aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
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()