From 51ef451faf39c2cf8bae8cb03e9904aacd3d8bc0 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Fri, 22 Aug 2014 18:37:15 -0700 Subject: [PATCH] Handle file open correctly Path through code allowed for xmlfile to be used when file was not opened. Also changed qWarning->qDebug to allow QT_FAIL_WARNINGS to be used to find bugs. --- src/ui/QGCPX4VehicleConfig.cc | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/ui/QGCPX4VehicleConfig.cc b/src/ui/QGCPX4VehicleConfig.cc index b63b0c524..3ee0c175b 100644 --- a/src/ui/QGCPX4VehicleConfig.cc +++ b/src/ui/QGCPX4VehicleConfig.cc @@ -204,12 +204,12 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary) if (!autopilotdir.exists("general")) { //TODO: Throw some kind of error here. There is no general configuration directory - qWarning() << "Invalid general dir. no general configuration will be loaded."; + qDebug() << "Invalid general dir. no general configuration will be loaded."; } if (!autopilotdir.exists(mav->getAutopilotTypeName().toLower())) { //TODO: Throw an error here too, no autopilot specific configuration - qWarning() << "Invalid vehicle dir, no vehicle specific configuration will be loaded."; + qDebug() << "Invalid vehicle dir, no vehicle specific configuration will be loaded."; } // Generate widgets for the General tab. @@ -380,23 +380,10 @@ void QGCPX4VehicleConfig::loadConfig() QGCToolWidget* tool; QDir autopilotdir(qApp->applicationDirPath() + "/files/" + mav->getAutopilotTypeName().toLower()); - QDir generaldir = QDir(autopilotdir.absolutePath() + "/general/widgets"); - QDir vehicledir = QDir(autopilotdir.absolutePath() + "/" + mav->getSystemTypeName().toLower() + "/widgets"); - if (!autopilotdir.exists("general")) - { - //TODO: Throw some kind of error here. There is no general configuration directory - qWarning() << "Invalid general dir. no general configuration will be loaded."; - } - if (!autopilotdir.exists(mav->getAutopilotTypeName().toLower())) - { - //TODO: Throw an error here too, no autopilot specific configuration - qWarning() << "Invalid vehicle dir, no vehicle specific configuration will be loaded."; - } qDebug() << autopilotdir.absolutePath(); - qDebug() << generaldir.absolutePath(); - qDebug() << vehicledir.absolutePath(); + QFile xmlfile(autopilotdir.absolutePath() + "/arduplane.pdef.xml"); - if (xmlfile.exists() && !xmlfile.open(QIODevice::ReadOnly)) + if (!xmlfile.open(QIODevice::ReadOnly)) { loadQgcConfig(false); doneLoadingConfig = true; -- 2.22.0