forked from qt-creator/qt-creator
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:
@@ -93,20 +93,8 @@ void RemoteLinuxApplicationRunner::start()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_connection = SshConnectionManager::instance().acquireConnection(m_devConfig->sshParameters());
|
setState(SettingUpDevice);
|
||||||
setState(Connecting);
|
doDeviceSetup();
|
||||||
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::stop()
|
void RemoteLinuxApplicationRunner::stop()
|
||||||
@@ -124,6 +112,7 @@ void RemoteLinuxApplicationRunner::stop()
|
|||||||
setState(Inactive);
|
setState(Inactive);
|
||||||
emit remoteProcessFinished(InvalidExitCode);
|
emit remoteProcessFinished(InvalidExitCode);
|
||||||
break;
|
break;
|
||||||
|
case SettingUpDevice:
|
||||||
case PreRunCleaning:
|
case PreRunCleaning:
|
||||||
case AdditionalPreRunCleaning:
|
case AdditionalPreRunCleaning:
|
||||||
case AdditionalInitializing:
|
case AdditionalInitializing:
|
||||||
@@ -342,6 +331,11 @@ bool RemoteLinuxApplicationRunner::canRun(QString &whyNot) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RemoteLinuxApplicationRunner::doDeviceSetup()
|
||||||
|
{
|
||||||
|
handleDeviceSetupDone(true);
|
||||||
|
}
|
||||||
|
|
||||||
void RemoteLinuxApplicationRunner::doAdditionalInitialCleanup()
|
void RemoteLinuxApplicationRunner::doAdditionalInitialCleanup()
|
||||||
{
|
{
|
||||||
handleInitialCleanupDone(true);
|
handleInitialCleanupDone(true);
|
||||||
@@ -357,6 +351,34 @@ void RemoteLinuxApplicationRunner::doAdditionalPostRunCleanup()
|
|||||||
handlePostRunCleanupDone();
|
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)
|
void RemoteLinuxApplicationRunner::handleInitialCleanupDone(bool success)
|
||||||
{
|
{
|
||||||
ASSERT_STATE(AdditionalPreRunCleaning);
|
ASSERT_STATE(AdditionalPreRunCleaning);
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ protected:
|
|||||||
// Override to to additional checks.
|
// Override to to additional checks.
|
||||||
virtual bool canRun(QString &whyNot) const;
|
virtual bool canRun(QString &whyNot) const;
|
||||||
|
|
||||||
|
void handleDeviceSetupDone(bool success);
|
||||||
void handleInitialCleanupDone(bool success);
|
void handleInitialCleanupDone(bool success);
|
||||||
void handleInitializationsDone(bool success);
|
void handleInitializationsDone(bool success);
|
||||||
void handlePostRunCleanupDone();
|
void handlePostRunCleanupDone();
|
||||||
@@ -99,11 +100,15 @@ private slots:
|
|||||||
void handleUsedPortsAvailable();
|
void handleUsedPortsAvailable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum State { Inactive, Connecting, PreRunCleaning, AdditionalPreRunCleaning, GatheringPorts,
|
enum State { Inactive, SettingUpDevice, Connecting, PreRunCleaning, AdditionalPreRunCleaning,
|
||||||
AdditionalInitializing, ReadyForExecution, ProcessStarting, ProcessStarted, PostRunCleaning,
|
GatheringPorts, AdditionalInitializing, ReadyForExecution, ProcessStarting, ProcessStarted,
|
||||||
AdditionalPostRunCleaning
|
PostRunCleaning, AdditionalPostRunCleaning
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Override to do custom setup of the device *before* connecting.
|
||||||
|
// Call handleDeviceSetupDone() afterwards.
|
||||||
|
virtual void doDeviceSetup();
|
||||||
|
|
||||||
// Override to do additional pre-run cleanup and call handleInitialCleanupDone().
|
// Override to do additional pre-run cleanup and call handleInitialCleanupDone().
|
||||||
virtual void doAdditionalInitialCleanup();
|
virtual void doAdditionalInitialCleanup();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user