{
    "version": 1,
    "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ],
    "id": "C.QuickAutoTest",
    "category": "I.TestProject",
    "trDescription": "Creates a new unit test project using Qt Quick Test. Unit tests allow you to verify that the code is fit for use and that there are no regressions.",
    "trDisplayName": "Qt Quick Test Project",
    "trDisplayCategory": "Test Project",
    "icon": "../autotest.png",
    "iconKind": "Themed",
    "enabled": "%{JS: isPluginRunning('cppeditor')}",

    "options":
    [
        { "key": "TestFrameWork",
          "value": "QtQuickTest"
        },
        { "key": "ProjectFilePath",
          "value": "%{JS: value('BuildSystem') == 'qmake' ? value('ProFileName') : (value('BuildSystem') == 'qbs' ? value('QbsFileName') : value('CMakeFileName')) }"
        },
        { "key": "ProFileName",
          "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}"
        },
        {
          "key": "QbsFileName",
          "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}"
        },
        {
          "key": "CMakeFileName",
          "value": "%{ProjectDirectory}/CMakeLists.txt"
        },
        { "key": "MainCppName",
          "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src') }"
        },
        {
          "key": "GUARD",
          "value": "%{JS: value('TestCaseFileWithHeaderSuffix').toUpperCase().replace('.', '_') }"
        },
        {
            "key": "TestCaseFileWithQmlSuffix",
            "value": "%{JS: 'tst_' + value('TestCaseName').toLowerCase() + '.qml' }"
        },
        {
            "key": "FeatureQt",
            "value": "QtSupport.Wizards.FeatureQt%{JS: value('BuildSystem') === 'cmake-qt6' ? '.6.5' : ''}"
        },
        {
            "key": "MinimumSupportedQtVersion",
            "value": "%{JS: value('BuildSystem') === 'cmake-qt6' ? '6.5' : '5.0' }"
        },
        {
            "key": "HasQSPSetup",
            "value": "%{JS: value('MinimumSupportedQtVersion') > '6.2' }"
        },
        {
            "key": "UsesAutoResourcePrefix",
            "value": "%{JS: value('MinimumSupportedQtVersion') > '6.4' }"
        }
    ],

    "pages":
    [
        {
            "trDisplayName": "Project Location",
            "trShortTitle": "Location",
            "typeId": "Project",
            "data":
            {
                "trDescription": "This wizard creates a simple unit test project using Qt Quick Test."
            }
        },
        {
            "trDisplayName": "Project and Test Information",
            "trShortTitle": "Details",
            "typeId": "Fields",
            "data":
            [
                {
                    "name": "TestCaseName",
                    "trDisplayName": "Test case name:",
                    "mandatory": true,
                    "type": "LineEdit",
                    "data": { "validator": "^[a-zA-Z_0-9]+$" }
                },
                {
                    "name": "UseSetupCode",
                    "trDisplayName": "Generate setup code",
                    "type": "CheckBox",
                    "data": {
                        "checked": false
                    }
                },
                {
                    "name": "GenerateInitAndCleanup",
                    "trDisplayName": "Generate initialization and cleanup code",
                    "type": "CheckBox",
                    "data": {
                        "checked": false
                    }
                },
                {
                    "name": "QtCompatibility",
                    "trDisplayName": "Qt code compatibility:",
                    "type": "ComboBox",
                    "data":
                    {
                        "index": 0,
                        "items":
                        [
                            {
                                "trKey": "Qt6 and higher",
                                "value": "Qt6+"
                            },
                            {
                                "trKey": "Qt5 and higher",
                                "value": "Qt5+"
                            }
                        ]
                    }
                },
                {
                    "name": "BuildSystem",
                    "trDisplayName": "Build system:",
                    "type": "ComboBox",
                    "persistenceKey": "BuildSystemType",
                    "visible": "%{JS: !value('IsSubproject')}",
                    "data":
                    {
                        "index": 1,
                        "items":
                        [
                            {
                                "trKey": "qmake",
                                "value": "qmake",
                                "condition": "%{JS: isPluginRunning('qmakeprojectmanager')}"
                            },
                            {
                                "trKey": "CMake for Qt5 and Qt 6",
                                "value": "cmake",
                                "condition": "%{JS: isPluginRunning('cmakeprojectmanager')}"
                            },
                            {
                                "trKey": "CMake",
                                "value": "cmake-qt6",
                                "condition": "%{JS: isPluginRunning('cmakeprojectmanager')}"
                            },
                            {
                                "trKey": "Qbs",
                                "value": "qbs",
                                "condition": "%{JS: isPluginRunning('qbsprojectmanager')}"
                            }
                        ]
                    }
                }
            ]
        },
        {
            "trDisplayName": "Kit Selection",
            "trShortTitle": "Kits",
            "typeId": "Kits",
            "data": {
                 "projectFilePath": "%{ProjectFilePath}",
                 "requiredFeatures": [ "%{FeatureQt}", "QtSupport.Wizards.FeatureQtQuick.2", "DeviceType.Desktop" ]
            }
        },
        {
            "trDisplayName": "Project Management",
            "trShortTitle": "Summary",
            "typeId": "Summary"
        }
    ],
    "generators":
    [
        {
            "typeId": "File",
            "data":
            [
                {
                    "source": "../files/tst.pro",
                    "target": "%{ProjectFilePath}",
                    "condition": "%{JS: value('BuildSystem') == 'qmake'}",
                    "openInEditor": false,
                    "openAsProject": true
                },
                {
                    "source": "../files/tst.qbs",
                    "target": "%{ProjectFilePath}",
                    "condition": "%{JS: value('BuildSystem') == 'qbs'}",
                    "openInEditor": false,
                    "openAsProject": true
                },
                {
                    "source": "../files/tst.txt",
                    "target": "CMakeLists.txt",
                    "condition": "%{JS: value('BuildSystem') == 'cmake'}",
                    "openInEditor": false,
                    "openAsProject": true
                },
                {
                    "source": "../files/tstQt6.txt",
                    "target": "CMakeLists.txt",
                    "condition": "%{JS: value('BuildSystem') == 'cmake-qt6'}",
                    "openInEditor": false,
                    "openAsProject": true
                },
                {
                    "source": "../files/tst_main.cpp",
                    "target": "%{MainCppName}",
                    "openInEditor": true
                },
                {
                    "source": "../files/tst_qml.tmpl",
                    "target": "%{TestCaseFileWithQmlSuffix}",
                    "openInEditor": true
                },
                {
                    "source": "../files/setup.cpp",
                    "target": "setup.cpp",
                    "condition": "%{JS: value('UseSetupCode')}",
                    "openInEditor": true
                },
                {
                    "source": "../files/setup.h",
                    "target": "setup.h",
                    "condition": "%{JS: value('UseSetupCode')}",
                    "openInEditor": true
                },
                {
                    "source": "../../projects/git.ignore",
                    "target": ".gitignore",
                    "condition": "%{JS: ( !value('IsSubproject') && value('VersionControl') === 'G.Git' )}"
                }
            ]
        }
    ]
}
