Skip to content

Commit 15b4cab

Browse files
committed
Fixed cppcheck-opensource#1934 (GUI: Add checking info display)
1 parent 7a8190e commit 15b4cab

9 files changed

Lines changed: 580 additions & 4 deletions

File tree

gui/gui.pro

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ FORMS = main.ui \
3030
projectfile.ui \
3131
about.ui \
3232
logview.ui \
33-
helpwindow.ui
33+
helpwindow.ui \
34+
stats.ui
3435

3536
TRANSLATIONS = cppcheck_fi.ts \
3637
cppcheck_nl.ts \
@@ -67,7 +68,8 @@ HEADERS += mainwindow.h \
6768
csvreport.h \
6869
logview.h \
6970
filelist.h \
70-
helpwindow.h
71+
helpwindow.h \
72+
statsdialog.h
7173

7274
SOURCES += main.cpp \
7375
mainwindow.cpp\
@@ -92,7 +94,8 @@ SOURCES += main.cpp \
9294
csvreport.cpp \
9395
logview.cpp \
9496
filelist.cpp \
95-
helpwindow.cpp
97+
helpwindow.cpp \
98+
statsdialog.cpp
9699

97100
win32 {
98101
DEFINES += _CRT_SECURE_NO_WARNINGS

gui/main.ui

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<x>0</x>
6767
<y>0</y>
6868
<width>640</width>
69-
<height>21</height>
69+
<height>25</height>
7070
</rect>
7171
</property>
7272
<widget class="QMenu" name="mMenuFile">
@@ -105,6 +105,7 @@
105105
<addaction name="mActionExpandAll"/>
106106
<addaction name="separator"/>
107107
<addaction name="mActionViewLog"/>
108+
<addaction name="mActionViewStats"/>
108109
</widget>
109110
<widget class="QMenu" name="mMenuLanguage">
110111
<property name="title">
@@ -399,6 +400,15 @@
399400
<string>&amp;Edit Project File...</string>
400401
</property>
401402
</action>
403+
<action name="mActionViewStats">
404+
<property name="icon">
405+
<iconset resource="gui.qrc">
406+
<normaloff>:/images/text-x-generic.png</normaloff>:/images/text-x-generic.png</iconset>
407+
</property>
408+
<property name="text">
409+
<string>&amp;Statistics</string>
410+
</property>
411+
</action>
402412
</widget>
403413
<customwidgets>
404414
<customwidget>

gui/mainwindow.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "projectfile.h"
3434
#include "project.h"
3535
#include "report.h"
36+
#include "statsdialog.h"
3637
#include "logview.h"
3738
#include "filelist.h"
3839
#include "helpwindow.h"
@@ -67,6 +68,7 @@ MainWindow::MainWindow() :
6768
connect(mUI.mActionCollapseAll, SIGNAL(triggered()), mUI.mResults, SLOT(CollapseAllResults()));
6869
connect(mUI.mActionExpandAll, SIGNAL(triggered()), mUI.mResults, SLOT(ExpandAllResults()));
6970
connect(mUI.mActionViewLog, SIGNAL(triggered()), this, SLOT(ShowLogView()));
71+
connect(mUI.mActionViewStats, SIGNAL(triggered()), this, SLOT(ShowStatistics()));
7072

7173
connect(mUI.mActionRecheck, SIGNAL(triggered()), this, SLOT(ReCheck()));
7274

@@ -811,6 +813,22 @@ void MainWindow::ShowLogView()
811813
mLogView->activateWindow();
812814
}
813815

816+
void MainWindow::ShowStatistics()
817+
{
818+
StatsDialog statsDialog(this);
819+
820+
// Show a dialog with the previous scan statistics and project information
821+
if (mProject)
822+
{
823+
statsDialog.setProject(*mProject);
824+
}
825+
statsDialog.setPathSelected(mCurrentDirectory);
826+
statsDialog.setNumberOfFilesScanned(mThread->GetPreviousFilesCount());
827+
statsDialog.setScanDuration(mThread->GetPreviousScanDuration() / 1000.0);
828+
829+
statsDialog.exec();
830+
}
831+
814832
void MainWindow::Log(const QString &logline)
815833
{
816834
if (mLogView)

gui/mainwindow.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class LogView;
3737
class HelpWindow;
3838
class Project;
3939
class ErrorItem;
40+
class StatsDialog;
4041

4142
/// @addtogroup GUI
4243
/// @{
@@ -166,6 +167,12 @@ public slots:
166167
*/
167168
void ShowLogView();
168169

170+
/**
171+
* @brief Slot for showing the scan and project statistics.
172+
*
173+
*/
174+
void ShowStatistics();
175+
169176
protected slots:
170177

171178
/**

0 commit comments

Comments
 (0)