Cppcheck
Public Slots | Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
ResultsView Class Reference

Widget to show cppcheck progressbar and result. More...

#include <resultsview.h>

Inheritance diagram for ResultsView:

Public Slots

void progress (int value, const QString &description)
 Slot for updating the checking progress. More...
 
void error (const ErrorItem &item)
 Slot for new error to be displayed. More...
 
void filterResults (const QString &filter)
 Filters the results in the result list. More...
 
void updateDetails (const QModelIndex &index)
 Update detailed message when selected item is changed. More...
 
void print ()
 Slot opening a print dialog to print the current report. More...
 
void print (QPrinter *printer)
 Slot printing the current report to the printer. More...
 
void printPreview ()
 Slot opening a print preview dialog. More...
 
void log (const QString &str)
 Log message. More...
 
void debugError (const ErrorItem &item)
 debug message More...
 
void logClear ()
 Clear log messages. More...
 
void logCopyEntry ()
 Copy selected log message entry. More...
 
void logCopyComplete ()
 Copy all log messages. More...
 

Signals

void gotResults ()
 Signal to be emitted when we have results. More...
 
void resultsHidden (bool hidden)
 Signal that results have been hidden or shown. More...
 
void checkSelected (QStringList selectedFilesList)
 Signal to perform recheck of selected files. More...
 
void suppressIds (QStringList ids)
 Suppress Ids. More...
 
void showResults (ShowTypes::ShowType type, bool show)
 Show/hide certain type of errors Refreshes the tree. More...
 
void showCppcheckResults (bool show)
 Show/hide cppcheck errors. More...
 
void showClangResults (bool show)
 Show/hide clang-tidy/clang-analyzer errors. More...
 
void collapseAllResults ()
 Collapse all results in the result list. More...
 
void expandAllResults ()
 Expand all results in the result list. More...
 
void showHiddenResults ()
 Show hidden results in the result list. More...
 

Public Member Functions

 ResultsView (QWidget *parent=nullptr)
 
void initialize (QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler)
 
 ResultsView (const ResultsView &)=delete
 
 ~ResultsView () override
 
ResultsViewoperator= (const ResultsView &)=delete
 
void clear (bool results)
 Clear results and statistics and reset progressinfo. More...
 
void clear (const QString &filename)
 Remove a file from the results. More...
 
void clearRecheckFile (const QString &filename)
 Remove a recheck file from the results. More...
 
void saveStatistics (const QString &filename) const
 Write statistics in file. More...
 
void save (const QString &filename, Report::Type type, const QString &productName) const
 Save results to a file. More...
 
void updateFromOldReport (const QString &filename) const
 Update results from old report (tag, sinceDate) More...
 
void updateSettings (bool showFullPath, bool saveFullPath, bool saveAllErrors, bool showNoErrorsMessage, bool showErrorId, bool showInconclusive)
 Update tree settings. More...
 
void updateStyleSetting (QSettings *settings)
 Update Code Editor Style. More...
 
void setCheckDirectory (const QString &dir)
 Set the directory we are checking. More...
 
QString getCheckDirectory ()
 Get the directory we are checking. More...
 
void setCheckSettings (const Settings &settings)
 Set settings used in checking. More...
 
void checkingStarted (int count)
 Inform the view that checking has started. More...
 
void checkingFinished ()
 Inform the view that checking finished. More...
 
bool hasVisibleResults () const
 Do we have visible results to show? More...
 
bool hasResults () const
 Do we have results from check? More...
 
void saveSettings (QSettings *settings)
 Save View's settings. More...
 
void translate ()
 Translate this view. More...
 
void stopAnalysis ()
 This function should be called when analysis is stopped. More...
 
bool isSuccess () const
 Are there successful results? More...
 
void disableProgressbar ()
 
void readErrorsXml (const QString &filename)
 Read errors from report XML file. More...
 
const CheckStatisticsgetStatistics () const
 Return checking statistics. More...
 
const ShowTypesgetShowTypes () const
 Return Showtypes. More...
 

Private Slots

void on_mListLog_customContextMenuRequested (const QPoint &pos)
 Custom context menu for Analysis Log. More...
 

Private Member Functions

void handleCriticalError (const ErrorItem &item)
 If provided ErrorItem is a critical error then display warning message in the resultsview. More...
 

Private Attributes

bool mShowNoErrorsMessage = true
 Should we show a "No errors found dialog" every time no errors were found? More...
 
Ui::ResultsView * mUI
 
CheckStatisticsmStatistics
 
SettingsmCheckSettings = nullptr
 
bool mSuccess = false
 Set to true when checking finish successfully. More...
 
QString mCriticalErrors
 Critical error ids. More...
 

Detailed Description

Widget to show cppcheck progressbar and result.

Definition at line 51 of file resultsview.h.

Constructor & Destructor Documentation

◆ ResultsView() [1/2]

ResultsView::ResultsView ( QWidget *  parent = nullptr)
explicit

◆ ResultsView() [2/2]

ResultsView::ResultsView ( const ResultsView )
delete

◆ ~ResultsView()

ResultsView::~ResultsView ( )
override

Definition at line 113 of file resultsview.cpp.

References mCheckSettings, and mUI.

Member Function Documentation

◆ checkingFinished()

void ResultsView::checkingFinished ( )

◆ checkingStarted()

void ResultsView::checkingStarted ( int  count)

Inform the view that checking has started.

Parameters
countCount of files to be checked.

Definition at line 311 of file resultsview.cpp.

References mSuccess, mUI, and PROGRESS_MAX.

◆ checkSelected

void ResultsView::checkSelected ( QStringList  selectedFilesList)
signal

Signal to perform recheck of selected files.

Parameters
selectedFilesListlist of selected files

Referenced by MainWindow::MainWindow(), and ResultsView().

◆ clear() [1/2]

void ResultsView::clear ( bool  results)

Clear results and statistics and reset progressinfo.

Parameters
resultsRemove all the results from view?

Definition at line 119 of file resultsview.cpp.

References CheckStatistics::clear(), mCheckSettings, mStatistics, mSuccess, mUI, and PROGRESS_MAX.

◆ clear() [2/2]

void ResultsView::clear ( const QString &  filename)

Remove a file from the results.

Definition at line 141 of file resultsview.cpp.

References mUI.

◆ clearRecheckFile()

void ResultsView::clearRecheckFile ( const QString &  filename)

Remove a recheck file from the results.

Definition at line 146 of file resultsview.cpp.

References mUI.

◆ collapseAllResults

void ResultsView::collapseAllResults ( )
signal

Collapse all results in the result list.

Referenced by MainWindow::MainWindow(), and ResultsView().

◆ debugError

void ResultsView::debugError ( const ErrorItem item)
slot

debug message

Definition at line 507 of file resultsview.cpp.

References mUI, and ErrorItem::toString().

Referenced by MainWindow::MainWindow().

◆ disableProgressbar()

void ResultsView::disableProgressbar ( )

Definition at line 386 of file resultsview.cpp.

References mUI.

◆ error

void ResultsView::error ( const ErrorItem item)
slot

◆ expandAllResults

void ResultsView::expandAllResults ( )
signal

Expand all results in the result list.

Referenced by MainWindow::MainWindow(), and ResultsView().

◆ filterResults

void ResultsView::filterResults ( const QString &  filter)
slot

Filters the results in the result list.

Definition at line 180 of file resultsview.cpp.

References mUI.

◆ getCheckDirectory()

QString ResultsView::getCheckDirectory ( )

Get the directory we are checking.

Returns
Directory containing source files

Definition at line 299 of file resultsview.cpp.

References mUI.

◆ getShowTypes()

const ShowTypes & ResultsView::getShowTypes ( ) const

Return Showtypes.

Returns
Pointer to Showtypes.

Definition at line 151 of file resultsview.cpp.

References mUI.

◆ getStatistics()

const CheckStatistics* ResultsView::getStatistics ( ) const
inline

Return checking statistics.

Returns
Pointer to checking statistics.

Definition at line 210 of file resultsview.h.

References mStatistics.

◆ gotResults

void ResultsView::gotResults ( )
signal

Signal to be emitted when we have results.

Referenced by error(), and MainWindow::MainWindow().

◆ handleCriticalError()

void ResultsView::handleCriticalError ( const ErrorItem item)
private

If provided ErrorItem is a critical error then display warning message in the resultsview.

Definition at line 561 of file resultsview.cpp.

References ErrorItem::errorId, ErrorItem::file0, internal, ErrorLogger::isCriticalErrorId(), mCriticalErrors, mSuccess, mUI, and ErrorItem::severity.

Referenced by error(), and readErrorsXml().

◆ hasResults()

bool ResultsView::hasResults ( ) const

Do we have results from check?

Returns
true if there is at least one warning/error, hidden or visible.

Definition at line 367 of file resultsview.cpp.

References mUI.

Referenced by checkingFinished(), and print().

◆ hasVisibleResults()

bool ResultsView::hasVisibleResults ( ) const

Do we have visible results to show?

Returns
true if there is at least one warning/error to show.

Definition at line 362 of file resultsview.cpp.

