forked from qt-creator/qt-creator
Add license validation with LicenseChecker plugin
This commit is contained in:
committed by
Christian Stenger
parent
eba497d921
commit
eca8e2faba
@@ -3,7 +3,8 @@ QTC_PLUGIN_NAME = AutoTest
|
||||
QTC_PLUGIN_DEPENDS += \
|
||||
coreplugin \
|
||||
projectexplorer \
|
||||
cpptools
|
||||
cpptools \
|
||||
licensechecker
|
||||
|
||||
QTC_LIB_DEPENDS += \
|
||||
cplusplus \
|
||||
|
@@ -30,6 +30,10 @@
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <licensechecker/licensecheckerplugin.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
#include <QMainWindow>
|
||||
@@ -66,6 +70,15 @@ 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())
|
||||
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));
|
||||
|
Reference in New Issue
Block a user