LeechCraft  0.6.70-15082-g543737046d
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
25 {
26 namespace Util
27 {
28  class BaseSettingsManager;
29  class FontChooserWidget;
30 
68  class UTIL_XSD_API WkFontsWidget : public QWidget
69  {
70  Q_OBJECT
71 
72  std::shared_ptr<Ui::WkFontsWidget> Ui_;
73  BaseSettingsManager * const BSM_;
74 
75  QHash<IWkFontsSettable::FontFamily, FontChooserWidget*> Family2Chooser_;
76  QHash<IWkFontsSettable::FontFamily, std::string_view> Family2Name_;
77  QHash<IWkFontsSettable::FontFamily, QFont> PendingFontChanges_;
78 
79  QHash<IWkFontsSettable::FontSize, QSpinBox*> Size2Spinbox_;
80  QHash<IWkFontsSettable::FontSize, std::string_view> Size2Name_;
81  QHash<IWkFontsSettable::FontSize, int> PendingSizeChanges_;
82 
83  QList<IWkFontsSettable*> Settables_;
84  public:
91  WkFontsWidget (Util::BaseSettingsManager *bsm, QWidget *parent = nullptr);
92 
100  void RegisterSettable (IWkFontsSettable *settable);
101 
110  void SetSize (IWkFontsSettable::FontSize type, int size);
111  private:
112  void ResetFontChoosers ();
113  void ResetSizeChoosers ();
114 
115  void ApplyPendingSizeChanges ();
116  private slots:
117  void on_ChangeAll__released ();
118  public slots:
119  void accept ();
120  void reject ();
121  signals:
129  void fontChanged (IWkFontsSettable::FontFamily family, const QFont& font);
130 
138  void sizeChanged (IWkFontsSettable::FontSize type, int size);
139 
144  void sizeMultiplierChanged (qreal factor);
145  };
146 }
147 }
QList< IWkFontsSettable * >
iwkfontssettable.h
IWkFontsSettable::FontSize
FontSize
Enumeration for possible font sizes.
Definition: iwkfontssettable.h:44
IWkFontsSettable::FontFamily
FontFamily
Enumeration for possible font families.
Definition: iwkfontssettable.h:32
IWkFontsSettable
Interface to aid WebKit-like-view-containing tabs to expose the view fonts configuration to the user.
Definition: iwkfontssettable.h:24
xsdconfig.h
Ui
Definition: backendselector.h:15
LC
Definition: constants.h:14
LC::Util::WkFontsWidget
A settings widget for configuring WebKit fonts.
Definition: wkfontswidget.h:68
UTIL_XSD_API
#define UTIL_XSD_API
Definition: xsdconfig.h:16