X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fsettingspage.cpp;h=9ee7f00f6c9769f88f0689bf4158bcd88bb368f9;hb=38880d99a159fd670915d910bcb2c4280b3efc51;hp=e752ec72efa45f60278fd901c5b6b93aaac732cd;hpb=6579cd49c867ce3fb6c99127851a881ea82d1b1b;p=quassel.git diff --git a/src/uisupport/settingspage.cpp b/src/uisupport/settingspage.cpp index e752ec72..9ee7f00f 100644 --- a/src/uisupport/settingspage.cpp +++ b/src/uisupport/settingspage.cpp @@ -20,6 +20,11 @@ #include "settingspage.h" +#include +#include +#include +#include + SettingsPage::SettingsPage(const QString &category, const QString &title, QWidget *parent) : QWidget(parent), _category(category), @@ -35,3 +40,30 @@ 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(); +} + + +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(); +}