diff --git a/gui/gui.qrc b/gui/gui.qrc index c6d12b84c..12eb6312b 100644 --- a/gui/gui.qrc +++ b/gui/gui.qrc @@ -11,6 +11,7 @@ images/preferences-system.png images/process-stop.png images/text-x-generic.png + images/view-recheck.png images/view-refresh.png images/showerrors.png images/showstylewarnings.png diff --git a/gui/images/view-recheck.png b/gui/images/view-recheck.png new file mode 100644 index 000000000..caebff48a Binary files /dev/null and b/gui/images/view-recheck.png differ diff --git a/gui/images/view-refresh.png b/gui/images/view-refresh.png index caebff48a..a8b3d7b6b 100644 Binary files a/gui/images/view-refresh.png and b/gui/images/view-refresh.png differ diff --git a/gui/main.ui b/gui/main.ui index d8c094ce6..a6daa7f0a 100644 --- a/gui/main.ui +++ b/gui/main.ui @@ -148,7 +148,8 @@ - + + @@ -188,7 +189,8 @@ - + + @@ -273,18 +275,27 @@ Ctrl+D - + :/images/view-refresh.png:/images/view-refresh.png - &Recheck files + &Recheck modified files Ctrl+R + + + + :/images/view-recheck.png:/images/view-recheck.png + + + &Recheck all files + + diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 79f26c649..a65f2b4c4 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -103,7 +103,8 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) : connect(mUI.mActionViewStats, SIGNAL(triggered()), this, SLOT(ShowStatistics())); connect(mUI.mActionLibraryEditor, SIGNAL(triggered()), this, SLOT(ShowLibraryEditor())); - connect(mUI.mActionRecheck, SIGNAL(triggered()), this, SLOT(ReCheck())); + connect(mUI.mActionRecheckModified, SIGNAL(triggered()), this, SLOT(ReCheckModified())); + connect(mUI.mActionRecheckAll, SIGNAL(triggered()), this, SLOT(ReCheckAll())); connect(mUI.mActionStop, SIGNAL(triggered()), this, SLOT(StopChecking())); connect(mUI.mActionSave, SIGNAL(triggered()), this, SLOT(Save())); @@ -144,7 +145,8 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) : mUI.mActionPrintPreview->setEnabled(false); mUI.mActionClearResults->setEnabled(false); mUI.mActionSave->setEnabled(false); - mUI.mActionRecheck->setEnabled(false); + mUI.mActionRecheckModified->setEnabled(false); + mUI.mActionRecheckAll->setEnabled(false); EnableProjectOpenActions(true); EnableProjectActions(false); @@ -776,14 +778,24 @@ void MainWindow::ProgramSettings() } } -void MainWindow::ReCheck() +void MainWindow::ReCheckModified() { - const QStringList files = mThread->GetReCheckFiles(); + ReCheck(false); +} + +void MainWindow::ReCheckAll() +{ + ReCheck(true); +} + +void MainWindow::ReCheck(bool all) +{ + const QStringList files = mThread->GetReCheckFiles(all); if (files.empty()) return; // Clear details, statistics and progress - mUI.mResults->Clear(false); + mUI.mResults->Clear(all); // Clear results for changed files for (int i = 0; i < files.size(); ++i) @@ -795,7 +807,7 @@ void MainWindow::ReCheck() if (mProject) qDebug() << "Rechecking project file" << mProject->GetProjectFile()->GetFilename(); - mThread->Check(GetCppcheckSettings(), true); + mThread->Check(GetCppcheckSettings(), !all); } void MainWindow::ClearResults() @@ -859,8 +871,10 @@ void MainWindow::EnableCheckButtons(bool enable) mUI.mActionStop->setEnabled(!enable); mUI.mActionCheckFiles->setEnabled(enable); - if (!enable || mThread->HasPreviousFiles()) - mUI.mActionRecheck->setEnabled(enable); + if (!enable || mThread->HasPreviousFiles()) { + mUI.mActionRecheckModified->setEnabled(enable); + mUI.mActionRecheckAll->setEnabled(enable); + } mUI.mActionCheckDirectory->setEnabled(enable); } diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 681aa0e29..94e8d15c2 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -79,10 +79,16 @@ public slots: void CheckFiles(); /** - * @brief Slot to recheck files + * @brief Slot to recheck all files * */ - void ReCheck(); + void ReCheckAll(); + + /** + * @brief Slot to recheck modified files + * + */ + void ReCheckModified(); /** * @brief Slot to clear all search results @@ -307,6 +313,12 @@ protected slots: private: + /** + * @brief Rechecks files + * + */ + void ReCheck(bool all); + /** * @brief Check the project. * @param project Pointer to the project to check. diff --git a/gui/threadhandler.cpp b/gui/threadhandler.cpp index 89961e4b8..e786d7772 100644 --- a/gui/threadhandler.cpp +++ b/gui/threadhandler.cpp @@ -55,7 +55,7 @@ void ThreadHandler::Check(const Settings &settings, bool recheck) { if (recheck && mRunningThreadCount == 0) { // only recheck changed files - mResults.SetFiles(GetReCheckFiles()); + mResults.SetFiles(GetReCheckFiles(false)); } if (mResults.GetFileCount() == 0 || mRunningThreadCount > 0 || settings._jobs == 0) { @@ -188,7 +188,7 @@ int ThreadHandler::GetPreviousScanDuration() const return mScanDuration; } -QStringList ThreadHandler::GetReCheckFiles() const +QStringList ThreadHandler::GetReCheckFiles(bool all) const { if (mLastCheckTime.isNull()) return mLastFiles; diff --git a/gui/threadhandler.h b/gui/threadhandler.h index 09225cc0d..0b7a530dd 100644 --- a/gui/threadhandler.h +++ b/gui/threadhandler.h @@ -123,7 +123,7 @@ public: * @brief Get files that should be rechecked because they have been * changed. */ - QStringList GetReCheckFiles() const; + QStringList GetReCheckFiles(bool all) const; signals: /**