Blackberry: Remove blackberry support
Keep QNX. A short informal search did not turn up any more blackberry users, even though there is interest in QNX. So this patch removes the platform: We had no contact with the maintainers in months, there are no changes going into the code for about as long. I am not even aware of anybody testing the platform, so any remaining users are probably better of with Qt Creator 3.2 or so where the code was extensively tested. Change-Id: Ibeda6bfd8565599918cfcc08fd01cb5ed8793dc2 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Before Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 44 KiB |
@@ -21,7 +21,7 @@
|
||||
\contentspage {Qt Creator Manual}
|
||||
\previouspage creator-deployment.html
|
||||
\page creator-deploying-android.html
|
||||
\nextpage creator-deployment-bb10.html
|
||||
\nextpage creator-deployment-embedded-linux.html
|
||||
|
||||
\title Deploying Applications to Android Devices
|
||||
|
||||
|
@@ -21,7 +21,7 @@
|
||||
\contentspage {Qt Creator Manual}
|
||||
\previouspage creator-developing-android.html
|
||||
\page creator-developing-baremetal.html
|
||||
\nextpage creator-developing-bb10.html
|
||||
\nextpage creator-developing-generic-linux.html
|
||||
|
||||
\title Connecting Bare Metal Devices
|
||||
|
||||
|
@@ -371,10 +371,6 @@
|
||||
\li \uicontrol Analyzer - Errors encountered while running the
|
||||
\l{Analyzing Code}{Valgrind code analysis tools}.
|
||||
|
||||
\li \uicontrol {BAR Descriptor} - Errors and warnings encountered when using
|
||||
the BlackBerry 10 BAR descriptor editor to customize the appearance
|
||||
and behavior of an application.
|
||||
|
||||
\li \uicontrol {Build System} - Errors and warnings encountered during a
|
||||
build.
|
||||
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
/*!
|
||||
\contentspage {Qt Creator Manual}
|
||||
\previouspage creator-deployment-bb10.html
|
||||
\previouspage creator-deploying-android.html
|
||||
\page creator-deployment-embedded-linux.html
|
||||
\nextpage creator-deployment-qnx.html
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
/*!
|
||||
|
||||
\contentspage {Qt Creator Manual}
|
||||
\previouspage creator-developing-bb10.html
|
||||
\previouspage creator-developing-baremetal.html
|
||||
\page creator-developing-generic-linux.html
|
||||
\nextpage creator-developing-ios.html
|
||||
|
||||
|
@@ -42,11 +42,6 @@
|
||||
When you deploy the application to an Android device, \QC copies
|
||||
the application files to the device. In addition, you can determine
|
||||
the Qt libraries to use.
|
||||
\li \l{Deploying Applications to BlackBerry 10 Devices}
|
||||
|
||||
When you deploy the application to a BlackBerry 10 device, \QC generates a
|
||||
BAR package in the build directory and deploys it to the connected
|
||||
device.
|
||||
\li \l{Deploying Applications to Embedded Linux Devices}
|
||||
|
||||
When you deploy the application to a generic Linux-based device, \QC
|
||||
@@ -54,9 +49,7 @@
|
||||
can test and debug the application on the device.
|
||||
\li \l{Deploying Applications to QNX Neutrino Devices}
|
||||
|
||||
When you deploy the application to a BlackBerry, \QC generates a
|
||||
BAR package in the build directory and deploys it to the connected
|
||||
device. When you deploy it to a QNX Neutrino device, \QC copies
|
||||
When you deploy the application to a QNX Neutrino device, \QC copies
|
||||
the application files to the connected device. You can test and
|
||||
debug the application on the device.
|
||||
\endlist
|
||||
|
@@ -56,13 +56,6 @@
|
||||
You can connect bare metal devices to the development PC and use \QC
|
||||
to debug applications on them with GDB or a hardware debugger.
|
||||
|
||||
\li \l{Connecting BlackBerry 10 Devices}
|
||||
|
||||
\QC enables you to develop, deploy and debug your Qt applications
|
||||
to BlackBerry 10.
|
||||
You need to install the BlackBerry 10 NDK which contains a pre-built Qt.
|
||||
You also need either a BlackBerry 10 device or the simulator.
|
||||
|
||||
\li \l{Connecting Embedded Linux Devices}
|
||||
|
||||
If you have a tool chain for building applications for embedded
|
||||
@@ -79,9 +72,8 @@
|
||||
|
||||
You can connect QNX devices to the development PC to deploy, run and
|
||||
debug applications on them from within \QC. This is currently only
|
||||
supported for BlackBerry Playbook and QNX Neutrino devices, and
|
||||
requires the BlackBerry NDK or the QNX SDK to be installed on the
|
||||
development PC.
|
||||
supported for QNX Neutrino devices, and requires the QNX SDK to be
|
||||
installed on the development PC.
|
||||
|
||||
\li \l{Connecting Windows Runtime Devices}
|
||||
|
||||
|
@@ -8,8 +8,6 @@
|
||||
|
||||
\li Android
|
||||
|
||||
\li BlackBerry 10
|
||||
|
||||
\li Generic remote Linux
|
||||
|
||||
\li iOS
|
||||
@@ -37,11 +35,6 @@
|
||||
\li \image ok
|
||||
\li \image ok
|
||||
\li \image ok
|
||||
\row
|
||||
\li BlackBerry 10
|
||||
\li \image ok
|
||||
\li \image ok
|
||||
\li \image ok
|
||||
\row
|
||||
\li Generic Remote Linux
|
||||
\li \image ok
|
||||
@@ -70,3 +63,5 @@
|
||||
\note Madde support has been removed from \QC 3.0. To develop for Maemo or Harmattan,
|
||||
use \QC 2.8.
|
||||
|
||||
\note BlackBerry 10 support has been removed from \QC 3.5. Use \QC 3.4 instead.
|
||||
|
||||
|
@@ -65,8 +65,7 @@
|
||||
to the directory where the compiler is located and select
|
||||
the application binary interface (ABI) version from the list of available
|
||||
versions. You can also create a custom ABI definition.
|
||||
For QCC, also specify the path to the BlackBerry NDK or the QNX Software
|
||||
Development Platform (SDP).
|
||||
For QCC, also specify the path to the QNX Software Development Platform (SDP).
|
||||
|
||||
You specify the compiler to use for each kit in \uicontrol Tools >
|
||||
\uicontrol Options > \uicontrol {Build & Run} > \uicontrol Kits.
|
||||
|
@@ -72,9 +72,8 @@
|
||||
|
||||
\image qt-creator-debugging-helpers.png
|
||||
|
||||
\li If the Qt version is for Blackberry or QNX, enter the path
|
||||
to your installed Blackberry NDK or QNX SDK in the
|
||||
\uicontrol {Blackberry Native SDK} or \uicontrol{QNX SDK} field respectively.
|
||||
\li If the Qt version is for QNX, enter the path to your installed QNX SDK in the
|
||||
\uicontrol{QNX SDK} field.
|
||||
|
||||
\endlist
|
||||
|
||||
|
@@ -46,8 +46,6 @@
|
||||
|
||||
\li Bare Metal Device
|
||||
|
||||
\li BlackBerry 10 Device
|
||||
|
||||
\li Generic Linux Device
|
||||
|
||||
\li iOS Device
|
||||
|
@@ -1,90 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (C) 2011 - 2014 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
**
|
||||
** GNU Free Documentation License
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Free
|
||||
** Documentation License version 1.3 as published by the Free Software
|
||||
** Foundation and appearing in the file included in the packaging of this
|
||||
** file.
|
||||
**
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
// **********************************************************************
|
||||
// NOTE: the sections are not ordered by their logical order to avoid
|
||||
// reshuffling the file each time the index order changes (i.e., often).
|
||||
// Run the fixnavi.pl script to adjust the links to the index order.
|
||||
// **********************************************************************
|
||||
|
||||
/*!
|
||||
\contentspage {Qt Creator Manual}
|
||||
\previouspage creator-deploying-android.html
|
||||
\page creator-deployment-bb10.html
|
||||
\nextpage creator-deployment-embedded-linux.html
|
||||
|
||||
\title Deploying Applications to BlackBerry 10 Devices
|
||||
|
||||
To deploy Qt applications to BlackBerry 10 devices:
|
||||
|
||||
\list 1
|
||||
\li Select \uicontrol File > \uicontrol {New File or Project}
|
||||
> \uicontrol {Application} to create a
|
||||
\uicontrol {Qt Quick Application}, \uicontrol {Qt Widgets
|
||||
Application}, or \uicontrol {BlackBerry Cascades Application}.
|
||||
\li Select a BlackBerry 10 \l{glossary-buildandrun-kit}{kit} for either device or simulator. For more information about adding kits, see \l{Connecting BlackBerry 10 Devices}.
|
||||
\li When \QC prompts you to generate a BAR descriptor file, answer
|
||||
\uicontrol Yes to generate the file and enable the packaging
|
||||
process.
|
||||
\li You can use the BAR descriptor editor to customize the appearance and behavior of the application.
|
||||
\li You can specify which Qt libraries your application should link to
|
||||
in the \uicontrol {Create Packages} deployment step,
|
||||
\uicontrol {Package in development mode} option, if you create a
|
||||
package in development mode:
|
||||
\list
|
||||
\li Select \uicontrol {Use Pre-installed Qt} to use Qt libraries
|
||||
shipped with the device.
|
||||
\li Select \uicontrol{Bundle Qt in Package} to package and use the
|
||||
Qt version from the active BlackBerry kit.
|
||||
This will significantly increase the size of your package.
|
||||
\li To use a deployed Qt version in the device, select
|
||||
\uicontrol{Use Deployed Qt} and set the path under
|
||||
/accounts/devuser/ where Qt is deployed. To deploy a Qt version
|
||||
select \uicontrol {Deploy Now}.
|
||||
\image qtcreator-blackberry-deployQt.png "Use deployed Qt."
|
||||
\endlist
|
||||
\endlist
|
||||
|
||||
The BAR application descriptor file in your project will serve as a template to generate the actual BAR application descriptor file in the build directory
|
||||
that is used for packaging. The final BAR application descriptor file
|
||||
depends on the options you specify in the \uicontrol {Create Packages}
|
||||
deployment step.
|
||||
|
||||
If you have an existing Cascades project created by QNX Momentics IDE, you can import it to \QC:
|
||||
|
||||
\list 1
|
||||
\li Select \uicontrol File > \uicontrol {New File or Project} >
|
||||
\uicontrol {Import Project} > \uicontrol {Momentics Cascades
|
||||
Project} > \uicontrol Choose.
|
||||
\li Specify an existing Cascades project created by QNX Momentics IDE.
|
||||
\li Specify a location for the newly created \QC project.
|
||||
\endlist
|
||||
|
||||
A project import report is generated into import.log file located in your project.
|
||||
|
||||
\note \uicontrol {BlackBerry Cascades Application} and \uicontrol {Momentics
|
||||
Cascades Project} projects are available in the \uicontrol {All Templates}
|
||||
filter, so you need to set this filter in the top-right corner of the
|
||||
\uicontrol {New} dialog to enable those templates.
|
||||
|
||||
\note Currently, the BlackBerry 10 devices and Simulator have Qt 4.8 libraries preinstalled. To use Qt 5 features, you must compile the Qt libraries for BlackBerry 10 yourself. For more information, see \l {http://wiki.qt.io/Building_Qt5_for_Blackberry}{Building Qt5 for BlackBerry}.
|
||||
|
||||
For more details please refer to the Qt-Project wiki page: \l {http://wiki.qt.io/BlackBerry}{Qt for BlackBerry}.
|
||||
*/
|
@@ -1,124 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (C) 2011 - 2014 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
**
|
||||
** GNU Free Documentation License
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Free
|
||||
** Documentation License version 1.3 as published by the Free Software
|
||||
** Foundation and appearing in the file included in the packaging of this
|
||||
** file.
|
||||
**
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\contentspage {Qt Creator Manual}
|
||||
\previouspage creator-developing-baremetal.html
|
||||
\page creator-developing-bb10.html
|
||||
\nextpage creator-developing-generic-linux.html
|
||||
|
||||
\title Connecting BlackBerry 10 Devices
|
||||
|
||||
\QC provides a plugin that enables you to develop for QNX and BlackBerry 10 platforms.
|
||||
This page explains the basic steps to develop for BlackBerry 10 using \QC.
|
||||
|
||||
The native BlackBerry 10 NDK includes Qt 4 (4.8.4 or newer) for both simulator (x86) and device (arm) targets available for development. Compared with the development for the PlayBook, Qt libraries are integrated in the BlackBerry 10 device firmware and can be used by Qt applications as shared libraries.
|
||||
|
||||
Before starting to develop for BlackBerry 10 you need to download the following tools:
|
||||
|
||||
\list
|
||||
\li \l {http://developer.blackberry.com/native/download/} {QNX Momentics IDE} - it is recommend to download the latest version to enable all \QC features
|
||||
\li \l {http://developer.blackberry.com/native/download/} {BlackBerry 10 Simulator} if you do not have a BlackBerry 10 device
|
||||
\li BlackBerry code signing keys (https://www.blackberry.com/SignedKeys/)
|
||||
\endlist
|
||||
|
||||
|
||||
\section1 Setting Up BlackBerry 10 Environment in Qt Creator
|
||||
|
||||
To check your BlackBerry 10 configuration, including the API level, the
|
||||
Signing Keys and the Device registration, select \uicontrol Tools >
|
||||
\uicontrol Options > \uicontrol BlackBerry > \uicontrol Setup.
|
||||
|
||||
\image qtcreator-blackberry-setupage.png "BlackBerry setup page"
|
||||
|
||||
\list 1
|
||||
|
||||
\li Set up API Levels:
|
||||
|
||||
\list 1
|
||||
\li Select \uicontrol Tools > \uicontrol Options > \uicontrol BlackBerry >
|
||||
\uicontrol {API Levels and Runtimes} to list all registered API Levels automatically
|
||||
detected by \QC.
|
||||
\image qtcreator-blackberry-apilevels.png "BlackBerry API leves and Runtimes page"
|
||||
\li The API Levels printed with a bold font are active. Use
|
||||
\uicontrol Activate and \uicontrol Deactivate to change it. When
|
||||
an API Level is active, \QC registers kits, Qt versions, tool
|
||||
chains, and debuggers to enable BlackBerry 10 development
|
||||
against the API Level.
|
||||
\li Use \uicontrol Add to install a new API Level or to register an
|
||||
existing one.
|
||||
\li It is recommended to keep the newest version as the default API level. \QC will use the available BlackBerry tools from the default API level to implement several of the plugin functions including device management, deployment process and the BlackBerry Signing Keys support. Some of those functions require 10.2 version or newer.
|
||||
\endlist
|
||||
|
||||
\li Set up your Signing Keys:
|
||||
|
||||
\list 1
|
||||
\li Select \uicontrol Tools > \uicontrol Options >
|
||||
\uicontrol BlackBerry > \uicontrol Keys.
|
||||
\li Register a BlackBerry Signing Authority - if you do not have any, the page will guide you to an online web form to request one.
|
||||
\li Select \uicontrol {Create Certificate} to create a Developer
|
||||
Certificate.
|
||||
\li To package your application in development mode, select
|
||||
\uicontrol Request to request a debug token or
|
||||
\uicontrol Import to import a valid token.
|
||||
\image qtcreator-blackberry-keys.png "BlackBerry Keys page"
|
||||
You can also access the debug token list in \uicontrol Tools >
|
||||
\uicontrol Options > \uicontrol Devices when you register a
|
||||
BlackBerry device. To use the same debug token for different
|
||||
devices, select \uicontrol{Edit} to add, remove or update the debug
|
||||
token's device PINs.
|
||||
\endlist
|
||||
|
||||
|
||||
\li Register your device:
|
||||
|
||||
\list 1
|
||||
\li On the device, select \uicontrol Settings >
|
||||
\uicontrol {Security and Privacy} > \uicontrol {Development Mode}
|
||||
to switch the BlackBerry 10 device to development mode.
|
||||
\li Select \uicontrol Tools > \uicontrol Options > \uicontrol Devices
|
||||
> \uicontrol Add > \uicontrol {Blackberry Device} to add a
|
||||
BlackBerry Device. \QC should auto detect your BlackBerry device
|
||||
if the default API level is set to 10.2 or newer.
|
||||
\li In the \uicontrol {Device password} field, enter the device
|
||||
password. \QC will query information from the device.
|
||||
\image qtcreator-blackberry-add-device.png "BlackBerry Device Wizard"
|
||||
\li Select \uicontrol Import to import a valid debug token for the
|
||||
device or \uicontrol Request to request a new token.
|
||||
\image qtcreator-blackberry-device-debugToken.png "BlackBerry Device debug token"
|
||||
\li If your device is successfully added, it should be listed in
|
||||
\uicontrol Tools > \uicontrol Options > \uicontrol {Devices}.
|
||||
\image qtcreator-blackberry-device.png "BlackBerry Device Configuration page"
|
||||
\li Select \uicontrol Upload to upload your debug token to the
|
||||
device.
|
||||
\li Select \uicontrol {Connect to device} to connect to the device.
|
||||
You should close any other pending connections from a shell or
|
||||
other IDE to successfully connect your device in \QC.
|
||||
\li Select \uicontrol Tools > \uicontrol Options >
|
||||
\uicontrol {Build & Run} > \uicontrol Kits to add your device to
|
||||
compatible BlackBerry 10 kits.
|
||||
\endlist
|
||||
|
||||
\endlist
|
||||
|
||||
\include qnx/creator-key-management-qnx.qdocinc
|
||||
|
||||
For more details please refer to the Qt-Project wiki page: \l {http://wiki.qt.io/BlackBerry}{Qt for BlackBerry}.
|
||||
*/
|
@@ -29,90 +29,6 @@
|
||||
You can connect QNX devices to the development PC to deploy, run and debug
|
||||
applications on them from within \QC.
|
||||
|
||||
\section1 Setting Up Connectivity on Playbook
|
||||
|
||||
In order to deploy applications to the Playbook, you will need to enable
|
||||
Development Mode on the device and upload a debug token to it.
|
||||
|
||||
Enabling Development Mode is done by sliding top-down on the Playbook,
|
||||
thereby opening the \uicontrol{Preferences}. Now go to \uicontrol{Security >
|
||||
Development Mode} and set \uicontrol{Use Development Mode} to \uicontrol{ON}. Enter the
|
||||
device password when asked to do so.
|
||||
|
||||
\image qtcreator-qnx-playbook-development-mode.png
|
||||
|
||||
\section2 USB Access
|
||||
|
||||
The \uicontrol{Development Address} shown in the \uicontrol{Development Mode} settings
|
||||
is the IP address to use when you are connecting the device with a USB
|
||||
cable to the development PC. If you are deploying over a Wi-Fi network, you
|
||||
should use the IP address shown in \uicontrol{Preferences > About > Network}.
|
||||
|
||||
To enable access over USB, change \uicontrol{Preferences > Storage & Sharing >
|
||||
USB Connections} to \uicontrol{Connect to Windows} if you are deploying from
|
||||
Windows, or \uicontrol{Connect to Mac} if you are deploying from Linux or OS X.
|
||||
|
||||
\image qtcreator-qnx-playbook-storage-sharing.png
|
||||
|
||||
\section2 Debug Token
|
||||
|
||||
If you are using a physical device, you will have to upload a debug token to
|
||||
the device. The simulator does not require any debug token.
|
||||
|
||||
\section3 Create a Debug Token
|
||||
|
||||
You can create the debug token either in QNX Momentics or from the command
|
||||
line. There is currently no support for creating the debug token from
|
||||
within \QC.
|
||||
|
||||
From the command line:
|
||||
\c{blackberry-debugtokenrequest -storepass <pass> -devicepin <your PB pin> debugtoken.bar}
|
||||
|
||||
\section3 Install Debug Token on Playbook
|
||||
|
||||
You can install the debug token on the Playbook either in QNX Momentics or
|
||||
from the command line. There is currently no support for installing the
|
||||
debug token from within \QC.
|
||||
|
||||
From the command line:
|
||||
\c{blackberry-nativepackage -installDebugToken ~/.rim/debugtoken.bar -device <device_ip> [-password <device_pass>]}
|
||||
|
||||
\section1 Adding a BlackBerry Device in \QC
|
||||
|
||||
Adding a BlackBerry device is done using a wizard in the \uicontrol{Device
|
||||
Configurations} options. To launch it, go to \uicontrol Tools > \uicontrol Options >
|
||||
\uicontrol Devices > \uicontrol Add > \uicontrol {BlackBerry Device} > \uicontrol {Start Wizard}.
|
||||
|
||||
\image qtcreator-qnx-device-configurations-wizard-1.png "Connection details"
|
||||
|
||||
\list
|
||||
\li In the \uicontrol{The name to identify this configuration} field, enter a
|
||||
name for the device.
|
||||
\li In the \uicontrol{The device's host name or IP address} field, enter the
|
||||
host name or IP address of the device.
|
||||
\li In the \uicontrol{Device password} field, enter the password for the device.
|
||||
\li In the \uicontrol{Device type} field, select whether it is a \uicontrol{Physical
|
||||
device} or a \uicontrol{Simulator} you are connecting to.
|
||||
\li In the \uicontrol{Debug token} field, enter the path to the debug token
|
||||
that is also installed on the device. This is only necessary if you are
|
||||
connecting to a \uicontrol{Physical device}.
|
||||
\li Click \uicontrol{Next} to continue.
|
||||
\endlist
|
||||
|
||||
\image qtcreator-qnx-device-configurations-wizard-2.png "SSH Key Setup"
|
||||
|
||||
For the \uicontrol{SSH Key Setup}, you can either select an existing \b{4096}-bit
|
||||
key, or click \uicontrol{Generate} to create a new key. The generated key will be
|
||||
stored next to the \QC settings, in a \b{qnx} sub-directory.
|
||||
|
||||
Click \uicontrol{Next} and then \uicontrol{Finish} to complete setting up the device
|
||||
connection.
|
||||
|
||||
Once the device is added, you can edit the settings directly in \uicontrol Tools >
|
||||
\uicontrol Options > \uicontrol Devices.
|
||||
|
||||
\image qtcreator-qnx-device-configurations.png "Devices"
|
||||
|
||||
\section1 Adding a QNX Neutrino Device in \QC
|
||||
|
||||
Adding a QNX Neutrino device is very similar to \l{Connecting Embedded
|
||||
|
@@ -1,47 +0,0 @@
|
||||
\section2 Obtaining New Keys
|
||||
|
||||
To request keys from the BlackBerry Signing Authority, select
|
||||
\uicontrol Tools > \uicontrol Options > \uicontrol BlackBerry >
|
||||
\uicontrol Keys > \uicontrol Register.
|
||||
Then select the \uicontrol {BlackBerry website} link, and follow the
|
||||
instructions.
|
||||
|
||||
\image qtcreator-blackberry-obtain-keys.png "Requesting new keys"
|
||||
|
||||
\section2 Registering Newly Obtained Keys
|
||||
|
||||
After you register in the BlackBerry website, you should get a bbidtoken.csk
|
||||
file. Once you store it at the proper location as described in the email,
|
||||
you can check that signing keys are registered in \QC by selecting
|
||||
\uicontrol Tools > \uicontrol Options > \uicontrol BlackBerry >
|
||||
\uicontrol Keys.
|
||||
|
||||
\image qtcreator-blackberry-registered-keys.png "Registered keys"
|
||||
|
||||
\section2 Creating a New Certificate
|
||||
|
||||
To create a new developer certificate, click the
|
||||
\uicontrol {Create Certificate} button to open the
|
||||
\uicontrol {Create Certificate} dialog.
|
||||
|
||||
\image qtcreator-blackberry-createcertificatedialog.png "Create Certificate dialog"
|
||||
|
||||
The fields you will need to fill in are:
|
||||
|
||||
\list
|
||||
|
||||
\li Author
|
||||
|
||||
The author, or owner of the certificate.
|
||||
|
||||
\li Password
|
||||
|
||||
The password which will be used to unlock the certificate from
|
||||
they keystore.
|
||||
|
||||
\endlist
|
||||
|
||||
After filling in these fields, click \uicontrol OK and the certificate
|
||||
will be created and registered in \QC.
|
||||
|
||||
\image qtcreator-blackberry-registered-certificate.png "Registered certificate"
|
@@ -7,10 +7,7 @@
|
||||
\li Configure the device and specify a connection to it. For more
|
||||
information, see \l{Connecting QNX Devices}.
|
||||
|
||||
\li If you are running on a BlackBerry 10 device, create an Application
|
||||
Descriptor File if it does not already exist. For more information, see \l{Deploying Applications to BlackBerry 10 Devices}.
|
||||
|
||||
\li Make sure that your kit has your QNX or BlackBerry 10 device set.
|
||||
\li Make sure that your kit has your QNX device set.
|
||||
|
||||
\li Click the \uicontrol Run button.
|
||||
|
||||
@@ -19,19 +16,13 @@
|
||||
\QC uses the compiler specified in the QNX tool chain to build the
|
||||
application.
|
||||
|
||||
If you are running on a BlackBerry device, \QC generates a BAR package,
|
||||
installs it on the device, and executes the selected application. The
|
||||
application views are displayed on the device. Standard output is
|
||||
visible in the \QC \uicontrol {Application Output} view.
|
||||
|
||||
\note Debugging is currently only fully supported on Linux and OS X.
|
||||
It is not possible to insert breakpoints during runtime on Windows.
|
||||
|
||||
\section2 Troubleshooting Errors
|
||||
|
||||
For the command-line output to show up in the \uicontrol{Application Output}
|
||||
view when running on a BlackBerry device, \QC needs to be able to establish
|
||||
an SSH connection to the device.
|
||||
For the command-line output to show up in the \uicontrol{Application Output},
|
||||
\QC needs to be able to establish an SSH connection to the device.
|
||||
This is only possible if QNX Momentics is not running, and the SSH key
|
||||
configured for the device is a 4096-bit key.
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
\section2 Specifying Run Settings for QNX Devices
|
||||
|
||||
To run and debug an application on a QNX or BlackBerry device, you must
|
||||
To run and debug an application on a QNX device, you must
|
||||
create connections from the development PC to the device. Click
|
||||
\uicontrol {Manage device configurations} to create a connection. For more
|
||||
information, see \l{Connecting QNX Devices}.
|
||||
@@ -9,10 +9,3 @@
|
||||
|
||||
Specifying run settings for QNX Neutrino devices is very similar to
|
||||
\l{Specifying Run Settings for Linux-Based Devices}.
|
||||
|
||||
\section2 Specifying Run Settings for Blackberry 10 Devices
|
||||
|
||||
When you run the application on the BlackBerry 10 device, \QC first creates a BAR package
|
||||
using the settings in the Application Descriptor File. The default is to create the
|
||||
BAR package in the build directory. The BAR package is then deployed to the
|
||||
selected device. For more information, see \l{Deploying Applications to BlackBerry 10 Devices}.
|
||||
|
@@ -230,7 +230,6 @@
|
||||
\li \l{Deploying to Mobile Devices}
|
||||
\list
|
||||
\li \l{Deploying Applications to Android Devices}
|
||||
\li \l{Deploying Applications to BlackBerry 10 Devices}
|
||||
\li \l{Deploying Applications to Embedded Linux Devices}
|
||||
\li \l{Deploying Applications to QNX Neutrino Devices}
|
||||
\endlist
|
||||
@@ -238,7 +237,6 @@
|
||||
\list
|
||||
\li \l{Connecting Android Devices}
|
||||
\li \l{Connecting Bare Metal Devices}
|
||||
\li \l{Connecting BlackBerry 10 Devices}
|
||||
\li \l{Connecting Embedded Linux Devices}
|
||||
\li \l{Connecting iOS Devices}
|
||||
\li \l{Connecting QNX Devices}
|
||||
|
@@ -143,8 +143,8 @@
|
||||
\endlist
|
||||
|
||||
\note The SDK for a particular target platform might install additional
|
||||
templates for that platform. For example, the BlackBerry 10 and QNX templates are installed
|
||||
as part of the BlackBerry 10 NDK, BlackBerry NDK, or QNX SDK.
|
||||
templates for that platform. For example, the QNX templates are installed
|
||||
as part of the QNX SDK.
|
||||
|
||||
\QC creates the necessary boilerplate files. Some of the files are
|
||||
specific to a particular target platform.
|
||||
|
@@ -1,23 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8' standalone='no'?>
|
||||
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
|
||||
<id>ID</id>
|
||||
<name>PROJECTNAME</name>
|
||||
<versionNumber>1.0.0</versionNumber>
|
||||
<description>DESCRIPTION</description>
|
||||
<initialWindow>
|
||||
<systemChrome>none</systemChrome>
|
||||
<transparent>false</transparent>
|
||||
<autoOrients>true</autoOrients>
|
||||
<aspectRatio>landscape</aspectRatio>
|
||||
</initialWindow>
|
||||
<author>PUBLISHER</author>
|
||||
<copyright>COPYRIGHT</copyright>
|
||||
<arg>-style</arg>
|
||||
<!-- available styles are bb10dark and bb10bright -->
|
||||
<arg>bb10dark</arg>
|
||||
<env var="LD_LIBRARY_PATH" value="/usr/lib/qt4/lib:$LD_LIBRARY_PATH"/>
|
||||
<env var="QT_PLUGIN_PATH" value="/usr/lib/qt4/plugins:$QT_PLUGIN_PATH"/>
|
||||
<env var="QML_IMPORT_PATH" value="/usr/lib/qt4/imports:$QML_IMPORT_PATH"/>
|
||||
<action system="true">run_native</action>
|
||||
<asset type="Qnx/Elf" path="${BUILD_DIR}/TARGETNAME" entry="true">PROJECTNAME</asset>
|
||||
</qnx>
|
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
-->
|
||||
|
||||
<wizard version="1" kind="file" id="Q.QnxBlackBerryBarDescriptor" category="Q.BlackBerry"
|
||||
featuresRequired="QtSupport.Wizards.FeatureBlackBerry">
|
||||
<description>Creates an application descriptor file.</description>
|
||||
<displayname>Application descriptor</displayname>;
|
||||
<displaycategory>BlackBerry</displaycategory>
|
||||
<files>
|
||||
<file source="bar-descriptor.xml" openeditor="true"/>
|
||||
</files>
|
||||
</wizard>
|
@@ -1,13 +0,0 @@
|
||||
import bb.cascades 1.0
|
||||
|
||||
Page {
|
||||
Container {
|
||||
layout: DockLayout { }
|
||||
Label {
|
||||
text: qsTr("Hello World")
|
||||
textStyle.base: SystemDefaults.TextStyles.BigText
|
||||
verticalAlignment: VerticalAlignment.Center
|
||||
horizontalAlignment: HorizontalAlignment.Center
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8' standalone='no'?>
|
||||
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
|
||||
<id>com.example.%ProjectName%</id>
|
||||
<name>%ProjectName%</name>
|
||||
<versionNumber>1.0.0</versionNumber>
|
||||
<description>DESCRIPTION</description>
|
||||
<initialWindow>
|
||||
<systemChrome>none</systemChrome>
|
||||
<transparent>false</transparent>
|
||||
<autoOrients>true</autoOrients>
|
||||
<aspectRatio>landscape</aspectRatio>
|
||||
</initialWindow>
|
||||
<!-- The icon for the application, which should be 114x114. -->
|
||||
<icon>
|
||||
<image>icon.png</image>
|
||||
</icon>
|
||||
<action system="true">run_native</action>
|
||||
<!-- Application assets -->
|
||||
<env var="LD_LIBRARY_PATH" value="/usr/lib/qt4/lib:$LD_LIBRARY_PATH"/>
|
||||
<env var="QT_PLUGIN_PATH" value="/usr/lib/qt4/plugins:$QT_PLUGIN_PATH"/>
|
||||
<env var="QML_IMPORT_PATH" value="/usr/lib/qt4/imports:$QML_IMPORT_PATH"/>
|
||||
<asset path="icon.png">icon.png</asset>
|
||||
<asset path="assets">assets</asset>
|
||||
<asset type="Qnx/Elf" path="${BUILD_DIR}/TARGETNAME" entry="true">%ProjectName%</asset>
|
||||
</qnx>
|
Before Width: | Height: | Size: 10 KiB |
@@ -1,17 +0,0 @@
|
||||
TEMPLATE = app
|
||||
|
||||
LIBS += -lbbdata -lbb -lbbcascades
|
||||
QT += declarative xml
|
||||
|
||||
SOURCES += \
|
||||
src/main.%CppSourceSuffix% \
|
||||
src/applicationui.%CppSourceSuffix% \
|
||||
|
||||
HEADERS += \
|
||||
src/applicationui.%CppHeaderSuffix% \
|
||||
|
||||
DISTFILES += \
|
||||
bar-descriptor.xml \
|
||||
assets/main.qml \
|
||||
|
||||
|
@@ -1,22 +0,0 @@
|
||||
#include "applicationui.h"
|
||||
|
||||
#include <bb/cascades/Application>
|
||||
#include <bb/cascades/QmlDocument>
|
||||
#include <bb/cascades/AbstractPane>
|
||||
|
||||
using namespace bb::cascades;
|
||||
|
||||
ApplicationUI::ApplicationUI(Application *app) :
|
||||
QObject(app)
|
||||
{
|
||||
// By default the QmlDocument object is owned by the Application instance
|
||||
// and will have the lifespan of the application
|
||||
QmlDocument *qml = QmlDocument::create("asset:///main.qml");
|
||||
|
||||
// Create root object for the UI
|
||||
AbstractPane *root = qml->createRootObject<AbstractPane>();
|
||||
|
||||
// Set created root object as the application scene
|
||||
app->setScene(root);
|
||||
}
|
||||
|
@@ -1,20 +0,0 @@
|
||||
#ifndef APPLICATIONUI_H
|
||||
#define APPLICATIONUI_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace bb {
|
||||
namespace cascades {
|
||||
class Application;
|
||||
}
|
||||
}
|
||||
|
||||
class ApplicationUI : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ApplicationUI(bb::cascades::Application *app);
|
||||
virtual ~ApplicationUI() {}
|
||||
};
|
||||
|
||||
#endif /* APPLICATIONUI_H */
|
@@ -1,19 +0,0 @@
|
||||
#include "applicationui.h"
|
||||
|
||||
#include <bb/cascades/Application>
|
||||
|
||||
#include <Qt/qdeclarativedebug.h>
|
||||
|
||||
using namespace bb::cascades;
|
||||
|
||||
Q_DECL_EXPORT int main(int argc, char **argv)
|
||||
{
|
||||
Application app(argc, argv);
|
||||
|
||||
// Create the Application UI object, this is where the main.qml file
|
||||
// is loaded and the application scene is set.
|
||||
new ApplicationUI(&app);
|
||||
|
||||
// Enter the application main event loop.
|
||||
return Application::exec();
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2014 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
**************************************************************************/
|
||||
-->
|
||||
<wizard version="1" kind="project"
|
||||
class="qmakeproject" firstpage="10"
|
||||
id="Q.QnxBlackBerryCascadesApp" category="F.Application"
|
||||
featuresRequired="QtSupport.Wizards.FeatureBlackBerry">
|
||||
<icon>icon.png</icon>
|
||||
<displayname>BlackBerry Cascades Application</displayname>;
|
||||
<description>Creates a Cascades application for BlackBerry 10.</description>
|
||||
<files>
|
||||
<file source="assets/main.qml" openeditor="true"/>
|
||||
<file source="bar-descriptor.xml" openeditor="true"/>
|
||||
<file source="project.pro" target="%ProjectName%.pro" openproject="true"/>
|
||||
<file source="src/main.cpp" target="main.%CppSourceSuffix%" openeditor="true"/>
|
||||
<file source="src/applicationui.h" target="applicationui.%CppHeaderSuffix%" openproject="true"/>
|
||||
<file source="src/applicationui.cpp" target="applicationui.%CppSourceSuffix%" openproject="true"/>
|
||||
<file source="icon.png"/>
|
||||
</files>
|
||||
</wizard>
|
@@ -1,21 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8' standalone='no'?>
|
||||
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
|
||||
<id>ID</id>
|
||||
<name>PROJECTNAME</name>
|
||||
<versionNumber>1.0.0</versionNumber>
|
||||
<description>DESCRIPTION</description>
|
||||
<copyright>COPYRIGHT</copyright>
|
||||
<initialWindow>
|
||||
<systemChrome>none</systemChrome>
|
||||
<transparent>false</transparent>
|
||||
<autoOrients>true</autoOrients>
|
||||
<aspectRatio>landscape</aspectRatio>
|
||||
</initialWindow>
|
||||
<env value="/usr/lib/qt5/lib:$LD_LIBRARY_PATH" var="LD_LIBRARY_PATH"/>
|
||||
<env value="/usr/lib/qt5/plugins:$QT_PLUGIN_PATH" var="QT_PLUGIN_PATH"/>
|
||||
<env value="/usr/lib/qt5/imports:$QML_IMPORT_PATH" var="QML_IMPORT_PATH"/>
|
||||
<env value="/usr/lib/qt5/qml:$QML2_IMPORT_PATH" var="QML2_IMPORT_PATH"/>
|
||||
<action system="true">run_native</action>
|
||||
<asset path="${BUILD_DIR}/TARGETNAME" entry="true" type="Qnx/Elf">PROJECTNAME</asset>
|
||||
<author>PUBLISHER</author>
|
||||
</qnx>
|
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
-->
|
||||
|
||||
<wizard version="1" kind="file" id="Q.QnxBlackBerryBarDescriptor" category="Q.BlackBerry"
|
||||
featuresRequired="QtSupport.Wizards.FeatureBlackBerry">
|
||||
<description>Creates an Qt5 application descriptor file.</description>
|
||||
<displayname>Qt5 Application descriptor</displayname>;
|
||||
<displaycategory>BlackBerry</displaycategory>
|
||||
<files>
|
||||
<file source="bar-descriptor.xml" openeditor="true"/>
|
||||
</files>
|
||||
</wizard>
|
@@ -39,7 +39,7 @@
|
||||
</tutorial>
|
||||
<tutorial imageUrl="images/icons/ddays13.png" difficulty="" projectPath="" name="Targeting Multiple Mobile Platforms with Qt Creator" isVideo="true" videoUrl="http://www.youtube.com/watch?v=jDRup5z2qz0" videoLength="52:38">
|
||||
<description><![CDATA[Using Qt Creator to develop a cross-platform application for mobile devices and other small devices.]]></description>
|
||||
<tags>qt creator,qt quick,qml,c++,android,blackberry,sailfishos</tags>
|
||||
<tags>qt creator,qt quick,qml,c++,android,sailfishos</tags>
|
||||
</tutorial>
|
||||
<tutorial imageUrl="images/icons/ddays13.png" difficulty="" projectPath="" name="Step by Step Qt on Android Tutorial" isVideo="true" videoUrl="http://www.youtube.com/watch?v=yhdi6JONtQo" videoLength="1:02:30">
|
||||
<description><![CDATA[Using Qt Creator to develop a Qt Quick application for Android devices.]]></description>
|
||||
|
@@ -130,8 +130,7 @@ QList<GeneratorInfo> GeneratorInfo::generatorInfosFor(ProjectExplorer::Kit *k, N
|
||||
if (deviceType != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE
|
||||
&& deviceType != BareMetal::Constants::BareMetalOsType
|
||||
&& deviceType != RemoteLinux::Constants::GenericLinuxOsType
|
||||
&& deviceType != Qnx::Constants::QNX_QNX_OS_TYPE
|
||||
&& deviceType != Qnx::Constants::QNX_BB_OS_TYPE)
|
||||
&& deviceType != Qnx::Constants::QNX_QNX_OS_TYPE)
|
||||
return results;
|
||||
ProjectExplorer::Abi targetAbi = tc->targetAbi();
|
||||
if (n != ForceNinja) {
|
||||
|
@@ -118,9 +118,7 @@ static QStringList targetOSList(const ProjectExplorer::Abi &abi, const ProjectEx
|
||||
os << QLatin1String("bsd") << QLatin1String("unix");
|
||||
break;
|
||||
case ProjectExplorer::Abi::UnixOS:
|
||||
if (device == QNX_BB_OS_TYPE)
|
||||
os << QLatin1String("blackberry") << QLatin1String("qnx");
|
||||
else if (device == QNX_QNX_OS_TYPE)
|
||||
if (device == QNX_QNX_OS_TYPE)
|
||||
os << QLatin1String("qnx");
|
||||
else if (abi.osFlavor() == ProjectExplorer::Abi::SolarisUnixFlavor)
|
||||
os << QLatin1String("solaris");
|
||||
|
@@ -13,7 +13,7 @@
|
||||
\"Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 or version 3 as published by the Free Software Foundation. Please review the following information to ensure the GNU Lesser General Public License requirements will be met: https://www.gnu.org/licenses/lgpl.html and http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\"
|
||||
],
|
||||
\"Category\" : \"Device Support\",
|
||||
\"Description\" : \"Adds support for QNX and BlackBerry 10 to Qt Creator.\",
|
||||
\"Description\" : \"Adds support for QNX to Qt Creator.\",
|
||||
\"Url\" : \"http://www.blackberry.com\",
|
||||
$$dependencyList
|
||||
}
|
||||
|
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
||||
<mime-type type="application/z-vnd.rim.qnx.bar_descriptor">
|
||||
<comment>BAR descriptor file (BlackBerry)</comment>
|
||||
<sub-class-of type="application/xml"/>
|
||||
<glob pattern="*.xml"/>
|
||||
<magic>
|
||||
<match value="<qnx>" type="string" offset="0:1000"/>
|
||||
</magic>
|
||||
</mime-type>
|
||||
</mime-info>
|
@@ -1,690 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "bardescriptordocument.h"
|
||||
|
||||
#include "qnxconstants.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QMetaEnum>
|
||||
#include <QTextCodec>
|
||||
#include <QSet>
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BarDescriptorDocument::BarDescriptorDocument(QObject *parent)
|
||||
: Core::BaseTextDocument(parent)
|
||||
{
|
||||
setId(Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID);
|
||||
setMimeType(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE));
|
||||
// blackberry-nativepackager requires the XML file to be in UTF-8 encoding,
|
||||
// force if possible
|
||||
if (QTextCodec *defaultUTF8 = QTextCodec::codecForName("UTF-8"))
|
||||
setCodec(defaultUTF8);
|
||||
else
|
||||
setCodec(Core::EditorManager::defaultTextCodec());
|
||||
}
|
||||
|
||||
BarDescriptorDocument::~BarDescriptorDocument()
|
||||
{
|
||||
}
|
||||
|
||||
bool BarDescriptorDocument::open(QString *errorString, const QString &fileName) {
|
||||
QString contents;
|
||||
if (read(fileName, &contents, errorString) != Utils::TextFileFormat::ReadSuccess)
|
||||
return false;
|
||||
|
||||
setFilePath(Utils::FileName::fromString(fileName));
|
||||
|
||||
const bool result = loadContent(contents, false);
|
||||
|
||||
if (!result)
|
||||
*errorString = tr("%1 does not appear to be a valid application descriptor file").arg(QDir::toNativeSeparators(fileName));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool BarDescriptorDocument::save(QString *errorString, const QString &fn, bool autoSave)
|
||||
{
|
||||
QTC_ASSERT(!autoSave, return false);
|
||||
QTC_ASSERT(fn.isEmpty(), return false);
|
||||
|
||||
const bool result = write(filePath().toString(), xmlSource(), errorString);
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
m_dirty = false;
|
||||
emit Core::IDocument::changed();
|
||||
return true;
|
||||
}
|
||||
|
||||
QString BarDescriptorDocument::defaultPath() const
|
||||
{
|
||||
return filePath().toFileInfo().absolutePath();
|
||||
}
|
||||
|
||||
QString BarDescriptorDocument::suggestedFileName() const
|
||||
{
|
||||
return filePath().fileName();
|
||||
}
|
||||
|
||||
bool BarDescriptorDocument::shouldAutoSave() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BarDescriptorDocument::isModified() const
|
||||
{
|
||||
return m_dirty;
|
||||
}
|
||||
|
||||
bool BarDescriptorDocument::isSaveAsAllowed() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Core::IDocument::ReloadBehavior BarDescriptorDocument::reloadBehavior(Core::IDocument::ChangeTrigger state, Core::IDocument::ChangeType type) const
|
||||
{
|
||||
if (type == TypeRemoved || type == TypePermissions)
|
||||
return BehaviorSilent;
|
||||
if (type == TypeContents && state == TriggerInternal && !isModified())
|
||||
return BehaviorSilent;
|
||||
return BehaviorAsk;
|
||||
}
|
||||
|
||||
bool BarDescriptorDocument::reload(QString *errorString, Core::IDocument::ReloadFlag flag, Core::IDocument::ChangeType type)
|
||||
{
|
||||
Q_UNUSED(type);
|
||||
|
||||
if (flag == Core::IDocument::FlagIgnore)
|
||||
return true;
|
||||
|
||||
return open(errorString, filePath().toString());
|
||||
}
|
||||
|
||||
QString BarDescriptorDocument::xmlSource() const
|
||||
{
|
||||
const int indent = 4;
|
||||
return m_barDocument.toString(indent);
|
||||
}
|
||||
|
||||
bool BarDescriptorDocument::loadContent(const QString &xmlCode, bool setDirty, QString *errorMessage, int *errorLine)
|
||||
{
|
||||
if (xmlCode == xmlSource())
|
||||
return true;
|
||||
|
||||
bool result = m_barDocument.setContent(xmlCode, errorMessage, errorLine);
|
||||
|
||||
m_dirty = setDirty;
|
||||
|
||||
emitAllChanged();
|
||||
emit Core::IDocument::changed();
|
||||
return result;
|
||||
}
|
||||
|
||||
QVariant BarDescriptorDocument::value(BarDescriptorDocument::Tag tag) const
|
||||
{
|
||||
const QString tagName = QString::fromLatin1(metaObject()->enumerator(metaObject()->enumeratorOffset()).valueToKey(tag));
|
||||
|
||||
switch (tag) {
|
||||
case id:
|
||||
case versionNumber:
|
||||
case buildId:
|
||||
case name:
|
||||
case description:
|
||||
case author:
|
||||
case publisher:
|
||||
case authorId:
|
||||
return stringValue(tagName);
|
||||
case icon:
|
||||
return childStringListValue(tagName, QLatin1String("image")).value(0);
|
||||
case splashScreens:
|
||||
return childStringListValue(tagName, QLatin1String("image"));
|
||||
case asset: {
|
||||
QVariant var;
|
||||
var.setValue(assets());
|
||||
return var;
|
||||
}
|
||||
case aspectRatio:
|
||||
case autoOrients:
|
||||
case systemChrome:
|
||||
return childStringListValue(QLatin1String("initialWindow"), tagName).value(0);
|
||||
case transparent:
|
||||
return childStringListValue(QLatin1String("initialWindow"), tagName).value(0) == QLatin1String("true");
|
||||
case arg:
|
||||
case action:
|
||||
return stringListValue(tagName);
|
||||
case env:
|
||||
QVariant var;
|
||||
var.setValue(environment());
|
||||
return var;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void BarDescriptorDocument::setValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||
{
|
||||
const QMetaEnum tagEnum = metaObject()->enumerator(metaObject()->enumeratorOffset());
|
||||
const QString tagName = QString::fromLatin1(tagEnum.valueToKey(tag));
|
||||
|
||||
switch (tag) {
|
||||
case id:
|
||||
case versionNumber:
|
||||
case buildId:
|
||||
case name:
|
||||
case description:
|
||||
case authorId:
|
||||
setStringValue(tagName, value.toString());
|
||||
break;
|
||||
case icon:
|
||||
case splashScreens:
|
||||
setChildStringListValue(tagName, QLatin1String("image"), value.toStringList());
|
||||
break;
|
||||
case asset:
|
||||
setAssets(value.value<BarDescriptorAssetList>());
|
||||
break;
|
||||
case aspectRatio:
|
||||
case autoOrients:
|
||||
case systemChrome:
|
||||
setChildStringListValue(QLatin1String("initialWindow"), tagName, value.toStringList());
|
||||
break;
|
||||
case transparent:
|
||||
setChildStringListValue(QLatin1String("initialWindow"), tagName, QStringList() << (value.toBool() ? QLatin1String("true") : QLatin1String("false")));
|
||||
break;
|
||||
case arg:
|
||||
case action:
|
||||
setStringListValue(tagName, value.toStringList());
|
||||
break;
|
||||
case env:
|
||||
setEnvironment(value.value<QList<Utils::EnvironmentItem> >());
|
||||
break;
|
||||
case author:
|
||||
case publisher:
|
||||
// Unset <publisher> when setting <author> as only one should be used
|
||||
setStringValue(QString::fromLatin1(tagEnum.valueToKey(author)), value.toString());
|
||||
setStringValue(QString::fromLatin1(tagEnum.valueToKey(publisher)), QLatin1String(""));
|
||||
break;
|
||||
}
|
||||
|
||||
m_dirty = true;
|
||||
emit changed(tag, value);
|
||||
emit Core::IDocument::changed();
|
||||
}
|
||||
|
||||
QString BarDescriptorDocument::stringValue(const QString &tagName) const
|
||||
{
|
||||
QDomNodeList nodes = m_barDocument.elementsByTagName(tagName);
|
||||
if (nodes.isEmpty() || nodes.size() > 1)
|
||||
return QString();
|
||||
|
||||
QDomNode node = nodes.item(0);
|
||||
QDomText textNode = node.firstChild().toText();
|
||||
if (textNode.isNull())
|
||||
return QString();
|
||||
|
||||
return textNode.data();
|
||||
}
|
||||
|
||||
void BarDescriptorDocument::setStringValue(const QString &tagName, const QString &value)
|
||||
{
|
||||
QDomNodeList nodes = m_barDocument.elementsByTagName(tagName);
|
||||
|
||||
if (nodes.size() > 1)
|
||||
return;
|
||||
|
||||
QDomNode existingNode = nodes.item(0);
|
||||
if (existingNode.isNull() && value.isEmpty())
|
||||
return;
|
||||
|
||||
if (!existingNode.isNull() && value.isEmpty()) {
|
||||
m_barDocument.documentElement().removeChild(existingNode);
|
||||
} else if (existingNode.isNull()) {
|
||||
QDomElement newNode = m_barDocument.createElement(tagName);
|
||||
newNode.appendChild(m_barDocument.createTextNode(value));
|
||||
m_barDocument.documentElement().appendChild(newNode);
|
||||
} else {
|
||||
QDomText textNode = existingNode.firstChild().toText();
|
||||
if (textNode.isNull())
|
||||
return;
|
||||
textNode.setData(value);
|
||||
}
|
||||
}
|
||||
|
||||
QStringList BarDescriptorDocument::childStringListValue(const QString &tagName, const QString &childTagName) const
|
||||
{
|
||||
QDomNodeList nodes = m_barDocument.elementsByTagName(tagName);
|
||||
if (nodes.isEmpty() || nodes.size() > 1)
|
||||
return QStringList();
|
||||
|
||||
QDomNode parentNode = nodes.item(0);
|
||||
QDomElement childElm = parentNode.firstChildElement(childTagName);
|
||||
if (childElm.isNull())
|
||||
return QStringList();
|
||||
|
||||
QStringList result;
|
||||
while (!childElm.isNull()) {
|
||||
QDomText textNode = childElm.firstChild().toText();
|
||||
if (textNode.isNull())
|
||||
return QStringList();
|
||||
|
||||
result.append(textNode.data());
|
||||
|
||||
childElm = childElm.nextSiblingElement(childTagName);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void BarDescriptorDocument::setChildStringListValue(const QString &tagName, const QString &childTagName, const QStringList &stringList)
|
||||
{
|
||||
QDomNodeList nodes = m_barDocument.elementsByTagName(tagName);
|
||||
|
||||
if (nodes.size() > 1)
|
||||
return;
|
||||
|
||||
QDomNode existingNode = nodes.item(0);
|
||||
|
||||
if (existingNode.isNull()) {
|
||||
QDomElement newParentNode = m_barDocument.createElement(tagName);
|
||||
|
||||
foreach (const QString &value, stringList) {
|
||||
QDomElement newChildNode = m_barDocument.createElement(childTagName);
|
||||
QDomText newTextNode = m_barDocument.createTextNode(value);
|
||||
newChildNode.appendChild(newTextNode);
|
||||
newParentNode.appendChild(newChildNode);
|
||||
}
|
||||
m_barDocument.documentElement().appendChild(newParentNode);
|
||||
} else {
|
||||
QStringList values = stringList;
|
||||
QDomElement childElm = existingNode.firstChildElement(childTagName);
|
||||
if (!childElm.isNull()) {
|
||||
// Loop through existing elements, remove the existing nodes
|
||||
// that no longer are in "values", and remove from "values"
|
||||
// the existing nodes that don't need re-creation
|
||||
while (!childElm.isNull()) {
|
||||
QDomText textNode = childElm.firstChild().toText();
|
||||
if (textNode.isNull())
|
||||
continue;
|
||||
|
||||
QDomElement toRemove;
|
||||
if (!values.contains(textNode.data()))
|
||||
toRemove = childElm;
|
||||
else
|
||||
values.removeAll(textNode.data());
|
||||
|
||||
childElm = childElm.nextSiblingElement(childTagName);
|
||||
|
||||
if (!toRemove.isNull())
|
||||
existingNode.removeChild(toRemove);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the new elements
|
||||
int newElementCount = 0;
|
||||
foreach (const QString &value, values) {
|
||||
if (value.isEmpty())
|
||||
continue;
|
||||
QDomElement newChildNode = m_barDocument.createElement(childTagName);
|
||||
newChildNode.appendChild(m_barDocument.createTextNode(value));
|
||||
existingNode.appendChild(newChildNode);
|
||||
++newElementCount;
|
||||
}
|
||||
|
||||
if (newElementCount == 0)
|
||||
m_barDocument.documentElement().removeChild(existingNode);
|
||||
}
|
||||
}
|
||||
|
||||
QStringList BarDescriptorDocument::stringListValue(const QString &tagName) const
|
||||
{
|
||||
QStringList result;
|
||||
|
||||
QDomElement childElm = m_barDocument.documentElement().firstChildElement(tagName);
|
||||
while (!childElm.isNull()) {
|
||||
QDomText textNode = childElm.firstChild().toText();
|
||||
if (textNode.isNull())
|
||||
continue;
|
||||
|
||||
result.append(textNode.data());
|
||||
|
||||
childElm = childElm.nextSiblingElement(tagName);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void BarDescriptorDocument::setStringListValue(const QString &tagName, const QStringList &stringList)
|
||||
{
|
||||
QStringList values = stringList;
|
||||
QDomElement childElm = m_barDocument.documentElement().firstChildElement(tagName);
|
||||
if (!childElm.isNull()) {
|
||||
// Loop through existing elements, remove the existing nodes
|
||||
// that no longer are in "values", and remove from "values"
|
||||
// the existing nodes that don't need re-creation
|
||||
while (!childElm.isNull()) {
|
||||
QDomText textNode = childElm.firstChild().toText();
|
||||
if (textNode.isNull())
|
||||
continue;
|
||||
|
||||
QDomElement toRemove;
|
||||
if (!values.contains(textNode.data()))
|
||||
toRemove = childElm;
|
||||
else
|
||||
values.removeAll(textNode.data());
|
||||
|
||||
childElm = childElm.nextSiblingElement(tagName);
|
||||
|
||||
if (!toRemove.isNull())
|
||||
m_barDocument.documentElement().removeChild(toRemove);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the new elements
|
||||
foreach (const QString &value, values) {
|
||||
if (value.isEmpty())
|
||||
continue;
|
||||
QDomElement newChildNode = m_barDocument.createElement(tagName);
|
||||
newChildNode.appendChild(m_barDocument.createTextNode(value));
|
||||
m_barDocument.documentElement().appendChild(newChildNode);
|
||||
}
|
||||
}
|
||||
|
||||
BarDescriptorAssetList BarDescriptorDocument::assets() const
|
||||
{
|
||||
BarDescriptorAssetList result;
|
||||
QDomNodeList nodes = m_barDocument.elementsByTagName(QLatin1String("asset"));
|
||||
if (nodes.isEmpty())
|
||||
return result;
|
||||
|
||||
for (int i = 0; i < nodes.size(); ++i) {
|
||||
QDomElement assetElm = nodes.item(i).toElement();
|
||||
if (assetElm.isNull())
|
||||
continue;
|
||||
|
||||
QDomText textNode = assetElm.firstChild().toText();
|
||||
if (textNode.isNull())
|
||||
continue;
|
||||
|
||||
QString path = assetElm.attribute(QLatin1String("path"));
|
||||
QString entry = assetElm.attribute(QLatin1String("entry"));
|
||||
QString dest = textNode.data();
|
||||
|
||||
BarDescriptorAsset asset;
|
||||
asset.source = path;
|
||||
asset.destination = dest;
|
||||
asset.entry = entry == QLatin1String("true");
|
||||
result.append(asset);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void BarDescriptorDocument::setAssets(const BarDescriptorAssetList &assets)
|
||||
{
|
||||
QDomNodeList nodes = m_barDocument.elementsByTagName(QLatin1String("asset"));
|
||||
|
||||
BarDescriptorAssetList newAssets = assets;
|
||||
QList<QDomNode> toRemove;
|
||||
|
||||
for (int i = 0; i < nodes.size(); ++i) {
|
||||
QDomElement assetElm = nodes.at(i).toElement();
|
||||
if (assetElm.isNull())
|
||||
continue;
|
||||
|
||||
QDomText textNode = assetElm.firstChild().toText();
|
||||
if (textNode.isNull())
|
||||
continue;
|
||||
|
||||
QString source = assetElm.attribute(QLatin1String("path"));
|
||||
bool found = false;
|
||||
foreach (const BarDescriptorAsset &asset, newAssets) {
|
||||
if (asset.source == source) {
|
||||
found = true;
|
||||
if (asset.entry) {
|
||||
assetElm.setAttribute(QLatin1String("type"), QLatin1String("Qnx/Elf"));
|
||||
assetElm.setAttribute(QLatin1String("entry"), QLatin1String("true"));
|
||||
} else {
|
||||
assetElm.removeAttribute(QLatin1String("type"));
|
||||
assetElm.removeAttribute(QLatin1String("entry"));
|
||||
}
|
||||
textNode.setData(asset.destination);
|
||||
|
||||
newAssets.removeAll(asset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
toRemove.append(assetElm);
|
||||
}
|
||||
|
||||
foreach (const QDomNode &node, toRemove)
|
||||
m_barDocument.documentElement().removeChild(node);
|
||||
|
||||
foreach (const BarDescriptorAsset &asset, newAssets) {
|
||||
QDomElement assetElm = m_barDocument.createElement(QLatin1String("asset"));
|
||||
assetElm.setAttribute(QLatin1String("path"), asset.source);
|
||||
if (asset.entry) {
|
||||
assetElm.setAttribute(QLatin1String("type"), QLatin1String("Qnx/Elf"));
|
||||
assetElm.setAttribute(QLatin1String("entry"), QLatin1String("true"));
|
||||
}
|
||||
assetElm.appendChild(m_barDocument.createTextNode(asset.destination));
|
||||
m_barDocument.documentElement().appendChild(assetElm);
|
||||
}
|
||||
}
|
||||
|
||||
QList<Utils::EnvironmentItem> BarDescriptorDocument::environment() const
|
||||
{
|
||||
QList<Utils::EnvironmentItem> result;
|
||||
|
||||
QDomElement envElm = m_barDocument.documentElement().firstChildElement(QLatin1String("env"));
|
||||
while (!envElm.isNull()) {
|
||||
QString var = envElm.attribute(QLatin1String("var"));
|
||||
QString value = envElm.attribute(QLatin1String("value"));
|
||||
|
||||
Utils::EnvironmentItem item(var, value);
|
||||
result.append(item);
|
||||
|
||||
envElm = envElm.nextSiblingElement(QLatin1String("env"));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void BarDescriptorDocument::setEnvironment(const QList<Utils::EnvironmentItem> &environment)
|
||||
{
|
||||
QDomNodeList envNodes = m_barDocument.elementsByTagName(QLatin1String("env"));
|
||||
|
||||
QList<Utils::EnvironmentItem> newEnvironment = environment;
|
||||
QList<QDomElement> toRemove;
|
||||
for (int i = 0; i < envNodes.size(); ++i) {
|
||||
QDomElement elm = envNodes.at(i).toElement();
|
||||
if (elm.isNull())
|
||||
continue;
|
||||
|
||||
QString var = elm.attribute(QLatin1String("var"));
|
||||
bool found = false;
|
||||
foreach (const Utils::EnvironmentItem item, newEnvironment) {
|
||||
if (item.name == var) {
|
||||
found = true;
|
||||
elm.setAttribute(QLatin1String("value"), item.value);
|
||||
newEnvironment.removeAll(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
toRemove.append(elm);
|
||||
}
|
||||
|
||||
foreach (const QDomNode &node, toRemove)
|
||||
m_barDocument.documentElement().removeChild(node);
|
||||
|
||||
foreach (const Utils::EnvironmentItem item, newEnvironment) {
|
||||
QDomElement elm = m_barDocument.createElement(QLatin1String("env"));
|
||||
elm.setAttribute(QLatin1String("var"), item.name);
|
||||
elm.setAttribute(QLatin1String("value"), item.value);
|
||||
m_barDocument.documentElement().appendChild(elm);
|
||||
}
|
||||
}
|
||||
|
||||
void BarDescriptorDocument::emitAllChanged()
|
||||
{
|
||||
QMetaEnum tags = metaObject()->enumerator(metaObject()->enumeratorOffset());
|
||||
for (int i = 0; i < tags.keyCount(); ++i) {
|
||||
Tag tag = static_cast<Tag>(tags.value(i));
|
||||
emit changed(tag, value(tag));
|
||||
}
|
||||
}
|
||||
|
||||
QString BarDescriptorDocument::bannerComment() const
|
||||
{
|
||||
QDomNode nd = m_barDocument.firstChild();
|
||||
QDomProcessingInstruction pi = nd.toProcessingInstruction();
|
||||
if (!pi.isNull())
|
||||
nd = pi.nextSibling();
|
||||
|
||||
return nd.toComment().data();
|
||||
}
|
||||
|
||||
void BarDescriptorDocument::setBannerComment(const QString &commentText)
|
||||
{
|
||||
QDomNode nd = m_barDocument.firstChild();
|
||||
QDomProcessingInstruction pi = nd.toProcessingInstruction();
|
||||
if (!pi.isNull())
|
||||
nd = pi.nextSibling();
|
||||
|
||||
bool oldDirty = m_dirty;
|
||||
QDomComment cnd = nd.toComment();
|
||||
if (cnd.isNull()) {
|
||||
if (!commentText.isEmpty()) {
|
||||
cnd = m_barDocument.createComment(commentText);
|
||||
m_barDocument.insertBefore(cnd, nd);
|
||||
m_dirty = true;
|
||||
}
|
||||
} else {
|
||||
if (commentText.isEmpty()) {
|
||||
m_barDocument.removeChild(cnd);
|
||||
m_dirty = true;
|
||||
} else {
|
||||
if (cnd.data() != commentText) {
|
||||
cnd.setData(commentText);
|
||||
m_dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_dirty != oldDirty)
|
||||
emit Core::IDocument::changed();
|
||||
}
|
||||
|
||||
int BarDescriptorDocument::tagForElement(const QDomElement &element)
|
||||
{
|
||||
QMetaEnum tags = metaObject()->enumerator(metaObject()->enumeratorOffset());
|
||||
QDomElement el = element;
|
||||
while (!el.isNull()) {
|
||||
const int n = tags.keyToValue(el.tagName().toLatin1().constData());
|
||||
if (n > -1)
|
||||
return n;
|
||||
el = el.parentNode().toElement();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool BarDescriptorDocument::expandPlaceHolder_helper(const QDomElement &el,
|
||||
const QString &placeholderKey,
|
||||
const QString &placeholderText,
|
||||
QSet<BarDescriptorDocument::Tag> &changedTags)
|
||||
{
|
||||
// replace attributes
|
||||
bool elementChanged = false;
|
||||
QDomNamedNodeMap attrs = el.attributes();
|
||||
for (int i = 0; i < attrs.count(); ++i) {
|
||||
QDomAttr attr = attrs.item(i).toAttr();
|
||||
if (!attr.isNull()) {
|
||||
QString s = attr.value();
|
||||
s.replace(placeholderKey, placeholderText);
|
||||
if (s != attr.value()) {
|
||||
attr.setValue(s);
|
||||
elementChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool documentChanged = false;
|
||||
// replace text
|
||||
for (QDomNode nd = el.firstChild(); !nd.isNull(); nd = nd.nextSibling()) {
|
||||
QDomText txtnd = nd.toText();
|
||||
if (!txtnd.isNull()) {
|
||||
QString s = txtnd.data();
|
||||
s.replace(placeholderKey, placeholderText);
|
||||
if (s != txtnd.data()) {
|
||||
txtnd.setData(s);
|
||||
elementChanged = true;
|
||||
}
|
||||
}
|
||||
QDomElement child = nd.toElement();
|
||||
if (!child.isNull()) {
|
||||
bool hit = expandPlaceHolder_helper(child, placeholderKey, placeholderText, changedTags);
|
||||
documentChanged = documentChanged || hit;
|
||||
}
|
||||
}
|
||||
if (elementChanged) {
|
||||
int n = tagForElement(el);
|
||||
if (n >= 0)
|
||||
changedTags << static_cast<Tag>(n);
|
||||
}
|
||||
documentChanged = documentChanged || elementChanged;
|
||||
return documentChanged;
|
||||
}
|
||||
|
||||
void BarDescriptorDocument::expandPlaceHolders(const QHash<QString, QString> &placeholdersKeyVals)
|
||||
{
|
||||
QSet<Tag> changedTags;
|
||||
QHashIterator<QString, QString> it(placeholdersKeyVals);
|
||||
bool docChanged = false;
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
bool expanded = expandPlaceHolder_helper(m_barDocument.documentElement(),
|
||||
it.key(), it.value(), changedTags);
|
||||
docChanged = docChanged || expanded;
|
||||
}
|
||||
m_dirty = m_dirty || docChanged;
|
||||
foreach (Tag tag, changedTags)
|
||||
emit changed(tag, value(tag));
|
||||
if (docChanged)
|
||||
emit Core::IDocument::changed();
|
||||
}
|
@@ -1,152 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BARDESCRIPTORDOCUMENT_H
|
||||
#define QNX_INTERNAL_BARDESCRIPTORDOCUMENT_H
|
||||
|
||||
#include <coreplugin/textdocument.h>
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QDomDocument>
|
||||
#include <QMetaType>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BarDescriptorAsset {
|
||||
public:
|
||||
QString source;
|
||||
QString destination;
|
||||
bool entry;
|
||||
|
||||
bool operator==(const BarDescriptorAsset &asset) const
|
||||
{
|
||||
return source == asset.source && destination == asset.destination;
|
||||
}
|
||||
};
|
||||
|
||||
typedef QList<BarDescriptorAsset> BarDescriptorAssetList;
|
||||
|
||||
class BarDescriptorDocument : public Core::BaseTextDocument
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_ENUMS(Tag)
|
||||
|
||||
public:
|
||||
enum Tag {
|
||||
id = 0,
|
||||
versionNumber,
|
||||
buildId,
|
||||
name,
|
||||
description,
|
||||
icon,
|
||||
splashScreens,
|
||||
asset,
|
||||
aspectRatio,
|
||||
autoOrients,
|
||||
systemChrome,
|
||||
transparent,
|
||||
arg,
|
||||
action,
|
||||
env,
|
||||
author,
|
||||
publisher,
|
||||
authorId
|
||||
};
|
||||
|
||||
explicit BarDescriptorDocument(QObject *parent = 0);
|
||||
~BarDescriptorDocument();
|
||||
|
||||
bool open(QString *errorString, const QString &fileName);
|
||||
bool save(QString *errorString, const QString &fileName = QString(), bool autoSave = false);
|
||||
|
||||
QString defaultPath() const;
|
||||
QString suggestedFileName() const;
|
||||
|
||||
bool shouldAutoSave() const;
|
||||
bool isModified() const;
|
||||
bool isSaveAsAllowed() const;
|
||||
|
||||
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
|
||||
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
|
||||
|
||||
QString xmlSource() const;
|
||||
bool loadContent(const QString &xmlCode, bool setDirty, QString *errorMessage = 0, int *errorLine = 0);
|
||||
|
||||
QVariant value(Tag tag) const;
|
||||
|
||||
void expandPlaceHolders(const QHash<QString, QString> &placeholdersKeyVals);
|
||||
|
||||
QString bannerComment() const;
|
||||
void setBannerComment(const QString &commentText);
|
||||
|
||||
signals:
|
||||
void changed(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||
|
||||
public slots:
|
||||
void setValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||
private:
|
||||
QString stringValue(const QString &tagName) const;
|
||||
void setStringValue(const QString &tagName, const QString &value);
|
||||
|
||||
QStringList childStringListValue(const QString &tagName, const QString &childTagName) const;
|
||||
void setChildStringListValue(const QString &tagName, const QString &childTagName, const QStringList &stringList);
|
||||
|
||||
QStringList stringListValue(const QString &tagName) const;
|
||||
void setStringListValue(const QString &tagName, const QStringList &stringList);
|
||||
|
||||
BarDescriptorAssetList assets() const;
|
||||
void setAssets(const BarDescriptorAssetList &assets);
|
||||
|
||||
QList<Utils::EnvironmentItem> environment() const;
|
||||
void setEnvironment(const QList<Utils::EnvironmentItem> &environment);
|
||||
|
||||
int tagForElement(const QDomElement &element);
|
||||
bool expandPlaceHolder_helper(const QDomElement &el, const QString &placeholderKey,
|
||||
const QString &placeholderText,
|
||||
QSet<BarDescriptorDocument::Tag> &changedTags);
|
||||
|
||||
void emitAllChanged();
|
||||
|
||||
bool m_dirty;
|
||||
QDomDocument m_barDocument;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
Q_DECLARE_METATYPE(Qnx::Internal::BarDescriptorAssetList)
|
||||
Q_DECLARE_METATYPE(QList<Utils::EnvironmentItem>)
|
||||
Q_DECLARE_METATYPE(Qnx::Internal::BarDescriptorDocument::Tag)
|
||||
|
||||
#endif // QNX_INTERNAL_BARDESCRIPTORDOCUMENT_H
|
@@ -1,172 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "bardescriptoreditor.h"
|
||||
|
||||
#include "qnxconstants.h"
|
||||
#include "bardescriptoreditorwidget.h"
|
||||
#include "bardescriptordocument.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/task.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
#include <texteditor/texteditor.h>
|
||||
#include <texteditor/textdocument.h>
|
||||
#include <texteditor/tabsettings.h>
|
||||
#include <utils/linecolumnlabel.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QStyle>
|
||||
#include <QTextBlock>
|
||||
#include <QToolBar>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
BarDescriptorEditor::BarDescriptorEditor()
|
||||
{
|
||||
m_file = new BarDescriptorDocument(this);
|
||||
|
||||
BarDescriptorEditorWidget *editorWidget = new BarDescriptorEditorWidget(this);
|
||||
setWidget(editorWidget);
|
||||
|
||||
m_toolBar = new QToolBar(editorWidget);
|
||||
|
||||
m_actionGroup = new QActionGroup(this);
|
||||
connect(m_actionGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeEditorPage(QAction*)));
|
||||
|
||||
QAction *generalAction = m_toolBar->addAction(tr("General"));
|
||||
generalAction->setData(General);
|
||||
generalAction->setCheckable(true);
|
||||
m_actionGroup->addAction(generalAction);
|
||||
|
||||
QAction *applicationAction = m_toolBar->addAction(tr("Application"));
|
||||
applicationAction->setData(Application);
|
||||
applicationAction->setCheckable(true);
|
||||
m_actionGroup->addAction(applicationAction);
|
||||
|
||||
QAction *assetsAction = m_toolBar->addAction(tr("Assets"));
|
||||
assetsAction->setData(Assets);
|
||||
assetsAction->setCheckable(true);
|
||||
m_actionGroup->addAction(assetsAction);
|
||||
|
||||
QAction *sourceAction = m_toolBar->addAction(tr("XML Source"));
|
||||
sourceAction->setData(Source);
|
||||
sourceAction->setCheckable(true);
|
||||
m_actionGroup->addAction(sourceAction);
|
||||
|
||||
generalAction->setChecked(true);
|
||||
|
||||
m_cursorPositionLabel = new Utils::LineColumnLabel;
|
||||
const int spacing = editorWidget->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2;
|
||||
m_cursorPositionLabel->setContentsMargins(spacing, 0, spacing, 0);
|
||||
|
||||
QWidget *spacer = new QWidget;
|
||||
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
m_toolBar->addWidget(spacer);
|
||||
|
||||
m_cursorPositionAction = m_toolBar->addWidget(m_cursorPositionLabel);
|
||||
connect(editorWidget->sourceWidget(), SIGNAL(cursorPositionChanged()), this, SLOT(updateCursorPosition()));
|
||||
|
||||
setContext(Core::Context(Constants::QNX_BAR_DESCRIPTOR_EDITOR_CONTEXT,
|
||||
TextEditor::Constants::C_TEXTEDITOR));
|
||||
}
|
||||
|
||||
bool BarDescriptorEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
|
||||
{
|
||||
QTC_ASSERT(fileName == realFileName, return false);
|
||||
|
||||
bool result = m_file->open(errorString, fileName);
|
||||
if (result) {
|
||||
BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget());
|
||||
QTC_ASSERT(editorWidget, return false);
|
||||
editorWidget->setFilePath(Utils::FileName::fromString(fileName));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Core::IDocument *BarDescriptorEditor::document()
|
||||
{
|
||||
return m_file;
|
||||
}
|
||||
|
||||
QWidget *BarDescriptorEditor::toolBar()
|
||||
{
|
||||
return m_toolBar;
|
||||
}
|
||||
|
||||
BarDescriptorEditor::EditorPage BarDescriptorEditor::activePage() const
|
||||
{
|
||||
BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget());
|
||||
QTC_ASSERT(editorWidget, return static_cast<EditorPage>(-1));
|
||||
|
||||
return static_cast<EditorPage>(editorWidget->currentIndex());
|
||||
}
|
||||
|
||||
void BarDescriptorEditor::changeEditorPage(QAction *action)
|
||||
{
|
||||
setActivePage(static_cast<EditorPage>(action->data().toInt()));
|
||||
}
|
||||
|
||||
void BarDescriptorEditor::setActivePage(BarDescriptorEditor::EditorPage page)
|
||||
{
|
||||
BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget());
|
||||
QTC_ASSERT(editorWidget, return);
|
||||
|
||||
m_cursorPositionAction->setVisible(page == Source);
|
||||
editorWidget->setCurrentIndex(page);
|
||||
}
|
||||
|
||||
void BarDescriptorEditor::updateCursorPosition()
|
||||
{
|
||||
BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget());
|
||||
QTC_ASSERT(editorWidget, return);
|
||||
|
||||
const QTextCursor cursor = editorWidget->sourceWidget()->textCursor();
|
||||
const QTextBlock block = cursor.block();
|
||||
const int line = block.blockNumber() + 1;
|
||||
const int column = cursor.position() - block.position();
|
||||
m_cursorPositionLabel->setText(tr("Line: %1, Col: %2").arg(line)
|
||||
.arg(editorWidget->sourceWidget()->textDocument()
|
||||
->tabSettings().columnAt(block.text(), column)+1),
|
||||
tr("Line: 9999, Col: 999"));
|
||||
if (!block.isVisible())
|
||||
editorWidget->sourceWidget()->ensureCursorVisible();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
@@ -1,88 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BARDESCRIPTOREDITOR_H
|
||||
#define QNX_INTERNAL_BARDESCRIPTOREDITOR_H
|
||||
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QActionGroup;
|
||||
class QToolBar;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils { class LineColumnLabel; }
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BarDescriptorDocument;
|
||||
class BarDescriptorEditorWidget;
|
||||
|
||||
class BarDescriptorEditor : public Core::IEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum EditorPage {
|
||||
General = 0,
|
||||
Application,
|
||||
Assets,
|
||||
Source
|
||||
};
|
||||
|
||||
BarDescriptorEditor();
|
||||
|
||||
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
|
||||
Core::IDocument *document();
|
||||
QWidget *toolBar();
|
||||
|
||||
EditorPage activePage() const;
|
||||
|
||||
private slots:
|
||||
void changeEditorPage(QAction *action);
|
||||
void updateCursorPosition();
|
||||
|
||||
private:
|
||||
void setActivePage(EditorPage page);
|
||||
|
||||
BarDescriptorDocument *m_file;
|
||||
|
||||
QToolBar *m_toolBar;
|
||||
QActionGroup *m_actionGroup;
|
||||
Utils::LineColumnLabel *m_cursorPositionLabel;
|
||||
QAction *m_cursorPositionAction;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BARDESCRIPTOREDITOR_H
|
@@ -1,132 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "bardescriptoreditorabstractpanelwidget.h"
|
||||
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QLineEdit>
|
||||
#include <QSignalMapper>
|
||||
#include <QTextEdit>
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BarDescriptorEditorAbstractPanelWidget::BarDescriptorEditorAbstractPanelWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
m_signalMapper = new QSignalMapper(this);
|
||||
connect(m_signalMapper, SIGNAL(mapped(int)), this, SLOT(handleSignalMapped(int)));
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAbstractPanelWidget::setValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||
{
|
||||
if (m_blockedSignals.contains(tag))
|
||||
return;
|
||||
|
||||
blockSignalMapping(tag);
|
||||
updateWidgetValue(tag, value);
|
||||
unblockSignalMapping(tag);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAbstractPanelWidget::addSignalMapping(BarDescriptorDocument::Tag tag, QObject *object, const char *signal)
|
||||
{
|
||||
m_signalMapper->setMapping(object, tag);
|
||||
connect(object, signal, m_signalMapper, SLOT(map()));
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAbstractPanelWidget::blockSignalMapping(BarDescriptorDocument::Tag tag)
|
||||
{
|
||||
m_blockedSignals.prepend(tag);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAbstractPanelWidget::unblockSignalMapping(BarDescriptorDocument::Tag tag)
|
||||
{
|
||||
BarDescriptorDocument::Tag removedTag = m_blockedSignals.takeFirst();
|
||||
QTC_CHECK(removedTag == tag);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||
{
|
||||
QObject *object = m_signalMapper->mapping(static_cast<int>(tag));
|
||||
if (!object)
|
||||
return;
|
||||
|
||||
if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(object))
|
||||
lineEdit->setText(value.toString());
|
||||
else if (QTextEdit *textEdit = qobject_cast<QTextEdit *>(object))
|
||||
textEdit->setPlainText(value.toString());
|
||||
else if (Utils::PathChooser *pathChooser = qobject_cast<Utils::PathChooser *>(object))
|
||||
pathChooser->setPath(value.toString());
|
||||
else if (QComboBox *comboBox = qobject_cast<QComboBox *>(object))
|
||||
comboBox->setCurrentIndex(comboBox->findData(value.toString()));
|
||||
else if (QCheckBox *checkBox = qobject_cast<QCheckBox *>(object))
|
||||
checkBox->setChecked(value.toBool());
|
||||
else
|
||||
QTC_CHECK(false);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAbstractPanelWidget::emitChanged(BarDescriptorDocument::Tag tag)
|
||||
{
|
||||
QObject *sender = m_signalMapper->mapping(tag);
|
||||
|
||||
if (!sender)
|
||||
return;
|
||||
|
||||
if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(sender))
|
||||
emit changed(tag, lineEdit->text());
|
||||
else if (QTextEdit *textEdit = qobject_cast<QTextEdit *>(sender))
|
||||
emit changed(tag, textEdit->toPlainText());
|
||||
else if (Utils::PathChooser *pathChooser = qobject_cast<Utils::PathChooser *>(sender))
|
||||
emit changed(tag, pathChooser->path());
|
||||
else if (QComboBox *comboBox = qobject_cast<QComboBox *>(sender))
|
||||
emit changed(tag, comboBox->itemData(comboBox->currentIndex()));
|
||||
else if (QCheckBox *checkBox = qobject_cast<QCheckBox *>(sender))
|
||||
emit changed(tag, checkBox->isChecked());
|
||||
else
|
||||
QTC_CHECK(false);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAbstractPanelWidget::handleSignalMapped(int id)
|
||||
{
|
||||
BarDescriptorDocument::Tag tag = static_cast<BarDescriptorDocument::Tag>(id);
|
||||
|
||||
if (m_blockedSignals.contains(tag))
|
||||
return;
|
||||
|
||||
blockSignalMapping(tag);
|
||||
emitChanged(tag);
|
||||
unblockSignalMapping(tag);
|
||||
}
|
@@ -1,85 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BARDESCRIPTOREDITORABSTRACTPANELWIDGET_H
|
||||
#define QNX_INTERNAL_BARDESCRIPTOREDITORABSTRACTPANELWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "bardescriptordocument.h"
|
||||
|
||||
namespace Utils { class PathChooser; }
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class QLineEdit;
|
||||
class QSignalMapper;
|
||||
class QStringListModel;
|
||||
class QTextEdit;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BarDescriptorEditorAbstractPanelWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BarDescriptorEditorAbstractPanelWidget(QWidget *parent = 0);
|
||||
|
||||
public slots:
|
||||
void setValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||
|
||||
signals:
|
||||
void changed(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||
|
||||
protected:
|
||||
virtual void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||
virtual void emitChanged(BarDescriptorDocument::Tag tag);
|
||||
|
||||
void addSignalMapping(BarDescriptorDocument::Tag tag, QObject *object, const char *signal);
|
||||
void blockSignalMapping(BarDescriptorDocument::Tag tag);
|
||||
void unblockSignalMapping(BarDescriptorDocument::Tag tag);
|
||||
|
||||
private slots:
|
||||
void handleSignalMapped(int id);
|
||||
|
||||
private:
|
||||
QSignalMapper *m_signalMapper;
|
||||
QList<BarDescriptorDocument::Tag> m_blockedSignals;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BARDESCRIPTOREDITORABSTRACTPANELWIDGET_H
|
@@ -1,206 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "bardescriptoreditorassetswidget.h"
|
||||
#include "ui_bardescriptoreditorassetswidget.h"
|
||||
|
||||
#include "bardescriptordocument.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BarDescriptorEditorAssetsWidget::BarDescriptorEditorAssetsWidget(QWidget *parent) :
|
||||
BarDescriptorEditorAbstractPanelWidget(parent),
|
||||
m_ui(new Ui::BarDescriptorEditorAssetsWidget)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
QStringList headerLabels;
|
||||
headerLabels << tr("Path") << tr("Destination") << tr("Entry-Point");
|
||||
m_assetsModel = new QStandardItemModel(this);
|
||||
m_assetsModel->setHorizontalHeaderLabels(headerLabels);
|
||||
m_ui->assets->setModel(m_assetsModel);
|
||||
|
||||
connect(m_ui->addAsset, SIGNAL(clicked()), this, SLOT(addNewAsset()));
|
||||
connect(m_ui->removeAsset, SIGNAL(clicked()), this, SLOT(removeSelectedAsset()));
|
||||
connect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*)));
|
||||
|
||||
addSignalMapping(BarDescriptorDocument::asset, m_assetsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
|
||||
addSignalMapping(BarDescriptorDocument::asset, m_assetsModel, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
||||
addSignalMapping(BarDescriptorDocument::asset, m_assetsModel, SIGNAL(rowsRemoved(QModelIndex,int,int)));
|
||||
}
|
||||
|
||||
BarDescriptorEditorAssetsWidget::~BarDescriptorEditorAssetsWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAssetsWidget::clear()
|
||||
{
|
||||
blockSignalMapping(BarDescriptorDocument::asset);
|
||||
m_assetsModel->removeRows(0, m_assetsModel->rowCount());
|
||||
unblockSignalMapping(BarDescriptorDocument::asset);
|
||||
}
|
||||
|
||||
QStandardItemModel *BarDescriptorEditorAssetsWidget::assetsModel() const
|
||||
{
|
||||
return m_assetsModel;
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAssetsWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||
{
|
||||
if (tag != BarDescriptorDocument::asset) {
|
||||
BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value);
|
||||
return;
|
||||
}
|
||||
|
||||
clear();
|
||||
BarDescriptorAssetList assets = value.value<BarDescriptorAssetList>();
|
||||
foreach (const BarDescriptorAsset asset, assets)
|
||||
addAsset(asset);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAssetsWidget::addAsset(const QString &fullPath)
|
||||
{
|
||||
if (fullPath.isEmpty())
|
||||
return;
|
||||
|
||||
BarDescriptorAsset asset;
|
||||
asset.source = fullPath;
|
||||
asset.destination = Utils::FileName::fromString(fullPath).fileName();
|
||||
asset.entry = false;
|
||||
addAsset(asset);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAssetsWidget::removeAsset(const QString &fullPath)
|
||||
{
|
||||
QList<QStandardItem*> assetItems = m_assetsModel->findItems(fullPath);
|
||||
foreach (QStandardItem *assetItem, assetItems) {
|
||||
QList<QStandardItem*> assetRow = m_assetsModel->takeRow(assetItem->row());
|
||||
while (!assetRow.isEmpty())
|
||||
delete assetRow.takeLast();
|
||||
}
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAssetsWidget::addNewAsset()
|
||||
{
|
||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Select File to Add"));
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
addAsset(fileName);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAssetsWidget::removeSelectedAsset()
|
||||
{
|
||||
QModelIndexList selectedIndexes = m_ui->assets->selectionModel()->selectedRows();
|
||||
if (selectedIndexes.isEmpty())
|
||||
return;
|
||||
|
||||
foreach (const QModelIndex &index, selectedIndexes)
|
||||
m_assetsModel->removeRow(index.row());
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAssetsWidget::updateEntryCheckState(QStandardItem *item)
|
||||
{
|
||||
if (item->column() != 2 || item->checkState() == Qt::Unchecked)
|
||||
return;
|
||||
|
||||
disconnect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*)));
|
||||
for (int i = 0; i < m_assetsModel->rowCount(); ++i) {
|
||||
QStandardItem *other = m_assetsModel->item(i, 2);
|
||||
if (other == item)
|
||||
continue;
|
||||
|
||||
// Only one asset can be the entry point
|
||||
other->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
connect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*)));
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAssetsWidget::emitChanged(BarDescriptorDocument::Tag tag)
|
||||
{
|
||||
if (tag != BarDescriptorDocument::asset) {
|
||||
BarDescriptorEditorAbstractPanelWidget::emitChanged(tag);
|
||||
return;
|
||||
}
|
||||
|
||||
BarDescriptorAssetList result;
|
||||
for (int i = 0; i < m_assetsModel->rowCount(); ++i) {
|
||||
BarDescriptorAsset asset;
|
||||
asset.source = m_assetsModel->item(i, 0)->text();
|
||||
asset.destination = m_assetsModel->item(i, 1)->text();
|
||||
asset.entry = m_assetsModel->item(i, 2)->checkState() == Qt::Checked;
|
||||
result.append(asset);
|
||||
}
|
||||
|
||||
QVariant var;
|
||||
var.setValue(result);
|
||||
emit changed(tag, var);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAssetsWidget::addAsset(const BarDescriptorAsset &asset)
|
||||
{
|
||||
const QString path = asset.source;
|
||||
const QString dest = asset.destination;
|
||||
QTC_ASSERT(!path.isEmpty(), return);
|
||||
QTC_ASSERT(!dest.isEmpty(), return);
|
||||
|
||||
if (hasAsset(asset))
|
||||
return;
|
||||
|
||||
QList<QStandardItem *> items;
|
||||
items << new QStandardItem(path);
|
||||
items << new QStandardItem(dest);
|
||||
|
||||
QStandardItem *entryItem = new QStandardItem();
|
||||
entryItem->setCheckable(true);
|
||||
entryItem->setCheckState(asset.entry ? Qt::Checked : Qt::Unchecked);
|
||||
items << entryItem;
|
||||
m_assetsModel->appendRow(items);
|
||||
}
|
||||
|
||||
bool BarDescriptorEditorAssetsWidget::hasAsset(const BarDescriptorAsset &asset)
|
||||
{
|
||||
for (int i = 0; i < m_assetsModel->rowCount(); ++i) {
|
||||
QStandardItem *sourceItem = m_assetsModel->item(i, 0);
|
||||
QStandardItem *destItem = m_assetsModel->item(i, 1);
|
||||
if (sourceItem->text() == asset.source && destItem->text() == asset.destination)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
@@ -1,86 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BARDESCRIPTOREDITORASSETSWIDGET_H
|
||||
#define QNX_INTERNAL_BARDESCRIPTOREDITORASSETSWIDGET_H
|
||||
|
||||
#include "bardescriptoreditorabstractpanelwidget.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QStandardItem;
|
||||
class QStandardItemModel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
namespace Ui { class BarDescriptorEditorAssetsWidget; }
|
||||
|
||||
class BarDescriptorAsset;
|
||||
|
||||
class BarDescriptorEditorAssetsWidget : public BarDescriptorEditorAbstractPanelWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BarDescriptorEditorAssetsWidget(QWidget *parent = 0);
|
||||
~BarDescriptorEditorAssetsWidget();
|
||||
|
||||
QStandardItemModel *assetsModel() const;
|
||||
|
||||
public slots:
|
||||
void addAsset(const QString &fullPath);
|
||||
void removeAsset(const QString &fullPath);
|
||||
|
||||
protected:
|
||||
void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||
void emitChanged(BarDescriptorDocument::Tag tag);
|
||||
|
||||
private slots:
|
||||
void addNewAsset();
|
||||
void removeSelectedAsset();
|
||||
void updateEntryCheckState(QStandardItem *item);
|
||||
|
||||
private:
|
||||
void clear();
|
||||
void addAsset(const BarDescriptorAsset &asset);
|
||||
bool hasAsset(const BarDescriptorAsset &asset);
|
||||
|
||||
Ui::BarDescriptorEditorAssetsWidget *m_ui;
|
||||
|
||||
QStandardItemModel *m_assetsModel;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
#endif // QNX_INTERNAL_BARDESCRIPTOREDITORASSETSWIDGET_H
|
@@ -1,59 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Qnx::Internal::BarDescriptorEditorAssetsWidget</class>
|
||||
<widget class="QWidget" name="Qnx::Internal::BarDescriptorEditorAssetsWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>380</width>
|
||||
<height>245</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QTreeView" name="assets">
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="addAsset">
|
||||
<property name="text">
|
||||
<string>Add...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeAsset">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -1,108 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "bardescriptoreditorauthorinformationwidget.h"
|
||||
#include "ui_bardescriptoreditorauthorinformationwidget.h"
|
||||
|
||||
#include "blackberrydebugtokenreader.h"
|
||||
#include "blackberrydeviceconfiguration.h"
|
||||
#include "blackberrysigningutils.h"
|
||||
#include "qnxconstants.h"
|
||||
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QInputDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BarDescriptorEditorAuthorInformationWidget::BarDescriptorEditorAuthorInformationWidget(QWidget *parent) :
|
||||
BarDescriptorEditorAbstractPanelWidget(parent),
|
||||
m_ui(new Ui::BarDescriptorEditorAuthorInformationWidget)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->setFromDebugToken->setVisible(BlackBerryDebugTokenReader::isSupported());
|
||||
|
||||
addSignalMapping(BarDescriptorDocument::author, m_ui->author, SIGNAL(textChanged(QString)));
|
||||
addSignalMapping(BarDescriptorDocument::authorId, m_ui->authorId, SIGNAL(textChanged(QString)));
|
||||
connect(m_ui->setFromDebugToken, SIGNAL(clicked()), this, SLOT(setAuthorFromDebugToken()));
|
||||
}
|
||||
|
||||
BarDescriptorEditorAuthorInformationWidget::~BarDescriptorEditorAuthorInformationWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAuthorInformationWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||
{
|
||||
if (tag == BarDescriptorDocument::publisher && !value.toString().isEmpty())
|
||||
// <publisher> is deprecated and hence not connected to the author field as we only want to read it from the XML
|
||||
m_ui->author->setText(value.toString());
|
||||
else
|
||||
BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorAuthorInformationWidget::setAuthorFromDebugToken()
|
||||
{
|
||||
// To select debug token, make it fancier once the debug token management is done in
|
||||
// Qt Creator
|
||||
QStringList debugTokens;
|
||||
ProjectExplorer::DeviceManager *deviceManager = ProjectExplorer::DeviceManager::instance();
|
||||
for (int i = 0; i < deviceManager->deviceCount(); ++i) {
|
||||
ProjectExplorer::IDevice::ConstPtr device = deviceManager->deviceAt(i);
|
||||
if (device->type() == Core::Id(Constants::QNX_BB_OS_TYPE)) {
|
||||
BlackBerryDeviceConfiguration::ConstPtr bbDevice = device.dynamicCast<const BlackBerryDeviceConfiguration>();
|
||||
QTC_ASSERT(bbDevice, continue);
|
||||
|
||||
debugTokens << bbDevice->debugToken();
|
||||
}
|
||||
}
|
||||
debugTokens << BlackBerrySigningUtils::instance().debugTokens();
|
||||
debugTokens.removeDuplicates();
|
||||
|
||||
bool ok;
|
||||
QString debugToken = QInputDialog::getItem(this, tr("Select Debug Token"), tr("Debug token:"), debugTokens, 0, false, &ok);
|
||||
if (!ok || debugToken.isEmpty())
|
||||
return;
|
||||
|
||||
BlackBerryDebugTokenReader debugTokenReader(debugToken);
|
||||
if (!debugTokenReader.isValid()) {
|
||||
QMessageBox::warning(this, tr("Error Reading Debug Token"), tr("There was a problem reading debug token."));
|
||||
return;
|
||||
}
|
||||
|
||||
m_ui->author->setText(debugTokenReader.author());
|
||||
m_ui->authorId->setText(debugTokenReader.authorId());
|
||||
}
|
@@ -1,64 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BARDESCRIPTOREDITORAUTHORINFORMATIONWIDGET_H
|
||||
#define QNX_INTERNAL_BARDESCRIPTOREDITORAUTHORINFORMATIONWIDGET_H
|
||||
|
||||
#include "bardescriptoreditorabstractpanelwidget.h"
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
namespace Ui { class BarDescriptorEditorAuthorInformationWidget; }
|
||||
|
||||
class BarDescriptorEditorAuthorInformationWidget : public BarDescriptorEditorAbstractPanelWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BarDescriptorEditorAuthorInformationWidget(QWidget *parent = 0);
|
||||
~BarDescriptorEditorAuthorInformationWidget();
|
||||
|
||||
protected:
|
||||
void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||
|
||||
private slots:
|
||||
void setAuthorFromDebugToken();
|
||||
|
||||
private:
|
||||
Ui::BarDescriptorEditorAuthorInformationWidget *m_ui;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BARDESCRIPTOREDITORAUTHORINFORMATIONWIDGET_H
|
@@ -1,48 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Qnx::Internal::BarDescriptorEditorAuthorInformationWidget</class>
|
||||
<widget class="QWidget" name="Qnx::Internal::BarDescriptorEditorAuthorInformationWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>371</width>
|
||||
<height>90</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Author:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="author"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Author ID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="authorId"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="setFromDebugToken">
|
||||
<property name="text">
|
||||
<string>Set from debug token...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -1,309 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "bardescriptoreditorentrypointwidget.h"
|
||||
#include "ui_bardescriptoreditorentrypointwidget.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QStringListModel>
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
namespace {
|
||||
// Recommended maximum size for icons according to
|
||||
// http://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.devguide/com.qnx.doc.native_sdk.devguide/topic/r_barfile_dtd_ref_image.html
|
||||
static int AppIconMaxWidth = 114;
|
||||
static int AppIconMaxHeight = 114;
|
||||
|
||||
// Recommended maximum size for splashscreens according to
|
||||
// http://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.devguide/com.qnx.doc.native_sdk.devguide/topic/r_barfile_dtd_ref_splashscreens.html
|
||||
static int SplashScreenMaxWidth = 1280;
|
||||
static int SplashScreenMaxHeight = 1280;
|
||||
}
|
||||
|
||||
BarDescriptorEditorEntryPointWidget::BarDescriptorEditorEntryPointWidget(QWidget *parent) :
|
||||
BarDescriptorEditorAbstractPanelWidget(parent),
|
||||
m_ui(new Ui::BarDescriptorEditorEntryPointWidget)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->iconFilePath->setExpectedKind(Utils::PathChooser::File);
|
||||
m_ui->iconFilePath->setHistoryCompleter(QLatin1String("Qmake.Icon.History"));
|
||||
m_ui->iconFilePath->setPromptDialogFilter(tr("Images (*.jpg *.png)"));
|
||||
|
||||
m_ui->iconWarningLabel->setVisible(false);
|
||||
m_ui->iconWarningPixmap->setVisible(false);
|
||||
|
||||
m_ui->splashScreenWarningLabel->setVisible(false);
|
||||
m_ui->splashScreenWarningPixmap->setVisible(false);
|
||||
|
||||
connect(m_ui->iconFilePath, SIGNAL(changed(QString)), this, SLOT(handleIconChanged(QString)));
|
||||
connect(m_ui->iconClearButton, SIGNAL(clicked()), this, SLOT(clearIcon()));
|
||||
|
||||
m_splashScreenModel = new QStringListModel(this);
|
||||
m_ui->splashScreensView->setModel(m_splashScreenModel);
|
||||
connect(m_ui->addSplashScreen, SIGNAL(clicked()), this, SLOT(browseForSplashScreen()));
|
||||
connect(m_ui->removeSplashScreen, SIGNAL(clicked()), this, SLOT(removeSelectedSplashScreen()));
|
||||
connect(m_ui->splashScreensView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(handleSplashScreenSelectionChanged(QItemSelection,QItemSelection)));
|
||||
|
||||
addSignalMapping(BarDescriptorDocument::name, m_ui->applicationName, SIGNAL(textChanged(QString)));
|
||||
addSignalMapping(BarDescriptorDocument::description, m_ui->applicationDescription, SIGNAL(textChanged()));
|
||||
addSignalMapping(BarDescriptorDocument::icon, m_ui->iconFilePath, SIGNAL(changed(QString)));
|
||||
addSignalMapping(BarDescriptorDocument::splashScreens, m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
|
||||
addSignalMapping(BarDescriptorDocument::splashScreens, m_splashScreenModel, SIGNAL(rowsRemoved(QModelIndex,int,int)));
|
||||
addSignalMapping(BarDescriptorDocument::splashScreens, m_splashScreenModel, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
||||
}
|
||||
|
||||
BarDescriptorEditorEntryPointWidget::~BarDescriptorEditorEntryPointWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEntryPointWidget::setAssetsModel(QStandardItemModel *assetsModel)
|
||||
{
|
||||
m_assetsModel = assetsModel;
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEntryPointWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||
{
|
||||
// During file loading, the assets might not have been read yet
|
||||
if (tag == BarDescriptorDocument::icon) {
|
||||
QMetaObject::invokeMethod(this, "setApplicationIconDelayed", Qt::QueuedConnection, Q_ARG(QString, value.toString()));
|
||||
} else if (tag == BarDescriptorDocument::splashScreens) {
|
||||
QStringList splashScreens = value.toStringList();
|
||||
foreach (const QString &splashScreen, splashScreens)
|
||||
QMetaObject::invokeMethod(this, "appendSplashScreenDelayed", Qt::QueuedConnection, Q_ARG(QString, splashScreen));
|
||||
} else {
|
||||
BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value);
|
||||
}
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEntryPointWidget::emitChanged(BarDescriptorDocument::Tag tag)
|
||||
{
|
||||
if (tag == BarDescriptorDocument::icon) {
|
||||
emit changed(tag, Utils::FileName::fromString(m_ui->iconFilePath->path()).fileName());
|
||||
} else if (tag == BarDescriptorDocument::splashScreens) {
|
||||
QStringList list;
|
||||
foreach (const QString &splashScreen, m_splashScreenModel->stringList())
|
||||
list << Utils::FileName::fromString(splashScreen).fileName();
|
||||
|
||||
emit changed(tag, list);
|
||||
} else {
|
||||
BarDescriptorEditorAbstractPanelWidget::emitChanged(tag);
|
||||
}
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEntryPointWidget::setApplicationIconPreview(const QString &path)
|
||||
{
|
||||
setImagePreview(m_ui->iconPreviewLabel, path);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEntryPointWidget::validateIconSize(const QString &path)
|
||||
{
|
||||
validateImage(path, m_ui->iconWarningLabel, m_ui->iconWarningPixmap, QSize(AppIconMaxWidth, AppIconMaxHeight));
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEntryPointWidget::handleIconChanged(const QString &path)
|
||||
{
|
||||
if (path == m_prevIconPath)
|
||||
return;
|
||||
|
||||
setApplicationIconPreview(path);
|
||||
validateIconSize(path);
|
||||
|
||||
if (!m_splashScreenModel->stringList().contains(m_prevIconPath))
|
||||
emit imageRemoved(m_prevIconPath);
|
||||
|
||||
m_prevIconPath = path;
|
||||
if (QFileInfo::exists(path))
|
||||
emit imageAdded(path);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEntryPointWidget::clearIcon()
|
||||
{
|
||||
m_ui->iconFilePath->setPath(QString());
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEntryPointWidget::browseForSplashScreen()
|
||||
{
|
||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Select Splash Screen"), QString(), tr("Images (*.jpg *.png)"));
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
|
||||
if (m_splashScreenModel->stringList().contains(fileName))
|
||||
return;
|
||||
|
||||
int rowCount = m_splashScreenModel->rowCount();
|
||||
m_splashScreenModel->insertRow(rowCount);
|
||||
m_splashScreenModel->setData(m_splashScreenModel->index(rowCount), fileName);
|
||||
emit imageAdded(fileName);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEntryPointWidget::removeSelectedSplashScreen()
|
||||
{
|
||||
QModelIndexList selectedIndexes = m_ui->splashScreensView->selectionModel()->selectedRows();
|
||||
if (selectedIndexes.isEmpty())
|
||||
return;
|
||||
|
||||
foreach (const QModelIndex &index, selectedIndexes) {
|
||||
QString path = m_splashScreenModel->data(index, Qt::DisplayRole).toString();
|
||||
if (path != m_ui->iconFilePath->path())
|
||||
emit imageRemoved(path);
|
||||
|
||||
m_splashScreenModel->removeRow(index.row());
|
||||
}
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEntryPointWidget::handleSplashScreenSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
|
||||
{
|
||||
Q_UNUSED(deselected);
|
||||
|
||||
const bool emptySelection = selected.indexes().isEmpty();
|
||||
m_ui->removeSplashScreen->setEnabled(!emptySelection);
|
||||
|
||||
if (!emptySelection) {
|
||||
QString path = m_splashScreenModel->data(selected.indexes().at(0), Qt::DisplayRole).toString();
|
||||
setImagePreview(m_ui->splashScreenPreviewLabel, path);
|
||||
validateSplashScreenSize(path);
|
||||
} else {
|
||||
setImagePreview(m_ui->splashScreenPreviewLabel, QString());
|
||||
m_ui->splashScreenWarningLabel->setVisible(false);
|
||||
m_ui->splashScreenWarningPixmap->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEntryPointWidget::appendSplashScreenDelayed(const QString &splashScreenPath)
|
||||
{
|
||||
const QString fullSplashScreenPath = localAssetPathFromDestination(splashScreenPath);
|
||||
if (fullSplashScreenPath.isEmpty())
|
||||
return;
|
||||
|
||||
blockSignalMapping(BarDescriptorDocument::splashScreens);
|
||||
int rowCount = m_splashScreenModel->rowCount();
|
||||
m_splashScreenModel->insertRow(rowCount);
|
||||
m_splashScreenModel->setData(m_splashScreenModel->index(rowCount), fullSplashScreenPath);
|
||||
unblockSignalMapping(BarDescriptorDocument::splashScreens);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEntryPointWidget::setImagePreview(QLabel *previewLabel, const QString &path)
|
||||
{
|
||||
if (path.isEmpty()) {
|
||||
previewLabel->clear();
|
||||
return;
|
||||
}
|
||||
|
||||
QPixmap originalPixmap(path);
|
||||
if (originalPixmap.isNull()) {
|
||||
previewLabel->clear();
|
||||
return;
|
||||
}
|
||||
|
||||
QSize size = previewLabel->minimumSize();
|
||||
QPixmap scaledPixmap = originalPixmap.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
if (scaledPixmap.isNull()) {
|
||||
previewLabel->clear();
|
||||
return;
|
||||
}
|
||||
|
||||
previewLabel->setPixmap(scaledPixmap);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEntryPointWidget::validateSplashScreenSize(const QString &path)
|
||||
{
|
||||
validateImage(path, m_ui->splashScreenWarningLabel, m_ui->splashScreenWarningPixmap, QSize(SplashScreenMaxWidth, SplashScreenMaxHeight));
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEntryPointWidget::validateImage(const QString &path, QLabel *warningMessage, QLabel *warningPixmap, const QSize &maximumSize)
|
||||
{
|
||||
ImageValidationResult result = Valid;
|
||||
|
||||
QSize actualSize;
|
||||
if (!path.isEmpty()) {
|
||||
QImage img(path);
|
||||
if (img.isNull()) {
|
||||
result = CouldNotLoad;
|
||||
} else {
|
||||
actualSize = img.size();
|
||||
if (actualSize.width() > maximumSize.width() || actualSize.height() > maximumSize.height())
|
||||
result = IncorrectSize;
|
||||
}
|
||||
}
|
||||
|
||||
switch (result) {
|
||||
case CouldNotLoad:
|
||||
warningMessage->setText(tr("<font color=\"red\">Could not open \"%1\" for reading.</font>").arg(path));
|
||||
warningMessage->setVisible(true);
|
||||
warningPixmap->setVisible(true);
|
||||
break;
|
||||
case IncorrectSize: {
|
||||
warningMessage->setText(tr("<font color=\"red\">The selected image is too big (%1x%2). The maximum size is %3x%4 pixels.</font>")
|
||||
.arg(actualSize.width()).arg(actualSize.height())
|
||||
.arg(maximumSize.width()).arg(maximumSize.height()));
|
||||
warningMessage->setVisible(true);
|
||||
warningPixmap->setVisible(true);
|
||||
break;
|
||||
}
|
||||
case Valid:
|
||||
default:
|
||||
warningMessage->setVisible(false);
|
||||
warningPixmap->setVisible(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEntryPointWidget::setApplicationIconDelayed(const QString &iconPath)
|
||||
{
|
||||
const QString fullIconPath = localAssetPathFromDestination(iconPath);
|
||||
if (fullIconPath.isEmpty())
|
||||
return;
|
||||
|
||||
blockSignalMapping(BarDescriptorDocument::icon);
|
||||
m_ui->iconFilePath->setPath(fullIconPath);
|
||||
setApplicationIconPreview(fullIconPath);
|
||||
validateIconSize(fullIconPath);
|
||||
unblockSignalMapping(BarDescriptorDocument::icon);
|
||||
}
|
||||
|
||||
QString BarDescriptorEditorEntryPointWidget::localAssetPathFromDestination(const QString &destination)
|
||||
{
|
||||
if (!m_assetsModel)
|
||||
return QString();
|
||||
|
||||
for (int i = 0; i < m_assetsModel.data()->rowCount(); ++i) {
|
||||
QStandardItem *destItem = m_assetsModel.data()->item(i, 1);
|
||||
if (destItem->text() == destination)
|
||||
return m_assetsModel.data()->item(i, 0)->text();
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
@@ -1,106 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BARDESCRIPTOREDITORENTRYPOINTWIDGET_H
|
||||
#define QNX_INTERNAL_BARDESCRIPTOREDITORENTRYPOINTWIDGET_H
|
||||
|
||||
#include "bardescriptoreditorabstractpanelwidget.h"
|
||||
|
||||
#include <QPointer>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QItemSelection;
|
||||
class QLabel;
|
||||
class QStringListModel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
namespace Ui { class BarDescriptorEditorEntryPointWidget; }
|
||||
|
||||
class BarDescriptorEditorEntryPointWidget : public BarDescriptorEditorAbstractPanelWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BarDescriptorEditorEntryPointWidget(QWidget *parent = 0);
|
||||
~BarDescriptorEditorEntryPointWidget();
|
||||
|
||||
void setAssetsModel(QStandardItemModel *assetsModel);
|
||||
|
||||
signals:
|
||||
void imageAdded(const QString &path);
|
||||
void imageRemoved(const QString &path);
|
||||
|
||||
protected:
|
||||
void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||
void emitChanged(BarDescriptorDocument::Tag tag);
|
||||
|
||||
private slots:
|
||||
void setApplicationIconDelayed(const QString &iconPath);
|
||||
void setApplicationIconPreview(const QString &path);
|
||||
void validateIconSize(const QString &path);
|
||||
void handleIconChanged(const QString &path);
|
||||
void clearIcon();
|
||||
|
||||
void browseForSplashScreen();
|
||||
void removeSelectedSplashScreen();
|
||||
void handleSplashScreenSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
||||
void appendSplashScreenDelayed(const QString &splashScreenPath);
|
||||
|
||||
private:
|
||||
enum ImageValidationResult {
|
||||
Valid,
|
||||
CouldNotLoad,
|
||||
IncorrectSize
|
||||
};
|
||||
|
||||
void setImagePreview(QLabel *previewLabel, const QString &path);
|
||||
void validateSplashScreenSize(const QString &path);
|
||||
void validateImage(const QString &path, QLabel *warningMessage, QLabel *warningPixmap, const QSize &maximumSize);
|
||||
|
||||
QString localAssetPathFromDestination(const QString &path);
|
||||
|
||||
QStringListModel *m_splashScreenModel;
|
||||
QPointer<QStandardItemModel> m_assetsModel;
|
||||
|
||||
QString m_prevIconPath;
|
||||
|
||||
Ui::BarDescriptorEditorEntryPointWidget *m_ui;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
#endif // QNX_INTERNAL_BARDESCRIPTOREDITORENTRYPOINTWIDGET_H
|
@@ -1,212 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Qnx::Internal::BarDescriptorEditorEntryPointWidget</class>
|
||||
<widget class="QWidget" name="Qnx::Internal::BarDescriptorEditorEntryPointWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>611</width>
|
||||
<height>455</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="applicationName"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QTextEdit" name="applicationDescription">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Icon:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="iconPreviewLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>90</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="Utils::PathChooser" name="iconFilePath" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="iconClearButton">
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="iconWarningPixmap">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../coreplugin/core.qrc">:/core/images/warning.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="iconWarningLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Splash screens:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QListView" name="splashScreensView"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QPushButton" name="addSplashScreen">
|
||||
<property name="text">
|
||||
<string>Add...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeSplashScreen">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="splashScreenPreviewLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>90</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="splashScreenWarningPixmap">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../coreplugin/core.qrc">:/core/images/warning.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="splashScreenWarningLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Utils::PathChooser</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">utils/pathchooser.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../projectexplorer/projectexplorer.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@@ -1,75 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "bardescriptoreditorenvironmentwidget.h"
|
||||
#include "ui_bardescriptoreditorenvironmentwidget.h"
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BarDescriptorEditorEnvironmentWidget::BarDescriptorEditorEnvironmentWidget(QWidget *parent) :
|
||||
BarDescriptorEditorAbstractPanelWidget(parent),
|
||||
m_ui(new Ui::BarDescriptorEditorEnvironmentWidget)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->environmentWidget->setBaseEnvironmentText(tr("Device Environment"));
|
||||
|
||||
addSignalMapping(BarDescriptorDocument::env, m_ui->environmentWidget, SIGNAL(userChangesChanged()));
|
||||
}
|
||||
|
||||
BarDescriptorEditorEnvironmentWidget::~BarDescriptorEditorEnvironmentWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEnvironmentWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||
{
|
||||
if (tag != BarDescriptorDocument::env) {
|
||||
BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value);
|
||||
return;
|
||||
}
|
||||
|
||||
m_ui->environmentWidget->setUserChanges(value.value<QList<Utils::EnvironmentItem> >());
|
||||
}
|
||||
|
||||
void BarDescriptorEditorEnvironmentWidget::emitChanged(BarDescriptorDocument::Tag tag)
|
||||
{
|
||||
if (tag != BarDescriptorDocument::env) {
|
||||
BarDescriptorEditorAbstractPanelWidget::emitChanged(tag);
|
||||
return;
|
||||
}
|
||||
|
||||
QVariant var;
|
||||
var.setValue(m_ui->environmentWidget->userChanges());
|
||||
emit changed(tag, var);
|
||||
}
|
@@ -1,64 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BARDESCRIPTOREDITORENVIRONMENTWIDGET_H
|
||||
#define QNX_INTERNAL_BARDESCRIPTOREDITORENVIRONMENTWIDGET_H
|
||||
|
||||
#include "bardescriptoreditorabstractpanelwidget.h"
|
||||
|
||||
#include <utils/environment.h>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
namespace Ui { class BarDescriptorEditorEnvironmentWidget; }
|
||||
|
||||
class BarDescriptorEditorEnvironmentWidget : public BarDescriptorEditorAbstractPanelWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BarDescriptorEditorEnvironmentWidget(QWidget *parent = 0);
|
||||
~BarDescriptorEditorEnvironmentWidget();
|
||||
|
||||
protected:
|
||||
void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||
void emitChanged(BarDescriptorDocument::Tag tag);
|
||||
|
||||
private:
|
||||
Ui::BarDescriptorEditorEnvironmentWidget *m_ui;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
#endif // QNX_INTERNAL_BARDESCRIPTOREDITORENVIRONMENTWIDGET_H
|
@@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Qnx::Internal::BarDescriptorEditorEnvironmentWidget</class>
|
||||
<widget class="QWidget" name="Qnx::Internal::BarDescriptorEditorEnvironmentWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="ProjectExplorer::EnvironmentWidget" name="environmentWidget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ProjectExplorer::EnvironmentWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">projectexplorer/environmentwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -1,74 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "bardescriptoreditorfactory.h"
|
||||
|
||||
#include "qnxconstants.h"
|
||||
#include "bardescriptoreditor.h"
|
||||
#include "bardescriptoreditorwidget.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
#include <texteditor/texteditoractionhandler.h>
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
class BarDescriptorActionHandler : public TextEditor::TextEditorActionHandler
|
||||
{
|
||||
public:
|
||||
BarDescriptorActionHandler(QObject *parent)
|
||||
: TextEditor::TextEditorActionHandler(parent, Constants::QNX_BAR_DESCRIPTOR_EDITOR_CONTEXT)
|
||||
{
|
||||
}
|
||||
protected:
|
||||
TextEditor::TextEditorWidget *resolveTextEditorWidget(Core::IEditor *editor) const
|
||||
{
|
||||
BarDescriptorEditorWidget *w = qobject_cast<BarDescriptorEditorWidget *>(editor->widget());
|
||||
return w ? w->sourceWidget() : 0;
|
||||
}
|
||||
};
|
||||
|
||||
BarDescriptorEditorFactory::BarDescriptorEditorFactory(QObject *parent)
|
||||
: Core::IEditorFactory(parent)
|
||||
{
|
||||
setId(Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID);
|
||||
setDisplayName(tr("Bar descriptor editor"));
|
||||
addMimeType(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE);
|
||||
new BarDescriptorActionHandler(this);
|
||||
}
|
||||
|
||||
Core::IEditor *BarDescriptorEditorFactory::createEditor()
|
||||
{
|
||||
BarDescriptorEditor *editor = new BarDescriptorEditor();
|
||||
return editor;
|
||||
}
|
@@ -1,54 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BARDESCRIPTOREDITORFACTORY_H
|
||||
#define QNX_INTERNAL_BARDESCRIPTOREDITORFACTORY_H
|
||||
|
||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BarDescriptorEditorFactory : public Core::IEditorFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BarDescriptorEditorFactory(QObject *parent = 0);
|
||||
|
||||
Core::IEditor *createEditor();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BARDESCRIPTOREDITORFACTORY_H
|
@@ -1,103 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "bardescriptoreditorgeneralwidget.h"
|
||||
#include "ui_bardescriptoreditorgeneralwidget.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BarDescriptorEditorGeneralWidget::BarDescriptorEditorGeneralWidget(QWidget *parent) :
|
||||
BarDescriptorEditorAbstractPanelWidget(parent),
|
||||
m_ui(new Ui::BarDescriptorEditorGeneralWidget)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->orientation->addItem(tr("Default"), QLatin1String(""));
|
||||
m_ui->orientation->addItem(tr("Auto-orient"), QLatin1String("auto-orient"));
|
||||
m_ui->orientation->addItem(tr("Landscape"), QLatin1String("landscape"));
|
||||
m_ui->orientation->addItem(tr("Portrait"), QLatin1String("portrait"));
|
||||
|
||||
m_ui->chrome->addItem(tr("Standard"), QLatin1String("standard"));
|
||||
m_ui->chrome->addItem(tr("None"), QLatin1String("none"));
|
||||
|
||||
addSignalMapping(BarDescriptorDocument::aspectRatio, m_ui->orientation, SIGNAL(currentIndexChanged(int)));
|
||||
addSignalMapping(BarDescriptorDocument::systemChrome, m_ui->chrome, SIGNAL(currentIndexChanged(int)));
|
||||
addSignalMapping(BarDescriptorDocument::transparent, m_ui->transparentMainWindow, SIGNAL(toggled(bool)));
|
||||
addSignalMapping(BarDescriptorDocument::arg, m_ui->applicationArguments, SIGNAL(textChanged(QString)));
|
||||
}
|
||||
|
||||
BarDescriptorEditorGeneralWidget::~BarDescriptorEditorGeneralWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void BarDescriptorEditorGeneralWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||
{
|
||||
if (tag == BarDescriptorDocument::aspectRatio) {
|
||||
m_ui->orientation->setCurrentIndex(m_ui->orientation->findData(value));
|
||||
} else if (tag == BarDescriptorDocument::autoOrients) {
|
||||
if (value.toString() == QLatin1String("true")) {
|
||||
blockSignalMapping(BarDescriptorDocument::aspectRatio);
|
||||
m_ui->orientation->setCurrentIndex(m_ui->orientation->findData(QLatin1String("auto-orient")));
|
||||
unblockSignalMapping(BarDescriptorDocument::aspectRatio);
|
||||
}
|
||||
} else if (tag == BarDescriptorDocument::arg) {
|
||||
m_ui->applicationArguments->setText(value.toStringList().join(QLatin1Char(' ')));
|
||||
} else {
|
||||
BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value);
|
||||
}
|
||||
}
|
||||
|
||||
void BarDescriptorEditorGeneralWidget::emitChanged(BarDescriptorDocument::Tag tag)
|
||||
{
|
||||
if (tag == BarDescriptorDocument::aspectRatio) {
|
||||
QString value = m_ui->orientation->itemData(m_ui->orientation->currentIndex()).toString();
|
||||
if (value == QLatin1String("auto-orient")) {
|
||||
emit changed(BarDescriptorDocument::aspectRatio, QLatin1String(""));
|
||||
emit changed(BarDescriptorDocument::autoOrients, QLatin1String("true"));
|
||||
return;
|
||||
} else if (!value.isEmpty()) {
|
||||
emit changed(BarDescriptorDocument::aspectRatio, value);
|
||||
emit changed(BarDescriptorDocument::autoOrients, QLatin1String("false"));
|
||||
} else {
|
||||
emit changed(BarDescriptorDocument::aspectRatio, value);
|
||||
emit changed(BarDescriptorDocument::autoOrients, QLatin1String(""));
|
||||
}
|
||||
} else if (tag == BarDescriptorDocument::arg) {
|
||||
emit changed(tag, m_ui->applicationArguments->text().split(QLatin1Char(' ')));
|
||||
} else {
|
||||
BarDescriptorEditorAbstractPanelWidget::emitChanged(tag);
|
||||
}
|
||||
}
|
@@ -1,62 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BARDESCRIPTOREDITORGENERALWIDGET_H
|
||||
#define QNX_INTERNAL_BARDESCRIPTOREDITORGENERALWIDGET_H
|
||||
|
||||
#include "bardescriptoreditorabstractpanelwidget.h"
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
namespace Ui { class BarDescriptorEditorGeneralWidget; }
|
||||
|
||||
class BarDescriptorEditorGeneralWidget : public BarDescriptorEditorAbstractPanelWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BarDescriptorEditorGeneralWidget(QWidget *parent = 0);
|
||||
~BarDescriptorEditorGeneralWidget();
|
||||
|
||||
protected:
|
||||
void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||
void emitChanged(BarDescriptorDocument::Tag tag);
|
||||
|
||||
private:
|
||||
Ui::BarDescriptorEditorGeneralWidget *m_ui;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
#endif // QNX_INTERNAL_BARDESCRIPTOREDITORGENERALWIDGET_H
|
@@ -1,58 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Qnx::Internal::BarDescriptorEditorGeneralWidget</class>
|
||||
<widget class="QWidget" name="Qnx::Internal::BarDescriptorEditorGeneralWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>373</width>
|
||||
<height>112</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Orientation:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="orientation"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Chrome:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="chrome"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="transparentMainWindow">
|
||||
<property name="text">
|
||||
<string>Transparent main window</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Application Arguments:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="applicationArguments"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -1,57 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "bardescriptoreditorpackageinformationwidget.h"
|
||||
#include "ui_bardescriptoreditorpackageinformationwidget.h"
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BarDescriptorEditorPackageInformationWidget::BarDescriptorEditorPackageInformationWidget(QWidget *parent) :
|
||||
BarDescriptorEditorAbstractPanelWidget(parent),
|
||||
m_ui(new Ui::BarDescriptorEditorPackageInformationWidget)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
QRegExp versionNumberRegExp(QLatin1String("(\\d{1,3}\\.)?(\\d{1,3}\\.)?(\\d{1,3})"));
|
||||
QRegExpValidator *versionNumberValidator = new QRegExpValidator(versionNumberRegExp, this);
|
||||
m_ui->packageVersion->setValidator(versionNumberValidator);
|
||||
|
||||
addSignalMapping(BarDescriptorDocument::id, m_ui->packageId, SIGNAL(textChanged(QString)));
|
||||
addSignalMapping(BarDescriptorDocument::versionNumber, m_ui->packageVersion, SIGNAL(textChanged(QString)));
|
||||
addSignalMapping(BarDescriptorDocument::buildId, m_ui->packageBuildId, SIGNAL(textChanged(QString)));
|
||||
}
|
||||
|
||||
BarDescriptorEditorPackageInformationWidget::~BarDescriptorEditorPackageInformationWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
@@ -1,59 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BARDESCRIPTOREDITORPACKAGEINFORMATIONWIDGET_H
|
||||
#define QNX_INTERNAL_BARDESCRIPTOREDITORPACKAGEINFORMATIONWIDGET_H
|
||||
|
||||
#include "bardescriptoreditorabstractpanelwidget.h"
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
namespace Ui { class BarDescriptorEditorPackageInformationWidget; }
|
||||
|
||||
class BarDescriptorEditorPackageInformationWidget : public BarDescriptorEditorAbstractPanelWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BarDescriptorEditorPackageInformationWidget(QWidget *parent = 0);
|
||||
~BarDescriptorEditorPackageInformationWidget();
|
||||
|
||||
private:
|
||||
Ui::BarDescriptorEditorPackageInformationWidget *m_ui;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BARDESCRIPTOREDITORPACKAGEINFORMATIONWIDGET_H
|
@@ -1,51 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Qnx::Internal::BarDescriptorEditorPackageInformationWidget</class>
|
||||
<widget class="QWidget" name="Qnx::Internal::BarDescriptorEditorPackageInformationWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>372</width>
|
||||
<height>85</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Package ID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="packageId"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Package version:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="packageVersion"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Package build ID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="packageBuildId"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -1,93 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "bardescriptoreditorpermissionswidget.h"
|
||||
#include "ui_bardescriptoreditorpermissionswidget.h"
|
||||
|
||||
#include "bardescriptorpermissionsmodel.h"
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BarDescriptorEditorPermissionsWidget::BarDescriptorEditorPermissionsWidget(QWidget *parent) :
|
||||
BarDescriptorEditorAbstractPanelWidget(parent),
|
||||
m_ui(new Ui::BarDescriptorEditorPermissionsWidget)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_permissionsModel = new BarDescriptorPermissionsModel(this);
|
||||
m_ui->permissionsView->setModel(m_permissionsModel);
|
||||
|
||||
connect(m_ui->selectAllPermissions, SIGNAL(clicked()), m_permissionsModel, SLOT(checkAll()));
|
||||
connect(m_ui->deselectAllPermissions, SIGNAL(clicked()), m_permissionsModel, SLOT(uncheckAll()));
|
||||
|
||||
addSignalMapping(BarDescriptorDocument::action, m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
|
||||
}
|
||||
|
||||
BarDescriptorEditorPermissionsWidget::~BarDescriptorEditorPermissionsWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
QStringList BarDescriptorEditorPermissionsWidget::checkedPermissions() const
|
||||
{
|
||||
return m_permissionsModel->checkedIdentifiers();
|
||||
}
|
||||
|
||||
void BarDescriptorEditorPermissionsWidget::checkPermission(const QString &identifier)
|
||||
{
|
||||
blockSignalMapping(BarDescriptorDocument::action);
|
||||
m_permissionsModel->checkPermission(identifier);
|
||||
unblockSignalMapping(BarDescriptorDocument::action);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorPermissionsWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||
{
|
||||
if (tag != BarDescriptorDocument::action) {
|
||||
BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value);
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList permissions = value.toStringList();
|
||||
Q_FOREACH (const QString &permission, permissions)
|
||||
checkPermission(permission);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorPermissionsWidget::emitChanged(BarDescriptorDocument::Tag tag)
|
||||
{
|
||||
if (tag != BarDescriptorDocument::action) {
|
||||
BarDescriptorEditorAbstractPanelWidget::emitChanged(tag);
|
||||
return;
|
||||
}
|
||||
|
||||
emit changed(tag, checkedPermissions());
|
||||
}
|
@@ -1,69 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BARDESCRIPTOREDITORPERMISSIONSWIDGET_H
|
||||
#define QNX_INTERNAL_BARDESCRIPTOREDITORPERMISSIONSWIDGET_H
|
||||
|
||||
#include "bardescriptoreditorabstractpanelwidget.h"
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BarDescriptorPermissionsModel;
|
||||
|
||||
namespace Ui { class BarDescriptorEditorPermissionsWidget; }
|
||||
|
||||
class BarDescriptorEditorPermissionsWidget : public BarDescriptorEditorAbstractPanelWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BarDescriptorEditorPermissionsWidget(QWidget *parent = 0);
|
||||
~BarDescriptorEditorPermissionsWidget();
|
||||
|
||||
protected:
|
||||
void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||
void emitChanged(BarDescriptorDocument::Tag tag);
|
||||
|
||||
private:
|
||||
QStringList checkedPermissions() const;
|
||||
void checkPermission(const QString &identifier);
|
||||
|
||||
Ui::BarDescriptorEditorPermissionsWidget *m_ui;
|
||||
|
||||
BarDescriptorPermissionsModel *m_permissionsModel;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
#endif // QNX_INTERNAL_BARDESCRIPTOREDITORPERMISSIONSWIDGET_H
|
@@ -1,62 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Qnx::Internal::BarDescriptorEditorPermissionsWidget</class>
|
||||
<widget class="QWidget" name="Qnx::Internal::BarDescriptorEditorPermissionsWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>314</width>
|
||||
<height>171</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTreeView" name="permissionsView">
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="itemsExpandable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="selectAllPermissions">
|
||||
<property name="text">
|
||||
<string>Select All</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="deselectAllPermissions">
|
||||
<property name="text">
|
||||
<string>Deselect All</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -1,237 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "bardescriptoreditorwidget.h"
|
||||
|
||||
#include "qnxconstants.h"
|
||||
#include "bardescriptoreditor.h"
|
||||
#include "bardescriptoreditorassetswidget.h"
|
||||
#include "bardescriptoreditorauthorinformationwidget.h"
|
||||
#include "bardescriptoreditorentrypointwidget.h"
|
||||
#include "bardescriptoreditorenvironmentwidget.h"
|
||||
#include "bardescriptoreditorgeneralwidget.h"
|
||||
#include "bardescriptoreditorpackageinformationwidget.h"
|
||||
#include "bardescriptoreditorpermissionswidget.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <projectexplorer/panelswidget.h>
|
||||
#include <projectexplorer/propertiespanel.h>
|
||||
#include <projectexplorer/task.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <texteditor/textdocument.h>
|
||||
#include <texteditor/texteditor.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
#include <texteditor/normalindenter.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace TextEditor;
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BarDescriptorEditorWidget::BarDescriptorEditorWidget(BarDescriptorEditor *editor, QWidget *parent)
|
||||
: QStackedWidget(parent)
|
||||
, m_editor(editor)
|
||||
{
|
||||
Core::IContext *myContext = new Core::IContext(this);
|
||||
myContext->setWidget(this);
|
||||
myContext->setContext(Core::Context(Constants::QNX_BAR_DESCRIPTOR_EDITOR_CONTEXT, TextEditor::Constants::C_TEXTEDITOR));
|
||||
Core::ICore::addContextObject(myContext);
|
||||
|
||||
initGeneralPage();
|
||||
initApplicationPage();
|
||||
initAssetsPage();
|
||||
initSourcePage();
|
||||
|
||||
setCurrentIndex(0);
|
||||
|
||||
connect(m_entryPointWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||
connect(m_packageInformationWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||
connect(m_authorInformationWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||
connect(m_generalWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||
connect(m_permissionsWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||
connect(m_environmentWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||
connect(m_assetsWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||
|
||||
connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_entryPointWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||
connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_packageInformationWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||
connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_authorInformationWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||
connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_generalWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||
connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_permissionsWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||
connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_environmentWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||
connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_assetsWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||
|
||||
connect(m_xmlSourceWidget, SIGNAL(textChanged()), this, SLOT(updateDocumentContent()));
|
||||
connect(barDescriptorDocument(), SIGNAL(changed()), this, SLOT(updateSourceView()));
|
||||
}
|
||||
|
||||
void BarDescriptorEditorWidget::initGeneralPage()
|
||||
{
|
||||
ProjectExplorer::PanelsWidget *generalPanel = new ProjectExplorer::PanelsWidget(this);
|
||||
initPanelSize(generalPanel);
|
||||
addWidget(generalPanel);
|
||||
|
||||
// Entry-Point Text and Images
|
||||
ProjectExplorer::PropertiesPanel *entryPointPanel = new ProjectExplorer::PropertiesPanel;
|
||||
m_entryPointWidget = new BarDescriptorEditorEntryPointWidget;
|
||||
entryPointPanel->setDisplayName(tr("Entry-Point Text and Images"));
|
||||
entryPointPanel->setWidget(m_entryPointWidget);
|
||||
generalPanel->addPropertiesPanel(entryPointPanel);
|
||||
|
||||
// Package Information
|
||||
ProjectExplorer::PropertiesPanel *packageInformationPanel = new ProjectExplorer::PropertiesPanel;
|
||||
m_packageInformationWidget = new BarDescriptorEditorPackageInformationWidget;
|
||||
packageInformationPanel->setDisplayName(tr("Package Information"));
|
||||
packageInformationPanel->setWidget(m_packageInformationWidget);
|
||||
generalPanel->addPropertiesPanel(packageInformationPanel);
|
||||
|
||||
// Author information
|
||||
ProjectExplorer::PropertiesPanel *authorInformationPanel = new ProjectExplorer::PropertiesPanel;
|
||||
m_authorInformationWidget = new BarDescriptorEditorAuthorInformationWidget;
|
||||
authorInformationPanel->setDisplayName(tr("Author Information"));
|
||||
authorInformationPanel->setWidget(m_authorInformationWidget);
|
||||
generalPanel->addPropertiesPanel(authorInformationPanel);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorWidget::initApplicationPage()
|
||||
{
|
||||
ProjectExplorer::PanelsWidget *applicationPanel = new ProjectExplorer::PanelsWidget(this);
|
||||
initPanelSize(applicationPanel);
|
||||
addWidget(applicationPanel);
|
||||
|
||||
// General
|
||||
ProjectExplorer::PropertiesPanel *generalPanel = new ProjectExplorer::PropertiesPanel;
|
||||
m_generalWidget = new BarDescriptorEditorGeneralWidget;
|
||||
generalPanel->setDisplayName(tr("General"));
|
||||
generalPanel->setWidget(m_generalWidget);
|
||||
applicationPanel->addPropertiesPanel(generalPanel);
|
||||
|
||||
//Permissions
|
||||
ProjectExplorer::PropertiesPanel *permissionsPanel = new ProjectExplorer::PropertiesPanel;
|
||||
m_permissionsWidget = new BarDescriptorEditorPermissionsWidget;
|
||||
permissionsPanel->setDisplayName(tr("Permissions"));
|
||||
permissionsPanel->setWidget(m_permissionsWidget);
|
||||
applicationPanel->addPropertiesPanel(permissionsPanel);
|
||||
|
||||
// Environment
|
||||
ProjectExplorer::PropertiesPanel *environmentPanel = new ProjectExplorer::PropertiesPanel;
|
||||
m_environmentWidget = new BarDescriptorEditorEnvironmentWidget;
|
||||
environmentPanel->setDisplayName(tr("Environment"));
|
||||
environmentPanel->setWidget(m_environmentWidget);
|
||||
applicationPanel->addPropertiesPanel(environmentPanel);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorWidget::initAssetsPage()
|
||||
{
|
||||
ProjectExplorer::PanelsWidget *assetsPanel = new ProjectExplorer::PanelsWidget(this);
|
||||
initPanelSize(assetsPanel);
|
||||
addWidget(assetsPanel);
|
||||
|
||||
ProjectExplorer::PropertiesPanel *assetsPropertiesPanel = new ProjectExplorer::PropertiesPanel;
|
||||
m_assetsWidget = new BarDescriptorEditorAssetsWidget;
|
||||
assetsPropertiesPanel->setDisplayName(tr("Assets"));
|
||||
assetsPropertiesPanel->setWidget(m_assetsWidget);
|
||||
assetsPanel->addPropertiesPanel(assetsPropertiesPanel);
|
||||
|
||||
m_entryPointWidget->setAssetsModel(m_assetsWidget->assetsModel());
|
||||
connect(m_entryPointWidget, SIGNAL(imageAdded(QString)), m_assetsWidget, SLOT(addAsset(QString)));
|
||||
connect(m_entryPointWidget, SIGNAL(imageRemoved(QString)), m_assetsWidget, SLOT(removeAsset(QString)));
|
||||
}
|
||||
|
||||
void BarDescriptorEditorWidget::initSourcePage()
|
||||
{
|
||||
TextDocumentPtr doc(new TextDocument);
|
||||
doc->setId(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID); // FIXME: This looks odd.
|
||||
doc->setIndenter(new NormalIndenter);
|
||||
doc->setMimeType(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE));
|
||||
|
||||
m_xmlSourceWidget = new TextEditorWidget(this);
|
||||
m_xmlSourceWidget->setTextDocument(doc);
|
||||
m_xmlSourceWidget->setupGenericHighlighter();
|
||||
addWidget(m_xmlSourceWidget);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorWidget::initPanelSize(ProjectExplorer::PanelsWidget *panelsWidget)
|
||||
{
|
||||
panelsWidget->widget()->setMaximumWidth(900);
|
||||
panelsWidget->widget()->setMinimumWidth(0);
|
||||
}
|
||||
|
||||
TextEditorWidget *BarDescriptorEditorWidget::sourceWidget() const
|
||||
{
|
||||
return m_xmlSourceWidget;
|
||||
}
|
||||
|
||||
void BarDescriptorEditorWidget::setFilePath(const Utils::FileName &filePath)
|
||||
{
|
||||
Core::IDocument *doc = m_xmlSourceWidget->textDocument();
|
||||
if (doc)
|
||||
doc->setFilePath(filePath);
|
||||
}
|
||||
|
||||
void BarDescriptorEditorWidget::updateDocumentContent()
|
||||
{
|
||||
ProjectExplorer::TaskHub::clearTasks(Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR);
|
||||
QString errorMsg;
|
||||
int errorLine;
|
||||
|
||||
disconnect(barDescriptorDocument(), SIGNAL(changed()), this, SLOT(updateSourceView()));
|
||||
bool result = barDescriptorDocument()->loadContent(m_xmlSourceWidget->toPlainText(), true, &errorMsg, &errorLine);
|
||||
connect(barDescriptorDocument(), SIGNAL(changed()), this, SLOT(updateSourceView()));
|
||||
|
||||
if (!result) {
|
||||
ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error, errorMsg, Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR,
|
||||
Utils::FileName::fromString(barDescriptorDocument()->filePath().toString()), errorLine);
|
||||
ProjectExplorer::TaskHub::requestPopup();
|
||||
}
|
||||
}
|
||||
|
||||
void BarDescriptorEditorWidget::updateSourceView()
|
||||
{
|
||||
bool blocked = m_xmlSourceWidget->blockSignals(true);
|
||||
|
||||
int line;
|
||||
int column;
|
||||
int position = m_xmlSourceWidget->position();
|
||||
m_xmlSourceWidget->convertPosition(position, &line, &column);
|
||||
|
||||
m_xmlSourceWidget->setPlainText(barDescriptorDocument()->xmlSource());
|
||||
|
||||
m_xmlSourceWidget->gotoLine(line, column);
|
||||
|
||||
m_xmlSourceWidget->blockSignals(blocked);
|
||||
}
|
||||
|
||||
BarDescriptorDocument *BarDescriptorEditorWidget::barDescriptorDocument() const
|
||||
{
|
||||
return qobject_cast<BarDescriptorDocument*>(m_editor->document());
|
||||
}
|
@@ -1,104 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BARDESCRIPTOREDITORWIDGET_H
|
||||
#define QNX_INTERNAL_BARDESCRIPTOREDITORWIDGET_H
|
||||
|
||||
#include "bardescriptordocument.h"
|
||||
|
||||
#include <QStackedWidget>
|
||||
|
||||
namespace Core { class IEditor; }
|
||||
|
||||
namespace ProjectExplorer { class PanelsWidget; }
|
||||
|
||||
namespace TextEditor { class TextEditorWidget; }
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BarDescriptorEditor;
|
||||
class BarDescriptorEditorEntryPointWidget;
|
||||
class BarDescriptorEditorPackageInformationWidget;
|
||||
class BarDescriptorEditorAuthorInformationWidget;
|
||||
class BarDescriptorEditorGeneralWidget;
|
||||
class BarDescriptorEditorPermissionsWidget;
|
||||
class BarDescriptorEditorEnvironmentWidget;
|
||||
class BarDescriptorEditorAssetsWidget;
|
||||
|
||||
class BarDescriptorEditorWidget : public QStackedWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BarDescriptorEditorWidget(BarDescriptorEditor *editor, QWidget *parent = 0);
|
||||
|
||||
TextEditor::TextEditorWidget *sourceWidget() const;
|
||||
|
||||
void setFilePath(const Utils::FileName &filePath);
|
||||
|
||||
signals:
|
||||
void changed(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||
|
||||
private slots:
|
||||
void updateDocumentContent();
|
||||
void updateSourceView();
|
||||
|
||||
private:
|
||||
BarDescriptorDocument *barDescriptorDocument() const;
|
||||
|
||||
void initGeneralPage();
|
||||
void initApplicationPage();
|
||||
void initAssetsPage();
|
||||
void initSourcePage();
|
||||
void initPanelSize(ProjectExplorer::PanelsWidget *panelsWidget);
|
||||
|
||||
Core::IEditor *m_editor;
|
||||
|
||||
// New UI
|
||||
BarDescriptorEditorEntryPointWidget *m_entryPointWidget;
|
||||
BarDescriptorEditorPackageInformationWidget *m_packageInformationWidget;
|
||||
BarDescriptorEditorAuthorInformationWidget *m_authorInformationWidget;
|
||||
|
||||
BarDescriptorEditorGeneralWidget *m_generalWidget;
|
||||
BarDescriptorEditorPermissionsWidget *m_permissionsWidget;
|
||||
BarDescriptorEditorEnvironmentWidget *m_environmentWidget;
|
||||
|
||||
BarDescriptorEditorAssetsWidget *m_assetsWidget;
|
||||
|
||||
TextEditor::TextEditorWidget *m_xmlSourceWidget;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
#endif // QNX_INTERNAL_BARDESCRIPTOREDITORWIDGET_H
|
@@ -1,49 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "bardescriptorfilenode.h"
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BarDescriptorFileNode::BarDescriptorFileNode(const Utils::FileName &filePath)
|
||||
: ProjectExplorer::FileNode(filePath, ProjectExplorer::ProjectFileType, false)
|
||||
{
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::ProjectAction> BarDescriptorFileNode::supportedActions(ProjectExplorer::Node *node) const
|
||||
{
|
||||
Q_UNUSED(node)
|
||||
|
||||
// To disable "Remove File..." and "Rename..." context menu actions
|
||||
return QList<ProjectExplorer::ProjectAction>();
|
||||
}
|
@@ -1,52 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BARDESCRIPTORFILENODE_H
|
||||
#define QNX_INTERNAL_BARDESCRIPTORFILENODE_H
|
||||
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BarDescriptorFileNode : public ProjectExplorer::FileNode
|
||||
{
|
||||
public:
|
||||
explicit BarDescriptorFileNode(const Utils::FileName &filePath);
|
||||
|
||||
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BARDESCRIPTORFILENODE_H
|
@@ -1,357 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "bardescriptorfilenodemanager.h"
|
||||
|
||||
#include "bardescriptorfilenode.h"
|
||||
#include "blackberrydeployconfiguration.h"
|
||||
#include "blackberrydeployinformation.h"
|
||||
#include "blackberrycreatepackagestep.h"
|
||||
#include "blackberryqtversion.h"
|
||||
#include "bardescriptordocument.h"
|
||||
#include "qnxconstants.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projecttree.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <qmakeprojectmanager/qmakenodes.h>
|
||||
#include <qtsupport/baseqtversion.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <utils/checkablemessagebox.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
namespace {
|
||||
const char SKIP_BAR_DESCRIPTOR_CREATION_KEY[] = "Qnx.BlackBerry.BarDescriptorFileNodeManager.SkipCreation";
|
||||
}
|
||||
|
||||
BarDescriptorFileNodeManager::BarDescriptorFileNodeManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
connect(ProjectExplorer::ProjectTree::instance(), &ProjectExplorer::ProjectTree::currentProjectChanged,
|
||||
this, &BarDescriptorFileNodeManager::setCurrentProject);
|
||||
connect(ProjectExplorer::SessionManager::instance(), &ProjectExplorer::SessionManager::startupProjectChanged,
|
||||
this, &BarDescriptorFileNodeManager::setCurrentProject);
|
||||
}
|
||||
|
||||
void BarDescriptorFileNodeManager::setCurrentProject(ProjectExplorer::Project *project)
|
||||
{
|
||||
if (!project)
|
||||
return;
|
||||
|
||||
connect(project, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
|
||||
this, SLOT(updateBarDescriptorNodes(ProjectExplorer::Target*)), Qt::UniqueConnection);
|
||||
|
||||
updateBarDescriptorNodes(project->activeTarget());
|
||||
}
|
||||
|
||||
void BarDescriptorFileNodeManager::updateBarDescriptorNodes(ProjectExplorer::Target *target)
|
||||
{
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
// We are not consistently getting a signal when the current project changes,
|
||||
// so instead use target->project() to get access to the current project
|
||||
|
||||
if (ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(target->kit()) != Constants::QNX_BB_OS_TYPE) {
|
||||
removeBarDescriptorNodes(target->project());
|
||||
return;
|
||||
}
|
||||
|
||||
updateBarDescriptorNodes(target->project(), true);
|
||||
|
||||
QList<ProjectExplorer::DeployConfiguration*> deployConfigurations = target->deployConfigurations();
|
||||
foreach (ProjectExplorer::DeployConfiguration *deployConfiguration, deployConfigurations) {
|
||||
BlackBerryDeployConfiguration *bbdc = qobject_cast<BlackBerryDeployConfiguration*>(deployConfiguration);
|
||||
if (!bbdc)
|
||||
continue;
|
||||
|
||||
connect(bbdc->deploymentInfo(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
|
||||
this, SLOT(handleDeploymentDataChanged()), Qt::UniqueConnection);
|
||||
connect(bbdc->deploymentInfo(), SIGNAL(modelReset()),
|
||||
this, SLOT(handleDeploymentModelReset()), Qt::UniqueConnection);
|
||||
}
|
||||
}
|
||||
|
||||
void BarDescriptorFileNodeManager::handleDeploymentDataChanged()
|
||||
{
|
||||
handleDeploymentInfoChanged(false);
|
||||
}
|
||||
|
||||
void BarDescriptorFileNodeManager::handleDeploymentModelReset()
|
||||
{
|
||||
handleDeploymentInfoChanged(true);
|
||||
}
|
||||
|
||||
void BarDescriptorFileNodeManager::handleDeploymentInfoChanged(bool modelReset)
|
||||
{
|
||||
BlackBerryDeployInformation *deployInfo = qobject_cast<BlackBerryDeployInformation*>(sender());
|
||||
QTC_ASSERT(deployInfo, return);
|
||||
|
||||
updateBarDescriptorNodes(deployInfo->target()->project(), modelReset);
|
||||
}
|
||||
|
||||
void BarDescriptorFileNodeManager::updateBarDescriptorNodes(ProjectExplorer::Project *project, bool attemptCreate)
|
||||
{
|
||||
if (!project)
|
||||
return;
|
||||
|
||||
ProjectExplorer::ProjectNode *rootProject = project->rootProjectNode();
|
||||
if (!rootProject)
|
||||
return;
|
||||
|
||||
BlackBerryDeployConfiguration *dc =
|
||||
qobject_cast<BlackBerryDeployConfiguration*>(project->activeTarget()->activeDeployConfiguration());
|
||||
if (!dc)
|
||||
return;
|
||||
|
||||
QList<BarPackageDeployInformation> packages = dc->deploymentInfo()->allPackages();
|
||||
foreach (const BarPackageDeployInformation &package, packages) {
|
||||
ProjectExplorer::ProjectNode *projectNode = rootProject->path() == package.proFilePath ?
|
||||
rootProject : findProjectNode(rootProject, package.proFilePath);
|
||||
if (!projectNode)
|
||||
continue;
|
||||
|
||||
if (!package.appDescriptorPath().exists()) {
|
||||
if (!attemptCreate)
|
||||
continue;
|
||||
|
||||
if (!createBarDescriptor(project, package.appDescriptorPath(), projectNode))
|
||||
continue;
|
||||
} else {
|
||||
// Update the Qt environment if not matching the one in the deployment settings
|
||||
updateBarDescriptor(package.appDescriptorPath(), project->activeTarget());
|
||||
}
|
||||
|
||||
BarDescriptorFileNode *existingNode = findBarDescriptorFileNode(projectNode);
|
||||
if (existingNode) {
|
||||
if (existingNode->path() != package.appDescriptorPath()) {
|
||||
// Reload the new bar-descriptor document in the existing editor (if there is one)
|
||||
Core::IDocument *oldDocument = Core::DocumentModel::documentForFilePath(
|
||||
existingNode->path().toString());
|
||||
if (oldDocument) {
|
||||
QString errorMessage;
|
||||
|
||||
if (!oldDocument->save(&errorMessage)) {
|
||||
Core::MessageManager::write(tr("Cannot save bar descriptor file: %1").arg(errorMessage));
|
||||
continue;
|
||||
} else {
|
||||
oldDocument->setFilePath(package.appDescriptorPath());
|
||||
|
||||
if (!oldDocument->reload(&errorMessage, Core::IDocument::FlagReload, Core::IDocument::TypeContents))
|
||||
Core::MessageManager::write(tr("Cannot reload bar descriptor file: %1").arg(errorMessage));
|
||||
}
|
||||
}
|
||||
|
||||
existingNode->setPath(package.appDescriptorPath());
|
||||
}
|
||||
} else {
|
||||
BarDescriptorFileNode *fileNode = new BarDescriptorFileNode(package.appDescriptorPath());
|
||||
projectNode->addFileNodes(QList<ProjectExplorer::FileNode*>() << fileNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool BarDescriptorFileNodeManager::createBarDescriptor(ProjectExplorer::Project *project,
|
||||
const Utils::FileName &barDescriptorPath,
|
||||
ProjectExplorer::ProjectNode *projectNode)
|
||||
{
|
||||
const QString projectName = projectNode->path().toFileInfo().completeBaseName();
|
||||
|
||||
QmakeProjectManager::QmakeProFileNode *proFileNode =
|
||||
dynamic_cast<QmakeProjectManager::QmakeProFileNode*>(projectNode);
|
||||
QTC_ASSERT(proFileNode, return false);
|
||||
const QString targetName = proFileNode->targetInformation().target;
|
||||
|
||||
const QFile barDescriptorFile(barDescriptorPath.toString());
|
||||
if (barDescriptorFile.exists())
|
||||
return false;
|
||||
|
||||
bool skipFileCreation = project->namedSettings(QLatin1String(SKIP_BAR_DESCRIPTOR_CREATION_KEY)).toBool();
|
||||
|
||||
if (skipFileCreation)
|
||||
return false;
|
||||
|
||||
QDialogButtonBox::StandardButton button = Utils::CheckableMessageBox::question(Core::ICore::mainWindow(),
|
||||
tr("Setup Application Descriptor File"),
|
||||
tr("You need to set up a bar descriptor file to enable "
|
||||
"packaging.\nDo you want Qt Creator to generate it for your project (%1)?")
|
||||
.arg(project->projectFilePath().toUserOutput()),
|
||||
tr("Don't ask again for this project"), &skipFileCreation);
|
||||
|
||||
if (button != QDialogButtonBox::Yes) {
|
||||
project->setNamedSettings(QLatin1String(SKIP_BAR_DESCRIPTOR_CREATION_KEY), skipFileCreation);
|
||||
return false;
|
||||
}
|
||||
|
||||
QString barDescriptorTemplate;
|
||||
QtSupport::QtVersionNumber qtVersion =
|
||||
QtSupport::QtKitInformation::qtVersion(project->activeTarget()->kit())->qtVersion();
|
||||
if (qtVersion >= QtSupport::QtVersionNumber(5, 0, 0))
|
||||
barDescriptorTemplate = Core::ICore::resourcePath()
|
||||
+ QLatin1String("/templates/wizards/bb-qt5-bardescriptor/bar-descriptor.xml");
|
||||
else
|
||||
barDescriptorTemplate = Core::ICore::resourcePath()
|
||||
+ QLatin1String("/templates/wizards/bb-bardescriptor/bar-descriptor.xml");
|
||||
|
||||
Utils::FileReader reader;
|
||||
if (!reader.fetch(barDescriptorTemplate)) {
|
||||
Core::MessageManager::write(tr("Cannot set up application descriptor file: "
|
||||
"Reading the bar descriptor template failed."));
|
||||
return false;
|
||||
}
|
||||
|
||||
QString content = QString::fromUtf8(reader.data());
|
||||
content.replace(QLatin1String("PROJECTNAME"), projectName);
|
||||
content.replace(QLatin1String("TARGETNAME"), targetName);
|
||||
content.replace(QLatin1String("ID"), QLatin1String("com.example.") + projectName);
|
||||
|
||||
if (project->projectDirectory().appendPath(QLatin1String("qml")).exists())
|
||||
content.replace(QLatin1String("</qnx>"),
|
||||
QLatin1String(" <asset path=\"qml\">qml</asset>\n</qnx>"));
|
||||
|
||||
Utils::FileSaver writer(barDescriptorFile.fileName(), QIODevice::WriteOnly);
|
||||
writer.write(content.toUtf8());
|
||||
if (!writer.finalize()) {
|
||||
Core::MessageManager::write(tr("Cannot set up application descriptor file: "
|
||||
"Writing the bar descriptor file failed."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the Qt environment matches the Qt bundle mode in the deployment step
|
||||
updateBarDescriptor(barDescriptorPath, project->activeTarget(), true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BarDescriptorFileNodeManager::updateBarDescriptor(const Utils::FileName &barDescriptorPath,
|
||||
ProjectExplorer::Target *target,
|
||||
bool skipConfirmation)
|
||||
{
|
||||
BarDescriptorDocument doc;
|
||||
QString errorString;
|
||||
if (!doc.open(&errorString, barDescriptorPath.toString())) {
|
||||
QMessageBox::warning(Core::ICore::mainWindow(), tr("Error"),
|
||||
tr("Cannot open BAR application descriptor file"));
|
||||
return;
|
||||
}
|
||||
|
||||
QList<Utils::EnvironmentItem> envItems =
|
||||
doc.value(BarDescriptorDocument::env).value<QList<Utils::EnvironmentItem> >();
|
||||
|
||||
BlackBerryQtVersion *qtVersion =
|
||||
dynamic_cast<BlackBerryQtVersion *>(QtSupport::QtKitInformation::qtVersion(target->kit()));
|
||||
if (!qtVersion)
|
||||
return;
|
||||
|
||||
ProjectExplorer::BuildStepList *stepList = target->activeDeployConfiguration()->stepList();
|
||||
foreach (ProjectExplorer::BuildStep *step, stepList->steps()) {
|
||||
BlackBerryCreatePackageStep *createPackageStep = dynamic_cast<BlackBerryCreatePackageStep *>(step);
|
||||
if (createPackageStep) {
|
||||
createPackageStep->doUpdateAppDescriptorFile(barDescriptorPath,
|
||||
BlackBerryCreatePackageStep::QtEnvironment,
|
||||
skipConfirmation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BarDescriptorFileNodeManager::removeBarDescriptorNodes(ProjectExplorer::Project *project)
|
||||
{
|
||||
if (!project)
|
||||
return;
|
||||
|
||||
ProjectExplorer::ProjectNode *rootProject = project->rootProjectNode();
|
||||
if (!rootProject)
|
||||
return;
|
||||
|
||||
BarDescriptorFileNode *existingNode = findBarDescriptorFileNode(rootProject);
|
||||
if (existingNode)
|
||||
rootProject->removeFileNodes(QList<ProjectExplorer::FileNode*>() << existingNode);
|
||||
|
||||
// Also remove the bar descriptor nodes for sub-projects
|
||||
removeBarDescriptorNodes(rootProject);
|
||||
}
|
||||
|
||||
void BarDescriptorFileNodeManager::removeBarDescriptorNodes(ProjectExplorer::ProjectNode *parent)
|
||||
{
|
||||
QList<ProjectExplorer::ProjectNode*> projectNodes = parent->subProjectNodes();
|
||||
foreach (ProjectExplorer::ProjectNode *projectNode, projectNodes) {
|
||||
BarDescriptorFileNode *existingNode = findBarDescriptorFileNode(projectNode);
|
||||
if (existingNode)
|
||||
projectNode->removeFileNodes(QList<ProjectExplorer::FileNode*>() << existingNode);
|
||||
|
||||
removeBarDescriptorNodes(projectNode);
|
||||
}
|
||||
}
|
||||
|
||||
BarDescriptorFileNode *BarDescriptorFileNodeManager::findBarDescriptorFileNode(ProjectExplorer::ProjectNode *parent) const
|
||||
{
|
||||
QTC_ASSERT(parent, return 0);
|
||||
|
||||
QList<ProjectExplorer::FileNode*> fileNodes = parent->fileNodes();
|
||||
foreach (ProjectExplorer::FileNode *fileNode, fileNodes) {
|
||||
BarDescriptorFileNode *barDescriptorNode = dynamic_cast<BarDescriptorFileNode*>(fileNode);
|
||||
if (barDescriptorNode)
|
||||
return barDescriptorNode;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ProjectExplorer::ProjectNode *BarDescriptorFileNodeManager::findProjectNode(
|
||||
ProjectExplorer::ProjectNode *parent,
|
||||
const Utils::FileName &projectFilePath) const
|
||||
{
|
||||
QTC_ASSERT(parent, return 0);
|
||||
|
||||
QList<ProjectExplorer::ProjectNode*> projectNodes = parent->subProjectNodes();
|
||||
foreach (ProjectExplorer::ProjectNode *projectNode, projectNodes) {
|
||||
if (projectNode->path() == projectFilePath) {
|
||||
return projectNode;
|
||||
} else if (!projectNode->subProjectNodes().isEmpty()) {
|
||||
ProjectExplorer::ProjectNode *hit = findProjectNode(projectNode, projectFilePath);
|
||||
if (hit)
|
||||
return hit;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,86 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BARDESCRIPTORFILENODEMANAGER_H
|
||||
#define QNX_INTERNAL_BARDESCRIPTORFILENODEMANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace Utils {
|
||||
class FileName;
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class DeployConfiguration;
|
||||
class Project;
|
||||
class ProjectNode;
|
||||
class Target;
|
||||
}
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BarDescriptorFileNode;
|
||||
|
||||
class BarDescriptorFileNodeManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BarDescriptorFileNodeManager(QObject *parent = 0);
|
||||
|
||||
private slots:
|
||||
void setCurrentProject(ProjectExplorer::Project *project);
|
||||
void updateBarDescriptorNodes(ProjectExplorer::Target *target);
|
||||
void handleDeploymentInfoChanged(bool modelReset);
|
||||
|
||||
void handleDeploymentDataChanged();
|
||||
void handleDeploymentModelReset();
|
||||
|
||||
private:
|
||||
BarDescriptorFileNode *findBarDescriptorFileNode(ProjectExplorer::ProjectNode *parent) const;
|
||||
ProjectExplorer::ProjectNode *findProjectNode(ProjectExplorer::ProjectNode *parent,
|
||||
const Utils::FileName &projectFilePath) const;
|
||||
|
||||
void updateBarDescriptorNodes(ProjectExplorer::Project *project, bool attemptCreate);
|
||||
bool createBarDescriptor(ProjectExplorer::Project *project, const Utils::FileName &barDescriptorPath,
|
||||
ProjectExplorer::ProjectNode *projectNode);
|
||||
void updateBarDescriptor(const Utils::FileName &barDescriptorPath, ProjectExplorer::Target *target,
|
||||
bool skipConfirmation = false);
|
||||
|
||||
void removeBarDescriptorNodes(ProjectExplorer::Project *project);
|
||||
void removeBarDescriptorNodes(ProjectExplorer::ProjectNode *parent);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BARDESCRIPTORFILENODEMANAGER_H
|
@@ -1,208 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "bardescriptorpermissionsmodel.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BarDescriptorPermissionsModel::BarDescriptorPermissionsModel(QObject *parent) :
|
||||
QAbstractTableModel(parent)
|
||||
{
|
||||
initModel();
|
||||
}
|
||||
|
||||
Qt::ItemFlags BarDescriptorPermissionsModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
Qt::ItemFlags flags = QAbstractTableModel::flags(index);
|
||||
flags |= Qt::ItemIsUserCheckable;
|
||||
return flags;
|
||||
}
|
||||
|
||||
int BarDescriptorPermissionsModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
return m_permissions.size();
|
||||
}
|
||||
|
||||
int BarDescriptorPermissionsModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
return 1;
|
||||
}
|
||||
|
||||
QVariant BarDescriptorPermissionsModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid() || index.row() >= m_permissions.size() || index.column() >= 1)
|
||||
return QVariant();
|
||||
|
||||
BarDescriptorPermission perm = m_permissions[index.row()];
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
case Qt::EditRole:
|
||||
return perm.permission;
|
||||
case Qt::CheckStateRole:
|
||||
return perm.checked ? Qt::Checked : Qt::Unchecked;
|
||||
case Qt::ToolTipRole:
|
||||
return perm.description;
|
||||
case IdentifierRole:
|
||||
return perm.identifier;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool BarDescriptorPermissionsModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if (!index.isValid() || index.row() >= m_permissions.size() || index.column() >= 1)
|
||||
return false;
|
||||
|
||||
if (role == Qt::CheckStateRole) {
|
||||
BarDescriptorPermission &perm = m_permissions[index.row()];
|
||||
perm.checked = static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked;
|
||||
emit dataChanged(index, index);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QVariant BarDescriptorPermissionsModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole || orientation == Qt::Vertical)
|
||||
return QVariant();
|
||||
|
||||
if (section == 0)
|
||||
return tr("Permission");
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void BarDescriptorPermissionsModel::uncheckAll()
|
||||
{
|
||||
setCheckStateAll(Qt::Unchecked);
|
||||
}
|
||||
|
||||
void BarDescriptorPermissionsModel::checkAll()
|
||||
{
|
||||
setCheckStateAll(Qt::Checked);
|
||||
}
|
||||
|
||||
void BarDescriptorPermissionsModel::checkPermission(const QString &identifier)
|
||||
{
|
||||
for (int i = 0; i < rowCount(); ++i) {
|
||||
QModelIndex idx = index(i, 0);
|
||||
if (data(idx, IdentifierRole).toString() == identifier)
|
||||
setData(idx, Qt::Checked, Qt::CheckStateRole);
|
||||
}
|
||||
}
|
||||
|
||||
QStringList BarDescriptorPermissionsModel::checkedIdentifiers() const
|
||||
{
|
||||
QStringList result;
|
||||
foreach (const BarDescriptorPermission &perm, m_permissions) {
|
||||
if (perm.checked)
|
||||
result << perm.identifier;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void BarDescriptorPermissionsModel::initModel()
|
||||
{
|
||||
beginResetModel();
|
||||
m_permissions << BarDescriptorPermission(tr("BlackBerry Messenger"), QLatin1String("bbm_connect"),
|
||||
tr("<html><head/><body><p>Allows this app to connect to the BBM Social Platform to access BBM "
|
||||
"contact lists and user profiles, invite BBM contacts to download your "
|
||||
"app, initiate BBM chats and share content from within your app, or "
|
||||
"stream data between apps in real time.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Calendar"), QLatin1String("access_pimdomain_calendars"),
|
||||
tr("<html><head/><body><p>Allows this app to access the calendar on the device. This access "
|
||||
"includes viewing, adding, and deleting calendar appointments.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Camera"), QLatin1String("use_camera"),
|
||||
tr("<html><head/><body><p>Allows this app to take pictures, record video, and use the flash.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Contacts"), QLatin1String("access_pimdomain_contacts"),
|
||||
tr("<html><head/><body><p>Allows this app to access the contacts stored on the device. This "
|
||||
"access includes viewing, creating, and deleting the contacts.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Device Identifying Information"), QLatin1String("read_device_identifying_information"),
|
||||
tr("<html><head/><body><p>Allows this app to access device identifiers such as serial number and PIN.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Email and PIN Messages"), QLatin1String("access_pimdomain_messages"),
|
||||
tr("<html><head/><body><p>Allows this app to access the email and PIN messages stored on the "
|
||||
"device. This access includes viewing, creating, sending, and deleting the messages.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("GPS Location"), QLatin1String("read_geolocation"),
|
||||
tr("<html><head/><body><p>Allows this app to access the current GPS location of the device.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Internet"), QLatin1String("access_internet"),
|
||||
tr("<html><head/><body><p>Allows this app to use Wi-fi, wired, or other connections to a "
|
||||
"destination that is not local on the user's device.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Location"), QLatin1String("access_location_services"),
|
||||
tr("<html><head/><body><p>Allows this app to access the device's current or saved locations.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Microphone"), QLatin1String("record_audio"),
|
||||
tr("<html><head/><body><p>Allows this app to record sound using the microphone.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Notebooks"), QLatin1String("access_pimdomain_notebooks"),
|
||||
tr("<html><head/><body><p>Allows this app to access the content stored in the notebooks on the "
|
||||
"device. This access includes adding and deleting entries and content.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Post Notifications"), QLatin1String("post_notification"),
|
||||
tr("<html><head/><body><p>Post a notification to the notifications area of the screen.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Push"), QLatin1String("_sys_use_consumer_push"),
|
||||
tr("<html><head/><body><p>Allows this app to use the Push Service with the BlackBerry Internet "
|
||||
"Service. This access allows the app to receive and request push "
|
||||
"messages. To use the Push Service with the BlackBerry Internet Service, "
|
||||
"you must register with BlackBerry. When you register, you "
|
||||
"receive a confirmation email message that contains information that "
|
||||
"your application needs to receive and request push messages. For more "
|
||||
"information about registering, visit "
|
||||
"https://developer.blackberry.com/services/push/. If you're using the "
|
||||
"Push Service with the BlackBerry Enterprise Server or the BlackBerry "
|
||||
"Device Service, you don't need to register with BlackBerry.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Run When Backgrounded"), QLatin1String("run_when_backgrounded"),
|
||||
tr("<html><head/><body><p>Allows background processing. Without this permission, the app is "
|
||||
"stopped when the user switches focus to another app. Apps that use this "
|
||||
"permission are rigorously reviewed for acceptance to BlackBerry App "
|
||||
"World storefront for their use of power.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Shared Files"), QLatin1String("access_shared"),
|
||||
tr("<html><head/><body><p>Allows this app to access pictures, music, documents, and other files "
|
||||
"stored on the user's device, at a remote storage provider, on a media "
|
||||
"card, or in the cloud.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Text Messages"), QLatin1String("access_sms_mms"),
|
||||
tr("<html><head/><body><p>Allows this app to access the text messages stored on the device. The "
|
||||
"access includes viewing, creating, sending, and deleting text messages.</p></body></html>"));
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
|
||||
void BarDescriptorPermissionsModel::setCheckStateAll(Qt::CheckState checkState)
|
||||
{
|
||||
for (int i = 0; i < rowCount(); ++i)
|
||||
setData(index(i, 0), checkState, Qt::CheckStateRole);
|
||||
}
|
@@ -1,95 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BARDESCRIPTORPERMISSIONSMODEL_H
|
||||
#define QNX_INTERNAL_BARDESCRIPTORPERMISSIONSMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BarDescriptorPermission {
|
||||
public:
|
||||
BarDescriptorPermission(const QString &perm, const QString &ident, const QString &desc)
|
||||
: checked(false)
|
||||
, permission(perm)
|
||||
, identifier(ident)
|
||||
, description(desc)
|
||||
{
|
||||
}
|
||||
|
||||
bool checked;
|
||||
QString permission;
|
||||
QString identifier;
|
||||
QString description;
|
||||
};
|
||||
|
||||
class BarDescriptorPermissionsModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BarDescriptorPermissionsModel(QObject *parent = 0);
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
|
||||
void checkPermission(const QString &identifier);
|
||||
QStringList checkedIdentifiers() const;
|
||||
|
||||
public slots:
|
||||
void uncheckAll();
|
||||
void checkAll();
|
||||
|
||||
private:
|
||||
enum DataRole {
|
||||
IdentifierRole = Qt::UserRole
|
||||
};
|
||||
|
||||
void setCheckStateAll(Qt::CheckState checkState);
|
||||
|
||||
void initModel();
|
||||
|
||||
QList<BarDescriptorPermission> m_permissions;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BARDESCRIPTORPERMISSIONSMODEL_H
|
@@ -1,253 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 - 2014 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "blackberryabstractdeploystep.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/task.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QTimer>
|
||||
#include <QEventLoop>
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BlackBerryAbstractDeployStep::BlackBerryAbstractDeployStep(ProjectExplorer::BuildStepList *bsl, Core::Id id)
|
||||
: ProjectExplorer::BuildStep(bsl, id)
|
||||
, m_processCounter(-1)
|
||||
, m_process(0)
|
||||
, m_timer(0)
|
||||
, m_futureInterface(0)
|
||||
, m_eventLoop(0)
|
||||
{
|
||||
connect(&m_outputParser, SIGNAL(addTask(ProjectExplorer::Task)), this, SIGNAL(addTask(ProjectExplorer::Task)));
|
||||
connect(&m_outputParser, SIGNAL(progressParsed(int)), this, SLOT(reportProgress(int)));
|
||||
}
|
||||
|
||||
BlackBerryAbstractDeployStep::BlackBerryAbstractDeployStep(ProjectExplorer::BuildStepList *bsl, BlackBerryAbstractDeployStep *bs)
|
||||
: ProjectExplorer::BuildStep(bsl, bs)
|
||||
, m_processCounter(-1)
|
||||
, m_process(0)
|
||||
, m_timer(0)
|
||||
, m_futureInterface(0)
|
||||
, m_eventLoop(0)
|
||||
{
|
||||
connect(&m_outputParser, SIGNAL(addTask(ProjectExplorer::Task)), this, SIGNAL(addTask(ProjectExplorer::Task)));
|
||||
connect(&m_outputParser, SIGNAL(progressParsed(int)), this, SLOT(reportProgress(int)));
|
||||
}
|
||||
|
||||
BlackBerryAbstractDeployStep::~BlackBerryAbstractDeployStep()
|
||||
{
|
||||
delete m_process;
|
||||
m_process = 0;
|
||||
}
|
||||
|
||||
bool BlackBerryAbstractDeployStep::init()
|
||||
{
|
||||
m_params.clear();
|
||||
m_processCounter = -1;
|
||||
|
||||
m_environment = target()->activeBuildConfiguration()->environment();
|
||||
m_buildDirectory = target()->activeBuildConfiguration()->buildDirectory().toString();
|
||||
// The bar descriptor is using BUILD_DIR variable to set the target path
|
||||
m_environment.appendOrSet(QLatin1String("BUILD_DIR"), m_buildDirectory);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::run(QFutureInterface<bool> &fi)
|
||||
{
|
||||
m_timer = new QTimer();
|
||||
connect(m_timer, SIGNAL(timeout()), this, SLOT(checkForCancel()), Qt::DirectConnection);
|
||||
m_timer->start(500);
|
||||
m_eventLoop = new QEventLoop;
|
||||
|
||||
fi.setProgressRange(0, 100 * m_params.size());
|
||||
|
||||
Q_ASSERT(!m_futureInterface);
|
||||
m_futureInterface = &fi;
|
||||
|
||||
runCommands();
|
||||
|
||||
bool returnValue = m_eventLoop->exec();
|
||||
|
||||
// Finished
|
||||
m_params.clear();
|
||||
m_processCounter = -1;
|
||||
|
||||
m_timer->stop();
|
||||
delete m_timer;
|
||||
m_timer = 0;
|
||||
|
||||
delete m_process;
|
||||
m_process = 0;
|
||||
delete m_eventLoop;
|
||||
m_eventLoop = 0;
|
||||
|
||||
m_futureInterface = 0;
|
||||
|
||||
fi.reportResult(returnValue);
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::addCommand(const QString &command, const QStringList &arguments)
|
||||
{
|
||||
ProjectExplorer::ProcessParameters param;
|
||||
param.setCommand(command);
|
||||
param.setArguments(arguments.join(QLatin1Char(' ')));
|
||||
m_params << param;
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::reportProgress(int progress)
|
||||
{
|
||||
QTC_ASSERT(progress >= 0 && progress <= 100, return);
|
||||
|
||||
if (m_futureInterface)
|
||||
m_futureInterface->setProgressValue(100 * m_processCounter + progress);
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::runCommands()
|
||||
{
|
||||
if (!m_process) {
|
||||
m_process = new Utils::QtcProcess();
|
||||
connect(m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(processReadyReadStdOutput()), Qt::DirectConnection);
|
||||
connect(m_process, SIGNAL(readyReadStandardError()), this, SLOT(processReadyReadStdError()), Qt::DirectConnection);
|
||||
}
|
||||
|
||||
m_process->setEnvironment(m_environment);
|
||||
m_process->setWorkingDirectory(m_buildDirectory);
|
||||
|
||||
connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(handleProcessFinished(int,QProcess::ExitStatus)), Qt::DirectConnection);
|
||||
|
||||
runNextCommand();
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::runNextCommand()
|
||||
{
|
||||
++m_processCounter;
|
||||
m_futureInterface->setProgressValue(100 * m_processCounter);
|
||||
|
||||
ProjectExplorer::ProcessParameters param = m_params.takeFirst();
|
||||
|
||||
QTC_ASSERT(m_process->state() == QProcess::NotRunning, return);
|
||||
|
||||
m_process->setCommand(param.effectiveCommand(), param.effectiveArguments());
|
||||
m_process->start();
|
||||
if (!m_process->waitForStarted()) {
|
||||
m_eventLoop->exit(false);
|
||||
return;
|
||||
}
|
||||
processStarted(param);
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::processStarted(const ProjectExplorer::ProcessParameters ¶ms)
|
||||
{
|
||||
emitOutputInfo(params, params.prettyArguments());
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::emitOutputInfo(const ProjectExplorer::ProcessParameters ¶ms, const QString &arguments)
|
||||
{
|
||||
emit addOutput(tr("Starting: \"%1\" %2")
|
||||
.arg(QDir::toNativeSeparators(params.effectiveCommand()),
|
||||
arguments),
|
||||
BuildStep::MessageOutput);
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::raiseError(const QString &errorMessage)
|
||||
{
|
||||
ProjectExplorer::Task task = ProjectExplorer::Task(ProjectExplorer::Task::Error, errorMessage, Utils::FileName(), -1,
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
|
||||
emit addTask(task, 1);
|
||||
emit addOutput(errorMessage, BuildStep::ErrorMessageOutput);
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::processReadyReadStdOutput()
|
||||
{
|
||||
m_process->setReadChannel(QProcess::StandardOutput);
|
||||
while (m_process->canReadLine()) {
|
||||
const QString line = QString::fromLocal8Bit(m_process->readLine());
|
||||
stdOutput(line);
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::stdOutput(const QString &line)
|
||||
{
|
||||
m_outputParser.stdOutput(line);
|
||||
emit addOutput(line, BuildStep::NormalOutput, BuildStep::DontAppendNewline);
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::processReadyReadStdError()
|
||||
{
|
||||
m_process->setReadChannel(QProcess::StandardError);
|
||||
while (m_process->canReadLine()) {
|
||||
const QString line = QString::fromLocal8Bit(m_process->readLine());
|
||||
stdError(line);
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::checkForCancel()
|
||||
{
|
||||
if (m_futureInterface->isCanceled()
|
||||
&& m_timer && m_timer->isActive()) {
|
||||
m_timer->stop();
|
||||
if (m_process) {
|
||||
m_process->terminate();
|
||||
m_process->waitForFinished(5000); //while waiting, the process can be killed
|
||||
if (m_process)
|
||||
m_process->kill();
|
||||
}
|
||||
if (m_eventLoop)
|
||||
m_eventLoop->exit(false);
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
if (exitCode == 0 && exitStatus == QProcess::NormalExit) {
|
||||
if (!m_params.isEmpty())
|
||||
runNextCommand();
|
||||
else
|
||||
m_eventLoop->exit(true);
|
||||
} else {
|
||||
m_eventLoop->exit(false);
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::stdError(const QString &line)
|
||||
{
|
||||
m_outputParser.stdError(line);
|
||||
emit addOutput(line, BuildStep::ErrorOutput, BuildStep::DontAppendNewline);
|
||||
}
|
@@ -1,109 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 - 2014 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BLACKBERRYABSTRACTDEPLOYSTEP_H
|
||||
#define QNX_INTERNAL_BLACKBERRYABSTRACTDEPLOYSTEP_H
|
||||
|
||||
#include "blackberryprocessparser.h"
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <projectexplorer/processparameters.h>
|
||||
|
||||
#include <QProcess>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QEventLoop;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils { class QtcProcess; }
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BlackBerryAbstractDeployStep : public ProjectExplorer::BuildStep
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BlackBerryAbstractDeployStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
|
||||
~BlackBerryAbstractDeployStep();
|
||||
|
||||
bool init();
|
||||
void run(QFutureInterface<bool> &fi);
|
||||
|
||||
protected:
|
||||
BlackBerryAbstractDeployStep(ProjectExplorer::BuildStepList *bsl, BlackBerryAbstractDeployStep *bs);
|
||||
|
||||
void addCommand(const QString &command, const QStringList &arguments);
|
||||
|
||||
virtual void stdOutput(const QString &line);
|
||||
virtual void stdError(const QString &line);
|
||||
|
||||
virtual void processStarted(const ProjectExplorer::ProcessParameters ¶m);
|
||||
|
||||
void emitOutputInfo(const ProjectExplorer::ProcessParameters ¶ms, const QString& arguments);
|
||||
|
||||
void raiseError(const QString &errorMessage);
|
||||
|
||||
private slots:
|
||||
void reportProgress(int progress);
|
||||
|
||||
void processReadyReadStdOutput();
|
||||
void processReadyReadStdError();
|
||||
|
||||
void checkForCancel();
|
||||
|
||||
void handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
||||
private:
|
||||
void ctor();
|
||||
|
||||
void runCommands();
|
||||
void runNextCommand();
|
||||
|
||||
QList<ProjectExplorer::ProcessParameters> m_params;
|
||||
int m_processCounter;
|
||||
Utils::QtcProcess *m_process;
|
||||
|
||||
Utils::Environment m_environment;
|
||||
QString m_buildDirectory;
|
||||
|
||||
QTimer *m_timer;
|
||||
QFutureInterface<bool> *m_futureInterface;
|
||||
QEventLoop *m_eventLoop;
|
||||
|
||||
BlackBerryProcessParser m_outputParser;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BLACKBERRYABSTRACTDEPLOYSTEP_H
|
@@ -1,417 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "blackberryapilevelconfiguration.h"
|
||||
#include "blackberryconfigurationmanager.h"
|
||||
#include "blackberryqtversion.h"
|
||||
|
||||
#include "qnxtoolchain.h"
|
||||
#include "qnxconstants.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
#include <projectexplorer/gcctoolchain.h>
|
||||
|
||||
#include <qtsupport/baseqtversion.h>
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
|
||||
#include <qmakeprojectmanager/qmakekitinformation.h>
|
||||
|
||||
#include <debugger/debuggeritemmanager.h>
|
||||
#include <debugger/debuggeritem.h>
|
||||
#include <debugger/debuggerkitinformation.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QMessageBox>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace QtSupport;
|
||||
using namespace Utils;
|
||||
using namespace Debugger;
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
const QLatin1String NDKPathKey("NDKPath");
|
||||
const QLatin1String NDKDisplayNameKey("NDKDisplayName");
|
||||
const QLatin1String NDKTargetKey("NDKTarget");
|
||||
const QLatin1String NDKHostKey("NDKHost");
|
||||
const QLatin1String NDKAutoDetectionSourceKey("NDKAutoDetectionSource");
|
||||
const QLatin1String NDKAutoDetectedKey("NDKAutoDetectedKey");
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
bool BlackBerryApiLevelConfiguration::m_fakeConfig = false;
|
||||
#endif
|
||||
|
||||
BlackBerryApiLevelConfiguration::BlackBerryApiLevelConfiguration(const ConfigInstallInformation &ndkInstallInfo)
|
||||
: QnxBaseConfiguration(FileName::fromString(
|
||||
QnxUtils::envFilePath(ndkInstallInfo.path, ndkInstallInfo.version)))
|
||||
{
|
||||
m_displayName = ndkInstallInfo.name;
|
||||
QString sep = QString::fromLatin1("/qnx6");
|
||||
// The QNX_TARGET value is using Unix-like separator on all platforms.
|
||||
m_targetName = ndkInstallInfo.target.split(sep).first().split(QLatin1Char('/')).last();
|
||||
m_sysRoot = FileName::fromString(ndkInstallInfo.target);
|
||||
m_autoDetectionSource = FileName::fromString(ndkInstallInfo.installationXmlFilePath);
|
||||
setVersion(QnxVersionNumber(ndkInstallInfo.version));
|
||||
ctor();
|
||||
}
|
||||
|
||||
BlackBerryApiLevelConfiguration::BlackBerryApiLevelConfiguration(const FileName &ndkEnvFile)
|
||||
: QnxBaseConfiguration(ndkEnvFile)
|
||||
{
|
||||
m_displayName = ndkPath().split(QDir::separator()).last();
|
||||
QString ndkTarget = qnxTarget().toString();
|
||||
// The QNX_TARGET value is using Unix-like separator on all platforms.
|
||||
QString sep = QString::fromLatin1("/qnx6");
|
||||
m_targetName = ndkTarget.split(sep).first().split(QLatin1Char('/')).last();
|
||||
if (QDir(ndkTarget).exists())
|
||||
m_sysRoot = FileName::fromString(ndkTarget);
|
||||
|
||||
setVersion(QnxVersionNumber::fromNdkEnvFileName(QFileInfo(envFile().toString()).baseName()));
|
||||
if (version().isEmpty())
|
||||
setVersion(QnxVersionNumber::fromTargetName(m_targetName));
|
||||
|
||||
ctor();
|
||||
}
|
||||
|
||||
BlackBerryApiLevelConfiguration::BlackBerryApiLevelConfiguration(const QVariantMap &data)
|
||||
: QnxBaseConfiguration(data)
|
||||
{
|
||||
m_displayName = data.value(NDKDisplayNameKey).toString();
|
||||
QString sep = QString::fromLatin1("/qnx6");
|
||||
// The QNX_TARGET value is using Unix-like separator on all platforms.
|
||||
m_targetName = data.value(NDKTargetKey).toString().split(sep).first().split(QLatin1Char('/')).last();
|
||||
m_sysRoot = FileName::fromString(data.value(NDKTargetKey).toString());
|
||||
if (data.value(QLatin1String(NDKAutoDetectedKey)).toBool())
|
||||
m_autoDetectionSource = FileName::fromString(data.value(NDKAutoDetectionSourceKey).toString());
|
||||
|
||||
ctor();
|
||||
}
|
||||
|
||||
void BlackBerryApiLevelConfiguration::ctor()
|
||||
{
|
||||
QString host = qnxHost().toString();
|
||||
FileName qmake4Path = FileName::fromString(HostOsInfo::withExecutableSuffix(host + QLatin1String("/usr/bin/qmake")));
|
||||
FileName qmake5Path = FileName::fromString(HostOsInfo::withExecutableSuffix(host + QLatin1String("/usr/bin/qt5/qmake")));
|
||||
if (qmake4Path.exists())
|
||||
m_qmake4BinaryFile = qmake4Path;
|
||||
|
||||
if (qmake5Path.exists())
|
||||
m_qmake5BinaryFile = qmake5Path;
|
||||
}
|
||||
|
||||
QString BlackBerryApiLevelConfiguration::ndkPath() const
|
||||
{
|
||||
return envFile().parentDir().toString();
|
||||
}
|
||||
|
||||
QString BlackBerryApiLevelConfiguration::displayName() const
|
||||
{
|
||||
return m_displayName;
|
||||
}
|
||||
|
||||
QString BlackBerryApiLevelConfiguration::targetName() const
|
||||
{
|
||||
return m_targetName;
|
||||
}
|
||||
|
||||
bool BlackBerryApiLevelConfiguration::isAutoDetected() const
|
||||
{
|
||||
return !m_autoDetectionSource.isEmpty();
|
||||
}
|
||||
|
||||
FileName BlackBerryApiLevelConfiguration::autoDetectionSource() const
|
||||
{
|
||||
return m_autoDetectionSource;
|
||||
}
|
||||
|
||||
bool BlackBerryApiLevelConfiguration::isActive() const
|
||||
{
|
||||
foreach (Kit *kit, KitManager::kits()) {
|
||||
if (kit->isAutoDetected() &&
|
||||
kit->autoDetectionSource() == envFile().toString())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BlackBerryApiLevelConfiguration::isValid() const
|
||||
{
|
||||
#ifdef WITH_TESTS
|
||||
if (BlackBerryApiLevelConfiguration::fakeConfig())
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return QnxBaseConfiguration::isValid() &&
|
||||
((!m_qmake4BinaryFile.isEmpty() || !m_qmake5BinaryFile.isEmpty())
|
||||
&& (m_autoDetectionSource.isEmpty() ||
|
||||
m_autoDetectionSource.exists())
|
||||
&& (!m_sysRoot.isEmpty() && m_sysRoot.exists()));
|
||||
}
|
||||
|
||||
|
||||
FileName BlackBerryApiLevelConfiguration::qmake4BinaryFile() const
|
||||
{
|
||||
return m_qmake4BinaryFile;
|
||||
}
|
||||
|
||||
FileName BlackBerryApiLevelConfiguration::qmake5BinaryFile() const
|
||||
{
|
||||
return m_qmake5BinaryFile;
|
||||
}
|
||||
|
||||
FileName BlackBerryApiLevelConfiguration::sysRoot() const
|
||||
{
|
||||
return m_sysRoot;
|
||||
}
|
||||
|
||||
QVariantMap BlackBerryApiLevelConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap data = QnxBaseConfiguration::toMap();
|
||||
data.insert(QLatin1String(Qnx::Constants::QNX_BB_KEY_CONFIGURATION_TYPE),
|
||||
QLatin1String(Qnx::Constants::QNX_BB_APILEVEL_TYPE));
|
||||
data.insert(QLatin1String(NDKDisplayNameKey), m_displayName);
|
||||
data.insert(QLatin1String(NDKPathKey), ndkPath());
|
||||
data.insert(QLatin1String(NDKTargetKey), m_sysRoot.toString());
|
||||
data.insert(QLatin1String(NDKAutoDetectionSourceKey), m_autoDetectionSource.toString());
|
||||
data.insert(QLatin1String(NDKAutoDetectedKey), isAutoDetected());
|
||||
return data;
|
||||
}
|
||||
|
||||
QnxAbstractQtVersion *BlackBerryApiLevelConfiguration::createQtVersion(
|
||||
const FileName &qmakePath, Qnx::QnxArchitecture arch, const QString &versionName)
|
||||
{
|
||||
QnxAbstractQtVersion *version = new BlackBerryQtVersion(
|
||||
arch, qmakePath, true, QString(), envFile().toString());
|
||||
version->setUnexpandedDisplayName(tr("Qt %{Qt:Version} for %2")
|
||||
.arg(version->qtVersionString(), versionName));
|
||||
QtVersionManager::addVersion(version);
|
||||
return version;
|
||||
}
|
||||
|
||||
Kit *BlackBerryApiLevelConfiguration::createKit(
|
||||
QnxAbstractQtVersion *version, QnxToolChain *toolChain, const QVariant &debuggerItemId)
|
||||
{
|
||||
Kit *kit = new Kit;
|
||||
bool isSimulator = version->architecture() == X86;
|
||||
|
||||
QtKitInformation::setQtVersion(kit, version);
|
||||
ToolChainKitInformation::setToolChain(kit, toolChain);
|
||||
|
||||
if (debuggerItemId.isValid())
|
||||
DebuggerKitInformation::setDebugger(kit, debuggerItemId);
|
||||
|
||||
if (version->qtVersion().majorVersion == 4) {
|
||||
if (isSimulator) {
|
||||
QmakeProjectManager::QmakeKitInformation::setMkspec(
|
||||
kit, FileName::fromLatin1("blackberry-x86-qcc"));
|
||||
} else {
|
||||
QmakeProjectManager::QmakeKitInformation::setMkspec(
|
||||
kit, FileName::fromLatin1("blackberry-armv7le-qcc"));
|
||||
}
|
||||
}
|
||||
|
||||
DeviceTypeKitInformation::setDeviceTypeId(kit, Constants::QNX_BB_OS_TYPE);
|
||||
SysRootKitInformation::setSysRoot(kit, m_sysRoot);
|
||||
|
||||
kit->setUnexpandedDisplayName(version->displayName());
|
||||
kit->setIconPath(FileName::fromString(QLatin1String(Constants::QNX_BB_CATEGORY_ICON)));
|
||||
|
||||
kit->setAutoDetected(true);
|
||||
kit->setAutoDetectionSource(envFile().toString());
|
||||
kit->setMutable(DeviceKitInformation::id(), true);
|
||||
|
||||
kit->setSticky(QtKitInformation::id(), true);
|
||||
kit->setSticky(ToolChainKitInformation::id(), true);
|
||||
kit->setSticky(DeviceTypeKitInformation::id(), true);
|
||||
kit->setSticky(SysRootKitInformation::id(), true);
|
||||
kit->setSticky(DebuggerKitInformation::id(), true);
|
||||
kit->setSticky(QmakeProjectManager::QmakeKitInformation::id(), true);
|
||||
|
||||
KitManager::registerKit(kit);
|
||||
return kit;
|
||||
}
|
||||
|
||||
QStringList BlackBerryApiLevelConfiguration::validationErrors() const
|
||||
{
|
||||
QStringList errorStrings = QnxBaseConfiguration::validationErrors();
|
||||
if (m_qmake4BinaryFile.isEmpty() && m_qmake5BinaryFile.isEmpty())
|
||||
errorStrings << tr("- No Qt version found.");
|
||||
|
||||
if (!m_autoDetectionSource.isEmpty() && !m_autoDetectionSource.exists())
|
||||
errorStrings << tr("- No auto detection source found.");
|
||||
|
||||
if (m_sysRoot.isEmpty() && m_sysRoot.exists())
|
||||
errorStrings << tr("- No sysroot found.");
|
||||
|
||||
|
||||
return errorStrings;
|
||||
}
|
||||
|
||||
bool BlackBerryApiLevelConfiguration::activate()
|
||||
{
|
||||
if (!isValid()) {
|
||||
if (!m_autoDetectionSource.isEmpty())
|
||||
return false;
|
||||
|
||||
QString errorMessage = tr("The following errors occurred while activating target \"%1\":\n").arg(m_targetName);
|
||||
errorMessage.append(validationErrors().join(QLatin1Char('\n')));
|
||||
QMessageBox::warning(Core::ICore::mainWindow(), tr("Cannot Set up BB10 Configuration"),
|
||||
errorMessage, QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isActive())
|
||||
return true;
|
||||
|
||||
deactivate(); // cleaning-up artifacts autodetected by old QtCreator versions
|
||||
|
||||
QString armVersionName = tr("BlackBerry %1 Device").arg(version().toString());
|
||||
QString x86VersionName = tr("BlackBerry %1 Simulator").arg(version().toString());
|
||||
|
||||
// create versions
|
||||
QnxAbstractQtVersion *qt4ArmVersion = 0;
|
||||
QnxAbstractQtVersion *qt4X86Version = 0;
|
||||
QnxAbstractQtVersion *qt5ArmVersion = 0;
|
||||
QnxAbstractQtVersion *qt5X86Version = 0;
|
||||
QList<Abi> armAbis;
|
||||
QList<Abi> x86Abis;
|
||||
|
||||
if (!m_qmake4BinaryFile.isEmpty()) {
|
||||
qt4ArmVersion = createQtVersion(m_qmake4BinaryFile, Qnx::ArmLeV7, armVersionName);
|
||||
armAbis << qt4ArmVersion->qtAbis();
|
||||
qt4X86Version = createQtVersion(m_qmake4BinaryFile, Qnx::X86, x86VersionName);
|
||||
x86Abis << qt4X86Version->qtAbis();
|
||||
}
|
||||
if (!m_qmake5BinaryFile.isEmpty()) {
|
||||
qt5ArmVersion = createQtVersion(m_qmake5BinaryFile, Qnx::ArmLeV7, armVersionName);
|
||||
foreach (Abi abi, qt5ArmVersion->qtAbis())
|
||||
if (!armAbis.contains(abi))
|
||||
armAbis << abi;
|
||||
qt5X86Version = createQtVersion(m_qmake5BinaryFile, Qnx::X86, x86VersionName);
|
||||
foreach (Abi abi, qt5X86Version->qtAbis())
|
||||
if (!x86Abis.contains(abi))
|
||||
x86Abis << abi;
|
||||
}
|
||||
|
||||
// Create tool chains
|
||||
QnxToolChain *armvle7ToolChain = createToolChain(ArmLeV7,
|
||||
tr("QCC for %1").arg(armVersionName),
|
||||
ndkPath());
|
||||
QnxToolChain *x86ToolChain = createToolChain(X86,
|
||||
tr("QCC for %1").arg(x86VersionName),
|
||||
ndkPath());
|
||||
// Create debuggers
|
||||
QVariant armDebuggerId = createDebuggerItem(ArmLeV7,
|
||||
tr("Debugger for %1").arg(armVersionName));
|
||||
|
||||
QVariant x86DebuggerId = createDebuggerItem(X86,
|
||||
tr("Debugger for %1").arg(x86VersionName));
|
||||
|
||||
// create kits
|
||||
if (qt4ArmVersion)
|
||||
createKit(qt4ArmVersion, armvle7ToolChain, armDebuggerId);
|
||||
if (qt4X86Version)
|
||||
createKit(qt4X86Version, x86ToolChain, x86DebuggerId);
|
||||
if (qt5ArmVersion)
|
||||
createKit(qt5ArmVersion, armvle7ToolChain, armDebuggerId);
|
||||
if (qt5X86Version)
|
||||
createKit(qt5X86Version, x86ToolChain, x86DebuggerId);
|
||||
|
||||
BlackBerryConfigurationManager::instance()->emitSettingsChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BlackBerryApiLevelConfiguration::deactivate()
|
||||
{
|
||||
QList<BaseQtVersion *> qtvToRemove;
|
||||
QList<ToolChain *> tcToRemove;
|
||||
QList<const DebuggerItem *> dbgToRemove;
|
||||
|
||||
foreach (Kit *kit, KitManager::kits()) {
|
||||
if (kit->isAutoDetected() &&
|
||||
kit->autoDetectionSource() == envFile().toString()) {
|
||||
BaseQtVersion *version = QtKitInformation::qtVersion(kit);
|
||||
ToolChain *toolChain = ToolChainKitInformation::toolChain(kit);
|
||||
const DebuggerItem *debugger = DebuggerKitInformation::debugger(kit);
|
||||
// Kit's Qt version, tool chain or debugger might be used by other BB kits
|
||||
// generated for the same API level that are not yet unregistered. This triggers warning outputs.
|
||||
// Let's unregistered/removed them later once all API level kits are unregistered.
|
||||
if (version && !qtvToRemove.contains(version))
|
||||
qtvToRemove << version;
|
||||
if (toolChain && !tcToRemove.contains(toolChain))
|
||||
tcToRemove << toolChain;
|
||||
if (debugger && !dbgToRemove.contains(debugger))
|
||||
dbgToRemove << debugger;
|
||||
|
||||
KitManager::deregisterKit(kit);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (BaseQtVersion *qtv, qtvToRemove)
|
||||
QtVersionManager::removeVersion(qtv);
|
||||
|
||||
foreach (ToolChain *tc, tcToRemove)
|
||||
ToolChainManager::deregisterToolChain(tc);
|
||||
|
||||
foreach (const DebuggerItem *debugger, dbgToRemove)
|
||||
DebuggerItemManager::deregisterDebugger(debugger->id());
|
||||
|
||||
BlackBerryConfigurationManager::instance()->emitSettingsChanged();
|
||||
}
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
void BlackBerryApiLevelConfiguration::setFakeConfig(bool fakeConfig)
|
||||
{
|
||||
m_fakeConfig = fakeConfig;
|
||||
}
|
||||
|
||||
bool BlackBerryApiLevelConfiguration::fakeConfig()
|
||||
{
|
||||
return m_fakeConfig;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
@@ -1,110 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BLACKBERRYCONFIGURATIONS_H
|
||||
#define BLACKBERRYCONFIGURATIONS_H
|
||||
|
||||
#include "qnxutils.h"
|
||||
#include "qnxversionnumber.h"
|
||||
#include "qnxbaseconfiguration.h"
|
||||
#include "qnxconstants.h"
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <projectexplorer/abi.h>
|
||||
#include <projectexplorer/kit.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace QtSupport { class BaseQtVersion; }
|
||||
namespace Debugger { class DebuggerItem; }
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class QnxAbstractQtVersion;
|
||||
class QnxToolChain;
|
||||
|
||||
class BlackBerryApiLevelConfiguration : public QnxBaseConfiguration
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Qnx::Internal::BlackBerryApiLevelConfiguration)
|
||||
public:
|
||||
BlackBerryApiLevelConfiguration(const ConfigInstallInformation &ndkInstallInfo);
|
||||
BlackBerryApiLevelConfiguration(const Utils::FileName &ndkEnvFile);
|
||||
BlackBerryApiLevelConfiguration(const QVariantMap &data);
|
||||
bool activate();
|
||||
void deactivate();
|
||||
QString ndkPath() const;
|
||||
QString displayName() const;
|
||||
QString targetName() const;
|
||||
bool isAutoDetected() const;
|
||||
Utils::FileName autoDetectionSource() const;
|
||||
bool isActive() const;
|
||||
bool isValid() const;
|
||||
Utils::FileName qmake4BinaryFile() const;
|
||||
Utils::FileName qmake5BinaryFile() const;
|
||||
Utils::FileName sysRoot() const;
|
||||
QVariantMap toMap() const;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
static void setFakeConfig(bool fakeConfig);
|
||||
static bool fakeConfig();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
QnxAbstractQtVersion *createQtVersion(
|
||||
const Utils::FileName &qmakePath, Qnx::QnxArchitecture arch, const QString &versionName);
|
||||
ProjectExplorer::Kit *createKit(
|
||||
QnxAbstractQtVersion *version, QnxToolChain *armToolChain, const QVariant &debuggerItemId);
|
||||
QStringList validationErrors() const;
|
||||
|
||||
private:
|
||||
QString m_displayName;
|
||||
QString m_targetName;
|
||||
Utils::FileName m_autoDetectionSource;
|
||||
Utils::FileName m_qmake4BinaryFile;
|
||||
Utils::FileName m_qmake5BinaryFile;
|
||||
Utils::FileName m_sysRoot;
|
||||
|
||||
void ctor();
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
static bool m_fakeConfig;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // BLACKBERRYCONFIGURATIONS_H
|
@@ -1,515 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 - 2014 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "blackberryapplicationrunner.h"
|
||||
|
||||
#include "blackberrydeployconfiguration.h"
|
||||
#include "blackberrydeviceconnectionmanager.h"
|
||||
#include "blackberryrunconfiguration.h"
|
||||
#include "blackberrylogprocessrunner.h"
|
||||
#include "blackberrydeviceinformation.h"
|
||||
#include "qnxconstants.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <projectexplorer/kit.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qmakeprojectmanager/qmakebuildconfiguration.h>
|
||||
#include <debugger/debuggerrunconfigurationaspect.h>
|
||||
#include <ssh/sshremoteprocessrunner.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
#include <QDir>
|
||||
#include <QTemporaryFile>
|
||||
|
||||
namespace {
|
||||
enum { debugCheckQmlJSArgs = 0 };
|
||||
|
||||
bool parseRunningState(const QString &line)
|
||||
{
|
||||
QTC_ASSERT(line.startsWith(QLatin1String("result::")), return false);
|
||||
return line.trimmed().mid(8) == QLatin1String("true");
|
||||
}
|
||||
}
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BlackBerryApplicationRunner::BlackBerryApplicationRunner(const BlackBerryApplicationRunner::LaunchFlags &launchFlags, BlackBerryRunConfiguration *runConfiguration, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_launchFlags(launchFlags)
|
||||
, m_pid(-1)
|
||||
, m_appId(QString())
|
||||
, m_running(false)
|
||||
, m_stopping(false)
|
||||
, m_launchProcess(0)
|
||||
, m_stopProcess(0)
|
||||
, m_deviceInfo(0)
|
||||
, m_logProcessRunner(0)
|
||||
, m_runningStateTimer(new QTimer(this))
|
||||
, m_runningStateProcess(0)
|
||||
, m_qmlDebugServerPort(0)
|
||||
, m_checkQmlJsDebugArgumentsProcess(0)
|
||||
{
|
||||
QTC_ASSERT(runConfiguration, return);
|
||||
|
||||
Target *target = runConfiguration->target();
|
||||
BuildConfiguration *buildConfig = target->activeBuildConfiguration();
|
||||
m_environment = buildConfig->environment();
|
||||
m_deployCmd = m_environment.searchInPath(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD)).toString();
|
||||
|
||||
QFileInfo fi(target->kit()->autoDetectionSource());
|
||||
m_bbApiLevelVersion = QnxVersionNumber::fromNdkEnvFileName(fi.baseName());
|
||||
|
||||
m_device = BlackBerryDeviceConfiguration::device(target->kit());
|
||||
m_barPackage = runConfiguration->barPackage();
|
||||
|
||||
// The BlackBerry device always uses key authentication
|
||||
m_sshParams = m_device->sshParameters();
|
||||
m_sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationTypePublicKey;
|
||||
|
||||
Debugger::DebuggerRunConfigurationAspect *aspect =
|
||||
runConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
|
||||
if (aspect)
|
||||
m_qmlDebugServerPort = aspect->qmlDebugServerPort();
|
||||
|
||||
m_runningStateTimer->setInterval(3000);
|
||||
m_runningStateTimer->setSingleShot(true);
|
||||
connect(m_runningStateTimer, SIGNAL(timeout()), this, SLOT(determineRunningState()));
|
||||
connect(this, SIGNAL(started()), this, SLOT(startLogProcessRunner()));
|
||||
|
||||
connect(&m_launchStopProcessParser, SIGNAL(pidParsed(qint64)), this, SLOT(setPid(qint64)));
|
||||
connect(&m_launchStopProcessParser, SIGNAL(applicationIdParsed(QString)), this, SLOT(setApplicationId(QString)));
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::start()
|
||||
{
|
||||
if (!BlackBerryDeviceConnectionManager::instance()->isConnected(m_device->id())) {
|
||||
connect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(deviceConnected()),
|
||||
this, SLOT(checkDeployMode()));
|
||||
connect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(deviceDisconnected(Core::Id)),
|
||||
this, SLOT(disconnectFromDeviceSignals(Core::Id)));
|
||||
connect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(connectionOutput(Core::Id,QString)),
|
||||
this, SLOT(displayConnectionOutput(Core::Id,QString)));
|
||||
BlackBerryDeviceConnectionManager::instance()->connectDevice(m_device->id());
|
||||
} else {
|
||||
checkDeployMode();
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::startLogProcessRunner()
|
||||
{
|
||||
if (!m_logProcessRunner) {
|
||||
m_logProcessRunner = new BlackBerryLogProcessRunner(this, m_appId, m_device);
|
||||
connect(m_logProcessRunner, SIGNAL(output(QString,Utils::OutputFormat)),
|
||||
this, SIGNAL(output(QString,Utils::OutputFormat)));
|
||||
connect(m_logProcessRunner, SIGNAL(finished()), this, SIGNAL(finished()));
|
||||
}
|
||||
|
||||
m_logProcessRunner->start();
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::displayConnectionOutput(Core::Id deviceId, const QString &msg)
|
||||
{
|
||||
if (deviceId != m_device->id())
|
||||
return;
|
||||
|
||||
if (msg.contains(QLatin1String("Info:")))
|
||||
emit output(msg, Utils::StdOutFormat);
|
||||
else if (msg.contains(QLatin1String("Error:")))
|
||||
emit output(msg, Utils::StdErrFormat);
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::checkDeviceRuntimeVersion(int status)
|
||||
{
|
||||
if (status != BlackBerryNdkProcess::Success) {
|
||||
emit output(tr("Cannot determine device runtime version."), Utils::StdErrFormat);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_bbApiLevelVersion.isEmpty()) {
|
||||
emit output(tr("Cannot determine API level version."), Utils::StdErrFormat);
|
||||
checkQmlJsDebugArguments();
|
||||
return;
|
||||
}
|
||||
|
||||
const QString runtimeVersion = m_deviceInfo->scmBundle();
|
||||
if (m_bbApiLevelVersion.toString() != runtimeVersion) {
|
||||
const QMessageBox::StandardButton answer =
|
||||
QMessageBox::question(Core::ICore::mainWindow(),
|
||||
tr("Confirmation"),
|
||||
tr("The device runtime version (%1) does not match "
|
||||
"the API level version (%2).\n"
|
||||
"This may cause unexpected behavior when debugging.\n"
|
||||
"Do you want to continue anyway?")
|
||||
.arg(runtimeVersion, m_bbApiLevelVersion.toString()),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (answer == QMessageBox::No) {
|
||||
emit startFailed(tr("API level version does not match Runtime version."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
checkQmlJsDebugArguments();
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::queryDeviceInformation()
|
||||
{
|
||||
if (!m_deviceInfo) {
|
||||
m_deviceInfo = new BlackBerryDeviceInformation(this);
|
||||
connect(m_deviceInfo, SIGNAL(finished(int)),
|
||||
this, SLOT(checkDeviceRuntimeVersion(int)));
|
||||
}
|
||||
|
||||
m_deviceInfo->setDeviceTarget(m_sshParams.host, m_sshParams.password);
|
||||
emit output(tr("Querying device runtime version..."), Utils::StdOutFormat);
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::startFinished(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
if (exitCode == 0 && exitStatus == QProcess::NormalExit && m_pid > -1) {
|
||||
emit started();
|
||||
} else {
|
||||
m_running = false;
|
||||
m_runningStateTimer->stop();
|
||||
|
||||
QTC_ASSERT(m_launchProcess, return);
|
||||
const QString errorString = (m_launchProcess->error() != QProcess::UnknownError)
|
||||
? m_launchProcess->errorString() : tr("Launching application failed");
|
||||
emit startFailed(errorString);
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
RunControl::StopResult BlackBerryApplicationRunner::stop()
|
||||
{
|
||||
if (m_stopping)
|
||||
return RunControl::AsynchronousStop;
|
||||
|
||||
m_stopping = true;
|
||||
|
||||
QStringList args;
|
||||
args << QLatin1String("-terminateApp");
|
||||
args << QLatin1String("-device") << m_sshParams.host;
|
||||
if (!m_sshParams.password.isEmpty())
|
||||
args << QLatin1String("-password") << m_sshParams.password;
|
||||
args << m_barPackage.toUserOutput();
|
||||
|
||||
if (!m_stopProcess) {
|
||||
m_stopProcess = new QProcess(this);
|
||||
connect(m_stopProcess, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError()));
|
||||
connect(m_stopProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput()));
|
||||
connect(m_stopProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||
this, SLOT(stopFinished(int,QProcess::ExitStatus)));
|
||||
|
||||
m_stopProcess->setEnvironment(m_environment.toStringList());
|
||||
}
|
||||
|
||||
m_stopProcess->start(m_deployCmd, args);
|
||||
return RunControl::AsynchronousStop;
|
||||
}
|
||||
|
||||
bool BlackBerryApplicationRunner::isRunning() const
|
||||
{
|
||||
return m_running;
|
||||
}
|
||||
|
||||
qint64 BlackBerryApplicationRunner::pid() const
|
||||
{
|
||||
return m_pid;
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::stopFinished(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
Q_UNUSED(exitCode);
|
||||
Q_UNUSED(exitStatus);
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::readStandardOutput()
|
||||
{
|
||||
QProcess *process = qobject_cast<QProcess *>(sender());
|
||||
process->setReadChannel(QProcess::StandardOutput);
|
||||
while (process->canReadLine()) {
|
||||
QString line = QString::fromLocal8Bit(process->readLine());
|
||||
m_launchStopProcessParser.stdOutput(line);
|
||||
emit output(line, Utils::StdOutFormat);
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::readStandardError()
|
||||
{
|
||||
QProcess *process = qobject_cast<QProcess *>(sender());
|
||||
process->setReadChannel(QProcess::StandardError);
|
||||
while (process->canReadLine()) {
|
||||
const QString line = QString::fromLocal8Bit(process->readLine());
|
||||
m_launchStopProcessParser.stdError(line);
|
||||
emit output(line, Utils::StdErrFormat);
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::disconnectFromDeviceSignals(Core::Id deviceId)
|
||||
{
|
||||
if (m_device->id() == deviceId) {
|
||||
disconnect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(deviceConnected()),
|
||||
this, SLOT(checkDeployMode()));
|
||||
disconnect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(deviceDisconnected(Core::Id)),
|
||||
this, SLOT(disconnectFromDeviceSignals(Core::Id)));
|
||||
disconnect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(connectionOutput(Core::Id,QString)),
|
||||
this, SLOT(displayConnectionOutput(Core::Id,QString)));
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::setPid(qint64 pid)
|
||||
{
|
||||
m_pid = pid;
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::setApplicationId(const QString &applicationId)
|
||||
{
|
||||
m_appId = applicationId;
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::checkQmlJsDebugArguments()
|
||||
{
|
||||
if (!m_launchFlags.testFlag(QmlDebugLaunch)) {
|
||||
// no need to change anytning in app manifest for this kind of run
|
||||
launchApplication();
|
||||
}
|
||||
|
||||
emit output(tr("Checking qmljsdebugger command line argument."), Utils::StdOutFormat);
|
||||
QString nativePackagerCmd = m_environment.searchInPath(QLatin1String("blackberry-nativepackager")).toString();
|
||||
if (nativePackagerCmd.isEmpty()) {
|
||||
emit output(tr("Cannot find Native Packager executable."), Utils::StdErrFormat);
|
||||
return;
|
||||
}
|
||||
|
||||
m_checkQmlJsDebugArgumentsProcess = new QProcess(this);
|
||||
connect(m_checkQmlJsDebugArgumentsProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(checkQmlJsDebugArgumentsManifestLoaded()));
|
||||
connect(m_checkQmlJsDebugArgumentsProcess, SIGNAL(finished(int)), this, SLOT(checkQmlJsDebugArgumentsManifestLoaded()));
|
||||
|
||||
QStringList args;
|
||||
args << QLatin1String("-listManifest") << m_barPackage.toUserOutput();
|
||||
if (debugCheckQmlJSArgs)
|
||||
qDebug() << "get manifest:" << nativePackagerCmd << args.join(QLatin1Char(' '));
|
||||
m_checkQmlJsDebugArgumentsProcess->start(nativePackagerCmd, args);
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::checkQmlJsDebugArgumentsManifestLoaded()
|
||||
{
|
||||
m_checkQmlJsDebugArgumentsProcess->deleteLater();
|
||||
|
||||
if (m_checkQmlJsDebugArgumentsProcess->exitStatus() != QProcess::NormalExit) {
|
||||
emit output(tr("Cannot read bar package manifest."), Utils::StdErrFormat);
|
||||
qWarning() << "Cannot read bar package manifest:" << m_checkQmlJsDebugArgumentsProcess->errorString();
|
||||
qWarning() << m_checkQmlJsDebugArgumentsProcess->readAllStandardError();
|
||||
return;
|
||||
}
|
||||
|
||||
QString manifestContent = QString::fromUtf8(m_checkQmlJsDebugArgumentsProcess->readAllStandardOutput());
|
||||
|
||||
QRegExp rxEoln(QLatin1String("(\\r\\n|\\n|\\r)"));
|
||||
QStringList manifestLines = manifestContent.split(rxEoln);
|
||||
|
||||
QMutableListIterator<QString> it(manifestLines);
|
||||
QLatin1String entryPoint("Entry-Point: ");
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
if (it.value().startsWith(entryPoint)) {
|
||||
while (it.hasNext() && it.peekNext().startsWith(QLatin1Char(' ')))
|
||||
it.next();
|
||||
QString qmljsdbgArg = QString::fromLatin1("-qmljsdebugger=port:%1%2")
|
||||
.arg(m_qmlDebugServerPort)
|
||||
.arg(m_launchFlags.testFlag(QmlDebugLaunchBlocking)? QLatin1String(",block"): QLatin1String(""));
|
||||
it.insert(QLatin1String(" ") + qmljsdbgArg);
|
||||
manifestContent = manifestLines.join(QLatin1Char('\n'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_checkQmlJsDebugArgumentsProcess = new QProcess(this);
|
||||
connect(m_checkQmlJsDebugArgumentsProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(checkQmlJsDebugArgumentsManifestSaved()));
|
||||
connect(m_checkQmlJsDebugArgumentsProcess, SIGNAL(finished(int)), this, SLOT(checkQmlJsDebugArgumentsManifestSaved()));
|
||||
|
||||
QTemporaryFile *manifestFile = new QTemporaryFile(m_checkQmlJsDebugArgumentsProcess);
|
||||
if (!manifestFile->open()) {
|
||||
emit output(tr("Internal error: Cannot create temporary manifest file \"%1\"")
|
||||
.arg(manifestFile->fileName()), Utils::StdErrFormat);
|
||||
delete manifestFile;
|
||||
return;
|
||||
}
|
||||
|
||||
manifestFile->write(manifestContent.toUtf8());
|
||||
manifestFile->flush();
|
||||
|
||||
QStringList args;
|
||||
args << QLatin1String("-device") << m_sshParams.host;
|
||||
if (!m_sshParams.password.isEmpty())
|
||||
args << QLatin1String("-password") << m_sshParams.password;
|
||||
args << QLatin1String("-package") << m_barPackage.toUserOutput();
|
||||
args << QLatin1String("-putFile");
|
||||
args << manifestFile->fileName();
|
||||
args << QLatin1String("app/META-INF/MANIFEST.MF");
|
||||
if (debugCheckQmlJSArgs)
|
||||
qDebug() << "set manifest:" << m_deployCmd << args.join(QLatin1Char(' '));
|
||||
m_checkQmlJsDebugArgumentsProcess->start(m_deployCmd, args);
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::checkQmlJsDebugArgumentsManifestSaved()
|
||||
{
|
||||
m_checkQmlJsDebugArgumentsProcess->deleteLater();
|
||||
|
||||
if (m_checkQmlJsDebugArgumentsProcess->exitStatus() != QProcess::NormalExit) {
|
||||
emit output(tr("Cannot set command line arguments."), Utils::StdErrFormat);
|
||||
qWarning() << "Cannot set command line arguments:" << m_checkQmlJsDebugArgumentsProcess->errorString();
|
||||
qWarning() << m_checkQmlJsDebugArgumentsProcess->readAllStandardError();
|
||||
return;
|
||||
}
|
||||
|
||||
launchApplication();
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::launchApplication()
|
||||
{
|
||||
// If original device connection fails before launching, this method maybe triggered
|
||||
// if any other device is connected(?)
|
||||
if (!BlackBerryDeviceConnectionManager::instance()->isConnected(m_device->id()))
|
||||
return;
|
||||
|
||||
QStringList args;
|
||||
args << QLatin1String("-launchApp");
|
||||
if (m_launchFlags.testFlag(CppDebugLaunch))
|
||||
args << QLatin1String("-debugNative");
|
||||
args << QLatin1String("-device") << m_sshParams.host;
|
||||
if (!m_sshParams.password.isEmpty())
|
||||
args << QLatin1String("-password") << m_sshParams.password;
|
||||
args << QLatin1String("-package") << m_barPackage.toUserOutput();
|
||||
|
||||
if (!m_launchProcess) {
|
||||
m_launchProcess = new QProcess(this);
|
||||
connect(m_launchProcess, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError()));
|
||||
connect(m_launchProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput()));
|
||||
connect(m_launchProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||
this, SLOT(startFinished(int,QProcess::ExitStatus)));
|
||||
|
||||
m_launchProcess->setEnvironment(m_environment.toStringList());
|
||||
}
|
||||
if (debugCheckQmlJSArgs)
|
||||
qDebug() << "launch:" << m_deployCmd << args.join(QLatin1Char(' '));
|
||||
m_launchProcess->start(m_deployCmd, args);
|
||||
m_runningStateTimer->start();
|
||||
m_running = true;
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::checkDeployMode()
|
||||
{
|
||||
// If original device connection fails before launching, this method maybe triggered
|
||||
// if any other device is connected
|
||||
if (!BlackBerryDeviceConnectionManager::instance()->isConnected(m_device->id()))
|
||||
return;
|
||||
|
||||
if (m_launchFlags.testFlag(CppDebugLaunch))
|
||||
queryDeviceInformation(); // check API version vs Runtime version
|
||||
else
|
||||
checkQmlJsDebugArguments();
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::startRunningStateTimer()
|
||||
{
|
||||
if (m_running)
|
||||
m_runningStateTimer->start();
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::determineRunningState()
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("-isAppRunning");
|
||||
args << QLatin1String("-device") << m_sshParams.host;
|
||||
if (!m_sshParams.password.isEmpty())
|
||||
args << QLatin1String("-password") << m_sshParams.password;
|
||||
args << m_barPackage.toUserOutput();
|
||||
|
||||
if (!m_runningStateProcess) {
|
||||
m_runningStateProcess = new QProcess(this);
|
||||
|
||||
connect(m_runningStateProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readRunningStateStandardOutput()));
|
||||
connect(m_runningStateProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(startRunningStateTimer()));
|
||||
}
|
||||
|
||||
m_runningStateProcess->setEnvironment(m_environment.toStringList());
|
||||
|
||||
m_runningStateProcess->start(m_deployCmd, args);
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::readRunningStateStandardOutput()
|
||||
{
|
||||
QProcess *process = qobject_cast<QProcess *>(sender());
|
||||
process->setReadChannel(QProcess::StandardOutput);
|
||||
while (process->canReadLine()) {
|
||||
const QString line = QString::fromLocal8Bit(process->readLine());
|
||||
if (line.startsWith(QLatin1String("result"))) {
|
||||
m_running = parseRunningState(line);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_running)
|
||||
reset();
|
||||
}
|
||||
|
||||
void BlackBerryApplicationRunner::reset()
|
||||
{
|
||||
m_pid = -1;
|
||||
m_appId.clear();
|
||||
m_running = false;
|
||||
m_stopping = false;
|
||||
|
||||
m_runningStateTimer->stop();
|
||||
if (m_runningStateProcess) {
|
||||
m_runningStateProcess->terminate();
|
||||
if (!m_runningStateProcess->waitForFinished(1000))
|
||||
m_runningStateProcess->kill();
|
||||
}
|
||||
|
||||
if (m_logProcessRunner) {
|
||||
m_logProcessRunner->stop();
|
||||
|
||||
delete m_logProcessRunner;
|
||||
m_logProcessRunner = 0;
|
||||
} else {
|
||||
emit finished();
|
||||
}
|
||||
}
|
@@ -1,152 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 - 2014 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BLACKBERRYAPPLICATIONRUNNER_H
|
||||
#define QNX_INTERNAL_BLACKBERRYAPPLICATIONRUNNER_H
|
||||
|
||||
#include "blackberrydeviceconfiguration.h"
|
||||
#include "blackberryprocessparser.h"
|
||||
#include "qnxversionnumber.h"
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
#include <ssh/sshconnection.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
#include <QDateTime>
|
||||
|
||||
namespace QSsh { class SshRemoteProcessRunner; }
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BlackBerryRunConfiguration;
|
||||
class BlackBerryLogProcessRunner;
|
||||
class BlackBerryDeviceInformation;
|
||||
|
||||
class BlackBerryApplicationRunner : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum LaunchFlag
|
||||
{
|
||||
CppDebugLaunch = 0x1,
|
||||
QmlDebugLaunch = 0x2,
|
||||
QmlDebugLaunchBlocking = 0x4,
|
||||
QmlProfilerLaunch = 0x8
|
||||
};
|
||||
Q_DECLARE_FLAGS(LaunchFlags, LaunchFlag)
|
||||
|
||||
public:
|
||||
explicit BlackBerryApplicationRunner(const LaunchFlags &launchFlags, BlackBerryRunConfiguration *runConfiguration, QObject *parent = 0);
|
||||
|
||||
bool isRunning() const;
|
||||
qint64 pid() const;
|
||||
|
||||
public slots:
|
||||
void start();
|
||||
ProjectExplorer::RunControl::StopResult stop();
|
||||
|
||||
signals:
|
||||
void output(const QString &msg, Utils::OutputFormat format);
|
||||
void started();
|
||||
void finished();
|
||||
|
||||
void startFailed(const QString &msg);
|
||||
|
||||
private slots:
|
||||
void startFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void stopFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
||||
void readStandardOutput();
|
||||
void readStandardError();
|
||||
|
||||
void disconnectFromDeviceSignals(Core::Id deviceId);
|
||||
void startRunningStateTimer();
|
||||
void determineRunningState();
|
||||
void readRunningStateStandardOutput();
|
||||
|
||||
void setPid(qint64 pid);
|
||||
void setApplicationId(const QString &applicationId);
|
||||
|
||||
void launchApplication();
|
||||
void checkDeployMode();
|
||||
void startLogProcessRunner();
|
||||
|
||||
void displayConnectionOutput(Core::Id deviceId, const QString &output);
|
||||
void checkDeviceRuntimeVersion(int status);
|
||||
|
||||
void checkQmlJsDebugArguments();
|
||||
void checkQmlJsDebugArgumentsManifestLoaded();
|
||||
void checkQmlJsDebugArgumentsManifestSaved();
|
||||
|
||||
private:
|
||||
void reset();
|
||||
void queryDeviceInformation();
|
||||
|
||||
LaunchFlags m_launchFlags;
|
||||
|
||||
qint64 m_pid;
|
||||
QString m_appId;
|
||||
|
||||
bool m_running;
|
||||
bool m_stopping;
|
||||
|
||||
Utils::Environment m_environment;
|
||||
QString m_deployCmd;
|
||||
BlackBerryDeviceConfiguration::ConstPtr m_device;
|
||||
Utils::FileName m_barPackage;
|
||||
QSsh::SshConnectionParameters m_sshParams;
|
||||
|
||||
QProcess *m_launchProcess;
|
||||
QProcess *m_stopProcess;
|
||||
BlackBerryProcessParser m_launchStopProcessParser;
|
||||
BlackBerryDeviceInformation *m_deviceInfo;
|
||||
|
||||
BlackBerryLogProcessRunner *m_logProcessRunner;
|
||||
|
||||
QTimer *m_runningStateTimer;
|
||||
QProcess *m_runningStateProcess;
|
||||
|
||||
QnxVersionNumber m_bbApiLevelVersion;
|
||||
|
||||
int m_qmlDebugServerPort;
|
||||
QProcess *m_checkQmlJsDebugArgumentsProcess;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BLACKBERRYAPPLICATIONRUNNER_H
|
@@ -1,194 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "blackberrycertificate.h"
|
||||
#include "blackberryapilevelconfiguration.h"
|
||||
#include "blackberryconfigurationmanager.h"
|
||||
#include "blackberryndkprocess.h"
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
#include <QProcess>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
BlackBerryCertificate::BlackBerryCertificate(const QString &fileName,
|
||||
const QString &author, const QString &storePass, QObject *parent) :
|
||||
QObject(parent),
|
||||
m_fileName(fileName),
|
||||
m_author(author),
|
||||
m_storePass(storePass),
|
||||
m_process(new QProcess(this))
|
||||
{
|
||||
m_process->setProcessChannelMode(QProcess::MergedChannels);
|
||||
m_process->setEnvironment(Utils::EnvironmentItem::toStringList(
|
||||
BlackBerryConfigurationManager::instance()->defaultConfigurationEnv()));
|
||||
}
|
||||
|
||||
void BlackBerryCertificate::load()
|
||||
{
|
||||
if (m_process->state() != QProcess::NotRunning) {
|
||||
emit finished(BlackBerryCertificate::Busy);
|
||||
return;
|
||||
}
|
||||
QStringList arguments;
|
||||
|
||||
arguments << QLatin1String("-keystore")
|
||||
<< m_fileName
|
||||
<< QLatin1String("-list")
|
||||
<< QLatin1String("-verbose")
|
||||
<< QLatin1String("-storepass")
|
||||
<< m_storePass;
|
||||
|
||||
connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||
this, SLOT(loadFinished()));
|
||||
connect(m_process, SIGNAL(error(QProcess::ProcessError)),
|
||||
this, SLOT(processError()));
|
||||
|
||||
m_process->start(command(), arguments);
|
||||
}
|
||||
|
||||
void BlackBerryCertificate::store()
|
||||
{
|
||||
if (m_process->state() != QProcess::NotRunning) {
|
||||
emit finished(BlackBerryCertificate::Busy);
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file(m_fileName);
|
||||
|
||||
if (file.exists())
|
||||
file.remove();
|
||||
|
||||
QStringList arguments;
|
||||
|
||||
arguments << QLatin1String("-genkeypair")
|
||||
<< QLatin1String("-storepass")
|
||||
<< m_storePass
|
||||
<< QLatin1String("-author")
|
||||
<< m_author
|
||||
<< QLatin1String("-keystore")
|
||||
<< m_fileName;
|
||||
|
||||
connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||
this, SLOT(storeFinished(int)));
|
||||
connect(m_process, SIGNAL(error(QProcess::ProcessError)),
|
||||
this, SLOT(processError()));
|
||||
|
||||
m_process->start(command(), arguments);
|
||||
}
|
||||
|
||||
QString BlackBerryCertificate::fileName() const
|
||||
{
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
QString BlackBerryCertificate::author() const
|
||||
{
|
||||
return m_author;
|
||||
}
|
||||
|
||||
QString BlackBerryCertificate::id() const
|
||||
{
|
||||
QString tmpId = fileName();
|
||||
return tmpId.replace(QLatin1Char('/'), QLatin1Char('-'));
|
||||
}
|
||||
|
||||
void BlackBerryCertificate::storeFinished(int status)
|
||||
{
|
||||
m_process->disconnect();
|
||||
|
||||
if (status == 0)
|
||||
emit finished(BlackBerryCertificate::Success);
|
||||
else
|
||||
emit finished(BlackBerryCertificate::Error);
|
||||
}
|
||||
|
||||
void BlackBerryCertificate::loadFinished()
|
||||
{
|
||||
m_process->disconnect();
|
||||
|
||||
ResultCode status = Error;
|
||||
|
||||
QTextStream processOutput(m_process);
|
||||
|
||||
while (!processOutput.atEnd()) {
|
||||
QString chunk = processOutput.readLine();
|
||||
|
||||
if (chunk.contains(QLatin1String("invalid password"))) {
|
||||
status = WrongPassword;
|
||||
break;
|
||||
} else if (chunk.contains(QLatin1String("must be at least 6 characters"))) {
|
||||
status = PasswordTooSmall;
|
||||
break;
|
||||
} else if (chunk.startsWith(QLatin1String("Owner:"))) {
|
||||
chunk.remove(QLatin1String("Owner:"));
|
||||
m_author = chunk.remove(QLatin1String("CN=")).trimmed();
|
||||
status = Success;
|
||||
break;
|
||||
} else if (chunk.contains(QLatin1String("Subject Name:"))) {
|
||||
// this format is used by newer NDKs, the interesting data
|
||||
// comes on the next line
|
||||
chunk = processOutput.readLine();
|
||||
const QString token = QLatin1String("CommonName=");
|
||||
if (chunk.contains(token)) {
|
||||
m_author = chunk.remove(token).trimmed();
|
||||
status = Success;
|
||||
} else {
|
||||
status = InvalidOutputFormat;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
emit finished(status);
|
||||
}
|
||||
|
||||
void BlackBerryCertificate::processError()
|
||||
{
|
||||
m_process->disconnect();
|
||||
|
||||
emit finished(Error);
|
||||
}
|
||||
|
||||
QString BlackBerryCertificate::command() const
|
||||
{
|
||||
return BlackBerryNdkProcess::resolveNdkToolPath(QLatin1String("blackberry-keytool"));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
@@ -1,95 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BLACKBERRYCERTIFICATE_H
|
||||
#define QNX_INTERNAL_BLACKBERRYCERTIFICATE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QProcess;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BlackBerryCertificate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum ResultCode {
|
||||
Success,
|
||||
Busy,
|
||||
WrongPassword,
|
||||
PasswordTooSmall,
|
||||
InvalidOutputFormat,
|
||||
Error
|
||||
};
|
||||
|
||||
BlackBerryCertificate(const QString &fileName,
|
||||
const QString &author = QString(),
|
||||
const QString &storePass = QString(),
|
||||
QObject *parent = 0);
|
||||
|
||||
void load();
|
||||
void store();
|
||||
|
||||
QString fileName() const;
|
||||
QString author() const;
|
||||
QString id() const;
|
||||
|
||||
signals:
|
||||
void loaded();
|
||||
void stored();
|
||||
void finished(int status);
|
||||
|
||||
private slots:
|
||||
void storeFinished(int status);
|
||||
void loadFinished();
|
||||
void processError();
|
||||
|
||||
private:
|
||||
QString command() const;
|
||||
|
||||
QString m_fileName;
|
||||
QString m_author;
|
||||
QString m_storePass;
|
||||
|
||||
QProcess *m_process;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BLACKBERRYCERTIFICATE_H
|
@@ -1,281 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "blackberrycheckdevicestatusstep.h"
|
||||
|
||||
#include "blackberrycheckdevicestatusstepconfigwidget.h"
|
||||
#include "blackberrydeviceinformation.h"
|
||||
#include "qnxversionnumber.h"
|
||||
#include "qnxconstants.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/kit.h>
|
||||
#include <projectexplorer/task.h>
|
||||
#include <ssh/sshconnection.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <qfileinfo.h>
|
||||
|
||||
#include <qmessagebox.h>
|
||||
|
||||
#include <qeventloop.h>
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
namespace {
|
||||
const char RUNTIME_CHECK_ENABLED[] =
|
||||
"Qnx.Internal.BlackBerryCheckDeviceStatusStep.RuntimeCheckEnabled";
|
||||
const char DEBUG_TOKEN_CHECK_ENABLED[] =
|
||||
"Qnx.Internal.BlackBerryCheckDeviceStatusStep.DebugTokenCheckEnabled";
|
||||
}
|
||||
|
||||
BlackBerryCheckDeviceStatusStep::BlackBerryCheckDeviceStatusStep(ProjectExplorer::BuildStepList *bsl) :
|
||||
ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QNX_CHECK_DEVICE_STATUS_BS_ID))
|
||||
, m_deviceInfo(0)
|
||||
, m_eventLoop(0)
|
||||
, m_runtimeCheckEnabled(true)
|
||||
, m_debugTokenCheckEnabled(true)
|
||||
{
|
||||
setDisplayName(tr("Check Device Status"));
|
||||
}
|
||||
|
||||
BlackBerryCheckDeviceStatusStep::BlackBerryCheckDeviceStatusStep(ProjectExplorer::BuildStepList *bsl,
|
||||
BlackBerryCheckDeviceStatusStep *bs) :
|
||||
ProjectExplorer::BuildStep(bsl, bs)
|
||||
, m_deviceInfo(0)
|
||||
, m_eventLoop(0)
|
||||
, m_runtimeCheckEnabled(true)
|
||||
, m_debugTokenCheckEnabled(true)
|
||||
{
|
||||
setDisplayName(tr("Check Device Status"));
|
||||
}
|
||||
|
||||
void BlackBerryCheckDeviceStatusStep::checkDeviceInfo(int status)
|
||||
{
|
||||
if (!m_runtimeCheckEnabled && m_debugTokenCheckEnabled) {
|
||||
// Skip debug token check for internal non secure devices and simulators
|
||||
if (!m_deviceInfo->isProductionDevice() || m_deviceInfo->isSimulator()) {
|
||||
m_eventLoop->exit(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (status != BlackBerryDeviceInformation::Success) {
|
||||
switch (status) {
|
||||
case BlackBerryDeviceInformation::AuthenticationFailed:
|
||||
raiseError(tr("Authentication failed."));
|
||||
break;
|
||||
case BlackBerryDeviceInformation::NoRouteToHost:
|
||||
raiseError(tr("Cannot connect to device."));
|
||||
break;
|
||||
case BlackBerryDeviceInformation::DevelopmentModeDisabled:
|
||||
raiseError(tr("Device is not in the development mode."));
|
||||
break;
|
||||
case BlackBerryDeviceInformation::InferiorProcessTimedOut:
|
||||
raiseError(tr("Timeout querying device information."));
|
||||
break;
|
||||
case BlackBerryDeviceInformation::FailedToStartInferiorProcess:
|
||||
raiseError(tr("Failed to query device information."));
|
||||
break;
|
||||
case BlackBerryDeviceInformation::InferiorProcessCrashed:
|
||||
raiseError(tr("Process to query device information has crashed."));
|
||||
break;
|
||||
default:
|
||||
raiseError(tr("Cannot query device information."));
|
||||
break;
|
||||
}
|
||||
m_eventLoop->exit(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_debugTokenCheckEnabled && !m_deviceInfo->debugTokenValid()) {
|
||||
//: %1: Error message from BlackBerryDeviceInformation
|
||||
const QString errorMsg =
|
||||
tr("%1. Upload a valid debug token into the device.")
|
||||
.arg(m_deviceInfo->debugTokenValidationError());
|
||||
raiseError(errorMsg);
|
||||
m_eventLoop->exit(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_runtimeCheckEnabled) {
|
||||
QnxVersionNumber deviceRuntimeVersion(m_deviceInfo->scmBundle());
|
||||
QFileInfo fi(target()->kit()->autoDetectionSource());
|
||||
|
||||
if (deviceRuntimeVersion.isEmpty()) {
|
||||
// Skip the check if device runtime is not determined
|
||||
m_eventLoop->exit(true);
|
||||
raiseWarning(tr("Cannot determine device runtime version."));
|
||||
return;
|
||||
}
|
||||
|
||||
QnxVersionNumber apiLevelVersion = QnxVersionNumber::fromNdkEnvFileName(fi.baseName());
|
||||
if (apiLevelVersion.isEmpty()) {
|
||||
// Skip the check if device API level version is not determined
|
||||
m_eventLoop->exit(true);
|
||||
raiseWarning(tr("Cannot determine API level version."));
|
||||
return;
|
||||
}
|
||||
|
||||
bool ok = true;
|
||||
if (apiLevelVersion > deviceRuntimeVersion) {
|
||||
raiseError(tr("The device runtime version (%1) is inferior to the API level version (%2)")
|
||||
.arg(deviceRuntimeVersion.toString(), apiLevelVersion.toString()));
|
||||
|
||||
QMetaObject::invokeMethod(this, "handleVersionMismatch", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, ok),
|
||||
Q_ARG(QString, deviceRuntimeVersion.toString()),
|
||||
Q_ARG(QString, apiLevelVersion.toString()));
|
||||
}
|
||||
|
||||
m_eventLoop->exit(ok);
|
||||
return;
|
||||
}
|
||||
|
||||
m_eventLoop->exit(true);
|
||||
}
|
||||
|
||||
void BlackBerryCheckDeviceStatusStep::emitOutputInfo()
|
||||
{
|
||||
emit addOutput(tr("Checking device status..."), BuildStep::MessageOutput);
|
||||
}
|
||||
|
||||
void BlackBerryCheckDeviceStatusStep::enableDebugTokenCheck(bool enable)
|
||||
{
|
||||
m_debugTokenCheckEnabled = enable;
|
||||
}
|
||||
|
||||
void BlackBerryCheckDeviceStatusStep::enableRuntimeCheck(bool enable)
|
||||
{
|
||||
m_runtimeCheckEnabled = enable;
|
||||
}
|
||||
|
||||
bool BlackBerryCheckDeviceStatusStep::handleVersionMismatch(const QString &runtimeVersion, const QString &apiLevelVersion)
|
||||
{
|
||||
// TODO: Check if a matching API level exists in the user configurations,
|
||||
// otherwise let the user download the matching device runtime.
|
||||
const QMessageBox::StandardButton answer = QMessageBox::question(Core::ICore::mainWindow(), tr("Confirmation"),
|
||||
tr("The device runtime version (%1) does not match the API level version (%2).\n"
|
||||
"Do you want to continue anyway?").arg(runtimeVersion, apiLevelVersion),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
return answer == QMessageBox::Yes;
|
||||
}
|
||||
|
||||
bool BlackBerryCheckDeviceStatusStep::init()
|
||||
{
|
||||
m_device = BlackBerryDeviceConfiguration::device(target()->kit());
|
||||
if (!m_device)
|
||||
return false;
|
||||
|
||||
if (m_device->sshParameters().host.isEmpty()) {
|
||||
raiseError(tr("No hostname specified for the device"));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BlackBerryCheckDeviceStatusStep::run(QFutureInterface<bool> &fi)
|
||||
{
|
||||
if (!m_runtimeCheckEnabled && !m_debugTokenCheckEnabled)
|
||||
return fi.reportResult(true);
|
||||
|
||||
m_eventLoop = new QEventLoop;
|
||||
m_deviceInfo = new BlackBerryDeviceInformation;
|
||||
|
||||
connect(m_deviceInfo, SIGNAL(started()), this, SLOT(emitOutputInfo()));
|
||||
connect(m_deviceInfo, SIGNAL(finished(int)), this, SLOT(checkDeviceInfo(int)), Qt::DirectConnection);
|
||||
m_deviceInfo->setDeviceTarget(m_device->sshParameters().host, m_device->sshParameters().password);
|
||||
|
||||
bool returnValue = m_eventLoop->exec();
|
||||
|
||||
delete m_eventLoop;
|
||||
m_eventLoop = 0;
|
||||
|
||||
delete m_deviceInfo;
|
||||
m_deviceInfo = 0;
|
||||
|
||||
return fi.reportResult(returnValue);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStepConfigWidget *BlackBerryCheckDeviceStatusStep::createConfigWidget()
|
||||
{
|
||||
return new BlackBerryCheckDeviceStatusStepConfigWidget(this);
|
||||
}
|
||||
|
||||
void BlackBerryCheckDeviceStatusStep::raiseError(const QString &errorMessage)
|
||||
{
|
||||
ProjectExplorer::Task task = ProjectExplorer::Task(ProjectExplorer::Task::Error, errorMessage, Utils::FileName(), -1,
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
|
||||
emit addTask(task, 1);
|
||||
emit addOutput(errorMessage, BuildStep::ErrorMessageOutput);
|
||||
}
|
||||
|
||||
void BlackBerryCheckDeviceStatusStep::raiseWarning(const QString &warningMessage)
|
||||
{
|
||||
ProjectExplorer::Task task = ProjectExplorer::Task(ProjectExplorer::Task::Warning, warningMessage, Utils::FileName(), -1,
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
|
||||
emit addTask(task, 1);
|
||||
emit addOutput(warningMessage, BuildStep::ErrorOutput);
|
||||
}
|
||||
|
||||
|
||||
bool BlackBerryCheckDeviceStatusStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_runtimeCheckEnabled = map.value(QLatin1String(RUNTIME_CHECK_ENABLED), false).toBool();
|
||||
m_debugTokenCheckEnabled = map.value(QLatin1String(DEBUG_TOKEN_CHECK_ENABLED), false).toBool();
|
||||
|
||||
return BuildStep::fromMap(map);
|
||||
}
|
||||
|
||||
QVariantMap BlackBerryCheckDeviceStatusStep::toMap() const
|
||||
{
|
||||
QVariantMap map = BuildStep::toMap();
|
||||
map.insert(QLatin1String(RUNTIME_CHECK_ENABLED), m_runtimeCheckEnabled);
|
||||
map.insert(QLatin1String(DEBUG_TOKEN_CHECK_ENABLED), m_debugTokenCheckEnabled);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
bool BlackBerryCheckDeviceStatusStep::debugTokenCheckEnabled() const
|
||||
{
|
||||
return m_debugTokenCheckEnabled;
|
||||
}
|
||||
|
||||
bool BlackBerryCheckDeviceStatusStep::runtimeCheckEnabled() const
|
||||
{
|
||||
return m_runtimeCheckEnabled;
|
||||
}
|
@@ -1,94 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEP_H
|
||||
#define QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEP_H
|
||||
|
||||
#include "blackberrydeviceconfiguration.h"
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QEventLoop;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BlackBerryDeviceInformation;
|
||||
class BlackBerryCheckDeviceStatusStep : public ProjectExplorer::BuildStep
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class BlackBerryCheckDeviceStatusStepFactory;
|
||||
|
||||
public:
|
||||
explicit BlackBerryCheckDeviceStatusStep(ProjectExplorer::BuildStepList *bsl);
|
||||
|
||||
bool init();
|
||||
void run(QFutureInterface<bool> &fi);
|
||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
|
||||
void raiseError(const QString &error);
|
||||
void raiseWarning(const QString &warning);
|
||||
|
||||
bool fromMap(const QVariantMap &map);
|
||||
QVariantMap toMap() const;
|
||||
|
||||
bool debugTokenCheckEnabled () const;
|
||||
bool runtimeCheckEnabled() const;
|
||||
|
||||
protected:
|
||||
BlackBerryCheckDeviceStatusStep(ProjectExplorer::BuildStepList *bsl,
|
||||
BlackBerryCheckDeviceStatusStep *bs);
|
||||
|
||||
protected slots:
|
||||
void checkDeviceInfo(int status);
|
||||
void emitOutputInfo();
|
||||
|
||||
void enableDebugTokenCheck(bool enable);
|
||||
void enableRuntimeCheck(bool enable);
|
||||
|
||||
bool handleVersionMismatch(const QString &runtimeVersion, const QString &apiLevelVersion);
|
||||
|
||||
private:
|
||||
BlackBerryDeviceInformation *m_deviceInfo;
|
||||
BlackBerryDeviceConfiguration::ConstPtr m_device;
|
||||
QEventLoop *m_eventLoop;
|
||||
|
||||
bool m_runtimeCheckEnabled;
|
||||
bool m_debugTokenCheckEnabled;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEP_H
|
@@ -1,74 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
||||
**
|
||||
** Contact: BlackBerry (qt@blackberry.com)
|
||||
** Contact: KDAB (info@kdab.com)
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "blackberrycheckdevicestatusstepconfigwidget.h"
|
||||
#include "ui_blackberrycheckdevicestatusstepconfigwidget.h"
|
||||
#include "blackberrycheckdevicestatusstep.h"
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BlackBerryCheckDeviceStatusStepConfigWidget::BlackBerryCheckDeviceStatusStepConfigWidget(
|
||||
BlackBerryCheckDeviceStatusStep *checkDeviceStatuStep)
|
||||
: ProjectExplorer::BuildStepConfigWidget()
|
||||
, m_checkDeviceStatusStep(checkDeviceStatuStep)
|
||||
, m_ui(new Ui::BlackBerryCheckDeviceStatusStepConfigWidget)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->checkRuntime->setChecked(m_checkDeviceStatusStep->runtimeCheckEnabled());
|
||||
m_ui->checkDebugToken->setChecked(m_checkDeviceStatusStep->debugTokenCheckEnabled());
|
||||
|
||||
connect(m_ui->checkRuntime, SIGNAL(clicked(bool)),
|
||||
m_checkDeviceStatusStep, SLOT(enableRuntimeCheck(bool)));
|
||||
connect(m_ui->checkDebugToken, SIGNAL(clicked(bool)),
|
||||
m_checkDeviceStatusStep, SLOT(enableDebugTokenCheck(bool)));
|
||||
}
|
||||
|
||||
BlackBerryCheckDeviceStatusStepConfigWidget::~BlackBerryCheckDeviceStatusStepConfigWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
QString BlackBerryCheckDeviceStatusStepConfigWidget::displayName() const
|
||||
{
|
||||
return tr("<b>Check device status</b>");
|
||||
}
|
||||
|
||||
QString BlackBerryCheckDeviceStatusStepConfigWidget::summaryText() const
|
||||
{
|
||||
return displayName();
|
||||
}
|
||||
|
||||
bool BlackBerryCheckDeviceStatusStepConfigWidget::showWidget() const
|
||||
{
|
||||
return true;
|
||||
}
|