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 <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2015-06-16 14:37:02 +02:00 committed by Dirk Hohndel
parent f66ea4cbb0
commit eca7d998e1
5 changed files with 8 additions and 10 deletions

View file

@ -840,12 +840,7 @@ void DivePlannerPointsModel::createTemporaryPlan()
#endif #endif
if (recalcQ() && !diveplan_empty(&diveplan)) { if (recalcQ() && !diveplan_empty(&diveplan)) {
plan(&diveplan, &cache, isPlanner(), false); plan(&diveplan, &cache, isPlanner(), false);
/* TODO: emit calculatedPlanNotes();
* 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);
} }
// throw away the cache // throw away the cache
free(cache); free(cache);

View file

@ -97,7 +97,7 @@ signals:
void cylinderModelEdited(); void cylinderModelEdited();
void startTimeChanged(QDateTime); void startTimeChanged(QDateTime);
void recreationChanged(bool); void recreationChanged(bool);
void calculatedPlanNotes(const QString& notes); void calculatedPlanNotes();
private: private:
explicit DivePlannerPointsModel(QObject *parent = 0); explicit DivePlannerPointsModel(QObject *parent = 0);

View file

@ -127,6 +127,8 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
plannerModel, SIGNAL(cylinderModelEdited())); plannerModel, SIGNAL(cylinderModelEdited()));
connect(CylindersModel::instance(), SIGNAL(rowsRemoved(QModelIndex, int, int)), connect(CylindersModel::instance(), SIGNAL(rowsRemoved(QModelIndex, int, int)),
plannerModel, SIGNAL(cylinderModelEdited())); plannerModel, SIGNAL(cylinderModelEdited()));
connect(plannerModel, SIGNAL(calculatedPlanNotes()), MainWindow::instance(), SLOT(setPlanNotes()));
ui.tableWidget->setBtnToolTip(tr("Add dive data point")); ui.tableWidget->setBtnToolTip(tr("Add dive data point"));
connect(ui.startTime, SIGNAL(timeChanged(QTime)), plannerModel, SLOT(setStartTime(QTime))); connect(ui.startTime, SIGNAL(timeChanged(QTime)), plannerModel, SLOT(setStartTime(QTime)));

View file

@ -619,9 +619,9 @@ void MainWindow::planCreated()
refreshDisplay(); refreshDisplay();
} }
void MainWindow::setPlanNotes(const char *notes) void MainWindow::setPlanNotes()
{ {
plannerDetails()->divePlanOutput()->setHtml(notes); plannerDetails()->divePlanOutput()->setHtml(displayed_dive.notes);
} }
void MainWindow::printPlan() void MainWindow::printPlan()

View file

@ -88,7 +88,6 @@ public:
PlannerDetails *plannerDetails() const; PlannerDetails *plannerDetails() const;
void setLoadedWithFiles(bool filesFromCommandLine); void setLoadedWithFiles(bool filesFromCommandLine);
bool filesFromCommandLine() const; bool filesFromCommandLine() const;
void setPlanNotes(const char *notes);
void printPlan(); void printPlan();
void checkSurvey(QSettings *s); void checkSurvey(QSettings *s);
void setApplicationState(const QByteArray& state); void setApplicationState(const QByteArray& state);
@ -188,6 +187,8 @@ slots:
void planCreated(); void planCreated();
void setEnabledToolbar(bool arg1); void setEnabledToolbar(bool arg1);
void enableDiveSiteCreation(); void enableDiveSiteCreation();
void setPlanNotes();
private: private:
Ui::MainWindow ui; Ui::MainWindow ui;