diff --git a/gui/common.h b/gui/common.h
index 33b84a8de..614a87e07 100644
--- a/gui/common.h
+++ b/gui/common.h
@@ -31,6 +31,7 @@ typedef enum
{
SHOW_ALL = 0,
SHOW_STYLE,
+ SHOW_ALL_STYLE,
SHOW_ERRORS,
SHOW_NONE
}
@@ -44,6 +45,7 @@ ShowTypes;
#define SETTINGS_WINDOW_HEIGHT "Window height"
#define SETTINGS_SHOW_ALL "Show all"
#define SETTINGS_SHOW_STYLE "Show style"
+#define SETTINGS_SHOW_ALL_STYLE "Show all style"
#define SETTINGS_SHOW_ERRORS "Show errors"
#define SETTINGS_CHECK_PATH "Check path"
#define SETTINGS_CHECK_FORCE "Check force"
diff --git a/gui/main.ui b/gui/main.ui
index 3c72e5d6c..c6c65c8bb 100644
--- a/gui/main.ui
+++ b/gui/main.ui
@@ -85,6 +85,7 @@
+
@@ -270,6 +271,14 @@
Show style errors
+
+
+ true
+
+
+ Show possible style errors
+
+
true
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index 64131ee89..131d3ce3e 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -57,6 +57,7 @@ MainWindow::MainWindow() :
connect(mUI.mActionShowAll, SIGNAL(toggled(bool)), this, SLOT(ShowAll(bool)));
connect(mUI.mActionShowStyle, SIGNAL(toggled(bool)), this, SLOT(ShowStyle(bool)));
+ connect(mUI.mActionShowAllStyle, SIGNAL(toggled(bool)), this, SLOT(ShowAllStyle(bool)));
connect(mUI.mActionShowErrors, SIGNAL(toggled(bool)), this, SLOT(ShowErrors(bool)));
connect(mUI.mActionCheckAll, SIGNAL(triggered()), this, SLOT(CheckAll()));
connect(mUI.mActionUncheckAll, SIGNAL(triggered()), this, SLOT(UncheckAll()));
@@ -155,12 +156,14 @@ void MainWindow::LoadSettings()
mUI.mActionShowAll->setChecked(mSettings->value(SETTINGS_SHOW_ALL, true).toBool());
mUI.mActionShowStyle->setChecked(mSettings->value(SETTINGS_SHOW_STYLE, true).toBool());
+ mUI.mActionShowAllStyle->setChecked(mSettings->value(SETTINGS_SHOW_ALL_STYLE, true).toBool());
mUI.mActionShowErrors->setChecked(mSettings->value(SETTINGS_SHOW_ERRORS, true).toBool());
mUI.mResults->ShowResults(SHOW_ALL, mUI.mActionShowAll->isChecked());
mUI.mResults->ShowResults(SHOW_ERRORS, mUI.mActionShowErrors->isChecked());
mUI.mResults->ShowResults(SHOW_STYLE, mUI.mActionShowStyle->isChecked());
+ mUI.mResults->ShowResults(SHOW_ALL_STYLE, mUI.mActionShowAllStyle->isChecked());
mUI.mActionToolbar->setChecked(mSettings->value(SETTINGS_TOOLBARS_SHOW, true).toBool());
mUI.mToolBar->setVisible(mSettings->value(SETTINGS_TOOLBARS_SHOW, true).toBool());
@@ -182,6 +185,7 @@ void MainWindow::SaveSettings()
mSettings->setValue(SETTINGS_SHOW_ALL, mUI.mActionShowAll->isChecked());
mSettings->setValue(SETTINGS_SHOW_STYLE, mUI.mActionShowStyle->isChecked());
+ mSettings->setValue(SETTINGS_SHOW_ALL_STYLE, mUI.mActionShowAllStyle->isChecked());
mSettings->setValue(SETTINGS_SHOW_ERRORS, mUI.mActionShowErrors->isChecked());
mSettings->setValue(SETTINGS_TOOLBARS_SHOW, mUI.mToolBar->isVisible());
@@ -430,6 +434,11 @@ void MainWindow::ShowStyle(bool checked)
mUI.mResults->ShowResults(SHOW_STYLE, checked);
}
+void MainWindow::ShowAllStyle(bool checked)
+{
+ mUI.mResults->ShowResults(SHOW_ALL_STYLE, checked);
+}
+
void MainWindow::ShowErrors(bool checked)
{
mUI.mResults->ShowResults(SHOW_ERRORS, checked);
@@ -479,6 +488,9 @@ void MainWindow::ToggleAllChecked(bool checked)
mUI.mActionShowStyle->setChecked(checked);
ShowStyle(checked);
+ mUI.mActionShowAllStyle->setChecked(checked);
+ ShowStyle(checked);
+
mUI.mActionShowErrors->setChecked(checked);
ShowErrors(checked);
}
diff --git a/gui/mainwindow.h b/gui/mainwindow.h
index 690d53a22..de71bf736 100644
--- a/gui/mainwindow.h
+++ b/gui/mainwindow.h
@@ -84,6 +84,12 @@ public slots:
*/
void ShowStyle(bool checked);
+ /**
+ * @brief Show errors with type "possible style"
+ * @param checked Should errors be shown (true) or hidden (false)
+ */
+ void ShowAllStyle(bool checked);
+
/**
* @brief Show errors with type "error"
* @param checked Should errors be shown (true) or hidden (false)
diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp
index 64203837a..d6bf15e18 100644
--- a/gui/resultstree.cpp
+++ b/gui/resultstree.cpp
@@ -189,6 +189,8 @@ ShowTypes ResultsTree::SeverityToShowType(const QString & severity)
return SHOW_ERRORS;
if (severity == "style")
return SHOW_STYLE;
+ if (severity == "possible style")
+ return SHOW_ALL_STYLE;
return SHOW_NONE;
}
@@ -532,7 +534,7 @@ QString ResultsTree::SeverityToIcon(const QString &severity)
return ":images/dialog-warning.png";
if (severity == "error")
return ":images/dialog-error.png";
- if (severity == "style")
+ if (severity == "style" || severity == "possible style")
return ":images/dialog-information.png";
return "";
@@ -615,6 +617,10 @@ QString ResultsTree::ShowTypeToString(ShowTypes type)
return tr("style");
break;
+ case SHOW_ALL_STYLE:
+ return tr("possible style");
+ break;
+
case SHOW_ERRORS:
return tr("error");
break;
diff --git a/gui/test.cpp b/gui/test.cpp
index 2527fd74c..aea81c240 100644
--- a/gui/test.cpp
+++ b/gui/test.cpp
@@ -4,6 +4,8 @@ Used for testing GUI with various error styles reported by cppcheck.
Not meant to be compiled.
*/
+#include
+
void unused()
{
int a = 15;
@@ -14,6 +16,13 @@ void f(char k)
delete k;
}
+void possible_style()
+{
+ std::list::iterator it;\n
+ for (it = ab.begin(); it != ab.end(); it++)\n
+ ;
+}
+
int main()
{
char *b = new char[1];
@@ -21,7 +30,7 @@ int main()
if (a);
b = gets();
f(a);
-
+ iter_err();
}