Add ability to reset the settings

This may be a bit crude and it doesn't actually FULLY reset the settings
(as for example the column widths will still be maintained), but it's a
good start, I think.

Fixes #552

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-06-25 17:46:51 +08:00
parent 81b268d4ba
commit dd96b03d22
3 changed files with 58 additions and 18 deletions

View file

@ -350,6 +350,30 @@ void PreferencesDialog::on_chooseFile_clicked()
ui.defaultfilename->setText(choosenFileName);
}
void PreferencesDialog::on_resetSettings_clicked()
{
QSettings s;
QMessageBox response(this);
response.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
response.setDefaultButton(QMessageBox::Cancel);
response.setWindowTitle(tr("Warning"));
response.setText(tr("If you click OK, all settings of Subsurface are reset to their default values. This will be applied immediately."));
response.setWindowModality(Qt::WindowModal);
int result = response.exec();
if (result == QMessageBox::Ok) {
prefs = default_prefs;
setUiFromPrefs();
QStringList keys = s.allKeys();
Q_FOREACH (QString key, keys) {
s.remove(key);
}
syncSettings();
close();
}
}
void PreferencesDialog::emitSettingsChanged()
{
emit settingsChanged();