void PluginArtistWindow::loadBaseUi() { setWindowTitle(tr("Artist")); setCentralWidget(new QWidget); m_view->setModel(m_model); m_view->setItemDelegate(new NavDelegate(m_view)); m_avatar->setFixedSize(100, 100); m_avatar->setFallbackSource(QUrl::fromLocalFile("/usr/share/icons/hicolor/96x96/hildon/general_default_avatar.png")); m_titleLabel->setWordWrap(true); QWidget *scrollWidget = new QWidget(m_scrollArea); QVBoxLayout *vbox = new QVBoxLayout(scrollWidget); vbox->addWidget(m_avatar, Qt::AlignLeft); vbox->addWidget(m_titleLabel, Qt::AlignLeft | Qt::AlignTop); vbox->addWidget(m_descriptionLabel, Qt::AlignTop); vbox->setStretch(2, 1); vbox->setContentsMargins(0, 0, 0, 0); m_scrollArea->setWidget(scrollWidget); m_scrollArea->setWidgetResizable(true); m_scrollArea->setFixedWidth(410); m_layout = new QHBoxLayout(centralWidget()); m_layout->addWidget(m_scrollArea); m_layout->addWidget(m_view); m_layout->setStretch(1, 1); m_layout->setContentsMargins(0, 0, 0, 0); menuBar()->addAction(m_nowPlayingAction); connect(m_view, SIGNAL(activated(QModelIndex)), this, SLOT(showWindow(QModelIndex))); connect(m_descriptionLabel, SIGNAL(anchorClicked(QUrl)), this, SLOT(showResource(QUrl))); }
bool DBusService::showResource(const QStringList &url) { if (!url.isEmpty()) { return showResource(url.first()); } return false; }
bool MainWindow::showResource(const QString &url) { const QVariantMap resource = Resources::getResourceFromUrl(url); if (resource.isEmpty()) { return false; } return showResource(resource); }
void PluginView::showSearchDialog() { PluginSearchDialog dialog(m_model->service(), StackedWindow::currentWindow()); if (dialog.exec() == QDialog::Accepted) { const QVariantMap resource = Resources::getResourceFromUrl(dialog.query()); if (resource.value("service") == m_model->service()) { showResource(resource.value("type").toString(), resource.value("id").toString()); } else { search(dialog.query(), dialog.type(), dialog.order()); } } }
void VimeoUserWindow::loadBaseUi() { setWindowTitle(tr("User")); setCentralWidget(new QWidget); m_view->setModel(m_model); m_view->setItemDelegate(new NavDelegate(m_view)); m_avatar->setFixedSize(100, 100); m_statsLabel->setStyleSheet("font-size: 18px"); m_subscribeButton->setEnabled(false); QWidget *scrollWidget = new QWidget(m_scrollArea); QGridLayout *grid = new QGridLayout(scrollWidget); grid->addWidget(m_avatar, 0, 0, Qt::AlignLeft); grid->addWidget(m_titleLabel, 1, 0, Qt::AlignLeft | Qt::AlignTop); grid->addWidget(m_statsLabel, 1, 1, Qt::AlignRight | Qt::AlignTop); grid->addWidget(m_subscribeButton, 2, 0, Qt::AlignLeft); grid->addWidget(m_descriptionLabel, 3, 0, 1, 2, Qt::AlignTop); grid->setRowStretch(3, 1); grid->setColumnStretch(0, 1); grid->setContentsMargins(0, 0, 0, 0); m_scrollArea->setWidget(scrollWidget); m_scrollArea->setWidgetResizable(true); m_scrollArea->setFixedWidth(410); m_layout = new QHBoxLayout(centralWidget()); m_layout->addWidget(m_scrollArea); m_layout->addWidget(m_view); m_layout->setStretch(1, 1); m_layout->setContentsMargins(0, 0, 0, 0); connect(m_view, SIGNAL(activated(QModelIndex)), this, SLOT(showWindow(QModelIndex))); connect(m_descriptionLabel, SIGNAL(anchorClicked(QUrl)), this, SLOT(showResource(QUrl))); connect(m_subscribeButton, SIGNAL(clicked()), this, SLOT(setUserSubscription())); }
void SoundCloudPlaylistWindow::loadBaseUi() { setWindowTitle(tr("Set")); setCentralWidget(new QWidget); m_view->setModel(m_model); m_view->setItemDelegate(m_delegate); m_view->setContextMenuPolicy(Qt::CustomContextMenu); m_thumbnail->setFixedSize(320, 320); m_thumbnail->setFallbackSource(QUrl::fromLocalFile("/usr/share/icons/hicolor/295x295/hildon/mediaplayer_default_album.png")); m_avatar->setFixedSize(60, 60); m_avatar->setFallbackSource(QUrl::fromLocalFile("/usr/share/icons/hicolor/64x64/hildon/general_default_avatar.png")); m_titleLabel->setWordWrap(true); m_dateLabel->setStyleSheet(QString("color: %1; font-size: 13pt").arg(palette().color(QPalette::Mid).name())); m_artistLabel->setStyleSheet("font-size: 13pt"); m_noTracksLabel->hide(); m_reloadAction->setEnabled(false); m_contextMenu->addAction(m_queueAction); m_contextMenu->addAction(m_downloadAction); m_contextMenu->addAction(m_shareAction); QWidget *scrollWidget = new QWidget(m_scrollArea); QGridLayout *grid = new QGridLayout(scrollWidget); grid->addWidget(m_thumbnail, 0, 0, 1, 2, Qt::AlignLeft); grid->addWidget(m_titleLabel, 1, 0, 1, 2); grid->addWidget(m_avatar, 2, 0, 2, 1, Qt::AlignLeft); grid->addWidget(m_artistLabel, 2, 1, Qt::AlignLeft | Qt::AlignTop); grid->addWidget(m_dateLabel, 3, 1, Qt::AlignLeft | Qt::AlignBottom); grid->addWidget(m_descriptionLabel, 4, 0, 1, 2); grid->setRowStretch(4, 1); grid->setColumnStretch(1, 1); grid->setContentsMargins(0, 0, 0, 0); m_scrollArea->setWidget(scrollWidget); m_scrollArea->setWidgetResizable(true); m_scrollArea->setFixedWidth(330); m_layout = new QHBoxLayout(centralWidget()); m_layout->addWidget(m_scrollArea); m_layout->addWidget(m_view); m_layout->addWidget(m_noTracksLabel); m_layout->setStretch(1, 1); m_layout->setStretch(2, 1); m_layout->setContentsMargins(0, 0, 0, 0); menuBar()->addAction(m_reloadAction); menuBar()->addAction(m_queuePlaylistAction); menuBar()->addAction(m_nowPlayingAction); connect(m_model, SIGNAL(statusChanged(QSoundCloud::ResourcesRequest::Status)), this, SLOT(onModelStatusChanged(QSoundCloud::ResourcesRequest::Status))); connect(m_cache, SIGNAL(imageReady()), this, SLOT(onImageReady())); connect(m_view, SIGNAL(activated(QModelIndex)), this, SLOT(showTrack(QModelIndex))); connect(m_view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); connect(m_thumbnail, SIGNAL(clicked()), this, SLOT(playPlaylist())); connect(m_delegate, SIGNAL(thumbnailClicked(QModelIndex)), this, SLOT(playTrack(QModelIndex))); connect(m_reloadAction, SIGNAL(triggered()), m_model, SLOT(reload())); connect(m_queuePlaylistAction, SIGNAL(triggered()), this, SLOT(queuePlaylist())); connect(m_avatar, SIGNAL(clicked()), this, SLOT(showArtist())); connect(m_descriptionLabel, SIGNAL(anchorClicked(QUrl)), this, SLOT(showResource(QUrl))); connect(m_queueAction, SIGNAL(triggered()), this, SLOT(queueTrack())); connect(m_downloadAction, SIGNAL(triggered()), this, SLOT(downloadTrack())); connect(m_shareAction, SIGNAL(triggered()), this, SLOT(shareTrack())); if (!SoundCloud::instance()->userId().isEmpty()) { m_favouriteAction = new QAction(this); m_contextMenu->addAction(m_favouriteAction); connect(m_favouriteAction, SIGNAL(triggered()), this, SLOT(setTrackFavourite())); } }