New QNX plugin.

This plugin adds support for cross-compiling, deploying, running
and debugging on a PlayBook or QNX Neutrino device.

Change-Id: I0da7ccee40bd7ce4c0d6bdc6884d48ef23167dac
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
Tobias Nätterlund
2012-06-29 07:23:13 +02:00
committed by Daniel Teske
parent cbce4389a5
commit a7ac2bb559
176 changed files with 11619 additions and 29 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -29,7 +29,7 @@
\contentspage index.html \contentspage index.html
\previouspage creator-deployment-symbian.html \previouspage creator-deployment-symbian.html
\page creator-deployment-maemo.html \page creator-deployment-maemo.html
\nextpage creator-connecting-mobile.html \nextpage creator-deployment-qnx.html
\title Deploying Applications to Linux-Based Devices \title Deploying Applications to Linux-Based Devices

View File

@@ -55,6 +55,11 @@
can test and debug the application on the device. can test and debug the application on the device.
You can create Debian installation packages for MeeGo Harmattan and You can create Debian installation packages for MeeGo Harmattan and
Maemo 5 devices. Maemo 5 devices.
\o \l{Deploying Applications to QNX Devices}
When you deploy the application on the \gui{QNX} target, \QC generates
a BAR package in the build directory and deploys it to the connected
device. You can test and debug the application on the device.
\endlist \endlist
\section1 Related Topics \section1 Related Topics

View File

@@ -27,7 +27,7 @@
/*! /*!
\contentspage index.html \contentspage index.html
\previouspage creator-deployment-maemo.html \previouspage creator-deployment-qnx.html
\page creator-connecting-mobile.html \page creator-connecting-mobile.html
\nextpage creator-developing-meego.html \nextpage creator-developing-meego.html
@@ -76,6 +76,13 @@
Install and launch the CODA on-device debugging agent on the Install and launch the CODA on-device debugging agent on the
devices and connect the devices to the development PC. devices and connect the devices to the development PC.
\o \l{Connecting QNX Devices}
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 requires the BlackBerry NDK
to be installed on the development PC.
\endlist \endlist
*/ */

View File

@@ -16,6 +16,8 @@
\o Symbian \o Symbian
\o QNX
\endlist \endlist
The following table summarizes operating system support for developing The following table summarizes operating system support for developing
@@ -23,8 +25,8 @@
\table \table
\header \header
\o {1,6} Operating system \o {1,7} Operating system
\o {6,1} Platform \o {7,1} Platform
\header \header
\o Desktop \o Desktop
\o \QS \o \QS
@@ -32,6 +34,7 @@
\o MeeGo Harmattan \o MeeGo Harmattan
\o Generic Remote Linux \o Generic Remote Linux
\o Symbian \o Symbian
\o QNX
\row \row
\o Windows \o Windows
@@ -41,6 +44,7 @@
\o Yes \o Yes
\o Yes \o Yes
\o Yes \o Yes
\o Yes (see \l{Running on QNX Devices} for limitations)
\row \row
\o Linux \o Linux
\o Yes \o Yes
@@ -49,6 +53,7 @@
\o Yes \o Yes
\o Yes \o Yes
\o Yes (by using Remote Compiler for building) \o Yes (by using Remote Compiler for building)
\o Yes
\row \row
\o Mac OS X \o Mac OS X
\o Yes \o Yes
@@ -57,4 +62,5 @@
\o Yes \o Yes
\o Yes \o Yes
\o Yes (by using Remote Compiler for building) \o Yes (by using Remote Compiler for building)
\o Yes
\endtable \endtable

View File

@@ -27,7 +27,7 @@
/*! /*!
\contentspage index.html \contentspage index.html
\previouspage creator-developing-symbian.html \previouspage creator-developing-qnx.html
\page creator-build-process-customizing.html \page creator-build-process-customizing.html
\nextpage creator-maemo-emulator.html \nextpage creator-maemo-emulator.html

View File

@@ -83,6 +83,7 @@
\if defined(qcmanual) \if defined(qcmanual)
\input symbian/creator-projects-qt-versions-symbian.qdocinc \input symbian/creator-projects-qt-versions-symbian.qdocinc
\input qnx/creator-projects-qt-version-qnx.qdocinc
\endif \endif
*/ */

View File

@@ -55,6 +55,7 @@
\input linux-mobile/creator-projects-running-madde.qdocinc \input linux-mobile/creator-projects-running-madde.qdocinc
\input linux-mobile/creator-projects-running-generic-linux.qdocinc \input linux-mobile/creator-projects-running-generic-linux.qdocinc
\input symbian/creator-projects-running-symbian.qdocinc \input symbian/creator-projects-running-symbian.qdocinc
\input qnx/creator-projects-running-qnx.qdocinc
\endif \endif
*/ */

View File

@@ -54,6 +54,7 @@
\input projects/creator-projects-settings-run-debug.qdocinc \input projects/creator-projects-settings-run-debug.qdocinc
\input symbian/creator-projects-settings-run-symbian.qdocinc \input symbian/creator-projects-settings-run-symbian.qdocinc
\input linux-mobile/creator-projects-settings-run-linux.qdocinc \input linux-mobile/creator-projects-settings-run-linux.qdocinc
\input qnx/creator-projects-settings-run-qnx.qdocinc
\endif \endif
\section1 Specifying a Custom Executable to Run \section1 Specifying a Custom Executable to Run

View File

@@ -0,0 +1,61 @@
/****************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 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.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
****************************************************************************/
// **********************************************************************
// 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 index.html
\previouspage creator-deployment-maemo.html
\page creator-deployment-qnx.html
\nextpage creator-connecting-mobile.html
\title Deploying Applications to QNX Devices
When you deploy the application on the \gui{QNX} target, \QC generates
a BAR package in the build directory and installs it on the connected
device. The contents of the BAR package are specified in the \gui{Application
Descriptor File}.
\image qtcreator-qnx-deployment.png "Deploy to device"
The name of the generated BAR package is shown in the \gui{Bar package}
setting. If the package already exists, it will be overwritten without
prior notification.
\section1 Application Descriptor File
The application descriptor file needs to be created manually,
or you can use the \gui{Application Descriptor} wizard to have a generic
template generated. The wizard is available in \gui {File > New File or
Project > BlackBerry > Application descriptor}. This wizard will also
include a splashscreen.png and an icon.png file which are included in the
application descriptor file.
To tailor your BAR packages, you will have to manually edit the application
descriptor file. For a full reference, see
\l{https://bdsc.webapps.blackberry.com/native/documentation/com.qnx.doc.native_sdk.devguide/com.qnx.doc.native_sdk.devguide/topic/r_blackberry_tablet_dtd_intro.html}
{Document Type Definition (DTD) for the application descriptor file}.
*/

View File

@@ -0,0 +1,118 @@
/****************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 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.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
****************************************************************************/
/*!
\contentspage index.html
\previouspage creator-developing-symbian.html
\page creator-developing-qnx.html
\nextpage creator-build-process-customizing.html
\title Connecting QNX Devices
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 \gui{Preferences}. Now go to \gui{Security >
Development Mode} and set \gui{Use Development Mode} to \gui{ON}. Enter the
device password when asked to do so.
\image qtcreator-qnx-playbook-development-mode.png
\section2 USB Access
The \gui{Development Address} shown in the \gui{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 \gui{Preferences > About > Network}.
To enable access over USB, change \gui{Preferences > Storage & Sharing >
USB Connections} to \gui{Connect to Windows} if you are deploying from
Windows, or \gui{Connect to Mac} if you are deploying from Linux or Mac OS.
\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 QNX Device in \QC
Adding a QNX device is done using a wizard in the \gui{Device
Configurations} options. To launch it, go to \gui{Tools > Options >
Linux Devices > Device Configurations > Add... > QNX device > Start
Wizard}.
\image qtcreator-qnx-device-configurations-wizard-1.png "Connection details"
\list
\o In the \gui{The name to identify this configuration} field, enter a
name for the device.
\o In the \gui{The device's host name or IP address} field, enter the
host name or IP address of the device.
\o In the \gui{Device password} field, enter the password for the device.
\o In the \gui{Device type} field, select whether it is a \gui{Physical
device} or a \gui{Simulator} you are connecting to.
\o In the \gui{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 \gui{Physical device}.
\o Click \gui{Next} to continue.
\endlist
\image qtcreator-qnx-device-configurations-wizard-2.png "SSH Key Setup"
For the \gui{SSH Key Setup}, you can either select an existing \bold{4096}-bit
key, or click \gui{Generate} to create a new key. The generated key will be
stored next to the \QC settings, in a \bold{qnx} sub-directory.
Click \gui{Next} and then \gui{Finish} to complete setting up the device
connection.
Once the device is added, you can edit the settings directly in the
\gui{Device Configurations} options page.
\image qtcreator-qnx-device-configurations.png "Device Configurations"
*/

View File

@@ -0,0 +1,21 @@
\section2 Setting Up Qt for QNX Versions
If you install Qt for QNX as a part of Qt Playbook SDK, it is automatically
detected by \QC. The \gui {BlackBerry Native SDK} field displays the path to the directory where
the Blackberry NDK is located.
To view Qt for QNX version settings, select \gui {Tools > Options >
Build & Run > Qt Versions}.
\image qtcreator-qt4-qtversions-win-qnx.png
If you have built your own version of Qt for QNX you need to add this manually to Qt Creator
using the above dialog:
\list
\o Select \gui {Tools > Options > Build & Run > Qt Versions > Add}.
\o Navigate to and select the qmake application that is part of your Qt for QNX build and select
\gui {Open}.
\o In the \gui {Blackberry Native SDK} field enter the path to your installed Blackberry NDK.
\o Select \gui {OK}.
\endlist

View File

@@ -0,0 +1,37 @@
\section1 Running on QNX Devices
\list 1
\o Connect the device to the development PC or to the Wi-Fi network.
\o Configure the device and specify a connection to it. For more
information, see \l{Connecting QNX Devices}.
\o Create an Application Descriptor File if it does not already exist.
For more information, see \l{Deploying Applications to QNX
Devices}.
\o Click the \gui Run button.
\endlist
\QC uses the compiler specified in the QNX tool chain to build the
application.
\QC generates a BAR package, installs it on the device, and
executes the selected application. The application views are displayed on
the device. Command-line output is visible in the \QC
\gui {Application Output} view.
\note Debugging is currently only fully supported on Linux and Mac OS.
It is not possible to insert breakpoints during runtime on Windows.
\section2 Troubleshooting Errors
For the command-line output to show up in the \gui{Application Output}
view, \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.
If these conditions are not met, you will get an error message saying debug
output cannot be shown.

View File

@@ -0,0 +1,13 @@
\section2 Specifying Run Settings for QNX Devices
To run and debug an application on a QNX device, you must create connections
from the development PC to the device. Click \gui {Manage device configurations}
to create a connection. For more information, see \l{Connecting QNX
Devices}.
\image qtcreator-qnx-run-settings.png "Run settings for QNX devices"
When you run the application on the QNX 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 onto the
selected device. For more information, see \l{Deploying Applications to QNX Devices}.

View File

@@ -240,6 +240,7 @@
\list \list
\o \l{Deploying Applications to Symbian Devices} \o \l{Deploying Applications to Symbian Devices}
\o \l{Deploying Applications to Linux-Based Devices} \o \l{Deploying Applications to Linux-Based Devices}
\o \l{Deploying Applications to QNX Devices}
\endlist \endlist
\o \l{Connecting Mobile Targets} \o \l{Connecting Mobile Targets}
\list \list
@@ -247,6 +248,7 @@
\o \l{Connecting Embedded Linux Devices} \o \l{Connecting Embedded Linux Devices}
\o \l{Connecting Maemo Devices} \o \l{Connecting Maemo Devices}
\o \l{Connecting Symbian Devices} \o \l{Connecting Symbian Devices}
\o \l{Connecting QNX Devices}
\endlist \endlist
\o \l{Customizing the Build Process} \o \l{Customizing the Build Process}
\o \l{Using Maemo or MeeGo Harmattan Emulator} \o \l{Using Maemo or MeeGo Harmattan Emulator}

View File

@@ -28,7 +28,7 @@
\endif \endif
\page creator-developing-symbian.html \page creator-developing-symbian.html
\if defined(qcmanual) \if defined(qcmanual)
\nextpage creator-build-process-customizing.html \nextpage creator-developing-qnx.html
\else \else
\nextpage creator-developing-meego.html \nextpage creator-developing-meego.html
\endif \endif

View File

@@ -0,0 +1,33 @@
<?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>
<publisher>PUBLISHER</publisher>
<copyright>COPYRIGHT</copyright>
<env var="QML_IMPORT_PATH" value="app/native/imports"/>
<env var="QT_PLUGIN_PATH" value="app/native/plugins"/>
<env var="LD_LIBRARY_PATH" value="app/native/lib"/>
<arg>-platform</arg>
<arg>blackberry</arg>
<arg>-style</arg>
<arg>qnxlight</arg>
<action system="true">run_native</action>
<!-- PROJECTPATH should point to the project binary, path can be relative -->
<asset entry="true" path="PROJECTPATH" type="Qnx/Elf">PROJECTNAME</asset>
<!-- These values will be replaced when deploying in Qt Creator -->
<asset path="%QT_INSTALL_LIBS%">lib</asset>
<asset path="%QT_INSTALL_PLUGINS%">plugins</asset>
<asset path="%QT_INSTALL_IMPORTS%">imports</asset>
</qnx>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
-->
<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>

View File

@@ -0,0 +1,28 @@
<?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>
<env var="QML_IMPORT_PATH" value="app/native/imports"/>
<env var="QT_PLUGIN_PATH" value="app/native/plugins"/>
<env var="LD_LIBRARY_PATH" value="app/native/lib"/>
<arg>-platform</arg>
<arg>blackberry</arg>
<action system="true">run_native</action>
<asset entry="true" path="%ProjectName%" type="Qnx/Elf">%ProjectName%</asset>
<!-- These values will be replaced when deploying in Qt Creator -->
<asset path="%QT_INSTALL_LIBS%">lib</asset>
<asset path="%QT_INSTALL_PLUGINS%">plugins</asset>
<asset path="%QT_INSTALL_IMPORTS%">imports</asset>
</qnx>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,12 @@
#include <QApplication>
#include "mainwidget.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWidget w;
w.showMaximized();
return a.exec();
}

View File

@@ -0,0 +1,14 @@
#include "mainwidget.h"
#include "ui_mainwidget.h"
MainWidget::MainWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::MainWidget)
{
ui->setupUi(this);
}
MainWidget::~MainWidget()
{
delete ui;
}

