Commit 2cc47c20 authored by Tim Jenssen's avatar Tim Jenssen Committed by Christian Stenger
Browse files

move license check to a function



Change-Id: Idcb2c328f3313dac38997765c2569d6861d34a20
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent 6a4afc7d
......@@ -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);
......
......@@ -49,6 +49,7 @@ private slots:
void triggerAction();
private:
bool checkLicense();
const QSharedPointer<TestSettings> m_settings;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment