GUI: Don't warn about empty results after re-check.
If user tried to save results after re-checking files and not getting new results by the re-check, the save was failed since Cppcheck thought there were no results. This was caused by wrong clearing of "has results" flag when removing single items from the results. Ticket: #4121 (Bogus error message when saving the report)
This commit is contained in:
parent
8025b8bab4
commit
6d75cdf7c2
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,11 +67,15 @@ ResultsView::~ResultsView()
|
|||
//dtor
|
||||
}
|
||||
|
||||
void ResultsView::Clear()
|
||||
void ResultsView::Clear(bool results)
|
||||
{
|
||||
if (results) {
|
||||
mUI.mTree->Clear();
|
||||
mUI.mDetails->setText("");
|
||||
mErrorsFound = false;
|
||||
}
|
||||
|
||||
mUI.mDetails->setText("");
|
||||
|
||||
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)
|
||||
|
|
|
@ -59,13 +59,13 @@ public:
|
|||
void ShowResults(ShowTypes::ShowType type, bool show);
|
||||
|
||||
/**
|
||||
* @brief Clear results
|
||||
*
|
||||
* @brief Clear results and statistics and reset progressinfo.
|
||||
* @param results Remove all the results from view?
|
||||
*/
|
||||
void Clear();
|
||||
void Clear(bool results);
|
||||
|
||||
/**
|
||||
* @brief Clear results for a specific file
|
||||
* @brief Remove a file from the results.
|
||||
*/
|
||||
void Clear(const QString &filename);
|
||||
|
||||
|
|
Loading…
Reference in New Issue