View File

@@ -0,0 +1,22 @@
#ifndef MAINWIDGET_H
#define MAINWIDGET_H
#include <QWidget>
namespace Ui {
class MainWidget;
}
class MainWidget : public QWidget
{
Q_OBJECT
public:
explicit MainWidget(QWidget *parent = 0);
~MainWidget();
private:
Ui::MainWidget *ui;
};
#endif // MAINWIDGET_H

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWidget</class>
<widget class="QWidget" name="MainWidget">
<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="QLabel" name="label">
<property name="text">
<string>Hello World</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,7 @@
TEMPLATE = app
SOURCES += main.cpp mainwidget.cpp
HEADERS += mainwidget.h
FORMS += mainwidget.ui
OTHER_FILES += bar-descriptor.xml

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
-->
<wizard version="1" kind="project"
class="qt4project" firstpage="10"
id="Q.QnxBlackBerryGuiApp" category="F.QtApplications"
featuresRequired="QtSupport.Wizards.FeatureBlackBerry">
<icon>icon.png</icon>
<displayname>BlackBerry Qt Gui Application</displayname>;
<description>Creates a Qt Gui application for BlackBerry.</description>
<files>
<file source="main.cpp" openeditor="true"/>
<file source="mainwidget.cpp" openeditor="true"/>
<file source="mainwidget.h" openeditor="true"/>
<file source="mainwidget.ui" openeditor="true"/>
<file source="bar-descriptor.xml" openeditor="true"/>
<file source="project.pro" target="%ProjectName%.pro" openproject="true"/>
</files>
</wizard>

View File

@@ -0,0 +1,32 @@
<?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>
<publisher>PUBLISHER</publisher>
<copyright>COPYRIGHT</copyright>
<env var="QML_IMPORT_PATH" value="app/native/imports"/>
<env var="QT_PLUGIN_PATH" value="app/native/plugins"/>
<env var="LD_LIBRARY_PATH" value="app/native/lib"/>
<arg>-style</arg>
<arg>qnxlight</arg>
<action system="true">run_native</action>
<!-- PROJECTPATH should point to the project binary, path can be relative -->
<asset entry="true" path="PROJECTPATH" type="Qnx/Elf">PROJECTNAME</asset>
<!-- These values will be replaced when deploying in Qt Creator -->
<asset path="%QT_INSTALL_LIBS%">lib</asset>
<asset path="%QT_INSTALL_PLUGINS%">plugins</asset>
<asset path="%QT_INSTALL_IMPORTS%">imports</asset>
</qnx>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
-->
<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>

View File

@@ -0,0 +1,28 @@
<?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>
<env var="QML_IMPORT_PATH" value="app/native/imports"/>
<env var="QT_PLUGIN_PATH" value="app/native/plugins"/>
<env var="LD_LIBRARY_PATH" value="app/native/lib"/>
<publisher>PUBLISHER</publisher>
<copyright>COPYRIGHT</copyright>
<action system="true">run_native</action>
<asset entry="true" path="%ProjectName%" type="Qnx/Elf">%ProjectName%</asset>
<!-- These values will be replaced when deploying in Qt Creator -->
<asset path="%QT_INSTALL_LIBS%">lib</asset>
<asset path="%QT_INSTALL_PLUGINS%">plugins</asset>
<asset path="%QT_INSTALL_IMPORTS%">imports</asset>
</qnx>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,13 @@
#include <QtGui/QGuiApplication>
#include "mainwidget.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWidget w;
w.showFullScreen();
return a.exec();
}

View File

@@ -0,0 +1,14 @@
#include "mainwidget.h"
#include "ui_mainwidget.h"
MainWidget::MainWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::MainWidget)
{
ui->setupUi(this);
}
MainWidget::~MainWidget()
{
delete ui;
}

View File

@@ -0,0 +1,22 @@
#ifndef MAINWIDGET_H
#define MAINWIDGET_H
#include <QtWidgets>
namespace Ui {
class MainWidget;
}
class MainWidget : public QWidget
{
Q_OBJECT
public:
explicit MainWidget(QWidget *parent = 0);
~MainWidget();
private:
Ui::MainWidget *ui;
};
#endif // MAINWIDGET_H

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWidget</class>
<widget class="QWidget" name="MainWidget">
<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="QLabel" name="label">
<property name="text">
<string>Hello World</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,11 @@
TEMPLATE = app
QT += widgets
SOURCES += main.cpp mainwidget.cpp
HEADERS += mainwidget.h
FORMS += mainwidget.ui
OTHER_FILES += bar-descriptor.xml

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
-->
<wizard version="1" kind="project"
class="qt4project" firstpage="10"
id="Q.QnxBlackBerryGuiApp" category="F.QtApplications"
featuresRequired="QtSupport.Wizards.FeatureBlackBerry">
<icon>icon.png</icon>
<displayname>BlackBerry Qt5 Gui Application</displayname>;
<description>Creates a Qt5 Gui application for BlackBerry.</description>
<files>
<file source="main.cpp" openeditor="true"/>
<file source="mainwidget.cpp" openeditor="true"/>
<file source="mainwidget.h" openeditor="true"/>
<file source="mainwidget.ui" openeditor="true"/>
<file source="bar-descriptor.xml" openeditor="true"/>
<file source="project.pro" target="%ProjectName%.pro" openproject="true"/>
</files>
</wizard>

View File

@@ -0,0 +1,30 @@
<?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>
<publisher>PUBLISHER</publisher>
<copyright>COPYRIGHT</copyright>
<env var="QML_IMPORT_PATH" value="app/native/imports"/>
<env var="QT_PLUGIN_PATH" value="app/native/plugins"/>
<env var="LD_LIBRARY_PATH" value="app/native/lib"/>
<action system="true">run_native</action>
<asset entry="true" path="%ProjectName%" type="Qnx/Elf">%ProjectName%</asset>
<asset path="%SRC_DIR%/qml">qml</asset>
<!-- These values will be replaced when deploying in Qt Creator -->
<asset path="%QT_INSTALL_LIBS%">lib</asset>
<asset path="%QT_INSTALL_PLUGINS%">plugins</asset>
<asset path="%QT_INSTALL_IMPORTS%">imports</asset>
</qnx>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,26 @@
#include <QWindow>
#include <QtDeclarative>
#include <QQuickView>
int main( int argc, char** argv )
{
QGuiApplication app( argc, argv );
QWindow *window = 0;
int exitCode = 0;
QQuickView* view = new QQuickView();
view->setResizeMode( QQuickView::SizeRootObjectToView );
view->setSource( QUrl( "app/native/qml/main.qml" ) );
QDeclarativeEngine* engine = view->engine();
QObject::connect( engine, SIGNAL( quit() ),
QCoreApplication::instance(), SLOT( quit() ) );
window = view;
window->showMaximized();
exitCode = app.exec();
delete window;
return exitCode;
}

View File

@@ -0,0 +1,12 @@
TEMPLATE = app
QT += qml quick
# Additional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =
# The .cpp file which was generated for your project. Feel free to hack it.
SOURCES += main.cpp
OTHER_FILES += bar-descriptor.xml \
qml/main.qml

View File

@@ -0,0 +1,17 @@
import QtQuick 2.0
Rectangle {
width: 1024
height: 600
Text {
text: qsTr("Hello from QtQuick2")
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
}

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
-->
<wizard version="1" kind="project"
class="qt4project" firstpage="10"
id="Q.QnxBlackBerryQQ2App" category="F.QtApplications"
featuresRequired="QtSupport.Wizards.FeatureBlackBerry">
<icon>icon.png</icon>
<displayname>BlackBerry Qt Quick 2 Application</displayname>;
<description>Creates a Qt Quick 2 application for BlackBerry.</description>
<files>
<file source="main.cpp" openeditor="true"/>
<file source="qml/main.qml" openeditor="true"/>
<file source="bar-descriptor.xml" openeditor="true"/>
<file source="project.pro" target="%ProjectName%.pro" openproject="true"/>
</files>
</wizard>

View File

@@ -0,0 +1,30 @@
<?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>
<env var="QML_IMPORT_PATH" value="app/native/imports"/>
<env var="QT_PLUGIN_PATH" value="app/native/plugins"/>
<env var="LD_LIBRARY_PATH" value="app/native/lib"/>
<arg>-platform</arg>
<arg>blackberry</arg>
<action system="true">run_native</action>
<asset entry="true" path="%ProjectName%" type="Qnx/Elf">%ProjectName%</asset>
<asset path="%SRC_DIR%/qml">qml</asset>
<!-- These values will be replaced when deploying in Qt Creator -->
<asset path="%QT_INSTALL_LIBS%">lib</asset>
<asset path="%QT_INSTALL_PLUGINS%">plugins</asset>
<asset path="%QT_INSTALL_IMPORTS%">imports</asset>
</qnx>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,20 @@
#include <QApplication>
#include <QDeclarativeView>
#include <QObject>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QDeclarativeView view;
#ifdef Q_OS_QNX
view.setSource(QUrl("app/native/qml/main.qml"));
#else
view.setSource(QUrl("qml/main.qml"));
#endif
view.setAttribute(Qt::WA_AutoOrientation, true);
view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
view.showMaximized();
return a.exec();
}

View File

@@ -0,0 +1,12 @@
TEMPLATE = app
QT += declarative
# Additional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =
# The .cpp file which was generated for your project. Feel free to hack it.
SOURCES += main.cpp
OTHER_FILES += bar-descriptor.xml \
qml/main.qml

View File

@@ -0,0 +1,17 @@
import QtQuick 1.1
Rectangle {
width: 360
height: 360
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
}

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
-->
<wizard version="1" kind="project"
class="qt4project" firstpage="10"
id="Q.QnxBlackBerryQQApp" category="F.QtApplications"
featuresRequired="QtSupport.Wizards.FeatureBlackBerry">
<icon>icon.png</icon>
<displayname>BlackBerry Qt Quick Application</displayname>;
<description>Creates a Qt Quick application for BlackBerry.</description>
<files>
<file source="main.cpp" openeditor="true"/>
<file source="qml/main.qml" openeditor="true"/>
<file source="bar-descriptor.xml" openeditor="true"/>
<file source="project.pro" target="%ProjectName%.pro" openproject="true"/>
</files>
</wizard>

View File

@@ -144,6 +144,9 @@ public:
QString serverAddress; QString serverAddress;
quint16 serverPort; quint16 serverPort;
// For QNX debugging
QString remoteExecutable;
// For Debugger testing. // For Debugger testing.
QObject *testReceiver; QObject *testReceiver;
const char *testCallback; const char *testCallback;

View File

