GUI: Add support for inconclusive errors.

This is the first (and quick) support for the inconclusive errors.
We simply add [Inconclusive] to begin of the summary. This is
temporary solution until better GUI is implemented. XML v1 won't
be supporting inconclusive errors. For XML v2 we need still to
decide what to do.
This commit is contained in:
Kimmo Varis 2011-04-16 14:04:20 +03:00
parent b7e14223b3
commit f9c97c7b56
7 changed files with 43 additions and 5 deletions

View File

@ -29,6 +29,7 @@ ErrorItem::ErrorItem(const ErrorItem &item)
files = item.files; files = item.files;
lines = item.lines; lines = item.lines;
id = item.id; id = item.id;
inconclusive = item.inconclusive;
severity = item.severity; severity = item.severity;
summary = item.summary; summary = item.summary;
message = item.message; message = item.message;
@ -40,6 +41,7 @@ ErrorItem::ErrorItem(const ErrorLine &line)
files.append(line.file); files.append(line.file);
lines.append(line.line); lines.append(line.line);
id = line.id; id = line.id;
inconclusive = line.inconclusive;
severity = line.severity; severity = line.severity;
summary = line.summary; summary = line.summary;
message = line.message; message = line.message;
@ -47,7 +49,10 @@ ErrorItem::ErrorItem(const ErrorLine &line)
QString ErrorItem::ToString() const QString ErrorItem::ToString() const
{ {
QString str = file + " - " + id + " - " + GuiSeverity::toString(severity) +"\n"; QString str = file + " - " + id + " - ";
if (inconclusive)
str += "inconclusive ";
str += GuiSeverity::toString(severity) +"\n";
str += summary + "\n"; str += summary + "\n";
str += message + "\n"; str += message + "\n";
for (int i = 0; i < files.size(); i++) for (int i = 0; i < files.size(); i++)

View File

@ -113,6 +113,7 @@ public:
QList<unsigned int> lines; QList<unsigned int> lines;
QString id; QString id;
Severity::SeverityType severity; Severity::SeverityType severity;
bool inconclusive;
QString summary; QString summary;
QString message; QString message;
}; };
@ -128,6 +129,7 @@ public:
QString file; QString file;
unsigned int line; unsigned int line;
QString id; QString id;
bool inconclusive;
Severity::SeverityType severity; Severity::SeverityType severity;
QString summary; QString summary;
QString message; QString message;

View File

