QmlDesigner: Enable integration of the new create effect system

- Remove old New Effect item from new file dialog
- Add license checker for creating effects

Task-number: QDS-8675
Task-number: QDS-8676
Change-Id: I83ed2c4021c9df3896018da19fbff76be92a7431
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Amr Essam
2022-12-19 16:50:24 +02:00
committed by Amr Elsayed
parent 0887174727
commit fb12660b0a
5 changed files with 12 additions and 64 deletions

View File

@@ -186,6 +186,7 @@ StudioControls.Menu {
StudioControls.MenuItem { StudioControls.MenuItem {
text: qsTr("New Effect") text: qsTr("New Effect")
visible: assetsModel.canCreateEffects()
NewEffectDialog { NewEffectDialog {
id: newEffectDialog id: newEffectDialog

View File

@@ -1,64 +0,0 @@
{
"version": 1,
"supportedProjectTypes": [ ],
"id": "J.QEP",
"category": "U.QEP",
"trDescription": "Creates an Effect Maker file.",
"trDisplayName": "Effect File (Effect Maker)",
"trDisplayCategory": "Effects",
"iconText": "qep",
"platformIndependent": true,
"enabled": "%{JS: value('Features').indexOf('QmlDesigner.Wizards.Enterprise') >= 0}",
"featuresRequired": [ "QmlDesigner.Wizards.Enterprise" ],
"options": [
{ "key": "EffectFile", "value": "%{Class}.qep" },
{ "key": "DoNotOpenFile", "value": "true" }
],
"pages" :
[
{
"trDisplayName": "Define Class",
"trShortTitle": "Details",
"typeId": "Fields",
"data" :
[
{
"name": "Class",
"trDisplayName": "Effect name:",
"mandatory": true,
"type": "LineEdit",
"data": {
"validator": "(?:[A-Z_][a-zA-Z_0-9]*|)",
"fixup": "%{JS: '%{INPUT}'.charAt(0).toUpperCase() + '%{INPUT}'.slice(1) }"
}
},
{
"name": "TargetPath",
"type": "PathChooser",
"trDisplayName": "Path:",
"mandatory": true,
"data":
{
"kind": "existingDirectory",
"basePath": "%{InitialPath}",
"path": "%{InitialPath}"
}
}
]
}
],
"generators" :
[
{
"typeId": "File",
"data":
{
"source": "file.qep",
"target": "%{TargetPath}/%{EffectFile}",
"openInEditor": false
}
}
]
}

View File

@@ -194,6 +194,15 @@ bool AssetsLibraryModel::createNewEffect(const QString &effectPath, bool openEff
return created; return created;
} }
bool AssetsLibraryModel::canCreateEffects() const
{
#ifdef LICENSECHECKER
return checkLicense() == FoundLicense::enterprise;
#else
return true;
#endif
}
bool AssetsLibraryModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const bool AssetsLibraryModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{ {
QString path = m_sourceFsModel->filePath(sourceParent); QString path = m_sourceFsModel->filePath(sourceParent);

View File

@@ -50,6 +50,8 @@ public:
Q_INVOKABLE QString getUniqueEffectPath(const QString &parentFolder, const QString &effectName); Q_INVOKABLE QString getUniqueEffectPath(const QString &parentFolder, const QString &effectName);
Q_INVOKABLE bool createNewEffect(const QString &effectPath, bool openEffectMaker = true); Q_INVOKABLE bool createNewEffect(const QString &effectPath, bool openEffectMaker = true);
Q_INVOKABLE bool canCreateEffects() const;
int columnCount(const QModelIndex &parent = QModelIndex()) const override int columnCount(const QModelIndex &parent = QModelIndex()) const override
{ {
int result = QSortFilterProxyModel::columnCount(parent); int result = QSortFilterProxyModel::columnCount(parent);