Skip to content

Commit 34a96a5

Browse files
committed
GUI: Added buttons to show/hide clang/cppcheck results
1 parent f6184bb commit 34a96a5

10 files changed

Lines changed: 151 additions & 50 deletions

File tree

gui/checkthread.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ QString CheckThread::getAddonPath() const
310310

311311
void CheckThread::parseAddonErrors(QString err, QString tool)
312312
{
313+
Q_UNUSED(tool);
313314
QTextStream in(&err, QIODevice::ReadOnly);
314315
while (!in.atEnd()) {
315316
QString line = in.readLine();

gui/gui.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@
2727
<file>images/go-previous.png</file>
2828
<file>images/applications-development.png</file>
2929
<file>images/applications-system.png</file>
30+
<file>images/llvm-dragon.svg</file>
3031
</qresource>
3132
</RCC>

gui/images/llvm-dragon.svg

Lines changed: 1 addition & 0 deletions
Loading

gui/mainwindow.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
9595
connect(mUI.mActionShowPortability, &QAction::toggled, this, &MainWindow::showPortability);
9696
connect(mUI.mActionShowPerformance, &QAction::toggled, this, &MainWindow::showPerformance);
9797
connect(mUI.mActionShowInformation, &QAction::toggled, this, &MainWindow::showInformation);
98+
connect(mUI.mActionShowCppcheck, &QAction::toggled, mUI.mResults, &ResultsView::showCppcheckResults);
99+
connect(mUI.mActionShowClang, &QAction::toggled, mUI.mResults, &ResultsView::showClangResults);
98100
connect(mUI.mActionCheckAll, &QAction::triggered, this, &MainWindow::checkAll);
99101
connect(mUI.mActionUncheckAll, &QAction::triggered, this, &MainWindow::uncheckAll);
100102
connect(mUI.mActionCollapseAll, &QAction::triggered, mUI.mResults, &ResultsView::collapseAllResults);
@@ -268,6 +270,8 @@ void MainWindow::loadSettings()
268270
mUI.mActionShowPortability->setChecked(types->isShown(ShowTypes::ShowPortability));
269271
mUI.mActionShowPerformance->setChecked(types->isShown(ShowTypes::ShowPerformance));
270272
mUI.mActionShowInformation->setChecked(types->isShown(ShowTypes::ShowInformation));
273+
mUI.mActionShowCppcheck->setChecked(true);
274+
mUI.mActionShowClang->setChecked(true);
271275

272276
const bool stdCpp03 = mSettings->value(SETTINGS_STD_CPP03, false).toBool();
273277
mUI.mActionCpp03->setChecked(stdCpp03);

gui/mainwindow.ui

Lines changed: 55 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<x>0</x>
6363
<y>0</y>
6464
<width>640</width>
65-
<height>20</height>
65+
<height>25</height>
6666
</rect>
6767
</property>
6868
<widget class="QMenu" name="mMenuFile">
@@ -128,7 +128,7 @@
128128
</widget>
129129
<widget class="QMenu" name="mMenuAnalyze">
130130
<property name="title">
131-
<string>Analyze</string>
131+
<string>A&amp;nalyze</string>
132132
</property>
133133
<widget class="QMenu" name="menuCpp_standard">
134134
<property name="title">
@@ -139,7 +139,7 @@
139139
</widget>
140140
<widget class="QMenu" name="menuC_standard">
141141
<property name="title">
142-
<string>C standard</string>
142+
<string>&amp;C standard</string>
143143
</property>
144144
<addaction name="mActionC89"/>
145145
<addaction name="mActionC99"/>
@@ -184,11 +184,8 @@
184184
<attribute name="toolBarBreak">
185185
<bool>false</bool>
186186
</attribute>
187-
<addaction name="mActionAnalyzeDirectory"/>
188187
<addaction name="mActionOpenProjectFile"/>
189-
<addaction name="mActionShowScratchpad"/>
190188
<addaction name="mActionSave"/>
191-
<addaction name="mActionReanalyzeModified"/>
192189
<addaction name="mActionReanalyzeAll"/>
193190
<addaction name="mActionStop"/>
194191
<addaction name="mActionClearResults"/>
@@ -211,6 +208,8 @@
211208
<addaction name="mActionShowPortability"/>
212209
<addaction name="mActionShowPerformance"/>
213210
<addaction name="mActionShowInformation"/>
211+
<addaction name="mActionShowCppcheck"/>
212+
<addaction name="mActionShowClang"/>
214213
</widget>
215214
<widget class="QToolBar" name="mToolBarFilter">
216215
<property name="windowTitle">
@@ -292,7 +291,7 @@
292291
<normaloff>:/images/view-recheck.png</normaloff>:/images/view-recheck.png</iconset>
293292
</property>
294293
<property name="text">
295-
<string>&amp;Reanalyze all files</string>
294+
<string>Reanal&amp;yze all files</string>
296295
</property>
297296
</action>
298297
<action name="mActionStop">
@@ -357,7 +356,7 @@
357356
<normaloff>:/images/applications-development.png</normaloff>:/images/applications-development.png</iconset>
358357
</property>
359358
<property name="text">
360-
<string>Style warnings</string>
359+
<string>Style war&amp;nings</string>
361360
</property>
362361
<property name="iconText">
363362
<string>Show style warnings</string>
@@ -375,7 +374,7 @@
375374
<normaloff>:/images/showerrors.png</normaloff>:/images/showerrors.png</iconset>
376375
</property>
377376
<property name="text">
378-
<string>Errors</string>
377+
<string>E&amp;rrors</string>
379378
</property>
380379
<property name="iconText">
381380
<string>Show errors</string>
@@ -462,7 +461,7 @@
462461
<normaloff>:/images/scratchpad.png</normaloff>:/images/scratchpad.png</iconset>
463462
</property>
464463
<property name="text">
465-
<string>Show S&amp;cratchpad...</string>
464+
<string>Sh&amp;ow Scratchpad...</string>
466465
</property>
467466
</action>
468467
<action name="mActionNewProjectFile">
@@ -512,7 +511,7 @@
512511
<normaloff>:/images/showwarnings.png</normaloff>:/images/showwarnings.png</iconset>
513512
</property>
514513
<property name="text">
515-
<string>Warnings</string>
514+
<string>&amp;Warnings</string>
516515
</property>
517516
<property name="iconText">
518517
<string>Show warnings</string>
@@ -530,7 +529,7 @@
530529
<normaloff>:/images/showperformance.png</normaloff>:/images/showperformance.png</iconset>
531530
</property>
532531
<property name="text">
533-
<string>Performance warnings</string>
532+
<string>Per&amp;formance warnings</string>
534533
</property>
535534
<property name="iconText">
536535
<string>Show performance warnings</string>
@@ -556,7 +555,7 @@
556555
<normaloff>:/images/dialog-information.png</normaloff>:/images/dialog-information.png</iconset>
557556
</property>
558557
<property name="text">
559-
<string>Information</string>
558+
<string>&amp;Information</string>
560559
</property>
561560
<property name="toolTip">
562561
<string>Show information messages</string>
@@ -571,12 +570,42 @@
571570
<normaloff>:/images/applications-system.png</normaloff>:/images/applications-system.png</iconset>
572571
</property>
573572
<property name="text">
574-
<string>Portability</string>
573+
<string>&amp;Portability</string>
575574
</property>
576575
<property name="toolTip">
577576
<string>Show portability warnings</string>
578577
</property>
579578
</action>
579+
<action name="mActionShowCppcheck">
580+
<property name="checkable">
581+
<bool>true</bool>
582+
</property>
583+
<property name="icon">
584+
<iconset resource="gui.qrc">
585+
<normaloff>:/cppcheck-gui.png</normaloff>:/cppcheck-gui.png</iconset>
586+
</property>
587+
<property name="text">
588+
<string>Cppcheck</string>
589+
</property>
590+
<property name="toolTip">
591+
<string>Show Cppcheck results</string>
592+
</property>
593+
</action>
594+
<action name="mActionShowClang">
595+
<property name="checkable">
596+
<bool>true</bool>
597+
</property>
598+
<property name="icon">
599+
<iconset resource="gui.qrc">
600+
<normaloff>:/images/llvm-dragon.svg</normaloff>:/images/llvm-dragon.svg</iconset>
601+
</property>
602+
<property name="text">
603+
<string>Clang</string>
604+
</property>
605+
<property name="toolTip">
606+
<string>Show Clang results</string>
607+
</property>
608+
</action>
580609
<action name="mActionToolBarFilter">
581610
<property name="checkable">
582611
<bool>true</bool>
@@ -590,7 +619,7 @@
590619
</action>
591620
<action name="mActionProjectMRU">
592621
<property name="text">
593-
<string notr="true">Project MRU placeholder</string>
622+
<string notr="true">Project &amp;MRU placeholder</string>
594623
</property>
595624
<property name="visible">
596625
<bool>true</bool>
@@ -641,7 +670,7 @@
641670
<bool>false</bool>
642671
</property>
643672
<property name="text">
644-
<string>Platforms</string>
673+
<string>P&amp;latforms</string>
645674
</property>
646675
<property name="visible">
647676
<bool>false</bool>
@@ -655,7 +684,7 @@
655684
<bool>true</bool>
656685
</property>
657686
<property name="text">
658-
<string>C++11</string>
687+
<string>C++&amp;11</string>
659688
</property>
660689
</action>
661690
<action name="mActionC99">
@@ -666,39 +695,39 @@
666695
<bool>true</bool>
667696
</property>
668697
<property name="text">
669-
<string>C99</string>
698+
<string>C&amp;99</string>
670699
</property>
671700
</action>
672701
<action name="mActionPosix">
673702
<property name="checkable">
674703
<bool>true</bool>
675704
</property>
676705
<property name="text">
677-
<string>Posix</string>
706+
<string>&amp;Posix</string>
678707
</property>
679708
</action>
680709
<action name="mActionC11">
681710
<property name="checkable">
682711
<bool>true</bool>
683712
</property>
684713
<property name="text">
685-
<string>C11</string>
714+
<string>C&amp;11</string>
686715
</property>
687716
</action>
688717
<action name="mActionC89">
689718
<property name="checkable">
690719
<bool>true</bool>
691720
</property>
692721
<property name="text">
693-
<string>C89</string>
722+
<string>&amp;C89</string>
694723
</property>
695724
</action>
696725
<action name="mActionCpp03">
697726
<property name="checkable">
698727
<bool>true</bool>
699728
</property>
700729
<property name="text">
701-
<string>C++03</string>
730+
<string>&amp;C++03</string>
702731
</property>
703732
</action>
704733
<action name="mActionPrint">
@@ -719,7 +748,7 @@
719748
</action>
720749
<action name="mActionLibraryEditor">
721750
<property name="text">
722-
<string>Library Editor...</string>
751+
<string>&amp;Library Editor...</string>
723752
</property>
724753
<property name="toolTip">
725754
<string>Open library editor</string>
@@ -730,23 +759,23 @@
730759
<bool>true</bool>
731760
</property>
732761
<property name="text">
733-
<string>Auto-detect language</string>
762+
<string>&amp;Auto-detect language</string>
734763
</property>
735764
</action>
736765
<action name="mActionEnforceCpp">
737766
<property name="checkable">
738767
<bool>true</bool>
739768
</property>
740769
<property name="text">
741-
<string>Enforce C++</string>
770+
<string>&amp;Enforce C++</string>
742771
</property>
743772
</action>
744773
<action name="mActionEnforceC">
745774
<property name="checkable">
746775
<bool>true</bool>
747776
</property>
748777
<property name="text">
749-
<string>Enforce C</string>
778+
<string>E&amp;nforce C</string>
750779
</property>
751780
</action>
752781
</widget>

gui/projectfile.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,14 @@ class ProjectFile : public QObject {
122122
return mAddons;
123123
}
124124

125+
bool getClangAnalyzer() const {
126+
return mAddons.contains("clang-analyzer");
127+
}
128+
129+
bool getClangTidy() const {
130+
return mAddons.contains("clang-tidy");
131+
}
132+
125133
QStringList getTags() const {
126134
return mTags;
127135
}

gui/resultstree.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ ResultsTree::ResultsTree(QWidget * parent) :
6464
mShowErrorId(false),
6565
mVisibleErrors(false),
6666
mSelectionModel(0),
67-
mThread(nullptr)
67+
mThread(nullptr),
68+
mShowCppcheck(true),
69+
mShowClang(true)
6870
{
6971
setModel(&mModel);
7072
translate(); // Adds columns to grid
@@ -400,6 +402,18 @@ void ResultsTree::showResults(ShowTypes::ShowType type, bool show)
400402
}
401403
}
402404

405+
void ResultsTree::showCppcheckResults(bool show)
406+
{
407+
mShowCppcheck = show;
408+
refreshTree();
409+
}
410+
411+
void ResultsTree::showClangResults(bool show)
412+
{
413+
mShowClang = show;
414+
refreshTree();
415+
}
416+
403417
void ResultsTree::filterResults(const QString& filter)
404418
{
405419
mFilter = filter;
@@ -478,6 +492,14 @@ void ResultsTree::refreshTree()
478492
}
479493
}
480494

495+
// Tool filter
496+
if (!hide) {
497+
if (data["id"].toString().startsWith("clang"))
498+
hide = !mShowClang;
499+
else
500+
hide = !mShowCppcheck;
501+
}
502+
481503
if (!hide) {
482504
mVisibleErrors = true;
483505
}

0 commit comments

Comments
 (0)