{
    "version": 1,
    "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qt4ProjectManager.Qt4Project", "Qbs.QbsProject" ],
    "id": "C.QtWidgets",
    "category": "D.ApplicationQt",
    "trDescription": "Creates a Qt application for the desktop. Includes a Qt Designer-based main window.\n\nPreselects a desktop Qt for building the application if available.",
    "trDisplayName": "Qt Widgets Application",
    "trDisplayCategory": "Application (Qt)",
    "icon": "../../global/guiapplication.png",
    "featuresRequired": [ "QtSupport.Wizards.FeatureQt" ],
    "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0}",

    "options":
    [
        { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile')}" },
        { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" },
        { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" },
        { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" },
        { "key": "MainFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" },
        { "key": "UiHdrFileName", "value": "%{JS: (value('BuildSystem') === 'cmake' ? (Util.path(value('FormFileName')) + '/') : '') + 'ui_' + Util.completeBaseName(value('FormFileName')) + '.h'}" },
        { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" },
        { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" },
        { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('Class'), Util.suffix(value('HdrFileName')))}" }
    ],

    "pages":
    [
        {
            "trDisplayName": "Project Location",
            "trShortTitle": "Location",
            "typeId": "Project",
            "data": { "trDescription": "This wizard generates a Qt Widgets Application project. The application derives by default from QApplication and includes an empty widget." }
        },
        {
            "trDisplayName": "Define Build System",
            "trShortTitle": "Build System",
            "typeId": "Fields",
            "enabled": "%{JS: !value('IsSubproject')}",
            "data":
            [
                {
                    "name": "BuildSystem",
                    "trDisplayName": "Build system:",
                    "type": "ComboBox",
                    "persistenceKey": "BuildSystemType",
                    "data":
                    {
                        "index": 0,
                        "items":
                        [
                            {
                                "trKey": "qmake",
                                "value": "qmake",
                                "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}"
                            },
                            {
                                "trKey": "CMake",
                                "value": "cmake",
                                "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}"
                            },
                            {
                                "trKey": "Qbs",
                                "value": "qbs",
                                "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}"
                            }
                        ]
                    }
                }
            ]
        },
        {
            "trDisplayName": "Class Information",
            "trShortTitle": "Details",
            "typeId": "Fields",
            "data":
            [
                {
                    "name": "ClassPageDescription",
                    "type": "Label",
                    "data":
                    {
                        "trText": "Specify basic information about the classes for which you want to generate skeleton source code files.",
                        "wordWrap": true
                    }
                },
                {
                    "name": "Sp0",
                    "type": "Spacer"
                },
                {
                    "name": "Class",
                    "trDisplayName": "Class name:",
                    "mandatory": true,
                    "type": "LineEdit",
                    "data":
                    {
                        "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)",
                        "trText": "%{JS: value('BaseClass') ? value('BaseClass').slice(1) : 'MyClass'}"
                    }
                },
                {
                    "name": "BaseClass",
                    "trDisplayName": "Base class:",
                    "type": "ComboBox",
                    "data":
                    {
                        "items": [ "QMainWindow", "QWidget", "QDialog" ]
                    }
                },
                {
                    "name": "Sp1",
                    "type": "Spacer"
                },
                {
                    "name": "HdrFileName",
                    "type": "LineEdit",
                    "trDisplayName": "Header file:",
                    "mandatory": true,
                    "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++hdr'))}" }
                },
                {
                    "name": "SrcFileName",
                    "type": "LineEdit",
                    "trDisplayName": "Source file:",
                    "mandatory": true,
                    "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++src'))}" }
                },
                {
                    "name": "GenerateForm",
                    "type": "CheckBox",
                    "trDisplayName": "Generate form",
                    "data": { "checked": true }
                },
                {
                    "name": "FormFileName",
                    "type": "LineEdit",
                    "trDisplayName": "Form file:",
                    "enabled": "%{GenerateForm}",
                    "mandatory": true,
                    "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), 'ui')}" }
                }
            ]
        },
        {
            "trDisplayName": "Translation File",
            "trShortTitle": "Translation",
            "typeId": "QtTranslation"
        },
        {
            "trDisplayName": "Kit Selection",
            "trShortTitle": "Kits",
            "typeId": "Kits",
            "enabled": "%{JS: !value('IsSubproject')}",
            "data": { "projectFilePath": "%{ProjectFile}" }
        },
        {
            "trDisplayName": "Project Management",
            "trShortTitle": "Summary",
            "typeId": "Summary"
        }
    ],
    "generators":
    [
        {
            "typeId": "File",
            "data":
            [
                {
                    "source": "project.pro",
                    "target": "%{ProFile}",
                    "openAsProject": true,
                    "condition": "%{JS: value('BuildSystem') === 'qmake'}"
                },
                {
                    "source": "CMakeLists.txt",
                    "openAsProject": true,
                    "condition": "%{JS: value('BuildSystem') === 'cmake'}"
                },
                {
                    "source": "project.qbs",
                    "target": "%{QbsFile}",
                    "openAsProject": true,
                    "condition": "%{JS: value('BuildSystem') === 'qbs'}"
                },
                {
                    "source": "main.cpp",
                    "target": "%{MainFileName}",
                    "openInEditor": true
                },
                {
                    "source": "widget.cpp",
                    "target": "%{SrcFileName}"
                },
                {
                    "source": "widget.h",
                    "target": "%{HdrFileName}"
                },
                {
                    "source": "widget.ui",
                    "target": "%{FormFileName}",
                    "condition": "%{GenerateForm}"
                },
                {
                    "source": "../translation.ts",
                    "target": "%{TsFileName}",
                    "condition": "%{HasTranslation}"
                },
                {
                    "source": "../git.ignore",
                    "target": ".gitignore",
                    "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
                }
            ]
        }
    ]
}
