Sayonara Player
LibraryContextMenu.h
1/* LibraryContextMenu.h */
2
3/* Copyright (C) 2011-2020 Michael Lugmair (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
30namespace Gui
31{
32 class ExtensionSet;
33 class PreferenceAction;
34}
35
36namespace Library
37{
44 public Gui::WidgetTemplate<QMenu>
45 {
46 Q_OBJECT
47 PIMPL(ContextMenu)
48
49 signals:
50 void sigInfoClicked();
51 void sigEditClicked();
52 void sigLyricsClicked();
53 void sigRemoveClicked();
54 void sigDeleteClicked();
55 void sigPlayClicked();
56 void sigPlayNewTabClicked();
57 void sigPlayNextClicked();
58 void sigAppendClicked();
59 void sigRefreshClicked();
60 void sigClearClicked();
61 void sigFilterTriggered(const QString& extension, bool b);
62 void sigReloadClicked();
63
64
65 public:
69 enum Entry
70 {
71 EntryNone = 0,
72 EntryInfo = (1<<0),
73 EntryEdit = (1<<1),
74 EntryLyrics = (1<<2),
75 EntryRemove = (1<<3),
76 EntryDelete = (1<<4),
77 EntryPlayNext = (1<<5),
78 EntryAppend = (1<<6),
79 EntryRefresh = (1<<7),
80 EntryClear = (1<<8),
81 EntryPlay = (1<<9),
82 EntryPlayNewTab = (1<<10),
83 EntryFilterExtension= (1<<11),
84 EntryReload = (1<<12),
85 EntryLast = (1<<13)
86 };
87
88 using Entries=uint64_t;
89
90
91 public:
92 explicit ContextMenu(QWidget* parent=nullptr);
93 virtual ~ContextMenu() override;
94
99 virtual ContextMenu::Entries entries() const;
100
105 virtual void showActions(ContextMenu::Entries entries);
106
112 virtual void showAction(ContextMenu::Entry entry, bool visible);
113
117 virtual void showAll();
118
119 QAction* action(ContextMenu::Entry entry) const;
120 QAction* actionAfter(ContextMenu::Entry entry) const;
121
122 QAction* addPreferenceAction(Gui::PreferenceAction* action);
123 QAction* beforePreferenceAction() const;
124
125 void setActionShortcut(ContextMenu::Entry entry, const QString& shortcut);
126
127 void setExtensions(const Gui::ExtensionSet& extensions);
128 void setSelectionCount(int selectionSount);
129
130 QKeySequence shortcut(ContextMenu::Entry entry) const;
131
132
133 private slots:
134 void showFilterExtensionBarChanged();
135 void showFilterExtensionBarTriggered(bool b);
136 void libraryViewTypeChanged();
137 void libraryViewTypeTriggered(bool b);
138 void shortcutChanged(ShortcutIdentifier identifier);
139 void skinTimerTimeout();
140
141
142 protected:
143 void skinChanged() override;
144 void languageChanged() override;
145 };
146}
147
148#endif // LIBRARYCONTEXTMENU_H
Collection of extensions. Handles extensions currently active or inactive and the extension toolbar.
Definition: ExtensionSet.h:33
A PreferenceAction can be added to each widget supporting QActions. When triggering this action,...
Definition: PreferenceAction.h:40
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition: WidgetTemplate.h:87
Context menu used for Library and playlist windows.
Definition: LibraryContextMenu.h:45
Entry
This enum indicates which entries should be visible.
Definition: LibraryContextMenu.h:70
virtual void showAction(ContextMenu::Entry entry, bool visible)
show/hide a specific Entry
virtual ContextMenu::Entries entries() const
get all visible entries
virtual void showAll()
show all possible entries
virtual void showActions(ContextMenu::Entries entries)
show a specific amount of Entries
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:31