Qnx: Install/uninstall NDK targets

Basic implementation of an install/uninstall targets utility.

Note: This does not support 10.1 NKDs.

Change-Id: I3bb29ef467dd24a121ee59e11abb2237dcff696a
Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
This commit is contained in:
El Mehdi Fekari
2013-09-12 18:35:41 +02:00
committed by Mehdi Fekari
parent 668a50b775
commit 59a578d4a9
15 changed files with 1137 additions and 53 deletions

View File

@@ -65,6 +65,8 @@ public:
QMultiMap<QString, QString> defaultQnxEnv(); QMultiMap<QString, QString> defaultQnxEnv();
void loadAutoDetectedConfigurations();
public slots: public slots:
void loadSettings(); void loadSettings();
void saveSettings(); void saveSettings();
@@ -78,7 +80,6 @@ private:
QList<BlackBerryConfiguration*> m_configs; QList<BlackBerryConfiguration*> m_configs;
void loadManualConfigurations(); void loadManualConfigurations();
void loadAutoDetectedConfigurations();
void saveManualConfigurations(); void saveManualConfigurations();
void saveActiveConfigurationNdkEnvPath(); void saveActiveConfigurationNdkEnvPath();
void clearInvalidConfigurations(); void clearInvalidConfigurations();

View File

@@ -0,0 +1,90 @@
/**************************************************************************
**
** Copyright (C) 2013 BlackBerry Limited. All rights reserved
**
** Contact: BlackBerry (qt@blackberry.com)
** Contact: KDAB (info@kdab.com)
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 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, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "blackberryinstallwizard.h"
#include "blackberryinstallwizardpages.h"
#include <QAbstractButton>
#include <QMessageBox>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryInstallWizard::BlackBerryInstallWizard(BlackBerryInstallerDataHandler::Mode mode,
const QString& version,
QWidget *parent)
: QWizard(parent)
, m_ndkPage(0)
, m_targetPage(0)
{
setWindowTitle(tr("BlackBerry NDK Installation Wizard"));
m_data.mode = mode;
m_data.version = version;
if (m_data.mode != BlackBerryInstallerDataHandler::UninstallMode) {
m_optionPage = new BlackBerryInstallWizardOptionPage(m_data, this);
m_ndkPage = new BlackBerryInstallWizardNdkPage(m_data, this);
m_targetPage = new BlackBerryInstallWizardTargetPage(m_data, this);
setPage(OptionPage, m_optionPage);
setPage(NdkPageId, m_ndkPage);
setPage(TargetPageId, m_targetPage);
}
m_processPage = new BlackBerryInstallWizardProcessPage(m_data, this);
m_finalPage = new BlackBerryInstallWizardFinalPage(m_data, this);
connect(m_finalPage, SIGNAL(done()), this, SIGNAL(processFinished()));
disconnect(button(CancelButton), SIGNAL(clicked()), this, SLOT(reject()));
connect(button(CancelButton), SIGNAL(clicked()), this, SLOT(handleProcessCancelled()));
setPage(ProcessPageId, m_processPage);
setPage(FinalPageId, m_finalPage);
m_finalPage->setCommitPage(true);
setOption(DisabledBackButtonOnLastPage, true);
}
void BlackBerryInstallWizard::handleProcessCancelled()
{
if ((m_targetPage && m_targetPage->isProcessRunning())
|| m_processPage->isProcessRunning()) {
const QMessageBox::StandardButton answer = QMessageBox::question(this, tr("Confirmation"),
tr("Are you sure you want to cancel?"),
QMessageBox::Yes | QMessageBox::No);
if (answer == QMessageBox::No)
return;
}
reject();
}

View File

@@ -0,0 +1,100 @@
/**************************************************************************
**
** Copyright (C) 2013 BlackBerry Limited. All rights reserved
**
** Contact: BlackBerry (qt@blackberry.com)
** Contact: KDAB (info@kdab.com)
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 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, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIZARD_H
#define QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIZARD_H
#include <QProcess>
#include <QWizard>
namespace Qnx {
namespace Internal {
class BlackBerryInstallWizardOptionPage;
class BlackBerryInstallWizardNdkPage;
class BlackBerryInstallWizardTargetPage;
class BlackBerryInstallWizardProcessPage;
class BlackBerryInstallWizardFinalPage;
class BlackBerryInstallerDataHandler {
public:
enum Mode {
InstallMode,
UninstallMode,
ManuallMode
};
QString ndkPath;
QString target;
QString version;
int exitCode;
QProcess::ExitStatus exitStatus;
Mode mode;
};
class BlackBerryInstallWizard : public QWizard
{
Q_OBJECT
public:
enum PageId {
OptionPage,
NdkPageId,
TargetPageId,
ProcessPageId,
FinalPageId
};
explicit BlackBerryInstallWizard(BlackBerryInstallerDataHandler::Mode mode = BlackBerryInstallerDataHandler::InstallMode,
const QString& version = QString(),
QWidget *parent = 0);
signals:
void processFinished();
private slots:
void handleProcessCancelled();
private:
BlackBerryInstallWizardOptionPage *m_optionPage;
BlackBerryInstallWizardNdkPage *m_ndkPage;
BlackBerryInstallWizardTargetPage *m_targetPage;
BlackBerryInstallWizardProcessPage *m_processPage;
BlackBerryInstallWizardFinalPage *m_finalPage;
BlackBerryInstallerDataHandler m_data;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIZARD_H

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BlackBerryInstallWizardNdkPage</class>
<widget class="QWidget" name="Qnx::Internal::BlackBerryInstallWizardNdkPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Select NDK Path</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="ndkPathListWidget"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,499 @@
/**************************************************************************
**
** Copyright (C) 2013 BlackBerry Limited. All rights reserved
**
** Contact: BlackBerry (qt@blackberry.com)
** Contact: KDAB (info@kdab.com)
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 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, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "blackberryinstallwizardpages.h"
#include "blackberryconfigurationmanager.h"
#include "blackberryconfiguration.h"
#include "ui_blackberryinstallwizardtargetpage.h"
#include "ui_blackberryinstallwizardprocesspage.h"
#include "ui_blackberryinstallwizardndkpage.h"
#include "qnxutils.h"
#include <utils/synchronousprocess.h>
#include <utils/pathchooser.h>
#include <QProcess>
#include <QTreeWidgetItem>
#include <QFileInfo>
#include <QDir>
#include <QMessageBox>
#include <QLayout>
#include <QRadioButton>
namespace Qnx {
namespace Internal {
namespace {
const QLatin1String targetKeyWord("Native SDK");
}
NdkPathChooser::NdkPathChooser(Mode mode, QWidget *parent)
: Utils::PathChooser(parent)
, m_mode(mode)
{
if (m_mode == NdkPathChooser::InstallMode)
setExpectedKind(Utils::PathChooser::Directory);
else
setExpectedKind(Utils::PathChooser::File);
}
bool NdkPathChooser::validatePath(const QString &path, QString *errorMessage)
{
bool result = PathChooser::validatePath(path, errorMessage);
if (!result)
return false;
if (m_mode == NdkPathChooser::InstallMode)
return !(QnxUtils::sdkInstallerPath(path).isEmpty());
QFileInfo fi(path);
return (fi.suffix() == QLatin1String("sh") || fi.suffix() == QLatin1String("bat"));
}
//------------------------------------------------------------------
BlackBerryInstallWizardOptionPage::BlackBerryInstallWizardOptionPage(BlackBerryInstallerDataHandler &data,
QWidget *parent)
: QWizardPage(parent)
, m_layout(new QVBoxLayout(this))
, m_installButton(new QRadioButton)
, m_addButton(new QRadioButton)
, m_envFileChooser(new NdkPathChooser(NdkPathChooser::ManualMode))
, m_data(data)
{
connect(m_addButton, SIGNAL(toggled(bool)), this, SLOT(handleOptionChanged()));
connect(m_envFileChooser, SIGNAL(pathChanged(QString)), this, SLOT(handlePathChanged(QString)));
}
void BlackBerryInstallWizardOptionPage::initializePage()
{
m_installButton->setText(tr("Install a new target"));
m_addButton->setText(tr("Add an existing target"));
if (m_data.mode == BlackBerryInstallerDataHandler::ManuallMode)
m_addButton->setChecked(true);
else
m_installButton->setChecked(true);
m_envFileChooser->setEnabled(m_addButton->isChecked());
m_layout->addWidget(m_installButton);
m_layout->addWidget(m_addButton);
m_layout->addWidget(m_envFileChooser);
}
bool BlackBerryInstallWizardOptionPage::isComplete() const
{
return (m_installButton->isChecked()
|| (m_addButton->isChecked() && m_envFileChooser->isValid()));
}
int BlackBerryInstallWizardOptionPage::nextId() const
{
if (m_addButton->isChecked())
return BlackBerryInstallWizard::FinalPageId;
return BlackBerryInstallWizard::NdkPageId;
}
void BlackBerryInstallWizardOptionPage::handleOptionChanged()
{
if (m_addButton->isChecked())
m_data.mode = BlackBerryInstallerDataHandler::ManuallMode;
else
m_data.mode = BlackBerryInstallerDataHandler::InstallMode;
m_envFileChooser->setEnabled(m_addButton->isChecked());
emit completeChanged();
}
void BlackBerryInstallWizardOptionPage::handlePathChanged(const QString &envFilePath)
{
if (m_envFileChooser->isValid())
m_data.ndkPath = envFilePath;
emit completeChanged();
}
//------------------------------------------------------------------
BlackBerryInstallWizardNdkPage::BlackBerryInstallWizardNdkPage(BlackBerryInstallerDataHandler &data, QWidget *parent)
: QWizardPage(parent)
, m_ui(new Ui_BlackBerryInstallWizardNdkPage)
, m_data(data)
, m_ndkPathChooser(new NdkPathChooser(NdkPathChooser::InstallMode))
, m_manual(new QListWidgetItem)
, m_validNdkPath(false)
{
m_ui->setupUi(this);
m_ui->verticalLayout->addWidget(m_ndkPathChooser);
connect(m_ui->ndkPathListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(setNdkPath()));
connect(m_ndkPathChooser, SIGNAL(pathChanged(QString)), this, SLOT(setManualNdkPath()));
}
BlackBerryInstallWizardNdkPage::~BlackBerryInstallWizardNdkPage()
{
delete m_ui;
}
void BlackBerryInstallWizardNdkPage::initializePage()
{
m_manual->setText(tr("Specify 10.2 NDK path manually"));
m_ui->ndkPathListWidget->addItem(m_manual);
m_manual->setSelected(true);
QFont font;
font.setItalic(true);
m_manual->setFont(font);
foreach (const NdkInstallInformation &ndk, QnxUtils::installedNdks()) {
bool found = false;
for (int i = 0; i < m_ui->ndkPathListWidget->count(); i++) {
QListWidgetItem* item = m_ui->ndkPathListWidget->item(i);
if (item->text() == ndk.path) {
found = true;
break;
}
}
if (found)
continue;
if (!QnxUtils::sdkInstallerPath(ndk.path).isEmpty()) {
QListWidgetItem *ndkItem = new QListWidgetItem(m_ui->ndkPathListWidget);
ndkItem->setText(ndk.path);
}
}
}
void BlackBerryInstallWizardNdkPage::setNdkPath()
{
if (m_ui->ndkPathListWidget->selectedItems().isEmpty())
return;
m_ndkPathChooser->setEnabled(m_manual->isSelected());
QString selected = m_ui->ndkPathListWidget->selectedItems().first()->text();
if (!QnxUtils::sdkInstallerPath(selected).isEmpty()) {
m_validNdkPath = true;
m_data.ndkPath = selected;
} else {
m_validNdkPath = false;
}
emit completeChanged();
}
void BlackBerryInstallWizardNdkPage::setManualNdkPath()
{
if (m_ndkPathChooser->isValid()) {
m_validNdkPath = true;
m_data.ndkPath = m_ndkPathChooser->path();
} else {
m_validNdkPath = false;
}
emit completeChanged();
}
bool BlackBerryInstallWizardNdkPage::isComplete() const
{
return m_validNdkPath;
}
//------------------------------------------------------------------
BlackBerryInstallWizardTargetPage::BlackBerryInstallWizardTargetPage(BlackBerryInstallerDataHandler &data,
QWidget *parent)
: QWizardPage(parent)
, m_data(data)
, m_ui(new Ui_BlackBerryInstallWizardTargetPage)
, m_isTargetValid(false)
, m_targetListProcess(new QProcess(this))
{
m_ui->setupUi(this);
connect(m_targetListProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(targetsListProcessFinished()));
connect(m_ui->targetsTreeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(setTarget()));
}
BlackBerryInstallWizardTargetPage::~BlackBerryInstallWizardTargetPage()
{
Utils::SynchronousProcess::stopProcess(*m_targetListProcess);
delete m_ui;
}
void BlackBerryInstallWizardTargetPage::initializePage()
{
// process may be running if going back and forth
if (m_targetListProcess->state() == QProcess::Running) {
disconnect(m_targetListProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(targetsListProcessFinished()));
Utils::SynchronousProcess::stopProcess(*m_targetListProcess);
connect(m_targetListProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(targetsListProcessFinished()));
}
updateAvailableTargetsList();
}
bool BlackBerryInstallWizardTargetPage::isComplete() const
{
return m_isTargetValid;
}
bool BlackBerryInstallWizardTargetPage::isProcessRunning() const
{
return (m_targetListProcess->state() == QProcess::Running);
}
void BlackBerryInstallWizardTargetPage::targetsListProcessFinished()
{
initTargetsTreeWidget();
QString output = Utils::SynchronousProcess::normalizeNewlines(QString::fromLatin1(m_targetListProcess->readAll()));
QList<QString> targetList = output.split(QLatin1Char('\n'));
m_ui->targetsTreeWidget->clear();
foreach (const QString &target, targetList) {
if (!target.isEmpty() && target.contains(targetKeyWord)) {
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui->targetsTreeWidget);
QStringList res = target.split(QLatin1Char('-'));
if (res.count() > 1) {
item->setText(0, res.at(0));
item->setText(1, res.at(1));
}
}
}
m_ui->targetsTreeWidget->sortByColumn(0, Qt::DescendingOrder);
}
void BlackBerryInstallWizardTargetPage::setTarget()
{
if (m_ui->targetsTreeWidget->selectedItems().isEmpty())
return;
QString version = m_ui->targetsTreeWidget->selectedItems().first()->text(0);
QString target = m_ui->targetsTreeWidget->selectedItems().first()->text(1);
if (target.contains(targetKeyWord)) {
m_data.target = target;
m_data.version = version;
m_isTargetValid = true;
} else {
m_isTargetValid = false;
}
emit completeChanged();
}
void BlackBerryInstallWizardTargetPage::initTargetsTreeWidget()
{
m_ui->targetsTreeWidget->clear();
m_ui->targetsTreeWidget->setHeaderHidden(false);
m_ui->targetsTreeWidget->header()->setResizeMode(QHeaderView::ResizeToContents);
m_ui->targetsTreeWidget->setHeaderItem(new QTreeWidgetItem(QStringList() << tr("Version") << tr("Target")));
m_ui->targetsTreeWidget->setTextElideMode(Qt::ElideNone);
m_ui->targetsTreeWidget->setColumnCount(2);
}
void BlackBerryInstallWizardTargetPage::updateAvailableTargetsList()
{
m_ui->targetsTreeWidget->clear();
m_ui->targetsTreeWidget->setHeaderHidden(true);
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui->targetsTreeWidget);
item->setText(0, tr("Querying available targets. Please wait.."));
QFont font;
font.setItalic(true);
item->setFont(0, font);
QString qdeProcess = QnxUtils::qdeInstallProcess(m_data.ndkPath, QLatin1String(" --list"));
QTC_ASSERT(!qdeProcess.isEmpty(), return);
m_targetListProcess->start(qdeProcess);
}
//------------------------------------------------------------------
BlackBerryInstallWizardProcessPage::BlackBerryInstallWizardProcessPage(BlackBerryInstallerDataHandler &data,
QWidget *parent)
: QWizardPage(parent)
, m_ui(new Ui_BlackBerryInstallWizardProcessPage)
, m_data(data)
, m_targetProcess(new QProcess(this))
{
m_ui->setupUi(this);
connect(m_targetProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(handleProcessFinished(int, QProcess::ExitStatus)));
}
BlackBerryInstallWizardProcessPage::~BlackBerryInstallWizardProcessPage()
{
Utils::SynchronousProcess::stopProcess(*m_targetProcess);
delete m_ui;
}
void BlackBerryInstallWizardProcessPage::initializePage()
{
if (m_data.mode == BlackBerryInstallerDataHandler::UninstallMode) {
if (m_data.version.isEmpty()) {
wizard()->next();
return;
}
foreach (const NdkInstallInformation &ndk, QnxUtils::installedNdks()) {
if (ndk.version == m_data.version) {
m_data.ndkPath = ndk.path;
m_data.target = ndk.name;
break;
}
}
m_ui->label->setText(tr("Uninstalling target:\n") + m_data.target);
} else {
m_ui->label->setText(tr("Installing target:\n") + m_data.target);
}
// m_targetProcess could be running
if (m_targetProcess->state() == QProcess::Running) {
disconnect(m_targetProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(handleProcessFinished(int, QProcess::ExitStatus)));
Utils::SynchronousProcess::stopProcess(*m_targetProcess);
connect(m_targetProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(handleProcessFinished(int, QProcess::ExitStatus)));
}
processTarget();
}
bool BlackBerryInstallWizardProcessPage::isComplete() const
{
return false;
}
bool BlackBerryInstallWizardProcessPage::isProcessRunning() const
{
return (m_targetProcess->state() == QProcess::Running);
}
void BlackBerryInstallWizardProcessPage::handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
m_data.exitCode = exitCode;
m_data.exitStatus = exitStatus;
if (wizard()->currentPage() == this)
wizard()->next();
}
void BlackBerryInstallWizardProcessPage::processTarget()
{
QString option;
if (m_data.mode == BlackBerryInstallerDataHandler::UninstallMode)
option = QLatin1String(" --uninstall");
else
option = QLatin1String(" --install");
QString version = m_data.version;
QTC_ASSERT(!version.isEmpty(), return);
// deactivate target if activated before uninstalling
if (m_data.mode == BlackBerryInstallerDataHandler::UninstallMode) {
foreach (BlackBerryConfiguration *config, BlackBerryConfigurationManager::instance().configurations()) {
if (m_data.target.contains((config->targetName())) && config->isActive()) {
config->deactivate();
break;
}
}
}
// Killing the sdkinstall process won't kill the qde process it launched
// thus, let's directly launch the resulting qde process
QString qdeProcess = QnxUtils::qdeInstallProcess(m_data.ndkPath, option, version);
QTC_ASSERT(!qdeProcess.isEmpty(), return);
m_targetProcess->start(qdeProcess);
m_ui->progressBar->setMaximum(0);
m_ui->progressBar->setMinimum(0);
m_ui->progressBar->setValue(0);
}
// --------------------------------------------------------------------------------
BlackBerryInstallWizardFinalPage::BlackBerryInstallWizardFinalPage(BlackBerryInstallerDataHandler &data,
QWidget *parent)
: QWizardPage(parent)
, m_data(data)
{
}
void BlackBerryInstallWizardFinalPage::initializePage()
{
QVBoxLayout *layout = new QVBoxLayout(this);
QLabel *label = new QLabel(this);
layout->addWidget(label);
if (m_data.mode == BlackBerryInstallerDataHandler::ManuallMode) {
BlackBerryConfigurationManager &configManager = BlackBerryConfigurationManager::instance();
BlackBerryConfiguration *config = configManager.configurationFromEnvFile(Utils::FileName::fromString(m_data.ndkPath));
if (!config) {
config = new BlackBerryConfiguration(Utils::FileName::fromString(m_data.ndkPath), false);
if (!configManager.addConfiguration(config)) {
delete config;
// TODO: more explicit error message!
label->setText(tr("An error has occurred while adding target from:\n %1").arg(m_data.ndkPath));
return;
}
label->setText(tr("Target is being added.").arg(m_data.ndkPath));
emit done();
return;
} else {
label->setText(tr("Target is already added.").arg(m_data.ndkPath));
return;
}
}
QString actionMsg;
if (m_data.mode == BlackBerryInstallerDataHandler::UninstallMode)
actionMsg = tr("uninstalling");
else
actionMsg = tr("installing");
if (m_data.exitCode == 0 && m_data.exitStatus == QProcess::NormalExit) {
label->setText(tr("Finished %1 target:\n %2").arg(actionMsg, m_data.target));
emit done();
} else {
label->setText(tr("An error has occurred while %1 target:\n %2").arg(actionMsg, m_data.target));
}
}
} // namespace Internal
} // namespace Qnx

View File

@@ -0,0 +1,187 @@
/**************************************************************************
**
** Copyright (C) 2013 BlackBerry Limited. All rights reserved
**
** Contact: BlackBerry (qt@blackberry.com)
** Contact: KDAB (info@kdab.com)
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 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, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYINSTALLWIZARDPAGES_H
#define QNX_INTERNAL_BLACKBERRYINSTALLWIZARDPAGES_H
#include <QWizardPage>
#include <QListWidgetItem>
#include "blackberryinstallwizard.h"
#include <utils/pathchooser.h>
QT_BEGIN_NAMESPACE
class QProcess;
class QRadioButton;
class QVBoxLayout;
QT_END_NAMESPACE
namespace Qnx {
namespace Internal {
class Ui_BlackBerryInstallWizardNdkPage;
class Ui_BlackBerryInstallWizardTargetPage;
class Ui_BlackBerryInstallWizardProcessPage;
class NdkPathChooser : public Utils::PathChooser
{
Q_OBJECT
public:
enum Mode {
InstallMode, // Select a valid 10.2 NDK path
ManualMode // Select a target bbnk-env file path
};
NdkPathChooser(Mode mode, QWidget *parent = 0);
virtual bool validatePath(const QString &path, QString *errorMessage);
private:
Mode m_mode;
};
class BlackBerryInstallWizardOptionPage : public QWizardPage
{
Q_OBJECT
public:
explicit BlackBerryInstallWizardOptionPage(BlackBerryInstallerDataHandler &data, QWidget *parent = 0);
void initializePage();
bool isComplete() const;
int nextId() const;
protected slots:
void handleOptionChanged();
void handlePathChanged(const QString &envFilePath);
signals:
void installModeChanged();
private:
QVBoxLayout *m_layout;
QRadioButton* m_installButton;
QRadioButton* m_addButton;
NdkPathChooser* m_envFileChooser;
BlackBerryInstallerDataHandler &m_data;
};
class BlackBerryInstallWizardNdkPage : public QWizardPage
{
Q_OBJECT
public:
explicit BlackBerryInstallWizardNdkPage(BlackBerryInstallerDataHandler &data, QWidget *parent = 0);
~BlackBerryInstallWizardNdkPage();
void initializePage();
bool isComplete() const;
protected slots:
void setNdkPath();
void setManualNdkPath();
private:
Ui_BlackBerryInstallWizardNdkPage *m_ui;
BlackBerryInstallerDataHandler &m_data;
NdkPathChooser* m_ndkPathChooser;
QListWidgetItem* m_manual;
bool m_validNdkPath;
};
class BlackBerryInstallWizardTargetPage : public QWizardPage
{
Q_OBJECT
public:
explicit BlackBerryInstallWizardTargetPage(BlackBerryInstallerDataHandler &data, QWidget *parent = 0);
~BlackBerryInstallWizardTargetPage();
void initializePage();
bool isComplete() const;
bool isProcessRunning() const;
protected slots:
void targetsListProcessFinished();
void setTarget();
private:
BlackBerryInstallerDataHandler &m_data;
Ui_BlackBerryInstallWizardTargetPage *m_ui;
bool m_isTargetValid;
QProcess *m_targetListProcess;
void initTargetsTreeWidget();
void updateAvailableTargetsList();
};
class BlackBerryInstallWizardProcessPage : public QWizardPage
{
Q_OBJECT
public:
explicit BlackBerryInstallWizardProcessPage(BlackBerryInstallerDataHandler &data,
QWidget *parent = 0);
~BlackBerryInstallWizardProcessPage();
void initializePage();
bool isComplete() const;
bool isProcessRunning() const;
protected slots:
void handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
private:
Ui_BlackBerryInstallWizardProcessPage *m_ui;
BlackBerryInstallerDataHandler &m_data;
QProcess *m_targetProcess;
void processTarget();
};
class BlackBerryInstallWizardFinalPage : public QWizardPage
{
Q_OBJECT
public:
explicit BlackBerryInstallWizardFinalPage(BlackBerryInstallerDataHandler &data, QWidget *parent = 0);
void initializePage();
signals:
void done();
private:
BlackBerryInstallerDataHandler &m_data;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYINSTALLWIZARDPAGES_H

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BlackBerryInstallWizardProcessPage</class>
<widget class="QWidget" name="Qnx::Internal::BlackBerryInstallWizardProcessPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Please wait...</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BlackBerryInstallWizardTargetPage</class>
<widget class="QWidget" name="Qnx::Internal::BlackBerryInstallWizardTargetPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>543</width>
<height>373</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Please select target:</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="targetsTreeWidget">
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -60,13 +60,28 @@ BlackBerryNDKSettingsWidget::BlackBerryNDKSettingsWidget(QWidget *parent) :
m_bbConfigManager = &BlackBerryConfigurationManager::instance(); m_bbConfigManager = &BlackBerryConfigurationManager::instance();
m_ui->setupUi(this); m_ui->setupUi(this);
m_ui->removeNdkButton->setEnabled(false);
m_ui->activateNdkTargetButton->setEnabled(false); m_ui->activateNdkTargetButton->setEnabled(false);
m_ui->deactivateNdkTargetButton->setEnabled(false); m_ui->deactivateNdkTargetButton->setEnabled(false);
m_activatedTargets << m_bbConfigManager->activeConfigurations(); m_activatedTargets << m_bbConfigManager->activeConfigurations();
initNdkList(); m_ui->ndksTreeWidget->header()->setResizeMode(QHeaderView::Stretch);
m_ui->ndksTreeWidget->header()->setStretchLastSection(false);
m_ui->ndksTreeWidget->setHeaderItem(new QTreeWidgetItem(QStringList() << tr("NDK") << tr("NDK Environment File")));
m_ui->ndksTreeWidget->setTextElideMode(Qt::ElideNone);
m_ui->ndksTreeWidget->setColumnCount(2);
m_autoDetectedNdks = new QTreeWidgetItem(m_ui->ndksTreeWidget);
m_autoDetectedNdks->setText(0, tr("Auto-Detected"));
m_autoDetectedNdks->setFirstColumnSpanned(true);
m_autoDetectedNdks->setFlags(Qt::ItemIsEnabled);
m_manualNdks = new QTreeWidgetItem(m_ui->ndksTreeWidget);
m_manualNdks->setText(0, tr("Manual"));
m_manualNdks->setFirstColumnSpanned(true);
m_manualNdks->setFlags(Qt::ItemIsEnabled);
m_ui->ndksTreeWidget->expandAll();
updateNdkList();
connect(m_ui->wizardButton, SIGNAL(clicked()), this, SLOT(launchBlackBerrySetupWizard())); connect(m_ui->wizardButton, SIGNAL(clicked()), this, SLOT(launchBlackBerrySetupWizard()));
connect(m_ui->addNdkButton, SIGNAL(clicked()), this, SLOT(addNdkTarget())); connect(m_ui->addNdkButton, SIGNAL(clicked()), this, SLOT(addNdkTarget()));
@@ -146,13 +161,16 @@ void BlackBerryNDKSettingsWidget::updateInfoTable(QTreeWidgetItem* currentItem)
void BlackBerryNDKSettingsWidget::updateNdkList() void BlackBerryNDKSettingsWidget::updateNdkList()
{ {
qDeleteAll(m_autoDetectedNdks->takeChildren());
qDeleteAll(m_manualNdks->takeChildren());
foreach (BlackBerryConfiguration *config, m_bbConfigManager->configurations()) { foreach (BlackBerryConfiguration *config, m_bbConfigManager->configurations()) {
QTreeWidgetItem *parent = config->isAutoDetected() ? m_autoDetectedNdks : m_manualNdks; QTreeWidgetItem *parent = config->isAutoDetected() ? m_autoDetectedNdks : m_manualNdks;
QTreeWidgetItem *item = new QTreeWidgetItem(parent); QTreeWidgetItem *item = new QTreeWidgetItem(parent);
item->setText(0, config->displayName()); item->setText(0, config->displayName());
item->setText(1, config->ndkEnvFile().toString()); item->setText(1, config->ndkEnvFile().toString());
QFont font; QFont font;
font.setBold(config->isActive()); font.setBold(config->isActive() || m_activatedTargets.contains(config));
item->setFont(0, font); item->setFont(0, font);
item->setFont(1, font); item->setFont(1, font);
} }
@@ -165,25 +183,7 @@ void BlackBerryNDKSettingsWidget::updateNdkList()
void BlackBerryNDKSettingsWidget::addNdkTarget() void BlackBerryNDKSettingsWidget::addNdkTarget()
{ {
QString selectedPath = QFileDialog::getOpenFileName(0, tr("Select the NDK Environment file"), launchBlackBerryInstallerWizard(BlackBerryInstallerDataHandler::InstallMode);
QString(), tr("BlackBerry Environment File (*.sh *.bat)"));
if (selectedPath.isEmpty() || !QFileInfo(selectedPath).exists())
return;
BlackBerryConfiguration *config = m_bbConfigManager->configurationFromEnvFile(Utils::FileName::fromString(selectedPath));
if (!config) {
config = new BlackBerryConfiguration(Utils::FileName::fromString(selectedPath), false);
if (!m_bbConfigManager->addConfiguration(config)) {
delete config;
return;
}
QTreeWidgetItem *item = new QTreeWidgetItem(m_manualNdks);
item->setText(0, selectedPath.split(QDir::separator()).last());
item->setText(1, selectedPath);
updateInfoTable(item);
}
} }
void BlackBerryNDKSettingsWidget::removeNdkTarget() void BlackBerryNDKSettingsWidget::removeNdkTarget()
@@ -193,6 +193,16 @@ void BlackBerryNDKSettingsWidget::removeNdkTarget()
QString ndk = m_ui->ndksTreeWidget->currentItem()->text(0); QString ndk = m_ui->ndksTreeWidget->currentItem()->text(0);
QString envFilePath = m_ui->ndksTreeWidget->currentItem()->text(1); QString envFilePath = m_ui->ndksTreeWidget->currentItem()->text(1);
BlackBerryConfiguration *config = m_bbConfigManager->configurationFromEnvFile(Utils::FileName::fromString(envFilePath));
if (!config)
return;
if (config->isAutoDetected()) {
uninstallNdkTarget();
return;
}
QMessageBox::StandardButton button = QMessageBox::StandardButton button =
QMessageBox::question(Core::ICore::mainWindow(), QMessageBox::question(Core::ICore::mainWindow(),
tr("Clean BlackBerry 10 Configuration"), tr("Clean BlackBerry 10 Configuration"),
@@ -200,12 +210,9 @@ void BlackBerryNDKSettingsWidget::removeNdkTarget()
QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
if (button == QMessageBox::Yes) { if (button == QMessageBox::Yes) {
BlackBerryConfiguration *config = m_bbConfigManager->configurationFromEnvFile(Utils::FileName::fromString(envFilePath));
if (config) {
m_bbConfigManager->removeConfiguration(config); m_bbConfigManager->removeConfiguration(config);
m_manualNdks->removeChild(m_ui->ndksTreeWidget->currentItem()); m_manualNdks->removeChild(m_ui->ndksTreeWidget->currentItem());
} }
}
} }
void BlackBerryNDKSettingsWidget::activateNdkTarget() void BlackBerryNDKSettingsWidget::activateNdkTarget()
@@ -255,30 +262,62 @@ void BlackBerryNDKSettingsWidget::updateUi(QTreeWidgetItem *item, BlackBerryConf
m_ui->deactivateNdkTargetButton->setEnabled((m_activatedTargets.contains(config)) m_ui->deactivateNdkTargetButton->setEnabled((m_activatedTargets.contains(config))
&& m_activatedTargets.size() > 1 && m_activatedTargets.size() > 1
&& config->isAutoDetected()); && config->isAutoDetected());
m_ui->removeNdkButton->setEnabled(!config->isAutoDetected()); m_ui->removeNdkButton->setEnabled(true);
} }
void BlackBerryNDKSettingsWidget::initNdkList() void BlackBerryNDKSettingsWidget::uninstallNdkTarget()
{ {
m_ui->ndksTreeWidget->header()->setResizeMode(QHeaderView::Stretch); const QMessageBox::StandardButton answer = QMessageBox::question(this, tr("Confirmation"),
m_ui->ndksTreeWidget->header()->setStretchLastSection(false); tr("Are you sure you want to uninstall %1?").
m_ui->ndksTreeWidget->setHeaderItem(new QTreeWidgetItem(QStringList() << tr("NDK") << tr("NDK Environment File"))); arg(m_ui->baseNameLabel->text()),
m_ui->ndksTreeWidget->setTextElideMode(Qt::ElideNone); QMessageBox::Yes | QMessageBox::No);
m_ui->ndksTreeWidget->setColumnCount(2);
m_autoDetectedNdks = new QTreeWidgetItem(m_ui->ndksTreeWidget);
m_autoDetectedNdks->setText(0, tr("Auto-Detected"));
m_autoDetectedNdks->setFirstColumnSpanned(true);
m_autoDetectedNdks->setFlags(Qt::ItemIsEnabled);
m_manualNdks = new QTreeWidgetItem(m_ui->ndksTreeWidget);
m_manualNdks->setText(0, tr("Manual"));
m_manualNdks->setFirstColumnSpanned(true);
m_manualNdks->setFlags(Qt::ItemIsEnabled);
m_ui->ndksTreeWidget->expandAll(); if (answer == QMessageBox::Yes)
launchBlackBerryInstallerWizard(BlackBerryInstallerDataHandler::UninstallMode, m_ui->versionLabel->text());
}
void BlackBerryNDKSettingsWidget::handleInstallationFinished()
{
m_bbConfigManager->loadAutoDetectedConfigurations();
updateNdkList();
}
void BlackBerryNDKSettingsWidget::handleUninstallationFinished()
{
if (!m_ui->ndksTreeWidget->currentItem())
return;
QString targetName = m_ui->ndksTreeWidget->currentItem()->text(0);
QString envFilePath = m_ui->ndksTreeWidget->currentItem()->text(1);
// Check if the target is corrrecly uninstalled
foreach (const NdkInstallInformation &ndk, QnxUtils::installedNdks()) {
if (ndk.name == targetName)
return;
}
BlackBerryConfiguration *config = m_bbConfigManager->configurationFromEnvFile(Utils::FileName::fromString(envFilePath));
if (m_activatedTargets.contains(config))
m_activatedTargets.removeAt(m_activatedTargets.indexOf(config));
else if (m_deactivatedTargets.contains(config))
m_deactivatedTargets.removeAt(m_deactivatedTargets.indexOf(config));
m_bbConfigManager->removeConfiguration(config);
updateNdkList(); updateNdkList();
} }
void BlackBerryNDKSettingsWidget::launchBlackBerryInstallerWizard(BlackBerryInstallerDataHandler::Mode mode,
const QString& targetVersion)
{
BlackBerryInstallWizard wizard(mode, targetVersion, this);
if (mode == BlackBerryInstallerDataHandler::InstallMode)
connect(&wizard, SIGNAL(processFinished()), this, SLOT(handleInstallationFinished()));
else
connect(&wizard, SIGNAL(processFinished()), this, SLOT(handleUninstallationFinished()));
wizard.exec();
}
} // namespace Internal } // namespace Internal
} // namespace Qnx } // namespace Qnx

View File

@@ -1,8 +1,8 @@
/************************************************************************** /**************************************************************************
** **
** Copyright (C) 2011 - 2013 Research In Motion ** Copyright (C) 2013 BlackBerry Limited. All rights reserved
** **
** Contact: Research In Motion (blackberry-qt@qnx.com) ** Contact: BlackBerry (qt@blackberry.com)
** Contact: KDAB (info@kdab.com) ** Contact: KDAB (info@kdab.com)
** **
** This file is part of Qt Creator. ** This file is part of Qt Creator.
@@ -32,6 +32,8 @@
#ifndef BLACKBERRYNDKSETTINGSWIDGET_H #ifndef BLACKBERRYNDKSETTINGSWIDGET_H
#define BLACKBERRYNDKSETTINGSWIDGET_H #define BLACKBERRYNDKSETTINGSWIDGET_H
#include "blackberryinstallwizard.h"
#include <QWidget> #include <QWidget>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@@ -70,15 +72,21 @@ public slots:
void removeNdkTarget(); void removeNdkTarget();
void activateNdkTarget(); void activateNdkTarget();
void deactivateNdkTarget(); void deactivateNdkTarget();
void uninstallNdkTarget();
void handleInstallationFinished();
void handleUninstallationFinished();
void updateUi(QTreeWidgetItem* item, BlackBerryConfiguration* config); void updateUi(QTreeWidgetItem* item, BlackBerryConfiguration* config);
private: private:
void initNdkList(); void launchBlackBerryInstallerWizard(BlackBerryInstallerDataHandler::Mode mode,
const QString& tagetVersion = QString());
Ui_BlackBerryNDKSettingsWidget *m_ui; Ui_BlackBerryNDKSettingsWidget *m_ui;
BlackBerryConfigurationManager *m_bbConfigManager; BlackBerryConfigurationManager *m_bbConfigManager;
QTreeWidgetItem *m_autoDetectedNdks; QTreeWidgetItem *m_autoDetectedNdks;
QTreeWidgetItem *m_manualNdks; QTreeWidgetItem *m_manualNdks;
QList<BlackBerryConfiguration *> m_activatedTargets; QList<BlackBerryConfiguration *> m_activatedTargets;
QList<BlackBerryConfiguration *> m_deactivatedTargets; QList<BlackBerryConfiguration *> m_deactivatedTargets;
}; };

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>773</width> <width>773</width>
<height>443</height> <height>495</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">

View File

@@ -93,6 +93,8 @@ SOURCES += qnxplugin.cpp \
blackberryconfigurationmanager.cpp \ blackberryconfigurationmanager.cpp \
blackberrydevicelistdetector.cpp \ blackberrydevicelistdetector.cpp \
blackberrylogprocessrunner.cpp \ blackberrylogprocessrunner.cpp \
blackberryinstallwizardpages.cpp \
blackberryinstallwizard.cpp \
qnxdeviceprocesssignaloperation.cpp \ qnxdeviceprocesssignaloperation.cpp \
qnxdeviceprocesslist.cpp qnxdeviceprocesslist.cpp
@@ -187,9 +189,12 @@ HEADERS += qnxplugin.h\
blackberryconfigurationmanager.h \ blackberryconfigurationmanager.h \
blackberrydevicelistdetector.h \ blackberrydevicelistdetector.h \
blackberrylogprocessrunner.h \ blackberrylogprocessrunner.h \
blackberryinstallwizardpages.h \
blackberryinstallwizard.h \
qnxdeviceprocesssignaloperation.h \ qnxdeviceprocesssignaloperation.h \
qnxdeviceprocesslist.h qnxdeviceprocesslist.h
FORMS += \ FORMS += \
blackberrydeviceconfigurationwizardsetuppage.ui \ blackberrydeviceconfigurationwizardsetuppage.ui \
blackberryrunconfigurationwidget.ui \ blackberryrunconfigurationwidget.ui \
@@ -215,7 +220,10 @@ FORMS += \
blackberrysetupwizarddevicepage.ui \ blackberrysetupwizarddevicepage.ui \
blackberrysetupwizardfinishpage.ui \ blackberrysetupwizardfinishpage.ui \
blackberrydeviceconfigurationwizardconfigpage.ui \ blackberrydeviceconfigurationwizardconfigpage.ui \
blackberrydeviceconfigurationwizardquerypage.ui blackberrydeviceconfigurationwizardquerypage.ui \
blackberryinstallwizardtargetpage.ui \
blackberryinstallwizardndkpage.ui \
blackberryinstallwizardprocesspage.ui
include(../../private_headers.pri) include(../../private_headers.pri)

View File

@@ -115,6 +115,15 @@ QtcPlugin {
"blackberrydeviceconnectionmanager.h", "blackberrydeviceconnectionmanager.h",
"blackberrydevicelistdetector.cpp", "blackberrydevicelistdetector.cpp",
"blackberrydevicelistdetector.h", "blackberrydevicelistdetector.h",
"blackberrydeviceprocesssupport.h",
"blackberrydeviceprocesssupport.cpp",
"blackberryinstallwizard.cpp",
"blackberryinstallwizard.h",
"blackberryinstallwizardndkpage.ui",
"blackberryinstallwizardpages.cpp",
"blackberryinstallwizardpages.h",
"blackberryinstallwizardprocesspage.ui",
"blackberryinstallwizardtargetpage.ui",
"blackberrylogprocessrunner.cpp", "blackberrylogprocessrunner.cpp",
"blackberrylogprocessrunner.h", "blackberrylogprocessrunner.h",
"blackberryqtversion.cpp", "blackberryqtversion.cpp",

View File

@@ -1,8 +1,8 @@
/************************************************************************** /**************************************************************************
** **
** Copyright (C) 2011 - 2013 Research In Motion ** Copyright (C) 2013 BlackBerry Limited. All rights reserved
** **
** Contact: Research In Motion (blackberry-qt@qnx.com) ** Contact: BlackBerry (qt@blackberry.com)
** Contact: KDAB (info@kdab.com) ** Contact: KDAB (info@kdab.com)
** **
** This file is part of Qt Creator. ** This file is part of Qt Creator.
@@ -311,3 +311,28 @@ QList<NdkInstallInformation> QnxUtils::installedNdks()
return ndkList; return ndkList;
} }
QString QnxUtils::sdkInstallerPath(const QString &ndkPath)
{
QString sdkinstallPath;
if (Utils::HostOsInfo::isWindowsHost())
sdkinstallPath = ndkPath + QLatin1String("/qde.exe");
else
sdkinstallPath = ndkPath + QLatin1String("/qde");
if (QFileInfo(sdkinstallPath).exists())
return sdkinstallPath;
return QString();
}
// The resulting process when launching sdkinstall
QString QnxUtils::qdeInstallProcess(const QString &ndkPath, const QString &option, const QString &version)
{
QString installerPath = sdkInstallerPath(ndkPath);
if (ndkPath.isEmpty())
return QString();
return QString::fromLatin1("%1 -nosplash -application com.qnx.tools.ide.sdk.manager.core.SDKInstallerApplication "
"%2 %3 -vmargs -Dosgi.console=:none").arg(installerPath, option, version);
}

View File

@@ -1,8 +1,8 @@
/************************************************************************** /**************************************************************************
** **
** Copyright (C) 2011 - 2013 Research In Motion ** Copyright (C) 2013 BlackBerry Limited. All rights reserved
** **
** Contact: Research In Motion (blackberry-qt@qnx.com) ** Contact: BlackBerry (qt@blackberry.com)
** Contact: KDAB (info@kdab.com) ** Contact: KDAB (info@kdab.com)
** **
** This file is part of Qt Creator. ** This file is part of Qt Creator.
@@ -71,6 +71,8 @@ public:
static QString qConfigPath(); static QString qConfigPath();
static QString defaultTargetVersion(const QString& ndkPath); static QString defaultTargetVersion(const QString& ndkPath);
static QList<NdkInstallInformation> installedNdks(); static QList<NdkInstallInformation> installedNdks();
static QString sdkInstallerPath(const QString& ndkPath);
static QString qdeInstallProcess(const QString& ndkPath, const QString &option, const QString &version = QString());
}; };
} // namespace Internal } // namespace Internal