diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index 1ded1c4b4..1d4f90568 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -260,7 +260,7 @@ void ResultsView::ReadErrorsXml(const QString &filename) else if (version == 2) report = new XmlReportV2(filename, this); - QList errors; + QList errors; if (report) { if (report->Open()) @@ -283,10 +283,9 @@ void ResultsView::ReadErrorsXml(const QString &filename) msgBox.exec(); } - ErrorLine line; - foreach(line, errors) + ErrorItem item; + foreach(item, errors) { - ErrorItem item(line); mUI.mTree->AddErrorItem(item); } mUI.mTree->SetCheckDirectory(""); diff --git a/gui/xmlreport.h b/gui/xmlreport.h index 45ce6f3c7..e0e4e55ba 100644 --- a/gui/xmlreport.h +++ b/gui/xmlreport.h @@ -22,6 +22,7 @@ #include #include #include "report.h" +#include "erroritem.h" class QObject; @@ -40,7 +41,7 @@ public: /** * @brief Read contents of the report file. */ - virtual QList Read() = 0; + virtual QList Read() = 0; /** * @brief Quote the message. diff --git a/gui/xmlreportv1.cpp b/gui/xmlreportv1.cpp index 7fdf2d5fb..8df2a89da 100644 --- a/gui/xmlreportv1.cpp +++ b/gui/xmlreportv1.cpp @@ -106,9 +106,9 @@ void XmlReportV1::WriteError(const ErrorItem &error) mXmlWriter->writeEndElement(); } -QList XmlReportV1::Read() +QList XmlReportV1::Read() { - QList errors; + QList errors; bool insideResults = false; if (!mXmlReader) { @@ -126,8 +126,8 @@ QList XmlReportV1::Read() // Read error element from inside result element if (insideResults && mXmlReader->name() == ErrorElementName) { - ErrorLine line = ReadError(mXmlReader); - errors.append(line); + ErrorItem item = ReadError(mXmlReader); + errors.append(item); } break; @@ -152,16 +152,19 @@ QList XmlReportV1::Read() return errors; } -ErrorLine XmlReportV1::ReadError(QXmlStreamReader *reader) +ErrorItem XmlReportV1::ReadError(QXmlStreamReader *reader) { - ErrorLine line; + ErrorItem item; if (reader->name().toString() == ErrorElementName) { QXmlStreamAttributes attribs = reader->attributes(); - line.file = attribs.value("", FilenameAttribute).toString(); - line.line = attribs.value("", LineAttribute).toString().toUInt(); - line.id = attribs.value("", IdAttribute).toString(); - line.severity = attribs.value("", SeverityAttribute).toString(); + const QString file = attribs.value("", FilenameAttribute).toString(); + item.file = file; + item.files.push_back(file); + const int line = attribs.value("", LineAttribute).toString().toUInt(); + item.lines.push_back(line); + item.id = attribs.value("", IdAttribute).toString(); + item.severity = attribs.value("", SeverityAttribute).toString(); // NOTE: This dublicates the message to Summary-field. But since // old XML format doesn't have separate summary and verbose messages @@ -171,8 +174,8 @@ ErrorLine XmlReportV1::ReadError(QXmlStreamReader *reader) const int ind = summary.indexOf('.'); if (ind != -1) summary = summary.left(ind + 1); - line.summary = summary; - line.message = attribs.value("", MsgAttribute).toString(); + item.summary = summary; + item.message = attribs.value("", MsgAttribute).toString(); } - return line; + return item; } diff --git a/gui/xmlreportv1.h b/gui/xmlreportv1.h index 685afa9ef..181b21e4b 100644 --- a/gui/xmlreportv1.h +++ b/gui/xmlreportv1.h @@ -72,14 +72,14 @@ public: /** * @brief Read contents of the report file. */ - virtual QList Read(); + virtual QList Read(); protected: /** * @brief Read and parse error item from XML stream. * @param reader XML stream reader to use. */ - ErrorLine ReadError(QXmlStreamReader *reader); + ErrorItem ReadError(QXmlStreamReader *reader); private: /** diff --git a/gui/xmlreportv2.cpp b/gui/xmlreportv2.cpp index 0659cf03f..7e2011a92 100644 --- a/gui/xmlreportv2.cpp +++ b/gui/xmlreportv2.cpp @@ -132,9 +132,9 @@ void XmlReportV2::WriteError(const ErrorItem &error) mXmlWriter->writeEndElement(); } -QList XmlReportV2::Read() +QList XmlReportV2::Read() { - QList errors; + QList errors; bool insideResults = false; if (!mXmlReader) { @@ -152,8 +152,8 @@ QList XmlReportV2::Read() // Read error element from inside result element if (insideResults && mXmlReader->name() == ErrorElementName) { - ErrorLine line = ReadError(mXmlReader); - errors.append(line); + ErrorItem item = ReadError(mXmlReader); + errors.append(item); } break; @@ -178,16 +178,19 @@ QList XmlReportV2::Read() return errors; } -ErrorLine XmlReportV2::ReadError(QXmlStreamReader *reader) +ErrorItem XmlReportV2::ReadError(QXmlStreamReader *reader) { - ErrorLine line; + ErrorItem item; if (reader->name().toString() == ErrorElementName) { QXmlStreamAttributes attribs = reader->attributes(); - line.file = attribs.value("", FilenameAttribute).toString(); - line.line = attribs.value("", LineAttribute).toString().toUInt(); - line.id = attribs.value("", IdAttribute).toString(); - line.severity = attribs.value("", SeverityAttribute).toString(); + const QString file = attribs.value("", FilenameAttribute).toString(); + item.file = file; + item.files.push_back(file); + const int line = attribs.value("", LineAttribute).toString().toUInt(); + item.lines.push_back(line); + item.id = attribs.value("", IdAttribute).toString(); + item.severity = attribs.value("", SeverityAttribute).toString(); // NOTE: This dublicates the message to Summary-field. But since // old XML format doesn't have separate summary and verbose messages @@ -197,8 +200,8 @@ ErrorLine XmlReportV2::ReadError(QXmlStreamReader *reader) const int ind = summary.indexOf('.'); if (ind != -1) summary = summary.left(ind + 1); - line.summary = summary; - line.message = attribs.value("", MsgAttribute).toString(); + item.summary = summary; + item.message = attribs.value("", MsgAttribute).toString(); } - return line; + return item; } diff --git a/gui/xmlreportv2.h b/gui/xmlreportv2.h index ba793061c..6b1a2841c 100644 --- a/gui/xmlreportv2.h +++ b/gui/xmlreportv2.h @@ -72,14 +72,14 @@ public: /** * @brief Read contents of the report file. */ - virtual QList Read(); + virtual QList Read(); protected: /** * @brief Read and parse error item from XML stream. * @param reader XML stream reader to use. */ - ErrorLine ReadError(QXmlStreamReader *reader); + ErrorItem ReadError(QXmlStreamReader *reader); private: /**