Fixed #1934 (GUI: Add checking info display)
This commit is contained in:
parent
7a8190e188
commit
15b4cab4bb
|
@ -30,7 +30,8 @@ FORMS = main.ui \
|
|||
projectfile.ui \
|
||||
about.ui \
|
||||
logview.ui \
|
||||
helpwindow.ui
|
||||
helpwindow.ui \
|
||||
stats.ui
|
||||
|
||||
TRANSLATIONS = cppcheck_fi.ts \
|
||||
cppcheck_nl.ts \
|
||||
|
@ -67,7 +68,8 @@ HEADERS += mainwindow.h \
|
|||
csvreport.h \
|
||||
logview.h \
|
||||
filelist.h \
|
||||
helpwindow.h
|
||||
helpwindow.h \
|
||||
statsdialog.h
|
||||
|
||||
SOURCES += main.cpp \
|
||||
mainwindow.cpp\
|
||||
|
@ -92,7 +94,8 @@ SOURCES += main.cpp \
|
|||
csvreport.cpp \
|
||||
logview.cpp \
|
||||
filelist.cpp \
|
||||
helpwindow.cpp
|
||||
helpwindow.cpp \
|
||||
statsdialog.cpp
|
||||
|
||||
win32 {
|
||||
DEFINES += _CRT_SECURE_NO_WARNINGS
|
||||
|
|
12
gui/main.ui
12
gui/main.ui
|
@ -66,7 +66,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>21</height>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="mMenuFile">
|
||||
|
@ -105,6 +105,7 @@
|
|||
<addaction name="mActionExpandAll"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="mActionViewLog"/>
|
||||
<addaction name="mActionViewStats"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="mMenuLanguage">
|
||||
<property name="title">
|
||||
|
@ -399,6 +400,15 @@
|
|||
<string>&Edit Project File...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="mActionViewStats">
|
||||
<property name="icon">
|
||||
<iconset resource="gui.qrc">
|
||||
<normaloff>:/images/text-x-generic.png</normaloff>:/images/text-x-generic.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Statistics</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "projectfile.h"
|
||||
#include "project.h"
|
||||
#include "report.h"
|
||||
#include "statsdialog.h"
|
||||
#include "logview.h"
|
||||
#include "filelist.h"
|
||||
#include "helpwindow.h"
|
||||
|
@ -67,6 +68,7 @@ MainWindow::MainWindow() :
|
|||
connect(mUI.mActionCollapseAll, SIGNAL(triggered()), mUI.mResults, SLOT(CollapseAllResults()));
|
||||
connect(mUI.mActionExpandAll, SIGNAL(triggered()), mUI.mResults, SLOT(ExpandAllResults()));
|
||||
connect(mUI.mActionViewLog, SIGNAL(triggered()), this, SLOT(ShowLogView()));
|
||||
connect(mUI.mActionViewStats, SIGNAL(triggered()), this, SLOT(ShowStatistics()));
|
||||
|
||||
connect(mUI.mActionRecheck, SIGNAL(triggered()), this, SLOT(ReCheck()));
|
||||
|
||||
|
@ -811,6 +813,22 @@ void MainWindow::ShowLogView()
|
|||
mLogView->activateWindow();
|
||||
}
|
||||
|
||||
void MainWindow::ShowStatistics()
|
||||
{
|
||||
StatsDialog statsDialog(this);
|
||||
|
||||
// Show a dialog with the previous scan statistics and project information
|
||||
if (mProject)
|
||||
{
|
||||
statsDialog.setProject(*mProject);
|
||||
}
|
||||
statsDialog.setPathSelected(mCurrentDirectory);
|
||||
statsDialog.setNumberOfFilesScanned(mThread->GetPreviousFilesCount());
|
||||
statsDialog.setScanDuration(mThread->GetPreviousScanDuration() / 1000.0);
|
||||
|
||||
statsDialog.exec();
|
||||
}
|
||||
|
||||
void MainWindow::Log(const QString &logline)
|
||||
{
|
||||
if (mLogView)
|
||||
|
|
|
@ -37,6 +37,7 @@ class LogView;
|
|||
class HelpWindow;
|
||||
class Project;
|
||||
class ErrorItem;
|
||||
class StatsDialog;
|
||||
|
||||
/// @addtogroup GUI
|
||||
/// @{
|
||||
|
@ -166,6 +167,12 @@ public slots:
|
|||
*/
|
||||
void ShowLogView();
|
||||
|
||||
/**
|
||||
* @brief Slot for showing the scan and project statistics.
|
||||
*
|
||||
*/
|
||||
void ShowStatistics();
|
||||
|
||||
protected slots:
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,315 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>StatsDialog</class>
|
||||
<widget class="QDialog" name="StatsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>502</width>
|
||||
<height>329</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Statistics</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="mTabWidget">
|
||||
<property name="tabShape">
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="mProjectTab">
|
||||
<attribute name="title">
|
||||
<string>Project</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="mProjectLabel">
|
||||
<property name="text">
|
||||
<string>Project:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="mProject">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="mPathsLabel">
|
||||
<property name="text">
|
||||
<string>Paths:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="mPaths">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="mIncludePathsLabel">
|
||||
<property name="text">
|
||||
<string>Include paths:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="mIncludePaths">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="mDefinesLabel">
|
||||
<property name="text">
|
||||
<string>Defines:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="mDefines">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="mVerticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="mScanTab">
|
||||
<attribute name="title">
|
||||
<string>Previous Scan</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="mPathLabel">
|
||||
<property name="text">
|
||||
<string>Path Selected:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="mNumberOfFilesScannedLabel">
|
||||
<property name="text">
|
||||
<string>Number of Files Scanned:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="mNumberOfFilesScanned">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="mScanDurationLabel">
|
||||
<property name="text">
|
||||
<string>Scan Duration:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="mScanDuration">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="mVerticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="mPath">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mCopyToClipboard">
|
||||
<property name="text">
|
||||
<string>Copy to Clipboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="mButtonBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>mTabWidget</tabstop>
|
||||
<tabstop>mProject</tabstop>
|
||||
<tabstop>mPaths</tabstop>
|
||||
<tabstop>mIncludePaths</tabstop>
|
||||
<tabstop>mDefines</tabstop>
|
||||
<tabstop>mPath</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>mButtonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>StatsDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>227</x>
|
||||
<y>307</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>mButtonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>StatsDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>295</x>
|
||||
<y>313</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* Cppcheck - A tool for static C/C++ code analysis
|
||||
* Copyright (C) 2007-2010 Daniel Marjamäki and Cppcheck team.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QMimeData>
|
||||
#include "common.h"
|
||||
#include "project.h"
|
||||
#include "projectfile.h"
|
||||
#include "statsdialog.h"
|
||||
|
||||
StatsDialog::StatsDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
mUI.setupUi(this);
|
||||
|
||||
connect(mUI.mCopyToClipboard, SIGNAL(pressed()), this, SLOT(copyToClipboard()));
|
||||
}
|
||||
|
||||
void StatsDialog::setProject(const Project& project)
|
||||
{
|
||||
ProjectFile *projectFile = project.GetProjectFile();
|
||||
if (projectFile)
|
||||
{
|
||||
mUI.mProject->setText(projectFile->GetRootPath());
|
||||
mUI.mPaths->setText(projectFile->GetCheckPaths().join(";"));
|
||||
mUI.mIncludePaths->setText(projectFile->GetIncludeDirs().join(";"));
|
||||
mUI.mDefines->setText(projectFile->GetDefines().join(";"));
|
||||
}
|
||||
else
|
||||
{
|
||||
mUI.mProject->setText("");
|
||||
mUI.mPaths->setText("");
|
||||
mUI.mIncludePaths->setText("");
|
||||
mUI.mDefines->setText("");
|
||||
}
|
||||
}
|
||||
|
||||
void StatsDialog::setPathSelected(const QString& path)
|
||||
{
|
||||
mUI.mPath->setText(path);
|
||||
}
|
||||
|
||||
void StatsDialog::setNumberOfFilesScanned(int num)
|
||||
{
|
||||
mUI.mNumberOfFilesScanned->setText(QString::number(num));
|
||||
}
|
||||
|
||||
void StatsDialog::setScanDuration(double seconds)
|
||||
{
|
||||
mUI.mScanDuration->setText(tr("%1 secs").arg(seconds));
|
||||
}
|
||||
|
||||
void StatsDialog::copyToClipboard()
|
||||
{
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
if (clipboard)
|
||||
{
|
||||
// Plain text summary
|
||||
QString textSummary = tr(
|
||||
"Project Settings\n"
|
||||
"\tProject:\t%1\n"
|
||||
"\tPaths:\t%2\n"
|
||||
"\tInclude paths:\t%3\n"
|
||||
"\tDefines:\t%4\n"
|
||||
"Previous Scan\n"
|
||||
"\tPath selected:\t%5\n"
|
||||
"\tNumber of files scanned:\t%6\n"
|
||||
"\tScan duration:\t%7\n"
|
||||
)
|
||||
.arg(mUI.mProject->text())
|
||||
.arg(mUI.mPaths->text())
|
||||
.arg(mUI.mIncludePaths->text())
|
||||
.arg(mUI.mDefines->text())
|
||||
.arg(mUI.mPath->text())
|
||||
.arg(mUI.mNumberOfFilesScanned->text())
|
||||
.arg(mUI.mScanDuration->text());
|
||||
|
||||
// HTML summary
|
||||
QString htmlSummary = tr(
|
||||
"<h3>Project Settings<h3>\n"
|
||||
"<table>\n"
|
||||
" <tr><th>Project:</th><td>%1</td></tr>\n"
|
||||
" <tr><th>Paths:</th><td>%2</td></tr>\n"
|
||||
" <tr><th>Include paths:</th><td>%3</td></tr>\n"
|
||||
" <tr><th>Defines:</th><td>%4</td></tr>\n"
|
||||
"</table>\n"
|
||||
"<h3>Previous Scan</h3>\n"
|
||||
"<table>\n"
|
||||
" <tr><th>Path selected:</th><td>%5</td></tr>\n"
|
||||
" <tr><th>Number of files scanned:</th><td>%6</td></tr>\n"
|
||||
" <tr><th>Scan duration:</th><td>%7</td></tr>\n"
|
||||
"</table>\n"
|
||||
)
|
||||
.arg(mUI.mProject->text())
|
||||
.arg(mUI.mPaths->text())
|
||||
.arg(mUI.mIncludePaths->text())
|
||||
.arg(mUI.mDefines->text())
|
||||
.arg(mUI.mPath->text())
|
||||
.arg(mUI.mNumberOfFilesScanned->text())
|
||||
.arg(mUI.mScanDuration->text());
|
||||
|
||||
QMimeData *mimeData = new QMimeData();
|
||||
mimeData->setText(textSummary);
|
||||
mimeData->setHtml(htmlSummary);
|
||||
clipboard->setMimeData(mimeData);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Cppcheck - A tool for static C/C++ code analysis
|
||||
* Copyright (C) 2007-2010 Daniel Marjamäki and Cppcheck team.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef STATSDIALOG_H
|
||||
#define STATSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "ui_stats.h"
|
||||
|
||||
class Project;
|
||||
|
||||
/// @addtogroup GUI
|
||||
/// @{
|
||||
|
||||
/**
|
||||
* @brief A dialog that shows project and scan statistics.
|
||||
*
|
||||
*/
|
||||
class StatsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
StatsDialog(QWidget *parent = 0);
|
||||
|
||||
/**
|
||||
* @brief Sets the project to extract statistics from
|
||||
*/
|
||||
void setProject(const Project& project);
|
||||
|
||||
/**
|
||||
* @brief Sets the string to display beside "Path Selected:"
|
||||
*/
|
||||
void setPathSelected(const QString& path);
|
||||
|
||||
/**
|
||||
* @brief Sets the number to display beside "Number of Files Scanned:"
|
||||
*/
|
||||
void setNumberOfFilesScanned(int num);
|
||||
|
||||
/**
|
||||
* @brief Sets the number of seconds to display beside "Scan Duration:"
|
||||
*/
|
||||
void setScanDuration(double seconds);
|
||||
|
||||
private slots:
|
||||
void copyToClipboard();
|
||||
|
||||
private:
|
||||
Ui::StatsDialog mUI;
|
||||
};
|
||||
|
||||
/// @}
|
||||
|
||||
#endif // STATSDIALOG_H
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
ThreadHandler::ThreadHandler(QObject *parent) :
|
||||
QObject(parent),
|
||||
mScanDuration(0),
|
||||
mRunningThreadCount(0)
|
||||
{
|
||||
SetThreadCount(1);
|
||||
|
@ -71,6 +72,8 @@ void ThreadHandler::Check(Settings settings, bool recheck)
|
|||
{
|
||||
mThreads[i]->Check(settings);
|
||||
}
|
||||
|
||||
mTime.start();
|
||||
}
|
||||
|
||||
bool ThreadHandler::IsChecking() const
|
||||
|
@ -124,6 +127,8 @@ void ThreadHandler::ThreadDone()
|
|||
if (mRunningThreadCount == 0)
|
||||
{
|
||||
emit Done();
|
||||
|
||||
mScanDuration = mTime.elapsed();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,3 +178,8 @@ int ThreadHandler::GetPreviousFilesCount() const
|
|||
{
|
||||
return mLastFiles.size();
|
||||
}
|
||||
|
||||
int ThreadHandler::GetPreviousScanDuration() const
|
||||
{
|
||||
return mScanDuration;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QTime>
|
||||
#include "../lib/settings.h"
|
||||
#include "../lib/cppcheck.h"
|
||||
#include "threadresult.h"
|
||||
|
@ -110,6 +111,13 @@ public:
|
|||
*/
|
||||
int GetPreviousFilesCount() const;
|
||||
|
||||
/**
|
||||
* @brief Return the time elapsed while scanning the previous time.
|
||||
*
|
||||
* @return the time elapsed in milliseconds.
|
||||
*/
|
||||
int GetPreviousScanDuration() const;
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief Signal that all threads are done
|
||||
|
@ -140,6 +148,18 @@ protected:
|
|||
*/
|
||||
QStringList mLastFiles;
|
||||
|
||||
/**
|
||||
* @brief Timer used for measuring scan duration
|
||||
*
|
||||
*/
|
||||
QTime mTime;
|
||||
|
||||
/**
|
||||
* @brief The previous scan duration in milliseconds.
|
||||
*
|
||||
*/
|
||||
int mScanDuration;
|
||||
|
||||
/**
|
||||
* @brief Function to delete all threads
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue