diff --git a/gui/checkthread.cpp b/gui/checkthread.cpp index c2f545546..198bb5930 100644 --- a/gui/checkthread.cpp +++ b/gui/checkthread.cpp @@ -310,6 +310,7 @@ QString CheckThread::getAddonPath() const void CheckThread::parseAddonErrors(QString err, QString tool) { + Q_UNUSED(tool); QTextStream in(&err, QIODevice::ReadOnly); while (!in.atEnd()) { QString line = in.readLine(); diff --git a/gui/gui.qrc b/gui/gui.qrc index 076b12f6a..00247c03d 100644 --- a/gui/gui.qrc +++ b/gui/gui.qrc @@ -27,5 +27,6 @@ images/go-previous.png images/applications-development.png images/applications-system.png + images/llvm-dragon.svg diff --git a/gui/images/llvm-dragon.svg b/gui/images/llvm-dragon.svg new file mode 100644 index 000000000..57b5903ed --- /dev/null +++ b/gui/images/llvm-dragon.svg @@ -0,0 +1 @@ +Dragon \ No newline at end of file diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 75082652f..7ac588377 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -95,6 +95,8 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) : connect(mUI.mActionShowPortability, &QAction::toggled, this, &MainWindow::showPortability); connect(mUI.mActionShowPerformance, &QAction::toggled, this, &MainWindow::showPerformance); connect(mUI.mActionShowInformation, &QAction::toggled, this, &MainWindow::showInformation); + connect(mUI.mActionShowCppcheck, &QAction::toggled, mUI.mResults, &ResultsView::showCppcheckResults); + connect(mUI.mActionShowClang, &QAction::toggled, mUI.mResults, &ResultsView::showClangResults); connect(mUI.mActionCheckAll, &QAction::triggered, this, &MainWindow::checkAll); connect(mUI.mActionUncheckAll, &QAction::triggered, this, &MainWindow::uncheckAll); connect(mUI.mActionCollapseAll, &QAction::triggered, mUI.mResults, &ResultsView::collapseAllResults); @@ -268,6 +270,8 @@ void MainWindow::loadSettings() mUI.mActionShowPortability->setChecked(types->isShown(ShowTypes::ShowPortability)); mUI.mActionShowPerformance->setChecked(types->isShown(ShowTypes::ShowPerformance)); mUI.mActionShowInformation->setChecked(types->isShown(ShowTypes::ShowInformation)); + mUI.mActionShowCppcheck->setChecked(true); + mUI.mActionShowClang->setChecked(true); const bool stdCpp03 = mSettings->value(SETTINGS_STD_CPP03, false).toBool(); mUI.mActionCpp03->setChecked(stdCpp03); diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui index 79bbfa94d..1782cdf44 100644 --- a/gui/mainwindow.ui +++ b/gui/mainwindow.ui @@ -62,7 +62,7 @@ 0 0 640 - 20 + 25 @@ -128,7 +128,7 @@ - Analyze + A&nalyze @@ -139,7 +139,7 @@ - C standard + &C standard @@ -184,11 +184,8 @@ false - - - @@ -211,6 +208,8 @@ + + @@ -292,7 +291,7 @@ :/images/view-recheck.png:/images/view-recheck.png - &Reanalyze all files + Reanal&yze all files @@ -357,7 +356,7 @@ :/images/applications-development.png:/images/applications-development.png - Style warnings + Style war&nings Show style warnings @@ -375,7 +374,7 @@ :/images/showerrors.png:/images/showerrors.png - Errors + E&rrors Show errors @@ -462,7 +461,7 @@ :/images/scratchpad.png:/images/scratchpad.png - Show S&cratchpad... + Sh&ow Scratchpad... @@ -512,7 +511,7 @@ :/images/showwarnings.png:/images/showwarnings.png - Warnings + &Warnings Show warnings @@ -530,7 +529,7 @@ :/images/showperformance.png:/images/showperformance.png - Performance warnings + Per&formance warnings Show performance warnings @@ -556,7 +555,7 @@ :/images/dialog-information.png:/images/dialog-information.png - Information + &Information Show information messages @@ -571,12 +570,42 @@ :/images/applications-system.png:/images/applications-system.png - Portability + &Portability Show portability warnings + + + true + + + + :/cppcheck-gui.png:/cppcheck-gui.png + + + Cppcheck + + + Show Cppcheck results + + + + + true + + + + :/images/llvm-dragon.svg:/images/llvm-dragon.svg + + + Clang + + + Show Clang results + + true @@ -590,7 +619,7 @@ - Project MRU placeholder + Project &MRU placeholder true @@ -641,7 +670,7 @@ false - Platforms + P&latforms false @@ -655,7 +684,7 @@ true - C++11 + C++&11 @@ -666,7 +695,7 @@ true - C99 + C&99 @@ -674,7 +703,7 @@ true - Posix + &Posix @@ -682,7 +711,7 @@ true - C11 + C&11 @@ -690,7 +719,7 @@ true - C89 + &C89 @@ -698,7 +727,7 @@ true - C++03 + &C++03 @@ -719,7 +748,7 @@ - Library Editor... + &Library Editor... Open library editor @@ -730,7 +759,7 @@ true - Auto-detect language + &Auto-detect language @@ -738,7 +767,7 @@ true - Enforce C++ + &Enforce C++ @@ -746,7 +775,7 @@ true - Enforce C + E&nforce C diff --git a/gui/projectfile.h b/gui/projectfile.h index 2e69f3ae9..7a2eb3269 100644 --- a/gui/projectfile.h +++ b/gui/projectfile.h @@ -122,6 +122,14 @@ public: return mAddons; } + bool getClangAnalyzer() const { + return mAddons.contains("clang-analyzer"); + } + + bool getClangTidy() const { + return mAddons.contains("clang-tidy"); + } + QStringList getTags() const { return mTags; } diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index a76918fb9..f5864f656 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -64,7 +64,9 @@ ResultsTree::ResultsTree(QWidget * parent) : mShowErrorId(false), mVisibleErrors(false), mSelectionModel(0), - mThread(nullptr) + mThread(nullptr), + mShowCppcheck(true), + mShowClang(true) { setModel(&mModel); translate(); // Adds columns to grid @@ -400,6 +402,18 @@ void ResultsTree::showResults(ShowTypes::ShowType type, bool show) } } +void ResultsTree::showCppcheckResults(bool show) +{ + mShowCppcheck = show; + refreshTree(); +} + +void ResultsTree::showClangResults(bool show) +{ + mShowClang = show; + refreshTree(); +} + void ResultsTree::filterResults(const QString& filter) { mFilter = filter; @@ -478,6 +492,14 @@ void ResultsTree::refreshTree() } } + // Tool filter + if (!hide) { + if (data["id"].toString().startsWith("clang")) + hide = !mShowClang; + else + hide = !mShowCppcheck; + } + if (!hide) { mVisibleErrors = true; } diff --git a/gui/resultstree.h b/gui/resultstree.h index f25f96595..30c976b98 100644 --- a/gui/resultstree.h +++ b/gui/resultstree.h @@ -79,15 +79,6 @@ public: */ void clearRecheckFile(const QString &filename); - /** - * @brief Function to show/hide certain type of errors - * Refreshes the tree. - * - * @param type Type of error to show/hide - * @param show Should specified errors be shown (true) or hidden (false) - */ - void showResults(ShowTypes::ShowType type, bool show); - /** * @brief Function to filter the displayed list of errors. * Refreshes the tree. @@ -217,6 +208,34 @@ signals: /** Suppress Ids */ void suppressIds(QStringList ids); +public slots: + + /** + * @brief Function to show/hide certain type of errors + * Refreshes the tree. + * + * @param type Type of error to show/hide + * @param show Should specified errors be shown (true) or hidden (false) + */ + void showResults(ShowTypes::ShowType type, bool show); + + + /** + * @brief Show/hide cppcheck errors. + * Refreshes the tree. + * + * @param show Should specified errors be shown (true) or hidden (false) + */ + void showCppcheckResults(bool show); + + /** + * @brief Show/hide clang-tidy/clang-analyzer errors. + * Refreshes the tree. + * + * @param show Should specified errors be shown (true) or hidden (false) + */ + void showClangResults(bool show); + protected slots: /** * @brief Slot to quickstart an error with default application @@ -528,6 +547,9 @@ private: QItemSelectionModel *mSelectionModel; ThreadHandler *mThread; + + bool mShowCppcheck; + bool mShowClang; }; /// @} #endif // RESULTSTREE_H diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index 77ecb554d..b915bc087 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -53,6 +53,9 @@ ResultsView::ResultsView(QWidget * parent) : connect(mUI.mTree, &ResultsTree::selectionChanged, this, &ResultsView::updateDetails); connect(mUI.mTree, &ResultsTree::tagged, this, &ResultsView::tagged); connect(mUI.mTree, &ResultsTree::suppressIds, this, &ResultsView::suppressIds); + connect(this, &ResultsView::showResults, mUI.mTree, &ResultsTree::showResults); + connect(this, &ResultsView::showCppcheckResults, mUI.mTree, &ResultsTree::showCppcheckResults); + connect(this, &ResultsView::showClangResults, mUI.mTree, &ResultsTree::showClangResults); } void ResultsView::initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler) @@ -112,11 +115,6 @@ void ResultsView::error(const ErrorItem &item) } } -void ResultsView::showResults(ShowTypes::ShowType type, bool show) -{ - mUI.mTree->showResults(type, show); -} - void ResultsView::collapseAllResults() { mUI.mTree->collapseAll(); diff --git a/gui/resultsview.h b/gui/resultsview.h index 2bc9c771b..57992e19f 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -52,15 +52,6 @@ public: mUI.mTree->setTags(tags); } - /** - * @brief Function to show/hide certain type of errors - * Refreshes the tree. - * - * @param type Type of error to show/hide - * @param show Should specified errors be shown (true) or hidden (false) - */ - void showResults(ShowTypes::ShowType type, bool show); - /** * @brief Clear results and statistics and reset progressinfo. * @param results Remove all the results from view? @@ -225,6 +216,30 @@ signals: /** Suppress Ids */ void suppressIds(QStringList ids); + /** + * @brief Show/hide certain type of errors + * Refreshes the tree. + * + * @param type Type of error to show/hide + * @param show Should specified errors be shown (true) or hidden (false) + */ + void showResults(ShowTypes::ShowType type, bool show); + + /** + * @brief Show/hide cppcheck errors. + * Refreshes the tree. + * + * @param show Should specified errors be shown (true) or hidden (false) + */ + void showCppcheckResults(bool show); + + /** + * @brief Show/hide clang-tidy/clang-analyzer errors. + * Refreshes the tree. + * + * @param show Should specified errors be shown (true) or hidden (false) + */ + void showClangResults(bool show); public slots: /**