diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoconstants.h b/src/plugins/qt4projectmanager/qt-maemo/maemoconstants.h index 2f27e408377..2fc3b5c7a3c 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoconstants.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoconstants.h @@ -68,7 +68,8 @@ static const QLatin1String LastDeployedTimesKey(PREFIX ".LastDeployedTimes"); static const QLatin1String ProFileKey(PREFIX ".ProFile"); static const QLatin1String ExportedLocalDirsKey(PREFIX ".ExportedLocalDirs"); static const QLatin1String RemoteMountPointsKey(PREFIX ".RemoteMountPoints"); -static const QLatin1String MountPortsKey(PREFIX ".MountPorts"); +static const QLatin1String UserDefinedMountPortsKey(PREFIX ".MountPorts"); +static const QLatin1String DeployMountPortKey(PREFIX ".DeployMountPort"); static const QLatin1String BaseEnvironmentBaseKey(PREFIX ".BaseEnvironmentBase"); static const QLatin1String UserEnvironmentChangesKey(PREFIX ".UserEnvironmentChanges"); static const QLatin1String UseRemoteGdbKey(PREFIX ".UseRemoteGdb"); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp index d12068f7f33..3f6b1b85a06 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp @@ -60,6 +60,7 @@ using namespace ProjectExplorer; namespace Qt4ProjectManager { namespace Internal { +namespace { const int DefaultMountPort = 1050; } const QLatin1String MaemoDeployStep::Id("Qt4ProjectManager.MaemoDeployStep"); @@ -130,6 +131,9 @@ BuildStepConfigWidget *MaemoDeployStep::createConfigWidget() QVariantMap MaemoDeployStep::toMap() const { QVariantMap map(BuildStep::toMap()); +#ifdef DEPLOY_VIA_MOUNT + map.insert(DeployMountPortKey, m_mountPort); +#endif addDeployTimesToMap(map); map.unite(m_deviceConfigModel->toMap()); return map; @@ -158,6 +162,9 @@ bool MaemoDeployStep::fromMap(const QVariantMap &map) { if (!BuildStep::fromMap(map)) return false; +#ifdef DEPLOY_VIA_MOUNT + m_mountPort = map.value(DeployMountPortKey, DefaultMountPort).toInt(); +#endif getDeployTimesFromMap(map); m_deviceConfigModel->fromMap(map); return true; @@ -558,17 +565,16 @@ void MaemoDeployStep::handleUnmounted() return; } - // TODO: port must come from user setting. (Call it "base port" on windows!) if (m_needsInstall || !m_filesToCopy.isEmpty()) { if (m_needsInstall) { const QString localDir = QFileInfo(packagingStep()->packageFilePath()) .absolutePath(); const MaemoMountSpecification mountSpec(localDir, - deployMountPoint(), 11000); + deployMountPoint(), m_mountPort); m_mounter->addMountSpecification(mountSpec, true); } else { #ifdef Q_OS_WIN - int port = 11000; + int port = m_mountPort; bool drivesToMount[26]; for (int i = 0; i < sizeof drivesToMount / drivesToMount[0]; ++i) drivesToMount[i] = false; @@ -594,7 +600,7 @@ void MaemoDeployStep::handleUnmounted() } #else m_mounter->addMountSpecification(MaemoMountSpecification(QLatin1String("/"), - deployMountPoint(), 11000), true); + deployMountPoint(), m_mountPort), true); #endif } m_mounter->mount(); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h index dafedccb3d5..eaec0254084 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h @@ -81,6 +81,10 @@ public: const MaemoDeployable &deployable) const; void setDeployed(const QString &host, const MaemoDeployable &deployable); MaemoDeployables *deployables() const { return m_deployables; } +#ifdef DEPLOY_VIA_MOUNT + int mountPort() const { return m_mountPort; } + void setMountPort(int port) { m_mountPort = port; } +#endif signals: void done(); @@ -146,6 +150,7 @@ private: MaemoRemoteMounter *m_mounter; QTimer *m_cleanupTimer; bool m_canStart; + int m_mountPort; #else QSharedPointer m_uploader; typedef QPair DeployInfo; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp index 33888dce36e..90101bf653f 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp @@ -20,6 +20,7 @@ MaemoDeployStepWidget::MaemoDeployStepWidget(MaemoDeployStep *step) : m_step(step) { ui->setupUi(this); + ui->mountPortSpinBox->setToolTip(ui->mountPortLabel->toolTip()); connect(m_step->deployables(), SIGNAL(modelsCreated()), this, SLOT(handleModelsCreated())); @@ -33,6 +34,14 @@ MaemoDeployStepWidget::~MaemoDeployStepWidget() void MaemoDeployStepWidget::init() { +#ifdef DEPLOY_VIA_MOUNT + ui->mountPortSpinBox->setValue(m_step->mountPort()); + connect(ui->mountPortSpinBox, SIGNAL(valueChanged(int)), this, + SLOT(handleMountPortEdited(int))); +#else + ui->mountPortLabel->hide(); + ui->mountPortSpinBox->hide(); +#endif handleDeviceConfigModelChanged(); connect(m_step->buildConfiguration()->target(), SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)), @@ -90,5 +99,12 @@ void MaemoDeployStepWidget::setCurrentDeviceConfig(int index) m_step->deviceConfigModel()->setCurrentIndex(index); } +void MaemoDeployStepWidget::handleMountPortEdited(int newPort) +{ +#ifdef DEPLOY_VIA_MOUNT + m_step->setMountPort(newPort); +#endif +} + } // namespace Internal } // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.h index d5eff9ee7ec..fb32f0aa01e 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.h @@ -26,6 +26,7 @@ private: Q_SLOT void handleModelsCreated(); Q_SLOT void handleDeviceConfigModelChanged(); Q_SLOT void setCurrentDeviceConfig(int index); + Q_SLOT void handleMountPortEdited(int newPort); virtual void init(); virtual QString summaryText() const; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.ui b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.ui index 94afe4a4abe..8914fadad53 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.ui +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.ui @@ -15,29 +15,68 @@ - - + + Device configuration: - - + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - Qt::Horizontal + + + + The port on the device to use for mounting the host disk during deployment. +Note: On Windows, several consecutive ports may be used, starting with the one set here. - - - 40 - 20 - + + Mount port: - + + + + + + + + 65535 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.cpp index d755b44c138..340a51ab8e1 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.cpp @@ -106,7 +106,7 @@ QVariantMap MaemoRemoteMountsModel::toMap() const } map.insert(ExportedLocalDirsKey, localDirsList); map.insert(RemoteMountPointsKey, remoteMountPointsList); - map.insert(MountPortsKey, mountPortsList); + map.insert(UserDefinedMountPortsKey, mountPortsList); return map; } @@ -116,7 +116,7 @@ void MaemoRemoteMountsModel::fromMap(const QVariantMap &map) = map.value(ExportedLocalDirsKey).toList(); const QVariantList &remoteMountPointsList = map.value(RemoteMountPointsKey).toList(); - const QVariantList &mountPortsList = map.value(MountPortsKey).toList(); + const QVariantList &mountPortsList = map.value(UserDefinedMountPortsKey).toList(); const int count = qMin(qMin(localDirsList.count(), remoteMountPointsList.count()), mountPortsList.count()); for (int i = 0; i < count; ++i) {