Commit 74a0e0de authored by Don Gagne's avatar Don Gagne

parent 4509f4b1
......@@ -203,15 +203,15 @@ QString RallyPointController::editorQml(void) const
return _rallyPointManager->editorQml();
}
void RallyPointController::_managerLoadComplete(const QList<QGeoCoordinate> rgPoints)
void RallyPointController::_managerLoadComplete(void)
{
// Fly view always reloads on _loadComplete
// Plan view only reloads on _loadComplete if specifically requested
if (_flyView || _itemsRequested) {
_points.clearAndDeleteContents();
QObjectList pointList;
for (int i=0; i<rgPoints.count(); i++) {
pointList.append(new RallyPoint(rgPoints[i], this));
for (int i=0; i<_rallyPointManager->points().count(); i++) {
pointList.append(new RallyPoint(_rallyPointManager->points()[i], this));
}
_points.swapObjectList(pointList);
setDirty(false);
......@@ -224,7 +224,7 @@ void RallyPointController::_managerLoadComplete(const QList<QGeoCoordinate> rgPo
void RallyPointController::_managerSendComplete(bool error)
{
// Fly view always reloads after send
if (!error && !_flyView) {
if (!error && _flyView) {
showPlanFromManagerVehicle();
}
}
......@@ -317,6 +317,7 @@ bool RallyPointController::showPlanFromManagerVehicle (void)
} else {
qCDebug(RallyPointControllerLog) << "showPlanFromManagerVehicle: sync complete";
_itemsRequested = true;
_managerLoadComplete();
return false;
}
}
......
......@@ -61,7 +61,7 @@ signals:
void loadComplete(void);
private slots:
void _managerLoadComplete(const QList<QGeoCoordinate> rgPoints);
void _managerLoadComplete(void);
void _managerSendComplete(bool error);
void _managerRemoveAllComplete(bool error);
void _setFirstPointCurrent(void);
......
......@@ -21,7 +21,7 @@ RallyPointManager::RallyPointManager(Vehicle* vehicle)
connect(&_planManager, &PlanManager::inProgressChanged, this, &RallyPointManager::inProgressChanged);
connect(&_planManager, &PlanManager::error, this, &RallyPointManager::error);
connect(&_planManager, &PlanManager::removeAllComplete, this, &RallyPointManager::removeAllComplete);
connect(&_planManager, &PlanManager::sendComplete, this, &RallyPointManager::sendComplete);
connect(&_planManager, &PlanManager::sendComplete, this, &RallyPointManager::_sendComplete);
connect(&_planManager, &PlanManager::newMissionItemsAvailable, this, &RallyPointManager::_planManagerLoadComplete);
}
......@@ -45,8 +45,12 @@ void RallyPointManager::loadFromVehicle(void)
void RallyPointManager::sendToVehicle(const QList<QGeoCoordinate>& rgPoints)
{
QList<MissionItem*> rallyItems;
_rgSendPoints.clear();
for (const QGeoCoordinate& rallyPoint: rgPoints) {
_rgSendPoints.append(rallyPoint);
}
QList<MissionItem*> rallyItems;
for (int i=0; i<rgPoints.count(); i++) {
MissionItem* item = new MissionItem(0,
......@@ -100,5 +104,16 @@ void RallyPointManager::_planManagerLoadComplete(bool removeAllRequested)
}
emit loadComplete(_rgPoints);
emit loadComplete();
}
void RallyPointManager::_sendComplete(bool error)
{
if (error) {
_rgPoints.clear();
} else {
_rgPoints = _rgSendPoints;
}
_rgSendPoints.clear();
emit sendComplete(error);
}
......@@ -62,13 +62,14 @@ public:
} ErrorCode_t;
signals:
void loadComplete (const QList<QGeoCoordinate> rgPoints);
void loadComplete (void);
void inProgressChanged (bool inProgress);
void error (int errorCode, const QString& errorMsg);
void removeAllComplete (bool error);
void sendComplete (bool error);
private slots:
void _sendComplete (bool error);
void _planManagerLoadComplete (bool removeAllRequested);
protected:
......@@ -77,6 +78,7 @@ protected:
Vehicle* _vehicle;
PlanManager _planManager;
QList<QGeoCoordinate> _rgPoints;
QList<QGeoCoordinate> _rgSendPoints;
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment