{
    "version": 1,
    "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ],
    "id": "H.CppLibrary",
    "category": "G.Library",
    "trDescription": "Creates a C++ library. This can be used to create:<ul><li>a shared C++ library for use with <tt>QPluginLoader</tt> and runtime (Plugins)</li><li>a shared or static C++ library for use with another project at linktime</li></ul>",
    "trDisplayName": "C++ Library",
    "trDisplayCategory": "Library",
    "icon": "../../global/lib.png",
    "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0 && (value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0)}",

    "options":
    [
        { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('ProFile')}" },
        { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), value('BuildSystem') === 'qmake' ? 'pro' : 'qbs')}" },
        { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" },
        { "key": "PluginJsonFile", "value": "%{JS: Util.fileName(value('ProjectName'), 'json')}" },
        { "key": "IsShared", "value": "%{JS: value('Type') === 'shared'}" },
        { "key": "IsStatic", "value": "%{JS: value('Type') === 'static'}" },
        { "key": "IsQtPlugin", "value": "%{JS: value('Type') === 'qtplugin'}" },
        { "key": "BaseClassName", "value": "%{JS: value('BaseClassInfo').BaseClassName }" },
        { "key": "PluginTargetPath", "value": "%{JS: value('BaseClassInfo').PluginTargetPath }" },
        { "key": "PluginInterface", "value": "%{JS: value('BaseClassInfo').PluginInterface }" },
        { "key": "PluginModule", "value": "%{JS: value('BaseClassInfo').PluginModule }" },
        { "key": "PluginMethods", "value": "%{JS: value('BaseClassInfo').PluginMethods }" },
        { "key": "QtModule", "value": "%{JS: value('IsQtPlugin') === 'true' ? value('PluginModule') : value('LibraryQtModule')}" },
        { "key": "QtModuleUpperCase", "value": "%{JS: value('QtModule').charAt(0).toUpperCase() + value('QtModule').slice(1)}" },
        { "key": "LibraryDefine", "value": "%{JS: Cpp.headerGuard(value('ProjectName')) + '_LIBRARY'}" },
        { "key": "LibraryExport", "value": "%{JS: Cpp.headerGuard(value('ProjectName')) + '_EXPORT'}" },
        { "key": "GlobalHdrFileName", "value": "%{JS: Util.fileName(value('ProjectName') + '_global', Util.preferredSuffix('text/x-c++hdr'))}" },
        { "key": "TargetInstallPath", "value": "%{JS: value('IsShared') === 'true' ? '/usr/lib' : (value('IsQtPlugin') && value('PluginTargetPath') ? '$$[QT_INSTALL_PLUGINS]/' + value('PluginTargetPath') : '')}" },
        { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" },
        { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('Class'), Util.suffix(value('HdrFileName')))}" },
        { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" },
        { "key": "GLOBAL_GUARD", "value": "%{JS: Cpp.headerGuard(value('GlobalHdrFileName'))}" }
    ],

    "pages":
    [
        {
            "trDisplayName": "Project Location",
            "trShortTitle": "Location",
            "typeId": "Project",
            "data": { "trDescription": "This wizard creates a C++ library project." }
        },
        {
            "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": "Define Project Details",
            "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": "Type",
                    "trDisplayName": "Type:",
                    "type": "ComboBox",
                    "data":
                    {
                        "index": 0,
                        "items":
                        [
                            {
                                "trKey": "Shared Library",
                                "value": "shared"
                            },
                            {
                                "trKey": "Statically Linked Library",
                                "value": "static"
                            },
                            {
                                "trKey": "Qt Plugin",
                                "value": "qtplugin"
                            }
                        ]
                    }
                },
                {
                    "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('Type') === 'qtplugin' ? value('BaseClassName').slice(1) : (value('ProjectName').charAt(0).toUpperCase() + value('ProjectName').slice(1))}"
                    }
                },
                {
                    "name": "BaseClassInfo",
                    "trDisplayName": "Base class:",
                    "type": "ComboBox",
                    "visible": "%{JS: value('Type') === 'qtplugin'}",
                    "data":
                    {
                        "index": 1,
                        "items":
                        [
                            {
                                "trKey": "QAccessiblePlugin",
                                "value":
                                {
                                    "BaseClassName": "QAccessiblePlugin",
                                    "PluginTargetPath": "accessible",
                                    "PluginInterface": "QAccessibleFactoryInterface",
                                    "PluginModule": "gui",
                                    "PluginMethods": "QAccessibleInterface *create(const QString &key, QObject *object)"
                                }
                            },
                            {
                                "trKey": "QGenericPlugin",
                                "value":
                                {
                                    "BaseClassName": "QGenericPlugin",
                                    "PluginTargetPath": "generic",
                                    "PluginInterface": "QGenericPluginFactoryInterface",
                                    "PluginModule": "gui",
                                    "PluginMethods": "QObject *create(const QString &name, const QString &spec)"
                                }
                            },
                            {
                                "trKey": "QIconEnginePlugin",
                                "value":
                                {
                                    "BaseClassName": "QIconEnginePlugin",
                                    "PluginTargetPath": "imageformats",
                                    "PluginInterface": "QIconEngineFactoryInterface",
                                    "PluginModule": "gui",
                                    "PluginMethods": "QIconEngine *create(const QString &filename)"
                                }
                            },
                            {
                                "trKey": "QImageIOPlugin",
                                "value":
                                {
                                    "BaseClassName": "QImageIOPlugin",
                                    "PluginTargetPath": "imageformats",
                                    "PluginInterface": "QImageIOHandlerFactoryInterface",
                                    "PluginModule": "gui",
                                    "PluginMethods": "QImageIOPlugin::Capabilities capabilities(QIODevice *device, const QByteArray &format) const|QImageIOHandler *create(QIODevice *device, const QByteArray &format) const"
                                }
                            },
                            {
                                "trKey": "QScriptExtensionPlugin",
                                "value":
                                {
                                    "BaseClassName": "QScriptExtensionPlugin",
                                    "PluginTargetPath": "",
                                    "PluginInterface": "QScriptExtensionInterface",
                                    "PluginModule": "script",
                                    "PluginMethods": "void initialize(const QString &key, QScriptEngine *engine)|QStringList keys() const"
                                }
                            },
                            {
                                "trKey": "QSqlDriverPlugin",
                                "value":
                                {
                                    "BaseClassName": "QSqlDriverPlugin",
                                    "PluginTargetPath": "sqldrivers",
                                    "PluginInterface": "QSqlDriverFactoryInterface",
                                    "PluginModule": "sql",
                                    "PluginMethods": "QSqlDriver *create(const QString &key)"
                                }
                            },
                            {
                                "trKey": "QStylePlugin",
                                "value":
                                {
                                    "BaseClassName": "QStylePlugin",
                                    "PluginTargetPath": "styles",
                                    "PluginInterface": "QStyleFactoryInterface",
                                    "PluginModule": "widgets",
                                    "PluginMethods": "QStyle *create(const QString &key)"
                                }
                            }
                        ]
                    }
                },
                {
                    "name": "LibraryQtModule",
                    "trDisplayName": "Qt module:",
                    "type": "ComboBox",
                    "visible": "%{JS: value('Type') != 'qtplugin'}",
                    "data":
                    {
                        "index": 1,
                        "items":
                        [
                            {
                                "trKey": "None",
                                "value": "none"
                            },
                            {
                                "trKey": "Core",
                                "value": "core"
                            },
                            {
                                "trKey": "Gui",
                                "value": "gui"
                            },
                            {
                                "trKey": "Widgets",
                                "value": "widgets"
                            }
                        ]
                    }
                },
                {
                    "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'))}" }
                }
            ]
        },
        {
            "trDisplayName": "Translation File",
            "trShortTitle": "Translation",
            "data": { "enabled": "%{JS: value('QtModule') === 'none' ? 'no' : 'yes'}" },
            "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": "project.qbs",
                    "target": "%{ProFile}",
                    "openAsProject": true,
                    "condition": "%{JS: value('BuildSystem') === 'qbs'}"
                },
                {
                    "source": "CMakeLists.txt",
                    "openAsProject": true,
                    "condition": "%{JS: value('BuildSystem') === 'cmake'}"
                },
                {
                    "source": "lib.cpp",
                    "target": "%{SrcFileName}",
                    "openInEditor": true
                },
                {
                    "source": "lib.h",
                    "target": "%{HdrFileName}"
                },
                {
                    "source": "lib_global.h",
                    "target": "%{GlobalHdrFileName}",
                    "condition": "%{JS: value('Type') === 'shared'}"
                },
                {
                    "source": "project.json",
                    "target": "%{PluginJsonFile}",
                    "condition": "%{JS: value('Type') === 'qtplugin'}"
                },
                {
                    "source": "../translation.ts",
                    "target": "%{TsFileName}",
                    "condition": "%{HasTranslation}"
                },
                {
                    "source": "../git.ignore",
                    "target": ".gitignore",
                    "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
                }
            ]
        }
    ]
}
