X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fsettingspage.h;h=b68b78b190f16bd5334aedee1765b3532c077c9d;hb=44833145103bc0802f2e6fcc9edecaa2fdafc9d9;hp=98abc38575dffe7ced2e703ab7e174dc261b589b;hpb=f824db0e31b54969e0b7fa0b5405b1e9173d482c;p=quassel.git diff --git a/src/uisupport/settingspage.h b/src/uisupport/settingspage.h index 98abc385..b68b78b1 100644 --- a/src/uisupport/settingspage.h +++ b/src/uisupport/settingspage.h @@ -40,11 +40,15 @@ class QSpinBox; * its key is treated as a global path starting from the root, rather than from settingsKey(). * A second dynamic property \c defaultValue can be defined in child widgets as well. * + * For widgets requiring special ways for storing and saving, define the property settingsKey and leave it empty. In this + * case, the methods saveAutoWidgetValue() and loadAutoWidgetValue() will be called with the widget's objectName as parameter. + * * SettingsPage manages loading, saving, setting to default and setting the changed state for all automatic child widgets. * Derived classes must be sure to call initAutoWidgets() *after* setupUi(); they also need to call the baseclass implementations * of load(), save() and defaults() (preferably at the end of the derived function, since they call setChangedState(false)). * * The following widgets can be handled for now: + * - QGroupBox (isChecked()) * - QAbstractButton (isChecked(), e.g. for QCheckBox and QRadioButton) * - QLineEdit, QTextEdit (text()) * - QComboBox (currentIndex()) @@ -63,6 +67,12 @@ public: //! The title of this settings page. inline virtual QString title() const { return _title; } + //! Whether the settingspage needs a core connection to be selectable + /** This is a hint for the settingspage dialog. Do not rely on the settingspage not being + * visible if disconnected, and care about disabling it yourself. + */ + inline virtual bool needsCoreConnection() const { return false; } + //! The key this settings page stores its values under /** This needs to be overriden to enable automatic loading/saving/hasChanged checking of widgets. * The child widgets' values will be stored in client settings under this key. Every widget that @@ -126,6 +136,8 @@ protected slots: protected: void initAutoWidgets(); + virtual QVariant loadAutoWidgetValue(const QString &widgetName); + virtual void saveAutoWidgetValue(const QString &widgetName, const QVariant &value); signals: //! Emitted whenever the widget state changes.