+#include "fontselector.h"
+#include "uisettings.h"
+#include "widgethelpers.h"
+
+SettingsPage::SettingsPage(QString category, QString title, QWidget *parent)
+ : QWidget(parent),
+ _category(std::move(category)),
+ _title(std::move(title)),
+ _changed(false),
+ _autoWidgetsChanged(false)
+{
+}
+
+
+void SettingsPage::setChangedState(bool hasChanged_)
+{
+ if (hasChanged_ != _changed) {
+ bool old = hasChanged();
+ _changed = hasChanged_;
+ if (hasChanged() != old)
+ emit changed(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();
+}
+
+
+void SettingsPage::load(QComboBox *box, int index)
+{
+ box->setProperty("storedValue", index);
+ box->setCurrentIndex(index);
+}
+
+
+bool SettingsPage::hasChanged(QComboBox *box)
+{
+ return box->property("storedValue").toInt() != box->currentIndex();
+}
+
+
+void SettingsPage::load(QSpinBox *box, int value)
+{
+ box->setProperty("storedValue", value);
+ box->setValue(value);
+}
+
+
+bool SettingsPage::hasChanged(QSpinBox *box)
+{
+ return box->property("storedValue").toInt() != box->value();
+}
+
+
+void SettingsPage::load(FontSelector *box, QFont value)
+{
+ box->setProperty("storedValue", value);
+ box->setSelectedFont(value);
+}
+
+
+bool SettingsPage::hasChanged(FontSelector *box)
+{
+ return box->property("storedValue").value<QFont>() != box->selectedFont();