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,27 +42,48 @@ enum FoundLicense {
|
|||||||
enterprise
|
enterprise
|
||||||
};
|
};
|
||||||
|
|
||||||
FoundLicense checkLicense() {
|
namespace Internal {
|
||||||
|
ExtensionSystem::IPlugin *licenseCheckerPlugin()
|
||||||
|
{
|
||||||
const ExtensionSystem::PluginSpec *pluginSpec = Utils::findOrDefault(
|
const ExtensionSystem::PluginSpec *pluginSpec = Utils::findOrDefault(
|
||||||
ExtensionSystem::PluginManager::plugins(),
|
ExtensionSystem::PluginManager::plugins(),
|
||||||
Utils::equal(&ExtensionSystem::PluginSpec::name, QString("LicenseChecker")));
|
Utils::equal(&ExtensionSystem::PluginSpec::name, QString("LicenseChecker")));
|
||||||
|
|
||||||
if (!pluginSpec)
|
if (pluginSpec)
|
||||||
return community;
|
return pluginSpec->plugin();
|
||||||
|
return nullptr;
|
||||||
ExtensionSystem::IPlugin *plugin = pluginSpec->plugin();
|
|
||||||
|
|
||||||
if (!plugin)
|
|
||||||
return community;
|
|
||||||
|
|
||||||
bool retVal = false;
|
|
||||||
bool success = QMetaObject::invokeMethod(plugin,
|
|
||||||
"qdsEnterpriseLicense",
|
|
||||||
Qt::DirectConnection,
|
|
||||||
Q_RETURN_ARG(bool, retVal));
|
|
||||||
if (success && retVal)
|
|
||||||
return enterprise;
|
|
||||||
|
|
||||||
return professional;
|
|
||||||
}
|
}
|
||||||
|
} // namespace Internal
|
||||||
|
|
||||||
|
|
||||||
|
FoundLicense checkLicense()
|
||||||
|
{
|
||||||
|
if (auto plugin = Internal::licenseCheckerPlugin()) {
|
||||||
|
bool retVal = false;
|
||||||
|
bool success = QMetaObject::invokeMethod(plugin,
|
||||||
|
"qdsEnterpriseLicense",
|
||||||
|
Qt::DirectConnection,
|
||||||
|
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
|
} // namespace Utils
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
#include "qmldesignerconstants.h"
|
#include "qmldesignerconstants.h"
|
||||||
#include "qmldesignerprojectmanager.h"
|
#include "qmldesignerprojectmanager.h"
|
||||||
#include "settingspage.h"
|
#include "settingspage.h"
|
||||||
|
#include "dynamiclicensecheck.h"
|
||||||
|
|
||||||
#include <metainfo.h>
|
#include <metainfo.h>
|
||||||
#include <connectionview.h>
|
#include <connectionview.h>
|
||||||
@@ -312,14 +313,22 @@ bool QmlDesignerPlugin::delayedInitialize()
|
|||||||
d->viewManager.registerFormEditorTool(std::make_unique<QmlDesigner::TransitionTool>());
|
d->viewManager.registerFormEditorTool(std::make_unique<QmlDesigner::TransitionTool>());
|
||||||
|
|
||||||
if (QmlProjectManager::QmlProject::isQtDesignStudio()) {
|
if (QmlProjectManager::QmlProject::isQtDesignStudio()) {
|
||||||
|
d->mainWidget.initialize();
|
||||||
|
|
||||||
emitUsageStatistics("StandaloneMode");
|
emitUsageStatistics("StandaloneMode");
|
||||||
if (QmlProjectManager::QmlProject::isQtDesignStudioStartedFromQtC())
|
if (QmlProjectManager::QmlProject::isQtDesignStudioStartedFromQtC())
|
||||||
emitUsageStatistics("QDSlaunchedFromQtC");
|
emitUsageStatistics("QDSlaunchedFromQtC");
|
||||||
emitUsageStatistics("QDSstartupCount");
|
emitUsageStatistics("QDSstartupCount");
|
||||||
}
|
|
||||||
|
|
||||||
if (QmlProjectManager::QmlProject::isQtDesignStudio())
|
FoundLicense license = checkLicense();
|
||||||
d->mainWidget.initialize();
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user