diff options
author | Patrick Valsecchi <patrick@thus.ch> | 2013-10-10 10:16:32 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-10-10 07:11:32 -0700 |
commit | 1dccf84c678b4d91ac4efeab3432360ce0aa1cbc (patch) | |
tree | c16740b4facf50fb1d3c54a436325c40ebe3d833 /qt-ui/maintab.cpp | |
parent | c5a15c6a4544379a907e67accd849d2bdfe309a0 (diff) | |
download | subsurface-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>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r-- | qt-ui/maintab.cpp | 30 |
1 files changed, 10 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(""); |