Merge lp:~zeller-benjamin/qtcreator-plugin-ubuntu/qmlproject_translations into lp:qtcreator-plugin-ubuntu
- qmlproject_translations
- Merge into trunk
Proposed by
Benjamin Zeller
Status: | Merged |
---|---|
Approved by: | Zoltan Balogh |
Approved revision: | 331 |
Merged at revision: | 312 |
Proposed branch: | lp:~zeller-benjamin/qtcreator-plugin-ubuntu/qmlproject_translations |
Merge into: | lp:qtcreator-plugin-ubuntu |
Prerequisite: | lp:~zeller-benjamin/qtcreator-plugin-ubuntu/migratewizard |
Diff against target: |
474 lines (+302/-24) 8 files modified
share/qtcreator/templates/wizards/ubuntu/share/.excludes (+1/-0) share/qtcreator/templates/wizards/ubuntu/simple/Makefile (+33/-6) share/qtcreator/templates/wizards/ubuntu/tabs/Makefile (+33/-6) src/ubuntu/ubuntuconstants.h (+2/-0) src/ubuntu/ubuntupackagestep.cpp (+5/-11) src/ubuntu/ubuntuplugin.cpp (+1/-0) src/ubuntu/ubuntuqmlbuildconfiguration.cpp (+179/-1) src/ubuntu/ubuntuqmlbuildconfiguration.h (+48/-0) |
To merge this branch: | bzr merge lp:~zeller-benjamin/qtcreator-plugin-ubuntu/qmlproject_translations |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zoltan Balogh | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+243772@code.launchpad.net |
Commit message
- Fix Bug lp:1355618 "Adding localization support in the template
application"
- Add extra steps for QML only based projects, but only automatically
enable them if certain conditions are met
Description of the change
- Fix Bug lp:1355618 "Adding localization support in the template
application"
- Add extra steps for QML only based projects, but only automatically
enable them if certain conditions are met
To post a comment you must log in.
- 331. By Benjamin Zeller
-
Fix strings in the Makefiles
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Approve
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'share/qtcreator/templates/wizards/ubuntu/share/.excludes' |
2 | --- share/qtcreator/templates/wizards/ubuntu/share/.excludes 2014-08-19 06:39:27 +0000 |
3 | +++ share/qtcreator/templates/wizards/ubuntu/share/.excludes 2014-12-05 10:15:24 +0000 |
4 | @@ -2,3 +2,4 @@ |
5 | *.tmp |
6 | .bzr |
7 | .git |
8 | +po |
9 | |
10 | === modified file 'share/qtcreator/templates/wizards/ubuntu/simple/Makefile' |
11 | --- share/qtcreator/templates/wizards/ubuntu/simple/Makefile 2014-06-30 15:20:18 +0000 |
12 | +++ share/qtcreator/templates/wizards/ubuntu/simple/Makefile 2014-12-05 10:15:24 +0000 |
13 | @@ -1,14 +1,34 @@ |
14 | # More information: https://wiki.ubuntu.com/Touch/Testing |
15 | # |
16 | # Notes for autopilot tests: |
17 | -# ----------------------------------------------------------- |
18 | +# --------------------------------------------------------------- |
19 | # In order to run autopilot tests: |
20 | # sudo apt-add-repository ppa:autopilot/ppa |
21 | # sudo apt-get update |
22 | # sudo apt-get install python-autopilot autopilot-qt |
23 | -############################################################# |
24 | - |
25 | -all: |
26 | +# |
27 | +# Notes for translations: |
28 | +# --------------------------------------------------------------- |
29 | +# In order to create translation files manually: |
30 | +# 1) run make once to create and update the po/template.pot |
31 | +# 2) copy the template file and set the name to the language you want to |
32 | +# translate to: cp po/template.pot po/de.po |
33 | +# 3) edit the po file |
34 | +# 4) run make build-translations to build the translation files |
35 | +# |
36 | +# Steps 1) and 4) are automatically executed by QtCreator |
37 | +################################################################# |
38 | + |
39 | +#APP_ID needs to match the "name" field of the click manifest |
40 | +APP_ID=%ClickDomain:l%.%ProjectName:l% |
41 | + |
42 | +#provides a way for the IDE to set a specific target folder for the translations |
43 | +TRANSLATION_ROOT=. |
44 | + |
45 | +MO_FILES=$(shell for infile in `find po -name "*.po"`; do basename -s .po $$infile | awk '{print "$(TRANSLATION_ROOT)/share/locale/" $$0 "/LC_MESSAGES/$(APP_ID).mo";}' ; done) |
46 | +QMLJS_FILES=$(shell find . -name "*.qml" -o -name "*.js" | grep -v ./tests) |
47 | + |
48 | +all: po/template.pot |
49 | |
50 | autopilot: |
51 | chmod +x tests/autopilot/run |
52 | @@ -17,5 +37,12 @@ |
53 | check: |
54 | qmltestrunner -input tests/unit |
55 | |
56 | -run: |
57 | - /usr/bin/qmlscene $@ %ProjectName%.qml |
58 | +#translation targets |
59 | + |
60 | +build-translations: $(MO_FILES) |
61 | + |
62 | +po/template.pot: $(QMLJS_FILES) |
63 | + mkdir -p $(CURDIR)/po && xgettext -o po/template.pot --qt --c++ --add-comments=TRANSLATORS --keyword=tr --keyword=tr:1,2 $(QMLJS_FILES) --from-code=UTF-8 |
64 | + |
65 | +$(TRANSLATION_ROOT)/share/locale/%/LC_MESSAGES/$(APP_ID).mo: po/%.po |
66 | + mkdir -p $(TRANSLATION_ROOT)/share/locale/$*/LC_MESSAGES && msgfmt -o $(@) $(<) |
67 | |
68 | === modified file 'share/qtcreator/templates/wizards/ubuntu/tabs/Makefile' |
69 | --- share/qtcreator/templates/wizards/ubuntu/tabs/Makefile 2014-06-30 15:20:18 +0000 |
70 | +++ share/qtcreator/templates/wizards/ubuntu/tabs/Makefile 2014-12-05 10:15:24 +0000 |
71 | @@ -1,14 +1,34 @@ |
72 | # More information: https://wiki.ubuntu.com/Touch/Testing |
73 | # |
74 | # Notes for autopilot tests: |
75 | -# ----------------------------------------------------------- |
76 | +# --------------------------------------------------------------- |
77 | # In order to run autopilot tests: |
78 | # sudo apt-add-repository ppa:autopilot/ppa |
79 | # sudo apt-get update |
80 | # sudo apt-get install python-autopilot autopilot-qt |
81 | -############################################################# |
82 | - |
83 | -all: |
84 | +# |
85 | +# Notes for translations: |
86 | +# --------------------------------------------------------------- |
87 | +# In order to create translation files manually: |
88 | +# 1) run make once to create and update the po/template.pot |
89 | +# 2) copy the template file and set the name to the language you want to |
90 | +# translate to: cp po/template.pot po/de.po |
91 | +# 3) edit the po file |
92 | +# 4) run make build-translations to build the translation files |
93 | +# |
94 | +# Steps 1) and 4) are automatically executed by QtCreator |
95 | +################################################################# |
96 | + |
97 | +#APP_ID needs to match the "name" field of the click manifest |
98 | +APP_ID=%ClickDomain:l%.%ProjectName:l% |
99 | + |
100 | +#provides a way for the IDE to set a specific target folder for the translations |
101 | +TRANSLATION_ROOT=. |
102 | + |
103 | +MO_FILES=$(shell for infile in `find po -name "*.po"`; do basename -s .po $$infile | awk '{print "$(TRANSLATION_ROOT)/share/locale/" $$0 "/LC_MESSAGES/$(APP_ID).mo";}' ; done) |
104 | +QMLJS_FILES=$(shell find . -name "*.qml" -o -name "*.js" | grep -v ./tests) |
105 | + |
106 | +all: po/template.pot |
107 | |
108 | autopilot: |
109 | chmod +x tests/autopilot/run |
110 | @@ -17,5 +37,12 @@ |
111 | check: |
112 | qmltestrunner -input tests/unit |
113 | |
114 | -run: |
115 | - /usr/bin/qmlscene $@ %ProjectName%.qml |
116 | +#translation targets |
117 | + |
118 | +build-translations: $(MO_FILES) |
119 | + |
120 | +po/template.pot: $(QMLJS_FILES) |
121 | + mkdir -p $(CURDIR)/po && xgettext -o po/template.pot --qt --c++ --add-comments=TRANSLATORS --keyword=tr --keyword=tr:1,2 $(QMLJS_FILES) --from-code=UTF-8 |
122 | + |
123 | +$(TRANSLATION_ROOT)/share/locale/%/LC_MESSAGES/$(APP_ID).mo: po/%.po |
124 | + mkdir -p $(TRANSLATION_ROOT)/share/locale/$*/LC_MESSAGES && msgfmt -o $(@) $(<) |
125 | |
126 | === modified file 'src/ubuntu/ubuntuconstants.h' |
127 | --- src/ubuntu/ubuntuconstants.h 2014-12-05 10:15:24 +0000 |
128 | +++ src/ubuntu/ubuntuconstants.h 2014-12-05 10:15:24 +0000 |
129 | @@ -524,6 +524,8 @@ |
130 | const char UBUNTU_CLICK_CHROOT_WRAPPER[] = "%0/qtc_chroot_wrapper.py"; |
131 | const char UBUNTU_CLICK_HTML_BC_ID[] = "UbuntuProjectManager.UbuntuHTML5.BuildConfiguration"; |
132 | const char UBUNTU_CLICK_QML_BC_ID[] = "UbuntuProjectManager.UbuntuQml.BuildConfiguration"; |
133 | +const char UBUNTU_CLICK_QML_UPDATE_TRANSL_MAKESTEP[] = "UbuntuProjectManager.UbuntuQml.UpdateTranslationTemplateMakeStep"; |
134 | +const char UBUNTU_CLICK_QML_BUILD_TRANSL_MAKESTEP[] = "UbuntuProjectManager.UbuntuQml.BuildTranslationMakeStep"; |
135 | //Devicesupport |
136 | const char UBUNTU_DEVICE_TYPE_ID[] = "UbuntuProjectManager.DeviceTypeId"; |
137 | const char UBUNTU_DEVICE_SSHIDENTITY[] = "%0/.config/ubuntu-sdk/ubuntudevice_id_rsa"; |
138 | |
139 | === modified file 'src/ubuntu/ubuntupackagestep.cpp' |
140 | --- src/ubuntu/ubuntupackagestep.cpp 2014-11-14 11:12:31 +0000 |
141 | +++ src/ubuntu/ubuntupackagestep.cpp 2014-12-05 10:15:24 +0000 |
142 | @@ -152,7 +152,7 @@ |
143 | //QML and HTML projects are just rsynced for now |
144 | QStringList arguments; |
145 | arguments << QStringLiteral("-avh") |
146 | - << QStringLiteral("--delete") |
147 | + //<< QStringLiteral("--delete") |
148 | << QStringLiteral("--exclude")<<QStringLiteral(".bzr") |
149 | << QStringLiteral("--exclude")<<QStringLiteral(".git") |
150 | << QStringLiteral("--exclude")<<QStringLiteral(".hg") |
151 | @@ -162,15 +162,8 @@ |
152 | << QStringLiteral("--exclude")<<QStringLiteral("tests") |
153 | << QStringLiteral("--exclude")<<QStringLiteral("Makefile") |
154 | << QStringLiteral("--exclude")<<QStringLiteral(".excludes") |
155 | - << QStringLiteral("--exclude")<<QStringLiteral("*.ubuntuhtmlproject"); |
156 | - |
157 | - QFile excludes (projectDir+QDir::separator()+QStringLiteral(".excludes")); |
158 | - if (excludes.open(QIODevice::ReadOnly)) { |
159 | - while (excludes.canReadLine()) { |
160 | - arguments << QStringLiteral("--exclude") << QString::fromUtf8(excludes.readLine()); |
161 | - } |
162 | - excludes.close(); |
163 | - } |
164 | + << QStringLiteral("--exclude")<<QStringLiteral("*.ubuntuhtmlproject") |
165 | + << QString(QStringLiteral("--exclude-from=%1")).arg(projectDir+QDir::separator()+QStringLiteral(".excludes")); |
166 | |
167 | arguments << projectDir+QDir::separator() |
168 | << deployDir; |
169 | @@ -356,7 +349,8 @@ |
170 | m_process->setEnvironment(params.environment()); |
171 | m_process->setWorkingDirectory(wd.absolutePath()); |
172 | |
173 | - if(debug) qDebug()<<"Starting process "<<params.effectiveCommand()<<params.effectiveArguments(); |
174 | + emit addOutput(tr("Starting: \"%1 %2\"").arg(params.effectiveCommand(),params.effectiveArguments()), |
175 | + BuildStep::MessageOutput); |
176 | |
177 | ProjectExplorer::IOutputParser *parser = target()->kit()->createOutputParser(); |
178 | |
179 | |
180 | === modified file 'src/ubuntu/ubuntuplugin.cpp' |
181 | --- src/ubuntu/ubuntuplugin.cpp 2014-12-05 10:15:24 +0000 |
182 | +++ src/ubuntu/ubuntuplugin.cpp 2014-12-05 10:15:24 +0000 |
183 | @@ -170,6 +170,7 @@ |
184 | addAutoReleasedObject(new UbuntuCMakeBuildConfigurationFactory); |
185 | addAutoReleasedObject(new UbuntuHtmlBuildConfigurationFactory); |
186 | addAutoReleasedObject(new UbuntuQmlBuildConfigurationFactory); |
187 | + addAutoReleasedObject(new UbuntuQmlBuildStepFactory); |
188 | |
189 | //ubuntu device support |
190 | addAutoReleasedObject(new UbuntuDeviceFactory); |
191 | |
192 | === modified file 'src/ubuntu/ubuntuqmlbuildconfiguration.cpp' |
193 | --- src/ubuntu/ubuntuqmlbuildconfiguration.cpp 2014-07-29 14:19:23 +0000 |
194 | +++ src/ubuntu/ubuntuqmlbuildconfiguration.cpp 2014-12-05 10:15:24 +0000 |
195 | @@ -8,6 +8,10 @@ |
196 | #include <projectexplorer/project.h> |
197 | #include <projectexplorer/buildinfo.h> |
198 | #include <projectexplorer/kit.h> |
199 | +#include <projectexplorer/buildstep.h> |
200 | +#include <projectexplorer/toolchain.h> |
201 | +#include <projectexplorer/kitinformation.h> |
202 | +#include <projectexplorer/buildsteplist.h> |
203 | #include <utils/fancylineedit.h> |
204 | #include <qmlprojectmanager/qmlprojectconstants.h> |
205 | |
206 | @@ -22,7 +26,7 @@ |
207 | * Even though QML projects don't need to be built, we need |
208 | * that BuildConfiguration to store the Builddirectory (where the click |
209 | * package goes) and to enable the Target page to show us some actual |
210 | - * targets |
211 | + * targets as well as to build the translations for click packaging |
212 | */ |
213 | |
214 | UbuntuQmlBuildConfiguration::UbuntuQmlBuildConfiguration(ProjectExplorer::Target *target) |
215 | @@ -107,6 +111,23 @@ |
216 | conf->setDefaultDisplayName(info->displayName); |
217 | conf->setDisplayName(info->displayName); |
218 | |
219 | + //is this a ubuntu project? |
220 | + Utils::FileName manifestFilePath = Utils::FileName::fromString(parent->project()->projectDirectory()).appendPath(QStringLiteral("manifest.json")); |
221 | + Utils::FileName makeFilePath = Utils::FileName::fromString(parent->project()->projectDirectory()).appendPath(QStringLiteral("Makefile")); |
222 | + if(manifestFilePath.toFileInfo().exists() |
223 | + && makeFilePath.toFileInfo().exists()) { |
224 | + |
225 | + //make sure the "build-translations" target is available in the Makefile |
226 | + QFile makefile(makeFilePath.toString()); |
227 | + if(makefile.open(QIODevice::ReadOnly)) { |
228 | + QByteArray data = makefile.readAll(); |
229 | + if(data.contains("build-translations:")) { |
230 | + ProjectExplorer::BuildStepList *bs = conf->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); |
231 | + bs->insertStep(0, new UbuntuQmlUpdateTranslationTemplateStep(bs)); |
232 | + bs->insertStep(1, new UbuntuQmlBuildTranslationStep(bs)); |
233 | + } |
234 | + } |
235 | + } |
236 | return conf; |
237 | } |
238 | |
239 | @@ -198,6 +219,163 @@ |
240 | m_pathChooser->blockSignals(false); |
241 | } |
242 | |
243 | +UbuntuQmlUpdateTranslationTemplateStep::UbuntuQmlUpdateTranslationTemplateStep(ProjectExplorer::BuildStepList *bsl) |
244 | + : UbuntuQmlUpdateTranslationTemplateStep(bsl,Constants::UBUNTU_CLICK_QML_UPDATE_TRANSL_MAKESTEP) |
245 | +{ |
246 | + setDefaultDisplayName(tr("Update translations template")); |
247 | +} |
248 | + |
249 | +UbuntuQmlUpdateTranslationTemplateStep::UbuntuQmlUpdateTranslationTemplateStep(ProjectExplorer::BuildStepList *bsl,Core::Id typeId) |
250 | + : AbstractProcessStep(bsl,typeId) |
251 | +{} |
252 | + |
253 | +UbuntuQmlUpdateTranslationTemplateStep::UbuntuQmlUpdateTranslationTemplateStep(ProjectExplorer::BuildStepList *bsl, UbuntuQmlUpdateTranslationTemplateStep *bs) |
254 | + : AbstractProcessStep(bsl,bs) |
255 | +{} |
256 | + |
257 | +bool UbuntuQmlUpdateTranslationTemplateStep::init() |
258 | +{ |
259 | + QString projectDir = target()->project()->projectDirectory(); |
260 | + |
261 | + ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration(); |
262 | + if(!bc) |
263 | + return false; |
264 | + |
265 | + ProjectExplorer::ProcessParameters *param = processParameters(); |
266 | + param->setWorkingDirectory(projectDir); |
267 | + param->setCommand(makeCommand(ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit()), bc->environment())); |
268 | + param->setMacroExpander(bc->macroExpander()); |
269 | + param->setEnvironment(bc->environment()); |
270 | + return true; |
271 | +} |
272 | + |
273 | +QString UbuntuQmlUpdateTranslationTemplateStep::makeCommand(ProjectExplorer::ToolChain *tc, const Utils::Environment &env) const |
274 | +{ |
275 | + if (tc) |
276 | + return tc->makeCommand(env); |
277 | + return QStringLiteral("make"); |
278 | +} |
279 | + |
280 | +ProjectExplorer::BuildStepConfigWidget *UbuntuQmlUpdateTranslationTemplateStep::createConfigWidget() |
281 | +{ |
282 | + return new ProjectExplorer::SimpleBuildStepConfigWidget(this); |
283 | +} |
284 | + |
285 | +UbuntuQmlBuildTranslationStep::UbuntuQmlBuildTranslationStep(ProjectExplorer::BuildStepList *bsl) |
286 | + : UbuntuQmlUpdateTranslationTemplateStep(bsl,Constants::UBUNTU_CLICK_QML_BUILD_TRANSL_MAKESTEP) |
287 | +{ |
288 | + setDefaultDisplayName(tr("Build translations")); |
289 | +} |
290 | + |
291 | +UbuntuQmlBuildTranslationStep::UbuntuQmlBuildTranslationStep(ProjectExplorer::BuildStepList *bsl, UbuntuQmlBuildTranslationStep *bs) |
292 | + : UbuntuQmlUpdateTranslationTemplateStep(bsl,bs) |
293 | +{} |
294 | + |
295 | +bool UbuntuQmlBuildTranslationStep::init() |
296 | +{ |
297 | + if(!UbuntuQmlUpdateTranslationTemplateStep::init()) |
298 | + return false; |
299 | + |
300 | + ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration(); |
301 | + if(!bc) |
302 | + return false; |
303 | + |
304 | + QString deployDir = bc->buildDirectory().toString() |
305 | + + QDir::separator() |
306 | + + QString::fromLatin1(Constants::UBUNTU_DEPLOY_DESTDIR); |
307 | + |
308 | + processParameters()->setArguments(QString::fromLatin1("TRANSLATION_ROOT=%1 build-translations").arg(deployDir)); |
309 | + return true; |
310 | +} |
311 | + |
312 | +ProjectExplorer::BuildStepConfigWidget *UbuntuQmlBuildTranslationStep::createConfigWidget() |
313 | +{ |
314 | + return new ProjectExplorer::SimpleBuildStepConfigWidget(this); |
315 | +} |
316 | + |
317 | +QList<Core::Id> UbuntuQmlBuildStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const |
318 | +{ |
319 | + if(parent->id() != ProjectExplorer::Constants::BUILDSTEPS_BUILD) |
320 | + return QList<Core::Id>(); |
321 | + |
322 | + UbuntuKitMatcher m; |
323 | + if(!m.matches(parent->target()->kit()) |
324 | + || parent->target()->project()->id() != "QmlProjectManager.QmlProject") |
325 | + return QList<Core::Id>(); |
326 | + |
327 | + return QList<Core::Id>()<<Constants::UBUNTU_CLICK_QML_BUILD_TRANSL_MAKESTEP<<Constants::UBUNTU_CLICK_QML_UPDATE_TRANSL_MAKESTEP; |
328 | +} |
329 | + |
330 | +QString UbuntuQmlBuildStepFactory::displayNameForId(const Core::Id id) const |
331 | +{ |
332 | + if(id == Constants::UBUNTU_CLICK_QML_BUILD_TRANSL_MAKESTEP) |
333 | + return tr("Build translations"); |
334 | + else if(id == Constants::UBUNTU_CLICK_QML_UPDATE_TRANSL_MAKESTEP) |
335 | + return tr("Update translations template"); |
336 | + return QString(); |
337 | +} |
338 | + |
339 | +bool UbuntuQmlBuildStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const |
340 | +{ |
341 | + return availableCreationIds(parent).contains(id); |
342 | +} |
343 | + |
344 | +ProjectExplorer::BuildStep *UbuntuQmlBuildStepFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id) |
345 | +{ |
346 | + QTC_ASSERT(canCreate(parent,id),return 0); |
347 | + |
348 | + if(id == Constants::UBUNTU_CLICK_QML_BUILD_TRANSL_MAKESTEP) |
349 | + return new UbuntuQmlBuildTranslationStep(parent); |
350 | + else if(id == Constants::UBUNTU_CLICK_QML_UPDATE_TRANSL_MAKESTEP) |
351 | + return new UbuntuQmlUpdateTranslationTemplateStep(parent); |
352 | + |
353 | + return nullptr; |
354 | +} |
355 | + |
356 | +bool UbuntuQmlBuildStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const |
357 | +{ |
358 | + return availableCreationIds(parent).contains(ProjectExplorer::idFromMap(map)); |
359 | +} |
360 | + |
361 | +ProjectExplorer::BuildStep *UbuntuQmlBuildStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) |
362 | +{ |
363 | + QTC_ASSERT(canRestore(parent,map),return 0); |
364 | + |
365 | + ProjectExplorer::AbstractProcessStep *step = 0; |
366 | + Core::Id id = ProjectExplorer::idFromMap(map); |
367 | + |
368 | + if(id == Constants::UBUNTU_CLICK_QML_BUILD_TRANSL_MAKESTEP) |
369 | + step = new UbuntuQmlBuildTranslationStep(parent); |
370 | + else if(id == Constants::UBUNTU_CLICK_QML_UPDATE_TRANSL_MAKESTEP) |
371 | + step = new UbuntuQmlUpdateTranslationTemplateStep(parent); |
372 | + |
373 | + if(!step) |
374 | + return nullptr; |
375 | + |
376 | + if(!step->fromMap(map)) { |
377 | + delete step; |
378 | + return nullptr; |
379 | + } |
380 | + return step; |
381 | +} |
382 | + |
383 | +bool UbuntuQmlBuildStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const |
384 | +{ |
385 | + return availableCreationIds(parent).contains(product->id()); |
386 | +} |
387 | + |
388 | +ProjectExplorer::BuildStep *UbuntuQmlBuildStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) |
389 | +{ |
390 | + QTC_ASSERT(canClone(parent,product),return 0); |
391 | + |
392 | + const Core::Id id = product->id(); |
393 | + if(id == Constants::UBUNTU_CLICK_QML_BUILD_TRANSL_MAKESTEP) |
394 | + return new UbuntuQmlBuildTranslationStep(parent, static_cast<UbuntuQmlBuildTranslationStep *>(product)); |
395 | + else if(id == Core::Id(Constants::UBUNTU_CLICK_QML_UPDATE_TRANSL_MAKESTEP)) |
396 | + return new UbuntuQmlUpdateTranslationTemplateStep(parent, static_cast<UbuntuQmlUpdateTranslationTemplateStep *>(product)); |
397 | + |
398 | + return 0; |
399 | +} |
400 | |
401 | } // namespace Internal |
402 | } // namespace Ubuntu |
403 | |
404 | === modified file 'src/ubuntu/ubuntuqmlbuildconfiguration.h' |
405 | --- src/ubuntu/ubuntuqmlbuildconfiguration.h 2014-07-29 14:19:23 +0000 |
406 | +++ src/ubuntu/ubuntuqmlbuildconfiguration.h 2014-12-05 10:15:24 +0000 |
407 | @@ -4,6 +4,11 @@ |
408 | #include <projectexplorer/buildconfiguration.h> |
409 | #include <utils/pathchooser.h> |
410 | #include <projectexplorer/namedwidget.h> |
411 | +#include <projectexplorer/abstractprocessstep.h> |
412 | + |
413 | +namespace ProjectExplorer { |
414 | + class ToolChain; |
415 | +} |
416 | |
417 | namespace Ubuntu { |
418 | namespace Internal { |
419 | @@ -43,6 +48,33 @@ |
420 | UbuntuQmlBuildConfiguration *m_buildConfiguration; |
421 | }; |
422 | |
423 | +class UbuntuQmlUpdateTranslationTemplateStep : public ProjectExplorer::AbstractProcessStep |
424 | +{ |
425 | + Q_OBJECT |
426 | +public: |
427 | + UbuntuQmlUpdateTranslationTemplateStep(ProjectExplorer::BuildStepList *bsl); |
428 | + UbuntuQmlUpdateTranslationTemplateStep(ProjectExplorer::BuildStepList *bsl, Core::Id typeId); |
429 | + UbuntuQmlUpdateTranslationTemplateStep(ProjectExplorer::BuildStepList *bsl, UbuntuQmlUpdateTranslationTemplateStep *bs); |
430 | + |
431 | + // BuildStep interface |
432 | + virtual bool init(); |
433 | + virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); |
434 | + |
435 | + QString makeCommand(ProjectExplorer::ToolChain *tc, const Utils::Environment &env) const; |
436 | +}; |
437 | + |
438 | +class UbuntuQmlBuildTranslationStep : public UbuntuQmlUpdateTranslationTemplateStep |
439 | +{ |
440 | + Q_OBJECT |
441 | +public: |
442 | + UbuntuQmlBuildTranslationStep(ProjectExplorer::BuildStepList *bsl); |
443 | + UbuntuQmlBuildTranslationStep(ProjectExplorer::BuildStepList *bsl, UbuntuQmlBuildTranslationStep *bs); |
444 | + |
445 | + // BuildStep interface |
446 | + virtual bool init(); |
447 | + virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); |
448 | +}; |
449 | + |
450 | class UbuntuQmlBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory |
451 | { |
452 | Q_OBJECT |
453 | @@ -65,6 +97,22 @@ |
454 | QList<ProjectExplorer::BuildInfo *> createBuildInfos (const ProjectExplorer::Kit *k, const QString &projectDir) const; |
455 | }; |
456 | |
457 | +class UbuntuQmlBuildStepFactory : public ProjectExplorer::IBuildStepFactory |
458 | +{ |
459 | + Q_OBJECT |
460 | + |
461 | +public: |
462 | + // IBuildStepFactory interface |
463 | + virtual QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const override; |
464 | + virtual QString displayNameForId(const Core::Id id) const override; |
465 | + virtual bool canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const override; |
466 | + virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, const Core::Id id) override; |
467 | + virtual bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const override; |
468 | + virtual ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) override; |
469 | + virtual bool canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const override; |
470 | + virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) override; |
471 | +}; |
472 | + |
473 | } // namespace Internal |
474 | } // namespace Ubuntu |
475 |
PASSED: Continuous integration, rev:331 jenkins. qa.ubuntu. com/job/ qtcreator- plugin- ubuntu- ci/481/ jenkins. qa.ubuntu. com/job/ qtcreator- plugin- ubuntu- vivid-amd64- ci/15 jenkins. qa.ubuntu. com/job/ qtcreator- plugin- ubuntu- vivid-armhf- ci/15
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/qtcreator- plugin- ubuntu- ci/481/ rebuild
http://