Finalize the instance settings dialog, add setting reset mechanism

This commit is contained in:
Petr Mrázek
2013-07-16 00:30:32 +02:00
parent b5450042b5
commit e2ee6d6d25
11 changed files with 272 additions and 95 deletions

View File

@ -47,6 +47,7 @@ public:
protected slots:
virtual void changeSetting(const Setting &setting, QVariant value);
virtual void resetSetting ( const Setting& setting );
protected:
virtual QVariant retrieveValue(const Setting &setting);

View File

@ -84,6 +84,12 @@ signals:
*/
void settingChanged(const Setting &setting, QVariant value);
/*!
* \brief Signal emitted when this Setting object's value resets to default.
* \param setting A reference to the Setting that changed.
*/
void settingReset(const Setting &setting);
public slots:
/*!
* \brief Changes the setting's value.
@ -93,6 +99,13 @@ public slots:
*/
virtual void set(QVariant value);
/*!
* \brief Reset the setting to default
* This is done by emitting the settingReset() signal which will then be
* handled by the SettingsObject object and cause the setting to change.
* \param value The new value.
*/
virtual void reset();
protected:
QString m_id;
QVariant m_defVal;

View File

@ -100,6 +100,11 @@ public:
*/
virtual bool set(const QString &id, QVariant value);
/*!
* \brief Reverts the setting with the given ID to default.
* \param id The ID of the setting to reset.
*/
virtual void reset(const QString &id) const;
/*!
* \brief Gets a QList with pointers to all of the registered settings.
@ -125,6 +130,14 @@ signals:
*/
void settingChanged(const Setting &setting, QVariant value);
/*!
* \brief Signal emitted when one of this SettingsObject object's settings resets.
* This is usually just connected directly to each Setting object's
* settingReset() signals.
* \param setting A reference to the Setting object that changed.
*/
void settingReset(const Setting &setting);
protected slots:
/*!
* \brief Changes a setting.
@ -136,6 +149,15 @@ protected slots:
*/
virtual void changeSetting(const Setting &setting, QVariant value) = 0;
/*!
* \brief Resets a setting.
* This slot is usually connected to each Setting object's
* settingReset() signal. The signal is emitted, causing this slot
* to update the setting's value in the config file.
* \param setting A reference to the Setting object that changed.
*/
virtual void resetSetting(const Setting &setting) = 0;
protected:
/*!
* \brief Connects the necessary signals to the given Setting.