MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / readErrorsXml

Method readErrorsXml

gui/resultsview.cpp:393–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393void 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
437void ResultsView::updateDetails(const ResultItem* item)
438{

Callers 2

loadResultsMethod · 0.80
loadLastResultsMethod · 0.80

Calls 6

addErrorItemMethod · 0.80
isEmptyMethod · 0.80
QStringClass · 0.70
openMethod · 0.45
readMethod · 0.45
setCheckDirectoryMethod · 0.45

Tested by

no test coverage detected