X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingsdlg.cpp;h=b5fc125c2e1e131f2e021140b0e5b0c37dd04056;hp=1e8a59b1e28fa175bccf75b5a91ad9d4f9a308b1;hb=569bfa97ac24d59a77c1debf92fce356c2dc5826;hpb=9a6a8478bdd8c7c5bb4ff1fa3de9510863d65a97 diff --git a/src/qtui/settingsdlg.cpp b/src/qtui/settingsdlg.cpp index 1e8a59b1..b5fc125c 100644 --- a/src/qtui/settingsdlg.cpp +++ b/src/qtui/settingsdlg.cpp @@ -65,8 +65,9 @@ void SettingsDlg::registerSettingsPage(SettingsPage *sp) { QTreeWidgetItem *item = new QTreeWidgetItem(cat, QStringList(sp->title())); treeItems[sp] = item; pages[QString("%1$%2").arg(sp->category(), sp->title())] = sp; + sp->load(); // TESTING - //selectPage(sp->category(), sp->title()); + selectPage(sp->category(), sp->title()); } void SettingsDlg::selectPage(const QString &cat, const QString &title) { @@ -90,7 +91,7 @@ void SettingsDlg::selectPage(const QString &cat, const QString &title) { if(sp != currentPage()) { ui.pageTitle->setText(sp->title()); ui.settingsStack->setCurrentWidget(sp); - ui.settingsStack->setMinimumSize(sp->sizeHint()); // we don't want our page shrinked, use scrollbars instead... + ui.settingsStack->setMinimumSize(sp->minimumSizeHint()); // we don't want our page shrinked, use scrollbars instead... _currentPage = sp; } ui.settingsTree->setCurrentItem(treeItems[sp]); @@ -112,7 +113,6 @@ void SettingsDlg::itemSelected() { void SettingsDlg::setButtonStates() { SettingsPage *sp = currentPage(); - ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(sp && sp->hasChanged()); ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(sp && sp->hasChanged()); ui.buttonBox->button(QDialogButtonBox::Reset)->setEnabled(sp && sp->hasChanged()); ui.buttonBox->button(QDialogButtonBox::RestoreDefaults)->setEnabled(sp && sp->hasDefaults()); @@ -121,7 +121,9 @@ void SettingsDlg::setButtonStates() { void SettingsDlg::buttonClicked(QAbstractButton *button) { switch(ui.buttonBox->standardButton(button)) { case QDialogButtonBox::Ok: - if(applyChanges()) accept(); + if(currentPage() && currentPage()->hasChanged()) { + if(applyChanges()) accept(); + } else accept(); break; case QDialogButtonBox::Apply: applyChanges(); @@ -169,7 +171,7 @@ void SettingsDlg::loadDefaults() { if(!currentPage()) return; int ret = QMessageBox::question(this, tr("Restore Defaults"), tr("Do you like to restore the default values for this page?"), QMessageBox::RestoreDefaults|QMessageBox::Cancel, QMessageBox::Cancel); - if(ret == QMessageBox::Yes) { + if(ret == QMessageBox::RestoreDefaults) { currentPage()->defaults(); } }