@@ -171,7 +171,7 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
171171 connect (mUI ->mActionAnalyzeFiles , &QAction::triggered, this , &MainWindow::analyzeFiles);
172172 connect (mUI ->mActionAnalyzeDirectory , &QAction::triggered, this , &MainWindow::analyzeDirectory);
173173 connect (mUI ->mActionSettings , &QAction::triggered, this , &MainWindow::programSettings);
174- connect (mUI ->mActionClearResults , &QAction::triggered, this , &MainWindow:: clearResults);
174+ connect (mUI ->mActionClearResults , &QAction::triggered, this , [ this ]() { clearResults (); } );
175175 connect (mUI ->mActionOpenXML , &QAction::triggered, this , &MainWindow::openResults);
176176
177177 connect (mUI ->mActionShowStyle , &QAction::toggled, this , &MainWindow::showStyle);
@@ -582,7 +582,7 @@ void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLib, const bo
582582 });
583583 }
584584
585- clearResults ();
585+ clearResults (recheckFiles );
586586
587587 mIsLogfileLoaded = false ;
588588 if (mProjectFile ) {
@@ -628,7 +628,7 @@ void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLib, const bo
628628 if (!checkSettings.buildDir .empty ()) {
629629 checkSettings.loadSummaries ();
630630 std::list<std::string> sourcefiles;
631- AnalyzerInformation::writeFilesTxt (checkSettings.buildDir , sourcefiles, p.fileSettings );
631+ AnalyzerInformation::writeFilesTxt (checkSettings.buildDir , sourcefiles, p.fileSettings , !recheckFiles. isEmpty () );
632632 }
633633
634634 // mThread->SetanalyzeProject(true);
@@ -647,7 +647,7 @@ void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLib, const bo
647647 mUI ->mResults ->setCheckSettings (checkSettings);
648648}
649649
650- void MainWindow::doAnalyzeFiles (const QStringList &files, const bool checkLib, const bool checkConfig)
650+ void MainWindow::doAnalyzeFiles (const QStringList &files, const bool checkLib, const bool checkConfig, const bool partialRecheck )
651651{
652652 if (files.isEmpty ())
653653 return ;
@@ -657,7 +657,7 @@ void MainWindow::doAnalyzeFiles(const QStringList &files, const bool checkLib, c
657657 if (!getCppcheckSettings (checkSettings, *supprs))
658658 return ;
659659
660- clearResults ();
660+ clearResults (partialRecheck ? files : QStringList () );
661661
662662 mIsLogfileLoaded = false ;
663663 FileList pathList;
@@ -669,7 +669,6 @@ void MainWindow::doAnalyzeFiles(const QStringList &files, const bool checkLib, c
669669 }
670670 QStringList fileNames = pathList.getFileList ();
671671
672- mUI ->mResults ->clear (true );
673672 mUI ->mResults ->setResultsSource (ResultsTree::ResultsSource::Analysis);
674673 mThread ->clearFiles ();
675674
@@ -707,7 +706,7 @@ void MainWindow::doAnalyzeFiles(const QStringList &files, const bool checkLib, c
707706 if (!checkSettings.buildDir .empty ()) {
708707 checkSettings.loadSummaries ();
709708 const auto & sourcefiles = toStdStringList<std::list<std::string>>(fileNames);
710- AnalyzerInformation::writeFilesTxt (checkSettings.buildDir , sourcefiles, {});
709+ AnalyzerInformation::writeFilesTxt (checkSettings.buildDir , sourcefiles, {}, partialRecheck );
711710 }
712711
713712 mThread ->setCheckFiles (true );
@@ -1448,8 +1447,14 @@ void MainWindow::reAnalyze(bool all)
14481447 mUI ->mResults ->setCheckSettings (checkSettings);
14491448}
14501449
1451- void MainWindow::clearResults ()
1450+ void MainWindow::clearResults (const QStringList& selectedFiles )
14521451{
1452+ if (!selectedFiles.isEmpty ()) {
1453+ mUI ->mResults ->clear (false );
1454+ for (QString f : selectedFiles)
1455+ mUI ->mResults ->clearRecheckFile (f);
1456+ return ;
1457+ }
14531458 if (mProjectFile && !mProjectFile ->getBuildDir ().isEmpty ()) {
14541459 QDir dir (QFileInfo (mProjectFile ->getFilename ()).absolutePath () + ' /' + mProjectFile ->getBuildDir ());
14551460 for (const QString& f: dir.entryList (QDir::Files)) {
@@ -1981,7 +1986,7 @@ void MainWindow::analyzeProject(const ProjectFile *projectFile, const QStringLis
19811986 if (paths.isEmpty ()) {
19821987 paths << mCurrentDirectory ;
19831988 }
1984- doAnalyzeFiles (paths, checkLib, checkConfig);
1989+ doAnalyzeFiles (paths, checkLib, checkConfig, !recheckFiles. isEmpty () );
19851990}
19861991
19871992void MainWindow::newProjectFile ()
0 commit comments