GUI: Refactor comparisons
This commit is contained in:
parent
277e0f1a8f
commit
1a75084d75
|
@ -79,3 +79,14 @@ QString ErrorItem::ToString() const
|
|||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
bool ErrorItem::sameCID(const ErrorItem &errorItem1, const ErrorItem &errorItem2)
|
||||
{
|
||||
// TODO: Implement some better CID calculation
|
||||
return errorItem1.errorId == errorItem2.errorId &&
|
||||
errorItem1.errorPath == errorItem2.errorPath &&
|
||||
errorItem1.file0 == errorItem2.file0 &&
|
||||
errorItem1.message == errorItem2.message &&
|
||||
errorItem1.inconclusive == errorItem2.inconclusive &&
|
||||
errorItem1.severity == errorItem2.severity;
|
||||
}
|
||||
|
|
|
@ -94,6 +94,11 @@ public:
|
|||
// Special GUI properties
|
||||
QString sinceDate;
|
||||
QString tags;
|
||||
|
||||
/**
|
||||
* Compare "CID"
|
||||
*/
|
||||
static bool sameCID(const ErrorItem &errorItem1, const ErrorItem &errorItem2);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(ErrorItem);
|
||||
|
|
|
@ -1131,12 +1131,7 @@ void ResultsTree::saveErrors(Report *report, QStandardItem *fileItem) const
|
|||
static int indexOf(const QList<ErrorItem> &list, const ErrorItem &item)
|
||||
{
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (list[i].errorId == item.errorId &&
|
||||
list[i].errorPath == item.errorPath &&
|
||||
list[i].file0 == item.file0 &&
|
||||
list[i].message == item.message &&
|
||||
list[i].inconclusive == item.inconclusive &&
|
||||
list[i].severity == item.severity) {
|
||||
if (ErrorItem::sameCID(item, list[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue