aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-09-16 12:30:58 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-09-16 12:30:58 -0300
commitf74799d5815bb1d6e7d6c6c531ccf9ba6e966191 (patch)
tree9e0edfcd66be4b0280b23a57fbb358827a2d76d6 /qt-ui
parentfad55b30471b821950a9439e38daa9ca5b89ed64 (diff)
downloadsubsurface-f74799d5815bb1d6e7d6c6c531ccf9ba6e966191.tar.gz
Ok on the planner now correctly creates a Dive.
Ok on the planner now correctly creates a dive, a few remarks, tougth: 1 - the number of the added dive is always 0 ( but I may be testing it wrong ) 2 - the information pane is working only when the mouse is clicked, this is a regression and it will be fixed. ;) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveplanner.cpp28
-rw-r--r--qt-ui/diveplanner.h1
2 files changed, 23 insertions, 6 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 5cecd0f96..98a0c89b1 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -813,6 +813,7 @@ DivePlannerWidget::DivePlannerWidget(QWidget* parent, Qt::WindowFlags f): QWidge
connect(ui->buttonBox, SIGNAL(accepted()), plannerModel, SLOT(createPlan()));
connect(ui->buttonBox, SIGNAL(rejected()), plannerModel, SLOT(cancelPlan()));
connect(plannerModel, SIGNAL(planCreated()), mainWindow(), SLOT(showProfile()));
+ connect(plannerModel, SIGNAL(planCreated()), mainWindow(), SLOT(refreshDisplay()));
connect(plannerModel, SIGNAL(planCanceled()), mainWindow(), SLOT(showProfile()));
/* set defaults. */
@@ -950,11 +951,6 @@ DivePlannerPointsModel* DivePlannerPointsModel::instance()
return self;
}
-void DivePlannerPointsModel::createPlan()
-{
-
-}
-
void DivePlannerPointsModel::setBottomSac(int sac)
{
diveplan.bottomsac = sac;
@@ -1130,3 +1126,25 @@ void DivePlannerPointsModel::deleteTemporaryPlan(struct divedatapoint *dp)
deleteTemporaryPlan(dp->next);
free(dp);
}
+
+void DivePlannerPointsModel::createPlan()
+{
+ // Ok, so, here the diveplan creates a dive,
+ // puts it on the dive list, and we need to remember
+ // to not delete it later. mumble. ;p
+ char *cache = NULL;
+ tempDive = NULL;
+ char *errorString = NULL;
+
+ createTemporaryPlan();
+ plan(&diveplan, &cache, &tempDive, &errorString);
+ mark_divelist_changed(TRUE);
+ diveplan.dp = NULL;
+
+ beginRemoveRows(QModelIndex(), 0, rowCount() -1 );
+ divepoints.clear();
+ endRemoveRows();
+
+ // show_error(error_string);
+ planCreated();
+}
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index ea528068a..84545ce40 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -130,7 +130,6 @@ protected:
virtual void mousePressEvent(QMouseEvent* event);
virtual void mouseReleaseEvent(QMouseEvent* event);
bool isPointOutOfBoundaries(const QPointF& point);
- void deleteTemporaryDivePlan(struct divedatapoint* dp);
qreal fromPercent(qreal percent, Qt::Orientation orientation);
private slots:
void keyEscAction();