From 6b9d9188c9f1cefdac59d6ef54ebd2099c14b7a5 Mon Sep 17 00:00:00 2001 From: Zachary Blair Date: Wed, 24 Nov 2010 00:48:07 -0800 Subject: [PATCH] Fixed #1861 (GUI: Allow hiding error) Disabled menu item when not applicable --- gui/main.ui | 3 +++ gui/mainwindow.cpp | 1 + gui/resultstree.cpp | 2 ++ gui/resultstree.h | 9 +++++++++ gui/resultsview.cpp | 2 ++ gui/resultsview.h | 6 ++++++ 6 files changed, 23 insertions(+) diff --git a/gui/main.ui b/gui/main.ui index c6600c14d..675d284e6 100644 --- a/gui/main.ui +++ b/gui/main.ui @@ -464,6 +464,9 @@ + + false + Show &hidden diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 63be090a7..e17fe89a4 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -86,6 +86,7 @@ MainWindow::MainWindow() : connect(mUI.mActionAuthors, SIGNAL(triggered()), this, SLOT(ShowAuthors())); connect(mThread, SIGNAL(Done()), this, SLOT(CheckDone())); connect(mUI.mResults, SIGNAL(GotResults()), this, SLOT(ResultsAdded())); + connect(mUI.mResults, SIGNAL(ResultsHidden(bool)), mUI.mActionShowHidden, SLOT(setEnabled(bool))); connect(mUI.mMenuView, SIGNAL(aboutToShow()), this, SLOT(AboutToShowViewMenu())); connect(mUI.mActionNewProjectFile, SIGNAL(triggered()), this, SLOT(NewProjectFile())); diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index 48784b95d..a4f75d635 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -341,6 +341,7 @@ void ResultsTree::ShowHiddenResults() } } RefreshTree(); + emit ResultsHidden(false); } @@ -670,6 +671,7 @@ void ResultsTree::HideResult() mContextItem->setData(QVariant(data)); RefreshTree(); + emit ResultsHidden(true); } } diff --git a/gui/resultstree.h b/gui/resultstree.h index 3c807f4ca..971b8969b 100644 --- a/gui/resultstree.h +++ b/gui/resultstree.h @@ -122,6 +122,15 @@ public: * */ void Translate(); + +signals: + /** + * @brief Signal that results have been hidden or shown + * + * @param hidden true if there are some hidden results, or false if there are not + */ + void ResultsHidden(bool hidden); + protected slots: /** * @brief Slot to quickstart an error with default application diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index 12786743c..e067a4a08 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -33,6 +33,8 @@ ResultsView::ResultsView(QWidget * parent) : mShowNoErrorsMessage(true) { mUI.setupUi(this); + + connect(mUI.mTree, SIGNAL(ResultsHidden(bool)), this, SIGNAL(ResultsHidden(bool))); } void ResultsView::Initialize(QSettings *settings, ApplicationList *list) diff --git a/gui/resultsview.h b/gui/resultsview.h index 59ac1f7d6..f390e7358 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -146,6 +146,12 @@ signals: */ void GotResults(); + /** + * @brief Signal that results have been hidden or shown + * + * @param hidden true if there are some hidden results, or false if there are not + */ + void ResultsHidden(bool hidden); public slots: