summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Patrick Valsecchi <patrick@thus.ch>2013-10-10 10:16:32 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-10-10 07:11:32 -0700
commit1dccf84c678b4d91ac4efeab3432360ce0aa1cbc (patch)
treec16740b4facf50fb1d3c54a436325c40ebe3d833
parentc5a15c6a4544379a907e67accd849d2bdfe309a0 (diff)
downloadsubsurface-1dccf84c678b4d91ac4efeab3432360ce0aa1cbc.tar.gz
Added salinity to the Dive Info tab.
Took the opportunity to remove some copy&paste. Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
-rw-r--r--qt-ui/maintab.cpp30
-rw-r--r--qt-ui/maintab.ui16
2 files changed, 26 insertions, 20 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index d753379c7..6751224e2 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -195,6 +195,8 @@ bool MainTab::eventFilter(QObject* object, QEvent* event)
void MainTab::clearEquipment()
{
+ cylindersModel->clear();
+ weightModel->clear();
}
void MainTab::clearInfo()
@@ -211,6 +213,7 @@ void MainTab::clearInfo()
ui.waterTemperatureText->clear();
ui.airTemperatureText->clear();
ui.airPressureText->clear();
+ ui.salinityText->clear();
}
void MainTab::clearStats()
@@ -325,6 +328,10 @@ void MainTab::updateDiveInfo(int dive)
ui.airPressureText->setText(QString("%1mbar").arg(d->surface_pressure.mbar));
else
ui.airPressureText->clear();
+ if (d->salinity)
+ ui.salinityText->setText(QString("%1g/l").arg(d->salinity/10.0));
+ else
+ ui.salinityText->clear();
ui.depthLimits->setMaximum(get_depth_string(stats_selection.max_depth, TRUE));
ui.depthLimits->setMinimum(get_depth_string(stats_selection.min_depth, TRUE));
ui.depthLimits->setAverage(get_depth_string(stats_selection.avg_depth, TRUE));
@@ -354,29 +361,12 @@ void MainTab::updateDiveInfo(int dive)
weightModel->setDive(&multiEditEquipmentPlaceholder);
} else {
/* clear the fields */
+ clearInfo();
+ clearStats();
+ clearEquipment();
ui.rating->setCurrentStars(0);
ui.coordinates->clear();
- ui.sacText->clear();
- ui.otuText->clear();
- ui.oxygenHeliumText->clear();
- ui.dateText->clear();
- ui.diveTimeText->clear();
- ui.surfaceIntervalText->clear();
- ui.maximumDepthText->clear();
- ui.averageDepthText->clear();
ui.visibility->setCurrentStars(0);
- ui.waterTemperatureText->clear();
- ui.airTemperatureText->clear();
- ui.gasUsedText->clear();
- ui.airPressureText->clear();
- cylindersModel->clear();
- weightModel->clear();
- ui.depthLimits->clear();
- ui.sacLimits->clear();
- ui.divesAllText->clear();
- ui.tempLimits->clear();
- ui.totalTimeAllText->clear();
- ui.timeLimits->clear();
/* turns out this is non-trivial for a dateTimeEdit... this is a partial hack */
QLineEdit *le = ui.dateTimeEdit->findChild<QLineEdit*>();
le->setText("");
diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui
index 2f532c74b..3685f19ac 100644
--- a/qt-ui/maintab.ui
+++ b/qt-ui/maintab.ui
@@ -584,6 +584,22 @@
</widget>
</item>
<item row="4" column="0">
+ <widget class="QGroupBox">
+ <property name="title">
+ <string>Salinity</string>
+ </property>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="salinityText">
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="5" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>