forked from qt-creator/qt-creator
StudioWelcome: Show text for correct version
Task-number: QDS-5725 Change-Id: I040d9f1f0817fc719da060dd31ee6a04981199e3 Reviewed-by: Henning Gründl <henning.gruendl@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -341,10 +341,16 @@ Rectangle {
|
|||||||
x: 15
|
x: 15
|
||||||
y: 65
|
y: 65
|
||||||
color: "#ffffff"
|
color: "#ffffff"
|
||||||
text: qsTr("Community Edition")
|
|
||||||
font.pixelSize: 13
|
font.pixelSize: 13
|
||||||
font.family: StudioFonts.titilliumWeb_light
|
font.family: StudioFonts.titilliumWeb_light
|
||||||
visible: projectModel.communityVersion
|
text: {
|
||||||
|
if (projectModel.communityVersion)
|
||||||
|
return qsTr("Community Edition")
|
||||||
|
if (projectModel.enterpriseVersion)
|
||||||
|
return qsTr("Enterprise Edition")
|
||||||
|
return qsTr("Professional Edition")
|
||||||
|
}
|
||||||
|
|
||||||
ProjectModel {
|
ProjectModel {
|
||||||
id: projectModel
|
id: projectModel
|
||||||
|
@@ -197,6 +197,7 @@ public:
|
|||||||
enum { FilePathRole = Qt::UserRole + 1, PrettyFilePathRole, PreviewUrl, TagData, Description };
|
enum { FilePathRole = Qt::UserRole + 1, PrettyFilePathRole, PreviewUrl, TagData, Description };
|
||||||
|
|
||||||
Q_PROPERTY(bool communityVersion MEMBER m_communityVersion NOTIFY communityVersionChanged)
|
Q_PROPERTY(bool communityVersion MEMBER m_communityVersion NOTIFY communityVersionChanged)
|
||||||
|
Q_PROPERTY(bool enterpriseVersion MEMBER m_enterpriseVersion NOTIFY enterpriseVersionChanged)
|
||||||
|
|
||||||
explicit ProjectModel(QObject *parent = nullptr);
|
explicit ProjectModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
@@ -273,11 +274,48 @@ public slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void communityVersionChanged();
|
void communityVersionChanged();
|
||||||
|
void enterpriseVersionChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_communityVersion = false;
|
void setupVersion();
|
||||||
|
|
||||||
|
bool m_communityVersion = true;
|
||||||
|
bool m_enterpriseVersion = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void ProjectModel::setupVersion()
|
||||||
|
{
|
||||||
|
const ExtensionSystem::PluginSpec *pluginSpec = Utils::findOrDefault(
|
||||||
|
ExtensionSystem::PluginManager::plugins(),
|
||||||
|
Utils::equal(&ExtensionSystem::PluginSpec::name, QString("LicenseChecker")));
|
||||||
|
|
||||||
|
if (!pluginSpec)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ExtensionSystem::IPlugin *plugin = pluginSpec->plugin();
|
||||||
|
|
||||||
|
if (!plugin)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_communityVersion = false;
|
||||||
|
|
||||||
|
bool retVal = false;
|
||||||
|
bool success = QMetaObject::invokeMethod(plugin,
|
||||||
|
"qdsEnterpriseLicense",
|
||||||
|
Qt::DirectConnection,
|
||||||
|
Q_RETURN_ARG(bool, retVal));
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
|
qWarning("Check for Qt Design Studio Enterprise License failed.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!retVal) {
|
||||||
|
qWarning("No Qt Design Studio Enterprise License. Disabling asset importer.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_enterpriseVersion = true;
|
||||||
|
}
|
||||||
|
|
||||||
ProjectModel::ProjectModel(QObject *parent)
|
ProjectModel::ProjectModel(QObject *parent)
|
||||||
: QAbstractListModel(parent)
|
: QAbstractListModel(parent)
|
||||||
{
|
{
|
||||||
@@ -286,10 +324,7 @@ ProjectModel::ProjectModel(QObject *parent)
|
|||||||
this,
|
this,
|
||||||
&ProjectModel::resetProjects);
|
&ProjectModel::resetProjects);
|
||||||
|
|
||||||
if (!Utils::findOrDefault(ExtensionSystem::PluginManager::plugins(),
|
setupVersion();
|
||||||
Utils::equal(&ExtensionSystem::PluginSpec::name,
|
|
||||||
QString("LicenseChecker"))))
|
|
||||||
m_communityVersion = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ProjectModel::rowCount(const QModelIndex &) const
|
int ProjectModel::rowCount(const QModelIndex &) const
|
||||||
|
Reference in New Issue
Block a user