diff --git a/plugins/autotest/autotestplugin.cpp b/plugins/autotest/autotestplugin.cpp index 2abcebbb801..7823fdef2c0 100644 --- a/plugins/autotest/autotestplugin.cpp +++ b/plugins/autotest/autotestplugin.cpp @@ -70,6 +70,19 @@ AutotestPlugin *AutotestPlugin::instance() return m_instance; } +bool AutotestPlugin::checkLicense() +{ + LicenseChecker::LicenseCheckerPlugin *licenseChecker + = ExtensionSystem::PluginManager::getObject(); + + if (!licenseChecker || !licenseChecker->hasValidLicense()) { + qWarning() << "Invalid license, disabling Qt Creator Enterprise Auto Test Add-on."; + return false; + } else if (!licenseChecker->enterpriseFeatures()) + return false; + return true; +} + bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorString) { // Register objects in the plugin manager's object pool @@ -82,13 +95,7 @@ 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()) + if (!checkLicense()) return true; QAction *action = new QAction(tr("Autotest action"), this); diff --git a/plugins/autotest/autotestplugin.h b/plugins/autotest/autotestplugin.h index 6d5365ddeea..5f761264a2d 100644 --- a/plugins/autotest/autotestplugin.h +++ b/plugins/autotest/autotestplugin.h @@ -49,6 +49,7 @@ private slots: void triggerAction(); private: + bool checkLicense(); const QSharedPointer m_settings; };