diff options
-rw-r--r-- | core/subsurface-qt/DiveListNotifier.h | 1 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveInformation.cpp | 17 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveInformation.h | 1 |
3 files changed, 14 insertions, 5 deletions
diff --git a/core/subsurface-qt/DiveListNotifier.h b/core/subsurface-qt/DiveListNotifier.h index 64ef71481..11da468cf 100644 --- a/core/subsurface-qt/DiveListNotifier.h +++ b/core/subsurface-qt/DiveListNotifier.h @@ -28,6 +28,7 @@ enum class DiveField { TAGS, MODE, NOTES, + SALINITY }; enum class TripField { LOCATION, diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp index 492ba97a7..66c1f7401 100644 --- a/desktop-widgets/tab-widgets/TabDiveInformation.cpp +++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp @@ -106,6 +106,14 @@ void TabDiveInformation::updateWhen() ui->surfaceIntervalText->clear(); } +void TabDiveInformation::updateSalinity() +{ + if (current_dive->salinity) + ui->salinityText->setText(QString("%1g/ℓ").arg(current_dive->salinity / 10.0)); + else + ui->salinityText->clear(); +} + void TabDiveInformation::updateData() { if (!current_dive) { @@ -117,11 +125,7 @@ void TabDiveInformation::updateData() updateWhen(); ui->waterTemperatureText->setText(get_temperature_string(current_dive->watertemp, true)); ui->airTemperatureText->setText(get_temperature_string(current_dive->airtemp, true)); - - if (current_dive->salinity) - ui->salinityText->setText(QString("%1g/ℓ").arg(current_dive->salinity / 10.0)); - else - ui->salinityText->clear(); + updateSalinity(); ui->atmPressType->setEditable(true); ui->atmPressType->setItemText(1, get_depth_unit()); // Check for changes in depth unit (imperial/metric) @@ -155,6 +159,9 @@ void TabDiveInformation::divesChanged(const QVector<dive *> &dives, DiveField fi case DiveField::DATETIME: updateWhen(); break; + case DiveField::SALINITY: + updateSalinity(); + break; default: break; } diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.h b/desktop-widgets/tab-widgets/TabDiveInformation.h index 04c27acab..5305f4146 100644 --- a/desktop-widgets/tab-widgets/TabDiveInformation.h +++ b/desktop-widgets/tab-widgets/TabDiveInformation.h @@ -23,6 +23,7 @@ private slots: private: Ui::TabDiveInformation *ui; void updateProfile(); + void updateSalinity(); void updateWhen(); int pressTypeIndex; void updateTextBox(int event); |