X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fsettingspage.h;h=994a3e4f06a8468814baf407cb67f55b12aad255;hp=eaa0d5f789c56c5c0b23814391c0b99f72a0a60e;hb=6eefdfc697067d184a589fc8a231b16316c09106;hpb=1cb02004ee5973b89368bd84f234d4652794690d diff --git a/src/uisupport/settingspage.h b/src/uisupport/settingspage.h index eaa0d5f7..994a3e4f 100644 --- a/src/uisupport/settingspage.h +++ b/src/uisupport/settingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -18,14 +18,16 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef _SETTINGSPAGE_H_ -#define _SETTINGSPAGE_H_ +#pragma once + +#include "uisupport-export.h" #include class QCheckBox; class QComboBox; class QSpinBox; +class FontSelector; //! A SettingsPage is a page in the settings dialog. /** The SettingsDlg provides suitable standard buttons, such as Ok, Apply, Cancel, Restore Defaults and Reset. @@ -54,13 +56,12 @@ class QSpinBox; * - QComboBox (currentIndex()) * - QSpinBox (value()) */ -class SettingsPage : public QWidget +class UISUPPORT_EXPORT SettingsPage : public QWidget { Q_OBJECT public: - SettingsPage(const QString &category, const QString &name, QWidget *parent = 0); - virtual ~SettingsPage() {}; + SettingsPage(QString category, QString name, QWidget *parent = nullptr); //! The category of this settings page. inline virtual QString category() const { return _category; } @@ -74,6 +75,13 @@ public: */ 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 @@ -108,6 +116,8 @@ public: static bool hasChanged(QComboBox *box); static void load(QSpinBox *box, int value); static bool hasChanged(QSpinBox *box); + static void load(FontSelector *box, QFont value); + static bool hasChanged(FontSelector *box); public slots: //! Save settings to permanent storage. @@ -129,9 +139,6 @@ public slots: virtual void defaults(); protected slots: - //! Calling this slot is equivalent to calling setChangedState(true). - inline void changed() { setChangedState(true); } - //! This should be called whenever the widget state changes from unchanged to change or the other way round. void setChangedState(bool hasChanged = true); @@ -157,6 +164,3 @@ private: bool _changed, _autoWidgetsChanged; QObjectList _autoWidgets; }; - - -#endif