Commit 746fa180 authored by pixhawk's avatar pixhawk

Improved the offline missionplan warning

parent 63a40d01
...@@ -47,6 +47,7 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) : ...@@ -47,6 +47,7 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) :
mavY(0.0), mavY(0.0),
mavZ(0.0), mavZ(0.0),
mavYaw(0.0), mavYaw(0.0),
showOfflineWarning(false),
m_ui(new Ui::WaypointList) m_ui(new Ui::WaypointList)
{ {
...@@ -104,15 +105,16 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) : ...@@ -104,15 +105,16 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) :
} }
else else
{ {
qDebug() << "setUAS failed" ; qDebug() << "setUAS failed. Creating an offline WaypointList";
// Hide buttons, which don't make sense without valid UAS // Hide buttons, which don't make sense without valid UAS
m_ui->positionAddButton->hide(); m_ui->positionAddButton->hide();
m_ui->transmitButton->hide(); m_ui->transmitButton->hide();
m_ui->readButton->hide(); m_ui->readButton->hide();
//FIXME: The whole "Onboard Waypoints"-tab should be hidden, instead of "refresh" button
m_ui->refreshButton->hide(); m_ui->refreshButton->hide();
//FIXME: The whole "Onboard Waypoints"-tab should be hidden, instead of "refresh" button
UnconnectedUASInfoWidget* inf = new UnconnectedUASInfoWidget(this); UnconnectedUASInfoWidget* inf = new UnconnectedUASInfoWidget(this);
viewOnlyListLayout->insertWidget(0, inf); viewOnlyListLayout->insertWidget(0, inf); //insert a "NO UAV" info into the Onboard Tab
showOfflineWarning = true;
WPM = new UASWaypointManager(NULL); WPM = new UASWaypointManager(NULL);
} }
...@@ -183,10 +185,20 @@ void WaypointList::saveWaypoints() ...@@ -183,10 +185,20 @@ void WaypointList::saveWaypoints()
void WaypointList::loadWaypoints() void WaypointList::loadWaypoints()
{ {
//create a popup notifying the user about the limitations of offline editing
QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), ".", tr("Waypoint File (*.txt)")); if (showOfflineWarning == true)
WPM->loadWaypoints(fileName); {
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText("Offline editor!");
msgBox.setInformativeText("You are using the offline mission editor. Please don't forget to save your mission plan before connecting the UAV, otherwise it will be lost.");
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec();
showOfflineWarning = false;
}
QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), ".", tr("Waypoint File (*.txt)"));
WPM->loadWaypoints(fileName);
} }
void WaypointList::transmit() void WaypointList::transmit()
...@@ -240,13 +252,17 @@ void WaypointList::addEditable() ...@@ -240,13 +252,17 @@ void WaypointList::addEditable()
wp = new Waypoint(0, 0, 0, -0.50, 0, 0.20, 0, 0,true, true, MAV_FRAME_LOCAL_NED, MAV_CMD_NAV_WAYPOINT); wp = new Waypoint(0, 0, 0, -0.50, 0, 0.20, 0, 0,true, true, MAV_FRAME_LOCAL_NED, MAV_CMD_NAV_WAYPOINT);
WPM->addWaypointEditable(wp); WPM->addWaypointEditable(wp);
//create a popup notifying the user about the limitations of offline editing //create a popup notifying the user about the limitations of offline editing
QMessageBox msgBox; if (showOfflineWarning == true)
msgBox.setIcon(QMessageBox::Warning); {
msgBox.setText("Offline editor!"); QMessageBox msgBox;
msgBox.setInformativeText("You are using the offline mission editor. Please don't forget to save your mission plan before connecting the UAV, otherwise it will be lost."); msgBox.setIcon(QMessageBox::Warning);
msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setText("Offline editor!");
msgBox.setDefaultButton(QMessageBox::Ok); msgBox.setInformativeText("You are using the offline mission editor. Please don't forget to save your mission plan before connecting the UAV, otherwise it will be lost.");
int ret = msgBox.exec(); msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec();
showOfflineWarning = false;
}
} }
} }
......
...@@ -141,6 +141,7 @@ protected: ...@@ -141,6 +141,7 @@ protected:
QPointF centerMapCoordinate; QPointF centerMapCoordinate;
bool loadFileGlobalWP; bool loadFileGlobalWP;
bool readGlobalWP; bool readGlobalWP;
bool showOfflineWarning;
private: private:
Ui::WaypointList *m_ui; Ui::WaypointList *m_ui;
......
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