1{
2    "version": 1,
3    "supportedProjectTypes": [ "MesonProjectManager.MesonProject", "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ],
4    "id": "H.CppLibrary",
5    "category": "G.Library",
6    "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>",
7    "trDisplayName": "C++ Library",
8    "trDisplayCategory": "Library",
9    "icon": "../../global/lib.png",
10    "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0 && (value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0 || value('Plugins').indexOf('MesonProjectManager') >= 0)}",
11
12    "options":
13    [
14        { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'cmake' ? value('CMakeFile') : ( value('BuildSystem') === 'meson' ? value('MesonFile') : value('ProFile') )}" },
15        { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), value('BuildSystem') === 'qmake' ? 'pro' : 'qbs')}" },
16        { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" },
17        { "key": "MesonFile", "value": "%{ProjectDirectory}/meson.build" },
18        { "key": "PluginJsonFile", "value": "%{JS: Util.fileName(value('ProjectName'), 'json')}" },
19        { "key": "IsShared", "value": "%{JS: value('Type') === 'shared'}" },
20        { "key": "IsStatic", "value": "%{JS: value('Type') === 'static'}" },
21        { "key": "IsQtPlugin", "value": "%{JS: value('Type') === 'qtplugin'}" },
22        { "key": "BaseClassName", "value": "%{JS: value('BaseClassInfo').BaseClassName }" },
23        { "key": "PluginTargetPath", "value": "%{JS: value('BaseClassInfo').PluginTargetPath }" },
24        { "key": "PluginInterface", "value": "%{JS: value('BaseClassInfo').PluginInterface }" },
25        { "key": "PluginModule", "value": "%{JS: value('BaseClassInfo').PluginModule }" },
26        { "key": "PluginMethods", "value": "%{JS: value('BaseClassInfo').PluginMethods }" },
27        { "key": "QtModule", "value": "%{JS: value('IsQtPlugin') === 'true' ? value('PluginModule') : value('LibraryQtModule')}" },
28        { "key": "QtModuleUpperCase", "value": "%{JS: value('QtModule').charAt(0).toUpperCase() + value('QtModule').slice(1)}" },
29        { "key": "LibraryDefine", "value": "%{JS: Cpp.headerGuard(value('ProjectName')) + '_LIBRARY'}" },
30        { "key": "LibraryExport", "value": "%{JS: Cpp.headerGuard(value('ProjectName')) + '_EXPORT'}" },
31        { "key": "GlobalHdrFileName", "value": "%{JS: Util.fileName(value('ProjectName') + '_global', Util.preferredSuffix('text/x-c++hdr'))}" },
32        { "key": "TargetInstallPath", "value": "%{JS: value('IsShared') === 'true' ? '/usr/lib' : (value('IsQtPlugin') && value('PluginTargetPath') ? '$$[QT_INSTALL_PLUGINS]/' + value('PluginTargetPath') : '')}" },
33        { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" },
34        { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('Class'), Util.suffix(value('HdrFileName')))}" },
35        { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" },
36        { "key": "GLOBAL_GUARD", "value": "%{JS: Cpp.headerGuard(value('GlobalHdrFileName'))}" }
37    ],
38
39    "pages":
40    [
41        {
42            "trDisplayName": "Project Location",
43            "trShortTitle": "Location",
44            "typeId": "Project",
45            "data": { "trDescription": "This wizard creates a C++ library project." }
46        },
47        {
48            "trDisplayName": "Define Build System",
49            "trShortTitle": "Build System",
50            "typeId": "Fields",
51            "enabled": "%{JS: !value('IsSubproject')}",
52            "data":
53            [
54                {
55                    "name": "BuildSystem",
56                    "trDisplayName": "Build system:",
57                    "type": "ComboBox",
58                    "persistenceKey": "BuildSystemType",
59                    "data":
60                    {
61                        "index": 0,
62                        "items":
63                        [
64                            {
65                                "trKey": "qmake",
66                                "value": "qmake",
67                                "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}"
68                            },
69                            {
70                                "trKey": "CMake",
71                                "value": "cmake",
72                                "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}"
73                            },
74                            {
75                                "trKey": "Qbs",
76                                "value": "qbs",
77                                "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}"
78                            },
79                            {
80                                "trKey": "Meson",
81                                "value": "meson",
82                                "condition": "%{JS: value('Plugins').indexOf('MesonProjectManager') >= 0}"
83                            }
84                        ]
85                    }
86                }
87            ]
88        },
89        {
90            "trDisplayName": "Define Project Details",
91            "trShortTitle": "Details",
92            "typeId": "Fields",
93            "data":
94            [
95                {
96                    "name": "ClassPageDescription",
97                    "type": "Label",
98                    "data":
99                    {
100                        "trText": "Specify basic information about the classes for which you want to generate skeleton source code files.",
101                        "wordWrap": true
102                    }
103                },
104                {
105                    "name": "Type",
106                    "trDisplayName": "Type:",
107                    "type": "ComboBox",
108                    "data":
109                    {
110                        "index": 0,
111                        "items":
112                        [
113                            {
114                                "trKey": "Shared Library",
115                                "value": "shared"
116                            },
117                            {
118                                "trKey": "Statically Linked Library",
119                                "value": "static"
120                            },
121                            {
122                                "trKey": "Qt Plugin",
123                                "value": "qtplugin"
124                            }
125                        ]
126                    }
127                },
128                {
129                    "name": "Sp0",
130                    "type": "Spacer"
131                },
132                {
133                    "name": "Class",
134                    "trDisplayName": "Class name:",
135                    "mandatory": true,
136                    "type": "LineEdit",
137                    "data":
138                    {
139                        "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)",
140                        "trText": "%{JS: value('Type') === 'qtplugin' ? value('BaseClassName').slice(1) : (value('ProjectName').charAt(0).toUpperCase() + value('ProjectName').slice(1))}"
141                    }
142                },
143                {
144                    "name": "BaseClassInfo",
145                    "trDisplayName": "Base class:",
146                    "type": "ComboBox",
147                    "visible": "%{JS: value('Type') === 'qtplugin'}",
148                    "data":
149                    {
150                        "index": 1,
151                        "items":
152                        [
153                            {
154                                "trKey": "QAccessiblePlugin",
155                                "value":
156                                {
157                                    "BaseClassName": "QAccessiblePlugin",
158                                    "PluginTargetPath": "accessible",
159                                    "PluginInterface": "QAccessibleFactoryInterface",
160                                    "PluginModule": "gui",
161                                    "PluginMethods": "QAccessibleInterface *create(const QString &key, QObject *object)"
162                                }
163                            },
164                            {
165                                "trKey": "QGenericPlugin",
166                                "value":
167                                {
168                                    "BaseClassName": "QGenericPlugin",
169                                    "PluginTargetPath": "generic",
170                                    "PluginInterface": "QGenericPluginFactoryInterface",
171                                    "PluginModule": "gui",
172                                    "PluginMethods": "QObject *create(const QString &name, const QString &spec)"
173                                }
174                            },
175                            {
176                                "trKey": "QIconEnginePlugin",
177                                "value":
178                                {
179                                    "BaseClassName": "QIconEnginePlugin",
180                                    "PluginTargetPath": "imageformats",
181                                    "PluginInterface": "QIconEngineFactoryInterface",
182                                    "PluginModule": "gui",
183                                    "PluginMethods": "QIconEngine *create(const QString &filename)"
184                                }
185                            },
186                            {
187                                "trKey": "QImageIOPlugin",
188                                "value":
189                                {
190                                    "BaseClassName": "QImageIOPlugin",
191                                    "PluginTargetPath": "imageformats",
192                                    "PluginInterface": "QImageIOHandlerFactoryInterface",
193                                    "PluginModule": "gui",
194                                    "PluginMethods": "QImageIOPlugin::Capabilities capabilities(QIODevice *device, const QByteArray &format) const|QImageIOHandler *create(QIODevice *device, const QByteArray &format) const"
195                                }
196                            },
197                            {
198                                "trKey": "QScriptExtensionPlugin",
199                                "value":
200                                {
201                                    "BaseClassName": "QScriptExtensionPlugin",
202                                    "PluginTargetPath": "",
203                                    "PluginInterface": "QScriptExtensionInterface",
204                                    "PluginModule": "script",
205                                    "PluginMethods": "void initialize(const QString &key, QScriptEngine *engine)|QStringList keys() const"
206                                }
207                            },
208                            {
209                                "trKey": "QSqlDriverPlugin",
210                                "value":
211                                {
212                                    "BaseClassName": "QSqlDriverPlugin",
213                                    "PluginTargetPath": "sqldrivers",
214                                    "PluginInterface": "QSqlDriverFactoryInterface",
215                                    "PluginModule": "sql",
216                                    "PluginMethods": "QSqlDriver *create(const QString &key)"
217                                }
218                            },
219                            {
220                                "trKey": "QStylePlugin",
221                                "value":
222                                {
223                                    "BaseClassName": "QStylePlugin",
224                                    "PluginTargetPath": "styles",
225                                    "PluginInterface": "QStyleFactoryInterface",
226                                    "PluginModule": "widgets",
227                                    "PluginMethods": "QStyle *create(const QString &key)"
228                                }
229                            }
230                        ]
231                    }
232                },
233                {
234                    "name": "LibraryQtModule",
235                    "trDisplayName": "Qt module:",
236                    "type": "ComboBox",
237                    "visible": "%{JS: value('Type') != 'qtplugin'}",
238                    "data":
239                    {
240                        "index": 1,
241                        "items":
242                        [
243                            {
244                                "trKey": "None",
245                                "value": "none"
246                            },
247                            {
248                                "trKey": "Core",
249                                "value": "core"
250                            },
251                            {
252                                "trKey": "Gui",
253                                "value": "gui"
254                            },
255                            {
256                                "trKey": "Widgets",
257                                "value": "widgets"
258                            }
259                        ]
260                    }
261                },
262                {
263                    "name": "Sp1",
264                    "type": "Spacer"
265                },
266                {
267                    "name": "HdrFileName",
268                    "type": "LineEdit",
269                    "trDisplayName": "Header file:",
270                    "mandatory": true,
271                    "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++hdr'))}" }
272                },
273                {
274                    "name": "SrcFileName",
275                    "type": "LineEdit",
276                    "trDisplayName": "Source file:",
277                    "mandatory": true,
278                    "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++src'))}" }
279                }
280            ]
281        },
282        {
283            "trDisplayName": "Translation File",
284            "trShortTitle": "Translation",
285            "data": { "enabled": "%{JS: value('QtModule') === 'none' ? 'no' : 'yes'}" },
286            "typeId": "QtTranslation"
287        },
288        {
289            "trDisplayName": "Kit Selection",
290            "trShortTitle": "Kits",
291            "typeId": "Kits",
292            "enabled": "%{JS: !value('IsSubproject')}",
293            "data": { "projectFilePath": "%{ProjectFile}" }
294        },
295        {
296            "trDisplayName": "Project Management",
297            "trShortTitle": "Summary",
298            "typeId": "Summary"
299        }
300    ],
301    "generators":
302    [
303        {
304            "typeId": "File",
305            "data":
306            [
307                {
308                    "source": "project.pro",
309                    "target": "%{ProFile}",
310                    "openAsProject": true,
311                    "condition": "%{JS: value('BuildSystem') === 'qmake'}"
312                },
313                {
314                    "source": "project.qbs",
315                    "target": "%{ProFile}",
316                    "openAsProject": true,
317                    "condition": "%{JS: value('BuildSystem') === 'qbs'}"
318                },
319                {
320                    "source": "CMakeLists.txt",
321                    "openAsProject": true,
322                    "condition": "%{JS: value('BuildSystem') === 'cmake'}"
323                },
324                {
325                    "source": "meson.build",
326                    "openAsProject": true,
327                    "condition": "%{JS: value('BuildSystem') === 'meson'}"
328                },
329                {
330                    "source": "lib.cpp",
331                    "target": "%{SrcFileName}",
332                    "openInEditor": true
333                },
334                {
335                    "source": "lib.h",
336                    "target": "%{HdrFileName}"
337                },
338                {
339                    "source": "lib_global.h",
340                    "target": "%{GlobalHdrFileName}",
341                    "condition": "%{JS: value('Type') === 'shared'}"
342                },
343                {
344                    "source": "project.json",
345                    "target": "%{PluginJsonFile}",
346                    "condition": "%{JS: value('Type') === 'qtplugin'}"
347                },
348                {
349                    "source": "../translation.ts",
350                    "target": "%{TsFileName}",
351                    "condition": "%{HasTranslation}"
352                },
353                {
354                    "source": "../git.ignore",
355                    "target": ".gitignore",
356                    "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
357                }
358            ]
359        }
360    ]
361}
362