adding new settings for proper message redirection
[quassel.git] / src / uisupport / settingspage.cpp
index 7808a74..c815d98 100644 (file)
 
 #include "settingspage.h"
 
-SettingsPage::SettingsPage(const QString &category, const QString &title, QWidget *parent) : QWidget(parent),
-     _category(category), _title(title) {
+#include <QCheckBox>
+#include <QVariant>
 
-  _changed = false;
-}
-
-QString SettingsPage::category() const {
-  return _category;
-}
-
-QString SettingsPage::title() const {
-  return _title;
-}
-
-bool SettingsPage::hasDefaults() const {
-  return false;
-}
-
-void SettingsPage::defaults() {
-
-}
-
-bool SettingsPage::hasChanged() const {
-  return _changed;
-}
-
-bool SettingsPage::aboutToSave() {
-  return true;
-}
-
-void SettingsPage::changed() {
-  setChangedState(true);
+SettingsPage::SettingsPage(const QString &category, const QString &title, QWidget *parent)
+  : QWidget(parent),
+    _category(category),
+    _title(title),
+    _changed(false)
+{
 }
 
 void SettingsPage::setChangedState(bool hasChanged) {
@@ -61,3 +38,11 @@ void SettingsPage::setChangedState(bool hasChanged) {
   }
 }
 
+void SettingsPage::load(QCheckBox *box, bool checked) {
+  box->setProperty("StoredValue", checked);
+  box->setChecked(checked);
+}
+
+bool SettingsPage::hasChanged(QCheckBox *box) {
+  return box->property("StoredValue").toBool() == box->isChecked();
+}