From d0fbfc7a9c999bdab79884f3991650a1c0866adb Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Sun, 24 Nov 2013 23:21:29 +0100 Subject: Create a drop down to choose default cylinder This also renames the ui element to match. Signed-off-by: Anton Lundin Signed-off-by: Dirk Hohndel --- qt-ui/preferences.cpp | 9 +++++++-- qt-ui/preferences.ui | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'qt-ui') 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"); diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui index d30752829..cb546a93b 100644 --- a/qt-ui/preferences.ui +++ b/qt-ui/preferences.ui @@ -209,7 +209,7 @@ - + -- cgit v1.2.3-70-g09d2