2009-03-01 08:38:21 +01:00
|
|
|
/*
|
|
|
|
* Cppcheck - A tool for static C/C++ code analysis
|
2015-11-18 20:04:50 +01:00
|
|
|
* Copyright (C) 2007-2015 Cppcheck team.
|
2009-03-01 08:38:21 +01:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2009-09-27 17:08:31 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2009-03-01 08:38:21 +01:00
|
|
|
*/
|
|
|
|
|
2009-06-09 09:51:27 +02:00
|
|
|
#include <QMessageBox>
|
2010-11-22 23:37:29 +01:00
|
|
|
#include <QStandardItemModel>
|
|
|
|
#include <QStandardItem>
|
|
|
|
#include <QVariant>
|
|
|
|
#include <QString>
|
|
|
|
#include <QModelIndex>
|
2015-04-17 16:33:52 +02:00
|
|
|
#include <QPrinter>
|
|
|
|
#include <QPrintDialog>
|
|
|
|
#include <QPrintPreviewDialog>
|
2010-11-23 20:57:16 +01:00
|
|
|
#include <QSettings>
|
2015-10-14 18:10:14 +02:00
|
|
|
#include <QDir>
|
2011-07-28 08:30:45 +02:00
|
|
|
#include "common.h"
|
2010-07-14 13:24:46 +02:00
|
|
|
#include "erroritem.h"
|
2009-06-24 09:54:56 +02:00
|
|
|
#include "resultsview.h"
|
2009-07-06 11:30:49 +02:00
|
|
|
#include "report.h"
|
2009-06-24 09:54:56 +02:00
|
|
|
#include "txtreport.h"
|
|
|
|
#include "xmlreport.h"
|
2011-02-04 22:56:14 +01:00
|
|
|
#include "xmlreportv1.h"
|
2011-02-03 20:40:35 +01:00
|
|
|
#include "xmlreportv2.h"
|
2009-07-06 11:30:49 +02:00
|
|
|
#include "csvreport.h"
|
2015-04-17 16:33:52 +02:00
|
|
|
#include "printablereport.h"
|
2010-11-24 16:39:53 +01:00
|
|
|
#include "applicationlist.h"
|
2010-11-29 23:01:45 +01:00
|
|
|
#include "checkstatistics.h"
|
2009-03-01 08:38:21 +01:00
|
|
|
|
2009-07-02 10:32:29 +02:00
|
|
|
ResultsView::ResultsView(QWidget * parent) :
|
2010-04-15 20:08:51 +02:00
|
|
|
QWidget(parent),
|
|
|
|
mErrorsFound(false),
|
2010-11-29 23:01:45 +01:00
|
|
|
mShowNoErrorsMessage(true),
|
|
|
|
mStatistics(new CheckStatistics(this))
|
2009-03-01 08:38:21 +01:00
|
|
|
{
|
2009-07-02 10:32:29 +02:00
|
|
|
mUI.setupUi(this);
|
2010-11-24 09:48:07 +01:00
|
|
|
|
|
|
|
connect(mUI.mTree, SIGNAL(ResultsHidden(bool)), this, SIGNAL(ResultsHidden(bool)));
|
2015-12-23 10:28:07 +01:00
|
|
|
connect(mUI.mTree, SIGNAL(CheckSelected(QStringList)), this, SIGNAL(CheckSelected(QStringList)));
|
2010-11-23 21:37:31 +01:00
|
|
|
connect(mUI.mTree, SIGNAL(SelectionChanged(const QModelIndex &)), this, SLOT(UpdateDetails(const QModelIndex &)));
|
2009-07-02 10:32:29 +02:00
|
|
|
}
|
2009-03-01 08:38:21 +01:00
|
|
|
|
2015-12-23 10:28:07 +01:00
|
|
|
void ResultsView::Initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler)
|
2009-07-02 10:32:29 +02:00
|
|
|
{
|
|
|
|
mUI.mProgress->setMinimum(0);
|
|
|
|
mUI.mProgress->setVisible(false);
|
2010-11-23 20:57:16 +01:00
|
|
|
|
|
|
|
QByteArray state = settings->value(SETTINGS_MAINWND_SPLITTER_STATE).toByteArray();
|
|
|
|
mUI.mVerticalSplitter->restoreState(state);
|
2009-07-02 10:32:29 +02:00
|
|
|
mShowNoErrorsMessage = settings->value(SETTINGS_SHOW_NO_ERRORS, true).toBool();
|
2009-06-09 09:51:27 +02:00
|
|
|
|
2015-12-23 10:28:07 +01:00
|
|
|
mUI.mTree->Initialize(settings, list, checkThreadHandler);
|
2009-03-01 08:38:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ResultsView::~ResultsView()
|
|
|
|
{
|
|
|
|
//dtor
|
|
|
|
}
|
|
|
|
|
2012-09-05 21:01:50 +02:00
|
|
|
void ResultsView::Clear(bool results)
|
2009-03-01 08:38:21 +01:00
|
|
|
{
|
2012-09-05 21:01:50 +02:00
|
|
|
if (results) {
|
|
|
|
mUI.mTree->Clear();
|
|
|
|
mErrorsFound = false;
|
|
|
|
}
|
|
|
|
|
2010-11-24 16:09:02 +01:00
|
|
|
mUI.mDetails->setText("");
|
2012-09-05 21:01:50 +02:00
|
|
|
|
2010-11-29 23:01:45 +01:00
|
|
|
mStatistics->Clear();
|
2009-06-09 09:51:27 +02:00
|
|
|
|
|
|
|
//Clear the progressbar
|
2011-07-28 08:30:45 +02:00
|
|
|
mUI.mProgress->setMaximum(PROGRESS_MAX);
|
2009-07-02 10:32:29 +02:00
|
|
|
mUI.mProgress->setValue(0);
|
2011-08-03 09:53:35 +02:00
|
|
|
mUI.mProgress->setFormat("%p%");
|
2009-03-01 08:38:21 +01:00
|
|
|
}
|
|
|
|
|
2012-02-14 21:16:11 +01:00
|
|
|
void ResultsView::Clear(const QString &filename)
|
|
|
|
{
|
|
|
|
mUI.mTree->Clear(filename);
|
|
|
|
|
2012-09-05 21:01:50 +02:00
|
|
|
/**
|
|
|
|
* @todo Optimize this.. It is inefficient to check this every time.
|
|
|
|
*/
|
|
|
|
// If the results list got empty..
|
|
|
|
if (!mUI.mTree->HasResults())
|
|
|
|
mErrorsFound = false;
|
2012-02-14 21:16:11 +01:00
|
|
|
}
|
|
|
|
|
2011-07-28 08:30:45 +02:00
|
|
|
void ResultsView::Progress(int value, const QString& description)
|
2009-03-01 08:38:21 +01:00
|
|
|
{
|
2009-07-02 10:32:29 +02:00
|
|
|
mUI.mProgress->setValue(value);
|
2011-08-03 09:53:35 +02:00
|
|
|
mUI.mProgress->setFormat(QString("%p% (%1)").arg(description));
|
2009-03-01 08:38:21 +01:00
|
|
|
}
|
|
|
|
|
2010-07-14 13:24:46 +02:00
|
|
|
void ResultsView::Error(const ErrorItem &item)
|
2009-03-01 08:38:21 +01:00
|
|
|
{
|
2009-06-09 09:51:27 +02:00
|
|
|
mErrorsFound = true;
|
2013-02-15 16:49:36 +01:00
|
|
|
if (mUI.mTree->AddErrorItem(item)) {
|
|
|
|
emit GotResults();
|
|
|
|
mStatistics->AddItem(ShowTypes::SeverityToShowType(item.severity));
|
|
|
|
}
|
2009-03-01 08:38:21 +01:00
|
|
|
}
|
2009-03-22 18:39:44 +01:00
|
|
|
|
2011-10-11 21:14:15 +02:00
|
|
|
void ResultsView::ShowResults(ShowTypes::ShowType type, bool show)
|
2009-03-22 18:39:44 +01:00
|
|
|
{
|
2009-07-02 10:32:29 +02:00
|
|
|
mUI.mTree->ShowResults(type, show);
|
2009-03-22 18:39:44 +01:00
|
|
|
}
|
2009-06-02 00:26:44 +02:00
|
|
|
|
|
|
|
void ResultsView::CollapseAllResults()
|
|
|
|
{
|
2009-07-02 10:32:29 +02:00
|
|
|
mUI.mTree->collapseAll();
|
2009-06-02 00:26:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ResultsView::ExpandAllResults()
|
|
|
|
{
|
2009-07-02 10:32:29 +02:00
|
|
|
mUI.mTree->expandAll();
|
2009-06-02 00:26:44 +02:00
|
|
|
}
|
2009-06-03 20:18:22 +02:00
|
|
|
|
2010-11-21 19:55:34 +01:00
|
|
|
void ResultsView::ShowHiddenResults()
|
|
|
|
{
|
|
|
|
mUI.mTree->ShowHiddenResults();
|
|
|
|
}
|
|
|
|
|
2011-05-04 07:30:54 +02:00
|
|
|
void ResultsView::FilterResults(const QString& filter)
|
|
|
|
{
|
|
|
|
mUI.mTree->FilterResults(filter);
|
|
|
|
}
|
|
|
|
|
2012-10-27 12:22:56 +02:00
|
|
|
void ResultsView::Save(const QString &filename, Report::Type type) const
|
2009-06-03 20:18:22 +02:00
|
|
|
{
|
2011-10-13 20:53:06 +02:00
|
|
|
if (!mErrorsFound) {
|
2009-06-09 09:51:27 +02:00
|
|
|
QMessageBox msgBox;
|
2009-08-01 08:42:52 +02:00
|
|
|
msgBox.setText(tr("No errors found, nothing to save."));
|
2009-07-06 11:37:54 +02:00
|
|
|
msgBox.setIcon(QMessageBox::Critical);
|
2009-06-09 09:51:27 +02:00
|
|
|
msgBox.exec();
|
|
|
|
}
|
|
|
|
|
2009-07-06 11:30:49 +02:00
|
|
|
Report *report = NULL;
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
switch (type) {
|
2009-07-06 11:30:49 +02:00
|
|
|
case Report::CSV:
|
2012-10-27 12:22:56 +02:00
|
|
|
report = new CsvReport(filename);
|
2009-07-06 11:30:49 +02:00
|
|
|
break;
|
|
|
|
case Report::TXT:
|
2012-10-27 12:22:56 +02:00
|
|
|
report = new TxtReport(filename);
|
2009-07-06 11:30:49 +02:00
|
|
|
break;
|
|
|
|
case Report::XML:
|
2012-10-27 12:22:56 +02:00
|
|
|
report = new XmlReportV1(filename);
|
2009-07-06 11:30:49 +02:00
|
|
|
break;
|
2011-02-03 20:40:35 +01:00
|
|
|
case Report::XMLV2:
|
2012-10-27 12:22:56 +02:00
|
|
|
report = new XmlReportV2(filename);
|
2011-02-03 20:40:35 +01:00
|
|
|
break;
|
2009-07-06 11:30:49 +02:00
|
|
|
}
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
if (report) {
|
2010-04-02 07:30:58 +02:00
|
|
|
if (report->Create())
|
2009-07-06 11:30:49 +02:00
|
|
|
mUI.mTree->SaveResults(report);
|
2011-10-13 20:53:06 +02:00
|
|
|
else {
|
2009-06-24 09:54:56 +02:00
|
|
|
QMessageBox msgBox;
|
2009-08-01 08:42:52 +02:00
|
|
|
msgBox.setText(tr("Failed to save the report."));
|
2009-07-06 11:37:54 +02:00
|
|
|
msgBox.setIcon(QMessageBox::Critical);
|
2009-06-24 09:54:56 +02:00
|
|
|
msgBox.exec();
|
|
|
|
}
|
2009-07-31 21:19:21 +02:00
|
|
|
delete report;
|
2012-09-15 21:13:31 +02:00
|
|
|
report = NULL;
|
2011-10-13 20:53:06 +02:00
|
|
|
} else {
|
2009-07-06 11:30:49 +02:00
|
|
|
QMessageBox msgBox;
|
2009-08-01 08:42:52 +02:00
|
|
|
msgBox.setText(tr("Failed to save the report."));
|
2009-07-06 11:37:54 +02:00
|
|
|
msgBox.setIcon(QMessageBox::Critical);
|
2009-07-06 11:30:49 +02:00
|
|
|
msgBox.exec();
|
2009-06-03 20:18:22 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-17 16:33:52 +02:00
|
|
|
void ResultsView::Print()
|
|
|
|
{
|
|
|
|
QPrinter printer;
|
|
|
|
QPrintDialog dialog(&printer, this);
|
|
|
|
dialog.setWindowTitle(tr("Print Report"));
|
|
|
|
if (dialog.exec() != QDialog::Accepted)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Print(&printer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResultsView::PrintPreview()
|
|
|
|
{
|
|
|
|
QPrinter printer;
|
|
|
|
QPrintPreviewDialog dialog(&printer, this);
|
|
|
|
connect(&dialog, SIGNAL(paintRequested(QPrinter*)), SLOT(Print(QPrinter*)));
|
|
|
|
dialog.exec();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResultsView::Print(QPrinter* printer)
|
|
|
|
{
|
|
|
|
if (!mErrorsFound) {
|
|
|
|
QMessageBox msgBox;
|
|
|
|
msgBox.setText(tr("No errors found, nothing to print."));
|
|
|
|
msgBox.setIcon(QMessageBox::Critical);
|
|
|
|
msgBox.exec();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
PrintableReport report;
|
|
|
|
mUI.mTree->SaveResults(&report);
|
2015-04-17 16:46:58 +02:00
|
|
|
QTextDocument doc(report.GetFormattedReportText());
|
|
|
|
doc.print(printer);
|
2015-04-17 16:33:52 +02:00
|
|
|
}
|
|
|
|
|
2009-06-03 20:18:22 +02:00
|
|
|
void ResultsView::UpdateSettings(bool showFullPath,
|
|
|
|
bool saveFullPath,
|
2009-06-09 09:51:27 +02:00
|
|
|
bool saveAllErrors,
|
2012-10-27 11:16:52 +02:00
|
|
|
bool showNoErrorsMessage,
|
2015-10-15 11:59:17 +02:00
|
|
|
bool showErrorId,
|
|
|
|
bool showInconclusive)
|
2009-06-03 20:18:22 +02:00
|
|
|
{
|
2015-10-15 11:59:17 +02:00
|
|
|
mUI.mTree->UpdateSettings(showFullPath, saveFullPath, saveAllErrors, showErrorId, showInconclusive);
|
2009-06-09 09:51:27 +02:00
|
|
|
mShowNoErrorsMessage = showNoErrorsMessage;
|
2009-06-03 20:18:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ResultsView::SetCheckDirectory(const QString &dir)
|
|
|
|
{
|
2009-07-02 10:32:29 +02:00
|
|
|
mUI.mTree->SetCheckDirectory(dir);
|
2009-06-03 20:18:22 +02:00
|
|
|
}
|
|
|
|
|
2010-07-04 17:54:41 +02:00
|
|
|
void ResultsView::CheckingStarted(int count)
|
2009-06-09 10:21:17 +02:00
|
|
|
{
|
2009-07-02 10:32:29 +02:00
|
|
|
mUI.mProgress->setVisible(true);
|
2011-07-28 08:30:45 +02:00
|
|
|
mUI.mProgress->setMaximum(PROGRESS_MAX);
|
|
|
|
mUI.mProgress->setValue(0);
|
|
|
|
mUI.mProgress->setFormat(tr("%p% (%1 of %2 files checked)").arg(0).arg(count));
|
2010-07-04 17:54:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ResultsView::CheckingFinished()
|
|
|
|
{
|
|
|
|
mUI.mProgress->setVisible(false);
|
2011-07-28 08:30:45 +02:00
|
|
|
mUI.mProgress->setFormat("%p%");
|
|
|
|
|
2010-07-04 17:54:41 +02:00
|
|
|
//Should we inform user of non visible/not found errors?
|
2011-10-13 20:53:06 +02:00
|
|
|
if (mShowNoErrorsMessage) {
|
2010-07-04 17:54:41 +02:00
|
|
|
//Tell user that we found no errors
|
2011-10-13 20:53:06 +02:00
|
|
|
if (!mErrorsFound) {
|
2010-07-04 17:54:41 +02:00
|
|
|
QMessageBox msg(QMessageBox::Information,
|
|
|
|
tr("Cppcheck"),
|
|
|
|
tr("No errors found."),
|
|
|
|
QMessageBox::Ok,
|
|
|
|
this);
|
|
|
|
|
|
|
|
msg.exec();
|
|
|
|
} //If we have errors but they aren't visible, tell user about it
|
2011-10-13 20:53:06 +02:00
|
|
|
else if (!mUI.mTree->HasVisibleResults()) {
|
2010-07-04 17:54:41 +02:00
|
|
|
QString text = tr("Errors were found, but they are configured to be hidden.\n"\
|
|
|
|
"To toggle what kind of errors are shown, open view menu.");
|
|
|
|
QMessageBox msg(QMessageBox::Information,
|
|
|
|
tr("Cppcheck"),
|
|
|
|
text,
|
|
|
|
QMessageBox::Ok,
|
|
|
|
this);
|
|
|
|
|
|
|
|
msg.exec();
|
|
|
|
}
|
|
|
|
}
|
2009-06-09 10:21:17 +02:00
|
|
|
}
|
|
|
|
|
2009-06-20 22:05:17 +02:00
|
|
|
bool ResultsView::HasVisibleResults() const
|
|
|
|
{
|
2009-07-02 10:32:29 +02:00
|
|
|
return mUI.mTree->HasVisibleResults();
|
2009-06-20 22:05:17 +02:00
|
|
|
}
|
2009-06-20 22:42:12 +02:00
|
|
|
|
|
|
|
bool ResultsView::HasResults() const
|
|
|
|
{
|
2009-07-02 10:32:29 +02:00
|
|
|
return mUI.mTree->HasResults();
|
2009-06-20 22:42:12 +02:00
|
|
|
}
|
2009-07-02 10:32:29 +02:00
|
|
|
|
2010-11-23 20:57:16 +01:00
|
|
|
void ResultsView::SaveSettings(QSettings *settings)
|
2009-07-02 10:32:29 +02:00
|
|
|
{
|
|
|
|
mUI.mTree->SaveSettings();
|
2010-11-23 20:57:16 +01:00
|
|
|
QByteArray state = mUI.mVerticalSplitter->saveState();
|
|
|
|
settings->setValue(SETTINGS_MAINWND_SPLITTER_STATE, state);
|
|
|
|
mUI.mVerticalSplitter->restoreState(state);
|
2009-07-02 10:32:29 +02:00
|
|
|
}
|
|
|
|
|
2009-07-02 10:46:26 +02:00
|
|
|
void ResultsView::Translate()
|
|
|
|
{
|
|
|
|
mUI.mTree->Translate();
|
|
|
|
}
|
|
|
|
|
2009-07-02 19:23:44 +02:00
|
|
|
void ResultsView::DisableProgressbar()
|
|
|
|
{
|
|
|
|
mUI.mProgress->setEnabled(false);
|
|
|
|
}
|
2010-07-10 15:37:36 +02:00
|
|
|
|
|
|
|
void ResultsView::ReadErrorsXml(const QString &filename)
|
|
|
|
{
|
2011-02-05 11:12:34 +01:00
|
|
|
const int version = XmlReport::determineVersion(filename);
|
2011-10-13 20:53:06 +02:00
|
|
|
if (version == 0) {
|
2011-02-05 11:12:34 +01:00
|
|
|
QMessageBox msgBox;
|
|
|
|
msgBox.setText(tr("Failed to read the report."));
|
|
|
|
msgBox.setIcon(QMessageBox::Critical);
|
|
|
|
msgBox.exec();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
XmlReport *report = NULL;
|
|
|
|
if (version == 1)
|
2012-10-27 12:22:56 +02:00
|
|
|
report = new XmlReportV1(filename);
|
2011-02-05 11:12:34 +01:00
|
|
|
else if (version == 2)
|
2012-10-27 12:22:56 +02:00
|
|
|
report = new XmlReportV2(filename);
|
2011-02-05 11:12:34 +01:00
|
|
|
|
2011-02-05 11:41:29 +01:00
|
|
|
QList<ErrorItem> errors;
|
2011-10-13 20:53:06 +02:00
|
|
|
if (report) {
|
2010-07-10 15:37:36 +02:00
|
|
|
if (report->Open())
|
2010-07-11 01:02:08 +02:00
|
|
|
errors = report->Read();
|
2011-10-13 20:53:06 +02:00
|
|
|
else {
|
2010-07-10 15:37:36 +02:00
|
|
|
QMessageBox msgBox;
|
|
|
|
msgBox.setText(tr("Failed to read the report."));
|
|
|
|
msgBox.setIcon(QMessageBox::Critical);
|
|
|
|
msgBox.exec();
|
|
|
|
}
|
|
|
|
delete report;
|
2012-09-15 21:13:31 +02:00
|
|
|
report = NULL;
|
2011-10-13 20:53:06 +02:00
|
|
|
} else {
|
2010-07-10 15:37:36 +02:00
|
|
|
QMessageBox msgBox;
|
|
|
|
msgBox.setText(tr("Failed to read the report."));
|
|
|
|
msgBox.setIcon(QMessageBox::Critical);
|
|
|
|
msgBox.exec();
|
|
|
|
}
|
2010-07-11 01:02:08 +02:00
|
|
|
|
2011-02-05 11:41:29 +01:00
|
|
|
ErrorItem item;
|
2015-12-17 15:40:54 +01:00
|
|
|
foreach (item, errors) {
|
2010-07-11 01:02:08 +02:00
|
|
|
mUI.mTree->AddErrorItem(item);
|
|
|
|
}
|
2010-07-11 15:20:19 +02:00
|
|
|
mUI.mTree->SetCheckDirectory("");
|
2010-07-10 15:37:36 +02:00
|
|
|
}
|
2010-11-22 22:13:12 +01:00
|
|
|
|
2010-11-23 21:37:31 +01:00
|
|
|
void ResultsView::UpdateDetails(const QModelIndex &index)
|
2010-11-22 22:13:12 +01:00
|
|
|
{
|
|
|
|
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(mUI.mTree->model());
|
|
|
|
QStandardItem *item = model->itemFromIndex(index);
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
if (!item) {
|
2010-12-01 17:19:37 +01:00
|
|
|
mUI.mDetails->setText("");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-11-22 22:13:12 +01:00
|
|
|
// Make sure we are working with the first column
|
|
|
|
if (item->parent() && item->column() != 0)
|
|
|
|
item = item->parent()->child(item->row(), 0);
|
|
|
|
|
|
|
|
QVariantMap data = item->data().toMap();
|
2010-12-01 17:58:26 +01:00
|
|
|
|
|
|
|
// If there is no severity data then it is a parent item without summary and message
|
2011-10-13 20:53:06 +02:00
|
|
|
if (!data.contains("severity")) {
|
2010-12-01 17:58:26 +01:00
|
|
|
mUI.mDetails->setText("");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-11-30 22:37:25 +01:00
|
|
|
const QString summary = data["summary"].toString();
|
|
|
|
const QString message = data["message"].toString();
|
2012-10-27 11:16:52 +02:00
|
|
|
QString formattedMsg = QString("%1: %2\n%3: %4")
|
|
|
|
.arg(tr("Summary")).arg(summary)
|
|
|
|
.arg(tr("Message")).arg(message);
|
2015-10-14 18:10:14 +02:00
|
|
|
|
|
|
|
const QString file0 = data["file0"].toString();
|
|
|
|
if (file0 != "" && file0 != data["file"].toString())
|
|
|
|
formattedMsg += QString("\n\n%1: %2").arg(tr("First included by")).arg(QDir::toNativeSeparators(file0));
|
|
|
|
|
2012-10-27 11:16:52 +02:00
|
|
|
if (mUI.mTree->ShowIdColumn())
|
|
|
|
formattedMsg.prepend(tr("Id") + ": " + data["id"].toString() + "\n");
|
2010-11-30 22:37:25 +01:00
|
|
|
mUI.mDetails->setText(formattedMsg);
|
2010-11-22 22:13:12 +01:00
|
|
|
}
|