From c1c0dab2a9f5eded6fbec9e5adebf27a0bed6fbd Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 22 Feb 2022 11:10:15 +0100 Subject: Move dynamiclicensecheck.h to QmlDesigner Change-Id: Ic49a18a6ed164d3878e69d157edd83773c93959c Reviewed-by: hjk Reviewed-by: Qt CI Bot Reviewed-by: Thomas Hartmann Reviewed-by: --- src/libs/utils/CMakeLists.txt | 1 - src/libs/utils/dynamiclicensecheck.h | 68 ----------------------- src/plugins/qmldesigner/CMakeLists.txt | 1 + src/plugins/qmldesigner/dynamiclicensecheck.h | 68 +++++++++++++++++++++++ src/plugins/studiowelcome/studiowelcomeplugin.cpp | 10 ++-- 5 files changed, 74 insertions(+), 74 deletions(-) delete mode 100644 src/libs/utils/dynamiclicensecheck.h create mode 100644 src/plugins/qmldesigner/dynamiclicensecheck.h diff --git a/src/libs/utils/CMakeLists.txt b/src/libs/utils/CMakeLists.txt index 49e2ab648d..780f3e2017 100644 --- a/src/libs/utils/CMakeLists.txt +++ b/src/libs/utils/CMakeLists.txt @@ -34,7 +34,6 @@ add_qtc_library(Utils differ.cpp differ.h displayname.cpp displayname.h dropsupport.cpp dropsupport.h - dynamiclicensecheck.h elfreader.cpp elfreader.h elidinglabel.cpp elidinglabel.h environment.cpp environment.h diff --git a/src/libs/utils/dynamiclicensecheck.h b/src/libs/utils/dynamiclicensecheck.h deleted file mode 100644 index 634c6b28d1..0000000000 --- a/src/libs/utils/dynamiclicensecheck.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2022 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include -#include -#include - -#include -#include - -#include - -namespace Utils { - -enum FoundLicense { - community, - professional, - enterprise -}; - -FoundLicense checkLicense() { - const ExtensionSystem::PluginSpec *pluginSpec = Utils::findOrDefault( - ExtensionSystem::PluginManager::plugins(), - Utils::equal(&ExtensionSystem::PluginSpec::name, QString("LicenseChecker"))); - - if (!pluginSpec) - return community; - - 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 Utils diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt index 742b6f055c..bee619026a 100644 --- a/src/plugins/qmldesigner/CMakeLists.txt +++ b/src/plugins/qmldesigner/CMakeLists.txt @@ -32,6 +32,7 @@ add_qtc_plugin(QmlDesigner cmakegeneratordialogtreemodel.cpp cmakegeneratordialogtreemodel.h cmakeprojectconverter.cpp cmakeprojectconverter.h cmakeprojectconverterdialog.cpp cmakeprojectconverterdialog.h + dynamiclicensecheck.h generateresource.cpp generateresource.h generatecmakelists.cpp generatecmakelists.h generatecmakelistsconstants.h diff --git a/src/plugins/qmldesigner/dynamiclicensecheck.h b/src/plugins/qmldesigner/dynamiclicensecheck.h new file mode 100644 index 0000000000..8cc7982895 --- /dev/null +++ b/src/plugins/qmldesigner/dynamiclicensecheck.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include +#include +#include + +#include +#include + +#include + +namespace QmlDesigner { + +enum FoundLicense { + community, + professional, + enterprise +}; + +FoundLicense checkLicense() { + const ExtensionSystem::PluginSpec *pluginSpec = Utils::findOrDefault( + ExtensionSystem::PluginManager::plugins(), + Utils::equal(&ExtensionSystem::PluginSpec::name, QString("LicenseChecker"))); + + if (!pluginSpec) + return community; + + 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 Utils diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp index 72f6afcdb5..8e38dccc6b 100644 --- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp +++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp @@ -46,8 +46,9 @@ #include -#include #include +#include +#include #include #include @@ -56,7 +57,6 @@ #include #include #include -#include #include #include @@ -300,9 +300,9 @@ private: void ProjectModel::setupVersion() { - Utils::FoundLicense license = Utils::checkLicense(); - m_communityVersion = license == Utils::FoundLicense::community; - m_enterpriseVersion = license == Utils::FoundLicense::enterprise; + QmlDesigner::FoundLicense license = QmlDesigner::checkLicense(); + m_communityVersion = license == QmlDesigner::FoundLicense::community; + m_enterpriseVersion = license == QmlDesigner::FoundLicense::enterprise; } ProjectModel::ProjectModel(QObject *parent) -- cgit v1.2.1