diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-06-12 11:52:59 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-12 11:52:59 -0700 |
commit | 21be237b0e5608dc506bb0a09dcf8000c5a821ca (patch) | |
tree | 05f5f1bcadf0f19a22bacc989f5c79800f895941 /qt-ui | |
parent | 6227372c2f71c98c8cf84e2cbb34cb6619e9ec75 (diff) | |
download | subsurface-21be237b0e5608dc506bb0a09dcf8000c5a821ca.tar.gz |
Delay loading of some settings until later
This early in init_ui() the settings may not be available, yet.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/mainwindow.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index a57965ea7..676ca3ab7 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -769,6 +769,16 @@ void MainWindow::initialUiSetup() settings.endGroup(); } +const char *getSetting(QSettings &s, QString name) +{ + QVariant v; + v = s.value(name); + if (v.isValid()) { + return strdup(v.toString().toUtf8().data()); + } + return NULL; +} + #define TOOLBOX_PREF_BUTTON(pref, setting, button) \ prefs.pref = s.value(#setting).toBool(); \ ui.button->setChecked(prefs.pref); @@ -797,6 +807,13 @@ void MainWindow::readSettings() TOOLBOX_PREF_BUTTON(hrgraph, hrgraph, profHR); TOOLBOX_PREF_BUTTON(rulergraph, rulergraph, profRuler); TOOLBOX_PREF_BUTTON(show_sac, show_sac, profSAC); + s.endGroup(); + s.beginGroup("DiveComputer"); + default_dive_computer_vendor = getSetting(s, "dive_computer_vendor"); + default_dive_computer_product = getSetting(s, "dive_computer_product"); + default_dive_computer_device = getSetting(s, "dive_computer_device"); + s.endGroup(); + loadRecentFiles(&s); } #undef TOOLBOX_PREF_BUTTON |