diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp index ea74392ee878865aab5289c0420bb51cce7d3058..25f4ac6cae34bb1af89856d51d2a3a3607fef572 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp @@ -68,11 +68,25 @@ AbstractMaemoRunControl::~AbstractMaemoRunControl() { } +void AbstractMaemoRunControl::start() +{ + m_stoppedByUser = false; + startInternal(); +} + +void AbstractMaemoRunControl::stop() +{ + m_stoppedByUser = true; + stopInternal(); +} + void AbstractMaemoRunControl::startDeployment(bool forDebugging) { QTC_ASSERT(runConfig, return); - if (devConfig.isValid()) { + if (m_stoppedByUser) { + handleDeploymentFinished(false); + } else if (devConfig.isValid()) { m_deployables.clear(); if (runConfig->currentlyNeedsDeployment(devConfig.host)) { m_deployables.append(Deployable(executableFileName(), @@ -184,14 +198,17 @@ void AbstractMaemoRunControl::kill(const QStringList &apps) void AbstractMaemoRunControl::deployProcessFinished() { const bool success = !m_sshDeployer->hasError(); - if (success) { + if (m_stoppedByUser) { + emit addToOutputWindow(this, tr("Deployment canceled by user.")); + m_progress.reportCanceled(); + } else if (success) { emit addToOutputWindow(this, tr("Deployment finished.")); } else { handleError(tr("Deployment failed: %1").arg(m_sshDeployer->error())); m_progress.reportCanceled(); } m_progress.reportFinished(); - handleDeploymentFinished(success); + handleDeploymentFinished(success && !m_stoppedByUser); } const QString AbstractMaemoRunControl::executableOnHost() const @@ -264,9 +281,8 @@ MaemoRunControl::~MaemoRunControl() stop(); } -void MaemoRunControl::start() +void MaemoRunControl::startInternal() { - m_stoppedByUser = false; startDeployment(false); } @@ -310,12 +326,10 @@ void MaemoRunControl::executionFinished() emit finished(); } -void MaemoRunControl::stop() +void MaemoRunControl::stopInternal() { if (!isRunning()) return; - - m_stoppedByUser = true; if (isDeploying()) { stopDeployment(); } else { @@ -362,7 +376,7 @@ MaemoDebugRunControl::~MaemoDebugRunControl() debuggingFinished(); } -void MaemoDebugRunControl::start() +void MaemoDebugRunControl::startInternal() { startDeployment(true); } @@ -430,7 +444,7 @@ void MaemoDebugRunControl::startDebugging() m_debuggerManager->startNewDebugger(m_startParams); } -void MaemoDebugRunControl::stop() +void MaemoDebugRunControl::stopInternal() { if (!isRunning()) return; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h index 8d1be80ee69a4dccfcf45114dc90066a43023cf4..88f1d1eaa8ca98db4fd6a5d80e7b2079a3cd0b16 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h @@ -68,6 +68,8 @@ public: protected: virtual bool isRunning() const; + virtual void start(); + virtual void stop(); void startDeployment(bool forDebugging); void deploy(); @@ -90,8 +92,11 @@ private slots: protected: MaemoRunConfiguration *runConfig; // TODO this pointer can be invalid const MaemoDeviceConfig devConfig; + bool m_stoppedByUser; private: + virtual void startInternal()=0; + virtual void stopInternal()=0; virtual void handleDeploymentFinished(bool success)=0; virtual void handleExecutionAboutToStart(const MaemoSshRunner *runner)=0; void kill(const QStringList &apps); @@ -119,19 +124,17 @@ class MaemoRunControl : public AbstractMaemoRunControl public: explicit MaemoRunControl(ProjectExplorer::RunConfiguration *runConfiguration); ~MaemoRunControl(); - void start(); - void stop(); private slots: void executionFinished(); void handleRemoteOutput(const QString &output); private: + virtual void startInternal(); + virtual void stopInternal(); virtual void handleDeploymentFinished(bool success); virtual void handleExecutionAboutToStart(const MaemoSshRunner *runner); void startExecution(); - - bool m_stoppedByUser; }; class MaemoDebugRunControl : public AbstractMaemoRunControl @@ -140,16 +143,16 @@ class MaemoDebugRunControl : public AbstractMaemoRunControl public: explicit MaemoDebugRunControl(ProjectExplorer::RunConfiguration *runConfiguration); ~MaemoDebugRunControl(); - void start(); - void stop(); bool isRunning() const; - Q_SLOT void debuggingFinished(); private slots: void gdbServerStarted(const QString &output); void debuggerOutput(const QString &output); + void debuggingFinished(); private: + virtual void startInternal(); + virtual void stopInternal(); virtual void handleDeploymentFinished(bool success); virtual void handleExecutionAboutToStart(const MaemoSshRunner *runner);