Sayonara Player
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Gui
Utils
ContextMenu
ContextMenu.h
1
/* ContextMenu.h */
2
3
/* Copyright (C) 2011-2024 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 CONTEXTMENU_H
22
#define CONTEXTMENU_H
23
24
#include "Gui/Utils/Widgets/WidgetTemplate.h"
25
#include "Utils/Pimpl.h"
26
27
#include <QMenu>
28
29
namespace
Gui
30
{
31
class
PreferenceAction
;
32
using
ContextMenuEntries = uint16_t;
33
34
class
ContextMenu :
35
public
Gui::WidgetTemplate
<QMenu>
36
{
37
Q_OBJECT
38
PIMPL(ContextMenu)
39
40
public
:
41
enum
Entry
42
{
43
EntryNone = 0,
44
EntryNew = (1 << 0),
45
EntryEdit = (1 << 1),
46
EntryUndo = (1 << 2),
47
EntrySave = (1 << 3),
48
EntrySaveAs = (1 << 4),
49
EntryRename = (1 << 5),
50
EntryDelete = (1 << 6),
51
EntryOpen = (1 << 7),
52
EntryDefault = (1 << 8),
53
EntryApply = (1 << 9)
54
};
55
56
signals:
57
void
sigApply();
58
void
sigDefault();
59
void
sigDelete();
60
void
sigEdit();
61
void
sigNew();
62
void
sigOpen();
63
void
sigRename();
64
void
sigSave();
65
void
sigSaveAs();
66
void
sigUndo();
67
68
// private:
69
// void showAction(bool b, QAction* action);
70
71
public
:
72
explicit
ContextMenu(QWidget* parent =
nullptr
);
73
~ContextMenu()
override
;
74
75
void
registerAction(QAction* action);
76
bool
hasActions();
77
78
[[nodiscard]] ContextMenuEntries entries()
const
;
79
80
protected
:
81
void
showEvent(QShowEvent* e)
override
;
82
void
languageChanged()
override
;
83
void
skinChanged()
override
;
84
85
public
slots:
86
void
showActions(ContextMenuEntries entries);
87
void
showAction(ContextMenu::Entry entry,
bool
visible);
88
void
showAll();
89
90
void
addPreferenceAction(
PreferenceAction
* action);
91
92
private
slots:
93
void
timedOut();
94
};
95
}
96
97
#endif
// CONTEXTMENU_H
Gui::PreferenceAction
A PreferenceAction can be added to each widget supporting QActions. When triggering this action,...
Definition
PreferenceAction.h:40
Gui::WidgetTemplate
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition
WidgetTemplate.h:86
Generated on
for Sayonara Player by
1.17.0