Sayonara Player
LibraryContextMenu.h
1 /* LibraryContextMenu.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef LIBRARYCONTEXTMENU_H
22 #define LIBRARYCONTEXTMENU_H
23 
24 #include <QMenu>
25 
26 #include "GUI/Utils/Widgets/WidgetTemplate.h"
27 #include "GUI/Utils/Shortcuts/ShortcutIdentifier.h"
28 #include "Utils/Pimpl.h"
29 
30 class PreferenceAction;
31 class QAction;
37  public Gui::WidgetTemplate<QMenu>
38 {
39  Q_OBJECT
40  PIMPL(LibraryContextMenu)
41 
42 public:
46  enum Entry
47  {
48  EntryNone=0,
49  EntryInfo=(1<<0),
50  EntryEdit=(1<<1),
51  EntryLyrics=(1<<2),
52  EntryRemove=(1<<3),
53  EntryDelete=(1<<4),
54  EntryPlayNext=(1<<5),
55  EntryAppend=(1<<6),
56  EntryRefresh=(1<<7),
57  EntryClear=(1<<8),
58  EntryClearSelection=(1<<9),
59  EntryCoverView=(1<<10),
60  EntryPlay=(1<<11),
61  EntryPlayNewTab=(1<<12),
62  EntryLast=(1<<13)
63  };
64 
65  using Entries=uint64_t;
66 
67 public:
68  explicit LibraryContextMenu(QWidget *parent=nullptr);
69  virtual ~LibraryContextMenu();
70 
71 
76  virtual LibraryContextMenu::Entries get_entries() const;
77 
82  virtual void show_actions(LibraryContextMenu::Entries entries);
83 
89  virtual void show_action(LibraryContextMenu::Entry entry, bool visible);
90 
94  virtual void show_all();
95 
96  QAction* get_action(LibraryContextMenu::Entry entry) const;
97 
98  QAction* add_preference_action(PreferenceAction* action);
99  QAction* before_preference_action() const;
100 
101  void set_action_shortcut(LibraryContextMenu::Entry entry, const QString& shortcut);
102 
103 
104 signals:
105  void sig_info_clicked();
106  void sig_edit_clicked();
107  void sig_lyrics_clicked();
108  void sig_remove_clicked();
109  void sig_delete_clicked();
110  void sig_play_clicked();
111  void sig_play_new_tab_clicked();
112  void sig_play_next_clicked();
113  void sig_append_clicked();
114  void sig_refresh_clicked();
115  void sig_clear_clicked();
116  void sig_clear_selection_clicked();
117 
118 
119 private slots:
120  void show_cover_view_changed();
121  void show_cover_triggered(bool b);
122  void shortcut_changed(ShortcutIdentifier identifier);
123 
124 
125 protected:
126  void skin_changed() override;
127  void language_changed() override;
128 };
129 
130 #endif // LIBRARYCONTEXTMENU_H
Entry
This enum indicates which entries should be visible.
Definition: LibraryContextMenu.h:46
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings...
Definition: WidgetTemplate.h:47
virtual LibraryContextMenu::Entries get_entries() const
get all visible entries
virtual void show_actions(LibraryContextMenu::Entries entries)
show a specific amount of Entries
Definition: PreferenceAction.h:35
virtual void show_all()
show all possible entries
virtual void show_action(LibraryContextMenu::Entry entry, bool visible)
show/hide a specific Entry
Context menu used for Library and playlist windows.
Definition: LibraryContextMenu.h:36