Sayonara Player
GUI_PreferenceDialog.h
1 /* GUI_PreferenceDialog.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 GUI_PreferenceDialog_H
22 #define GUI_PreferenceDialog_H
23 
24 #include "Utils/Pimpl.h"
25 #include "Gui/Utils/Widgets/Dialog.h"
26 #include "Components/Preferences/PreferenceRegistry.h"
27 
28 namespace Preferences
29 {
30  class Base;
31  class Action;
32 }
33 
35 
36 
41  public Gui::Dialog,
42  public PreferenceUi
43 {
44  Q_OBJECT
45  UI_CLASS(GUI_PreferenceDialog)
47 
48  signals:
49  void sigError(const QString& error_message);
50 
51  public:
52  explicit GUI_PreferenceDialog(QWidget* parent=nullptr);
53  ~GUI_PreferenceDialog() override;
54 
55  QString actionName() const;
56  QAction* action();
57 
58  QList<QAction*> actions(QWidget* parent);
59 
60  void registerPreferenceDialog(Preferences::Base* dialog);
61  void showPreference(const QString& identifier) override;
62 
63  protected slots:
64  bool commit();
65  void revert();
66  void commitAndClose();
67  void rowChanged(int row);
68 
69  protected:
70  void initUi();
71  void languageChanged() override;
72  void showEvent(QShowEvent* e) override;
73 
74  void hideAll();
75 };
76 
77 #endif // GUI_PreferenceDialog_H
PreferenceUi
Definition: PreferenceRegistry.h:30
QList
Definition: EngineUtils.h:33
GUI_PreferenceDialog
The Preference Dialog. Register new Preference dialogs with the register_preference_dialog() method.
Definition: GUI_PreferenceDialog.h:43
Preferences::Base
Abstract Interface you should use when creating a preferences item.
Definition: PreferenceWidget.h:42