Sayonara Player
GUI_PreferenceDialog.h
1 /* GUI_PreferenceDialog.h */
2 
3 /* Copyright (C) 2011-2019 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 sig_error(const QString& error_message);
50 
51  public:
52  explicit GUI_PreferenceDialog(QWidget* parent=nullptr);
54 
55  QString action_name() const;
56  QAction* action();
57 
58  QList<QAction*> actions(QWidget* parent);
59 
60  void register_preference_dialog(Preferences::Base* dialog);
61  void show_preference(const QString& identifier) override;
62 
63  protected slots:
64  void commit_and_close();
65  void row_changed(int row);
66 
67  protected:
68  void init_ui();
69  void language_changed() override;
70  void showEvent(QShowEvent *e) override;
71 
72  void hide_all();
73 
74  private:
75  bool commit();
76  void revert();
77 
78 };
79 
80 #endif // GUI_PreferenceDialog_H
The Preference Dialog. Register new Preference dialogs with the register_preference_dialog() method.
Definition: GUI_PreferenceDialog.h:40
Definition: PreferenceRegistry.h:29
Abstract Interface you should use when creating a preferences item.
Definition: PreferenceWidget.h:40
Definition: org_mpris_media_player2_adaptor.h:20