From 999e4467777adafa0635a5b97b23946569d0469e Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Thu, 11 Nov 2010 22:51:00 +0200 Subject: [PATCH] GUI: Add new short summary to error structures. Also rename 'msg' in structures to 'message' for consistency. --- gui/csvreport.cpp | 2 +- gui/erroritem.cpp | 9 ++++++--- gui/erroritem.h | 6 ++++-- gui/resultstree.cpp | 10 +++++----- gui/threadresult.cpp | 4 ++-- gui/txtreport.cpp | 2 +- gui/xmlreport.cpp | 4 ++-- 7 files changed, 21 insertions(+), 16 deletions(-) diff --git a/gui/csvreport.cpp b/gui/csvreport.cpp index 0fb3dbfb7..28b6ee3a2 100644 --- a/gui/csvreport.cpp +++ b/gui/csvreport.cpp @@ -65,7 +65,7 @@ void CsvReport::WriteError(const ErrorItem &error) QString line; const QString file = QDir::toNativeSeparators(error.files[error.files.size() - 1]); line += QString("%1,%2,").arg(file).arg(error.lines[error.lines.size() - 1]); - line += QString("%1,%2").arg(error.severity).arg(error.msg); + line += QString("%1,%2").arg(error.severity).arg(error.message); mTxtWriter << line << endl; } diff --git a/gui/erroritem.cpp b/gui/erroritem.cpp index 148332964..1fa03e43b 100644 --- a/gui/erroritem.cpp +++ b/gui/erroritem.cpp @@ -25,7 +25,8 @@ ErrorItem::ErrorItem(const ErrorItem &item) lines = item.lines; id = item.id; severity = item.severity; - msg = item.msg; + summary = item.summary; + message = item.message; } ErrorItem::ErrorItem(const ErrorLine &line) @@ -35,13 +36,15 @@ ErrorItem::ErrorItem(const ErrorLine &line) lines.append(line.line); id = line.id; severity = line.severity; - msg = line.msg; + summary = line.summary; + message = line.message; } QString ErrorItem::ToString() const { QString str = file + " - " + id + " - " + severity +"\n"; - str += " " + msg; + str += " " + summary; + str += "\n" + message; for (int i = 0; i < files.size(); i++) str += " " + files[i] + ": " + lines[i] + "\n"; return str; diff --git a/gui/erroritem.h b/gui/erroritem.h index 898f5c971..68729ebac 100644 --- a/gui/erroritem.h +++ b/gui/erroritem.h @@ -50,7 +50,8 @@ public: QList lines; QString id; QString severity; - QString msg; + QString summary; + QString message; }; Q_DECLARE_METATYPE(ErrorItem); @@ -65,7 +66,8 @@ public: unsigned int line; QString id; QString severity; - QString msg; + QString summary; + QString message; }; /// @} diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index 6178c48b9..a162d2275 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -107,7 +107,7 @@ void ResultsTree::AddErrorItem(const ErrorItem &item) line.file = realfile; line.id = item.id; line.line = item.lines[0]; - line.msg = item.msg; + line.message = item.message; line.severity = item.severity; //Create the base item for the error and ensure it has a proper //file item as a parent @@ -122,7 +122,7 @@ void ResultsTree::AddErrorItem(const ErrorItem &item) //Add user data to that item QMap data; data["severity"] = SeverityToShowType(item.severity); - data["message"] = item.msg; + data["message"] = item.message; data["file"] = item.files[0]; data["line"] = item.lines[0]; data["id"] = item.id; @@ -142,7 +142,7 @@ void ResultsTree::AddErrorItem(const ErrorItem &item) //Add user data to that item QMap child_data; child_data["severity"] = SeverityToShowType(line.severity); - child_data["message"] = line.msg; + child_data["message"] = line.message; child_data["file"] = item.files[i]; child_data["line"] = line.line; child_data["id"] = line.id; @@ -176,7 +176,7 @@ QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent, list << CreateItem(QString("%1").arg(item.line)); //TODO message has parameter names so we'll need changes to the core //cppcheck so we can get proper translations - list << CreateItem(tr(item.msg.toLatin1())); + list << CreateItem(tr(item.message.toLatin1())); // Check for duplicate rows and don't add them if found for (int i = 0; i < parent->rowCount(); i++) @@ -693,7 +693,7 @@ void ResultsTree::SaveErrors(Report *report, QStandardItem *item) ErrorItem item; item.severity = ShowTypeToString(VariantToShowType(data["severity"])); - item.msg = data["message"].toString(); + item.message = data["message"].toString(); item.id = data["id"].toString(); QString file = StripPath(data["file"].toString(), true); unsigned int line = data["line"].toUInt(); diff --git a/gui/threadresult.cpp b/gui/threadresult.cpp index 890356133..5d8963096 100644 --- a/gui/threadresult.cpp +++ b/gui/threadresult.cpp @@ -69,7 +69,8 @@ void ThreadResult::reportErr(const ErrorLogger::ErrorMessage &msg) item.files = files; item.id = QString(msg._id.c_str()); item.lines = lines; - item.msg = QString::fromStdString(msg.verboseMessage()); + item.summary = QString::fromStdString(msg.shortMessage()); + item.message = QString::fromStdString(msg.verboseMessage()); item.severity = QString::fromStdString(Severity::toString(msg._severity)); if (msg._severity != Severity::debug) @@ -115,4 +116,3 @@ int ThreadResult::GetFileCount() QMutexLocker locker(&mutex); return mFiles.size(); } - diff --git a/gui/txtreport.cpp b/gui/txtreport.cpp index bba9ae0ed..52b7efeba 100644 --- a/gui/txtreport.cpp +++ b/gui/txtreport.cpp @@ -76,7 +76,7 @@ void TxtReport::WriteError(const ErrorItem &error) } } - line += QString("(%1) %2").arg(error.severity).arg(error.msg); + line += QString("(%1) %2").arg(error.severity).arg(error.message); mTxtWriter << line << endl; } diff --git a/gui/xmlreport.cpp b/gui/xmlreport.cpp index c3a104235..f5c416134 100644 --- a/gui/xmlreport.cpp +++ b/gui/xmlreport.cpp @@ -99,7 +99,7 @@ void XmlReport::WriteError(const ErrorItem &error) mXmlWriter->writeAttribute(LineAttribute, line); mXmlWriter->writeAttribute(IdAttribute, error.id); mXmlWriter->writeAttribute(SeverityAttribute, error.severity); - mXmlWriter->writeAttribute(MsgAttribute, error.msg); + mXmlWriter->writeAttribute(MsgAttribute, error.message); mXmlWriter->writeEndElement(); } @@ -159,7 +159,7 @@ ErrorLine XmlReport::ReadError(QXmlStreamReader *reader) line.line = attribs.value("", LineAttribute).toString().toUInt(); line.id = attribs.value("", IdAttribute).toString(); line.severity = attribs.value("", SeverityAttribute).toString(); - line.msg = attribs.value("", MsgAttribute).toString(); + line.message = attribs.value("", MsgAttribute).toString(); } return line; }