Commit 724ecfca authored by qt-info@nokia.com's avatar qt-info@nokia.com Committed by ck
Browse files

Maemo: Make deploy mount port user-settable.

parent db5a61d3
......@@ -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");
......
......@@ -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();
......
......@@ -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<Core::SftpChannel> m_uploader;
typedef QPair<MaemoDeployable, QString> DeployInfo;
......
......@@ -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
......@@ -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;
......
......@@ -15,29 +15,68 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="deviceConfigLabel">
<property name="text">
<string>Device configuration:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="deviceConfigComboBox"/>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="deviceConfigComboBox"/>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="1" column="0">
<widget class="QLabel" name="mountPortLabel">
<property name="toolTip">
<string>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.</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<property name="text">
<string>Mount port:</string>
</property>
</spacer>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QSpinBox" name="mountPortSpinBox">
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
......
......@@ -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) {
......
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