From 0792d89a6b8133659e966ff05f69713708f280d6 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Sat, 20 Jun 2009 23:05:17 +0300 Subject: [PATCH] GUI: Disable result cleaning and saving during the checking. --- gui/mainwindow.cpp | 7 +++++-- gui/resultstree.cpp | 2 +- gui/resultstree.h | 6 +++--- gui/resultsview.cpp | 7 +++++-- gui/resultsview.h | 8 ++++++++ 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index f269abdbc..67b62106f 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -348,6 +348,11 @@ QStringList MainWindow::RemoveUnacceptedFiles(const QStringList &list) void MainWindow::CheckDone() { EnableCheckButtons(true); + if (mResults.HasVisibleResults()) + { + mActionClearResults.setEnabled(true); + mActionSave.setEnabled(true); + } } void MainWindow::ProgramSettings() @@ -522,6 +527,4 @@ void MainWindow::Save() void MainWindow::ResultsAdded() { - mActionClearResults.setEnabled(true); - mActionSave.setEnabled(true); } diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index b8b3fafa0..5d1068962 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -774,7 +774,7 @@ void ResultsTree::RefreshFilePaths() } } -bool ResultsTree::VisibleErrors() +bool ResultsTree::HasVisibleResults() const { return mVisibleErrors; } diff --git a/gui/resultstree.h b/gui/resultstree.h index de3b1d8bc..c77e071a3 100644 --- a/gui/resultstree.h +++ b/gui/resultstree.h @@ -95,10 +95,10 @@ public: void SetCheckDirectory(const QString &dir); /** - * @brief Check if there are any visible errors - * @return true if there is at least one visible error + * @brief Check if there are any visible results in view. + * @return true if there is at least one visible warning/error. */ - bool VisibleErrors(); + bool HasVisibleResults() const; protected slots: /** diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index 798daec04..5160b9718 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -80,7 +80,7 @@ void ResultsView::Progress(int value, int max) msg.exec(); } //If we have errors but they aren't visible, tell user about it - else if (!mTree->VisibleErrors()) + else if (!mTree->HasVisibleResults()) { QString text = tr("Errors were found, but they are configured to be hidden.\n"\ "To toggle what kind of errors are shown, open view menu."); @@ -166,4 +166,7 @@ void ResultsView::CheckingStarted() mProgress->setVisible(true); } - +bool ResultsView::HasVisibleResults() const +{ + return mTree->HasVisibleResults(); +} diff --git a/gui/resultsview.h b/gui/resultsview.h index de1719549..7bbcb7ce0 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -89,6 +89,14 @@ public: * At the moment this only displays the progressbar */ void CheckingStarted(); + + /** + * @brief Do we have visible results to show? + * + * @return true if there is at least one warning/error to show. + */ + bool HasVisibleResults() const; + signals: /**