diff options
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 16 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.h | 1 | ||||
-rw-r--r-- | qt-models/diveplannermodel.cpp | 10 |
3 files changed, 11 insertions, 16 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 7b7d3bab3..0f7078c68 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -852,19 +852,6 @@ void MainWindow::printPlan() #endif } -void MainWindow::setupForAddAndPlan(const char *model) -{ - // clean out the dive and give it an id and the correct dc model - clear_dive(&displayed_dive); - displayed_dive.id = dive_getUniqID(); - displayed_dive.when = QDateTime::currentMSecsSinceEpoch() / 1000L + gettimezoneoffset() + 3600; - displayed_dive.dc.model = strdup(model); // don't translate! this is stored in the XML file - dc_number = 1; - // setup the dive cylinders - DivePlannerPointsModel::instance()->clear(); - DivePlannerPointsModel::instance()->setupCylinders(); -} - void MainWindow::on_actionReplanDive_triggered() { if (!plannerStateClean() || !current_dive) @@ -902,10 +889,9 @@ void MainWindow::on_actionDivePlanner_triggered() setApplicationState(ApplicationState::PlanDive); graphics->setPlanState(); + dc_number = 1; // create a simple starting dive, using the first gas from the just copied cylinders - setupForAddAndPlan("planned dive"); // don't translate, stored in XML file - DivePlannerPointsModel::instance()->setupStartTime(); DivePlannerPointsModel::instance()->createSimpleDive(); // plan the dive in the same mode as the currently selected one if (current_dive) { diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h index 7f8e17196..683897cd7 100644 --- a/desktop-widgets/mainwindow.h +++ b/desktop-widgets/mainwindow.h @@ -211,7 +211,6 @@ private: LocationInformationWidget *diveSiteEdit; bool plannerStateClean(); - void setupForAddAndPlan(const char *model); void configureToolbar(); void setupSocialNetworkMenu(); QDialog *findMovedImagesDialog; diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index 6bb560098..ea24c3a73 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -46,6 +46,16 @@ void DivePlannerPointsModel::removeSelectedPoints(const QVector<int> &rows) void DivePlannerPointsModel::createSimpleDive() { + // clean out the dive and give it an id and the correct dc model + clear_dive(&displayed_dive); + displayed_dive.id = dive_getUniqID(); + displayed_dive.when = QDateTime::currentMSecsSinceEpoch() / 1000L + gettimezoneoffset() + 3600; + displayed_dive.dc.model = strdup("planned dive"); // don't translate! this is stored in the XML file + + clear(); + setupCylinders(); + setupStartTime(); + // initialize the start time in the plan diveplan.when = displayed_dive.when; |