QmlDesigner: Do license check only once

We should only make the license check once.
An evaluationLicense is handled as enterprise license.

Change-Id: Ib4b53795a7d735c10b5238f1e7b76346a9bcc8e1
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2022-06-09 12:33:48 +02:00
parent a5d501d22e
commit ab635dd4b2

View File

@@ -37,6 +37,7 @@
namespace QmlDesigner { namespace QmlDesigner {
enum FoundLicense { enum FoundLicense {
noLicense,
community, community,
professional, professional,
enterprise enterprise
@@ -58,12 +59,28 @@ ExtensionSystem::IPlugin *licenseCheckerPlugin()
FoundLicense checkLicense() FoundLicense checkLicense()
{ {
static FoundLicense license = noLicense;
if (license != noLicense)
return license;
if (auto plugin = Internal::licenseCheckerPlugin()) { if (auto plugin = Internal::licenseCheckerPlugin()) {
bool retVal = false; bool retVal = false;
bool success = QMetaObject::invokeMethod(plugin, bool success = QMetaObject::invokeMethod(plugin,
"qdsEnterpriseLicense", "evaluationLicense",
Qt::DirectConnection, Qt::DirectConnection,
Q_RETURN_ARG(bool, retVal)); Q_RETURN_ARG(bool, retVal));
if (success && retVal)
return enterprise;
retVal = false;
success = QMetaObject::invokeMethod(plugin,
"qdsEnterpriseLicense",
Qt::DirectConnection,
Q_RETURN_ARG(bool, retVal));
if (success && retVal) if (success && retVal)
return enterprise; return enterprise;
else else