Merge lp:~zeller-benjamin/qtcreator-plugin-remotelinux/qt53migrate into lp:qtcreator-plugin-remotelinux
- qt53migrate
- Merge into trunk
Proposed by
Benjamin Zeller
Status: | Merged |
---|---|
Merged at revision: | 12 |
Proposed branch: | lp:~zeller-benjamin/qtcreator-plugin-remotelinux/qt53migrate |
Merge into: | lp:qtcreator-plugin-remotelinux |
Diff against target: |
18661 lines (+8335/-5585) 217 files modified
debian/changelog (+6/-0) debian/control (+5/-5) share/qtcreator/templates/wizards/bb-bardescriptor/bar-descriptor.xml (+2/-4) share/qtcreator/templates/wizards/bb-cascades-app/bar-descriptor.xml (+0/-2) share/qtcreator/templates/wizards/bb-cascades-app/wizard.xml (+1/-1) share/qtcreator/templates/wizards/bb-qt5-bardescriptor/bar-descriptor.xml (+0/-22) src/qnx/bardescriptordocument.cpp (+559/-127) src/qnx/bardescriptordocument.h (+76/-13) src/qnx/bardescriptordocumentnodehandlers.cpp (+0/-708) src/qnx/bardescriptordocumentnodehandlers.h (+0/-302) src/qnx/bardescriptoreditor.cpp (+48/-34) src/qnx/bardescriptoreditor.h (+6/-2) src/qnx/bardescriptoreditorabstractpanelwidget.cpp (+84/-36) src/qnx/bardescriptoreditorabstractpanelwidget.h (+21/-10) src/qnx/bardescriptoreditorassetswidget.cpp (+42/-42) src/qnx/bardescriptoreditorassetswidget.h (+7/-12) src/qnx/bardescriptoreditorauthorinformationwidget.cpp (+11/-26) src/qnx/bardescriptoreditorauthorinformationwidget.h (+3/-10) src/qnx/bardescriptoreditorentrypointwidget.cpp (+46/-67) src/qnx/bardescriptoreditorentrypointwidget.h (+5/-17) src/qnx/bardescriptoreditorenvironmentwidget.cpp (+21/-20) src/qnx/bardescriptoreditorenvironmentwidget.h (+4/-7) src/qnx/bardescriptoreditorfactory.cpp (+10/-14) src/qnx/bardescriptoreditorfactory.h (+2/-10) src/qnx/bardescriptoreditorgeneralwidget.cpp (+41/-62) src/qnx/bardescriptoreditorgeneralwidget.h (+4/-16) src/qnx/bardescriptoreditorpackageinformationwidget.cpp (+3/-46) src/qnx/bardescriptoreditorpackageinformationwidget.h (+1/-14) src/qnx/bardescriptoreditorpermissionswidget.cpp (+26/-10) src/qnx/bardescriptoreditorpermissionswidget.h (+5/-5) src/qnx/bardescriptoreditorwidget.cpp (+61/-112) src/qnx/bardescriptoreditorwidget.h (+10/-34) src/qnx/blackberryabstractdeploystep.h (+1/-3) src/qnx/blackberryapilevelconfiguration.cpp (+504/-0) src/qnx/blackberryapilevelconfiguration.h (+125/-0) src/qnx/blackberryapplicationrunner.cpp (+186/-8) src/qnx/blackberryapplicationrunner.h (+29/-7) src/qnx/blackberrycertificate.cpp (+2/-2) src/qnx/blackberrycheckdevicestatusstep.cpp (+278/-0) src/qnx/blackberrycheckdevicestatusstep.h (+93/-0) src/qnx/blackberrycheckdevicestatusstepconfigwidget.cpp (+73/-0) src/qnx/blackberrycheckdevicestatusstepconfigwidget.h (+63/-0) src/qnx/blackberrycheckdevicestatusstepconfigwidget.ui (+35/-0) src/qnx/blackberrycheckdevicestatusstepfactory.cpp (+110/-0) src/qnx/blackberrycheckdevicestatusstepfactory.h (+64/-0) src/qnx/blackberrycheckdevmodestep.cpp (+0/-110) src/qnx/blackberrycheckdevmodestep.h (+0/-63) src/qnx/blackberrycheckdevmodestepconfigwidget.cpp (+0/-55) src/qnx/blackberrycheckdevmodestepconfigwidget.h (+0/-55) src/qnx/blackberrycheckdevmodestepfactory.cpp (+0/-108) src/qnx/blackberrycheckdevmodestepfactory.h (+0/-64) src/qnx/blackberryconfiguration.cpp (+0/-389) src/qnx/blackberryconfiguration.h (+0/-111) src/qnx/blackberryconfigurationmanager.cpp (+304/-176) src/qnx/blackberryconfigurationmanager.h (+46/-19) src/qnx/blackberrycreatecertificatedialog.cpp (+1/-1) src/qnx/blackberrycreatepackagestep.cpp (+164/-65) src/qnx/blackberrycreatepackagestep.h (+15/-0) src/qnx/blackberrycreatepackagestepconfigwidget.cpp (+82/-7) src/qnx/blackberrycreatepackagestepconfigwidget.h (+6/-3) src/qnx/blackberrycreatepackagestepconfigwidget.ui (+161/-4) src/qnx/blackberrydebugsupport.cpp (+6/-1) src/qnx/blackberrydebugtokenpinsdialog.cpp (+173/-0) src/qnx/blackberrydebugtokenpinsdialog.h (+79/-0) src/qnx/blackberrydebugtokenpinsdialog.ui (+144/-0) src/qnx/blackberrydebugtokenreader.cpp (+24/-0) src/qnx/blackberrydebugtokenreader.h (+2/-0) src/qnx/blackberrydebugtokenrequestdialog.cpp (+22/-3) src/qnx/blackberrydebugtokenrequester.cpp (+10/-6) src/qnx/blackberrydeployconfiguration.cpp (+6/-5) src/qnx/blackberrydeployconfiguration.h (+1/-3) src/qnx/blackberrydeployconfigurationfactory.cpp (+2/-2) src/qnx/blackberrydeployconfigurationfactory.h (+1/-3) src/qnx/blackberrydeployconfigurationwidget.cpp (+2/-0) src/qnx/blackberrydeployconfigurationwidget.h (+1/-3) src/qnx/blackberrydeployinformation.h (+1/-3) src/qnx/blackberrydeployqtlibrariesdialog.cpp (+298/-0) src/qnx/blackberrydeployqtlibrariesdialog.h (+109/-0) src/qnx/blackberrydeployqtlibrariesdialog.ui (+117/-0) src/qnx/blackberrydeviceconfiguration.cpp (+13/-4) src/qnx/blackberrydeviceconfiguration.h (+1/-3) src/qnx/blackberrydeviceconfigurationwidget.cpp (+52/-19) src/qnx/blackberrydeviceconfigurationwidget.h (+6/-3) src/qnx/blackberrydeviceconfigurationwidget.ui (+16/-17) src/qnx/blackberrydeviceconfigurationwizardconfigpage.ui (+13/-15) src/qnx/blackberrydeviceconfigurationwizardpages.cpp (+39/-17) src/qnx/blackberrydeviceconfigurationwizardpages.h (+4/-3) src/qnx/blackberrydeviceconnection.cpp (+1/-2) src/qnx/blackberrydeviceconnectionmanager.cpp (+5/-5) src/qnx/blackberrydeviceinformation.cpp (+11/-2) src/qnx/blackberrydeviceinformation.h (+2/-0) src/qnx/blackberrydevicelistdetector.cpp (+1/-1) src/qnx/blackberryimportcertificatedialog.cpp (+1/-0) src/qnx/blackberryinstallwizard.cpp (+3/-0) src/qnx/blackberryinstallwizard.h (+11/-3) src/qnx/blackberryinstallwizardoptionpage.ui (+97/-0) src/qnx/blackberryinstallwizardpages.cpp (+88/-39) src/qnx/blackberryinstallwizardpages.h (+9/-7) src/qnx/blackberryinstallwizardtargetpage.ui (+1/-1) src/qnx/blackberrykeyspage.cpp (+5/-2) src/qnx/blackberrykeyspage.h (+4/-2) src/qnx/blackberrykeyswidget.cpp (+213/-35) src/qnx/blackberrykeyswidget.h (+19/-2) src/qnx/blackberrykeyswidget.ui (+68/-13) src/qnx/blackberrylogprocessrunner.h (+1/-3) src/qnx/blackberryndkprocess.cpp (+4/-3) src/qnx/blackberryndkprocess.h (+1/-0) src/qnx/blackberryndksettingspage.cpp (+11/-6) src/qnx/blackberryndksettingspage.h (+4/-2) src/qnx/blackberryndksettingswidget.cpp (+342/-213) src/qnx/blackberryndksettingswidget.h (+27/-18) src/qnx/blackberryndksettingswidget.ui (+188/-346) src/qnx/blackberrypotentialkit.cpp (+119/-0) src/qnx/blackberrypotentialkit.h (+62/-0) src/qnx/blackberryqtversionfactory.cpp (+2/-1) src/qnx/blackberryrunconfiguration.h (+1/-3) src/qnx/blackberryrunconfigurationwidget.h (+1/-3) src/qnx/blackberryruncontrol.cpp (+1/-1) src/qnx/blackberryruncontrol.h (+1/-3) src/qnx/blackberryruncontrolfactory.cpp (+53/-1) src/qnx/blackberryruncontrolfactory.h (+1/-3) src/qnx/blackberryruntimeconfiguration.cpp (+95/-0) src/qnx/blackberryruntimeconfiguration.h (+62/-0) src/qnx/blackberrysetuppage.cpp (+67/-0) src/qnx/blackberrysetuppage.h (+59/-0) src/qnx/blackberrysetupwidget.cpp (+333/-0) src/qnx/blackberrysetupwidget.h (+143/-0) src/qnx/blackberrysetupwizard.cpp (+0/-503) src/qnx/blackberrysetupwizard.h (+0/-146) src/qnx/blackberrysetupwizardcertificatepage.ui (+0/-108) src/qnx/blackberrysetupwizarddevicepage.ui (+0/-134) src/qnx/blackberrysetupwizardfinishpage.ui (+0/-64) src/qnx/blackberrysetupwizardkeyspage.ui (+0/-310) src/qnx/blackberrysetupwizardpages.cpp (+3/-2) src/qnx/blackberrysetupwizardpages.h (+0/-167) src/qnx/blackberrysigningpasswordsdialog.h (+1/-3) src/qnx/blackberrysigningutils.cpp (+148/-38) src/qnx/blackberrysigningutils.h (+25/-4) src/qnx/blackberrysshkeysgenerator.h (+1/-3) src/qnx/blackberryversionnumber.cpp (+125/-0) src/qnx/blackberryversionnumber.h (+64/-0) src/qnx/cascadesimport/cascadesimport.pri (+2/-0) src/qnx/cascadesimport/cascadesimportwizard.cpp (+2/-7) src/qnx/cascadesimport/cascadesimportwizard.h (+4/-7) src/qnx/cascadesimport/fileconverter.h (+1/-3) src/qnx/cascadesimport/srcprojectpathchooser.cpp (+77/-0) src/qnx/cascadesimport/srcprojectpathchooser.h (+53/-0) src/qnx/cascadesimport/srcprojectwizardpage.ui (+5/-5) src/qnx/pathchooserdelegate.cpp (+6/-0) src/qnx/pathchooserdelegate.h (+3/-0) src/qnx/qnx.pro (+33/-22) src/qnx/qnx.qbs (+39/-22) src/qnx/qnx.qrc (+4/-0) src/qnx/qnx_dependencies.pri (+6/-0) src/qnx/qnxanalyzesupport.cpp (+27/-2) src/qnx/qnxanalyzesupport.h (+6/-1) src/qnx/qnxattachdebugdialog.cpp (+71/-0) src/qnx/qnxattachdebugdialog.h (+59/-0) src/qnx/qnxattachdebugsupport.cpp (+174/-0) src/qnx/qnxattachdebugsupport.h (+89/-0) src/qnx/qnxbaseqtconfigwidget.cpp (+1/-0) src/qnx/qnxbaseqtconfigwidget.h (+1/-3) src/qnx/qnxconstants.h (+23/-1) src/qnx/qnxdevicetester.h (+1/-3) src/qnx/qnxplugin.cpp (+405/-15) src/qnx/qnxplugin.h (+24/-3) src/qnx/qnxrunconfiguration.cpp (+10/-1) src/qnx/qnxruncontrolfactory.cpp (+8/-7) src/qnx/qnxtoolchain.cpp (+11/-6) src/qnx/qnxutils.cpp (+5/-3) src/qnx/qnxutils.h (+6/-1) src/qnx/slog2inforunner.cpp (+2/-2) src/qnx/slog2inforunner.h (+1/-3) src/remotelinux/abstractremotelinuxdeployservice.cpp (+8/-2) src/remotelinux/abstractremotelinuxdeployservice.h (+2/-0) src/remotelinux/abstractremotelinuxdeploystep.h (+1/-3) src/remotelinux/abstractuploadandinstallpackageservice.h (+1/-3) src/remotelinux/genericdirectuploadservice.cpp (+3/-3) src/remotelinux/genericdirectuploadservice.h (+1/-1) src/remotelinux/genericdirectuploadstep.h (+1/-3) src/remotelinux/genericlinuxdeviceconfigurationwidget.cpp (+1/-0) src/remotelinux/genericlinuxdeviceconfigurationwidget.h (+1/-3) src/remotelinux/genericlinuxdeviceconfigurationwidget.ui (+1/-1) src/remotelinux/genericlinuxdeviceconfigurationwizard.h (+1/-3) src/remotelinux/genericlinuxdeviceconfigurationwizardpages.cpp (+1/-0) src/remotelinux/linuxdeviceprocess.cpp (+1/-1) src/remotelinux/linuxdevicetester.h (+1/-3) src/remotelinux/packageuploader.cpp (+3/-3) src/remotelinux/packageuploader.h (+1/-1) src/remotelinux/publickeydeploymentdialog.h (+1/-3) src/remotelinux/remotelinux.qbs (+5/-3) src/remotelinux/remotelinux_dependencies.pri (+5/-0) src/remotelinux/remotelinuxanalyzesupport.cpp (+1/-1) src/remotelinux/remotelinuxcustomcommanddeployservice.h (+1/-3) src/remotelinux/remotelinuxdebugsupport.cpp (+0/-4) src/remotelinux/remotelinuxdeployconfigurationwidget.h (+1/-3) src/remotelinux/remotelinuxenvironmentreader.cpp (+1/-1) src/remotelinux/remotelinuxpackageinstaller.h (+1/-3) src/remotelinux/remotelinuxrunconfiguration.cpp (+1/-14) src/remotelinux/remotelinuxrunconfiguration.h (+0/-2) src/remotelinux/remotelinuxrunconfigurationwidget.h (+1/-3) src/remotelinux/sshkeydeployer.h (+2/-6) src/remotelinux/uploadandinstalltarpackagestep.h (+1/-3) src/valgrind/callgrindtextmark.h (+1/-3) src/valgrind/callgrindtool.cpp (+4/-4) src/valgrind/callgrindvisualisation.h (+1/-3) src/valgrind/memcheckerrorview.cpp (+2/-0) src/valgrind/memchecktool.cpp (+6/-0) src/valgrind/suppressiondialog.cpp (+1/-0) src/valgrind/valgrind.qbs (+5/-3) src/valgrind/valgrind_dependencies.pri (+2/-0) src/valgrind/valgrindconfigwidget.cpp (+1/-0) src/valgrind/valgrindconfigwidget.h (+1/-3) src/valgrind/valgrindconfigwidget.ui (+7/-10) src/valgrind/valgrindplugin.cpp (+16/-4) src/valgrind/valgrindprocess.cpp (+1/-6) src/valgrind/xmlprotocol/errorlistmodel.cpp (+1/-1) |
To merge this branch: | bzr merge lp:~zeller-benjamin/qtcreator-plugin-remotelinux/qt53migrate |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zoltan Balogh | Pending | ||
Review via email:
|
Commit message
Migrating to Qt5.3 and QtC 3.1
Description of the change
Migrating to Qt5.3 and QtC 3.1
To post a comment you must log in.
- 11. By Benjamin Zeller
-
Update package versions
- 12. By Benjamin Zeller
-
Merge
- 13. By Benjamin Zeller
-
Version bump
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2014-06-09 08:00:41 +0000 | |||
3 | +++ debian/changelog 2014-06-16 09:46:37 +0000 | |||
4 | @@ -1,3 +1,9 @@ | |||
5 | 1 | qtcreator-plugin-remotelinux (3.1.1-0ubuntu1) UNRELEASED; urgency=medium | ||
6 | 2 | |||
7 | 3 | * Migrating to Qt5.3 and QtC 3.1 | ||
8 | 4 | |||
9 | 5 | -- Benjamin Zeller <benjamin.zeller@canonical.com> Mon, 16 Jun 2014 11:45:02 +0200 | ||
10 | 6 | |||
11 | 1 | qtcreator-plugin-remotelinux (3.0.1+14.10.20140609-0ubuntu1) utopic; urgency=low | 7 | qtcreator-plugin-remotelinux (3.0.1+14.10.20140609-0ubuntu1) utopic; urgency=low |
12 | 2 | 8 | ||
13 | 3 | [ Benjamin Zeller ] | 9 | [ Benjamin Zeller ] |
14 | 4 | 10 | ||
15 | === modified file 'debian/control' | |||
16 | --- debian/control 2014-04-09 11:27:44 +0000 | |||
17 | +++ debian/control 2014-06-16 09:46:37 +0000 | |||
18 | @@ -4,12 +4,12 @@ | |||
19 | 4 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> | 4 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
20 | 5 | Build-Depends: debhelper (>= 9), | 5 | Build-Depends: debhelper (>= 9), |
21 | 6 | libqt5webkit5-dev, | 6 | libqt5webkit5-dev, |
23 | 7 | libqt5widgets5 (>= 5.0.2~), | 7 | libqt5widgets5 (>= 5.3.0~), |
24 | 8 | libsqlite3-dev, | 8 | libsqlite3-dev, |
29 | 9 | qt5-qmake (>= 5.2.1~), | 9 | qt5-qmake (>= 5.3.0~), |
30 | 10 | qtcreator-dev (>= 3.0.1-0ubuntu3), | 10 | qtcreator-dev (>= 3.1.0), |
31 | 11 | qttools5-dev-tools (>= 5.2.1~), | 11 | qttools5-dev-tools (>= 5.3.0~), |
32 | 12 | qtbase5-private-dev (>= 5.2.1~), | 12 | qtbase5-private-dev (>= 5.3.0~), |
33 | 13 | qtxmlpatterns5-dev-tools, | 13 | qtxmlpatterns5-dev-tools, |
34 | 14 | Standards-Version: 3.9.5 | 14 | Standards-Version: 3.9.5 |
35 | 15 | Homepage: https://launchpad.net/qtcreator-plugin-remotelinux | 15 | Homepage: https://launchpad.net/qtcreator-plugin-remotelinux |
36 | 16 | 16 | ||
37 | === modified file 'share/qtcreator/templates/wizards/bb-bardescriptor/bar-descriptor.xml' | |||
38 | --- share/qtcreator/templates/wizards/bb-bardescriptor/bar-descriptor.xml 2014-03-20 10:59:28 +0000 | |||
39 | +++ share/qtcreator/templates/wizards/bb-bardescriptor/bar-descriptor.xml 2014-06-16 09:46:37 +0000 | |||
40 | @@ -13,11 +13,9 @@ | |||
41 | 13 | </initialWindow> | 13 | </initialWindow> |
42 | 14 | <publisher>PUBLISHER</publisher> | 14 | <publisher>PUBLISHER</publisher> |
43 | 15 | <copyright>COPYRIGHT</copyright> | 15 | <copyright>COPYRIGHT</copyright> |
44 | 16 | <env var="QML_IMPORT_PATH" value="app/native/imports:/usr/lib/qt4/imports"/> | ||
45 | 17 | <env var="QT_PLUGIN_PATH" value="app/native/plugins:/usr/lib/qt4/plugins"/> | ||
46 | 18 | <env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib/"/> | ||
47 | 19 | <arg>-style</arg> | 16 | <arg>-style</arg> |
49 | 20 | <arg>qnxlight</arg> | 17 | <!-- available styles are bb10dark and bb10bright --> |
50 | 18 | <arg>bb10dark</arg> | ||
51 | 21 | 19 | ||
52 | 22 | <action system="true">run_native</action> | 20 | <action system="true">run_native</action> |
53 | 23 | 21 | ||
54 | 24 | 22 | ||
55 | === modified file 'share/qtcreator/templates/wizards/bb-cascades-app/bar-descriptor.xml' | |||
56 | --- share/qtcreator/templates/wizards/bb-cascades-app/bar-descriptor.xml 2014-03-20 10:59:28 +0000 | |||
57 | +++ share/qtcreator/templates/wizards/bb-cascades-app/bar-descriptor.xml 2014-06-16 09:46:37 +0000 | |||
58 | @@ -17,8 +17,6 @@ | |||
59 | 17 | <image>icon.png</image> | 17 | <image>icon.png</image> |
60 | 18 | </icon> | 18 | </icon> |
61 | 19 | 19 | ||
62 | 20 | <env value="app/native/lib:/usr/lib/qt4/lib/" var="LD_LIBRARY_PATH"/> | ||
63 | 21 | |||
64 | 22 | <action system="true">run_native</action> | 20 | <action system="true">run_native</action> |
65 | 23 | 21 | ||
66 | 24 | <!-- Application assets --> | 22 | <!-- Application assets --> |
67 | 25 | 23 | ||
68 | === modified file 'share/qtcreator/templates/wizards/bb-cascades-app/wizard.xml' | |||
69 | --- share/qtcreator/templates/wizards/bb-cascades-app/wizard.xml 2014-03-20 10:59:28 +0000 | |||
70 | +++ share/qtcreator/templates/wizards/bb-cascades-app/wizard.xml 2014-06-16 09:46:37 +0000 | |||
71 | @@ -31,7 +31,7 @@ | |||
72 | 31 | **************************************************************************/ | 31 | **************************************************************************/ |
73 | 32 | --> | 32 | --> |
74 | 33 | <wizard version="1" kind="project" | 33 | <wizard version="1" kind="project" |
76 | 34 | class="qt4project" firstpage="10" | 34 | class="qmakeproject" firstpage="10" |
77 | 35 | id="Q.QnxBlackBerryCascadesApp" category="F.QtApplications" | 35 | id="Q.QnxBlackBerryCascadesApp" category="F.QtApplications" |
78 | 36 | featuresRequired="QtSupport.Wizards.FeatureBlackBerry"> | 36 | featuresRequired="QtSupport.Wizards.FeatureBlackBerry"> |
79 | 37 | <icon>icon.png</icon> | 37 | <icon>icon.png</icon> |
80 | 38 | 38 | ||
81 | === modified file 'share/qtcreator/templates/wizards/bb-qt5-bardescriptor/bar-descriptor.xml' | |||
82 | --- share/qtcreator/templates/wizards/bb-qt5-bardescriptor/bar-descriptor.xml 2014-03-20 10:59:28 +0000 | |||
83 | +++ share/qtcreator/templates/wizards/bb-qt5-bardescriptor/bar-descriptor.xml 2014-06-16 09:46:37 +0000 | |||
84 | @@ -14,29 +14,7 @@ | |||
85 | 14 | <aspectRatio>landscape</aspectRatio> | 14 | <aspectRatio>landscape</aspectRatio> |
86 | 15 | </initialWindow> | 15 | </initialWindow> |
87 | 16 | 16 | ||
88 | 17 | <env var="QML2_IMPORT_PATH" value="app/native/imports"/> | ||
89 | 18 | <env var="QT_PLUGIN_PATH" value="app/native/plugins"/> | ||
90 | 19 | <env var="LD_LIBRARY_PATH" value="app/native/lib"/> | ||
91 | 20 | |||
92 | 21 | <arg>-platform</arg> | ||
93 | 22 | <arg>qnx</arg> | ||
94 | 23 | |||
95 | 24 | <action system="true">run_native</action> | 17 | <action system="true">run_native</action> |
96 | 25 | 18 | ||
97 | 26 | <asset entry="true" path="PROJECTPATH" type="Qnx/Elf">PROJECTNAME</asset> | 19 | <asset entry="true" path="PROJECTPATH" type="Qnx/Elf">PROJECTNAME</asset> |
98 | 27 | |||
99 | 28 | <!-- | ||
100 | 29 | %QT_INSTALL_LIBS%, %QT_INSTALL_PLUGINS, %QT_INSTALL_QML% and %SRC_DIR% | ||
101 | 30 | tags are replaced on-the-fly when deploying the app. in Qt Creator. | ||
102 | 31 | --> | ||
103 | 32 | <asset path="%QT_INSTALL_LIBS%">lib</asset> | ||
104 | 33 | <asset path="%QT_INSTALL_PLUGINS%">plugins</asset> | ||
105 | 34 | <asset path="%QT_INSTALL_QML%">imports</asset> | ||
106 | 35 | |||
107 | 36 | <!-- | ||
108 | 37 | By default this bar-descriptor.xml embeds Qt5 runtime | ||
109 | 38 | into the application itself. See the following document | ||
110 | 39 | for various deployments of Qt runtime to a device: | ||
111 | 40 | http://qt-project.org/wiki/Qt-on-BlackBerry-devices | ||
112 | 41 | --> | ||
113 | 42 | </qnx> | 20 | </qnx> |
114 | 43 | 21 | ||
115 | === modified file 'src/qnx/bardescriptordocument.cpp' | |||
116 | --- src/qnx/bardescriptordocument.cpp 2014-03-18 10:51:43 +0000 | |||
117 | +++ src/qnx/bardescriptordocument.cpp 2014-06-16 09:46:37 +0000 | |||
118 | @@ -32,47 +32,22 @@ | |||
119 | 32 | #include "bardescriptordocument.h" | 32 | #include "bardescriptordocument.h" |
120 | 33 | 33 | ||
121 | 34 | #include "qnxconstants.h" | 34 | #include "qnxconstants.h" |
122 | 35 | #include "bardescriptoreditor.h" | ||
123 | 36 | #include "bardescriptoreditorwidget.h" | ||
124 | 37 | #include "bardescriptordocumentnodehandlers.h" | ||
125 | 38 | 35 | ||
126 | 39 | #include <coreplugin/editormanager/ieditor.h> | ||
127 | 40 | #include <coreplugin/editormanager/editormanager.h> | 36 | #include <coreplugin/editormanager/editormanager.h> |
128 | 41 | #include <utils/qtcassert.h> | 37 | #include <utils/qtcassert.h> |
129 | 42 | 38 | ||
131 | 43 | #include <QFile> | 39 | #include <QDir> |
132 | 44 | #include <QFileInfo> | 40 | #include <QFileInfo> |
134 | 45 | #include <QDir> | 41 | #include <QMetaEnum> |
135 | 46 | #include <QTextCodec> | 42 | #include <QTextCodec> |
136 | 43 | #include <QSet> | ||
137 | 47 | 44 | ||
138 | 48 | using namespace Qnx; | 45 | using namespace Qnx; |
139 | 49 | using namespace Qnx::Internal; | 46 | using namespace Qnx::Internal; |
140 | 50 | 47 | ||
145 | 51 | BarDescriptorDocument::BarDescriptorDocument(BarDescriptorEditorWidget *editorWidget) | 48 | BarDescriptorDocument::BarDescriptorDocument(QObject *parent) |
146 | 52 | : Core::TextDocument(editorWidget) | 49 | : Core::TextDocument(parent) |
143 | 53 | , m_nodeHandlers(QList<BarDescriptorDocumentAbstractNodeHandler *>()) | ||
144 | 54 | , m_editorWidget(editorWidget) | ||
147 | 55 | { | 50 | { |
148 | 56 | // General | ||
149 | 57 | registerNodeHandler(new BarDescriptorDocumentIdNodeHandler(m_editorWidget)); | ||
150 | 58 | registerNodeHandler(new BarDescriptorDocumentVersionNumberNodeHandler(m_editorWidget)); | ||
151 | 59 | registerNodeHandler(new BarDescriptorDocumentBuildIdNodeHandler(m_editorWidget)); | ||
152 | 60 | registerNodeHandler(new BarDescriptorDocumentAuthorNodeHandler(m_editorWidget)); | ||
153 | 61 | registerNodeHandler(new BarDescriptorDocumentAuthorIdNodeHandler(m_editorWidget)); | ||
154 | 62 | |||
155 | 63 | // Application | ||
156 | 64 | registerNodeHandler(new BarDescriptorDocumentApplicationNameNodeHandler(m_editorWidget)); | ||
157 | 65 | registerNodeHandler(new BarDescriptorDocumentApplicationDescriptionNodeHandler(m_editorWidget)); | ||
158 | 66 | registerNodeHandler(new BarDescriptorDocumentApplicationIconNodeHandler(m_editorWidget)); | ||
159 | 67 | registerNodeHandler(new BarDescriptorDocumentSplashScreenNodeHandler(m_editorWidget)); | ||
160 | 68 | registerNodeHandler(new BarDescriptorDocumentInitialWindowNodeHandler(m_editorWidget)); | ||
161 | 69 | registerNodeHandler(new BarDescriptorDocumentArgNodeHandler(m_editorWidget)); | ||
162 | 70 | registerNodeHandler(new BarDescriptorDocumentActionNodeHandler(m_editorWidget)); | ||
163 | 71 | registerNodeHandler(new BarDescriptorDocumentEnvNodeHandler(m_editorWidget)); | ||
164 | 72 | |||
165 | 73 | // Assets | ||
166 | 74 | registerNodeHandler(new BarDescriptorDocumentAssetNodeHandler(m_editorWidget)); | ||
167 | 75 | |||
168 | 76 | // blackberry-nativepackager requires the XML file to be in UTF-8 encoding, | 51 | // blackberry-nativepackager requires the XML file to be in UTF-8 encoding, |
169 | 77 | // force if possible | 52 | // force if possible |
170 | 78 | if (QTextCodec *defaultUTF8 = QTextCodec::codecForName("UTF-8")) | 53 | if (QTextCodec *defaultUTF8 = QTextCodec::codecForName("UTF-8")) |
171 | @@ -83,10 +58,6 @@ | |||
172 | 83 | 58 | ||
173 | 84 | BarDescriptorDocument::~BarDescriptorDocument() | 59 | BarDescriptorDocument::~BarDescriptorDocument() |
174 | 85 | { | 60 | { |
175 | 86 | while (!m_nodeHandlers.isEmpty()) { | ||
176 | 87 | BarDescriptorDocumentAbstractNodeHandler *nodeHandler = m_nodeHandlers.takeFirst(); | ||
177 | 88 | delete nodeHandler; | ||
178 | 89 | } | ||
179 | 90 | } | 61 | } |
180 | 91 | 62 | ||
181 | 92 | bool BarDescriptorDocument::open(QString *errorString, const QString &fileName) { | 63 | bool BarDescriptorDocument::open(QString *errorString, const QString &fileName) { |
182 | @@ -95,9 +66,8 @@ | |||
183 | 95 | return false; | 66 | return false; |
184 | 96 | 67 | ||
185 | 97 | setFilePath(fileName); | 68 | setFilePath(fileName); |
186 | 98 | m_editorWidget->setFilePath(fileName); | ||
187 | 99 | 69 | ||
189 | 100 | bool result = loadContent(contents); | 70 | const bool result = loadContent(contents, false); |
190 | 101 | 71 | ||
191 | 102 | if (!result) | 72 | if (!result) |
192 | 103 | *errorString = tr("%1 does not appear to be a valid application descriptor file").arg(QDir::toNativeSeparators(fileName)); | 73 | *errorString = tr("%1 does not appear to be a valid application descriptor file").arg(QDir::toNativeSeparators(fileName)); |
193 | @@ -110,12 +80,12 @@ | |||
194 | 110 | QTC_ASSERT(!autoSave, return false); | 80 | QTC_ASSERT(!autoSave, return false); |
195 | 111 | QTC_ASSERT(fn.isEmpty(), return false); | 81 | QTC_ASSERT(fn.isEmpty(), return false); |
196 | 112 | 82 | ||
198 | 113 | bool result = write(filePath(), xmlSource(), errorString); | 83 | const bool result = write(filePath(), xmlSource(), errorString); |
199 | 114 | if (!result) | 84 | if (!result) |
200 | 115 | return false; | 85 | return false; |
201 | 116 | 86 | ||
204 | 117 | m_editorWidget->setDirty(false); | 87 | m_dirty = false; |
205 | 118 | emit changed(); | 88 | emit Core::IDocument::changed(); |
206 | 119 | return true; | 89 | return true; |
207 | 120 | } | 90 | } |
208 | 121 | 91 | ||
209 | @@ -143,7 +113,7 @@ | |||
210 | 143 | 113 | ||
211 | 144 | bool BarDescriptorDocument::isModified() const | 114 | bool BarDescriptorDocument::isModified() const |
212 | 145 | { | 115 | { |
214 | 146 | return m_editorWidget->isDirty(); | 116 | return m_dirty; |
215 | 147 | } | 117 | } |
216 | 148 | 118 | ||
217 | 149 | bool BarDescriptorDocument::isSaveAsAllowed() const | 119 | bool BarDescriptorDocument::isSaveAsAllowed() const |
218 | @@ -172,91 +142,553 @@ | |||
219 | 172 | 142 | ||
220 | 173 | QString BarDescriptorDocument::xmlSource() const | 143 | QString BarDescriptorDocument::xmlSource() const |
221 | 174 | { | 144 | { |
309 | 175 | BarDescriptorEditor *editor = qobject_cast<BarDescriptorEditor*>(m_editorWidget->editor()); | 145 | const int indent = 4; |
310 | 176 | QTC_ASSERT(editor, return QString()); | 146 | return m_barDocument.toString(indent); |
311 | 177 | 147 | } | |
312 | 178 | if (editor->activePage() == BarDescriptorEditor::Source) { | 148 | |
313 | 179 | return m_editorWidget->xmlSource(); | 149 | bool BarDescriptorDocument::loadContent(const QString &xmlCode, bool setDirty, QString *errorMessage, int *errorLine) |
314 | 180 | } else { | 150 | { |
315 | 181 | QDomDocument doc; | 151 | if (xmlCode == xmlSource()) |
316 | 182 | doc.appendChild(doc.createProcessingInstruction(QLatin1String("xml"), QLatin1String("version='1.0' encoding='") + QLatin1String(codec()->name()) + QLatin1String("' standalone='no'"))); | 152 | return true; |
317 | 183 | 153 | ||
318 | 184 | // QNX | 154 | bool result = m_barDocument.setContent(xmlCode, errorMessage, errorLine); |
319 | 185 | QDomElement rootElem = doc.createElement(QLatin1String("qnx")); | 155 | |
320 | 186 | rootElem.setAttribute(QLatin1String("xmlns"), QLatin1String("http://www.qnx.com/schemas/application/1.0")); | 156 | m_dirty = setDirty; |
321 | 187 | 157 | ||
322 | 188 | QMap<int, BarDescriptorDocumentAbstractNodeHandler*> nodeHandlerMap; | 158 | emitAllChanged(); |
323 | 189 | foreach (BarDescriptorDocumentAbstractNodeHandler *nodeHandler, m_nodeHandlers) | 159 | emit Core::IDocument::changed(); |
324 | 190 | nodeHandlerMap.insertMulti(nodeHandler->order(), nodeHandler); | 160 | return result; |
325 | 191 | 161 | } | |
326 | 192 | QList<BarDescriptorDocumentAbstractNodeHandler*> nodeHandlers = nodeHandlerMap.values(); | 162 | |
327 | 193 | foreach (BarDescriptorDocumentAbstractNodeHandler *nodeHandler, nodeHandlers) | 163 | QVariant BarDescriptorDocument::value(BarDescriptorDocument::Tag tag) const |
328 | 194 | rootElem.appendChild(nodeHandler->toNode(doc)); | 164 | { |
329 | 195 | 165 | const QString tagName = QString::fromLatin1(metaObject()->enumerator(metaObject()->enumeratorOffset()).valueToKey(tag)); | |
330 | 196 | doc.appendChild(rootElem); | 166 | |
331 | 197 | 167 | switch (tag) { | |
332 | 198 | return doc.toString(4); | 168 | case id: |
333 | 199 | } | 169 | case versionNumber: |
334 | 200 | } | 170 | case buildId: |
335 | 201 | 171 | case name: | |
336 | 202 | bool BarDescriptorDocument::loadContent(const QString &xmlSource, QString *errorMessage, int *errorLine) | 172 | case description: |
337 | 203 | { | 173 | case author: |
338 | 204 | QDomDocument doc; | 174 | case publisher: |
339 | 205 | bool result = doc.setContent(xmlSource, errorMessage, errorLine); | 175 | case authorId: |
340 | 206 | if (!result) | 176 | return stringValue(tagName); |
341 | 207 | return false; | 177 | case icon: |
342 | 208 | 178 | return childStringListValue(tagName, QLatin1String("image")).value(0); | |
343 | 209 | QDomElement docElem = doc.documentElement(); | 179 | case splashScreens: |
344 | 210 | if (docElem.tagName() != QLatin1String("qnx")) | 180 | return childStringListValue(tagName, QLatin1String("image")); |
345 | 211 | return false; | 181 | case asset: { |
346 | 212 | 182 | QVariant var; | |
347 | 213 | m_editorWidget->clear(); | 183 | var.setValue(assets()); |
348 | 214 | 184 | return var; | |
349 | 215 | removeUnknownNodeHandlers(); | 185 | } |
350 | 216 | foreach (BarDescriptorDocumentAbstractNodeHandler *nodeHandler, m_nodeHandlers) | 186 | case aspectRatio: |
351 | 217 | nodeHandler->clear(); | 187 | case autoOrients: |
352 | 218 | 188 | case systemChrome: | |
353 | 219 | QDomNode node = docElem.firstChildElement(); | 189 | return childStringListValue(QLatin1String("initialWindow"), tagName).value(0); |
354 | 220 | while (!node.isNull()) { | 190 | case transparent: |
355 | 221 | BarDescriptorDocumentAbstractNodeHandler *nodeHandler = nodeHandlerForDomNode(node); | 191 | return childStringListValue(QLatin1String("initialWindow"), tagName).value(0) == QLatin1String("true"); |
356 | 222 | if (!nodeHandler) { | 192 | case arg: |
357 | 223 | nodeHandler = new BarDescriptorDocumentUnknownNodeHandler(m_editorWidget); | 193 | case action: |
358 | 224 | registerNodeHandler(nodeHandler); | 194 | return stringListValue(tagName); |
359 | 225 | } | 195 | case env: |
360 | 226 | 196 | QVariant var; | |
361 | 227 | if (!nodeHandler->handle(node)) | 197 | var.setValue(environment()); |
362 | 228 | return false; | 198 | return var; |
363 | 229 | 199 | } | |
364 | 230 | node = node.nextSibling(); | 200 | |
365 | 231 | } | 201 | return QVariant(); |
366 | 232 | 202 | } | |
367 | 233 | m_editorWidget->setXmlSource(xmlSource); | 203 | |
368 | 234 | 204 | void BarDescriptorDocument::setValue(BarDescriptorDocument::Tag tag, const QVariant &value) | |
369 | 235 | return true; | 205 | { |
370 | 236 | } | 206 | const QMetaEnum tagEnum = metaObject()->enumerator(metaObject()->enumeratorOffset()); |
371 | 237 | 207 | const QString tagName = QString::fromLatin1(tagEnum.valueToKey(tag)); | |
372 | 238 | void BarDescriptorDocument::registerNodeHandler(BarDescriptorDocumentAbstractNodeHandler *nodeHandler) | 208 | |
373 | 239 | { | 209 | switch (tag) { |
374 | 240 | m_nodeHandlers << nodeHandler; | 210 | case id: |
375 | 241 | } | 211 | case versionNumber: |
376 | 242 | 212 | case buildId: | |
377 | 243 | BarDescriptorDocumentAbstractNodeHandler *BarDescriptorDocument::nodeHandlerForDomNode(const QDomNode &node) | 213 | case name: |
378 | 244 | { | 214 | case description: |
379 | 245 | foreach (BarDescriptorDocumentAbstractNodeHandler *handler, m_nodeHandlers) { | 215 | case authorId: |
380 | 246 | if (handler->canHandle(node) && !dynamic_cast<BarDescriptorDocumentUnknownNodeHandler*>(handler)) | 216 | setStringValue(tagName, value.toString()); |
381 | 247 | return handler; | 217 | break; |
382 | 248 | } | 218 | case icon: |
383 | 249 | 219 | case splashScreens: | |
384 | 250 | return 0; | 220 | setChildStringListValue(tagName, QLatin1String("image"), value.toStringList()); |
385 | 251 | } | 221 | break; |
386 | 252 | 222 | case asset: | |
387 | 253 | void BarDescriptorDocument::removeUnknownNodeHandlers() | 223 | setAssets(value.value<BarDescriptorAssetList>()); |
388 | 254 | { | 224 | break; |
389 | 255 | for (int i = m_nodeHandlers.size() - 1; i >= 0; --i) { | 225 | case aspectRatio: |
390 | 256 | BarDescriptorDocumentUnknownNodeHandler *nodeHandler = dynamic_cast<BarDescriptorDocumentUnknownNodeHandler*>(m_nodeHandlers[i]); | 226 | case autoOrients: |
391 | 257 | if (nodeHandler) { | 227 | case systemChrome: |
392 | 258 | m_nodeHandlers.removeAt(i); | 228 | setChildStringListValue(QLatin1String("initialWindow"), tagName, value.toStringList()); |
393 | 259 | delete nodeHandler; | 229 | break; |
394 | 260 | } | 230 | case transparent: |
395 | 261 | } | 231 | setChildStringListValue(QLatin1String("initialWindow"), tagName, QStringList() << (value.toBool() ? QLatin1String("true") : QLatin1String("false"))); |
396 | 232 | break; | ||
397 | 233 | case arg: | ||
398 | 234 | case action: | ||
399 | 235 | setStringListValue(tagName, value.toStringList()); | ||
400 | 236 | break; | ||
401 | 237 | case env: | ||
402 | 238 | setEnvironment(value.value<QList<Utils::EnvironmentItem> >()); | ||
403 | 239 | break; | ||
404 | 240 | case author: | ||
405 | 241 | case publisher: | ||
406 | 242 | // Unset <publisher> when setting <author> as only one should be used | ||
407 | 243 | setStringValue(QString::fromLatin1(tagEnum.valueToKey(author)), value.toString()); | ||
408 | 244 | setStringValue(QString::fromLatin1(tagEnum.valueToKey(publisher)), QLatin1String("")); | ||
409 | 245 | break; | ||
410 | 246 | } | ||
411 | 247 | |||
412 | 248 | m_dirty = true; | ||
413 | 249 | emit changed(tag, value); | ||
414 | 250 | emit Core::IDocument::changed(); | ||
415 | 251 | } | ||
416 | 252 | |||
417 | 253 | QString BarDescriptorDocument::stringValue(const QString &tagName) const | ||
418 | 254 | { | ||
419 | 255 | QDomNodeList nodes = m_barDocument.elementsByTagName(tagName); | ||
420 | 256 | if (nodes.isEmpty() || nodes.size() > 1) | ||
421 | 257 | return QString(); | ||
422 | 258 | |||
423 | 259 | QDomNode node = nodes.item(0); | ||
424 | 260 | QDomText textNode = node.firstChild().toText(); | ||
425 | 261 | if (textNode.isNull()) | ||
426 | 262 | return QString(); | ||
427 | 263 | |||
428 | 264 | return textNode.data(); | ||
429 | 265 | } | ||
430 | 266 | |||
431 | 267 | void BarDescriptorDocument::setStringValue(const QString &tagName, const QString &value) | ||
432 | 268 | { | ||
433 | 269 | QDomNodeList nodes = m_barDocument.elementsByTagName(tagName); | ||
434 | 270 | |||
435 | 271 | if (nodes.size() > 1) | ||
436 | 272 | return; | ||
437 | 273 | |||
438 | 274 | QDomNode existingNode = nodes.item(0); | ||
439 | 275 | if (existingNode.isNull() && value.isEmpty()) | ||
440 | 276 | return; | ||
441 | 277 | |||
442 | 278 | if (!existingNode.isNull() && value.isEmpty()) { | ||
443 | 279 | m_barDocument.documentElement().removeChild(existingNode); | ||
444 | 280 | } else if (existingNode.isNull()) { | ||
445 | 281 | QDomElement newNode = m_barDocument.createElement(tagName); | ||
446 | 282 | newNode.appendChild(m_barDocument.createTextNode(value)); | ||
447 | 283 | m_barDocument.documentElement().appendChild(newNode); | ||
448 | 284 | } else { | ||
449 | 285 | QDomText textNode = existingNode.firstChild().toText(); | ||
450 | 286 | if (textNode.isNull()) | ||
451 | 287 | return; | ||
452 | 288 | textNode.setData(value); | ||
453 | 289 | } | ||
454 | 290 | } | ||
455 | 291 | |||
456 | 292 | QStringList BarDescriptorDocument::childStringListValue(const QString &tagName, const QString &childTagName) const | ||
457 | 293 | { | ||
458 | 294 | QDomNodeList nodes = m_barDocument.elementsByTagName(tagName); | ||
459 | 295 | if (nodes.isEmpty() || nodes.size() > 1) | ||
460 | 296 | return QStringList(); | ||
461 | 297 | |||
462 | 298 | QDomNode parentNode = nodes.item(0); | ||
463 | 299 | QDomElement childElm = parentNode.firstChildElement(childTagName); | ||
464 | 300 | if (childElm.isNull()) | ||
465 | 301 | return QStringList(); | ||
466 | 302 | |||
467 | 303 | QStringList result; | ||
468 | 304 | while (!childElm.isNull()) { | ||
469 | 305 | QDomText textNode = childElm.firstChild().toText(); | ||
470 | 306 | if (textNode.isNull()) | ||
471 | 307 | return QStringList(); | ||
472 | 308 | |||
473 | 309 | result.append(textNode.data()); | ||
474 | 310 | |||
475 | 311 | childElm = childElm.nextSiblingElement(childTagName); | ||
476 | 312 | } | ||
477 | 313 | |||
478 | 314 | return result; | ||
479 | 315 | } | ||
480 | 316 | |||
481 | 317 | void BarDescriptorDocument::setChildStringListValue(const QString &tagName, const QString &childTagName, const QStringList &stringList) | ||
482 | 318 | { | ||
483 | 319 | QDomNodeList nodes = m_barDocument.elementsByTagName(tagName); | ||
484 | 320 | |||
485 | 321 | if (nodes.size() > 1) | ||
486 | 322 | return; | ||
487 | 323 | |||
488 | 324 | QDomNode existingNode = nodes.item(0); | ||
489 | 325 | |||
490 | 326 | if (existingNode.isNull()) { | ||
491 | 327 | QDomElement newParentNode = m_barDocument.createElement(tagName); | ||
492 | 328 | |||
493 | 329 | foreach (const QString &value, stringList) { | ||
494 | 330 | QDomElement newChildNode = m_barDocument.createElement(childTagName); | ||
495 | 331 | QDomText newTextNode = m_barDocument.createTextNode(value); | ||
496 | 332 | newChildNode.appendChild(newTextNode); | ||
497 | 333 | newParentNode.appendChild(newChildNode); | ||
498 | 334 | } | ||
499 | 335 | m_barDocument.documentElement().appendChild(newParentNode); | ||
500 | 336 | } else { | ||
501 | 337 | QStringList values = stringList; | ||
502 | 338 | QDomElement childElm = existingNode.firstChildElement(childTagName); | ||
503 | 339 | if (!childElm.isNull()) { | ||
504 | 340 | // Loop through existing elements, remove the existing nodes | ||
505 | 341 | // that no longer are in "values", and remove from "values" | ||
506 | 342 | // the existing nodes that don't need re-creation | ||
507 | 343 | while (!childElm.isNull()) { | ||
508 | 344 | QDomText textNode = childElm.firstChild().toText(); | ||
509 | 345 | if (textNode.isNull()) | ||
510 | 346 | continue; | ||
511 | 347 | |||
512 | 348 | QDomElement toRemove; | ||
513 | 349 | if (!values.contains(textNode.data())) | ||
514 | 350 | toRemove = childElm; | ||
515 | 351 | else | ||
516 | 352 | values.removeAll(textNode.data()); | ||
517 | 353 | |||
518 | 354 | childElm = childElm.nextSiblingElement(childTagName); | ||
519 | 355 | |||
520 | 356 | if (!toRemove.isNull()) | ||
521 | 357 | existingNode.removeChild(toRemove); | ||
522 | 358 | } | ||
523 | 359 | } | ||
524 | 360 | |||
525 | 361 | // Add the new elements | ||
526 | 362 | int newElementCount = 0; | ||
527 | 363 | foreach (const QString &value, values) { | ||
528 | 364 | if (value.isEmpty()) | ||
529 | 365 | continue; | ||
530 | 366 | QDomElement newChildNode = m_barDocument.createElement(childTagName); | ||
531 | 367 | newChildNode.appendChild(m_barDocument.createTextNode(value)); | ||
532 | 368 | existingNode.appendChild(newChildNode); | ||
533 | 369 | ++newElementCount; | ||
534 | 370 | } | ||
535 | 371 | |||
536 | 372 | if (newElementCount == 0) | ||
537 | 373 | m_barDocument.documentElement().removeChild(existingNode); | ||
538 | 374 | } | ||
539 | 375 | } | ||
540 | 376 | |||
541 | 377 | QStringList BarDescriptorDocument::stringListValue(const QString &tagName) const | ||
542 | 378 | { | ||
543 | 379 | QStringList result; | ||
544 | 380 | |||
545 | 381 | QDomElement childElm = m_barDocument.documentElement().firstChildElement(tagName); | ||
546 | 382 | while (!childElm.isNull()) { | ||
547 | 383 | QDomText textNode = childElm.firstChild().toText(); | ||
548 | 384 | if (textNode.isNull()) | ||
549 | 385 | continue; | ||
550 | 386 | |||
551 | 387 | result.append(textNode.data()); | ||
552 | 388 | |||
553 | 389 | childElm = childElm.nextSiblingElement(tagName); | ||
554 | 390 | } | ||
555 | 391 | |||
556 | 392 | return result; | ||
557 | 393 | } | ||
558 | 394 | |||
559 | 395 | void BarDescriptorDocument::setStringListValue(const QString &tagName, const QStringList &stringList) | ||
560 | 396 | { | ||
561 | 397 | QStringList values = stringList; | ||
562 | 398 | QDomElement childElm = m_barDocument.documentElement().firstChildElement(tagName); | ||
563 | 399 | if (!childElm.isNull()) { | ||
564 | 400 | // Loop through existing elements, remove the existing nodes | ||
565 | 401 | // that no longer are in "values", and remove from "values" | ||
566 | 402 | // the existing nodes that don't need re-creation | ||
567 | 403 | while (!childElm.isNull()) { | ||
568 | 404 | QDomText textNode = childElm.firstChild().toText(); | ||
569 | 405 | if (textNode.isNull()) | ||
570 | 406 | continue; | ||
571 | 407 | |||
572 | 408 | QDomElement toRemove; | ||
573 | 409 | if (!values.contains(textNode.data())) | ||
574 | 410 | toRemove = childElm; | ||
575 | 411 | else | ||
576 | 412 | values.removeAll(textNode.data()); | ||
577 | 413 | |||
578 | 414 | childElm = childElm.nextSiblingElement(tagName); | ||
579 | 415 | |||
580 | 416 | if (!toRemove.isNull()) | ||
581 | 417 | m_barDocument.documentElement().removeChild(toRemove); | ||
582 | 418 | } | ||
583 | 419 | } | ||
584 | 420 | |||
585 | 421 | // Add the new elements | ||
586 | 422 | foreach (const QString &value, values) { | ||
587 | 423 | if (value.isEmpty()) | ||
588 | 424 | continue; | ||
589 | 425 | QDomElement newChildNode = m_barDocument.createElement(tagName); | ||
590 | 426 | newChildNode.appendChild(m_barDocument.createTextNode(value)); | ||
591 | 427 | m_barDocument.documentElement().appendChild(newChildNode); | ||
592 | 428 | } | ||
593 | 429 | } | ||
594 | 430 | |||
595 | 431 | BarDescriptorAssetList BarDescriptorDocument::assets() const | ||
596 | 432 | { | ||
597 | 433 | BarDescriptorAssetList result; | ||
598 | 434 | QDomNodeList nodes = m_barDocument.elementsByTagName(QLatin1String("asset")); | ||
599 | 435 | if (nodes.isEmpty()) | ||
600 | 436 | return result; | ||
601 | 437 | |||
602 | 438 | for (int i = 0; i < nodes.size(); ++i) { | ||
603 | 439 | QDomElement assetElm = nodes.item(i).toElement(); | ||
604 | 440 | if (assetElm.isNull()) | ||
605 | 441 | continue; | ||
606 | 442 | |||
607 | 443 | QDomText textNode = assetElm.firstChild().toText(); | ||
608 | 444 | if (textNode.isNull()) | ||
609 | 445 | continue; | ||
610 | 446 | |||
611 | 447 | QString path = assetElm.attribute(QLatin1String("path")); | ||
612 | 448 | QString entry = assetElm.attribute(QLatin1String("entry")); | ||
613 | 449 | QString dest = textNode.data(); | ||
614 | 450 | |||
615 | 451 | BarDescriptorAsset asset; | ||
616 | 452 | asset.source = path; | ||
617 | 453 | asset.destination = dest; | ||
618 | 454 | asset.entry = entry == QLatin1String("true"); | ||
619 | 455 | result.append(asset); | ||
620 | 456 | } | ||
621 | 457 | |||
622 | 458 | return result; | ||
623 | 459 | } | ||
624 | 460 | |||
625 | 461 | void BarDescriptorDocument::setAssets(const BarDescriptorAssetList &assets) | ||
626 | 462 | { | ||
627 | 463 | QDomNodeList nodes = m_barDocument.elementsByTagName(QLatin1String("asset")); | ||
628 | 464 | |||
629 | 465 | BarDescriptorAssetList newAssets = assets; | ||
630 | 466 | QList<QDomNode> toRemove; | ||
631 | 467 | |||
632 | 468 | for (int i = 0; i < nodes.size(); ++i) { | ||
633 | 469 | QDomElement assetElm = nodes.at(i).toElement(); | ||
634 | 470 | if (assetElm.isNull()) | ||
635 | 471 | continue; | ||
636 | 472 | |||
637 | 473 | QDomText textNode = assetElm.firstChild().toText(); | ||
638 | 474 | if (textNode.isNull()) | ||
639 | 475 | continue; | ||
640 | 476 | |||
641 | 477 | QString source = assetElm.attribute(QLatin1String("path")); | ||
642 | 478 | bool found = false; | ||
643 | 479 | foreach (const BarDescriptorAsset &asset, newAssets) { | ||
644 | 480 | if (asset.source == source) { | ||
645 | 481 | found = true; | ||
646 | 482 | if (asset.entry) { | ||
647 | 483 | assetElm.setAttribute(QLatin1String("type"), QLatin1String("Qnx/Elf")); | ||
648 | 484 | assetElm.setAttribute(QLatin1String("entry"), QLatin1String("true")); | ||
649 | 485 | } else { | ||
650 | 486 | assetElm.removeAttribute(QLatin1String("type")); | ||
651 | 487 | assetElm.removeAttribute(QLatin1String("entry")); | ||
652 | 488 | } | ||
653 | 489 | textNode.setData(asset.destination); | ||
654 | 490 | |||
655 | 491 | newAssets.removeAll(asset); | ||
656 | 492 | break; | ||
657 | 493 | } | ||
658 | 494 | } | ||
659 | 495 | |||
660 | 496 | if (!found) | ||
661 | 497 | toRemove.append(assetElm); | ||
662 | 498 | } | ||
663 | 499 | |||
664 | 500 | foreach (const QDomNode &node, toRemove) | ||
665 | 501 | m_barDocument.documentElement().removeChild(node); | ||
666 | 502 | |||
667 | 503 | foreach (const BarDescriptorAsset &asset, newAssets) { | ||
668 | 504 | QDomElement assetElm = m_barDocument.createElement(QLatin1String("asset")); | ||
669 | 505 | assetElm.setAttribute(QLatin1String("path"), asset.source); | ||
670 | 506 | if (asset.entry) { | ||
671 | 507 | assetElm.setAttribute(QLatin1String("type"), QLatin1String("Qnx/Elf")); | ||
672 | 508 | assetElm.setAttribute(QLatin1String("entry"), QLatin1String("true")); | ||
673 | 509 | } | ||
674 | 510 | assetElm.appendChild(m_barDocument.createTextNode(asset.destination)); | ||
675 | 511 | m_barDocument.documentElement().appendChild(assetElm); | ||
676 | 512 | } | ||
677 | 513 | } | ||
678 | 514 | |||
679 | 515 | QList<Utils::EnvironmentItem> BarDescriptorDocument::environment() const | ||
680 | 516 | { | ||
681 | 517 | QList<Utils::EnvironmentItem> result; | ||
682 | 518 | |||
683 | 519 | QDomElement envElm = m_barDocument.documentElement().firstChildElement(QLatin1String("env")); | ||
684 | 520 | while (!envElm.isNull()) { | ||
685 | 521 | QString var = envElm.attribute(QLatin1String("var")); | ||
686 | 522 | QString value = envElm.attribute(QLatin1String("value")); | ||
687 | 523 | |||
688 | 524 | Utils::EnvironmentItem item(var, value); | ||
689 | 525 | result.append(item); | ||
690 | 526 | |||
691 | 527 | envElm = envElm.nextSiblingElement(QLatin1String("env")); | ||
692 | 528 | } | ||
693 | 529 | return result; | ||
694 | 530 | } | ||
695 | 531 | |||
696 | 532 | void BarDescriptorDocument::setEnvironment(const QList<Utils::EnvironmentItem> &environment) | ||
697 | 533 | { | ||
698 | 534 | QDomNodeList envNodes = m_barDocument.elementsByTagName(QLatin1String("env")); | ||
699 | 535 | |||
700 | 536 | QList<Utils::EnvironmentItem> newEnvironment = environment; | ||
701 | 537 | QList<QDomElement> toRemove; | ||
702 | 538 | for (int i = 0; i < envNodes.size(); ++i) { | ||
703 | 539 | QDomElement elm = envNodes.at(i).toElement(); | ||
704 | 540 | if (elm.isNull()) | ||
705 | 541 | continue; | ||
706 | 542 | |||
707 | 543 | QString var = elm.attribute(QLatin1String("var")); | ||
708 | 544 | bool found = false; | ||
709 | 545 | foreach (const Utils::EnvironmentItem item, newEnvironment) { | ||
710 | 546 | if (item.name == var) { | ||
711 | 547 | found = true; | ||
712 | 548 | elm.setAttribute(QLatin1String("value"), item.value); | ||
713 | 549 | newEnvironment.removeAll(item); | ||
714 | 550 | break; | ||
715 | 551 | } | ||
716 | 552 | } | ||
717 | 553 | |||
718 | 554 | if (!found) | ||
719 | 555 | toRemove.append(elm); | ||
720 | 556 | } | ||
721 | 557 | |||
722 | 558 | foreach (const QDomNode &node, toRemove) | ||
723 | 559 | m_barDocument.documentElement().removeChild(node); | ||
724 | 560 | |||
725 | 561 | foreach (const Utils::EnvironmentItem item, newEnvironment) { | ||
726 | 562 | QDomElement elm = m_barDocument.createElement(QLatin1String("env")); | ||
727 | 563 | elm.setAttribute(QLatin1String("var"), item.name); | ||
728 | 564 | elm.setAttribute(QLatin1String("value"), item.value); | ||
729 | 565 | m_barDocument.documentElement().appendChild(elm); | ||
730 | 566 | } | ||
731 | 567 | } | ||
732 | 568 | |||
733 | 569 | void BarDescriptorDocument::emitAllChanged() | ||
734 | 570 | { | ||
735 | 571 | QMetaEnum tags = metaObject()->enumerator(metaObject()->enumeratorOffset()); | ||
736 | 572 | for (int i = 0; i < tags.keyCount(); ++i) { | ||
737 | 573 | Tag tag = static_cast<Tag>(tags.value(i)); | ||
738 | 574 | emit changed(tag, value(tag)); | ||
739 | 575 | } | ||
740 | 576 | } | ||
741 | 577 | |||
742 | 578 | QString BarDescriptorDocument::bannerComment() const | ||
743 | 579 | { | ||
744 | 580 | QDomNode nd = m_barDocument.firstChild(); | ||
745 | 581 | QDomProcessingInstruction pi = nd.toProcessingInstruction(); | ||
746 | 582 | if (!pi.isNull()) | ||
747 | 583 | nd = pi.nextSibling(); | ||
748 | 584 | |||
749 | 585 | return nd.toComment().data(); | ||
750 | 586 | } | ||
751 | 587 | |||
752 | 588 | void BarDescriptorDocument::setBannerComment(const QString &commentText) | ||
753 | 589 | { | ||
754 | 590 | QDomNode nd = m_barDocument.firstChild(); | ||
755 | 591 | QDomProcessingInstruction pi = nd.toProcessingInstruction(); | ||
756 | 592 | if (!pi.isNull()) | ||
757 | 593 | nd = pi.nextSibling(); | ||
758 | 594 | |||
759 | 595 | bool oldDirty = m_dirty; | ||
760 | 596 | QDomComment cnd = nd.toComment(); | ||
761 | 597 | if (cnd.isNull()) { | ||
762 | 598 | if (!commentText.isEmpty()) { | ||
763 | 599 | cnd = m_barDocument.createComment(commentText); | ||
764 | 600 | m_barDocument.insertBefore(cnd, nd); | ||
765 | 601 | m_dirty = true; | ||
766 | 602 | } | ||
767 | 603 | } else { | ||
768 | 604 | if (commentText.isEmpty()) { | ||
769 | 605 | m_barDocument.removeChild(cnd); | ||
770 | 606 | m_dirty = true; | ||
771 | 607 | } else { | ||
772 | 608 | if (cnd.data() != commentText) { | ||
773 | 609 | cnd.setData(commentText); | ||
774 | 610 | m_dirty = true; | ||
775 | 611 | } | ||
776 | 612 | } | ||
777 | 613 | } | ||
778 | 614 | if (m_dirty != oldDirty) | ||
779 | 615 | emit Core::IDocument::changed(); | ||
780 | 616 | } | ||
781 | 617 | |||
782 | 618 | int BarDescriptorDocument::tagForElement(const QDomElement &element) | ||
783 | 619 | { | ||
784 | 620 | QMetaEnum tags = metaObject()->enumerator(metaObject()->enumeratorOffset()); | ||
785 | 621 | QDomElement el = element; | ||
786 | 622 | while (!el.isNull()) { | ||
787 | 623 | const int n = tags.keyToValue(el.tagName().toLatin1().constData()); | ||
788 | 624 | if (n > -1) | ||
789 | 625 | return n; | ||
790 | 626 | el = el.parentNode().toElement(); | ||
791 | 627 | } | ||
792 | 628 | return -1; | ||
793 | 629 | } | ||
794 | 630 | |||
795 | 631 | bool BarDescriptorDocument::expandPlaceHolder_helper(const QDomElement &el, | ||
796 | 632 | const QString &placeholderKey, | ||
797 | 633 | const QString &placeholderText, | ||
798 | 634 | QSet<BarDescriptorDocument::Tag> &changedTags) | ||
799 | 635 | { | ||
800 | 636 | // replace attributes | ||
801 | 637 | bool elementChanged = false; | ||
802 | 638 | QDomNamedNodeMap attrs = el.attributes(); | ||
803 | 639 | for (int i = 0; i < attrs.count(); ++i) { | ||
804 | 640 | QDomAttr attr = attrs.item(i).toAttr(); | ||
805 | 641 | if (!attr.isNull()) { | ||
806 | 642 | QString s = attr.value(); | ||
807 | 643 | s.replace(placeholderKey, placeholderText); | ||
808 | 644 | if (s != attr.value()) { | ||
809 | 645 | attr.setValue(s); | ||
810 | 646 | elementChanged = true; | ||
811 | 647 | } | ||
812 | 648 | } | ||
813 | 649 | } | ||
814 | 650 | |||
815 | 651 | bool documentChanged = false; | ||
816 | 652 | // replace text | ||
817 | 653 | for (QDomNode nd = el.firstChild(); !nd.isNull(); nd = nd.nextSibling()) { | ||
818 | 654 | QDomText txtnd = nd.toText(); | ||
819 | 655 | if (!txtnd.isNull()) { | ||
820 | 656 | QString s = txtnd.data(); | ||
821 | 657 | s.replace(placeholderKey, placeholderText); | ||
822 | 658 | if (s != txtnd.data()) { | ||
823 | 659 | txtnd.setData(s); | ||
824 | 660 | elementChanged = true; | ||
825 | 661 | } | ||
826 | 662 | } | ||
827 | 663 | QDomElement child = nd.toElement(); | ||
828 | 664 | if (!child.isNull()) { | ||
829 | 665 | bool hit = expandPlaceHolder_helper(child, placeholderKey, placeholderText, changedTags); | ||
830 | 666 | documentChanged = documentChanged || hit; | ||
831 | 667 | } | ||
832 | 668 | } | ||
833 | 669 | if (elementChanged) { | ||
834 | 670 | int n = tagForElement(el); | ||
835 | 671 | if (n >= 0) | ||
836 | 672 | changedTags << static_cast<Tag>(n); | ||
837 | 673 | } | ||
838 | 674 | documentChanged = documentChanged || elementChanged; | ||
839 | 675 | return documentChanged; | ||
840 | 676 | } | ||
841 | 677 | |||
842 | 678 | void BarDescriptorDocument::expandPlaceHolders(const QHash<QString, QString> &placeholdersKeyVals) | ||
843 | 679 | { | ||
844 | 680 | QSet<Tag> changedTags; | ||
845 | 681 | QHashIterator<QString, QString> it(placeholdersKeyVals); | ||
846 | 682 | bool docChanged = false; | ||
847 | 683 | while (it.hasNext()) { | ||
848 | 684 | it.next(); | ||
849 | 685 | bool expanded = expandPlaceHolder_helper(m_barDocument.documentElement(), | ||
850 | 686 | it.key(), it.value(), changedTags); | ||
851 | 687 | docChanged = docChanged || expanded; | ||
852 | 688 | } | ||
853 | 689 | m_dirty = m_dirty || docChanged; | ||
854 | 690 | foreach (Tag tag, changedTags) | ||
855 | 691 | emit changed(tag, value(tag)); | ||
856 | 692 | if (docChanged) | ||
857 | 693 | emit Core::IDocument::changed(); | ||
858 | 262 | } | 694 | } |
859 | 263 | 695 | ||
860 | === modified file 'src/qnx/bardescriptordocument.h' | |||
861 | --- src/qnx/bardescriptordocument.h 2014-03-18 10:51:43 +0000 | |||
862 | +++ src/qnx/bardescriptordocument.h 2014-06-16 09:46:37 +0000 | |||
863 | @@ -33,8 +33,10 @@ | |||
864 | 33 | #define QNX_INTERNAL_BARDESCRIPTORDOCUMENT_H | 33 | #define QNX_INTERNAL_BARDESCRIPTORDOCUMENT_H |
865 | 34 | 34 | ||
866 | 35 | #include <coreplugin/textdocument.h> | 35 | #include <coreplugin/textdocument.h> |
867 | 36 | #include <utils/environment.h> | ||
868 | 36 | 37 | ||
870 | 37 | #include <QDomNode> | 38 | #include <QDomDocument> |
871 | 39 | #include <QMetaType> | ||
872 | 38 | 40 | ||
873 | 39 | namespace Qnx { | 41 | namespace Qnx { |
874 | 40 | namespace Internal { | 42 | namespace Internal { |
875 | @@ -44,16 +46,44 @@ | |||
876 | 44 | QString source; | 46 | QString source; |
877 | 45 | QString destination; | 47 | QString destination; |
878 | 46 | bool entry; | 48 | bool entry; |
879 | 49 | |||
880 | 50 | bool operator==(const BarDescriptorAsset &asset) const | ||
881 | 51 | { | ||
882 | 52 | return source == asset.source && destination == asset.destination; | ||
883 | 53 | } | ||
884 | 47 | }; | 54 | }; |
885 | 48 | 55 | ||
888 | 49 | class BarDescriptorEditorWidget; | 56 | typedef QList<BarDescriptorAsset> BarDescriptorAssetList; |
887 | 50 | class BarDescriptorDocumentAbstractNodeHandler; | ||
889 | 51 | 57 | ||
890 | 52 | class BarDescriptorDocument : public Core::TextDocument | 58 | class BarDescriptorDocument : public Core::TextDocument |
891 | 53 | { | 59 | { |
892 | 54 | Q_OBJECT | 60 | Q_OBJECT |
893 | 61 | |||
894 | 62 | Q_ENUMS(Tag) | ||
895 | 63 | |||
896 | 55 | public: | 64 | public: |
898 | 56 | explicit BarDescriptorDocument(BarDescriptorEditorWidget *editorWidget); | 65 | enum Tag { |
899 | 66 | id = 0, | ||
900 | 67 | versionNumber, | ||
901 | 68 | buildId, | ||
902 | 69 | name, | ||
903 | 70 | description, | ||
904 | 71 | icon, | ||
905 | 72 | splashScreens, | ||
906 | 73 | asset, | ||
907 | 74 | aspectRatio, | ||
908 | 75 | autoOrients, | ||
909 | 76 | systemChrome, | ||
910 | 77 | transparent, | ||
911 | 78 | arg, | ||
912 | 79 | action, | ||
913 | 80 | env, | ||
914 | 81 | author, | ||
915 | 82 | publisher, | ||
916 | 83 | authorId | ||
917 | 84 | }; | ||
918 | 85 | |||
919 | 86 | explicit BarDescriptorDocument(QObject *parent = 0); | ||
920 | 57 | ~BarDescriptorDocument(); | 87 | ~BarDescriptorDocument(); |
921 | 58 | 88 | ||
922 | 59 | bool open(QString *errorString, const QString &fileName); | 89 | bool open(QString *errorString, const QString &fileName); |
923 | @@ -71,19 +101,52 @@ | |||
924 | 71 | bool reload(QString *errorString, ReloadFlag flag, ChangeType type); | 101 | bool reload(QString *errorString, ReloadFlag flag, ChangeType type); |
925 | 72 | 102 | ||
926 | 73 | QString xmlSource() const; | 103 | QString xmlSource() const; |
929 | 74 | bool loadContent(const QString &xmlSource, QString *errorMessage = 0, int *errorLine = 0); | 104 | bool loadContent(const QString &xmlCode, bool setDirty, QString *errorMessage = 0, int *errorLine = 0); |
930 | 75 | 105 | ||
931 | 106 | QVariant value(Tag tag) const; | ||
932 | 107 | |||
933 | 108 | void expandPlaceHolders(const QHash<QString, QString> &placeholdersKeyVals); | ||
934 | 109 | |||
935 | 110 | QString bannerComment() const; | ||
936 | 111 | void setBannerComment(const QString &commentText); | ||
937 | 112 | |||
938 | 113 | signals: | ||
939 | 114 | void changed(BarDescriptorDocument::Tag tag, const QVariant &value); | ||
940 | 115 | |||
941 | 116 | public slots: | ||
942 | 117 | void setValue(BarDescriptorDocument::Tag tag, const QVariant &value); | ||
943 | 76 | private: | 118 | private: |
951 | 77 | void registerNodeHandler(BarDescriptorDocumentAbstractNodeHandler *nodeHandler); | 119 | QString stringValue(const QString &tagName) const; |
952 | 78 | BarDescriptorDocumentAbstractNodeHandler *nodeHandlerForDomNode(const QDomNode &node); | 120 | void setStringValue(const QString &tagName, const QString &value); |
953 | 79 | void removeUnknownNodeHandlers(); | 121 | |
954 | 80 | 122 | QStringList childStringListValue(const QString &tagName, const QString &childTagName) const; | |
955 | 81 | QList<BarDescriptorDocumentAbstractNodeHandler *> m_nodeHandlers; | 123 | void setChildStringListValue(const QString &tagName, const QString &childTagName, const QStringList &stringList); |
956 | 82 | 124 | ||
957 | 83 | BarDescriptorEditorWidget *m_editorWidget; | 125 | QStringList stringListValue(const QString &tagName) const; |
958 | 126 | void setStringListValue(const QString &tagName, const QStringList &stringList); | ||
959 | 127 | |||
960 | 128 | BarDescriptorAssetList assets() const; | ||
961 | 129 | void setAssets(const BarDescriptorAssetList &assets); | ||
962 | 130 | |||
963 | 131 | QList<Utils::EnvironmentItem> environment() const; | ||
964 | 132 | void setEnvironment(const QList<Utils::EnvironmentItem> &environment); | ||
965 | 133 | |||
966 | 134 | int tagForElement(const QDomElement &element); | ||
967 | 135 | bool expandPlaceHolder_helper(const QDomElement &el, const QString &placeholderKey, | ||
968 | 136 | const QString &placeholderText, | ||
969 | 137 | QSet<BarDescriptorDocument::Tag> &changedTags); | ||
970 | 138 | |||
971 | 139 | void emitAllChanged(); | ||
972 | 140 | |||
973 | 141 | bool m_dirty; | ||
974 | 142 | QDomDocument m_barDocument; | ||
975 | 84 | }; | 143 | }; |
976 | 85 | 144 | ||
977 | 86 | } // namespace Internal | 145 | } // namespace Internal |
978 | 87 | } // namespace Qnx | 146 | } // namespace Qnx |
979 | 88 | 147 | ||
980 | 148 | Q_DECLARE_METATYPE(Qnx::Internal::BarDescriptorAssetList) | ||
981 | 149 | Q_DECLARE_METATYPE(QList<Utils::EnvironmentItem>) | ||
982 | 150 | Q_DECLARE_METATYPE(Qnx::Internal::BarDescriptorDocument::Tag) | ||
983 | 151 | |||
984 | 89 | #endif // QNX_INTERNAL_BARDESCRIPTORDOCUMENT_H | 152 | #endif // QNX_INTERNAL_BARDESCRIPTORDOCUMENT_H |
985 | 90 | 153 | ||
986 | === removed file 'src/qnx/bardescriptordocumentnodehandlers.cpp' | |||
987 | --- src/qnx/bardescriptordocumentnodehandlers.cpp 2014-03-18 10:51:43 +0000 | |||
988 | +++ src/qnx/bardescriptordocumentnodehandlers.cpp 1970-01-01 00:00:00 +0000 | |||
989 | @@ -1,708 +0,0 @@ | |||
990 | 1 | /************************************************************************** | ||
991 | 2 | ** | ||
992 | 3 | ** Copyright (C) 2014 BlackBerry Limited. All rights reserved. | ||
993 | 4 | ** | ||
994 | 5 | ** Contact: BlackBerry (qt@blackberry.com) | ||
995 | 6 | ** Contact: KDAB (info@kdab.com) | ||
996 | 7 | ** | ||
997 | 8 | ** This file is part of Qt Creator. | ||
998 | 9 | ** | ||
999 | 10 | ** Commercial License Usage | ||
1000 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in | ||
1001 | 12 | ** accordance with the commercial license agreement provided with the | ||
1002 | 13 | ** Software or, alternatively, in accordance with the terms contained in | ||
1003 | 14 | ** a written agreement between you and Digia. For licensing terms and | ||
1004 | 15 | ** conditions see http://qt.digia.com/licensing. For further information | ||
1005 | 16 | ** use the contact form at http://qt.digia.com/contact-us. | ||
1006 | 17 | ** | ||
1007 | 18 | ** GNU Lesser General Public License Usage | ||
1008 | 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser | ||
1009 | 20 | ** General Public License version 2.1 as published by the Free Software | ||
1010 | 21 | ** Foundation and appearing in the file LICENSE.LGPL included in the | ||
1011 | 22 | ** packaging of this file. Please review the following information to | ||
1012 | 23 | ** ensure the GNU Lesser General Public License version 2.1 requirements | ||
1013 | 24 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | ||
1014 | 25 | ** | ||
1015 | 26 | ** In addition, as a special exception, Digia gives you certain additional | ||
1016 | 27 | ** rights. These rights are described in the Digia Qt LGPL Exception | ||
1017 | 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | ||
1018 | 29 | ** | ||
1019 | 30 | ****************************************************************************/ | ||
1020 | 31 | |||
1021 | 32 | #include "bardescriptordocumentnodehandlers.h" | ||
1022 | 33 | #include "bardescriptoreditorwidget.h" | ||
1023 | 34 | #include "bardescriptoreditorassetswidget.h" | ||
1024 | 35 | #include "bardescriptoreditorauthorinformationwidget.h" | ||
1025 | 36 | #include "bardescriptoreditorentrypointwidget.h" | ||
1026 | 37 | #include "bardescriptoreditorenvironmentwidget.h" | ||
1027 | 38 | #include "bardescriptoreditorgeneralwidget.h" | ||
1028 | 39 | #include "bardescriptoreditorpackageinformationwidget.h" | ||
1029 | 40 | #include "bardescriptoreditorpermissionswidget.h" | ||
1030 | 41 | |||
1031 | 42 | #include <utils/environment.h> | ||
1032 | 43 | #include <utils/qtcassert.h> | ||
1033 | 44 | |||
1034 | 45 | #include <QDomNode> | ||
1035 | 46 | |||
1036 | 47 | using namespace Qnx; | ||
1037 | 48 | using namespace Qnx::Internal; | ||
1038 | 49 | |||
1039 | 50 | BarDescriptorDocumentAbstractNodeHandler::BarDescriptorDocumentAbstractNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1040 | 51 | : m_editorWidget(editorWidget) | ||
1041 | 52 | , m_order(0xFFFF) | ||
1042 | 53 | { | ||
1043 | 54 | } | ||
1044 | 55 | |||
1045 | 56 | BarDescriptorDocumentAbstractNodeHandler::~BarDescriptorDocumentAbstractNodeHandler() | ||
1046 | 57 | { | ||
1047 | 58 | } | ||
1048 | 59 | |||
1049 | 60 | bool BarDescriptorDocumentAbstractNodeHandler::handle(const QDomNode &node) | ||
1050 | 61 | { | ||
1051 | 62 | if (m_order == 0xFFFF) | ||
1052 | 63 | m_order = node.lineNumber(); | ||
1053 | 64 | |||
1054 | 65 | return fromNode(node); | ||
1055 | 66 | } | ||
1056 | 67 | |||
1057 | 68 | void BarDescriptorDocumentAbstractNodeHandler::clear() | ||
1058 | 69 | { | ||
1059 | 70 | m_order = 0xFFFF; | ||
1060 | 71 | } | ||
1061 | 72 | |||
1062 | 73 | int BarDescriptorDocumentAbstractNodeHandler::order() const | ||
1063 | 74 | { | ||
1064 | 75 | return m_order; | ||
1065 | 76 | } | ||
1066 | 77 | |||
1067 | 78 | BarDescriptorEditorPackageInformationWidget *BarDescriptorDocumentAbstractNodeHandler::packageInformationWidget() const | ||
1068 | 79 | { | ||
1069 | 80 | return m_editorWidget->packageInformationWidget(); | ||
1070 | 81 | } | ||
1071 | 82 | |||
1072 | 83 | BarDescriptorEditorAuthorInformationWidget *BarDescriptorDocumentAbstractNodeHandler::authorInformationWidget() const | ||
1073 | 84 | { | ||
1074 | 85 | return m_editorWidget->authorInformationWidget(); | ||
1075 | 86 | } | ||
1076 | 87 | |||
1077 | 88 | BarDescriptorEditorEntryPointWidget *BarDescriptorDocumentAbstractNodeHandler::entryPointWidget() const | ||
1078 | 89 | { | ||
1079 | 90 | return m_editorWidget->entryPointWidget(); | ||
1080 | 91 | } | ||
1081 | 92 | |||
1082 | 93 | BarDescriptorEditorGeneralWidget *BarDescriptorDocumentAbstractNodeHandler::generalWidget() const | ||
1083 | 94 | { | ||
1084 | 95 | return m_editorWidget->generalWidget(); | ||
1085 | 96 | } | ||
1086 | 97 | |||
1087 | 98 | BarDescriptorEditorPermissionsWidget *BarDescriptorDocumentAbstractNodeHandler::permissionsWidget() const | ||
1088 | 99 | { | ||
1089 | 100 | return m_editorWidget->permissionsWidget(); | ||
1090 | 101 | } | ||
1091 | 102 | |||
1092 | 103 | BarDescriptorEditorEnvironmentWidget *BarDescriptorDocumentAbstractNodeHandler::environmentWidget() const | ||
1093 | 104 | { | ||
1094 | 105 | return m_editorWidget->environmentWidget(); | ||
1095 | 106 | } | ||
1096 | 107 | |||
1097 | 108 | BarDescriptorEditorAssetsWidget *BarDescriptorDocumentAbstractNodeHandler::assetsWidget() const | ||
1098 | 109 | { | ||
1099 | 110 | return m_editorWidget->assetsWidget(); | ||
1100 | 111 | } | ||
1101 | 112 | |||
1102 | 113 | bool BarDescriptorDocumentAbstractNodeHandler::canHandleSimpleTextElement(const QDomNode &node, const QString &tagName) const | ||
1103 | 114 | { | ||
1104 | 115 | QDomElement element = node.toElement(); | ||
1105 | 116 | if (element.isNull()) | ||
1106 | 117 | return false; | ||
1107 | 118 | |||
1108 | 119 | if (element.tagName().toLower() != tagName.toLower()) | ||
1109 | 120 | return false; | ||
1110 | 121 | |||
1111 | 122 | QDomText textNode = element.firstChild().toText(); | ||
1112 | 123 | if (textNode.isNull()) | ||
1113 | 124 | return false; | ||
1114 | 125 | |||
1115 | 126 | return true; | ||
1116 | 127 | } | ||
1117 | 128 | |||
1118 | 129 | QString BarDescriptorDocumentAbstractNodeHandler::loadSimpleTextElement(const QDomNode &node) | ||
1119 | 130 | { | ||
1120 | 131 | QDomElement element = node.toElement(); | ||
1121 | 132 | QDomText textNode = element.firstChild().toText(); | ||
1122 | 133 | return textNode.data(); | ||
1123 | 134 | } | ||
1124 | 135 | |||
1125 | 136 | QDomElement BarDescriptorDocumentAbstractNodeHandler::createSimpleTextElement(QDomDocument &doc, const QString &tagName, const QString &textValue) const | ||
1126 | 137 | { | ||
1127 | 138 | if (textValue.isEmpty()) | ||
1128 | 139 | return QDomElement(); | ||
1129 | 140 | |||
1130 | 141 | QDomElement elem = doc.createElement(tagName); | ||
1131 | 142 | elem.appendChild(doc.createTextNode(textValue)); | ||
1132 | 143 | return elem; | ||
1133 | 144 | } | ||
1134 | 145 | |||
1135 | 146 | // ---------------------------------------------------------------------------- | ||
1136 | 147 | |||
1137 | 148 | BarDescriptorDocumentIdNodeHandler::BarDescriptorDocumentIdNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1138 | 149 | : BarDescriptorDocumentAbstractNodeHandler(editorWidget) | ||
1139 | 150 | { | ||
1140 | 151 | } | ||
1141 | 152 | |||
1142 | 153 | bool BarDescriptorDocumentIdNodeHandler::canHandle(const QDomNode &node) const | ||
1143 | 154 | { | ||
1144 | 155 | return canHandleSimpleTextElement(node, QLatin1String("id")); | ||
1145 | 156 | } | ||
1146 | 157 | |||
1147 | 158 | bool BarDescriptorDocumentIdNodeHandler::fromNode(const QDomNode &node) | ||
1148 | 159 | { | ||
1149 | 160 | if (!canHandle(node)) | ||
1150 | 161 | return false; | ||
1151 | 162 | |||
1152 | 163 | packageInformationWidget()->setPackageId(loadSimpleTextElement(node)); | ||
1153 | 164 | return true; | ||
1154 | 165 | } | ||
1155 | 166 | |||
1156 | 167 | QDomNode BarDescriptorDocumentIdNodeHandler::toNode(QDomDocument &doc) const | ||
1157 | 168 | { | ||
1158 | 169 | return createSimpleTextElement(doc, QLatin1String("id"), packageInformationWidget()->packageId()); | ||
1159 | 170 | } | ||
1160 | 171 | |||
1161 | 172 | // ---------------------------------------------------------------------------- | ||
1162 | 173 | |||
1163 | 174 | BarDescriptorDocumentVersionNumberNodeHandler::BarDescriptorDocumentVersionNumberNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1164 | 175 | : BarDescriptorDocumentAbstractNodeHandler(editorWidget) | ||
1165 | 176 | { | ||
1166 | 177 | } | ||
1167 | 178 | |||
1168 | 179 | bool BarDescriptorDocumentVersionNumberNodeHandler::canHandle(const QDomNode &node) const | ||
1169 | 180 | { | ||
1170 | 181 | return canHandleSimpleTextElement(node, QLatin1String("versionNumber")); | ||
1171 | 182 | } | ||
1172 | 183 | |||
1173 | 184 | bool BarDescriptorDocumentVersionNumberNodeHandler::fromNode(const QDomNode &node) | ||
1174 | 185 | { | ||
1175 | 186 | if (!canHandle(node)) | ||
1176 | 187 | return false; | ||
1177 | 188 | |||
1178 | 189 | packageInformationWidget()->setPackageVersion(loadSimpleTextElement(node)); | ||
1179 | 190 | return true; | ||
1180 | 191 | } | ||
1181 | 192 | |||
1182 | 193 | QDomNode BarDescriptorDocumentVersionNumberNodeHandler::toNode(QDomDocument &doc) const | ||
1183 | 194 | { | ||
1184 | 195 | return createSimpleTextElement(doc, QLatin1String("versionNumber"), packageInformationWidget()->packageVersion()); | ||
1185 | 196 | } | ||
1186 | 197 | |||
1187 | 198 | // ---------------------------------------------------------------------------- | ||
1188 | 199 | |||
1189 | 200 | BarDescriptorDocumentBuildIdNodeHandler::BarDescriptorDocumentBuildIdNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1190 | 201 | : BarDescriptorDocumentAbstractNodeHandler(editorWidget) | ||
1191 | 202 | { | ||
1192 | 203 | } | ||
1193 | 204 | |||
1194 | 205 | bool BarDescriptorDocumentBuildIdNodeHandler::canHandle(const QDomNode &node) const | ||
1195 | 206 | { | ||
1196 | 207 | return canHandleSimpleTextElement(node, QLatin1String("buildId")); | ||
1197 | 208 | } | ||
1198 | 209 | |||
1199 | 210 | bool BarDescriptorDocumentBuildIdNodeHandler::fromNode(const QDomNode &node) | ||
1200 | 211 | { | ||
1201 | 212 | if (!canHandle(node)) | ||
1202 | 213 | return false; | ||
1203 | 214 | |||
1204 | 215 | packageInformationWidget()->setPackageBuildId(loadSimpleTextElement(node)); | ||
1205 | 216 | return true; | ||
1206 | 217 | } | ||
1207 | 218 | |||
1208 | 219 | QDomNode BarDescriptorDocumentBuildIdNodeHandler::toNode(QDomDocument &doc) const | ||
1209 | 220 | { | ||
1210 | 221 | return createSimpleTextElement(doc, QLatin1String("buildId"), packageInformationWidget()->packageBuildId()); | ||
1211 | 222 | } | ||
1212 | 223 | |||
1213 | 224 | // ---------------------------------------------------------------------------- | ||
1214 | 225 | |||
1215 | 226 | BarDescriptorDocumentApplicationNameNodeHandler::BarDescriptorDocumentApplicationNameNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1216 | 227 | : BarDescriptorDocumentAbstractNodeHandler(editorWidget) | ||
1217 | 228 | { | ||
1218 | 229 | } | ||
1219 | 230 | |||
1220 | 231 | bool BarDescriptorDocumentApplicationNameNodeHandler::canHandle(const QDomNode &node) const | ||
1221 | 232 | { | ||
1222 | 233 | return canHandleSimpleTextElement(node, QLatin1String("name")); | ||
1223 | 234 | } | ||
1224 | 235 | |||
1225 | 236 | bool BarDescriptorDocumentApplicationNameNodeHandler::fromNode(const QDomNode &node) | ||
1226 | 237 | { | ||
1227 | 238 | // TODO: Add support for localization | ||
1228 | 239 | |||
1229 | 240 | if (!canHandle(node)) | ||
1230 | 241 | return false; | ||
1231 | 242 | |||
1232 | 243 | entryPointWidget()->setApplicationName(loadSimpleTextElement(node)); | ||
1233 | 244 | return true; | ||
1234 | 245 | } | ||
1235 | 246 | |||
1236 | 247 | QDomNode BarDescriptorDocumentApplicationNameNodeHandler::toNode(QDomDocument &doc) const | ||
1237 | 248 | { | ||
1238 | 249 | // TODO: Add support for localization | ||
1239 | 250 | |||
1240 | 251 | return createSimpleTextElement(doc, QLatin1String("name"), entryPointWidget()->applicationName()); | ||
1241 | 252 | } | ||
1242 | 253 | |||
1243 | 254 | // ---------------------------------------------------------------------------- | ||
1244 | 255 | |||
1245 | 256 | BarDescriptorDocumentApplicationDescriptionNodeHandler::BarDescriptorDocumentApplicationDescriptionNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1246 | 257 | : BarDescriptorDocumentAbstractNodeHandler(editorWidget) | ||
1247 | 258 | { | ||
1248 | 259 | } | ||
1249 | 260 | |||
1250 | 261 | bool BarDescriptorDocumentApplicationDescriptionNodeHandler::canHandle(const QDomNode &node) const | ||
1251 | 262 | { | ||
1252 | 263 | return canHandleSimpleTextElement(node, QLatin1String("description")); | ||
1253 | 264 | } | ||
1254 | 265 | |||
1255 | 266 | bool BarDescriptorDocumentApplicationDescriptionNodeHandler::fromNode(const QDomNode &node) | ||
1256 | 267 | { | ||
1257 | 268 | // TODO: Add support for localization | ||
1258 | 269 | |||
1259 | 270 | if (!canHandle(node)) | ||
1260 | 271 | return false; | ||
1261 | 272 | |||
1262 | 273 | entryPointWidget()->setApplicationDescription(loadSimpleTextElement(node)); | ||
1263 | 274 | return true; | ||
1264 | 275 | } | ||
1265 | 276 | |||
1266 | 277 | QDomNode BarDescriptorDocumentApplicationDescriptionNodeHandler::toNode(QDomDocument &doc) const | ||
1267 | 278 | { | ||
1268 | 279 | return createSimpleTextElement(doc, QLatin1String("description"), entryPointWidget()->applicationDescription()); | ||
1269 | 280 | } | ||
1270 | 281 | |||
1271 | 282 | // ---------------------------------------------------------------------------- | ||
1272 | 283 | |||
1273 | 284 | BarDescriptorDocumentApplicationIconNodeHandler::BarDescriptorDocumentApplicationIconNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1274 | 285 | : BarDescriptorDocumentAbstractNodeHandler(editorWidget) | ||
1275 | 286 | { | ||
1276 | 287 | } | ||
1277 | 288 | |||
1278 | 289 | bool BarDescriptorDocumentApplicationIconNodeHandler::canHandle(const QDomNode &node) const | ||
1279 | 290 | { | ||
1280 | 291 | QDomElement element = node.toElement(); | ||
1281 | 292 | if (element.isNull()) | ||
1282 | 293 | return false; | ||
1283 | 294 | |||
1284 | 295 | if (element.tagName() != QLatin1String("icon")) | ||
1285 | 296 | return false; | ||
1286 | 297 | |||
1287 | 298 | QDomElement imageElement = element.firstChild().toElement(); | ||
1288 | 299 | if (imageElement.isNull()) | ||
1289 | 300 | return false; | ||
1290 | 301 | |||
1291 | 302 | if (imageElement.tagName() != QLatin1String("image")) | ||
1292 | 303 | return false; | ||
1293 | 304 | |||
1294 | 305 | QDomText imageTextNode = imageElement.firstChild().toText(); | ||
1295 | 306 | if (imageTextNode.isNull()) | ||
1296 | 307 | return false; | ||
1297 | 308 | |||
1298 | 309 | return true; | ||
1299 | 310 | } | ||
1300 | 311 | |||
1301 | 312 | bool BarDescriptorDocumentApplicationIconNodeHandler::fromNode(const QDomNode &node) | ||
1302 | 313 | { | ||
1303 | 314 | // TODO: Add support for localization | ||
1304 | 315 | |||
1305 | 316 | if (!canHandle(node)) | ||
1306 | 317 | return false; | ||
1307 | 318 | |||
1308 | 319 | QDomNode imageNode = node.firstChild(); | ||
1309 | 320 | QDomText imageTextNode = imageNode.firstChild().toText(); | ||
1310 | 321 | entryPointWidget()->setApplicationIcon(imageTextNode.data()); | ||
1311 | 322 | return true; | ||
1312 | 323 | } | ||
1313 | 324 | |||
1314 | 325 | QDomNode BarDescriptorDocumentApplicationIconNodeHandler::toNode(QDomDocument &doc) const | ||
1315 | 326 | { | ||
1316 | 327 | // TODO: Add support for localization | ||
1317 | 328 | const QString iconFileName = entryPointWidget()->applicationIconFileName(); | ||
1318 | 329 | if (iconFileName.isEmpty()) | ||
1319 | 330 | return QDomElement(); | ||
1320 | 331 | |||
1321 | 332 | QDomElement iconElement = doc.createElement(QLatin1String("icon")); | ||
1322 | 333 | iconElement.appendChild(createSimpleTextElement(doc, QLatin1String("image"), iconFileName)); | ||
1323 | 334 | return iconElement; | ||
1324 | 335 | } | ||
1325 | 336 | |||
1326 | 337 | // ---------------------------------------------------------------------------- | ||
1327 | 338 | |||
1328 | 339 | BarDescriptorDocumentSplashScreenNodeHandler::BarDescriptorDocumentSplashScreenNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1329 | 340 | : BarDescriptorDocumentAbstractNodeHandler(editorWidget) | ||
1330 | 341 | { | ||
1331 | 342 | } | ||
1332 | 343 | |||
1333 | 344 | bool BarDescriptorDocumentSplashScreenNodeHandler::canHandle(const QDomNode &node) const | ||
1334 | 345 | { | ||
1335 | 346 | QDomElement element = node.toElement(); | ||
1336 | 347 | if (element.isNull()) | ||
1337 | 348 | return false; | ||
1338 | 349 | |||
1339 | 350 | if (element.tagName().toLower() != QLatin1String("splashscreens")) | ||
1340 | 351 | return false; | ||
1341 | 352 | |||
1342 | 353 | QDomElement imageElement = element.firstChild().toElement(); | ||
1343 | 354 | if (imageElement.isNull()) | ||
1344 | 355 | return false; | ||
1345 | 356 | |||
1346 | 357 | if (imageElement.tagName().toLower() != QLatin1String("image")) | ||
1347 | 358 | return false; | ||
1348 | 359 | |||
1349 | 360 | QDomText imageTextNode = imageElement.firstChild().toText(); | ||
1350 | 361 | if (imageTextNode.isNull()) | ||
1351 | 362 | return false; | ||
1352 | 363 | |||
1353 | 364 | return true; | ||
1354 | 365 | } | ||
1355 | 366 | |||
1356 | 367 | bool BarDescriptorDocumentSplashScreenNodeHandler::fromNode(const QDomNode &node) | ||
1357 | 368 | { | ||
1358 | 369 | if (!canHandle(node)) | ||
1359 | 370 | return false; | ||
1360 | 371 | |||
1361 | 372 | QDomElement imageNode = node.firstChildElement(); | ||
1362 | 373 | while (!imageNode.isNull()) { | ||
1363 | 374 | if (imageNode.tagName().toLower() == QLatin1String("image")) { | ||
1364 | 375 | QDomText imageTextNode = imageNode.firstChild().toText(); | ||
1365 | 376 | entryPointWidget()->appendSplashScreen(imageTextNode.data()); | ||
1366 | 377 | } | ||
1367 | 378 | imageNode = imageNode.nextSiblingElement(); | ||
1368 | 379 | } | ||
1369 | 380 | return true; | ||
1370 | 381 | } | ||
1371 | 382 | |||
1372 | 383 | QDomNode BarDescriptorDocumentSplashScreenNodeHandler::toNode(QDomDocument &doc) const | ||
1373 | 384 | { | ||
1374 | 385 | QStringList splashScreens = entryPointWidget()->splashScreens(); | ||
1375 | 386 | if (splashScreens.isEmpty()) | ||
1376 | 387 | return QDomElement(); | ||
1377 | 388 | |||
1378 | 389 | QDomElement splashScreenElement = doc.createElement(QLatin1String("splashScreens")); | ||
1379 | 390 | foreach (const QString &splashScreen, splashScreens) | ||
1380 | 391 | splashScreenElement.appendChild(createSimpleTextElement(doc, QLatin1String("image"), splashScreen)); | ||
1381 | 392 | |||
1382 | 393 | return splashScreenElement; | ||
1383 | 394 | } | ||
1384 | 395 | |||
1385 | 396 | // ---------------------------------------------------------------------------- | ||
1386 | 397 | |||
1387 | 398 | BarDescriptorDocumentAssetNodeHandler::BarDescriptorDocumentAssetNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1388 | 399 | : BarDescriptorDocumentAbstractNodeHandler(editorWidget) | ||
1389 | 400 | { | ||
1390 | 401 | } | ||
1391 | 402 | |||
1392 | 403 | bool BarDescriptorDocumentAssetNodeHandler::canHandle(const QDomNode &node) const | ||
1393 | 404 | { | ||
1394 | 405 | return canHandleSimpleTextElement(node, QLatin1String("asset")); | ||
1395 | 406 | } | ||
1396 | 407 | |||
1397 | 408 | bool BarDescriptorDocumentAssetNodeHandler::fromNode(const QDomNode &node) | ||
1398 | 409 | { | ||
1399 | 410 | if (!canHandle(node)) | ||
1400 | 411 | return false; | ||
1401 | 412 | |||
1402 | 413 | QDomElement element = node.toElement(); | ||
1403 | 414 | |||
1404 | 415 | QString path = element.attribute(QLatin1String("path")); | ||
1405 | 416 | QString entry = element.attribute(QLatin1String("entry")); | ||
1406 | 417 | QDomText destNode = element.firstChild().toText(); | ||
1407 | 418 | QString dest = destNode.data(); | ||
1408 | 419 | |||
1409 | 420 | BarDescriptorAsset asset; | ||
1410 | 421 | asset.source = path; | ||
1411 | 422 | asset.destination = dest; | ||
1412 | 423 | asset.entry = entry == QLatin1String("true"); | ||
1413 | 424 | |||
1414 | 425 | assetsWidget()->addAsset(asset); | ||
1415 | 426 | return true; | ||
1416 | 427 | } | ||
1417 | 428 | |||
1418 | 429 | QDomNode BarDescriptorDocumentAssetNodeHandler::toNode(QDomDocument &doc) const | ||
1419 | 430 | { | ||
1420 | 431 | QDomDocumentFragment fragment = doc.createDocumentFragment(); | ||
1421 | 432 | |||
1422 | 433 | QList<BarDescriptorAsset> assets = assetsWidget()->assets(); | ||
1423 | 434 | foreach (const BarDescriptorAsset &asset, assets) { | ||
1424 | 435 | QDomElement assetElem = doc.createElement(QLatin1String("asset")); | ||
1425 | 436 | assetElem.setAttribute(QLatin1String("path"), asset.source); | ||
1426 | 437 | if (asset.entry) { | ||
1427 | 438 | assetElem.setAttribute(QLatin1String("type"), QLatin1String("Qnx/Elf")); | ||
1428 | 439 | assetElem.setAttribute(QLatin1String("entry"), QLatin1String("true")); | ||
1429 | 440 | } | ||
1430 | 441 | assetElem.appendChild(doc.createTextNode(asset.destination)); | ||
1431 | 442 | fragment.appendChild(assetElem); | ||
1432 | 443 | } | ||
1433 | 444 | |||
1434 | 445 | return fragment; | ||
1435 | 446 | } | ||
1436 | 447 | |||
1437 | 448 | // ---------------------------------------------------------------------------- | ||
1438 | 449 | |||
1439 | 450 | BarDescriptorDocumentInitialWindowNodeHandler::BarDescriptorDocumentInitialWindowNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1440 | 451 | : BarDescriptorDocumentAbstractNodeHandler(editorWidget) | ||
1441 | 452 | { | ||
1442 | 453 | } | ||
1443 | 454 | |||
1444 | 455 | bool BarDescriptorDocumentInitialWindowNodeHandler::canHandle(const QDomNode &node) const | ||
1445 | 456 | { | ||
1446 | 457 | QDomElement element = node.toElement(); | ||
1447 | 458 | if (element.isNull()) | ||
1448 | 459 | return false; | ||
1449 | 460 | |||
1450 | 461 | if (element.tagName() != QLatin1String("initialWindow")) | ||
1451 | 462 | return false; | ||
1452 | 463 | |||
1453 | 464 | return true; | ||
1454 | 465 | } | ||
1455 | 466 | |||
1456 | 467 | bool BarDescriptorDocumentInitialWindowNodeHandler::fromNode(const QDomNode &node) | ||
1457 | 468 | { | ||
1458 | 469 | if (!canHandle(node)) | ||
1459 | 470 | return false; | ||
1460 | 471 | |||
1461 | 472 | QDomElement child = node.firstChildElement(); | ||
1462 | 473 | while (!child.isNull()) { | ||
1463 | 474 | if (child.tagName() == QLatin1String("aspectRatio")) { | ||
1464 | 475 | generalWidget()->setOrientation(loadSimpleTextElement(child)); | ||
1465 | 476 | } else if (child.tagName() == QLatin1String("autoOrients")) { | ||
1466 | 477 | if (loadSimpleTextElement(child) == QLatin1String("true")) | ||
1467 | 478 | generalWidget()->setOrientation(QLatin1String("auto-orient")); | ||
1468 | 479 | } else if (child.tagName() == QLatin1String("systemChrome")) { | ||
1469 | 480 | generalWidget()->setChrome(loadSimpleTextElement(child)); | ||
1470 | 481 | } else if (child.tagName() == QLatin1String("transparent")) { | ||
1471 | 482 | const QString transparent = loadSimpleTextElement(child); | ||
1472 | 483 | generalWidget()->setTransparent(transparent == QLatin1String("true")); | ||
1473 | 484 | } | ||
1474 | 485 | child = child.nextSiblingElement(); | ||
1475 | 486 | } | ||
1476 | 487 | |||
1477 | 488 | return true; | ||
1478 | 489 | } | ||
1479 | 490 | |||
1480 | 491 | QDomNode BarDescriptorDocumentInitialWindowNodeHandler::toNode(QDomDocument &doc) const | ||
1481 | 492 | { | ||
1482 | 493 | QDomElement element = doc.createElement(QLatin1String("initialWindow")); | ||
1483 | 494 | |||
1484 | 495 | if (generalWidget()->orientation() == QLatin1String("auto-orient")) { | ||
1485 | 496 | element.appendChild(createSimpleTextElement(doc, QLatin1String("autoOrients"), QLatin1String("true"))); | ||
1486 | 497 | } else if (!generalWidget()->orientation().isEmpty()) { | ||
1487 | 498 | element.appendChild(createSimpleTextElement(doc, QLatin1String("aspectRatio"), generalWidget()->orientation())); | ||
1488 | 499 | element.appendChild(createSimpleTextElement(doc, QLatin1String("autoOrients"), QLatin1String("false"))); | ||
1489 | 500 | } | ||
1490 | 501 | element.appendChild(createSimpleTextElement(doc, QLatin1String("systemChrome"), generalWidget()->chrome())); | ||
1491 | 502 | element.appendChild(createSimpleTextElement(doc, QLatin1String("transparent"), generalWidget()->transparent() ? QLatin1String("true") : QLatin1String("false"))); | ||
1492 | 503 | |||
1493 | 504 | return element; | ||
1494 | 505 | } | ||
1495 | 506 | |||
1496 | 507 | // ---------------------------------------------------------------------------- | ||
1497 | 508 | |||
1498 | 509 | |||
1499 | 510 | BarDescriptorDocumentActionNodeHandler::BarDescriptorDocumentActionNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1500 | 511 | : BarDescriptorDocumentAbstractNodeHandler(editorWidget) | ||
1501 | 512 | { | ||
1502 | 513 | } | ||
1503 | 514 | |||
1504 | 515 | bool BarDescriptorDocumentActionNodeHandler::canHandle(const QDomNode &node) const | ||
1505 | 516 | { | ||
1506 | 517 | return canHandleSimpleTextElement(node, QLatin1String("action")); | ||
1507 | 518 | } | ||
1508 | 519 | |||
1509 | 520 | bool BarDescriptorDocumentActionNodeHandler::fromNode(const QDomNode &node) | ||
1510 | 521 | { | ||
1511 | 522 | if (!canHandle(node)) | ||
1512 | 523 | return false; | ||
1513 | 524 | |||
1514 | 525 | QString value = loadSimpleTextElement(node); | ||
1515 | 526 | if (value != QLatin1String("run_native")) // This has no representation in the GUI, and is always added | ||
1516 | 527 | permissionsWidget()->checkPermission(value); | ||
1517 | 528 | |||
1518 | 529 | return true; | ||
1519 | 530 | } | ||
1520 | 531 | |||
1521 | 532 | QDomNode BarDescriptorDocumentActionNodeHandler::toNode(QDomDocument &doc) const | ||
1522 | 533 | { | ||
1523 | 534 | QDomDocumentFragment frag = doc.createDocumentFragment(); | ||
1524 | 535 | |||
1525 | 536 | QDomElement runNativeElement = doc.createElement(QLatin1String("action")); | ||
1526 | 537 | runNativeElement.setAttribute(QLatin1String("system"), QLatin1String("true")); | ||
1527 | 538 | runNativeElement.appendChild(doc.createTextNode(QLatin1String("run_native"))); | ||
1528 | 539 | frag.appendChild(runNativeElement); | ||
1529 | 540 | |||
1530 | 541 | QStringList checkedIdentifiers = permissionsWidget()->checkedPermissions(); | ||
1531 | 542 | foreach (const QString &identifier, checkedIdentifiers) | ||
1532 | 543 | frag.appendChild(createSimpleTextElement(doc, QLatin1String("action"), identifier)); | ||
1533 | 544 | |||
1534 | 545 | return frag; | ||
1535 | 546 | } | ||
1536 | 547 | |||
1537 | 548 | // ---------------------------------------------------------------------------- | ||
1538 | 549 | |||
1539 | 550 | BarDescriptorDocumentArgNodeHandler::BarDescriptorDocumentArgNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1540 | 551 | : BarDescriptorDocumentAbstractNodeHandler(editorWidget) | ||
1541 | 552 | { | ||
1542 | 553 | } | ||
1543 | 554 | |||
1544 | 555 | bool BarDescriptorDocumentArgNodeHandler::canHandle(const QDomNode &node) const | ||
1545 | 556 | { | ||
1546 | 557 | return canHandleSimpleTextElement(node, QLatin1String("arg")); | ||
1547 | 558 | } | ||
1548 | 559 | |||
1549 | 560 | bool BarDescriptorDocumentArgNodeHandler::fromNode(const QDomNode &node) | ||
1550 | 561 | { | ||
1551 | 562 | if (!canHandle(node)) | ||
1552 | 563 | return false; | ||
1553 | 564 | |||
1554 | 565 | generalWidget()->appendApplicationArgument(loadSimpleTextElement(node)); | ||
1555 | 566 | return true; | ||
1556 | 567 | } | ||
1557 | 568 | |||
1558 | 569 | QDomNode BarDescriptorDocumentArgNodeHandler::toNode(QDomDocument &doc) const | ||
1559 | 570 | { | ||
1560 | 571 | QDomDocumentFragment frag = doc.createDocumentFragment(); | ||
1561 | 572 | |||
1562 | 573 | QStringList arguments = generalWidget()->applicationArguments(); | ||
1563 | 574 | foreach (const QString &argument, arguments) | ||
1564 | 575 | frag.appendChild(createSimpleTextElement(doc, QLatin1String("arg"), argument)); | ||
1565 | 576 | |||
1566 | 577 | return frag; | ||
1567 | 578 | } | ||
1568 | 579 | |||
1569 | 580 | // ---------------------------------------------------------------------------- | ||
1570 | 581 | |||
1571 | 582 | BarDescriptorDocumentEnvNodeHandler::BarDescriptorDocumentEnvNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1572 | 583 | : BarDescriptorDocumentAbstractNodeHandler(editorWidget) | ||
1573 | 584 | { | ||
1574 | 585 | } | ||
1575 | 586 | |||
1576 | 587 | bool BarDescriptorDocumentEnvNodeHandler::canHandle(const QDomNode &node) const | ||
1577 | 588 | { | ||
1578 | 589 | QDomElement element = node.toElement(); | ||
1579 | 590 | if (element.isNull()) | ||
1580 | 591 | return false; | ||
1581 | 592 | |||
1582 | 593 | if (element.tagName() != QLatin1String("env")) | ||
1583 | 594 | return false; | ||
1584 | 595 | |||
1585 | 596 | if (!element.hasAttribute(QLatin1String("var")) || !element.hasAttribute(QLatin1String("value"))) | ||
1586 | 597 | return false; | ||
1587 | 598 | |||
1588 | 599 | return true; | ||
1589 | 600 | } | ||
1590 | 601 | |||
1591 | 602 | bool BarDescriptorDocumentEnvNodeHandler::fromNode(const QDomNode &node) | ||
1592 | 603 | { | ||
1593 | 604 | if (!canHandle(node)) | ||
1594 | 605 | return false; | ||
1595 | 606 | |||
1596 | 607 | QDomElement element = node.toElement(); | ||
1597 | 608 | |||
1598 | 609 | QString var = element.attribute(QLatin1String("var")); | ||
1599 | 610 | QString value = element.attribute(QLatin1String("value")); | ||
1600 | 611 | |||
1601 | 612 | Utils::EnvironmentItem item(var, value); | ||
1602 | 613 | environmentWidget()->appendEnvironmentItem(item); | ||
1603 | 614 | return true; | ||
1604 | 615 | } | ||
1605 | 616 | |||
1606 | 617 | QDomNode BarDescriptorDocumentEnvNodeHandler::toNode(QDomDocument &doc) const | ||
1607 | 618 | { | ||
1608 | 619 | QDomDocumentFragment frag = doc.createDocumentFragment(); | ||
1609 | 620 | QList<Utils::EnvironmentItem> environmentItems = environmentWidget()->environment(); | ||
1610 | 621 | |||
1611 | 622 | foreach (const Utils::EnvironmentItem &item, environmentItems) { | ||
1612 | 623 | QDomElement element = doc.createElement(QLatin1String("env")); | ||
1613 | 624 | element.setAttribute(QLatin1String("var"), item.name); | ||
1614 | 625 | element.setAttribute(QLatin1String("value"), item.value); | ||
1615 | 626 | frag.appendChild(element); | ||
1616 | 627 | } | ||
1617 | 628 | |||
1618 | 629 | return frag; | ||
1619 | 630 | } | ||
1620 | 631 | |||
1621 | 632 | // ---------------------------------------------------------------------------- | ||
1622 | 633 | |||
1623 | 634 | BarDescriptorDocumentAuthorNodeHandler::BarDescriptorDocumentAuthorNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1624 | 635 | : BarDescriptorDocumentAbstractNodeHandler(editorWidget) | ||
1625 | 636 | { | ||
1626 | 637 | } | ||
1627 | 638 | |||
1628 | 639 | bool BarDescriptorDocumentAuthorNodeHandler::canHandle(const QDomNode &node) const | ||
1629 | 640 | { | ||
1630 | 641 | return canHandleSimpleTextElement(node, QLatin1String("author")) | ||
1631 | 642 | || canHandleSimpleTextElement(node, QLatin1String("publisher")); | ||
1632 | 643 | } | ||
1633 | 644 | |||
1634 | 645 | bool BarDescriptorDocumentAuthorNodeHandler::fromNode(const QDomNode &node) | ||
1635 | 646 | { | ||
1636 | 647 | if (!canHandle(node)) | ||
1637 | 648 | return false; | ||
1638 | 649 | |||
1639 | 650 | authorInformationWidget()->setAuthor(loadSimpleTextElement(node)); | ||
1640 | 651 | return true; | ||
1641 | 652 | } | ||
1642 | 653 | |||
1643 | 654 | QDomNode BarDescriptorDocumentAuthorNodeHandler::toNode(QDomDocument &doc) const | ||
1644 | 655 | { | ||
1645 | 656 | return createSimpleTextElement(doc, QLatin1String("author"), authorInformationWidget()->author()); | ||
1646 | 657 | } | ||
1647 | 658 | |||
1648 | 659 | // ---------------------------------------------------------------------------- | ||
1649 | 660 | |||
1650 | 661 | BarDescriptorDocumentAuthorIdNodeHandler::BarDescriptorDocumentAuthorIdNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1651 | 662 | : BarDescriptorDocumentAbstractNodeHandler(editorWidget) | ||
1652 | 663 | { | ||
1653 | 664 | } | ||
1654 | 665 | |||
1655 | 666 | bool BarDescriptorDocumentAuthorIdNodeHandler::canHandle(const QDomNode &node) const | ||
1656 | 667 | { | ||
1657 | 668 | return canHandleSimpleTextElement(node, QLatin1String("authorId")); | ||
1658 | 669 | } | ||
1659 | 670 | |||
1660 | 671 | bool BarDescriptorDocumentAuthorIdNodeHandler::fromNode(const QDomNode &node) | ||
1661 | 672 | { | ||
1662 | 673 | if (!canHandle(node)) | ||
1663 | 674 | return false; | ||
1664 | 675 | |||
1665 | 676 | authorInformationWidget()->setAuthorId(loadSimpleTextElement(node)); | ||
1666 | 677 | return true; | ||
1667 | 678 | } | ||
1668 | 679 | |||
1669 | 680 | QDomNode BarDescriptorDocumentAuthorIdNodeHandler::toNode(QDomDocument &doc) const | ||
1670 | 681 | { | ||
1671 | 682 | return createSimpleTextElement(doc, QLatin1String("authorId"), authorInformationWidget()->authorId()); | ||
1672 | 683 | } | ||
1673 | 684 | |||
1674 | 685 | // ---------------------------------------------------------------------------- | ||
1675 | 686 | |||
1676 | 687 | BarDescriptorDocumentUnknownNodeHandler::BarDescriptorDocumentUnknownNodeHandler(BarDescriptorEditorWidget *editorWidget) | ||
1677 | 688 | : BarDescriptorDocumentAbstractNodeHandler(editorWidget) | ||
1678 | 689 | { | ||
1679 | 690 | } | ||
1680 | 691 | |||
1681 | 692 | bool BarDescriptorDocumentUnknownNodeHandler::canHandle(const QDomNode &node) const | ||
1682 | 693 | { | ||
1683 | 694 | Q_UNUSED(node); | ||
1684 | 695 | return true; | ||
1685 | 696 | } | ||
1686 | 697 | |||
1687 | 698 | bool BarDescriptorDocumentUnknownNodeHandler::fromNode(const QDomNode &node) | ||
1688 | 699 | { | ||
1689 | 700 | m_node = node.cloneNode(); | ||
1690 | 701 | return true; | ||
1691 | 702 | } | ||
1692 | 703 | |||
1693 | 704 | QDomNode BarDescriptorDocumentUnknownNodeHandler::toNode(QDomDocument &doc) const | ||
1694 | 705 | { | ||
1695 | 706 | Q_UNUSED(doc); | ||
1696 | 707 | return m_node; | ||
1697 | 708 | } | ||
1698 | 709 | 0 | ||
1699 | === removed file 'src/qnx/bardescriptordocumentnodehandlers.h' | |||
1700 | --- src/qnx/bardescriptordocumentnodehandlers.h 2014-03-18 10:51:43 +0000 | |||
1701 | +++ src/qnx/bardescriptordocumentnodehandlers.h 1970-01-01 00:00:00 +0000 | |||
1702 | @@ -1,302 +0,0 @@ | |||
1703 | 1 | /************************************************************************** | ||
1704 | 2 | ** | ||
1705 | 3 | ** Copyright (C) 2014 BlackBerry Limited. All rights reserved. | ||
1706 | 4 | ** | ||
1707 | 5 | ** Contact: BlackBerry (qt@blackberry.com) | ||
1708 | 6 | ** Contact: KDAB (info@kdab.com) | ||
1709 | 7 | ** | ||
1710 | 8 | ** This file is part of Qt Creator. | ||
1711 | 9 | ** | ||
1712 | 10 | ** Commercial License Usage | ||
1713 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in | ||
1714 | 12 | ** accordance with the commercial license agreement provided with the | ||
1715 | 13 | ** Software or, alternatively, in accordance with the terms contained in | ||
1716 | 14 | ** a written agreement between you and Digia. For licensing terms and | ||
1717 | 15 | ** conditions see http://qt.digia.com/licensing. For further information | ||
1718 | 16 | ** use the contact form at http://qt.digia.com/contact-us. | ||
1719 | 17 | ** | ||
1720 | 18 | ** GNU Lesser General Public License Usage | ||
1721 | 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser | ||
1722 | 20 | ** General Public License version 2.1 as published by the Free Software | ||
1723 | 21 | ** Foundation and appearing in the file LICENSE.LGPL included in the | ||
1724 | 22 | ** packaging of this file. Please review the following information to | ||
1725 | 23 | ** ensure the GNU Lesser General Public License version 2.1 requirements | ||
1726 | 24 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | ||
1727 | 25 | ** | ||
1728 | 26 | ** In addition, as a special exception, Digia gives you certain additional | ||
1729 | 27 | ** rights. These rights are described in the Digia Qt LGPL Exception | ||
1730 | 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | ||
1731 | 29 | ** | ||
1732 | 30 | ****************************************************************************/ | ||
1733 | 31 | |||
1734 | 32 | #ifndef QNX_INTERNAL_BARDESCRIPTORDOCUMENTNODEHANDLERS_H | ||
1735 | 33 | #define QNX_INTERNAL_BARDESCRIPTORDOCUMENTNODEHANDLERS_H | ||
1736 | 34 | |||
1737 | 35 | #include <QDomNode> | ||
1738 | 36 | #include <QSharedPointer> | ||
1739 | 37 | |||
1740 | 38 | namespace Qnx { | ||
1741 | 39 | namespace Internal { | ||
1742 | 40 | |||
1743 | 41 | class BarDescriptorEditorWidget; | ||
1744 | 42 | class BarDescriptorEditorAssetsWidget; | ||
1745 | 43 | class BarDescriptorEditorAuthorInformationWidget; | ||
1746 | 44 | class BarDescriptorEditorEntryPointWidget; | ||
1747 | 45 | class BarDescriptorEditorEnvironmentWidget; | ||
1748 | 46 | class BarDescriptorEditorGeneralWidget; | ||
1749 | 47 | class BarDescriptorEditorPackageInformationWidget; | ||
1750 | 48 | class BarDescriptorEditorPermissionsWidget; | ||
1751 | 49 | |||
1752 | 50 | class BarDescriptorDocumentAbstractNodeHandler | ||
1753 | 51 | { | ||
1754 | 52 | public: | ||
1755 | 53 | BarDescriptorDocumentAbstractNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1756 | 54 | virtual ~BarDescriptorDocumentAbstractNodeHandler(); | ||
1757 | 55 | |||
1758 | 56 | virtual bool canHandle(const QDomNode &node) const = 0; | ||
1759 | 57 | bool handle(const QDomNode &node); | ||
1760 | 58 | virtual QDomNode toNode(QDomDocument &doc) const = 0; | ||
1761 | 59 | |||
1762 | 60 | void clear(); | ||
1763 | 61 | int order() const; | ||
1764 | 62 | |||
1765 | 63 | protected: | ||
1766 | 64 | BarDescriptorEditorPackageInformationWidget *packageInformationWidget() const; | ||
1767 | 65 | BarDescriptorEditorAuthorInformationWidget *authorInformationWidget() const; | ||
1768 | 66 | |||
1769 | 67 | BarDescriptorEditorEntryPointWidget *entryPointWidget() const; | ||
1770 | 68 | BarDescriptorEditorGeneralWidget *generalWidget() const; | ||
1771 | 69 | BarDescriptorEditorPermissionsWidget *permissionsWidget() const; | ||
1772 | 70 | BarDescriptorEditorEnvironmentWidget *environmentWidget() const; | ||
1773 | 71 | |||
1774 | 72 | BarDescriptorEditorAssetsWidget *assetsWidget() const; | ||
1775 | 73 | |||
1776 | 74 | virtual bool fromNode(const QDomNode &node) = 0; | ||
1777 | 75 | |||
1778 | 76 | bool canHandleSimpleTextElement(const QDomNode &node, const QString &tagName) const; | ||
1779 | 77 | QString loadSimpleTextElement(const QDomNode &node); | ||
1780 | 78 | QDomElement createSimpleTextElement(QDomDocument &doc, const QString &tagName, const QString &textValue) const; | ||
1781 | 79 | |||
1782 | 80 | private: | ||
1783 | 81 | BarDescriptorEditorWidget *m_editorWidget; | ||
1784 | 82 | |||
1785 | 83 | int m_order; | ||
1786 | 84 | }; | ||
1787 | 85 | |||
1788 | 86 | // ---------------------------------------------------------------------------- | ||
1789 | 87 | |||
1790 | 88 | class BarDescriptorDocumentIdNodeHandler : public BarDescriptorDocumentAbstractNodeHandler | ||
1791 | 89 | { | ||
1792 | 90 | public: | ||
1793 | 91 | BarDescriptorDocumentIdNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1794 | 92 | |||
1795 | 93 | bool canHandle(const QDomNode &node) const; | ||
1796 | 94 | QDomNode toNode(QDomDocument &doc) const; | ||
1797 | 95 | |||
1798 | 96 | protected: | ||
1799 | 97 | bool fromNode(const QDomNode &node); | ||
1800 | 98 | }; | ||
1801 | 99 | |||
1802 | 100 | // ---------------------------------------------------------------------------- | ||
1803 | 101 | |||
1804 | 102 | class BarDescriptorDocumentVersionNumberNodeHandler : public BarDescriptorDocumentAbstractNodeHandler | ||
1805 | 103 | { | ||
1806 | 104 | public: | ||
1807 | 105 | BarDescriptorDocumentVersionNumberNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1808 | 106 | |||
1809 | 107 | bool canHandle(const QDomNode &node) const; | ||
1810 | 108 | QDomNode toNode(QDomDocument &doc) const; | ||
1811 | 109 | |||
1812 | 110 | protected: | ||
1813 | 111 | bool fromNode(const QDomNode &node); | ||
1814 | 112 | }; | ||
1815 | 113 | |||
1816 | 114 | // ---------------------------------------------------------------------------- | ||
1817 | 115 | |||
1818 | 116 | class BarDescriptorDocumentBuildIdNodeHandler : public BarDescriptorDocumentAbstractNodeHandler | ||
1819 | 117 | { | ||
1820 | 118 | public: | ||
1821 | 119 | BarDescriptorDocumentBuildIdNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1822 | 120 | |||
1823 | 121 | bool canHandle(const QDomNode &node) const; | ||
1824 | 122 | QDomNode toNode(QDomDocument &doc) const; | ||
1825 | 123 | |||
1826 | 124 | protected: | ||
1827 | 125 | bool fromNode(const QDomNode &node); | ||
1828 | 126 | }; | ||
1829 | 127 | |||
1830 | 128 | // ---------------------------------------------------------------------------- | ||
1831 | 129 | |||
1832 | 130 | class BarDescriptorDocumentApplicationNameNodeHandler : public BarDescriptorDocumentAbstractNodeHandler | ||
1833 | 131 | { | ||
1834 | 132 | public: | ||
1835 | 133 | BarDescriptorDocumentApplicationNameNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1836 | 134 | |||
1837 | 135 | bool canHandle(const QDomNode &node) const; | ||
1838 | 136 | QDomNode toNode(QDomDocument &doc) const; | ||
1839 | 137 | |||
1840 | 138 | protected: | ||
1841 | 139 | bool fromNode(const QDomNode &node); | ||
1842 | 140 | }; | ||
1843 | 141 | |||
1844 | 142 | // ---------------------------------------------------------------------------- | ||
1845 | 143 | |||
1846 | 144 | class BarDescriptorDocumentApplicationDescriptionNodeHandler : public BarDescriptorDocumentAbstractNodeHandler | ||
1847 | 145 | { | ||
1848 | 146 | public: | ||
1849 | 147 | BarDescriptorDocumentApplicationDescriptionNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1850 | 148 | |||
1851 | 149 | bool canHandle(const QDomNode &node) const; | ||
1852 | 150 | QDomNode toNode(QDomDocument &doc) const; | ||
1853 | 151 | |||
1854 | 152 | protected: | ||
1855 | 153 | bool fromNode(const QDomNode &node); | ||
1856 | 154 | }; | ||
1857 | 155 | |||
1858 | 156 | // ---------------------------------------------------------------------------- | ||
1859 | 157 | |||
1860 | 158 | class BarDescriptorDocumentApplicationIconNodeHandler : public BarDescriptorDocumentAbstractNodeHandler | ||
1861 | 159 | { | ||
1862 | 160 | public: | ||
1863 | 161 | BarDescriptorDocumentApplicationIconNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1864 | 162 | |||
1865 | 163 | bool canHandle(const QDomNode &node) const; | ||
1866 | 164 | QDomNode toNode(QDomDocument &doc) const; | ||
1867 | 165 | |||
1868 | 166 | protected: | ||
1869 | 167 | bool fromNode(const QDomNode &node); | ||
1870 | 168 | }; | ||
1871 | 169 | |||
1872 | 170 | // ---------------------------------------------------------------------------- | ||
1873 | 171 | |||
1874 | 172 | class BarDescriptorDocumentSplashScreenNodeHandler : public BarDescriptorDocumentAbstractNodeHandler | ||
1875 | 173 | { | ||
1876 | 174 | public: | ||
1877 | 175 | BarDescriptorDocumentSplashScreenNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1878 | 176 | |||
1879 | 177 | bool canHandle(const QDomNode &node) const; | ||
1880 | 178 | QDomNode toNode(QDomDocument &doc) const; | ||
1881 | 179 | |||
1882 | 180 | protected: | ||
1883 | 181 | bool fromNode(const QDomNode &node); | ||
1884 | 182 | }; | ||
1885 | 183 | |||
1886 | 184 | // ---------------------------------------------------------------------------- | ||
1887 | 185 | |||
1888 | 186 | class BarDescriptorDocumentAssetNodeHandler : public BarDescriptorDocumentAbstractNodeHandler | ||
1889 | 187 | { | ||
1890 | 188 | public: | ||
1891 | 189 | BarDescriptorDocumentAssetNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1892 | 190 | |||
1893 | 191 | bool canHandle(const QDomNode &node) const; | ||
1894 | 192 | QDomNode toNode(QDomDocument &doc) const; | ||
1895 | 193 | |||
1896 | 194 | protected: | ||
1897 | 195 | bool fromNode(const QDomNode &node); | ||
1898 | 196 | }; | ||
1899 | 197 | |||
1900 | 198 | // ---------------------------------------------------------------------------- | ||
1901 | 199 | |||
1902 | 200 | class BarDescriptorDocumentInitialWindowNodeHandler : public BarDescriptorDocumentAbstractNodeHandler | ||
1903 | 201 | { | ||
1904 | 202 | public: | ||
1905 | 203 | BarDescriptorDocumentInitialWindowNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1906 | 204 | |||
1907 | 205 | bool canHandle(const QDomNode &node) const; | ||
1908 | 206 | QDomNode toNode(QDomDocument &doc) const; | ||
1909 | 207 | |||
1910 | 208 | protected: | ||
1911 | 209 | bool fromNode(const QDomNode &node); | ||
1912 | 210 | }; | ||
1913 | 211 | |||
1914 | 212 | // ---------------------------------------------------------------------------- | ||
1915 | 213 | |||
1916 | 214 | class BarDescriptorDocumentActionNodeHandler : public BarDescriptorDocumentAbstractNodeHandler | ||
1917 | 215 | { | ||
1918 | 216 | public: | ||
1919 | 217 | BarDescriptorDocumentActionNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1920 | 218 | |||
1921 | 219 | bool canHandle(const QDomNode &node) const; | ||
1922 | 220 | QDomNode toNode(QDomDocument &doc) const; | ||
1923 | 221 | |||
1924 | 222 | protected: | ||
1925 | 223 | bool fromNode(const QDomNode &node); | ||
1926 | 224 | }; | ||
1927 | 225 | |||
1928 | 226 | // ---------------------------------------------------------------------------- | ||
1929 | 227 | |||
1930 | 228 | class BarDescriptorDocumentArgNodeHandler : public BarDescriptorDocumentAbstractNodeHandler | ||
1931 | 229 | { | ||
1932 | 230 | public: | ||
1933 | 231 | BarDescriptorDocumentArgNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1934 | 232 | |||
1935 | 233 | bool canHandle(const QDomNode &node) const; | ||
1936 | 234 | QDomNode toNode(QDomDocument &doc) const; | ||
1937 | 235 | |||
1938 | 236 | protected: | ||
1939 | 237 | bool fromNode(const QDomNode &node); | ||
1940 | 238 | }; | ||
1941 | 239 | |||
1942 | 240 | // ---------------------------------------------------------------------------- | ||
1943 | 241 | |||
1944 | 242 | class BarDescriptorDocumentEnvNodeHandler : public BarDescriptorDocumentAbstractNodeHandler | ||
1945 | 243 | { | ||
1946 | 244 | public: | ||
1947 | 245 | BarDescriptorDocumentEnvNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1948 | 246 | |||
1949 | 247 | bool canHandle(const QDomNode &node) const; | ||
1950 | 248 | QDomNode toNode(QDomDocument &doc) const; | ||
1951 | 249 | |||
1952 | 250 | protected: | ||
1953 | 251 | bool fromNode(const QDomNode &node); | ||
1954 | 252 | }; | ||
1955 | 253 | |||
1956 | 254 | // ---------------------------------------------------------------------------- | ||
1957 | 255 | |||
1958 | 256 | class BarDescriptorDocumentAuthorNodeHandler : public BarDescriptorDocumentAbstractNodeHandler | ||
1959 | 257 | { | ||
1960 | 258 | public: | ||
1961 | 259 | BarDescriptorDocumentAuthorNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1962 | 260 | |||
1963 | 261 | bool canHandle(const QDomNode &node) const; | ||
1964 | 262 | QDomNode toNode(QDomDocument &doc) const; | ||
1965 | 263 | |||
1966 | 264 | protected: | ||
1967 | 265 | bool fromNode(const QDomNode &node); | ||
1968 | 266 | }; | ||
1969 | 267 | |||
1970 | 268 | // ---------------------------------------------------------------------------- | ||
1971 | 269 | |||
1972 | 270 | class BarDescriptorDocumentAuthorIdNodeHandler : public BarDescriptorDocumentAbstractNodeHandler | ||
1973 | 271 | { | ||
1974 | 272 | public: | ||
1975 | 273 | BarDescriptorDocumentAuthorIdNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1976 | 274 | |||
1977 | 275 | bool canHandle(const QDomNode &node) const; | ||
1978 | 276 | QDomNode toNode(QDomDocument &doc) const; | ||
1979 | 277 | |||
1980 | 278 | protected: | ||
1981 | 279 | bool fromNode(const QDomNode &node); | ||
1982 | 280 | }; | ||
1983 | 281 | |||
1984 | 282 | // ---------------------------------------------------------------------------- | ||
1985 | 283 | |||
1986 | 284 | class BarDescriptorDocumentUnknownNodeHandler : public BarDescriptorDocumentAbstractNodeHandler | ||
1987 | 285 | { | ||
1988 | 286 | public: | ||
1989 | 287 | BarDescriptorDocumentUnknownNodeHandler(BarDescriptorEditorWidget *editorWidget); | ||
1990 | 288 | |||
1991 | 289 | bool canHandle(const QDomNode &node) const; | ||
1992 | 290 | QDomNode toNode(QDomDocument &doc) const; | ||
1993 | 291 | |||
1994 | 292 | protected: | ||
1995 | 293 | bool fromNode(const QDomNode &node); | ||
1996 | 294 | |||
1997 | 295 | private: | ||
1998 | 296 | QDomNode m_node; | ||
1999 | 297 | }; | ||
2000 | 298 | |||
2001 | 299 | } // namespace Internal | ||
2002 | 300 | } // namespace Qnx | ||
2003 | 301 | |||
2004 | 302 | #endif // QNX_INTERNAL_BARDESCRIPTORDOCUMENTNODEHANDLERS_H | ||
2005 | 303 | 0 | ||
2006 | === modified file 'src/qnx/bardescriptoreditor.cpp' | |||
2007 | --- src/qnx/bardescriptoreditor.cpp 2014-03-18 10:51:43 +0000 | |||
2008 | +++ src/qnx/bardescriptoreditor.cpp 2014-06-16 09:46:37 +0000 | |||
2009 | @@ -38,11 +38,15 @@ | |||
2010 | 38 | #include <projectexplorer/projectexplorerconstants.h> | 38 | #include <projectexplorer/projectexplorerconstants.h> |
2011 | 39 | #include <projectexplorer/task.h> | 39 | #include <projectexplorer/task.h> |
2012 | 40 | #include <projectexplorer/taskhub.h> | 40 | #include <projectexplorer/taskhub.h> |
2013 | 41 | #include <utils/qtcassert.h> | ||
2014 | 42 | #include <texteditor/texteditorconstants.h> | 41 | #include <texteditor/texteditorconstants.h> |
2015 | 43 | #include <texteditor/basetexteditor.h> | 42 | #include <texteditor/basetexteditor.h> |
2016 | 43 | #include <texteditor/tabsettings.h> | ||
2017 | 44 | #include <utils/linecolumnlabel.h> | ||
2018 | 45 | #include <utils/qtcassert.h> | ||
2019 | 44 | 46 | ||
2020 | 45 | #include <QAction> | 47 | #include <QAction> |
2021 | 48 | #include <QStyle> | ||
2022 | 49 | #include <QTextBlock> | ||
2023 | 46 | #include <QToolBar> | 50 | #include <QToolBar> |
2024 | 47 | 51 | ||
2025 | 48 | using namespace ProjectExplorer; | 52 | using namespace ProjectExplorer; |
2026 | @@ -50,12 +54,14 @@ | |||
2027 | 50 | namespace Qnx { | 54 | namespace Qnx { |
2028 | 51 | namespace Internal { | 55 | namespace Internal { |
2029 | 52 | 56 | ||
2031 | 53 | BarDescriptorEditor::BarDescriptorEditor(BarDescriptorEditorWidget *editorWidget) | 57 | BarDescriptorEditor::BarDescriptorEditor() |
2032 | 54 | { | 58 | { |
2033 | 59 | setId(Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID); | ||
2034 | 60 | m_file = new BarDescriptorDocument(this); | ||
2035 | 61 | |||
2036 | 62 | BarDescriptorEditorWidget *editorWidget = new BarDescriptorEditorWidget(this); | ||
2037 | 55 | setWidget(editorWidget); | 63 | setWidget(editorWidget); |
2038 | 56 | 64 | ||
2039 | 57 | m_file = new BarDescriptorDocument(editorWidget); | ||
2040 | 58 | |||
2041 | 59 | m_toolBar = new QToolBar(editorWidget); | 65 | m_toolBar = new QToolBar(editorWidget); |
2042 | 60 | 66 | ||
2043 | 61 | m_actionGroup = new QActionGroup(this); | 67 | m_actionGroup = new QActionGroup(this); |
2044 | @@ -83,6 +89,17 @@ | |||
2045 | 83 | 89 | ||
2046 | 84 | generalAction->setChecked(true); | 90 | generalAction->setChecked(true); |
2047 | 85 | 91 | ||
2048 | 92 | m_cursorPositionLabel = new Utils::LineColumnLabel; | ||
2049 | 93 | const int spacing = editorWidget->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2; | ||
2050 | 94 | m_cursorPositionLabel->setContentsMargins(spacing, 0, spacing, 0); | ||
2051 | 95 | |||
2052 | 96 | QWidget *spacer = new QWidget; | ||
2053 | 97 | spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); | ||
2054 | 98 | m_toolBar->addWidget(spacer); | ||
2055 | 99 | |||
2056 | 100 | m_cursorPositionAction = m_toolBar->addWidget(m_cursorPositionLabel); | ||
2057 | 101 | connect(editorWidget->sourceWidget(), SIGNAL(cursorPositionChanged()), this, SLOT(updateCursorPosition())); | ||
2058 | 102 | |||
2059 | 86 | setContext(Core::Context(Constants::QNX_BAR_DESCRIPTOR_EDITOR_CONTEXT, | 103 | setContext(Core::Context(Constants::QNX_BAR_DESCRIPTOR_EDITOR_CONTEXT, |
2060 | 87 | TextEditor::Constants::C_TEXTEDITOR)); | 104 | TextEditor::Constants::C_TEXTEDITOR)); |
2061 | 88 | } | 105 | } |
2062 | @@ -90,7 +107,15 @@ | |||
2063 | 90 | bool BarDescriptorEditor::open(QString *errorString, const QString &fileName, const QString &realFileName) | 107 | bool BarDescriptorEditor::open(QString *errorString, const QString &fileName, const QString &realFileName) |
2064 | 91 | { | 108 | { |
2065 | 92 | QTC_ASSERT(fileName == realFileName, return false); | 109 | QTC_ASSERT(fileName == realFileName, return false); |
2067 | 93 | return m_file->open(errorString, fileName); | 110 | |
2068 | 111 | bool result = m_file->open(errorString, fileName); | ||
2069 | 112 | if (result) { | ||
2070 | 113 | BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget()); | ||
2071 | 114 | QTC_ASSERT(editorWidget, return false); | ||
2072 | 115 | editorWidget->setFilePath(fileName); | ||
2073 | 116 | } | ||
2074 | 117 | |||
2075 | 118 | return result; | ||
2076 | 94 | } | 119 | } |
2077 | 95 | 120 | ||
2078 | 96 | Core::IDocument *BarDescriptorEditor::document() | 121 | Core::IDocument *BarDescriptorEditor::document() |
2079 | @@ -98,11 +123,6 @@ | |||
2080 | 98 | return m_file; | 123 | return m_file; |
2081 | 99 | } | 124 | } |
2082 | 100 | 125 | ||
2083 | 101 | Core::Id BarDescriptorEditor::id() const | ||
2084 | 102 | { | ||
2085 | 103 | return Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID; | ||
2086 | 104 | } | ||
2087 | 105 | |||
2088 | 106 | QWidget *BarDescriptorEditor::toolBar() | 126 | QWidget *BarDescriptorEditor::toolBar() |
2089 | 107 | { | 127 | { |
2090 | 108 | return m_toolBar; | 128 | return m_toolBar; |
2091 | @@ -126,32 +146,26 @@ | |||
2092 | 126 | BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget()); | 146 | BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget()); |
2093 | 127 | QTC_ASSERT(editorWidget, return); | 147 | QTC_ASSERT(editorWidget, return); |
2094 | 128 | 148 | ||
2119 | 129 | int prevPage = editorWidget->currentIndex(); | 149 | m_cursorPositionAction->setVisible(page == Source); |
2096 | 130 | |||
2097 | 131 | if (prevPage == page) | ||
2098 | 132 | return; | ||
2099 | 133 | |||
2100 | 134 | if (page == Source) { | ||
2101 | 135 | editorWidget->setXmlSource(m_file->xmlSource()); | ||
2102 | 136 | } else if (prevPage == Source) { | ||
2103 | 137 | TaskHub::clearTasks(Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR); | ||
2104 | 138 | QString errorMsg; | ||
2105 | 139 | int errorLine; | ||
2106 | 140 | if (!m_file->loadContent(editorWidget->xmlSource(), &errorMsg, &errorLine)) { | ||
2107 | 141 | TaskHub::addTask(Task::Error, errorMsg, Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR, | ||
2108 | 142 | Utils::FileName::fromString(m_file->filePath()), errorLine); | ||
2109 | 143 | TaskHub::requestPopup(); | ||
2110 | 144 | |||
2111 | 145 | foreach (QAction *action, m_actionGroup->actions()) | ||
2112 | 146 | if (action->data().toInt() == Source) | ||
2113 | 147 | action->setChecked(true); | ||
2114 | 148 | |||
2115 | 149 | return; | ||
2116 | 150 | } | ||
2117 | 151 | } | ||
2118 | 152 | |||
2120 | 153 | editorWidget->setCurrentIndex(page); | 150 | editorWidget->setCurrentIndex(page); |
2121 | 154 | } | 151 | } |
2122 | 155 | 152 | ||
2123 | 153 | void BarDescriptorEditor::updateCursorPosition() | ||
2124 | 154 | { | ||
2125 | 155 | BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget()); | ||
2126 | 156 | QTC_ASSERT(editorWidget, return); | ||
2127 | 157 | |||
2128 | 158 | const QTextCursor cursor = editorWidget->sourceWidget()->textCursor(); | ||
2129 | 159 | const QTextBlock block = cursor.block(); | ||
2130 | 160 | const int line = block.blockNumber() + 1; | ||
2131 | 161 | const int column = cursor.position() - block.position(); | ||
2132 | 162 | m_cursorPositionLabel->setText(tr("Line: %1, Col: %2").arg(line) | ||
2133 | 163 | .arg(editorWidget->sourceWidget()->baseTextDocument() | ||
2134 | 164 | ->tabSettings().columnAt(block.text(), column)+1), | ||
2135 | 165 | tr("Line: 9999, Col: 999")); | ||
2136 | 166 | if (!block.isVisible()) | ||
2137 | 167 | editorWidget->sourceWidget()->ensureCursorVisible(); | ||
2138 | 168 | } | ||
2139 | 169 | |||
2140 | 156 | } // namespace Internal | 170 | } // namespace Internal |
2141 | 157 | } // namespace Qnx | 171 | } // namespace Qnx |
2142 | 158 | 172 | ||
2143 | === modified file 'src/qnx/bardescriptoreditor.h' | |||
2144 | --- src/qnx/bardescriptoreditor.h 2014-03-18 10:51:43 +0000 | |||
2145 | +++ src/qnx/bardescriptoreditor.h 2014-06-16 09:46:37 +0000 | |||
2146 | @@ -39,6 +39,8 @@ | |||
2147 | 39 | class QToolBar; | 39 | class QToolBar; |
2148 | 40 | QT_END_NAMESPACE | 40 | QT_END_NAMESPACE |
2149 | 41 | 41 | ||
2150 | 42 | namespace Utils { class LineColumnLabel; } | ||
2151 | 43 | |||
2152 | 42 | namespace Qnx { | 44 | namespace Qnx { |
2153 | 43 | namespace Internal { | 45 | namespace Internal { |
2154 | 44 | 46 | ||
2155 | @@ -56,17 +58,17 @@ | |||
2156 | 56 | Source | 58 | Source |
2157 | 57 | }; | 59 | }; |
2158 | 58 | 60 | ||
2160 | 59 | explicit BarDescriptorEditor(BarDescriptorEditorWidget *editorWidget); | 61 | BarDescriptorEditor(); |
2161 | 60 | 62 | ||
2162 | 61 | bool open(QString *errorString, const QString &fileName, const QString &realFileName); | 63 | bool open(QString *errorString, const QString &fileName, const QString &realFileName); |
2163 | 62 | Core::IDocument *document(); | 64 | Core::IDocument *document(); |
2164 | 63 | Core::Id id() const; | ||
2165 | 64 | QWidget *toolBar(); | 65 | QWidget *toolBar(); |
2166 | 65 | 66 | ||
2167 | 66 | EditorPage activePage() const; | 67 | EditorPage activePage() const; |
2168 | 67 | 68 | ||
2169 | 68 | private slots: | 69 | private slots: |
2170 | 69 | void changeEditorPage(QAction *action); | 70 | void changeEditorPage(QAction *action); |
2171 | 71 | void updateCursorPosition(); | ||
2172 | 70 | 72 | ||
2173 | 71 | private: | 73 | private: |
2174 | 72 | void setActivePage(EditorPage page); | 74 | void setActivePage(EditorPage page); |
2175 | @@ -75,6 +77,8 @@ | |||
2176 | 75 | 77 | ||
2177 | 76 | QToolBar *m_toolBar; | 78 | QToolBar *m_toolBar; |
2178 | 77 | QActionGroup *m_actionGroup; | 79 | QActionGroup *m_actionGroup; |
2179 | 80 | Utils::LineColumnLabel *m_cursorPositionLabel; | ||
2180 | 81 | QAction *m_cursorPositionAction; | ||
2181 | 78 | }; | 82 | }; |
2182 | 79 | 83 | ||
2183 | 80 | } // namespace Internal | 84 | } // namespace Internal |
2184 | 81 | 85 | ||
2185 | === modified file 'src/qnx/bardescriptoreditorabstractpanelwidget.cpp' | |||
2186 | --- src/qnx/bardescriptoreditorabstractpanelwidget.cpp 2014-03-18 10:51:43 +0000 | |||
2187 | +++ src/qnx/bardescriptoreditorabstractpanelwidget.cpp 2014-06-16 09:46:37 +0000 | |||
2188 | @@ -32,10 +32,12 @@ | |||
2189 | 32 | #include "bardescriptoreditorabstractpanelwidget.h" | 32 | #include "bardescriptoreditorabstractpanelwidget.h" |
2190 | 33 | 33 | ||
2191 | 34 | #include <utils/pathchooser.h> | 34 | #include <utils/pathchooser.h> |
2192 | 35 | #include <utils/qtcassert.h> | ||
2193 | 35 | 36 | ||
2194 | 36 | #include <QCheckBox> | 37 | #include <QCheckBox> |
2195 | 37 | #include <QComboBox> | 38 | #include <QComboBox> |
2196 | 38 | #include <QLineEdit> | 39 | #include <QLineEdit> |
2197 | 40 | #include <QSignalMapper> | ||
2198 | 39 | #include <QTextEdit> | 41 | #include <QTextEdit> |
2199 | 40 | 42 | ||
2200 | 41 | using namespace Qnx; | 43 | using namespace Qnx; |
2201 | @@ -44,40 +46,86 @@ | |||
2202 | 44 | BarDescriptorEditorAbstractPanelWidget::BarDescriptorEditorAbstractPanelWidget(QWidget *parent) : | 46 | BarDescriptorEditorAbstractPanelWidget::BarDescriptorEditorAbstractPanelWidget(QWidget *parent) : |
2203 | 45 | QWidget(parent) | 47 | QWidget(parent) |
2204 | 46 | { | 48 | { |
2241 | 47 | } | 49 | m_signalMapper = new QSignalMapper(this); |
2242 | 48 | 50 | connect(m_signalMapper, SIGNAL(mapped(int)), this, SLOT(handleSignalMapped(int))); | |
2243 | 49 | 51 | } | |
2244 | 50 | void BarDescriptorEditorAbstractPanelWidget::setComboBoxBlocked(QComboBox *comboBox, int index) | 52 | |
2245 | 51 | { | 53 | void BarDescriptorEditorAbstractPanelWidget::setValue(BarDescriptorDocument::Tag tag, const QVariant &value) |
2246 | 52 | bool blocked = comboBox->blockSignals(true); | 54 | { |
2247 | 53 | comboBox->setCurrentIndex(index); | 55 | if (m_blockedSignals.contains(tag)) |
2248 | 54 | comboBox->blockSignals(blocked); | 56 | return; |
2249 | 55 | } | 57 | |
2250 | 56 | 58 | blockSignalMapping(tag); | |
2251 | 57 | void BarDescriptorEditorAbstractPanelWidget::setCheckBoxBlocked(QCheckBox *checkBox, bool checked) | 59 | updateWidgetValue(tag, value); |
2252 | 58 | { | 60 | unblockSignalMapping(tag); |
2253 | 59 | bool blocked = checkBox->blockSignals(true); | 61 | } |
2254 | 60 | checkBox->setChecked(checked); | 62 | |
2255 | 61 | checkBox->blockSignals(blocked); | 63 | void BarDescriptorEditorAbstractPanelWidget::addSignalMapping(BarDescriptorDocument::Tag tag, QObject *object, const char *signal) |
2256 | 62 | } | 64 | { |
2257 | 63 | 65 | m_signalMapper->setMapping(object, tag); | |
2258 | 64 | void BarDescriptorEditorAbstractPanelWidget::setLineEditBlocked(QLineEdit *lineEdit, const QString &text) | 66 | connect(object, signal, m_signalMapper, SLOT(map())); |
2259 | 65 | { | 67 | } |
2260 | 66 | bool blocked = lineEdit->blockSignals(true); | 68 | |
2261 | 67 | lineEdit->setText(text); | 69 | void BarDescriptorEditorAbstractPanelWidget::blockSignalMapping(BarDescriptorDocument::Tag tag) |
2262 | 68 | lineEdit->blockSignals(blocked); | 70 | { |
2263 | 69 | } | 71 | m_blockedSignals.prepend(tag); |
2264 | 70 | 72 | } | |
2265 | 71 | void BarDescriptorEditorAbstractPanelWidget::setTextEditBlocked(QTextEdit *textEdit, const QString &text) | 73 | |
2266 | 72 | { | 74 | void BarDescriptorEditorAbstractPanelWidget::unblockSignalMapping(BarDescriptorDocument::Tag tag) |
2267 | 73 | bool blocked = textEdit->blockSignals(true); | 75 | { |
2268 | 74 | textEdit->setPlainText(text); | 76 | BarDescriptorDocument::Tag removedTag = m_blockedSignals.takeFirst(); |
2269 | 75 | textEdit->blockSignals(blocked); | 77 | QTC_CHECK(removedTag == tag); |
2270 | 76 | } | 78 | } |
2271 | 77 | 79 | ||
2272 | 78 | void BarDescriptorEditorAbstractPanelWidget::setPathChooserBlocked(Utils::PathChooser *pathChooser, const QString &path) | 80 | void BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value) |
2273 | 79 | { | 81 | { |
2274 | 80 | bool blocked = pathChooser->blockSignals(true); | 82 | QObject *object = m_signalMapper->mapping(static_cast<int>(tag)); |
2275 | 81 | pathChooser->setPath(path); | 83 | if (!object) |
2276 | 82 | pathChooser->blockSignals(blocked); | 84 | return; |
2277 | 85 | |||
2278 | 86 | if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(object)) | ||
2279 | 87 | lineEdit->setText(value.toString()); | ||
2280 | 88 | else if (QTextEdit *textEdit = qobject_cast<QTextEdit *>(object)) | ||
2281 | 89 | textEdit->setPlainText(value.toString()); | ||
2282 | 90 | else if (Utils::PathChooser *pathChooser = qobject_cast<Utils::PathChooser *>(object)) | ||
2283 | 91 | pathChooser->setPath(value.toString()); | ||
2284 | 92 | else if (QComboBox *comboBox = qobject_cast<QComboBox *>(object)) | ||
2285 | 93 | comboBox->setCurrentIndex(comboBox->findData(value.toString())); | ||
2286 | 94 | else if (QCheckBox *checkBox = qobject_cast<QCheckBox *>(object)) | ||
2287 | 95 | checkBox->setChecked(value.toBool()); | ||
2288 | 96 | else | ||
2289 | 97 | QTC_CHECK(false); | ||
2290 | 98 | } | ||
2291 | 99 | |||
2292 | 100 | void BarDescriptorEditorAbstractPanelWidget::emitChanged(BarDescriptorDocument::Tag tag) | ||
2293 | 101 | { | ||
2294 | 102 | QObject *sender = m_signalMapper->mapping(tag); | ||
2295 | 103 | |||
2296 | 104 | if (!sender) | ||
2297 | 105 | return; | ||
2298 | 106 | |||
2299 | 107 | if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(sender)) | ||
2300 | 108 | emit changed(tag, lineEdit->text()); | ||
2301 | 109 | else if (QTextEdit *textEdit = qobject_cast<QTextEdit *>(sender)) | ||
2302 | 110 | emit changed(tag, textEdit->toPlainText()); | ||
2303 | 111 | else if (Utils::PathChooser *pathChooser = qobject_cast<Utils::PathChooser *>(sender)) | ||
2304 | 112 | emit changed(tag, pathChooser->path()); | ||
2305 | 113 | else if (QComboBox *comboBox = qobject_cast<QComboBox *>(sender)) | ||
2306 | 114 | emit changed(tag, comboBox->itemData(comboBox->currentIndex())); | ||
2307 | 115 | else if (QCheckBox *checkBox = qobject_cast<QCheckBox *>(sender)) | ||
2308 | 116 | emit changed(tag, checkBox->isChecked()); | ||
2309 | 117 | else | ||
2310 | 118 | QTC_CHECK(false); | ||
2311 | 119 | } | ||
2312 | 120 | |||
2313 | 121 | void BarDescriptorEditorAbstractPanelWidget::handleSignalMapped(int id) | ||
2314 | 122 | { | ||
2315 | 123 | BarDescriptorDocument::Tag tag = static_cast<BarDescriptorDocument::Tag>(id); | ||
2316 | 124 | |||
2317 | 125 | if (m_blockedSignals.contains(tag)) | ||
2318 | 126 | return; | ||
2319 | 127 | |||
2320 | 128 | blockSignalMapping(tag); | ||
2321 | 129 | emitChanged(tag); | ||
2322 | 130 | unblockSignalMapping(tag); | ||
2323 | 83 | } | 131 | } |
2324 | 84 | 132 | ||
2325 | === modified file 'src/qnx/bardescriptoreditorabstractpanelwidget.h' | |||
2326 | --- src/qnx/bardescriptoreditorabstractpanelwidget.h 2014-03-18 10:51:43 +0000 | |||
2327 | +++ src/qnx/bardescriptoreditorabstractpanelwidget.h 2014-06-16 09:46:37 +0000 | |||
2328 | @@ -34,14 +34,16 @@ | |||
2329 | 34 | 34 | ||
2330 | 35 | #include <QWidget> | 35 | #include <QWidget> |
2331 | 36 | 36 | ||
2335 | 37 | namespace Utils { | 37 | #include "bardescriptordocument.h" |
2336 | 38 | class PathChooser; | 38 | |
2337 | 39 | } | 39 | namespace Utils { class PathChooser; } |
2338 | 40 | 40 | ||
2339 | 41 | QT_BEGIN_NAMESPACE | 41 | QT_BEGIN_NAMESPACE |
2340 | 42 | class QCheckBox; | 42 | class QCheckBox; |
2341 | 43 | class QComboBox; | 43 | class QComboBox; |
2342 | 44 | class QLineEdit; | 44 | class QLineEdit; |
2343 | 45 | class QSignalMapper; | ||
2344 | 46 | class QStringListModel; | ||
2345 | 45 | class QTextEdit; | 47 | class QTextEdit; |
2346 | 46 | QT_END_NAMESPACE | 48 | QT_END_NAMESPACE |
2347 | 47 | 49 | ||
2348 | @@ -54,17 +56,26 @@ | |||
2349 | 54 | public: | 56 | public: |
2350 | 55 | explicit BarDescriptorEditorAbstractPanelWidget(QWidget *parent = 0); | 57 | explicit BarDescriptorEditorAbstractPanelWidget(QWidget *parent = 0); |
2351 | 56 | 58 | ||
2353 | 57 | virtual void clear() = 0; | 59 | public slots: |
2354 | 60 | void setValue(BarDescriptorDocument::Tag tag, const QVariant &value); | ||
2355 | 58 | 61 | ||
2356 | 59 | signals: | 62 | signals: |
2358 | 60 | void changed(); | 63 | void changed(BarDescriptorDocument::Tag tag, const QVariant &value); |
2359 | 61 | 64 | ||
2360 | 62 | protected: | 65 | protected: |
2366 | 63 | void setComboBoxBlocked(QComboBox *comboBox, int index); | 66 | virtual void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value); |
2367 | 64 | void setCheckBoxBlocked(QCheckBox *checkBox, bool checked); | 67 | virtual void emitChanged(BarDescriptorDocument::Tag tag); |
2368 | 65 | void setLineEditBlocked(QLineEdit *lineEdit, const QString &text); | 68 | |
2369 | 66 | void setTextEditBlocked(QTextEdit *textEdit, const QString &text); | 69 | void addSignalMapping(BarDescriptorDocument::Tag tag, QObject *object, const char *signal); |
2370 | 67 | void setPathChooserBlocked(Utils::PathChooser *pathChooser, const QString &path); | 70 | void blockSignalMapping(BarDescriptorDocument::Tag tag); |
2371 | 71 | void unblockSignalMapping(BarDescriptorDocument::Tag tag); | ||
2372 | 72 | |||
2373 | 73 | private slots: | ||
2374 | 74 | void handleSignalMapped(int id); | ||
2375 | 75 | |||
2376 | 76 | private: | ||
2377 | 77 | QSignalMapper *m_signalMapper; | ||
2378 | 78 | QList<BarDescriptorDocument::Tag> m_blockedSignals; | ||
2379 | 68 | }; | 79 | }; |
2380 | 69 | 80 | ||
2381 | 70 | } // namespace Internal | 81 | } // namespace Internal |
2382 | 71 | 82 | ||
2383 | === modified file 'src/qnx/bardescriptoreditorassetswidget.cpp' | |||
2384 | --- src/qnx/bardescriptoreditorassetswidget.cpp 2014-03-18 10:51:43 +0000 | |||
2385 | +++ src/qnx/bardescriptoreditorassetswidget.cpp 2014-06-16 09:46:37 +0000 | |||
2386 | @@ -57,7 +57,10 @@ | |||
2387 | 57 | connect(m_ui->addAsset, SIGNAL(clicked()), this, SLOT(addNewAsset())); | 57 | connect(m_ui->addAsset, SIGNAL(clicked()), this, SLOT(addNewAsset())); |
2388 | 58 | connect(m_ui->removeAsset, SIGNAL(clicked()), this, SLOT(removeSelectedAsset())); | 58 | connect(m_ui->removeAsset, SIGNAL(clicked()), this, SLOT(removeSelectedAsset())); |
2389 | 59 | connect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*))); | 59 | connect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*))); |
2391 | 60 | connectAssetsModel(); | 60 | |
2392 | 61 | addSignalMapping(BarDescriptorDocument::asset, m_assetsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex))); | ||
2393 | 62 | addSignalMapping(BarDescriptorDocument::asset, m_assetsModel, SIGNAL(rowsInserted(QModelIndex,int,int))); | ||
2394 | 63 | addSignalMapping(BarDescriptorDocument::asset, m_assetsModel, SIGNAL(rowsRemoved(QModelIndex,int,int))); | ||
2395 | 61 | } | 64 | } |
2396 | 62 | 65 | ||
2397 | 63 | BarDescriptorEditorAssetsWidget::~BarDescriptorEditorAssetsWidget() | 66 | BarDescriptorEditorAssetsWidget::~BarDescriptorEditorAssetsWidget() |
2398 | @@ -67,32 +70,9 @@ | |||
2399 | 67 | 70 | ||
2400 | 68 | void BarDescriptorEditorAssetsWidget::clear() | 71 | void BarDescriptorEditorAssetsWidget::clear() |
2401 | 69 | { | 72 | { |
2404 | 70 | // We can't just block signals, as the view depends on them | 73 | blockSignalMapping(BarDescriptorDocument::asset); |
2403 | 71 | disconnectAssetsModel(); | ||
2405 | 72 | m_assetsModel->removeRows(0, m_assetsModel->rowCount()); | 74 | m_assetsModel->removeRows(0, m_assetsModel->rowCount()); |
2429 | 73 | connectAssetsModel(); | 75 | unblockSignalMapping(BarDescriptorDocument::asset); |
2407 | 74 | } | ||
2408 | 75 | |||
2409 | 76 | void BarDescriptorEditorAssetsWidget::addAsset(const BarDescriptorAsset &asset) | ||
2410 | 77 | { | ||
2411 | 78 | disconnectAssetsModel(); | ||
2412 | 79 | addAssetInternal(asset); | ||
2413 | 80 | connectAssetsModel(); | ||
2414 | 81 | } | ||
2415 | 82 | |||
2416 | 83 | QList<BarDescriptorAsset> BarDescriptorEditorAssetsWidget::assets() const | ||
2417 | 84 | { | ||
2418 | 85 | QList<BarDescriptorAsset> result; | ||
2419 | 86 | |||
2420 | 87 | for (int i = 0; i < m_assetsModel->rowCount(); ++i) { | ||
2421 | 88 | BarDescriptorAsset asset; | ||
2422 | 89 | asset.source = m_assetsModel->item(i, 0)->text(); | ||
2423 | 90 | asset.destination = m_assetsModel->item(i, 1)->text(); | ||
2424 | 91 | asset.entry = m_assetsModel->item(i, 2)->checkState() == Qt::Checked; | ||
2425 | 92 | result << asset; | ||
2426 | 93 | } | ||
2427 | 94 | |||
2428 | 95 | return result; | ||
2430 | 96 | } | 76 | } |
2431 | 97 | 77 | ||
2432 | 98 | QStandardItemModel *BarDescriptorEditorAssetsWidget::assetsModel() const | 78 | QStandardItemModel *BarDescriptorEditorAssetsWidget::assetsModel() const |
2433 | @@ -100,6 +80,19 @@ | |||
2434 | 100 | return m_assetsModel; | 80 | return m_assetsModel; |
2435 | 101 | } | 81 | } |
2436 | 102 | 82 | ||
2437 | 83 | void BarDescriptorEditorAssetsWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value) | ||
2438 | 84 | { | ||
2439 | 85 | if (tag != BarDescriptorDocument::asset) { | ||
2440 | 86 | BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value); | ||
2441 | 87 | return; | ||
2442 | 88 | } | ||
2443 | 89 | |||
2444 | 90 | clear(); | ||
2445 | 91 | BarDescriptorAssetList assets = value.value<BarDescriptorAssetList>(); | ||
2446 | 92 | foreach (const BarDescriptorAsset asset, assets) | ||
2447 | 93 | addAsset(asset); | ||
2448 | 94 | } | ||
2449 | 95 | |||
2450 | 103 | void BarDescriptorEditorAssetsWidget::addAsset(const QString &fullPath) | 96 | void BarDescriptorEditorAssetsWidget::addAsset(const QString &fullPath) |
2451 | 104 | { | 97 | { |
2452 | 105 | if (fullPath.isEmpty()) | 98 | if (fullPath.isEmpty()) |
2453 | @@ -109,7 +102,7 @@ | |||
2454 | 109 | asset.source = fullPath; | 102 | asset.source = fullPath; |
2455 | 110 | asset.destination = QFileInfo(fullPath).fileName(); | 103 | asset.destination = QFileInfo(fullPath).fileName(); |
2456 | 111 | asset.entry = false; | 104 | asset.entry = false; |
2458 | 112 | addAssetInternal(asset); | 105 | addAsset(asset); |
2459 | 113 | } | 106 | } |
2460 | 114 | 107 | ||
2461 | 115 | void BarDescriptorEditorAssetsWidget::removeAsset(const QString &fullPath) | 108 | void BarDescriptorEditorAssetsWidget::removeAsset(const QString &fullPath) |
2462 | @@ -157,21 +150,28 @@ | |||
2463 | 157 | connect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*))); | 150 | connect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*))); |
2464 | 158 | } | 151 | } |
2465 | 159 | 152 | ||
2481 | 160 | void BarDescriptorEditorAssetsWidget::connectAssetsModel() | 153 | void BarDescriptorEditorAssetsWidget::emitChanged(BarDescriptorDocument::Tag tag) |
2482 | 161 | { | 154 | { |
2483 | 162 | connect(m_assetsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); | 155 | if (tag != BarDescriptorDocument::asset) { |
2484 | 163 | connect(m_assetsModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(changed())); | 156 | BarDescriptorEditorAbstractPanelWidget::emitChanged(tag); |
2485 | 164 | connect(m_assetsModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(changed())); | 157 | return; |
2486 | 165 | } | 158 | } |
2487 | 166 | 159 | ||
2488 | 167 | void BarDescriptorEditorAssetsWidget::disconnectAssetsModel() | 160 | BarDescriptorAssetList result; |
2489 | 168 | { | 161 | for (int i = 0; i < m_assetsModel->rowCount(); ++i) { |
2490 | 169 | disconnect(m_assetsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); | 162 | BarDescriptorAsset asset; |
2491 | 170 | disconnect(m_assetsModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(changed())); | 163 | asset.source = m_assetsModel->item(i, 0)->text(); |
2492 | 171 | disconnect(m_assetsModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(changed())); | 164 | asset.destination = m_assetsModel->item(i, 1)->text(); |
2493 | 172 | } | 165 | asset.entry = m_assetsModel->item(i, 2)->checkState() == Qt::Checked; |
2494 | 173 | 166 | result.append(asset); | |
2495 | 174 | void BarDescriptorEditorAssetsWidget::addAssetInternal(const BarDescriptorAsset &asset) | 167 | } |
2496 | 168 | |||
2497 | 169 | QVariant var; | ||
2498 | 170 | var.setValue(result); | ||
2499 | 171 | emit changed(tag, var); | ||
2500 | 172 | } | ||
2501 | 173 | |||
2502 | 174 | void BarDescriptorEditorAssetsWidget::addAsset(const BarDescriptorAsset &asset) | ||
2503 | 175 | { | 175 | { |
2504 | 176 | const QString path = asset.source; | 176 | const QString path = asset.source; |
2505 | 177 | const QString dest = asset.destination; | 177 | const QString dest = asset.destination; |
2506 | 178 | 178 | ||
2507 | === modified file 'src/qnx/bardescriptoreditorassetswidget.h' | |||
2508 | --- src/qnx/bardescriptoreditorassetswidget.h 2014-03-18 10:51:43 +0000 | |||
2509 | +++ src/qnx/bardescriptoreditorassetswidget.h 2014-06-16 09:46:37 +0000 | |||
2510 | @@ -42,9 +42,7 @@ | |||
2511 | 42 | namespace Qnx { | 42 | namespace Qnx { |
2512 | 43 | namespace Internal { | 43 | namespace Internal { |
2513 | 44 | 44 | ||
2517 | 45 | namespace Ui { | 45 | namespace Ui { class BarDescriptorEditorAssetsWidget; } |
2515 | 46 | class BarDescriptorEditorAssetsWidget; | ||
2516 | 47 | } | ||
2518 | 48 | 46 | ||
2519 | 49 | class BarDescriptorAsset; | 47 | class BarDescriptorAsset; |
2520 | 50 | 48 | ||
2521 | @@ -56,27 +54,24 @@ | |||
2522 | 56 | explicit BarDescriptorEditorAssetsWidget(QWidget *parent = 0); | 54 | explicit BarDescriptorEditorAssetsWidget(QWidget *parent = 0); |
2523 | 57 | ~BarDescriptorEditorAssetsWidget(); | 55 | ~BarDescriptorEditorAssetsWidget(); |
2524 | 58 | 56 | ||
2525 | 59 | void clear(); | ||
2526 | 60 | |||
2527 | 61 | void addAsset(const BarDescriptorAsset &asset); | ||
2528 | 62 | QList<BarDescriptorAsset> assets() const; | ||
2529 | 63 | |||
2530 | 64 | QStandardItemModel *assetsModel() const; | 57 | QStandardItemModel *assetsModel() const; |
2531 | 65 | 58 | ||
2532 | 66 | public slots: | 59 | public slots: |
2533 | 67 | void addAsset(const QString &fullPath); | 60 | void addAsset(const QString &fullPath); |
2534 | 68 | void removeAsset(const QString &fullPath); | 61 | void removeAsset(const QString &fullPath); |
2535 | 69 | 62 | ||
2536 | 63 | protected: | ||
2537 | 64 | void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value); | ||
2538 | 65 | void emitChanged(BarDescriptorDocument::Tag tag); | ||
2539 | 66 | |||
2540 | 70 | private slots: | 67 | private slots: |
2541 | 71 | void addNewAsset(); | 68 | void addNewAsset(); |
2542 | 72 | void removeSelectedAsset(); | 69 | void removeSelectedAsset(); |
2543 | 73 | void updateEntryCheckState(QStandardItem *item); | 70 | void updateEntryCheckState(QStandardItem *item); |
2544 | 74 | 71 | ||
2545 | 75 | private: | 72 | private: |
2550 | 76 | void connectAssetsModel(); | 73 | void clear(); |
2551 | 77 | void disconnectAssetsModel(); | 74 | void addAsset(const BarDescriptorAsset &asset); |
2548 | 78 | |||
2549 | 79 | void addAssetInternal(const BarDescriptorAsset &asset); | ||
2552 | 80 | bool hasAsset(const BarDescriptorAsset &asset); | 75 | bool hasAsset(const BarDescriptorAsset &asset); |
2553 | 81 | 76 | ||
2554 | 82 | Ui::BarDescriptorEditorAssetsWidget *m_ui; | 77 | Ui::BarDescriptorEditorAssetsWidget *m_ui; |
2555 | 83 | 78 | ||
2556 | === modified file 'src/qnx/bardescriptoreditorauthorinformationwidget.cpp' | |||
2557 | --- src/qnx/bardescriptoreditorauthorinformationwidget.cpp 2014-03-18 10:51:43 +0000 | |||
2558 | +++ src/qnx/bardescriptoreditorauthorinformationwidget.cpp 2014-06-16 09:46:37 +0000 | |||
2559 | @@ -34,6 +34,7 @@ | |||
2560 | 34 | 34 | ||
2561 | 35 | #include "blackberrydebugtokenreader.h" | 35 | #include "blackberrydebugtokenreader.h" |
2562 | 36 | #include "blackberrydeviceconfiguration.h" | 36 | #include "blackberrydeviceconfiguration.h" |
2563 | 37 | #include "blackberrysigningutils.h" | ||
2564 | 37 | #include "qnxconstants.h" | 38 | #include "qnxconstants.h" |
2565 | 38 | 39 | ||
2566 | 39 | #include <projectexplorer/devicesupport/devicemanager.h> | 40 | #include <projectexplorer/devicesupport/devicemanager.h> |
2567 | @@ -53,8 +54,8 @@ | |||
2568 | 53 | 54 | ||
2569 | 54 | m_ui->setFromDebugToken->setVisible(BlackBerryDebugTokenReader::isSupported()); | 55 | m_ui->setFromDebugToken->setVisible(BlackBerryDebugTokenReader::isSupported()); |
2570 | 55 | 56 | ||
2573 | 56 | connect(m_ui->author, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); | 57 | addSignalMapping(BarDescriptorDocument::author, m_ui->author, SIGNAL(textChanged(QString))); |
2574 | 57 | connect(m_ui->authorId, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); | 58 | addSignalMapping(BarDescriptorDocument::authorId, m_ui->authorId, SIGNAL(textChanged(QString))); |
2575 | 58 | connect(m_ui->setFromDebugToken, SIGNAL(clicked()), this, SLOT(setAuthorFromDebugToken())); | 59 | connect(m_ui->setFromDebugToken, SIGNAL(clicked()), this, SLOT(setAuthorFromDebugToken())); |
2576 | 59 | } | 60 | } |
2577 | 60 | 61 | ||
2578 | @@ -63,30 +64,13 @@ | |||
2579 | 63 | delete m_ui; | 64 | delete m_ui; |
2580 | 64 | } | 65 | } |
2581 | 65 | 66 | ||
2606 | 66 | void BarDescriptorEditorAuthorInformationWidget::clear() | 67 | void BarDescriptorEditorAuthorInformationWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value) |
2607 | 67 | { | 68 | { |
2608 | 68 | setLineEditBlocked(m_ui->author, QString()); | 69 | if (tag == BarDescriptorDocument::publisher && !value.toString().isEmpty()) |
2609 | 69 | setLineEditBlocked(m_ui->authorId, QString()); | 70 | // <publisher> is deprecated and hence not connected to the author field as we only want to read it from the XML |
2610 | 70 | } | 71 | m_ui->author->setText(value.toString()); |
2611 | 71 | 72 | else | |
2612 | 72 | QString BarDescriptorEditorAuthorInformationWidget::author() const | 73 | BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value); |
2589 | 73 | { | ||
2590 | 74 | return m_ui->author->text(); | ||
2591 | 75 | } | ||
2592 | 76 | |||
2593 | 77 | void BarDescriptorEditorAuthorInformationWidget::setAuthor(const QString &author) | ||
2594 | 78 | { | ||
2595 | 79 | setLineEditBlocked(m_ui->author, author); | ||
2596 | 80 | } | ||
2597 | 81 | |||
2598 | 82 | QString BarDescriptorEditorAuthorInformationWidget::authorId() const | ||
2599 | 83 | { | ||
2600 | 84 | return m_ui->authorId->text(); | ||
2601 | 85 | } | ||
2602 | 86 | |||
2603 | 87 | void BarDescriptorEditorAuthorInformationWidget::setAuthorId(const QString &authorId) | ||
2604 | 88 | { | ||
2605 | 89 | setLineEditBlocked(m_ui->authorId, authorId); | ||
2613 | 90 | } | 74 | } |
2614 | 91 | 75 | ||
2615 | 92 | void BarDescriptorEditorAuthorInformationWidget::setAuthorFromDebugToken() | 76 | void BarDescriptorEditorAuthorInformationWidget::setAuthorFromDebugToken() |
2616 | @@ -104,6 +88,7 @@ | |||
2617 | 104 | debugTokens << bbDevice->debugToken(); | 88 | debugTokens << bbDevice->debugToken(); |
2618 | 105 | } | 89 | } |
2619 | 106 | } | 90 | } |
2620 | 91 | debugTokens << BlackBerrySigningUtils::instance().debugTokens(); | ||
2621 | 107 | debugTokens.removeDuplicates(); | 92 | debugTokens.removeDuplicates(); |
2622 | 108 | 93 | ||
2623 | 109 | bool ok; | 94 | bool ok; |
2624 | 110 | 95 | ||
2625 | === modified file 'src/qnx/bardescriptoreditorauthorinformationwidget.h' | |||
2626 | --- src/qnx/bardescriptoreditorauthorinformationwidget.h 2014-03-18 10:51:43 +0000 | |||
2627 | +++ src/qnx/bardescriptoreditorauthorinformationwidget.h 2014-06-16 09:46:37 +0000 | |||
2628 | @@ -37,9 +37,7 @@ | |||
2629 | 37 | namespace Qnx { | 37 | namespace Qnx { |
2630 | 38 | namespace Internal { | 38 | namespace Internal { |
2631 | 39 | 39 | ||
2635 | 40 | namespace Ui { | 40 | namespace Ui { class BarDescriptorEditorAuthorInformationWidget; } |
2633 | 41 | class BarDescriptorEditorAuthorInformationWidget; | ||
2634 | 42 | } | ||
2636 | 43 | 41 | ||
2637 | 44 | class BarDescriptorEditorAuthorInformationWidget : public BarDescriptorEditorAbstractPanelWidget | 42 | class BarDescriptorEditorAuthorInformationWidget : public BarDescriptorEditorAbstractPanelWidget |
2638 | 45 | { | 43 | { |
2639 | @@ -49,13 +47,8 @@ | |||
2640 | 49 | explicit BarDescriptorEditorAuthorInformationWidget(QWidget *parent = 0); | 47 | explicit BarDescriptorEditorAuthorInformationWidget(QWidget *parent = 0); |
2641 | 50 | ~BarDescriptorEditorAuthorInformationWidget(); | 48 | ~BarDescriptorEditorAuthorInformationWidget(); |
2642 | 51 | 49 | ||
2650 | 52 | void clear(); | 50 | protected: |
2651 | 53 | 51 | void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value); | |
2645 | 54 | QString author() const; | ||
2646 | 55 | void setAuthor(const QString &author); | ||
2647 | 56 | |||
2648 | 57 | QString authorId() const; | ||
2649 | 58 | void setAuthorId(const QString &authorId); | ||
2652 | 59 | 52 | ||
2653 | 60 | private slots: | 53 | private slots: |
2654 | 61 | void setAuthorFromDebugToken(); | 54 | void setAuthorFromDebugToken(); |
2655 | 62 | 55 | ||
2656 | === modified file 'src/qnx/bardescriptoreditorentrypointwidget.cpp' | |||
2657 | --- src/qnx/bardescriptoreditorentrypointwidget.cpp 2014-03-18 10:51:43 +0000 | |||
2658 | +++ src/qnx/bardescriptoreditorentrypointwidget.cpp 2014-06-16 09:46:37 +0000 | |||
2659 | @@ -57,6 +57,7 @@ | |||
2660 | 57 | m_ui->setupUi(this); | 57 | m_ui->setupUi(this); |
2661 | 58 | 58 | ||
2662 | 59 | m_ui->iconFilePath->setExpectedKind(Utils::PathChooser::File); | 59 | m_ui->iconFilePath->setExpectedKind(Utils::PathChooser::File); |
2663 | 60 | m_ui->iconFilePath->setHistoryCompleter(QLatin1String("Qmake.Icon.History")); | ||
2664 | 60 | m_ui->iconFilePath->setPromptDialogFilter(tr("Images (*.jpg *.png)")); | 61 | m_ui->iconFilePath->setPromptDialogFilter(tr("Images (*.jpg *.png)")); |
2665 | 61 | 62 | ||
2666 | 62 | m_ui->iconWarningLabel->setVisible(false); | 63 | m_ui->iconWarningLabel->setVisible(false); |
2667 | @@ -65,9 +66,6 @@ | |||
2668 | 65 | m_ui->splashScreenWarningLabel->setVisible(false); | 66 | m_ui->splashScreenWarningLabel->setVisible(false); |
2669 | 66 | m_ui->splashScreenWarningPixmap->setVisible(false); | 67 | m_ui->splashScreenWarningPixmap->setVisible(false); |
2670 | 67 | 68 | ||
2671 | 68 | connect(m_ui->applicationName, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); | ||
2672 | 69 | connect(m_ui->applicationDescription, SIGNAL(textChanged()), this, SIGNAL(changed())); | ||
2673 | 70 | |||
2674 | 71 | connect(m_ui->iconFilePath, SIGNAL(changed(QString)), this, SLOT(handleIconChanged(QString))); | 69 | connect(m_ui->iconFilePath, SIGNAL(changed(QString)), this, SLOT(handleIconChanged(QString))); |
2675 | 72 | connect(m_ui->iconClearButton, SIGNAL(clicked()), this, SLOT(clearIcon())); | 70 | connect(m_ui->iconClearButton, SIGNAL(clicked()), this, SLOT(clearIcon())); |
2676 | 73 | 71 | ||
2677 | @@ -75,8 +73,14 @@ | |||
2678 | 75 | m_ui->splashScreensView->setModel(m_splashScreenModel); | 73 | m_ui->splashScreensView->setModel(m_splashScreenModel); |
2679 | 76 | connect(m_ui->addSplashScreen, SIGNAL(clicked()), this, SLOT(browseForSplashScreen())); | 74 | connect(m_ui->addSplashScreen, SIGNAL(clicked()), this, SLOT(browseForSplashScreen())); |
2680 | 77 | connect(m_ui->removeSplashScreen, SIGNAL(clicked()), this, SLOT(removeSelectedSplashScreen())); | 75 | connect(m_ui->removeSplashScreen, SIGNAL(clicked()), this, SLOT(removeSelectedSplashScreen())); |
2681 | 78 | connect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); | ||
2682 | 79 | connect(m_ui->splashScreensView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(handleSplashScreenSelectionChanged(QItemSelection,QItemSelection))); | 76 | connect(m_ui->splashScreensView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(handleSplashScreenSelectionChanged(QItemSelection,QItemSelection))); |
2683 | 77 | |||
2684 | 78 | addSignalMapping(BarDescriptorDocument::name, m_ui->applicationName, SIGNAL(textChanged(QString))); | ||
2685 | 79 | addSignalMapping(BarDescriptorDocument::description, m_ui->applicationDescription, SIGNAL(textChanged())); | ||
2686 | 80 | addSignalMapping(BarDescriptorDocument::icon, m_ui->iconFilePath, SIGNAL(changed(QString))); | ||
2687 | 81 | addSignalMapping(BarDescriptorDocument::splashScreens, m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex))); | ||
2688 | 82 | addSignalMapping(BarDescriptorDocument::splashScreens, m_splashScreenModel, SIGNAL(rowsRemoved(QModelIndex,int,int))); | ||
2689 | 83 | addSignalMapping(BarDescriptorDocument::splashScreens, m_splashScreenModel, SIGNAL(rowsInserted(QModelIndex,int,int))); | ||
2690 | 80 | } | 84 | } |
2691 | 81 | 85 | ||
2692 | 82 | BarDescriptorEditorEntryPointWidget::~BarDescriptorEditorEntryPointWidget() | 86 | BarDescriptorEditorEntryPointWidget::~BarDescriptorEditorEntryPointWidget() |
2693 | @@ -84,68 +88,40 @@ | |||
2694 | 84 | delete m_ui; | 88 | delete m_ui; |
2695 | 85 | } | 89 | } |
2696 | 86 | 90 | ||
2697 | 87 | void BarDescriptorEditorEntryPointWidget::clear() | ||
2698 | 88 | { | ||
2699 | 89 | setPathChooserBlocked(m_ui->iconFilePath, QString()); | ||
2700 | 90 | setApplicationIconPreview(QString()); | ||
2701 | 91 | |||
2702 | 92 | disconnect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); | ||
2703 | 93 | m_splashScreenModel->setStringList(QStringList()); | ||
2704 | 94 | connect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); | ||
2705 | 95 | setImagePreview(m_ui->splashScreenPreviewLabel, QString()); | ||
2706 | 96 | } | ||
2707 | 97 | |||
2708 | 98 | QString BarDescriptorEditorEntryPointWidget::applicationName() const | ||
2709 | 99 | { | ||
2710 | 100 | return m_ui->applicationName->text(); | ||
2711 | 101 | } | ||
2712 | 102 | |||
2713 | 103 | void BarDescriptorEditorEntryPointWidget::setApplicationName(const QString &applicationName) | ||
2714 | 104 | { | ||
2715 | 105 | setLineEditBlocked(m_ui->applicationName, applicationName); | ||
2716 | 106 | } | ||
2717 | 107 | |||
2718 | 108 | QString BarDescriptorEditorEntryPointWidget::applicationDescription() const | ||
2719 | 109 | { | ||
2720 | 110 | return m_ui->applicationDescription->toPlainText(); | ||
2721 | 111 | } | ||
2722 | 112 | |||
2723 | 113 | void BarDescriptorEditorEntryPointWidget::setApplicationDescription(const QString &applicationDescription) | ||
2724 | 114 | { | ||
2725 | 115 | setTextEditBlocked(m_ui->applicationDescription, applicationDescription); | ||
2726 | 116 | } | ||
2727 | 117 | |||
2728 | 118 | QString BarDescriptorEditorEntryPointWidget::applicationIconFileName() const | ||
2729 | 119 | { | ||
2730 | 120 | return QFileInfo(m_ui->iconFilePath->path()).fileName(); | ||
2731 | 121 | } | ||
2732 | 122 | |||
2733 | 123 | void BarDescriptorEditorEntryPointWidget::setApplicationIcon(const QString &iconPath) | ||
2734 | 124 | { | ||
2735 | 125 | // During file loading, the assets might not have been read yet | ||
2736 | 126 | QMetaObject::invokeMethod(this, "setApplicationIconDelayed", Qt::QueuedConnection, Q_ARG(QString, iconPath)); | ||
2737 | 127 | } | ||
2738 | 128 | |||
2739 | 129 | QStringList BarDescriptorEditorEntryPointWidget::splashScreens() const | ||
2740 | 130 | { | ||
2741 | 131 | QStringList result; | ||
2742 | 132 | |||
2743 | 133 | foreach (const QString &splashScreen, m_splashScreenModel->stringList()) | ||
2744 | 134 | result << QFileInfo(splashScreen).fileName(); | ||
2745 | 135 | |||
2746 | 136 | return result; | ||
2747 | 137 | } | ||
2748 | 138 | |||
2749 | 139 | void BarDescriptorEditorEntryPointWidget::appendSplashScreen(const QString &splashScreenPath) | ||
2750 | 140 | { | ||
2751 | 141 | QMetaObject::invokeMethod(this, "appendSplashScreenDelayed", Qt::QueuedConnection, Q_ARG(QString, splashScreenPath)); | ||
2752 | 142 | } | ||
2753 | 143 | |||
2754 | 144 | void BarDescriptorEditorEntryPointWidget::setAssetsModel(QStandardItemModel *assetsModel) | 91 | void BarDescriptorEditorEntryPointWidget::setAssetsModel(QStandardItemModel *assetsModel) |
2755 | 145 | { | 92 | { |
2756 | 146 | m_assetsModel = QWeakPointer<QStandardItemModel>(assetsModel); | 93 | m_assetsModel = QWeakPointer<QStandardItemModel>(assetsModel); |
2757 | 147 | } | 94 | } |
2758 | 148 | 95 | ||
2759 | 96 | void BarDescriptorEditorEntryPointWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value) | ||
2760 | 97 | { | ||
2761 | 98 | // During file loading, the assets might not have been read yet | ||
2762 | 99 | if (tag == BarDescriptorDocument::icon) { | ||
2763 | 100 | QMetaObject::invokeMethod(this, "setApplicationIconDelayed", Qt::QueuedConnection, Q_ARG(QString, value.toString())); | ||
2764 | 101 | } else if (tag == BarDescriptorDocument::splashScreens) { | ||
2765 | 102 | QStringList splashScreens = value.toStringList(); | ||
2766 | 103 | foreach (const QString &splashScreen, splashScreens) | ||
2767 | 104 | QMetaObject::invokeMethod(this, "appendSplashScreenDelayed", Qt::QueuedConnection, Q_ARG(QString, splashScreen)); | ||
2768 | 105 | } else { | ||
2769 | 106 | BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value); | ||
2770 | 107 | } | ||
2771 | 108 | } | ||
2772 | 109 | |||
2773 | 110 | void BarDescriptorEditorEntryPointWidget::emitChanged(BarDescriptorDocument::Tag tag) | ||
2774 | 111 | { | ||
2775 | 112 | if (tag == BarDescriptorDocument::icon) { | ||
2776 | 113 | emit changed(tag, QFileInfo(m_ui->iconFilePath->path()).fileName()); | ||
2777 | 114 | } else if (tag == BarDescriptorDocument::splashScreens) { | ||
2778 | 115 | QStringList list; | ||
2779 | 116 | foreach (const QString &splashScreen, m_splashScreenModel->stringList()) | ||
2780 | 117 | list << QFileInfo(splashScreen).fileName(); | ||
2781 | 118 | |||
2782 | 119 | emit changed(tag, list); | ||
2783 | 120 | } else { | ||
2784 | 121 | BarDescriptorEditorAbstractPanelWidget::emitChanged(tag); | ||
2785 | 122 | } | ||
2786 | 123 | } | ||
2787 | 124 | |||
2788 | 149 | void BarDescriptorEditorEntryPointWidget::setApplicationIconPreview(const QString &path) | 125 | void BarDescriptorEditorEntryPointWidget::setApplicationIconPreview(const QString &path) |
2789 | 150 | { | 126 | { |
2790 | 151 | setImagePreview(m_ui->iconPreviewLabel, path); | 127 | setImagePreview(m_ui->iconPreviewLabel, path); |
2791 | @@ -164,8 +140,8 @@ | |||
2792 | 164 | setApplicationIconPreview(path); | 140 | setApplicationIconPreview(path); |
2793 | 165 | validateIconSize(path); | 141 | validateIconSize(path); |
2794 | 166 | 142 | ||
2797 | 167 | emit changed(); | 143 | if (!m_splashScreenModel->stringList().contains(m_prevIconPath)) |
2798 | 168 | emit imageRemoved(m_prevIconPath); | 144 | emit imageRemoved(m_prevIconPath); |
2799 | 169 | 145 | ||
2800 | 170 | m_prevIconPath = path; | 146 | m_prevIconPath = path; |
2801 | 171 | if (QFileInfo(path).exists()) | 147 | if (QFileInfo(path).exists()) |
2802 | @@ -200,7 +176,8 @@ | |||
2803 | 200 | 176 | ||
2804 | 201 | foreach (const QModelIndex &index, selectedIndexes) { | 177 | foreach (const QModelIndex &index, selectedIndexes) { |
2805 | 202 | QString path = m_splashScreenModel->data(index, Qt::DisplayRole).toString(); | 178 | QString path = m_splashScreenModel->data(index, Qt::DisplayRole).toString(); |
2807 | 203 | emit imageRemoved(path); | 179 | if (path != m_ui->iconFilePath->path()) |
2808 | 180 | emit imageRemoved(path); | ||
2809 | 204 | 181 | ||
2810 | 205 | m_splashScreenModel->removeRow(index.row()); | 182 | m_splashScreenModel->removeRow(index.row()); |
2811 | 206 | } | 183 | } |
2812 | @@ -230,11 +207,11 @@ | |||
2813 | 230 | if (fullSplashScreenPath.isEmpty()) | 207 | if (fullSplashScreenPath.isEmpty()) |
2814 | 231 | return; | 208 | return; |
2815 | 232 | 209 | ||
2817 | 233 | disconnect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); | 210 | blockSignalMapping(BarDescriptorDocument::splashScreens); |
2818 | 234 | int rowCount = m_splashScreenModel->rowCount(); | 211 | int rowCount = m_splashScreenModel->rowCount(); |
2819 | 235 | m_splashScreenModel->insertRow(rowCount); | 212 | m_splashScreenModel->insertRow(rowCount); |
2820 | 236 | m_splashScreenModel->setData(m_splashScreenModel->index(rowCount), fullSplashScreenPath); | 213 | m_splashScreenModel->setData(m_splashScreenModel->index(rowCount), fullSplashScreenPath); |
2822 | 237 | connect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); | 214 | unblockSignalMapping(BarDescriptorDocument::splashScreens); |
2823 | 238 | } | 215 | } |
2824 | 239 | 216 | ||
2825 | 240 | void BarDescriptorEditorEntryPointWidget::setImagePreview(QLabel *previewLabel, const QString &path) | 217 | void BarDescriptorEditorEntryPointWidget::setImagePreview(QLabel *previewLabel, const QString &path) |
2826 | @@ -309,9 +286,11 @@ | |||
2827 | 309 | if (fullIconPath.isEmpty()) | 286 | if (fullIconPath.isEmpty()) |
2828 | 310 | return; | 287 | return; |
2829 | 311 | 288 | ||
2831 | 312 | setPathChooserBlocked(m_ui->iconFilePath, fullIconPath); | 289 | blockSignalMapping(BarDescriptorDocument::icon); |
2832 | 290 | m_ui->iconFilePath->setPath(fullIconPath); | ||
2833 | 313 | setApplicationIconPreview(fullIconPath); | 291 | setApplicationIconPreview(fullIconPath); |
2834 | 314 | validateIconSize(fullIconPath); | 292 | validateIconSize(fullIconPath); |
2835 | 293 | unblockSignalMapping(BarDescriptorDocument::icon); | ||
2836 | 315 | } | 294 | } |
2837 | 316 | 295 | ||
2838 | 317 | QString BarDescriptorEditorEntryPointWidget::localAssetPathFromDestination(const QString &destination) | 296 | QString BarDescriptorEditorEntryPointWidget::localAssetPathFromDestination(const QString &destination) |
2839 | 318 | 297 | ||
2840 | === modified file 'src/qnx/bardescriptoreditorentrypointwidget.h' | |||
2841 | --- src/qnx/bardescriptoreditorentrypointwidget.h 2014-03-18 10:51:43 +0000 | |||
2842 | +++ src/qnx/bardescriptoreditorentrypointwidget.h 2014-06-16 09:46:37 +0000 | |||
2843 | @@ -45,9 +45,7 @@ | |||
2844 | 45 | namespace Qnx { | 45 | namespace Qnx { |
2845 | 46 | namespace Internal { | 46 | namespace Internal { |
2846 | 47 | 47 | ||
2850 | 48 | namespace Ui { | 48 | namespace Ui { class BarDescriptorEditorEntryPointWidget; } |
2848 | 49 | class BarDescriptorEditorEntryPointWidget; | ||
2849 | 50 | } | ||
2851 | 51 | 49 | ||
2852 | 52 | class BarDescriptorEditorEntryPointWidget : public BarDescriptorEditorAbstractPanelWidget | 50 | class BarDescriptorEditorEntryPointWidget : public BarDescriptorEditorAbstractPanelWidget |
2853 | 53 | { | 51 | { |
2854 | @@ -57,26 +55,16 @@ | |||
2855 | 57 | explicit BarDescriptorEditorEntryPointWidget(QWidget *parent = 0); | 55 | explicit BarDescriptorEditorEntryPointWidget(QWidget *parent = 0); |
2856 | 58 | ~BarDescriptorEditorEntryPointWidget(); | 56 | ~BarDescriptorEditorEntryPointWidget(); |
2857 | 59 | 57 | ||
2858 | 60 | void clear(); | ||
2859 | 61 | |||
2860 | 62 | QString applicationName() const; | ||
2861 | 63 | void setApplicationName(const QString &applicationName); | ||
2862 | 64 | |||
2863 | 65 | QString applicationDescription() const; | ||
2864 | 66 | void setApplicationDescription(const QString &applicationDescription); | ||
2865 | 67 | |||
2866 | 68 | QString applicationIconFileName() const; | ||
2867 | 69 | void setApplicationIcon(const QString &iconPath); | ||
2868 | 70 | |||
2869 | 71 | QStringList splashScreens() const; | ||
2870 | 72 | void appendSplashScreen(const QString &splashScreenPath); | ||
2871 | 73 | |||
2872 | 74 | void setAssetsModel(QStandardItemModel *assetsModel); | 58 | void setAssetsModel(QStandardItemModel *assetsModel); |
2873 | 75 | 59 | ||
2874 | 76 | signals: | 60 | signals: |
2875 | 77 | void imageAdded(const QString &path); | 61 | void imageAdded(const QString &path); |
2876 | 78 | void imageRemoved(const QString &path); | 62 | void imageRemoved(const QString &path); |
2877 | 79 | 63 | ||
2878 | 64 | protected: | ||
2879 | 65 | void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value); | ||
2880 | 66 | void emitChanged(BarDescriptorDocument::Tag tag); | ||
2881 | 67 | |||
2882 | 80 | private slots: | 68 | private slots: |
2883 | 81 | void setApplicationIconDelayed(const QString &iconPath); | 69 | void setApplicationIconDelayed(const QString &iconPath); |
2884 | 82 | void setApplicationIconPreview(const QString &path); | 70 | void setApplicationIconPreview(const QString &path); |
2885 | 83 | 71 | ||
2886 | === modified file 'src/qnx/bardescriptoreditorenvironmentwidget.cpp' | |||
2887 | --- src/qnx/bardescriptoreditorenvironmentwidget.cpp 2014-03-18 10:51:43 +0000 | |||
2888 | +++ src/qnx/bardescriptoreditorenvironmentwidget.cpp 2014-06-16 09:46:37 +0000 | |||
2889 | @@ -43,7 +43,7 @@ | |||
2890 | 43 | 43 | ||
2891 | 44 | m_ui->environmentWidget->setBaseEnvironmentText(tr("Device Environment")); | 44 | m_ui->environmentWidget->setBaseEnvironmentText(tr("Device Environment")); |
2892 | 45 | 45 | ||
2894 | 46 | connect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SIGNAL(changed())); | 46 | addSignalMapping(BarDescriptorDocument::env, m_ui->environmentWidget, SIGNAL(userChangesChanged())); |
2895 | 47 | } | 47 | } |
2896 | 48 | 48 | ||
2897 | 49 | BarDescriptorEditorEnvironmentWidget::~BarDescriptorEditorEnvironmentWidget() | 49 | BarDescriptorEditorEnvironmentWidget::~BarDescriptorEditorEnvironmentWidget() |
2898 | @@ -51,23 +51,24 @@ | |||
2899 | 51 | delete m_ui; | 51 | delete m_ui; |
2900 | 52 | } | 52 | } |
2901 | 53 | 53 | ||
2921 | 54 | void BarDescriptorEditorEnvironmentWidget::clear() | 54 | void BarDescriptorEditorEnvironmentWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value) |
2922 | 55 | { | 55 | { |
2923 | 56 | disconnect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SIGNAL(changed())); | 56 | if (tag != BarDescriptorDocument::env) { |
2924 | 57 | m_ui->environmentWidget->setUserChanges(QList<Utils::EnvironmentItem>()); | 57 | BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value); |
2925 | 58 | connect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SIGNAL(changed())); | 58 | return; |
2926 | 59 | } | 59 | } |
2927 | 60 | 60 | ||
2928 | 61 | QList<Utils::EnvironmentItem> BarDescriptorEditorEnvironmentWidget::environment() const | 61 | m_ui->environmentWidget->setUserChanges(value.value<QList<Utils::EnvironmentItem> >()); |
2929 | 62 | { | 62 | } |
2930 | 63 | return m_ui->environmentWidget->userChanges(); | 63 | |
2931 | 64 | } | 64 | void BarDescriptorEditorEnvironmentWidget::emitChanged(BarDescriptorDocument::Tag tag) |
2932 | 65 | 65 | { | |
2933 | 66 | void BarDescriptorEditorEnvironmentWidget::appendEnvironmentItem(const Utils::EnvironmentItem &envItem) | 66 | if (tag != BarDescriptorDocument::env) { |
2934 | 67 | { | 67 | BarDescriptorEditorAbstractPanelWidget::emitChanged(tag); |
2935 | 68 | disconnect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SIGNAL(changed())); | 68 | return; |
2936 | 69 | QList<Utils::EnvironmentItem> items = m_ui->environmentWidget->userChanges(); | 69 | } |
2937 | 70 | items.append(envItem); | 70 | |
2938 | 71 | m_ui->environmentWidget->setUserChanges(items); | 71 | QVariant var; |
2939 | 72 | connect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SIGNAL(changed())); | 72 | var.setValue(m_ui->environmentWidget->userChanges()); |
2940 | 73 | emit changed(tag, var); | ||
2941 | 73 | } | 74 | } |
2942 | 74 | 75 | ||
2943 | === modified file 'src/qnx/bardescriptoreditorenvironmentwidget.h' | |||
2944 | --- src/qnx/bardescriptoreditorenvironmentwidget.h 2014-03-18 10:51:43 +0000 | |||
2945 | +++ src/qnx/bardescriptoreditorenvironmentwidget.h 2014-06-16 09:46:37 +0000 | |||
2946 | @@ -39,9 +39,7 @@ | |||
2947 | 39 | namespace Qnx { | 39 | namespace Qnx { |
2948 | 40 | namespace Internal { | 40 | namespace Internal { |
2949 | 41 | 41 | ||
2953 | 42 | namespace Ui { | 42 | namespace Ui { class BarDescriptorEditorEnvironmentWidget; } |
2951 | 43 | class BarDescriptorEditorEnvironmentWidget; | ||
2952 | 44 | } | ||
2954 | 45 | 43 | ||
2955 | 46 | class BarDescriptorEditorEnvironmentWidget : public BarDescriptorEditorAbstractPanelWidget | 44 | class BarDescriptorEditorEnvironmentWidget : public BarDescriptorEditorAbstractPanelWidget |
2956 | 47 | { | 45 | { |
2957 | @@ -51,10 +49,9 @@ | |||
2958 | 51 | explicit BarDescriptorEditorEnvironmentWidget(QWidget *parent = 0); | 49 | explicit BarDescriptorEditorEnvironmentWidget(QWidget *parent = 0); |
2959 | 52 | ~BarDescriptorEditorEnvironmentWidget(); | 50 | ~BarDescriptorEditorEnvironmentWidget(); |
2960 | 53 | 51 | ||
2965 | 54 | void clear(); | 52 | protected: |
2966 | 55 | 53 | void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value); | |
2967 | 56 | QList<Utils::EnvironmentItem> environment() const; | 54 | void emitChanged(BarDescriptorDocument::Tag tag); |
2964 | 57 | void appendEnvironmentItem(const Utils::EnvironmentItem &envItem); | ||
2968 | 58 | 55 | ||
2969 | 59 | private: | 56 | private: |
2970 | 60 | Ui::BarDescriptorEditorEnvironmentWidget *m_ui; | 57 | Ui::BarDescriptorEditorEnvironmentWidget *m_ui; |
2971 | 61 | 58 | ||
2972 | === modified file 'src/qnx/bardescriptoreditorfactory.cpp' | |||
2973 | --- src/qnx/bardescriptoreditorfactory.cpp 2014-03-18 10:51:43 +0000 | |||
2974 | +++ src/qnx/bardescriptoreditorfactory.cpp 2014-06-16 09:46:37 +0000 | |||
2975 | @@ -32,6 +32,7 @@ | |||
2976 | 32 | #include "bardescriptoreditorfactory.h" | 32 | #include "bardescriptoreditorfactory.h" |
2977 | 33 | 33 | ||
2978 | 34 | #include "qnxconstants.h" | 34 | #include "qnxconstants.h" |
2979 | 35 | #include "bardescriptoreditor.h" | ||
2980 | 35 | #include "bardescriptoreditorwidget.h" | 36 | #include "bardescriptoreditorwidget.h" |
2981 | 36 | 37 | ||
2982 | 37 | #include <coreplugin/editormanager/editormanager.h> | 38 | #include <coreplugin/editormanager/editormanager.h> |
2983 | @@ -44,8 +45,8 @@ | |||
2984 | 44 | class BarDescriptorActionHandler : public TextEditor::TextEditorActionHandler | 45 | class BarDescriptorActionHandler : public TextEditor::TextEditorActionHandler |
2985 | 45 | { | 46 | { |
2986 | 46 | public: | 47 | public: |
2989 | 47 | BarDescriptorActionHandler() | 48 | BarDescriptorActionHandler(QObject *parent) |
2990 | 48 | : TextEditor::TextEditorActionHandler(Constants::QNX_BAR_DESCRIPTOR_EDITOR_CONTEXT) | 49 | : TextEditor::TextEditorActionHandler(parent, Constants::QNX_BAR_DESCRIPTOR_EDITOR_CONTEXT) |
2991 | 49 | { | 50 | { |
2992 | 50 | } | 51 | } |
2993 | 51 | protected: | 52 | protected: |
2994 | @@ -58,20 +59,15 @@ | |||
2995 | 58 | 59 | ||
2996 | 59 | BarDescriptorEditorFactory::BarDescriptorEditorFactory(QObject *parent) | 60 | BarDescriptorEditorFactory::BarDescriptorEditorFactory(QObject *parent) |
2997 | 60 | : Core::IEditorFactory(parent) | 61 | : Core::IEditorFactory(parent) |
2998 | 61 | , m_actionHandler(new BarDescriptorActionHandler) | ||
2999 | 62 | { | 62 | { |
3000 | 63 | setId(Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID); | 63 | setId(Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID); |
3001 | 64 | setDisplayName(tr("Bar descriptor editor")); | 64 | setDisplayName(tr("Bar descriptor editor")); |
3002 | 65 | addMimeType(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE); | 65 | addMimeType(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE); |
3014 | 66 | } | 66 | new BarDescriptorActionHandler(this); |
3015 | 67 | 67 | } | |
3016 | 68 | BarDescriptorEditorFactory::~BarDescriptorEditorFactory() | 68 | |
3017 | 69 | { | 69 | Core::IEditor *BarDescriptorEditorFactory::createEditor() |
3018 | 70 | delete m_actionHandler; | 70 | { |
3019 | 71 | } | 71 | BarDescriptorEditor *editor = new BarDescriptorEditor(); |
3020 | 72 | 72 | return editor; | |
3010 | 73 | Core::IEditor *BarDescriptorEditorFactory::createEditor(QWidget *parent) | ||
3011 | 74 | { | ||
3012 | 75 | BarDescriptorEditorWidget *editorWidget = new BarDescriptorEditorWidget(parent, m_actionHandler); | ||
3013 | 76 | return editorWidget->editor(); | ||
3021 | 77 | } | 73 | } |
3022 | 78 | 74 | ||
3023 | === modified file 'src/qnx/bardescriptoreditorfactory.h' | |||
3024 | --- src/qnx/bardescriptoreditorfactory.h 2014-03-18 10:51:43 +0000 | |||
3025 | +++ src/qnx/bardescriptoreditorfactory.h 2014-06-16 09:46:37 +0000 | |||
3026 | @@ -34,10 +34,6 @@ | |||
3027 | 34 | 34 | ||
3028 | 35 | #include <coreplugin/editormanager/ieditorfactory.h> | 35 | #include <coreplugin/editormanager/ieditorfactory.h> |
3029 | 36 | 36 | ||
3030 | 37 | namespace TextEditor { | ||
3031 | 38 | class TextEditorActionHandler; | ||
3032 | 39 | } | ||
3033 | 40 | |||
3034 | 41 | namespace Qnx { | 37 | namespace Qnx { |
3035 | 42 | namespace Internal { | 38 | namespace Internal { |
3036 | 43 | 39 | ||
3037 | @@ -47,12 +43,8 @@ | |||
3038 | 47 | 43 | ||
3039 | 48 | public: | 44 | public: |
3040 | 49 | explicit BarDescriptorEditorFactory(QObject *parent = 0); | 45 | explicit BarDescriptorEditorFactory(QObject *parent = 0); |
3047 | 50 | ~BarDescriptorEditorFactory(); | 46 | |
3048 | 51 | 47 | Core::IEditor *createEditor(); | |
3043 | 52 | Core::IEditor *createEditor(QWidget *parent); | ||
3044 | 53 | |||
3045 | 54 | private: | ||
3046 | 55 | TextEditor::TextEditorActionHandler *m_actionHandler; | ||
3049 | 56 | }; | 48 | }; |
3050 | 57 | 49 | ||
3051 | 58 | } // namespace Internal | 50 | } // namespace Internal |
3052 | 59 | 51 | ||
3053 | === modified file 'src/qnx/bardescriptoreditorgeneralwidget.cpp' | |||
3054 | --- src/qnx/bardescriptoreditorgeneralwidget.cpp 2014-03-18 10:51:43 +0000 | |||
3055 | +++ src/qnx/bardescriptoreditorgeneralwidget.cpp 2014-06-16 09:46:37 +0000 | |||
3056 | @@ -51,10 +51,10 @@ | |||
3057 | 51 | m_ui->chrome->addItem(tr("Standard"), QLatin1String("standard")); | 51 | m_ui->chrome->addItem(tr("Standard"), QLatin1String("standard")); |
3058 | 52 | m_ui->chrome->addItem(tr("None"), QLatin1String("none")); | 52 | m_ui->chrome->addItem(tr("None"), QLatin1String("none")); |
3059 | 53 | 53 | ||
3064 | 54 | connect(m_ui->orientation, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); | 54 | addSignalMapping(BarDescriptorDocument::aspectRatio, m_ui->orientation, SIGNAL(currentIndexChanged(int))); |
3065 | 55 | connect(m_ui->chrome, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); | 55 | addSignalMapping(BarDescriptorDocument::systemChrome, m_ui->chrome, SIGNAL(currentIndexChanged(int))); |
3066 | 56 | connect(m_ui->transparentMainWindow, SIGNAL(toggled(bool)), this, SIGNAL(changed())); | 56 | addSignalMapping(BarDescriptorDocument::transparent, m_ui->transparentMainWindow, SIGNAL(toggled(bool))); |
3067 | 57 | connect(m_ui->applicationArguments, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); | 57 | addSignalMapping(BarDescriptorDocument::arg, m_ui->applicationArguments, SIGNAL(textChanged(QString))); |
3068 | 58 | } | 58 | } |
3069 | 59 | 59 | ||
3070 | 60 | BarDescriptorEditorGeneralWidget::~BarDescriptorEditorGeneralWidget() | 60 | BarDescriptorEditorGeneralWidget::~BarDescriptorEditorGeneralWidget() |
3071 | @@ -62,62 +62,41 @@ | |||
3072 | 62 | delete m_ui; | 62 | delete m_ui; |
3073 | 63 | } | 63 | } |
3074 | 64 | 64 | ||
3133 | 65 | void BarDescriptorEditorGeneralWidget::clear() | 65 | void BarDescriptorEditorGeneralWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value) |
3134 | 66 | { | 66 | { |
3135 | 67 | setComboBoxBlocked(m_ui->orientation, m_ui->orientation->findData(QLatin1String(""))); | 67 | if (tag == BarDescriptorDocument::aspectRatio) { |
3136 | 68 | setComboBoxBlocked(m_ui->chrome, m_ui->chrome->findData(QLatin1String("none"))); | 68 | m_ui->orientation->setCurrentIndex(m_ui->orientation->findData(value)); |
3137 | 69 | setCheckBoxBlocked(m_ui->transparentMainWindow, false); | 69 | } else if (tag == BarDescriptorDocument::autoOrients) { |
3138 | 70 | setLineEditBlocked(m_ui->applicationArguments, QString()); | 70 | if (value.toString() == QLatin1String("true")) { |
3139 | 71 | } | 71 | blockSignalMapping(BarDescriptorDocument::aspectRatio); |
3140 | 72 | 72 | m_ui->orientation->setCurrentIndex(m_ui->orientation->findData(QLatin1String("auto-orient"))); | |
3141 | 73 | QString BarDescriptorEditorGeneralWidget::orientation() const | 73 | unblockSignalMapping(BarDescriptorDocument::aspectRatio); |
3142 | 74 | { | 74 | } |
3143 | 75 | return m_ui->orientation->itemData(m_ui->orientation->currentIndex()).toString(); | 75 | } else if (tag == BarDescriptorDocument::arg) { |
3144 | 76 | } | 76 | m_ui->applicationArguments->setText(value.toStringList().join(QLatin1String(" "))); |
3145 | 77 | 77 | } else { | |
3146 | 78 | void BarDescriptorEditorGeneralWidget::setOrientation(const QString &orientation) | 78 | BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value); |
3147 | 79 | { | 79 | } |
3148 | 80 | int index = m_ui->orientation->findData(orientation); | 80 | } |
3149 | 81 | QTC_ASSERT(index >= 0, return); | 81 | |
3150 | 82 | 82 | void BarDescriptorEditorGeneralWidget::emitChanged(BarDescriptorDocument::Tag tag) | |
3151 | 83 | setComboBoxBlocked(m_ui->orientation, index); | 83 | { |
3152 | 84 | } | 84 | if (tag == BarDescriptorDocument::aspectRatio) { |
3153 | 85 | 85 | QString value = m_ui->orientation->itemData(m_ui->orientation->currentIndex()).toString(); | |
3154 | 86 | QString BarDescriptorEditorGeneralWidget::chrome() const | 86 | if (value == QLatin1String("auto-orient")) { |
3155 | 87 | { | 87 | emit changed(BarDescriptorDocument::aspectRatio, QLatin1String("")); |
3156 | 88 | return m_ui->chrome->itemData(m_ui->chrome->currentIndex()).toString(); | 88 | emit changed(BarDescriptorDocument::autoOrients, QLatin1String("true")); |
3157 | 89 | } | 89 | return; |
3158 | 90 | 90 | } else if (!value.isEmpty()) { | |
3159 | 91 | void BarDescriptorEditorGeneralWidget::setChrome(const QString &chrome) | 91 | emit changed(BarDescriptorDocument::aspectRatio, value); |
3160 | 92 | { | 92 | emit changed(BarDescriptorDocument::autoOrients, QLatin1String("false")); |
3161 | 93 | int index = m_ui->chrome->findData(chrome); | 93 | } else { |
3162 | 94 | QTC_ASSERT(index >= 0, return); | 94 | emit changed(BarDescriptorDocument::aspectRatio, value); |
3163 | 95 | 95 | emit changed(BarDescriptorDocument::autoOrients, QLatin1String("")); | |
3164 | 96 | setComboBoxBlocked(m_ui->chrome, index); | 96 | } |
3165 | 97 | } | 97 | } else if (tag == BarDescriptorDocument::arg) { |
3166 | 98 | 98 | emit changed(tag, m_ui->applicationArguments->text().split(QLatin1Char(' '))); | |
3167 | 99 | bool BarDescriptorEditorGeneralWidget::transparent() const | 99 | } else { |
3168 | 100 | { | 100 | BarDescriptorEditorAbstractPanelWidget::emitChanged(tag); |
3169 | 101 | return m_ui->transparentMainWindow->isChecked(); | 101 | } |
3112 | 102 | } | ||
3113 | 103 | |||
3114 | 104 | void BarDescriptorEditorGeneralWidget::setTransparent(bool transparent) | ||
3115 | 105 | { | ||
3116 | 106 | setCheckBoxBlocked(m_ui->transparentMainWindow, transparent); | ||
3117 | 107 | } | ||
3118 | 108 | |||
3119 | 109 | void BarDescriptorEditorGeneralWidget::appendApplicationArgument(const QString &argument) | ||
3120 | 110 | { | ||
3121 | 111 | QString completeArguments = m_ui->applicationArguments->text(); | ||
3122 | 112 | if (!completeArguments.isEmpty()) | ||
3123 | 113 | completeArguments.append(QLatin1Char(' ')); | ||
3124 | 114 | completeArguments.append(argument); | ||
3125 | 115 | |||
3126 | 116 | setLineEditBlocked(m_ui->applicationArguments, completeArguments); | ||
3127 | 117 | } | ||
3128 | 118 | |||
3129 | 119 | QStringList BarDescriptorEditorGeneralWidget::applicationArguments() const | ||
3130 | 120 | { | ||
3131 | 121 | // TODO: Should probably handle "argument with spaces within quotes" | ||
3132 | 122 | return m_ui->applicationArguments->text().split(QLatin1Char(' ')); | ||
3170 | 123 | } | 102 | } |
3171 | 124 | 103 | ||
3172 | === modified file 'src/qnx/bardescriptoreditorgeneralwidget.h' | |||
3173 | --- src/qnx/bardescriptoreditorgeneralwidget.h 2014-03-18 10:51:43 +0000 | |||
3174 | +++ src/qnx/bardescriptoreditorgeneralwidget.h 2014-06-16 09:46:37 +0000 | |||
3175 | @@ -37,9 +37,7 @@ | |||
3176 | 37 | namespace Qnx { | 37 | namespace Qnx { |
3177 | 38 | namespace Internal { | 38 | namespace Internal { |
3178 | 39 | 39 | ||
3182 | 40 | namespace Ui { | 40 | namespace Ui { class BarDescriptorEditorGeneralWidget; } |
3180 | 41 | class BarDescriptorEditorGeneralWidget; | ||
3181 | 42 | } | ||
3183 | 43 | 41 | ||
3184 | 44 | class BarDescriptorEditorGeneralWidget : public BarDescriptorEditorAbstractPanelWidget | 42 | class BarDescriptorEditorGeneralWidget : public BarDescriptorEditorAbstractPanelWidget |
3185 | 45 | { | 43 | { |
3186 | @@ -49,19 +47,9 @@ | |||
3187 | 49 | explicit BarDescriptorEditorGeneralWidget(QWidget *parent = 0); | 47 | explicit BarDescriptorEditorGeneralWidget(QWidget *parent = 0); |
3188 | 50 | ~BarDescriptorEditorGeneralWidget(); | 48 | ~BarDescriptorEditorGeneralWidget(); |
3189 | 51 | 49 | ||
3203 | 52 | void clear(); | 50 | protected: |
3204 | 53 | 51 | void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value); | |
3205 | 54 | QString orientation() const; | 52 | void emitChanged(BarDescriptorDocument::Tag tag); |
3193 | 55 | void setOrientation(const QString &orientation); | ||
3194 | 56 | |||
3195 | 57 | QString chrome() const; | ||
3196 | 58 | void setChrome(const QString &chrome); | ||
3197 | 59 | |||
3198 | 60 | bool transparent() const; | ||
3199 | 61 | void setTransparent(bool transparent); | ||
3200 | 62 | |||
3201 | 63 | void appendApplicationArgument(const QString &argument); | ||
3202 | 64 | QStringList applicationArguments() const; | ||
3206 | 65 | 53 | ||
3207 | 66 | private: | 54 | private: |
3208 | 67 | Ui::BarDescriptorEditorGeneralWidget *m_ui; | 55 | Ui::BarDescriptorEditorGeneralWidget *m_ui; |
3209 | 68 | 56 | ||
3210 | === modified file 'src/qnx/bardescriptoreditorpackageinformationwidget.cpp' | |||
3211 | --- src/qnx/bardescriptoreditorpackageinformationwidget.cpp 2014-03-18 10:51:43 +0000 | |||
3212 | +++ src/qnx/bardescriptoreditorpackageinformationwidget.cpp 2014-06-16 09:46:37 +0000 | |||
3213 | @@ -45,55 +45,12 @@ | |||
3214 | 45 | QRegExpValidator *versionNumberValidator = new QRegExpValidator(versionNumberRegExp, this); | 45 | QRegExpValidator *versionNumberValidator = new QRegExpValidator(versionNumberRegExp, this); |
3215 | 46 | m_ui->packageVersion->setValidator(versionNumberValidator); | 46 | m_ui->packageVersion->setValidator(versionNumberValidator); |
3216 | 47 | 47 | ||
3220 | 48 | connect(m_ui->packageId, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); | 48 | addSignalMapping(BarDescriptorDocument::id, m_ui->packageId, SIGNAL(textChanged(QString))); |
3221 | 49 | connect(m_ui->packageVersion, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); | 49 | addSignalMapping(BarDescriptorDocument::versionNumber, m_ui->packageVersion, SIGNAL(textChanged(QString))); |
3222 | 50 | connect(m_ui->packageBuildId, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); | 50 | addSignalMapping(BarDescriptorDocument::buildId, m_ui->packageBuildId, SIGNAL(textChanged(QString))); |
3223 | 51 | } | 51 | } |
3224 | 52 | 52 | ||
3225 | 53 | BarDescriptorEditorPackageInformationWidget::~BarDescriptorEditorPackageInformationWidget() | 53 | BarDescriptorEditorPackageInformationWidget::~BarDescriptorEditorPackageInformationWidget() |
3226 | 54 | { | 54 | { |
3227 | 55 | delete m_ui; | 55 | delete m_ui; |
3228 | 56 | } | 56 | } |
3229 | 57 | |||
3230 | 58 | void BarDescriptorEditorPackageInformationWidget::clear() | ||
3231 | 59 | { | ||
3232 | 60 | setLineEditBlocked(m_ui->packageId, QString()); | ||
3233 | 61 | setLineEditBlocked(m_ui->packageVersion, QString()); | ||
3234 | 62 | setLineEditBlocked(m_ui->packageBuildId, QString()); | ||
3235 | 63 | } | ||
3236 | 64 | |||
3237 | 65 | QString BarDescriptorEditorPackageInformationWidget::packageId() const | ||
3238 | 66 | { | ||
3239 | 67 | return m_ui->packageId->text(); | ||
3240 | 68 | } | ||
3241 | 69 | |||
3242 | 70 | void BarDescriptorEditorPackageInformationWidget::setPackageId(const QString &packageId) | ||
3243 | 71 | { | ||
3244 | 72 | setLineEditBlocked(m_ui->packageId, packageId); | ||
3245 | 73 | } | ||
3246 | 74 | |||
3247 | 75 | QString BarDescriptorEditorPackageInformationWidget::packageVersion() const | ||
3248 | 76 | { | ||
3249 | 77 | QString version = m_ui->packageVersion->text(); | ||
3250 | 78 | int pos = 0; | ||
3251 | 79 | if (m_ui->packageVersion->validator()->validate(version, pos) == QValidator::Intermediate) { | ||
3252 | 80 | if (version.endsWith(QLatin1Char('.'))) | ||
3253 | 81 | version = version.left(version.size() - 1); | ||
3254 | 82 | } | ||
3255 | 83 | return version; | ||
3256 | 84 | } | ||
3257 | 85 | |||
3258 | 86 | void BarDescriptorEditorPackageInformationWidget::setPackageVersion(const QString &packageVersion) | ||
3259 | 87 | { | ||
3260 | 88 | setLineEditBlocked(m_ui->packageVersion, packageVersion); | ||
3261 | 89 | } | ||
3262 | 90 | |||
3263 | 91 | QString BarDescriptorEditorPackageInformationWidget::packageBuildId() const | ||
3264 | 92 | { | ||
3265 | 93 | return m_ui->packageBuildId->text(); | ||
3266 | 94 | } | ||
3267 | 95 | |||
3268 | 96 | void BarDescriptorEditorPackageInformationWidget::setPackageBuildId(const QString &packageBuildId) | ||
3269 | 97 | { | ||
3270 | 98 | setLineEditBlocked(m_ui->packageBuildId, packageBuildId); | ||
3271 | 99 | } | ||
3272 | 100 | 57 | ||
3273 | === modified file 'src/qnx/bardescriptoreditorpackageinformationwidget.h' | |||
3274 | --- src/qnx/bardescriptoreditorpackageinformationwidget.h 2014-03-18 10:51:43 +0000 | |||
3275 | +++ src/qnx/bardescriptoreditorpackageinformationwidget.h 2014-06-16 09:46:37 +0000 | |||
3276 | @@ -37,9 +37,7 @@ | |||
3277 | 37 | namespace Qnx { | 37 | namespace Qnx { |
3278 | 38 | namespace Internal { | 38 | namespace Internal { |
3279 | 39 | 39 | ||
3283 | 40 | namespace Ui { | 40 | namespace Ui { class BarDescriptorEditorPackageInformationWidget; } |
3281 | 41 | class BarDescriptorEditorPackageInformationWidget; | ||
3282 | 42 | } | ||
3284 | 43 | 41 | ||
3285 | 44 | class BarDescriptorEditorPackageInformationWidget : public BarDescriptorEditorAbstractPanelWidget | 42 | class BarDescriptorEditorPackageInformationWidget : public BarDescriptorEditorAbstractPanelWidget |
3286 | 45 | { | 43 | { |
3287 | @@ -49,17 +47,6 @@ | |||
3288 | 49 | explicit BarDescriptorEditorPackageInformationWidget(QWidget *parent = 0); | 47 | explicit BarDescriptorEditorPackageInformationWidget(QWidget *parent = 0); |
3289 | 50 | ~BarDescriptorEditorPackageInformationWidget(); | 48 | ~BarDescriptorEditorPackageInformationWidget(); |
3290 | 51 | 49 | ||
3291 | 52 | void clear(); | ||
3292 | 53 | |||
3293 | 54 | QString packageId() const; | ||
3294 | 55 | void setPackageId(const QString &packageId); | ||
3295 | 56 | |||
3296 | 57 | QString packageVersion() const; | ||
3297 | 58 | void setPackageVersion(const QString &packageVersion); | ||
3298 | 59 | |||
3299 | 60 | QString packageBuildId() const; | ||
3300 | 61 | void setPackageBuildId(const QString &packageBuildId); | ||
3301 | 62 | |||
3302 | 63 | private: | 50 | private: |
3303 | 64 | Ui::BarDescriptorEditorPackageInformationWidget *m_ui; | 51 | Ui::BarDescriptorEditorPackageInformationWidget *m_ui; |
3304 | 65 | }; | 52 | }; |
3305 | 66 | 53 | ||
3306 | === modified file 'src/qnx/bardescriptoreditorpermissionswidget.cpp' | |||
3307 | --- src/qnx/bardescriptoreditorpermissionswidget.cpp 2014-03-18 10:51:43 +0000 | |||
3308 | +++ src/qnx/bardescriptoreditorpermissionswidget.cpp 2014-06-16 09:46:37 +0000 | |||
3309 | @@ -48,7 +48,8 @@ | |||
3310 | 48 | 48 | ||
3311 | 49 | connect(m_ui->selectAllPermissions, SIGNAL(clicked()), m_permissionsModel, SLOT(checkAll())); | 49 | connect(m_ui->selectAllPermissions, SIGNAL(clicked()), m_permissionsModel, SLOT(checkAll())); |
3312 | 50 | connect(m_ui->deselectAllPermissions, SIGNAL(clicked()), m_permissionsModel, SLOT(uncheckAll())); | 50 | connect(m_ui->deselectAllPermissions, SIGNAL(clicked()), m_permissionsModel, SLOT(uncheckAll())); |
3314 | 51 | connect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); | 51 | |
3315 | 52 | addSignalMapping(BarDescriptorDocument::action, m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex))); | ||
3316 | 52 | } | 53 | } |
3317 | 53 | 54 | ||
3318 | 54 | BarDescriptorEditorPermissionsWidget::~BarDescriptorEditorPermissionsWidget() | 55 | BarDescriptorEditorPermissionsWidget::~BarDescriptorEditorPermissionsWidget() |
3319 | @@ -56,13 +57,6 @@ | |||
3320 | 56 | delete m_ui; | 57 | delete m_ui; |
3321 | 57 | } | 58 | } |
3322 | 58 | 59 | ||
3323 | 59 | void BarDescriptorEditorPermissionsWidget::clear() | ||
3324 | 60 | { | ||
3325 | 61 | disconnect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); | ||
3326 | 62 | m_permissionsModel->uncheckAll(); | ||
3327 | 63 | connect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); | ||
3328 | 64 | } | ||
3329 | 65 | |||
3330 | 66 | QStringList BarDescriptorEditorPermissionsWidget::checkedPermissions() const | 60 | QStringList BarDescriptorEditorPermissionsWidget::checkedPermissions() const |
3331 | 67 | { | 61 | { |
3332 | 68 | return m_permissionsModel->checkedIdentifiers(); | 62 | return m_permissionsModel->checkedIdentifiers(); |
3333 | @@ -70,7 +64,29 @@ | |||
3334 | 70 | 64 | ||
3335 | 71 | void BarDescriptorEditorPermissionsWidget::checkPermission(const QString &identifier) | 65 | void BarDescriptorEditorPermissionsWidget::checkPermission(const QString &identifier) |
3336 | 72 | { | 66 | { |
3338 | 73 | disconnect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); | 67 | blockSignalMapping(BarDescriptorDocument::action); |
3339 | 74 | m_permissionsModel->checkPermission(identifier); | 68 | m_permissionsModel->checkPermission(identifier); |
3341 | 75 | connect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); | 69 | unblockSignalMapping(BarDescriptorDocument::action); |
3342 | 70 | } | ||
3343 | 71 | |||
3344 | 72 | void BarDescriptorEditorPermissionsWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value) | ||
3345 | 73 | { | ||
3346 | 74 | if (tag != BarDescriptorDocument::action) { | ||
3347 | 75 | BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value); | ||
3348 | 76 | return; | ||
3349 | 77 | } | ||
3350 | 78 | |||
3351 | 79 | QStringList permissions = value.toStringList(); | ||
3352 | 80 | Q_FOREACH (const QString &permission, permissions) | ||
3353 | 81 | checkPermission(permission); | ||
3354 | 82 | } | ||
3355 | 83 | |||
3356 | 84 | void BarDescriptorEditorPermissionsWidget::emitChanged(BarDescriptorDocument::Tag tag) | ||
3357 | 85 | { | ||
3358 | 86 | if (tag != BarDescriptorDocument::action) { | ||
3359 | 87 | BarDescriptorEditorAbstractPanelWidget::emitChanged(tag); | ||
3360 | 88 | return; | ||
3361 | 89 | } | ||
3362 | 90 | |||
3363 | 91 | emit changed(tag, checkedPermissions()); | ||
3364 | 76 | } | 92 | } |
3365 | 77 | 93 | ||
3366 | === modified file 'src/qnx/bardescriptoreditorpermissionswidget.h' | |||
3367 | --- src/qnx/bardescriptoreditorpermissionswidget.h 2014-03-18 10:51:43 +0000 | |||
3368 | +++ src/qnx/bardescriptoreditorpermissionswidget.h 2014-06-16 09:46:37 +0000 | |||
3369 | @@ -39,9 +39,7 @@ | |||
3370 | 39 | 39 | ||
3371 | 40 | class BarDescriptorPermissionsModel; | 40 | class BarDescriptorPermissionsModel; |
3372 | 41 | 41 | ||
3376 | 42 | namespace Ui { | 42 | namespace Ui { class BarDescriptorEditorPermissionsWidget; } |
3374 | 43 | class BarDescriptorEditorPermissionsWidget; | ||
3375 | 44 | } | ||
3377 | 45 | 43 | ||
3378 | 46 | class BarDescriptorEditorPermissionsWidget : public BarDescriptorEditorAbstractPanelWidget | 44 | class BarDescriptorEditorPermissionsWidget : public BarDescriptorEditorAbstractPanelWidget |
3379 | 47 | { | 45 | { |
3380 | @@ -51,12 +49,14 @@ | |||
3381 | 51 | explicit BarDescriptorEditorPermissionsWidget(QWidget *parent = 0); | 49 | explicit BarDescriptorEditorPermissionsWidget(QWidget *parent = 0); |
3382 | 52 | ~BarDescriptorEditorPermissionsWidget(); | 50 | ~BarDescriptorEditorPermissionsWidget(); |
3383 | 53 | 51 | ||
3385 | 54 | void clear(); | 52 | protected: |
3386 | 53 | void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value); | ||
3387 | 54 | void emitChanged(BarDescriptorDocument::Tag tag); | ||
3388 | 55 | 55 | ||
3389 | 56 | private: | ||
3390 | 56 | QStringList checkedPermissions() const; | 57 | QStringList checkedPermissions() const; |
3391 | 57 | void checkPermission(const QString &identifier); | 58 | void checkPermission(const QString &identifier); |
3392 | 58 | 59 | ||
3393 | 59 | private: | ||
3394 | 60 | Ui::BarDescriptorEditorPermissionsWidget *m_ui; | 60 | Ui::BarDescriptorEditorPermissionsWidget *m_ui; |
3395 | 61 | 61 | ||
3396 | 62 | BarDescriptorPermissionsModel *m_permissionsModel; | 62 | BarDescriptorPermissionsModel *m_permissionsModel; |
3397 | 63 | 63 | ||
3398 | === modified file 'src/qnx/bardescriptoreditorwidget.cpp' | |||
3399 | --- src/qnx/bardescriptoreditorwidget.cpp 2014-03-18 10:51:43 +0000 | |||
3400 | +++ src/qnx/bardescriptoreditorwidget.cpp 2014-06-16 09:46:37 +0000 | |||
3401 | @@ -44,20 +44,19 @@ | |||
3402 | 44 | #include <coreplugin/icore.h> | 44 | #include <coreplugin/icore.h> |
3403 | 45 | #include <projectexplorer/iprojectproperties.h> | 45 | #include <projectexplorer/iprojectproperties.h> |
3404 | 46 | #include <projectexplorer/projectwindow.h> | 46 | #include <projectexplorer/projectwindow.h> |
3405 | 47 | #include <projectexplorer/task.h> | ||
3406 | 48 | #include <projectexplorer/taskhub.h> | ||
3407 | 47 | #include <texteditor/plaintexteditor.h> | 49 | #include <texteditor/plaintexteditor.h> |
3408 | 48 | #include <texteditor/texteditoractionhandler.h> | ||
3409 | 49 | #include <texteditor/texteditorsettings.h> | 50 | #include <texteditor/texteditorsettings.h> |
3410 | 50 | #include <texteditor/texteditorconstants.h> | 51 | #include <texteditor/texteditorconstants.h> |
3411 | 52 | #include <utils/qtcassert.h> | ||
3412 | 51 | 53 | ||
3413 | 52 | using namespace Qnx; | 54 | using namespace Qnx; |
3414 | 53 | using namespace Qnx::Internal; | 55 | using namespace Qnx::Internal; |
3415 | 54 | 56 | ||
3418 | 55 | BarDescriptorEditorWidget::BarDescriptorEditorWidget( | 57 | BarDescriptorEditorWidget::BarDescriptorEditorWidget(BarDescriptorEditor *editor, QWidget *parent) |
3417 | 56 | QWidget *parent, TextEditor::TextEditorActionHandler *handler) | ||
3419 | 57 | : QStackedWidget(parent) | 58 | : QStackedWidget(parent) |
3423 | 58 | , m_editor(0) | 59 | , m_editor(editor) |
3421 | 59 | , m_handler(handler) | ||
3422 | 60 | , m_dirty(false) | ||
3424 | 61 | { | 60 | { |
3425 | 62 | Core::IContext *myContext = new Core::IContext(this); | 61 | Core::IContext *myContext = new Core::IContext(this); |
3426 | 63 | myContext->setWidget(this); | 62 | myContext->setWidget(this); |
3427 | @@ -70,6 +69,25 @@ | |||
3428 | 70 | initSourcePage(); | 69 | initSourcePage(); |
3429 | 71 | 70 | ||
3430 | 72 | setCurrentIndex(0); | 71 | setCurrentIndex(0); |
3431 | 72 | |||
3432 | 73 | connect(m_entryPointWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant))); | ||
3433 | 74 | connect(m_packageInformationWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant))); | ||
3434 | 75 | connect(m_authorInformationWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant))); | ||
3435 | 76 | connect(m_generalWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant))); | ||
3436 | 77 | connect(m_permissionsWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant))); | ||
3437 | 78 | connect(m_environmentWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant))); | ||
3438 | 79 | connect(m_assetsWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant))); | ||
3439 | 80 | |||
3440 | 81 | connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_entryPointWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant))); | ||
3441 | 82 | connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_packageInformationWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant))); | ||
3442 | 83 | connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_authorInformationWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant))); | ||
3443 | 84 | connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_generalWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant))); | ||
3444 | 85 | connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_permissionsWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant))); | ||
3445 | 86 | connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_environmentWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant))); | ||
3446 | 87 | connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_assetsWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant))); | ||
3447 | 88 | |||
3448 | 89 | connect(m_xmlSourceWidget, SIGNAL(textChanged()), this, SLOT(updateDocumentContent())); | ||
3449 | 90 | connect(barDescriptorDocument(), SIGNAL(changed()), this, SLOT(updateSourceView())); | ||
3450 | 73 | } | 91 | } |
3451 | 74 | 92 | ||
3452 | 75 | void BarDescriptorEditorWidget::initGeneralPage() | 93 | void BarDescriptorEditorWidget::initGeneralPage() |
3453 | @@ -98,10 +116,6 @@ | |||
3454 | 98 | authorInformationPanel->setDisplayName(tr("Author Information")); | 116 | authorInformationPanel->setDisplayName(tr("Author Information")); |
3455 | 99 | authorInformationPanel->setWidget(m_authorInformationWidget); | 117 | authorInformationPanel->setWidget(m_authorInformationWidget); |
3456 | 100 | generalPanel->addPropertiesPanel(authorInformationPanel); | 118 | generalPanel->addPropertiesPanel(authorInformationPanel); |
3457 | 101 | |||
3458 | 102 | connect(m_entryPointWidget, SIGNAL(changed()), this, SLOT(setDirty())); | ||
3459 | 103 | connect(m_packageInformationWidget, SIGNAL(changed()), this, SLOT(setDirty())); | ||
3460 | 104 | connect(m_authorInformationWidget, SIGNAL(changed()), this, SLOT(setDirty())); | ||
3461 | 105 | } | 119 | } |
3462 | 106 | 120 | ||
3463 | 107 | void BarDescriptorEditorWidget::initApplicationPage() | 121 | void BarDescriptorEditorWidget::initApplicationPage() |
3464 | @@ -130,10 +144,6 @@ | |||
3465 | 130 | environmentPanel->setDisplayName(tr("Environment")); | 144 | environmentPanel->setDisplayName(tr("Environment")); |
3466 | 131 | environmentPanel->setWidget(m_environmentWidget); | 145 | environmentPanel->setWidget(m_environmentWidget); |
3467 | 132 | applicationPanel->addPropertiesPanel(environmentPanel); | 146 | applicationPanel->addPropertiesPanel(environmentPanel); |
3468 | 133 | |||
3469 | 134 | connect(m_generalWidget, SIGNAL(changed()), this, SLOT(setDirty())); | ||
3470 | 135 | connect(m_permissionsWidget, SIGNAL(changed()), this, SLOT(setDirty())); | ||
3471 | 136 | connect(m_environmentWidget, SIGNAL(changed()), this, SLOT(setDirty())); | ||
3472 | 137 | } | 147 | } |
3473 | 138 | 148 | ||
3474 | 139 | void BarDescriptorEditorWidget::initAssetsPage() | 149 | void BarDescriptorEditorWidget::initAssetsPage() |
3475 | @@ -148,8 +158,6 @@ | |||
3476 | 148 | assetsPropertiesPanel->setWidget(m_assetsWidget); | 158 | assetsPropertiesPanel->setWidget(m_assetsWidget); |
3477 | 149 | assetsPanel->addPropertiesPanel(assetsPropertiesPanel); | 159 | assetsPanel->addPropertiesPanel(assetsPropertiesPanel); |
3478 | 150 | 160 | ||
3479 | 151 | connect(m_assetsWidget, SIGNAL(changed()), this, SLOT(setDirty())); | ||
3480 | 152 | |||
3481 | 153 | m_entryPointWidget->setAssetsModel(m_assetsWidget->assetsModel()); | 161 | m_entryPointWidget->setAssetsModel(m_assetsWidget->assetsModel()); |
3482 | 154 | connect(m_entryPointWidget, SIGNAL(imageAdded(QString)), m_assetsWidget, SLOT(addAsset(QString))); | 162 | connect(m_entryPointWidget, SIGNAL(imageAdded(QString)), m_assetsWidget, SLOT(addAsset(QString))); |
3483 | 155 | connect(m_entryPointWidget, SIGNAL(imageRemoved(QString)), m_assetsWidget, SLOT(removeAsset(QString))); | 163 | connect(m_entryPointWidget, SIGNAL(imageRemoved(QString)), m_assetsWidget, SLOT(removeAsset(QString))); |
3484 | @@ -161,9 +169,7 @@ | |||
3485 | 161 | addWidget(m_xmlSourceWidget); | 169 | addWidget(m_xmlSourceWidget); |
3486 | 162 | 170 | ||
3487 | 163 | TextEditor::TextEditorSettings::initializeEditor(m_xmlSourceWidget); | 171 | TextEditor::TextEditorSettings::initializeEditor(m_xmlSourceWidget); |
3488 | 164 | m_handler->setupActions(m_xmlSourceWidget); | ||
3489 | 165 | m_xmlSourceWidget->configure(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE)); | 172 | m_xmlSourceWidget->configure(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE)); |
3490 | 166 | connect(m_xmlSourceWidget, SIGNAL(textChanged()), this, SLOT(setDirty())); | ||
3491 | 167 | } | 173 | } |
3492 | 168 | 174 | ||
3493 | 169 | void BarDescriptorEditorWidget::initPanelSize(ProjectExplorer::PanelsWidget *panelsWidget) | 175 | void BarDescriptorEditorWidget::initPanelSize(ProjectExplorer::PanelsWidget *panelsWidget) |
3494 | @@ -172,51 +178,6 @@ | |||
3495 | 172 | panelsWidget->widget()->setMinimumWidth(0); | 178 | panelsWidget->widget()->setMinimumWidth(0); |
3496 | 173 | } | 179 | } |
3497 | 174 | 180 | ||
3498 | 175 | Core::IEditor *BarDescriptorEditorWidget::editor() const | ||
3499 | 176 | { | ||
3500 | 177 | if (!m_editor) { | ||
3501 | 178 | m_editor = const_cast<BarDescriptorEditorWidget *>(this)->createEditor(); | ||
3502 | 179 | connect(this, SIGNAL(changed()), m_editor->document(), SIGNAL(changed())); | ||
3503 | 180 | } | ||
3504 | 181 | |||
3505 | 182 | return m_editor; | ||
3506 | 183 | } | ||
3507 | 184 | |||
3508 | 185 | BarDescriptorEditorPackageInformationWidget *BarDescriptorEditorWidget::packageInformationWidget() const | ||
3509 | 186 | { | ||
3510 | 187 | return m_packageInformationWidget; | ||
3511 | 188 | } | ||
3512 | 189 | |||
3513 | 190 | BarDescriptorEditorAuthorInformationWidget *BarDescriptorEditorWidget::authorInformationWidget() const | ||
3514 | 191 | { | ||
3515 | 192 | return m_authorInformationWidget; | ||
3516 | 193 | } | ||
3517 | 194 | |||
3518 | 195 | BarDescriptorEditorEntryPointWidget *BarDescriptorEditorWidget::entryPointWidget() const | ||
3519 | 196 | { | ||
3520 | 197 | return m_entryPointWidget; | ||
3521 | 198 | } | ||
3522 | 199 | |||
3523 | 200 | BarDescriptorEditorGeneralWidget *BarDescriptorEditorWidget::generalWidget() const | ||
3524 | 201 | { | ||
3525 | 202 | return m_generalWidget; | ||
3526 | 203 | } | ||
3527 | 204 | |||
3528 | 205 | BarDescriptorEditorPermissionsWidget *BarDescriptorEditorWidget::permissionsWidget() const | ||
3529 | 206 | { | ||
3530 | 207 | return m_permissionsWidget; | ||
3531 | 208 | } | ||
3532 | 209 | |||
3533 | 210 | BarDescriptorEditorEnvironmentWidget *BarDescriptorEditorWidget::environmentWidget() const | ||
3534 | 211 | { | ||
3535 | 212 | return m_environmentWidget; | ||
3536 | 213 | } | ||
3537 | 214 | |||
3538 | 215 | BarDescriptorEditorAssetsWidget *BarDescriptorEditorWidget::assetsWidget() const | ||
3539 | 216 | { | ||
3540 | 217 | return m_assetsWidget; | ||
3541 | 218 | } | ||
3542 | 219 | |||
3543 | 220 | TextEditor::BaseTextEditorWidget *BarDescriptorEditorWidget::sourceWidget() const | 181 | TextEditor::BaseTextEditorWidget *BarDescriptorEditorWidget::sourceWidget() const |
3544 | 221 | { | 182 | { |
3545 | 222 | return m_xmlSourceWidget; | 183 | return m_xmlSourceWidget; |
3546 | @@ -224,57 +185,45 @@ | |||
3547 | 224 | 185 | ||
3548 | 225 | void BarDescriptorEditorWidget::setFilePath(const QString &filePath) | 186 | void BarDescriptorEditorWidget::setFilePath(const QString &filePath) |
3549 | 226 | { | 187 | { |
3552 | 227 | Core::IDocument *doc = m_xmlSourceWidget->editorDocument(); | 188 | Core::IDocument *doc = m_xmlSourceWidget->baseTextDocument(); |
3553 | 228 | if (doc) { | 189 | if (doc) |
3554 | 229 | doc->setFilePath(filePath); | 190 | doc->setFilePath(filePath); |
3559 | 230 | // setFilePath() call leads to a textChanged() signal emitted | 191 | } |
3560 | 231 | // and therefore having this editor-widget to become dirty | 192 | |
3561 | 232 | // therefore we have to explicitly unset the dirty flag | 193 | void BarDescriptorEditorWidget::updateDocumentContent() |
3562 | 233 | setDirty(false); | 194 | { |
3563 | 195 | ProjectExplorer::TaskHub::clearTasks(Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR); | ||
3564 | 196 | QString errorMsg; | ||
3565 | 197 | int errorLine; | ||
3566 | 198 | |||
3567 | 199 | disconnect(barDescriptorDocument(), SIGNAL(changed()), this, SLOT(updateSourceView())); | ||
3568 | 200 | bool result = barDescriptorDocument()->loadContent(m_xmlSourceWidget->toPlainText(), true, &errorMsg, &errorLine); | ||
3569 | 201 | connect(barDescriptorDocument(), SIGNAL(changed()), this, SLOT(updateSourceView())); | ||
3570 | 202 | |||
3571 | 203 | if (!result) { | ||
3572 | 204 | ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error, errorMsg, Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR, | ||
3573 | 205 | Utils::FileName::fromString(barDescriptorDocument()->filePath()), errorLine); | ||
3574 | 206 | ProjectExplorer::TaskHub::requestPopup(); | ||
3575 | 234 | } | 207 | } |
3576 | 235 | } | 208 | } |
3577 | 236 | 209 | ||
3621 | 237 | QString BarDescriptorEditorWidget::xmlSource() const | 210 | void BarDescriptorEditorWidget::updateSourceView() |
3622 | 238 | { | 211 | { |
3623 | 239 | return m_xmlSourceWidget->toPlainText(); | 212 | bool blocked = m_xmlSourceWidget->blockSignals(true); |
3624 | 240 | } | 213 | |
3625 | 241 | 214 | int line; | |
3626 | 242 | void BarDescriptorEditorWidget::setXmlSource(const QString &xmlSource) | 215 | int column; |
3627 | 243 | { | 216 | int position = m_xmlSourceWidget->position(); |
3628 | 244 | bool blocked = m_xmlSourceWidget->blockSignals(true); | 217 | m_xmlSourceWidget->convertPosition(position, &line, &column); |
3629 | 245 | m_xmlSourceWidget->setPlainText(xmlSource); | 218 | |
3630 | 246 | m_xmlSourceWidget->blockSignals(blocked); | 219 | m_xmlSourceWidget->setPlainText(barDescriptorDocument()->xmlSource()); |
3631 | 247 | } | 220 | |
3632 | 248 | 221 | m_xmlSourceWidget->gotoLine(line, column); | |
3633 | 249 | bool BarDescriptorEditorWidget::isDirty() const | 222 | |
3634 | 250 | { | 223 | m_xmlSourceWidget->blockSignals(blocked); |
3635 | 251 | return m_dirty; | 224 | } |
3636 | 252 | } | 225 | |
3637 | 253 | 226 | BarDescriptorDocument *BarDescriptorEditorWidget::barDescriptorDocument() const | |
3638 | 254 | void BarDescriptorEditorWidget::clear() | 227 | { |
3639 | 255 | { | 228 | return qobject_cast<BarDescriptorDocument*>(m_editor->document()); |
3597 | 256 | m_entryPointWidget->clear(); | ||
3598 | 257 | m_packageInformationWidget->clear(); | ||
3599 | 258 | m_authorInformationWidget->clear(); | ||
3600 | 259 | |||
3601 | 260 | m_generalWidget->clear(); | ||
3602 | 261 | m_permissionsWidget->clear(); | ||
3603 | 262 | m_environmentWidget->clear(); | ||
3604 | 263 | |||
3605 | 264 | m_assetsWidget->clear(); | ||
3606 | 265 | |||
3607 | 266 | bool blocked = m_xmlSourceWidget->blockSignals(true); | ||
3608 | 267 | m_xmlSourceWidget->clear(); | ||
3609 | 268 | m_xmlSourceWidget->blockSignals(blocked); | ||
3610 | 269 | } | ||
3611 | 270 | |||
3612 | 271 | void BarDescriptorEditorWidget::setDirty(bool dirty) | ||
3613 | 272 | { | ||
3614 | 273 | m_dirty = dirty; | ||
3615 | 274 | emit changed(); | ||
3616 | 275 | } | ||
3617 | 276 | |||
3618 | 277 | BarDescriptorEditor *BarDescriptorEditorWidget::createEditor() | ||
3619 | 278 | { | ||
3620 | 279 | return new BarDescriptorEditor(this); | ||
3640 | 280 | } | 229 | } |
3641 | 281 | 230 | ||
3642 | === modified file 'src/qnx/bardescriptoreditorwidget.h' | |||
3643 | --- src/qnx/bardescriptoreditorwidget.h 2014-03-18 10:51:43 +0000 | |||
3644 | +++ src/qnx/bardescriptoreditorwidget.h 2014-06-16 09:46:37 +0000 | |||
3645 | @@ -36,17 +36,12 @@ | |||
3646 | 36 | 36 | ||
3647 | 37 | #include <QStackedWidget> | 37 | #include <QStackedWidget> |
3648 | 38 | 38 | ||
3652 | 39 | namespace Core { | 39 | namespace Core { class IEditor; } |
3650 | 40 | class IEditor; | ||
3651 | 41 | } | ||
3653 | 42 | 40 | ||
3657 | 43 | namespace ProjectExplorer { | 41 | namespace ProjectExplorer { class PanelsWidget; } |
3655 | 44 | class PanelsWidget; | ||
3656 | 45 | } | ||
3658 | 46 | 42 | ||
3659 | 47 | namespace TextEditor { | 43 | namespace TextEditor { |
3660 | 48 | class PlainTextEditorWidget; | 44 | class PlainTextEditorWidget; |
3661 | 49 | class TextEditorActionHandler; | ||
3662 | 50 | class BaseTextEditorWidget; | 45 | class BaseTextEditorWidget; |
3663 | 51 | } | 46 | } |
3664 | 52 | 47 | ||
3665 | @@ -67,37 +62,21 @@ | |||
3666 | 67 | Q_OBJECT | 62 | Q_OBJECT |
3667 | 68 | 63 | ||
3668 | 69 | public: | 64 | public: |
3682 | 70 | explicit BarDescriptorEditorWidget(QWidget *parent, TextEditor::TextEditorActionHandler *handler); | 65 | explicit BarDescriptorEditorWidget(BarDescriptorEditor *editor, QWidget *parent = 0); |
3670 | 71 | |||
3671 | 72 | Core::IEditor *editor() const; | ||
3672 | 73 | |||
3673 | 74 | BarDescriptorEditorEntryPointWidget *entryPointWidget() const; | ||
3674 | 75 | BarDescriptorEditorPackageInformationWidget *packageInformationWidget() const; | ||
3675 | 76 | BarDescriptorEditorAuthorInformationWidget *authorInformationWidget() const; | ||
3676 | 77 | |||
3677 | 78 | BarDescriptorEditorGeneralWidget *generalWidget() const; | ||
3678 | 79 | BarDescriptorEditorPermissionsWidget *permissionsWidget() const; | ||
3679 | 80 | BarDescriptorEditorEnvironmentWidget *environmentWidget() const; | ||
3680 | 81 | |||
3681 | 82 | BarDescriptorEditorAssetsWidget *assetsWidget() const; | ||
3683 | 83 | 66 | ||
3684 | 84 | TextEditor::BaseTextEditorWidget *sourceWidget() const; | 67 | TextEditor::BaseTextEditorWidget *sourceWidget() const; |
3685 | 85 | 68 | ||
3686 | 86 | void setFilePath(const QString &filePath); | 69 | void setFilePath(const QString &filePath); |
3687 | 87 | QString xmlSource() const; | ||
3688 | 88 | void setXmlSource(const QString &xmlSource); | ||
3689 | 89 | |||
3690 | 90 | bool isDirty() const; | ||
3691 | 91 | void clear(); | ||
3692 | 92 | |||
3693 | 93 | public slots: | ||
3694 | 94 | void setDirty(bool dirty = true); | ||
3695 | 95 | 70 | ||
3696 | 96 | signals: | 71 | signals: |
3698 | 97 | void changed(); | 72 | void changed(BarDescriptorDocument::Tag tag, const QVariant &value); |
3699 | 73 | |||
3700 | 74 | private slots: | ||
3701 | 75 | void updateDocumentContent(); | ||
3702 | 76 | void updateSourceView(); | ||
3703 | 98 | 77 | ||
3704 | 99 | private: | 78 | private: |
3706 | 100 | BarDescriptorEditor *createEditor(); | 79 | BarDescriptorDocument *barDescriptorDocument() const; |
3707 | 101 | 80 | ||
3708 | 102 | void initGeneralPage(); | 81 | void initGeneralPage(); |
3709 | 103 | void initApplicationPage(); | 82 | void initApplicationPage(); |
3710 | @@ -105,10 +84,7 @@ | |||
3711 | 105 | void initSourcePage(); | 84 | void initSourcePage(); |
3712 | 106 | void initPanelSize(ProjectExplorer::PanelsWidget *panelsWidget); | 85 | void initPanelSize(ProjectExplorer::PanelsWidget *panelsWidget); |
3713 | 107 | 86 | ||
3718 | 108 | mutable Core::IEditor *m_editor; | 87 | Core::IEditor *m_editor; |
3715 | 109 | |||
3716 | 110 | TextEditor::TextEditorActionHandler *m_handler; | ||
3717 | 111 | bool m_dirty; | ||
3719 | 112 | 88 | ||
3720 | 113 | // New UI | 89 | // New UI |
3721 | 114 | BarDescriptorEditorEntryPointWidget *m_entryPointWidget; | 90 | BarDescriptorEditorEntryPointWidget *m_entryPointWidget; |
3722 | 115 | 91 | ||
3723 | === modified file 'src/qnx/blackberryabstractdeploystep.h' | |||
3724 | --- src/qnx/blackberryabstractdeploystep.h 2014-03-18 10:51:43 +0000 | |||
3725 | +++ src/qnx/blackberryabstractdeploystep.h 2014-06-16 09:46:37 +0000 | |||
3726 | @@ -43,9 +43,7 @@ | |||
3727 | 43 | class QEventLoop; | 43 | class QEventLoop; |
3728 | 44 | QT_END_NAMESPACE | 44 | QT_END_NAMESPACE |
3729 | 45 | 45 | ||
3733 | 46 | namespace Utils { | 46 | namespace Utils { class QtcProcess; } |
3731 | 47 | class QtcProcess; | ||
3732 | 48 | } | ||
3734 | 49 | 47 | ||
3735 | 50 | namespace Qnx { | 48 | namespace Qnx { |
3736 | 51 | namespace Internal { | 49 | namespace Internal { |
3737 | 52 | 50 | ||
3738 | === added file 'src/qnx/blackberryapilevelconfiguration.cpp' | |||
3739 | --- src/qnx/blackberryapilevelconfiguration.cpp 1970-01-01 00:00:00 +0000 | |||
3740 | +++ src/qnx/blackberryapilevelconfiguration.cpp 2014-06-16 09:46:37 +0000 | |||
3741 | @@ -0,0 +1,504 @@ | |||
3742 | 1 | /************************************************************************** | ||
3743 | 2 | ** | ||
3744 | 3 | ** Copyright (C) 2014 BlackBerry Limited. All rights reserved. | ||
3745 | 4 | ** | ||
3746 | 5 | ** Contact: BlackBerry (qt@blackberry.com) | ||
3747 | 6 | ** Contact: KDAB (info@kdab.com) | ||
3748 | 7 | ** | ||
3749 | 8 | ** This file is part of Qt Creator. | ||
3750 | 9 | ** | ||
3751 | 10 | ** Commercial License Usage | ||
3752 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in | ||
3753 | 12 | ** accordance with the commercial license agreement provided with the | ||
3754 | 13 | ** Software or, alternatively, in accordance with the terms contained in | ||
3755 | 14 | ** a written agreement between you and Digia. For licensing terms and | ||
3756 | 15 | ** conditions see http://qt.digia.com/licensing. For further information | ||
3757 | 16 | ** use the contact form at http://qt.digia.com/contact-us. | ||
3758 | 17 | ** | ||
3759 | 18 | ** GNU Lesser General Public License Usage | ||
3760 | 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser | ||
3761 | 20 | ** General Public License version 2.1 as published by the Free Software | ||
3762 | 21 | ** Foundation and appearing in the file LICENSE.LGPL included in the | ||
3763 | 22 | ** packaging of this file. Please review the following information to | ||
3764 | 23 | ** ensure the GNU Lesser General Public License version 2.1 requirements | ||
3765 | 24 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | ||
3766 | 25 | ** | ||
3767 | 26 | ** In addition, as a special exception, Digia gives you certain additional | ||
3768 | 27 | ** rights. These rights are described in the Digia Qt LGPL Exception | ||
3769 | 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | ||
3770 | 29 | ** | ||
3771 | 30 | ****************************************************************************/ | ||
3772 | 31 | |||
3773 | 32 | #include "blackberryapilevelconfiguration.h" | ||
3774 | 33 | #include "blackberryconfigurationmanager.h" | ||
3775 | 34 | #include "blackberryqtversion.h" | ||
3776 | 35 | |||
3777 | 36 | #include "qnxtoolchain.h" | ||
3778 | 37 | #include "qnxconstants.h" | ||
3779 | 38 | |||
3780 | 39 | #include <utils/qtcassert.h> | ||
3781 | 40 | |||
3782 | 41 | #include <projectexplorer/projectexplorerconstants.h> | ||
3783 | 42 | #include <projectexplorer/kitmanager.h> | ||
3784 | 43 | #include <projectexplorer/kitinformation.h> | ||
3785 | 44 | #include <projectexplorer/toolchainmanager.h> | ||
3786 | 45 | #include <projectexplorer/gcctoolchain.h> | ||
3787 | 46 | |||
3788 | 47 | #include <qtsupport/baseqtversion.h> | ||
3789 | 48 | #include <qtsupport/qtversionmanager.h> | ||
3790 | 49 | #include <qtsupport/qtkitinformation.h> | ||
3791 | 50 | |||
3792 | 51 | #include <qmakeprojectmanager/qmakekitinformation.h> | ||
3793 | 52 | |||
3794 | 53 | #include <debugger/debuggeritemmanager.h> | ||
3795 | 54 | #include <debugger/debuggerkitinformation.h> | ||
3796 | 55 | |||
3797 | 56 | #include <coreplugin/icore.h> | ||
3798 | 57 | |||
3799 | 58 | #include <QFileInfo> | ||
3800 | 59 | #include <QDir> | ||
3801 | 60 | #include <QMessageBox> | ||
3802 | 61 | |||
3803 | 62 | using namespace ProjectExplorer; | ||
3804 | 63 | using namespace QtSupport; | ||
3805 | 64 | using namespace Utils; | ||
3806 | 65 | using namespace Debugger; | ||
3807 | 66 | |||
3808 | 67 | namespace Qnx { | ||
3809 | 68 | namespace Internal { | ||
3810 | 69 | |||
3811 | 70 | const QLatin1String NDKEnvFileKey("NDKEnvFile"); | ||
3812 | 71 | const QLatin1String NDKPathKey("NDKPath"); | ||
3813 | 72 | const QLatin1String NDKDisplayNameKey("NDKDisplayName"); | ||
3814 | 73 | const QLatin1String NDKTargetKey("NDKTarget"); | ||
3815 | 74 | const QLatin1String NDKHostKey("NDKHost"); | ||
3816 | 75 | const QLatin1String NDKVersionKey("NDKVersion"); | ||
3817 | 76 | const QLatin1String NDKAutoDetectionSourceKey("NDKAutoDetectionSource"); | ||
3818 | 77 | const QLatin1String NDKAutoDetectedKey("NDKAutoDetectedKey"); | ||
3819 | 78 | |||
3820 | 79 | #ifdef WITH_TESTS | ||
3821 | 80 | bool BlackBerryApiLevelConfiguration::m_fakeConfig = false; | ||
3822 | 81 | #endif | ||
3823 | 82 | |||
3824 | 83 | BlackBerryApiLevelConfiguration::BlackBerryApiLevelConfiguration(const NdkInstallInformation &ndkInstallInfo) | ||
3825 | 84 | { | ||
3826 | 85 | QString envFilePath = QnxUtils::envFilePath(ndkInstallInfo.path, ndkInstallInfo.version); | ||
3827 | 86 | QTC_ASSERT(!envFilePath.isEmpty(), return); | ||
3828 | 87 | m_ndkEnvFile = Utils::FileName::fromString(envFilePath); | ||
3829 | 88 | m_displayName = ndkInstallInfo.name; | ||
3830 | 89 | m_qnxEnv = QnxUtils::qnxEnvironmentFromNdkFile(m_ndkEnvFile.toString()); | ||
3831 | 90 | QString sep = QString::fromLatin1("/qnx6"); | ||
3832 | 91 | // The QNX_TARGET value is using Unix-like separator on all platforms. | ||
3833 | 92 | m_targetName = ndkInstallInfo.target.split(sep).first().split(QLatin1Char('/')).last(); | ||
3834 | 93 | m_qnxHost = ndkInstallInfo.host; | ||
3835 | 94 | m_sysRoot = FileName::fromString(ndkInstallInfo.target); | ||
3836 | 95 | m_version = BlackBerryVersionNumber(ndkInstallInfo.version); | ||
3837 | 96 | m_autoDetectionSource = Utils::FileName::fromString(ndkInstallInfo.installationXmlFilePath); | ||
3838 | 97 | ctor(); | ||
3839 | 98 | } | ||
3840 | 99 | |||
3841 | 100 | BlackBerryApiLevelConfiguration::BlackBerryApiLevelConfiguration(const FileName &ndkEnvFile) | ||
3842 | 101 | : m_autoDetectionSource(Utils::FileName()) | ||
3843 | 102 | { | ||
3844 | 103 | QTC_ASSERT(!QFileInfo(ndkEnvFile.toString()).isDir(), return); | ||
3845 | 104 | m_ndkEnvFile = ndkEnvFile; | ||
3846 | 105 | QString ndkPath = m_ndkEnvFile.parentDir().toString(); | ||
3847 | 106 | m_displayName = ndkPath.split(QDir::separator()).last(); | ||
3848 | 107 | m_qnxEnv = QnxUtils::qnxEnvironmentFromNdkFile(m_ndkEnvFile.toString()); | ||
3849 | 108 | |||
3850 | 109 | QString ndkTarget; | ||
3851 | 110 | foreach (const Utils::EnvironmentItem &item, m_qnxEnv) { | ||
3852 | 111 | if (item.name == QLatin1String("QNX_TARGET")) | ||
3853 | 112 | ndkTarget = item.value; | ||
3854 | 113 | |||
3855 | 114 | else if (item.name == QLatin1String("QNX_HOST")) | ||
3856 | 115 | m_qnxHost = item.value; | ||
3857 | 116 | |||
3858 | 117 | } | ||
3859 | 118 | |||
3860 | 119 | // The QNX_TARGET value is using Unix-like separator on all platforms. | ||
3861 | 120 | QString sep = QString::fromLatin1("/qnx6"); | ||
3862 | 121 | m_targetName = ndkTarget.split(sep).first().split(QLatin1Char('/')).last(); | ||
3863 | 122 | |||
3864 | 123 | if (QDir(ndkTarget).exists()) | ||
3865 | 124 | m_sysRoot = FileName::fromString(ndkTarget); | ||
3866 | 125 | |||
3867 | 126 | m_version = BlackBerryVersionNumber::fromNdkEnvFileName(QFileInfo(m_ndkEnvFile.toString()).baseName()); | ||
3868 | 127 | if (m_version.isEmpty()) | ||
3869 | 128 | m_version = BlackBerryVersionNumber::fromTargetName(m_targetName); | ||
3870 | 129 | |||
3871 | 130 | ctor(); | ||
3872 | 131 | } | ||
3873 | 132 | |||
3874 | 133 | BlackBerryApiLevelConfiguration::BlackBerryApiLevelConfiguration(const QVariantMap &data) | ||
3875 | 134 | { | ||
3876 | 135 | QString envFilePath = data.value(NDKEnvFileKey).toString(); | ||
3877 | 136 | QTC_ASSERT(!envFilePath.isEmpty(), return); | ||
3878 | 137 | m_ndkEnvFile = Utils::FileName::fromString(envFilePath); | ||
3879 | 138 | m_displayName = data.value(NDKDisplayNameKey).toString(); | ||
3880 | 139 | m_qnxEnv = QnxUtils::qnxEnvironmentFromNdkFile(m_ndkEnvFile.toString()); | ||
3881 | 140 | QString sep = QString::fromLatin1("/qnx6"); | ||
3882 | 141 | // The QNX_TARGET value is using Unix-like separator on all platforms. | ||
3883 | 142 | m_targetName = data.value(NDKTargetKey).toString().split(sep).first().split(QLatin1Char('/')).last(); | ||
3884 | 143 | m_qnxHost = data.value(NDKHostKey).toString(); | ||
3885 | 144 | m_sysRoot = FileName::fromString(data.value(NDKTargetKey).toString()); | ||
3886 | 145 | m_version = BlackBerryVersionNumber(data.value(NDKVersionKey).toString()); | ||
3887 | 146 | if (data.value(QLatin1String(NDKAutoDetectedKey)).toBool()) | ||
3888 | 147 | m_autoDetectionSource = Utils::FileName::fromString(data.value(NDKAutoDetectionSourceKey).toString()); | ||
3889 | 148 | |||
3890 | 149 | ctor(); | ||
3891 | 150 | } | ||
3892 | 151 | |||
3893 | 152 | void BlackBerryApiLevelConfiguration::ctor() | ||
3894 | 153 | { | ||
3895 | 154 | FileName qmake4Path = QnxUtils::executableWithExtension(FileName::fromString(m_qnxHost + QLatin1String("/usr/bin/qmake"))); | ||
3896 | 155 | FileName qmake5Path = QnxUtils::executableWithExtension(FileName::fromString(m_qnxHost + QLatin1String("/usr/bin/qt5/qmake"))); | ||
3897 | 156 | FileName gccPath = QnxUtils::executableWithExtension(FileName::fromString(m_qnxHost + QLatin1String("/usr/bin/qcc"))); | ||
3898 | 157 | FileName deviceGdbPath = QnxUtils::executableWithExtension(FileName::fromString(m_qnxHost + QLatin1String("/usr/bin/ntoarm-gdb"))); | ||
3899 | 158 | FileName simulatorGdbPath = QnxUtils::executableWithExtension(FileName::fromString(m_qnxHost + QLatin1String("/usr/bin/ntox86-gdb"))); | ||
3900 | 159 | |||
3901 | 160 | if (qmake4Path.toFileInfo().exists()) | ||
3902 | 161 | m_qmake4BinaryFile = qmake4Path; | ||
3903 | 162 | |||
3904 | 163 | if (qmake5Path.toFileInfo().exists()) | ||
3905 | 164 | m_qmake5BinaryFile = qmake5Path; | ||
3906 | 165 | |||
3907 | 166 | if (gccPath.toFileInfo().exists()) | ||
3908 | 167 | m_gccCompiler = gccPath; | ||
3909 | 168 | |||
3910 | 169 | if (deviceGdbPath.toFileInfo().exists()) | ||
3911 | 170 | m_deviceDebugger = deviceGdbPath; | ||
3912 | 171 | |||
3913 | 172 | if (simulatorGdbPath.toFileInfo().exists()) | ||
3914 | 173 | m_simulatorDebugger = simulatorGdbPath; | ||
3915 | 174 | } | ||
3916 | 175 | |||
3917 | 176 | QString BlackBerryApiLevelConfiguration::ndkPath() const | ||
3918 | 177 | { | ||
3919 | 178 | return m_ndkEnvFile.parentDir().toString(); | ||
3920 | 179 | } | ||
3921 | 180 | |||
3922 | 181 | QString BlackBerryApiLevelConfiguration::displayName() const | ||
3923 | 182 | { | ||
3924 | 183 | return m_displayName; | ||
3925 | 184 | } | ||
3926 | 185 | |||
3927 | 186 | QString BlackBerryApiLevelConfiguration::targetName() const | ||
3928 | 187 | { | ||
3929 | 188 | return m_targetName; | ||
3930 | 189 | } | ||
3931 | 190 | |||
3932 | 191 | QString BlackBerryApiLevelConfiguration::qnxHost() const | ||
3933 | 192 | { | ||
3934 | 193 | return m_qnxHost; | ||
3935 | 194 | } | ||
3936 | 195 | |||
3937 | 196 | BlackBerryVersionNumber BlackBerryApiLevelConfiguration::version() const | ||
3938 | 197 | { | ||
3939 | 198 | return m_version; | ||
3940 | 199 | } | ||
3941 | 200 | |||
3942 | 201 | bool BlackBerryApiLevelConfiguration::isAutoDetected() const | ||
3943 | 202 | { | ||
3944 | 203 | return !m_autoDetectionSource.isEmpty(); | ||
3945 | 204 | } | ||
3946 | 205 | |||
3947 | 206 | Utils::FileName BlackBerryApiLevelConfiguration::autoDetectionSource() const | ||
3948 | 207 | { | ||
3949 | 208 | return m_autoDetectionSource; | ||
3950 | 209 | } | ||
3951 | 210 | |||
3952 | 211 | bool BlackBerryApiLevelConfiguration::isActive() const | ||
3953 | 212 | { | ||
3954 | 213 | foreach (Kit *kit, KitManager::kits()) { | ||
3955 | 214 | if (kit->isAutoDetected() && | ||
3956 | 215 | kit->autoDetectionSource() == m_ndkEnvFile.toString()) | ||
3957 | 216 | return true; | ||
3958 | 217 | } | ||
3959 | 218 | |||
3960 | 219 | return false; | ||
3961 | 220 | } | ||
3962 | 221 | |||
3963 | 222 | bool BlackBerryApiLevelConfiguration::isValid() const | ||
3964 | 223 | { | ||
3965 | 224 | #ifdef WITH_TESTS | ||
3966 | 225 | if (BlackBerryApiLevelConfiguration::fakeConfig()) | ||
3967 | 226 | return true; | ||
3968 | 227 | #endif | ||
3969 | 228 | |||
3970 | 229 | return ((!m_qmake4BinaryFile.isEmpty() || !m_qmake5BinaryFile.isEmpty()) && !m_gccCompiler.isEmpty() | ||
3971 | 230 | && !m_deviceDebugger.isEmpty() && !m_simulatorDebugger.isEmpty() | ||
3972 | 231 | && m_ndkEnvFile.toFileInfo().exists() && (m_autoDetectionSource.isEmpty() || | ||
3973 | 232 | m_autoDetectionSource.toFileInfo().exists()) | ||
3974 | 233 | && m_sysRoot.toFileInfo().exists()); | ||
3975 | 234 | } | ||
3976 | 235 | |||
3977 | 236 | FileName BlackBerryApiLevelConfiguration::ndkEnvFile() const | ||
3978 | 237 | { | ||
3979 | 238 | return m_ndkEnvFile; | ||
3980 | 239 | } | ||
3981 | 240 | |||
3982 | 241 | FileName BlackBerryApiLevelConfiguration::qmake4BinaryFile() const | ||
3983 | 242 | { | ||
3984 | 243 | return m_qmake4BinaryFile; | ||
3985 | 244 | } | ||
3986 | 245 | |||
3987 | 246 | FileName BlackBerryApiLevelConfiguration::qmake5BinaryFile() const | ||
3988 | 247 | { | ||
3989 | 248 | return m_qmake5BinaryFile; | ||
3990 | 249 | } | ||
3991 | 250 | |||
3992 | 251 | FileName BlackBerryApiLevelConfiguration::gccCompiler() const | ||
3993 | 252 | { | ||
3994 | 253 | return m_gccCompiler; | ||
3995 | 254 | } | ||
3996 | 255 | |||
3997 | 256 | FileName BlackBerryApiLevelConfiguration::deviceDebuger() const | ||
3998 | 257 | { | ||
3999 | 258 | return m_deviceDebugger; | ||
4000 | 259 | } | ||
4001 | 260 | |||
4002 | 261 | FileName BlackBerryApiLevelConfiguration::simulatorDebuger() const | ||
4003 | 262 | { | ||
4004 | 263 | return m_simulatorDebugger; | ||
4005 | 264 | } | ||
4006 | 265 | |||
4007 | 266 | FileName BlackBerryApiLevelConfiguration::sysRoot() const | ||
4008 | 267 | { | ||
4009 | 268 | return m_sysRoot; | ||
4010 | 269 | } | ||
4011 | 270 | |||
4012 | 271 | QList<Utils::EnvironmentItem> BlackBerryApiLevelConfiguration::qnxEnv() const | ||
4013 | 272 | { | ||
4014 | 273 | return m_qnxEnv; | ||
4015 | 274 | } | ||
4016 | 275 | |||
4017 | 276 | QVariantMap BlackBerryApiLevelConfiguration::toMap() const | ||
4018 | 277 | { | ||
4019 | 278 | QVariantMap data; | ||
4020 | 279 | data.insert(QLatin1String(Qnx::Constants::QNX_BB_KEY_CONFIGURATION_TYPE), | ||
4021 | 280 | QLatin1String(Qnx::Constants::QNX_BB_APILEVEL_TYPE)); | ||
4022 | 281 | data.insert(QLatin1String(NDKEnvFileKey), m_ndkEnvFile.toString()); | ||
4023 | 282 | data.insert(QLatin1String(NDKDisplayNameKey), m_displayName); | ||
4024 | 283 | data.insert(QLatin1String(NDKPathKey), ndkPath()); | ||
4025 | 284 | data.insert(QLatin1String(NDKTargetKey), m_sysRoot.toString()); | ||
4026 | 285 | data.insert(QLatin1String(NDKHostKey), m_qnxHost); | ||
4027 | 286 | data.insert(QLatin1String(NDKVersionKey), m_version.toString()); | ||
4028 | 287 | data.insert(QLatin1String(NDKAutoDetectionSourceKey), m_autoDetectionSource.toString()); | ||
4029 | 288 | data.insert(QLatin1String(NDKAutoDetectedKey), isAutoDetected()); | ||
4030 | 289 | return data; | ||
4031 | 290 | } | ||
4032 | 291 | |||
4033 | 292 | QnxAbstractQtVersion *BlackBerryApiLevelConfiguration::createQtVersion( | ||
4034 | 293 | const FileName &qmakePath, Qnx::QnxArchitecture arch, const QString &versionName) | ||
4035 | 294 | { | ||
4036 | 295 | QnxAbstractQtVersion *version = new BlackBerryQtVersion( | ||
4037 | 296 | arch, qmakePath, true, QString(), m_ndkEnvFile.toString()); | ||
4038 | 297 | version->setDisplayName(tr("Qt %1 for %2").arg(version->qtVersionString(), versionName)); | ||
4039 | 298 | QtVersionManager::addVersion(version); | ||
4040 | 299 | return version; | ||
4041 | 300 | } | ||
4042 | 301 | |||
4043 | 302 | QnxToolChain *BlackBerryApiLevelConfiguration::createToolChain( | ||
4044 | 303 | ProjectExplorer::Abi abi, const QString &versionName) | ||
4045 | 304 | { | ||
4046 | 305 | QnxToolChain* toolChain = new QnxToolChain(ToolChain::AutoDetection); | ||
4047 | 306 | toolChain->setDisplayName(tr("QCC for %1").arg(versionName)); | ||
4048 | 307 | toolChain->setCompilerCommand(m_gccCompiler); | ||
4049 | 308 | toolChain->setNdkPath(ndkPath()); | ||
4050 | 309 | if (abi.isValid()) | ||
4051 | 310 | toolChain->setTargetAbi(abi); | ||
4052 | 311 | ToolChainManager::registerToolChain(toolChain); | ||
4053 | 312 | return toolChain; | ||
4054 | 313 | } | ||
4055 | 314 | |||
4056 | 315 | QVariant BlackBerryApiLevelConfiguration::createDebuggerItem( | ||
4057 | 316 | QList<ProjectExplorer::Abi> abis, Qnx::QnxArchitecture arch, const QString &versionName) | ||
4058 | 317 | { | ||
4059 | 318 | Utils::FileName command = arch == X86 ? m_simulatorDebugger : m_deviceDebugger; | ||
4060 | 319 | DebuggerItem debugger; | ||
4061 | 320 | debugger.setCommand(command); | ||
4062 | 321 | debugger.setEngineType(GdbEngineType); | ||
4063 | 322 | debugger.setAutoDetected(true); | ||
4064 | 323 | debugger.setAbis(abis); | ||
4065 | 324 | debugger.setDisplayName(tr("Debugger for %1").arg(versionName)); | ||
4066 | 325 | return DebuggerItemManager::registerDebugger(debugger); | ||
4067 | 326 | } | ||
4068 | 327 | |||
4069 | 328 | Kit *BlackBerryApiLevelConfiguration::createKit( | ||
4070 | 329 | QnxAbstractQtVersion *version, QnxToolChain *toolChain, const QVariant &debuggerItemId) | ||
4071 | 330 | { | ||
4072 | 331 | Kit *kit = new Kit; | ||
4073 | 332 | bool isSimulator = version->architecture() == X86; | ||
4074 | 333 | |||
4075 | 334 | QtKitInformation::setQtVersion(kit, version); | ||
4076 | 335 | ToolChainKitInformation::setToolChain(kit, toolChain); | ||
4077 | 336 | |||
4078 | 337 | if (debuggerItemId.isValid()) | ||
4079 | 338 | DebuggerKitInformation::setDebugger(kit, debuggerItemId); | ||
4080 | 339 | |||
4081 | 340 | if (version->qtVersion().majorVersion == 4) { | ||
4082 | 341 | if (isSimulator) { | ||
4083 | 342 | QmakeProjectManager::QmakeKitInformation::setMkspec( | ||
4084 | 343 | kit, FileName::fromLatin1("blackberry-x86-qcc")); | ||
4085 | 344 | } else { | ||
4086 | 345 | QmakeProjectManager::QmakeKitInformation::setMkspec( | ||
4087 | 346 | kit, FileName::fromLatin1("blackberry-armv7le-qcc")); | ||
4088 | 347 | } | ||
4089 | 348 | } | ||
4090 | 349 | |||
4091 | 350 | DeviceTypeKitInformation::setDeviceTypeId(kit, Constants::QNX_BB_OS_TYPE); | ||
4092 | 351 | SysRootKitInformation::setSysRoot(kit, m_sysRoot); | ||
4093 | 352 | |||
4094 | 353 | kit->setDisplayName(version->displayName()); | ||
4095 | 354 | kit->setIconPath(FileName::fromString(QLatin1String(Constants::QNX_BB_CATEGORY_ICON))); | ||
4096 | 355 | |||
4097 | 356 | kit->setAutoDetected(true); | ||
4098 | 357 | kit->setAutoDetectionSource(m_ndkEnvFile.toString()); | ||
4099 | 358 | kit->setMutable(DeviceKitInformation::id(), true); | ||
4100 | 359 | |||
4101 | 360 | kit->setSticky(QtKitInformation::id(), true); | ||
4102 | 361 | kit->setSticky(ToolChainKitInformation::id(), true); | ||
4103 | 362 | kit->setSticky(DeviceTypeKitInformation::id(), true); | ||
4104 | 363 | kit->setSticky(SysRootKitInformation::id(), true); | ||
4105 | 364 | kit->setSticky(DebuggerKitInformation::id(), true); | ||
4106 | 365 | kit->setSticky(QmakeProjectManager::QmakeKitInformation::id(), true); | ||
4107 | 366 | |||
4108 | 367 | KitManager::registerKit(kit); | ||
4109 | 368 | return kit; | ||
4110 | 369 | } | ||
4111 | 370 | |||
4112 | 371 | bool BlackBerryApiLevelConfiguration::activate() | ||
4113 | 372 | { | ||
4114 | 373 | if (!isValid()) { | ||
4115 | 374 | if (!m_autoDetectionSource.isEmpty()) | ||
4116 | 375 | return false; | ||
4117 | 376 | |||
4118 | 377 | QString errorMessage = tr("The following errors occurred while activating target: %1").arg(m_targetName); | ||
4119 | 378 | if (m_qmake4BinaryFile.isEmpty() && m_qmake5BinaryFile.isEmpty()) | ||
4120 | 379 | errorMessage += QLatin1Char('\n') + tr("- No Qt version found."); | ||
4121 | 380 | |||
4122 | 381 | if (m_gccCompiler.isEmpty()) | ||
4123 | 382 | errorMessage += QLatin1Char('\n') + tr("- No GCC compiler found."); | ||
4124 | 383 | |||
4125 | 384 | if (m_deviceDebugger.isEmpty()) | ||
4126 | 385 | errorMessage += QLatin1Char('\n') + tr("- No GDB debugger found for BB10 Device."); | ||
4127 | 386 | |||
4128 | 387 | if (!m_simulatorDebugger.isEmpty()) | ||
4129 | 388 | errorMessage += QLatin1Char('\n') + tr("- No GDB debugger found for BB10 Simulator."); | ||
4130 | 389 | |||
4131 | 390 | QMessageBox::warning(Core::ICore::mainWindow(), tr("Cannot Set up BB10 Configuration"), | ||
4132 | 391 | errorMessage, QMessageBox::Ok); | ||
4133 | 392 | return false; | ||
4134 | 393 | } | ||
4135 | 394 | |||
4136 | 395 | if (isActive()) | ||
4137 | 396 | return true; | ||
4138 | 397 | |||
4139 | 398 | deactivate(); // cleaning-up artifacts autodetected by old QtCreator versions | ||
4140 | 399 | |||
4141 | 400 | QString armVersionName = tr("BlackBerry %1 Device").arg(m_version.toString()); | ||
4142 | 401 | QString x86VersionName = tr("BlackBerry %1 Simulator").arg(m_version.toString()); | ||
4143 | 402 | |||
4144 | 403 | // create versions | ||
4145 | 404 | QnxAbstractQtVersion *qt4ArmVersion = 0; | ||
4146 | 405 | QnxAbstractQtVersion *qt4X86Version = 0; | ||
4147 | 406 | QnxAbstractQtVersion *qt5ArmVersion = 0; | ||
4148 | 407 | QnxAbstractQtVersion *qt5X86Version = 0; | ||
4149 | 408 | QList<Abi> armAbis; | ||
4150 | 409 | QList<Abi> x86Abis; | ||
4151 | 410 | |||
4152 | 411 | if (!m_qmake4BinaryFile.isEmpty()) { | ||
4153 | 412 | qt4ArmVersion = createQtVersion(m_qmake4BinaryFile, Qnx::ArmLeV7, armVersionName); | ||
4154 | 413 | armAbis << qt4ArmVersion->qtAbis(); | ||
4155 | 414 | qt4X86Version = createQtVersion(m_qmake4BinaryFile, Qnx::X86, x86VersionName); | ||
4156 | 415 | x86Abis << qt4X86Version->qtAbis(); | ||
4157 | 416 | } | ||
4158 | 417 | if (!m_qmake5BinaryFile.isEmpty()) { | ||
4159 | 418 | qt5ArmVersion = createQtVersion(m_qmake5BinaryFile, Qnx::ArmLeV7, armVersionName); | ||
4160 | 419 | foreach (Abi abi, qt5ArmVersion->qtAbis()) | ||
4161 | 420 | if (!armAbis.contains(abi)) | ||
4162 | 421 | armAbis << abi; | ||
4163 | 422 | qt5X86Version = createQtVersion(m_qmake5BinaryFile, Qnx::X86, x86VersionName); | ||
4164 | 423 | foreach (Abi abi, qt5X86Version->qtAbis()) | ||
4165 | 424 | if (!x86Abis.contains(abi)) | ||
4166 | 425 | x86Abis << abi; | ||
4167 | 426 | } | ||
4168 | 427 | |||
4169 | 428 | // create toolchains | ||
4170 | 429 | QnxToolChain *armToolChain = createToolChain( | ||
4171 | 430 | !armAbis.isEmpty() ? armAbis.first() : Abi(), armVersionName); | ||
4172 | 431 | QnxToolChain *x86ToolChain = createToolChain( | ||
4173 | 432 | !x86Abis.isEmpty() ? x86Abis.first() : Abi(), x86VersionName); | ||
4174 | 433 | |||
4175 | 434 | // create debuggers | ||
4176 | 435 | QVariant armDebuggerItemId = createDebuggerItem(armAbis, Qnx::ArmLeV7, armVersionName); | ||
4177 | 436 | QVariant x86DebuggerItemId = createDebuggerItem(x86Abis, Qnx::X86, x86VersionName); | ||
4178 | 437 | |||
4179 | 438 | // create kits | ||
4180 | 439 | if (qt4ArmVersion) | ||
4181 | 440 | createKit(qt4ArmVersion, armToolChain, armDebuggerItemId); | ||
4182 | 441 | if (qt4X86Version) | ||
4183 | 442 | createKit(qt4X86Version, x86ToolChain, x86DebuggerItemId); | ||
4184 | 443 | if (qt5ArmVersion) | ||
4185 | 444 | createKit(qt5ArmVersion, armToolChain, armDebuggerItemId); | ||
4186 | 445 | if (qt5X86Version) | ||
4187 | 446 | createKit(qt5X86Version, x86ToolChain, x86DebuggerItemId); | ||
4188 | 447 | |||
4189 | 448 | BlackBerryConfigurationManager::instance()->emitSettingsChanged(); | ||
4190 | 449 | |||
4191 | 450 | return true; | ||
4192 | 451 | } | ||
4193 | 452 | |||
4194 | 453 | void BlackBerryApiLevelConfiguration::deactivate() | ||
4195 | 454 | { | ||
4196 | 455 | QList<BaseQtVersion *> qtvToRemove; | ||
4197 | 456 | QList<ToolChain *> tcToRemove; | ||
4198 | 457 | QList<const DebuggerItem *> dbgToRemove; | ||
4199 | 458 | |||
4200 | 459 | foreach (Kit *kit, KitManager::kits()) { | ||
4201 | 460 | if (kit->isAutoDetected() && | ||
4202 | 461 | kit->autoDetectionSource() == ndkEnvFile().toString()) { | ||
4203 | 462 | BaseQtVersion *version = QtKitInformation::qtVersion(kit); | ||
4204 | 463 | ToolChain *toolChain = ToolChainKitInformation::toolChain(kit); | ||
4205 | 464 | const DebuggerItem *debugger = DebuggerKitInformation::debugger(kit); | ||
4206 | 465 | // Kit's Qt version, tool chain or debugger might be used by other BB kits | ||
4207 | 466 | // generated for the same API level that are not yet unregistered. This triggers warning outputs. | ||
4208 | 467 | // Let's unregistered/removed them later once all API level kits are unregistered. | ||
4209 | 468 | if (version && !qtvToRemove.contains(version)) | ||
4210 | 469 | qtvToRemove << version; | ||
4211 | 470 | if (toolChain && !tcToRemove.contains(toolChain)) | ||
4212 | 471 | tcToRemove << toolChain; | ||
4213 | 472 | if (debugger && !dbgToRemove.contains(debugger)) | ||
4214 | 473 | dbgToRemove << debugger; | ||
4215 | 474 | |||
4216 | 475 | KitManager::deregisterKit(kit); | ||
4217 | 476 | } | ||
4218 | 477 | } | ||
4219 | 478 | |||
4220 | 479 | foreach (BaseQtVersion *qtv, qtvToRemove) | ||
4221 | 480 | QtVersionManager::removeVersion(qtv); | ||
4222 | 481 | |||
4223 | 482 | foreach (ToolChain *tc, tcToRemove) | ||
4224 | 483 | ToolChainManager::deregisterToolChain(tc); | ||
4225 | 484 | |||
4226 | 485 | foreach (const DebuggerItem *debugger, dbgToRemove) | ||
4227 | 486 | DebuggerItemManager::deregisterDebugger(debugger->id()); | ||
4228 | 487 | |||
4229 | 488 | BlackBerryConfigurationManager::instance()->emitSettingsChanged(); | ||
4230 | 489 | } | ||
4231 | 490 | |||
4232 | 491 | #ifdef WITH_TESTS | ||
4233 | 492 | void BlackBerryApiLevelConfiguration::setFakeConfig(bool fakeConfig) | ||
4234 | 493 | { | ||
4235 | 494 | m_fakeConfig = fakeConfig; | ||
4236 | 495 | } | ||
4237 | 496 | |||
4238 | 497 | bool BlackBerryApiLevelConfiguration::fakeConfig() | ||
4239 | 498 | { | ||
4240 | 499 | return m_fakeConfig; | ||
4241 | 500 | } | ||
4242 | 501 | #endif | ||
4243 | 502 | |||
4244 | 503 | } // namespace Internal | ||
4245 | 504 | } // namespace Qnx | ||
4246 | 0 | 505 | ||
4247 | === added file 'src/qnx/blackberryapilevelconfiguration.h' | |||
4248 | --- src/qnx/blackberryapilevelconfiguration.h 1970-01-01 00:00:00 +0000 | |||
4249 | +++ src/qnx/blackberryapilevelconfiguration.h 2014-06-16 09:46:37 +0000 | |||
4250 | @@ -0,0 +1,125 @@ | |||
4251 | 1 | /************************************************************************** | ||
4252 | 2 | ** | ||
4253 | 3 | ** Copyright (C) 2014 BlackBerry Limited. All rights reserved. | ||
4254 | 4 | ** | ||
4255 | 5 | ** Contact: BlackBerry (qt@blackberry.com) | ||
4256 | 6 | ** Contact: KDAB (info@kdab.com) | ||
4257 | 7 | ** | ||
4258 | 8 | ** This file is part of Qt Creator. | ||
4259 | 9 | ** | ||
4260 | 10 | ** Commercial License Usage | ||
4261 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in | ||
4262 | 12 | ** accordance with the commercial license agreement provided with the | ||
4263 | 13 | ** Software or, alternatively, in accordance with the terms contained in | ||
4264 | 14 | ** a written agreement between you and Digia. For licensing terms and | ||
4265 | 15 | ** conditions see http://qt.digia.com/licensing. For further information | ||
4266 | 16 | ** use the contact form at http://qt.digia.com/contact-us. | ||
4267 | 17 | ** | ||
4268 | 18 | ** GNU Lesser General Public License Usage | ||
4269 | 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser | ||
4270 | 20 | ** General Public License version 2.1 as published by the Free Software | ||
4271 | 21 | ** Foundation and appearing in the file LICENSE.LGPL included in the | ||
4272 | 22 | ** packaging of this file. Please review the following information to | ||
4273 | 23 | ** ensure the GNU Lesser General Public License version 2.1 requirements | ||
4274 | 24 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | ||
4275 | 25 | ** | ||
4276 | 26 | ** In addition, as a special exception, Digia gives you certain additional | ||
4277 | 27 | ** rights. These rights are described in the Digia Qt LGPL Exception | ||
4278 | 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | ||
4279 | 29 | ** | ||
4280 | 30 | ****************************************************************************/ | ||
4281 | 31 | |||
4282 | 32 | #ifndef BLACKBERRYCONFIGURATIONS_H | ||
4283 | 33 | #define BLACKBERRYCONFIGURATIONS_H | ||
4284 | 34 | |||
4285 | 35 | #include "qnxutils.h" | ||
4286 | 36 | #include "blackberryversionnumber.h" | ||
4287 | 37 | #include "qnxconstants.h" | ||
4288 | 38 | |||
4289 | 39 | #include <utils/environment.h> | ||
4290 | 40 | #include <utils/fileutils.h> | ||
4291 | 41 | |||
4292 | 42 | #include <projectexplorer/abi.h> | ||
4293 | 43 | #include <projectexplorer/kit.h> | ||
4294 | 44 | |||
4295 | 45 | #include <QObject> | ||
4296 | 46 | #include <QCoreApplication> | ||
4297 | 47 | |||
4298 | 48 | namespace QtSupport { class BaseQtVersion; } | ||
4299 | 49 | namespace Debugger { class DebuggerItem; } | ||
4300 | 50 | |||
4301 | 51 | namespace Qnx { | ||
4302 | 52 | namespace Internal { | ||
4303 | 53 | |||
4304 | 54 | class QnxAbstractQtVersion; | ||
4305 | 55 | class QnxToolChain; | ||
4306 | 56 | |||
4307 | 57 | class BlackBerryApiLevelConfiguration | ||
4308 | 58 | { | ||
4309 | 59 | Q_DECLARE_TR_FUNCTIONS(Qnx::Internal::BlackBerryApiLevelConfiguration) | ||
4310 | 60 | public: | ||
4311 | 61 | BlackBerryApiLevelConfiguration(const NdkInstallInformation &ndkInstallInfo); | ||
4312 | 62 | BlackBerryApiLevelConfiguration(const Utils::FileName &ndkEnvFile); | ||
4313 | 63 | BlackBerryApiLevelConfiguration(const QVariantMap &data); | ||
4314 | 64 | bool activate(); | ||
4315 | 65 | void deactivate(); | ||
4316 | 66 | QString ndkPath() const; | ||
4317 | 67 | QString displayName() const; | ||
4318 | 68 | QString targetName() const; | ||
4319 | 69 | QString qnxHost() const; | ||
4320 | 70 | BlackBerryVersionNumber version() const; | ||
4321 | 71 | bool isAutoDetected() const; | ||
4322 | 72 | Utils::FileName autoDetectionSource() const; | ||
4323 | 73 | bool isActive() const; | ||
4324 | 74 | bool isValid() const; | ||
4325 | 75 | Utils::FileName ndkEnvFile() const; | ||
4326 | 76 | Utils::FileName qmake4BinaryFile() const; | ||
4327 | 77 | Utils::FileName qmake5BinaryFile() const; | ||
4328 | 78 | Utils::FileName gccCompiler() const; | ||
4329 | 79 | Utils::FileName deviceDebuger() const; | ||
4330 | 80 | Utils::FileName simulatorDebuger() const; | ||
4331 | 81 | Utils::FileName sysRoot() const; | ||
4332 | 82 | QList<Utils::EnvironmentItem> qnxEnv() const; | ||
4333 | 83 | QVariantMap toMap() const; | ||
4334 | 84 | |||
4335 | 85 | #ifdef WITH_TESTS | ||
4336 | 86 | static void setFakeConfig(bool fakeConfig); | ||
4337 | 87 | static bool fakeConfig(); | ||
4338 | 88 | #endif | ||
4339 | 89 | |||
4340 | 90 | private: | ||
4341 | 91 | QString m_displayName; | ||
4342 | 92 | QString m_targetName; | ||
4343 | 93 | QString m_qnxHost; | ||
4344 | 94 | BlackBerryVersionNumber m_version; | ||
4345 | 95 | Utils::FileName m_autoDetectionSource; | ||
4346 | 96 | Utils::FileName m_ndkEnvFile; | ||
4347 | 97 | Utils::FileName m_qmake4BinaryFile; | ||
4348 | 98 | Utils::FileName m_qmake5BinaryFile; | ||
4349 | 99 | Utils::FileName m_gccCompiler; | ||
4350 | 100 | Utils::FileName m_deviceDebugger; | ||
4351 | 101 | Utils::FileName m_simulatorDebugger; | ||
4352 | 102 | Utils::FileName m_sysRoot; | ||
4353 | 103 | QList<Utils::EnvironmentItem> m_qnxEnv; | ||
4354 | 104 | |||
4355 | 105 | void ctor(); | ||
4356 | 106 | |||
4357 | 107 | QnxAbstractQtVersion* createQtVersion( | ||
4358 | 108 | const Utils::FileName &qmakePath, Qnx::QnxArchitecture arch, const QString &versionName); | ||
4359 | 109 | QnxToolChain* createToolChain( | ||
4360 | 110 | ProjectExplorer::Abi abi, const QString &versionName); | ||
4361 | 111 | QVariant createDebuggerItem( | ||
4362 | 112 | QList<ProjectExplorer::Abi> abis, Qnx::QnxArchitecture arch, const QString &versionName); | ||
4363 | 113 | ProjectExplorer::Kit* createKit( | ||
4364 | 114 | QnxAbstractQtVersion* version, QnxToolChain* toolChain, | ||
4365 | 115 | const QVariant &debuggerItemId); | ||
4366 | 116 | |||
4367 | 117 | #ifdef WITH_TESTS | ||
4368 | 118 | static bool m_fakeConfig; | ||
4369 | 119 | #endif | ||
4370 | 120 | }; | ||
4371 | 121 | |||
4372 | 122 | } // namespace Internal | ||
4373 | 123 | } // namespace Qnx | ||
4374 | 124 | |||
4375 | 125 | #endif // BLACKBERRYCONFIGURATIONS_H | ||
4376 | 0 | 126 | ||
4377 | === modified file 'src/qnx/blackberryapplicationrunner.cpp' | |||
4378 | --- src/qnx/blackberryapplicationrunner.cpp 2014-03-18 10:51:43 +0000 | |||
4379 | +++ src/qnx/blackberryapplicationrunner.cpp 2014-06-16 09:46:37 +0000 | |||
4380 | @@ -35,17 +35,25 @@ | |||
4381 | 35 | #include "blackberrydeviceconnectionmanager.h" | 35 | #include "blackberrydeviceconnectionmanager.h" |
4382 | 36 | #include "blackberryrunconfiguration.h" | 36 | #include "blackberryrunconfiguration.h" |
4383 | 37 | #include "blackberrylogprocessrunner.h" | 37 | #include "blackberrylogprocessrunner.h" |
4384 | 38 | #include "blackberrydeviceinformation.h" | ||
4385 | 38 | #include "qnxconstants.h" | 39 | #include "qnxconstants.h" |
4386 | 39 | 40 | ||
4387 | 41 | #include <coreplugin/icore.h> | ||
4388 | 42 | #include <projectexplorer/kit.h> | ||
4389 | 40 | #include <projectexplorer/target.h> | 43 | #include <projectexplorer/target.h> |
4390 | 41 | #include <qmakeprojectmanager/qmakebuildconfiguration.h> | 44 | #include <qmakeprojectmanager/qmakebuildconfiguration.h> |
4391 | 45 | #include <debugger/debuggerrunconfigurationaspect.h> | ||
4392 | 42 | #include <ssh/sshremoteprocessrunner.h> | 46 | #include <ssh/sshremoteprocessrunner.h> |
4393 | 43 | #include <utils/qtcassert.h> | 47 | #include <utils/qtcassert.h> |
4394 | 44 | 48 | ||
4395 | 49 | #include <QMessageBox> | ||
4396 | 45 | #include <QTimer> | 50 | #include <QTimer> |
4397 | 46 | #include <QDir> | 51 | #include <QDir> |
4398 | 52 | #include <QTemporaryFile> | ||
4399 | 47 | 53 | ||
4400 | 48 | namespace { | 54 | namespace { |
4401 | 55 | enum { debugCheckQmlJSArgs = 0 }; | ||
4402 | 56 | |||
4403 | 49 | bool parseRunningState(const QString &line) | 57 | bool parseRunningState(const QString &line) |
4404 | 50 | { | 58 | { |
4405 | 51 | QTC_ASSERT(line.startsWith(QLatin1String("result::")), return false); | 59 | QTC_ASSERT(line.startsWith(QLatin1String("result::")), return false); |
4406 | @@ -57,18 +65,21 @@ | |||
4407 | 57 | using namespace Qnx; | 65 | using namespace Qnx; |
4408 | 58 | using namespace Qnx::Internal; | 66 | using namespace Qnx::Internal; |
4409 | 59 | 67 | ||
4411 | 60 | BlackBerryApplicationRunner::BlackBerryApplicationRunner(bool debugMode, BlackBerryRunConfiguration *runConfiguration, QObject *parent) | 68 | BlackBerryApplicationRunner::BlackBerryApplicationRunner(const BlackBerryApplicationRunner::LaunchFlags &launchFlags, BlackBerryRunConfiguration *runConfiguration, QObject *parent) |
4412 | 61 | : QObject(parent) | 69 | : QObject(parent) |
4414 | 62 | , m_debugMode(debugMode) | 70 | , m_launchFlags(launchFlags) |
4415 | 63 | , m_pid(-1) | 71 | , m_pid(-1) |
4416 | 64 | , m_appId(QString()) | 72 | , m_appId(QString()) |
4417 | 65 | , m_running(false) | 73 | , m_running(false) |
4418 | 66 | , m_stopping(false) | 74 | , m_stopping(false) |
4419 | 67 | , m_launchProcess(0) | 75 | , m_launchProcess(0) |
4420 | 68 | , m_stopProcess(0) | 76 | , m_stopProcess(0) |
4421 | 77 | , m_deviceInfo(0) | ||
4422 | 69 | , m_logProcessRunner(0) | 78 | , m_logProcessRunner(0) |
4423 | 70 | , m_runningStateTimer(new QTimer(this)) | 79 | , m_runningStateTimer(new QTimer(this)) |
4424 | 71 | , m_runningStateProcess(0) | 80 | , m_runningStateProcess(0) |
4425 | 81 | , m_qmlDebugServerPort(0) | ||
4426 | 82 | , m_checkQmlJsDebugArgumentsProcess(0) | ||
4427 | 72 | { | 83 | { |
4428 | 73 | QTC_ASSERT(runConfiguration, return); | 84 | QTC_ASSERT(runConfiguration, return); |
4429 | 74 | 85 | ||
4430 | @@ -77,6 +88,9 @@ | |||
4431 | 77 | m_environment = buildConfig->environment(); | 88 | m_environment = buildConfig->environment(); |
4432 | 78 | m_deployCmd = m_environment.searchInPath(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD)); | 89 | m_deployCmd = m_environment.searchInPath(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD)); |
4433 | 79 | 90 | ||
4434 | 91 | QFileInfo fi(target->kit()->autoDetectionSource()); | ||
4435 | 92 | m_bbApiLevelVersion = BlackBerryVersionNumber::fromNdkEnvFileName(fi.baseName()); | ||
4436 | 93 | |||
4437 | 80 | m_device = BlackBerryDeviceConfiguration::device(target->kit()); | 94 | m_device = BlackBerryDeviceConfiguration::device(target->kit()); |
4438 | 81 | m_barPackage = runConfiguration->barPackage(); | 95 | m_barPackage = runConfiguration->barPackage(); |
4439 | 82 | 96 | ||
4440 | @@ -84,6 +98,11 @@ | |||
4441 | 84 | m_sshParams = m_device->sshParameters(); | 98 | m_sshParams = m_device->sshParameters(); |
4442 | 85 | m_sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationTypePublicKey; | 99 | m_sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationTypePublicKey; |
4443 | 86 | 100 | ||
4444 | 101 | Debugger::DebuggerRunConfigurationAspect *aspect = | ||
4445 | 102 | runConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>(); | ||
4446 | 103 | if (aspect) | ||
4447 | 104 | m_qmlDebugServerPort = aspect->qmlDebugServerPort(); | ||
4448 | 105 | |||
4449 | 87 | m_runningStateTimer->setInterval(3000); | 106 | m_runningStateTimer->setInterval(3000); |
4450 | 88 | m_runningStateTimer->setSingleShot(true); | 107 | m_runningStateTimer->setSingleShot(true); |
4451 | 89 | connect(m_runningStateTimer, SIGNAL(timeout()), this, SLOT(determineRunningState())); | 108 | connect(m_runningStateTimer, SIGNAL(timeout()), this, SLOT(determineRunningState())); |
4452 | @@ -97,14 +116,14 @@ | |||
4453 | 97 | { | 116 | { |
4454 | 98 | if (!BlackBerryDeviceConnectionManager::instance()->isConnected(m_device->id())) { | 117 | if (!BlackBerryDeviceConnectionManager::instance()->isConnected(m_device->id())) { |
4455 | 99 | connect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(deviceConnected()), | 118 | connect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(deviceConnected()), |
4457 | 100 | this, SLOT(launchApplication())); | 119 | this, SLOT(checkDeployMode())); |
4458 | 101 | connect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(deviceDisconnected(Core::Id)), | 120 | connect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(deviceDisconnected(Core::Id)), |
4459 | 102 | this, SLOT(disconnectFromDeviceSignals(Core::Id))); | 121 | this, SLOT(disconnectFromDeviceSignals(Core::Id))); |
4460 | 103 | connect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(connectionOutput(Core::Id,QString)), | 122 | connect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(connectionOutput(Core::Id,QString)), |
4461 | 104 | this, SLOT(displayConnectionOutput(Core::Id,QString))); | 123 | this, SLOT(displayConnectionOutput(Core::Id,QString))); |
4462 | 105 | BlackBerryDeviceConnectionManager::instance()->connectDevice(m_device->id()); | 124 | BlackBerryDeviceConnectionManager::instance()->connectDevice(m_device->id()); |
4463 | 106 | } else { | 125 | } else { |
4465 | 107 | launchApplication(); | 126 | checkDeployMode(); |
4466 | 108 | } | 127 | } |
4467 | 109 | } | 128 | } |
4468 | 110 | 129 | ||
4469 | @@ -131,6 +150,52 @@ | |||
4470 | 131 | emit output(msg, Utils::StdErrFormat); | 150 | emit output(msg, Utils::StdErrFormat); |
4471 | 132 | } | 151 | } |
4472 | 133 | 152 | ||
4473 | 153 | void BlackBerryApplicationRunner::checkDeviceRuntimeVersion(int status) | ||
4474 | 154 | { | ||
4475 | 155 | if (status != BlackBerryNdkProcess::Success) { | ||
4476 | 156 | emit output(tr("Cannot determine device runtime version."), Utils::StdErrFormat); | ||
4477 | 157 | return; | ||
4478 | 158 | } | ||
4479 | 159 | |||
4480 | 160 | if (m_bbApiLevelVersion.isEmpty()) { | ||
4481 | 161 | emit output(tr("Cannot determine API level version."), Utils::StdErrFormat); | ||
4482 | 162 | checkQmlJsDebugArguments(); | ||
4483 | 163 | return; | ||
4484 | 164 | } | ||
4485 | 165 | |||
4486 | 166 | const QString runtimeVersion = m_deviceInfo->scmBundle(); | ||
4487 | 167 | if (m_bbApiLevelVersion.toString() != runtimeVersion) { | ||
4488 | 168 | const QMessageBox::StandardButton answer = | ||
4489 | 169 | QMessageBox::question(Core::ICore::mainWindow(), | ||
4490 | 170 | tr("Confirmation"), | ||
4491 | 171 | tr("The device runtime version(%1) does not match " | ||
4492 | 172 | "the API level version(%2).\n" | ||
4493 | 173 | "This may cause unexpected behavior when debugging.\n" | ||
4494 | 174 | "Do you want to continue anyway?") | ||
4495 | 175 | .arg(runtimeVersion, m_bbApiLevelVersion.toString()), | ||
4496 | 176 | QMessageBox::Yes | QMessageBox::No); | ||
4497 | 177 | |||
4498 | 178 | if (answer == QMessageBox::No) { | ||
4499 | 179 | emit startFailed(tr("API level version does not match Runtime version.")); | ||
4500 | 180 | return; | ||
4501 | 181 | } | ||
4502 | 182 | } | ||
4503 | 183 | |||
4504 | 184 | checkQmlJsDebugArguments(); | ||
4505 | 185 | } | ||
4506 | 186 | |||
4507 | 187 | void BlackBerryApplicationRunner::queryDeviceInformation() | ||
4508 | 188 | { | ||
4509 | 189 | if (!m_deviceInfo) { | ||
4510 | 190 | m_deviceInfo = new BlackBerryDeviceInformation(this); | ||
4511 | 191 | connect(m_deviceInfo, SIGNAL(finished(int)), | ||
4512 | 192 | this, SLOT(checkDeviceRuntimeVersion(int))); | ||
4513 | 193 | } | ||
4514 | 194 | |||
4515 | 195 | m_deviceInfo->setDeviceTarget(m_sshParams.host, m_sshParams.password); | ||
4516 | 196 | emit output(tr("Querying device runtime version..."), Utils::StdOutFormat); | ||
4517 | 197 | } | ||
4518 | 198 | |||
4519 | 134 | void BlackBerryApplicationRunner::startFinished(int exitCode, QProcess::ExitStatus exitStatus) | 199 | void BlackBerryApplicationRunner::startFinished(int exitCode, QProcess::ExitStatus exitStatus) |
4520 | 135 | { | 200 | { |
4521 | 136 | if (exitCode == 0 && exitStatus == QProcess::NormalExit && m_pid > -1) { | 201 | if (exitCode == 0 && exitStatus == QProcess::NormalExit && m_pid > -1) { |
4522 | @@ -219,7 +284,7 @@ | |||
4523 | 219 | { | 284 | { |
4524 | 220 | if (m_device->id() == deviceId) { | 285 | if (m_device->id() == deviceId) { |
4525 | 221 | disconnect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(deviceConnected()), | 286 | disconnect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(deviceConnected()), |
4527 | 222 | this, SLOT(launchApplication())); | 287 | this, SLOT(checkDeployMode())); |
4528 | 223 | disconnect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(deviceDisconnected(Core::Id)), | 288 | disconnect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(deviceDisconnected(Core::Id)), |
4529 | 224 | this, SLOT(disconnectFromDeviceSignals(Core::Id))); | 289 | this, SLOT(disconnectFromDeviceSignals(Core::Id))); |
4530 | 225 | disconnect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(connectionOutput(Core::Id,QString)), | 290 | disconnect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(connectionOutput(Core::Id,QString)), |
4531 | @@ -237,6 +302,105 @@ | |||
4532 | 237 | m_appId = applicationId; | 302 | m_appId = applicationId; |
4533 | 238 | } | 303 | } |
4534 | 239 | 304 | ||
4535 | 305 | void BlackBerryApplicationRunner::checkQmlJsDebugArguments() | ||
4536 | 306 | { | ||
4537 | 307 | if (!m_launchFlags.testFlag(QmlDebugLaunch)) { | ||
4538 | 308 | // no need to change anytning in app manifest for this kind of run | ||
4539 | 309 | launchApplication(); | ||
4540 | 310 | } | ||
4541 | 311 | |||
4542 | 312 | emit output(tr("Checking qmljsdebugger command line argument."), Utils::StdOutFormat); | ||
4543 | 313 | QString nativePackagerCmd = m_environment.searchInPath(QLatin1String("blackberry-nativepackager")); | ||
4544 | 314 | if (nativePackagerCmd.isEmpty()) { | ||
4545 | 315 | emit output(tr("Cannot find Native Packager executable."), Utils::StdErrFormat); | ||
4546 | 316 | return; | ||
4547 | 317 | } | ||
4548 | 318 | |||
4549 | 319 | m_checkQmlJsDebugArgumentsProcess = new QProcess(this); | ||
4550 | 320 | connect(m_checkQmlJsDebugArgumentsProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(checkQmlJsDebugArgumentsManifestLoaded())); | ||
4551 | 321 | connect(m_checkQmlJsDebugArgumentsProcess, SIGNAL(finished(int)), this, SLOT(checkQmlJsDebugArgumentsManifestLoaded())); | ||
4552 | 322 | |||
4553 | 323 | QStringList args; | ||
4554 | 324 | args << QLatin1String("-listManifest") << QDir::toNativeSeparators(m_barPackage); | ||
4555 | 325 | if (debugCheckQmlJSArgs) | ||
4556 | 326 | qDebug() << "get manifest:" << nativePackagerCmd << args.join(QLatin1String(" ")); | ||
4557 | 327 | m_checkQmlJsDebugArgumentsProcess->start(nativePackagerCmd, args); | ||
4558 | 328 | } | ||
4559 | 329 | |||
4560 | 330 | void BlackBerryApplicationRunner::checkQmlJsDebugArgumentsManifestLoaded() | ||
4561 | 331 | { | ||
4562 | 332 | m_checkQmlJsDebugArgumentsProcess->deleteLater(); | ||
4563 | 333 | |||
4564 | 334 | if (m_checkQmlJsDebugArgumentsProcess->exitStatus() != QProcess::NormalExit) { | ||
4565 | 335 | emit output(tr("Cannot read bar package manifest."), Utils::StdErrFormat); | ||
4566 | 336 | qWarning() << "Cannot read bar package manifest:" << m_checkQmlJsDebugArgumentsProcess->errorString(); | ||
4567 | 337 | qWarning() << m_checkQmlJsDebugArgumentsProcess->readAllStandardError(); | ||
4568 | 338 | return; | ||
4569 | 339 | } | ||
4570 | 340 | |||
4571 | 341 | QString manifestContent = QString::fromUtf8(m_checkQmlJsDebugArgumentsProcess->readAllStandardOutput()); | ||
4572 | 342 | |||
4573 | 343 | QRegExp rxEoln(QLatin1String("(\\r\\n|\\n|\\r)")); | ||
4574 | 344 | QStringList manifestLines = manifestContent.split(rxEoln); | ||
4575 | 345 | |||
4576 | 346 | QMutableListIterator<QString> it(manifestLines); | ||
4577 | 347 | QLatin1String entryPoint("Entry-Point: "); | ||
4578 | 348 | while (it.hasNext()) { | ||
4579 | 349 | it.next(); | ||
4580 | 350 | if (it.value().startsWith(entryPoint)) { | ||
4581 | 351 | while (it.hasNext() && it.peekNext().startsWith(QLatin1Char(' '))) | ||
4582 | 352 | it.next(); | ||
4583 | 353 | QString qmljsdbgArg = QString::fromLatin1("-qmljsdebugger=port:%1%2") | ||
4584 | 354 | .arg(m_qmlDebugServerPort) | ||
4585 | 355 | .arg(m_launchFlags.testFlag(QmlDebugLaunchBlocking)? QLatin1String(",block"): QLatin1String("")); | ||
4586 | 356 | it.insert(QLatin1String(" ") + qmljsdbgArg); | ||
4587 | 357 | manifestContent = manifestLines.join(QLatin1String("\n")); | ||
4588 | 358 | break; | ||
4589 | 359 | } | ||
4590 | 360 | } | ||
4591 | 361 | |||
4592 | 362 | m_checkQmlJsDebugArgumentsProcess = new QProcess(this); | ||
4593 | 363 | connect(m_checkQmlJsDebugArgumentsProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(checkQmlJsDebugArgumentsManifestSaved())); | ||
4594 | 364 | connect(m_checkQmlJsDebugArgumentsProcess, SIGNAL(finished(int)), this, SLOT(checkQmlJsDebugArgumentsManifestSaved())); | ||
4595 | 365 | |||
4596 | 366 | QTemporaryFile *manifestFile = new QTemporaryFile(m_checkQmlJsDebugArgumentsProcess); | ||
4597 | 367 | if (!manifestFile->open()) { | ||
4598 | 368 | emit output(tr("Internal error: Cannot create temporary manifest file '%1'") | ||
4599 | 369 | .arg(manifestFile->fileName()), Utils::StdErrFormat); | ||
4600 | 370 | delete manifestFile; | ||
4601 | 371 | return; | ||
4602 | 372 | } | ||
4603 | 373 | |||
4604 | 374 | manifestFile->write(manifestContent.toUtf8()); | ||
4605 | 375 | manifestFile->flush(); | ||
4606 | 376 | |||
4607 | 377 | QStringList args; | ||
4608 | 378 | args << QLatin1String("-device") << m_sshParams.host; | ||
4609 | 379 | if (!m_sshParams.password.isEmpty()) | ||
4610 | 380 | args << QLatin1String("-password") << m_sshParams.password; | ||
4611 | 381 | args << QLatin1String("-package") << QDir::toNativeSeparators(m_barPackage); | ||
4612 | 382 | args << QLatin1String("-putFile"); | ||
4613 | 383 | args << manifestFile->fileName(); | ||
4614 | 384 | args << QLatin1String("app/META-INF/MANIFEST.MF"); | ||
4615 | 385 | if (debugCheckQmlJSArgs) | ||
4616 | 386 | qDebug() << "set manifest:" << m_deployCmd << args.join(QLatin1String(" ")); | ||
4617 | 387 | m_checkQmlJsDebugArgumentsProcess->start(m_deployCmd, args); | ||
4618 | 388 | } | ||
4619 | 389 | |||
4620 | 390 | void BlackBerryApplicationRunner::checkQmlJsDebugArgumentsManifestSaved() | ||
4621 | 391 | { | ||
4622 | 392 | m_checkQmlJsDebugArgumentsProcess->deleteLater(); | ||
4623 | 393 | |||
4624 | 394 | if (m_checkQmlJsDebugArgumentsProcess->exitStatus() != QProcess::NormalExit) { | ||
4625 | 395 | emit output(tr("Cannot set command line arguments."), Utils::StdErrFormat); | ||
4626 | 396 | qWarning() << "Cannot set command line arguments:" << m_checkQmlJsDebugArgumentsProcess->errorString(); | ||
4627 | 397 | qWarning() << m_checkQmlJsDebugArgumentsProcess->readAllStandardError(); | ||
4628 | 398 | return; | ||
4629 | 399 | } | ||
4630 | 400 | |||
4631 | 401 | launchApplication(); | ||
4632 | 402 | } | ||
4633 | 403 | |||
4634 | 240 | void BlackBerryApplicationRunner::launchApplication() | 404 | void BlackBerryApplicationRunner::launchApplication() |
4635 | 241 | { | 405 | { |
4636 | 242 | // If original device connection fails before launching, this method maybe triggered | 406 | // If original device connection fails before launching, this method maybe triggered |
4637 | @@ -246,12 +410,12 @@ | |||
4638 | 246 | 410 | ||
4639 | 247 | QStringList args; | 411 | QStringList args; |
4640 | 248 | args << QLatin1String("-launchApp"); | 412 | args << QLatin1String("-launchApp"); |
4642 | 249 | if (m_debugMode) | 413 | if (m_launchFlags.testFlag(CppDebugLaunch)) |
4643 | 250 | args << QLatin1String("-debugNative"); | 414 | args << QLatin1String("-debugNative"); |
4644 | 251 | args << QLatin1String("-device") << m_sshParams.host; | 415 | args << QLatin1String("-device") << m_sshParams.host; |
4645 | 252 | if (!m_sshParams.password.isEmpty()) | 416 | if (!m_sshParams.password.isEmpty()) |
4646 | 253 | args << QLatin1String("-password") << m_sshParams.password; | 417 | args << QLatin1String("-password") << m_sshParams.password; |
4648 | 254 | args << QDir::toNativeSeparators(m_barPackage); | 418 | args << QLatin1String("-package") << QDir::toNativeSeparators(m_barPackage); |
4649 | 255 | 419 | ||
4650 | 256 | if (!m_launchProcess) { | 420 | if (!m_launchProcess) { |
4651 | 257 | m_launchProcess = new QProcess(this); | 421 | m_launchProcess = new QProcess(this); |
4652 | @@ -262,12 +426,26 @@ | |||
4653 | 262 | 426 | ||
4654 | 263 | m_launchProcess->setEnvironment(m_environment.toStringList()); | 427 | m_launchProcess->setEnvironment(m_environment.toStringList()); |
4655 | 264 | } | 428 | } |
4657 | 265 | 429 | if (debugCheckQmlJSArgs) | |
4658 | 430 | qDebug() << "launch:" << m_deployCmd << args.join(QLatin1String(" ")); | ||
4659 | 266 | m_launchProcess->start(m_deployCmd, args); | 431 | m_launchProcess->start(m_deployCmd, args); |
4660 | 267 | m_runningStateTimer->start(); | 432 | m_runningStateTimer->start(); |
4661 | 268 | m_running = true; | 433 | m_running = true; |
4662 | 269 | } | 434 | } |
4663 | 270 | 435 | ||
4664 | 436 | void BlackBerryApplicationRunner::checkDeployMode() | ||
4665 | 437 | { | ||
4666 | 438 | // If original device connection fails before launching, this method maybe triggered | ||
4667 | 439 | // if any other device is connected | ||
4668 | 440 | if (!BlackBerryDeviceConnectionManager::instance()->isConnected(m_device->id())) | ||
4669 | 441 | return; | ||
4670 | 442 | |||
4671 | 443 | if (m_launchFlags.testFlag(CppDebugLaunch)) | ||
4672 | 444 | queryDeviceInformation(); // check API version vs Runtime version | ||
4673 | 445 | else | ||
4674 | 446 | checkQmlJsDebugArguments(); | ||
4675 | 447 | } | ||
4676 | 448 | |||
4677 | 271 | void BlackBerryApplicationRunner::startRunningStateTimer() | 449 | void BlackBerryApplicationRunner::startRunningStateTimer() |
4678 | 272 | { | 450 | { |
4679 | 273 | if (m_running) | 451 | if (m_running) |
4680 | 274 | 452 | ||
4681 | === modified file 'src/qnx/blackberryapplicationrunner.h' | |||
4682 | --- src/qnx/blackberryapplicationrunner.h 2014-03-18 10:51:43 +0000 | |||
4683 | +++ src/qnx/blackberryapplicationrunner.h 2014-06-16 09:46:37 +0000 | |||
4684 | @@ -34,6 +34,7 @@ | |||
4685 | 34 | 34 | ||
4686 | 35 | #include "blackberrydeviceconfiguration.h" | 35 | #include "blackberrydeviceconfiguration.h" |
4687 | 36 | #include "blackberryprocessparser.h" | 36 | #include "blackberryprocessparser.h" |
4688 | 37 | #include "blackberryversionnumber.h" | ||
4689 | 37 | 38 | ||
4690 | 38 | #include <projectexplorer/runconfiguration.h> | 39 | #include <projectexplorer/runconfiguration.h> |
4691 | 39 | 40 | ||
4692 | @@ -44,29 +45,37 @@ | |||
4693 | 44 | #include <QProcess> | 45 | #include <QProcess> |
4694 | 45 | #include <QDateTime> | 46 | #include <QDateTime> |
4695 | 46 | 47 | ||
4699 | 47 | namespace QSsh { | 48 | namespace QSsh { class SshRemoteProcessRunner; } |
4697 | 48 | class SshRemoteProcessRunner; | ||
4698 | 49 | } | ||
4700 | 50 | 49 | ||
4701 | 51 | namespace Qnx { | 50 | namespace Qnx { |
4702 | 52 | namespace Internal { | 51 | namespace Internal { |
4703 | 53 | 52 | ||
4704 | 54 | class BlackBerryRunConfiguration; | 53 | class BlackBerryRunConfiguration; |
4705 | 55 | class BlackBerryLogProcessRunner; | 54 | class BlackBerryLogProcessRunner; |
4706 | 55 | class BlackBerryDeviceInformation; | ||
4707 | 56 | 56 | ||
4708 | 57 | class BlackBerryApplicationRunner : public QObject | 57 | class BlackBerryApplicationRunner : public QObject |
4709 | 58 | { | 58 | { |
4710 | 59 | Q_OBJECT | 59 | Q_OBJECT |
4711 | 60 | public: | 60 | public: |
4713 | 61 | explicit BlackBerryApplicationRunner(bool debugMode, BlackBerryRunConfiguration *runConfiguration, QObject *parent = 0); | 61 | enum LaunchFlag |
4714 | 62 | { | ||
4715 | 63 | CppDebugLaunch = 0x1, | ||
4716 | 64 | QmlDebugLaunch = 0x2, | ||
4717 | 65 | QmlDebugLaunchBlocking = 0x4, | ||
4718 | 66 | QmlProfilerLaunch = 0x8 | ||
4719 | 67 | }; | ||
4720 | 68 | Q_DECLARE_FLAGS(LaunchFlags, LaunchFlag) | ||
4721 | 69 | |||
4722 | 70 | public: | ||
4723 | 71 | explicit BlackBerryApplicationRunner(const LaunchFlags &launchFlags, BlackBerryRunConfiguration *runConfiguration, QObject *parent = 0); | ||
4724 | 62 | 72 | ||
4725 | 63 | bool isRunning() const; | 73 | bool isRunning() const; |
4726 | 64 | qint64 pid() const; | 74 | qint64 pid() const; |
4727 | 65 | 75 | ||
4728 | 66 | ProjectExplorer::RunControl::StopResult stop(); | ||
4729 | 67 | |||
4730 | 68 | public slots: | 76 | public slots: |
4731 | 69 | void start(); | 77 | void start(); |
4732 | 78 | ProjectExplorer::RunControl::StopResult stop(); | ||
4733 | 70 | 79 | ||
4734 | 71 | signals: | 80 | signals: |
4735 | 72 | void output(const QString &msg, Utils::OutputFormat format); | 81 | void output(const QString &msg, Utils::OutputFormat format); |
4736 | @@ -91,14 +100,21 @@ | |||
4737 | 91 | void setApplicationId(const QString &applicationId); | 100 | void setApplicationId(const QString &applicationId); |
4738 | 92 | 101 | ||
4739 | 93 | void launchApplication(); | 102 | void launchApplication(); |
4740 | 103 | void checkDeployMode(); | ||
4741 | 94 | void startLogProcessRunner(); | 104 | void startLogProcessRunner(); |
4742 | 95 | 105 | ||
4743 | 96 | void displayConnectionOutput(Core::Id deviceId, const QString &output); | 106 | void displayConnectionOutput(Core::Id deviceId, const QString &output); |
4744 | 107 | void checkDeviceRuntimeVersion(int status); | ||
4745 | 108 | |||
4746 | 109 | void checkQmlJsDebugArguments(); | ||
4747 | 110 | void checkQmlJsDebugArgumentsManifestLoaded(); | ||
4748 | 111 | void checkQmlJsDebugArgumentsManifestSaved(); | ||
4749 | 97 | 112 | ||
4750 | 98 | private: | 113 | private: |
4751 | 99 | void reset(); | 114 | void reset(); |
4752 | 115 | void queryDeviceInformation(); | ||
4753 | 100 | 116 | ||
4755 | 101 | bool m_debugMode; | 117 | LaunchFlags m_launchFlags; |
4756 | 102 | 118 | ||
4757 | 103 | qint64 m_pid; | 119 | qint64 m_pid; |
4758 | 104 | QString m_appId; | 120 | QString m_appId; |
4759 | @@ -115,11 +131,17 @@ | |||
4760 | 115 | QProcess *m_launchProcess; | 131 | QProcess *m_launchProcess; |
4761 | 116 | QProcess *m_stopProcess; | 132 | QProcess *m_stopProcess; |
4762 | 117 | BlackBerryProcessParser m_launchStopProcessParser; | 133 | BlackBerryProcessParser m_launchStopProcessParser; |
4763 | 134 | BlackBerryDeviceInformation *m_deviceInfo; | ||
4764 | 118 | 135 | ||
4765 | 119 | BlackBerryLogProcessRunner *m_logProcessRunner; | 136 | BlackBerryLogProcessRunner *m_logProcessRunner; |
4766 | 120 | 137 | ||
4767 | 121 | QTimer *m_runningStateTimer; | 138 | QTimer *m_runningStateTimer; |
4768 | 122 | QProcess *m_runningStateProcess; | 139 | QProcess *m_runningStateProcess; |
4769 | 140 | |||
4770 | 141 | BlackBerryVersionNumber m_bbApiLevelVersion; | ||
4771 | 142 | |||
4772 | 143 | int m_qmlDebugServerPort; | ||
4773 | 144 | QProcess *m_checkQmlJsDebugArgumentsProcess; | ||
4774 | 123 | }; | 145 | }; |
4775 | 124 | 146 | ||
4776 | 125 | } // namespace Internal | 147 | } // namespace Internal |
4777 | 126 | 148 | ||
4778 | === modified file 'src/qnx/blackberrycertificate.cpp' | |||
4779 | --- src/qnx/blackberrycertificate.cpp 2014-03-18 10:51:43 +0000 | |||
4780 | +++ src/qnx/blackberrycertificate.cpp 2014-06-16 09:46:37 +0000 | |||
4781 | @@ -30,7 +30,7 @@ | |||
4782 | 30 | ****************************************************************************/ | 30 | ****************************************************************************/ |
4783 | 31 | 31 | ||
4784 | 32 | #include "blackberrycertificate.h" | 32 | #include "blackberrycertificate.h" |
4786 | 33 | #include "blackberryconfiguration.h" | 33 | #include "blackberryapilevelconfiguration.h" |
4787 | 34 | #include "blackberryconfigurationmanager.h" | 34 | #include "blackberryconfigurationmanager.h" |
4788 | 35 | #include "blackberryndkprocess.h" | 35 | #include "blackberryndkprocess.h" |
4789 | 36 | 36 | ||
4790 | @@ -54,7 +54,7 @@ | |||
4791 | 54 | { | 54 | { |
4792 | 55 | m_process->setProcessChannelMode(QProcess::MergedChannels); | 55 | m_process->setProcessChannelMode(QProcess::MergedChannels); |
4793 | 56 | m_process->setEnvironment(Utils::EnvironmentItem::toStringList( | 56 | m_process->setEnvironment(Utils::EnvironmentItem::toStringList( |
4795 | 57 | BlackBerryConfigurationManager::instance().defaultQnxEnv())); | 57 | BlackBerryConfigurationManager::instance()->defaultConfigurationEnv())); |
4796 | 58 | } | 58 | } |
4797 | 59 | 59 | ||
4798 | 60 | void BlackBerryCertificate::load() | 60 | void BlackBerryCertificate::load() |
4799 | 61 | 61 | ||
4800 | === added file 'src/qnx/blackberrycheckdevicestatusstep.cpp' | |||
4801 | --- src/qnx/blackberrycheckdevicestatusstep.cpp 1970-01-01 00:00:00 +0000 | |||
4802 | +++ src/qnx/blackberrycheckdevicestatusstep.cpp 2014-06-16 09:46:37 +0000 | |||
4803 | @@ -0,0 +1,278 @@ | |||
4804 | 1 | /************************************************************************** | ||
4805 | 2 | ** | ||
4806 | 3 | ** Copyright (C) 2014 BlackBerry Limited. All rights reserved. | ||
4807 | 4 | ** | ||
4808 | 5 | ** Contact: BlackBerry (qt@blackberry.com) | ||
4809 | 6 | ** Contact: KDAB (info@kdab.com) | ||
4810 | 7 | ** | ||
4811 | 8 | ** This file is part of Qt Creator. | ||
4812 | 9 | ** | ||
4813 | 10 | ** Commercial License Usage | ||
4814 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in | ||
4815 | 12 | ** accordance with the commercial license agreement provided with the | ||
4816 | 13 | ** Software or, alternatively, in accordance with the terms contained in | ||
4817 | 14 | ** a written agreement between you and Digia. For licensing terms and | ||
4818 | 15 | ** conditions see http://qt.digia.com/licensing. For further information | ||
4819 | 16 | ** use the contact form at http://qt.digia.com/contact-us. | ||
4820 | 17 | ** | ||
4821 | 18 | ** GNU Lesser General Public License Usage | ||
4822 | 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser | ||
4823 | 20 | ** General Public License version 2.1 as published by the Free Software | ||
4824 | 21 | ** Foundation and appearing in the file LICENSE.LGPL included in the | ||
4825 | 22 | ** packaging of this file. Please review the following information to | ||
4826 | 23 | ** ensure the GNU Lesser General Public License version 2.1 requirements | ||
4827 | 24 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | ||
4828 | 25 | ** | ||
4829 | 26 | ** In addition, as a special exception, Digia gives you certain additional | ||
4830 | 27 | ** rights. These rights are described in the Digia Qt LGPL Exception | ||
4831 | 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | ||
4832 | 29 | ** | ||
4833 | 30 | ****************************************************************************/ | ||
4834 | 31 | |||
4835 | 32 | #include "blackberrycheckdevicestatusstep.h" | ||
4836 | 33 | |||
4837 | 34 | #include "blackberrycheckdevicestatusstepconfigwidget.h" | ||
4838 | 35 | #include "blackberrydeviceinformation.h" | ||
4839 | 36 | #include "blackberryversionnumber.h" | ||
4840 | 37 | #include "qnxconstants.h" | ||
4841 | 38 | |||
4842 | 39 | #include <projectexplorer/buildconfiguration.h> | ||
4843 | 40 | #include <projectexplorer/projectexplorerconstants.h> | ||
4844 | 41 | #include <projectexplorer/target.h> | ||
4845 | 42 | #include <projectexplorer/kit.h> | ||
4846 | 43 | #include <projectexplorer/task.h> | ||
4847 | 44 | #include <ssh/sshconnection.h> | ||
4848 | 45 | |||
4849 | 46 | #include <coreplugin/icore.h> | ||
4850 | 47 | |||
4851 | 48 | #include <qfileinfo.h> | ||
4852 | 49 | |||
4853 | 50 | #include <qmessagebox.h> | ||
4854 | 51 | |||
4855 | 52 | #include <qeventloop.h> | ||
4856 | 53 | |||
4857 | 54 | using namespace Qnx; | ||
4858 | 55 | using namespace Qnx::Internal; | ||
4859 | 56 | |||
4860 | 57 | namespace { | ||
4861 | 58 | const char RUNTIME_CHECK_ENABLED[] = | ||
4862 | 59 | "Qnx.Internal.BlackBerryCheckDeviceStatusStep.RuntimeCheckEnabled"; | ||
4863 | 60 | const char DEBUG_TOKEN_CHECK_ENABLED[] = | ||
4864 | 61 | "Qnx.Internal.BlackBerryCheckDeviceStatusStep.DebugTokenCheckEnabled"; | ||
4865 | 62 | } | ||
4866 | 63 | |||
4867 | 64 | BlackBerryCheckDeviceStatusStep::BlackBerryCheckDeviceStatusStep(ProjectExplorer::BuildStepList *bsl) : | ||
4868 | 65 | ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QNX_CHECK_DEVICE_STATUS_BS_ID)) | ||
4869 | 66 | , m_deviceInfo(0) | ||
4870 | 67 | , m_eventLoop(0) | ||
4871 | 68 | , m_runtimeCheckEnabled(true) | ||
4872 | 69 | , m_debugTokenCheckEnabled(true) | ||
4873 | 70 | { | ||
4874 | 71 | setDisplayName(tr("Check Device Status")); | ||
4875 | 72 | } | ||
4876 | 73 | |||
4877 | 74 | BlackBerryCheckDeviceStatusStep::BlackBerryCheckDeviceStatusStep(ProjectExplorer::BuildStepList *bsl, | ||
4878 | 75 | BlackBerryCheckDeviceStatusStep *bs) : | ||
4879 | 76 | ProjectExplorer::BuildStep(bsl, bs) | ||
4880 | 77 | , m_deviceInfo(0) | ||
4881 | 78 | , m_eventLoop(0) | ||
4882 | 79 | , m_runtimeCheckEnabled(true) | ||
4883 | 80 | , m_debugTokenCheckEnabled(true) | ||
4884 | 81 | { | ||
4885 | 82 | setDisplayName(tr("Check Device Status")); | ||
4886 | 83 | } | ||
4887 | 84 | |||
4888 | 85 | void BlackBerryCheckDeviceStatusStep::checkDeviceInfo(int status) | ||
4889 | 86 | { | ||
4890 | 87 | if (!m_runtimeCheckEnabled && m_debugTokenCheckEnabled) { | ||
4891 | 88 | // Skip debug token check for internal non secure devices and simulators | ||
4892 | 89 | if (!m_deviceInfo->isProductionDevice() || m_deviceInfo->isSimulator()) { | ||
4893 | 90 | m_eventLoop->exit(true); | ||
4894 | 91 | return; | ||
4895 | 92 | } | ||
4896 | 93 | } | ||
4897 | 94 | |||
4898 | 95 | if (status != BlackBerryDeviceInformation::Success) { | ||
4899 | 96 | switch (status) { | ||
4900 | 97 | case BlackBerryDeviceInformation::AuthenticationFailed: | ||
4901 | 98 | raiseError(tr("Authentication failed.")); | ||
4902 | 99 | break; | ||
4903 | 100 | case BlackBerryDeviceInformation::NoRouteToHost: | ||
4904 | 101 | raiseError(tr("Cannot connect to device.")); | ||
4905 | 102 | break; | ||
4906 | 103 | case BlackBerryDeviceInformation::DevelopmentModeDisabled: | ||
4907 | 104 | raiseError(tr("Device is not in the development mode.")); | ||
4908 | 105 | break; | ||
4909 | 106 | case BlackBerryDeviceInformation::InferiorProcessTimedOut: | ||
4910 | 107 | raiseError(tr("Timeout querying device information.")); | ||
4911 | 108 | break; | ||
4912 | 109 | case BlackBerryDeviceInformation::FailedToStartInferiorProcess: | ||
4913 | 110 | raiseError(tr("Failed to query device information.")); | ||
4914 | 111 | break; | ||
4915 | 112 | case BlackBerryDeviceInformation::InferiorProcessCrashed: | ||
4916 | 113 | raiseError(tr("Process to query device information has crashed.")); | ||
4917 | 114 | break; | ||
4918 | 115 | default: | ||
4919 | 116 | raiseError(tr("Cannot query device information.")); | ||
4920 | 117 | break; | ||
4921 | 118 | } | ||
4922 | 119 | m_eventLoop->exit(false); | ||
4923 | 120 | return; | ||
4924 | 121 | } | ||
4925 | 122 | |||
4926 | 123 | if (m_debugTokenCheckEnabled && !m_deviceInfo->debugTokenValid()) { | ||
4927 | 124 | //: %1: Error message from BlackBerryDeviceInformation | ||
4928 | 125 | const QString errorMsg = | ||
4929 | 126 | tr("%1. Upload a valid debug token into the device.") | ||
4930 | 127 | .arg(m_deviceInfo->debugTokenValidationError()); | ||
4931 | 128 | raiseError(errorMsg); | ||
4932 | 129 | m_eventLoop->exit(false); | ||
4933 | 130 | return; | ||
4934 | 131 | } | ||
4935 | 132 | |||
4936 | 133 | if (m_runtimeCheckEnabled) { | ||
4937 | 134 | BlackBerryVersionNumber deviceRuntimeVersion(m_deviceInfo->scmBundle()); | ||
4938 | 135 | QFileInfo fi(target()->kit()->autoDetectionSource()); | ||
4939 | 136 | |||
4940 | 137 | if (deviceRuntimeVersion.isEmpty()) { | ||
4941 | 138 | // Skip the check if device runtime is not determined | ||
4942 | 139 | m_eventLoop->exit(true); | ||
4943 | 140 | raiseWarning(tr("Cannot determine device runtime version.")); | ||
4944 | 141 | return; | ||
4945 | 142 | } | ||
4946 | 143 | |||
4947 | 144 | BlackBerryVersionNumber apiLevelVersion = BlackBerryVersionNumber::fromNdkEnvFileName(fi.baseName()); | ||
4948 | 145 | if (apiLevelVersion.isEmpty()) { | ||
4949 | 146 | // Skip the check if device API level version is not determined | ||
4950 | 147 | m_eventLoop->exit(true); | ||
4951 | 148 | raiseWarning(tr("Cannot determine API level version.")); | ||
4952 | 149 | return; | ||
4953 | 150 | } | ||
4954 | 151 | |||
4955 | 152 | bool ok = true; | ||
4956 | 153 | if (apiLevelVersion > deviceRuntimeVersion) { | ||
4957 | 154 | raiseError(tr("The device runtime version (%1) is inferior to the API level version (%2)") | ||
4958 | 155 | .arg(deviceRuntimeVersion.toString(), apiLevelVersion.toString())); | ||
4959 | 156 | |||
4960 | 157 | QMetaObject::invokeMethod(this, "handleVersionMismatch", Qt::BlockingQueuedConnection, | ||
4961 | 158 | Q_RETURN_ARG(bool, ok), | ||
4962 | 159 | Q_ARG(QString, deviceRuntimeVersion.toString()), | ||
4963 | 160 | Q_ARG(QString, apiLevelVersion.toString())); | ||
4964 | 161 | } | ||
4965 | 162 | |||
4966 | 163 | m_eventLoop->exit(ok); | ||
4967 | 164 | return; | ||
4968 | 165 | } | ||
4969 | 166 | |||
4970 | 167 | m_eventLoop->exit(true); | ||
4971 | 168 | } | ||
4972 | 169 | |||
4973 | 170 | void BlackBerryCheckDeviceStatusStep::emitOutputInfo() | ||
4974 | 171 | { | ||
4975 | 172 | emit addOutput(tr("Checking device status..."), BuildStep::MessageOutput); | ||
4976 | 173 | } | ||
4977 | 174 | |||
4978 | 175 | void BlackBerryCheckDeviceStatusStep::enableDebugTokenCheck(bool enable) | ||
4979 | 176 | { | ||
4980 | 177 | m_debugTokenCheckEnabled = enable; | ||
4981 | 178 | } | ||
4982 | 179 | |||
4983 | 180 | void BlackBerryCheckDeviceStatusStep::enableRuntimeCheck(bool enable) | ||
4984 | 181 | { | ||
4985 | 182 | m_runtimeCheckEnabled = enable; | ||
4986 | 183 | } | ||
4987 | 184 | |||
4988 | 185 | bool BlackBerryCheckDeviceStatusStep::handleVersionMismatch(const QString &runtimeVersion, const QString &apiLevelVersion) | ||
4989 | 186 | { | ||
4990 | 187 | // TODO: Check if a matching API level exists in the user configurations, | ||
4991 | 188 | // otherwise let the user download the matching device runtime. | ||
4992 | 189 | const QMessageBox::StandardButton answer = QMessageBox::question(Core::ICore::mainWindow(), tr("Confirmation"), | ||
4993 | 190 | tr("The device runtime version(%1) does not match the API level version(%2).\n" | ||
4994 | 191 | "Do you want to continue anyway?").arg(runtimeVersion, apiLevelVersion), | ||
4995 | 192 | QMessageBox::Yes | QMessageBox::No); | ||
4996 | 193 | return answer == QMessageBox::Yes; | ||
4997 | 194 | } | ||
4998 | 195 | |||
4999 | 196 | bool BlackBerryCheckDeviceStatusStep::init() | ||
5000 | 197 | { |
The diff has been truncated for viewing.