forked from qt-creator/qt-creator
move license check to a function
Change-Id: Idcb2c328f3313dac38997765c2569d6861d34a20 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
committed by
Christian Stenger
parent
6a4afc7d5f
commit
2cc47c2039
@@ -70,6 +70,19 @@ AutotestPlugin *AutotestPlugin::instance()
|
|||||||
return m_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)
|
bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||||
{
|
{
|
||||||
// Register objects in the plugin manager's object pool
|
// 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(arguments)
|
||||||
Q_UNUSED(errorString)
|
Q_UNUSED(errorString)
|
||||||
|
|
||||||
LicenseChecker::LicenseCheckerPlugin *licenseChecker
|
if (!checkLicense())
|
||||||
= 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())
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
QAction *action = new QAction(tr("Autotest action"), this);
|
QAction *action = new QAction(tr("Autotest action"), this);
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ private slots:
|
|||||||
void triggerAction();
|
void triggerAction();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool checkLicense();
|
||||||
const QSharedPointer<TestSettings> m_settings;
|
const QSharedPointer<TestSettings> m_settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user