Commit fc2d8dea authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlEngine: Move setup logic from setupInferior to setupEngine



This is more in line with e.g. the gdb engine, which also emits
requestRemoteSetup in setupEngine().

Change-Id: I1c2a4c56d6f190a3043ea8a18d2bb28c9d340826
Reviewed-by: default avatarAurindam Jana <aurindam.jana@nokia.com>
parent 2cf6cd6c
...@@ -197,19 +197,7 @@ void QmlEngine::setupInferior() ...@@ -197,19 +197,7 @@ void QmlEngine::setupInferior()
{ {
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
if (startParameters().startMode == AttachToRemoteServer) { notifyInferiorSetupOk();
emit requestRemoteSetup();
if (startParameters().qmlServerPort != quint16(-1))
notifyInferiorSetupOk();
} if (startParameters().startMode == AttachToQmlPort) {
notifyInferiorSetupOk();
} else {
d->m_applicationLauncher.setEnvironment(startParameters().environment);
d->m_applicationLauncher.setWorkingDirectory(startParameters().workingDirectory);
notifyInferiorSetupOk();
}
} }
void QmlEngine::appendMessage(const QString &msg, Utils::OutputFormat /* format */) void QmlEngine::appendMessage(const QString &msg, Utils::OutputFormat /* format */)
...@@ -422,14 +410,15 @@ void QmlEngine::handleRemoteSetupDone(int gdbServerPort, int qmlPort) ...@@ -422,14 +410,15 @@ void QmlEngine::handleRemoteSetupDone(int gdbServerPort, int qmlPort)
Q_UNUSED(gdbServerPort); Q_UNUSED(gdbServerPort);
if (qmlPort != -1) if (qmlPort != -1)
startParameters().qmlServerPort = qmlPort; startParameters().qmlServerPort = qmlPort;
notifyInferiorSetupOk(); notifyEngineSetupOk();
} }
void QmlEngine::handleRemoteSetupFailed(const QString &message) void QmlEngine::handleRemoteSetupFailed(const QString &message)
{ {
QMessageBox::critical(0,tr("Failed to start application"), if (isMasterEngine())
tr("Application startup failed: %1").arg(message)); QMessageBox::critical(0,tr("Failed to start application"),
notifyInferiorSetupFailed(); tr("Application startup failed: %1").arg(message));
notifyEngineSetupFailed();
} }
void QmlEngine::shutdownInferior() void QmlEngine::shutdownInferior()
...@@ -461,11 +450,21 @@ void QmlEngine::shutdownEngine() ...@@ -461,11 +450,21 @@ void QmlEngine::shutdownEngine()
void QmlEngine::setupEngine() void QmlEngine::setupEngine()
{ {
connect(&d->m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)), if (startParameters().startMode == AttachToQmlPort
runControl(), SLOT(bringApplicationToForeground(qint64)), || startParameters().startMode == AttachToRemoteServer) {
Qt::UniqueConnection); // we need to get the port first
emit requestRemoteSetup();
} else {
d->m_applicationLauncher.setEnvironment(startParameters().environment);
d->m_applicationLauncher.setWorkingDirectory(startParameters().workingDirectory);
notifyEngineSetupOk(); // We can't do this in the constructore because runControl() isn't yet defined
connect(&d->m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
runControl(), SLOT(bringApplicationToForeground(qint64)),
Qt::UniqueConnection);
notifyEngineSetupOk();
}
} }
void QmlEngine::continueInferior() void QmlEngine::continueInferior()
......
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