1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

OP-112 OP-1120 waypoint editor - added popup notification for success or failure of uploading/downloading a flight path to the board + minor header file reorg

This commit is contained in:
Philippe Renon 2013-12-11 23:13:32 +01:00
parent 617924e64d
commit bbdef44344
2 changed files with 18 additions and 14 deletions

View File

@ -66,10 +66,10 @@ void ModelUavoProxy::flightPlanSent(UAVObject *obj, bool success)
if (completionCount == 2) {
qDebug() << "ModelUavoProxy::flightPlanSent - success" << (completionSuccessCount == 2);
if (completionSuccessCount == 2) {
// TODO : popup?
QMessageBox::information(NULL, tr("Flight Plan Upload Successful"), tr("Flight plan upload was successful."));
}
else {
// TODO : popup?
QMessageBox::critical(NULL, tr("Flight Plan Upload Failed !"), tr("Failed to upload the flight plan !"));
}
}
}
@ -102,10 +102,10 @@ void ModelUavoProxy::flightPlanReceived(UAVObject *obj, bool success)
qDebug() << "ModelUavoProxy::flightPlanReceived - success" << (completionSuccessCount == 2);
if (completionSuccessCount == 2) {
objectsToModel();
// TODO : popup?
QMessageBox::information(NULL, tr("Flight Plan Download Successful"), tr("Flight plan download was successful."));
}
else {
// TODO : popup?
QMessageBox::critical(NULL, tr("Flight Plan Download Failed !"), tr("Failed to download the flight plan !"));
}
}
}
@ -254,8 +254,11 @@ PathAction *ModelUavoProxy::findPathAction(const PathAction::DataFields &actionD
void ModelUavoProxy::objectsToModel()
{
// build model from uav objects
// the list of objects can end with "garbage" instances due to previous flightpath
// they need to be ignored
int instanceCount = objManager->getNumInstances(Waypoint::OBJID);
// TODO retain only reachable waypoints
int rowCount = myModel->rowCount();
if (instanceCount < rowCount) {
@ -275,8 +278,7 @@ void ModelUavoProxy::objectsToModel()
Waypoint::DataFields waypointData = waypoint->getData();
waypointToModel(i, waypointData);
int actionId = waypointData.Action;
PathAction *action = PathAction::GetInstance(objManager, actionId);
PathAction *action = PathAction::GetInstance(objManager, waypoint->getAction());
Q_ASSERT(action);
if (!action) {
continue;

View File

@ -38,9 +38,6 @@ class ModelUavoProxy : public QObject {
public:
explicit ModelUavoProxy(QObject *parent, flightDataModel *model);
void modelToObjects();
void objectsToModel();
public slots:
void sendFlightPlan();
void receiveFlightPlan();
@ -51,16 +48,21 @@ private:
uint completionCount;
uint completionSuccessCount;
void modelToObjects();
void objectsToModel();
Waypoint *createWaypoint(int index, Waypoint *newWaypoint);
void modelToWaypoint(int i, Waypoint::DataFields &data);
void waypointToModel(int i, Waypoint::DataFields &data);
PathAction *createPathAction(int index, PathAction *newAction);
PathAction *findPathAction(const PathAction::DataFields& actionFields, int actionCount);
PathAction *createPathAction(int index, PathAction *newAction);
void modelToWaypoint(int i, Waypoint::DataFields &data);
void modelToPathAction(int i, PathAction::DataFields &data);
void waypointToModel(int i, Waypoint::DataFields &data);
void pathActionToModel(int i, PathAction::DataFields &data);
public slots:
private slots:
void flightPlanSent(UAVObject *, bool success);
void flightPlanReceived(UAVObject *, bool success);