GUI: Improved handling of inconclusive messages (#3815)

- Moved setting from "Advanced" to "General" tab
-> Moved remaining single item, too, as it does not make sense to keep a tab for a single option. This option is now shown at the bottom of the dialog
- Replaced [inconclusive] string in "Summary" Column by extra column "Inconclusive", which is only visible if inconclusive checking is enabled
This commit is contained in:
PKEuS 2015-10-15 11:59:17 +02:00
parent 46bfa62aad
commit dfe61f415d
8 changed files with 75 additions and 48 deletions

View File

@ -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);
}

View File

@ -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 &current, const QModelIndex &previous)
{
QTreeView::currentChanged(current, previous);

View File

@ -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.
*

View File

@ -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;
}

View File

@ -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

View File

@ -143,6 +143,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="mEnableInconclusive">
<property name="text">
<string>Check for inconclusive errors also</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
@ -156,6 +163,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="mShowDebugWarnings">
<property name="text">
<string>Show internal warnings in log</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_5">
@ -324,40 +338,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_6">
<attribute name="title">
<string>Advanced</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QCheckBox" name="mEnableInconclusive">
<property name="text">
<string>&amp;Show inconclusive errors</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="mShowDebugWarnings">
<property name="text">
<string>S&amp;how internal warnings in log</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item>

View File

@ -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,

View File

@ -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
*