From c7485d352762773addeae8ae533989f18fefb37c Mon Sep 17 00:00:00 2001
From: "Robert C. Helling" <[email protected]>
Date: Tue, 16 Jun 2015 14:37:02 +0200
Subject: [PATCH] Set up signalling to display notes in planner again.

This got broken in a recent transition to more abstract models.

Signed-off-by: Robert C. Helling <[email protected]>
---
 qt-models/diveplannermodel.cpp | 7 +------
 qt-models/diveplannermodel.h   | 2 +-
 qt-ui/diveplanner.cpp          | 2 ++
 qt-ui/mainwindow.cpp           | 4 ++--
 qt-ui/mainwindow.h             | 3 ++-
 5 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index 5dd43c7..bace54e 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -840,12 +840,7 @@ void DivePlannerPointsModel::createTemporaryPlan()
 #endif
        if (recalcQ() && !diveplan_empty(&diveplan)) {
                plan(&diveplan, &cache, isPlanner(), false);
-               /* TODO:
-                * Hook this signal to the mainwindow(s), the call to MainWindow
-                * can't be here as we are now dealing with QML too.
-                */
-               //MainWindow::instance()->setPlanNotes(displayed_dive.notes);
-               emit calculatedPlanNotes(displayed_dive.notes);
+               emit calculatedPlanNotes();
        }
        // throw away the cache
        free(cache);
diff --git a/qt-models/diveplannermodel.h b/qt-models/diveplannermodel.h
index 403b86b..4d1ef32 100644
--- a/qt-models/diveplannermodel.h
+++ b/qt-models/diveplannermodel.h
@@ -97,7 +97,7 @@ signals:
        void cylinderModelEdited();
        void startTimeChanged(QDateTime);
        void recreationChanged(bool);
-       void calculatedPlanNotes(const QString& notes);
+       void calculatedPlanNotes();
 
 private:
        explicit DivePlannerPointsModel(QObject *parent = 0);
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 7ab0aac..e2a604b 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -127,6 +127,8 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, 
Qt::WindowFlags f) : QWidg
                plannerModel, SIGNAL(cylinderModelEdited()));
        connect(CylindersModel::instance(), SIGNAL(rowsRemoved(QModelIndex, 
int, int)),
                plannerModel, SIGNAL(cylinderModelEdited()));
+       connect(plannerModel, SIGNAL(calculatedPlanNotes()), 
MainWindow::instance(), SLOT(setPlanNotes()));
+
 
        ui.tableWidget->setBtnToolTip(tr("Add dive data point"));
        connect(ui.startTime, SIGNAL(timeChanged(QTime)), plannerModel, 
SLOT(setStartTime(QTime)));
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index de7cdbd..7e0d31a 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -617,9 +617,9 @@ void MainWindow::planCreated()
        refreshDisplay();
 }
 
-void MainWindow::setPlanNotes(const char *notes)
+void MainWindow::setPlanNotes()
 {
-       plannerDetails()->divePlanOutput()->setHtml(notes);
+       plannerDetails()->divePlanOutput()->setHtml(displayed_dive.notes);
 }
 
 void MainWindow::printPlan()
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
index 8469f57..b695239 100644
--- a/qt-ui/mainwindow.h
+++ b/qt-ui/mainwindow.h
@@ -87,7 +87,6 @@ public:
        PlannerDetails *plannerDetails() const;
        void setLoadedWithFiles(bool filesFromCommandLine);
        bool filesFromCommandLine() const;
-       void setPlanNotes(const char *notes);
        void printPlan();
        void checkSurvey(QSettings *s);
        void setApplicationState(const QByteArray& state);
@@ -187,6 +186,8 @@ slots:
        void planCreated();
        void setEnabledToolbar(bool arg1);
        void enableDiveSiteCreation();
+       void setPlanNotes();
+
 
 private:
        Ui::MainWindow ui;
-- 
2.3.2 (Apple Git-55)

Hi,

this connects a signal to reenable planner notes (see other thread).

Best
Robert

-- 
.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oO
Robert C. Helling     Elite Master Course Theoretical and Mathematical Physics
                      Scientific Coordinator
                      Ludwig Maximilians Universitaet Muenchen, Dept. Physik
                      Phone: +49 89 2180-4523  Theresienstr. 39, rm. B339
                      http://www.atdotde.de

Enhance your privacy, use cryptography! My PGP keys have fingerprints
A9D1 A01D 13A5 31FA 6515  BB44 0820 367C 36BC 0C1D    and
DCED 37B6 251C 7861 270D  5613 95C7 9D32 9A8D 9B8F





Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to