Sayonara Player
LibraryContextMenu.h
1 /* LibraryContextMenu.h */
2 
3 /* Copyright (C) 2011-2016 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 
22 
23 #ifndef LIBRARYCONTEXTMENU_H
24 #define LIBRARYCONTEXTMENU_H
25 
26 #include <QMenu>
27 #include <QAction>
28 #include <QEvent>
29 #include "Helper/Settings/SayonaraClass.h"
30 
31 typedef int LibraryContexMenuEntries;
32 
38  public QMenu,
39  protected SayonaraClass
40 {
41  Q_OBJECT
42 
43 
44 public:
45  explicit LibraryContextMenu(QWidget *parent=nullptr);
46  virtual ~LibraryContextMenu();
47 
48 
52  enum Entry {
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  EntryLast=(1<<10)
65  };
66 
71  virtual LibraryContexMenuEntries get_entries() const;
72 
77  virtual void show_actions(LibraryContexMenuEntries entries);
78 
84  virtual void show_action(Entry entry, bool visible);
85 
89  virtual void show_all();
90 
95  void set_rating(int rating);
96 
97 
98 signals:
99  void sig_info_clicked();
100  void sig_edit_clicked();
101  void sig_lyrics_clicked();
102  void sig_remove_clicked();
103  void sig_delete_clicked();
104  void sig_play_next_clicked();
105  void sig_append_clicked();
106  void sig_refresh_clicked();
107  void sig_clear_clicked();
108  void sig_rating_changed(int rating);
109 
110 
111 private:
112  QAction* _info_action=nullptr;
113  QAction* _lyrics_action=nullptr;
114  QAction* _edit_action=nullptr;
115  QAction* _remove_action=nullptr;
116  QAction* _delete_action=nullptr;
117  QAction* _play_next_action=nullptr;
118  QAction* _append_action=nullptr;
119  QAction* _refresh_action=nullptr;
120  QAction* _clear_action=nullptr;
121 
122  QAction* _rating_action=nullptr;
123  QMenu* _rating_menu=nullptr;
124 
125 
126 protected:
127  void changeEvent(QEvent* e) override;
128  QAction* init_rating_action(int rating);
129 
130  QString rating_text();
131 
132 private slots:
133  void skin_changed();
134 };
135 
136 
137 #endif // LIBRARYCONTEXTMENU_H
Entry
This enum indicates which entries should be visible.
Definition: LibraryContextMenu.h:52
virtual void show_actions(LibraryContexMenuEntries entries)
show a specific amount of Entries
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:31
virtual void show_action(Entry entry, bool visible)
show/hide a specific Entry
virtual LibraryContexMenuEntries get_entries() const
get all visible entries
virtual void show_all()
show all possible entries
Context menu used for Library and playlist windows.
Definition: LibraryContextMenu.h:37
void set_rating(int rating)
set rating for the rating entry