From c299d95ea7204f0716b6f464c9a92e187a7f31a2 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 3 Nov 2022 00:23:06 +0100 Subject: [PATCH] QmlDesigner: Enforce rules for QML component names Since a QML component is generated from the effect, the same rules for names should apply. (cherry picked from commit 318a2aff2f21b03ba7564055f168095101269cb8) Task-number: QDS-8152 Change-Id: I607c2771401fec2259b1e1aac9a37707aa1328b7 Reviewed-by: Tim Jenssen --- .../studio_templates/files/effect/wizard.json | 41 +++++++++++++++---- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/share/qtcreator/qmldesigner/studio_templates/files/effect/wizard.json b/share/qtcreator/qmldesigner/studio_templates/files/effect/wizard.json index d922fb94a5d..3dedbb5080d 100644 --- a/share/qtcreator/qmldesigner/studio_templates/files/effect/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/files/effect/wizard.json @@ -12,18 +12,43 @@ "featuresRequired": [ "QmlDesigner.Wizards.Enterprise" ], "options": [ - { "key": "DefaultSuffix", "value": "qep" }, + { "key": "EffectFile", "value": "%{Class}.qep" }, { "key": "DoNotOpenFile", "value": "true" } ], "pages" : [ - { - "trDisplayName": "Location", - "trShortTitle": "Location", - "typeId": "File" - } - ], + { + "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" : [ { @@ -31,7 +56,7 @@ "data": { "source": "file.qep", - "target": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}", + "target": "%{TargetPath}/%{EffectFile}", "openInEditor": false } }