GUI: Add support for warning and performance -error types.

This commit is contained in:
Kimmo Varis 2010-10-18 20:50:34 +03:00
parent e54129fa8d
commit bee8d15848
5 changed files with 74 additions and 5 deletions

View File

@ -30,7 +30,9 @@
typedef enum typedef enum
{ {
SHOW_STYLE = 0, SHOW_STYLE = 0,
SHOW_ERRORS, SHOW_WARNINGS,
SHOW_PERFORMANCE,
SHOW_ERRORS, // Keep this as last real item
SHOW_NONE SHOW_NONE
} }
ShowTypes; ShowTypes;
@ -43,6 +45,8 @@ ShowTypes;
#define SETTINGS_WINDOW_HEIGHT "Window height" #define SETTINGS_WINDOW_HEIGHT "Window height"
#define SETTINGS_SHOW_STYLE "Show style" #define SETTINGS_SHOW_STYLE "Show style"
#define SETTINGS_SHOW_ERRORS "Show errors" #define SETTINGS_SHOW_ERRORS "Show errors"
#define SETTINGS_SHOW_WARNINGS "Show warnings"
#define SETTINGS_SHOW_PERFORMANCE "Show performance"
#define SETTINGS_CHECK_PATH "Check path" #define SETTINGS_CHECK_PATH "Check path"
#define SETTINGS_CHECK_FORCE "Check force" #define SETTINGS_CHECK_FORCE "Check force"
#define SETTINGS_CHECK_THREADS "Check threads" #define SETTINGS_CHECK_THREADS "Check threads"

View File

@ -66,7 +66,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>640</width> <width>640</width>
<height>25</height> <height>21</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="mMenuFile"> <widget class="QMenu" name="mMenuFile">
@ -96,8 +96,10 @@
</widget> </widget>
<addaction name="mMenuToolbars"/> <addaction name="mMenuToolbars"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="mActionShowStyle"/>
<addaction name="mActionShowErrors"/> <addaction name="mActionShowErrors"/>
<addaction name="mActionShowWarnings"/>
<addaction name="mActionShowStyle"/>
<addaction name="mActionShowPerformance"/>
<addaction name="mActionCheckAll"/> <addaction name="mActionCheckAll"/>
<addaction name="mActionUncheckAll"/> <addaction name="mActionUncheckAll"/>
<addaction name="separator"/> <addaction name="separator"/>
@ -284,7 +286,7 @@
<normaloff>:/images/showstylewarnings.png</normaloff>:/images/showstylewarnings.png</iconset> <normaloff>:/images/showstylewarnings.png</normaloff>:/images/showstylewarnings.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Show style errors</string> <string>Show style warnings</string>
</property> </property>
</action> </action>
<action name="mActionShowErrors"> <action name="mActionShowErrors">
@ -409,6 +411,34 @@
<string>&amp;Statistics</string> <string>&amp;Statistics</string>
</property> </property>
</action> </action>
<action name="mActionShowWarnings">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Warnings</string>
</property>
<property name="iconText">
<string>Show warnings</string>
</property>
<property name="toolTip">
<string>Show warnings</string>
</property>
</action>
<action name="mActionShowPerformance">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Performance warnings</string>
</property>
<property name="iconText">
<string>Show performance warnings</string>
</property>
<property name="toolTip">
<string>Show performance warnings</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

View File

