diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2020-02-28 15:33:25 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2020-03-10 09:53:53 +0000 |
commit | 829faf7eefbf8646ca8f30f8b050dc9542b9779f (patch) | |
tree | fdf3a69446e172f158a21c9891d96c979b27e7e9 /share/qtcreator/templates | |
parent | e35289243dd857315fb7a9ae3c11a6ce557de1ff (diff) |
File wizards: Optionally show the default suffix
In wizards that create a single new file, there's almost always a
default suffix that gets appended if the user provides only the base
name. However, there's currently no visual indication on the page that
such a suffix will be appended. Therefore, we add an optional field to
the FileWizardPage that displays the default suffix if the wizard
provides one.
Change-Id: Ia1c8966e7de14b484d065dbd4a41aa74f484f085
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'share/qtcreator/templates')
13 files changed, 43 insertions, 14 deletions
diff --git a/share/qtcreator/templates/wizards/files/cppheader/wizard.json b/share/qtcreator/templates/wizards/files/cppheader/wizard.json index efb0ea8119..6d4de50975 100644 --- a/share/qtcreator/templates/wizards/files/cppheader/wizard.json +++ b/share/qtcreator/templates/wizards/files/cppheader/wizard.json @@ -9,7 +9,10 @@ "iconText": "h", "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0}", - "options": { "key": "FileName", "value": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-c++hdr'))}" }, + "options": [ + { "key": "DefaultSuffix", "value": "%{JS: Util.preferredSuffix('text/x-c++hdr')}" }, + { "key": "FileName", "value": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}" } + ], "pages" : [ diff --git a/share/qtcreator/templates/wizards/files/cppsource/wizard.json b/share/qtcreator/templates/wizards/files/cppsource/wizard.json index 775cd892ab..e9af17a913 100644 --- a/share/qtcreator/templates/wizards/files/cppsource/wizard.json +++ b/share/qtcreator/templates/wizards/files/cppsource/wizard.json @@ -9,7 +9,10 @@ "iconText": "cpp", "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0}", - "options": { "key": "FileName", "value": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-c++src'))}" }, + "options": [ + { "key": "FileName", "value": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}" }, + { "key": "DefaultSuffix", "value": "%{JS: Util.preferredSuffix('text/x-c++src')}" } + ], "pages" : [ diff --git a/share/qtcreator/templates/wizards/files/glsl/gl/fragment/wizard.json b/share/qtcreator/templates/wizards/files/glsl/gl/fragment/wizard.json index 900e4f8f68..28a018945b 100644 --- a/share/qtcreator/templates/wizards/files/glsl/gl/fragment/wizard.json +++ b/share/qtcreator/templates/wizards/files/glsl/gl/fragment/wizard.json @@ -10,6 +10,8 @@ "platformIndependent": true, "enabled": "%{JS: value('Plugins').indexOf('GLSLEditor') >= 0}", + "options": { "key": "DefaultSuffix", "value": "%{JS: Util.preferredSuffix('text/x-glsl-frag')}" }, + "pages" : [ { @@ -30,7 +32,7 @@ "data": { "source": "file.frag", - "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-glsl-frag'))}", + "target": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/glsl/gl/vertex/wizard.json b/share/qtcreator/templates/wizards/files/glsl/gl/vertex/wizard.json index 38d2df2947..48f1f68afd 100644 --- a/share/qtcreator/templates/wizards/files/glsl/gl/vertex/wizard.json +++ b/share/qtcreator/templates/wizards/files/glsl/gl/vertex/wizard.json @@ -10,6 +10,8 @@ "platformIndependent": true, "enabled": "%{JS: value('Plugins').indexOf('GLSLEditor') >= 0}", + "options": { "key": "DefaultSuffix", "value": "%{JS: Util.preferredSuffix('text/x-glsl-vert')}" }, + "pages" : [ { @@ -30,7 +32,7 @@ "data": { "source": "file.vert", - "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-glsl-vert'))}", + "target": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/glsl/gles/fragment/wizard.json b/share/qtcreator/templates/wizards/files/glsl/gles/fragment/wizard.json index a993a3cfce..d636d0eb21 100644 --- a/share/qtcreator/templates/wizards/files/glsl/gles/fragment/wizard.json +++ b/share/qtcreator/templates/wizards/files/glsl/gles/fragment/wizard.json @@ -10,6 +10,8 @@ "platformIndependent": true, "enabled": "%{JS: value('Plugins').indexOf('GLSLEditor') >= 0}", + "options": { "key": "DefaultSuffix", "value": "%{JS: Util.preferredSuffix('text/x-glsl-es-frag')}" }, + "pages" : [ { @@ -30,7 +32,7 @@ "data": { "source": "file.fsh", - "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-glsl-es-frag'))}", + "target": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/glsl/gles/vertex/wizard.json b/share/qtcreator/templates/wizards/files/glsl/gles/vertex/wizard.json index 54231aadd5..83a042d91b 100644 --- a/share/qtcreator/templates/wizards/files/glsl/gles/vertex/wizard.json +++ b/share/qtcreator/templates/wizards/files/glsl/gles/vertex/wizard.json @@ -10,6 +10,8 @@ "platformIndependent": true, "enabled": "%{JS: value('Plugins').indexOf('GLSLEditor') >= 0}", + "options": { "key": "DefaultSuffix", "value": "%{JS: Util.preferredSuffix('text/x-glsl-es-vert')}" }, + "pages" : [ { @@ -30,7 +32,7 @@ "data": { "source": "file.vsh", - "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-glsl-es-vert'))}", + "target": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/java/wizard.json b/share/qtcreator/templates/wizards/files/java/wizard.json index 5a8fae5dc1..ec1da4e164 100644 --- a/share/qtcreator/templates/wizards/files/java/wizard.json +++ b/share/qtcreator/templates/wizards/files/java/wizard.json @@ -9,7 +9,10 @@ "iconText": "java", "enabled": "%{JS: value('Plugins').indexOf('Android') >= 0}", - "options": [ { "key": "ClassName", "value": "%{JS: value('FileName').charAt(0).toUpperCase() + value('FileName').substr(1).replace(/[.]java$/,'')}" } ], + "options": [ + { "key": "ClassName", "value": "%{JS: value('FileName').charAt(0).toUpperCase() + value('FileName').substr(1).replace(/[.]java$/,'')}" }. + { "key": "DefaultSuffix", "value": "%{JS: Util.preferredSuffix('text/x-java')}" } + ], "pages" : [ @@ -31,7 +34,7 @@ "data": { "source": "source.java", - "target": "%{JS: Util.fileName(value('Path') + '/' + value('ClassName'), Util.preferredSuffix('text/x-java'))}", + "target": "%{JS: Util.fileName(value('Path') + '/' + value('ClassName'), value('DefaultSuffix'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/js/wizard.json b/share/qtcreator/templates/wizards/files/js/wizard.json index d47721bb46..505ca57817 100644 --- a/share/qtcreator/templates/wizards/files/js/wizard.json +++ b/share/qtcreator/templates/wizards/files/js/wizard.json @@ -9,6 +9,8 @@ "iconText": "js", "enabled": "%{JS: value('Plugins').indexOf('QmlJSEditor') >= 0}", + "options": { "key": "DefaultSuffix", "value": "%{JS: Util.preferredSuffix('application/javascript')}" }, + "pages" : [ { @@ -47,7 +49,7 @@ "data": { "source": "file.js", - "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('application/javascript'))}", + "target": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/nim/wizard.json b/share/qtcreator/templates/wizards/files/nim/wizard.json index 723531ced5..1baf376aa4 100644 --- a/share/qtcreator/templates/wizards/files/nim/wizard.json +++ b/share/qtcreator/templates/wizards/files/nim/wizard.json @@ -9,6 +9,8 @@ "icon": "../../projects/nim/icon.png", "enabled": "%{JS: value('Plugins').indexOf('Nim') >= 0}", + "options": { "key": "DefaultSuffix", "value": "nim" }, + "pages" : [ { @@ -29,7 +31,7 @@ "data": { "source": "file.nim", - "target": "%{JS: Util.fileName(value('TargetPath'), 'nim')}", + "target": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/nimscript/wizard.json b/share/qtcreator/templates/wizards/files/nimscript/wizard.json index 15f366773b..94012a7167 100644 --- a/share/qtcreator/templates/wizards/files/nimscript/wizard.json +++ b/share/qtcreator/templates/wizards/files/nimscript/wizard.json @@ -9,6 +9,8 @@ "icon": "../../projects/nim/icon.png", "enabled": "%{JS: value('Plugins').indexOf('Nim') >= 0}", + "options": { "key": "DefaultSuffix", "value": "nims" }, + "pages" : [ { @@ -29,7 +31,7 @@ "data": { "source": "file.nims", - "target": "%{JS: Util.fileName(value('TargetPath'), 'nims')}", + "target": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/python/wizard.json b/share/qtcreator/templates/wizards/files/python/wizard.json index f3bff037b5..a01e32bf4a 100644 --- a/share/qtcreator/templates/wizards/files/python/wizard.json +++ b/share/qtcreator/templates/wizards/files/python/wizard.json @@ -9,6 +9,8 @@ "icon": "icon.png", "enabled": "%{JS: value('Plugins').indexOf('Python') >= 0}", + "options": { "key": "DefaultSuffix", "value": "%{JS: Util.preferredSuffix('text/x-python')}" }, + "pages" : [ { @@ -29,7 +31,7 @@ "data": { "source": "file.py", - "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-python'))}", + "target": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/qrc/wizard.json b/share/qtcreator/templates/wizards/files/qrc/wizard.json index 578eed58a1..fe8ea73d17 100644 --- a/share/qtcreator/templates/wizards/files/qrc/wizard.json +++ b/share/qtcreator/templates/wizards/files/qrc/wizard.json @@ -9,6 +9,8 @@ "iconText": "qrc", "enabled": "%{JS: value('Plugins').indexOf('ResourceEditor') >= 0}", + "options": { "key": "DefaultSuffix", "value": "%{JS: Util.preferredSuffix('application/vnd.qt.xml.resource')}" }, + "pages" : [ { @@ -29,7 +31,7 @@ "data": { "source": "file.qrc", - "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('application/vnd.qt.xml.resource'))}", + "target": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/qtquick2/wizard.json b/share/qtcreator/templates/wizards/files/qtquick2/wizard.json index ead52b1687..0fa070cf93 100644 --- a/share/qtcreator/templates/wizards/files/qtquick2/wizard.json +++ b/share/qtcreator/templates/wizards/files/qtquick2/wizard.json @@ -9,6 +9,8 @@ "iconText": "qml", "enabled": "%{JS: value('Plugins').indexOf('QmlJSEditor') >= 0}", + "options": { "key": "DefaultSuffix", "value": "%{JS: Util.preferredSuffix('text/x-qml')}" }, + "pages" : [ { @@ -29,7 +31,7 @@ "data": { "source": "file.qml.tpl", - "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-qml'))}", + "target": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}", "openInEditor": true } } |