Merge lp:~zeller-benjamin/qtcreator-plugin-ubuntu/bughunt-27082015 into lp:qtcreator-plugin-ubuntu/3.1

Proposed by Benjamin Zeller
Status: Merged
Merged at revision: 408
Proposed branch: lp:~zeller-benjamin/qtcreator-plugin-ubuntu/bughunt-27082015
Merge into: lp:qtcreator-plugin-ubuntu/3.1
Diff against target: 409 lines (+122/-42)
12 files modified
share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.desktop (+1/-1)
share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.pro (+9/-3)
share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/projectName.pro (+6/-5)
share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.desktop (+1/-1)
share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.pro (+9/-2)
share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/projectName.pro (+7/-6)
share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.desktop (+1/-1)
share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.pro (+9/-3)
share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/projectName.pro (+7/-6)
share/qtcreator/ubuntu/scripts/qtc_device_applaunch.py (+8/-3)
src/ubuntu/ubuntupackagestep.cpp (+1/-1)
ubuntu-click-tools.prf (+63/-10)
To merge this branch: bzr merge lp:~zeller-benjamin/qtcreator-plugin-ubuntu/bughunt-27082015
Reviewer Review Type Date Requested Status
Zoltan Balogh Approve
Review via email: mp+269329@code.launchpad.net

Commit message

- Catch "permission denied" error if opening syslog is not allowed
- Fix Bug lp:1480771 "Wrong directory used for translation"
- Fix Bug lp:1443351 ".desktop file is not translated for qmake based
projects"
- Fix Bug lp:1479581 "Debug helper is disabled by default"
- Fix Bug lp:1481325 "fix i18n integration in qmake template"

Description of the change

- Catch "permission denied" error if opening syslog is not allowed
- Fix Bug lp:1480771 "Wrong directory used for translation"
- Fix Bug lp:1443351 ".desktop file is not translated for qmake based
projects"
- Fix Bug lp:1479581 "Debug helper is disabled by default"
- Fix Bug lp:1481325 "fix i18n integration in qmake template"

To post a comment you must log in.
Revision history for this message
Zoltan Balogh (bzoltan) wrote :

Let's test it

review: Approve
408. By Benjamin Zeller

Add bugs

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.desktop'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.desktop 2015-01-17 04:53:32 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.desktop 2015-08-27 10:44:50 +0000
@@ -1,5 +1,5 @@
1[Desktop Entry]1[Desktop Entry]
2Name=%ClickHookName%2_Name=%ClickHookName%
3Exec=qmlscene $@ %ClickHookName%/Main.qml3Exec=qmlscene $@ %ClickHookName%/Main.qml
4Icon=%ClickHookName%/%ClickHookName%.png4Icon=%ClickHookName%/%ClickHookName%.png
5Terminal=false5Terminal=false
66
=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.pro'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.pro 2015-05-26 09:46:32 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.pro 2015-08-27 10:44:50 +0000
@@ -7,7 +7,6 @@
7 $$files(*.js,true)7 $$files(*.js,true)
88
9CONF_FILES += %ClickHookName%.apparmor \9CONF_FILES += %ClickHookName%.apparmor \
10 %ClickHookName%.desktop \
11 %ClickHookName%.png10 %ClickHookName%.png
1211
13AP_TEST_FILES += tests/autopilot/run \12AP_TEST_FILES += tests/autopilot/run \
@@ -15,7 +14,8 @@
1514
16OTHER_FILES += $${CONF_FILES} \15OTHER_FILES += $${CONF_FILES} \
17 $${QML_FILES} \16 $${QML_FILES} \
18 $${AP_TEST_FILES}17 $${AP_TEST_FILES} \
18 %ClickHookName%.desktop
1919
20#specify where the qml/js files are installed to20#specify where the qml/js files are installed to
21qml_files.path = /%ClickHookName%21qml_files.path = /%ClickHookName%
@@ -25,4 +25,10 @@
25config_files.path = /%ClickHookName%25config_files.path = /%ClickHookName%
26config_files.files += $${CONF_FILES}26config_files.files += $${CONF_FILES}
2727
28INSTALLS+=config_files qml_files28#install the desktop file, a translated version is automatically created in
29#the build directory
30desktop_file.path = /%ClickHookName%
31desktop_file.files = $$OUT_PWD/%ClickHookName%.desktop
32desktop_file.CONFIG += no_check_exist
33
34INSTALLS+=config_files qml_files desktop_file
2935
=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/projectName.pro'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/projectName.pro 2015-05-26 09:46:32 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/projectName.pro 2015-08-27 10:44:50 +0000
@@ -25,20 +25,21 @@
25 $$files(*.qml,true) \25 $$files(*.qml,true) \
26 $$files(*.js,true) \26 $$files(*.js,true) \
27 $$files(*.cpp,true) \27 $$files(*.cpp,true) \
28 $$files(*.h,true)28 $$files(*.h,true) \
29 $$files(*.desktop,true)
2930
30# specifies all translations files and makes sure they are31# specifies all translations files and makes sure they are
31# compiled and installed into the right place in the click package32# compiled and installed into the right place in the click package
32UBUNTU_PO_FILES+=$$files(po/*.po)33UBUNTU_PO_FILES+=$$files(po/*.po)
3334
34aptest.target = autopilot35aptest.target = autopilot
35aptest.commands = QML2_IMPORT_PATH=$$OUT_PWD/backend bash $$PWD/app/tests/autopilot/run36aptest.commands = QML2_IMPORT_PATH=$$OUT_PWD/backend bash $$PWD/%ClickHookName%/tests/autopilot/run
36aptest.depends = sub-app sub-backend-App37aptest.depends = sub-%ClickHookName% sub-backend-App
3738
38unittest.target = check39unittest.target = check
39unittest.commands = /usr/bin/qmltestrunner -input $$PWD/backend/tests/unit -import $$OUT_PWD/backend40unittest.commands = /usr/bin/qmltestrunner -input $$PWD/backend/tests/unit -import $$OUT_PWD/backend
40unittest.commands += && /usr/bin/qmltestrunner -input $$PWD/app/tests/unit -import $$OUT_PWD/backend41unittest.commands += && /usr/bin/qmltestrunner -input $$PWD/%ClickHookName%/tests/unit -import $$OUT_PWD/backend
41unittest.depends = sub-app sub-backend-App42unittest.depends = sub-%ClickHookName% sub-backend-App
4243
43QMAKE_EXTRA_TARGETS += aptest unittest44QMAKE_EXTRA_TARGETS += aptest unittest
4445
4546
=== modified file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.desktop'
--- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.desktop 2014-11-13 15:45:24 +0000
+++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.desktop 2015-08-27 10:44:50 +0000
@@ -1,5 +1,5 @@
1[Desktop Entry]1[Desktop Entry]
2Name=%ClickHookName%2_Name=%ClickHookName%
3Exec=%ClickHookName%3Exec=%ClickHookName%
4Icon=%ClickHookName%/%ClickHookName%.png4Icon=%ClickHookName%/%ClickHookName%.png
5Terminal=false5Terminal=false
66
=== modified file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.pro'
--- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.pro 2015-05-22 15:37:52 +0000
+++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.pro 2015-08-27 10:44:50 +0000
@@ -13,7 +13,6 @@
13 $$files(*.js,true)13 $$files(*.js,true)
1414
15CONF_FILES += %ClickHookName%.apparmor \15CONF_FILES += %ClickHookName%.apparmor \
16 %ClickHookName%.desktop \
17 %ClickHookName%.png16 %ClickHookName%.png
1817
19AP_TEST_FILES += tests/autopilot/run \18AP_TEST_FILES += tests/autopilot/run \
@@ -22,13 +21,21 @@
22#show all the files in QtCreator21#show all the files in QtCreator
23OTHER_FILES += $${CONF_FILES} \22OTHER_FILES += $${CONF_FILES} \
24 $${QML_FILES} \23 $${QML_FILES} \
25 $${AP_TEST_FILES}24 $${AP_TEST_FILES} \
25 %ClickHookName%.desktop
2626
27#specify where the config files are installed to27#specify where the config files are installed to
28config_files.path = /%ClickHookName%28config_files.path = /%ClickHookName%
29config_files.files += $${CONF_FILES}29config_files.files += $${CONF_FILES}
30INSTALLS+=config_files30INSTALLS+=config_files
3131
32#install the desktop file, a translated version is
33#automatically created in the build directory
34desktop_file.path = /%ClickHookName%
35desktop_file.files = $$OUT_PWD/%ClickHookName%.desktop
36desktop_file.CONFIG += no_check_exist
37INSTALLS+=desktop_file
38
32# Default rules for deployment.39# Default rules for deployment.
33target.path = $${UBUNTU_CLICK_BINARY_PATH}40target.path = $${UBUNTU_CLICK_BINARY_PATH}
34INSTALLS+=target41INSTALLS+=target
3542
=== modified file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/projectName.pro'
--- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/projectName.pro 2015-05-26 09:46:32 +0000
+++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/projectName.pro 2015-08-27 10:44:50 +0000
@@ -21,20 +21,21 @@
21# template is created in po/template.pot, to create a21# template is created in po/template.pot, to create a
22# translation copy the template to e.g. de.po and edit the sources22# translation copy the template to e.g. de.po and edit the sources
23UBUNTU_TRANSLATION_SOURCES+= \23UBUNTU_TRANSLATION_SOURCES+= \
24 $$files(app/*.qml,true) \24 $$files(*.qml,true) \
25 $$files(app/*.js,true)25 $$files(*.js,true) \
26 $$files(*.desktop,true)
2627
27# specifies all translations files and makes sure they are28# specifies all translations files and makes sure they are
28# compiled and installed into the right place in the click package29# compiled and installed into the right place in the click package
29UBUNTU_PO_FILES+=$$files(po/*.po)30UBUNTU_PO_FILES+=$$files(po/*.po)
3031
31aptest.target = autopilot32aptest.target = autopilot
32aptest.commands = bash $$PWD/app/tests/autopilot/run33aptest.commands = bash $$PWD/%ClickHookName%/tests/autopilot/run
33aptest.depends = sub-app34aptest.depends = sub-%ClickHookName%
3435
35unittest.target = check36unittest.target = check
36unittest.commands = /usr/bin/qmltestrunner -input $$PWD/app/tests/unit37unittest.commands = /usr/bin/qmltestrunner -input $$PWD/%ClickHookName%/tests/unit
37unittest.depends = sub-app38unittest.depends = sub-%ClickHookName%
3839
39QMAKE_EXTRA_TARGETS += aptest unittest40QMAKE_EXTRA_TARGETS += aptest unittest
4041
4142
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.desktop'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.desktop 2015-01-17 04:53:32 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.desktop 2015-08-27 10:44:50 +0000
@@ -1,5 +1,5 @@
1[Desktop Entry]1[Desktop Entry]
2Name=%ClickHookName%2_Name=%ClickHookName%
3Exec=qmlscene $@ %ClickHookName%/Main.qml3Exec=qmlscene $@ %ClickHookName%/Main.qml
4Icon=%ClickHookName%/%ClickHookName%.png4Icon=%ClickHookName%/%ClickHookName%.png
5Terminal=false5Terminal=false
66
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.pro'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.pro 2015-05-22 15:37:52 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.pro 2015-08-27 10:44:50 +0000
@@ -7,7 +7,6 @@
7 $$files(*.js,true)7 $$files(*.js,true)
88
9CONF_FILES += %ClickHookName%.apparmor \9CONF_FILES += %ClickHookName%.apparmor \
10 %ClickHookName%.desktop \
11 %ClickHookName%.png10 %ClickHookName%.png
1211
13AP_TEST_FILES += tests/autopilot/run \12AP_TEST_FILES += tests/autopilot/run \
@@ -15,7 +14,8 @@
1514
16OTHER_FILES += $${CONF_FILES} \15OTHER_FILES += $${CONF_FILES} \
17 $${QML_FILES} \16 $${QML_FILES} \
18 $${AP_TEST_FILES}17 $${AP_TEST_FILES} \
18 %ClickHookName%.desktop
1919
20#specify where the qml/js files are installed to20#specify where the qml/js files are installed to
21qml_files.path = /%ClickHookName%21qml_files.path = /%ClickHookName%
@@ -25,4 +25,10 @@
25config_files.path = /%ClickHookName%25config_files.path = /%ClickHookName%
26config_files.files += $${CONF_FILES}26config_files.files += $${CONF_FILES}
2727
28INSTALLS+=config_files qml_files28#install the desktop file, a translated version is
29#automatically created in the build directory
30desktop_file.path = /%ClickHookName%
31desktop_file.files = $$OUT_PWD/%ClickHookName%.desktop
32desktop_file.CONFIG += no_check_exist
33
34INSTALLS+=config_files qml_files desktop_file
2935
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/projectName.pro'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/projectName.pro 2015-05-26 09:46:32 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/projectName.pro 2015-08-27 10:44:50 +0000
@@ -21,19 +21,20 @@
21# template is created in po/template.pot, to create a21# template is created in po/template.pot, to create a
22# translation copy the template to e.g. de.po and edit the sources22# translation copy the template to e.g. de.po and edit the sources
23UBUNTU_TRANSLATION_SOURCES+= \23UBUNTU_TRANSLATION_SOURCES+= \
24 $$files(app/*.qml,true) \24 $$files(*.qml,true) \
25 $$files(app/*.js,true)25 $$files(*.js,true) \
26 $$files(*.desktop,true)
2627
27# specifies all translations files and makes sure they are28# specifies all translations files and makes sure they are
28# compiled and installed into the right place in the click package29# compiled and installed into the right place in the click package
29UBUNTU_PO_FILES+=$$files(po/*.po)30UBUNTU_PO_FILES+=$$files(po/*.po)
3031
31aptest.target = autopilot32aptest.target = autopilot
32aptest.commands = bash $$PWD/app/tests/autopilot/run33aptest.commands = bash $$PWD/%ClickHookName%/tests/autopilot/run
33aptest.depends = sub-app34aptest.depends = sub-%ClickHookName%
3435
35unittest.target = check36unittest.target = check
36unittest.commands = /usr/bin/qmltestrunner -input $$PWD/app/tests/unit 37unittest.commands = /usr/bin/qmltestrunner -input $$PWD/%ClickHookName%/tests/unit
37unittest.depends = sub-app38unittest.depends = sub-%ClickHookName%
3839
39QMAKE_EXTRA_TARGETS += aptest unittest40QMAKE_EXTRA_TARGETS += aptest unittest
4041
=== modified file 'share/qtcreator/ubuntu/scripts/qtc_device_applaunch.py'
--- share/qtcreator/ubuntu/scripts/qtc_device_applaunch.py 2015-06-01 14:26:02 +0000
+++ share/qtcreator/ubuntu/scripts/qtc_device_applaunch.py 2015-08-27 10:44:50 +0000
@@ -441,7 +441,7 @@
441success = subprocess.call(441success = subprocess.call(
442 ["pkcon","--allow-untrusted","install-local",options.clickPck,"-p"])442 ["pkcon","--allow-untrusted","install-local",options.clickPck,"-p"])
443if success != 0:443if success != 0:
444 print("Sdk-Launcher> Installing the application failed",flush=True)444 print("Sdk-Launcher> Installing the application failed",flush=True,file=sys.stderr)
445 sys.exit(1)445 sys.exit(1)
446446
447print("Sdk-Launcher> Application installed successfully",flush=True)447print("Sdk-Launcher> Application installed successfully",flush=True)
@@ -451,6 +451,7 @@
451procStdOut = None451procStdOut = None
452stderrPipeName = None452stderrPipeName = None
453procStdErr = None453procStdErr = None
454syslogHandle = None
454455
455try:456try:
456 confined = is_confined(manifest,hook_name)457 confined = is_confined(manifest,hook_name)
@@ -494,8 +495,12 @@
494 stderrPipeName = tmp_dir+app_id+".stderr"495 stderrPipeName = tmp_dir+app_id+".stderr"
495 procStdErr = create_procpipe(stderrPipeName,on_proc_stderr)496 procStdErr = create_procpipe(stderrPipeName,on_proc_stderr)
496497
497 syslogFileName = "/var/log/syslog"498 try:
498 syslogHandle = create_filelistener("/var/log/syslog",on_syslog_update)499 syslogFileName = "/var/log/syslog"
500 syslogHandle = create_filelistener("/var/log/syslog",on_syslog_update)
501 except OSError:
502 print("Sdk-Launcher> Not able to open syslog, apparmor errors will not be reported.",flush=True,file=sys.stderr)
503
499504
500 if "unix_signal_add" in dir(GLib):505 if "unix_signal_add" in dir(GLib):
501 GLib.unix_signal_add(GLib.PRIORITY_HIGH, signal.SIGTERM, on_sigterm, runner)506 GLib.unix_signal_add(GLib.PRIORITY_HIGH, signal.SIGTERM, on_sigterm, runner)
502507
=== modified file 'src/ubuntu/ubuntupackagestep.cpp'
--- src/ubuntu/ubuntupackagestep.cpp 2015-07-08 15:43:11 +0000
+++ src/ubuntu/ubuntupackagestep.cpp 2015-08-27 10:44:50 +0000
@@ -62,7 +62,7 @@
62 false).toBool();62 false).toBool();
6363
64 if (!settings.value(QLatin1String(Constants::SETTINGS_KEY_ENABLE_DEBUG_HELPER_DEFAULT),64 if (!settings.value(QLatin1String(Constants::SETTINGS_KEY_ENABLE_DEBUG_HELPER_DEFAULT),
65 false).toBool())65 true).toBool())
66 m_debugMode = DisableDebugScript;66 m_debugMode = DisableDebugScript;
6767
68 settings.endGroup();68 settings.endGroup();
6969
=== modified file 'ubuntu-click-tools.prf'
--- ubuntu-click-tools.prf 2015-01-16 13:06:04 +0000
+++ ubuntu-click-tools.prf 2015-08-27 10:44:50 +0000
@@ -26,40 +26,60 @@
2626
27!isEmpty(UBUNTU_MANIFEST_FILE){27!isEmpty(UBUNTU_MANIFEST_FILE){
28 OTHER_FILES+=$$UBUNTU_MANIFEST_FILE28 OTHER_FILES+=$$UBUNTU_MANIFEST_FILE
29 manifest_file.target = $$OUT_PWD/manifest.json29 manifest_file.target = $$shadowed($$_PRO_FILE_PWD_)/manifest.json
30 manifest_file.commands = sed s/@CLICK_ARCH@/$$UBUNTU_CLICK_ARCH/g $$absolute_path($${UBUNTU_MANIFEST_FILE},$$_PRO_FILE_PWD_) > $${manifest_file.target}30 manifest_file.commands = sed s/@CLICK_ARCH@/$$UBUNTU_CLICK_ARCH/g $$absolute_path($${UBUNTU_MANIFEST_FILE},$$_PRO_FILE_PWD_) > $${manifest_file.target}
31 manifest_file.depends = $$absolute_path($${UBUNTU_MANIFEST_FILE},$$_PRO_FILE_PWD_)31 manifest_file.depends = $$absolute_path($${UBUNTU_MANIFEST_FILE},$$_PRO_FILE_PWD_)
3232
33 QMAKE_EXTRA_TARGETS+=manifest_file33 QMAKE_EXTRA_TARGETS+=manifest_file
34 QMAKE_CLEAN += $${manifest_file.target}
34 ubuntuAddPreTargetDep($${manifest_file.target})35 ubuntuAddPreTargetDep($${manifest_file.target})
3536
36 manifest_file_install.path = /37 manifest_file_install.path = /
37 manifest_file_install.files = $${OUT_PWD}/manifest.json38 manifest_file_install.files = $$manifest_file.target
38 manifest_file_install.CONFIG +=no_check_exist39 manifest_file_install.CONFIG +=no_check_exist
39 INSTALLS+=manifest_file_install40 INSTALLS+=manifest_file_install
40}41}
4142
42!isEmpty(UBUNTU_TRANSLATION_SOURCES){43!isEmpty(UBUNTU_TRANSLATION_SOURCES){
44 isEmpty(UBUNTU_TRANSLATION_DOMAIN):error("UBUNTU_TRANSLATION_DOMAIN not defined")
45
43 # iterate over all QML/JS files and create a basic translation template46 # iterate over all QML/JS files and create a basic translation template
44 template_pot.target=$$_PRO_FILE_PWD_/po/template.pot47 template_pot.target=$$_PRO_FILE_PWD_/po/$${UBUNTU_TRANSLATION_DOMAIN}.pot
45 for(filelist, UBUNTU_TRANSLATION_SOURCES) {48 for(filelist, UBUNTU_TRANSLATION_SOURCES) {
46 resolved_filelist = $$absolute_path($$filelist,$$_PRO_FILE_PWD_)49 resolved_filelist = $$absolute_path($$filelist,$$_PRO_FILE_PWD_)
47 resolved_filelist = $$files($$resolved_filelist)50 resolved_filelist = $$files($$resolved_filelist)
51
48 for(file,resolved_filelist) {52 for(file,resolved_filelist) {
49 template_pot.depends+=$$file53 RESULT = $$find(file, "\\.desktop(\\.in)?$")
54 count(RESULT, 1) {
55 # extract the strings from the desktop file, and feed them to xgettext
56 target_file = "$$shadowed($$_PRO_FILE_PWD_)/$$relative_path($$file,$$_PRO_FILE_PWD_).h"
57 target_dir = $$dirname(target_file)
58 target_name = $$replace(target_file,"[/.-]","_")
59
60 $${target_name}.target=$$target_file
61 $${target_name}.commands=mkdir -p $$target_dir && cd $$target_dir && intltool-extract --type="gettext/ini" --update --srcdir=$$dirname(file) $$basename(file)
62 $${target_name}.depends+=$$file
63 QMAKE_EXTRA_TARGETS+=$$target_name
64
65 template_pot.depends+=$$target_file
66 QMAKE_CLEAN += $$target_file
67
68 translated_desktop_files+=$$file
69 } else {
70 template_pot.depends+=$$file
71 }
50 }72 }
51
52 }73 }
5374
54 !isEmpty(template_pot.depends) {75 !isEmpty(template_pot.depends) {
55 template_pot.commands=mkdir -p $$_PRO_FILE_PWD_/po && xgettext -o $$template_pot.target --qt --c++ --add-comments=TRANSLATORS --keyword=tr --keyword=tr:1,2 $$template_pot.depends --from-code=UTF-876 template_pot.commands=mkdir -p $$_PRO_FILE_PWD_/po && xgettext -o $$template_pot.target --qt --c++ --from-code=UTF-8 --add-comments=TRANSLATORS --keyword=tr --keyword=tr:1,2 --keyword=N_ $$template_pot.depends
5677
57 QMAKE_EXTRA_TARGETS+=template_pot78 QMAKE_EXTRA_TARGETS+=template_pot
58 ubuntuAddPreTargetDep($$_PRO_FILE_PWD_/po/template.pot)79 ubuntuAddPreTargetDep($${template_pot.target})
59 }80 }
6081
61 !isEmpty(UBUNTU_PO_FILES){82 !isEmpty(UBUNTU_PO_FILES){
62 isEmpty(UBUNTU_TRANSLATION_DOMAIN):error("UBUNTU_TRANSLATION_DOMAIN not defined")
63 # compile the mo files into po files83 # compile the mo files into po files
64 for(filelist, UBUNTU_PO_FILES) {84 for(filelist, UBUNTU_PO_FILES) {
65 resolved_filelist = $$absolute_path($$filelist,$$_PRO_FILE_PWD_)85 resolved_filelist = $$absolute_path($$filelist,$$_PRO_FILE_PWD_)
@@ -69,22 +89,55 @@
69 lang=$$split(lang, .)89 lang=$$split(lang, .)
70 lang=$$first(lang)90 lang=$$first(lang)
7191
92 # add a target that automatically updates the po files from the template
93 update_target_file = $$shadowed($$_PRO_FILE_PWD_)/po/$$basename(file).updated
94
95 target_name=update_po_target_$$lang
96 $${target_name}.target = $${update_target_file}
97 $${target_name}.commands =cd $$_PRO_FILE_PWD_/po && LC_ALL=C intltool-update -d $$lang -g template -x && touch $${update_target_file}
98 $${target_name}.depends+=$${template_pot.target}
99
100 QMAKE_EXTRA_TARGETS+=$$target_name
101 QMAKE_CLEAN += $$update_target_file
102 ubuntuAddPreTargetDep($${update_target_file})
103
104 # build the .mo files
72 target_name=mo_target_$$lang105 target_name=mo_target_$$lang
73 target_file=$$shadowed($$_PRO_FILE_PWD_)/po/$${lang}/$${UBUNTU_TRANSLATION_DOMAIN}.mo106 target_file=$$shadowed($$_PRO_FILE_PWD_)/po/$${lang}/$${UBUNTU_TRANSLATION_DOMAIN}.mo
74107
75 $${target_name}.target=$$target_file108 $${target_name}.target=$$target_file
76 $${target_name}.commands=mkdir -p po/$${lang} && msgfmt -o $${target_file} $$absolute_path($$file,$$_PRO_FILE_PWD_)109 $${target_name}.commands=mkdir -p po/$${lang} && LC_ALL=C msgfmt -o $${target_file} $$absolute_path($$file,$$_PRO_FILE_PWD_)
77 $${target_name}.depends+=$$absolute_path($$file,$$_PRO_FILE_PWD_)110 $${target_name}.depends+=$$absolute_path($$file,$$_PRO_FILE_PWD_) $${update_target_file}
78111
79 $${target_name}_inst.path =/share/locale/$${lang}/LC_MESSAGES112 $${target_name}_inst.path =/share/locale/$${lang}/LC_MESSAGES
80 $${target_name}_inst.CONFIG +=no_check_exist113 $${target_name}_inst.CONFIG +=no_check_exist
81 $${target_name}_inst.files=$$target_file114 $${target_name}_inst.files=$$target_file
82115
116 registered_po_files+=$$absolute_path($$file,$$_PRO_FILE_PWD_)
83 QMAKE_EXTRA_TARGETS+=$$target_name117 QMAKE_EXTRA_TARGETS+=$$target_name
118 QMAKE_CLEAN += $$target_file
84 ubuntuAddPreTargetDep($${target_file})119 ubuntuAddPreTargetDep($${target_file})
85120
86 INSTALLS += $${target_name}_inst121 INSTALLS += $${target_name}_inst
87 }122 }
88 }123 }
89 }124 }
125
126 !isEmpty(translated_desktop_files) {
127 #merge the translations into the desktop files
128 for(file, translated_desktop_files) {
129 target_file = $$shadowed($$_PRO_FILE_PWD_)/$$relative_path($$file,$$_PRO_FILE_PWD_)
130 target_file = $$replace(target_file,"\\.in$","")
131
132 target_name = $$replace(target_file,"[/.-]","_")
133 $${target_name}.target=$$target_file
134 $${target_name}.commands=LC_ALL=C intltool-merge -d -u $$_PRO_FILE_PWD_/po $$file $$target_file > /dev/null
135 $${target_name}.depends+=$$registered_po_files \
136 $$file
137
138 QMAKE_EXTRA_TARGETS+=$$target_name
139 QMAKE_CLEAN += $$target_file
140 ubuntuAddPreTargetDep($${target_file})
141 }
142 }
90}143}

Subscribers

People subscribed via source and target branches