Commit 8cdb5aca authored by El Mehdi Fekari's avatar El Mehdi Fekari Committed by Mehdi Fekari
Browse files

Qnx: Enable installing runtime and simulator



Change-Id: I3aca5575d4a925ee2efcf891f558105ffcec6094
Reviewed-by: Nicolas Arnaud-Cormos's avatarNicolas Arnaud-Cormos <nicolas@kdab.com>
Reviewed-by: default avatarRafael Roquetto <rafael.roquetto@kdab.com>
parent 39212338
......@@ -40,6 +40,7 @@ using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryInstallWizard::BlackBerryInstallWizard(BlackBerryInstallerDataHandler::Mode mode,
BlackBerryInstallerDataHandler::Target target,
const QString& version,
QWidget *parent)
: Utils::Wizard(parent)
......@@ -49,8 +50,10 @@ BlackBerryInstallWizard::BlackBerryInstallWizard(BlackBerryInstallerDataHandler:
setWindowTitle(tr("BlackBerry NDK Installation Wizard"));
m_data.mode = mode;
m_data.installTarget = target;
m_data.version = version;
if (m_data.mode != BlackBerryInstallerDataHandler::UninstallMode) {
m_optionPage = new BlackBerryInstallWizardOptionPage(m_data, this);
m_ndkPage = new BlackBerryInstallWizardNdkPage(m_data, this);
......
......@@ -53,12 +53,19 @@ public:
ManuallMode
};
enum Target {
ApiLevel,
Simulator,
Runtime
};
QString ndkPath;
QString target;
QString version;
int exitCode;
QProcess::ExitStatus exitStatus;
Mode mode;
Target installTarget;
};
class BlackBerryInstallWizard : public Utils::Wizard
......@@ -74,6 +81,7 @@ public:
};
explicit BlackBerryInstallWizard(BlackBerryInstallerDataHandler::Mode mode = BlackBerryInstallerDataHandler::InstallMode,
BlackBerryInstallerDataHandler::Target target = BlackBerryInstallerDataHandler::ApiLevel,
const QString& version = QString(),
QWidget *parent = 0);
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BlackBerryInstallWizardOptionPage</class>
<widget class="QWidget" name="Qnx::Internal::BlackBerryInstallWizardOptionPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>457</width>
<height>278</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="apiLevelButton">
<property name="text">
<string>Install Api Level</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="apiLevelOptionsLayout">
<item>
<widget class="QRadioButton" name="installButton">
<property name="text">
<string>Install New Target</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="addButton">
<property name="text">
<string>Add Existing Target</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QRadioButton" name="simulatorButton">
<property name="text">
<string>Install Simulator</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="runtimeButton">
<property name="text">
<string>Install Runtime</string>
</property>
</widget>
</item>
</layout>
</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>
......@@ -33,6 +33,7 @@
#include "blackberryconfigurationmanager.h"
#include "blackberryconfiguration.h"
#include "ui_blackberryinstallwizardoptionpage.h"
#include "ui_blackberryinstallwizardtargetpage.h"
#include "ui_blackberryinstallwizardprocesspage.h"
#include "ui_blackberryinstallwizardndkpage.h"
......@@ -50,8 +51,6 @@
#include <QDir>
#include <QMessageBox>
#include <QLayout>
#include <QRadioButton>
namespace Qnx {
namespace Internal {
......@@ -94,56 +93,64 @@ bool NdkPathChooser::validatePath(const QString &path, QString *errorMessage)
BlackBerryInstallWizardOptionPage::BlackBerryInstallWizardOptionPage(BlackBerryInstallerDataHandler &data,
QWidget *parent)
: QWizardPage(parent)
, m_layout(new QVBoxLayout(this))
, m_installButton(new QRadioButton)
, m_addButton(new QRadioButton)
, m_ui(new Ui_BlackBerryInstallWizardOptionPage)
, m_buttonGroup(new QButtonGroup(this))
, m_envFileChooser(new NdkPathChooser(NdkPathChooser::ManualMode))
, m_data(data)
{
m_ui->setupUi(this);
setTitle(tr("Options"));
connect(m_addButton, SIGNAL(toggled(bool)), this, SLOT(handleOptionChanged()));
connect(m_ui->addButton, SIGNAL(toggled(bool)), this, SLOT(handleApiLevelOptionChanged()));
connect(m_envFileChooser, SIGNAL(pathChanged(QString)), this, SLOT(handlePathChanged(QString)));
connect(m_ui->apiLevelButton, SIGNAL(toggled(bool)), this, SLOT(handleTargetChanged()));
connect(m_ui->simulatorButton, SIGNAL(toggled(bool)), this, SLOT(handleTargetChanged()));
connect(m_ui->runtimeButton, SIGNAL(toggled(bool)), this, SLOT(handleTargetChanged()));
}
BlackBerryInstallWizardOptionPage::~BlackBerryInstallWizardOptionPage()
{
delete m_ui;
}
void BlackBerryInstallWizardOptionPage::initializePage()
{
m_installButton->setText(tr("Install New Target"));
m_addButton->setText(tr("Add Existing Target"));
m_ui->apiLevelOptionsLayout->addWidget(m_envFileChooser);
m_buttonGroup->addButton(m_ui->installButton);
m_buttonGroup->addButton(m_ui->addButton);
m_ui->apiLevelButton->setChecked(true);
if (m_data.mode == BlackBerryInstallerDataHandler::ManuallMode)
m_addButton->setChecked(true);
m_ui->addButton->setChecked(true);
else
m_installButton->setChecked(true);
m_ui->installButton->setChecked(true);
m_envFileChooser->setEnabled(m_addButton->isChecked());
m_layout->addWidget(m_installButton);
m_layout->addWidget(m_addButton);
m_layout->addWidget(m_envFileChooser);
m_envFileChooser->setEnabled(m_ui->addButton->isChecked());
}
bool BlackBerryInstallWizardOptionPage::isComplete() const
{
return (m_installButton->isChecked()
|| (m_addButton->isChecked() && m_envFileChooser->isValid()));
if (m_ui->addButton->isEnabled() && m_ui->addButton->isChecked())
return m_envFileChooser->isValid();
return true;
}
int BlackBerryInstallWizardOptionPage::nextId() const
{
if (m_addButton->isChecked())
if (m_ui->addButton->isChecked())
return BlackBerryInstallWizard::FinalPageId;
return BlackBerryInstallWizard::NdkPageId;
}
void BlackBerryInstallWizardOptionPage::handleOptionChanged()
void BlackBerryInstallWizardOptionPage::handleApiLevelOptionChanged()
{
if (m_addButton->isChecked())
if (m_ui->addButton->isChecked())
m_data.mode = BlackBerryInstallerDataHandler::ManuallMode;
else
m_data.mode = BlackBerryInstallerDataHandler::InstallMode;
m_envFileChooser->setEnabled(m_addButton->isChecked());
m_envFileChooser->setEnabled(m_ui->addButton->isChecked());
emit completeChanged();
}
......@@ -155,6 +162,21 @@ void BlackBerryInstallWizardOptionPage::handlePathChanged(const QString &envFile
emit completeChanged();
}
void BlackBerryInstallWizardOptionPage::handleTargetChanged()
{
m_ui->installButton->setEnabled(m_ui->apiLevelButton->isChecked());
m_ui->addButton->setEnabled(m_ui->apiLevelButton->isChecked());
if (m_ui->apiLevelButton->isChecked())
m_data.installTarget = BlackBerryInstallerDataHandler::ApiLevel;
else if (m_ui->simulatorButton->isChecked())
m_data.installTarget = BlackBerryInstallerDataHandler::Simulator;
else if (m_ui->runtimeButton->isChecked())
m_data.installTarget = BlackBerryInstallerDataHandler::Runtime;
emit completeChanged();
}
//------------------------------------------------------------------
BlackBerryInstallWizardNdkPage::BlackBerryInstallWizardNdkPage(BlackBerryInstallerDataHandler &data, QWidget *parent)
......@@ -250,7 +272,7 @@ BlackBerryInstallWizardTargetPage::BlackBerryInstallWizardTargetPage(BlackBerryI
, m_targetListProcess(new QProcess(this))
{
m_ui->setupUi(this);
setTitle(tr("Target"));
setTitle(tr("Version"));
connect(m_targetListProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(targetsListProcessFinished()));
......@@ -331,7 +353,7 @@ 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->setHeaderItem(new QTreeWidgetItem(QStringList() << tr("Version") << tr("Name")));
m_ui->targetsTreeWidget->setTextElideMode(Qt::ElideNone);
m_ui->targetsTreeWidget->setColumnCount(2);
}
......@@ -341,11 +363,11 @@ 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..."));
item->setText(0, tr("Querying available versions. Please wait..."));
QFont font;
font.setItalic(true);
item->setFont(0, font);
QString qdeProcess = QnxUtils::qdeInstallProcess(m_data.ndkPath, QLatin1String(" --list"));
QString qdeProcess = QnxUtils::qdeInstallProcess(m_data.ndkPath, QString(), QLatin1String(" --list"));
QTC_ASSERT(!qdeProcess.isEmpty(), return);
m_targetListProcess->start(qdeProcess);
}
......@@ -377,6 +399,21 @@ BlackBerryInstallWizardProcessPage::~BlackBerryInstallWizardProcessPage()
void BlackBerryInstallWizardProcessPage::initializePage()
{
QString target;
switch (m_data.installTarget) {
case BlackBerryInstallerDataHandler::ApiLevel:
target = tr("API level version: ");
break;
case BlackBerryInstallerDataHandler::Simulator:
target = tr("simulator version: ");
break;
case BlackBerryInstallerDataHandler::Runtime:
target = tr("runtime version: ");
break;
default:
break;
}
if (m_data.mode == BlackBerryInstallerDataHandler::UninstallMode) {
if (m_data.version.isEmpty()) {
wizard()->next();
......@@ -391,9 +428,9 @@ void BlackBerryInstallWizardProcessPage::initializePage()
}
}
m_ui->label->setText(tr("Uninstalling target:") + QLatin1Char('\n') + m_data.target);
m_ui->label->setText(tr("Uninstalling ") + target + m_data.version);
} else {
m_ui->label->setText(tr("Installing target:") + QLatin1Char('\n') + m_data.target);
m_ui->label->setText(tr("Installing ") + target + m_data.version);
}
// m_targetProcess could be running
if (m_targetProcess->state() == QProcess::Running) {
......@@ -428,6 +465,12 @@ void BlackBerryInstallWizardProcessPage::handleProcessFinished(int exitCode, QPr
void BlackBerryInstallWizardProcessPage::processTarget()
{
QString target;
if (m_data.installTarget == BlackBerryInstallerDataHandler::Simulator)
target = QLatin1String(" --simulator");
else if (m_data.installTarget == BlackBerryInstallerDataHandler::Runtime)
target = QLatin1String(" --runtime");
QString option;
if (m_data.mode == BlackBerryInstallerDataHandler::UninstallMode)
option = QLatin1String(" --uninstall");
......@@ -449,7 +492,7 @@ void BlackBerryInstallWizardProcessPage::processTarget()
// 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);
QString qdeProcess = QnxUtils::qdeInstallProcess(m_data.ndkPath, target, option, version);
QTC_ASSERT(!qdeProcess.isEmpty(), return);
m_targetProcess->start(qdeProcess);
......@@ -497,15 +540,30 @@ void BlackBerryInstallWizardFinalPage::initializePage()
}
QString message;
QString target;
switch (m_data.installTarget) {
case BlackBerryInstallerDataHandler::ApiLevel:
target = tr("API level version: ");
break;
case BlackBerryInstallerDataHandler::Simulator:
target = tr("simulator version: ");
break;
case BlackBerryInstallerDataHandler::Runtime:
target = tr("runtime version: ");
break;
default:
break;
}
if (m_data.exitCode == 0 && m_data.exitStatus == QProcess::NormalExit) {
message = m_data.mode == BlackBerryInstallerDataHandler::UninstallMode ?
tr("Finished uninstalling target:\n %1").arg(m_data.target) :
tr("Finished installing target:\n %1").arg(m_data.target);
tr("Finished uninstalling %1:\n %2").arg(target, m_data.version) :
tr("Finished installing %1:\n %2").arg(target, m_data.version);
emit done();
} else {
message = m_data.mode == BlackBerryInstallerDataHandler::UninstallMode ?
tr("An error has occurred while uninstalling target:\n %1").arg(m_data.target) :
tr("An error has occurred while installing target:\n %1").arg(m_data.target);
tr("An error has occurred while uninstalling %1:\n %2").arg(target, m_data.version) :
tr("An error has occurred while installing %1:\n %2").arg(target, m_data.version);
}
label->setText(message);
}
......
......@@ -41,13 +41,13 @@
QT_BEGIN_NAMESPACE
class QProcess;
class QRadioButton;
class QVBoxLayout;
class QButtonGroup;
QT_END_NAMESPACE
namespace Qnx {
namespace Internal {
class Ui_BlackBerryInstallWizardOptionPage;
class Ui_BlackBerryInstallWizardNdkPage;
class Ui_BlackBerryInstallWizardTargetPage;
class Ui_BlackBerryInstallWizardProcessPage;
......@@ -74,22 +74,24 @@ class BlackBerryInstallWizardOptionPage : public QWizardPage
public:
explicit BlackBerryInstallWizardOptionPage(BlackBerryInstallerDataHandler &data, QWidget *parent = 0);
~BlackBerryInstallWizardOptionPage();
void initializePage();
bool isComplete() const;
int nextId() const;
protected slots:
void handleOptionChanged();
void handleApiLevelOptionChanged();
void handlePathChanged(const QString &envFilePath);
void handleTargetChanged();
signals:
void installModeChanged();
private:
QVBoxLayout *m_layout;
QRadioButton* m_installButton;
QRadioButton* m_addButton;
NdkPathChooser* m_envFileChooser;
Ui_BlackBerryInstallWizardOptionPage *m_ui;
QButtonGroup *m_buttonGroup;
NdkPathChooser *m_envFileChooser;
BlackBerryInstallerDataHandler &m_data;
};
......
......@@ -17,7 +17,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Please select target:</string>
<string>Please select version:</string>
</property>
</widget>
</item>
......
......@@ -398,7 +398,7 @@ void BlackBerryNDKSettingsWidget::updateDefaultApiLevel()
void BlackBerryNDKSettingsWidget::launchBlackBerryInstallerWizard(BlackBerryInstallerDataHandler::Mode mode,
const QString& targetVersion)
{
BlackBerryInstallWizard wizard(mode, targetVersion, this);
BlackBerryInstallWizard wizard(mode, BlackBerryInstallerDataHandler::ApiLevel, targetVersion, this);
if (mode == BlackBerryInstallerDataHandler::InstallMode)
connect(&wizard, SIGNAL(processFinished()), this, SLOT(handleInstallationFinished()));
else
......
......@@ -229,7 +229,8 @@ FORMS += \
blackberrydeviceconfigurationwizardquerypage.ui \
blackberryinstallwizardtargetpage.ui \
blackberryinstallwizardndkpage.ui \
blackberryinstallwizardprocesspage.ui
blackberryinstallwizardprocesspage.ui \
blackberryinstallwizardoptionpage.ui
include(../../private_headers.pri)
include(./cascadesimport/cascadesimport.pri)
......
......@@ -118,6 +118,7 @@ QtcPlugin {
"blackberryinstallwizard.cpp",
"blackberryinstallwizard.h",
"blackberryinstallwizardndkpage.ui",
"blackberryinstallwizardoptionpage.ui",
"blackberryinstallwizardpages.cpp",
"blackberryinstallwizardpages.h",
"blackberryinstallwizardprocesspage.ui",
......
......@@ -282,7 +282,8 @@ QString QnxUtils::sdkInstallerPath(const QString &ndkPath)
}
// The resulting process when launching sdkinstall
QString QnxUtils::qdeInstallProcess(const QString &ndkPath, const QString &option, const QString &version)
QString QnxUtils::qdeInstallProcess(const QString &ndkPath, const QString &target,
const QString &option, const QString &version)
{
QString installerPath = sdkInstallerPath(ndkPath);
if (installerPath.isEmpty())
......@@ -293,7 +294,7 @@ QString QnxUtils::qdeInstallProcess(const QString &ndkPath, const QString &optio
const QString installerApplication = installerPlugins.size() >= 1 ? QLatin1String("com.qnx.tools.ide.sdk.installer.app.SDKInstallerApplication")
: QLatin1String("com.qnx.tools.ide.sdk.manager.core.SDKInstallerApplication");
return QString::fromLatin1("%1 -nosplash -application %2 "
"%3 %4 -vmargs -Dosgi.console=:none").arg(installerPath, installerApplication, option, version);
"%3 %4 %5 -vmargs -Dosgi.console=:none").arg(installerPath, installerApplication, target, option, version);
}
QList<Utils::EnvironmentItem> QnxUtils::qnxEnvironment(const QString &sdkPath)
......
......@@ -75,7 +75,8 @@ public:
static QString defaultTargetVersion(const QString& ndkPath);
static QList<NdkInstallInformation> installedNdks();
static QString sdkInstallerPath(const QString& ndkPath);
static QString qdeInstallProcess(const QString& ndkPath, const QString &option, const QString &version = QString());
static QString qdeInstallProcess(const QString& ndkPath, const QString &target,
const QString &option, const QString &version = QString());
static QList<Utils::EnvironmentItem> qnxEnvironment(const QString &ndk);
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment