Commit 40076900 authored by Daniel Teske's avatar Daniel Teske Committed by hjk

RemoteLinux: Remove PreRunAction and postRunAction

They were only used by the Madde plugin

Change-Id: I6733a3d95714f64d4fe091b8a9d4b0814134eb11
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@digia.com>
parent 3adea203
......@@ -43,15 +43,13 @@ using namespace QSsh;
namespace ProjectExplorer {
namespace {
enum State { Inactive, Connecting, PreRun, Run, PostRun };
enum State { Inactive, Connecting, Run };
} // anonymous namespace
class DeviceApplicationRunner::DeviceApplicationRunnerPrivate
{
public:
SshConnection *connection;
DeviceApplicationHelperAction *preRunAction;
DeviceApplicationHelperAction *postRunAction;
DeviceProcess *deviceProcess;
IDevice::ConstPtr device;
QTimer stopTimer;
......@@ -65,20 +63,9 @@ public:
};
DeviceApplicationHelperAction::DeviceApplicationHelperAction(QObject *parent) : QObject(parent)
{
}
DeviceApplicationHelperAction::~DeviceApplicationHelperAction()
{
}
DeviceApplicationRunner::DeviceApplicationRunner(QObject *parent) :
QObject(parent), d(new DeviceApplicationRunnerPrivate)
{
d->preRunAction = 0;
d->postRunAction = 0;
d->connection = 0;
d->deviceProcess = 0;
d->state = Inactive;
......@@ -129,31 +116,15 @@ void DeviceApplicationRunner::stop()
case Connecting:
setFinished();
break;
case PreRun:
d->preRunAction->stop();
break;
case Run:
d->stopTimer.start(10000);
d->deviceProcess->terminate();
break;
case PostRun:
d->postRunAction->stop();
break;
case Inactive:
break;
}
}
void DeviceApplicationRunner::setPreRunAction(DeviceApplicationHelperAction *action)
{
addAction(d->preRunAction, action);
}
void DeviceApplicationRunner::setPostRunAction(DeviceApplicationHelperAction *action)
{
addAction(d->postRunAction, action);
}
void DeviceApplicationRunner::connectToServer()
{
QTC_CHECK(!d->connection);
......@@ -178,28 +149,6 @@ void DeviceApplicationRunner::connectToServer()
}
}
void DeviceApplicationRunner::executePreRunAction()
{
QTC_ASSERT(d->state == Connecting, return);
d->state = PreRun;
if (d->preRunAction)
d->preRunAction->start();
else
runApplication();
}
void DeviceApplicationRunner::executePostRunAction()
{
QTC_ASSERT(d->state == PreRun || d->state == Run, return);
d->state = PostRun;
if (d->postRunAction)
d->postRunAction->start();
else
setFinished();
}
void DeviceApplicationRunner::setFinished()
{
if (d->state == Inactive)
......@@ -229,7 +178,7 @@ void DeviceApplicationRunner::handleConnected()
return;
}
executePreRunAction();
runApplication();
}
void DeviceApplicationRunner::handleConnectionFailure()
......@@ -244,57 +193,11 @@ void DeviceApplicationRunner::handleConnectionFailure()
case Connecting:
setFinished();
break;
case PreRun:
d->preRunAction->stop();
break;
case Run:
d->stopTimer.stop();
d->deviceProcess->disconnect(this);
executePostRunAction();
break;
case PostRun:
d->postRunAction->stop();
break;
}
}
void DeviceApplicationRunner::handleHelperActionFinished(bool success)
{
switch (d->state) {
case Inactive:
break;
case PreRun:
if (success && d->success) {
runApplication();
} else if (success && !d->success) {
executePostRunAction();
} else {
d->success = false;
setFinished();
}
break;
case PostRun:
if (!success)
d->success = false;
setFinished();
break;
default:
QTC_CHECK(false);
}
}
void DeviceApplicationRunner::addAction(DeviceApplicationHelperAction *&target,
DeviceApplicationHelperAction *source)
{
QTC_ASSERT(d->state == Inactive, return);
if (target)
disconnect(target, 0, this, 0);
target = source;
if (target) {
connect(target, SIGNAL(finished(bool)), SLOT(handleHelperActionFinished(bool)));
connect(target, SIGNAL(reportProgress(QString)), SIGNAL(reportProgress(QString)));
connect(target, SIGNAL(reportError(QString)), SIGNAL(reportError(QString)));
}
}
......@@ -324,7 +227,7 @@ void DeviceApplicationRunner::handleApplicationFinished()
emit reportProgress(tr("Remote application finished with exit code 0."));
}
}
executePostRunAction();
setFinished();
}
void DeviceApplicationRunner::handleRemoteStdout()
......@@ -341,7 +244,7 @@ void DeviceApplicationRunner::handleRemoteStderr()
void DeviceApplicationRunner::runApplication()
{
QTC_ASSERT(d->state == PreRun, return);
QTC_ASSERT(d->state == Connecting, return);
d->state = Run;
d->deviceProcess = d->device->createProcess(this);
......
......@@ -43,22 +43,6 @@ namespace Utils { class Environment; }
namespace ProjectExplorer {
class PROJECTEXPLORER_EXPORT DeviceApplicationHelperAction : public QObject
{
Q_OBJECT
public:
~DeviceApplicationHelperAction();
virtual void start() = 0;
virtual void stop() = 0;
signals:
void reportProgress(const QString &progressOutput);
void reportError(const QString &errorOutput);
void finished(bool success);
protected:
DeviceApplicationHelperAction(QObject *parent = 0);
};
class PROJECTEXPLORER_EXPORT DeviceApplicationRunner : public QObject
{
Q_OBJECT
......@@ -73,12 +57,6 @@ public:
const QStringList &arguments);
void stop();
// Use these if you need to do something before and after the application is run, respectively.
// Typically, the post-run action reverts the effects of the pre-run action.
// If you only have a pre-run action, you probably want a deploy step instead.
void setPreRunAction(DeviceApplicationHelperAction *action);
void setPostRunAction(DeviceApplicationHelperAction *action);
signals:
void remoteStdout(const QByteArray &output);
void remoteStderr(const QByteArray &output);
......@@ -90,17 +68,13 @@ signals:
private slots:
void handleConnected();
void handleConnectionFailure();
void handleHelperActionFinished(bool success);
void handleStopTimeout();
void handleApplicationFinished();
void handleRemoteStdout();
void handleRemoteStderr();
private:
void addAction(DeviceApplicationHelperAction *&target, DeviceApplicationHelperAction *source);
void connectToServer();
void executePreRunAction();
void executePostRunAction();
void runApplication();
void setFinished();
......
......@@ -82,16 +82,6 @@ AbstractRemoteLinuxRunSupport::~AbstractRemoteLinuxRunSupport()
delete d;
}
void AbstractRemoteLinuxRunSupport::setApplicationRunnerPreRunAction(DeviceApplicationHelperAction *action)
{
d->appRunner.setPreRunAction(action);
}
void AbstractRemoteLinuxRunSupport::setApplicationRunnerPostRunAction(DeviceApplicationHelperAction *action)
{
d->appRunner.setPostRunAction(action);
}
void AbstractRemoteLinuxRunSupport::setState(AbstractRemoteLinuxRunSupport::State state)
{
d->state = state;
......
......@@ -36,10 +36,7 @@
#include <QObject>
namespace ProjectExplorer {
class DeviceApplicationHelperAction;
class DeviceApplicationRunner;
}
namespace ProjectExplorer { class DeviceApplicationRunner; }
namespace Utils { class Environment; }
......@@ -65,9 +62,6 @@ public:
QObject *parent = 0);
~AbstractRemoteLinuxRunSupport();
void setApplicationRunnerPreRunAction(ProjectExplorer::DeviceApplicationHelperAction *action);
void setApplicationRunnerPostRunAction(ProjectExplorer::DeviceApplicationHelperAction *action);
protected:
void setState(State state);
State state() const;
......
......@@ -129,16 +129,6 @@ QIcon RemoteLinuxRunControl::icon() const
return QIcon(QLatin1String(ProjectExplorer::Constants::ICON_RUN_SMALL));
}
void RemoteLinuxRunControl::setApplicationRunnerPreRunAction(DeviceApplicationHelperAction *action)
{
d->runner.setPreRunAction(action);
}
void RemoteLinuxRunControl::setApplicationRunnerPostRunAction(DeviceApplicationHelperAction *action)
{
d->runner.setPostRunAction(action);
}
void RemoteLinuxRunControl::setFinished()
{
d->runner.disconnect(this);
......
......@@ -34,8 +34,6 @@
#include <projectexplorer/runconfiguration.h>
namespace ProjectExplorer { class DeviceApplicationHelperAction; }
namespace RemoteLinux {
class REMOTELINUX_EXPORT RemoteLinuxRunControl : public ProjectExplorer::RunControl
......@@ -50,9 +48,6 @@ public:
virtual bool isRunning() const;
virtual QIcon icon() const;
void setApplicationRunnerPreRunAction(ProjectExplorer::DeviceApplicationHelperAction *action);
void setApplicationRunnerPostRunAction(ProjectExplorer::DeviceApplicationHelperAction *action);
private slots:
void handleErrorMessage(const QString &error);
void handleRunnerFinished();
......
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