aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-03-02 22:37:29 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-02 13:42:07 -0800
commit909cfe71356a0c71c27354f9f2c7a77e1969b866 (patch)
tree3e5e638559d4e00ab925d9259105cc07861f97d1 /qt-ui
parentb7940dec5c7839eb3a315baf5f5248b45c8c5f9a (diff)
downloadsubsurface-909cfe71356a0c71c27354f9f2c7a77e1969b866.tar.gz
Set the prefs-value alongside the button status
Previous code just set the button-"status" based on what we stored on the settings. This sets the corresponding value in our prefs-struct. This fixes the same issue as in 63f7f3, without the side effect of magically hiding the mean depth line. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/mainwindow.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 43e55bac8..43f596eb2 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -620,6 +620,10 @@ void MainWindow::initialUiSetup()
settings.endGroup();
}
+#define TOOLBOX_PREF_BUTTON(pref, setting, button) \
+ prefs.pref = s.value(#setting).toBool(); \
+ ui.button->setChecked(prefs.pref);
+
void MainWindow::readSettings()
{
QSettings s;
@@ -630,20 +634,22 @@ void MainWindow::readSettings()
s.endGroup();
s.beginGroup("TecDetails");
- ui.profCalcAllTissues->setChecked(s.value("calcalltissues").toBool());
- ui.profCalcCeiling->setChecked(s.value("calcceiling").toBool());
- ui.profDcCeiling->setChecked(s.value("dcceiling").toBool());
- ui.profEad->setChecked(s.value("ead").toBool());
- ui.profIncrement3m->setChecked(s.value("calcceiling3m").toBool());
- ui.profMod->setChecked(s.value("mod").toBool());
- ui.profNdl_tts->setChecked(s.value("calcndltts").toBool());
- ui.profPhe->setChecked(s.value("phegraph").toBool());
- ui.profPn2->setChecked(s.value("pn2graph").toBool());
- ui.profPO2->setChecked(s.value("po2graph").toBool());
+ TOOLBOX_PREF_BUTTON(calc_all_tissues, calcalltissues, profCalcAllTissues);
+ TOOLBOX_PREF_BUTTON(profile_calc_ceiling, calcceiling, profCalcCeiling);
+ TOOLBOX_PREF_BUTTON(profile_dc_ceiling, dcceiling, profDcCeiling);
+ TOOLBOX_PREF_BUTTON(ead, ead, profEad);
+ TOOLBOX_PREF_BUTTON(calc_ceiling_3m_incr, calcceiling3m, profIncrement3m);
+ TOOLBOX_PREF_BUTTON(mod, mod, profMod);
+ TOOLBOX_PREF_BUTTON(calc_ndl_tts, calcndltts, profNdl_tts);
+ TOOLBOX_PREF_BUTTON(pp_graphs.phe, phegraph, profPhe);
+ TOOLBOX_PREF_BUTTON(pp_graphs.pn2, pn2graph, profPn2);
+ TOOLBOX_PREF_BUTTON(pp_graphs.po2, po2graph, profPO2);
ui.profRuler->setChecked(s.value("rulergraph").toBool());
- ui.profSAC->setChecked(s.value("show_sac").toBool());
+ TOOLBOX_PREF_BUTTON(show_sac, show_sac, profSAC);
}
+#undef TOOLBOX_PREF_BUTTON
+
void MainWindow::writeSettings()
{
QSettings settings;