From c7278acda0c3135851e10effe4246a28539af95d Mon Sep 17 00:00:00 2001 From: Pawel Polanski <pawel.3.polanski@nokia.com> Date: Tue, 20 Jul 2010 13:37:15 +0200 Subject: [PATCH] Installing on a drive other than C: for Symbian OS Silent installation added to Sumbian's Run Configuration UI Reviewed-by: Tobias Hunger --- .../qt-s60/s60deploystep.cpp | 11 +++-- .../qt4projectmanager/qt-s60/s60deploystep.h | 3 +- .../qt-s60/s60devicerunconfiguration.cpp | 40 +++++++++++++-- .../qt-s60/s60devicerunconfiguration.h | 10 ++++ .../s60devicerunconfigurationwidget.cpp | 49 ++++++++++++++++++- .../qt-s60/s60devicerunconfigurationwidget.h | 6 +++ src/shared/symbianutils/launcher.cpp | 16 +++++- src/shared/symbianutils/launcher.h | 2 + 8 files changed, 125 insertions(+), 12 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp index f0294d02738..b927b74c4c3 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp @@ -128,6 +128,8 @@ bool S60DeployStep::init() m_serialPortFriendlyName = SymbianUtils::SymbianDeviceManager::instance()->friendlyNameForPort(m_serialPortName); m_packageFileNameWithTarget = runConfiguration->packageFileNameWithTargetInfo(); m_signedPackage = runConfiguration->signedPackage(); + m_installationDrive = runConfiguration->installationDrive(); + m_silentInstall = runConfiguration->silentInstall(); setDisplayName(tr("Deploy", "Qt4 DeployStep display name.")); QString message; @@ -250,11 +252,14 @@ void S60DeployStep::startDeployment() Q_ASSERT(m_launcher); setupConnections(); - //TODO sisx destination and file path user definable - const QString copyDst = QString::fromLatin1("C:\\Data\\%1").arg(QFileInfo(m_signedPackage).fileName()); + + const QString copyDst = QString::fromLatin1("%1:\\Data\\%2").arg(m_installationDrive).arg(QFileInfo(m_signedPackage).fileName()); m_launcher->setCopyFileName(m_signedPackage, copyDst); m_launcher->setInstallFileName(copyDst); + m_launcher->setInstallationDrive(m_installationDrive); + m_launcher->setInstallationMode(m_silentInstall?trk::Launcher::InstallationModeSilent: + trk::Launcher::InstallationModeUser); m_launcher->addStartupActions(trk::Launcher::ActionCopyInstall); appendMessage(tr("Package: %1\nDeploying application to '%2'...").arg(m_signedPackage, m_serialPortFriendlyName), false); @@ -347,7 +352,7 @@ void S60DeployStep::printCopyingNotice() void S60DeployStep::printInstallingNotice() { - appendMessage(tr("Installing application..."), false); + appendMessage(tr("Installing application on drive %1:...").arg(m_installationDrive), false); } void S60DeployStep::printInstallingFinished() diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h index 579ebdde730..2023270b5c6 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h @@ -143,7 +143,8 @@ private: QEventLoop *m_eventLoop; bool m_deployResult; - + char m_installationDrive; + bool m_silentInstall; }; class S60DeployStepWidget : public ProjectExplorer::BuildStepConfigWidget diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp index 1acabce8ab3..4c66d059c7f 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp @@ -72,6 +72,8 @@ const char * const PRO_FILE_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.Pro const char * const SERIAL_PORT_NAME_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.SerialPortName"); const char * const COMMUNICATION_TYPE_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.CommunicationType"); const char * const COMMAND_LINE_ARGUMENTS_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.CommandLineArguments"); +const char * const INSTALLATION_DRIVE_LETTER_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.InstallationDriveLetter"); +const char * const SILENT_INSTALL_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.SilentInstall"); const int PROGRESS_DEPLOYBASE = 0; const int PROGRESS_PACKAGEDEPLOYED = 100; @@ -115,10 +117,11 @@ S60DeviceRunConfiguration::S60DeviceRunConfiguration(Target *parent, const QStri m_proFilePath(proFilePath), m_activeBuildConfiguration(0), #ifdef Q_OS_WIN - m_serialPortName(QLatin1String("COM5")) + m_serialPortName(QLatin1String("COM5")), #else - m_serialPortName(QLatin1String(SymbianUtils::SymbianDeviceManager::linuxBlueToothDeviceRootC) + QLatin1Char('0')) + m_serialPortName(QLatin1String(SymbianUtils::SymbianDeviceManager::linuxBlueToothDeviceRootC) + QLatin1Char('0')), #endif + m_installationDrive('C') { ctor(); } @@ -127,7 +130,8 @@ S60DeviceRunConfiguration::S60DeviceRunConfiguration(Target *target, S60DeviceRu RunConfiguration(target, source), m_proFilePath(source->m_proFilePath), m_activeBuildConfiguration(0), - m_serialPortName(source->m_serialPortName) + m_serialPortName(source->m_serialPortName), + m_installationDrive(source->m_installationDrive) { ctor(); } @@ -221,6 +225,8 @@ QVariantMap S60DeviceRunConfiguration::toMap() const map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(m_proFilePath)); map.insert(QLatin1String(SERIAL_PORT_NAME_KEY), m_serialPortName); map.insert(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY), m_commandLineArguments); + map.insert(QLatin1String(INSTALLATION_DRIVE_LETTER_KEY), QChar(m_installationDrive)); + map.insert(QLatin1String(SILENT_INSTALL_KEY), QVariant(m_silentInstall)); return map; } @@ -232,6 +238,9 @@ bool S60DeviceRunConfiguration::fromMap(const QVariantMap &map) m_proFilePath = projectDir.filePath(map.value(QLatin1String(PRO_FILE_KEY)).toString()); m_serialPortName = map.value(QLatin1String(SERIAL_PORT_NAME_KEY)).toString().trimmed(); m_commandLineArguments = map.value(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY)).toStringList(); + m_installationDrive = map.value(QLatin1String(INSTALLATION_DRIVE_LETTER_KEY), QChar('C')) + .toChar().toAscii(); + m_silentInstall = map.value(QLatin1String(SILENT_INSTALL_KEY), QVariant(true)).toBool(); return RunConfiguration::fromMap(map); } @@ -250,6 +259,16 @@ void S60DeviceRunConfiguration::setSerialPortName(const QString &name) emit serialPortNameChanged(); } +char S60DeviceRunConfiguration::installationDrive() const +{ + return m_installationDrive; +} + +void S60DeviceRunConfiguration::setInstallationDrive(char drive) +{ + m_installationDrive = drive; +} + QString S60DeviceRunConfiguration::targetName() const { TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()->targetInformation(m_proFilePath); @@ -404,6 +423,16 @@ void S60DeviceRunConfiguration::setCommandLineArguments(const QStringList &args) m_commandLineArguments = args; } +bool S60DeviceRunConfiguration::silentInstall() const +{ + return m_silentInstall; +} + +void S60DeviceRunConfiguration::setSilentInstall(bool v) +{ + m_silentInstall = v; +} + // ======== S60DeviceRunConfigurationFactory S60DeviceRunConfigurationFactory::S60DeviceRunConfigurationFactory(QObject *parent) : @@ -511,6 +540,7 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(RunConfiguration *runConfigurat m_targetName = s60runConfig->targetName(); m_commandLineArguments = s60runConfig->commandLineArguments(); m_qtDir = activeBuildConf->qtVersion()->versionInfo().value("QT_INSTALL_DATA"); + m_installationDrive = s60runConfig->installationDrive(); if (const QtVersion *qtv = s60runConfig->qtVersion()) m_qtBinPath = qtv->versionInfo().value(QLatin1String("QT_INSTALL_BINS")); QTC_ASSERT(!m_qtBinPath.isEmpty(), return); @@ -608,10 +638,10 @@ void S60DeviceRunControlBase::startDeployment() connect(m_launcher, SIGNAL(processStopped(uint,uint,uint,QString)), this, SLOT(processStopped(uint,uint,uint,QString))); - //TODO sisx destination and file path user definable if (!m_commandLineArguments.isEmpty()) m_launcher->setCommandLineArgs(m_commandLineArguments); - const QString runFileName = QString::fromLatin1("C:\\sys\\bin\\%1.exe").arg(m_targetName); + + const QString runFileName = QString::fromLatin1("%1:\\sys\\bin\\%2.exe").arg(m_installationDrive).arg(m_targetName); initLauncher(runFileName, m_launcher); const trk::PromptStartCommunicationResult src = S60RunConfigBluetoothStarter::startCommunication(m_launcher->trkDevice(), diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h index f5537a9ca43..d17716f9574 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h @@ -79,6 +79,9 @@ public: QString serialPortName() const; void setSerialPortName(const QString &name); + char installationDrive() const; + void setInstallationDrive(char drive); + QString targetName() const; QString packageFileNameWithTargetInfo() const; QString symbianPlatform() const; @@ -93,6 +96,9 @@ public: QStringList commandLineArguments() const; void setCommandLineArguments(const QStringList &args); + bool silentInstall() const; + void setSilentInstall(bool v); + ProjectExplorer::ToolChain::ToolChainType toolChainType() const; QVariantMap toMap() const; @@ -119,6 +125,9 @@ private: ProjectExplorer::BuildConfiguration *m_activeBuildConfiguration; QString m_serialPortName; QStringList m_commandLineArguments; + + char m_installationDrive; + bool m_silentInstall; }; class S60DeviceRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory @@ -196,6 +205,7 @@ private: bool m_handleDeviceRemoval; QFutureInterface<void> *m_deployProgress; trk::Launcher *m_launcher; + char m_installationDrive; }; // Configure launcher to run the application diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.cpp index 0d87d9deae3..d180b234987 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.cpp @@ -55,6 +55,7 @@ #include <QtGui/QSpacerItem> #include <QtGui/QMainWindow> #include <QtGui/QMessageBox> +#include <QtGui/QCheckBox> Q_DECLARE_METATYPE(SymbianUtils::SymbianDevice) @@ -67,6 +68,9 @@ enum { wantUpdateSerialDevicesButton = 1 }; namespace Qt4ProjectManager { namespace Internal { +const char STARTING_DRIVE_LETTER = 'C'; +const char LAST_DRIVE_LETTER = 'Z'; + S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget( S60DeviceRunConfiguration *runConfiguration, QWidget *parent) @@ -80,7 +84,9 @@ S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget( m_deviceInfoButton(new QToolButton), m_deviceInfoDescriptionLabel(new QLabel(tr("Device:"))), m_deviceInfoLabel(new QLabel), - m_infoTimeOutTimer(0) + m_infoTimeOutTimer(0), + m_installationDriveCombo(new QComboBox), + m_silentInstallCheckBox(new QCheckBox(tr("Silent installation"))) { m_detailsWidget->setState(Utils::DetailsWidget::NoSummary); updateTargetInformation(); @@ -105,6 +111,23 @@ S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget( formLayout->addRow(tr("Arguments:"), m_argumentsLineEdit); formLayout->addRow(tr("Installation file:"), m_sisFileLabel); + // Installation Drive control + updateInstallationDrives(); + m_installationDriveCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents); + connect(m_installationDriveCombo, SIGNAL(activated(int)), this, SLOT(setInstallationDrive(int))); + QHBoxLayout *installationDriveHBoxLayout = new QHBoxLayout; + installationDriveHBoxLayout->addWidget(m_installationDriveCombo); + installationDriveHBoxLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored)); + formLayout->addRow(tr("Installation drive:"), installationDriveHBoxLayout); + + // Non-silent installs are a fallback if one wants to override missing dependencies. + m_silentInstallCheckBox->setChecked(m_runConfiguration->silentInstall()); + m_silentInstallCheckBox->setToolTip(tr("Silent installation is an installation mode " + "that does not require user's intervention. " + "In case it fails the non silent installation is launched.")); + connect(m_silentInstallCheckBox, SIGNAL(stateChanged(int)), this, SLOT(silentInstallChanged(int))); + formLayout->addRow(m_silentInstallCheckBox); + updateSerialDevices(); connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(updated()), this, SLOT(updateSerialDevices())); @@ -144,6 +167,25 @@ S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget( this, SLOT(updateTargetInformation())); } +void S60DeviceRunConfigurationWidget::updateInstallationDrives() +{ + m_installationDriveCombo->clear(); + for (int i = STARTING_DRIVE_LETTER; i <= LAST_DRIVE_LETTER; ++i) { + m_installationDriveCombo->addItem(QString("%1:").arg((char)i), qVariantFromValue(i)); + } + int index = (char)QChar::toUpper((uint)m_runConfiguration->installationDrive())-STARTING_DRIVE_LETTER; + + Q_ASSERT(index>= 0 && index <= LAST_DRIVE_LETTER-STARTING_DRIVE_LETTER); + + m_installationDriveCombo->setCurrentIndex(index); +} + +void S60DeviceRunConfigurationWidget::silentInstallChanged(int state) +{ + bool isSilent = state == Qt::Checked; + m_runConfiguration->setSilentInstall(isSilent); +} + void S60DeviceRunConfigurationWidget::updateSerialDevices() { m_serialPortsCombo->clear(); @@ -208,6 +250,11 @@ void S60DeviceRunConfigurationWidget::updateTargetInformation() m_sisFileLabel->setText(QDir::toNativeSeparators(m_runConfiguration->signedPackage())); } +void S60DeviceRunConfigurationWidget::setInstallationDrive(int index) +{ + m_runConfiguration->setInstallationDrive((char)(STARTING_DRIVE_LETTER + index)); +} + void S60DeviceRunConfigurationWidget::setSerialPort(int index) { const SymbianUtils::SymbianDevice d = device(index); diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h index bc3da502092..39c69dfaaef 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h @@ -39,6 +39,7 @@ class QTimer; class QLineEdit; class QComboBox; class QToolButton; +class QCheckBox; QT_END_NAMESPACE namespace Utils { @@ -72,12 +73,15 @@ private slots: void displayNameEdited(const QString &text); void argumentsEdited(const QString &text); void updateTargetInformation(); + void updateInstallationDrives(); void updateSerialDevices(); + void setInstallationDrive(int index); void setSerialPort(int index); void updateDeviceInfo(); void clearDeviceInfo(); void slotLauncherStateChanged(int); void slotWaitingForTrkClosed(); + void silentInstallChanged(int); private: inline SymbianUtils::SymbianDevice device(int i) const; @@ -96,6 +100,8 @@ private: QLabel *m_deviceInfoLabel; QTimer *m_infoTimeOutTimer; QPointer<trk::Launcher> m_infoLauncher; + QComboBox *m_installationDriveCombo; + QCheckBox *m_silentInstallCheckBox; }; } // namespace Internal diff --git a/src/shared/symbianutils/launcher.cpp b/src/shared/symbianutils/launcher.cpp index 930e6d1495c..e6b790f45af 100644 --- a/src/shared/symbianutils/launcher.cpp +++ b/src/shared/symbianutils/launcher.cpp @@ -104,6 +104,7 @@ struct LauncherPrivate { CrashReportState m_crashReportState; Launcher::InstallationMode m_installationMode; Launcher::InstallationMode m_currentInstallationStep; + char m_installationDrive; }; LauncherPrivate::LauncherPrivate(const TrkDevicePtr &d) : @@ -112,7 +113,8 @@ LauncherPrivate::LauncherPrivate(const TrkDevicePtr &d) : m_verbose(0), m_closeDevice(true), m_installationMode(Launcher::InstallationModeSilentAndUser), - m_currentInstallationStep(Launcher::InstallationModeSilent) + m_currentInstallationStep(Launcher::InstallationModeSilent), + m_installationDrive('C') { if (m_device.isNull()) m_device = TrkDevicePtr(new TrkDevice); @@ -156,6 +158,11 @@ void Launcher::setInstallationMode(InstallationMode installation) d->m_installationMode = installation; } +void Launcher::setInstallationDrive(char drive) +{ + d->m_installationDrive = drive; +} + void Launcher::addStartupActions(trk::Launcher::Actions startupActions) { d->m_startupActions = Actions(d->m_startupActions | startupActions); @@ -228,6 +235,11 @@ Launcher::InstallationMode Launcher::installationMode() const return d->m_installationMode; } +char Launcher::installationDrive() const +{ + return d->m_installationDrive; +} + bool Launcher::startServer(QString *errorMessage) { errorMessage->clear(); @@ -862,7 +874,7 @@ void Launcher::installRemotePackageSilently() emit installingStarted(); d->m_currentInstallationStep = InstallationModeSilent; QByteArray ba; - ba.append('C'); + ba.append((char)QChar::toUpper((ushort)d->m_installationDrive)); appendString(&ba, d->m_installFileName.toLocal8Bit(), TargetByteOrder, false); d->m_device->sendTrkMessage(TrkInstallFile, TrkCallback(this, &Launcher::handleInstallPackageFinished), ba); } diff --git a/src/shared/symbianutils/launcher.h b/src/shared/symbianutils/launcher.h index edf2afed94a..c2270f1402f 100644 --- a/src/shared/symbianutils/launcher.h +++ b/src/shared/symbianutils/launcher.h @@ -95,10 +95,12 @@ public: void setCommandLineArgs(const QStringList &args); bool startServer(QString *errorMessage); void setInstallationMode(InstallationMode installation); + void setInstallationDrive(char drive); void setVerbose(int v); void setSerialFrame(bool b); InstallationMode installationMode() const; + char installationDrive() const; bool serialFrame() const; // Close device or leave it open -- GitLab