aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2024-02-02 18:40:04 +0100
committerTim Jenssen <tim.jenssen@qt.io>2024-02-07 10:44:11 +0000
commit87dd0096b43fc8a8a413c872f82262ac1d391058 (patch)
treeff02c7a8da6424cd82158311981066fed8bed6af
parente43b0bcc1fb9c25b3f8a2052bae3c93bb19c8fc8 (diff)
QmlDesigner: Disable share button in open source version
Task-number: QDS-11627 Change-Id: I3eb21fa84b6993aa783713ef5fa3beba1e3e030e Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
-rw-r--r--share/qtcreator/qmldesigner/toolbar/Main.qml4
-rw-r--r--src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp10
-rw-r--r--src/plugins/qmldesigner/components/toolbar/toolbarbackend.h4
-rw-r--r--src/plugins/qmldesigner/dynamiclicensecheck.h19
4 files changed, 35 insertions, 2 deletions
diff --git a/share/qtcreator/qmldesigner/toolbar/Main.qml b/share/qtcreator/qmldesigner/toolbar/Main.qml
index af83887832..294422df3e 100644
--- a/share/qtcreator/qmldesigner/toolbar/Main.qml
+++ b/share/qtcreator/qmldesigner/toolbar/Main.qml
@@ -337,6 +337,8 @@ Rectangle {
iconFont: StudioTheme.Constants.font
buttonIcon: qsTr("Share")
visible: !root.flyoutEnabled
+ enabled: backend.isSharingEnabled
+ tooltip: shareButton.enabled ? qsTr("Share your project online.") : qsTr("Sharing your project online is disabled in the Community Version.")
onClicked: backend.shareApplicationOnline()
}
@@ -458,6 +460,8 @@ Rectangle {
width: shareButton.width
iconFont: StudioTheme.Constants.font
buttonIcon: qsTr("Share")
+ enabled: backend.isSharingEnabled
+ tooltip: shareButton.enabled ? qsTr("Share your project online.") : qsTr("Sharing your project online is disabled in the Community Version.")
onClicked: backend.shareApplicationOnline()
}
diff --git a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp
index c3073d58e5..7ca17dfcdd 100644
--- a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp
+++ b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp
@@ -7,11 +7,12 @@
#include <crumblebar.h>
#include <designeractionmanager.h>
#include <designmodewidget.h>
-#include <viewmanager.h>
-#include <zoomaction.h>
+#include <dynamiclicensecheck.h>
#include <qmldesignerconstants.h>
#include <qmldesignerplugin.h>
#include <qmleditormenu.h>
+#include <viewmanager.h>
+#include <zoomaction.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h>
@@ -734,6 +735,11 @@ bool ToolBarBackend::projectOpened() const
return ProjectExplorer::ProjectManager::instance()->startupProject();
}
+bool ToolBarBackend::isSharingEnabled()
+{
+ return !QmlDesigner::checkOpenSourceLicense();
+}
+
void ToolBarBackend::launchGlobalAnnotations()
{
QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_TOOLBAR_EDIT_GLOBAL_ANNOTATION);
diff --git a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h
index eb258f9ab7..5d0b0e712a 100644
--- a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h
+++ b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h
@@ -96,6 +96,7 @@ class ToolBarBackend : public QObject
Q_PROPERTY(bool isQt6 READ isQt6 NOTIFY isQt6Changed)
Q_PROPERTY(bool isMCUs READ isMCUs NOTIFY isMCUsChanged)
Q_PROPERTY(bool projectOpened READ projectOpened NOTIFY projectOpenedChanged)
+ Q_PROPERTY(bool isSharingEnabled READ isSharingEnabled NOTIFY isSharingEnabledChanged)
public:
ToolBarBackend(QObject *parent = nullptr);
@@ -144,6 +145,8 @@ public:
bool projectOpened() const;
+ bool isSharingEnabled();
+
static void launchGlobalAnnotations();
signals:
@@ -163,6 +166,7 @@ signals:
void isQt6Changed();
void isMCUsChanged();
void projectOpenedChanged();
+ void isSharingEnabledChanged();
private:
void setupWorkspaces();
diff --git a/src/plugins/qmldesigner/dynamiclicensecheck.h b/src/plugins/qmldesigner/dynamiclicensecheck.h
index a3ddf6c192..95ffa8a7c4 100644
--- a/src/plugins/qmldesigner/dynamiclicensecheck.h
+++ b/src/plugins/qmldesigner/dynamiclicensecheck.h
@@ -133,4 +133,23 @@ inline bool checkEnterpriseLicense()
return true;
}
+inline bool checkOpenSourceLicense()
+{
+ if (auto plugin = Internal::dsLicenseCheckerPlugin()) {
+ bool retVal = false;
+ bool success = QMetaObject::invokeMethod(plugin,
+ "checkCommunityLicense",
+ Qt::DirectConnection,
+ Q_RETURN_ARG(bool, retVal));
+
+ if (success)
+ return retVal;
+ }
+
+ if (Internal::dsLicenseCheckerPluginExists())
+ return false;
+
+ return true;
+}
+
} // namespace Utils