summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2017-11-27 17:36:21 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-12-01 15:47:51 -0800
commita9703628c4c4d3b1226d4ea86b3079718940e14e (patch)
treec008eb9c45ef2b02425c086b39877d35cc34ec5f /desktop-widgets/mainwindow.cpp
parentf159792b8050bb6d07dbf29c525dc5e86da2688b (diff)
downloadsubsurface-a9703628c4c4d3b1226d4ea86b3079718940e14e.tar.gz
Actually compute variations in background
This reenables the computation of plan variations but now in a separate thread. Once finieshed, a signal is sent to update the notes. Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'desktop-widgets/mainwindow.cpp')
-rw-r--r--desktop-widgets/mainwindow.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 6d4c36dc1..12592ece0 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -212,6 +212,7 @@ MainWindow::MainWindow() : QMainWindow(),
connect(information(), SIGNAL(dateTimeChanged()), graphics(), SLOT(dateTimeChanged()));
connect(DivePlannerPointsModel::instance(), SIGNAL(planCreated()), this, SLOT(planCreated()));
connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled()));
+ connect(DivePlannerPointsModel::instance(), SIGNAL(variationsComputed(QString)), this, SLOT(updateVariations(QString)));
connect(plannerDetails->printPlan(), SIGNAL(pressed()), divePlannerWidget(), SLOT(printDecoPlan()));
connect(this, SIGNAL(startDiveSiteEdit()), this, SLOT(on_actionDiveSiteEdit_triggered()));
connect(information(), SIGNAL(diveSiteChanged(struct dive_site *)), mapWidget, SLOT(centerOnDiveSite(struct dive_site *)));
@@ -445,7 +446,6 @@ void MainWindow::enableDisableCloudActions()
PlannerDetails *MainWindow::plannerDetails() const {
return qobject_cast<PlannerDetails*>(applicationState["PlanDive"].bottomRight);
}
-
PlannerSettingsWidget *MainWindow::divePlannerSettingsWidget() {
return qobject_cast<PlannerSettingsWidget*>(applicationState["PlanDive"].bottomLeft);
}
@@ -899,6 +899,14 @@ void MainWindow::setPlanNotes()
plannerDetails()->divePlanOutput()->setHtml(displayed_dive.notes);
}
+void MainWindow::updateVariations(QString variations)
+{
+ QString notes = QString(displayed_dive.notes);
+ free(displayed_dive.notes);
+ displayed_dive.notes = strdup(notes.replace("VARIATIONS", variations).toUtf8().data());
+ plannerDetails()->divePlanOutput()->setHtml(displayed_dive.notes);
+}
+
void MainWindow::printPlan()
{
#ifndef NO_PRINTING