diff options
Diffstat (limited to 'qt-ui')
| -rw-r--r-- | qt-ui/maintab.cpp | 8 | ||||
| -rw-r--r-- | qt-ui/maintab.h | 4 | ||||
| -rw-r--r-- | qt-ui/mainwindow.cpp | 5 | ||||
| -rw-r--r-- | qt-ui/modeldelegates.cpp | 2 | ||||
| -rw-r--r-- | qt-ui/models.cpp | 3 | ||||
| -rw-r--r-- | qt-ui/preferences.cpp | 4 | ||||
| -rw-r--r-- | qt-ui/preferences.ui | 54 |
7 files changed, 58 insertions, 22 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index ae0de914f..2498a0d97 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -74,7 +74,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), connect(ui.weights, SIGNAL(addButtonClicked()), this, SLOT(addWeight_clicked())); connect(ui.cylinders->view(), SIGNAL(clicked(QModelIndex)), this, SLOT(editCylinderWidget(QModelIndex))); - connect(ui.weights->view(), SIGNAL(clicked(QModelIndex)), this, SLOT(editWeigthWidget(QModelIndex))); + connect(ui.weights->view(), SIGNAL(clicked(QModelIndex)), this, SLOT(editWeightWidget(QModelIndex))); connect(ui.notesButtonBox, SIGNAL(accepted()), this, SLOT(acceptChanges())); connect(ui.notesButtonBox, SIGNAL(rejected()), this, SLOT(rejectChanges())); connect(ui.equipmentButtonBox, SIGNAL(accepted()), this, SLOT(acceptChanges())); @@ -167,7 +167,7 @@ void MainTab::enableEdition() notesBackup[mydive].cylinders[i] = mydive->cylinder[i]; } for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) { - notesBackup[mydive].weigthsystem[i] = mydive->weightsystem[i]; + notesBackup[mydive].weightsystem[i] = mydive->weightsystem[i]; } } editMode = DIVE; @@ -561,7 +561,7 @@ void MainTab::rejectChanges() mydive->cylinder[i] = notesBackup[mydive].cylinders[i]; } for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) { - mydive->weightsystem[i] = notesBackup[mydive].weigthsystem[i]; + mydive->weightsystem[i] = notesBackup[mydive].weightsystem[i]; } } multiEditEquipmentPlaceholder = *get_dive(selected_dive); @@ -726,7 +726,7 @@ void MainTab::editCylinderWidget(const QModelIndex& index) ui.cylinders->edit(index); } -void MainTab::editWeigthWidget(const QModelIndex& index) +void MainTab::editWeightWidget(const QModelIndex& index) { if (editMode == NONE) enableEdition(); diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index 8afa5ff02..2a588bad8 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -32,7 +32,7 @@ struct NotesBackup{ int visibility; QString divemaster; cylinder_t cylinders[MAX_CYLINDERS]; - weightsystem_t weigthsystem[MAX_WEIGHTSYSTEMS ]; + weightsystem_t weightsystem[MAX_WEIGHTSYSTEMS ]; }; struct Completers{ @@ -72,7 +72,7 @@ public slots: void on_rating_valueChanged(int value); void on_visibility_valueChanged(int value); void editCylinderWidget(const QModelIndex& index); - void editWeigthWidget(const QModelIndex& index); + void editWeightWidget(const QModelIndex& index); void addDiveStarted(); private: diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index bbacc74a1..84b1bc50b 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -416,7 +416,7 @@ void MainWindow::on_actionUserManual_triggered() QString MainWindow::filter() { QString f; - f += "ALL ( *.xml *.XML *.uddf *.udcf *.UDFC *.jlb *.JLB "; + f += "ALL ( *.ssrf *.xml *.XML *.uddf *.udcf *.UDFC *.jlb *.JLB "; #ifdef LIBZIP f += "*.sde *.SDE *.dld *.DLD "; #endif @@ -425,6 +425,7 @@ QString MainWindow::filter() #endif f += ");;"; + f += "Subsurface (*.ssrf);;"; f += "XML (*.xml *.XML);;"; f += "UDDF (*.uddf);;"; f += "UDCF (*.udcf *.UDCF);;"; @@ -567,6 +568,7 @@ void MainWindow::readSettings() GET_UNIT("temperature", temperature, units::FAHRENHEIT, units::CELSIUS); GET_UNIT("weight", weight, units::LBS, units::KG); } + GET_UNIT("vertical_speed_time", vertical_speed_time, units::MINUTES, units::SECONDS); s.endGroup(); s.beginGroup("TecDetails"); GET_BOOL("po2graph", pp_graphs.po2); @@ -624,6 +626,7 @@ void MainWindow::writeSettings() SAVE_VALUE("volume", units.volume); SAVE_VALUE("temperature", units.temperature); SAVE_VALUE("weight", units.weight); + SAVE_VALUE("vertical_speed_time", units.vertical_speed_time); settings.endGroup(); settings.beginGroup("TecDetails"); SAVE_VALUE("po2graph", pp_graphs.po2); diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp index e80afab59..5304313b3 100644 --- a/qt-ui/modeldelegates.cpp +++ b/qt-ui/modeldelegates.cpp @@ -117,7 +117,7 @@ QWidget* ComboBoxDelegate::createEditor(QWidget* parent, const QStyleOptionViewI /* This Method is being called when the user *writes* something and press enter or tab, * and it`s also called when the mouse walks over the list of choices from the ComboBox, - * One thing is important, if the user writes a *new* cylinder or weigth type, it will + * One thing is important, if the user writes a *new* cylinder or weight type, it will * be ADDED to the list, and the user will need to fill the other data. */ void ComboBoxDelegate::testActivation(const QString& currText) diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 6831b9271..752f3ddf3 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -1114,7 +1114,8 @@ QString DiveItem::displayWeight() const int kg = weight() / 1000; str = QString("%1.%2").arg(kg).arg((unsigned)(gr) / 100); } else { - str = QString("%1").arg((unsigned)(grams_to_lbs(weight()))); + double lbs = grams_to_lbs(weight()); + str = QString("%1").arg(lbs, 0, 'f', lbs >= 40.0 ? 0 : 1 ); } return str; diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp index b996bf2df..e188cdba7 100644 --- a/qt-ui/preferences.cpp +++ b/qt-ui/preferences.cpp @@ -73,6 +73,8 @@ void PreferencesDialog::setUiFromPrefs() ui.defaultfilename->setText(prefs.default_filename); ui.displayinvalid->setChecked(prefs.show_invalid); ui.show_time->setChecked(prefs.show_time); + ui.vertical_speed_minutes->setChecked(prefs.units.vertical_speed_time == units::MINUTES); + ui.vertical_speed_seconds->setChecked(prefs.units.vertical_speed_time == units::SECONDS); } void PreferencesDialog::restorePrefs() @@ -109,6 +111,7 @@ void PreferencesDialog::setPrefsFromUi() prefs.units.pressure = ui.psi->isChecked() ? units::PSI : units::BAR; prefs.units.volume = ui.cuft->isChecked() ? units::CUFT : units::LITER; prefs.units.weight = ui.lbs->isChecked() ? units::LBS : units::KG; + prefs.units.vertical_speed_time = ui.vertical_speed_minutes->isChecked() ? units::MINUTES : units::SECONDS; prefs.divelist_font = strdup(ui.font->font().family().toUtf8().data()); prefs.font_size = ui.fontsize->value(); prefs.default_filename = strdup(ui.defaultfilename->text().toUtf8().data()); @@ -151,6 +154,7 @@ void PreferencesDialog::syncSettings() s.setValue("pressure", ui.psi->isChecked() ? units::PSI : units::BAR); s.setValue("volume", ui.cuft->isChecked() ? units::CUFT : units::LITER); s.setValue("weight", ui.lbs->isChecked() ? units::LBS : units::KG); + s.setValue("vertical_speed_time", ui.vertical_speed_minutes->isChecked() ? units::MINUTES : units::SECONDS); s.endGroup(); // Defaults s.beginGroup("GeneralSettings"); diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui index 55076235d..18767a790 100644 --- a/qt-ui/preferences.ui +++ b/qt-ui/preferences.ui @@ -402,6 +402,46 @@ </widget> </item> <item> + <layout class="QHBoxLayout"> + <item> + <widget class="QGroupBox"> + <property name="title"> + <string>Time units</string> + </property> + <layout class="QGridLayout"> + <item row="0" column="0"> + <widget class="QLabel"> + <property name="text"> + <string>Ascent/Descent speed denominator</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QRadioButton" name="vertical_speed_minutes"> + <property name="text"> + <string>Minutes</string> + </property> + <attribute name="buttonGroup"> + <string notr="true">verticalSpeed</string> + </attribute> + </widget> + </item> + <item row="0" column="2"> + <widget class="QRadioButton" name="vertical_speed_seconds"> + <property name="text"> + <string>Seconds</string> + </property> + <attribute name="buttonGroup"> + <string notr="true">verticalSpeed</string> + </attribute> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </item> + <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -414,19 +454,6 @@ </property> </spacer> </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> </layout> </widget> <widget class="QWidget" name="page_3"> @@ -999,5 +1026,6 @@ <buttongroup name="buttonGroup_5"/> <buttongroup name="buttonGroup"/> <buttongroup name="buttonGroup_6"/> + <buttongroup name="verticalSpeed"/> </buttongroups> </ui> |