GUI: Do not show Severity, Id, Inconclusive and Summary twice if an error element has a child
This commit is contained in:
parent
dfe61f415d
commit
04a31011b0
|
@ -144,7 +144,8 @@ bool ResultsTree::AddErrorItem(const ErrorItem &item)
|
||||||
QStandardItem* stditem = AddBacktraceFiles(fileItem,
|
QStandardItem* stditem = AddBacktraceFiles(fileItem,
|
||||||
line,
|
line,
|
||||||
hide,
|
hide,
|
||||||
SeverityToIcon(line.severity));
|
SeverityToIcon(line.severity),
|
||||||
|
false);
|
||||||
|
|
||||||
if (!stditem)
|
if (!stditem)
|
||||||
return false;
|
return false;
|
||||||
|
@ -170,7 +171,8 @@ bool ResultsTree::AddErrorItem(const ErrorItem &item)
|
||||||
child_item = AddBacktraceFiles(stditem,
|
child_item = AddBacktraceFiles(stditem,
|
||||||
line,
|
line,
|
||||||
hide,
|
hide,
|
||||||
":images/go-down.png");
|
":images/go-down.png",
|
||||||
|
true);
|
||||||
|
|
||||||
//Add user data to that item
|
//Add user data to that item
|
||||||
QMap<QString, QVariant> child_data;
|
QMap<QString, QVariant> child_data;
|
||||||
|
@ -184,9 +186,8 @@ bool ResultsTree::AddErrorItem(const ErrorItem &item)
|
||||||
child_item->setData(QVariant(child_data));
|
child_item->setData(QVariant(child_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Partially refresh the tree: Unhide error item and file item if necessary
|
// Partially refresh the tree: Unhide file item if necessary
|
||||||
if (!hide) {
|
if (!hide) {
|
||||||
setRowHidden(stditem->row(), stditem->index(), false);
|
|
||||||
setRowHidden(fileItem->row(), QModelIndex(), false);
|
setRowHidden(fileItem->row(), QModelIndex(), false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -195,7 +196,8 @@ bool ResultsTree::AddErrorItem(const ErrorItem &item)
|
||||||
QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent,
|
QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent,
|
||||||
const ErrorLine &item,
|
const ErrorLine &item,
|
||||||
const bool hide,
|
const bool hide,
|
||||||
const QString &icon)
|
const QString &icon,
|
||||||
|
bool childOfMessage)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
|
@ -206,14 +208,27 @@ QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent,
|
||||||
// Ensure shown path is with native separators
|
// Ensure shown path is with native separators
|
||||||
const QString file = QDir::toNativeSeparators(item.file);
|
const QString file = QDir::toNativeSeparators(item.file);
|
||||||
list << CreateNormalItem(file);
|
list << CreateNormalItem(file);
|
||||||
const QString severity = SeverityToTranslatedString(item.severity);
|
if (childOfMessage)
|
||||||
list << CreateNormalItem(severity);
|
list << CreateNormalItem("");
|
||||||
|
else {
|
||||||
|
const QString severity = SeverityToTranslatedString(item.severity);
|
||||||
|
list << CreateNormalItem(severity);
|
||||||
|
}
|
||||||
list << CreateLineNumberItem(QString("%1").arg(item.line));
|
list << CreateLineNumberItem(QString("%1").arg(item.line));
|
||||||
list << CreateNormalItem(item.errorId);
|
if (childOfMessage)
|
||||||
list << CreateCheckboxItem(item.inconclusive);
|
list << CreateNormalItem("");
|
||||||
|
else
|
||||||
|
list << CreateNormalItem(item.errorId);
|
||||||
|
if (childOfMessage)
|
||||||
|
list << CreateNormalItem("");
|
||||||
|
else
|
||||||
|
list << CreateCheckboxItem(item.inconclusive);
|
||||||
//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(item.summary.toLatin1());
|
if (childOfMessage)
|
||||||
|
list << CreateNormalItem("");
|
||||||
|
else
|
||||||
|
list << CreateNormalItem(item.summary.toLatin1());
|
||||||
|
|
||||||
// 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++) {
|
||||||
|
@ -223,8 +238,8 @@ QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent,
|
||||||
if (parent->child(i, 2)->text() == list[2]->text()) {
|
if (parent->child(i, 2)->text() == list[2]->text()) {
|
||||||
// the second column is the severity so check it next
|
// the second column is the severity so check it next
|
||||||
if (parent->child(i, 1)->text() == list[1]->text()) {
|
if (parent->child(i, 1)->text() == list[1]->text()) {
|
||||||
// the fourth column is the summary so check it last
|
// the sixth column is the summary so check it last
|
||||||
if (parent->child(i, 4)->text() == list[4]->text()) {
|
if (parent->child(i, 5)->text() == list[5]->text()) {
|
||||||
// this row matches so don't add it
|
// this row matches so don't add it
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,12 +320,14 @@ protected:
|
||||||
* @param item Error line data
|
* @param item Error line data
|
||||||
* @param hide Should this be hidden (true) or shown (false)
|
* @param hide Should this be hidden (true) or shown (false)
|
||||||
* @param icon Should a default backtrace item icon be added
|
* @param icon Should a default backtrace item icon be added
|
||||||
|
* @param childOfMessage Is this a child element of a message?
|
||||||
* @return newly created QStandardItem *
|
* @return newly created QStandardItem *
|
||||||
*/
|
*/
|
||||||
QStandardItem *AddBacktraceFiles(QStandardItem *parent,
|
QStandardItem *AddBacktraceFiles(QStandardItem *parent,
|
||||||
const ErrorLine &item,
|
const ErrorLine &item,
|
||||||
const bool hide,
|
const bool hide,
|
||||||
const QString &icon);
|
const QString &icon,
|
||||||
|
bool childOfMessage);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue