| 
    Cppcheck
    
   | 
 
This class handles creating threadresult and starting threads. More...
#include <threadhandler.h>
 Public Slots | |
| void | stop () | 
| Slot to stop all threads.  More... | |
Signals | |
| void | done () | 
| Signal that all threads are done.  More... | |
| void | log (const QString &msg) | 
| void | debugError (const ErrorItem &item) | 
Public Member Functions | |
| ThreadHandler (QObject *parent=nullptr) | |
| ~ThreadHandler () override | |
| void | setThreadCount (const int count) | 
| Set the number of threads to use.  More... | |
| void | initialize (const ResultsView *view) | 
| Initialize the threads (connect all signals to resultsview's slots)  More... | |
| void | loadSettings (const QSettings &settings) | 
| Load settings.  More... | |
| void | saveSettings (QSettings &settings) const | 
| Save settings.  More... | |
| void | setAddonsAndTools (const QStringList &addonsAndTools) | 
| void | setSuppressions (const QList< SuppressionList::Suppression > &s) | 
| void | setClangIncludePaths (const QStringList &s) | 
| void | clearFiles () | 
| Clear all files from cppcheck.  More... | |
| void | setFiles (const QStringList &files) | 
| Set files to check.  More... | |
| void | setProject (const ImportProject &prj) | 
| Set project to check.  More... | |
| void | check (const Settings &settings) | 
| Start the threads to check the files.  More... | |
| void | setCheckFiles (bool all) | 
| Set files to check.  More... | |
| void | setCheckFiles (const QStringList &files) | 
| Set selected files to check.  More... | |
| bool | isChecking () const | 
| Is checking running?  More... | |
| bool | hasPreviousFiles () const | 
| Have we checked files already?  More... | |
| int | getPreviousFilesCount () const | 
| Return count of files we checked last time.  More... | |
| int | getPreviousScanDuration () const | 
| Return the time elapsed while scanning the previous time.  More... | |
| QStringList | getReCheckFiles (bool all) const | 
| Get files that should be rechecked because they have been changed.  More... | |
| QDateTime | getCheckStartTime () const | 
| Get start time of last check.  More... | |
| void | setCheckStartTime (QDateTime checkStartTime) | 
| Set start time of check.  More... | |
Protected Slots | |
| void | threadDone () | 
| Slot that a single thread is done.  More... | |
Protected Member Functions | |
| void | removeThreads () | 
| Function to delete all threads.  More... | |
Protected Attributes | |
| QStringList | mLastFiles | 
| List of files checked last time (used when rechecking)  More... | |
| QDateTime | mCheckStartTime | 
| date and time when current checking started  More... | |
| QDateTime | mLastCheckTime | 
| when was the files checked the last time (used when rechecking)  More... | |
| QElapsedTimer | mTimer | 
| Timer used for measuring scan duration.  More... | |
| int | mScanDuration {} | 
| The previous scan duration in milliseconds.  More... | |
| ThreadResult | mResults | 
| Thread results are stored here.  More... | |
| QList< CheckThread * > | mThreads | 
| List of threads currently in use.  More... | |
| int | mRunningThreadCount {} | 
| The amount of threads currently running.  More... | |
| bool | mAnalyseWholeProgram {} | 
| QStringList | mAddonsAndTools | 
| QList< SuppressionList::Suppression > | mSuppressions | 
| QStringList | mClangIncludePaths | 
Private Member Functions | |
| bool | needsReCheck (const QString &filename, std::set< QString > &modified, std::set< QString > &unmodified) const | 
| Check if a file needs to be rechecked.  More... | |
This class handles creating threadresult and starting threads.
Definition at line 50 of file threadhandler.h.
      
  | 
  explicit | 
Definition at line 38 of file threadhandler.cpp.
References setThreadCount().
      
  | 
  override | 
Definition at line 44 of file threadhandler.cpp.
References removeThreads().
| void ThreadHandler::check | ( | const Settings & | settings | ) | 
Start the threads to check the files.
| settings | Settings for checking | 
Definition at line 84 of file threadhandler.cpp.
References Settings::addons, done(), ThreadResult::getFileCount(), Settings::jobs, mAddonsAndTools, mAnalyseWholeProgram, mCheckStartTime, mClangIncludePaths, mResults, mRunningThreadCount, mSuppressions, mThreads, mTimer, and setThreadCount().
Referenced by MainWindow::doAnalyzeFiles(), MainWindow::doAnalyzeProject(), MainWindow::reAnalyze(), and MainWindow::reAnalyzeSelected().
| void ThreadHandler::clearFiles | ( | ) | 
Clear all files from cppcheck.
Definition at line 49 of file threadhandler.cpp.
References ThreadResult::clearFiles(), mAddonsAndTools, mAnalyseWholeProgram, mLastFiles, mResults, and mSuppressions.
Referenced by MainWindow::doAnalyzeFiles(), and MainWindow::doAnalyzeProject().
      
  | 
  signal | 
Referenced by initialize(), and MainWindow::MainWindow().
      
  | 
  signal | 
Signal that all threads are done.
Referenced by check(), MainWindow::MainWindow(), and threadDone().
| QDateTime ThreadHandler::getCheckStartTime | ( | ) | const | 
Get start time of last check.
Definition at line 293 of file threadhandler.cpp.
References mCheckStartTime.
Referenced by MainWindow::reAnalyzeSelected().
| int ThreadHandler::getPreviousFilesCount | ( | ) | const | 
Return count of files we checked last time.
Definition at line 227 of file threadhandler.cpp.
References mLastFiles.
Referenced by MainWindow::showStatistics().
| int ThreadHandler::getPreviousScanDuration | ( | ) | const | 
Return the time elapsed while scanning the previous time.
Definition at line 232 of file threadhandler.cpp.
References mScanDuration.
Referenced by MainWindow::showStatistics().
| QStringList ThreadHandler::getReCheckFiles | ( | bool | all | ) | const | 
Get files that should be rechecked because they have been changed.
Definition at line 237 of file threadhandler.cpp.
References mLastCheckTime, mLastFiles, and needsReCheck().
Referenced by MainWindow::reAnalyze(), and setCheckFiles().
| bool ThreadHandler::hasPreviousFiles | ( | ) | const | 
Have we checked files already?
Definition at line 222 of file threadhandler.cpp.
References mLastFiles.
Referenced by MainWindow::enableCheckButtons().
| void ThreadHandler::initialize | ( | const ResultsView * | view | ) | 
Initialize the threads (connect all signals to resultsview's slots)
| view | View to show error results | 
Definition at line 197 of file threadhandler.cpp.
References debugError(), ThreadResult::debugError(), ResultsView::error(), ThreadResult::error(), ThreadResult::log(), log(), mResults, ResultsView::progress(), and ThreadResult::progress().
Referenced by MainWindow::MainWindow().
| bool ThreadHandler::isChecking | ( | ) | const | 
Is checking running?
Definition at line 122 of file threadhandler.cpp.
References mRunningThreadCount.
Referenced by MainWindow::closeEvent(), ResultsTree::contextMenuEvent(), and MainWindow::reAnalyzeSelected().
| void ThreadHandler::loadSettings | ( | const QSettings & | settings | ) | 
Load settings.
| settings | QSettings to load settings from | 
Definition at line 212 of file threadhandler.cpp.
References setThreadCount(), and SETTINGS_CHECK_THREADS.
      
  | 
  signal | 
Referenced by initialize(), and MainWindow::MainWindow().
      
  | 
  private | 
Check if a file needs to be rechecked.
Recursively checks included headers. Used by GetReCheckFiles()
Definition at line 253 of file threadhandler.cpp.
References mLastCheckTime.
Referenced by getReCheckFiles().
      
  | 
  protected | 
Function to delete all threads.
Definition at line 148 of file threadhandler.cpp.
References CheckThread::done(), CheckThread::fileChecked(), ThreadResult::fileChecked(), mAnalyseWholeProgram, mResults, mThreads, and threadDone().
Referenced by setThreadCount(), and ~ThreadHandler().
| void ThreadHandler::saveSettings | ( | QSettings & | settings | ) | const | 
Save settings.
| settings | QSettings to save settings to | 
Definition at line 217 of file threadhandler.cpp.
References mThreads, and SETTINGS_CHECK_THREADS.
      
  | 
  inline | 
Definition at line 81 of file threadhandler.h.
References mAddonsAndTools.
Referenced by MainWindow::analyzeProject(), MainWindow::doAnalyzeFiles(), and MainWindow::doAnalyzeProject().
| void ThreadHandler::setCheckFiles | ( | bool | all | ) | 
Set files to check.
| all | true if all files, false if modified files | 
Definition at line 70 of file threadhandler.cpp.
References getReCheckFiles(), mResults, mRunningThreadCount, and ThreadResult::setFiles().
Referenced by MainWindow::doAnalyzeFiles(), MainWindow::reAnalyze(), and MainWindow::reAnalyzeSelected().
| void ThreadHandler::setCheckFiles | ( | const QStringList & | files | ) | 
Set selected files to check.
| files | list of files to be checked | 
Definition at line 77 of file threadhandler.cpp.
References mResults, mRunningThreadCount, and ThreadResult::setFiles().
| void ThreadHandler::setCheckStartTime | ( | QDateTime | checkStartTime | ) | 
Set start time of check.
| checkStartTime | saved start time of the last check | 
Definition at line 298 of file threadhandler.cpp.
References mCheckStartTime.
Referenced by MainWindow::reAnalyzeSelected().
      
  | 
  inline | 
Definition at line 89 of file threadhandler.h.
References mClangIncludePaths.
Referenced by MainWindow::doAnalyzeProject().
| void ThreadHandler::setFiles | ( | const QStringList & | files | ) | 
Set files to check.
| files | files to check | 
Definition at line 58 of file threadhandler.cpp.
References mLastFiles, mResults, and ThreadResult::setFiles().
Referenced by MainWindow::doAnalyzeFiles().
| void ThreadHandler::setProject | ( | const ImportProject & | prj | ) | 
Set project to check.
| prj | project to check | 
Definition at line 64 of file threadhandler.cpp.
References mLastFiles, mResults, and ThreadResult::setProject().
Referenced by MainWindow::doAnalyzeProject().
      
  | 
  inline | 
Definition at line 85 of file threadhandler.h.
References mSuppressions.
Referenced by MainWindow::doAnalyzeFiles(), and MainWindow::doAnalyzeProject().
| void ThreadHandler::setThreadCount | ( | const int | count | ) | 
Set the number of threads to use.
| count | The number of threads to use | 
Definition at line 127 of file threadhandler.cpp.
References CheckThread::done(), CheckThread::fileChecked(), ThreadResult::fileChecked(), mResults, mRunningThreadCount, mThreads, removeThreads(), and threadDone().
Referenced by check(), loadSettings(), and ThreadHandler().
      
  | 
  slot | 
Slot to stop all threads.
Definition at line 188 of file threadhandler.cpp.
References mAnalyseWholeProgram, mCheckStartTime, and mThreads.
Referenced by MainWindow::closeEvent(), and MainWindow::stopAnalysis().
      
  | 
  protectedslot | 
Slot that a single thread is done.
Definition at line 166 of file threadhandler.cpp.
References done(), mAnalyseWholeProgram, mCheckStartTime, mLastCheckTime, mLastFiles, mRunningThreadCount, mScanDuration, mThreads, and mTimer.
Referenced by removeThreads(), and setThreadCount().
      
  | 
  protected | 
Definition at line 261 of file threadhandler.h.
Referenced by check(), clearFiles(), and setAddonsAndTools().
      
  | 
  protected | 
Definition at line 259 of file threadhandler.h.
Referenced by check(), clearFiles(), removeThreads(), stop(), and threadDone().
      
  | 
  protected | 
date and time when current checking started
Definition at line 216 of file threadhandler.h.
Referenced by check(), getCheckStartTime(), setCheckStartTime(), stop(), and threadDone().
      
  | 
  protected | 
Definition at line 263 of file threadhandler.h.
Referenced by check(), and setClangIncludePaths().
      
  | 
  protected | 
when was the files checked the last time (used when rechecking)
Definition at line 221 of file threadhandler.h.
Referenced by getReCheckFiles(), needsReCheck(), and threadDone().
      
  | 
  protected | 
List of files checked last time (used when rechecking)
Definition at line 213 of file threadhandler.h.
Referenced by clearFiles(), getPreviousFilesCount(), getReCheckFiles(), hasPreviousFiles(), setFiles(), setProject(), and threadDone().
      
  | 
  protected | 
Thread results are stored here.
Definition at line 245 of file threadhandler.h.
Referenced by check(), clearFiles(), initialize(), removeThreads(), setCheckFiles(), setFiles(), setProject(), and setThreadCount().
      
  | 
  protected | 
The amount of threads currently running.
Definition at line 257 of file threadhandler.h.
Referenced by check(), isChecking(), setCheckFiles(), setThreadCount(), and threadDone().
      
  | 
  protected | 
The previous scan duration in milliseconds.
Definition at line 233 of file threadhandler.h.
Referenced by getPreviousScanDuration(), and threadDone().
      
  | 
  protected | 
Definition at line 262 of file threadhandler.h.
Referenced by check(), clearFiles(), and setSuppressions().
      
  | 
  protected | 
List of threads currently in use.
Definition at line 251 of file threadhandler.h.
Referenced by check(), removeThreads(), saveSettings(), setThreadCount(), stop(), and threadDone().
      
  | 
  protected | 
Timer used for measuring scan duration.
Definition at line 227 of file threadhandler.h.
Referenced by check(), and threadDone().