From 8e0f868a5e3252e8f48d5b8a7be7d2b9155b7328 Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Tue, 13 Oct 2009 11:19:00 +0300 Subject: [PATCH] Fix #455 (Recheck is enabled when no previous results available) http://sourceforge.net/apps/trac/cppcheck/ticket/455 --- gui/mainwindow.cpp | 6 +++++- gui/threadhandler.cpp | 7 +++++++ gui/threadhandler.h | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 112b10262..ef27c0fcc 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -89,6 +89,7 @@ MainWindow::MainWindow() : mUI.mActionClearResults->setEnabled(false); mUI.mActionSave->setEnabled(false); + mUI.mActionRecheck->setEnabled(false); @@ -419,7 +420,10 @@ void MainWindow::EnableCheckButtons(bool enable) { mUI.mActionStop->setEnabled(!enable); mUI.mActionCheckFiles->setEnabled(enable); - mUI.mActionRecheck->setEnabled(enable); + + if (!enable || mThread->HasPreviousFiles()) + mUI.mActionRecheck->setEnabled(enable); + mUI.mActionCheckDirectory->setEnabled(enable); } diff --git a/gui/threadhandler.cpp b/gui/threadhandler.cpp index 0c18f0b62..8f6ea916c 100644 --- a/gui/threadhandler.cpp +++ b/gui/threadhandler.cpp @@ -166,3 +166,10 @@ void ThreadHandler::SaveSettings(QSettings &settings) settings.setValue(SETTINGS_CHECK_THREADS, mThreads.size()); } +bool ThreadHandler::HasPreviousFiles() const +{ + if (mLastFiles.size() > 0) + return true; + + return false; +} diff --git a/gui/threadhandler.h b/gui/threadhandler.h index d90dace28..b8ce9c6bf 100644 --- a/gui/threadhandler.h +++ b/gui/threadhandler.h @@ -96,6 +96,13 @@ public: */ bool IsChecking() const; + /** + * @brief Have we checked files already? + * + * @return true check has been previously run and recheck can be done + */ + bool HasPreviousFiles() const; + signals: /** * @brief Signal that all threads are done