#include "settingspagedlg.h"
-SettingsPageDlg::SettingsPageDlg(SettingsPage *page, QWidget *parent) : QDialog(parent) {
+SettingsPageDlg::SettingsPageDlg(SettingsPage *page, QWidget *parent)
+ : QDialog(parent)
+{
ui.setupUi(this);
_currentPage = page;
page->setParent(this);
+
+ // make it look more native under Mac OS X:
+ setWindowFlags(Qt::Sheet);
+
ui.pageTitle->setText(page->title());
// make the scrollarea behave sanely
void SettingsPageDlg::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 SettingsPageDlg::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();