summaryrefslogtreecommitdiffstats
path: root/qt-ui/preferences.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-07-16 18:40:49 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-16 15:52:29 -0700
commit1b6144350d38c2246a0366ae52d0f99a758737e4 (patch)
treee9ae1c27c134aab5be05250d58fe6f021653fb2c /qt-ui/preferences.cpp
parentbf7fc97b50374a7b317d4d942dda2ff4e135f422 (diff)
downloadsubsurface-1b6144350d38c2246a0366ae52d0f99a758737e4.tar.gz
Added a 'use default file' button on preferences.
Added a 'Use default file' button on preferences in a way that doesn't clutters the interface. Fixes #630 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/preferences.cpp')
-rw-r--r--qt-ui/preferences.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index a35675690..cc5cfefb8 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -132,6 +132,7 @@ void PreferencesDialog::setUiFromPrefs()
ui.proxyUsername->setText(prefs.proxy_user);
ui.proxyPassword->setText(prefs.proxy_pass);
ui.proxyType->setCurrentIndex(ui.proxyType->findData(prefs.proxy_type));
+ ui.btnUseDefaultFile->setChecked(prefs.use_default_file);
}
void PreferencesDialog::restorePrefs()
@@ -227,6 +228,7 @@ void PreferencesDialog::syncSettings()
s.beginGroup("GeneralSettings");
s.setValue("default_filename", ui.defaultfilename->text());
s.setValue("default_cylinder", ui.default_cylinder->currentText());
+ s.setValue("use_default_file", ui.btnUseDefaultFile->isChecked());
s.endGroup();
s.beginGroup("Display");
@@ -326,6 +328,7 @@ void PreferencesDialog::loadSettings()
s.beginGroup("GeneralSettings");
GET_TXT("default_filename", default_filename);
GET_TXT("default_cylinder", default_cylinder);
+ GET_BOOL("use_default_file", use_default_file);
s.endGroup();
s.beginGroup("Display");
@@ -427,3 +430,13 @@ void PreferencesDialog::proxyType_changed(int idx)
ui.proxyPassword->setEnabled(hpEnabled & ui.proxyAuthRequired->isChecked());
ui.proxyAuthRequired->setChecked(ui.proxyAuthRequired->isChecked());
}
+
+void PreferencesDialog::on_btnUseDefaultFile_toggled(bool toggle)
+{
+ if (toggle) {
+ ui.defaultfilename->setText(system_default_filename());
+ ui.defaultfilename->setEnabled(false);
+ } else {
+ ui.defaultfilename->setEnabled(true);
+ }
+}