summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-04-13 15:35:27 +0200
committerGravatar Robert C. Helling <helling@atdotde.de>2020-05-04 10:42:07 +0200
commit4f5621c4c6acc3a1dbc1dbdc1267a222dcf66854 (patch)
tree118ffce3e495ccba777ecc34935704abfdd5333a /desktop-widgets/mainwindow.cpp
parent62cbf26cc8abd9373b72f919bdd50f666318873e (diff)
downloadsubsurface-4f5621c4c6acc3a1dbc1dbdc1267a222dcf66854.tar.gz
Planner: fold MainWindow::setupForAddAndPlan into createSimpleDive()
There was only one caller of MainWindow::setupForAddAndPlan() left and that caller immediately called DivePlannerPointsModel::createSimpleDive(). Thus, we might just as fold the former in the latter and thus concentrate all the prepare-dive-for-plan business in one place. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/mainwindow.cpp')
-rw-r--r--desktop-widgets/mainwindow.cpp16
1 files changed, 1 insertions, 15 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) {