Skip to content

Commit

Permalink
gui
Browse files Browse the repository at this point in the history
  • Loading branch information
danmar committed Jun 2, 2024
1 parent 759e1d1 commit 1e338e5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
8 changes: 3 additions & 5 deletions gui/erroritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,10 @@ ErrorItem::ErrorItem(const ErrorMessage &errmsg)
, cwe(errmsg.cwe.id)
, hash(errmsg.hash)
, symbolNames(QString::fromStdString(errmsg.symbolNames()))
, remark(QString::fromStdString(errmsg.remark))
{
for (std::list<ErrorMessage::FileLocation>::const_iterator loc = errmsg.callStack.cbegin();
loc != errmsg.callStack.cend();
++loc) {
errorPath << QErrorPathItem(*loc);
}
for (const auto& loc: errmsg.callStack)
errorPath << QErrorPathItem(loc);
}

QString ErrorItem::tool() const
Expand Down
2 changes: 2 additions & 0 deletions gui/erroritem.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class ErrorItem {
unsigned long long hash;
QList<QErrorPathItem> errorPath;
QString symbolNames;
QString remark;

// Special GUI properties
QString sinceDate;
Expand Down Expand Up @@ -122,6 +123,7 @@ class ErrorLine {
QString message;
QString sinceDate;
QString tags;
QString remark;
};

/// @}
Expand Down
4 changes: 4 additions & 0 deletions gui/resultstree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ static constexpr char SINCEDATE[] = "sinceDate";
static constexpr char SYMBOLNAMES[] = "symbolNames";
static constexpr char SUMMARY[] = "summary";
static constexpr char TAGS[] = "tags";
static constexpr char REMARK[] = "remark";

// These must match column headers given in ResultsTree::translate()
static constexpr int COLUMN_SINCE_DATE = 6;
Expand Down Expand Up @@ -185,6 +186,7 @@ bool ResultsTree::addErrorItem(const ErrorItem &item)
if (const ProjectFile *activeProject = ProjectFile::getActiveProject()) {
line.tags = activeProject->getWarningTags(item.hash);
}
line.remark = item.remark;
//Create the base item for the error and ensure it has a proper
//file item as a parent
QStandardItem* fileItem = ensureFileItem(loc.file, item.file0, hide);
Expand Down Expand Up @@ -213,6 +215,7 @@ bool ResultsTree::addErrorItem(const ErrorItem &item)
data[SINCEDATE] = item.sinceDate;
data[SYMBOLNAMES] = item.symbolNames;
data[TAGS] = line.tags;
data[REMARK] = line.remark;
data[HIDE] = hide;
stditem->setData(QVariant(data));

Expand Down Expand Up @@ -1295,6 +1298,7 @@ void ResultsTree::readErrorItem(const QStandardItem *error, ErrorItem *item) con
item->file0 = data[FILE0].toString();
item->sinceDate = data[SINCEDATE].toString();
item->tags = data[TAGS].toString();
item->remark = data[REMARK].toString();

if (error->rowCount() == 0) {
QErrorPathItem e;
Expand Down
5 changes: 5 additions & 0 deletions gui/xmlreportv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ static const QString TagsAttribute = "tag";
static const QString FilenameAttribute = "file";
static const QString IncludedFromFilenameAttribute = "file0";
static const QString InconclusiveAttribute = "inconclusive";
static const QString RemarkAttribute = "remark";
static const QString InfoAttribute = "info";
static const QString LineAttribute = "line";
static const QString ColumnAttribute = "column";
Expand Down Expand Up @@ -137,6 +138,8 @@ void XmlReportV2::writeError(const ErrorItem &error)
mXmlWriter->writeAttribute(VerboseAttribute, message);
if (error.inconclusive)
mXmlWriter->writeAttribute(InconclusiveAttribute, "true");
if (!error.remark.isEmpty())
mXmlWriter->writeAttribute(RemarkAttribute, error.remark);
if (error.cwe > 0)
mXmlWriter->writeAttribute(CWEAttribute, QString::number(error.cwe));
if (error.hash > 0)
Expand Down Expand Up @@ -231,6 +234,8 @@ ErrorItem XmlReportV2::readError(const QXmlStreamReader *reader)
item.message = XmlReport::unquoteMessage(message);
if (attribs.hasAttribute(QString(), InconclusiveAttribute))
item.inconclusive = true;
if (attribs.hasAttribute(QString(), RemarkAttribute))
item.remark = attribs.value(QString(), RemarkAttribute).toString();
if (attribs.hasAttribute(QString(), CWEAttribute))
item.cwe = attribs.value(QString(), CWEAttribute).toInt();
if (attribs.hasAttribute(QString(), HashAttribute))
Expand Down

0 comments on commit 1e338e5

Please sign in to comment.