void SshRemoteProcessRunnerPrivate::handleProcessFinished(int exitStatus) { switch (exitStatus) { case SshRemoteProcess::FailedToStart: ASSERT_STATE(Connected); break; case SshRemoteProcess::KilledBySignal: case SshRemoteProcess::ExitedNormally: ASSERT_STATE(ProcessRunning); break; default: Q_ASSERT_X(false, Q_FUNC_INFO, "Impossible exit status."); } setState(Inactive); emit processClosed(exitStatus); }
void SshRemoteProcessRunnerPrivate::handleProcessStarted() { ASSERT_STATE(Connected); setState(ProcessRunning); emit processStarted(); }
void MaemoDebugSupport::handleAdapterSetupRequested() { ASSERT_STATE(Inactive); setState(StartingRunner); showMessage(tr("Preparing remote side ...\n"), AppStuff); disconnect(m_runner, 0, this, 0); connect(m_runner, SIGNAL(error(QString)), this, SLOT(handleSshError(QString))); connect(m_runner, SIGNAL(readyForExecution()), this, SLOT(startExecution())); connect(m_runner, SIGNAL(reportProgress(QString)), this, SLOT(handleProgressReport(QString))); m_runner->start(); }
void AbstractMaemoUploadAndInstallStep::handleInstallationFinished(const QString &errorMsg) { ASSERT_BASE_STATE(QList<BaseState>() << Deploying << StopRequested); ASSERT_STATE(QList<ExtendedState>() << Installing << Inactive); if (m_extendedState == Inactive) return; if (errorMsg.isEmpty()) { setDeployed(connection()->connectionParameters().host, MaemoDeployable(packagingStep()->packageFilePath(), QString())); writeOutput(tr("Package installed.")); } else { raiseError(errorMsg); } setFinished(); }
void MaemoDebugSupport::handleRemoteErrorOutput(const QByteArray &output) { ASSERT_STATE(QList<State>() << Inactive << StartingRemoteProcess << Debugging); if (!m_engine) return; showMessage(QString::fromUtf8(output), AppOutput); if (m_state == StartingRemoteProcess && m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) { m_gdbserverOutput += output; if (m_gdbserverOutput.contains("Listening on port")) { handleAdapterSetupDone(); m_gdbserverOutput.clear(); } } }
void MaemoDebugSupport::startExecution() { if (m_state == Inactive) return; ASSERT_STATE(StartingRunner); if (!useGdb() && m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) { if (!setPort(m_gdbServerPort)) return; } if (m_debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) { if (!setPort(m_qmlPort)) return; } if (useGdb()) { handleAdapterSetupDone(); return; } setState(StartingRemoteProcess); m_gdbserverOutput.clear(); connect(m_runner, SIGNAL(remoteErrorOutput(QByteArray)), this, SLOT(handleRemoteErrorOutput(QByteArray))); connect(m_runner, SIGNAL(remoteOutput(QByteArray)), this, SLOT(handleRemoteOutput(QByteArray))); if (m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly) { connect(m_runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted())); } const QString &remoteExe = m_runner->remoteExecutable(); QString args = m_runner->arguments(); if (m_debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) { args += QString(QLatin1String(" -qmljsdebugger=port:%1,block")) .arg(m_qmlPort); } const QString remoteCommandLine = m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly ? QString::fromLocal8Bit("%1 %2 %3").arg(m_runner->commandPrefix()).arg(remoteExe).arg(args) : QString::fromLocal8Bit("%1 gdbserver :%2 %3 %4").arg(m_runner->commandPrefix()) .arg(m_gdbServerPort).arg(remoteExe).arg(args); connect(m_runner, SIGNAL(remoteProcessFinished(qint64)), SLOT(handleRemoteProcessFinished(qint64))); m_runner->startExecution(remoteCommandLine.toUtf8()); }
void SshRemoteProcessRunnerPrivate::handleConnected() { ASSERT_STATE(Connecting); setState(Connected); m_process = m_connection->createRemoteProcess(m_command); connect(m_process.data(), SIGNAL(started()), SLOT(handleProcessStarted())); connect(m_process.data(), SIGNAL(closed(int)), SLOT(handleProcessFinished(int))); connect(m_process.data(), SIGNAL(outputAvailable(QByteArray)), SIGNAL(processOutputAvailable(QByteArray))); connect(m_process.data(), SIGNAL(errorOutputAvailable(QByteArray)), SIGNAL(processErrorOutputAvailable(QByteArray))); if (m_runInTerminal) m_process->requestTerminal(m_terminal); m_process->start(); }
void SshRemoteProcessRunnerPrivate::run(const QByteArray &command) { ASSERT_STATE(Inactive); setState(Connecting); m_command = command; connect(m_connection.data(), SIGNAL(error(Utils::SshError)), SLOT(handleConnectionError(Utils::SshError))); connect(m_connection.data(), SIGNAL(disconnected()), SLOT(handleDisconnected())); if (m_connection->state() == SshConnection::Connected) { handleConnected(); } else { connect(m_connection.data(), SIGNAL(connected()), SLOT(handleConnected())); m_connection->connectToHost(); } }
void AbstractMaemoUploadAndInstallStep::stopInternal() { ASSERT_BASE_STATE(StopRequested); ASSERT_STATE(QList<ExtendedState>() << Uploading << Installing); switch (m_extendedState) { case Uploading: m_uploader->cancelUpload(); break; case Installing: m_installer->cancelInstallation(); break; case Inactive: break; default: qFatal("Missing switch case in %s.", Q_FUNC_INFO); } setFinished(); }
void AbstractMaemoUploadAndInstallStep::handleUploadFinished(const QString &errorMsg) { ASSERT_BASE_STATE(QList<BaseState>() << Deploying << StopRequested); ASSERT_STATE(QList<ExtendedState>() << Uploading << Inactive); if (m_extendedState == Inactive) return; if (!errorMsg.isEmpty()) { raiseError(errorMsg); setFinished(); } else { writeOutput(tr("Successfully uploaded package file.")); const QString remoteFilePath = uploadDir() + QLatin1Char('/') + QFileInfo(packagingStep()->packageFilePath()).fileName(); m_extendedState = Installing; writeOutput(tr("Installing package to device...")); m_installer->installPackage(connection(), helper().cachedDeviceConfig(), remoteFilePath, true); } }
void MaemoDebugSupport::handleRemoteProcessStarted() { Q_ASSERT(m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly); ASSERT_STATE(StartingRemoteProcess); handleAdapterSetupDone(); }
void MaemoDebugSupport::handleRemoteOutput(const QByteArray &output) { ASSERT_STATE(QList<State>() << Inactive << Debugging); showMessage(QString::fromUtf8(output), AppOutput); }
void SshRemoteProcessRunnerPrivate::handleDisconnected() { ASSERT_STATE(QList<State>() << Connecting << Connected << ProcessRunning); setState(Inactive); }