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

View File

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

View File

@@ -170,11 +170,17 @@ void GdbRemoteServerEngine::setupInferior()
#else
#define PATHSEP ":"
#endif
QString fileName;
QString executableFileName;
if (!sp.executable.isEmpty()) {
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 remoteArch = sp.remoteArchitecture.toLatin1();
//const QByteArray gnuTarget = sp.gnuTarget.toLatin1();
@@ -213,14 +219,21 @@ void GdbRemoteServerEngine::setupInferior()
if (debuggerCore()->boolSetting(TargetAsync))
postCommand("set target-async on", CB(handleSetTargetAsync));
if (fileName.isEmpty()) {
if (executableFileName.isEmpty() && symbolFileName.isEmpty()) {
showMessage(tr("No symbol file given."), StatusBar);
callTargetRemote();
return;
}
postCommand("-file-exec-and-symbols \"" + fileName.toLocal8Bit() + '"',
CB(handleFileExecAndSymbols));
if (!symbolFileName.isEmpty()) {
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)
@@ -302,7 +315,7 @@ void GdbRemoteServerEngine::handleTargetQnx(const GdbResponse &response)
showMessage(_("INFERIOR STARTED"));
showMessage(msgAttachedToStoppedInferior(), StatusBar);
const qint64 pid = startParameters().attachPID;
const qint64 pid = isMasterEngine() ? startParameters().attachPID : masterEngine()->startParameters().attachPID;
if (pid > -1) {
postCommand("attach " + QByteArray::number(pid), CB(handleAttach));
} else {
@@ -342,8 +355,28 @@ void GdbRemoteServerEngine::handleAttach(const GdbResponse &response)
void GdbRemoteServerEngine::runEngine()
{
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()

View File

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

View File

@@ -45,7 +45,8 @@ SUBDIRS = plugin_coreplugin \
plugin_android \
plugin_madde \
plugin_valgrind \
plugin_todo
plugin_todo \
plugin_qnx
isEmpty(IDE_PACKAGE_MODE) {
SUBDIRS += plugin_helloworld \
@@ -322,3 +323,9 @@ plugin_todo.depends = plugin_coreplugin
plugin_todo.depends += plugin_projectexplorer
plugin_todo.depends += plugin_texteditor
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;
virtual QList<Utils::FileName> suggestedMkspecList() const { return QList<Utils::FileName>(); }
Utils::FileName suggestedDebugger();
virtual Utils::FileName suggestedDebugger();
virtual QString type() 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>

View File

@@ -0,0 +1,141 @@
/**************************************************************************
**
** 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 "blackberrydeviceconfigurationwizard.h"
#include "blackberrydeviceconfigurationwizardpages.h"
#include "qnxconstants.h"
#include "blackberrydeviceconfiguration.h"
#include <ssh/sshconnection.h>
#include <ssh/sshkeygenerator.h>
#include <utils/portlist.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <QDir>
#include <QFileInfo>
#include <QMessageBox>
#include <QHostInfo>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryDeviceConfigurationWizard::BlackBerryDeviceConfigurationWizard(QWidget *parent) :
QWizard(parent)
{
setWindowTitle(tr("New BlackBerry Device Configuration Setup"));
m_setupPage = new BlackBerryDeviceConfigurationWizardSetupPage(this);
m_sshKeyPage = new BlackBerryDeviceConfigurationWizardSshKeyPage(this);
m_finalPage = new BlackBerryDeviceConfigurationWizardFinalPage(this);
setPage(SetupPageId, m_setupPage);
setPage(SshKeyPageId, m_sshKeyPage);
setPage(FinalPageId, m_finalPage);
m_finalPage->setCommitPage(true);
}
ProjectExplorer::IDevice::Ptr BlackBerryDeviceConfigurationWizard::device()
{
QSsh::SshConnectionParameters sshParams;
sshParams.proxyType = QSsh::SshConnectionParameters::NoProxy;
sshParams.host = m_setupPage->hostName();
sshParams.password = m_setupPage->password();
sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationByKey;
sshParams.privateKeyFile = m_sshKeyPage->privateKey();
sshParams.userName = QLatin1String("devuser");
sshParams.timeout = 10;
sshParams.port = 22;
BlackBerryDeviceConfiguration::Ptr configuration = BlackBerryDeviceConfiguration::create(m_setupPage->deviceName(),
Core::Id(Constants::QNX_BB_OS_TYPE),
m_setupPage->machineType());
configuration->setSshParameters(sshParams);
configuration->setDebugToken(m_setupPage->debugToken());
return configuration;
}
void BlackBerryDeviceConfigurationWizard::accept()
{
if (m_sshKeyPage->isGenerated()) {
if (saveKeys()) {
QWizard::accept();
}
} else {
QWizard::accept();
}
}
bool BlackBerryDeviceConfigurationWizard::saveKeys()
{
const QString privKeyPath = m_sshKeyPage->privateKey();
const QString pubKeyPath = m_sshKeyPage->publicKey();
const QString storeLocation = QFileInfo(privKeyPath).absolutePath();
if (!QDir::root().mkpath(storeLocation)) {
QMessageBox::critical(this, tr("Failure to Save Key File"),
tr("Failed to create directory: '%1'.").arg(storeLocation));
return false;
}
if (QFileInfo(privKeyPath).exists()) {
QMessageBox::critical(this, tr("Failure to Save Key File"),
tr("Private key file already exists: '%1'").arg(privKeyPath));
return false;
}
if (QFileInfo(pubKeyPath).exists()) {
QMessageBox::critical(this, tr("Failure to Save Key File"),
tr("Public key file already exists: '%1'").arg(pubKeyPath));
return false;
}
Utils::FileSaver privSaver(privKeyPath);
privSaver.write(m_sshKeyPage->keyGenerator()->privateKey());
if (!privSaver.finalize(this))
return false; // finalize shows an error message if necessary
QFile::setPermissions(privKeyPath, QFile::ReadOwner | QFile::WriteOwner);
Utils::FileSaver pubSaver(pubKeyPath);
// blackberry-connect requires an @ character to be included in the RSA comment
const QString atHost = QLatin1String("@") + QHostInfo::localHostName();
QByteArray pubKeyContent = m_sshKeyPage->keyGenerator()->publicKey();
pubKeyContent.append(atHost.toLocal8Bit());
pubSaver.write(pubKeyContent);
if (!pubSaver.finalize(this)) {
return false;
}
return true;
}

View File

@@ -0,0 +1,75 @@
/**************************************************************************
**
** 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_BLACKBERRYDEVICECONFIGURATIONWIZARD_H
#define QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIZARD_H
#include <QWizard>
#include <projectexplorer/devicesupport/idevice.h>
namespace Qnx {
namespace Internal {
class BlackBerryDeviceConfigurationWizardSetupPage;
class BlackBerryDeviceConfigurationWizardSshKeyPage;
class BlackBerryDeviceConfigurationWizardFinalPage;
class BlackBerryDeviceConfigurationWizard : public QWizard
{
Q_OBJECT
public:
explicit BlackBerryDeviceConfigurationWizard(QWidget *parent = 0);
ProjectExplorer::IDevice::Ptr device();
void accept();
private:
enum PageId {
SetupPageId,
SshKeyPageId,
FinalPageId
};
bool saveKeys();
BlackBerryDeviceConfigurationWizardSetupPage *m_setupPage;
BlackBerryDeviceConfigurationWizardSshKeyPage *m_sshKeyPage;
BlackBerryDeviceConfigurationWizardFinalPage *m_finalPage;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIZARD_H

View File

@@ -0,0 +1,228 @@
/**************************************************************************
**
** 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 "blackberrydeviceconfigurationwizardpages.h"
#include "ui_blackberrydeviceconfigurationwizardsetuppage.h"
#include "ui_blackberrydeviceconfigurationwizardsshkeypage.h"
#include <coreplugin/icore.h>
#include <ssh/sshkeygenerator.h>
#include <QFormLayout>
#include <QMessageBox>
using namespace Qnx;
using namespace Qnx::Internal;
namespace {
const char DEVICENAME_FIELD_ID[] = "DeviceName";
}
BlackBerryDeviceConfigurationWizardSetupPage::BlackBerryDeviceConfigurationWizardSetupPage(QWidget *parent)
: QWizardPage(parent)
, m_ui(new Ui::BlackBerryDeviceConfigurationWizardSetupPage)
{
m_ui->setupUi(this);
setTitle(tr("Connection Details"));
m_ui->debugToken->setExpectedKind(Utils::PathChooser::File);
m_ui->debugToken->setPromptDialogFilter(QLatin1String("*.bar"));
connect(m_ui->deviceName, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
connect(m_ui->deviceHostIp, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
connect(m_ui->physicalDevice, SIGNAL(toggled(bool)), this, SIGNAL(completeChanged()));
connect(m_ui->debugToken, SIGNAL(changed(QString)), this, SIGNAL(completeChanged()));
registerField(QLatin1String(DEVICENAME_FIELD_ID), m_ui->deviceName);
}
BlackBerryDeviceConfigurationWizardSetupPage::~BlackBerryDeviceConfigurationWizardSetupPage()
{
delete m_ui;
m_ui = 0;
}
void BlackBerryDeviceConfigurationWizardSetupPage::initializePage()
{
m_ui->deviceName->setText(tr("BlackBerry Device"));
m_ui->deviceHostIp->setText(QString());
m_ui->password->setText(QString());
m_ui->physicalDevice->setChecked(true);
}
bool BlackBerryDeviceConfigurationWizardSetupPage::isComplete() const
{
bool debugTokenComplete = m_ui->simulator->isChecked()
|| (m_ui->physicalDevice->isChecked() && !m_ui->debugToken->fileName().isEmpty()
&& QFileInfo(m_ui->debugToken->fileName().toString()).exists());
return !m_ui->deviceHostIp->text().isEmpty() && !m_ui->deviceHostIp->text().isEmpty()
&& debugTokenComplete;
}
QString BlackBerryDeviceConfigurationWizardSetupPage::deviceName() const
{
return m_ui->deviceName->text();
}
QString BlackBerryDeviceConfigurationWizardSetupPage::hostName() const
{
return m_ui->deviceHostIp->text();
}
QString BlackBerryDeviceConfigurationWizardSetupPage::password() const
{
return m_ui->password->text();
}
QString BlackBerryDeviceConfigurationWizardSetupPage::debugToken() const
{
return m_ui->debugToken->fileName().toString();
}
RemoteLinux::LinuxDeviceConfiguration::MachineType BlackBerryDeviceConfigurationWizardSetupPage::machineType() const
{
if (m_ui->physicalDevice->isChecked())
return RemoteLinux::LinuxDeviceConfiguration::Hardware;
else
return RemoteLinux::LinuxDeviceConfiguration::Emulator;
}
// ----------------------------------------------------------------------------
BlackBerryDeviceConfigurationWizardSshKeyPage::BlackBerryDeviceConfigurationWizardSshKeyPage(QWidget *parent)
: QWizardPage(parent)
, m_ui(new Ui::BlackBerryDeviceConfigurationWizardSshKeyPage)
, m_keyGen(0)
, m_isGenerated(false)
{
m_ui->setupUi(this);
m_ui->privateKey->setExpectedKind(Utils::PathChooser::File);
setTitle(tr("SSH Key Setup"));
setSubTitle(tr("Please select an existing <b>4096</b>-bit key or click <b>Generate</b> to create a new one."));
connect(m_ui->privateKey, SIGNAL(changed(QString)), this, SLOT(findMatchingPublicKey(QString)));
connect(m_ui->privateKey, SIGNAL(changed(QString)), this, SIGNAL(completeChanged()));
connect(m_ui->generate, SIGNAL(clicked()), this, SLOT(generateSshKey()));
}
BlackBerryDeviceConfigurationWizardSshKeyPage::~BlackBerryDeviceConfigurationWizardSshKeyPage()
{
delete m_ui;
m_ui = 0;
delete m_keyGen;
m_keyGen = 0;
}
void BlackBerryDeviceConfigurationWizardSshKeyPage::initializePage()
{
}
bool BlackBerryDeviceConfigurationWizardSshKeyPage::isComplete() const
{
QFileInfo privateKeyFi(m_ui->privateKey->fileName().toString());
QFileInfo publicKeyFi(m_ui->publicKey->text());
return (privateKeyFi.exists() && publicKeyFi.exists()) || m_isGenerated;
}
QString BlackBerryDeviceConfigurationWizardSshKeyPage::privateKey() const
{
return m_ui->privateKey->fileName().toString();
}
QString BlackBerryDeviceConfigurationWizardSshKeyPage::publicKey() const
{
return m_ui->publicKey->text();
}
bool BlackBerryDeviceConfigurationWizardSshKeyPage::isGenerated() const
{
return m_isGenerated;
}
QSsh::SshKeyGenerator *BlackBerryDeviceConfigurationWizardSshKeyPage::keyGenerator() const
{
return m_keyGen;
}
void BlackBerryDeviceConfigurationWizardSshKeyPage::findMatchingPublicKey(const QString &privateKeyPath)
{
const QString candidate = privateKeyPath + QLatin1String(".pub");
if (QFileInfo(candidate).exists())
m_ui->publicKey->setText(candidate);
}
void BlackBerryDeviceConfigurationWizardSshKeyPage::generateSshKey()
{
if (!m_keyGen)
m_keyGen = new QSsh::SshKeyGenerator;
const bool success = m_keyGen->generateKeys(QSsh::SshKeyGenerator::Rsa,
QSsh::SshKeyGenerator::Mixed, 4096,
QSsh::SshKeyGenerator::DoNotOfferEncryption);
if (!success) {
QMessageBox::critical(this, tr("Key Generation Failed"), m_keyGen->error());
m_isGenerated = false;
return;
}
m_isGenerated = true;
const QString storeLocation = Core::ICore::userResourcePath() + QLatin1String("/qnx/")
+ field(QLatin1String(DEVICENAME_FIELD_ID)).toString();
const QString privKeyPath = storeLocation + QLatin1String("/id_rsa");
const QString pubKeyPath = storeLocation + QLatin1String("/id_rsa.pub");
m_ui->privateKey->setFileName(Utils::FileName::fromString(privKeyPath));
m_ui->publicKey->setText(pubKeyPath);
m_ui->privateKey->setEnabled(false);
}
// ----------------------------------------------------------------------------
BlackBerryDeviceConfigurationWizardFinalPage::BlackBerryDeviceConfigurationWizardFinalPage(QWidget *parent)
: QWizardPage(parent)
{
setTitle(tr("Setup Finished"));
QVBoxLayout *layout = new QVBoxLayout(this);
QLabel *label = new QLabel(tr("The new device configuration will now be created."), this);
layout->addWidget(label);
}

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.
**
**************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIZARDPAGES_H
#define QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIZARDPAGES_H
#include <remotelinux/linuxdeviceconfiguration.h>
#include <QWizardPage>
namespace QSsh {
class SshKeyGenerator;
}
namespace Qnx {
namespace Internal {
namespace Ui {
class BlackBerryDeviceConfigurationWizardSetupPage;
class BlackBerryDeviceConfigurationWizardSshKeyPage;
}
class BlackBerryDeviceConfigurationWizardSetupPage : public QWizardPage
{
Q_OBJECT
public:
explicit BlackBerryDeviceConfigurationWizardSetupPage(QWidget *parent = 0);
~BlackBerryDeviceConfigurationWizardSetupPage();
void initializePage();
bool isComplete() const;
QString deviceName() const;
QString hostName() const;
QString password() const;
QString debugToken() const;
RemoteLinux::LinuxDeviceConfiguration::MachineType machineType() const;
private:
Ui::BlackBerryDeviceConfigurationWizardSetupPage *m_ui;
};
class BlackBerryDeviceConfigurationWizardSshKeyPage : public QWizardPage
{
Q_OBJECT
public:
explicit BlackBerryDeviceConfigurationWizardSshKeyPage(QWidget *parent = 0);
~BlackBerryDeviceConfigurationWizardSshKeyPage();
void initializePage();
bool isComplete() const;
QString privateKey() const;
QString publicKey() const;
bool isGenerated() const;
QSsh::SshKeyGenerator *keyGenerator() const;
private slots:
void findMatchingPublicKey(const QString &privateKeyPath);
void generateSshKey();
private:
void saveKeys();
Ui::BlackBerryDeviceConfigurationWizardSshKeyPage *m_ui;
QSsh::SshKeyGenerator *m_keyGen;
bool m_isGenerated;
};
class BlackBerryDeviceConfigurationWizardFinalPage : public QWizardPage
{
Q_OBJECT
public:
explicit BlackBerryDeviceConfigurationWizardFinalPage(QWidget *parent = 0);
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIZARDPAGES_H

View File

@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BlackBerryDeviceConfigurationWizardSetupPage</class>
<widget class="QWizardPage" name="Qnx::Internal::BlackBerryDeviceConfigurationWizardSetupPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>546</width>
<height>148</height>
</rect>
</property>
<property name="windowTitle">
<string>WizardPage</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>The name to identify this configuration:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="deviceName"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>The device's host name or IP address:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="deviceHostIp"/>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Device password:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="password">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Device type:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QRadioButton" name="physicalDevice">
<property name="text">
<string>Physical device</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="simulator">
<property name="text">
<string>Simulator</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Debug token:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="Utils::PathChooser" name="debugToken" native="true"/>
</item>
</layout>
</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>
<connection>
<sender>physicalDevice</sender>
<signal>toggled(bool)</signal>
<receiver>debugToken</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>271</x>
<y>98</y>
</hint>
<hint type="destinationlabel">
<x>226</x>
<y>124</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BlackBerryDeviceConfigurationWizardSshKeyPage</class>
<widget class="QWizardPage" name="Qnx::Internal::BlackBerryDeviceConfigurationWizardSshKeyPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>413</width>
<height>88</height>
</rect>
</property>
<property name="windowTitle">
<string>WizardPage</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Private key file:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="privateKey" native="true"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Public key file:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="generate">
<property name="text">
<string>Generate</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="publicKey">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
<slots>
<signal>editingFinished()</signal>
<signal>browsingFinished()</signal>
</slots>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,176 @@
/**************************************************************************
**
** 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 "blackberryqtversion.h"
#include "qnxconstants.h"
#include <utils/qtcassert.h>
#include <QTextStream>
using namespace Qnx;
using namespace Qnx::Internal;
namespace {
QMultiMap<QString, QString> parseEnvironmentFile(const QString &fileName)
{
QMultiMap<QString, QString> result;
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly))
return result;
QTextStream str(&file);
QMap<QString, QString> fileContent;
while (!str.atEnd()) {
QString line = str.readLine();
if (!line.contains(QLatin1Char('=')))
continue;
const QStringList lineContent = line.split(QLatin1Char('='));
QString var = lineContent.value(0);
//Remove set in front
if (var.startsWith(QLatin1String("set ")))
var = var.right(var.size() - 4);
QString value = lineContent.value(1).section(QLatin1Char('"'), 0, -1, QString::SectionSkipEmpty);
fileContent[var] = value;
}
file.close();
QMapIterator<QString, QString> it(fileContent);
while (it.hasNext()) {
it.next();
#if defined Q_OS_WIN
QStringList values = it.value().split(QLatin1Char(';'));
#elif defined Q_OS_UNIX
QStringList values = it.value().split(QLatin1Char(':'));
#endif
QString key = it.key();
foreach (const QString &value, values) {
const QString ownKeyAsWindowsVar = QLatin1Char('%') + key + QLatin1Char('%');
const QString ownKeyAsUnixVar = QLatin1Char('$') + key;
if (!value.contains(ownKeyAsWindowsVar) && !value.contains(ownKeyAsUnixVar)) {
QString val = value;
if (val.contains(QLatin1Char('%')) || val.contains(QLatin1Char('$'))) {
QMapIterator<QString, QString> replaceIt(fileContent);
while (replaceIt.hasNext()) {
replaceIt.next();
const QString replaceKey = replaceIt.key();
if (replaceKey == key)
continue;
const QString keyAsWindowsVar = QLatin1Char('%') + replaceKey + QLatin1Char('%');
const QString keyAsUnixVar = QLatin1Char('$') + replaceKey;
if (val.contains(keyAsWindowsVar))
val.replace(keyAsWindowsVar, replaceIt.value());
if (val.contains(keyAsUnixVar))
val.replace(keyAsUnixVar, replaceIt.value());
}
}
result.insert(key, val);
}
}
}
return result;
}
}
BlackBerryQtVersion::BlackBerryQtVersion()
: QnxAbstractQtVersion()
{
}
BlackBerryQtVersion::BlackBerryQtVersion(QnxArchitecture arch, const Utils::FileName &path, bool isAutoDetected, const QString &autoDetectionSource)
: QnxAbstractQtVersion(arch, path, isAutoDetected, autoDetectionSource)
{
}
BlackBerryQtVersion::~BlackBerryQtVersion()
{
}
BlackBerryQtVersion *BlackBerryQtVersion::clone() const
{
return new BlackBerryQtVersion(*this);
}
QString BlackBerryQtVersion::type() const
{
return QLatin1String(Constants::QNX_BB_QT);
}
QString BlackBerryQtVersion::description() const
{
return QCoreApplication::translate("QtVersion", "BlackBerry %1", "Qt Version is meant for BlackBerry").arg(archString());
}
QMultiMap<QString, QString> BlackBerryQtVersion::environment() const
{
QTC_CHECK(!sdkPath().isEmpty());
if (sdkPath().isEmpty())
return QMultiMap<QString, QString>();
#if defined Q_OS_WIN
const QString envFile = sdkPath() + QLatin1String("/bbndk-env.bat");
#elif defined Q_OS_UNIX
const QString envFile = sdkPath() + QLatin1String("/bbndk-env.sh");
#endif
return parseEnvironmentFile(envFile);
}
Core::FeatureSet BlackBerryQtVersion::availableFeatures() const
{
Core::FeatureSet features = QnxAbstractQtVersion::availableFeatures();
features |= Core::FeatureSet(Constants::QNX_BB_FEATURE);
return features;
}
QString BlackBerryQtVersion::platformName() const
{
return QLatin1String(Constants::QNX_BB_PLATFORM_NAME);
}
QString BlackBerryQtVersion::platformDisplayName() const
{
return QCoreApplication::tr("BlackBerry");
}
QString BlackBerryQtVersion::sdkDescription() const
{
return QCoreApplication::tr("BlackBerry Native SDK:");
}

View File

@@ -0,0 +1,70 @@
/**************************************************************************
**
** 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_BLACKBERRYQTVERSION_H
#define QNX_INTERNAL_BLACKBERRYQTVERSION_H
#include "qnxconstants.h"
#include "qnxabstractqtversion.h"
namespace Qnx {
namespace Internal {
class BlackBerryQtVersion : public QnxAbstractQtVersion
{
public:
BlackBerryQtVersion();
BlackBerryQtVersion(QnxArchitecture arch, const Utils::FileName &path,
bool isAutoDetected = false,
const QString &autoDetectionSource = QString());
BlackBerryQtVersion *clone() const;
~BlackBerryQtVersion();
QString type() const;
QString description() const;
Core::FeatureSet availableFeatures() const;
QString platformName() const;
QString platformDisplayName() const;
QString sdkDescription() const;
private:
QMultiMap<QString, QString> environment() const;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYQTVERSION_H

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.
**
**************************************************************************/
#include "blackberryqtversionfactory.h"
#include "qnxconstants.h"
#include "blackberryqtversion.h"
#include "qnxutils.h"
#include <qtsupport/profilereader.h>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryQtVersionFactory::BlackBerryQtVersionFactory(QObject *parent) :
QtSupport::QtVersionFactory(parent)
{
}
BlackBerryQtVersionFactory::~BlackBerryQtVersionFactory()
{
}
bool BlackBerryQtVersionFactory::canRestore(const QString &type)
{
return type == QLatin1String(Constants::QNX_BB_QT);
}
QtSupport::BaseQtVersion *BlackBerryQtVersionFactory::restore(const QString &type, const QVariantMap &data)
{
if (!canRestore(type))
return 0;
BlackBerryQtVersion *v = new BlackBerryQtVersion();
v->fromMap(data);
return v;
}
int BlackBerryQtVersionFactory::priority() const
{
return Constants::QNX_BB_QT_FACTORY_PRIO;
}
QtSupport::BaseQtVersion *BlackBerryQtVersionFactory::create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator,
bool isAutoDetected,
const QString &autoDetectionSource)
{
QFileInfo fi = qmakePath.toFileInfo();
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
return 0;
if (evaluator->value(QLatin1String("CONFIG")).contains("blackberry")) {
QString cpuDir = evaluator->value(QLatin1String("QNX_CPUDIR"));
return new BlackBerryQtVersion(QnxUtils::cpudirToArch(cpuDir), qmakePath,
isAutoDetected, autoDetectionSource);
}
return 0;
}

View File

@@ -0,0 +1,62 @@
/**************************************************************************
**
** 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_BLACKBERRYQTVERSIONFACTORY_H
#define QNX_INTERNAL_BLACKBERRYQTVERSIONFACTORY_H
#include <qtsupport/qtversionfactory.h>
namespace Qnx {
namespace Internal {
class BlackBerryQtVersionFactory : public QtSupport::QtVersionFactory
{
Q_OBJECT
public:
explicit BlackBerryQtVersionFactory(QObject *parent = 0);
~BlackBerryQtVersionFactory();
virtual bool canRestore(const QString &type);
virtual QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data);
virtual int priority() const;
virtual QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator,
bool isAutoDetected = false,
const QString &autoDetectionSource = QString());
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYQTVERSIONFACTORY_H

View File

@@ -0,0 +1,153 @@
/**************************************************************************
**
** 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 "blackberryrunconfiguration.h"
#include "qnxconstants.h"
#include "blackberrydeployconfiguration.h"
#include "blackberryrunconfigurationwidget.h"
#include "blackberrydeployinformation.h"
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4nodes.h>
#include <qt4projectmanager/qt4project.h>
#include <ssh/sshconnection.h>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryRunConfiguration::BlackBerryRunConfiguration(ProjectExplorer::Target *parent, const Core::Id id, const QString &path)
: ProjectExplorer::RunConfiguration(parent, id)
, m_proFilePath(path)
{
init();
}
BlackBerryRunConfiguration::BlackBerryRunConfiguration(ProjectExplorer::Target *parent,
BlackBerryRunConfiguration *source)
: ProjectExplorer::RunConfiguration(parent, source)
, m_proFilePath(source->m_proFilePath)
{
init();
}
void BlackBerryRunConfiguration::init()
{
updateDisplayName();
}
void BlackBerryRunConfiguration::updateDisplayName()
{
if (!m_proFilePath.isEmpty())
setDefaultDisplayName(tr("%1 on BlackBerry device").arg(QFileInfo(m_proFilePath).completeBaseName()));
else
setDefaultDisplayName(tr("Run on BlackBerry device"));
}
QWidget *BlackBerryRunConfiguration::createConfigurationWidget()
{
return new BlackBerryRunConfigurationWidget(this);
}
QString BlackBerryRunConfiguration::proFilePath() const
{
return m_proFilePath;
}
QString BlackBerryRunConfiguration::deviceName() const
{
return deployConfiguration()->deviceName();
}
QString BlackBerryRunConfiguration::barPackage() const
{
BlackBerryDeployConfiguration *dc = deployConfiguration();
if (!dc)
return QString();
QList<BarPackageDeployInformation> packages = dc->deploymentInfo()->enabledPackages();
foreach (const BarPackageDeployInformation package, packages) {
if (package.proFilePath == proFilePath()) {
return package.packagePath;
}
}
return QString();
}
QString BlackBerryRunConfiguration::localExecutableFilePath() const
{
Qt4ProjectManager::Qt4Project *qt4Project = static_cast<Qt4ProjectManager::Qt4Project *>(target()->project());
if (!qt4Project)
return QString();
Qt4ProjectManager::TargetInformation ti = qt4Project->rootQt4ProjectNode()->targetInformation(m_proFilePath);
if (!ti.valid)
return QString();
return QDir::cleanPath(ti.buildDir + QLatin1Char('/') + ti.target);
}
bool BlackBerryRunConfiguration::fromMap(const QVariantMap &map)
{
if (!ProjectExplorer::RunConfiguration::fromMap(map))
return false;
m_proFilePath = map.value(QLatin1String(Constants::QNX_PROFILEPATH_KEY)).toString();
if (m_proFilePath.isEmpty() || !QFileInfo(m_proFilePath).exists())
return false;
init();
return true;
}
QVariantMap BlackBerryRunConfiguration::toMap() const
{
QVariantMap map(ProjectExplorer::RunConfiguration::toMap());
map.insert(QLatin1String(Constants::QNX_PROFILEPATH_KEY), m_proFilePath);
return map;
}
BlackBerryDeployConfiguration *BlackBerryRunConfiguration::deployConfiguration() const
{
return qobject_cast<BlackBerryDeployConfiguration *>(target()->activeDeployConfiguration());
}
Qt4ProjectManager::Qt4BuildConfiguration *BlackBerryRunConfiguration::activeQt4BuildConfiguration() const
{
return static_cast<Qt4ProjectManager::Qt4BuildConfiguration *>(activeBuildConfiguration());
}
QString BlackBerryRunConfiguration::key() const
{
return barPackage() + QLatin1Char('_') + BlackBerryDeviceConfiguration::device(target()->profile())->sshParameters().host;
}

View File

@@ -0,0 +1,94 @@
/**************************************************************************
**
** 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_BLACKBERRYRUNCONFIGURATION_H
#define QNX_INTERNAL_BLACKBERRYRUNCONFIGURATION_H
#include <projectexplorer/runconfiguration.h>
namespace ProjectExplorer {
class Target;
}
namespace Qt4ProjectManager {
class Qt4BuildConfiguration;
class Qt4Project;
}
namespace Qnx {
namespace Internal {
class BlackBerryDeployConfiguration;
class BlackBerryRunConfiguration : public ProjectExplorer::RunConfiguration
{
Q_OBJECT
friend class BlackBerryRunConfigurationFactory;
public:
explicit BlackBerryRunConfiguration(ProjectExplorer::Target *parent, const Core::Id id, const QString &path);
QWidget *createConfigurationWidget();
QString proFilePath() const;
QString deviceName() const;
QString barPackage() const;
QString localExecutableFilePath() const;
bool fromMap(const QVariantMap &map);
QVariantMap toMap() const;
BlackBerryDeployConfiguration *deployConfiguration() const;
Qt4ProjectManager::Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
QString key() const;
signals:
void targetInformationChanged();
protected:
BlackBerryRunConfiguration(ProjectExplorer::Target *parent, BlackBerryRunConfiguration *source);
private:
void init();
void updateDisplayName();
QString m_proFilePath;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYRUNCONFIGURATION_H

View File

@@ -0,0 +1,170 @@
/**************************************************************************
**
** 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 "blackberryrunconfigurationfactory.h"
#include "qnxconstants.h"
#include "blackberryrunconfiguration.h"
#include "blackberrydeviceconfigurationfactory.h"
#include <projectexplorer/profileinformation.h>
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4project.h>
using namespace Qnx;
using namespace Qnx::Internal;
namespace {
QString pathFromId(const Core::Id id)
{
QString idStr = id.toString();
if (idStr.startsWith(QLatin1String(Constants::QNX_BB_RUNCONFIGURATION_PREFIX)))
return idStr.mid(QString::fromLatin1(Constants::QNX_BB_RUNCONFIGURATION_PREFIX).size());
return QString();
}
}
BlackBerryRunConfigurationFactory::BlackBerryRunConfigurationFactory(QObject *parent) :
ProjectExplorer::IRunConfigurationFactory(parent)
{
}
QList<Core::Id> BlackBerryRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
{
QList<Core::Id> ids;
if (!canHandle(parent))
return ids;
Qt4ProjectManager::Qt4Project *qt4Project = qobject_cast<Qt4ProjectManager::Qt4Project *>(parent->project());
if (!qt4Project)
return ids;
QStringList proFiles = qt4Project->applicationProFilePathes(QLatin1String(Constants::QNX_BB_RUNCONFIGURATION_PREFIX));
foreach (const QString &pf, proFiles)
ids << Core::Id(pf);
return ids;
}
QString BlackBerryRunConfigurationFactory::displayNameForId(const Core::Id id) const
{
const QString path = pathFromId(id);
if (path.isEmpty())
return QString();
if (id.toString().startsWith(QLatin1String(Constants::QNX_BB_RUNCONFIGURATION_PREFIX)))
return tr("%1 on BlackBerry Device").arg(QFileInfo(path).completeBaseName());
return QString();
}
bool BlackBerryRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
{
if (!canHandle(parent))
return false;
Qt4ProjectManager::Qt4Project *qt4Project = qobject_cast<Qt4ProjectManager::Qt4Project *>(parent->project());
if (!qt4Project)
return false;
if (!id.toString().startsWith(QLatin1String(Constants::QNX_BB_RUNCONFIGURATION_PREFIX)))
return false;
return qt4Project->hasApplicationProFile(pathFromId(id));
}
ProjectExplorer::RunConfiguration *BlackBerryRunConfigurationFactory::create(ProjectExplorer::Target *parent,
const Core::Id id)
{
if (!canCreate(parent, id))
return 0;
return new BlackBerryRunConfiguration(parent, id, pathFromId(id));
}
bool BlackBerryRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent,
const QVariantMap &map) const
{
if (!canHandle(parent))
return false;
return ProjectExplorer::idFromMap(map).toString().startsWith(Constants::QNX_BB_RUNCONFIGURATION_PREFIX);
}
ProjectExplorer::RunConfiguration *BlackBerryRunConfigurationFactory::restore(
ProjectExplorer::Target *parent,
const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
ProjectExplorer::RunConfiguration *rc = 0;
rc = new BlackBerryRunConfiguration(parent, Core::Id(Constants::QNX_BB_RUNCONFIGURATION_PREFIX), QString());
if (rc->fromMap(map))
return rc;
delete rc;
return 0;
}
bool BlackBerryRunConfigurationFactory::canClone(ProjectExplorer::Target *parent,
ProjectExplorer::RunConfiguration *source) const
{
return canCreate(parent, source->id());
}
ProjectExplorer::RunConfiguration *BlackBerryRunConfigurationFactory::clone(
ProjectExplorer::Target *parent,
ProjectExplorer::RunConfiguration *source)
{
if (!canClone(parent, source))
return 0;
BlackBerryRunConfiguration *old = static_cast<BlackBerryRunConfiguration *>(source);
return new BlackBerryRunConfiguration(parent, old);
}
bool BlackBerryRunConfigurationFactory::canHandle(ProjectExplorer::Target *t) const
{
if (!t->project()->supportsProfile(t->profile()))
return false;
if (!qobject_cast<Qt4ProjectManager::Qt4Project *>(t->project()))
return false;
Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(t->profile());
if (deviceType != BlackBerryDeviceConfigurationFactory::deviceType())
return false;
return true;
}

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_BLACKBERRYRUNCONFIGURATIONFACTORY_H
#define QNX_INTERNAL_BLACKBERRYRUNCONFIGURATIONFACTORY_H
#include <projectexplorer/runconfiguration.h>
namespace Qnx {
namespace Internal {
class BlackBerryRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
{
Q_OBJECT
public:
explicit BlackBerryRunConfigurationFactory(QObject *parent = 0);
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::RunConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent,
const QVariantMap &map);
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent,
ProjectExplorer::RunConfiguration *source);
bool canHandle(ProjectExplorer::Target *t) const;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYRUNCONFIGURATIONFACTORY_H

View File

@@ -0,0 +1,62 @@
/**************************************************************************
**
** 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 "blackberryrunconfigurationwidget.h"
#include "ui_blackberryrunconfigurationwidget.h"
#include "blackberryrunconfiguration.h"
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryRunConfigurationWidget::BlackBerryRunConfigurationWidget(BlackBerryRunConfiguration *config, QWidget *parent)
: QWidget(parent)
, m_ui(new Ui::BlackBerryRunConfigurationWidget)
, m_runConfiguration(config)
{
m_ui->setupUi(this);
updateUi();
connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this, SLOT(updateUi()));
}
BlackBerryRunConfigurationWidget::~BlackBerryRunConfigurationWidget()
{
delete m_ui;
}
void BlackBerryRunConfigurationWidget::updateUi()
{
m_ui->deviceLabel->setText(m_runConfiguration->deviceName());
m_ui->packageLabel->setText(m_runConfiguration->barPackage());
}

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_BLACKBERRYRUNCONFIGURATIONWIDGET_H
#define QNX_INTERNAL_BLACKBERRYRUNCONFIGURATIONWIDGET_H
#include <QWidget>
namespace Qnx {
namespace Internal {
namespace Ui {
class BlackBerryRunConfigurationWidget;
}
class BlackBerryRunConfiguration;
class BlackBerryRunConfigurationWidget : public QWidget
{
Q_OBJECT
public:
explicit BlackBerryRunConfigurationWidget(BlackBerryRunConfiguration *config, QWidget *parent = 0);
~BlackBerryRunConfigurationWidget();
private slots:
void updateUi();
private:
Ui::BlackBerryRunConfigurationWidget *m_ui;
BlackBerryRunConfiguration *m_runConfiguration;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYRUNCONFIGURATIONWIDGET_H

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BlackBerryRunConfigurationWidget</class>
<widget class="QWidget" name="Qnx::Internal::BlackBerryRunConfigurationWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>374</width>
<height>53</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Device:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="deviceLabel"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Package:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="packageLabel"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

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.
**
**************************************************************************/
#include "blackberryruncontrol.h"
#include "blackberryapplicationrunner.h"
#include "blackberryrunconfiguration.h"
#include "blackberryconnect.h"
#include <QIcon>
#include <QTimer>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryRunControl::BlackBerryRunControl(BlackBerryRunConfiguration *runConfiguration)
: ProjectExplorer::RunControl(runConfiguration, ProjectExplorer::NormalRunMode)
{
m_runner = new BlackBerryApplicationRunner(false, runConfiguration, this);
m_connector = BlackBerryConnect::instance(runConfiguration);
connect(m_runner, SIGNAL(started()), this, SIGNAL(started()));
connect(m_runner, SIGNAL(started()), m_connector, SLOT(connectToDevice()));
connect(m_runner, SIGNAL(finished()), this, SIGNAL(finished()));
connect(m_runner, SIGNAL(finished()), m_connector, SLOT(disconnectFromDevice()));
connect(m_runner, SIGNAL(output(QString,Utils::OutputFormat)),
this, SLOT(appendMessage(QString,Utils::OutputFormat)));
connect(m_runner, SIGNAL(startFailed(QString)), this, SLOT(handleStartFailed(QString)));
connect(m_connector, SIGNAL(connected()), this, SLOT(launchTailProcess()));
connect(m_connector, SIGNAL(output(QString,Utils::OutputFormat)),
this, SLOT(appendMessage(QString,Utils::OutputFormat)));
}
BlackBerryRunControl::~BlackBerryRunControl()
{
BlackBerryConnect::cleanup(m_connector);
}
void BlackBerryRunControl::start()
{
m_runner->start();
}
ProjectExplorer::RunControl::StopResult BlackBerryRunControl::stop()
{
return m_runner->stop();
}
bool BlackBerryRunControl::isRunning() const
{
return m_runner->isRunning();
}
QIcon BlackBerryRunControl::icon() const
{
return QIcon(ProjectExplorer::Constants::ICON_RUN_SMALL);
}
void BlackBerryRunControl::handleStartFailed(const QString &message)
{
appendMessage(message, Utils::StdErrFormat);
}
void BlackBerryRunControl::launchTailProcess()
{
// Delay the launch of "tail" to ensure the blackberry-connect
// connection has been properly established
QTimer::singleShot(500, m_runner, SLOT(tailApplicationLog()));
}

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_BLACKBERRYRUNCONTROL_H
#define QNX_INTERNAL_BLACKBERRYRUNCONTROL_H
#include <projectexplorer/runconfiguration.h>
namespace Qt4ProjectManager {
class Qt4BuildConfiguration;
}
namespace Qnx {
namespace Internal {
class BlackBerryConnect;
class BlackBerryRunConfiguration;
class BlackBerryApplicationRunner;
class BlackBerryRunControl : public ProjectExplorer::RunControl
{
Q_OBJECT
public:
explicit BlackBerryRunControl(BlackBerryRunConfiguration *runConfiguration);
~BlackBerryRunControl();
void start();
ProjectExplorer::RunControl::StopResult stop();
bool isRunning() const;
QIcon icon() const;
private slots:
void handleStartFailed(const QString &message);
void launchTailProcess();
private:
BlackBerryApplicationRunner *m_runner;
BlackBerryConnect *m_connector;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYRUNCONTROL_H

View File

@@ -0,0 +1,172 @@
/**************************************************************************
**
** 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 "blackberryruncontrolfactory.h"
#include "blackberryrunconfiguration.h"
#include "blackberryruncontrol.h"
#include "blackberrydeployconfiguration.h"
#include "blackberrydebugsupport.h"
#include "blackberryqtversion.h"
#include "qnxutils.h"
#include <debugger/debuggerplugin.h>
#include <debugger/debuggerrunner.h>
#include <debugger/debuggerprofileinformation.h>
#include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qtsupport/qtprofileinformation.h>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryRunControlFactory::BlackBerryRunControlFactory(QObject *parent)
: ProjectExplorer::IRunControlFactory(parent)
{
}
bool BlackBerryRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode) const
{
Q_UNUSED(mode);
BlackBerryRunConfiguration *rc = qobject_cast<BlackBerryRunConfiguration *>(runConfiguration);
if (!rc)
return false;
// The device can only run the same application once, any subsequent runs will
// not launch a second instance. Disable the Run button if the application is already
// running on the device.
if (m_activeRunControls.contains(rc->key())) {
QWeakPointer<ProjectExplorer::RunControl> activeRunControl = m_activeRunControls[rc->key()];
if (activeRunControl && activeRunControl.data()->isRunning())
return false;
else
m_activeRunControls.remove(rc->key());
}
BlackBerryDeployConfiguration *activeDeployConf = qobject_cast<BlackBerryDeployConfiguration *>(
rc->target()->activeDeployConfiguration());
return activeDeployConf != 0;
}
ProjectExplorer::RunControl *BlackBerryRunControlFactory::create(
ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode)
{
BlackBerryRunConfiguration *rc = qobject_cast<BlackBerryRunConfiguration *>(runConfiguration);
if (!rc)
return 0;
BlackBerryDeployConfiguration *activeDeployConf = qobject_cast<BlackBerryDeployConfiguration *>(
rc->target()->activeDeployConfiguration());
if (!activeDeployConf)
return 0;
if (mode == ProjectExplorer::NormalRunMode) {
BlackBerryRunControl *runControl = new BlackBerryRunControl(rc);
m_activeRunControls[rc->key()] = QWeakPointer<ProjectExplorer::RunControl>(runControl);
return runControl;
}
Debugger::DebuggerRunControl * const runControl =
Debugger::DebuggerPlugin::createDebugger(startParameters(rc), runConfiguration);
if (!runControl)
return 0;
new BlackBerryDebugSupport(rc, runControl);
m_activeRunControls[rc->key()] = QWeakPointer<ProjectExplorer::RunControl>(runControl);
return runControl;
}
QString BlackBerryRunControlFactory::displayName() const
{
return tr("Run on BlackBerry Device");
}
ProjectExplorer::RunConfigWidget *BlackBerryRunControlFactory::createConfigurationWidget(
ProjectExplorer::RunConfiguration *runConfiguration)
{
Q_UNUSED(runConfiguration);
return 0;
}
Debugger::DebuggerStartParameters BlackBerryRunControlFactory::startParameters(
const BlackBerryRunConfiguration *runConfig)
{
Debugger::DebuggerStartParameters params;
ProjectExplorer::Target *target = runConfig->target();
ProjectExplorer::Profile *profile = target->profile();
params.startMode = Debugger::AttachToRemoteServer;
params.debuggerCommand = Debugger::DebuggerProfileInformation::debuggerCommand(profile).toString();
params.sysRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(profile).toString();
if (ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(profile)) {
params.toolChainAbi = tc->targetAbi();
params.remoteArchitecture = ProjectExplorer::Abi::toString(tc->targetAbi().architecture());
}
params.executable = runConfig->localExecutableFilePath();
params.remoteChannel = runConfig->deployConfiguration()->deviceHost() + QLatin1String(":8000");
params.displayName = runConfig->displayName();
params.remoteSetupNeeded = true;
if (runConfig->debuggerAspect()->useQmlDebugger()) {
BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(runConfig->target()->profile());
if (device) {
params.qmlServerAddress = device->sshParameters().host;
params.qmlServerPort = runConfig->debuggerAspect()->qmlDebugServerPort();
params.languages |= Debugger::QmlLanguage;
}
}
if (runConfig->debuggerAspect()->useCppDebugger())
params.languages |= Debugger::CppLanguage;
if (const ProjectExplorer::Project *project = runConfig->target()->project()) {
params.projectSourceDirectory = project->projectDirectory();
if (const ProjectExplorer::BuildConfiguration *buildConfig = runConfig->target()->activeBuildConfiguration()) {
params.projectBuildDirectory = buildConfig->buildDirectory();
}
params.projectSourceFiles = project->files(ProjectExplorer::Project::ExcludeGeneratedFiles);
}
BlackBerryQtVersion *qtVersion =
dynamic_cast<BlackBerryQtVersion *>(QtSupport::QtProfileInformation::qtVersion(profile));
if (qtVersion)
params.solibSearchPath = QnxUtils::searchPaths(qtVersion);
return params;
}

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_BLACKBERRYRUNCONTROLFACTORY_H
#define QNX_INTERNAL_BLACKBERRYRUNCONTROLFACTORY_H
#include <debugger/debuggerstartparameters.h>
#include <projectexplorer/runconfiguration.h>
namespace RemoteLinux {
class RemoteLinuxRunConfiguration;
}
namespace Qnx {
namespace Internal {
class BlackBerryRunConfiguration;
class BlackBerryRunControlFactory : public ProjectExplorer::IRunControlFactory
{
Q_OBJECT
public:
BlackBerryRunControlFactory(QObject *parent = 0);
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode) const;
ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode);
QString displayName() const;
ProjectExplorer::RunConfigWidget *createConfigurationWidget(
ProjectExplorer::RunConfiguration *runConfiguration);
private:
static Debugger::DebuggerStartParameters startParameters( const BlackBerryRunConfiguration *runConfig);
mutable QMap<QString, QWeakPointer<ProjectExplorer::RunControl> > m_activeRunControls;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYRUNCONTROLFACTORY_H

View File

@@ -0,0 +1,139 @@
/**************************************************************************
**
** 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 "blackberrywizardextension.h"
#include "bardescriptorfileimagewizardpage.h"
#include "qnxconstants.h"
#include <coreplugin/dialogs/iwizard.h>
#include <coreplugin/generatedfile.h>
#include <QFileInfo>
#include <QDomDocument>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryWizardExtension::BlackBerryWizardExtension()
: m_imageWizardPage(0)
{
}
QList<QWizardPage *> BlackBerryWizardExtension::extensionPages(const Core::IWizard *wizard)
{
QStringList validIds;
validIds << QLatin1String(Constants::QNX_BAR_DESCRIPTOR_WIZARD_ID);
validIds << QLatin1String(Constants::QNX_BLACKBERRY_QTQUICK_APP_WIZARD_ID);
validIds << QLatin1String(Constants::QNX_BLACKBERRY_GUI_APP_WIZARD_ID);
validIds << QLatin1String(Constants::QNX_BLACKBERRY_QTQUICK2_APP_WIZARD_ID);
QList<QWizardPage*> pages;
if (!validIds.contains(wizard->id()))
return pages;
m_imageWizardPage = new BarDescriptorFileImageWizardPage;
pages << m_imageWizardPage;
return pages;
}
bool BlackBerryWizardExtension::processFiles(const QList<Core::GeneratedFile> &files, bool *removeOpenProjectAttribute, QString *errorMessage)
{
Q_UNUSED(files);
Q_UNUSED(removeOpenProjectAttribute);
Q_UNUSED(errorMessage);
return true;
}
void BlackBerryWizardExtension::applyCodeStyle(Core::GeneratedFile *file) const
{
QFileInfo fi(file->path());
if (fi.fileName() == QLatin1String("bar-descriptor.xml"))
addImagesToBarDescriptor(file);
}
void BlackBerryWizardExtension::addImagesToBarDescriptor(Core::GeneratedFile *file) const
{
QDomDocument doc;
doc.setContent(file->contents());
QDomElement docElem = doc.documentElement();
// Add asset elements
QStringList fileAssets;
fileAssets << m_imageWizardPage->icon();
fileAssets << m_imageWizardPage->landscapeSplashScreen();
fileAssets << m_imageWizardPage->portraitSplashScreen();
Q_FOREACH (const QString &asset, fileAssets) {
if (asset.isEmpty())
continue;
QDomElement assetElem = doc.createElement(QLatin1String("asset"));
assetElem.setAttribute(QLatin1String("path"), asset);
QDomText fileNameText = doc.createTextNode(QFileInfo(asset).fileName());
assetElem.appendChild(fileNameText);
docElem.appendChild(assetElem);
}
// Add icon element
if (!m_imageWizardPage->icon().isEmpty()) {
QDomElement iconElem = doc.createElement(QLatin1String("icon"));
QDomElement imageElem = doc.createElement(QLatin1String("image"));
QDomText fileNameText = doc.createTextNode(QFileInfo(m_imageWizardPage->icon()).fileName());
imageElem.appendChild(fileNameText);
iconElem.appendChild(imageElem);
docElem.appendChild(iconElem);
}
// Add splashscreen element
QString splashScreenEntry = QFileInfo(m_imageWizardPage->landscapeSplashScreen()).fileName();
if (!m_imageWizardPage->portraitSplashScreen().isEmpty())
splashScreenEntry.append(QLatin1Char(':') + QFileInfo(m_imageWizardPage->portraitSplashScreen()).fileName());
if (!splashScreenEntry.isEmpty()) {
QDomElement splashScreenElem = doc.createElement(QLatin1String("splashscreen"));
QDomText splashScreenText = doc.createTextNode(splashScreenEntry);
splashScreenElem.appendChild(splashScreenText);
docElem.appendChild(splashScreenElem);
}
file->setContents(doc.toString(4));
}

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_BLACKBERRYWIZARDEXTENSION_H
#define QNX_INTERNAL_BLACKBERRYWIZARDEXTENSION_H
#include <coreplugin/ifilewizardextension.h>
namespace Qnx {
namespace Internal {
class BarDescriptorFileImageWizardPage;
class BlackBerryWizardExtension : public Core::IFileWizardExtension
{
Q_OBJECT
public:
explicit BlackBerryWizardExtension();
QList<QWizardPage *> extensionPages(const Core::IWizard *wizard);
bool processFiles(const QList<Core::GeneratedFile> &files,
bool *removeOpenProjectAttribute,
QString *errorMessage);
void applyCodeStyle(Core::GeneratedFile *file) const;
private:
void addImagesToBarDescriptor(Core::GeneratedFile *file) const;
BarDescriptorFileImageWizardPage *m_imageWizardPage;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYWIZARDEXTENSION_H

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

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.
**
**************************************************************************/
#include "pathchooserdelegate.h"
#include <utils/pathchooser.h>
#include <QLineEdit>
using namespace Qnx;
using namespace Qnx::Internal;
PathChooserDelegate::PathChooserDelegate(QObject *parent)
: QStyledItemDelegate(parent)
, m_kind(Utils::PathChooser::ExistingDirectory)
{
}
void PathChooserDelegate::setExpectedKind(Utils::PathChooser::Kind kind)
{
m_kind = kind;
}
void PathChooserDelegate::setPromptDialogFilter(const QString &filter)
{
m_filter = filter;
}
QWidget *PathChooserDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
Q_UNUSED(option);
Q_UNUSED(index);
Utils::PathChooser *editor = new Utils::PathChooser(parent);
editor->setAutoFillBackground(true); // To hide the text beneath the editor widget
editor->lineEdit()->setMinimumWidth(0);
return editor;
}
void PathChooserDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
QString value = index.model()->data(index, Qt::EditRole).toString();
Utils::PathChooser *pathChooser = qobject_cast<Utils::PathChooser *>(editor);
if (!pathChooser)
return;
pathChooser->setExpectedKind(m_kind);
pathChooser->setPromptDialogFilter(m_filter);
pathChooser->setPath(value);
}
void PathChooserDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
Utils::PathChooser *pathChooser = qobject_cast<Utils::PathChooser *>(editor);
if (!pathChooser)
return;
model->setData(index, pathChooser->path(), Qt::EditRole);
}
void PathChooserDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
Q_UNUSED(index);
editor->setGeometry(option.rect);
}

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_PATHCHOOSERDELEGATE_H
#define QNX_INTERNAL_PATHCHOOSERDELEGATE_H
#include <QStyledItemDelegate>
#include <utils/pathchooser.h>
namespace Qnx {
namespace Internal {
// TODO: This whole class should probably go into utils
class PathChooserDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit PathChooserDelegate(QObject *parent = 0);
void setExpectedKind(Utils::PathChooser::Kind kind);
void setPromptDialogFilter(const QString &filter);
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const;
void setEditorData(QWidget *editor, const QModelIndex &index) const;
void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const;
void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option, const QModelIndex &index) const;
private:
Utils::PathChooser::Kind m_kind;
QString m_filter;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_PATHCHOOSERDELEGATE_H

120
src/plugins/qnx/qnx.pro Normal file
View File

@@ -0,0 +1,120 @@
TEMPLATE = lib
TARGET = Qnx
QT += network xml
PROVIDER = RIM
include(../../qtcreatorplugin.pri)
include(qnx_dependencies.pri)
SOURCES += qnxplugin.cpp \
blackberryqtversionfactory.cpp \
blackberryqtversion.cpp \
qnxbaseqtconfigwidget.cpp \
blackberrydeployconfigurationfactory.cpp \
blackberrydeployconfiguration.cpp \
blackberrycreatepackagestep.cpp \
blackberrycreatepackagestepconfigwidget.cpp \
blackberrycreatepackagestepfactory.cpp \
blackberrydeploystep.cpp \
blackberrydeployconfigurationwidget.cpp \
blackberrydeploystepconfigwidget.cpp \
blackberrydeviceconfigurationfactory.cpp \
blackberrydeviceconfigurationwizard.cpp \
blackberrydeviceconfigurationwizardpages.cpp \
blackberrydeploystepfactory.cpp \
blackberryrunconfiguration.cpp \
blackberryrunconfigurationwidget.cpp \
blackberryrunconfigurationfactory.cpp \
blackberryruncontrolfactory.cpp \
blackberryruncontrol.cpp \
blackberrydebugsupport.cpp \
blackberryapplicationrunner.cpp \
blackberryconnect.cpp \
qnxutils.cpp \
blackberrydeviceconfigurationwidget.cpp \
qnxdeviceconfigurationfactory.cpp \
qnxdeviceconfigurationwizard.cpp \
qnxdeviceconfigurationwizardpages.cpp \
qnxrunconfiguration.cpp \
qnxruncontrolfactory.cpp \
qnxdebugsupport.cpp \
qnxapplicationrunner.cpp \
qnxdeploystepfactory.cpp \
qnxdeployconfigurationfactory.cpp \
qnxrunconfigurationfactory.cpp \
qnxruncontrol.cpp \
qnxqtversionfactory.cpp \
qnxqtversion.cpp \
qnxabstractqtversion.cpp \
bardescriptorfileimagewizardpage.cpp \
blackberrywizardextension.cpp \
blackberrydeviceconfiguration.cpp \
qnxdeployconfiguration.cpp \
qnxdeviceconfiguration.cpp \
blackberrydeployinformation.cpp \
pathchooserdelegate.cpp \
blackberryabstractdeploystep.cpp
HEADERS += qnxplugin.h\
qnxconstants.h \
blackberryqtversionfactory.h \
blackberryqtversion.h \
qnxbaseqtconfigwidget.h \
blackberrydeployconfigurationfactory.h \
blackberrydeployconfiguration.h \
blackberrycreatepackagestep.h \
blackberrycreatepackagestepconfigwidget.h \
blackberrycreatepackagestepfactory.h \
blackberrydeploystep.h \
blackberrydeployconfigurationwidget.h \
blackberrydeploystepconfigwidget.h \
blackberrydeviceconfigurationfactory.h \
blackberrydeviceconfigurationwizard.h \
blackberrydeviceconfigurationwizardpages.h \
blackberrydeploystepfactory.h \
blackberryrunconfiguration.h \
blackberryrunconfigurationwidget.h \
blackberryrunconfigurationfactory.h \
blackberryruncontrolfactory.h \
blackberryruncontrol.h \
blackberrydebugsupport.h \
blackberryapplicationrunner.h \
blackberryconnect.h \
qnxutils.h \
blackberrydeviceconfigurationwidget.h \
qnxdeviceconfigurationfactory.h \
qnxdeviceconfigurationwizard.h \
qnxdeviceconfigurationwizardpages.h \
qnxrunconfiguration.h \
qnxruncontrolfactory.h \
qnxdebugsupport.h \
qnxapplicationrunner.h \
qnxdeploystepfactory.h \
qnxdeployconfigurationfactory.h \
qnxrunconfigurationfactory.h \
qnxruncontrol.h \
qnxqtversionfactory.h \
qnxqtversion.h \
qnxabstractqtversion.h \
bardescriptorfileimagewizardpage.h \
blackberrywizardextension.h \
blackberrydeviceconfiguration.h \
qnxdeployconfiguration.h \
qnxdeviceconfiguration.h \
blackberrydeployinformation.h \
pathchooserdelegate.h \
blackberryabstractdeploystep.h
FORMS += \
blackberrydeviceconfigurationwizardsetuppage.ui \
blackberryrunconfigurationwidget.ui \
blackberrydeviceconfigurationwizardsshkeypage.ui \
blackberrydeployconfigurationwidget.ui \
blackberrydeviceconfigurationwidget.ui \
qnxbaseqtconfigwidget.ui \
bardescriptorfileimagewizardpage.ui
DEFINES += QT_NO_CAST_TO_ASCII
RESOURCES += \
qnx.qrc

6
src/plugins/qnx/qnx.qrc Normal file
View File

@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/qnx">
<file>images/target-small.png</file>
<file>images/target.png</file>
</qresource>
</RCC>

View File

@@ -0,0 +1,3 @@
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/qt4projectmanager/qt4projectmanager.pri)
include(../../plugins/remotelinux/remotelinux.pri)

View File

@@ -0,0 +1,173 @@
/**************************************************************************
**
** 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 "qnxabstractqtversion.h"
#include "qnxbaseqtconfigwidget.h"
#include <utils/environment.h>
#include <QDir>
using namespace Qnx;
using namespace Qnx::Internal;
QnxAbstractQtVersion::QnxAbstractQtVersion()
: QtSupport::BaseQtVersion()
, m_arch(UnknownArch)
{
}
QnxAbstractQtVersion::QnxAbstractQtVersion(QnxArchitecture arch, const Utils::FileName &path, bool isAutoDetected, const QString &autoDetectionSource)
: QtSupport::BaseQtVersion(path, isAutoDetected, autoDetectionSource)
, m_arch(arch)
{
}
QnxArchitecture QnxAbstractQtVersion::architecture() const
{
return m_arch;
}
QString QnxAbstractQtVersion::archString() const
{
switch (m_arch) {
case X86:
return QLatin1String("x86");
case ArmLeV7:
return QLatin1String("ARMle-v7");
case UnknownArch:
return QString();
}
return QString();
}
QVariantMap QnxAbstractQtVersion::toMap() const
{
QVariantMap result = BaseQtVersion::toMap();
result.insert(QLatin1String("SDKPath"), sdkPath());
result.insert(QLatin1String("Arch"), m_arch);
return result;
}
void QnxAbstractQtVersion::fromMap(const QVariantMap &map)
{
BaseQtVersion::fromMap(map);
setSdkPath(QDir::fromNativeSeparators(map.value(QLatin1String("SDKPath")).toString()));
m_arch = static_cast<QnxArchitecture>(map.value(QLatin1String("Arch"), UnknownArch).toInt());
}
QList<ProjectExplorer::Abi> QnxAbstractQtVersion::detectQtAbis() const
{
ensureMkSpecParsed();
return qtAbisFromLibrary(qtCorePath(versionInfo(), qtVersionString()));
}
void QnxAbstractQtVersion::addToEnvironment(const ProjectExplorer::Profile *p, Utils::Environment &env) const
{
QtSupport::BaseQtVersion::addToEnvironment(p, env);
if (!m_environmentUpToDate)
updateEnvironment();
QMultiMap<QString, QString>::const_iterator it;
QMultiMap<QString, QString>::const_iterator end(m_envMap.constEnd());
for (it = m_envMap.constBegin(); it != end; ++it) {
const QString key = it.key();
const QString value = it.value();
if (key == QLatin1String("PATH"))
env.prependOrSetPath(value);
else if (key == QLatin1String("LD_LIBRARY_PATH"))
env.prependOrSetLibrarySearchPath(value);
else
env.set(key, value);
}
env.prependOrSetLibrarySearchPath(versionInfo().value(QLatin1String("QT_INSTALL_LIBS")));
}
QString QnxAbstractQtVersion::sdkPath() const
{
return m_sdkPath;
}
void QnxAbstractQtVersion::setSdkPath(const QString &sdkPath)
{
if (m_sdkPath == sdkPath)
return;
m_sdkPath = sdkPath;
m_environmentUpToDate = false;
}
void QnxAbstractQtVersion::updateEnvironment() const
{
m_envMap = environment();
m_environmentUpToDate = true;
}
QString QnxAbstractQtVersion::qnxHost() const
{
if (!m_environmentUpToDate)
updateEnvironment();
return m_envMap.value(QLatin1String(Constants::QNX_HOST_KEY));
}
QString QnxAbstractQtVersion::qnxTarget() const
{
if (!m_environmentUpToDate)
updateEnvironment();
return m_envMap.value(QLatin1String(Constants::QNX_TARGET_KEY));
}
QtSupport::QtConfigWidget *QnxAbstractQtVersion::createConfigurationWidget() const
{
return new QnxBaseQtConfigWidget(const_cast<QnxAbstractQtVersion *>(this));
}
bool QnxAbstractQtVersion::isValid() const
{
return QtSupport::BaseQtVersion::isValid() && !sdkPath().isEmpty();
}
QString QnxAbstractQtVersion::invalidReason() const
{
if (sdkPath().isEmpty())
return QCoreApplication::translate("QtVersion", "No SDK path set");
return QtSupport::BaseQtVersion::invalidReason();
}

View File

@@ -0,0 +1,92 @@
/**************************************************************************
**
** 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_QNXABSTRACTQTVERSION_H
#define QNX_INTERNAL_QNXABSTRACTQTVERSION_H
#include "qnxconstants.h"
#include <qtsupport/baseqtversion.h>
namespace Qnx {
namespace Internal {
class QnxAbstractQtVersion : public QtSupport::BaseQtVersion
{
friend class QnxBaseQtConfigWidget;
public:
QnxAbstractQtVersion();
QnxAbstractQtVersion(QnxArchitecture arch, const Utils::FileName &path,
bool isAutoDetected = false,
const QString &autoDetectionSource = QString());
QString qnxHost() const;
QString qnxTarget() const;
QnxArchitecture architecture() const;
QString archString() const;
QVariantMap toMap() const;
void fromMap(const QVariantMap &map);
QList<ProjectExplorer::Abi> detectQtAbis() const;
void addToEnvironment(const ProjectExplorer::Profile *p, Utils::Environment &env) const;
QtSupport::QtConfigWidget *createConfigurationWidget() const;
bool isValid() const;
QString invalidReason() const;
virtual QString sdkDescription() const = 0;
protected:
QString sdkPath() const;
private:
void updateEnvironment() const;
virtual QMultiMap<QString, QString> environment() const = 0;
void setSdkPath(const QString &sdkPath);
QnxArchitecture m_arch;
QString m_sdkPath;
mutable bool m_environmentUpToDate;
mutable QMultiMap<QString, QString> m_envMap;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_QNXABSTRACTQTVERSION_H

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.
**
**************************************************************************/
#include "qnxapplicationrunner.h"
#include "qnxrunconfiguration.h"
#include "qnxconstants.h"
#include <remotelinux/remotelinuxusedportsgatherer.h>
using namespace Qnx;
using namespace Qnx::Internal;
QnxApplicationRunner::QnxApplicationRunner(QnxRunConfiguration *runConfig, QObject *parent)
: RemoteLinux::AbstractRemoteLinuxApplicationRunner(runConfig, parent)
, m_debugMode(false)
{
usedPortsGatherer()->setCommand(QLatin1String(Constants::QNX_PORT_GATHERER_COMMAND));
}
void QnxApplicationRunner::setDebugMode(bool debugMode)
{
m_debugMode = debugMode;
}
void QnxApplicationRunner::doDeviceSetup()
{
handleDeviceSetupDone(true);
}
void QnxApplicationRunner::doAdditionalInitialCleanup()
{
handleInitialCleanupDone(true);
}
void QnxApplicationRunner::doAdditionalInitializations()
{
handleInitializationsDone(true);
}
void QnxApplicationRunner::doPostRunCleanup()
{
handlePostRunCleanupDone();
}
void QnxApplicationRunner::doAdditionalConnectionErrorHandling()
{
}
QString QnxApplicationRunner::killApplicationCommandLine() const
{
QString executable = m_debugMode ? QLatin1String(Constants::QNX_DEBUG_EXECUTABLE) : remoteExecutable();
executable.replace(QLatin1String("/"), QLatin1String("\\/"));
return QString::fromLatin1("for PID in $(ps -f -o pid,comm | grep %1 | awk '/%1/ {print $1}'); "
"do "
"kill $PID; sleep 1; kill -9 $PID; "
"done").arg(executable);
}

View File

@@ -0,0 +1,69 @@
/**************************************************************************
**
** 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_QNXAPPLICATIONRUNNER_H
#define QNX_INTERNAL_QNXAPPLICATIONRUNNER_H
#include <remotelinux/remotelinuxapplicationrunner.h>
namespace Qnx {
namespace Internal {
class QnxRunConfiguration;
class QnxApplicationRunner : public RemoteLinux::AbstractRemoteLinuxApplicationRunner
{
Q_OBJECT
public:
explicit QnxApplicationRunner(QnxRunConfiguration *runConfig,
QObject *parent = 0);
void setDebugMode(bool debugMode);
protected:
void doDeviceSetup();
void doAdditionalInitialCleanup();
void doAdditionalInitializations();
void doPostRunCleanup();
void doAdditionalConnectionErrorHandling();
private:
QString killApplicationCommandLine() const;
bool m_debugMode;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_QNXAPPLICATIONRUNNER_H

View File

@@ -0,0 +1,72 @@
/**************************************************************************
**
** 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 "qnxbaseqtconfigwidget.h"
#include "ui_qnxbaseqtconfigwidget.h"
#include "qnxabstractqtversion.h"
#include <utils/pathchooser.h>
#include <QDir>
#include <QFormLayout>
using namespace Qnx;
using namespace Qnx::Internal;
QnxBaseQtConfigWidget::QnxBaseQtConfigWidget(QnxAbstractQtVersion *version)
: QtSupport::QtConfigWidget()
, m_version(version)
{
m_ui = new Ui::QnxBaseQtConfigWidget;
m_ui->setupUi(this);
m_ui->sdkLabel->setText(version->sdkDescription());
m_ui->sdkPath->setExpectedKind(Utils::PathChooser::ExistingDirectory);
m_ui->sdkPath->setPath(version->sdkPath());
connect(m_ui->sdkPath, SIGNAL(changed(QString)), this, SLOT(updateSdkPath(QString)));
}
QnxBaseQtConfigWidget::~QnxBaseQtConfigWidget()
{
delete m_ui;
m_ui = 0;
}
void QnxBaseQtConfigWidget::updateSdkPath(const QString &path)
{
m_version->setSdkPath(path);
emit changed();
}

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_QNXBASEQTCONFIGWIDGET_H
#define QNX_INTERNAL_QNXBASEQTCONFIGWIDGET_H
#include <qtsupport/baseqtversion.h>
namespace Qnx {
namespace Internal {
namespace Ui {
class QnxBaseQtConfigWidget;
}
class QnxAbstractQtVersion;
class QnxBaseQtConfigWidget : public QtSupport::QtConfigWidget
{
Q_OBJECT
public:
explicit QnxBaseQtConfigWidget(QnxAbstractQtVersion *version);
~QnxBaseQtConfigWidget();
private slots:
void updateSdkPath(const QString &path);
private:
QnxAbstractQtVersion *m_version;
Ui::QnxBaseQtConfigWidget *m_ui;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_QNXBASEQTCONFIGWIDGET_H

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::QnxBaseQtConfigWidget</class>
<widget class="QWidget" name="Qnx::Internal::QnxBaseQtConfigWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>778</width>
<height>23</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="Utils::PathChooser" name="sdkPath" native="true"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="sdkLabel">
<property name="text">
<string>SDK:</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,101 @@
/**************************************************************************
**
** 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_QNXCONSTANTS_H
#define QNX_QNXCONSTANTS_H
namespace Qnx {
enum QnxArchitecture {
X86,
ArmLeV7,
UnknownArch
};
namespace Constants {
const int QNX_BB_QT_FACTORY_PRIO = 60;
const int QNX_QNX_QT_FACTORY_PRIO = 50;
const char QNX_TARGET_KEY[] = "QNX_TARGET";
const char QNX_HOST_KEY[] = "QNX_HOST";
const char QNX_BB_QT[] = "Qt4ProjectManager.QtVersion.QNX.BlackBerry";
const char QNX_QNX_QT[] = "Qt4ProjectManager.QtVersion.QNX.QNX";
const char QNX_BB_FEATURE[] = "QtSupport.Wizards.FeatureBlackBerry";
const char QNX_QNX_FEATURE[] = "QtSupport.Wizards.FeatureQNX";
const char QNX_BB_X86_TARGET_ID[] = "Qt4ProjectManager.Target.QNX.BBX86Target";
const char QNX_BB_ARMLEV7_TARGET_ID[] = "Qt4ProjectManager.Target.QNX.BBArmLeV7Target";
const char QNX_QNX_X86_TARGET_ID[] = "Qt4ProjectManager.Target.QNX.QNXX86Target";
const char QNX_QNX_ARMLEV7_TARGET_ID[] = "Qt4ProjectManager.Target.QNX.QNXArmLeV7Target";
const char QNX_BB_DEPLOYCONFIGURATION_ID[] = "Qt4ProjectManager.QNX.BBDeployConfiguration";
const char QNX_QNX_DEPLOYCONFIGURATION_ID[] = "Qt4ProjectManager.QNX.QNXDeployConfiguration";
const char QNX_BB_RUNCONFIGURATION_PREFIX[] = "Qt4ProjectManager.QNX.BBRunConfiguration.";
const char QNX_QNX_RUNCONFIGURATION_PREFIX[] = "Qt4ProjectManager.QNX.QNXRunConfiguration.";
const char QNX_CREATE_PACKAGE_BS_ID[] = "Qt4ProjectManager.QnxCreatePackageBuildStep";
const char QNX_DEPLOY_PACKAGE_BS_ID[] = "Qt4ProjectManager.QnxDeployPackageBuildStep";
const char QNX_PROFILEPATH_KEY[] = "Qt4ProjectManager.QnxRunConfiguration.ProFilePath";
const char QNX_BB_OS_TYPE[] = "BBOsType";
const char QNX_QNX_OS_TYPE[] = "QnxOsType";
const char QNX_DEBUG_TOKEN_KEY[] = "debugToken";
const char QNX_PORT_GATHERER_COMMAND[] = "netstat -na "
"| sed 's/[a-z]\\+\\s\\+[0-9]\\+\\s\\+[0-9]\\+\\s\\+\\(\\*\\|[0-9\\.]\\+\\)\\.\\([0-9]\\+\\).*/\\2/g' "
"| while read line; do "
"if [[ $line != udp* ]] && [[ $line != Active* ]]; then "
"printf '%x\n' $line; "
"fi; "
"done";
const char QNX_BAR_DESCRIPTOR_WIZARD_ID[] = "Q.QnxBlackBerryBarDescriptor";
const char QNX_BLACKBERRY_QTQUICK_APP_WIZARD_ID[] = "Q.QnxBlackBerryQQApp";
const char QNX_BLACKBERRY_QTQUICK2_APP_WIZARD_ID[] = "Q.QnxBlackBerryQQ2App";
const char QNX_BLACKBERRY_GUI_APP_WIZARD_ID[] = "Q.QnxBlackBerryGuiApp";
const char QNX_QNX_PLATFORM_NAME[] = "QNX";
const char QNX_BB_PLATFORM_NAME[] = "BlackBerry";
const char QNX_DEBUG_EXECUTABLE[] = "pdebug";
} // namespace Constants
} // namespace Qnx
#endif // QNX_QNXCONSTANTS_H

View File

@@ -0,0 +1,147 @@
/**************************************************************************
**
** 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 "qnxdebugsupport.h"
#include "qnxapplicationrunner.h"
#include "qnxconstants.h"
#include <debugger/debuggerengine.h>
#include <remotelinux/remotelinuxusedportsgatherer.h>
#include <utils/qtcassert.h>
using namespace Qnx;
using namespace Qnx::Internal;
QnxDebugSupport::QnxDebugSupport(QnxRunConfiguration *runConfig, Debugger::DebuggerEngine *engine)
: QObject(engine)
, m_engine(engine)
, m_port(-1)
, m_state(Inactive)
{
m_runner = new QnxApplicationRunner(runConfig, this);
m_runner->setDebugMode(true);
connect(m_engine, SIGNAL(requestRemoteSetup()), this, SLOT(handleAdapterSetupRequested()));
}
void QnxDebugSupport::handleAdapterSetupRequested()
{
QTC_ASSERT(m_state == Inactive, return);
m_state = StartingRunner;
if (m_engine)
m_engine->showMessage(tr("Preparing remote side...\n"), Debugger::AppStuff);
connect(m_runner, SIGNAL(error(QString)), this, SLOT(handleSshError(QString)));
connect(m_runner, SIGNAL(readyForExecution()), this, SLOT(startExecution()));
connect(m_runner, SIGNAL(remoteProcessStarted()), this, SLOT(handleRemoteProcessStarted()));
connect(m_runner, SIGNAL(remoteProcessFinished(qint64)), this, SLOT(handleRemoteProcessFinished(qint64)));
connect(m_runner, SIGNAL(reportProgress(QString)), this, SLOT(handleProgressReport(QString)));
connect(m_runner, SIGNAL(remoteOutput(QByteArray)), this, SLOT(handleRemoteOutput(QByteArray)));
m_runner->start();
}
void QnxDebugSupport::startExecution()
{
if (m_state == Inactive)
return;
QTC_ASSERT(m_state == StartingRunner, return);
m_state = StartingRemoteProcess;
m_port = m_runner->usedPortsGatherer()->getNextFreePort(m_runner->freePorts());
const QString remoteCommandLine = QString::fromLatin1("%1 %2 %3").arg(m_runner->commandPrefix()).arg(QLatin1String(Constants::QNX_DEBUG_EXECUTABLE)).arg(m_port);
m_runner->startExecution(remoteCommandLine.toUtf8());
}
void QnxDebugSupport::handleRemoteProcessStarted()
{
if (m_engine)
m_engine->notifyEngineRemoteSetupDone(m_port, -1);
}
void QnxDebugSupport::handleRemoteProcessFinished(qint64 exitCode)
{
if (m_engine || m_state == Inactive)
return;
if (m_state == Debugging) {
if (exitCode != 0)
m_engine->notifyInferiorIll();
} else {
const QString errorMsg = tr("The %1 process closed unexpectedly.").arg(QLatin1String(Constants::QNX_DEBUG_EXECUTABLE));
m_engine->notifyEngineRemoteSetupFailed(errorMsg);
}
}
void QnxDebugSupport::handleDebuggingFinished()
{
setFinished();
}
void QnxDebugSupport::setFinished()
{
m_state = Inactive;
m_runner->stop();
}
void QnxDebugSupport::handleProgressReport(const QString &progressOutput)
{
if (m_engine)
m_engine->showMessage(progressOutput + QLatin1Char('\n'), Debugger::AppStuff);
}
void QnxDebugSupport::handleRemoteOutput(const QByteArray &output)
{
QTC_ASSERT(m_state == Inactive || m_state == Debugging, return);
if (m_engine)
m_engine->showMessage(QString::fromUtf8(output), Debugger::AppOutput);
}
void QnxDebugSupport::handleSshError(const QString &error)
{
if (m_state == Debugging) {
if (m_engine) {
m_engine->showMessage(error, Debugger::AppError);
m_engine->notifyInferiorIll();
}
} else if (m_state != Inactive) {
setFinished();
if (m_engine)
m_engine->notifyEngineRemoteSetupFailed(tr("Initial setup failed: %1").arg(error));
}
}

View File

@@ -0,0 +1,90 @@
/**************************************************************************
**
** 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_QNXDEBUGSUPPORT_H
#define QNX_INTERNAL_QNXDEBUGSUPPORT_H
#include <QObject>
namespace Debugger {
class DebuggerEngine;
}
namespace Qnx {
namespace Internal {
class QnxApplicationRunner;
class QnxRunConfiguration;
class QnxDebugSupport : public QObject
{
Q_OBJECT
public:
explicit QnxDebugSupport(QnxRunConfiguration *runConfig,
Debugger::DebuggerEngine *engine);
public slots:
void handleDebuggingFinished();
private slots:
void handleAdapterSetupRequested();
void startExecution();
void handleRemoteProcessStarted();
void handleRemoteProcessFinished(qint64 exitCode);
void handleProgressReport(const QString &progressOutput);
void handleRemoteOutput(const QByteArray &output);
void handleSshError(const QString &error);
private:
void setFinished();
enum State {
Inactive,
StartingRunner,
StartingRemoteProcess,
Debugging
};
QnxApplicationRunner *m_runner;
Debugger::DebuggerEngine *m_engine;
int m_port;
State m_state;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_QNXDEBUGSUPPORT_H

View File

@@ -0,0 +1,47 @@
/**************************************************************************
**
** 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 "qnxdeployconfiguration.h"
using namespace Qnx;
using namespace Qnx::Internal;
QnxDeployConfiguration::QnxDeployConfiguration(ProjectExplorer::Target *target, const Core::Id id, const QString &defaultDisplayName)
: RemoteLinux::RemoteLinuxDeployConfiguration(target, id, defaultDisplayName)
{
}
QnxDeployConfiguration::QnxDeployConfiguration(ProjectExplorer::Target *target, QnxDeployConfiguration *source)
: RemoteLinux::RemoteLinuxDeployConfiguration(target, source)
{
}

View File

@@ -0,0 +1,59 @@
/**************************************************************************
**
** 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_QNXDEPLOYCONFIGURATION_H
#define QNX_INTERNAL_QNXDEPLOYCONFIGURATION_H
#include <remotelinux/remotelinuxdeployconfiguration.h>
namespace Qnx {
namespace Internal {
class QnxDeployConfiguration : public RemoteLinux::RemoteLinuxDeployConfiguration
{
Q_OBJECT
public:
QnxDeployConfiguration(ProjectExplorer::Target *target, const Core::Id id,
const QString &defaultDisplayName);
QnxDeployConfiguration(ProjectExplorer::Target *target,
QnxDeployConfiguration *source);
private:
friend class QnxDeployConfigurationFactory;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_QNXDEPLOYCONFIGURATION_H

View File

@@ -0,0 +1,128 @@
/**************************************************************************
**
** 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 "qnxdeployconfigurationfactory.h"
#include "qnxconstants.h"
#include "qnxdeployconfiguration.h"
#include "qnxdeviceconfigurationfactory.h"
#include <projectexplorer/profileinformation.h>
#include <projectexplorer/target.h>
#include <remotelinux/genericdirectuploadstep.h>
using namespace Qnx;
using namespace Qnx::Internal;
QnxDeployConfigurationFactory::QnxDeployConfigurationFactory(QObject *parent)
: ProjectExplorer::DeployConfigurationFactory(parent)
{
}
QList<Core::Id> QnxDeployConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
{
QList<Core::Id> ids;
if (canHandle(parent))
ids << Core::Id(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID);
return ids;
}
QString QnxDeployConfigurationFactory::displayNameForId(const Core::Id id) const
{
if (id.toString().startsWith(QLatin1String(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID)))
return tr("Deploy to QNX Device");
return QString();
}
bool QnxDeployConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
{
if (!canHandle(parent)
|| !id.toString().startsWith(QLatin1String(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID)))
return false;
return true;
}
ProjectExplorer::DeployConfiguration *QnxDeployConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id)
{
if (!canCreate(parent, id))
return 0;
ProjectExplorer::DeployConfiguration * const dc = new QnxDeployConfiguration(parent, id,
displayNameForId(id));
dc->stepList()->insertStep(0, new RemoteLinux::GenericDirectUploadStep(dc->stepList(),
RemoteLinux::GenericDirectUploadStep::stepId()));
return dc;
}
bool QnxDeployConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
{
return canCreate(parent, ProjectExplorer::idFromMap(map));
}
ProjectExplorer::DeployConfiguration *QnxDeployConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
Core::Id id = ProjectExplorer::idFromMap(map);
QnxDeployConfiguration * const dc = new QnxDeployConfiguration(parent, id, displayNameForId(id));
if (!dc->fromMap(map)) {
delete dc;
return 0;
}
return dc;
}
bool QnxDeployConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *source) const
{
return canCreate(parent, source->id());
}
ProjectExplorer::DeployConfiguration *QnxDeployConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *source)
{
if (!canClone(parent, source))
return 0;
return new QnxDeployConfiguration(parent, qobject_cast<QnxDeployConfiguration *>(source));
}
bool QnxDeployConfigurationFactory::canHandle(ProjectExplorer::Target *t) const
{
Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(t->profile());
if (deviceType != QnxDeviceConfigurationFactory::deviceType())
return false;
return true;
}

View File

@@ -0,0 +1,70 @@
/**************************************************************************
**
** 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_QNXDEPLOYCONFIGURATIONFACTORY_H
#define QNX_INTERNAL_QNXDEPLOYCONFIGURATIONFACTORY_H
#include <projectexplorer/deployconfiguration.h>
namespace Qnx {
namespace Internal {
class QnxDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
{
Q_OBJECT
public:
explicit QnxDeployConfigurationFactory(QObject *parent = 0);
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);
bool canHandle(ProjectExplorer::Target *t) const;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_QNXDEPLOYCONFIGURATIONFACTORY_H

View File

@@ -0,0 +1,109 @@
/**************************************************************************
**
** 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 "qnxdeploystepfactory.h"
#include "qnxconstants.h"
#include "qnxdeviceconfigurationfactory.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/profileinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <remotelinux/genericdirectuploadstep.h>
using namespace Qnx;
using namespace Qnx::Internal;
QnxDeployStepFactory::QnxDeployStepFactory()
: ProjectExplorer::IBuildStepFactory()
{
}
QList<Core::Id> QnxDeployStepFactory::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 != QnxDeviceConfigurationFactory::deviceType())
return QList<Core::Id>();
return QList<Core::Id>() << RemoteLinux::GenericDirectUploadStep::stepId();
}
QString QnxDeployStepFactory::displayNameForId(const Core::Id id) const
{
if (id == RemoteLinux::GenericDirectUploadStep::stepId())
return RemoteLinux::GenericDirectUploadStep::displayName();
return QString();
}
bool QnxDeployStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
{
return availableCreationIds(parent).contains(id);
}
ProjectExplorer::BuildStep *QnxDeployStepFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
{
if (!canCreate(parent, id))
return 0;
return new RemoteLinux::GenericDirectUploadStep(parent, id);
}
bool QnxDeployStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
{
return canCreate(parent, ProjectExplorer::idFromMap(map));
}
ProjectExplorer::BuildStep *QnxDeployStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
ProjectExplorer::BuildStep * const bs = create(parent, ProjectExplorer::idFromMap(map));
if (bs->fromMap(map))
return bs;
delete bs;
return 0;
}
bool QnxDeployStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const
{
return canCreate(parent, product->id());
}
ProjectExplorer::BuildStep *QnxDeployStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
{
if (!canClone(parent, product))
return 0;
return new RemoteLinux::GenericDirectUploadStep(parent, static_cast<RemoteLinux::GenericDirectUploadStep *>(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_QNXDEPLOYSTEPFACTORY_H
#define QNX_INTERNAL_QNXDEPLOYSTEPFACTORY_H
#include <projectexplorer/buildstep.h>
namespace Qnx {
namespace Internal {
class QnxDeployStepFactory : public ProjectExplorer::IBuildStepFactory
{
Q_OBJECT
public:
explicit QnxDeployStepFactory();
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_QNXDEPLOYSTEPFACTORY_H

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.
**
**************************************************************************/
#include "qnxdeviceconfiguration.h"
using namespace Qnx;
using namespace Qnx::Internal;
QnxDeviceConfiguration::QnxDeviceConfiguration()
: RemoteLinux::LinuxDeviceConfiguration()
{
}
QnxDeviceConfiguration::QnxDeviceConfiguration(const QString &name, Core::Id type, MachineType machineType, Origin origin, Core::Id id)
: RemoteLinux::LinuxDeviceConfiguration(name, type, machineType, origin, id)
{
}
QnxDeviceConfiguration::QnxDeviceConfiguration(const QnxDeviceConfiguration &other)
: RemoteLinux::LinuxDeviceConfiguration(other)
{
}
QnxDeviceConfiguration::Ptr QnxDeviceConfiguration::create()
{
return Ptr(new QnxDeviceConfiguration);
}
QnxDeviceConfiguration::Ptr QnxDeviceConfiguration::create(const QString &name, Core::Id type, RemoteLinux::LinuxDeviceConfiguration::MachineType machineType, ProjectExplorer::IDevice::Origin origin, Core::Id id)
{
return Ptr(new QnxDeviceConfiguration(name, type, machineType, origin, id));
}
QString QnxDeviceConfiguration::displayType() const
{
return tr("QNX");
}
ProjectExplorer::IDevice::Ptr QnxDeviceConfiguration::clone() const
{
return Ptr(new QnxDeviceConfiguration(*this));
}

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_QNXDEVICECONFIGURATION_H
#define QNX_INTERNAL_QNXDEVICECONFIGURATION_H
#include <remotelinux/linuxdeviceconfiguration.h>
namespace Qnx {
namespace Internal {
class QnxDeviceConfiguration : public RemoteLinux::LinuxDeviceConfiguration
{
public:
typedef QSharedPointer<QnxDeviceConfiguration> Ptr;
typedef QSharedPointer<const QnxDeviceConfiguration> ConstPtr;
static Ptr create();
static Ptr create(const QString &name, Core::Id type, MachineType machineType,
Origin origin = ManuallyAdded, Core::Id id = Core::Id());
ProjectExplorer::IDevice::Ptr clone() const;
QString displayType() const;
protected:
QnxDeviceConfiguration();
QnxDeviceConfiguration(const QString &name, Core::Id type, MachineType machineType,
Origin origin, Core::Id id);
QnxDeviceConfiguration(const QnxDeviceConfiguration &other);
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_QNXDEVICECONFIGURATION_H

View File

@@ -0,0 +1,94 @@
/**************************************************************************
**
** 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 "qnxdeviceconfigurationfactory.h"
#include "qnxconstants.h"
#include "qnxdeviceconfigurationwizard.h"
#include "qnxdeviceconfiguration.h"
#include <utils/qtcassert.h>
using namespace Qnx;
using namespace Qnx::Internal;
QnxDeviceConfigurationFactory::QnxDeviceConfigurationFactory(QObject *parent) :
ProjectExplorer::IDeviceFactory(parent)
{
}
QString QnxDeviceConfigurationFactory::displayNameForId(Core::Id type) const
{
Q_UNUSED(type);
return tr("QNX Device");
}
QList<Core::Id> QnxDeviceConfigurationFactory::availableCreationIds() const
{
QList<Core::Id> result;
result << Core::Id(Constants::QNX_QNX_OS_TYPE);
return result;
}
bool QnxDeviceConfigurationFactory::canCreate() const
{
return true;
}
ProjectExplorer::IDevice::Ptr QnxDeviceConfigurationFactory::create(Core::Id id) const
{
Q_UNUSED(id);
QnxDeviceConfigurationWizard wizard;
if (wizard.exec() != QDialog::Accepted) {
return ProjectExplorer::IDevice::Ptr();
}
return wizard.device();
}
bool QnxDeviceConfigurationFactory::canRestore(const QVariantMap &map) const
{
return ProjectExplorer::IDevice::typeFromMap(map) == Core::Id(Constants::QNX_QNX_OS_TYPE);
}
ProjectExplorer::IDevice::Ptr QnxDeviceConfigurationFactory::restore(const QVariantMap &map) const
{
QTC_ASSERT(canRestore(map), return QnxDeviceConfiguration::Ptr());
const QnxDeviceConfiguration::Ptr device = QnxDeviceConfiguration::create();
device->fromMap(map);
return device;
}
Core::Id QnxDeviceConfigurationFactory::deviceType()
{
return Core::Id(Constants::QNX_QNX_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_QNXDEVICECONFIGURATIONFACTORY_H
#define QNX_INTERNAL_QNXDEVICECONFIGURATIONFACTORY_H
#include <projectexplorer/devicesupport/idevicefactory.h>
namespace Qnx {
namespace Internal {
class QnxDeviceConfigurationFactory : public ProjectExplorer::IDeviceFactory
{
Q_OBJECT
public:
explicit QnxDeviceConfigurationFactory(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_QNXDEVICECONFIGURATIONFACTORY_H

View File

@@ -0,0 +1,90 @@
/**************************************************************************
**
** 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 "qnxdeviceconfigurationwizard.h"
#include "qnxconstants.h"
#include "qnxdeviceconfigurationwizardpages.h"
#include "qnxdeviceconfiguration.h"
#include <remotelinux/genericlinuxdeviceconfigurationwizardpages.h>
#include <remotelinux/linuxdevicetestdialog.h>
#include <remotelinux/linuxdevicetester.h>
#include <utils/portlist.h>
#include <remotelinux/remotelinuxusedportsgatherer.h>
#include <ssh/sshconnection.h>
using namespace Qnx;
using namespace Qnx::Internal;
QnxDeviceConfigurationWizard::QnxDeviceConfigurationWizard(QWidget *parent) :
QWizard(parent)
{
setWindowTitle(tr("New QNX Device Configuration Setup"));
m_setupPage = new QnxDeviceConfigurationWizardSetupPage(this);
m_finalPage = new RemoteLinux::GenericLinuxDeviceConfigurationWizardFinalPage(this);
setPage(SetupPageId, m_setupPage);
setPage(FinalPageId, m_finalPage);
m_finalPage->setCommitPage(true);
}
ProjectExplorer::IDevice::Ptr QnxDeviceConfigurationWizard::device()
{
QSsh::SshConnectionParameters sshParams;
sshParams.proxyType = QSsh::SshConnectionParameters::NoProxy;
sshParams.host = m_setupPage->hostName();
sshParams.userName = m_setupPage->userName();
sshParams.port = 22;
sshParams.timeout = 10;
sshParams.authenticationType = m_setupPage->authenticationType();
if (sshParams.authenticationType == QSsh::SshConnectionParameters::AuthenticationByPassword) {
sshParams.password = m_setupPage->password();
} else {
sshParams.privateKeyFile = m_setupPage->privateKeyFilePath();
}
QnxDeviceConfiguration::Ptr devConf = QnxDeviceConfiguration::create(m_setupPage->configurationName(),
Core::Id(Constants::QNX_QNX_OS_TYPE), RemoteLinux::LinuxDeviceConfiguration::Hardware);
devConf->setSshParameters(sshParams);
devConf->setFreePorts(Utils::PortList::fromString(QLatin1String("10000-10100")));
RemoteLinux::GenericLinuxDeviceTester *devTester = new RemoteLinux::GenericLinuxDeviceTester(this);
devTester->usedPortsGatherer()->setCommand(QLatin1String(Constants::QNX_PORT_GATHERER_COMMAND));
RemoteLinux::LinuxDeviceTestDialog dlg(devConf, devTester, this);
dlg.exec();
return devConf;
}

View File

@@ -0,0 +1,70 @@
/**************************************************************************
**
** 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_QNXDEVICECONFIGURATIONWIZARD_H
#define QNX_INTERNAL_QNXDEVICECONFIGURATIONWIZARD_H
#include <QWizard>
#include <projectexplorer/devicesupport/idevice.h>
namespace RemoteLinux {
class GenericLinuxDeviceConfigurationWizardSetupPage;
class GenericLinuxDeviceConfigurationWizardFinalPage;
}
namespace Qnx {
namespace Internal {
class QnxDeviceConfigurationWizard : public QWizard
{
Q_OBJECT
public:
explicit QnxDeviceConfigurationWizard(QWidget *parent = 0);
ProjectExplorer::IDevice::Ptr device();
private:
enum PageId {
SetupPageId,
FinalPageId
};
RemoteLinux::GenericLinuxDeviceConfigurationWizardSetupPage *m_setupPage;
RemoteLinux::GenericLinuxDeviceConfigurationWizardFinalPage *m_finalPage;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_QNXDEVICECONFIGURATIONWIZARD_H

View File

@@ -0,0 +1,50 @@
/**************************************************************************
**
** 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 "qnxdeviceconfigurationwizardpages.h"
namespace Qnx {
namespace Internal {
QnxDeviceConfigurationWizardSetupPage::QnxDeviceConfigurationWizardSetupPage(QWidget *parent) :
RemoteLinux::GenericLinuxDeviceConfigurationWizardSetupPage(parent)
{
}
QString QnxDeviceConfigurationWizardSetupPage::defaultConfigurationName() const
{
return tr("QNX Device");
}
} // namespace Internal
} // namespace Qnx

View File

@@ -0,0 +1,54 @@
/**************************************************************************
**
** 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_QNXDEVICECONFIGURATIONWIZARDPAGES_H
#define QNX_INTERNAL_QNXDEVICECONFIGURATIONWIZARDPAGES_H
#include <remotelinux/genericlinuxdeviceconfigurationwizardpages.h>
namespace Qnx {
namespace Internal {
class QnxDeviceConfigurationWizardSetupPage : public RemoteLinux::GenericLinuxDeviceConfigurationWizardSetupPage
{
Q_OBJECT
public:
explicit QnxDeviceConfigurationWizardSetupPage(QWidget *parent = 0);
QString defaultConfigurationName() const;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_QNXDEVICECONFIGURATIONWIZARDPAGES_H

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.
**
**************************************************************************/
#include "qnxplugin.h"
#include "blackberrydeviceconfigurationfactory.h"
#include "qnxconstants.h"
#include "blackberryqtversionfactory.h"
#include "blackberrydeployconfigurationfactory.h"
#include "blackberrycreatepackagestepfactory.h"
#include "blackberrydeploystepfactory.h"
#include "blackberryrunconfigurationfactory.h"
#include "blackberryruncontrolfactory.h"
#include "qnxdeviceconfigurationfactory.h"
#include "qnxruncontrolfactory.h"
#include "qnxdeploystepfactory.h"
#include "qnxdeployconfigurationfactory.h"
#include "qnxrunconfigurationfactory.h"
#include "qnxqtversionfactory.h"
#include "blackberrywizardextension.h"
#include <QtPlugin>
using namespace Qnx::Internal;
QNXPlugin::QNXPlugin()
{
}
QNXPlugin::~QNXPlugin()
{
}
bool QNXPlugin::initialize(const QStringList &arguments, QString *errorString)
{
Q_UNUSED(arguments)
Q_UNUSED(errorString)
// Handles BlackBerry
addAutoReleasedObject(new BlackBerryQtVersionFactory);
addAutoReleasedObject(new BlackBerryDeployConfigurationFactory);
addAutoReleasedObject(new BlackBerryDeviceConfigurationFactory);
addAutoReleasedObject(new BlackBerryCreatePackageStepFactory);
addAutoReleasedObject(new BlackBerryDeployStepFactory);
addAutoReleasedObject(new BlackBerryRunConfigurationFactory);
addAutoReleasedObject(new BlackBerryRunControlFactory);
addAutoReleasedObject(new BlackBerryWizardExtension);
// Handles QNX
addAutoReleasedObject(new QnxQtVersionFactory);
addAutoReleasedObject(new QnxDeviceConfigurationFactory);
addAutoReleasedObject(new QnxRunControlFactory);
addAutoReleasedObject(new QnxDeployStepFactory);
addAutoReleasedObject(new QnxDeployConfigurationFactory);
addAutoReleasedObject(new QnxRunConfigurationFactory);
return true;
}
void QNXPlugin::extensionsInitialized()
{
}
ExtensionSystem::IPlugin::ShutdownFlag QNXPlugin::aboutToShutdown()
{
return SynchronousShutdown;
}
Q_EXPORT_PLUGIN2(QNX, QNXPlugin)

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