#include <settingscontroller.h>
Inheritance diagram for SettingsController:

Public Member Functions | |
| SettingsController (QObject *parent=0) | |
| SettingsController (SettingsModel *model, QObject *parent=0) | |
| SettingsModel * | settingsModel () const |
| virtual MvcModuleId_t | moduleId () const |
| void | bind (QObject *obj, const char *objProperty, const char *objSignal, const QString &settingsKey) |
Static Public Member Functions | |
| static MvcModuleId_t | classModuleId () |
Protected Member Functions | |
| virtual void | customEvent (QEvent *e) |
| virtual void | dispatchEvent (CEvent *) |
| virtual void | changeModelEvent (CChangeModelEvent *) |
| virtual void | settingsChangeValueEvent (CSettingsChangeValueEvent *) |
| virtual void | settingsRemoveKeyEvent (CSettingsRemoveKeyEvent *) |
| virtual void | settingsRemoveAllEvent (CSettingsEvent *) |
| virtual void | settingsSyncAllEvent (CSettingsEvent *) |
Classes | |
| struct | BindingInfo |
Note that the model's pointer is stored internally as a "guarded pointer". Hence, if the model is deleted, our reference to it will be automatically set back to 0.
Warning! We always assert that the model is non-null. Hence, you can't have an instance of a SettingsController without a SettingsModel. This is fine in our case and means that we don't need to constantly check if the diagram is null in the release / deployment version (when assertions are stripped).
| SettingsController::SettingsController | ( | QObject * | parent = 0 |
) |
Constructs a settings model controller with the given parent.
| SettingsController::SettingsController | ( | SettingsModel * | model, | |
| QObject * | parent = 0 | |||
| ) |
Constructs a Digest database controller with the given parent and model.
| SettingsModel * SettingsController::settingsModel | ( | ) | const |
Convenience method.
Returns a cached guarded pointer that has been dynamically cast to SettingsModel* from AbstractModel*.
See also AbstractController::model().
| static MvcModuleId_t SettingsController::classModuleId | ( | ) | [inline, static] |
Returns MvcSettings::id().
Reimplemented from MvcBase.
| virtual MvcModuleId_t SettingsController::moduleId | ( | ) | const [inline, virtual] |
Returns classModuleId().
Reimplemented from MvcBase.
| void SettingsController::bind | ( | QObject * | obj, | |
| const char * | objProperty, | |||
| const char * | objSignal, | |||
| const QString & | settingsKey | |||
| ) |
Binds a given object obj to a setting settingsKey, keeping the objProperty in sync (in both directions) with the setting whenever the objSignal is emitted or when the setting is modified by something else.
Example:
bind( usernameEdit, "text", SIGNAL(editingFinished()), "username" );
The object's property will be set to reflect the current setting's value before returning.
Note: The objProperty must be read-write (not read-only).
Note: For safety and convenience, the object's destroyed() signal is automatically connected to unbind().
Asserts that the obj, objProperty and objSignal are all non-null. Also, it's asserted that the settingsModel() is non-null.
See also unbind().
| virtual void SettingsController::customEvent | ( | QEvent * | e | ) | [inline, protected, virtual] |
| void SettingsController::dispatchEvent | ( | CEvent * | event | ) | [protected, virtual] |
The controller's event dispatcher.
Asserts that the event is non-null.
Warning! It is assumed that the events have their correct type set (as it uses static casts).
Reimplemented from AbstractController.
| void SettingsController::changeModelEvent | ( | CChangeModelEvent * | event | ) | [protected, virtual] |
Re-implemented, as to also have the pointer returned by settingModel() updated.
Asserts that the event is non-null.
Reimplemented from AbstractController.
| void SettingsController::settingsChangeValueEvent | ( | CSettingsChangeValueEvent * | event | ) | [protected, virtual] |
Changes the value of the given setting event()->key to event->value().
If a value for the given key doesn't already exist, then it will be added.
Objects that have been bound using bind() will be updated to the new value. Bound objects will be updated after the views().
Asserts that the event is non-null.
| void SettingsController::settingsRemoveKeyEvent | ( | CSettingsRemoveKeyEvent * | event | ) | [protected, virtual] |
Removes the setting event->key() and any sub-settings of it.
Objects that have been bound using bind() will be updated to null.
Asserts that the event is non-null.
| void SettingsController::settingsRemoveAllEvent | ( | CSettingsEvent * | event | ) | [protected, virtual] |
Removes all entries in the primary location.
All views will be sent VEvent(VEvent::Reset).
Asserts that the event is non-null.
| void SettingsController::settingsSyncAllEvent | ( | CSettingsEvent * | event | ) | [protected, virtual] |
Writes any unsaved changes to permanent storage, and reloads any settings that have been changed in the meantime (possibly by another application).
All views will be sent VEvent(VEvent::Reset).
Asserts that the event is non-null.
1.5.2