@ -121,6 +121,7 @@ void ResultsTree::AddErrorItem(const ErrorItem &item)
ErrorLine line; ErrorLine line;
line.file = realfile; line.file = realfile;
line.id = item.id; line.id = item.id;
line.inconclusive = item.inconclusive;
line.line = item.lines[0]; line.line = item.lines[0];
line.summary = item.summary; line.summary = item.summary;
line.message = item.message; line.message = item.message;
@ -144,6 +145,7 @@ void ResultsTree::AddErrorItem(const ErrorItem &item)
data["file"] = item.files[0]; data["file"] = item.files[0];
data["line"] = item.lines[0]; data["line"] = item.lines[0];
data["id"] = item.id; data["id"] = item.id;
data["inconclusive"] = item.inconclusive;
stditem->setData(QVariant(data)); stditem->setData(QVariant(data));
//Add backtrace files as children //Add backtrace files as children
@ -165,6 +167,7 @@ void ResultsTree::AddErrorItem(const ErrorItem &item)
child_data["file"] = item.files[i]; child_data["file"] = item.files[i];
child_data["line"] = line.line; child_data["line"] = line.line;
child_data["id"] = line.id; child_data["id"] = line.id;
child_data["inconclusive"] = line.inconclusive;
child_item->setData(QVariant(child_data)); child_item->setData(QVariant(child_data));
} }
@ -196,7 +199,14 @@ QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent,
list << CreateLineNumberItem(QString("%1").arg(item.line)); list << CreateLineNumberItem(QString("%1").arg(item.line));
//TODO message has parameter names so we'll need changes to the core //TODO message has parameter names so we'll need changes to the core
//cppcheck so we can get proper translations //cppcheck so we can get proper translations
list << CreateNormalItem(tr(item.summary.toLatin1())); QString summary;
if (item.inconclusive)
{
summary = tr("[Inconclusive]");
summary += " ";
}
summary += item.summary.toLatin1();
list << CreateNormalItem(summary);
// Check for duplicate rows and don't add them if found // Check for duplicate rows and don't add them if found
for (int i = 0; i < parent->rowCount(); i++) for (int i = 0; i < parent->rowCount(); i++)
@ -774,7 +784,13 @@ void ResultsTree::CopyMessage()
QVariantMap data = mContextItem->data().toMap(); QVariantMap data = mContextItem->data().toMap();
QString message = data["message"].toString(); QString message;
if (data["inconclusive"].toBool())
{
message = tr("[Inconclusive]");
message += " ";
}
message += data["message"].toString();
QClipboard *clipboard = QApplication::clipboard(); QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(message); clipboard->setText(message);
@ -903,6 +919,7 @@ void ResultsTree::SaveErrors(Report *report, QStandardItem *item)
item.summary = data["summary"].toString(); item.summary = data["summary"].toString();
item.message = data["message"].toString(); item.message = data["message"].toString();
item.id = data["id"].toString(); item.id = data["id"].toString();
item.inconclusive = data["inconclusive"].toBool();
QString file = StripPath(data["file"].toString(), true); QString file = StripPath(data["file"].toString(), true);
unsigned int line = data["line"].toUInt(); unsigned int line = data["line"].toUInt();

View File

@ -72,6 +72,7 @@ void ThreadResult::reportErr(const ErrorLogger::ErrorMessage &msg)
item.summary = QString::fromStdString(msg.shortMessage()); item.summary = QString::fromStdString(msg.shortMessage());
item.message = QString::fromStdString(msg.verboseMessage()); item.message = QString::fromStdString(msg.verboseMessage());
item.severity = msg._severity; item.severity = msg._severity;
item.inconclusive = msg._inconclusive;
if (msg._severity != Severity::debug) if (msg._severity != Severity::debug)
emit Error(item); emit Error(item);

View File

@ -75,8 +75,13 @@ void TxtReport::WriteError(const ErrorItem &error)
line += ": "; line += ": ";
} }
} }
line += QString("(%1) ").arg(GuiSeverity::toString(error.severity));
line += QString("(%1) %2").arg(GuiSeverity::toString(error.severity)).arg(error.summary); if (error.inconclusive)
{
line += tr("inconclusive");
line += " ";
}
line += error.summary;
mTxtWriter << line << endl; mTxtWriter << line << endl;
} }

View File

@ -93,6 +93,10 @@ void XmlReportV1::WriteError(const ErrorItem &error)
The callstack seems to be ignored here as well, instead last item of the stack is used The callstack seems to be ignored here as well, instead last item of the stack is used
*/ */
// Don't write inconclusive errors to XML V1
if (error.inconclusive)
return;
mXmlWriter->writeStartElement(ErrorElementName); mXmlWriter->writeStartElement(ErrorElementName);
QString file = QDir::toNativeSeparators(error.files[error.files.size() - 1]); QString file = QDir::toNativeSeparators(error.files[error.files.size() - 1]);
file = XmlReport::quoteMessage(file); file = XmlReport::quoteMessage(file);

View File

@ -108,6 +108,10 @@ void XmlReportV2::WriteError(const ErrorItem &error)
</error> </error>
*/ */
// Don't write inconclusive errors to XML V2 until we decide the format
if (error.inconclusive)
return;
mXmlWriter->writeStartElement(ErrorElementName); mXmlWriter->writeStartElement(ErrorElementName);
mXmlWriter->writeAttribute(IdAttribute, error.id); mXmlWriter->writeAttribute(IdAttribute, error.id);