Disable remove favorites from context menu in internetsongsview
This commit is contained in:
parent
4f2b04bd8f
commit
033300d659
|
@ -51,11 +51,18 @@ InternetCollectionView::InternetCollectionView(QWidget *parent)
|
|||
collection_backend_(nullptr),
|
||||
collection_model_(nullptr),
|
||||
filter_(nullptr),
|
||||
favorite_(false),
|
||||
total_song_count_(0),
|
||||
total_artist_count_(0),
|
||||
total_album_count_(0),
|
||||
nomusic_(":/pictures/nomusic.png"),
|
||||
context_menu_(nullptr),
|
||||
load_(nullptr),
|
||||
add_to_playlist_(nullptr),
|
||||
add_to_playlist_enqueue_(nullptr),
|
||||
add_to_playlist_enqueue_next_(nullptr),
|
||||
open_in_new_playlist_(nullptr),
|
||||
remove_songs_(nullptr),
|
||||
is_in_keyboard_search_(false)
|
||||
{
|
||||
|
||||
|
@ -74,11 +81,12 @@ InternetCollectionView::InternetCollectionView(QWidget *parent)
|
|||
|
||||
InternetCollectionView::~InternetCollectionView() {}
|
||||
|
||||
void InternetCollectionView::Init(Application *app, CollectionBackend *backend, CollectionModel *model) {
|
||||
void InternetCollectionView::Init(Application *app, CollectionBackend *backend, CollectionModel *model, const bool favorite) {
|
||||
|
||||
app_ = app;
|
||||
collection_backend_ = backend;
|
||||
collection_model_ = model;
|
||||
favorite_ = favorite;
|
||||
|
||||
collection_model_->set_pretty_covers(true);
|
||||
collection_model_->set_show_dividers(true);
|
||||
|
@ -301,8 +309,10 @@ void InternetCollectionView::contextMenuEvent(QContextMenuEvent *e) {
|
|||
|
||||
context_menu_->addSeparator();
|
||||
|
||||
remove_songs_ = context_menu_->addAction(IconLoader::Load("edit-delete"), tr("Remove from favorites"), this, SLOT(RemoveSongs()));
|
||||
context_menu_->addSeparator();
|
||||
if (favorite_) {
|
||||
remove_songs_ = context_menu_->addAction(IconLoader::Load("edit-delete"), tr("Remove from favorites"), this, SLOT(RemoveSongs()));
|
||||
context_menu_->addSeparator();
|
||||
}
|
||||
|
||||
if (filter_) context_menu_->addMenu(filter_->menu());
|
||||
|
||||
|
@ -320,7 +330,7 @@ void InternetCollectionView::contextMenuEvent(QContextMenuEvent *e) {
|
|||
add_to_playlist_->setEnabled(songs_selected);
|
||||
open_in_new_playlist_->setEnabled(songs_selected);
|
||||
add_to_playlist_enqueue_->setEnabled(songs_selected);
|
||||
remove_songs_->setEnabled(songs_selected);
|
||||
if (remove_songs_) remove_songs_->setEnabled(songs_selected);
|
||||
|
||||
context_menu_->popup(e->globalPos());
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class InternetCollectionView : public AutoExpandingTreeView {
|
|||
InternetCollectionView(QWidget *parent = nullptr);
|
||||
~InternetCollectionView();
|
||||
|
||||
void Init(Application *app, CollectionBackend *backend, CollectionModel *model);
|
||||
void Init(Application *app, CollectionBackend *backend, CollectionModel *model, const bool favorite = false);
|
||||
|
||||
// Returns Songs currently selected in the collection view.
|
||||
// Please note that the selection is recursive meaning that if for example an album is selected this will return all of it's songs.
|
||||
|
@ -115,6 +115,7 @@ class InternetCollectionView : public AutoExpandingTreeView {
|
|||
CollectionBackend *collection_backend_;
|
||||
CollectionModel*collection_model_;
|
||||
CollectionFilterWidget *filter_;
|
||||
bool favorite_;
|
||||
|
||||
int total_song_count_;
|
||||
int total_artist_count_;
|
||||
|
|
|
@ -45,7 +45,7 @@ InternetSongsView::InternetSongsView(Application *app, InternetService *service,
|
|||
ui_->setupUi(this);
|
||||
|
||||
ui_->stacked->setCurrentWidget(ui_->internetcollection_page);
|
||||
ui_->view->Init(app_, service_->songs_collection_backend(), service_->songs_collection_model());
|
||||
ui_->view->Init(app_, service_->songs_collection_backend(), service_->songs_collection_model(), false);
|
||||
ui_->view->setModel(service_->songs_collection_sort_model());
|
||||
ui_->view->SetFilter(ui_->filter);
|
||||
ui_->filter->SetSettingsGroup(settings_group);
|
||||
|
|
|
@ -52,7 +52,7 @@ InternetTabsView::InternetTabsView(Application *app, InternetService *service, I
|
|||
|
||||
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());
|
||||
ui_->artists_collection->view()->Init(app_, service_->artists_collection_backend(), service_->artists_collection_model(), true);
|
||||
ui_->artists_collection->view()->setModel(service_->artists_collection_sort_model());
|
||||
ui_->artists_collection->view()->SetFilter(ui_->artists_collection->filter());
|
||||
ui_->artists_collection->filter()->SetSettingsGroup(settings_group);
|
||||
|
@ -84,7 +84,7 @@ InternetTabsView::InternetTabsView(Application *app, InternetService *service, I
|
|||
|
||||
if (service_->albums_collection_model()) {
|
||||
ui_->albums_collection->stacked()->setCurrentWidget(ui_->albums_collection->internetcollection_page());
|
||||
ui_->albums_collection->view()->Init(app_, service_->albums_collection_backend(), service_->albums_collection_model());
|
||||
ui_->albums_collection->view()->Init(app_, service_->albums_collection_backend(), service_->albums_collection_model(), true);
|
||||
ui_->albums_collection->view()->setModel(service_->albums_collection_sort_model());
|
||||
ui_->albums_collection->view()->SetFilter(ui_->albums_collection->filter());
|
||||
ui_->albums_collection->filter()->SetSettingsGroup(settings_group);
|
||||
|
@ -116,7 +116,7 @@ InternetTabsView::InternetTabsView(Application *app, InternetService *service, I
|
|||
|
||||
if (service_->songs_collection_model()) {
|
||||
ui_->songs_collection->stacked()->setCurrentWidget(ui_->songs_collection->internetcollection_page());
|
||||
ui_->songs_collection->view()->Init(app_, service_->songs_collection_backend(), service_->songs_collection_model());
|
||||
ui_->songs_collection->view()->Init(app_, service_->songs_collection_backend(), service_->songs_collection_model(), true);
|
||||
ui_->songs_collection->view()->setModel(service_->songs_collection_sort_model());
|
||||
ui_->songs_collection->view()->SetFilter(ui_->songs_collection->filter());
|
||||
ui_->songs_collection->filter()->SetSettingsGroup(settings_group);
|
||||
|
|
Loading…
Reference in New Issue