diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index a65f2b4c4..7ac7c23d2 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -772,7 +772,8 @@ void MainWindow::ProgramSettings() dialog.SaveFullPath(), dialog.SaveAllErrors(), dialog.ShowNoErrorsMessage(), - dialog.ShowErrorId()); + dialog.ShowErrorId(), + dialog.ShowInconclusive()); const QString newLang = mSettings->value(SETTINGS_LANGUAGE, "en").toString(); SetLanguage(newLang); } diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index dfead6bc3..c77cc15ee 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -82,6 +82,15 @@ QStandardItem *ResultsTree::CreateNormalItem(const QString &name) return item; } +QStandardItem *ResultsTree::CreateCheckboxItem(bool checked) +{ + QStandardItem *item = new QStandardItem; + item->setCheckable(true); + item->setCheckState(checked ? Qt::Checked : Qt::Unchecked); + item->setEnabled(false); + return item; +} + QStandardItem *ResultsTree::CreateLineNumberItem(const QString &linenumber) { QStandardItem *item = new QStandardItem(); @@ -201,15 +210,10 @@ QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent, list << CreateNormalItem(severity); list << CreateLineNumberItem(QString("%1").arg(item.line)); list << CreateNormalItem(item.errorId); + list << CreateCheckboxItem(item.inconclusive); //TODO message has parameter names so we'll need changes to the core //cppcheck so we can get proper translations - QString summary; - if (item.inconclusive) { - summary = tr("[Inconclusive]"); - summary += " "; - } - summary += item.summary.toLatin1(); - list << CreateNormalItem(summary); + list << CreateNormalItem(item.summary.toLatin1()); // Check for duplicate rows and don't add them if found for (int i = 0; i < parent->rowCount(); i++) { @@ -323,6 +327,7 @@ void ResultsTree::LoadSettings() mShowFullPath = mSettings->value(SETTINGS_SHOW_FULL_PATH, false).toBool(); ShowIdColumn(mSettings->value(SETTINGS_SHOW_ERROR_ID, false).toBool()); + ShowInconclusiveColumn(mSettings->value(SETTINGS_INCONCLUSIVE_ERRORS, false).toBool()); } void ResultsTree::SaveSettings() const @@ -946,7 +951,8 @@ void ResultsTree::SaveErrors(Report *report, QStandardItem *item) const void ResultsTree::UpdateSettings(bool showFullPath, bool saveFullPath, bool saveAllErrors, - bool showErrorId) + bool showErrorId, + bool showInconclusive) { if (mShowFullPath != showFullPath) { mShowFullPath = showFullPath; @@ -957,6 +963,7 @@ void ResultsTree::UpdateSettings(bool showFullPath, mSaveAllErrors = saveAllErrors; ShowIdColumn(showErrorId); + ShowInconclusiveColumn(showInconclusive); } void ResultsTree::SetCheckDirectory(const QString &dir) @@ -1056,7 +1063,7 @@ bool ResultsTree::HasResults() const void ResultsTree::Translate() { QStringList labels; - labels << tr("File") << tr("Severity") << tr("Line") << tr("Id") << tr("Summary"); + labels << tr("File") << tr("Severity") << tr("Line") << tr("Id") << tr("Inconclusive") << tr("Summary"); mModel.setHorizontalHeaderLabels(labels); //TODO go through all the errors in the tree and translate severity and message } @@ -1070,6 +1077,14 @@ void ResultsTree::ShowIdColumn(bool show) hideColumn(3); } +void ResultsTree::ShowInconclusiveColumn(bool show) +{ + if (show) + showColumn(4); + else + hideColumn(4); +} + void ResultsTree::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { QTreeView::currentChanged(current, previous); diff --git a/gui/resultstree.h b/gui/resultstree.h index 8069e686d..09df9db09 100644 --- a/gui/resultstree.h +++ b/gui/resultstree.h @@ -104,8 +104,9 @@ public: * @param saveFullPath Save full path of files in reports * @param saveAllErrors Save all visible errors * @param showErrorId Show error id + * @param showInconclusive Show inconclusive column */ - void UpdateSettings(bool showFullPath, bool saveFullPath, bool saveAllErrors, bool showErrorId); + void UpdateSettings(bool showFullPath, bool saveFullPath, bool saveAllErrors, bool showErrorId, bool showInconclusive); /** * @brief Set the directory we are checking @@ -144,6 +145,11 @@ public: */ void ShowIdColumn(bool show); + /** + * @brief Show optional column "Inconclusve" + */ + void ShowInconclusiveColumn(bool show); + /** * @brief Returns true if column "Id" is shown */ @@ -358,6 +364,15 @@ protected: */ static QStandardItem *CreateNormalItem(const QString &name); + /** + * @brief Create new normal item. + * + * Normal item has left alignment and text set also as tooltip. + * @param checked checked + * @return new QStandardItem + */ + static QStandardItem *CreateCheckboxItem(bool checked); + /** * @brief Create new line number item. * diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index ecf6f0ef2..c95cd4527 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -222,9 +222,10 @@ void ResultsView::UpdateSettings(bool showFullPath, bool saveFullPath, bool saveAllErrors, bool showNoErrorsMessage, - bool showErrorId) + bool showErrorId, + bool showInconclusive) { - mUI.mTree->UpdateSettings(showFullPath, saveFullPath, saveAllErrors, showErrorId); + mUI.mTree->UpdateSettings(showFullPath, saveFullPath, saveAllErrors, showErrorId, showInconclusive); mShowNoErrorsMessage = showNoErrorsMessage; } diff --git a/gui/resultsview.h b/gui/resultsview.h index 75d72f95e..fbfab24ff 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -84,12 +84,14 @@ public: * @param saveAllErrors Save all visible errors * @param showNoErrorsMessage Show "no errors"? * @param showErrorId Show error id? + * @param showInconclusive Show inconclusive? */ void UpdateSettings(bool showFullPath, bool saveFullPath, bool saveAllErrors, bool showNoErrorsMessage, - bool showErrorId); + bool showErrorId, + bool showInconclusive); /** * @brief Set the directory we are checking diff --git a/gui/settings.ui b/gui/settings.ui index 6aad65f7f..8f9d0e9e3 100644 --- a/gui/settings.ui +++ b/gui/settings.ui @@ -143,6 +143,13 @@ + + + + Check for inconclusive errors also + + + @@ -156,6 +163,13 @@ + + + + Show internal warnings in log + + + @@ -324,40 +338,6 @@ - - - Advanced - - - - - - &Show inconclusive errors - - - - - - - S&how internal warnings in log - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index ec48fd82c..8a9ee8752 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -308,6 +308,11 @@ bool SettingsDialog::ShowErrorId() const return CheckStateToBool(mUI.mShowErrorId->checkState()); } +bool SettingsDialog::ShowInconclusive() const +{ + return CheckStateToBool(mUI.mEnableInconclusive->checkState()); +} + void SettingsDialog::AddIncludePath() { QString selectedDir = QFileDialog::getExistingDirectory(this, diff --git a/gui/settingsdialog.h b/gui/settingsdialog.h index 0aa6a7fe1..166a8ee7a 100644 --- a/gui/settingsdialog.h +++ b/gui/settingsdialog.h @@ -78,6 +78,14 @@ public: */ bool ShowErrorId() const; + + /** + * @brief Get checkbox value for mEnableInconclusive + * + * @return Should inconclusive column be displayed + */ + bool ShowInconclusive() const; + /** * @brief Get checkbox value for mSaveAllErrors *