forked from qt-creator/qt-creator
ApplicationLauncher: Move started() connection to more common code
Even though so local specific code needs to stay. Change-Id: I57b66e746861716bd95592c8aeb03d627d17fc92 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -77,7 +77,6 @@ public:
|
|||||||
void handleStandardError();
|
void handleStandardError();
|
||||||
|
|
||||||
// Local
|
// Local
|
||||||
void handleProcessStarted();
|
|
||||||
void localProcessError(QProcess::ProcessError error);
|
void localProcessError(QProcess::ProcessError error);
|
||||||
void cannotRetrieveLocalDebugOutput();
|
void cannotRetrieveLocalDebugOutput();
|
||||||
void checkLocalDebugOutput(qint64 pid, const QString &message);
|
void checkLocalDebugOutput(qint64 pid, const QString &message);
|
||||||
@@ -323,12 +322,6 @@ QProcess::ExitStatus ApplicationLauncher::exitStatus() const
|
|||||||
return d->m_exitStatus;
|
return d->m_exitStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationLauncherPrivate::handleProcessStarted()
|
|
||||||
{
|
|
||||||
m_listeningPid = applicationPID();
|
|
||||||
emit q->processStarted();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ApplicationLauncher::start()
|
void ApplicationLauncher::start()
|
||||||
{
|
{
|
||||||
d->start(IDevice::ConstPtr(), true);
|
d->start(IDevice::ConstPtr(), true);
|
||||||
@@ -349,8 +342,6 @@ void ApplicationLauncherPrivate::start(const IDevice::ConstPtr &device, bool loc
|
|||||||
if (m_isLocal) {
|
if (m_isLocal) {
|
||||||
m_process.reset(new QtcProcess(this));
|
m_process.reset(new QtcProcess(this));
|
||||||
|
|
||||||
connect(m_process.get(), &QtcProcess::started,
|
|
||||||
this, &ApplicationLauncherPrivate::handleProcessStarted);
|
|
||||||
connect(m_process.get(), &QtcProcess::finished, this, [this] {
|
connect(m_process.get(), &QtcProcess::finished, this, [this] {
|
||||||
m_exitCode = m_process->exitCode();
|
m_exitCode = m_process->exitCode();
|
||||||
m_exitStatus = m_process->exitStatus();
|
m_exitStatus = m_process->exitStatus();
|
||||||
@@ -360,7 +351,6 @@ void ApplicationLauncherPrivate::start(const IDevice::ConstPtr &device, bool loc
|
|||||||
connect(m_process.get(), &QtcProcess::errorOccurred,
|
connect(m_process.get(), &QtcProcess::errorOccurred,
|
||||||
this, &ApplicationLauncherPrivate::localProcessError);
|
this, &ApplicationLauncherPrivate::localProcessError);
|
||||||
|
|
||||||
|
|
||||||
// Work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch' ...)
|
// Work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch' ...)
|
||||||
const FilePath fixedPath = m_runnable.workingDirectory.normalizedPathName();
|
const FilePath fixedPath = m_runnable.workingDirectory.normalizedPathName();
|
||||||
m_process->setWorkingDirectory(fixedPath);
|
m_process->setWorkingDirectory(fixedPath);
|
||||||
@@ -412,8 +402,6 @@ void ApplicationLauncherPrivate::start(const IDevice::ConstPtr &device, bool loc
|
|||||||
m_stopRequested = false;
|
m_stopRequested = false;
|
||||||
|
|
||||||
m_process.reset(device->createProcess(this));
|
m_process.reset(device->createProcess(this));
|
||||||
connect(m_process.get(), &QtcProcess::started,
|
|
||||||
q, &ApplicationLauncher::processStarted);
|
|
||||||
connect(m_process.get(), &QtcProcess::errorOccurred,
|
connect(m_process.get(), &QtcProcess::errorOccurred,
|
||||||
this, &ApplicationLauncherPrivate::handleApplicationError);
|
this, &ApplicationLauncherPrivate::handleApplicationError);
|
||||||
connect(m_process.get(), &QtcProcess::finished,
|
connect(m_process.get(), &QtcProcess::finished,
|
||||||
@@ -429,6 +417,13 @@ void ApplicationLauncherPrivate::start(const IDevice::ConstPtr &device, bool loc
|
|||||||
else
|
else
|
||||||
m_outputCodec = QTextCodec::codecForName("utf8");
|
m_outputCodec = QTextCodec::codecForName("utf8");
|
||||||
|
|
||||||
|
connect(m_process.get(), &QtcProcess::started, this, [this] {
|
||||||
|
// The local bit affects only WinDebugInterface.
|
||||||
|
if (m_isLocal)
|
||||||
|
m_listeningPid = applicationPID();
|
||||||
|
emit q->processStarted();
|
||||||
|
});
|
||||||
|
|
||||||
m_process->setProcessChannelMode(m_processChannelMode);
|
m_process->setProcessChannelMode(m_processChannelMode);
|
||||||
if (m_processChannelMode == QProcess::SeparateChannels) {
|
if (m_processChannelMode == QProcess::SeparateChannels) {
|
||||||
connect(m_process.get(), &QtcProcess::readyReadStandardError,
|
connect(m_process.get(), &QtcProcess::readyReadStandardError,
|
||||||
|
Reference in New Issue
Block a user