4242
4343ResultsView::ResultsView (QWidget * parent) :
4444 QWidget(parent),
45- mErrorsFound(false ),
4645 mShowNoErrorsMessage(true ),
4746 mStatistics(new CheckStatistics(this ))
4847{
@@ -74,7 +73,6 @@ void ResultsView::Clear(bool results)
7473{
7574 if (results) {
7675 mUI .mTree ->Clear ();
77- mErrorsFound = false ;
7876 }
7977
8078 mUI .mDetails ->setText (" " );
@@ -90,13 +88,11 @@ void ResultsView::Clear(bool results)
9088void ResultsView::Clear (const QString &filename)
9189{
9290 mUI .mTree ->Clear (filename);
91+ }
9392
94- /* *
95- * @todo Optimize this.. It is inefficient to check this every time.
96- */
97- // If the results list got empty..
98- if (!mUI .mTree ->HasResults ())
99- mErrorsFound = false ;
93+ void ResultsView::ClearRecheckFile (const QString &filename)
94+ {
95+ mUI .mTree ->ClearRecheckFile (filename);
10096}
10197
10298void ResultsView::Progress (int value, const QString& description)
@@ -107,7 +103,6 @@ void ResultsView::Progress(int value, const QString& description)
107103
108104void ResultsView::Error (const ErrorItem &item)
109105{
110- mErrorsFound = true ;
111106 if (mUI .mTree ->AddErrorItem (item)) {
112107 emit GotResults ();
113108 mStatistics ->AddItem (ShowTypes::SeverityToShowType (item.severity ));
@@ -141,7 +136,7 @@ void ResultsView::FilterResults(const QString& filter)
141136
142137void ResultsView::Save (const QString &filename, Report::Type type) const
143138{
144- if (!mErrorsFound ) {
139+ if (!HasResults () ) {
145140 QMessageBox msgBox;
146141 msgBox.setText (tr (" No errors found, nothing to save." ));
147142 msgBox.setIcon (QMessageBox::Critical);
@@ -205,7 +200,7 @@ void ResultsView::PrintPreview()
205200
206201void ResultsView::Print (QPrinter* printer)
207202{
208- if (!mErrorsFound ) {
203+ if (!HasResults () ) {
209204 QMessageBox msgBox;
210205 msgBox.setText (tr (" No errors found, nothing to print." ));
211206 msgBox.setIcon (QMessageBox::Critical);
@@ -251,7 +246,7 @@ void ResultsView::CheckingFinished()
251246 // Should we inform user of non visible/not found errors?
252247 if (mShowNoErrorsMessage ) {
253248 // Tell user that we found no errors
254- if (!mErrorsFound ) {
249+ if (!HasResults () ) {
255250 QMessageBox msg (QMessageBox::Information,
256251 tr (" Cppcheck" ),
257252 tr (" No errors found." ),
0 commit comments