summaryrefslogtreecommitdiffstats
path: root/qt-ui/preferences.cpp
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2013-11-24 23:21:29 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-24 15:07:25 -0800
commitd0fbfc7a9c999bdab79884f3991650a1c0866adb (patch)
treeaf06e2f40312f65d7c5dc85213212bdaafcc205d /qt-ui/preferences.cpp
parenta25d351b64f311afe1d60af231bd1214b6eb4783 (diff)
downloadsubsurface-d0fbfc7a9c999bdab79884f3991650a1c0866adb.tar.gz
Create a drop down to choose default cylinder
This also renames the ui element to match. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/preferences.cpp')
-rw-r--r--qt-ui/preferences.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index e0ac4039f..4a3189337 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -78,7 +78,12 @@ void PreferencesDialog::setUiFromPrefs()
ui.font->setFont(QString(prefs.divelist_font));
ui.fontsize->setValue(prefs.font_size);
ui.defaultfilename->setText(prefs.default_filename);
- ui.defaultcylinder->setText(prefs.default_cylinder);
+ ui.default_cylinder->clear();
+ for(int i=0; tank_info[i].name != NULL; i++) {
+ ui.default_cylinder->addItem(tank_info[i].name);
+ if (prefs.default_cylinder && strcmp(tank_info[i].name, prefs.default_cylinder) == 0)
+ ui.default_cylinder->setCurrentIndex(i);
+ }
ui.displayinvalid->setChecked(prefs.display_invalid_dives);
ui.show_sac->setChecked(prefs.show_sac);
ui.vertical_speed_minutes->setChecked(prefs.units.vertical_speed_time == units::MINUTES);
@@ -140,7 +145,7 @@ void PreferencesDialog::syncSettings()
// Defaults
s.beginGroup("GeneralSettings");
s.setValue("default_filename", ui.defaultfilename->text());
- s.setValue("default_cylinder", ui.defaultcylinder->text());
+ s.setValue("default_cylinder", ui.default_cylinder->currentText());
s.endGroup();
s.beginGroup("Display");