Sayonara Player
Loading...
Searching...
No Matches
MenuToolButton.h
1/* MenuToolButton.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 MENUTOOL_H
22#define MENUTOOL_H
23
24#include "Utils/Pimpl.h"
25
26#include "Gui/Utils/Widgets/WidgetTemplate.h"
27#include "Gui/Utils/ContextMenu/ContextMenu.h"
28
29#include <QPushButton>
30
31namespace Gui
32{
33 class PreferenceAction;
34
36 public WidgetTemplate<QPushButton>
37 {
38 Q_OBJECT
39 PIMPL(MenuToolButton)
40
41 signals:
42 void sigApply();
43 void sigDefault();
44 void sigDelete();
45 void sigEdit();
46 void sigNew();
47 void sigOpen();
48 void sigRename();
49 void sigSave();
50 void sigSaveAs();
51 void sigUndo();
52
53 public:
54 explicit MenuToolButton(QWidget* parent);
55 ~MenuToolButton() override;
56
57 void registerAction(QAction* action);
58
59 void registerPreferenceAction(Gui::PreferenceAction* action);
60
61 [[nodiscard]] Gui::ContextMenuEntries entries() const;
62
63 void setOverrideText(bool b);
64
65 public slots: // NOLINT(*-redundant-access-specifiers)
66 void showAction(ContextMenu::Entry entry, bool visible);
67 void showActions(ContextMenuEntries options);
68 void showAll();
69
70 protected:
71 void languageChanged() override;
72 void skinChanged() override;
73
74 private slots:
75 void mouseReleaseEvent(QMouseEvent* e) override;
76
77 private: // NOLINT(*-redundant-access-specifiers)
78 bool proveEnabled();
79 };
80}
81
82#endif // MENUTOOL_H
Definition MenuToolButton.h:37
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:86