Base class for implementing of all the preference items. More...
#include <QtxPreferenceMgr.h>

Classes | |
| class | Updater |
| Preference item updater. More... | |
Public Member Functions | |
| QtxPreferenceItem (QtxPreferenceItem *=0) | |
| Constructor. More... | |
| QtxPreferenceItem (const QString &, QtxPreferenceItem *) | |
| Constructor. More... | |
| QtxPreferenceItem (const QString &, const QString &, const QString &, QtxPreferenceItem *) | |
| Constructor. More... | |
| virtual | ~QtxPreferenceItem () |
| Destructor. More... | |
| int | id () const |
| Get unique item identifier. More... | |
| virtual int | rtti () const |
| Get unique item type identifier. More... | |
| QtxPreferenceItem * | rootItem () const |
| Get root preference item. More... | |
| QtxPreferenceItem * | parentItem () const |
| Get parent preference item. More... | |
| QList< QtxPreferenceItem * > | childItems (const bool=false) const |
| Get all child preference items. More... | |
| int | depth () const |
| Get preference item depth. More... | |
| int | count () const |
| Get child preference items number. More... | |
| virtual bool | isEmpty () const |
| Check if the item has children. More... | |
| void | appendItem (QtxPreferenceItem *) |
| Append child preference item. More... | |
| void | removeItem (QtxPreferenceItem *) |
| Remove child preference item. More... | |
| void | insertItem (QtxPreferenceItem *, QtxPreferenceItem *=0) |
| Insert child preference item before specified item. If the before item is 0, then new item is appended. More... | |
| QIcon | icon () const |
| Get preference item icon. More... | |
| QString | title () const |
| Get preference item title. More... | |
| void | resource (QString &, QString &) const |
| Get resource file settings associated to the preference item. More... | |
| virtual void | setIcon (const QIcon &) |
| Set prefence item icon. More... | |
| virtual void | setTitle (const QString &) |
| Set preference item title . More... | |
| virtual void | setResource (const QString &, const QString &) |
| Assign resource file settings to the preference item. More... | |
| virtual void | updateContents () |
| Update preference item. More... | |
| QVariant | option (const QString &) const |
| Get preference item option value. More... | |
| void | setOption (const QString &, const QVariant &) |
| Set preference item option value. More... | |
| bool | isEvaluateValues () const |
| Get variables auto-conversion option value. More... | |
| void | setEvaluateValues (const bool) |
| Switch variables auto-conversion option on/off. More... | |
| bool | isRestartRequired () const |
| Get restart needed option value. More... | |
| void | setRestartRequired (const bool) |
| Switch restart needed option on/off. More... | |
| virtual void | store ()=0 |
| Save preference item (for example, to the resource file). More... | |
| virtual void | retrieve ()=0 |
| Restore preference item (for example, from the resource file). More... | |
| virtual void | retrieveDefault () |
| Restore preference item (for example, from the resource file, ignoring user preferences). If not overridden, it is equivalent to retrieve(). More... | |
| QString | resourceValue () const |
| Get the value of the associated resource file setting. More... | |
| void | setResourceValue (const QString &) |
| Get the value of the associated resource file setting. More... | |
| QtxPreferenceItem * | findItem (const int, const bool=false) const |
| Find the item by the specified identifier. More... | |
| QtxPreferenceItem * | findItem (const QString &, const bool=false) const |
| Find the item by the specified title. More... | |
| QtxPreferenceItem * | findItem (const QString &, const int, const bool=false) const |
| Find the item by the specified title and identifier. More... | |
| virtual QtxResourceMgr * | resourceMgr () const |
| Get the resources manager. More... | |
| virtual QtxPreferenceMgr * | preferenceMgr () const |
| Get the parent preferences manager. More... | |
| virtual void | activate () |
| void | ensureVisible () |
Static Public Member Functions | |
| static int | RTTI () |
| Specify unique item class identifier. More... | |
Protected Types | |
| typedef QList< QtxPreferenceItem * > | ItemList |
Protected Member Functions | |
| int | getInteger (const int=0) const |
| Get integer resources value corresponding to the item. More... | |
| double | getDouble (const double=0.0) const |
| Get double resources value corresponding to the item. More... | |
| bool | getBoolean (const bool=false) const |
| Get boolean resources value corresponding to the item. More... | |
| QColor | getColor (const QColor &=QColor()) const |
| Get color resources value corresponding to the item. More... | |
| QFont | getFont (const QFont &=QFont()) const |
| Get font resources value corresponding to the item. More... | |
| QString | getString (const QString &=QString()) const |
| Get string resources value corresponding to the item. More... | |
| void | setInteger (const int) |
| Set integer resources value corresponding to the item. More... | |
| void | setDouble (const double) |
| Set double resources value corresponding to the item. More... | |
| void | setBoolean (const bool) |
| Set boolean resources value corresponding to the item. More... | |
| void | setColor (const QColor &) |
| Set color resources value corresponding to the item. More... | |
| void | setFont (const QFont &) |
| Set font resources value corresponding to the item. More... | |
| void | setString (const QString &) |
| Set string resources value corresponding to the item. More... | |
| virtual void | itemAdded (QtxPreferenceItem *) |
| Callback function which is called when the child preference item is added. More... | |
| virtual void | itemRemoved (QtxPreferenceItem *) |
| Callback function which is called when the child preference item is removed. More... | |
| virtual void | itemChanged (QtxPreferenceItem *) |
| Callback function which is called when the child preference item is modified. More... | |
| virtual void | ensureVisible (QtxPreferenceItem *) |
| void | sendItemChanges () |
| Initiate item changing call back operation. More... | |
| virtual void | triggerUpdate () |
| Initiate item updating. More... | |
| virtual QVariant | optionValue (const QString &) const |
| Get preference item option value. More... | |
| virtual void | setOptionValue (const QString &, const QVariant &) |
| Set preference item option value. More... | |
Static Private Member Functions | |
| static int | generateId () |
| Generate unique preference item identifier. More... | |
Private Attributes | |
| int | myId |
| QtxPreferenceItem * | myParent |
| ItemList | myChildren |
| bool | myEval |
| bool | myRestartNeeded |
| QIcon | myIcon |
| QString | myTitle |
| QString | mySection |
| QString | myParameter |
Base class for implementing of all the preference items.
To implement any specific preference item, subclass from the QtxPreferenceItem and redefine store() and retrieve() methods.
|
protected |
| QtxPreferenceItem::QtxPreferenceItem | ( | QtxPreferenceItem * | parent = 0 | ) |
Constructor.
| parent | parent preference item |
References generateId(), insertItem(), and myId.
| QtxPreferenceItem::QtxPreferenceItem | ( | const QString & | title, |
| QtxPreferenceItem * | parent | ||
| ) |
Constructor.
| title | item title |
| parent | parent preference item |
References generateId(), insertItem(), and myId.
| QtxPreferenceItem::QtxPreferenceItem | ( | const QString & | title, |
| const QString & | sect, | ||
| const QString & | param, | ||
| QtxPreferenceItem * | parent | ||
| ) |
Constructor.
| title | item title |
| sect | resource file section to be associated with the item |
| param | resource file parameter to be associated with the item |
| parent | parent preference item |
References generateId(), insertItem(), and myId.
|
virtual |
Destructor.
References QtxPreferenceItem::Updater::instance(), myChildren, myParent, QtxPreferenceItem::Updater::removeItem(), and removeItem().
|
virtual |
Reimplemented in QtxPagePrefItem.
| void QtxPreferenceItem::appendItem | ( | QtxPreferenceItem * | item | ) |
Append child preference item.
Removes (if necessary) the item from the previous parent.
| item | item to be added |
References insertItem().
| QList< QtxPreferenceItem * > QtxPreferenceItem::childItems | ( | const bool | rec = false | ) | const |
Get all child preference items.
| rec | recursion boolean flag |
References myChildren.
| int QtxPreferenceItem::count | ( | ) | const |
Get child preference items number.
References myChildren.
| int QtxPreferenceItem::depth | ( | ) | const |
| void QtxPreferenceItem::ensureVisible | ( | ) |
References ensureVisible(), and parentItem().
|
protectedvirtual |
Reimplemented in QtxPagePrefItem, QtxPagePrefListItem, QtxPagePrefToolBoxItem, and QtxPagePrefTabsItem.
References ensureVisible().
| QtxPreferenceItem * QtxPreferenceItem::findItem | ( | const int | id, |
| const bool | rec = false |
||
| ) | const |
Find the item by the specified identifier.
| id | child item ID |
| rec | if true recursive search is done |
References findItem(), id(), and myChildren.
| QtxPreferenceItem * QtxPreferenceItem::findItem | ( | const QString & | title, |
| const bool | rec = false |
||
| ) | const |
Find the item by the specified title.
| title | child item title |
| rec | if true recursive search is done |
References findItem(), myChildren, and title().
| QtxPreferenceItem * QtxPreferenceItem::findItem | ( | const QString & | title, |
| const int | id, | ||
| const bool | rec = false |
||
| ) | const |
Find the item by the specified title and identifier.
| title | child item title |
| id | child item ID |
| rec | if true recursive search is done |
References findItem(), id(), myChildren, and title().
|
staticprivate |
Generate unique preference item identifier.
|
protected |
Get boolean resources value corresponding to the item.
| val | default value (returned if there is no such resource) |
References QtxResourceMgr::booleanValue(), myParameter, mySection, and resourceMgr().
|
protected |
Get color resources value corresponding to the item.
| val | default value (returned if there is no such resource) |
References QtxResourceMgr::colorValue(), myParameter, mySection, and resourceMgr().
|
protected |
Get double resources value corresponding to the item.
| val | default value (returned if there is no such resource) |
References QtxResourceMgr::doubleValue(), myParameter, mySection, and resourceMgr().
|
protected |
Get font resources value corresponding to the item.
| val | default value (returned if there is no such resource) |
References QtxResourceMgr::fontValue(), myParameter, mySection, and resourceMgr().
Get integer resources value corresponding to the item.
| val | default value (returned if there is no such resource) |
References QtxResourceMgr::integerValue(), myParameter, mySection, and resourceMgr().
|
protected |
Get string resources value corresponding to the item.
| val | default value (returned if there is no such resource) |
References isEvaluateValues(), myParameter, mySection, resourceMgr(), and QtxResourceMgr::value().
| QIcon QtxPreferenceItem::icon | ( | ) | const |
| void QtxPreferenceItem::insertItem | ( | QtxPreferenceItem * | item, |
| QtxPreferenceItem * | before = 0 |
||
| ) |
Insert child preference item before specified item. If the before item is 0, then new item is appended.
Removes (if necessary) the item from the previous parent.
| item | item to be added |
| before | item before which is inserted new \aitem |
References itemAdded(), myChildren, myParent, parentItem(), and removeItem().
|
virtual |
Check if the item has children.
true if item does not have children References myChildren.
| bool QtxPreferenceItem::isEvaluateValues | ( | ) | const |
| bool QtxPreferenceItem::isRestartRequired | ( | ) | const |
|
protectedvirtual |
Callback function which is called when the child preference item is added.
This function can be reimplemented in the subclasses to customize child item addition operation. Base implementation does nothing.
| item | child item being added |
Reimplemented in QtxPagePrefMgr, and QtxPagePrefItem.
|
protectedvirtual |
Callback function which is called when the child preference item is modified.
This function can be reimplemented in the subclasses to customize child item modifying operation. Base implementation does nothing.
| item | child item being modified |
Reimplemented in QtxPagePrefMgr, and QtxPagePrefItem.
|
protectedvirtual |
Callback function which is called when the child preference item is removed.
This function can be reimplemented in the subclasses to customize child item removal operation. Base implementation does nothing.
| item | child item being removed |
Reimplemented in QtxPagePrefMgr, and QtxPagePrefItem.
| QVariant QtxPreferenceItem::option | ( | const QString & | name | ) | const |
Get preference item option value.
| name | option name |
References optionValue().
|
protectedvirtual |
Get preference item option value.
This function can be reimplemented in the subclasses. Base implementation does nothing.
| name | option name |
Reimplemented in QtxPagePrefMgr, QtxPagePrefListItem, QtxPagePrefTabsItem, QtxPagePrefFrameItem, QtxPagePrefGroupItem, QtxPagePrefLabelItem, QtxPagePrefSpaceItem, QtxPagePrefEditItem, QtxPagePrefSliderItem, QtxPagePrefSelectItem, QtxPagePrefSpinItem, QtxPagePrefBiColorItem, QtxPagePrefFontItem, QtxPagePrefPathItem, QtxPagePrefPathListItem, QtxPagePrefDateTimeItem, QtxPagePrefBackgroundItem, SUIT_PreferenceMgr, and QtxUserDefinedItem.
References isEvaluateValues(), isRestartRequired(), and title().
| QtxPreferenceItem * QtxPreferenceItem::parentItem | ( | ) | const |
|
virtual |
Get the parent preferences manager.
Reimplemented in QtxPreferenceMgr.
References parentItem(), and preferenceMgr().
| void QtxPreferenceItem::removeItem | ( | QtxPreferenceItem * | item | ) |
Remove child preference item.
| item | item to be removed |
References itemRemoved(), myChildren, and myParent.
| void QtxPreferenceItem::resource | ( | QString & | sec, |
| QString & | param | ||
| ) | const |
Get resource file settings associated to the preference item.
| sec | used to return resource file section name |
| param | used to return resource file parameter name |
References myParameter, and mySection.
|
virtual |
Get the resources manager.
Reimplemented in QtxPreferenceMgr.
References preferenceMgr(), and QtxPreferenceMgr::resourceMgr().
| QString QtxPreferenceItem::resourceValue | ( | ) | const |
Get the value of the associated resource file setting.
References getString().
|
pure virtual |
Restore preference item (for example, from the resource file).
This method should be implemented in the subclasses.
Implemented in QtxPagePrefItem, QtxPagePrefGroupItem, QtxPagePrefCheckItem, QtxPagePrefEditItem, QtxPagePrefSliderItem, QtxPagePrefSelectItem, QtxPagePrefSpinItem, QtxPagePrefTextItem, QtxPagePrefColorItem, QtxPagePrefBiColorItem, QtxPagePrefFontItem, QtxPagePrefPathItem, QtxPagePrefPathListItem, QtxPagePrefDateTimeItem, QtxPagePrefBackgroundItem, QtxUserDefinedItem, QtxPreferenceMgr, and SUIT_PagePrefShortcutTreeItem.
|
virtual |
Restore preference item (for example, from the resource file, ignoring user preferences). If not overridden, it is equivalent to retrieve().
Reimplemented in QtxPreferenceMgr, and SUIT_PagePrefShortcutTreeItem.
References retrieve().
| QtxPreferenceItem * QtxPreferenceItem::rootItem | ( | ) | const |
|
static |
Specify unique item class identifier.
|
virtual |
|
protected |
Initiate item changing call back operation.
References itemChanged(), and parentItem().
|
protected |
Set boolean resources value corresponding to the item.
| val | new value |
References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().
|
protected |
Set color resources value corresponding to the item.
| val | new value |
References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().
|
protected |
Set double resources value corresponding to the item.
| val | new value |
References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().
| void QtxPreferenceItem::setEvaluateValues | ( | const bool | on | ) |
|
protected |
Set font resources value corresponding to the item.
| val | new value |
References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().
|
virtual |
Set prefence item icon.
| ico | new item icon |
References myIcon, and sendItemChanges().
|
protected |
Set integer resources value corresponding to the item.
| val | new value |
References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().
| void QtxPreferenceItem::setOption | ( | const QString & | name, |
| const QVariant & | val | ||
| ) |
Set preference item option value.
| name | option name |
| val | new property value |
References optionValue(), sendItemChanges(), and setOptionValue().
|
protectedvirtual |
Set preference item option value.
This function can be reimplemented in the subclasses. Base implementation does nothing.
| name | option name |
| val | new property value |
Reimplemented in QtxPagePrefMgr, QtxPagePrefListItem, QtxPagePrefTabsItem, QtxPagePrefFrameItem, QtxPagePrefGroupItem, QtxPagePrefLabelItem, QtxPagePrefSpaceItem, QtxPagePrefEditItem, QtxPagePrefSliderItem, QtxPagePrefSelectItem, QtxPagePrefSpinItem, QtxPagePrefBiColorItem, QtxPagePrefFontItem, QtxPagePrefPathItem, QtxPagePrefPathListItem, QtxPagePrefDateTimeItem, QtxPagePrefBackgroundItem, SUIT_PreferenceMgr, and QtxUserDefinedItem.
References setEvaluateValues(), setRestartRequired(), and setTitle().
|
virtual |
Assign resource file settings to the preference item.
| sec | resource file section name |
| param | resource file parameter name |
Reimplemented in QtxPagePrefGroupItem.
References myParameter, and mySection.
| void QtxPreferenceItem::setResourceValue | ( | const QString & | val | ) |
Get the value of the associated resource file setting.
| val | new associated resource file setting value |
References setString().
| void QtxPreferenceItem::setRestartRequired | ( | const bool | on | ) |
|
protected |
Set string resources value corresponding to the item.
| val | new value |
References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().
|
virtual |
Set preference item title .
| title | new item title |
Reimplemented in QtxPageNamedPrefItem, QtxPagePrefLabelItem, and QtxPagePrefCheckItem.
References myTitle, sendItemChanges(), and title().
|
pure virtual |
Save preference item (for example, to the resource file).
This method should be implemented in the subclasses.
Implemented in QtxPagePrefItem, QtxPagePrefGroupItem, QtxPagePrefCheckItem, QtxPagePrefEditItem, QtxPagePrefSliderItem, QtxPagePrefSelectItem, QtxPagePrefSpinItem, QtxPagePrefTextItem, QtxPagePrefColorItem, QtxPagePrefBiColorItem, QtxPagePrefFontItem, QtxPagePrefPathItem, QtxPagePrefPathListItem, QtxPagePrefDateTimeItem, QtxPagePrefBackgroundItem, QtxUserDefinedItem, QtxPreferenceMgr, and SUIT_PagePrefShortcutTreeItem.
| QString QtxPreferenceItem::title | ( | ) | const |
|
protectedvirtual |
Initiate item updating.
References QtxPreferenceItem::Updater::instance(), and QtxPreferenceItem::Updater::updateItem().
|
virtual |
Update preference item.
Reimplemented in QtxPagePrefMgr, QtxPagePrefListItem, QtxPagePrefToolBoxItem, QtxPagePrefTabsItem, QtxPagePrefFrameItem, and QtxPagePrefGroupItem.
References QtxPreferenceItem::Updater::instance(), and QtxPreferenceItem::Updater::removeItem().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |