summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-10-02 11:09:13 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-30 10:36:51 -0700
commit8a54a46779bac174cb9216d1c8aa76a3bfc1bc84 (patch)
treee9e769fb2a300b854935a4eff986fd206b119d54 /desktop-widgets
parentd9595ad266021575522f73bb87dfc51517461d59 (diff)
downloadsubsurface-8a54a46779bac174cb9216d1c8aa76a3bfc1bc84.tar.gz
Preferences: random fixes
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/preferences/preferences_defaults.cpp12
-rw-r--r--desktop-widgets/preferences/preferences_defaults.h2
-rw-r--r--desktop-widgets/preferences/preferences_graph.cpp1
-rw-r--r--desktop-widgets/preferences/preferences_units.cpp34
-rw-r--r--desktop-widgets/preferences/preferencesdialog.cpp5
-rw-r--r--desktop-widgets/preferences/preferencesdialog.h2
6 files changed, 24 insertions, 32 deletions
diff --git a/desktop-widgets/preferences/preferences_defaults.cpp b/desktop-widgets/preferences/preferences_defaults.cpp
index 637117105..45888ebec 100644
--- a/desktop-widgets/preferences/preferences_defaults.cpp
+++ b/desktop-widgets/preferences/preferences_defaults.cpp
@@ -25,7 +25,6 @@ void PreferencesDefaults::on_chooseFile_clicked()
ui->defaultfilename->setText(choosenFileName);
}
-
void PreferencesDefaults::on_btnUseDefaultFile_toggled(bool toggle)
{
if (toggle) {
@@ -36,22 +35,11 @@ void PreferencesDefaults::on_btnUseDefaultFile_toggled(bool toggle)
}
}
-void PreferencesDefaults::on_noDefaultFile_toggled(bool toggle)
-{
- prefs.default_file_behavior = NO_DEFAULT_FILE;
-}
-
void PreferencesDefaults::on_localDefaultFile_toggled(bool toggle)
{
ui->defaultfilename->setEnabled(toggle);
ui->btnUseDefaultFile->setEnabled(toggle);
ui->chooseFile->setEnabled(toggle);
- prefs.default_file_behavior = LOCAL_DEFAULT_FILE;
-}
-
-void PreferencesDefaults::on_cloudDefaultFile_toggled(bool toggle)
-{
- prefs.default_file_behavior = CLOUD_DEFAULT_FILE;
}
void PreferencesDefaults::refreshSettings()
diff --git a/desktop-widgets/preferences/preferences_defaults.h b/desktop-widgets/preferences/preferences_defaults.h
index 94de8b28a..c72be31a6 100644
--- a/desktop-widgets/preferences/preferences_defaults.h
+++ b/desktop-widgets/preferences/preferences_defaults.h
@@ -18,9 +18,7 @@ public:
public slots:
void on_chooseFile_clicked();
void on_btnUseDefaultFile_toggled(bool toggled);
- void on_noDefaultFile_toggled(bool toggled);
void on_localDefaultFile_toggled(bool toggled);
- void on_cloudDefaultFile_toggled(bool toggled);
private:
Ui::PreferencesDefaults *ui;
diff --git a/desktop-widgets/preferences/preferences_graph.cpp b/desktop-widgets/preferences/preferences_graph.cpp
index f671076f4..327557692 100644
--- a/desktop-widgets/preferences/preferences_graph.cpp
+++ b/desktop-widgets/preferences/preferences_graph.cpp
@@ -49,7 +49,6 @@ void PreferencesGraph::syncSettings()
s.setValue("pscr_ratio", rint(1000.0 / ui->pscrfactor->value()));
s.endGroup();
- // Graph
s.beginGroup("TecDetails");
SAVE_OR_REMOVE("phethreshold", default_prefs.pp_graphs.phe_threshold, ui->pheThreshold->value());
SAVE_OR_REMOVE("po2threshold", default_prefs.pp_graphs.po2_threshold, ui->po2Threshold->value());
diff --git a/desktop-widgets/preferences/preferences_units.cpp b/desktop-widgets/preferences/preferences_units.cpp
index 76f2078d7..cc77e51bb 100644
--- a/desktop-widgets/preferences/preferences_units.cpp
+++ b/desktop-widgets/preferences/preferences_units.cpp
@@ -17,23 +17,6 @@ PreferencesUnits::~PreferencesUnits()
void PreferencesUnits::refreshSettings()
{
- QSettings s;
- s.beginGroup("Units");
- QString unitSystem[] = {"metric", "imperial", "personal"};
- short unitValue = ui->metric->isChecked() ? METRIC : (ui->imperial->isChecked() ? IMPERIAL : PERSONALIZE);
- SAVE_OR_REMOVE_SPECIAL("unit_system", default_prefs.unit_system, unitValue, unitSystem[unitValue]);
- s.setValue("temperature", ui->fahrenheit->isChecked() ? units::FAHRENHEIT : units::CELSIUS);
- s.setValue("length", ui->feet->isChecked() ? units::FEET : units::METERS);
- s.setValue("pressure", ui->psi->isChecked() ? units::PSI : units::BAR);
- s.setValue("volume", ui->cuft->isChecked() ? units::CUFT : units::LITER);
- s.setValue("weight", ui->lbs->isChecked() ? units::LBS : units::KG);
- s.setValue("vertical_speed_time", ui->vertical_speed_minutes->isChecked() ? units::MINUTES : units::SECONDS);
- s.setValue("coordinates", ui->gpsTraditional->isChecked());
- s.endGroup();
-}
-
-void PreferencesUnits::syncSettings()
-{
switch(prefs.unit_system) {
case METRIC: ui->metric->setChecked(true); break;
case IMPERIAL: ui->imperial->setChecked(true); break;
@@ -58,3 +41,20 @@ void PreferencesUnits::syncSettings()
ui->vertical_speed_minutes->setChecked(prefs.units.vertical_speed_time == units::MINUTES);
ui->vertical_speed_seconds->setChecked(prefs.units.vertical_speed_time == units::SECONDS);
}
+
+void PreferencesUnits::syncSettings()
+{
+ QSettings s;
+ s.beginGroup("Units");
+ QString unitSystem[] = {"metric", "imperial", "personal"};
+ short unitValue = ui->metric->isChecked() ? METRIC : (ui->imperial->isChecked() ? IMPERIAL : PERSONALIZE);
+ SAVE_OR_REMOVE_SPECIAL("unit_system", default_prefs.unit_system, unitValue, unitSystem[unitValue]);
+ s.setValue("temperature", ui->fahrenheit->isChecked() ? units::FAHRENHEIT : units::CELSIUS);
+ s.setValue("length", ui->feet->isChecked() ? units::FEET : units::METERS);
+ s.setValue("pressure", ui->psi->isChecked() ? units::PSI : units::BAR);
+ s.setValue("volume", ui->cuft->isChecked() ? units::CUFT : units::LITER);
+ s.setValue("weight", ui->lbs->isChecked() ? units::LBS : units::KG);
+ s.setValue("vertical_speed_time", ui->vertical_speed_minutes->isChecked() ? units::MINUTES : units::SECONDS);
+ s.setValue("coordinates", ui->gpsTraditional->isChecked());
+ s.endGroup();
+}
diff --git a/desktop-widgets/preferences/preferencesdialog.cpp b/desktop-widgets/preferences/preferencesdialog.cpp
index bf751bff7..5b4cc560e 100644
--- a/desktop-widgets/preferences/preferencesdialog.cpp
+++ b/desktop-widgets/preferences/preferencesdialog.cpp
@@ -100,6 +100,8 @@ void PreferencesDialogV2::applyRequested()
Q_FOREACH(AbstractPreferencesWidget *page, pages) {
page->syncSettings();
}
+ emit settingsChanged();
+ accept();
}
void PreferencesDialogV2::cancelRequested()
@@ -107,6 +109,7 @@ void PreferencesDialogV2::cancelRequested()
Q_FOREACH(AbstractPreferencesWidget *page, pages) {
page->refreshSettings();
}
+ reject();
}
void PreferencesDialogV2::defaultsRequested()
@@ -115,4 +118,6 @@ void PreferencesDialogV2::defaultsRequested()
Q_FOREACH(AbstractPreferencesWidget *page, pages) {
page->refreshSettings();
}
+ emit settingsChanged();
+ accept();
}
diff --git a/desktop-widgets/preferences/preferencesdialog.h b/desktop-widgets/preferences/preferencesdialog.h
index dcc97bf94..720b94c25 100644
--- a/desktop-widgets/preferences/preferencesdialog.h
+++ b/desktop-widgets/preferences/preferencesdialog.h
@@ -17,6 +17,8 @@ public:
virtual ~PreferencesDialogV2();
void addPreferencePage(AbstractPreferencesWidget *page);
void refreshPages();
+signals:
+ void settingsChanged();
private:
void cancelRequested();
void applyRequested();