X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fsettingspage.cpp;h=9ee7f00f6c9769f88f0689bf4158bcd88bb368f9;hp=7808a7401f80aec458b22c386ff799ca9ba64b0a;hb=b8553ef5376b181ddcc105a47d27f09c40cea9cc;hpb=ddfd94072cc44fcbae497e5a962b9e50579b2026 diff --git a/src/uisupport/settingspage.cpp b/src/uisupport/settingspage.cpp index 7808a740..9ee7f00f 100644 --- a/src/uisupport/settingspage.cpp +++ b/src/uisupport/settingspage.cpp @@ -20,44 +20,50 @@ #include "settingspage.h" -SettingsPage::SettingsPage(const QString &category, const QString &title, QWidget *parent) : QWidget(parent), - _category(category), _title(title) { +#include +#include +#include +#include - _changed = false; +SettingsPage::SettingsPage(const QString &category, const QString &title, QWidget *parent) + : QWidget(parent), + _category(category), + _title(title), + _changed(false) +{ } -QString SettingsPage::category() const { - return _category; +void SettingsPage::setChangedState(bool hasChanged) { + if(hasChanged != _changed) { + _changed = hasChanged; + emit changed(hasChanged); + } } -QString SettingsPage::title() const { - return _title; +void SettingsPage::load(QCheckBox *box, bool checked) { + box->setProperty("StoredValue", checked); + box->setChecked(checked); } -bool SettingsPage::hasDefaults() const { - return false; +bool SettingsPage::hasChanged(QCheckBox *box) { + return box->property("StoredValue").toBool() == box->isChecked(); } -void SettingsPage::defaults() { +void SettingsPage::load(QComboBox *box, int index) { + box->setProperty("StoredValue", index); + box->setCurrentIndex(index); } -bool SettingsPage::hasChanged() const { - return _changed; +bool SettingsPage::hasChanged(QComboBox *box) { + return box->property("StoredValue").toInt() == box->currentIndex(); } -bool SettingsPage::aboutToSave() { - return true; +void SettingsPage::load(QSpinBox *box, int value) { + box->setProperty("StoredValue", value); + box->setValue(value); } -void SettingsPage::changed() { - setChangedState(true); +bool SettingsPage::hasChanged(QSpinBox *box) { + return box->property("StoredValue").toInt() == box->value(); } - -void SettingsPage::setChangedState(bool hasChanged) { - if(hasChanged != _changed) { - _changed = hasChanged; - emit changed(hasChanged); - } -} -