Commit 781bdd24 authored by ck's avatar ck
Browse files

Maemo: Don't run program if deployment has been canceled by user.

Reviewed-by: kh1
parent e9be9a0d
......@@ -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;
......
......@@ -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);
......
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