summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
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
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')
-rw-r--r--desktop-widgets/diveplanner.h2
-rw-r--r--desktop-widgets/mainwindow.cpp10
-rw-r--r--desktop-widgets/mainwindow.h3
3 files changed, 13 insertions, 2 deletions
diff --git a/desktop-widgets/diveplanner.h b/desktop-widgets/diveplanner.h
index 955fc690a..8f42dd21d 100644
--- a/desktop-widgets/diveplanner.h
+++ b/desktop-widgets/diveplanner.h
@@ -55,7 +55,6 @@ slots:
void printDecoPlan();
void setSurfacePressure(int surface_pressure);
void setSalinity(int salinity);
-
private:
Ui::DivePlanner ui;
QAbstractButton *replanButton;
@@ -103,6 +102,7 @@ public:
explicit PlannerDetails(QWidget *parent = 0);
QPushButton *printPlan() const { return ui.printPlan; }
QTextEdit *divePlanOutput() const { return ui.divePlanOutput; }
+ QLabel *divePlannerOutputLabel() const { return ui.divePlanOutputLabel; }
private:
Ui::plannerDetails ui;
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
diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h
index 75c32c2e4..ca1bf8962 100644
--- a/desktop-widgets/mainwindow.h
+++ b/desktop-widgets/mainwindow.h
@@ -15,6 +15,7 @@
#include <QProgressDialog>
#include "ui_mainwindow.h"
+#include "ui_plannerDetails.h"
#include "desktop-widgets/notificationwidget.h"
#include "core/windowtitleupdate.h"
#include "core/gpslocation.h"
@@ -186,6 +187,8 @@ slots:
void socialNetworkRequestUpload();
void facebookLoggedIn();
void facebookLoggedOut();
+ void updateVariations(QString);
+
private:
Ui::MainWindow ui;