summaryrefslogtreecommitdiff
path: root/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json
blob: 0b12fd67e11085c78e70183e921900a7566c035a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
{
    "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'}"
                }
            ]
        }
    ]
}