{
	"version": 1,
	"supportedProjectTypes": [ "Qt4ProjectManager.Qt4Project" ],
	"id": "G.QtMvvm",
    "category": "F.Application",
	"trDescription": "Creates a QtMvvm project with a core project and multiple GUI projects.",
	"trDisplayName": "QtMvvm Application Project",
	"trDisplayCategory": "Application",
    "icon": "icon.png",
	"featuresRequired": [ "QtSupport.Wizards.FeatureQt" ],
	"enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}",
	"options":
	[
		{ "key": "ProjectLowerName", "value": "%{JS: '%{ProjectName}'.toLowerCase()}" },
		{ "key": "ProFileName", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" },
		
		{ "key": "CoreName", "value": "%{ProjectName}Core" },
		{ "key": "CoreDirectory", "value": "%{ProjectDirectory}/%{CoreName}" },
		{ "key": "CoreProName", "value": "%{JS: Util.fileName('%{CoreDirectory}/%{CoreName}', 'pro')}" },
		
		{ "key": "WidgetsName", "value": "%{ProjectName}Widgets" },
		{ "key": "WidgetsDirectory", "value": "%{ProjectDirectory}/%{WidgetsName}" },
		{ "key": "WidgetsProName", "value": "%{JS: Util.fileName('%{WidgetsDirectory}/%{WidgetsName}', 'pro')}" },
		
		{ "key": "QuickName", "value": "%{ProjectName}Quick" },
		{ "key": "QuickDirectory", "value": "%{ProjectDirectory}/%{QuickName}" },
		{ "key": "QuickProName", "value": "%{JS: Util.fileName('%{QuickDirectory}/%{QuickName}', 'pro')}" },
		
		{ "key": "AppName", "value": "%{ProjectName}App" },
		{ "key": "AppHdrName", "value": "%{JS: Cpp.classToFileName('%{AppName}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" },
		{ "key": "AppSrcName", "value": "%{JS: Cpp.classToFileName('%{AppName}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}" },
        { "key": "AppCn", "value": "%{JS: Cpp.className('%{AppName}')}" },
        { "key": "AppGuard", "value": "%{JS: Cpp.headerGuard('%{AppHdrName}')}" },
		
		{ "key": "VmHdrName", "value": "%{JS: Cpp.classToFileName('%{VmClassName}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" },
		{ "key": "VmSrcName", "value": "%{JS: Cpp.classToFileName('%{VmClassName}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}" },
        { "key": "VmCn", "value": "%{JS: Cpp.className('%{VmClassName}')}" },
        { "key": "VmGuard", "value": "%{JS: Cpp.headerGuard('%{VmHdrName}')}" },
		
        { "key": "AppQrcName", "value": "%{JS: '%{CoreName}'.toLowerCase()}" },
        { "key": "AppQrcFile", "value": "%{JS: Util.fileName('%{AppQrcName}', 'qrc')}" },
		
		{ "key": "WindowHdrName", "value": "%{JS: Cpp.classToFileName('%{WindowClassName}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" },
		{ "key": "WindowSrcName", "value": "%{JS: Cpp.classToFileName('%{WindowClassName}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}" },
		{ "key": "WindowFormName", "value": "%{JS: Cpp.classToFileName('%{WindowClassName}', '%{JS: Util.preferredSuffix('application/x-designer')}')}" },
        { "key": "WindowCn", "value": "%{JS: Cpp.className('%{WindowClassName}')}" },
        { "key": "WindowGuard", "value": "%{JS: Cpp.headerGuard('%{WindowHdrName}')}" },
		
        { "key": "QuickQrcFile", "value": "%{JS: Util.fileName('%{JS: '%{QuickName}'.toLowerCase()}', 'qrc')}" },
		{ "key": "QuickQmlName", "value": "%{JS: Util.fileName('%{QuickClassName}', '%{JS: Util.preferredSuffix('text/x-qml')}')}" }
	],

	"pages":
	[
		{
			"trDisplayName": "Project Location",
			"trShortTitle": "Location",
			"typeId": "Project",
			"data": { "trDescription": "This wizard creates the projects and subprojects needed for a QtMvvm application." }
		},
		{
			"trDisplayName": "Define Project Details",
			"trShortTitle": "Details",
			"typeId": "Fields",
			"data" :
			[
                {
                    "name": "CreateWidgets",
                    "trDisplayName": "Create Widgets GUI",
                    "type": "CheckBox",
                    "data":
                    {
                        "checkedValue": "CreateWidgets",
                        "uncheckedValue": "",
						"checked": "true"
                    }
                },
                {
                    "name": "CreateQuick",
                    "trDisplayName": "Create Quick GUI",
                    "type": "CheckBox",
                    "data":
                    {
                        "checkedValue": "CreateQuick",
                        "uncheckedValue": "",
						"checked": "true"
                    }
                },
                {
                    "name": "UseSettings",
                    "trDisplayName": "Add Settings template",
                    "type": "CheckBox",
                    "data":
                    {
                        "checkedValue": "UseSettings",
                        "uncheckedValue": "",
						"checked": "true"
                    }
                }
			]
		},
		{
			"trDisplayName": "Define Initial ViewModel",
			"trShortTitle": "ViewModel",
			"typeId": "Fields",
			"data" :
			[
                {
                    "name": "VmName",
                    "trDisplayName": "ViewModel base name:",
                    "mandatory": true,
                    "type": "LineEdit",
                    "data":
					{ 
						"trText": "Main",
						"validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)"
					}
                },
                {
                    "name": "Sp1",
                    "type": "Spacer",
                    "data": { "factor": 2 }
                },
                {
                    "name": "VmClassName",
                    "type": "LineEdit",
                    "trDisplayName": "ViewModel class name:",
                    "mandatory": true,
                    "data":
					{ 
						"trText": "%{VmName}ViewModel",
						"validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)"
					}
                },
                {
                    "name": "WindowClassName",
                    "type": "LineEdit",
                    "trDisplayName": "Widget class name:",
                    "mandatory": true,
                    "data":
					{ 
						"trText": "%{VmName}Window",
						"validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)"
					}  
				},
                {
                    "name": "QuickClassName",
                    "type": "LineEdit",
                    "trDisplayName": "Qml class name:",
                    "mandatory": true,
                    "data": 
					{ 
						"trText": "%{VmName}View",
						"validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)"
					}  
                }
			]
		},
		{
			"trDisplayName": "Kit Selection",
			"trShortTitle": "Kits",
			"typeId": "Kits",
			"enabled": "%{IsTopLevelProject}",
			"data": { "projectFilePath": "%{ProFileName}" }
		},
		{
			"trDisplayName": "Project Management",
			"trShortTitle": "Summary",
			"typeId": "Summary"
		}
	],
	"generators":
	[
		{
			"typeId": "File",
			"data":
			[
                {
                    "source": "project.pro",
                    "target": "%{ProFileName}",
					"openAsProject": true
                },
                {
                    "source": "core.pro",
                    "target": "%{CoreProName}"
                },
                {
                    "source": "app.h",
                    "target": "%{CoreDirectory}/%{AppHdrName}"
                },
                {
                    "source": "app.cpp",
                    "target": "%{CoreDirectory}/%{AppSrcName}"
                },
                {
                    "source": "viewmodel.h",
                    "target": "%{CoreDirectory}/%{VmHdrName}"
                },
                {
                    "source": "viewmodel.cpp",
                    "target": "%{CoreDirectory}/%{VmSrcName}"
                },
                {
                    "source": "core.qrc",
                    "target": "%{CoreDirectory}/%{AppQrcFile}",
                    "condition": "%{JS: '%{UseSettings}' !== ''}"
                },
                {
                    "source": "settings.xml",
                    "target": "%{CoreDirectory}/settings.xml",
                    "condition": "%{JS: '%{UseSettings}' !== ''}"
                },
                {
                    "source": "widgets.pro",
                    "target": "%{WidgetsProName}",
                    "condition": "%{JS: '%{CreateWidgets}' !== ''}"
                },
                {
                    "source": "widgets_main.cpp",
                    "target": "%{WidgetsDirectory}/main.cpp",
                    "condition": "%{JS: '%{CreateWidgets}' !== ''}"
                },
                {
                    "source": "window.h",
                    "target": "%{WidgetsDirectory}/%{WindowHdrName}",
                    "condition": "%{JS: '%{CreateWidgets}' !== ''}"
                },
                {
                    "source": "window.cpp",
                    "target": "%{WidgetsDirectory}/%{WindowSrcName}",
                    "condition": "%{JS: '%{CreateWidgets}' !== ''}"
                },
                {
                    "source": "window.ui",
                    "target": "%{WidgetsDirectory}/%{WindowFormName}",
                    "condition": "%{JS: '%{CreateWidgets}' !== ''}"
                },
                {
                    "source": "quick.pro",
                    "target": "%{QuickProName}",
                    "condition": "%{JS: '%{CreateQuick}' !== ''}"
                },
                {
                    "source": "quick_main.cpp",
                    "target": "%{QuickDirectory}/main.cpp",
                    "condition": "%{JS: '%{CreateQuick}' !== ''}"
                },
                {
                    "source": "quick.qrc",
                    "target": "%{QuickDirectory}/%{QuickQrcFile}",
                    "condition": "%{JS: '%{CreateQuick}' !== ''}"
                },
                {
                    "source": "App.qml",
                    "target": "%{QuickDirectory}/App.qml",
                    "condition": "%{JS: '%{CreateQuick}' !== ''}"
                },
                {
                    "source": "view.qml",
                    "target": "%{QuickDirectory}/%{QuickQmlName}",
                    "condition": "%{JS: '%{CreateQuick}' !== ''}"
                },
                {
                    "source": "git.ignore",
                    "target": "%{ProjectDirectory}/.gitignore",
                    "condition": "%{JS: !%{IsSubproject} && '%{VersionControl}' === 'G.Git'}"
                }
			]
		}
	]
}