mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-05 21:52:10 +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:
parent
617924e64d
commit
bbdef44344
@ -66,10 +66,10 @@ void ModelUavoProxy::flightPlanSent(UAVObject *obj, bool success)
|
|||||||
if (completionCount == 2) {
|
if (completionCount == 2) {
|
||||||
qDebug() << "ModelUavoProxy::flightPlanSent - success" << (completionSuccessCount == 2);
|
qDebug() << "ModelUavoProxy::flightPlanSent - success" << (completionSuccessCount == 2);
|
||||||
if (completionSuccessCount == 2) {
|
if (completionSuccessCount == 2) {
|
||||||
// TODO : popup?
|
QMessageBox::information(NULL, tr("Flight Plan Upload Successful"), tr("Flight plan upload was successful."));
|
||||||
}
|
}
|
||||||
else {
|
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);
|
qDebug() << "ModelUavoProxy::flightPlanReceived - success" << (completionSuccessCount == 2);
|
||||||
if (completionSuccessCount == 2) {
|
if (completionSuccessCount == 2) {
|
||||||
objectsToModel();
|
objectsToModel();
|
||||||
// TODO : popup?
|
QMessageBox::information(NULL, tr("Flight Plan Download Successful"), tr("Flight plan download was successful."));
|
||||||
}
|
}
|
||||||
else {
|
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()
|
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);
|
int instanceCount = objManager->getNumInstances(Waypoint::OBJID);
|
||||||
// TODO retain only reachable waypoints
|
|
||||||
|
|
||||||
int rowCount = myModel->rowCount();
|
int rowCount = myModel->rowCount();
|
||||||
if (instanceCount < rowCount) {
|
if (instanceCount < rowCount) {
|
||||||
@ -275,8 +278,7 @@ void ModelUavoProxy::objectsToModel()
|
|||||||
Waypoint::DataFields waypointData = waypoint->getData();
|
Waypoint::DataFields waypointData = waypoint->getData();
|
||||||
waypointToModel(i, waypointData);
|
waypointToModel(i, waypointData);
|
||||||
|
|
||||||
int actionId = waypointData.Action;
|
PathAction *action = PathAction::GetInstance(objManager, waypoint->getAction());
|
||||||
PathAction *action = PathAction::GetInstance(objManager, actionId);
|
|
||||||
Q_ASSERT(action);
|
Q_ASSERT(action);
|
||||||
if (!action) {
|
if (!action) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -38,9 +38,6 @@ class ModelUavoProxy : public QObject {
|
|||||||
public:
|
public:
|
||||||
explicit ModelUavoProxy(QObject *parent, flightDataModel *model);
|
explicit ModelUavoProxy(QObject *parent, flightDataModel *model);
|
||||||
|
|
||||||
void modelToObjects();
|
|
||||||
void objectsToModel();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void sendFlightPlan();
|
void sendFlightPlan();
|
||||||
void receiveFlightPlan();
|
void receiveFlightPlan();
|
||||||
@ -51,16 +48,21 @@ private:
|
|||||||
uint completionCount;
|
uint completionCount;
|
||||||
uint completionSuccessCount;
|
uint completionSuccessCount;
|
||||||
|
|
||||||
|
void modelToObjects();
|
||||||
|
void objectsToModel();
|
||||||
|
|
||||||
Waypoint *createWaypoint(int index, Waypoint *newWaypoint);
|
Waypoint *createWaypoint(int index, Waypoint *newWaypoint);
|
||||||
void modelToWaypoint(int i, Waypoint::DataFields &data);
|
PathAction *createPathAction(int index, PathAction *newAction);
|
||||||
void waypointToModel(int i, Waypoint::DataFields &data);
|
|
||||||
|
|
||||||
PathAction *findPathAction(const PathAction::DataFields& actionFields, int actionCount);
|
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 modelToPathAction(int i, PathAction::DataFields &data);
|
||||||
|
|
||||||
|
void waypointToModel(int i, Waypoint::DataFields &data);
|
||||||
void pathActionToModel(int i, PathAction::DataFields &data);
|
void pathActionToModel(int i, PathAction::DataFields &data);
|
||||||
|
|
||||||
public slots:
|
private slots:
|
||||||
void flightPlanSent(UAVObject *, bool success);
|
void flightPlanSent(UAVObject *, bool success);
|
||||||
void flightPlanReceived(UAVObject *, bool success);
|
void flightPlanReceived(UAVObject *, bool success);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user