summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-02-26 12:05:23 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-03-04 12:16:49 -0800
commitd36f056bded107ea78abb39b64b810a249d64966 (patch)
tree135b13d3109069a20ce17f3d3f50cafce4801f44 /desktop-widgets
parentf1c46927effcc2182fff3f7acf507ba68cad8ade (diff)
downloadsubsurface-d36f056bded107ea78abb39b64b810a249d64966.tar.gz
Get initial depth/duration correct when manually adding dive
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/maintab.cpp10
-rw-r--r--desktop-widgets/maintab.h1
-rw-r--r--desktop-widgets/mainwindow.cpp5
3 files changed, 16 insertions, 0 deletions
diff --git a/desktop-widgets/maintab.cpp b/desktop-widgets/maintab.cpp
index d181131a8..b5a156d68 100644
--- a/desktop-widgets/maintab.cpp
+++ b/desktop-widgets/maintab.cpp
@@ -431,6 +431,16 @@ void MainTab::refreshDiveInfo()
updateDiveInfo();
}
+void MainTab::updateDepthDuration()
+{
+ ui.depth->setVisible(true);
+ ui.depthLabel->setVisible(true);
+ ui.duration->setVisible(true);
+ ui.durationLabel->setVisible(true);
+ ui.duration->setText(QDateTime::fromTime_t(displayed_dive.duration.seconds).toUTC().toString("h:mm"));
+ ui.depth->setText(get_depth_string(displayed_dive.maxdepth, true));
+}
+
void MainTab::updateDiveInfo(bool clear)
{
ui.location->refreshDiveSiteCache();
diff --git a/desktop-widgets/maintab.h b/desktop-widgets/maintab.h
index 690c8680c..25d078434 100644
--- a/desktop-widgets/maintab.h
+++ b/desktop-widgets/maintab.h
@@ -66,6 +66,7 @@ slots:
void addWeight_clicked();
void refreshDiveInfo();
void updateDiveInfo(bool clear = false);
+ void updateDepthDuration();
void acceptChanges();
void rejectChanges();
void on_location_diveSiteSelected();
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 5bba49c57..b6faa3dff 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -986,6 +986,11 @@ void MainWindow::on_actionAddDive_triggered()
DivePlannerPointsModel::instance()->createSimpleDive();
configureToolbar();
graphics()->plotDive();
+ fixup_dc_duration(&displayed_dive.dc);
+ displayed_dive.duration = displayed_dive.dc.duration;
+
+ // now that we have the correct depth and duration, update the dive info
+ information()->updateDepthDuration();
}
void MainWindow::on_actionEditDive_triggered()