diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index ef27951c5..0eae3cb9a 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -242,13 +242,14 @@ void FlightLogManager::exportToOPL(QString fileName) void FlightLogManager::exportToCSV(QString fileName) { QFile csvFile(fileName); + if (csvFile.open(QFile::WriteOnly | QFile::Truncate)) { QTextStream csvStream(&csvFile); quint32 baseTime = 0; quint32 currentFlight = 0; csvStream << "Flight" << '\t' << "Flight Time" << '\t' << "Entry" << '\t' << "Data" << '\n'; - foreach (ExtendedDebugLogEntry *entry , m_logEntries) { - if(m_adjustExportedTimestamps && entry->getFlight() != currentFlight) { + foreach(ExtendedDebugLogEntry * entry, m_logEntries) { + if (m_adjustExportedTimestamps && entry->getFlight() != currentFlight) { currentFlight = entry->getFlight(); baseTime = entry->getFlightTime(); } @@ -263,8 +264,8 @@ void FlightLogManager::exportToCSV(QString fileName) void FlightLogManager::exportToXML(QString fileName) { QFile xmlFile(fileName); - if (xmlFile.open(QFile::WriteOnly | QFile::Truncate)) { + if (xmlFile.open(QFile::WriteOnly | QFile::Truncate)) { QXmlStreamWriter xmlWriter(&xmlFile); xmlWriter.setAutoFormatting(true); xmlWriter.setAutoFormattingIndent(4); @@ -275,8 +276,8 @@ void FlightLogManager::exportToXML(QString fileName) quint32 baseTime = 0; quint32 currentFlight = 0; - foreach (ExtendedDebugLogEntry *entry , m_logEntries) { - if(m_adjustExportedTimestamps && entry->getFlight() != currentFlight) { + foreach(ExtendedDebugLogEntry * entry, m_logEntries) { + if (m_adjustExportedTimestamps && entry->getFlight() != currentFlight) { currentFlight = entry->getFlight(); baseTime = entry->getFlightTime(); } @@ -388,12 +389,13 @@ void ExtendedDebugLogEntry::toXML(QXmlStreamWriter *xmlWriter, quint32 baseTime) xmlWriter->writeAttribute("type", "uavobject"); m_object->toXML(xmlWriter); } - xmlWriter->writeEndElement(); //entry + xmlWriter->writeEndElement(); // entry } void ExtendedDebugLogEntry::toCSV(QTextStream *csvStream, quint32 baseTime) { QString data; + if (getType() == DebugLogEntry::TYPE_TEXT) { data = QString((const char *)getData().Data); } else if (getType() == DebugLogEntry::TYPE_UAVOBJECT) { diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index 1ad5db515..7bb2585d2 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -165,7 +165,6 @@ private: void exportToOPL(QString fileName); void exportToCSV(QString fileName); void exportToXML(QString fileName); - }; #endif // FLIGHTLOGMANAGER_H diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp index 092490257..e284ced8f 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp @@ -525,7 +525,7 @@ void UAVObject::toXML(QXmlStreamWriter *xmlWriter) xmlWriter->writeAttribute("name", getName()); xmlWriter->writeAttribute("id", QString("%1-%2").arg(getObjID(), 1, 16).toUpper().arg(getInstID())); xmlWriter->writeStartElement("fields"); - foreach(UAVObjectField* field , fields) { + foreach(UAVObjectField * field, fields) { field->toXML(xmlWriter); } xmlWriter->writeEndElement(); // fields diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp index 19ea0a563..235448a57 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp @@ -664,7 +664,7 @@ void UAVObjectField::toXML(QXmlStreamWriter *xmlWriter) } for (unsigned int n = 0; n < numElements; ++n) { xmlWriter->writeStartElement("value"); - if(getElementNames().size() > 1) { + if (getElementNames().size() > 1) { xmlWriter->writeAttribute("name", getElementNames().at(n)); } xmlWriter->writeCharacters(getValue(n).toString());