From 62cbf26cc8abd9373b72f919bdd50f666318873e Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 13 Apr 2020 15:09:35 +0200 Subject: planner: send plan in calculatedPlanNotes Thus, the MainWindow doesn't have to extract the plan from displayed_dive. This is a tiny step in an attempt to detangle the interfaces. The bigger goal will be to make displayed_dive local to the planner. Signed-off-by: Berthold Stoeger --- desktop-widgets/mainwindow.cpp | 4 ++-- desktop-widgets/mainwindow.h | 2 +- qt-models/diveplannermodel.cpp | 4 ++-- qt-models/diveplannermodel.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 1e893900b..7b7d3bab3 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -799,9 +799,9 @@ void MainWindow::planCreated() diveList->setFocus(); } -void MainWindow::setPlanNotes() +void MainWindow::setPlanNotes(QString plan) { - plannerDetails->divePlanOutput()->setHtml(displayed_dive.notes); + plannerDetails->divePlanOutput()->setHtml(plan); } void MainWindow::printPlan() diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h index 22cf1c828..7f8e17196 100644 --- a/desktop-widgets/mainwindow.h +++ b/desktop-widgets/mainwindow.h @@ -165,7 +165,7 @@ slots: void planCanceled(); void planCreated(); void setEnabledToolbar(bool arg1); - void setPlanNotes(); + void setPlanNotes(QString plan); // Some shortcuts like "change DC" or "copy/paste dive components" // should only be enabled when the profile's visible. void disableShortcuts(bool disablePaste = true); diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index 5d0375e69..6bb560098 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -985,7 +985,7 @@ void DivePlannerPointsModel::createTemporaryPlan() computeVariations(plan_copy, &plan_deco_state); #endif final_deco_state = plan_deco_state; - emit calculatedPlanNotes(); + emit calculatedPlanNotes(QString(displayed_dive.notes)); } // throw away the cache free(cache); @@ -1170,7 +1170,7 @@ void DivePlannerPointsModel::computeVariationsDone(QString variations) QString notes = QString(displayed_dive.notes); free(displayed_dive.notes); displayed_dive.notes = copy_qstring(notes.replace("VARIATIONS", variations)); - emit calculatedPlanNotes(); + emit calculatedPlanNotes(QString(displayed_dive.notes)); } void DivePlannerPointsModel::createPlan(bool replanCopy) diff --git a/qt-models/diveplannermodel.h b/qt-models/diveplannermodel.h index 24b153f0e..08ed8fd79 100644 --- a/qt-models/diveplannermodel.h +++ b/qt-models/diveplannermodel.h @@ -118,7 +118,7 @@ signals: void cylinderModelEdited(); void startTimeChanged(QDateTime); void recreationChanged(bool); - void calculatedPlanNotes(); + void calculatedPlanNotes(QString); void variationsComputed(QString); private: -- cgit v1.2.3-70-g09d2