+/** The SettingsDlg provides suitable standard buttons, such as Ok, Apply, Cancel, Restore Defaults and Reset.
+ * Some pages might also be used in standalone dialogs or other containers. A SettingsPage provides suitable
+ * slots and signals to allow interaction with the container.
+ *
+ * A derived class needs to keep track of its changed state. Whenever a child widget changes, it needs to be
+ * compared to its value in permanent storage, and the changed state updated accordingly by calling setChangedState().
+ * For most standard widgets, SettingsPage can do this automatically if desired. Such a child widget needs to have
+ * a dynamic property \c settingsKey that maps to the key in the client configuration file. This key is appended
+ * to settingsKey(), which must be set to a non-null value in a derived class. If the widget's key starts with '/',
+ * 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())
+ * - QSpinBox (value())
+ */
+class UISUPPORT_EXPORT SettingsPage : public QWidget
+{
+ Q_OBJECT
+
+public:
+ SettingsPage(QString category, QString name, QWidget* parent = nullptr);
+
+ //! The category of this settings page.
+ inline virtual QString category() const { return _category; }
+
+ //! 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; }
+
+ /**
+ * Whether the settingspage should be selectable or not, in a given situation
+ * Used for pages that should only be visible if certain features are available (or not).
+ * @return
+ */
+ inline virtual bool isSelectable() const { return true; }
+
+ //! 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
+ * should be automatically handled needs to have a \c settingsKey property set, and should also provide
+ * a \c defaultValue property.
+ * You can return an empty string (as opposed to a null string) to use the config root as a base, and
+ * you can override this key for individual widgets by prefixing their SettingsKey with /.
+ */
+ inline virtual QString settingsKey() const { return QString(); }