Sayonara Player
LibraryContextMenu.h
1 /* LibraryContextMenu.h */
2 
3 /* Copyright (C) 2011-2019 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 "Gui/Utils/Widgets/WidgetTemplate.h"
25 #include "Gui/Utils/Shortcuts/ShortcutIdentifier.h"
26 #include "Utils/Pimpl.h"
27 
28 #include <QMenu>
29 
30 class ExtensionSet;
31 class PreferenceAction;
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  EntryCoverView=(1<<9),
59  EntryPlay=(1<<10),
60  EntryPlayNewTab=(1<<11),
61  EntryFilterExtension=(1<<12),
62  EntryReload=(1<<13),
63  EntryLast=(1<<14)
64  };
65 
66  using Entries=uint64_t;
67 
68 public:
69  explicit LibraryContextMenu(QWidget *parent=nullptr);
70  virtual ~LibraryContextMenu();
71 
72 
77  virtual LibraryContextMenu::Entries get_entries() const;
78 
83  virtual void show_actions(LibraryContextMenu::Entries entries);
84 
90  virtual void show_action(LibraryContextMenu::Entry entry, bool visible);
91 
95  virtual void show_all();
96 
97  QAction* get_action(LibraryContextMenu::Entry entry) const;
98  QAction* get_action_after(LibraryContextMenu::Entry entry) const;
99 
100  QAction* add_preference_action(PreferenceAction* action);
101  QAction* before_preference_action() const;
102 
103  void set_action_shortcut(LibraryContextMenu::Entry entry, const QString& shortcut);
104 
105  void set_extensions(const ExtensionSet& extensions);
106 
107 
108 signals:
109  void sig_info_clicked();
110  void sig_edit_clicked();
111  void sig_lyrics_clicked();
112  void sig_remove_clicked();
113  void sig_delete_clicked();
114  void sig_play_clicked();
115  void sig_play_new_tab_clicked();
116  void sig_play_next_clicked();
117  void sig_append_clicked();
118  void sig_refresh_clicked();
119  void sig_clear_clicked();
120  void sig_filter_triggered(const QString& extension, bool b);
121  void sig_reload_clicked();
122 
123 private slots:
124  void show_cover_view_changed();
125  void show_filter_ext_bar_changed();
126  void show_cover_triggered(bool b);
127  void shortcut_changed(ShortcutIdentifier identifier);
128  void show_filter_extension_bar_triggered(bool b);
129 
130 
131 protected:
132  void skin_changed() override;
133  void language_changed() override;
134 };
135 
136 #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:76
virtual LibraryContextMenu::Entries get_entries() const
get all visible entries
Definition: ExtensionSet.h:28
virtual void show_actions(LibraryContextMenu::Entries entries)
show a specific amount of Entries
Definition: PreferenceAction.h:29
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