1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2024-12-17 02:59:03 +01:00

Add configure internet service to menu

This commit is contained in:
Jonas Kvinge 2020-04-20 18:01:45 +02:00
parent c69fff52cc
commit ab2ffd9ac1
6 changed files with 33 additions and 9 deletions

View File

@ -82,8 +82,6 @@ InternetCollectionView::InternetCollectionView(QWidget *parent)
}
InternetCollectionView::~InternetCollectionView() {}
void InternetCollectionView::Init(Application *app, CollectionBackend *backend, CollectionModel *model, const bool favorite) {
app_ = app;
@ -98,7 +96,11 @@ void InternetCollectionView::Init(Application *app, CollectionBackend *backend,
}
void InternetCollectionView::SetFilter(CollectionFilterWidget *filter) { filter_ = filter; }
void InternetCollectionView::SetFilter(CollectionFilterWidget *filter) {
filter_ = filter;
}
void InternetCollectionView::ReloadSettings() {}
@ -319,6 +321,10 @@ void InternetCollectionView::contextMenuEvent(QContextMenuEvent *e) {
if (filter_) context_menu_->addMenu(filter_->menu());
context_menu_->addSeparator();
context_menu_->addAction(IconLoader::Load("configure"), tr("Configure %1...").arg(Song::TextForSource(collection_backend_->Source())), this, SLOT(OpenSettingsDialog()));
}
context_menu_index_ = indexAt(e->pos());

View File

@ -51,7 +51,6 @@ class InternetCollectionView : public AutoExpandingTreeView {
public:
explicit InternetCollectionView(QWidget *parent = nullptr);
~InternetCollectionView();
void Init(Application *app, CollectionBackend *backend, CollectionModel *model, const bool favorite = false);

View File

@ -28,8 +28,10 @@
#include <QLabel>
#include <QProgressBar>
#include <QPushButton>
#include <QAction>
#include "core/application.h"
#include "core/iconloader.h"
#include "collection/collectionbackend.h"
#include "collection/collectionmodel.h"
#include "collection/collectionfilterwidget.h"
@ -56,6 +58,10 @@ InternetSongsView::InternetSongsView(Application *app, InternetService *service,
ui_->filter->SetSettingsGroup(settings_group);
ui_->filter->SetCollectionModel(service_->songs_collection_model());
QAction *action_configure = new QAction(IconLoader::Load("configure"), tr("Configure %1...").arg(Song::TextForSource(service_->source())), this);
connect(action_configure, SIGNAL(triggered()), SLOT(OpenSettingsDialog()));
ui_->filter->AddMenuAction(action_configure);
connect(ui_->view, SIGNAL(GetSongs()), SLOT(GetSongs()));
connect(ui_->view, SIGNAL(RemoveSongs(SongList)), service_, SIGNAL(RemoveSongs(SongList)));
@ -81,7 +87,10 @@ InternetSongsView::~InternetSongsView() { delete ui_; }
void InternetSongsView::ReloadSettings() {}
void InternetSongsView::contextMenuEvent(QContextMenuEvent *e) { Q_UNUSED(e); }
void InternetSongsView::OpenSettingsDialog() {
app_->OpenSettingsDialogAtPage(service_->settings_page());
}
void InternetSongsView::GetSongs() {

View File

@ -48,7 +48,7 @@ class InternetSongsView : public QWidget {
InternetCollectionView *view() const { return ui_->view; }
private slots:
void contextMenuEvent(QContextMenuEvent *e);
void OpenSettingsDialog();
void GetSongs();
void AbortGetSongs();
void SongsFinished(const SongList &songs, const QString &error);

View File

@ -30,9 +30,11 @@
#include <QTabWidget>
#include <QStackedWidget>
#include <QContextMenuEvent>
#include <QAction>
#include <QSettings>
#include "core/application.h"
#include "core/iconloader.h"
#include "collection/collectionbackend.h"
#include "collection/collectionmodel.h"
#include "collection/collectionfilterwidget.h"
@ -58,6 +60,9 @@ InternetTabsView::InternetTabsView(Application *app, InternetService *service, c
connect(ui_->search_view, SIGNAL(AddAlbumsSignal(SongList)), service_, SIGNAL(AddAlbums(SongList)));
connect(ui_->search_view, SIGNAL(AddSongsSignal(SongList)), service_, SIGNAL(AddSongs(SongList)));
QAction *action_configure = new QAction(IconLoader::Load("configure"), tr("Configure %1...").arg(Song::TextForSource(service_->source())), this);
connect(action_configure, SIGNAL(triggered()), SLOT(OpenSettingsDialog()));
if (service_->artists_collection_model()) {
ui_->artists_collection->stacked()->setCurrentWidget(ui_->artists_collection->internetcollection_page());
ui_->artists_collection->view()->Init(app_, service_->artists_collection_backend(), service_->artists_collection_model(), true);
@ -66,6 +71,7 @@ InternetTabsView::InternetTabsView(Application *app, InternetService *service, c
ui_->artists_collection->filter()->SetSettingsGroup(settings_group);
ui_->artists_collection->filter()->SetSettingsPrefix("artists");
ui_->artists_collection->filter()->SetCollectionModel(service_->artists_collection_model());
ui_->artists_collection->filter()->AddMenuAction(action_configure);
connect(ui_->artists_collection->view(), SIGNAL(GetSongs()), SLOT(GetArtists()));
connect(ui_->artists_collection->view(), SIGNAL(RemoveSongs(SongList)), service_, SIGNAL(RemoveArtists(SongList)));
@ -97,6 +103,7 @@ InternetTabsView::InternetTabsView(Application *app, InternetService *service, c
ui_->albums_collection->filter()->SetSettingsGroup(settings_group);
ui_->albums_collection->filter()->SetSettingsPrefix("albums");
ui_->albums_collection->filter()->SetCollectionModel(service_->albums_collection_model());
ui_->albums_collection->filter()->AddMenuAction(action_configure);
connect(ui_->albums_collection->view(), SIGNAL(GetSongs()), SLOT(GetAlbums()));
connect(ui_->albums_collection->view(), SIGNAL(RemoveSongs(SongList)), service_, SIGNAL(RemoveAlbums(SongList)));
@ -128,6 +135,7 @@ InternetTabsView::InternetTabsView(Application *app, InternetService *service, c
ui_->songs_collection->filter()->SetSettingsGroup(settings_group);
ui_->songs_collection->filter()->SetSettingsPrefix("songs");
ui_->songs_collection->filter()->SetCollectionModel(service_->songs_collection_model());
ui_->songs_collection->filter()->AddMenuAction(action_configure);
connect(ui_->songs_collection->view(), SIGNAL(GetSongs()), SLOT(GetSongs()));
connect(ui_->songs_collection->view(), SIGNAL(RemoveSongs(SongList)), service_, SIGNAL(RemoveSongs(SongList)));
@ -185,8 +193,6 @@ InternetTabsView::~InternetTabsView() {
void InternetTabsView::ReloadSettings() { ui_->search_view->ReloadSettings(); }
void InternetTabsView::contextMenuEvent(QContextMenuEvent *e) { Q_UNUSED(e); }
void InternetTabsView::GetArtists() {
if (!service_->authenticated() && service_->oauth()) {
@ -315,3 +321,7 @@ void InternetTabsView::SongsFinished(const SongList &songs, const QString &error
}
}
void InternetTabsView::OpenSettingsDialog() {
app_->OpenSettingsDialogAtPage(service_->settings_page());
}

View File

@ -53,7 +53,7 @@ class InternetTabsView : public QWidget {
InternetSearchView *search_view() const { return ui_->search_view; }
private slots:
void contextMenuEvent(QContextMenuEvent *e);
void OpenSettingsDialog();
void GetArtists();
void GetAlbums();
void GetSongs();