@ -63,6 +63,8 @@ MainWindow::MainWindow() :
connect(mUI.mActionShowStyle, SIGNAL(toggled(bool)), this, SLOT(ShowStyle(bool))); connect(mUI.mActionShowStyle, SIGNAL(toggled(bool)), this, SLOT(ShowStyle(bool)));
connect(mUI.mActionShowErrors, SIGNAL(toggled(bool)), this, SLOT(ShowErrors(bool))); connect(mUI.mActionShowErrors, SIGNAL(toggled(bool)), this, SLOT(ShowErrors(bool)));
connect(mUI.mActionShowWarnings, SIGNAL(toggled(bool)), this, SLOT(ShowWarnings(bool)));
connect(mUI.mActionShowPerformance, SIGNAL(toggled(bool)), this, SLOT(ShowPerformance(bool)));
connect(mUI.mActionCheckAll, SIGNAL(triggered()), this, SLOT(CheckAll())); connect(mUI.mActionCheckAll, SIGNAL(triggered()), this, SLOT(CheckAll()));
connect(mUI.mActionUncheckAll, SIGNAL(triggered()), this, SLOT(UncheckAll())); connect(mUI.mActionUncheckAll, SIGNAL(triggered()), this, SLOT(UncheckAll()));
connect(mUI.mActionCollapseAll, SIGNAL(triggered()), mUI.mResults, SLOT(CollapseAllResults())); connect(mUI.mActionCollapseAll, SIGNAL(triggered()), mUI.mResults, SLOT(CollapseAllResults()));
@ -169,6 +171,8 @@ void MainWindow::LoadSettings()
mUI.mActionShowStyle->setChecked(mSettings->value(SETTINGS_SHOW_STYLE, true).toBool()); mUI.mActionShowStyle->setChecked(mSettings->value(SETTINGS_SHOW_STYLE, true).toBool());
mUI.mActionShowErrors->setChecked(mSettings->value(SETTINGS_SHOW_ERRORS, true).toBool()); mUI.mActionShowErrors->setChecked(mSettings->value(SETTINGS_SHOW_ERRORS, true).toBool());
mUI.mActionShowWarnings->setChecked(mSettings->value(SETTINGS_SHOW_WARNINGS, true).toBool());
mUI.mActionShowPerformance->setChecked(mSettings->value(SETTINGS_SHOW_PERFORMANCE, true).toBool());
mUI.mResults->ShowResults(SHOW_ERRORS, mUI.mActionShowErrors->isChecked()); mUI.mResults->ShowResults(SHOW_ERRORS, mUI.mActionShowErrors->isChecked());
mUI.mResults->ShowResults(SHOW_STYLE, mUI.mActionShowStyle->isChecked()); mUI.mResults->ShowResults(SHOW_STYLE, mUI.mActionShowStyle->isChecked());
@ -193,6 +197,8 @@ void MainWindow::SaveSettings()
mSettings->setValue(SETTINGS_SHOW_STYLE, mUI.mActionShowStyle->isChecked()); mSettings->setValue(SETTINGS_SHOW_STYLE, mUI.mActionShowStyle->isChecked());
mSettings->setValue(SETTINGS_SHOW_ERRORS, mUI.mActionShowErrors->isChecked()); mSettings->setValue(SETTINGS_SHOW_ERRORS, mUI.mActionShowErrors->isChecked());
mSettings->setValue(SETTINGS_SHOW_WARNINGS, mUI.mActionShowWarnings->isChecked());
mSettings->setValue(SETTINGS_SHOW_PERFORMANCE, mUI.mActionShowPerformance->isChecked());
mSettings->setValue(SETTINGS_TOOLBARS_MAIN_SHOW, mUI.mToolBarMain->isVisible()); mSettings->setValue(SETTINGS_TOOLBARS_MAIN_SHOW, mUI.mToolBarMain->isVisible());
mSettings->setValue(SETTINGS_TOOLBARS_VIEW_SHOW, mUI.mToolBarView->isVisible()); mSettings->setValue(SETTINGS_TOOLBARS_VIEW_SHOW, mUI.mToolBarView->isVisible());
@ -473,6 +479,16 @@ void MainWindow::ShowErrors(bool checked)
mUI.mResults->ShowResults(SHOW_ERRORS, checked); mUI.mResults->ShowResults(SHOW_ERRORS, checked);
} }
void MainWindow::ShowWarnings(bool checked)
{
mUI.mResults->ShowResults(SHOW_WARNINGS, checked);
}
void MainWindow::ShowPerformance(bool checked)
{
mUI.mResults->ShowResults(SHOW_PERFORMANCE, checked);
}
void MainWindow::CheckAll() void MainWindow::CheckAll()
{ {
ToggleAllChecked(true); ToggleAllChecked(true);
@ -523,9 +539,12 @@ void MainWindow::ToggleAllChecked(bool checked)
{ {
mUI.mActionShowStyle->setChecked(checked); mUI.mActionShowStyle->setChecked(checked);
ShowStyle(checked); ShowStyle(checked);
mUI.mActionShowErrors->setChecked(checked); mUI.mActionShowErrors->setChecked(checked);
ShowErrors(checked); ShowErrors(checked);
mUI.mActionShowWarnings->setChecked(checked);
ShowWarnings(checked);
mUI.mActionShowPerformance->setChecked(checked);
ShowPerformance(checked);
} }
void MainWindow::About() void MainWindow::About()

View File

@ -91,6 +91,18 @@ public slots:
*/ */
void ShowErrors(bool checked); void ShowErrors(bool checked);
/**
* @brief Show errors with type "warning"
* @param checked Should errors be shown (true) or hidden (false)
*/
void ShowWarnings(bool checked);
/**
* @brief Show errors with type "performance"
* @param checked Should errors be shown (true) or hidden (false)
*/
void ShowPerformance(bool checked);
/** /**
* @brief Slot to check all "Show errors" menu items * @brief Slot to check all "Show errors" menu items
*/ */

View File

@ -226,6 +226,10 @@ ShowTypes ResultsTree::SeverityToShowType(const QString & severity) const
return SHOW_ERRORS; return SHOW_ERRORS;
if (severity == "style") if (severity == "style")
return SHOW_STYLE; return SHOW_STYLE;
if (severity == "warning")
return SHOW_WARNINGS;
if (severity == "performance")
return SHOW_PERFORMANCE;
return SHOW_NONE; return SHOW_NONE;
} }