forked from qt-creator/qt-creator
Maemo: Add ports gatherer to deploy step.
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include "maemoremotemounter.h"
|
||||
#include "maemorunconfiguration.h"
|
||||
#include "maemotoolchain.h"
|
||||
#include "maemousedportsgatherer.h"
|
||||
|
||||
#include <coreplugin/ssh/sftpchannel.h>
|
||||
#include <coreplugin/ssh/sshconnection.h>
|
||||
@@ -120,6 +121,11 @@ void MaemoDeployStep::ctor()
|
||||
SLOT(handleProgressReport(QString)));
|
||||
connect(m_mounter, SIGNAL(debugOutput(QString)), this,
|
||||
SLOT(handleMountDebugOutput(QString)));
|
||||
m_portsGatherer = new MaemoUsedPortsGatherer(this);
|
||||
connect(m_portsGatherer, SIGNAL(error(QString)), this,
|
||||
SLOT(handlePortsGathererError(QString)));
|
||||
connect(m_portsGatherer, SIGNAL(portListReady()), this,
|
||||
SLOT(handlePortListReady()));
|
||||
}
|
||||
|
||||
bool MaemoDeployStep::init()
|
||||
@@ -424,7 +430,7 @@ void MaemoDeployStep::handleUnmounted()
|
||||
prepareSftpConnection();
|
||||
break;
|
||||
case CurrentDirsUnmount:
|
||||
// m_mounter->mount(); TODO: See above
|
||||
m_portsGatherer->start(m_connection, deviceConfig().freePorts());
|
||||
break;
|
||||
case CurrentMountsUnmount:
|
||||
writeOutput(tr("Deployment finished."));
|
||||
@@ -456,8 +462,7 @@ void MaemoDeployStep::setupMount()
|
||||
const QString localDir
|
||||
= QFileInfo(packagingStep()->packageFilePath()).absolutePath();
|
||||
const MaemoMountSpecification mountSpec(localDir, deployMountPoint());
|
||||
if (!addMountSpecification(mountSpec))
|
||||
return;
|
||||
m_mounter->addMountSpecification(mountSpec, true);
|
||||
} else {
|
||||
#ifdef Q_OS_WIN
|
||||
bool drivesToMount[26];
|
||||
@@ -479,14 +484,12 @@ void MaemoDeployStep::setupMount()
|
||||
+ QLatin1Char(driveLetter);
|
||||
const MaemoMountSpecification mountSpec(localDir.left(3),
|
||||
mountPoint);
|
||||
if (!addMountSpecification(mountSpec))
|
||||
return;
|
||||
m_mounter->addMountSpecification(mountSpec, true);
|
||||
drivesToMount[index] = true;
|
||||
}
|
||||
#else
|
||||
if (!addMountSpecification(MaemoMountSpecification(QLatin1String("/"),
|
||||
deployMountPoint())))
|
||||
return;
|
||||
m_mounter->addMountSpecification(MaemoMountSpecification(QLatin1String("/"),
|
||||
deployMountPoint()), true);
|
||||
#endif
|
||||
}
|
||||
m_unmountState = CurrentDirsUnmount;
|
||||
@@ -657,15 +660,6 @@ void MaemoDeployStep::copyNextFileToDevice()
|
||||
copyProcess->start();
|
||||
}
|
||||
|
||||
bool MaemoDeployStep::addMountSpecification(const MaemoMountSpecification &mountSpec)
|
||||
{
|
||||
if (!m_mounter->addMountSpecification(mountSpec, true)) {
|
||||
raiseError(tr("Device has not enough free ports for deployment."));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MaemoDeployStep::handleCopyProcessFinished(int exitStatus)
|
||||
{
|
||||
if (m_stopped) {
|
||||
@@ -759,6 +753,17 @@ void MaemoDeployStep::handleInstallationFinished(int exitStatus)
|
||||
m_mounter->unmount();
|
||||
}
|
||||
|
||||
void MaemoDeployStep::handlePortsGathererError(const QString &errorMsg)
|
||||
{
|
||||
raiseError(errorMsg);
|
||||
}
|
||||
|
||||
void MaemoDeployStep::handlePortListReady()
|
||||
{
|
||||
m_freePorts = deviceConfig().freePorts();
|
||||
m_mounter->mount(&m_freePorts, m_portsGatherer);
|
||||
}
|
||||
|
||||
void MaemoDeployStep::handleDeviceInstallerOutput(const QByteArray &output)
|
||||
{
|
||||
writeOutput(QString::fromUtf8(output), NormalOutput);
|
||||
|
||||
@@ -62,6 +62,7 @@ class MaemoRemoteMounter;
|
||||
class MaemoDeviceConfigListModel;
|
||||
class MaemoPackageCreationStep;
|
||||
class MaemoToolChain;
|
||||
class MaemoUsedPortsGatherer;
|
||||
|
||||
class MaemoDeployStep : public ProjectExplorer::BuildStep
|
||||
{
|
||||
@@ -107,6 +108,8 @@ private slots:
|
||||
void handleInstallationFinished(int exitStatus);
|
||||
void handleDeviceInstallerOutput(const QByteArray &output);
|
||||
void handleDeviceInstallerErrorOutput(const QByteArray &output);
|
||||
void handlePortsGathererError(const QString &errorMsg);
|
||||
void handlePortListReady();
|
||||
|
||||
private:
|
||||
MaemoDeployStep(ProjectExplorer::BuildStepList *bc,
|
||||
@@ -127,7 +130,6 @@ private:
|
||||
QString deployMountPoint() const;
|
||||
const MaemoToolChain *toolChain() const;
|
||||
void copyNextFileToDevice();
|
||||
bool addMountSpecification(const MaemoMountSpecification &mountSpec);
|
||||
void installToSysroot();
|
||||
QString uploadDir() const;
|
||||
void connectToDevice();
|
||||
@@ -159,6 +161,8 @@ private:
|
||||
typedef QPair<MaemoDeployable, QString> DeployablePerHost;
|
||||
QHash<DeployablePerHost, QDateTime> m_lastDeployed;
|
||||
MaemoDeviceConfigListModel *m_deviceConfigModel;
|
||||
MaemoUsedPortsGatherer *m_portsGatherer;
|
||||
MaemoPortList m_freePorts;
|
||||
};
|
||||
|
||||
class MaemoDeployEventHandler : public QObject
|
||||
|
||||
@@ -67,7 +67,7 @@ void MaemoRemoteMounter::setConnection(const Core::SshConnection::Ptr &connectio
|
||||
m_connection = connection;
|
||||
}
|
||||
|
||||
bool MaemoRemoteMounter::addMountSpecification(const MaemoMountSpecification &mountSpec,
|
||||
void MaemoRemoteMounter::addMountSpecification(const MaemoMountSpecification &mountSpec,
|
||||
bool mountAsRoot)
|
||||
{
|
||||
Q_ASSERT(m_toolChain);
|
||||
@@ -75,7 +75,6 @@ bool MaemoRemoteMounter::addMountSpecification(const MaemoMountSpecification &mo
|
||||
|
||||
if (m_toolChain->allowsRemoteMounts() && mountSpec.isValid())
|
||||
m_mountSpecs << MountInfo(mountSpec, mountAsRoot);
|
||||
return true; // TODO: Function can't fail anymore. Make void and remove all checks
|
||||
}
|
||||
|
||||
bool MaemoRemoteMounter::hasValidMountSpecifications() const
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
MaemoRemoteMounter(QObject *parent);
|
||||
~MaemoRemoteMounter();
|
||||
void setToolchain(const MaemoToolChain *toolchain) { m_toolChain = toolchain; }
|
||||
bool addMountSpecification(const MaemoMountSpecification &mountSpec,
|
||||
void addMountSpecification(const MaemoMountSpecification &mountSpec,
|
||||
bool mountAsRoot);
|
||||
bool hasValidMountSpecifications() const;
|
||||
void resetMountSpecifications() { m_mountSpecs.clear(); }
|
||||
|
||||
Reference in New Issue
Block a user