From 86b78bde5d95ad9f4476d53c9ac6af26ca5f2504 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 13 Mar 2018 10:04:46 +0100 Subject: [PATCH] AutoTest: Allow framework specific tool tip on settings The grouping checkbox enables grouping, but frameworks can have more grouping modes than the default implementation. Allow frameworks to provide its own tool tip for the checkbox on the general settings page. Change-Id: I0515e542284491a669ef33820104a32074ecf885 Reviewed-by: Leena Miettinen Reviewed-by: David Schulz --- src/plugins/autotest/gtest/gtestframework.cpp | 7 +++++++ src/plugins/autotest/gtest/gtestframework.h | 1 + src/plugins/autotest/itestframework.h | 3 ++- src/plugins/autotest/testframeworkmanager.cpp | 7 +++++++ src/plugins/autotest/testframeworkmanager.h | 1 + src/plugins/autotest/testsettingspage.cpp | 5 ++++- 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/plugins/autotest/gtest/gtestframework.cpp b/src/plugins/autotest/gtest/gtestframework.cpp index 682a66f5475..d173a5ee8db 100644 --- a/src/plugins/autotest/gtest/gtestframework.cpp +++ b/src/plugins/autotest/gtest/gtestframework.cpp @@ -81,6 +81,13 @@ QString GTestFramework::currentGTestFilter() return gSettings.isNull() ? QString("*.*") : gSettings->gtestFilter; } +QString GTestFramework::groupingToolTip() const +{ + return QCoreApplication::translate("GTestFramework", + "Enable or disable grouping of test cases by folder or " + "gtest filter.\nSee also Google Test settings."); +} + GTest::Constants::GroupMode GTestFramework::groupMode() { static const Core::Id id diff --git a/src/plugins/autotest/gtest/gtestframework.h b/src/plugins/autotest/gtest/gtestframework.h index 754bd9e3fb5..7e94884933b 100644 --- a/src/plugins/autotest/gtest/gtestframework.h +++ b/src/plugins/autotest/gtest/gtestframework.h @@ -42,6 +42,7 @@ public: bool hasFrameworkSettings() const override; static GTest::Constants::GroupMode groupMode(); static QString currentGTestFilter(); + QString groupingToolTip() const override; protected: ITestParser *createTestParser() const override; TestTreeItem *createRootNode() const override; diff --git a/src/plugins/autotest/itestframework.h b/src/plugins/autotest/itestframework.h index 67778f13753..ec24bfa3a08 100644 --- a/src/plugins/autotest/itestframework.h +++ b/src/plugins/autotest/itestframework.h @@ -71,7 +71,8 @@ public: void setActive(bool active) { m_active = active; } bool grouping() const { return m_grouping; } void setGrouping(bool group) { m_grouping = group; } - + // framework specific tool tip to be displayed on the general settings page + virtual QString groupingToolTip() const { return QString(); } protected: virtual ITestParser *createTestParser() const = 0; virtual TestTreeItem *createRootNode() const = 0; diff --git a/src/plugins/autotest/testframeworkmanager.cpp b/src/plugins/autotest/testframeworkmanager.cpp index 0d8b5a723e9..07a898b7c80 100644 --- a/src/plugins/autotest/testframeworkmanager.cpp +++ b/src/plugins/autotest/testframeworkmanager.cpp @@ -194,6 +194,13 @@ void TestFrameworkManager::setGroupingEnabledFor(const Core::Id &frameworkId, bo framework->setGrouping(enabled); } +QString TestFrameworkManager::groupingToolTip(const Core::Id &frameworkId) const +{ + if (ITestFramework *framework = m_registeredFrameworks.value(frameworkId)) + return framework->groupingToolTip(); + return QString(); +} + bool TestFrameworkManager::hasActiveFrameworks() const { for (ITestFramework *framework : m_registeredFrameworks.values()) { diff --git a/src/plugins/autotest/testframeworkmanager.h b/src/plugins/autotest/testframeworkmanager.h index 3b8c5d4e9fb..27532020247 100644 --- a/src/plugins/autotest/testframeworkmanager.h +++ b/src/plugins/autotest/testframeworkmanager.h @@ -67,6 +67,7 @@ public: bool isActive(const Core::Id &frameworkId) const; bool groupingEnabled(const Core::Id &frameworkId) const; void setGroupingEnabledFor(const Core::Id &frameworkId, bool enabled); + QString groupingToolTip(const Core::Id &frameworkId) const; bool hasActiveFrameworks() const; private: diff --git a/src/plugins/autotest/testsettingspage.cpp b/src/plugins/autotest/testsettingspage.cpp index c054f612104..4c3b4654e74 100644 --- a/src/plugins/autotest/testsettingspage.cpp +++ b/src/plugins/autotest/testsettingspage.cpp @@ -184,7 +184,10 @@ void TestSettingsWidget::populateFrameworksListWidget(const QHashsetToolTip(0, tr("Enable or disable test frameworks to be handled by the AutoTest " "plugin.")); - item->setToolTip(1, tr("Enable or disable grouping of test cases by folder.")); + QString toolTip = frameworkManager->groupingToolTip(id); + if (toolTip.isEmpty()) + toolTip = tr("Enable or disable grouping of test cases by folder."); + item->setToolTip(1, toolTip); } }