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 #include <QAction>
26 
27 #include "Helper/Settings/SayonaraClass.h"
28 
29 typedef int LibraryContexMenuEntries;
30 
36  public QMenu,
37  protected SayonaraClass
38 {
39  Q_OBJECT
40 
41 
42 public:
43  explicit LibraryContextMenu(QWidget *parent=nullptr);
44  virtual ~LibraryContextMenu();
45 
46 
50  enum Entry
51  {
52  EntryNone=0,
53  EntryInfo=(1<<0),
54  EntryEdit=(1<<1),
55  EntryLyrics=(1<<2),
56  EntryRemove=(1<<3),
57  EntryDelete=(1<<4),
58  EntryPlayNext=(1<<5),
59  EntryAppend=(1<<6),
60  EntryRefresh=(1<<7),
61  EntryClear=(1<<8),
62  EntryRating=(1<<9),
63  EntryLast=(1<<10)
64  };
65 
70  virtual LibraryContexMenuEntries get_entries() const;
71 
76  virtual void show_actions(LibraryContexMenuEntries entries);
77 
83  virtual void show_action(Entry entry, bool visible);
84 
88  virtual void show_all();
89 
94  void set_rating(int rating);
95 
96 
97 signals:
98  void sig_info_clicked();
99  void sig_edit_clicked();
100  void sig_lyrics_clicked();
101  void sig_remove_clicked();
102  void sig_delete_clicked();
103  void sig_play_next_clicked();
104  void sig_append_clicked();
105  void sig_refresh_clicked();
106  void sig_clear_clicked();
107  void sig_rating_changed(int rating);
108 
109 
110 private:
111  QAction* _info_action=nullptr;
112  QAction* _lyrics_action=nullptr;
113  QAction* _edit_action=nullptr;
114  QAction* _remove_action=nullptr;
115  QAction* _delete_action=nullptr;
116  QAction* _play_next_action=nullptr;
117  QAction* _append_action=nullptr;
118  QAction* _refresh_action=nullptr;
119  QAction* _clear_action=nullptr;
120 
121  QAction* _rating_action=nullptr;
122  QMenu* _rating_menu=nullptr;
123 
124 
125 protected:
126  QAction* init_rating_action(int rating);
127 
128 private slots:
129  void skin_changed();
130  void language_changed();
131 };
132 
133 #endif // LIBRARYCONTEXTMENU_H
Entry
This enum indicates which entries should be visible.
Definition: LibraryContextMenu.h:50
virtual void show_actions(LibraryContexMenuEntries entries)
show a specific amount of Entries
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:29
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:35
void set_rating(int rating)
set rating for the rating entry