LeechCraft  0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
wkfontswidget.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <memory>
12 #include <QWidget>
13 #include <QHash>
15 #include "xsdconfig.h"
16 
17 class QSpinBox;
18 
19 namespace Ui
20 {
21  class WkFontsWidget;
22 }
23 
24 namespace LC::Util
25 {
26  class BaseSettingsManager;
27  class FontChooserWidget;
28 
66  class UTIL_XSD_API WkFontsWidget : public QWidget
67  {
68  Q_OBJECT
69 
70  std::shared_ptr<Ui::WkFontsWidget> Ui_;
71  BaseSettingsManager * const BSM_;
72 
73  QHash<IWkFontsSettable::FontFamily, FontChooserWidget*> Family2Chooser_;
74  QHash<IWkFontsSettable::FontFamily, std::string_view> Family2Name_;
75  QHash<IWkFontsSettable::FontFamily, QFont> PendingFontChanges_;
76 
77  QHash<IWkFontsSettable::FontSize, QSpinBox*> Size2Spinbox_;
78  QHash<IWkFontsSettable::FontSize, std::string_view> Size2Name_;
79  QHash<IWkFontsSettable::FontSize, int> PendingSizeChanges_;
80 
81  QList<IWkFontsSettable*> Settables_;
82  public:
89  WkFontsWidget (Util::BaseSettingsManager *bsm, QWidget *parent = nullptr);
90 
98  void RegisterSettable (IWkFontsSettable *settable);
99 
108  void SetSize (IWkFontsSettable::FontSize type, int size);
109  private:
110  void ResetFontChoosers ();
111  void ResetSizeChoosers ();
112 
113  void ApplyPendingSizeChanges ();
114 
115  void ChangeAllFonts ();
116  public slots:
117  void accept ();
118  void reject ();
119  signals:
127  void fontChanged (IWkFontsSettable::FontFamily family, const QFont& font);
128 
136  void sizeChanged (IWkFontsSettable::FontSize type, int size);
137 
142  void sizeMultiplierChanged (qreal factor);
143  };
144 }
#define UTIL_XSD_API
Definition: xsdconfig.h:16
Interface to aid WebKit-like-view-containing tabs to expose the view fonts configuration to the user...
A settings widget for configuring WebKit fonts.
Definition: wkfontswidget.h:66
FontSize
Enumeration for possible font sizes.
FontFamily
Enumeration for possible font families.