X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fsettingspage.cpp;h=9ee7f00f6c9769f88f0689bf4158bcd88bb368f9;hb=731ec69d4608ba95e3ae4f154b8ca1852e1db2e5;hp=0417751cf8858266856455e17094e9691412fcf7;hpb=8b68bdc964968d1d988242c37a598ba88cd0551c;p=quassel.git diff --git a/src/uisupport/settingspage.cpp b/src/uisupport/settingspage.cpp index 0417751c..9ee7f00f 100644 --- a/src/uisupport/settingspage.cpp +++ b/src/uisupport/settingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel IRC Team * + * Copyright (C) 2005-08 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -20,23 +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 +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); } -void SettingsPage::changed() { - emit changed(true); +bool SettingsPage::hasChanged(QCheckBox *box) { + return box->property("StoredValue").toBool() == box->isChecked(); } -void SettingsPage::changeState(bool hasChanged) { - emit changed(hasChanged); + +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(); }