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 "Utils/Pimpl.h"
28 
29 using LibraryContexMenuEntries=int;
30 
31 class PreferenceAction;
32 class QAction;
38  public Gui::WidgetTemplate<QMenu>
39 {
40  Q_OBJECT
41  PIMPL(LibraryContextMenu)
42 
43 public:
44  explicit LibraryContextMenu(QWidget *parent=nullptr);
45  virtual ~LibraryContextMenu();
46 
47 
51  enum Entry
52  {
53  EntryNone=0,
54  EntryInfo=(1<<0),
55  EntryEdit=(1<<1),
56  EntryLyrics=(1<<2),
57  EntryRemove=(1<<3),
58  EntryDelete=(1<<4),
59  EntryPlayNext=(1<<5),
60  EntryAppend=(1<<6),
61  EntryRefresh=(1<<7),
62  EntryClear=(1<<8),
63  EntryRating=(1<<9),
64  EntryClearSelection=(1<<10),
65  EntryCoverView=(1<<11),
66  EntryPlay=(1<<12),
67  EntryPlayNewTab=(1<<13),
68  EntryLast=(1<<14)
69  };
70 
75  virtual LibraryContexMenuEntries get_entries() const;
76 
81  virtual void show_actions(LibraryContexMenuEntries entries);
82 
88  virtual void show_action(Entry entry, bool visible);
89 
93  virtual void show_all();
94 
99  void set_rating(int rating);
100 
101  QAction* get_action(Entry entry) const;
102 
103  QAction* add_preference_action(PreferenceAction* action);
104 
105 
106 signals:
107  void sig_info_clicked();
108  void sig_edit_clicked();
109  void sig_lyrics_clicked();
110  void sig_remove_clicked();
111  void sig_delete_clicked();
112  void sig_play_clicked();
113  void sig_play_new_tab_clicked();
114  void sig_play_next_clicked();
115  void sig_append_clicked();
116  void sig_refresh_clicked();
117  void sig_clear_clicked();
118  void sig_rating_changed(int rating);
119  void sig_clear_selection_clicked();
120 
121 
122 private slots:
123  void show_covers_changed();
124  void cover_view_action_triggered();
125 
126 protected:
127  QAction* init_rating_action(int rating);
128 
129  void skin_changed() override;
130  void language_changed() override;
131 
132 
133 };
134 
135 #endif // LIBRARYCONTEXTMENU_H
Entry
This enum indicates which entries should be visible.
Definition: LibraryContextMenu.h:51
virtual void show_actions(LibraryContexMenuEntries entries)
show a specific amount of Entries
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings...
Definition: WidgetTemplate.h:47
virtual void show_action(Entry entry, bool visible)
show/hide a specific Entry
Definition: PreferenceAction.h:33
virtual void show_all()
show all possible entries
virtual LibraryContexMenuEntries get_entries() const
get all visible entries
Context menu used for Library and playlist windows.
Definition: LibraryContextMenu.h:37
void set_rating(int rating)
set rating for the rating entry