diff options
-rw-r--r-- | qt-ui/maintab.cpp | 3 | ||||
-rw-r--r-- | qt-ui/mainwindow.cpp | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 7ee6e834c..003f0319a 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -261,6 +261,9 @@ bool MainTab::isEditing() void MainTab::updateDiveInfo(int dive) { + // don't execute this while adding a dive + if (editMode == ADD) + return; if (!isEnabled() && dive != -1) setEnabled(true); if (isEnabled() && dive == -1) diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index be539620b..c111f3926 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -286,8 +286,8 @@ void MainWindow::on_actionAddDive_triggered() // clear the selection dive_list()->unselectDives(); disableDcShortcuts(); - DivePlannerPointsModel::instance()->clear(); DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD); + // now cheat - create one dive that we use to store the info tab data in struct dive *dive = alloc_dive(); dive->when = QDateTime::currentMSecsSinceEpoch() / 1000L + gettimezoneoffset(); @@ -297,11 +297,12 @@ void MainWindow::on_actionAddDive_triggered() // accepting the dive select_dive(get_divenr(dive)); ui.InfoWidget->updateDiveInfo(selected_dive); + ui.InfoWidget->addDiveStarted(); ui.stackedWidget->setCurrentIndex(PLANNERPROFILE); // Planner. ui.infoPane->setCurrentIndex(MAINTAB); + DivePlannerPointsModel::instance()->clear(); DivePlannerPointsModel::instance()->createSimpleDive(); refreshDisplay(); - ui.InfoWidget->addDiveStarted(); } void MainWindow::on_actionRenumber_triggered() |