LeechCraft 0.6.70-17609-g3dde4097dd
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
LC::Util::WkFontsWidget Class Reference

A settings widget for configuring WebKit fonts. More...

#include "wkfontswidget.h"

+ Inheritance diagram for LC::Util::WkFontsWidget:
+ Collaboration diagram for LC::Util::WkFontsWidget:

Public Slots

void accept ()
 
void reject ()
 

Signals

void fontChanged (IWkFontsSettable::FontFamily family, const QFont &font)
 Notifies the font for the given family has been changed.
 
void sizeChanged (IWkFontsSettable::FontSize type, int size)
 Notifies the size for the given font type has been changed.
 
void sizeMultiplierChanged (qreal factor)
 Notifies the text zoom factor has been changed.
 

Public Member Functions

 WkFontsWidget (Util::BaseSettingsManager *bsm, QWidget *parent=nullptr)
 Creates the fonts settings widget.
 
void RegisterSettable (IWkFontsSettable *settable)
 Registers an object to be automatically updated whenever font settings change.
 
void SetSize (IWkFontsSettable::FontSize type, int size)
 Sets the size for the given font size type.
 

Detailed Description

A settings widget for configuring WebKit fonts.

Provides a common widget for configuring QtWebKit fonts for standard WebKit font types.

This widget works through LeechCraft's XML Settings Dialog system, storing the configuration in an BaseSettingsManager instance.

This widget also supports automatically updating font settings for objects implementing the IWkFontsSettable interface if the user changes them.

Typical usage includes creating an item of type customwidget in the XML file describing the settings and then setting an instance of the WkFontsWidget as the widget for that item. On the C++ side this looks like:

FontsWidget_ = new Util::WkFontsWidget { &XmlSettingsManager::Instance () };
XmlSettingsDialog_->SetCustomWidget ("FontsSelector", FontsWidget_);
A settings widget for configuring WebKit fonts.

assuming the Util::BaseSettingsManager is provided by a singleton XmlSettingsManager class, and XmlSettingsDialog_ is an instance of Util::XmlSettingsDialog.

The code above also stores the WkFontsWidget as a class variable, which may be a good idea if one wishes to use the settings autoupdate feature. For example, assuming a class ChatTab properly implements the IWkFontsSettable interface:

const auto tab = new ChatTab {};
FontsWidget_->RegisterSettable (tab);
See also
IWkFontsSettable

Definition at line 66 of file wkfontswidget.h.

Constructor & Destructor Documentation

◆ WkFontsWidget()

LC::Util::WkFontsWidget::WkFontsWidget ( Util::BaseSettingsManager * bsm,
QWidget * parent = nullptr )

Creates the fonts settings widget.

Parameters
[in]bsmThe settings manager to use for storing settings.
[in]parentThe parent widget for this widget.

Definition at line 20 of file wkfontswidget.cpp.

References WkFontsWidget(), IWkFontsSettable::CursiveFont, IWkFontsSettable::DefaultFixedFontSize, IWkFontsSettable::DefaultFontSize, IWkFontsSettable::FantasyFont, IWkFontsSettable::FixedFont, LC::Util::FontChooserWidget::fontChanged(), IWkFontsSettable::MinimumFontSize, IWkFontsSettable::SansSerifFont, IWkFontsSettable::SerifFont, and IWkFontsSettable::StandardFont.

Referenced by WkFontsWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ accept

void LC::Util::WkFontsWidget::accept ( )
slot

Definition at line 151 of file wkfontswidget.cpp.

References fontChanged(), and LC::Util::Stlize().

+ Here is the call graph for this function:

◆ fontChanged

void LC::Util::WkFontsWidget::fontChanged ( IWkFontsSettable::FontFamily family,
const QFont & font )
signal

Notifies the font for the given family has been changed.

Parameters
[out]familyThe font family for which the font has been changed.
[out]fontThe new font for the given family.

Referenced by accept().

+ Here is the caller graph for this function:

◆ RegisterSettable()

void LC::Util::WkFontsWidget::RegisterSettable ( IWkFontsSettable * settable)

Registers an object to be automatically updated whenever font settings change.

Parameters
[in]settableAn object implementing IWkFontsSettable.
See also
IWkFontsSettable

Definition at line 69 of file wkfontswidget.cpp.

References IWkFontsSettable::GetQObject(), IWkFontsSettable::SetFontFamily(), IWkFontsSettable::SetFontSize(), and LC::Util::Stlize().

+ Here is the call graph for this function:

◆ reject

void LC::Util::WkFontsWidget::reject ( )
slot

Definition at line 167 of file wkfontswidget.cpp.

◆ SetSize()

void LC::Util::WkFontsWidget::SetSize ( IWkFontsSettable::FontSize type,
int size )

Sets the size for the given font size type.

The new size is stored in settings and applied to all settables registered with this widget via RegisterSettable().

Parameters
typeThe type of font size to change.
sizeThe new size.

Definition at line 83 of file wkfontswidget.cpp.

◆ sizeChanged

void LC::Util::WkFontsWidget::sizeChanged ( IWkFontsSettable::FontSize type,
int size )
signal

Notifies the size for the given font type has been changed.

Parameters
[out]typeThe font type for which the size has been changed.
[out]sizeThe new font size for the given font type.

◆ sizeMultiplierChanged

void LC::Util::WkFontsWidget::sizeMultiplierChanged ( qreal factor)
signal

Notifies the text zoom factor has been changed.

Parameters
[out]factorThe new font size multiplier.

The documentation for this class was generated from the following files: