{
    "version": 1,
    "supportedProjectTypes": [ ],
    "id": "Q.QtStudio.QmlUI.View",
    "category": "B.StudioQtQuickFiles",
    "trDescription": "Creates a Grid View or a List View component that contains a delegate and the model.",
    "trDisplayName": "Qt Quick Views",
    "trDisplayCategory": "Qt Quick Files",
    "icon": "data_gridmodel.png",
    "platformIndependent": true,

    "options":
        [
        { "key": "DelegateName", "value": "%{Class}Delegate" },
        { "key": "DelegateFile", "value": "%{DelegateName}.%{JS: Util.preferredSuffix('application/x-qt.ui+qml')}" },
        { "key": "ModelName", "value": "%{Class}Model" },
        { "key": "ModelFile", "value": "%{ModelName}.%{JS: Util.preferredSuffix('text/x-qml')}" },
        { "key": "ViewFile", "value": "%{Class}.%{JS: Util.preferredSuffix('application/x-qt.ui+qml')}" },
        { "key": "ApplicationImport", "value": "%{QmlProjectName} 1.0" },
        { "key": "MainSource", "value": "%{JS: %{RootItemCB}.MainSource}" },
        { "key": "DelegateSource", "value": "%{JS: %{RootItemCB}.DelegateSource}" }
    ],

    "pages" :
        [
        {
            "trDisplayName": "Define Class",
            "trShortTitle": "Details",
            "typeId": "Fields",
            "data" :
                [
                {
                    "name": "Class",
                    "trDisplayName": "Component 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}"
                    }
                },
                {
                    "name": "RootItemCB",
                    "trDisplayName": "Root Item:",
                    "type": "ComboBox",
                    "data":
                    {
                        "index": 0,
                        "items":
                            [
                            {
                                "trKey": "Grid View",
                                "value":
                                "({
                                    'MainSource': 'GridView.ui.qml.tpl',
                                    'DelegateSource': 'GridDelegate.ui.qml.tpl'
                                })"
                            },
                            {
                                "trKey": "List View",
                                "value":
                                "({
                                    'MainSource': 'ListView.ui.qml.tpl',
                                    'DelegateSource': 'ListDelegate.ui.qml.tpl'
                                })"
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "generators" :
        [
        {
            "typeId": "File",
            "data":
            {
                "source": "%{MainSource}",
                "target": "%{TargetPath}/%{ViewFile}",
                "openInEditor": true
            }
        },
        {
            "typeId": "File",
            "data":
            {
                "source": "%{DelegateSource}",
                "target": "%{TargetPath}/%{DelegateFile}"
            }
        },
        {
            "typeId": "File",
            "data":
            {
                "source": "DataModel.qml.tpl",
                "target": "%{TargetPath}/%{ModelFile}"
            }

        }
    ]
}
