RemoteLinux: Add additional hook for application runner.

Could be used e.g. for on-demand emulator start-up.

Change-Id: Ic62c6f1ac7f9151b1f26b749405d97a2f727d15d
Reviewed-on: http://codereview.qt.nokia.com/882
Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
Christian Kandeler
2011-06-29 11:38:21 +02:00
parent c699740f9f
commit 5722a11005
2 changed files with 44 additions and 17 deletions

View File

@@ -93,20 +93,8 @@ void RemoteLinuxApplicationRunner::start()
return;
}
m_connection = SshConnectionManager::instance().acquireConnection(m_devConfig->sshParameters());
setState(Connecting);
m_exitStatus = -1;
m_freePorts = m_initialFreePorts;
connect(m_connection.data(), SIGNAL(connected()), this,
SLOT(handleConnected()));
connect(m_connection.data(), SIGNAL(error(Utils::SshError)), this,
SLOT(handleConnectionFailure()));
if (isConnectionUsable()) {
handleConnected();
} else {
emit reportProgress(tr("Connecting to device..."));
m_connection->connectToHost();
}
setState(SettingUpDevice);
doDeviceSetup();
}
void RemoteLinuxApplicationRunner::stop()
@@ -124,6 +112,7 @@ void RemoteLinuxApplicationRunner::stop()
setState(Inactive);
emit remoteProcessFinished(InvalidExitCode);
break;
case SettingUpDevice:
case PreRunCleaning:
case AdditionalPreRunCleaning:
case AdditionalInitializing:
@@ -342,6 +331,11 @@ bool RemoteLinuxApplicationRunner::canRun(QString &whyNot) const
return true;
}
void RemoteLinuxApplicationRunner::doDeviceSetup()
{
handleDeviceSetupDone(true);
}
void RemoteLinuxApplicationRunner::doAdditionalInitialCleanup()
{
handleInitialCleanupDone(true);
@@ -357,6 +351,34 @@ void RemoteLinuxApplicationRunner::doAdditionalPostRunCleanup()
handlePostRunCleanupDone();
}
void RemoteLinuxApplicationRunner::handleDeviceSetupDone(bool success)
{
ASSERT_STATE(SettingUpDevice);
if (m_state != SettingUpDevice)
return;
if (!success || m_stopRequested) {
setState(Inactive);
emit remoteProcessFinished(InvalidExitCode);
return;
}
m_connection = SshConnectionManager::instance().acquireConnection(m_devConfig->sshParameters());
setState(Connecting);
m_exitStatus = -1;
m_freePorts = m_initialFreePorts;
connect(m_connection.data(), SIGNAL(connected()), this,
SLOT(handleConnected()));
connect(m_connection.data(), SIGNAL(error(Utils::SshError)), this,
SLOT(handleConnectionFailure()));
if (isConnectionUsable()) {
handleConnected();
} else {
emit reportProgress(tr("Connecting to device..."));
m_connection->connectToHost();
}
}
void RemoteLinuxApplicationRunner::handleInitialCleanupDone(bool success)
{
ASSERT_STATE(AdditionalPreRunCleaning);