diff options
author | Tim Jenssen <tim.jenssen@theqtcompany.com> | 2014-12-18 17:35:25 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@theqtcompany.com> | 2015-01-06 14:51:13 +0200 |
commit | 2cc47c2039c4b78c2f14b268ef156afd90255843 (patch) | |
tree | ff106da6de559f6ab0947c2f5d63e22740623eb9 | |
parent | 6a4afc7d5f8bb90582fa0e6e68c97448ded29b79 (diff) | |
download | qt-creator-2cc47c2039c4b78c2f14b268ef156afd90255843.tar.gz |
move license check to a function
Change-Id: Idcb2c328f3313dac38997765c2569d6861d34a20
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
-rw-r--r-- | plugins/autotest/autotestplugin.cpp | 21 | ||||
-rw-r--r-- | plugins/autotest/autotestplugin.h | 1 |
2 files changed, 15 insertions, 7 deletions
diff --git a/plugins/autotest/autotestplugin.cpp b/plugins/autotest/autotestplugin.cpp index 2abcebbb80..7823fdef2c 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<LicenseChecker::LicenseCheckerPlugin>(); + + 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<LicenseChecker::LicenseCheckerPlugin>(); - - 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 6d5365ddee..5f761264a2 100644 --- a/plugins/autotest/autotestplugin.h +++ b/plugins/autotest/autotestplugin.h @@ -49,6 +49,7 @@ private slots: void triggerAction(); private: + bool checkLicense(); const QSharedPointer<TestSettings> m_settings; }; |