digiKam
|
Public Slots | |
void | updateSettings () |
void | updateWidgets () |
void | updateWidgetsDefault () |
Signals | |
void | settingsChanged () |
void | settingsChanged (QWidget *widget) |
void | widgetModified () |
Public Member Functions | |
void | addWidget (QWidget *const widget) |
DConfigDlgMngr (QWidget *const parent, KConfigSkeleton *const conf) | |
bool | hasChanged () const |
bool | isDefault () const |
~DConfigDlgMngr () override | |
Static Public Member Functions | |
static QHash< QString, QByteArray > * | changedMap () |
static QHash< QString, QByteArray > * | propertyMap () |
Protected Member Functions | |
QByteArray | getCustomProperty (const QWidget *widget) const |
QByteArray | getCustomPropertyChangedSignal (const QWidget *widget) const |
QByteArray | getUserProperty (const QWidget *widget) const |
QByteArray | getUserPropertyChangedSignal (const QWidget *widget) const |
void | init (bool trackChanges) |
bool | parseChildren (const QWidget *widget, bool trackChanges) |
QVariant | property (QWidget *w) const |
void | setProperty (QWidget *w, const QVariant &v) |
void | setupWidget (QWidget *widget, KConfigSkeletonItem *item) |
Static Protected Member Functions | |
static void | initMaps () |
The DConfigDlgMngr class provides a means of automatically retrieving, saving and resetting basic settings. It also can emit signals when settings have been changed (settings were saved) or modified (the user changes a checkbox from on to off).
The object names of the widgets to be managed have to correspond to the names of the configuration entries in the KConfigSkeleton object plus an additional "kcfg_" prefix. For example a widget with the object name "kcfg_MyOption" would be associated to the configuration entry "MyOption".
The widget classes of Qt are supported out of the box.
Custom widget classes are supported if they have a Q_PROPERTY defined for the property representing the value edited by the widget. By default the property is used for which "USER true" is set. For using another property, see below.
Digikam::DConfigDlgMngr::DConfigDlgMngr | ( | QWidget *const | parent, |
KConfigSkeleton *const | conf | ||
) |
Constructor.
parent | Dialog widget to manage |
conf | Object that contains settings |
References init().
|
override |
Destructor.
void Digikam::DConfigDlgMngr::addWidget | ( | QWidget *const | widget | ) |
Add additional widgets to manage
widget | Additional widget to manage, including all its children |
References parseChildren().
|
static |
Retrieve the map between widgets class names and signals that are listened to detect changes in the configuration values.
References initMaps().
|
protected |
Find the property to use for a widget by querying the "kcfg_property" property of the widget. Like a widget can use a property other than the USER property.
Referenced by parseChildren(), property(), setProperty(), and setupWidget().
|
protected |
Find the changed signal of the property to use for a widget by querying the "kcfg_propertyNotify" property of the widget. Like a widget can use a property change signal other than the one for USER property, if there even is one.
Referenced by parseChildren().
|
protected |
Finds the USER property name using Qt's MetaProperty system, and caches it in the property map (the cache could be retrieved by propertyMap() ).
Referenced by parseChildren(), property(), and setProperty().
|
protected |
Finds the changed signal of the USER property using Qt's MetaProperty system.
Referenced by parseChildren().
bool Digikam::DConfigDlgMngr::hasChanged | ( | ) | const |
Returns whether the current state of the known widgets are different from the state in the config object.
References property().
Referenced by isDefault().
|
protected |
trackChanges | - If any changes by the widgets should be tracked set true. This causes the emitting the modified() signal when something changes. |
References initMaps(), and parseChildren().
Referenced by DConfigDlgMngr().
|
staticprotected |
Initializes the property maps
Referenced by changedMap(), init(), and propertyMap().
bool Digikam::DConfigDlgMngr::isDefault | ( | ) | const |
Returns whether the current state of the known widgets are the same as the default state in the config object.
References hasChanged().
|
protected |
Recursive function that finds all known children. Goes through the children of widget and if any are known and not being ignored, stores them in currentGroup. Also checks if the widget should be disabled because it is set immutable.
widget | - Parent of the children to look at. |
trackChanges | - If true then tracks any changes to the children of widget that are known. |
References getCustomProperty(), getCustomPropertyChangedSignal(), getUserProperty(), getUserPropertyChangedSignal(), setupWidget(), and widgetModified().
Referenced by addWidget(), and init().
|
protected |
Retrieve a property
References getCustomProperty(), and getUserProperty().
Referenced by hasChanged(), setupWidget(), updateSettings(), and updateWidgets().
|
static |
Retrieve the map between widgets class names and the USER properties used for the configuration values.
References initMaps().
|
protected |
Set a property
References getCustomProperty(), and getUserProperty().
Referenced by setupWidget(), and updateWidgets().
|
signal |
One or more of the settings have been saved (such as when the user clicks on the Apply button). This is only emitted by updateSettings() whenever one or more setting were changed and consequently saved.
Referenced by updateSettings().
|
signal |
One or more of the settings have been changed.
widget | - The widget group (pass in via addWidget()) that contains the one or more modified setting. |
|
protected |
Setup secondary widget properties
References getCustomProperty(), property(), and setProperty().
Referenced by parseChildren().
|
slot |
Traverse the specified widgets, saving the settings of all known widgets in the settings object.
Example use: User clicks Ok or Apply button in a configure dialog.
References property(), and settingsChanged().
|
slot |
Traverse the specified widgets, sets the state of all known widgets according to the state in the settings object.
Example use: Initialisation of dialog. Example use: User clicks Reset button in a configure dialog.
References property(), setProperty(), and widgetModified().
Referenced by updateWidgetsDefault().
|
slot |
Traverse the specified widgets, sets the state of all known widgets according to the default state in the settings object.
Example use: User clicks Defaults button in a configure dialog.
References updateWidgets().
|
signal |
If retrieveSettings() was told to track changes then if any known setting was changed this signal will be emitted. Note that a settings can be modified several times and might go back to the original saved state. hasChanged() will tell you if anything has actually changed from the saved values.
Referenced by parseChildren(), and updateWidgets().