Sayonara Player
GUI_FontConfig.h
1 
2 /* Copyright (C) 2011-2016 Lucio Carreras
3  *
4  * This file is part of sayonara player
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10 
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15 
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 
21 
22 
23 #ifndef GUI_FONTCONFIG_H
24 #define GUI_FONTCONFIG_H
25 
26 #include "Interfaces/PreferenceDialog/PreferenceWidgetInterface.h"
27 #include "GUI/Preferences/Fonts/ui_GUI_FontConfig.h"
28 
29 #include <QString>
30 #include <QFontDatabase>
31 #include <QFont>
32 #include <QList>
33 
34 
37  protected Ui::GUI_FontConfig
38 {
39  Q_OBJECT
40 
41  friend class PreferenceInterface<SayonaraWidget>;
42 
43 public:
44  GUI_FontConfig(QWidget* parent=nullptr);
45  virtual ~GUI_FontConfig();
46 
47  QString get_action_name() const override;
48 
49  void commit() override;
50  void revert() override;
51 
52 protected:
53  void init_ui() override;
54 
55 protected slots:
56 
57  void default_clicked();
58  void combo_fonts_changed(const QFont& font);
59 
60  void language_changed() override;
61  void skin_changed() override;
62 
63 
64 private:
65  QFontDatabase* _font_db=nullptr;
66  int _cur_font_size;
67  int _cur_font_weight;
68  bool _is_default;
69 
70 private:
71  QStringList get_available_font_sizes(const QString& font_name, const QString& style=QString());
72  QStringList get_available_font_sizes(const QFont& font);
73 
74  void fill_sizes(const QStringList& sizes);
75 };
76 
77 
78 
79 
80 
81 #endif // FONTCONFIG_H
void commit() override
This method is called, when OK or apply is pressed. So all settings should be written there...
void init_ui() override
call setup_parent(this) here. initialize compoenents and connections here. After calling setup_parent...
void language_changed()
automatically called when language has changed. When overriding this method. Overriding this method s...
Definition: PreferenceInterface.h:116
Template class for implementing preference dialogs and preference widgets.
Definition: PreferenceInterface.h:70
void revert() override
This method is called, when cancel is clicked. So the gui should be re-initialized when this method i...
Definition: ui_GUI_FontConfig.h:184
Definition: GUI_FontConfig.h:35
Abstract Interface you should use when creating a preferences item.
Definition: PreferenceWidgetInterface.h:41
QString get_action_name() const override
has to be implemented and should return the translated action text