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>
This commit is contained in:
Tomaz Canabrava 2013-09-16 12:30:58 -03:00
parent fad55b3047
commit f74799d581
2 changed files with 23 additions and 6 deletions

View file

@ -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();
}

View file

@ -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();