diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-06-25 17:46:51 +0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-25 17:46:51 +0800 |
commit | dd96b03d225367fcd527c4df0f5c5362d0aed09a (patch) | |
tree | a1db1285374cd38e8fefc529ea0bb861fb4277ac /qt-ui/preferences.cpp | |
parent | 81b268d4ba48338b6adda0efd011f58c5e44ed88 (diff) | |
download | subsurface-dd96b03d225367fcd527c4df0f5c5362d0aed09a.tar.gz |
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>
Diffstat (limited to 'qt-ui/preferences.cpp')
-rw-r--r-- | qt-ui/preferences.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp index 034d1be6f..fe4c87247 100644 --- a/qt-ui/preferences.cpp +++ b/qt-ui/preferences.cpp @@ -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(); |