diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-07-01 12:32:46 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-07-01 12:38:40 -0700 |
commit | a413141b334e89b0c9944bc403b8774f85427509 (patch) | |
tree | 323df09d9fa03984b3ce17340fb408633df46db5 /qt-ui/preferences.cpp | |
parent | f7b7d4c2df7fb82421588c69b3aa34e702dcbfdb (diff) | |
download | subsurface-a413141b334e89b0c9944bc403b8774f85427509.tar.gz |
Geo taxonomy: adjust the preferences to the new data structures
This allows us to pick which three categories of geo taxonomy will be
shown in the UI.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/preferences.cpp')
-rw-r--r-- | qt-ui/preferences.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp index c93460f9a..25638c991 100644 --- a/qt-ui/preferences.cpp +++ b/qt-ui/preferences.cpp @@ -241,9 +241,9 @@ void PreferencesDialog::setUiFromPrefs() ui.enable_geocoding->setChecked( prefs.geocoding.enable_geocoding ); ui.parse_without_gps->setChecked(prefs.geocoding.parse_dive_without_gps); ui.tag_existing_dives->setChecked(prefs.geocoding.tag_existing_dives); - ui.first_item->setCurrentText(prefs.geocoding.first_item); - ui.second_item->setCurrentText(prefs.geocoding.second_item); - ui.third_item->setCurrentText(prefs.geocoding.third_item); + ui.first_item->setCurrentIndex(prefs.geocoding.category[0]); + ui.second_item->setCurrentIndex(prefs.geocoding.category[1]); + ui.third_item->setCurrentIndex(prefs.geocoding.category[2]); } void PreferencesDialog::restorePrefs() @@ -288,6 +288,13 @@ void PreferencesDialog::rememberPrefs() else \ prefs.field = default_prefs.field +#define GET_ENUM(name, type, field) \ + v = s.value(QString(name)); \ + if (v.isValid()) \ + prefs.field = (enum type)v.toInt(); \ + else \ + prefs.field = default_prefs.field + #define GET_INT_DEF(name, field, defval) \ v = s.value(QString(name)); \ if (v.isValid()) \ @@ -455,9 +462,9 @@ void PreferencesDialog::syncSettings() s.setValue("enable_geocoding", ui.enable_geocoding->isChecked()); s.setValue("parse_dives_without_gps", ui.parse_without_gps->isChecked()); s.setValue("tag_existing_dives", ui.tag_existing_dives->isChecked()); - s.setValue("first_item", ui.first_item->currentText()); - s.setValue("second_item", ui.second_item->currentText()); - s.setValue("third_item", ui.third_item->currentText()); + s.setValue("cat0", ui.first_item->currentIndex()); + s.setValue("cat1", ui.second_item->currentIndex()); + s.setValue("cat2", ui.third_item->currentIndex()); s.endGroup(); loadSettings(); @@ -603,9 +610,9 @@ void PreferencesDialog::loadSettings() GET_BOOL("enable_geocoding", geocoding.enable_geocoding); GET_BOOL("parse_dives_without_gps", geocoding.parse_dive_without_gps); GET_BOOL("tag_existing_dives", geocoding.tag_existing_dives); - GET_TXT("first_item", geocoding.first_item); - GET_TXT("second_item", geocoding.second_item); - GET_TXT("third_item", geocoding.third_item); + GET_ENUM("cat0", taxonomy_category, geocoding.category[0]); + GET_ENUM("cat1", taxonomy_category, geocoding.category[1]); + GET_ENUM("cat2", taxonomy_category, geocoding.category[2]); s.endGroup(); } |