From bee8d15848a980c75d62aa383f0f638729b51ec2 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Mon, 18 Oct 2010 20:50:34 +0300 Subject: [PATCH] GUI: Add support for warning and performance -error types. --- gui/common.h | 6 +++++- gui/main.ui | 36 +++++++++++++++++++++++++++++++++--- gui/mainwindow.cpp | 21 ++++++++++++++++++++- gui/mainwindow.h | 12 ++++++++++++ gui/resultstree.cpp | 4 ++++ 5 files changed, 74 insertions(+), 5 deletions(-) diff --git a/gui/common.h b/gui/common.h index 132f6b3db..e7e419d99 100644 --- a/gui/common.h +++ b/gui/common.h @@ -30,7 +30,9 @@ typedef enum { SHOW_STYLE = 0, - SHOW_ERRORS, + SHOW_WARNINGS, + SHOW_PERFORMANCE, + SHOW_ERRORS, // Keep this as last real item SHOW_NONE } ShowTypes; @@ -43,6 +45,8 @@ ShowTypes; #define SETTINGS_WINDOW_HEIGHT "Window height" #define SETTINGS_SHOW_STYLE "Show style" #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_FORCE "Check force" #define SETTINGS_CHECK_THREADS "Check threads" diff --git a/gui/main.ui b/gui/main.ui index 7578e428b..780e7e6c8 100644 --- a/gui/main.ui +++ b/gui/main.ui @@ -66,7 +66,7 @@ 0 0 640 - 25 + 21 @@ -96,8 +96,10 @@ - + + + @@ -284,7 +286,7 @@ :/images/showstylewarnings.png:/images/showstylewarnings.png - Show style errors + Show style warnings @@ -409,6 +411,34 @@ &Statistics + + + true + + + Warnings + + + Show warnings + + + Show warnings + + + + + true + + + Performance warnings + + + Show performance warnings + + + Show performance warnings + + diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 6ee2df209..be70038fb 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -63,6 +63,8 @@ MainWindow::MainWindow() : connect(mUI.mActionShowStyle, SIGNAL(toggled(bool)), this, SLOT(ShowStyle(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.mActionUncheckAll, SIGNAL(triggered()), this, SLOT(UncheckAll())); 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.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_STYLE, mUI.mActionShowStyle->isChecked()); @@ -193,6 +197,8 @@ void MainWindow::SaveSettings() mSettings->setValue(SETTINGS_SHOW_STYLE, mUI.mActionShowStyle->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_VIEW_SHOW, mUI.mToolBarView->isVisible()); @@ -473,6 +479,16 @@ void MainWindow::ShowErrors(bool 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() { ToggleAllChecked(true); @@ -523,9 +539,12 @@ void MainWindow::ToggleAllChecked(bool checked) { mUI.mActionShowStyle->setChecked(checked); ShowStyle(checked); - mUI.mActionShowErrors->setChecked(checked); ShowErrors(checked); + mUI.mActionShowWarnings->setChecked(checked); + ShowWarnings(checked); + mUI.mActionShowPerformance->setChecked(checked); + ShowPerformance(checked); } void MainWindow::About() diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 1f4a97063..627e50204 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -91,6 +91,18 @@ public slots: */ 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 */ diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index a1117a2ae..c9b7a1fa7 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -226,6 +226,10 @@ ShowTypes ResultsTree::SeverityToShowType(const QString & severity) const return SHOW_ERRORS; if (severity == "style") return SHOW_STYLE; + if (severity == "warning") + return SHOW_WARNINGS; + if (severity == "performance") + return SHOW_PERFORMANCE; return SHOW_NONE; }