Commit 1914d05d authored by Christian Kandeler's avatar Christian Kandeler

Maemo: Introduce explicit states to deploy step.

Probably fixed some subtle error handling bugs along the way.

Task-number: QTCREATORBUG-2705
parent 706a04c6
......@@ -83,13 +83,14 @@ public:
bool isDeployToSysrootEnabled() const { return m_deployToSysroot; }
void setDeployToSysrootEnabled(bool deploy) { m_deployToSysroot = deploy; }
Q_INVOKABLE void stop();
signals:
void done();
void error();
private slots:
void start();
void stop();
void handleConnected();
void handleConnectionFailure();
void handleMounted();
......@@ -98,13 +99,13 @@ private slots:
void handleMountDebugOutput(const QString &output);
void handleProgressReport(const QString &progressMsg);
void handleCopyProcessFinished(int exitStatus);
void handleCleanupTimeout();
void handleSysrootInstallerFinished();
void handleSysrootInstallerOutput();
void handleSysrootInstallerErrorOutput();
void handleSftpChannelInitialized();
void handleSftpChannelInitializationFailed(const QString &error);
void handleSftpJobFinished(Core::SftpJobId job, const QString &error);
void handleSftpChannelClosed();
void handleInstallationFinished(int exitStatus);
void handleDeviceInstallerOutput(const QByteArray &output);
void handleDeviceInstallerErrorOutput(const QByteArray &output);
......@@ -112,6 +113,13 @@ private slots:
void handlePortListReady();
private:
enum State {
Inactive, StopRequested, InstallingToSysroot, Connecting,
UnmountingOldDirs, UnmountingCurrentDirs, GatheringPorts, Mounting,
InstallingToDevice, UnmountingCurrentMounts, CopyingFile,
InitializingSftp, Uploading
};
MaemoDeployStep(ProjectExplorer::BuildStepList *bc,
MaemoDeployStep *other);
virtual bool init();
......@@ -136,7 +144,9 @@ private:
void unmountOldDirs();
void setupMount();
void prepareSftpConnection();
void runDpkg(const QString &packageFilePath, bool removeAfterInstall);
void runDpkg(const QString &packageFilePath);
void setState(State newState);
void unmount();
static const QLatin1String Id;
......@@ -147,22 +157,17 @@ private:
QScopedPointer<DeviceDeployAction> m_currentDeviceDeployAction;
QList<MaemoDeployable> m_filesToCopy;
MaemoRemoteMounter *m_mounter;
QTimer *m_cleanupTimer;
bool m_canStart;
bool m_deployToSysroot;
enum UnmountState { OldDirsUnmount, CurrentDirsUnmount, CurrentMountsUnmount };
UnmountState m_unmountState;
QSharedPointer<Core::SftpChannel> m_uploader;
QSharedPointer<Core::SshRemoteProcess> m_deviceInstaller;
bool m_stopped;
bool m_needsInstall;
bool m_connecting;
typedef QPair<MaemoDeployable, QString> DeployablePerHost;
QHash<DeployablePerHost, QDateTime> m_lastDeployed;
MaemoDeviceConfigListModel *m_deviceConfigModel;
MaemoUsedPortsGatherer *m_portsGatherer;
MaemoPortList m_freePorts;
State m_state;
};
class MaemoDeployEventHandler : public QObject
......@@ -178,9 +183,10 @@ private slots:
void checkForCanceled();
private:
const MaemoDeployStep * const m_deployStep;
MaemoDeployStep * const m_deployStep;
const QFutureInterface<bool> m_future;
QEventLoop * const m_eventLoop;
bool m_error;
};
} // namespace Internal
......
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