diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp index 029f9f77f..e86d4794b 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp @@ -150,9 +150,14 @@ void UAVObjectUtilManager::objectPersistenceTransactionCompleted(UAVObject* obj, saveState = AWAITING_COMPLETED; disconnect(obj, SIGNAL(transactionCompleted(UAVObject*,bool)), this, SLOT(objectPersistenceTransactionCompleted(UAVObject*,bool))); failureTimer.start(1000); // Create a timeout - } else if (!success) { - // Can be caused by timeout errors on sending. Send again. + } else { + // Can be caused by timeout errors on sending. Forget it and send next. qDebug() << "objectPersistenceTranscationCompleted (error)"; + UAVObject *obj = getObjectManager()->getObject(ObjectPersistence::NAME); + obj->disconnect(this); + queue.dequeue(); // We can now remove the object, it failed anyway. + saveState = IDLE; + emit saveCompleted(obj->getField("ObjectID")->getValue().toInt(), false); saveNextObject(); } } diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummary.cpp b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummary.cpp index f9d96bf09..bc80afcf3 100644 --- a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummary.cpp +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummary.cpp @@ -55,7 +55,7 @@ ImportSummaryDialog::~ImportSummaryDialog() Adds a new line about a UAVObject along with its status (whether it got saved OK or not) */ -void ImportSummaryDialog::addLine(QString uavObjectName, bool status) +void ImportSummaryDialog::addLine(QString uavObjectName, QString text, bool status) { ui->importSummaryList->setRowCount(ui->importSummaryList->rowCount()+1); int row = ui->importSummaryList->rowCount()-1; @@ -64,11 +64,10 @@ void ImportSummaryDialog::addLine(QString uavObjectName, bool status) QTableWidgetItem *objName = new QTableWidgetItem(uavObjectName); ui->importSummaryList->setItem(row, 1, objName); QCheckBox *box = dynamic_cast(ui->importSummaryList->cellWidget(row,0)); + ui->importSummaryList->setItem(row,2,new QTableWidgetItem(text)); if (status) { - ui->importSummaryList->setItem(row,2,new QTableWidgetItem("OK")); box->setChecked(true); } else { - ui->importSummaryList->setItem(row,2,new QTableWidgetItem("Mismatch")); box->setChecked(false); box->setEnabled(false); } diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummary.h b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummary.h index defc824b1..11a9de00c 100644 --- a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummary.h +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummary.h @@ -48,7 +48,7 @@ class ImportSummaryDialog : public QDialog public: ImportSummaryDialog(QWidget *parent=0); ~ImportSummaryDialog(); - void addLine(QString objectName, bool status); + void addLine(QString objectName, QString text, bool status); protected: void showEvent(QShowEvent *event); diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.cpp b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.cpp index 781c28ea8..2f172e521 100644 --- a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.cpp +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.cpp @@ -157,35 +157,44 @@ void UAVSettingsImportExportPlugin::importUAVSettings() if (obj == NULL) { // This object is unknown! qDebug() << "Object Unknown:" << uavObjectName << uavObjectID; - swui.addLine(uavObjectName, false); + swui.addLine(uavObjectName, "Error", false); - } else if(uavObjectID != obj->getObjID()) { - qDebug() << "Mismatch for Object " << uavObjectName << uavObjectID << " - " << obj->getObjID(); - swui.addLine(uavObjectName, false); } else { // - Update each field // - Issue and "updated" command + bool error=false; QDomNode field = node.firstChild(); while(!field.isNull()) { QDomElement f = field.toElement(); if (f.tagName() == "field") { UAVObjectField *uavfield = obj->getField(f.attribute("name")); - QStringList list = f.attribute("values").split(","); - if (list.length() == 1) { - uavfield->setValue(f.attribute("values")); - } else { - // This is an enum: - int i=0; + if (uavfield) { QStringList list = f.attribute("values").split(","); - foreach (QString element, list) { - uavfield->setValue(element,i++); + if (list.length() == 1) { + uavfield->setValue(f.attribute("values")); + } else { + // This is an enum: + int i=0; + QStringList list = f.attribute("values").split(","); + foreach (QString element, list) { + uavfield->setValue(element,i++); + } } + error = false; + } else { + error = true; } } field = field.nextSibling(); } obj->updated(); - swui.addLine(uavObjectName, true); + if (error) { + swui.addLine(uavObjectName, "Error", false); + } else if (uavObjectID != obj->getObjID()) { + qDebug() << "Mismatch for Object " << uavObjectName << uavObjectID << " - " << obj->getObjID(); + swui.addLine(uavObjectName, "Warning", true); + } else + swui.addLine(uavObjectName, "OK", true); } } node = node.nextSibling();