QTreeWidgetItem *item = new QTreeWidgetItem(cat, QStringList(sp->title()));
treeItems[sp] = item;
pages[QString("%1$%2").arg(sp->category(), sp->title())] = sp;
- sp->load();
+ pageIsLoaded[sp] = false;
// TESTING
- selectPage(sp->category(), sp->title());
+ // selectPage(sp->category(), sp->title());
}
void SettingsDlg::selectPage(const QString &cat, const QString &title) {
ui.settingsTree->setCurrentItem(0);
return;
}
+ if(!pageIsLoaded[sp]) {
+ sp->load();
+ pageIsLoaded[sp] = true;
+ }
if(sp != currentPage() && currentPage() != 0 && currentPage()->hasChanged()) {
int ret = QMessageBox::warning(this, tr("Save changes"),
tr("There are unsaved changes on the current configuration page. Would you like to apply your changes now?"),
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());
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();