References mUI.

◆ initialize()

void ResultsView::initialize ( QSettings *  settings,
ApplicationList list,
ThreadHandler checkThreadHandler 
)

◆ isSuccess()

bool ResultsView::isSuccess ( ) const

Are there successful results?

Returns
true if analysis finished without critical errors etc

Definition at line 583 of file resultsview.cpp.

References mSuccess.

◆ log

void ResultsView::log ( const QString &  str)
slot

Log message.

Definition at line 502 of file resultsview.cpp.

References mUI.

Referenced by MainWindow::MainWindow().

◆ logClear

void ResultsView::logClear ( )
slot

Clear log messages.

Definition at line 512 of file resultsview.cpp.

References mUI.

Referenced by on_mListLog_customContextMenuRequested().

◆ logCopyComplete

void ResultsView::logCopyComplete ( )
slot

Copy all log messages.

Definition at line 526 of file resultsview.cpp.

References mUI.

Referenced by on_mListLog_customContextMenuRequested().

◆ logCopyEntry

void ResultsView::logCopyEntry ( )
slot

Copy selected log message entry.

Definition at line 517 of file resultsview.cpp.

References mUI.

Referenced by on_mListLog_customContextMenuRequested().

◆ on_mListLog_customContextMenuRequested

void ResultsView::on_mListLog_customContextMenuRequested ( const QPoint &  pos)
privateslot

Custom context menu for Analysis Log.

Parameters
posMouse click position

Definition at line 539 of file resultsview.cpp.

References logClear(), logCopyComplete(), logCopyEntry(), and mUI.

◆ operator=()

ResultsView& ResultsView::operator= ( const ResultsView )
delete

◆ print [1/2]

void ResultsView::print ( )
slot

Slot opening a print dialog to print the current report.

Definition at line 242 of file resultsview.cpp.

Referenced by printPreview().

◆ print [2/2]

void ResultsView::print ( QPrinter *  printer)
slot

Slot printing the current report to the printer.

Parameters
printerThe printer used for printing the report.

Definition at line 261 of file resultsview.cpp.

References PrintableReport::getFormattedReportText(), hasResults(), and mUI.

◆ printPreview

void ResultsView::printPreview ( )
slot

Slot opening a print preview dialog.

Definition at line 253 of file resultsview.cpp.

References print().

◆ progress

void ResultsView::progress ( int  value,
const QString &  description 
)
slot

Slot for updating the checking progress.

Parameters
valueCurrent progress value
descriptionDescription to accompany the progress

Definition at line 156 of file resultsview.cpp.

References mUI.

Referenced by ThreadHandler::initialize().

◆ readErrorsXml()

void ResultsView::readErrorsXml ( const QString &  filename)

Read errors from report XML file.

Parameters
filenameReport file to read.

Definition at line 391 of file resultsview.cpp.

References XmlReport::determineVersion(), handleCriticalError(), mSuccess, mUI, XmlReportV2::open(), and XmlReportV2::read().

◆ resultsHidden

void ResultsView::resultsHidden ( bool  hidden)
signal

Signal that results have been hidden or shown.

Parameters
hiddentrue if there are some hidden results, or false if there are not

Referenced by MainWindow::MainWindow(), and ResultsView().

◆ save()

void ResultsView::save ( const QString &  filename,
Report::Type  type,
const QString &  productName 
) const

Save results to a file.

Parameters
filenameFilename to save results to
typeType of the report.
productNameCustom product name

Definition at line 207 of file resultsview.cpp.

References Report::create(), Report::CSV, mUI, Report::TXT, and Report::XMLV2.

◆ saveSettings()

void ResultsView::saveSettings ( QSettings *  settings)

Save View's settings.

Parameters
settingsprogram settings.

Definition at line 372 of file resultsview.cpp.

References mUI, and SETTINGS_MAINWND_SPLITTER_STATE.

◆ saveStatistics()

void ResultsView::saveStatistics ( const QString &  filename) const

Write statistics in file.

Parameters
filenameFilename to save statistics to

Definition at line 185 of file resultsview.cpp.

References CheckStatistics::getCount(), CheckStatistics::getTools(), mStatistics, ShowTypes::ShowErrors, ShowTypes::ShowPerformance, ShowTypes::ShowPortability, ShowTypes::ShowStyle, and ShowTypes::ShowWarnings.

◆ setCheckDirectory()

void ResultsView::setCheckDirectory ( const QString &  dir)

Set the directory we are checking.

This is used to split error file path to relative if necessary

Parameters
dirDirectory we are checking

Definition at line 294 of file resultsview.cpp.

References mUI.

◆ setCheckSettings()

void ResultsView::setCheckSettings ( const Settings settings)

Set settings used in checking.

Definition at line 304 of file resultsview.cpp.

References mCheckSettings.

◆ showClangResults

void ResultsView::showClangResults ( bool  show)
signal

Show/hide clang-tidy/clang-analyzer errors.

Refreshes the tree.

Parameters
showShould specified errors be shown (true) or hidden (false)

Referenced by MainWindow::MainWindow(), and ResultsView().

◆ showCppcheckResults

void ResultsView::showCppcheckResults ( bool  show)
signal

Show/hide cppcheck errors.

Refreshes the tree.

Parameters
showShould specified errors be shown (true) or hidden (false)

Referenced by MainWindow::MainWindow(), and ResultsView().

◆ showHiddenResults

void ResultsView::showHiddenResults ( )
signal

Show hidden results in the result list.

Referenced by MainWindow::MainWindow(), and ResultsView().

◆ showResults

void ResultsView::showResults ( ShowTypes::ShowType  type,
bool  show 
)
signal

Show/hide certain type of errors Refreshes the tree.

Parameters
typeType of error to show/hide
showShould specified errors be shown (true) or hidden (false)

Referenced by ResultsView().

◆ stopAnalysis()

void ResultsView::stopAnalysis ( )

This function should be called when analysis is stopped.

Definition at line 554 of file resultsview.cpp.

References mSuccess, and mUI.

◆ suppressIds

void ResultsView::suppressIds ( QStringList  ids)
signal

Suppress Ids.

Referenced by MainWindow::MainWindow(), and ResultsView().

◆ translate()

void ResultsView::translate ( )

Translate this view.

Definition at line 380 of file resultsview.cpp.

References mUI.

◆ updateDetails

void ResultsView::updateDetails ( const QModelIndex &  index)
slot

Update detailed message when selected item is changed.

Parameters
indexPosition of new selected item.

Definition at line 437 of file resultsview.cpp.

References Path::isHeader2(), mUI, and toString().

Referenced by ResultsView().

◆ updateFromOldReport()

void ResultsView::updateFromOldReport ( const QString &  filename) const

Update results from old report (tag, sinceDate)

Definition at line 202 of file resultsview.cpp.

References mUI.

◆ updateSettings()

void ResultsView::updateSettings ( bool  showFullPath,
bool  saveFullPath,
bool  saveAllErrors,
bool  showNoErrorsMessage,
bool  showErrorId,
bool  showInconclusive 
)

Update tree settings.

Parameters
showFullPathShow full path of files in the tree
saveFullPathSave full path of files in reports
saveAllErrorsSave all visible errors
showNoErrorsMessageShow "no errors"?
showErrorIdShow error id?
showInconclusiveShow inconclusive?

Definition at line 277 of file resultsview.cpp.

References mShowNoErrorsMessage, and mUI.

◆ updateStyleSetting()

void ResultsView::updateStyleSetting ( QSettings *  settings)

Update Code Editor Style.

Function will read updated Code Editor styling from stored program settings.

Parameters
settingsPointer to QSettings Object

Definition at line 288 of file resultsview.cpp.

References CodeEditorStyle::loadSettings(), and mUI.

Member Data Documentation

◆ mCheckSettings

Settings* ResultsView::mCheckSettings = nullptr
private

Definition at line 378 of file resultsview.h.

Referenced by checkingFinished(), clear(), setCheckSettings(), and ~ResultsView().

◆ mCriticalErrors

QString ResultsView::mCriticalErrors
private

Critical error ids.

Definition at line 386 of file resultsview.h.

Referenced by checkingFinished(), and handleCriticalError().

◆ mShowNoErrorsMessage

bool ResultsView::mShowNoErrorsMessage = true
private

Should we show a "No errors found dialog" every time no errors were found?

Definition at line 372 of file resultsview.h.

Referenced by checkingFinished(), initialize(), and updateSettings().

◆ mStatistics

CheckStatistics* ResultsView::mStatistics
private

Definition at line 376 of file resultsview.h.

Referenced by checkingFinished(), clear(), error(), getStatistics(), and saveStatistics().

◆ mSuccess

bool ResultsView::mSuccess = false
private

Set to true when checking finish successfully.

Set to false whenever analysis starts.

Definition at line 383 of file resultsview.h.

Referenced by checkingStarted(), clear(), handleCriticalError(), isSuccess(), readErrorsXml(), and stopAnalysis().

◆ mUI

Ui::ResultsView* ResultsView::mUI
private

The documentation for this class was generated from the following files: