Sayonara Player
GUI_FontConfig.h
1 
2 /* Copyright (C) 2011-2017 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 #ifndef GUI_FONTCONFIG_H
21 #define GUI_FONTCONFIG_H
22 
23 #include "Interfaces/PreferenceDialog/PreferenceWidgetInterface.h"
24 
25 namespace Ui { class GUI_FontConfig; }
26 
27 class QFont;
28 class QFontDatabase;
29 
32 {
33  Q_OBJECT
34 
35 public:
36  explicit GUI_FontConfig(QWidget* parent=nullptr);
37  virtual ~GUI_FontConfig();
38 
39  void commit() override;
40  void revert() override;
41 
42  QString get_action_name() const override;
43 
44 
45 protected:
46  void init_ui() override;
47  void retranslate_ui() override;
48 
49 
50 protected slots:
51  void default_clicked();
52  void combo_fonts_changed(const QFont& font);
53  void skin_changed() override;
54 
55 
56 private:
57  Ui::GUI_FontConfig* ui=nullptr;
58 
59  QFontDatabase* _font_db=nullptr;
60  int _cur_font_size;
61  int _cur_font_weight;
62  bool _is_default;
63 
64 
65 private:
66  QStringList get_available_font_sizes(const QString& font_name, const QString& style=QString());
67  QStringList get_available_font_sizes(const QFont& font);
68 
69  void fill_sizes(const QStringList& sizes);
70 };
71 
72 #endif // FONTCONFIG_H
Definition: ui_GUI_SomaFM.h:216
Definition: ui_GUI_FontConfig.h:184
Definition: GUI_FontConfig.h:30
Abstract Interface you should use when creating a preferences item.
Definition: PreferenceWidgetInterface.h:39