@@ -170,11 +170,17 @@ void GdbRemoteServerEngine::setupInferior()
#else #else
#define PATHSEP ":" #define PATHSEP ":"
#endif #endif
QString fileName; QString executableFileName;
if (!sp.executable.isEmpty()) { if (!sp.executable.isEmpty()) {
QFileInfo fi(sp.executable); QFileInfo fi(sp.executable);
fileName = fi.absoluteFilePath(); executableFileName = fi.absoluteFilePath();
} }
QString symbolFileName;
if (!sp.symbolFileName.isEmpty()) {
QFileInfo fi(sp.symbolFileName);
symbolFileName = fi.absoluteFilePath();
}
//const QByteArray sysroot = sp.sysroot.toLocal8Bit(); //const QByteArray sysroot = sp.sysroot.toLocal8Bit();
//const QByteArray remoteArch = sp.remoteArchitecture.toLatin1(); //const QByteArray remoteArch = sp.remoteArchitecture.toLatin1();
//const QByteArray gnuTarget = sp.gnuTarget.toLatin1(); //const QByteArray gnuTarget = sp.gnuTarget.toLatin1();
@@ -213,14 +219,21 @@ void GdbRemoteServerEngine::setupInferior()
if (debuggerCore()->boolSetting(TargetAsync)) if (debuggerCore()->boolSetting(TargetAsync))
postCommand("set target-async on", CB(handleSetTargetAsync)); postCommand("set target-async on", CB(handleSetTargetAsync));
if (fileName.isEmpty()) { if (executableFileName.isEmpty() && symbolFileName.isEmpty()) {
showMessage(tr("No symbol file given."), StatusBar); showMessage(tr("No symbol file given."), StatusBar);
callTargetRemote(); callTargetRemote();
return; return;
} }
postCommand("-file-exec-and-symbols \"" + fileName.toLocal8Bit() + '"', if (!symbolFileName.isEmpty()) {
CB(handleFileExecAndSymbols)); postCommand("-file-symbol-file \""
+ symbolFileName.toLocal8Bit() + '"',
CB(handleFileExecAndSymbols));
}
if (!executableFileName.isEmpty()) {
postCommand("-file-exec-and-symbols \"" + executableFileName.toLocal8Bit() + '"',
CB(handleFileExecAndSymbols));
}
} }
void GdbRemoteServerEngine::handleSetTargetAsync(const GdbResponse &response) void GdbRemoteServerEngine::handleSetTargetAsync(const GdbResponse &response)
@@ -302,7 +315,7 @@ void GdbRemoteServerEngine::handleTargetQnx(const GdbResponse &response)
showMessage(_("INFERIOR STARTED")); showMessage(_("INFERIOR STARTED"));
showMessage(msgAttachedToStoppedInferior(), StatusBar); showMessage(msgAttachedToStoppedInferior(), StatusBar);
const qint64 pid = startParameters().attachPID; const qint64 pid = isMasterEngine() ? startParameters().attachPID : masterEngine()->startParameters().attachPID;
if (pid > -1) { if (pid > -1) {
postCommand("attach " + QByteArray::number(pid), CB(handleAttach)); postCommand("attach " + QByteArray::number(pid), CB(handleAttach));
} else { } else {
@@ -342,8 +355,28 @@ void GdbRemoteServerEngine::handleAttach(const GdbResponse &response)
void GdbRemoteServerEngine::runEngine() void GdbRemoteServerEngine::runEngine()
{ {
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
notifyEngineRunAndInferiorStopOk();
continueInferiorInternal(); const QString remoteExecutable = startParameters().remoteExecutable;
if (!remoteExecutable.isEmpty()) {
postCommand("-exec-run " + remoteExecutable.toLocal8Bit(), GdbEngine::RunRequest, CB(handleExecRun));
} else {
notifyEngineRunAndInferiorStopOk();
continueInferiorInternal();
}
}
void GdbRemoteServerEngine::handleExecRun(const GdbResponse &response)
{
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
if (response.resultClass == GdbResultRunning) {
notifyEngineRunAndInferiorRunOk();
showMessage(_("INFERIOR STARTED"));
showMessage(msgInferiorSetupOk(), StatusBar);
} else {
QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
showMessage(msg);
notifyEngineRunFailed();
}
} }
void GdbRemoteServerEngine::interruptInferior2() void GdbRemoteServerEngine::interruptInferior2()

View File

@@ -91,6 +91,7 @@ private:
void handleTargetQnx(const GdbResponse &response); void handleTargetQnx(const GdbResponse &response);
void handleAttach(const GdbResponse &response); void handleAttach(const GdbResponse &response);
void handleInterruptInferior(const GdbResponse &response); void handleInterruptInferior(const GdbResponse &response);
void handleExecRun(const GdbResponse &response);
QProcess m_uploadProc; QProcess m_uploadProc;
LocalGdbProcess m_gdbProc; LocalGdbProcess m_gdbProc;

View File

@@ -45,7 +45,8 @@ SUBDIRS = plugin_coreplugin \
plugin_android \ plugin_android \
plugin_madde \ plugin_madde \
plugin_valgrind \ plugin_valgrind \
plugin_todo plugin_todo \
plugin_qnx
isEmpty(IDE_PACKAGE_MODE) { isEmpty(IDE_PACKAGE_MODE) {
SUBDIRS += plugin_helloworld \ SUBDIRS += plugin_helloworld \
@@ -322,3 +323,9 @@ plugin_todo.depends = plugin_coreplugin
plugin_todo.depends += plugin_projectexplorer plugin_todo.depends += plugin_projectexplorer
plugin_todo.depends += plugin_texteditor plugin_todo.depends += plugin_texteditor
plugin_todo.depends += plugin_cpptools plugin_todo.depends += plugin_cpptools
plugin_qnx.subdir = qnx
plugin_qnx.depends = plugin_remotelinux
plugin_qnx.depends += plugin_qt4projectmanager
plugin_qnx.depends += plugin_coreplugin

View File

@@ -75,7 +75,7 @@ public:
QString id() const; QString id() const;
virtual QList<Utils::FileName> suggestedMkspecList() const { return QList<Utils::FileName>(); } virtual QList<Utils::FileName> suggestedMkspecList() const { return QList<Utils::FileName>(); }
Utils::FileName suggestedDebugger(); virtual Utils::FileName suggestedDebugger();
virtual QString type() const = 0; virtual QString type() const = 0;
virtual QString typeDisplayName() const = 0; virtual QString typeDisplayName() const = 0;

View File

@@ -0,0 +1,21 @@
<plugin name=\"Qnx\" version=\"$$QTCREATOR_VERSION\" compatVersion=\"$$QTCREATOR_VERSION\">
<vendor>Research In Motion</vendor>
<copyright>(C) Research In Motion</copyright>
<license>
Commercial Usage
Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
GNU Lesser General Public License Usage
Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Please review the following information to ensure the GNU Lesser General Public License version 2.1 requirements will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
</license>
<description>Adds support for QNX to Qt Creator</description>
<url>http://www.rim.com</url>
<category>Device Support</category>
<dependencyList>
<dependency name=\"Core\" version=\"$$QTCREATOR_VERSION\"/>
<dependency name=\"Qt4ProjectManager\" version=\"$$QTCREATOR_VERSION\"/>
<dependency name=\"RemoteLinux\" version=\"$$QTCREATOR_VERSION\"/>
</dependencyList>
</plugin>

View File

@@ -0,0 +1,197 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "bardescriptorfileimagewizardpage.h"
#include "ui_bardescriptorfileimagewizardpage.h"
using namespace Qnx;
using namespace Qnx::Internal;
BarDescriptorFileImageWizardPage::BarDescriptorFileImageWizardPage(QWidget *parent)
: QWizardPage(parent)
, m_ui(new Ui::BarDescriptorFileImageWizardPage)
, m_iconValidationResult(Valid)
, m_landscapeSplashScreenValidationResult(Valid)
, m_portraitSplashScreenValidationResult(Valid)
{
m_ui->setupUi(this);
setTitle(tr("Images"));
const QString dialogFilter = tr("Images (*.jpg *.png)");
m_ui->icon->setExpectedKind(Utils::PathChooser::File);
m_ui->icon->setPromptDialogFilter(dialogFilter);
connect(m_ui->icon, SIGNAL(changed(QString)), this, SLOT(validateIcon(QString)));
m_ui->landscapeSplashScreen->setExpectedKind(Utils::PathChooser::File);
m_ui->landscapeSplashScreen->setPromptDialogFilter(dialogFilter);
connect(m_ui->landscapeSplashScreen, SIGNAL(changed(QString)), this, SLOT(validateLandscapeSplashScreen(QString)));
m_ui->portraitSplashScreen->setExpectedKind(Utils::PathChooser::File);
m_ui->portraitSplashScreen->setPromptDialogFilter(dialogFilter);
connect(m_ui->portraitSplashScreen, SIGNAL(changed(QString)), this, SLOT(validatePortraitSplashScreen(QString)));
}
BarDescriptorFileImageWizardPage::~BarDescriptorFileImageWizardPage()
{
delete m_ui;
}
bool BarDescriptorFileImageWizardPage::isComplete() const
{
return m_iconValidationResult == Valid
&& m_landscapeSplashScreenValidationResult == Valid
&& m_portraitSplashScreenValidationResult == Valid;
}
QString BarDescriptorFileImageWizardPage::icon() const
{
return m_ui->icon->path();
}
QString BarDescriptorFileImageWizardPage::landscapeSplashScreen() const
{
return m_ui->landscapeSplashScreen->path();
}
QString BarDescriptorFileImageWizardPage::portraitSplashScreen() const
{
return m_ui->portraitSplashScreen->path();
}
void BarDescriptorFileImageWizardPage::validateIcon(const QString &path)
{
m_iconValidationResult = validateImage(path, QSize(1, 1), QSize(90, 90));
switch (m_iconValidationResult) {
case Valid:
m_ui->iconValidationLabel->clear();
break;
case CouldNotLoad:
m_ui->iconValidationLabel->setText(tr("<font color=\"red\">Could not open '%1' for reading.</font>").arg(path));
break;
case IncorrectSize: {
const QSize size = imageSize(path);
m_ui->iconValidationLabel->setText(tr("<font color=\"red\">Incorrect icon size (%1x%2). The recommended size is "
"86x86 pixels with a maximum size of 90x90 pixels.</font>").arg(size.width()).arg(size.height()));
break;
}
default:
break;
}
emit completeChanged();
}
void BarDescriptorFileImageWizardPage::validateLandscapeSplashScreen(const QString &path)
{
m_landscapeSplashScreenValidationResult = validateImage(path, QSize(1024, 600), QSize(1024, 600));
updateSplashScreenValidationLabel();
emit completeChanged();
}
void BarDescriptorFileImageWizardPage::validatePortraitSplashScreen(const QString &path)
{
m_portraitSplashScreenValidationResult = validateImage(path, QSize(600, 1024), QSize(600, 1024));
updateSplashScreenValidationLabel();
emit completeChanged();
}
void BarDescriptorFileImageWizardPage::updateSplashScreenValidationLabel()
{
if (m_landscapeSplashScreenValidationResult == Valid
&& m_portraitSplashScreenValidationResult == Valid) {
m_ui->splashScreenValidationLabel->clear();
return;
}
switch (m_landscapeSplashScreenValidationResult) {
case CouldNotLoad:
m_ui->splashScreenValidationLabel->setText(tr("<font color=\"red\">Could not open '%1' for reading.</font>")
.arg(m_ui->landscapeSplashScreen->fileName().toString()));
break;
case IncorrectSize: {
const QSize size = imageSize(m_ui->landscapeSplashScreen->fileName().toString());
m_ui->splashScreenValidationLabel->setText(tr("<font color=\"red\">Incorrect landscape splash screen size (%1x%2). The required "
"size is 1024x600 pixels.</font>").arg(size.width()).arg(size.height()));
break;
}
case Valid:
default:
break;
}
switch (m_portraitSplashScreenValidationResult) {
case CouldNotLoad:
m_ui->splashScreenValidationLabel->setText(tr("<font color=\"red\">Could not open '%1' for reading.</font>")
.arg(m_ui->portraitSplashScreen->fileName().toString()));
break;
case IncorrectSize: {
const QSize size = imageSize(m_ui->portraitSplashScreen->fileName().toString());
m_ui->splashScreenValidationLabel->setText(tr("<font color=\"red\">Incorrect portrait splash screen size (%1x%2). The required "
"size is 600x1024 pixels.</font>").arg(size.width()).arg(size.height()));
break;
}
case Valid:
default:
break;
}
}
BarDescriptorFileImageWizardPage::ImageValidationResult BarDescriptorFileImageWizardPage::validateImage(const QString &path, const QSize &minimumSize, const QSize &maximumSize)
{
if (path.isEmpty())
return Valid; // Empty is ok, since <icon> and <splashscreen> entries are optional
QImage img(path);
if (img.isNull())
return CouldNotLoad;
const QSize imgSize = img.size();
if (imgSize.width() < minimumSize.width() || imgSize.height() < minimumSize.height()
|| imgSize.width() > maximumSize.width() || imgSize.height() > maximumSize.height())
return IncorrectSize;
return Valid;
}
QSize BarDescriptorFileImageWizardPage::imageSize(const QString &path)
{
QImage img(path);
if (img.isNull())
return QSize();
return img.size();
}

View File

@@ -0,0 +1,87 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BARDESCRIPTORFILEIMAGEWIZARDPAGE_H
#define QNX_INTERNAL_BARDESCRIPTORFILEIMAGEWIZARDPAGE_H
#include <QWizardPage>
namespace Qnx {
namespace Internal {
namespace Ui {
class BarDescriptorFileImageWizardPage;
}
class BarDescriptorFileImageWizardPage : public QWizardPage
{
Q_OBJECT
public:
explicit BarDescriptorFileImageWizardPage(QWidget *parent = 0);
~BarDescriptorFileImageWizardPage();
bool isComplete() const;
QString icon() const;
QString landscapeSplashScreen() const;
QString portraitSplashScreen() const;
private slots:
void validateIcon(const QString &path);
void validateLandscapeSplashScreen(const QString &path);
void validatePortraitSplashScreen(const QString &path);
private:
enum ImageValidationResult {
Valid,
CouldNotLoad,
IncorrectSize
};
void updateSplashScreenValidationLabel();
ImageValidationResult validateImage(const QString &path, const QSize &minimumSize, const QSize &maximumSize);
QSize imageSize(const QString &path);
Ui::BarDescriptorFileImageWizardPage *m_ui;
ImageValidationResult m_iconValidationResult;
ImageValidationResult m_landscapeSplashScreenValidationResult;
ImageValidationResult m_portraitSplashScreenValidationResult;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BARDESCRIPTORFILEIMAGEWIZARDPAGE_H

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BarDescriptorFileImageWizardPage</class>
<widget class="QWizardPage" name="Qnx::Internal::BarDescriptorFileImageWizardPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>116</height>
</rect>
</property>
<property name="windowTitle">
<string>WizardPage</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Icon:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="icon" native="true"/>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="iconValidationLabel">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Splash screens</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Landscape:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Utils::PathChooser" name="landscapeSplashScreen" native="true"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Portrait:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="Utils::PathChooser" name="portraitSplashScreen" native="true"/>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="splashScreenValidationLabel">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</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/>
<connections/>
</ui>

View File

@@ -0,0 +1,236 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberryabstractdeploystep.h"
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/target.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)
{
}
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)
{
}
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();
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();
cleanup();
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(QLatin1String(" ")));
m_params << param;
}
void BlackBerryAbstractDeployStep::reportProgress(int progress)
{
QTC_ASSERT(progress >= 0 && progress <= 100, return);
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 &params)
{
emitOutputInfo(params, params.prettyArguments());
}
void BlackBerryAbstractDeployStep::emitOutputInfo(const ProjectExplorer::ProcessParameters &params, const QString &arguments)
{
emit addOutput(tr("Starting: \"%1\" %2")
.arg(QDir::toNativeSeparators(params.effectiveCommand()),
arguments),
BuildStep::MessageOutput);
}
void BlackBerryAbstractDeployStep::processReadyReadStdOutput()
{
m_process->setReadChannel(QProcess::StandardOutput);
while (m_process && m_process->canReadLine()) {
const QString line = QString::fromLocal8Bit(m_process->readLine());
stdOutput(line);
}
}
void BlackBerryAbstractDeployStep::stdOutput(const QString &line)
{
emit addOutput(line, BuildStep::NormalOutput, BuildStep::DontAppendNewline);
}
void BlackBerryAbstractDeployStep::processReadyReadStdError()
{
m_process->setReadChannel(QProcess::StandardError);
while (m_process && 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)
{
emit addOutput(line, BuildStep::ErrorOutput, BuildStep::DontAppendNewline);
}

View File

@@ -0,0 +1,106 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYABSTRACTDEPLOYSTEP_H
#define QNX_INTERNAL_BLACKBERRYABSTRACTDEPLOYSTEP_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);
virtual void cleanup() = 0;
protected:
BlackBerryAbstractDeployStep(ProjectExplorer::BuildStepList *bsl, BlackBerryAbstractDeployStep *bs);
void addCommand(const QString &command, const QStringList &arguments);
void reportProgress(int progress);
virtual void stdOutput(const QString &line);
virtual void stdError(const QString &line);
virtual void processStarted(const ProjectExplorer::ProcessParameters &param);
void emitOutputInfo(const ProjectExplorer::ProcessParameters &params, const QString& arguments);
private slots:
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;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYABSTRACTDEPLOYSTEP_H

View File

@@ -0,0 +1,356 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberryapplicationrunner.h"
#include "blackberrydeployconfiguration.h"
#include "blackberryrunconfiguration.h"
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <ssh/sshremoteprocessrunner.h>
#include <utils/qtcassert.h>
#include <QTimer>
#include <QDir>
namespace {
const char DEPLOY_CMD[] = "blackberry-deploy";
qint64 parsePid(const QString &line)
{
QTC_ASSERT(line.startsWith(QLatin1String("result::")), return -1);
int pidIndex = -1;
if (line.contains(QLatin1String("running"))) // "result::running,<pid>"
pidIndex = 16;
else // "result::<pid>"
pidIndex = 8;
bool ok;
const qint64 pid = line.mid(pidIndex).toInt(&ok);
if (!ok)
return -1;
return pid;
}
QString parseAppId(const QString &line)
{
QTC_ASSERT(line.startsWith(QLatin1String("Info: Launching")), return QString());
const int endOfId = line.indexOf(QLatin1String("..."));
return line.mid(16, endOfId - 16);
}
bool parseRunningState(const QString &line)
{
QTC_ASSERT(line.startsWith(QLatin1String("result::")), return false);
return line.trimmed().mid(8) == QLatin1String("true");
}
}
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryApplicationRunner::BlackBerryApplicationRunner(bool debugMode, BlackBerryRunConfiguration *runConfiguration, QObject *parent)
: QObject(parent)
, m_debugMode(debugMode)
, m_pid(-1)
, m_appId(QString())
, m_running(false)
, m_stopping(false)
, m_launchProcess(0)
, m_stopProcess(0)
, m_tailProcess(0)
, m_runningStateTimer(new QTimer(this))
, m_runningStateProcess(0)
{
QTC_ASSERT(runConfiguration, return);
Qt4ProjectManager::Qt4BuildConfiguration *qt4BuildConfig = runConfiguration->activeQt4BuildConfiguration();
m_environment = qt4BuildConfig->environment();
m_deployCmd = m_environment.searchInPath(QLatin1String(DEPLOY_CMD));
m_deviceHost = runConfiguration->deployConfiguration()->deviceHost();
m_password = runConfiguration->deployConfiguration()->password();
BlackBerryRunConfiguration *blackberryRunConfiguration = qobject_cast<BlackBerryRunConfiguration *>(runConfiguration);
if (blackberryRunConfiguration)
m_barPackage = blackberryRunConfiguration->barPackage();
BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(runConfiguration->target()->profile());
m_sshParams = device->sshParameters();
// The BlackBerry device always uses key authentication
m_sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationByKey;
m_runningStateTimer->setInterval(3000);
m_runningStateTimer->setSingleShot(true);
connect(m_runningStateTimer, SIGNAL(timeout()), this, SLOT(determineRunningState()));
}
void BlackBerryApplicationRunner::start()
{
QStringList args;
args << QLatin1String("-launchApp");
if (m_debugMode)
args << QLatin1String("-debugNative");
args << "-device" << m_deviceHost;
if (!m_password.isEmpty())
args << QLatin1String("-password") << m_password;
args << QDir::toNativeSeparators(m_barPackage);
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());
}
m_launchProcess->start(m_deployCmd, args);
m_runningStateTimer->start();
m_running = true;
}
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);
}
}
ProjectExplorer::RunControl::StopResult BlackBerryApplicationRunner::stop()
{
m_stopping = true;
QStringList args;
args << QLatin1String("-terminateApp");
args << QLatin1String("-device") << m_deviceHost;
if (!m_password.isEmpty())
args << QLatin1String("-password") << m_password;
args << m_barPackage;
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 ProjectExplorer::RunControl::AsynchronousStop;
}
bool BlackBerryApplicationRunner::isRunning() const
{
return m_running && !m_stopping;
}
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());
emit output(line, Utils::StdOutFormat);
if (line.startsWith(QLatin1String("result::"))) {
m_pid = parsePid(line);
} else if (line.startsWith(QLatin1String("Info: Launching"))) {
m_appId = parseAppId(line);
}
}
}
void BlackBerryApplicationRunner::readStandardError()
{
QProcess *process = qobject_cast<QProcess *>(sender());
process->setReadChannel(QProcess::StandardError);
while (process->canReadLine()) {
const QString line = QString::fromLocal8Bit(process->readLine());
emit output(line, Utils::StdErrFormat);
}
}
void BlackBerryApplicationRunner::killTailProcess()
{
QSsh::SshRemoteProcessRunner *slayProcess = new QSsh::SshRemoteProcessRunner(this);
connect(slayProcess, SIGNAL(processClosed(int)), this, SIGNAL(finished()));
slayProcess->run("slay tail", m_sshParams);
// Not supported by OpenSSH server
//m_tailProcess->sendSignalToProcess(Utils::SshRemoteProcess::KillSignal);
m_tailProcess->cancel();
delete m_tailProcess;
m_tailProcess = 0;
}
void BlackBerryApplicationRunner::tailApplicationLog()
{
// TODO: Reading the log using qconn instead?
if (m_tailProcess && m_tailProcess->isProcessRunning())
return;
QTC_CHECK(!m_appId.isEmpty());
if (!m_tailProcess) {
m_tailProcess = new QSsh::SshRemoteProcessRunner(this);
connect(m_tailProcess, SIGNAL(readyReadStandardOutput()),
this, SLOT(handleTailOutput()));
connect(m_tailProcess, SIGNAL(readyReadStandardError()),
this, SLOT(handleTailError()));
connect(m_tailProcess, SIGNAL(connectionError()),
this, SLOT(handleTailConnectionError()));
}
const QString command = QLatin1String("tail -c +1 -f /accounts/1000/appdata/") + m_appId
+ QLatin1String("/logs/log");
m_tailProcess->run(command.toLatin1(), m_sshParams);
}
void BlackBerryApplicationRunner::handleTailOutput()
{
QSsh::SshRemoteProcessRunner *process = qobject_cast<QSsh::SshRemoteProcessRunner *>(sender());
QTC_ASSERT(process, return);
const QString message = QString::fromLatin1(process->readAllStandardOutput());
emit output(message, Utils::StdOutFormat);
}
void BlackBerryApplicationRunner::handleTailError()
{
QSsh::SshRemoteProcessRunner *process = qobject_cast<QSsh::SshRemoteProcessRunner *>(sender());
QTC_ASSERT(process, return);
const QString message = QString::fromLatin1(process->readAllStandardError());
emit output(message, Utils::StdErrFormat);
}
void BlackBerryApplicationRunner::handleTailConnectionError()
{
emit output(tr("Cannot show debug output. Error: %1").arg(m_tailProcess->lastConnectionErrorString()),
Utils::StdErrFormat);
}
void BlackBerryApplicationRunner::startRunningStateTimer()
{
if (m_running)
m_runningStateTimer->start();
}
void BlackBerryApplicationRunner::determineRunningState()
{
QStringList args;
args << QLatin1String("-isAppRunning");
args << "-device" << m_deviceHost;
if (!m_password.isEmpty())
args << QLatin1String("-password") << m_password;
args << m_barPackage;
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 = "";
m_running = false;
m_stopping = false;
m_runningStateTimer->stop();
m_runningStateProcess->terminate();
if (!m_runningStateProcess->waitForFinished(1000))
m_runningStateProcess->kill();
if (m_tailProcess && m_tailProcess->isProcessRunning())
killTailProcess();
else
emit finished();
}

