| 391 | } |
| 392 | |
| 393 | void ResultsView::readErrorsXml(const QString &filename) |
| 394 | { |
| 395 | const int version = XmlReport::determineVersion(filename); |
| 396 | if (version == 0) { |
| 397 | QMessageBox msgBox; |
| 398 | msgBox.setText(tr("Failed to read the report.")); |
| 399 | msgBox.setIcon(QMessageBox::Critical); |
| 400 | msgBox.exec(); |
| 401 | return; |
| 402 | } |
| 403 | if (version == 1) { |
| 404 | QMessageBox msgBox; |
| 405 | msgBox.setText(tr("XML format version 1 is no longer supported.")); |
| 406 | msgBox.setIcon(QMessageBox::Critical); |
| 407 | msgBox.exec(); |
| 408 | return; |
| 409 | } |
| 410 | |
| 411 | XmlReportV2 report(filename, QString()); |
| 412 | QList<ErrorItem> errors; |
| 413 | if (report.open()) { |
| 414 | errors = report.read(); |
| 415 | } else { |
| 416 | QMessageBox msgBox; |
| 417 | msgBox.setText(tr("Failed to read the report.")); |
| 418 | msgBox.setIcon(QMessageBox::Critical); |
| 419 | msgBox.exec(); |
| 420 | } |
| 421 | |
| 422 | for (const ErrorItem& item : utils::as_const(errors)) { |
| 423 | handleCriticalError(item); |
| 424 | mUI->mTree->addErrorItem(item); |
| 425 | } |
| 426 | |
| 427 | QString dir; |
| 428 | if (!errors.isEmpty() && !errors[0].errorPath.isEmpty()) { |
| 429 | QString relativePath = QFileInfo(filename).canonicalPath(); |
| 430 | if (QFileInfo::exists(relativePath + '/' + errors[0].errorPath[0].file)) |
| 431 | dir = relativePath; |
| 432 | } |
| 433 | |
| 434 | mUI->mTree->setCheckDirectory(dir); |
| 435 | } |
| 436 | |
| 437 | void ResultsView::updateDetails(const ResultItem* item) |
| 438 | { |
no test coverage detected