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 #include <QMainWindow>
29 
30 namespace Preferences
31 {
32  class Base;
33  class Action;
34 }
35 
37 
38 
43  public Gui::Dialog,
44  public PreferenceUi
45 {
46  Q_OBJECT
47  UI_CLASS(GUI_PreferenceDialog)
49 
50  signals:
51  void sigError(const QString& error_message);
52 
53  public:
54  explicit GUI_PreferenceDialog(QMainWindow* parent);
55  ~GUI_PreferenceDialog() override;
56 
57  QString actionName() const;
58  QAction* action();
59 
60  QList<QAction*> actions(QWidget* parent);
61 
62  void registerPreferenceDialog(Preferences::Base* dialog);
63  void showPreference(const QString& identifier) override;
64 
65  protected slots:
66  bool commit();
67  void revert();
68  void commitAndClose();
69  void rowChanged(int row);
70 
71  protected:
72  void initUi();
73  void languageChanged() override;
74  void showEvent(QShowEvent* e) override;
75 
76  void hideAll();
77 };
78 
79 #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:45
Preferences::Base
Abstract Interface you should use when creating a preferences item.
Definition: PreferenceWidget.h:42