cmake: avoid de-duplication of user's CXXFLAGS
[quassel.git] / src / uisupport / settingspage.h
index 667c908..5b1199a 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2018 by the Quassel Project                        *
+ *   Copyright (C) 2005-2022 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -18,8 +18,9 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
-#ifndef _SETTINGSPAGE_H_
-#define _SETTINGSPAGE_H_
+#pragma once
+
+#include "uisupport-export.h"
 
 #include <QWidget>
 
@@ -55,13 +56,12 @@ class FontSelector;
  *    - 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; }
@@ -83,7 +83,7 @@ public:
     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.
+    /** This needs to be overridden 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.
@@ -97,7 +97,7 @@ public:
      *  enabled. You also need to provide an implementation of defaults() then.
      *
      * The default implementation returns false.
-       */
+     */
     inline virtual bool hasDefaults() const { return false; }
 
     //! Check if there are changes in the page, compared to the state saved in permanent storage.
@@ -109,15 +109,15 @@ public:
      */
     inline virtual bool aboutToSave() { return true; }
 
-    //! sets checked state depending on \checked and stores the value for later comparision
-    static void load(QCheckBox *box, bool checked);
-    static bool hasChanged(QCheckBox *box);
-    static void load(QComboBox *box, int index);
-    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);
+    //! sets checked state depending on \checked and stores the value for later comparison
+    static void load(QCheckBoxbox, bool checked);
+    static bool hasChanged(QCheckBoxbox);
+    static void load(QComboBoxbox, int index);
+    static bool hasChanged(QComboBoxbox);
+    static void load(QSpinBoxbox, int value);
+    static bool hasChanged(QSpinBoxbox);
+    static void load(FontSelectorbox, QFont value);
+    static bool hasChanged(FontSelectorbox);
 
 public slots:
     //! Save settings to permanent storage.
@@ -139,16 +139,13 @@ 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);
 
 protected:
     void initAutoWidgets();
-    virtual QVariant loadAutoWidgetValue(const QString &widgetName);
-    virtual void saveAutoWidgetValue(const QString &widgetName, const QVariant &value);
+    virtual QVariant loadAutoWidgetValue(const QStringwidgetName);
+    virtual void saveAutoWidgetValue(const QString& widgetName, const QVariant& value);
 
 signals:
     //! Emitted whenever the widget state changes.
@@ -159,14 +156,11 @@ private slots:
     void autoWidgetHasChanged();
 
 private:
-    void findAutoWidgets(QObject *parent, QObjectList *widgetList) const;
-    QByteArray autoWidgetPropertyName(QObject *widget) const;
-    QString autoWidgetSettingsKey(QObject *widget) const;
+    void findAutoWidgets(QObject* parent, QObjectList* widgetList) const;
+    QByteArray autoWidgetPropertyName(QObjectwidget) const;
+    QString autoWidgetSettingsKey(QObjectwidget) const;
 
     QString _category, _title;
     bool _changed, _autoWidgetsChanged;
     QObjectList _autoWidgets;
 };
-
-
-#endif