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... | |
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 |
To implement any specific preference item, cubclass from the QtxPreferenceItem and redefine store() and retrieve() methods.
|
protected |
QtxPreferenceItem::QtxPreferenceItem | ( | QtxPreferenceItem * | parent = 0 | ) |
parent | parent preference item |
References generateId(), insertItem(), and myId.
QtxPreferenceItem::QtxPreferenceItem | ( | const QString & | title, |
QtxPreferenceItem * | parent | ||
) |
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 | ||
) |
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 |
|
virtual |
Reimplemented in QtxPagePrefItem.
void QtxPreferenceItem::appendItem | ( | QtxPreferenceItem * | 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 |
int QtxPreferenceItem::count | ( | ) | const |
int QtxPreferenceItem::depth | ( | ) | const |
References depth(), and parentItem().
void QtxPreferenceItem::ensureVisible | ( | ) |
References ensureVisible(), and parentItem().
|
protectedvirtual |
Reimplemented in QtxPagePrefTabsItem, QtxPagePrefToolBoxItem, QtxPagePrefListItem, and QtxPagePrefItem.
References ensureVisible().
QtxPreferenceItem * QtxPreferenceItem::findItem | ( | const int | id, |
const bool | rec = false |
||
) | const |
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 |
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 |
title | child item title |
id | child item ID |
rec | if true recursive search is done |
References findItem(), id(), myChildren, and title().
|
staticprivate |
|
protected |
val | default value (returned if there is no such resource) |
References QtxResourceMgr::booleanValue(), myParameter, mySection, and resourceMgr().
|
protected |
val | default value (returned if there is no such resource) |
References QtxResourceMgr::colorValue(), myParameter, mySection, and resourceMgr().
|
protected |
val | default value (returned if there is no such resource) |
References QtxResourceMgr::doubleValue(), myParameter, mySection, and resourceMgr().
|
protected |
val | default value (returned if there is no such resource) |
References QtxResourceMgr::fontValue(), myParameter, mySection, and resourceMgr().
|
protected |
val | default value (returned if there is no such resource) |
References QtxResourceMgr::integerValue(), myParameter, mySection, and resourceMgr().
|
protected |
val | default value (returned if there is no such resource) |
References isEvaluateValues(), myParameter, mySection, resourceMgr(), and QtxResourceMgr::value().
int QtxPreferenceItem::id | ( | ) | const |
References myId.
void QtxPreferenceItem::insertItem | ( | QtxPreferenceItem * | item, |
QtxPreferenceItem * | before = 0 |
||
) |
Removes (if necessary) the item from the previous parent.
item | item to be added |
before | item before which is inserted new |
References itemAdded(), myChildren, myParent, parentItem(), and removeItem().
|
virtual |
bool QtxPreferenceItem::isEvaluateValues | ( | ) | const |
References myEval.
bool QtxPreferenceItem::isRestartRequired | ( | ) | const |
References myRestartNeeded.
|
protectedvirtual |
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 QtxPagePrefItem, and QtxPagePrefMgr.
|
protectedvirtual |
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 QtxPagePrefItem, and QtxPagePrefMgr.
|
protectedvirtual |
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 QtxPagePrefItem, and QtxPagePrefMgr.
QVariant QtxPreferenceItem::option | ( | const QString & | name | ) | const |
name | option name |
References optionValue().
|
protectedvirtual |
This function can be reimplemented in the subclasses. Base implementation does nothing.
name | option name |
Reimplemented in QtxUserDefinedItem, QtxPagePrefBackgroundItem, QtxPagePrefDateTimeItem, QtxPagePrefPathListItem, QtxPagePrefPathItem, QtxPagePrefFontItem, QtxPagePrefBiColorItem, QtxPagePrefSpinItem, QtxPagePrefSelectItem, QtxPagePrefSliderItem, QtxPagePrefEditItem, QtxPagePrefSpaceItem, QtxPagePrefLabelItem, QtxPagePrefGroupItem, QtxPagePrefFrameItem, QtxPagePrefTabsItem, QtxPagePrefListItem, QtxPagePrefMgr, and SUIT_PreferenceMgr.
References isEvaluateValues(), isRestartRequired(), and title().
QtxPreferenceItem * QtxPreferenceItem::parentItem | ( | ) | const |
References myParent.
|
virtual |
Reimplemented in QtxPreferenceMgr.
References parentItem(), and preferenceMgr().
void QtxPreferenceItem::removeItem | ( | QtxPreferenceItem * | item | ) |
item | item to be removed |
References itemRemoved(), myChildren, and myParent.
void QtxPreferenceItem::resource | ( | QString & | sec, |
QString & | param | ||
) | const |
sec | used to return resource file section name |
param | used to return resource file parameter name |
References myParameter, and mySection.
|
virtual |
Reimplemented in QtxPreferenceMgr.
References preferenceMgr(), and QtxPreferenceMgr::resourceMgr().
QString QtxPreferenceItem::resourceValue | ( | ) | const |
|
pure virtual |
This method should be implemented in the subclasses.
Implemented in QtxUserDefinedItem, QtxPagePrefBackgroundItem, QtxPagePrefShortcutTreeItem, QtxPagePrefShortcutBtnsItem, QtxPagePrefDateTimeItem, QtxPagePrefPathListItem, QtxPagePrefPathItem, QtxPagePrefFontItem, QtxPagePrefBiColorItem, QtxPagePrefColorItem, QtxPagePrefTextItem, QtxPagePrefSpinItem, QtxPagePrefSelectItem, QtxPagePrefSliderItem, QtxPagePrefEditItem, QtxPagePrefCheckItem, QtxPagePrefGroupItem, QtxPreferenceMgr, and QtxPagePrefItem.
QtxPreferenceItem * QtxPreferenceItem::rootItem | ( | ) | const |
References parentItem().
|
virtual |
References RTTI().
|
static |
|
protected |
References itemChanged(), and parentItem().
|
protected |
val | new value |
References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().
|
protected |
val | new value |
References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().
|
protected |
val | new value |
References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().
void QtxPreferenceItem::setEvaluateValues | ( | const bool | on | ) |
on | option value |
References myEval.
|
protected |
val | new value |
References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().
|
virtual |
|
protected |
val | new value |
References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().
name | option name |
val | new property value |
References optionValue(), sendItemChanges(), and setOptionValue().
|
protectedvirtual |
This function can be reimplemented in the subclasses. Base implementation does nothing.
name | option name |
val | new property value |
Reimplemented in QtxUserDefinedItem, QtxPagePrefBackgroundItem, QtxPagePrefDateTimeItem, QtxPagePrefPathListItem, QtxPagePrefPathItem, QtxPagePrefFontItem, QtxPagePrefBiColorItem, QtxPagePrefSpinItem, QtxPagePrefSelectItem, QtxPagePrefSliderItem, QtxPagePrefEditItem, QtxPagePrefSpaceItem, QtxPagePrefLabelItem, QtxPagePrefGroupItem, QtxPagePrefFrameItem, QtxPagePrefTabsItem, QtxPagePrefListItem, QtxPagePrefMgr, and SUIT_PreferenceMgr.
References setEvaluateValues(), setRestartRequired(), and setTitle().
sec | resource file section name |
param | resource file parameter name |
Reimplemented in QtxPagePrefGroupItem.
References myParameter, and mySection.
void QtxPreferenceItem::setResourceValue | ( | const QString & | val | ) |
val | new associated resource file setting value |
References setString().
void QtxPreferenceItem::setRestartRequired | ( | const bool | on | ) |
on | option value |
References myRestartNeeded.
|
protected |
val | new value |
References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().
|
virtual |
title | new item title |
Reimplemented in QtxPagePrefCheckItem, QtxPagePrefLabelItem, and QtxPageNamedPrefItem.
References myTitle, sendItemChanges(), and title().
|
pure virtual |
This method should be implemented in the subclasses.
Implemented in QtxUserDefinedItem, QtxPagePrefBackgroundItem, QtxPagePrefShortcutTreeItem, QtxPagePrefShortcutBtnsItem, QtxPagePrefDateTimeItem, QtxPagePrefPathListItem, QtxPagePrefPathItem, QtxPagePrefFontItem, QtxPagePrefBiColorItem, QtxPagePrefColorItem, QtxPagePrefTextItem, QtxPagePrefSpinItem, QtxPagePrefSelectItem, QtxPagePrefSliderItem, QtxPagePrefEditItem, QtxPagePrefCheckItem, QtxPagePrefGroupItem, QtxPreferenceMgr, and QtxPagePrefItem.
QString QtxPreferenceItem::title | ( | ) | const |
|
protectedvirtual |
|
virtual |
Reimplemented in QtxPagePrefGroupItem, QtxPagePrefFrameItem, QtxPagePrefTabsItem, QtxPagePrefToolBoxItem, QtxPagePrefListItem, and QtxPagePrefMgr.
References QtxPreferenceItem::Updater::instance(), and QtxPreferenceItem::Updater::removeItem().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |