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