void SpotifyService::EnsureMenuCreated() { if (context_menu_) return; context_menu_ = new QMenu; context_menu_->addAction(GetNewShowConfigAction()); playlist_context_menu_ = new QMenu; playlist_context_menu_->addActions(GetPlaylistActions()); playlist_context_menu_->addSeparator(); playlist_sync_action_ = playlist_context_menu_->addAction( IconLoader::Load("view-refresh", IconLoader::Base), tr("Make playlist available offline"), this, SLOT(SyncPlaylist())); get_url_to_share_playlist_ = playlist_context_menu_->addAction( tr("Get a URL to share this playlist"), this, SLOT(GetCurrentPlaylistUrlToShare())); playlist_context_menu_->addSeparator(); playlist_context_menu_->addAction(GetNewShowConfigAction()); song_context_menu_ = new QMenu; song_context_menu_->addActions(GetPlaylistActions()); song_context_menu_->addSeparator(); remove_from_playlist_ = song_context_menu_->addAction( IconLoader::Load("list-remove", IconLoader::Base), tr("Remove from playlist"), this, SLOT(RemoveCurrentFromPlaylist())); song_context_menu_->addAction(tr("Get a URL to share this Spotify song"), this, SLOT(GetCurrentSongUrlToShare())); song_context_menu_->addSeparator(); song_context_menu_->addAction(GetNewShowConfigAction()); }
void MagnatuneService::EnsureMenuCreated() { if (context_menu_) return; context_menu_ = new QMenu; context_menu_->addActions(GetPlaylistActions()); download_ = context_menu_->addAction(IconLoader::Load("download"), tr("Download this album"), this, SLOT(Download())); context_menu_->addSeparator(); context_menu_->addAction(IconLoader::Load("download"), tr("Open %1 in browser").arg("magnatune.com"), this, SLOT(Homepage())); context_menu_->addAction(IconLoader::Load("view-refresh"), tr("Refresh catalogue"), this, SLOT(ReloadDatabase())); QAction* config_action = context_menu_->addAction( IconLoader::Load("configure"), tr("Configure Magnatune..."), this, SLOT(ShowConfig())); library_filter_ = new LibraryFilterWidget(0); library_filter_->SetSettingsGroup(kSettingsGroup); library_filter_->SetLibraryModel(library_model_); library_filter_->SetFilterHint(tr("Search Magnatune")); library_filter_->SetAgeFilterEnabled(false); library_filter_->AddMenuAction(config_action); context_menu_->addSeparator(); context_menu_->addMenu(library_filter_->menu()); }
void GoogleDriveService::ShowContextMenu(const QPoint& global_pos) { if (!context_menu_) { context_menu_.reset(new QMenu); context_menu_->addActions(GetPlaylistActions()); open_in_drive_action_ = context_menu_->addAction( QIcon(":/providers/googledrive.png"), tr("Open in Google Drive"), this, SLOT(OpenWithDrive())); context_menu_->addSeparator(); context_menu_->addAction(IconLoader::Load("download"), tr("Cover Manager"), this, SLOT(ShowCoverManager())); context_menu_->addAction(IconLoader::Load("configure"), tr("Configure..."), this, SLOT(ShowSettingsDialog())); } // Only show some actions if there are real songs selected bool songs_selected = false; for (const QModelIndex& index : model()->selected_indexes()) { const int type = index.data(LibraryModel::Role_Type).toInt(); if (type == LibraryItem::Type_Song || type == LibraryItem::Type_Container) { songs_selected = true; break; } } open_in_drive_action_->setEnabled(songs_selected); context_menu_->popup(global_pos); }
void SavedRadio::ShowContextMenu(const QPoint& global_pos) { if (!context_menu_) { context_menu_ = new QMenu; context_menu_->addActions(GetPlaylistActions()); remove_action_ = context_menu_->addAction( IconLoader::Load("list-remove", IconLoader::Base), tr("Remove"), this, SLOT(Remove())); edit_action_ = context_menu_->addAction(IconLoader::Load("edit-rename", IconLoader::Base), tr("Edit..."), this, SLOT(Edit())); context_menu_->addSeparator(); context_menu_->addAction(IconLoader::Load("document-open-remote", IconLoader::Base), tr("Add another stream..."), this, SIGNAL(ShowAddStreamDialog())); } const bool is_root = model()->current_index().data(InternetModel::Role_Type).toInt() == InternetModel::Type_Service; GetAppendToPlaylistAction()->setEnabled(!is_root); GetReplacePlaylistAction()->setEnabled(!is_root); GetOpenInNewPlaylistAction()->setEnabled(!is_root); remove_action_->setEnabled(!is_root); edit_action_->setEnabled(!is_root); context_menu_->popup(global_pos); }
void SoundCloudService::EnsureMenuCreated() { if (!context_menu_) { context_menu_ = new QMenu; context_menu_->addActions(GetPlaylistActions()); context_menu_->addSeparator(); context_menu_->addAction(IconLoader::Load("download", IconLoader::Base), tr("Open %1 in browser").arg("soundcloud.com"), this, SLOT(Homepage())); } }
void SomaFMService::ShowContextMenu(const QPoint& global_pos) { if (!context_menu_) { context_menu_ = new QMenu; context_menu_->addActions(GetPlaylistActions()); context_menu_->addAction(IconLoader::Load("download"), tr("Open %1 in browser").arg("somafm.com"), this, SLOT(Homepage())); context_menu_->addAction(IconLoader::Load("view-refresh"), tr("Refresh channels"), this, SLOT(RefreshStreams())); } context_menu_->popup(global_pos); }
void CloudFileService::ShowContextMenu(const QPoint& global_pos) { if (!context_menu_) { context_menu_.reset(new QMenu); context_menu_->addActions(GetPlaylistActions()); context_menu_->addAction( IconLoader::Load("download"), tr("Cover Manager"), this, SLOT(ShowCoverManager())); } context_menu_->popup(global_pos); }
void CloudFileService::ShowContextMenu(const QPoint& global_pos) { if (!context_menu_) { context_menu_.reset(new QMenu); context_menu_->addActions(GetPlaylistActions()); context_menu_->addAction(IconLoader::Load("download", IconLoader::Base), tr("Cover Manager"), this, SLOT(ShowCoverManager())); context_menu_->addSeparator(); context_menu_->addAction(IconLoader::Load("configure", IconLoader::Base), tr("Configure..."), this, SLOT(ShowSettingsDialog())); } context_menu_->popup(global_pos); }
void DigitallyImportedServiceBase::ShowContextMenu(const QPoint& global_pos) { if (!context_menu_) { context_menu_.reset(new QMenu); context_menu_->addActions(GetPlaylistActions()); context_menu_->addAction(IconLoader::Load("download"), tr("Open %1 in browser").arg(homepage_url_.host()), this, SLOT(Homepage())); context_menu_->addAction(IconLoader::Load("view-refresh"), tr("Refresh streams"), this, SLOT(ForceRefreshStreams())); context_menu_->addSeparator(); context_menu_->addAction(IconLoader::Load("configure"), tr("Configure..."), this, SLOT(ShowSettingsDialog())); } context_menu_->popup(global_pos); }
void SomaFMServiceBase::ShowContextMenu(const QPoint& global_pos) { if (!context_menu_) { context_menu_ = new QMenu; context_menu_->addActions(GetPlaylistActions()); context_menu_->addAction(IconLoader::Load("download"), tr("Open %1 in browser").arg(homepage_url_.host()), this, SLOT(Homepage())); if (!donate_page_url_.isEmpty()) { context_menu_->addAction(IconLoader::Load("download"), tr("Donate"), this, SLOT(Donate())); } context_menu_->addAction(IconLoader::Load("view-refresh"), tr("Refresh channels"), this, SLOT(ForceRefreshStreams())); } context_menu_->popup(global_pos); }
SubsonicService::SubsonicService(Application* app, InternetModel* parent) : InternetService(kServiceName, app, parent, parent), network_(new QNetworkAccessManager(this)), url_handler_(new SubsonicUrlHandler(this, this)), scanner_(new SubsonicLibraryScanner(this, this)), load_database_task_id_(0), context_menu_(NULL), root_(NULL), library_backend_(NULL), library_model_(NULL), library_filter_(NULL), library_sort_model_(new QSortFilterProxyModel(this)), total_song_count_(0), login_state_(LoginState_OtherError), redirect_count_(0) { app_->player()->RegisterUrlHandler(url_handler_); connect(scanner_, SIGNAL(ScanFinished()), SLOT(ReloadDatabaseFinished())); library_backend_ = new LibraryBackend; library_backend_->moveToThread(app_->database()->thread()); library_backend_->Init(app_->database(), kSongsTable, QString::null, QString::null, kFtsTable); connect(library_backend_, SIGNAL(TotalSongCountUpdated(int)), SLOT(UpdateTotalSongCount(int))); library_model_ = new LibraryModel(library_backend_, app_, this); library_model_->set_show_various_artists(false); library_model_->set_show_smart_playlists(false); library_filter_ = new LibraryFilterWidget(0); library_filter_->SetSettingsGroup(kSettingsGroup); library_filter_->SetLibraryModel(library_model_); library_filter_->SetFilterHint(tr("Search Subsonic")); library_filter_->SetAgeFilterEnabled(false); library_sort_model_->setSourceModel(library_model_); library_sort_model_->setSortRole(LibraryModel::Role_SortText); library_sort_model_->setDynamicSortFilter(true); library_sort_model_->setSortLocaleAware(true); library_sort_model_->sort(0); connect(this, SIGNAL(LoginStateChanged(SubsonicService::LoginState)), SLOT(OnLoginStateChanged(SubsonicService::LoginState))); context_menu_ = new QMenu; context_menu_->addActions(GetPlaylistActions()); context_menu_->addSeparator(); context_menu_->addAction( IconLoader::Load("view-refresh"), tr("Refresh catalogue"), this, SLOT(ReloadDatabase())); QAction* config_action = context_menu_->addAction( IconLoader::Load("configure"), tr("Configure Subsonic..."), this, SLOT(ShowConfig())); context_menu_->addSeparator(); context_menu_->addMenu(library_filter_->menu()); library_filter_->AddMenuAction(config_action); app_->global_search()->AddProvider(new LibrarySearchProvider( library_backend_, tr("Subsonic"), "subsonic", QIcon(":/providers/subsonic.png"), true, app_, this)); }