Add 'possible style error' severity for the GUI.
Fixes ticket #436 (GUI: All style -severity). The possible style errors can be now selected visible / hidden so all severities have their own menu item.
This commit is contained in:
parent
4da5679737
commit
f6d2445e16
|
@ -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"
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
</property>
|
||||
<addaction name="mActionShowAll"/>
|
||||
<addaction name="mActionShowStyle"/>
|
||||
<addaction name="mActionShowAllStyle"/>
|
||||
<addaction name="mActionShowErrors"/>
|
||||
<addaction name="mActionCheckAll"/>
|
||||
<addaction name="mActionUncheckAll"/>
|
||||
|
@ -270,6 +271,14 @@
|
|||
<string>Show style errors</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="mActionShowAllStyle">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show possible style errors</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="mActionShowErrors">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
11
gui/test.cpp
11
gui/test.cpp
|
@ -4,6 +4,8 @@ Used for testing GUI with various error styles reported by cppcheck.
|
|||
Not meant to be compiled.
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
|
||||
void unused()
|
||||
{
|
||||
int a = 15;
|
||||
|
@ -14,6 +16,13 @@ void f(char k)
|
|||
delete k;
|
||||
}
|
||||
|
||||
void possible_style()
|
||||
{
|
||||
std::list<int>::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();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue