Commit 6b8b60ce authored by Tobias Nätterlund's avatar Tobias Nätterlund Committed by Tobias Nätterlund

BlackBerry: Improve handling of Qt libraries when creating package

This lets the user choose between bundling the Qt libraries in the
bar package, use the libraries shipped with the device, or use
libraries deployed to the device by the user.

From the user's choice, the correct assets will be added to the bar
package, and the correct environment will be set up, so those does
not have to be pre-filled in the bar-descriptor.xml template any longer.

Task-number: QTCREATORBUG-11376
Change-Id: If44a9f9868d068f2ccbbeca3e25447496a336648
Reviewed-by: Nicolas Arnaud-Cormos's avatarNicolas Arnaud-Cormos <nicolas@kdab.com>
parent 2128b289
......@@ -24,19 +24,4 @@
<action system="true">run_native</action>
<asset entry="true" path="PROJECTPATH" type="Qnx/Elf">PROJECTNAME</asset>
<!--
%QT_INSTALL_LIBS%, %QT_INSTALL_PLUGINS, %QT_INSTALL_QML% and %SRC_DIR%
tags are replaced on-the-fly when deploying the app. in Qt Creator.
-->
<asset path="%QT_INSTALL_LIBS%">lib</asset>
<asset path="%QT_INSTALL_PLUGINS%">plugins</asset>
<asset path="%QT_INSTALL_QML%">imports</asset>
<!--
By default this bar-descriptor.xml embeds Qt5 runtime
into the application itself. See the following document
for various deployments of Qt runtime to a device:
http://qt-project.org/wiki/Qt-on-BlackBerry-devices
-->
</qnx>
......@@ -52,6 +52,12 @@ public:
DevelopmentMode
};
enum BundleMode {
PreInstalledQt,
BundleQt,
DeployedQt
};
explicit BlackBerryCreatePackageStep(ProjectExplorer::BuildStepList *bsl);
bool init();
......@@ -67,12 +73,18 @@ public:
QString keystorePassword() const;
bool savePasswords() const;
BundleMode bundleMode() const;
QString qtLibraryPath() const;
public slots:
void setPackageMode(PackageMode packageMode);
void setCskPassword(const QString &cskPassword);
void setKeystorePassword(const QString &keystorePassword);
void setSavePasswords(bool savePasswords);
void setBundleMode(BundleMode bundleMode);
void setQtLibraryPath(const QString &qtLibraryPath);
signals:
void cskPasswordChanged(QString);
void keystorePasswordChanged(QString);
......@@ -86,11 +98,14 @@ private:
void ctor();
bool prepareAppDescriptorFile(const QString &appDescriptorPath, const QString &preparedFilePath);
QString fullQtLibraryPath() const;
PackageMode m_packageMode;
QString m_cskPassword;
QString m_keystorePassword;
bool m_savePasswords;
BundleMode m_bundleMode;
QString m_qtLibraryPath;
};
} // namespace Internal
......
......@@ -32,6 +32,12 @@
#include "blackberrycreatepackagestepconfigwidget.h"
#include "ui_blackberrycreatepackagestepconfigwidget.h"
#include "blackberrycreatepackagestep.h"
#include "blackberrydeployqtlibrariesdialog.h"
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/target.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/qtcassert.h>
using namespace Qnx;
using namespace Qnx::Internal;
......@@ -43,22 +49,46 @@ BlackBerryCreatePackageStepConfigWidget::BlackBerryCreatePackageStepConfigWidget
m_ui = new Ui::BlackBerryCreatePackageStepConfigWidget;
m_ui->setupUi(this);
m_ui->signPackages->setChecked(m_step->packageMode() == BlackBerryCreatePackageStep::SigningPackageMode);
m_ui->developmentMode->setChecked(m_step->packageMode() == BlackBerryCreatePackageStep::DevelopmentMode);
m_ui->cskPassword->setText(m_step->cskPassword());
m_ui->keystorePassword->setText(m_step->keystorePassword());
m_ui->savePasswords->setChecked(m_step->savePasswords());
m_ui->qtLibraryPath->setText(m_step->qtLibraryPath());
m_qtLibraryExplanations[0] = tr("Use the Qt libraries shipped with the BlackBerry device.");
m_qtLibraryExplanations[1] = tr("Include Qt libraries in the package. "
"This will increase the package size.");
m_qtLibraryExplanations[2] = tr("Use deployed Qt libraries on the device.");
m_ui->qtLibrary->addItem(tr("Use pre-installed Qt"), BlackBerryCreatePackageStep::PreInstalledQt);
m_ui->qtLibrary->addItem(tr("Bundle Qt in package"), BlackBerryCreatePackageStep::BundleQt);
m_ui->qtLibrary->addItem(tr("Use deployed Qt"), BlackBerryCreatePackageStep::DeployedQt);
connect(m_ui->signPackages, SIGNAL(toggled(bool)), this, SLOT(setPackageMode(bool)));
connect(m_ui->cskPassword, SIGNAL(textChanged(QString)), m_step, SLOT(setCskPassword(QString)));
connect(m_ui->keystorePassword, SIGNAL(textChanged(QString)), m_step, SLOT(setKeystorePassword(QString)));
connect(m_ui->keystorePassword, SIGNAL(textChanged(QString)),
m_step, SLOT(setKeystorePassword(QString)));
connect(m_ui->showPasswords, SIGNAL(toggled(bool)), this, SLOT(showPasswords(bool)));
connect(m_ui->savePasswords, SIGNAL(toggled(bool)), m_step, SLOT(setSavePasswords(bool)));
connect(m_ui->qtLibrary, SIGNAL(currentIndexChanged(int)), this, SLOT(setBundleMode(int)));
connect(m_ui->qtLibrary, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDeployWidgetsState()));
connect(m_ui->qtLibraryPath, SIGNAL(textChanged(QString)),
m_step, SLOT(setQtLibraryPath(QString)));
connect(m_ui->qtLibraryPath, SIGNAL(textChanged(QString)),
this, SLOT(updateDeployWidgetsState()));
connect(m_ui->deployNowButton, SIGNAL(clicked()), this, SLOT(deployLibraries()));
connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsChanged()), this, SLOT(updateDeployWidgetsState()));
connect(m_step, SIGNAL(cskPasswordChanged(QString)), m_ui->cskPassword, SLOT(setText(QString)));
connect(m_step, SIGNAL(keystorePasswordChanged(QString)), m_ui->keystorePassword, SLOT(setText(QString)));
connect(m_step, SIGNAL(keystorePasswordChanged(QString)),
m_ui->keystorePassword, SLOT(setText(QString)));
m_ui->signPackages->setChecked(m_step->packageMode() ==
BlackBerryCreatePackageStep::SigningPackageMode);
m_ui->developmentMode->setChecked(m_step->packageMode() ==
BlackBerryCreatePackageStep::DevelopmentMode);
m_ui->signPackagesWidget->setEnabled(m_ui->signPackages->isChecked());
m_ui->qtLibrary->setCurrentIndex(m_ui->qtLibrary->findData(m_step->bundleMode()));
setBundleMode(m_step->bundleMode());
updateDeployWidgetsState();
}
BlackBerryCreatePackageStepConfigWidget::~BlackBerryCreatePackageStepConfigWidget()
......@@ -92,3 +122,48 @@ void BlackBerryCreatePackageStepConfigWidget::showPasswords(bool show)
m_ui->cskPassword->setEchoMode(show ? QLineEdit::Normal : QLineEdit::Password);
m_ui->keystorePassword->setEchoMode(show ? QLineEdit::Normal : QLineEdit::Password);
}
void BlackBerryCreatePackageStepConfigWidget::setBundleMode(int qtLibraryIndex)
{
QTC_ASSERT(m_qtLibraryExplanations.contains(qtLibraryIndex), return);
BlackBerryCreatePackageStep::BundleMode bundleMode =
static_cast<BlackBerryCreatePackageStep::BundleMode>(
m_ui->qtLibrary->itemData(qtLibraryIndex).toInt());
m_step->setBundleMode(bundleMode);
m_ui->qtLibraryExplanationLabel->setText(m_qtLibraryExplanations[qtLibraryIndex]);
m_ui->qtLibraryPath->setVisible(bundleMode == BlackBerryCreatePackageStep::DeployedQt);
m_ui->qtLibraryLabel->setVisible(bundleMode == BlackBerryCreatePackageStep::DeployedQt);
}
void BlackBerryCreatePackageStepConfigWidget::updateDeployWidgetsState()
{
BlackBerryCreatePackageStep::BundleMode bundleMode =
static_cast<BlackBerryCreatePackageStep::BundleMode>(
m_ui->qtLibrary->itemData(m_ui->qtLibrary->currentIndex()).toInt());
ProjectExplorer::Kit *kit = m_step->target()->kit();
ProjectExplorer::IDevice::ConstPtr device = ProjectExplorer::DeviceKitInformation::device(kit);
const bool enableButton = !m_ui->qtLibraryPath->text().isEmpty()
&& bundleMode == BlackBerryCreatePackageStep::DeployedQt
&& !device.isNull();
const bool visibleButton = bundleMode == BlackBerryCreatePackageStep::DeployedQt;
const bool visibleLabels = bundleMode == BlackBerryCreatePackageStep::DeployedQt
&& device.isNull();
m_ui->deployNowButton->setEnabled(enableButton);
m_ui->deployNowButton->setVisible(visibleButton);
m_ui->deployErrorPixmap->setVisible(visibleLabels);
m_ui->deployErrorLabel->setVisible(visibleLabels);
}
void BlackBerryCreatePackageStepConfigWidget::deployLibraries()
{
ProjectExplorer::Kit *kit = m_step->target()->kit();
BlackBerryDeployQtLibrariesDialog dlg(ProjectExplorer::DeviceKitInformation::device(kit),
this);
dlg.execAndDeploy(QtSupport::QtKitInformation::qtVersionId(kit), m_ui->qtLibraryPath->text());
}
......@@ -56,10 +56,15 @@ public:
private slots:
void setPackageMode(bool signPackagesChecked);
void showPasswords(bool show);
void setBundleMode(int qtLibraryIndex);
void updateDeployWidgetsState();
void deployLibraries();
private:
BlackBerryCreatePackageStep *m_step;
Ui::BlackBerryCreatePackageStepConfigWidget *m_ui;
QMap<int, QString> m_qtLibraryExplanations;
};
} // namespace Internal
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>803</width>
<height>135</height>
<width>613</width>
<height>204</height>
</rect>
</property>
<property name="windowTitle">
......@@ -24,7 +24,16 @@
<item>
<widget class="QWidget" name="signPackagesWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
......@@ -115,9 +124,109 @@
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="developmentModeWidget" native="true">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<spacer name="horizontalSpacer_3">
<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>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="qtLibrary"/>
</item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="qtLibraryLabel">
<property name="text">
<string>/accounts/devuser/</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="qtLibraryPath"/>
</item>
</layout>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="deployNowButton">
<property name="text">
<string>Deploy now</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="deployErrorPixmap">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_warning.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QLabel" name="deployErrorLabel">
<property name="text">
<string>No device configured, cannot deploy.</string>
</property>
</widget>
</item>
<item row="0" column="6">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" colspan="5">
<widget class="QLabel" name="qtLibraryExplanationLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="../projectexplorer/projectexplorer.qrc"/>
</resources>
<connections>
<connection>
<sender>signPackages</sender>
......@@ -135,5 +244,53 @@
</hint>
</hints>
</connection>
<connection>
<sender>developmentMode</sender>
<signal>toggled(bool)</signal>
<receiver>developmentModeWidget</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>44</x>
<y>129</y>
</hint>
<hint type="destinationlabel">
<x>22</x>
<y>169</y>
</hint>
</hints>
</connection>
<connection>
<sender>signPackages</sender>
<signal>toggled(bool)</signal>
<receiver>developmentModeWidget</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>66</x>
<y>16</y>
</hint>
<hint type="destinationlabel">
<x>115</x>
<y>174</y>
</hint>
</hints>
</connection>
<connection>
<sender>developmentMode</sender>
<signal>toggled(bool)</signal>
<receiver>signPackagesWidget</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>69</x>
<y>132</y>
</hint>
<hint type="destinationlabel">
<x>338</x>
<y>97</y>
</hint>
</hints>
</connection>
</connections>
</ui>
This diff is collapsed.
/**************************************************************************
**
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
**
** Contact: BlackBerry (qt@blackberry.com)
** Contact: KDAB (info@kdab.com)
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and 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_BLACKBERRYDEPLOYQTLIBRARIESDIALOG_H
#define QNX_INTERNAL_BLACKBERRYDEPLOYQTLIBRARIESDIALOG_H
#include <QDialog>
#include <projectexplorer/deployablefile.h>
#include <projectexplorer/devicesupport/idevice.h>
namespace QSsh {
class SshRemoteProcessRunner;
}
namespace RemoteLinux {
class GenericDirectUploadService;
}
namespace Qnx {
namespace Internal {
namespace Ui {
class BlackBerryDeployQtLibrariesDialog;
}
class BlackBerryDeployQtLibrariesDialog : public QDialog
{
Q_OBJECT
public:
enum State {
Inactive,
CheckingRemoteDirectory,
RemovingRemoteDirectory,
Uploading
};
explicit BlackBerryDeployQtLibrariesDialog(const ProjectExplorer::IDevice::ConstPtr &device,
QWidget *parent = 0);
~BlackBerryDeployQtLibrariesDialog();
int execAndDeploy(int qtVersionId, const QString &remoteDirectory);
protected:
void closeEvent(QCloseEvent *event);
private slots:
void deployLibraries();
void updateProgress(const QString &progressMessage);
void handleUploadFinished();
void handleRemoteProcessError();
void handleRemoteProcessCompleted();
private:
QList<ProjectExplorer::DeployableFile> gatherFiles();
QList<ProjectExplorer::DeployableFile> gatherFiles(const QString &dirPath,
const QString &baseDir = QString());
QString fullRemoteDirectory() const;
void checkRemoteDirectoryExistance();
void removeRemoteDirectory();
void startUpload();
Ui::BlackBerryDeployQtLibrariesDialog *m_ui;
QSsh::SshRemoteProcessRunner *m_processRunner;
RemoteLinux::GenericDirectUploadService *m_uploadService;
ProjectExplorer::IDevice::ConstPtr m_device;
int m_progressCount;
State m_state;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYDEPLOYQTLIBRARIESDIALOG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BlackBerryDeployQtLibrariesDialog</class>
<widget class="QDialog" name="Qnx::Internal::BlackBerryDeployQtLibrariesDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>520</width>
<height>479</height>
</rect>
</property>
<property name="windowTitle">
<string>Deploy Qt to BlackBerry device</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Qt library to deploy:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="qtLibraryCombo"/>
</item>
<item>
<widget class="QPushButton" name="deployButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Deploy</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Remote directory:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>/accounts/devuser/</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="remoteDirectory">
<property name="text">
<string>qt</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QProgressBar" name="deployProgress">
<property name="value">
<number>0</number>
</property>
<property name="textVisible">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="deployLogWindow"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>218</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -101,7 +101,8 @@ SOURCES += qnxplugin.cpp \
blackberrycheckdevicestatusstepconfigwidget.cpp \
blackberrycheckdevicestatusstep.cpp \
qnxattachdebugsupport.cpp \
qnxattachdebugdialog.cpp
qnxattachdebugdialog.cpp \
blackberrydeployqtlibrariesdialog.cpp
HEADERS += qnxplugin.h\
qnxconstants.h \
......@@ -202,7 +203,8 @@ HEADERS += qnxplugin.h\
blackberrycheckdevicestatusstepfactory.h \
blackberrycheckdevicestatusstepconfigwidget.h \
qnxattachdebugsupport.h \
qnxattachdebugdialog.h
qnxattachdebugdialog.h \
blackberrydeployqtlibrariesdialog.h
FORMS += \
blackberrydeviceconfigurationwizardsetuppage.ui \
......@@ -235,7 +237,8 @@ FORMS += \
blackberryinstallwizardprocesspage.ui \
blackberryinstallwizardoptionpage.ui \
blackberrydebugtokenpinsdialog.ui \
blackberrycheckdevicestatusstepconfigwidget.ui
blackberrycheckdevicestatusstepconfigwidget.ui \
blackberrydeployqtlibrariesdialog.ui
include(../../private_headers.pri)
include(./cascadesimport/cascadesimport.pri)
......
......@@ -87,6 +87,9 @@ QtcPlugin {
"blackberrydeployconfigurationwidget.ui",
"blackberrydeployinformation.cpp",
"blackberrydeployinformation.h",
"blackberrydeployqtlibrariesdialog.cpp",
"blackberrydeployqtlibrariesdialog.h",
"blackberrydeployqtlibrariesdialog.ui",
"blackberrydeploystep.cpp",
"blackberrydeploystep.h",
"blackberrydeploystepconfigwidget.cpp",
......
......@@ -117,6 +117,8 @@ const char QNX_BLACKBERRY_CONFIGS_FILENAME[] = "bbndkconfigurations.xml";
const char QNX_DEBUGGING_GROUP[] = "Debugger.Group.Qnx";
const char QNX_BLACKBERRY_DEFAULT_DEPLOY_QT_BASEPATH[] = "/accounts/devuser/";
} // namespace Constants
} // namespace Qnx
......
Markdown is supported
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