#include <tdeconfigdialogmanager.h>
Inherits TQObject.
Public Slots | |
void | updateSettings () |
void | updateWidgets () |
void | updateWidgetsDefault () |
Signals | |
void | settingsChanged () |
void | settingsChanged (TQWidget *widget) |
void | widgetModified () |
Public Member Functions | |
TDEConfigDialogManager (TQWidget *parent, TDEConfigSkeleton *conf, const char *name=0) | |
~TDEConfigDialogManager () | |
void | addWidget (TQWidget *widget) |
bool | hasChanged () |
bool | isDefault () |
Protected Member Functions | |
void | init (bool trackChanges) |
bool | parseChildren (const TQWidget *widget, bool trackChanges) |
void | setProperty (TQWidget *w, const TQVariant &v) |
TQVariant | property (TQWidget *w) |
void | setupWidget (TQWidget *widget, TDEConfigSkeletonItem *item) |
Protected Attributes | |
TDEConfigSkeleton * | m_conf |
TQWidget * | m_dialog |
TQSqlPropertyMap * | propertyMap |
TQMap< TQString, TQCString > | changedMap |
Detailed Description
Provides a means of automatically retrieving, saving and resetting TDEConfigSkeleton based settings in a dialog.
The TDEConfigDialogManager 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 names of the widgets to be managed have to correspond to the names of the configuration entries in the TDEConfigSkeleton object plus an additional "kcfg_" prefix. For example a widget named "kcfg_MyOption" would be associated to the configuration entry "MyOption".
TDEConfigDialogManager uses the TQSqlPropertyMap class to determine if it can do anything to a widget. Note that TDEConfigDialogManager doesn't require a database, it simply uses the functionality that is built into the TQSqlPropertyMap class. New widgets can be added to the map using TQSqlPropertyMap::installDefaultMap(). Note that you can't just add any class. The class must have a matching TQ_PROPERTY(...) macro defined.
For example (note that KColorButton is already added and it doesn't need to manually added):
kcolorbutton.h defines the following property:
To add KColorButton the following code would be inserted in the main.
If you add a new widget to the TQSqlPropertyMap and wish to be notified when it is modified you should add its signal using addWidgetChangedSignal().
- Since
- 3.2
Definition at line 78 of file tdeconfigdialogmanager.h.
Constructor & Destructor Documentation
◆ TDEConfigDialogManager()
TDEConfigDialogManager::TDEConfigDialogManager | ( | TQWidget * | parent, |
TDEConfigSkeleton * | conf, | ||
const char * | name = 0 |
||
) |
Constructor.
- Parameters
-
parent Dialog widget to manage conf Object that contains settings name - Object name.
Definition at line 51 of file tdeconfigdialogmanager.cpp.
◆ ~TDEConfigDialogManager()
TDEConfigDialogManager::~TDEConfigDialogManager | ( | ) |
Destructor.
Definition at line 62 of file tdeconfigdialogmanager.cpp.
Member Function Documentation
◆ addWidget()
void TDEConfigDialogManager::addWidget | ( | TQWidget * | widget | ) |
Add additional widgets to manage.
- Parameters
-
widget Additional widget to manage, inlcuding all its children
Definition at line 124 of file tdeconfigdialogmanager.cpp.
◆ hasChanged()
bool TDEConfigDialogManager::hasChanged | ( | ) |
Returns whether the current state of the known widgets are different from the state in the config object.
Definition at line 365 of file tdeconfigdialogmanager.cpp.
◆ init()
|
protected |
- Parameters
-
trackChanges - If any changes by the widgets should be tracked set true. This causes the emitting the modified() signal when something changes. TODO:
- Returns
- bool - True if any setting was changed from the default.
Definition at line 67 of file tdeconfigdialogmanager.cpp.
◆ isDefault()
bool TDEConfigDialogManager::isDefault | ( | ) |
Returns whether the current state of the known widgets are the same as the default state in the config object.
Definition at line 389 of file tdeconfigdialogmanager.cpp.
◆ parseChildren()
|
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.
- Parameters
-
widget - Parent of the children to look at. trackChanges - If true then tracks any changes to the children of widget that are known.
- Returns
- bool - If a widget was set to something other then its default.
Definition at line 153 of file tdeconfigdialogmanager.cpp.
◆ property()
|
protected |
Retrieve a property.
Definition at line 352 of file tdeconfigdialogmanager.cpp.
◆ setProperty()
|
protected |
Set a property.
Definition at line 333 of file tdeconfigdialogmanager.cpp.
◆ settingsChanged [1/2]
|
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.
◆ settingsChanged [2/2]
|
signal |
TODO: Verify One or more of the settings have been changed.
- Parameters
-
widget - The widget group (pass in via addWidget()) that contains the one or more modified setting.
- See also
- settingsChanged()
◆ setupWidget()
|
protected |
Setup secondary widget properties.
Definition at line 129 of file tdeconfigdialogmanager.cpp.
◆ updateSettings
|
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.
Definition at line 304 of file tdeconfigdialogmanager.cpp.
◆ updateWidgets
|
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.
Definition at line 259 of file tdeconfigdialogmanager.cpp.
◆ 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.
Definition at line 297 of file tdeconfigdialogmanager.cpp.
◆ widgetModified
|
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.
Member Data Documentation
◆ changedMap
|
protected |
Map of the classes and the signals that they emit when changed.
Definition at line 224 of file tdeconfigdialogmanager.h.
◆ m_conf
|
protected |
TDEConfigSkeleton object used to store settings.
Definition at line 209 of file tdeconfigdialogmanager.h.
◆ m_dialog
|
protected |
Dialog being managed.
Definition at line 214 of file tdeconfigdialogmanager.h.
◆ propertyMap
|
protected |
Pointer to the property map for easy access.
Definition at line 219 of file tdeconfigdialogmanager.h.
The documentation for this class was generated from the following files: