diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 6de89ecab..558958522 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -301,7 +301,7 @@ void MainWindow::DoCheckFiles(const QStringList &files) pathList.AddExcludeList(mProject->GetProjectFile()->GetExcludedPaths()); QStringList fileNames = pathList.GetFileList(); - mUI.mResults->Clear(); + mUI.mResults->Clear(true); mThread->ClearFiles(); if (fileNames.isEmpty()) { @@ -586,6 +586,9 @@ void MainWindow::ReCheck() if (files.empty()) return; + // Clear details, statistics and progress + mUI.mResults->Clear(false); + // Clear results for changed files for (int i = 0; i < files.size(); ++i) mUI.mResults->Clear(files[i]); @@ -601,7 +604,7 @@ void MainWindow::ReCheck() void MainWindow::ClearResults() { - mUI.mResults->Clear(); + mUI.mResults->Clear(true); mUI.mActionClearResults->setEnabled(false); mUI.mActionSave->setEnabled(false); } @@ -634,7 +637,7 @@ void MainWindow::OpenXML() &selectedFilter); if (!selectedFile.isEmpty()) { - mUI.mResults->Clear(); + mUI.mResults->Clear(true); mUI.mResults->ReadErrorsXml(selectedFile); } } diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index dbf9e2a98..7a52ba192 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -67,11 +67,15 @@ ResultsView::~ResultsView() //dtor } -void ResultsView::Clear() +void ResultsView::Clear(bool results) { - mUI.mTree->Clear(); + if (results) { + mUI.mTree->Clear(); + mErrorsFound = false; + } + mUI.mDetails->setText(""); - mErrorsFound = false; + mStatistics->Clear(); //Clear the progressbar @@ -83,14 +87,13 @@ void ResultsView::Clear() void ResultsView::Clear(const QString &filename) { mUI.mTree->Clear(filename); - mUI.mDetails->setText(""); - mErrorsFound = false; - mStatistics->Clear(); - // Clear the progressbar - mUI.mProgress->setMaximum(PROGRESS_MAX); - mUI.mProgress->setValue(0); - mUI.mProgress->setFormat("%p%"); + /** + * @todo Optimize this.. It is inefficient to check this every time. + */ + // If the results list got empty.. + if (!mUI.mTree->HasResults()) + mErrorsFound = false; } void ResultsView::Progress(int value, const QString& description) diff --git a/gui/resultsview.h b/gui/resultsview.h index 29aa1c03f..f243f5aaa 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -59,13 +59,13 @@ public: void ShowResults(ShowTypes::ShowType type, bool show); /** - * @brief Clear results - * - */ - void Clear(); + * @brief Clear results and statistics and reset progressinfo. + * @param results Remove all the results from view? + */ + void Clear(bool results); /** - * @brief Clear results for a specific file + * @brief Remove a file from the results. */ void Clear(const QString &filename);