forked from qt-creator/qt-creator
qds: extra code to handle license in about dialog
Change-Id: If9b493a4c9582b1fefac3dcaf31d34ef08eb6e6d Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -42,19 +42,23 @@ enum FoundLicense {
|
||||
enterprise
|
||||
};
|
||||
|
||||
FoundLicense checkLicense() {
|
||||
namespace Internal {
|
||||
ExtensionSystem::IPlugin *licenseCheckerPlugin()
|
||||
{
|
||||
const ExtensionSystem::PluginSpec *pluginSpec = Utils::findOrDefault(
|
||||
ExtensionSystem::PluginManager::plugins(),
|
||||
Utils::equal(&ExtensionSystem::PluginSpec::name, QString("LicenseChecker")));
|
||||
|
||||
if (!pluginSpec)
|
||||
return community;
|
||||
if (pluginSpec)
|
||||
return pluginSpec->plugin();
|
||||
return nullptr;
|
||||
}
|
||||
} // namespace Internal
|
||||
|
||||
ExtensionSystem::IPlugin *plugin = pluginSpec->plugin();
|
||||
|
||||
if (!plugin)
|
||||
return community;
|
||||
|
||||
FoundLicense checkLicense()
|
||||
{
|
||||
if (auto plugin = Internal::licenseCheckerPlugin()) {
|
||||
bool retVal = false;
|
||||
bool success = QMetaObject::invokeMethod(plugin,
|
||||
"qdsEnterpriseLicense",
|
||||
@@ -62,7 +66,24 @@ FoundLicense checkLicense() {
|
||||
Q_RETURN_ARG(bool, retVal));
|
||||
if (success && retVal)
|
||||
return enterprise;
|
||||
|
||||
else
|
||||
return professional;
|
||||
}
|
||||
return community;
|
||||
}
|
||||
|
||||
QString licensee()
|
||||
{
|
||||
if (auto plugin = Internal::licenseCheckerPlugin()) {
|
||||
QString retVal;
|
||||
bool success = QMetaObject::invokeMethod(plugin,
|
||||
"licensee",
|
||||
Qt::DirectConnection,
|
||||
Q_RETURN_ARG(QString, retVal));
|
||||
if (success)
|
||||
return retVal;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include "qmldesignerconstants.h"
|
||||
#include "qmldesignerprojectmanager.h"
|
||||
#include "settingspage.h"
|
||||
#include "dynamiclicensecheck.h"
|
||||
|
||||
#include <metainfo.h>
|
||||
#include <connectionview.h>
|
||||
@@ -312,14 +313,22 @@ bool QmlDesignerPlugin::delayedInitialize()
|
||||
d->viewManager.registerFormEditorTool(std::make_unique<QmlDesigner::TransitionTool>());
|
||||
|
||||
if (QmlProjectManager::QmlProject::isQtDesignStudio()) {
|
||||
d->mainWidget.initialize();
|
||||
|
||||
emitUsageStatistics("StandaloneMode");
|
||||
if (QmlProjectManager::QmlProject::isQtDesignStudioStartedFromQtC())
|
||||
emitUsageStatistics("QDSlaunchedFromQtC");
|
||||
emitUsageStatistics("QDSstartupCount");
|
||||
}
|
||||
|
||||
if (QmlProjectManager::QmlProject::isQtDesignStudio())
|
||||
d->mainWidget.initialize();
|
||||
FoundLicense license = checkLicense();
|
||||
if (license == FoundLicense::enterprise)
|
||||
Core::ICore::appendAboutInformation(tr("License: Enterprise"));
|
||||
else if (license == FoundLicense::professional)
|
||||
Core::ICore::appendAboutInformation(tr("License: Professional"));
|
||||
|
||||
if (!licensee().isEmpty())
|
||||
Core::ICore::appendAboutInformation(tr("Licensee: %1").arg(licensee()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user