From eca8e2faba320331a4ae5ad0e5ec3c9c55559144 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 28 Oct 2014 13:02:34 +0100 Subject: [PATCH] Add license validation with LicenseChecker plugin --- plugins/autotest/autotest_dependencies.pri | 3 ++- plugins/autotest/autotestplugin.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/autotest/autotest_dependencies.pri b/plugins/autotest/autotest_dependencies.pri index af150efd0c4..c5d76107a00 100644 --- a/plugins/autotest/autotest_dependencies.pri +++ b/plugins/autotest/autotest_dependencies.pri @@ -3,7 +3,8 @@ QTC_PLUGIN_NAME = AutoTest QTC_PLUGIN_DEPENDS += \ coreplugin \ projectexplorer \ - cpptools + cpptools \ + licensechecker QTC_LIB_DEPENDS += \ cplusplus \ diff --git a/plugins/autotest/autotestplugin.cpp b/plugins/autotest/autotestplugin.cpp index 7dcb029d905..065b561f5ff 100644 --- a/plugins/autotest/autotestplugin.cpp +++ b/plugins/autotest/autotestplugin.cpp @@ -30,6 +30,10 @@ #include #include +#include + +#include + #include #include #include @@ -66,6 +70,15 @@ bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorStri Q_UNUSED(arguments) Q_UNUSED(errorString) + LicenseChecker::LicenseCheckerPlugin *licenseChecker + = ExtensionSystem::PluginManager::getObject(); + + if (!licenseChecker || !licenseChecker->hasValidLicense()) { + qWarning() << "Invalid license, disabling Qt Creator Enterprise Auto Test Add-on."; + return true; + } else if (!licenseChecker->enterpriseFeatures()) + return true; + QAction *action = new QAction(tr("Autotest action"), this); Core::Command *cmd = Core::ActionManager::registerAction(action, Constants::ACTION_ID, Core::Context(Core::Constants::C_GLOBAL));