1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

GCS-PathPlanner

Fixes loading path from file.
This commit is contained in:
PT_Dreamer 2012-10-30 13:48:02 +00:00
parent 7a14b761ec
commit 06e56165c5

View File

@ -565,11 +565,14 @@ void flightDataModel::readFromFile(QString fileName)
//TODO warning message //TODO warning message
removeRows(0,rowCount()); removeRows(0,rowCount());
QFile file(fileName); QFile file(fileName);
file.open(QIODevice::ReadOnly);
QDomDocument doc("PathPlan"); QDomDocument doc("PathPlan");
if (!doc.setContent(file.readAll())) { QByteArray array=file.readAll();
QString error;
if (!doc.setContent(array,&error)) {
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText(tr("File Parsing Failed.")); msgBox.setText(tr("File Parsing Failed."));
msgBox.setInformativeText(tr("This file is not a correct XML file")); msgBox.setInformativeText(QString(tr("This file is not a correct XML file:%0")).arg(error));
msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec(); msgBox.exec();
return; return;
@ -616,7 +619,7 @@ void flightDataModel::readFromFile(QString fileName)
else if(field.attribute("name")=="altitude") else if(field.attribute("name")=="altitude")
data->altitude=field.attribute("value").toDouble(); data->altitude=field.attribute("value").toDouble();
else if(field.attribute("name")=="velocity") else if(field.attribute("name")=="velocity")
data->velocity=field.attribute("value").toDouble(); data->velocity=field.attribute("value").toFloat();
else if(field.attribute("name")=="mode") else if(field.attribute("name")=="mode")
data->mode=field.attribute("value").toInt(); data->mode=field.attribute("value").toInt();
else if(field.attribute("name")=="mode_param0") else if(field.attribute("name")=="mode_param0")