Sayonara Player
GUI_PreferenceDialog.h
1 /* GUI_PreferenceDialog.h */
2 
3 /* Copyright (C) 2011-2017 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 "Interfaces/PreferenceDialog/PreferenceDialog.h"
26 #include "GUI/Utils/Widgets/Dialog.h"
27 
28 class QString;
29 namespace Preferences
30 {
31  class Base;
32  class Action;
33 }
34 
36 
37 
42  public Gui::Dialog,
43  public PreferenceDialog
44 
45 {
46  Q_OBJECT
47  UI_CLASS(GUI_PreferenceDialog)
49 
50  signals:
51  void sig_error(const QString& error_message);
52 
53  public:
54  explicit GUI_PreferenceDialog(QWidget* parent=nullptr);
56 
57  QString action_name() const override;
58  QAction* action() override;
59 
60  QList<QAction*> actions(QWidget* parent) override;
61 
62  void register_preference_dialog(Preferences::Base* dialog) override;
63  void show_preference(const QString& identifier) override;
64 
65  protected slots:
66  void commit_and_close();
67  void row_changed(int row);
68 
69  protected:
70  void init_ui();
71  void language_changed() override;
72  void showEvent(QShowEvent *e) override;
73 
74  void hide_all();
75 
76  private:
77  bool commit();
78  void revert();
79 
80 };
81 
82 #endif // GUI_PreferenceDialog_H
Definition: GUI_ControlsBase.h:43
The Preference Dialog. Register new Preference dialogs with the register_preference_dialog() method...
Definition: GUI_PreferenceDialog.h:41
Definition: PreferenceDialog.h:37
Definition: GUI_PreferenceDialog.h:29
Abstract Interface you should use when creating a preferences item.
Definition: PreferenceWidget.h:41
Definition: org_mpris_media_player2_adaptor.h:20