View File

@@ -0,0 +1,121 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYAPPLICATIONRUNNER_H
#define QNX_INTERNAL_BLACKBERRYAPPLICATIONRUNNER_H
#include <projectexplorer/runconfiguration.h>
#include <ssh/sshconnection.h>
#include <utils/environment.h>
#include <QObject>
#include <QProcess>
namespace QSsh {
class SshRemoteProcessRunner;
}
namespace Qnx {
namespace Internal {
class BlackBerryRunConfiguration;
class BlackBerryApplicationRunner : public QObject
{
Q_OBJECT
public:
explicit BlackBerryApplicationRunner(bool debugMode, BlackBerryRunConfiguration *runConfiguration, QObject *parent = 0);
bool isRunning() const;
qint64 pid() const;
ProjectExplorer::RunControl::StopResult stop();
public slots:
void start();
void tailApplicationLog();
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 handleTailOutput();
void handleTailError();
void handleTailConnectionError();
void startRunningStateTimer();
void determineRunningState();
void readRunningStateStandardOutput();
private:
void reset();
void killTailProcess();
bool m_debugMode;
qint64 m_pid;
QString m_appId;
bool m_running;
bool m_stopping;
Utils::Environment m_environment;
QString m_deployCmd;
QString m_deviceHost;
QString m_password;
QString m_barPackage;
QSsh::SshConnectionParameters m_sshParams;
QProcess *m_launchProcess;
QProcess *m_stopProcess;
QSsh::SshRemoteProcessRunner *m_tailProcess;
QTimer *m_runningStateTimer;
QProcess *m_runningStateProcess;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYAPPLICATIONRUNNER_H

View File

@@ -0,0 +1,183 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberryconnect.h"
#include "blackberryrunconfiguration.h"
#include "blackberrydeployconfiguration.h"
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <projectexplorer/target.h>
#include <ssh/sshconnection.h>
#include <utils/qtcassert.h>
#include <QProcess>
#include <QApplication>
using namespace Qnx;
using namespace Qnx::Internal;
namespace {
const char CONNECT_CMD[] = "java";
const char CONNECT_SUCCESS_MSG[] = "Successfully connected";
}
QMap<QString, BlackBerryConnect *> BlackBerryConnect::m_instances = QMap<QString, BlackBerryConnect *>();
QMap<QString, int> BlackBerryConnect::m_usageCount = QMap<QString, int>();
BlackBerryConnect *BlackBerryConnect::instance(BlackBerryRunConfiguration *runConfig)
{
BlackBerryDeployConfiguration *deployConfig = runConfig->deployConfiguration();
QString deviceHost = deployConfig->deviceHost();
if (!m_instances.contains(deviceHost)) {
m_instances[deviceHost] = new BlackBerryConnect(runConfig);
m_usageCount[deviceHost] = 1;
} else {
++m_usageCount[deviceHost];
}
return m_instances[deviceHost];
}
void BlackBerryConnect::cleanup(BlackBerryConnect *instance)
{
const QString deviceHost = instance->m_deviceHost;
QTC_ASSERT(m_usageCount.contains(deviceHost), return);
--m_usageCount[deviceHost];
QTC_ASSERT(m_usageCount[deviceHost] >= 0, return);
if (m_usageCount[deviceHost] == 0) {
m_instances.remove(deviceHost);
m_usageCount.remove(deviceHost);
instance->deleteLater();
}
}
BlackBerryConnect::BlackBerryConnect(BlackBerryRunConfiguration *runConfig)
: QObject()
, m_connected(false)
{
m_process = new QProcess(this);
Utils::Environment env;
if (runConfig->activeQt4BuildConfiguration())
env = runConfig->activeQt4BuildConfiguration()->environment();
m_process->setEnvironment(env.toStringList());
m_connectCmd = env.searchInPath(QLatin1String(CONNECT_CMD));
m_qnxHost = env.value(QLatin1String("QNX_HOST"));
BlackBerryDeployConfiguration *deployConfig = runConfig->deployConfiguration();
m_deviceHost = deployConfig->deviceHost();
m_password = deployConfig->password();
BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(runConfig->target()->profile());
m_publicKeyFile = device->sshParameters().privateKeyFile + QLatin1String(".pub");
connect(m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput()));
connect(m_process, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError()));
connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(handleProcessFinished(int,QProcess::ExitStatus)));
}
void BlackBerryConnect::connectToDevice()
{
if (m_connected) {
emit connected();
return;
}
QTC_ASSERT(!m_connectCmd.isEmpty() && !m_qnxHost.isEmpty(), return);
// Since killing the blackberry-connect script won't kill the java process it launches, let's just call
// the java process directly instead.
QStringList connectArgs;
connectArgs << QLatin1String("-Xmx512M");
connectArgs << QLatin1String("-jar") << m_qnxHost + QLatin1String("/usr/lib/Connect.jar");
connectArgs << QLatin1String("-targetHost") << m_deviceHost;
if (!m_password.isEmpty())
connectArgs << QLatin1String("-password") << m_password;
connectArgs << QLatin1String("-sshPublicKey") << m_publicKeyFile;
m_process->start(m_connectCmd, connectArgs);
}
void BlackBerryConnect::disconnectFromDevice()
{
if (m_process->state() != QProcess::Running)
return;
if (m_usageCount[m_deviceHost] == 1) {
m_process->terminate();
if (!m_process->waitForFinished(5000))
m_process->kill();
}
}
void BlackBerryConnect::handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
m_connected = false;
if (exitCode != 0 || exitStatus != QProcess::NormalExit)
emit error(m_process->errorString());
}
void BlackBerryConnect::readStandardOutput()
{
m_process->setReadChannel(QProcess::StandardOutput);
while (m_process->canReadLine()) {
const QString line = QString::fromLocal8Bit(m_process->readLine());
emit output(line, Utils::StdOutFormat);
if (line.contains(QLatin1String(CONNECT_SUCCESS_MSG))) {
m_connected = true;
emit connected();
}
}
}
void BlackBerryConnect::readStandardError()
{
m_process->setReadChannel(QProcess::StandardError);
QStringList errorLines;
while (m_process->canReadLine()) {
const QString line = QString::fromLocal8Bit(m_process->readLine());
emit output(line, Utils::StdErrFormat);
if (line.contains(QLatin1String("Error:")))
errorLines << line.mid(7);
}
// TODO: Handle error messages better
if (!errorLines.isEmpty())
emit error(errorLines.join(QLatin1String("\n")));
}

View File

@@ -0,0 +1,87 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYCONNECT_H
#define QNX_INTERNAL_BLACKBERRYCONNECT_H
#include <utils/outputformat.h>
#include <QObject>
#include <QProcess>
namespace Qnx {
namespace Internal {
class BlackBerryRunConfiguration;
class BlackBerryConnect : public QObject
{
Q_OBJECT
public:
static BlackBerryConnect *instance(BlackBerryRunConfiguration *runConfig);
static void cleanup(BlackBerryConnect *instance);
signals:
void connected();
void error(const QString &msg);
void output(const QString &msg, Utils::OutputFormat format);
public slots:
void connectToDevice();
void disconnectFromDevice();
private slots:
void handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void readStandardOutput();
void readStandardError();
private:
explicit BlackBerryConnect(BlackBerryRunConfiguration *runConfig);
static QMap<QString, BlackBerryConnect *> m_instances;
static QMap<QString, int> m_usageCount;
QProcess *m_process;
QString m_connectCmd;
QString m_deviceHost;
QString m_password;
QString m_publicKeyFile;
QString m_qnxHost;
bool m_connected;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYCONNECT_H

View File

@@ -0,0 +1,218 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberrycreatepackagestep.h"
#include "qnxconstants.h"
#include "blackberrycreatepackagestepconfigwidget.h"
#include "blackberrydeployconfiguration.h"
#include "qnxutils.h"
#include "blackberryqtversion.h"
#include "blackberrydeviceconfiguration.h"
#include "blackberrydeployinformation.h"
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <projectexplorer/runconfiguration.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4nodes.h>
#include <qt4projectmanager/qt4project.h>
#include <qtsupport/qtprofileinformation.h>
#include <utils/qtcassert.h>
#include <QTemporaryFile>
using namespace Qnx;
using namespace Qnx::Internal;
namespace {
const char PACKAGER_CMD[] = "blackberry-nativepackager";
const char QT_INSTALL_LIBS[] = "QT_INSTALL_LIBS";
const char QT_INSTALL_LIBS_VAR[] = "%QT_INSTALL_LIBS%";
const char QT_INSTALL_PLUGINS[] = "QT_INSTALL_PLUGINS";
const char QT_INSTALL_PLUGINS_VAR[] = "%QT_INSTALL_PLUGINS%";
const char QT_INSTALL_IMPORTS[] = "QT_INSTALL_IMPORTS";
const char QT_INSTALL_IMPORTS_VAR[] = "%QT_INSTALL_IMPORTS%";
const char SRC_DIR_VAR[] = "%SRC_DIR%";
}
BlackBerryCreatePackageStep::BlackBerryCreatePackageStep(ProjectExplorer::BuildStepList *bsl)
: BlackBerryAbstractDeployStep(bsl, Core::Id(Constants::QNX_CREATE_PACKAGE_BS_ID))
{
setDisplayName(tr("Create BAR packages"));
}
BlackBerryCreatePackageStep::BlackBerryCreatePackageStep(ProjectExplorer::BuildStepList *bsl,
BlackBerryCreatePackageStep *bs)
: BlackBerryAbstractDeployStep(bsl, bs)
{
setDisplayName(tr("Create BAR packages"));
}
bool BlackBerryCreatePackageStep::init()
{
if (!BlackBerryAbstractDeployStep::init())
return false;
const QString packageCmd = target()->activeBuildConfiguration()->environment().searchInPath(QLatin1String(PACKAGER_CMD));
if (packageCmd.isEmpty()) {
raiseError(tr("Could not find packager command '%s' in the build environment")
.arg(QLatin1String(PACKAGER_CMD)));
return false;
}
BlackBerryDeployConfiguration *deployConfig = qobject_cast<BlackBerryDeployConfiguration *>(deployConfiguration());
QTC_ASSERT(deployConfig, return false);
QList<BarPackageDeployInformation> packagesToDeploy = deployConfig->deploymentInfo()->enabledPackages();
if (packagesToDeploy.isEmpty()) {
raiseError(tr("No packages enabled for deployment"));
return false;
}
foreach (const BarPackageDeployInformation &info, packagesToDeploy) {
if (info.appDescriptorPath.isEmpty()) {
raiseError(tr("Application descriptor file not specified, please check deployment settings"));
return false;
}
if (info.packagePath.isEmpty()) {
raiseError(tr("No package specified, please check deployment settings"));
return false;
}
const QString buildDir = target()->activeBuildConfiguration()->buildDirectory();
QDir dir(buildDir);
if (!dir.exists()) {
if (!dir.mkpath(buildDir)) {
raiseError(tr("Could not create build directory '%1'").arg(buildDir));
return false;
}
}
QTemporaryFile *preparedAppDescriptorFile = new QTemporaryFile(buildDir + QLatin1String("/bar-descriptor_XXXXXX.xml"));
if (!prepareAppDescriptorFile(info.appDescriptorPath, preparedAppDescriptorFile)) { // If there is an error, prepareAppDescriptorFile() will raise it
delete preparedAppDescriptorFile;
return false;
}
m_preparedAppDescriptorFiles << preparedAppDescriptorFile;
QStringList args;
args << QLatin1String("-devMode");
if (!debugToken().isEmpty())
args << QLatin1String("-debugToken") << QnxUtils::addQuotes(QDir::toNativeSeparators(debugToken()));
args << QLatin1String("-package") << QnxUtils::addQuotes(QDir::toNativeSeparators(info.packagePath));
args << QnxUtils::addQuotes(QDir::toNativeSeparators(preparedAppDescriptorFile->fileName()));
addCommand(packageCmd, args);
}
return true;
}
void BlackBerryCreatePackageStep::cleanup()
{
while (!m_preparedAppDescriptorFiles.isEmpty()) {
QTemporaryFile *file = m_preparedAppDescriptorFiles.takeFirst();
delete file;
}
}
ProjectExplorer::BuildStepConfigWidget *BlackBerryCreatePackageStep::createConfigWidget()
{
return new BlackBerryCreatePackageStepConfigWidget();
}
QString BlackBerryCreatePackageStep::debugToken() const
{
BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(target()->profile());
return device->debugToken();
}
void BlackBerryCreatePackageStep::raiseError(const QString &errorMessage)
{
emit addOutput(errorMessage, BuildStep::ErrorMessageOutput);
emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error, errorMessage, Utils::FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
cleanup();
}
bool BlackBerryCreatePackageStep::prepareAppDescriptorFile(const QString &appDescriptorPath, QTemporaryFile *preparedFile)
{
BlackBerryQtVersion *qtVersion = dynamic_cast<BlackBerryQtVersion *>(QtSupport::QtProfileInformation::qtVersion(target()->profile()));
if (!qtVersion) {
raiseError(tr("Error preparing application descriptor file"));
return false;
}
QFile file(appDescriptorPath);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
raiseError(tr("Could not open '%1' for reading").arg(appDescriptorPath));
return false;
}
QByteArray fileContent = file.readAll();
// Replace Qt path placeholders
if (fileContent.contains(QT_INSTALL_LIBS_VAR))
fileContent.replace(QT_INSTALL_LIBS_VAR, qtVersion->versionInfo().value(QLatin1String(QT_INSTALL_LIBS)).toLatin1());
if (fileContent.contains(QT_INSTALL_PLUGINS_VAR))
fileContent.replace(QT_INSTALL_PLUGINS_VAR, qtVersion->versionInfo().value(QLatin1String(QT_INSTALL_PLUGINS)).toLatin1());
if (fileContent.contains(QT_INSTALL_IMPORTS_VAR))
fileContent.replace(QT_INSTALL_IMPORTS_VAR, qtVersion->versionInfo().value(QLatin1String(QT_INSTALL_IMPORTS)).toLatin1());
//Replace Source path placeholder
if (fileContent.contains(SRC_DIR_VAR))
fileContent.replace(SRC_DIR_VAR, QDir::toNativeSeparators(target()->project()->projectDirectory()).toLatin1());
// Add parameter for QML debugging (if enabled)
if (target()->activeRunConfiguration()->debuggerAspect()->useQmlDebugger()) {
if (!fileContent.contains("-qmljsdebugger")) {
const QString argString = QString::fromLatin1("<arg>-qmljsdebugger=port:%1</arg>\n</qnx>")
.arg(target()->activeRunConfiguration()->debuggerAspect()->qmlDebugServerPort());
fileContent.replace("</qnx>", argString.toLatin1());
}
}
const QString buildDir = target()->activeBuildConfiguration()->buildDirectory();
if (!preparedFile->open()) {
raiseError(tr("Could not create prepared application descriptor file in '%1'").arg(buildDir));
return false;
}
preparedFile->write(fileContent);
preparedFile->close();
return true;
}

View File

@@ -0,0 +1,74 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYCREATEPACKAGESTEP_H
#define QNX_INTERNAL_BLACKBERRYCREATEPACKAGESTEP_H
#include "blackberryabstractdeploystep.h"
QT_BEGIN_NAMESPACE
class QTemporaryFile;
QT_END_NAMESPACE
namespace Qnx {
namespace Internal {
class BlackBerryCreatePackageStep : public BlackBerryAbstractDeployStep
{
Q_OBJECT
friend class BlackBerryCreatePackageStepFactory;
public:
explicit BlackBerryCreatePackageStep(ProjectExplorer::BuildStepList *bsl);
bool init();
void cleanup();
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
QString debugToken() const;
protected:
BlackBerryCreatePackageStep(ProjectExplorer::BuildStepList *bsl, BlackBerryCreatePackageStep *bs);
void raiseError(const QString &errorMessage);
private:
bool prepareAppDescriptorFile(const QString &appDescriptorPath, QTemporaryFile *preparedFile);
QList<QTemporaryFile *> m_preparedAppDescriptorFiles;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYCREATEPACKAGESTEP_H

View File

@@ -0,0 +1,57 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberrycreatepackagestepconfigwidget.h"
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryCreatePackageStepConfigWidget::BlackBerryCreatePackageStepConfigWidget()
: ProjectExplorer::BuildStepConfigWidget()
{
}
QString BlackBerryCreatePackageStepConfigWidget::displayName() const
{
return tr("<b>Create packages</b>");
}
QString BlackBerryCreatePackageStepConfigWidget::summaryText() const
{
return displayName();
}
bool BlackBerryCreatePackageStepConfigWidget::showWidget() const
{
return false;
}

View File

@@ -0,0 +1,57 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYCREATEPACKAGESTEPCONFIGWIDGET_H
#define QNX_INTERNAL_BLACKBERRYCREATEPACKAGESTEPCONFIGWIDGET_H
#include <projectexplorer/buildstep.h>
namespace Qnx {
namespace Internal {
class BlackBerryCreatePackageStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
{
Q_OBJECT
public:
explicit BlackBerryCreatePackageStepConfigWidget();
QString displayName() const;
QString summaryText() const;
bool showWidget() const;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYCREATEPACKAGESTEPCONFIGWIDGET_H

View File

@@ -0,0 +1,120 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberrycreatepackagestepfactory.h"
#include "qnxconstants.h"
#include "blackberrycreatepackagestep.h"
#include "blackberrydeviceconfigurationfactory.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/profileinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryCreatePackageStepFactory::BlackBerryCreatePackageStepFactory(QObject *parent) :
ProjectExplorer::IBuildStepFactory(parent)
{
}
BlackBerryCreatePackageStepFactory::~BlackBerryCreatePackageStepFactory()
{
}
QList<Core::Id> BlackBerryCreatePackageStepFactory::availableCreationIds(
ProjectExplorer::BuildStepList *parent) const
{
if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY))
return QList<Core::Id>();
Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(parent->target()->profile());
if (deviceType != BlackBerryDeviceConfigurationFactory::deviceType())
return QList<Core::Id>();
return QList<Core::Id>() << Core::Id(Constants::QNX_CREATE_PACKAGE_BS_ID);
}
QString BlackBerryCreatePackageStepFactory::displayNameForId(const Core::Id id) const
{
if (id == Core::Id(Constants::QNX_CREATE_PACKAGE_BS_ID))
return tr("Create BAR Packages");
return QString();
}
bool BlackBerryCreatePackageStepFactory::canCreate(ProjectExplorer::BuildStepList *parent,
const Core::Id id) const
{
return availableCreationIds(parent).contains(id);
}
ProjectExplorer::BuildStep *BlackBerryCreatePackageStepFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
{
if (!canCreate(parent, id))
return 0;
return new BlackBerryCreatePackageStep(parent);
}
bool BlackBerryCreatePackageStepFactory::canRestore(ProjectExplorer::BuildStepList *parent,
const QVariantMap &map) const
{
return canCreate(parent, ProjectExplorer::idFromMap(map));
}
ProjectExplorer::BuildStep *BlackBerryCreatePackageStepFactory::restore(
ProjectExplorer::BuildStepList *parent, const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
BlackBerryCreatePackageStep *bs = new BlackBerryCreatePackageStep(parent);
if (bs->fromMap(map))
return bs;
delete bs;
return 0;
}
bool BlackBerryCreatePackageStepFactory::canClone(ProjectExplorer::BuildStepList *parent,
ProjectExplorer::BuildStep *source) const
{
return canCreate(parent, source->id());
}
ProjectExplorer::BuildStep *BlackBerryCreatePackageStepFactory::clone(ProjectExplorer::BuildStepList *parent,
ProjectExplorer::BuildStep *source)
{
if (!canClone(parent, source))
return 0;
return new BlackBerryCreatePackageStep(parent, static_cast<BlackBerryCreatePackageStep *>(source));
}

View File

@@ -0,0 +1,67 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYCREATEPACKAGESTEPFACTORY_H
#define QNX_INTERNAL_BLACKBERRYCREATEPACKAGESTEPFACTORY_H
#include <projectexplorer/buildstep.h>
namespace Qnx {
namespace Internal {
class BlackBerryCreatePackageStepFactory : public ProjectExplorer::IBuildStepFactory
{
Q_OBJECT
public:
explicit BlackBerryCreatePackageStepFactory(QObject *parent = 0);
~BlackBerryCreatePackageStepFactory();
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
QString displayNameForId(const Core::Id id) const;
bool canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, const Core::Id id);
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent,
const QVariantMap &map);
bool canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent,
ProjectExplorer::BuildStep *product);
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYCREATEPACKAGESTEPFACTORY_H

View File

@@ -0,0 +1,111 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberrydebugsupport.h"
#include "blackberryapplicationrunner.h"
#include "blackberryconnect.h"
#include <debugger/debuggerrunner.h>
#include <debugger/debuggerengine.h>
#include <debugger/debuggerstartparameters.h>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryDebugSupport::BlackBerryDebugSupport(BlackBerryRunConfiguration *runConfig,
Debugger::DebuggerRunControl *runControl)
: QObject(runControl->engine())
, m_engine(runControl->engine())
{
m_runner = new BlackBerryApplicationRunner(true, runConfig, this);
m_connector = BlackBerryConnect::instance(runConfig);
connect(m_engine, SIGNAL(requestRemoteSetup()), this, SLOT(launchRemoteApplication()));
connect(m_engine, SIGNAL(stateChanged(Debugger::DebuggerState)),
this, SLOT(handleDebuggerStateChanged(Debugger::DebuggerState)));
connect(m_connector, SIGNAL(error(QString)), this, SLOT(handleConnectorError(QString)));
connect(m_connector, SIGNAL(connected()), m_runner, SLOT(start()));
connect(m_connector, SIGNAL(output(QString,Utils::OutputFormat)),
runControl, SLOT(appendMessage(QString,Utils::OutputFormat)));
connect(m_runner, SIGNAL(started()), this, SLOT(handleStarted()));
connect(m_runner, SIGNAL(started()), m_runner, SLOT(tailApplicationLog()));
connect(m_runner, SIGNAL(startFailed(QString)), this, SLOT(handleStartFailed(QString)));
connect(m_runner, SIGNAL(output(QString,Utils::OutputFormat)),
this, SLOT(handleApplicationOutput(QString,Utils::OutputFormat)));
connect(m_runner, SIGNAL(finished()), m_connector, SLOT(disconnectFromDevice()));
connect(this, SIGNAL(output(QString,Utils::OutputFormat)),
runControl, SLOT(appendMessage(QString,Utils::OutputFormat)));
}
BlackBerryDebugSupport::~BlackBerryDebugSupport()
{
BlackBerryConnect::cleanup(m_connector);
}
void BlackBerryDebugSupport::launchRemoteApplication()
{
m_connector->connectToDevice();
}
void BlackBerryDebugSupport::handleStarted()
{
m_engine->startParameters().attachPID = m_runner->pid();
m_engine->notifyEngineRemoteSetupDone(-1, -1);
}
void BlackBerryDebugSupport::handleStartFailed(const QString &message)
{
m_engine->notifyEngineRemoteSetupFailed(message);
}
void BlackBerryDebugSupport::handleDebuggerStateChanged(Debugger::DebuggerState state)
{
if (state == Debugger::EngineShutdownOk || state == Debugger::DebuggerFinished) {
if (m_runner->isRunning())
m_runner->stop();
}
}
void BlackBerryDebugSupport::handleConnectorError(const QString &message)
{
m_engine->notifyEngineRemoteSetupFailed(message);
}
void BlackBerryDebugSupport::handleApplicationOutput(const QString &msg, Utils::OutputFormat format)
{
Q_UNUSED(format)
m_engine->showMessage(msg, Debugger::AppOutput);
}

View File

@@ -0,0 +1,89 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYDEBUGSUPPORT_H
#define QNX_INTERNAL_BLACKBERRYDEBUGSUPPORT_H
#include <debugger/debuggerconstants.h>
#include <utils/outputformat.h>
#include <QObject>
#include <QProcess>
namespace Debugger {
class DebuggerEngine;
class DebuggerRunControl;
}
namespace Qnx {
namespace Internal {
class BlackBerryConnect;
class BlackBerryRunConfiguration;
class BlackBerryApplicationRunner;
class BlackBerryDebugSupport : public QObject
{
Q_OBJECT
public:
explicit BlackBerryDebugSupport(BlackBerryRunConfiguration *runConfig,
Debugger::DebuggerRunControl *runControl);
~BlackBerryDebugSupport();
signals:
void output(const QString &msg, Utils::OutputFormat format);
private slots:
void launchRemoteApplication();
void handleStarted();
void handleStartFailed(const QString &message);
void handleDebuggerStateChanged(Debugger::DebuggerState state);
void handleConnectorError(const QString &message);
void handleApplicationOutput(const QString &msg, Utils::OutputFormat format);
private:
Debugger::DebuggerEngine *m_engine;
BlackBerryApplicationRunner *m_runner;
BlackBerryConnect *m_connector;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYDEBUGSUPPORT_H

View File

@@ -0,0 +1,111 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberrydeployconfiguration.h"
#include "qnxconstants.h"
#include "blackberrydeployconfigurationwidget.h"
#include "blackberrydeployinformation.h"
#include <projectexplorer/profileinformation.h>
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4nodes.h>
#include <qt4projectmanager/qt4project.h>
#include <ssh/sshconnection.h>
using namespace Qnx;
using namespace Qnx::Internal;
namespace {
const char DEPLOYMENT_INFO_SETTING[] = "QNX.BlackBerry.DeploymentInfo";
}
BlackBerryDeployConfiguration::BlackBerryDeployConfiguration(ProjectExplorer::Target *parent)
: ProjectExplorer::DeployConfiguration(parent, Core::Id(Constants::QNX_BB_DEPLOYCONFIGURATION_ID))
{
ctor();
}
BlackBerryDeployConfiguration::BlackBerryDeployConfiguration(ProjectExplorer::Target *parent,
BlackBerryDeployConfiguration *source)
: ProjectExplorer::DeployConfiguration(parent, source)
{
ctor();
}
void BlackBerryDeployConfiguration::ctor()
{
BlackBerryDeployInformation *info
= qobject_cast<BlackBerryDeployInformation *>(target()->project()->namedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING)).value<QObject *>());
if (!info) {
info = new BlackBerryDeployInformation(static_cast<Qt4ProjectManager::Qt4Project *>(target()->project()));
QVariant data = QVariant::fromValue(static_cast<QObject *>(info));
target()->project()->setNamedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING), data);
}
setDefaultDisplayName(tr("Deploy to BlackBerry Device"));
}
BlackBerryDeployConfiguration::~BlackBerryDeployConfiguration()
{
}
BlackBerryDeployInformation *BlackBerryDeployConfiguration::deploymentInfo() const
{
BlackBerryDeployInformation *info
= qobject_cast<BlackBerryDeployInformation *>(target()->project()->namedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING)).value<QObject *>());
return info;
}
QString BlackBerryDeployConfiguration::deviceHost() const
{
BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(target()->profile());
return device->sshParameters().host;
}
QString BlackBerryDeployConfiguration::password() const
{
BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(target()->profile());
return device->sshParameters().password;
}
QString BlackBerryDeployConfiguration::deviceName() const
{
BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(target()->profile());
return device->displayName();
}
ProjectExplorer::DeployConfigurationWidget *BlackBerryDeployConfiguration::configurationWidget() const
{
return new BlackBerryDeployConfigurationWidget;
}

View File

@@ -0,0 +1,77 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYDEPLOYCONFIGURATION_H
#define QNX_INTERNAL_BLACKBERRYDEPLOYCONFIGURATION_H
#include <projectexplorer/deployconfiguration.h>
#include "blackberrydeviceconfiguration.h"
namespace ProjectExplorer {
class Target;
}
namespace Qnx {
namespace Internal {
class BlackBerryDeployInformation;
class BlackBerryDeployConfiguration : public ProjectExplorer::DeployConfiguration
{
Q_OBJECT
friend class BlackBerryDeployConfigurationFactory;
public:
explicit BlackBerryDeployConfiguration(ProjectExplorer::Target *parent);
virtual ~BlackBerryDeployConfiguration();
ProjectExplorer::DeployConfigurationWidget *configurationWidget() const;
BlackBerryDeployInformation *deploymentInfo() const;
QString deviceHost() const;
QString password() const;
QString deviceName() const;
protected:
BlackBerryDeployConfiguration(ProjectExplorer::Target *parent, BlackBerryDeployConfiguration *source);
private:
void ctor();
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYDEPLOYCONFIGURATION_H

View File

@@ -0,0 +1,135 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberrydeployconfigurationfactory.h"
#include "qnxconstants.h"
#include "blackberrydeployconfiguration.h"
#include "blackberrycreatepackagestep.h"
#include "blackberrydeploystep.h"
#include "blackberrydeviceconfigurationfactory.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/profileinformation.h>
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4project.h>
#include <remotelinux/genericdirectuploadstep.h>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryDeployConfigurationFactory::BlackBerryDeployConfigurationFactory(QObject *parent) :
ProjectExplorer::DeployConfigurationFactory(parent)
{
}
BlackBerryDeployConfigurationFactory::~BlackBerryDeployConfigurationFactory()
{
}
QList<Core::Id> BlackBerryDeployConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
{
QList<Core::Id> result;
Qt4ProjectManager::Qt4Project *project = qobject_cast<Qt4ProjectManager::Qt4Project *>(parent->project());
if (!project)
return result;
Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(parent->profile());
if (deviceType != BlackBerryDeviceConfigurationFactory::deviceType())
return result;
result << Core::Id(Constants::QNX_BB_DEPLOYCONFIGURATION_ID);
return result;
}
QString BlackBerryDeployConfigurationFactory::displayNameForId(const Core::Id id) const
{
if (id == Core::Id(Constants::QNX_BB_DEPLOYCONFIGURATION_ID))
return tr("Deploy to BlackBerry Device");
return QString();
}
bool BlackBerryDeployConfigurationFactory::canCreate(ProjectExplorer::Target *parent,
const Core::Id id) const
{
return availableCreationIds(parent).contains(id);
}
ProjectExplorer::DeployConfiguration *BlackBerryDeployConfigurationFactory::create(
ProjectExplorer::Target *parent, const Core::Id id)
{
if (!canCreate(parent, id))
return 0;
BlackBerryDeployConfiguration *dc = new BlackBerryDeployConfiguration(parent);
dc->stepList()->insertStep(0, new BlackBerryCreatePackageStep(dc->stepList()));
dc->stepList()->insertStep(1, new BlackBerryDeployStep(dc->stepList()));
return dc;
}
bool BlackBerryDeployConfigurationFactory::canRestore(ProjectExplorer::Target *parent,
const QVariantMap &map) const
{
return canCreate(parent, ProjectExplorer::idFromMap(map));
}
ProjectExplorer::DeployConfiguration *BlackBerryDeployConfigurationFactory::restore(
ProjectExplorer::Target *parent, const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
BlackBerryDeployConfiguration *dc = new BlackBerryDeployConfiguration(parent);
if (dc->fromMap(map))
return dc;
delete dc;
return 0;
}
bool BlackBerryDeployConfigurationFactory::canClone(ProjectExplorer::Target *parent,
ProjectExplorer::DeployConfiguration *source) const
{
return canCreate(parent, source->id());
}
ProjectExplorer::DeployConfiguration *BlackBerryDeployConfigurationFactory::clone(
ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *source)
{
if (!canClone(parent, source))
return 0;
BlackBerryDeployConfiguration *old = static_cast<BlackBerryDeployConfiguration *>(source);
return new BlackBerryDeployConfiguration(parent, old);
}

View File

@@ -0,0 +1,73 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYDEPLOYCONFIGURATIONFACTORY_H
#define QNX_INTERNAL_BLACKBERRYDEPLOYCONFIGURATIONFACTORY_H
#include <projectexplorer/deployconfiguration.h>
namespace ProjectExplorer {
class Target;
}
namespace Qnx {
namespace Internal {
class BlackBerryDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
{
Q_OBJECT
public:
explicit BlackBerryDeployConfigurationFactory(QObject *parent = 0);
~BlackBerryDeployConfigurationFactory();
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
QString displayNameForId(const Core::Id id) const;
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
ProjectExplorer::DeployConfiguration *create(ProjectExplorer::Target *parent,
const Core::Id id);
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::DeployConfiguration *restore(ProjectExplorer::Target *parent,
const QVariantMap &map);
bool canClone(ProjectExplorer::Target *parent,
ProjectExplorer::DeployConfiguration *source) const;
ProjectExplorer::DeployConfiguration *clone(ProjectExplorer::Target *parent,
ProjectExplorer::DeployConfiguration *source);
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYDEPLOYCONFIGURATIONFACTORY_H

View File

@@ -0,0 +1,79 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberrydeployconfigurationwidget.h"
#include "ui_blackberrydeployconfigurationwidget.h"
#include "blackberrydeployconfiguration.h"
#include "blackberrydeployinformation.h"
#include "pathchooserdelegate.h"
#include <coreplugin/icore.h>
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/pathchooser.h>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryDeployConfigurationWidget::BlackBerryDeployConfigurationWidget(QWidget *parent)
: ProjectExplorer::DeployConfigurationWidget(parent)
, m_ui(new Ui::BlackBerryDeployConfigurationWidget)
, m_deployConfiguration(0)
{
m_ui->setupUi(this);
}
BlackBerryDeployConfigurationWidget::~BlackBerryDeployConfigurationWidget()
{
delete m_ui;
}
void BlackBerryDeployConfigurationWidget::init(ProjectExplorer::DeployConfiguration *dc)
{
m_deployConfiguration = qobject_cast<BlackBerryDeployConfiguration *>(dc);
m_ui->deployPackagesView->setModel(m_deployConfiguration->deploymentInfo());
PathChooserDelegate *appDescriptorPathDelegate = new PathChooserDelegate(this);
appDescriptorPathDelegate->setExpectedKind(Utils::PathChooser::File);
appDescriptorPathDelegate->setPromptDialogFilter(QLatin1String("*.xml"));
PathChooserDelegate *barPathDelegate = new PathChooserDelegate(this);
barPathDelegate->setExpectedKind(Utils::PathChooser::File);
barPathDelegate->setPromptDialogFilter(QLatin1String("*.bar"));
m_ui->deployPackagesView->setItemDelegateForColumn(1, appDescriptorPathDelegate);
m_ui->deployPackagesView->setItemDelegateForColumn(2, barPathDelegate);
m_ui->deployPackagesView->header()->resizeSections(QHeaderView::ResizeToContents);
}

View File

@@ -0,0 +1,66 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYDEPLOYCONFIGURATIONWIDGET_H
#define QNX_INTERNAL_BLACKBERRYDEPLOYCONFIGURATIONWIDGET_H
#include <projectexplorer/deployconfiguration.h>
namespace Qnx {
namespace Internal {
namespace Ui {
class BlackBerryDeployConfigurationWidget;
}
class BlackBerryDeployConfiguration;
class BlackBerryDeployConfigurationWidget : public ProjectExplorer::DeployConfigurationWidget
{
Q_OBJECT
public:
explicit BlackBerryDeployConfigurationWidget(QWidget *parent = 0);
~BlackBerryDeployConfigurationWidget();
void init(ProjectExplorer::DeployConfiguration *dc);
private:
Ui::BlackBerryDeployConfigurationWidget *m_ui;
BlackBerryDeployConfiguration *m_deployConfiguration;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYDEPLOYCONFIGURATIONWIDGET_H

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BlackBerryDeployConfigurationWidget</class>
<widget class="QWidget" name="Qnx::Internal::BlackBerryDeployConfigurationWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>599</width>
<height>213</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Packages to deploy:</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeView" name="deployPackagesView">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="textElideMode">
<enum>Qt::ElideLeft</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,197 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberrydeployinformation.h"
#include "blackberrydeployconfiguration.h"
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4project.h>
#include <qt4projectmanager/qt4nodes.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtprofileinformation.h>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryDeployInformation::BlackBerryDeployInformation(Qt4ProjectManager::Qt4Project *project)
: QAbstractTableModel(project)
, m_project(project)
{
connect(m_project, SIGNAL(buildSystemEvaluated()), this, SLOT(initModel()));
}
int BlackBerryDeployInformation::rowCount(const QModelIndex &parent) const
{
if (parent.isValid())
return 0;
return m_deployInformation.count();
}
int BlackBerryDeployInformation::columnCount(const QModelIndex &parent) const
{
if (parent.isValid())
return 0;
return ColumnCount;
}
QVariant BlackBerryDeployInformation::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if (index.row() >= m_deployInformation.count() || index.column() >= ColumnCount)
return QVariant();
BarPackageDeployInformation di = m_deployInformation[index.row()];
if (role == Qt::CheckStateRole) {
if (index.column() == EnabledColumn)
return di.enabled ? Qt::Checked : Qt::Unchecked;
} else if (role == Qt::DisplayRole || role == Qt::EditRole) {
if (index.column() == AppDescriptorColumn)
return di.appDescriptorPath;
else if (index.column() == PackageColumn)
return di.packagePath;
}
return QVariant();
}
QVariant BlackBerryDeployInformation::headerData(int section, Qt::Orientation orientation, int role) const
{
if (orientation == Qt::Vertical || role != Qt::DisplayRole)
return QVariant();
switch (section) {
case EnabledColumn:
return tr("Enabled");
case AppDescriptorColumn:
return tr("Application descriptor file");
case PackageColumn:
return tr("Package");
default:
return QVariant();
}
}
bool BlackBerryDeployInformation::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (!index.isValid())
return false;
if (index.row() >= m_deployInformation.count() || index.column() >= ColumnCount)
return false;
BarPackageDeployInformation &di = m_deployInformation[index.row()];
if (role == Qt::CheckStateRole && index.column() == EnabledColumn) {
di.enabled = static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked;
} else if (role == Qt::EditRole) {
if (index.column() == AppDescriptorColumn)
di.appDescriptorPath = value.toString();
else if (index.column() == PackageColumn)
di.packagePath = value.toString();
}
emit dataChanged(index, index);
return true;
}
Qt::ItemFlags BlackBerryDeployInformation::flags(const QModelIndex &index) const
{
Qt::ItemFlags flags = QAbstractTableModel::flags(index);
switch (index.column()) {
case EnabledColumn:
flags |= Qt::ItemIsEditable | Qt::ItemIsUserCheckable;
break;
case AppDescriptorColumn:
case PackageColumn:
flags |= Qt::ItemIsEditable;
break;
}
return flags;
}
QList<BarPackageDeployInformation> BlackBerryDeployInformation::enabledPackages() const
{
QList<BarPackageDeployInformation> result;
foreach (const BarPackageDeployInformation& info, m_deployInformation) {
if (info.enabled)
result << info;
}
return result;
}
void BlackBerryDeployInformation::initModel()
{
ProjectExplorer::Target *target = m_project->activeTarget();
if (!target
|| !target->activeDeployConfiguration()
|| !qobject_cast<BlackBerryDeployConfiguration *>(target->activeDeployConfiguration()))
return;
QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile());
if (!version || !version->isValid()) {
beginResetModel();
m_deployInformation.clear();
endResetModel();
return;
}
const Qt4ProjectManager::Qt4ProFileNode *const rootNode = m_project->rootQt4ProjectNode();
if (!rootNode || rootNode->parseInProgress()) // Can be null right after project creation by wizard.
return;
disconnect(m_project, SIGNAL(buildSystemEvaluated()), this, SLOT(initModel()));
beginResetModel();
m_deployInformation.clear();
QList<Qt4ProjectManager::Qt4ProFileNode *> appNodes = m_project->applicationProFiles();
foreach (Qt4ProjectManager::Qt4ProFileNode *node, appNodes) {
Qt4ProjectManager::TargetInformation ti = node->targetInformation();
QFileInfo fi(node->path());
const QString appDescriptorPath = QDir::toNativeSeparators(fi.absolutePath() + QLatin1String("/bar-descriptor.xml"));
QString barPackagePath;
if (!ti.buildDir.isEmpty())
barPackagePath = QDir::toNativeSeparators(ti.buildDir + QLatin1Char('/') + ti.target + QLatin1String(".bar"));
m_deployInformation << BarPackageDeployInformation(true, appDescriptorPath, barPackagePath, node->path());
}
endResetModel();
connect(m_project, SIGNAL(buildSystemEvaluated()), SLOT(initModel()));
}

View File

@@ -0,0 +1,99 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYDEPLOYINFORMATION_H
#define QNX_INTERNAL_BLACKBERRYDEPLOYINFORMATION_H
#include <QAbstractTableModel>
namespace Qt4ProjectManager {
class Qt4Project;
}
namespace Qnx {
namespace Internal {
class BarPackageDeployInformation {
public:
BarPackageDeployInformation(bool enabled, QString appDescriptorPath, QString packagePath, QString proFilePath)
: enabled(enabled)
, appDescriptorPath(appDescriptorPath)
, packagePath(packagePath)
, proFilePath(proFilePath)
{
}
bool enabled;
QString appDescriptorPath;
QString packagePath;
QString proFilePath;
};
class BlackBerryDeployInformation : public QAbstractTableModel
{
Q_OBJECT
public:
explicit BlackBerryDeployInformation(Qt4ProjectManager::Qt4Project *project);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
Qt::ItemFlags flags(const QModelIndex &index) const;
QList<BarPackageDeployInformation> enabledPackages() const;
private slots:
void initModel();
private:
enum Columns {
EnabledColumn = 0,
AppDescriptorColumn,
PackageColumn,
ColumnCount // Always have last
};
Qt4ProjectManager::Qt4Project *m_project;
QList<BarPackageDeployInformation> m_deployInformation;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYDEPLOYINFORMATION_H

View File

@@ -0,0 +1,193 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberrydeploystep.h"
#include "qnxconstants.h"
#include "blackberrydeployconfiguration.h"
#include "blackberrydeploystepconfigwidget.h"
#include "qnxutils.h"
#include "blackberrydeployinformation.h"
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <utils/qtcassert.h>
#include <QDir>
using namespace Qnx;
using namespace Qnx::Internal;
namespace {
const char DEPLOY_CMD[] = "blackberry-deploy";
int parseProgress(const QString &line)
{
const QString startOfLine = QLatin1String("Info: Progress ");
if (!line.startsWith(startOfLine))
return -1;
const int percentPos = line.indexOf(QLatin1Char('%'));
const QString progressStr = line.mid(startOfLine.length(), percentPos - startOfLine.length());
bool ok;
const int progress = progressStr.toInt(&ok);
if (!ok)
return -1;
return progress;
}
}
BlackBerryDeployStep::BlackBerryDeployStep(ProjectExplorer::BuildStepList *bsl)
: BlackBerryAbstractDeployStep(bsl, Core::Id(Constants::QNX_DEPLOY_PACKAGE_BS_ID))
{
setDisplayName(tr("Deploy packages"));
}
BlackBerryDeployStep::BlackBerryDeployStep(ProjectExplorer::BuildStepList *bsl, BlackBerryDeployStep *bs)
: BlackBerryAbstractDeployStep(bsl, bs)
{
setDisplayName(tr("Deploy packages"));
}
BlackBerryDeployStep::~BlackBerryDeployStep()
{
}
bool BlackBerryDeployStep::init()
{
if (!BlackBerryAbstractDeployStep::init())
return false;
QString deployCmd = target()->activeBuildConfiguration()->environment().searchInPath(QLatin1String(DEPLOY_CMD));
if (deployCmd.isEmpty()) {
raiseError(tr("Could not find deploy command '%1' in the build environment")
.arg(QLatin1String(DEPLOY_CMD)));
return false;
}
if (deviceHost().isEmpty()) {
raiseError(tr("No hostname specified for device"));
return false;
}
BlackBerryDeployConfiguration *deployConfig = qobject_cast<BlackBerryDeployConfiguration *>(deployConfiguration());
QTC_ASSERT(deployConfig, return false);
QList<BarPackageDeployInformation> packagesToDeploy = deployConfig->deploymentInfo()->enabledPackages();
if (packagesToDeploy.isEmpty()) {
raiseError(tr("No packages enabled for deployment"));
return false;
}
foreach (const BarPackageDeployInformation &info, packagesToDeploy) {
QStringList args;
args << QLatin1String("-installApp");
args << QLatin1String("-device") << deviceHost();
if (!password().isEmpty())
args << QLatin1String("-password") << password();
args << QnxUtils::addQuotes(QDir::toNativeSeparators(info.packagePath));
addCommand(deployCmd, args);
}
return true;
}
void BlackBerryDeployStep::run(QFutureInterface<bool> &fi)
{
BlackBerryDeployConfiguration *deployConfig = qobject_cast<BlackBerryDeployConfiguration *>(deployConfiguration());
QTC_ASSERT(deployConfig, return);
QList<BarPackageDeployInformation> packagesToDeploy = deployConfig->deploymentInfo()->enabledPackages();
foreach (const BarPackageDeployInformation &info, packagesToDeploy) {
if (!QFileInfo(info.packagePath).exists()) {
raiseError(tr("Package '%1' does not exist. Create the package first.").arg(info.packagePath));
fi.reportResult(false);
return;
}
}
BlackBerryAbstractDeployStep::run(fi);
}
void BlackBerryDeployStep::cleanup()
{
}
void BlackBerryDeployStep::stdOutput(const QString &line)
{
const int progress = parseProgress(line);
if (progress > -1)
reportProgress(progress);
BlackBerryAbstractDeployStep::stdOutput(line);
}
void BlackBerryDeployStep::processStarted(const ProjectExplorer::ProcessParameters &params)
{
QString arguments = params.prettyArguments();
if (!password().isEmpty()) {
const QString passwordLine = QLatin1String(" -password ") + password();
const QString hiddenPasswordLine = QLatin1String(" -password <hidden>");
arguments.replace(passwordLine, hiddenPasswordLine);
}
emitOutputInfo(params, arguments);
}
ProjectExplorer::BuildStepConfigWidget *BlackBerryDeployStep::createConfigWidget()
{
return new BlackBerryDeployStepConfigWidget();
}
QString BlackBerryDeployStep::deviceHost() const
{
BlackBerryDeployConfiguration *dc = static_cast<BlackBerryDeployConfiguration *>(deployConfiguration());
return dc->deviceHost();
}
QString BlackBerryDeployStep::password() const
{
BlackBerryDeployConfiguration *dc = static_cast<BlackBerryDeployConfiguration *>(deployConfiguration());
return dc->password();
}
void BlackBerryDeployStep::raiseError(const QString &errorMessage)
{
emit addOutput(errorMessage, BuildStep::ErrorMessageOutput);
emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error, errorMessage, Utils::FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
}

View File

@@ -0,0 +1,73 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYDEPLOYSTEP_H
#define QNX_INTERNAL_BLACKBERRYDEPLOYSTEP_H
#include "blackberryabstractdeploystep.h"
namespace Qnx {
namespace Internal {
class BlackBerryDeployStep : public BlackBerryAbstractDeployStep
{
Q_OBJECT
friend class BlackBerryDeployStepFactory;
public:
explicit BlackBerryDeployStep(ProjectExplorer::BuildStepList *bsl);
~BlackBerryDeployStep();
bool init();
void run(QFutureInterface<bool> &fi);
void cleanup();
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
protected:
BlackBerryDeployStep(ProjectExplorer::BuildStepList *bsl, BlackBerryDeployStep *bs);
void stdOutput(const QString &line);
void processStarted(const ProjectExplorer::ProcessParameters &params);
void raiseError(const QString &errorMessage);
private:
QString deviceHost() const;
QString password() const;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYDEPLOYSTEP_H

View File

@@ -0,0 +1,57 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberrydeploystepconfigwidget.h"
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryDeployStepConfigWidget::BlackBerryDeployStepConfigWidget()
: ProjectExplorer::BuildStepConfigWidget()
{
}
QString BlackBerryDeployStepConfigWidget::summaryText() const
{
return displayName();
}
QString BlackBerryDeployStepConfigWidget::displayName() const
{
return tr("<b>Deploy packages</b>");
}
bool BlackBerryDeployStepConfigWidget::showWidget() const
{
return false;
}

View File

@@ -0,0 +1,57 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYDEPLOYSTEPCONFIGWIDGET_H
#define QNX_INTERNAL_BLACKBERRYDEPLOYSTEPCONFIGWIDGET_H
#include <projectexplorer/buildstep.h>
namespace Qnx {
namespace Internal {
class BlackBerryDeployStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
{
Q_OBJECT
public:
explicit BlackBerryDeployStepConfigWidget();
QString summaryText() const;
QString displayName() const;
bool showWidget() const;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYDEPLOYSTEPCONFIGWIDGET_H

View File

@@ -0,0 +1,113 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberrydeploystepfactory.h"
#include "qnxconstants.h"
#include "blackberrydeploystep.h"
#include "blackberrydeviceconfigurationfactory.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/profileinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryDeployStepFactory::BlackBerryDeployStepFactory()
{
}
QList<Core::Id> BlackBerryDeployStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
{
if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY))
return QList<Core::Id>();
Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(parent->target()->profile());
if (deviceType != BlackBerryDeviceConfigurationFactory::deviceType())
return QList<Core::Id>();
return QList<Core::Id>() << Core::Id(Constants::QNX_DEPLOY_PACKAGE_BS_ID);
}
QString BlackBerryDeployStepFactory::displayNameForId(const Core::Id id) const
{
if (id == Core::Id(Constants::QNX_DEPLOY_PACKAGE_BS_ID))
return tr("Deploy Package");
return QString();
}
bool BlackBerryDeployStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
{
return availableCreationIds(parent).contains(id);
}
ProjectExplorer::BuildStep *BlackBerryDeployStepFactory::create(ProjectExplorer::BuildStepList *parent,
const Core::Id id)
{
if (!canCreate(parent, id))
return 0;
return new BlackBerryDeployStep(parent);
}
bool BlackBerryDeployStepFactory::canRestore(ProjectExplorer::BuildStepList *parent,
const QVariantMap &map) const
{
return canCreate(parent, ProjectExplorer::idFromMap(map));
}
ProjectExplorer::BuildStep *BlackBerryDeployStepFactory::restore(ProjectExplorer::BuildStepList *parent,
const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
BlackBerryDeployStep *bs = new BlackBerryDeployStep(parent);
if (bs->fromMap(map))
return bs;
delete bs;
return 0;
}
bool BlackBerryDeployStepFactory::canClone(ProjectExplorer::BuildStepList *parent,
ProjectExplorer::BuildStep *product) const
{
return canCreate(parent, product->id());
}
ProjectExplorer::BuildStep *BlackBerryDeployStepFactory::clone(ProjectExplorer::BuildStepList *parent,
ProjectExplorer::BuildStep *product)
{
if (!canClone(parent, product))
return 0;
return new BlackBerryDeployStep(parent, static_cast<BlackBerryDeployStep *>(product));
}

View File

@@ -0,0 +1,68 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYDEPLOYSTEPFACTORY_H
#define QNX_INTERNAL_BLACKBERRYDEPLOYSTEPFACTORY_H
#include <projectexplorer/buildstep.h>
namespace Qnx {
namespace Internal {
class BlackBerryDeployStepFactory : public ProjectExplorer::IBuildStepFactory
{
Q_OBJECT
public:
BlackBerryDeployStepFactory();
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
QString displayNameForId(const Core::Id id) const;
bool canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent,
const Core::Id id);
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent,
const QVariantMap &map);
bool canClone(ProjectExplorer::BuildStepList *parent,
ProjectExplorer::BuildStep *product) const;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent,
ProjectExplorer::BuildStep *product);
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYDEPLOYSTEPFACTORY_H

View File

@@ -0,0 +1,134 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberrydeviceconfiguration.h"
#include "qnxconstants.h"
#include "blackberrydeviceconfigurationwidget.h"
#include <projectexplorer/profileinformation.h>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryDeviceConfiguration::BlackBerryDeviceConfiguration()
: RemoteLinux::LinuxDeviceConfiguration()
{
}
BlackBerryDeviceConfiguration::BlackBerryDeviceConfiguration(const QString &name, Core::Id type,
RemoteLinux::LinuxDeviceConfiguration::MachineType machineType,
ProjectExplorer::IDevice::Origin origin, Core::Id id)
: RemoteLinux::LinuxDeviceConfiguration(name, type, machineType, origin, id)
{
}
BlackBerryDeviceConfiguration::BlackBerryDeviceConfiguration(const BlackBerryDeviceConfiguration &other)
: RemoteLinux::LinuxDeviceConfiguration(other)
, m_debugToken(other.m_debugToken)
{
}
BlackBerryDeviceConfiguration::Ptr BlackBerryDeviceConfiguration::create()
{
return Ptr(new BlackBerryDeviceConfiguration);
}
BlackBerryDeviceConfiguration::Ptr BlackBerryDeviceConfiguration::create(const QString &name, Core::Id type,
RemoteLinux::LinuxDeviceConfiguration::MachineType machineType,
ProjectExplorer::IDevice::Origin origin, Core::Id id)
{
return Ptr(new BlackBerryDeviceConfiguration(name, type, machineType, origin, id));
}
QString BlackBerryDeviceConfiguration::debugToken() const
{
return m_debugToken;
}
void BlackBerryDeviceConfiguration::setDebugToken(const QString &debugToken)
{
m_debugToken = debugToken;
}
void BlackBerryDeviceConfiguration::fromMap(const QVariantMap &map)
{
RemoteLinux::LinuxDeviceConfiguration::fromMap(map);
m_debugToken = map.value(QLatin1String(Constants::QNX_DEBUG_TOKEN_KEY)).toString();
}
ProjectExplorer::IDevice::Ptr BlackBerryDeviceConfiguration::clone() const
{
return Ptr(new BlackBerryDeviceConfiguration(*this));
}
BlackBerryDeviceConfiguration::ConstPtr BlackBerryDeviceConfiguration::device(const ProjectExplorer::Profile *p)
{
ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceProfileInformation::device(p);
return dev.dynamicCast<const BlackBerryDeviceConfiguration>();
}
QString BlackBerryDeviceConfiguration::displayType() const
{
return tr("BlackBerry");
}
ProjectExplorer::IDeviceWidget *BlackBerryDeviceConfiguration::createWidget()
{
return new BlackBerryDeviceConfigurationWidget(sharedFromThis()
.staticCast<BlackBerryDeviceConfiguration>());
}
QList<Core::Id> BlackBerryDeviceConfiguration::actionIds() const
{
return QList<Core::Id>();
}
QString BlackBerryDeviceConfiguration::displayNameForActionId(Core::Id actionId) const
{
Q_UNUSED(actionId);
return QString();
}
void BlackBerryDeviceConfiguration::executeAction(Core::Id actionId, QWidget *parent) const
{
Q_UNUSED(actionId);
Q_UNUSED(parent);
}
QVariantMap BlackBerryDeviceConfiguration::toMap() const
{
QVariantMap map = RemoteLinux::LinuxDeviceConfiguration::toMap();
map.insert(QLatin1String(Constants::QNX_DEBUG_TOKEN_KEY), m_debugToken);
return map;
}

View File

@@ -0,0 +1,86 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATION_H
#define QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATION_H
#include <remotelinux/linuxdeviceconfiguration.h>
namespace ProjectExplorer {
class Profile;
}
namespace Qnx {
namespace Internal {
class BlackBerryDeviceConfiguration : public RemoteLinux::LinuxDeviceConfiguration
{
public:
typedef QSharedPointer<BlackBerryDeviceConfiguration> Ptr;
typedef QSharedPointer<const BlackBerryDeviceConfiguration> ConstPtr;
static Ptr create();
static Ptr create(const QString &name, Core::Id type, MachineType machineType,
Origin origin = ManuallyAdded, Core::Id id = Core::Id());
QString debugToken() const;
void setDebugToken(const QString &debugToken);
void fromMap(const QVariantMap &map);
QString displayType() const;
ProjectExplorer::IDeviceWidget *createWidget();
QList<Core::Id> actionIds() const;
QString displayNameForActionId(Core::Id actionId) const;
void executeAction(Core::Id actionId, QWidget *parent) const;
ProjectExplorer::IDevice::Ptr clone() const;
static ConstPtr device(const ProjectExplorer::Profile *p);
protected:
BlackBerryDeviceConfiguration();
BlackBerryDeviceConfiguration(const QString &name, Core::Id type, MachineType machineType,
Origin origin, Core::Id id);
BlackBerryDeviceConfiguration(const BlackBerryDeviceConfiguration &other);
QVariantMap toMap() const;
private:
QString m_debugToken;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATION_H

View File

@@ -0,0 +1,93 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberrydeviceconfigurationfactory.h"
#include "qnxconstants.h"
#include "blackberrydeviceconfigurationwizard.h"
#include "blackberrydeviceconfiguration.h"
#include <utils/qtcassert.h>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryDeviceConfigurationFactory::BlackBerryDeviceConfigurationFactory(QObject *parent) :
ProjectExplorer::IDeviceFactory(parent)
{
}
QString BlackBerryDeviceConfigurationFactory::displayNameForId(Core::Id type) const
{
Q_UNUSED(type);
return tr("BlackBerry Device");
}
QList<Core::Id> BlackBerryDeviceConfigurationFactory::availableCreationIds() const
{
QList<Core::Id> result;
result << Core::Id(Constants::QNX_BB_OS_TYPE);
return result;
}
bool BlackBerryDeviceConfigurationFactory::canCreate() const
{
return true;
}
ProjectExplorer::IDevice::Ptr BlackBerryDeviceConfigurationFactory::create(Core::Id id) const
{
Q_UNUSED(id);
BlackBerryDeviceConfigurationWizard wizard;
if (wizard.exec() != QDialog::Accepted)
return ProjectExplorer::IDevice::Ptr();
return wizard.device();
}
bool BlackBerryDeviceConfigurationFactory::canRestore(const QVariantMap &map) const
{
return ProjectExplorer::IDevice::typeFromMap(map) == Core::Id(Constants::QNX_BB_OS_TYPE);
}
ProjectExplorer::IDevice::Ptr BlackBerryDeviceConfigurationFactory::restore(const QVariantMap &map) const
{
QTC_ASSERT(canRestore(map), return BlackBerryDeviceConfiguration::Ptr());
const BlackBerryDeviceConfiguration::Ptr device = BlackBerryDeviceConfiguration::create();
device->fromMap(map);
return device;
}
Core::Id BlackBerryDeviceConfigurationFactory::deviceType()
{
return Core::Id(Constants::QNX_BB_OS_TYPE);
}

View File

@@ -0,0 +1,63 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONFACTORY_H
#define QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONFACTORY_H
#include <projectexplorer/devicesupport/idevicefactory.h>
namespace Qnx {
namespace Internal {
class BlackBerryDeviceConfigurationFactory : public ProjectExplorer::IDeviceFactory
{
Q_OBJECT
public:
explicit BlackBerryDeviceConfigurationFactory(QObject *parent = 0);
QString displayNameForId(Core::Id type) const;
QList<Core::Id> availableCreationIds() const;
bool canCreate() const;
ProjectExplorer::IDevice::Ptr create(Core::Id id) const;
bool canRestore(const QVariantMap &map) const;
ProjectExplorer::IDevice::Ptr restore(const QVariantMap &map) const;
static Core::Id deviceType();
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONFACTORY_H

View File

@@ -0,0 +1,124 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "blackberrydeviceconfigurationwidget.h"
#include "ui_blackberrydeviceconfigurationwidget.h"
#include "qnxconstants.h"
#include <remotelinux/linuxdeviceconfiguration.h>
#include <ssh/sshconnection.h>
#include <utils/pathchooser.h>
using namespace Qnx::Internal;
BlackBerryDeviceConfigurationWidget::BlackBerryDeviceConfigurationWidget(const ProjectExplorer::IDevice::Ptr &device, QWidget *parent) :
ProjectExplorer::IDeviceWidget(device, parent),
ui(new Ui::BlackBerryDeviceConfigurationWidget)
{
ui->setupUi(this);
connect(ui->hostLineEdit, SIGNAL(editingFinished()), this, SLOT(hostNameEditingFinished()));
connect(ui->pwdLineEdit, SIGNAL(editingFinished()), this, SLOT(passwordEditingFinished()));
connect(ui->keyFileLineEdit, SIGNAL(editingFinished()), this, SLOT(keyFileEditingFinished()));
connect(ui->keyFileLineEdit, SIGNAL(browsingFinished()), this, SLOT(keyFileEditingFinished()));
connect(ui->showPasswordCheckBox, SIGNAL(toggled(bool)), this, SLOT(showPassword(bool)));
connect(ui->debugToken, SIGNAL(editingFinished()), this, SLOT(debugTokenEditingFinished()));
initGui();
}
BlackBerryDeviceConfigurationWidget::~BlackBerryDeviceConfigurationWidget()
{
delete ui;
}
void BlackBerryDeviceConfigurationWidget::hostNameEditingFinished()
{
QSsh::SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
sshParams.host = ui->hostLineEdit->text();
deviceConfiguration()->setSshParameters(sshParams);
}
void BlackBerryDeviceConfigurationWidget::passwordEditingFinished()
{
QSsh::SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
sshParams.password = ui->pwdLineEdit->text();
deviceConfiguration()->setSshParameters(sshParams);
}
void BlackBerryDeviceConfigurationWidget::keyFileEditingFinished()
{
QSsh::SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
sshParams.privateKeyFile = ui->keyFileLineEdit->path();
deviceConfiguration()->setSshParameters(sshParams);
}
void BlackBerryDeviceConfigurationWidget::showPassword(bool showClearText)
{
ui->pwdLineEdit->setEchoMode(showClearText
? QLineEdit::Normal : QLineEdit::Password);
}
void BlackBerryDeviceConfigurationWidget::debugTokenEditingFinished()
{
deviceConfiguration()->setDebugToken(ui->debugToken->path());
}
void BlackBerryDeviceConfigurationWidget::initGui()
{
ui->debugToken->setExpectedKind(Utils::PathChooser::File);
ui->debugToken->setPromptDialogFilter(QLatin1String("*.bar"));
ui->keyFileLineEdit->setExpectedKind(Utils::PathChooser::File);
ui->keyFileLineEdit->lineEdit()->setMinimumWidth(0);
const QSsh::SshConnectionParameters &sshParams = deviceConfiguration()->sshParameters();
ui->hostLineEdit->setEnabled(!deviceConfiguration()->isAutoDetected());
ui->hostLineEdit->setText(sshParams.host);
ui->pwdLineEdit->setText(sshParams.password);
ui->keyFileLineEdit->setPath(sshParams.privateKeyFile);
ui->showPasswordCheckBox->setChecked(false);
ui->debugToken->setPath(deviceConfiguration()->debugToken());
if (deviceConfiguration()->machineType() == RemoteLinux::LinuxDeviceConfiguration::Emulator) {
ui->debugToken->setEnabled(false);
ui->debugTokenLabel->setEnabled(false);
}
}
BlackBerryDeviceConfiguration::Ptr BlackBerryDeviceConfigurationWidget::deviceConfiguration() const
{
return device().dynamicCast<BlackBerryDeviceConfiguration>();
}

View File

@@ -0,0 +1,76 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 - 2012 Research In Motion
**
** Contact: Research In Motion (blackberry-qt@qnx.com)
** Contact: KDAB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIDGET_H
#define QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIDGET_H
#include <projectexplorer/devicesupport/idevicewidget.h>
#include "blackberrydeviceconfiguration.h"
namespace Qnx {
namespace Internal {
namespace Ui {
class BlackBerryDeviceConfigurationWidget;
}
class BlackBerryDeviceConfigurationWidget : public ProjectExplorer::IDeviceWidget
{
Q_OBJECT
public:
explicit BlackBerryDeviceConfigurationWidget(const ProjectExplorer::IDevice::Ptr &device,
QWidget *parent = 0);
~BlackBerryDeviceConfigurationWidget();
private slots:
void hostNameEditingFinished();
void passwordEditingFinished();
void keyFileEditingFinished();
void showPassword(bool showClearText);
void debugTokenEditingFinished();
private:
void initGui();
BlackBerryDeviceConfiguration::Ptr deviceConfiguration() const;
Ui::BlackBerryDeviceConfigurationWidget *ui;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIDGET_H

View File

@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BlackBerryDeviceConfigurationWidget</class>
<widget class="QWidget" name="Qnx::Internal::BlackBerryDeviceConfigurationWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>334</width>
<height>109</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::FieldsStayAtSizeHint</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="hostNameLabel">
<property name="text">
<string>&amp;Device name:</string>
</property>
<property name="buddy">
<cstring>hostLineEdit</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="hostLineEdit">
<property name="placeholderText">
<string>IP or host name of the device</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="passwordLabel">
<property name="text">
<string>Device &amp;password</string>
</property>
<property name="buddy">
<cstring>pwdLineEdit</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLineEdit" name="pwdLineEdit">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showPasswordCheckBox">
<property name="text">
<string>Show password</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="debugTokenLabel">
<property name="text">
<string>Debug token:</string>
</property>
<property name="buddy">
<cstring>debugToken</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Utils::PathChooser" name="debugToken" native="true"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="keyLabel">
<property name="text">
<string>Private key file:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Utils::PathChooser" name="keyFileLineEdit" native="true"/>
</item>
</layout>
<zorder>hostNameLabel</zorder>
<zorder>hostLineEdit</zorder>
<zorder>passwordLabel</zorder>
<zorder>keyLabel</zorder>
<zorder>debugTokenLabel</zorder>
<zorder>debugToken</zorder>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
<slots>
<signal>editingFinished()</signal>
<signal>browsingFinished()</signal>
</slots>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

Some files were not shown because too many files have changed in this diff Show More