GUI: small refactoring
This commit is contained in:
parent
4024420a4d
commit
f516c5696e
|
@ -972,9 +972,8 @@ void ResultsTree::saveResults(Report *report) const
|
|||
report->writeHeader();
|
||||
|
||||
for (int i = 0; i < mModel.rowCount(); i++) {
|
||||
QStandardItem *item = mModel.item(i, 0);
|
||||
//if (!isRowHidden(i, QModelIndex()))
|
||||
saveErrors(report, item);
|
||||
if (mSaveAllErrors || !isRowHidden(i, QModelIndex()))
|
||||
saveErrors(report, mModel.item(i, 0));
|
||||
}
|
||||
|
||||
report->writeFooter();
|
||||
|
@ -997,29 +996,36 @@ void ResultsTree::saveErrors(Report *report, QStandardItem *item) const
|
|||
continue;
|
||||
}
|
||||
|
||||
ErrorItem item;
|
||||
readErrorItem(error, &item);
|
||||
|
||||
report->writeError(item);
|
||||
}
|
||||
}
|
||||
|
||||
void ResultsTree::readErrorItem(const QStandardItem *error, ErrorItem *item) const {
|
||||
//Get error's user data
|
||||
QVariant userdata = error->data();
|
||||
//Convert it to QVariantMap
|
||||
QVariantMap data = userdata.toMap();
|
||||
|
||||
ErrorItem item;
|
||||
item.severity = ShowTypes::ShowTypeToSeverity(ShowTypes::VariantToShowType(data["severity"]));
|
||||
item.summary = data["summary"].toString();
|
||||
item.message = data["message"].toString();
|
||||
item.errorId = data["id"].toString();
|
||||
item.inconclusive = data["inconclusive"].toBool();
|
||||
item.file0 = data["file0"].toString();
|
||||
item->severity = ShowTypes::ShowTypeToSeverity(ShowTypes::VariantToShowType(data["severity"]));
|
||||
item->summary = data["summary"].toString();
|
||||
item->message = data["message"].toString();
|
||||
item->errorId = data["id"].toString();
|
||||
item->inconclusive = data["inconclusive"].toBool();
|
||||
item->file0 = data["file0"].toString();
|
||||
|
||||
if (error->rowCount() == 0) {
|
||||
QErrorPathItem e;
|
||||
e.file = stripPath(data["file"].toString(), true);
|
||||
e.line = data["line"].toUInt();
|
||||
e.info = data["message"].toString();
|
||||
item.errorPath << e;
|
||||
item->errorPath << e;
|
||||
}
|
||||
|
||||
for (int j = 0; j < error->rowCount(); j++) {
|
||||
QStandardItem *child_error = error->child(j, 0);
|
||||
const QStandardItem *child_error = error->child(j, 0);
|
||||
//Get error's user data
|
||||
QVariant child_userdata = child_error->data();
|
||||
//Convert it to QVariantMap
|
||||
|
@ -1029,10 +1035,7 @@ void ResultsTree::saveErrors(Report *report, QStandardItem *item) const
|
|||
e.file = stripPath(child_data["file"].toString(), true);
|
||||
e.line = child_data["line"].toUInt();
|
||||
e.info = child_data["message"].toString();
|
||||
item.errorPath << e;
|
||||
}
|
||||
|
||||
report->writeError(item);
|
||||
item->errorPath << e;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -498,6 +498,9 @@ protected:
|
|||
bool mVisibleErrors;
|
||||
|
||||
private:
|
||||
/** @brief Convert GUI error item into data error item */
|
||||
void readErrorItem(const QStandardItem *error, ErrorItem *item) const;
|
||||
|
||||
QItemSelectionModel *mSelectionModel;
|
||||
ThreadHandler *mThread;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue