diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-04-13 15:35:27 +0200 |
---|---|---|
committer | Robert C. Helling <helling@atdotde.de> | 2020-05-04 10:42:07 +0200 |
commit | 4f5621c4c6acc3a1dbc1dbdc1267a222dcf66854 (patch) | |
tree | 118ffce3e495ccba777ecc34935704abfdd5333a /qt-models | |
parent | 62cbf26cc8abd9373b72f919bdd50f666318873e (diff) | |
download | subsurface-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 'qt-models')
-rw-r--r-- | qt-models/diveplannermodel.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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; |