diff --git a/src/plugins/mcusupport/mcusupport.qrc b/src/plugins/mcusupport/mcusupport.qrc index b45fb8ccc31..23934d4df40 100644 --- a/src/plugins/mcusupport/mcusupport.qrc +++ b/src/plugins/mcusupport/mcusupport.qrc @@ -7,8 +7,13 @@ wizards/icon.png wizards/icon@2x.png wizards/application/CMakeLists.txt - wizards/application/project.qmlproject.tpl wizards/application/main.qml.tpl wizards/application/wizard.json + wizards/qmlproject/CMakeLists.txt + wizards/qmlproject/main.qml.tpl + wizards/qmlproject/project.qmlproject.tpl + wizards/qmlproject/module.qmlproject.tpl + wizards/qmlproject/component.qml.tpl + wizards/qmlproject/wizard.json diff --git a/src/plugins/mcusupport/wizards/application/project.qmlproject.tpl b/src/plugins/mcusupport/wizards/application/project.qmlproject.tpl deleted file mode 100644 index 0b5d6d58631..00000000000 --- a/src/plugins/mcusupport/wizards/application/project.qmlproject.tpl +++ /dev/null @@ -1,19 +0,0 @@ -/* File generated by Qt Creator */ - -import QmlProject 1.1 - -Project { - mainFile: "%{MainQmlFile}" - qtForMCUs: true - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/src/plugins/mcusupport/wizards/application/wizard.json b/src/plugins/mcusupport/wizards/application/wizard.json index e9caecf4c86..93bffa9f6e2 100644 --- a/src/plugins/mcusupport/wizards/application/wizard.json +++ b/src/plugins/mcusupport/wizards/application/wizard.json @@ -49,11 +49,6 @@ "source": "CMakeLists.txt", "openAsProject": true }, - { - "source": "project.qmlproject.tpl", - "target": "%{ProjectDirectory}/%{ProjectName}.qmlproject", - "openInEditor": false - }, { "source": "main.qml.tpl", "target": "%{ProjectDirectory}/%{MainQmlFile}", diff --git a/src/plugins/mcusupport/wizards/qmlproject/CMakeLists.txt b/src/plugins/mcusupport/wizards/qmlproject/CMakeLists.txt new file mode 100644 index 00000000000..a1fb2aef795 --- /dev/null +++ b/src/plugins/mcusupport/wizards/qmlproject/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required (VERSION 3.15) + +project(%{ProjectName} VERSION 0.0.1 LANGUAGES C CXX ASM ASM_MASM) + +find_package(Qul) + +qul_add_target(%{ProjectName} QML_PROJECT %{QmlProjectFile}) +app_target_setup_os(%{ProjectName}) +app_target_default_entrypoint(%{ProjectName} %{RootItemName}) diff --git a/src/plugins/mcusupport/wizards/qmlproject/component.qml.tpl b/src/plugins/mcusupport/wizards/qmlproject/component.qml.tpl new file mode 100644 index 00000000000..69b8e643bfc --- /dev/null +++ b/src/plugins/mcusupport/wizards/qmlproject/component.qml.tpl @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +Text { + color: "salmon" + text: "Hello World!" + font.pixelSize: 14 +} diff --git a/src/plugins/mcusupport/wizards/qmlproject/main.qml.tpl b/src/plugins/mcusupport/wizards/qmlproject/main.qml.tpl new file mode 100644 index 00000000000..a60dd10046a --- /dev/null +++ b/src/plugins/mcusupport/wizards/qmlproject/main.qml.tpl @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import CustomModule + +Rectangle { + width: 480 + height: 272 + + CustomComponent { + anchors.centerIn: parent + } +} diff --git a/src/plugins/mcusupport/wizards/qmlproject/module.qmlproject.tpl b/src/plugins/mcusupport/wizards/qmlproject/module.qmlproject.tpl new file mode 100644 index 00000000000..11e04b8325d --- /dev/null +++ b/src/plugins/mcusupport/wizards/qmlproject/module.qmlproject.tpl @@ -0,0 +1,12 @@ +import QmlProject 1.3 + +Project { + MCU.Module { + uri: "CustomModule" + generateQmltypes: true + } + + QmlFiles { + files: ["%{QmlComponent}"] + } +} diff --git a/src/plugins/mcusupport/wizards/qmlproject/project.qmlproject.tpl b/src/plugins/mcusupport/wizards/qmlproject/project.qmlproject.tpl new file mode 100644 index 00000000000..d799190038a --- /dev/null +++ b/src/plugins/mcusupport/wizards/qmlproject/project.qmlproject.tpl @@ -0,0 +1,139 @@ +import QmlProject 1.3 + +Project { + // importPaths: ["."] // optional extra import paths + // projectRootPath: "." // optional root path relative to qmlproject file path + + /* Global configuration */ + MCU.Config { + controlsStyle: "QtQuick.Controls.StyleDefault" + debugBytecode: false + debugLineDirectives: false + binaryAssetOptions: "Automatic" + // platformImageAlignment: 1 // undefined by default + platformPixelWidthAlignment: 1 + platformAlphaPixelFormat: "ARGB8888" + platformOpaquePixelFormat: "XRGB8888" + platformAlphaCompressedLosslessResourcePixelFormat: "ARGB8888RLE" + platformOpaqueCompressedLosslessResourcePixelFormat: "RGB888RLE" + // maxResourceCacheSize: 102400 // undefined by default + + // global defaults for image properties + resourceAlphaOptions: "ForTransformations" + resourceRlePremultipliedAlpha: true + resourceImagePixelFormat: "Automatic" + resourceCachePolicy: "OnStartup" + resourceCompression: false + resourceStorageSection: "QulResourceData" + resourceRuntimeAllocationType: 3 + resourceOptimizeForRotation: false + resourceOptimizeForScale: false + + // default font engine selection + fontEngine: "Static" // alternative option: "Spark" + + // font defaults for both engines + defaultFontFamily: "DejaVu Sans" + defaultFontQuality: "VeryHigh" + glyphsCachePolicy: "OnStartup" + glyphsStorageSection: "QulFontResourceData" + glyphsRuntimeAllocationType: 3 + + // font defaults for "Static" + autoGenerateGlyphs: true + complexTextRendering: true + fontFilesCachePolicy: "OnStartup" + fontFilesStorageSection: "QulFontResourceData" + fontFilesRuntimeAllocationType: 3 + + // font properties for "Spark" + fontCachePriming: true + fontCacheSize: 104800 + fontHeapSize: -1 + fontHeapPrealloc: true + fontCachePrealloc: true + fontVectorOutlinesDrawing: false + maxParagraphSize: 100 + } + + /* QML files */ + // optional root property for adding one single qml file + // mainFile: "%{MainQmlFile}" + QmlFiles { + files: ["%{MainQmlFile}"] + MCU.copyQmlFiles: false + } + + /* Images */ + ImageFiles { + // files: [""] // uncomment and add image files + MCU.base: "images" // example base "images". + MCU.prefix: "pics" // example prefix "pics". + + MCU.resourceAlphaOptions: "ForTransformations" + MCU.resourceRlePremultipliedAlpha: true + MCU.resourceImagePixelFormat: "Automatic" + MCU.resourceCachePolicy: "OnStartup" + MCU.resourceCompression: false + MCU.resourceStorageSection: "QulResourceData" + MCU.resourceRuntimeAllocationType: 3 + MCU.resourceOptimizeForRotation: false + MCU.resourceOptimizeForScale: false + } + + /* Modules */ + ModuleFiles { + files: ["%{ModuleFile}"] + // qulModules: [ // Uncomment for adding Qul modules + // "Qul::Controls", + // "Qul::ControlsTemplates", + // "Qul::Shapes", + // "Qul::Timeline" + // ] + } + + /* Interfaces */ + InterfaceFiles { + // files: [""] // uncomment for adding header files + MCU.qmlImports: ["QtQuick"] + } + + /* Translations */ + TranslationFiles { + // files: [""] // Uncomment for adding translation files with .ts extension + MCU.omitSourceLanguage: false + } + + FontFiles { + // files: [""] // Uncomment for adding font files (.ttf, .otf, .pfa, .ttc, .pfb) + MCU.addDefaultFonts: true + } + + FontConfiguration { + // font engine selection overriddes default + MCU.fontEngine: "Static" // or "Spark" + + // properties shared between both engines + MCU.defaultFontFamily: "DejaVu Sans" + MCU.defaultFontQuality: "VeryHigh" + MCU.glyphsCachePolicy: "OnStartup" + MCU.glyphsStorageSection: "QulFontResourceData" + MCU.glyphsRuntimeAllocationType: 3 + + // properties for Static engine + MCU.autoGenerateGlyphs: true + MCU.complexTextRendering: true + MCU.fontFilesCachePolicy: "OnStartup" + MCU.fontFilesStorageSection: "QulFontResourceData" + MCU.fontFilesRuntimeAllocationType: 3 + + // monotype for Spark engine + MCU.fontCachePriming: true + MCU.fontCacheSize: 104800 + MCU.fontHeapSize: -1 + MCU.fontHeapPrealloc: true + MCU.fontCachePrealloc: true + MCU.fontVectorOutlinesDrawing: false + MCU.maxParagraphSize: 100 + } +} diff --git a/src/plugins/mcusupport/wizards/qmlproject/wizard.json b/src/plugins/mcusupport/wizards/qmlproject/wizard.json new file mode 100644 index 00000000000..71874ff02bc --- /dev/null +++ b/src/plugins/mcusupport/wizards/qmlproject/wizard.json @@ -0,0 +1,83 @@ +{ + "version": 1, + "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject" ], + "id": "M.McuSupportQmlprojectApplication", + "category": "D.ApplicationMCU", + "trDescription": "Creates an Mcu Support application with an empty UI, based on qmlproject (Technical Preview).", + "trDisplayName": "Qt for MCUs QmlProject Application (Technical Preview)", + "trDisplayCategory": "QmlProject Application (Qt for MCU)", + "icon": "../icon.png", + "iconKind": "Themed", + "enabled": true, + + "options": + [ + { "key": "MainQmlFile", "value": "%{ProjectName}.qml" }, + { "key": "QmlProjectFile", "value": "%{ProjectName}.qmlproject" }, + { "key": "RootItemName", "value": "%{ProjectName}" }, + { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, + { "key": "ModuleFile", "value": "CustomModule.qmlproject"}, + { "key": "QmlComponent", "value": "CustomComponent.qml"} + ], + + "pages": + [ + { + "trDisplayName": "Project Location", + "trShortTitle": "Location", + "typeId": "Project" + }, + { + "trDisplayName": "Kit Selection", + "trShortTitle": "Kits", + "typeId": "Kits", + "enabled": "%{JS: !value('IsSubproject')}", + "data": { + "projectFilePath": "%{CMakeFile}" + } + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators": + [ + { + "typeId": "File", + "data": + [ + { + "source": "CMakeLists.txt", + "openAsProject": true + }, + { + "source": "project.qmlproject.tpl", + "target": "%{ProjectDirectory}/%{QmlProjectFile}", + "openInEditor": true + }, + { + "source": "main.qml.tpl", + "target": "%{ProjectDirectory}/%{MainQmlFile}", + "openInEditor": true + }, + { + "source": "component.qml.tpl", + "target": "%{ProjectDirectory}/%{QmlComponent}", + "openInEditor": true + }, + { + "source": "module.qmlproject.tpl", + "target": "%{ProjectDirectory}/%{ModuleFile}", + "openInEditor": true + }, + { + "source": "%{IDE:ResourcePath}/templates/wizards/projects/git.ignore", + "target": ".gitignore", + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" + } + ] + } + ] +}