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

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