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());
|
pathList.AddExcludeList(mProject->GetProjectFile()->GetExcludedPaths());
|
||||||
QStringList fileNames = pathList.GetFileList();
|
QStringList fileNames = pathList.GetFileList();
|
||||||
|
|
||||||
mUI.mResults->Clear();
|
mUI.mResults->Clear(true);
|
||||||
mThread->ClearFiles();
|
mThread->ClearFiles();
|
||||||
|
|
||||||
if (fileNames.isEmpty()) {
|
if (fileNames.isEmpty()) {
|
||||||
|
@ -586,6 +586,9 @@ void MainWindow::ReCheck()
|
||||||
if (files.empty())
|
if (files.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Clear details, statistics and progress
|
||||||
|
mUI.mResults->Clear(false);
|
||||||
|
|
||||||
// Clear results for changed files
|
// Clear results for changed files
|
||||||
for (int i = 0; i < files.size(); ++i)
|
for (int i = 0; i < files.size(); ++i)
|
||||||
mUI.mResults->Clear(files[i]);
|
mUI.mResults->Clear(files[i]);
|
||||||
|
@ -601,7 +604,7 @@ void MainWindow::ReCheck()
|
||||||
|
|
||||||
void MainWindow::ClearResults()
|
void MainWindow::ClearResults()
|
||||||
{
|
{
|
||||||
mUI.mResults->Clear();
|
mUI.mResults->Clear(true);
|
||||||
mUI.mActionClearResults->setEnabled(false);
|
mUI.mActionClearResults->setEnabled(false);
|
||||||
mUI.mActionSave->setEnabled(false);
|
mUI.mActionSave->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -634,7 +637,7 @@ void MainWindow::OpenXML()
|
||||||
&selectedFilter);
|
&selectedFilter);
|
||||||
|
|
||||||
if (!selectedFile.isEmpty()) {
|
if (!selectedFile.isEmpty()) {
|
||||||
mUI.mResults->Clear();
|
mUI.mResults->Clear(true);
|
||||||
mUI.mResults->ReadErrorsXml(selectedFile);
|
mUI.mResults->ReadErrorsXml(selectedFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,11 +67,15 @@ ResultsView::~ResultsView()
|
||||||
//dtor
|
//dtor
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResultsView::Clear()
|
void ResultsView::Clear(bool results)
|
||||||
{
|
{
|
||||||
|
if (results) {
|
||||||
mUI.mTree->Clear();
|
mUI.mTree->Clear();
|
||||||
mUI.mDetails->setText("");
|
|
||||||
mErrorsFound = false;
|
mErrorsFound = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
mUI.mDetails->setText("");
|
||||||
|
|
||||||
mStatistics->Clear();
|
mStatistics->Clear();
|
||||||
|
|
||||||
//Clear the progressbar
|
//Clear the progressbar
|
||||||
|
@ -83,14 +87,13 @@ void ResultsView::Clear()
|
||||||
void ResultsView::Clear(const QString &filename)
|
void ResultsView::Clear(const QString &filename)
|
||||||
{
|
{
|
||||||
mUI.mTree->Clear(filename);
|
mUI.mTree->Clear(filename);
|
||||||
mUI.mDetails->setText("");
|
|
||||||
mErrorsFound = false;
|
|
||||||
mStatistics->Clear();
|
|
||||||
|
|
||||||
// Clear the progressbar
|
/**
|
||||||
mUI.mProgress->setMaximum(PROGRESS_MAX);
|
* @todo Optimize this.. It is inefficient to check this every time.
|
||||||
mUI.mProgress->setValue(0);
|
*/
|
||||||
mUI.mProgress->setFormat("%p%");
|
// If the results list got empty..
|
||||||
|
if (!mUI.mTree->HasResults())
|
||||||
|
mErrorsFound = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResultsView::Progress(int value, const QString& description)
|
void ResultsView::Progress(int value, const QString& description)
|
||||||
|
|
|
@ -59,13 +59,13 @@ public:
|
||||||
void ShowResults(ShowTypes::ShowType type, bool show);
|
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);
|
void Clear(const QString &filename);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue