Separated child-process stdout/stderr, and seperated "our" output/errors.

So now the "Applciation Output" can distinguish between these four, and
handle them appropriately.
This commit is contained in:
Erik Verbruggen
2010-04-19 14:21:33 +02:00
parent 53425816af
commit e3bceff3ee
36 changed files with 223 additions and 189 deletions

View File

@@ -56,7 +56,7 @@ public:
virtual int exitCode() const = 0; virtual int exitCode() const = 0;
//signals: //signals:
virtual void processError(const QString &error) = 0; virtual void processMessage(const QString &error, bool isError) = 0;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
// Add PATH and SystemRoot environment variables in case they are missing // Add PATH and SystemRoot environment variables in case they are missing

View File

@@ -81,7 +81,7 @@ public:
#endif #endif
signals: signals:
void processError(const QString &error); void processMessage(const QString &message, bool isError);
// These reflect the state of the actual client process // These reflect the state of the actual client process
void processStarted(); void processStarted();
void processStopped(); void processStopped();

View File

@@ -70,7 +70,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
const QString err = stubServerListen(); const QString err = stubServerListen();
if (!err.isEmpty()) { if (!err.isEmpty()) {
emit processError(msgCommChannelFailed(err)); emit processMessage(msgCommChannelFailed(err), true);
return false; return false;
} }
@@ -78,7 +78,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
m_tempFile = new QTemporaryFile(); m_tempFile = new QTemporaryFile();
if (!m_tempFile->open()) { if (!m_tempFile->open()) {
stubServerShutdown(); stubServerShutdown();
emit processError(msgCannotCreateTempFile(m_tempFile->errorString())); emit processMessage(msgCannotCreateTempFile(m_tempFile->errorString()), true);
delete m_tempFile; delete m_tempFile;
m_tempFile = 0; m_tempFile = 0;
return false; return false;
@@ -108,7 +108,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
m_process.start(xterm, xtermArgs); m_process.start(xterm, xtermArgs);
if (!m_process.waitForStarted()) { if (!m_process.waitForStarted()) {
stubServerShutdown(); stubServerShutdown();
emit processError(tr("Cannot start the terminal emulator '%1'.").arg(xterm)); emit processMessage(tr("Cannot start the terminal emulator '%1'.").arg(xterm), true);
delete m_tempFile; delete m_tempFile;
m_tempFile = 0; m_tempFile = 0;
return false; return false;
@@ -189,9 +189,9 @@ void ConsoleProcess::readStubOutput()
QByteArray out = m_stubSocket->readLine(); QByteArray out = m_stubSocket->readLine();
out.chop(1); // \n out.chop(1); // \n
if (out.startsWith("err:chdir ")) { if (out.startsWith("err:chdir ")) {
emit processError(msgCannotChangeToWorkDir(workingDirectory(), errorMsg(out.mid(10).toInt()))); emit processMessage(msgCannotChangeToWorkDir(workingDirectory(), errorMsg(out.mid(10).toInt())), true);
} else if (out.startsWith("err:exec ")) { } else if (out.startsWith("err:exec ")) {
emit processError(msgCannotExecute(m_executable, errorMsg(out.mid(9).toInt()))); emit processMessage(msgCannotExecute(m_executable, errorMsg(out.mid(9).toInt())), true);
} else if (out.startsWith("pid ")) { } else if (out.startsWith("pid ")) {
// Will not need it any more // Will not need it any more
delete m_tempFile; delete m_tempFile;
@@ -210,7 +210,7 @@ void ConsoleProcess::readStubOutput()
m_appPid = 0; m_appPid = 0;
emit processStopped(); emit processStopped();
} else { } else {
emit processError(msgUnexpectedOutput()); emit processMessage(msgUnexpectedOutput(), true);
m_process.terminate(); m_process.terminate();
break; break;
} }

View File

@@ -68,7 +68,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
const QString err = stubServerListen(); const QString err = stubServerListen();
if (!err.isEmpty()) { if (!err.isEmpty()) {
emit processError(msgCommChannelFailed(err)); emit processMessage(msgCommChannelFailed(err), true);
return false; return false;
} }
@@ -76,7 +76,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
m_tempFile = new QTemporaryFile(); m_tempFile = new QTemporaryFile();
if (!m_tempFile->open()) { if (!m_tempFile->open()) {
stubServerShutdown(); stubServerShutdown();
emit processError(msgCannotCreateTempFile(m_tempFile->errorString())); emit processMessage(msgCannotCreateTempFile(m_tempFile->errorString()), true);
delete m_tempFile; delete m_tempFile;
m_tempFile = 0; m_tempFile = 0;
return false; return false;
@@ -122,7 +122,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
delete m_tempFile; delete m_tempFile;
m_tempFile = 0; m_tempFile = 0;
stubServerShutdown(); stubServerShutdown();
emit processError(tr("The process '%1' could not be started: %2").arg(cmdLine, winErrorMessage(GetLastError()))); emit processMessage(tr("The process '%1' could not be started: %2").arg(cmdLine, winErrorMessage(GetLastError())), true);
return false; return false;
} }
@@ -179,9 +179,9 @@ void ConsoleProcess::readStubOutput()
QByteArray out = m_stubSocket->readLine(); QByteArray out = m_stubSocket->readLine();
out.chop(2); // \r\n out.chop(2); // \r\n
if (out.startsWith("err:chdir ")) { if (out.startsWith("err:chdir ")) {
emit processError(msgCannotChangeToWorkDir(workingDirectory(), winErrorMessage(out.mid(10).toInt()))); emit processMessage(msgCannotChangeToWorkDir(workingDirectory(), winErrorMessage(out.mid(10).toInt())), true);
} else if (out.startsWith("err:exec ")) { } else if (out.startsWith("err:exec ")) {
emit processError(msgCannotExecute(m_executable, winErrorMessage(out.mid(9).toInt()))); emit processMessage(msgCannotExecute(m_executable, winErrorMessage(out.mid(9).toInt())), processMessage);
} else if (out.startsWith("pid ")) { } else if (out.startsWith("pid ")) {
// Wil not need it any more // Wil not need it any more
delete m_tempFile; delete m_tempFile;
@@ -192,8 +192,8 @@ void ConsoleProcess::readStubOutput()
SYNCHRONIZE | PROCESS_QUERY_INFORMATION | PROCESS_TERMINATE, SYNCHRONIZE | PROCESS_QUERY_INFORMATION | PROCESS_TERMINATE,
FALSE, m_appPid); FALSE, m_appPid);
if (m_hInferior == NULL) { if (m_hInferior == NULL) {
emit processError(tr("Cannot obtain a handle to the inferior: %1") emit processMessage(tr("Cannot obtain a handle to the inferior: %1")
.arg(winErrorMessage(GetLastError()))); .arg(winErrorMessage(GetLastError())), true);
// Uhm, and now what? // Uhm, and now what?
continue; continue;
} }
@@ -201,7 +201,7 @@ void ConsoleProcess::readStubOutput()
connect(inferiorFinishedNotifier, SIGNAL(activated(HANDLE)), SLOT(inferiorExited())); connect(inferiorFinishedNotifier, SIGNAL(activated(HANDLE)), SLOT(inferiorExited()));
emit processStarted(); emit processStarted();
} else { } else {
emit processError(msgUnexpectedOutput()); emit processMessage(msgUnexpectedOutput(), true);
TerminateProcess(m_pid->hProcess, (unsigned)-1); TerminateProcess(m_pid->hProcess, (unsigned)-1);
break; break;
} }
@@ -222,8 +222,8 @@ void ConsoleProcess::inferiorExited()
DWORD chldStatus; DWORD chldStatus;
if (!GetExitCodeProcess(m_hInferior, &chldStatus)) if (!GetExitCodeProcess(m_hInferior, &chldStatus))
emit processError(tr("Cannot obtain exit status from inferior: %1") emit processMessage(tr("Cannot obtain exit status from inferior: %1")
.arg(winErrorMessage(GetLastError()))); .arg(winErrorMessage(GetLastError())), true);
cleanupInferior(); cleanupInferior();
m_appStatus = QProcess::NormalExit; m_appStatus = QProcess::NormalExit;
m_appCode = chldStatus; m_appCode = chldStatus;

View File

@@ -221,8 +221,8 @@ CdbDebugEngine::CdbDebugEngine(DebuggerManager *manager, const QSharedPointer<Cd
m_d(new CdbDebugEnginePrivate(manager, options, this)) m_d(new CdbDebugEnginePrivate(manager, options, this))
{ {
m_d->m_consoleStubProc.setMode(Utils::ConsoleProcess::Suspend); m_d->m_consoleStubProc.setMode(Utils::ConsoleProcess::Suspend);
connect(&m_d->m_consoleStubProc, SIGNAL(processError(QString)), connect(&m_d->m_consoleStubProc, SIGNAL(processMessage(QString,bool)),
this, SLOT(slotConsoleStubError(QString))); this, SLOT(slotConsoleStubMessage(QString, bool)));
connect(&m_d->m_consoleStubProc, SIGNAL(processStarted()), connect(&m_d->m_consoleStubProc, SIGNAL(processStarted()),
this, SLOT(slotConsoleStubStarted())); this, SLOT(slotConsoleStubStarted()));
connect(&m_d->m_consoleStubProc, SIGNAL(wrapperStopped()), connect(&m_d->m_consoleStubProc, SIGNAL(wrapperStopped()),
@@ -1232,7 +1232,7 @@ void CdbDebugEngine::slotConsoleStubStarted()
} }
} }
void CdbDebugEngine::slotConsoleStubError(const QString &msg) void CdbDebugEngine::slotConsoleStubMessage(const QString &msg, bool)
{ {
QMessageBox::critical(DebuggerUISwitcher::instance()->mainWindow(), tr("Debugger Error"), msg); QMessageBox::critical(DebuggerUISwitcher::instance()->mainWindow(), tr("Debugger Error"), msg);
} }

View File

@@ -106,7 +106,7 @@ public slots:
private slots: private slots:
void slotConsoleStubStarted(); void slotConsoleStubStarted();
void slotConsoleStubError(const QString &msg); void slotConsoleStubMessage(const QString &msg, bool);
void slotConsoleStubTerminated(); void slotConsoleStubTerminated();
void slotBreakAttachToCrashed(); void slotBreakAttachToCrashed();
void warning(const QString &w); void warning(const QString &w);

View File

@@ -821,9 +821,9 @@ void DebuggerManager::notifyInferiorPidChanged(qint64 pid)
} }
} }
void DebuggerManager::showApplicationOutput(const QString &str) void DebuggerManager::showApplicationOutput(const QString &str, bool onStdErr)
{ {
emit applicationOutputAvailable(str); emit applicationOutputAvailable(str, onStdErr);
} }
void DebuggerManager::shutdown() void DebuggerManager::shutdown()

View File

@@ -264,7 +264,7 @@ public slots: // FIXME
//private slots: // FIXME //private slots: // FIXME
void showDebuggerOutput(int channel, const QString &msg); void showDebuggerOutput(int channel, const QString &msg);
void showDebuggerInput(int channel, const QString &msg); void showDebuggerInput(int channel, const QString &msg);
void showApplicationOutput(const QString &data); void showApplicationOutput(const QString &data, bool onStdErr);
void reloadSourceFiles(); void reloadSourceFiles();
void sourceFilesDockToggled(bool on); void sourceFilesDockToggled(bool on);
@@ -329,7 +329,8 @@ signals:
void inferiorPidChanged(qint64 pid); void inferiorPidChanged(qint64 pid);
void stateChanged(int newstatus); void stateChanged(int newstatus);
void statusMessageRequested(const QString &msg, int timeout); // -1 for 'forever' void statusMessageRequested(const QString &msg, int timeout); // -1 for 'forever'
void applicationOutputAvailable(const QString &output); void applicationOutputAvailable(const QString &output, bool onStdErr);
void messageAvailable(const QString &output, bool isError);
void emitShowOutput(int channel, const QString &output); void emitShowOutput(int channel, const QString &output);
void emitShowInput(int channel, const QString &input); void emitShowInput(int channel, const QString &input);

View File

@@ -179,9 +179,11 @@ void DebuggerRunControl::init()
connect(m_manager, SIGNAL(debuggingFinished()), connect(m_manager, SIGNAL(debuggingFinished()),
this, SLOT(debuggingFinished()), this, SLOT(debuggingFinished()),
Qt::QueuedConnection); Qt::QueuedConnection);
connect(m_manager, SIGNAL(applicationOutputAvailable(QString)), connect(m_manager, SIGNAL(applicationOutputAvailable(QString, bool)),
this, SLOT(slotAddToOutputWindowInline(QString)), this, SLOT(slotAddToOutputWindowInline(QString, bool)),
Qt::QueuedConnection); Qt::QueuedConnection);
connect(m_manager, SIGNAL(messageAvailable(QString, bool)),
this, SLOT(slotMessageAvailable(QString, bool)));
connect(m_manager, SIGNAL(inferiorPidChanged(qint64)), connect(m_manager, SIGNAL(inferiorPidChanged(qint64)),
this, SLOT(bringApplicationToForeground(qint64)), this, SLOT(bringApplicationToForeground(qint64)),
Qt::QueuedConnection); Qt::QueuedConnection);
@@ -200,7 +202,7 @@ void DebuggerRunControl::start()
m_manager->startNewDebugger(m_startParameters); m_manager->startNewDebugger(m_startParameters);
emit started(); emit started();
} else { } else {
error(this, errorMessage); appendMessage(this, errorMessage, true);
emit finished(); emit finished();
Core::ICore::instance()->showWarningWithOptions(tr("Debugger"), errorMessage, Core::ICore::instance()->showWarningWithOptions(tr("Debugger"), errorMessage,
QString(), QString(),
@@ -208,9 +210,15 @@ void DebuggerRunControl::start()
} }
} }
void DebuggerRunControl::slotAddToOutputWindowInline(const QString &data) void DebuggerRunControl::slotAddToOutputWindowInline(const QString &data,
bool onStdErr)
{ {
emit addToOutputWindowInline(this, data); emit addToOutputWindowInline(this, data, onStdErr);
}
void DebuggerRunControl::slotMessageAvailable(const QString &data, bool isError)
{
emit appendMessage(this, data, isError);
} }
void DebuggerRunControl::stop() void DebuggerRunControl::stop()

View File

@@ -87,7 +87,8 @@ signals:
void stopRequested(); void stopRequested();
private slots: private slots:
void slotAddToOutputWindowInline(const QString &output); void slotAddToOutputWindowInline(const QString &output, bool onStdErr);
void slotMessageAvailable(const QString &data, bool isError);
private: private:
void init(); void init();

View File

@@ -329,8 +329,8 @@ static void dump(const char *first, const char *middle, const QString & to)
void GdbEngine::readDebugeeOutput(const QByteArray &data) void GdbEngine::readDebugeeOutput(const QByteArray &data)
{ {
m_manager->showApplicationOutput(m_outputCodec->toUnicode( m_manager->messageAvailable(m_outputCodec->toUnicode(
data.constData(), data.length(), &m_outputCodecState)); data.constData(), data.length(), &m_outputCodecState), true);
} }
void GdbEngine::debugMessage(const QString &msg) void GdbEngine::debugMessage(const QString &msg)
@@ -541,7 +541,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
// On Windows, the contents seem to depend on the debugger // On Windows, the contents seem to depend on the debugger
// version and/or OS version used. // version and/or OS version used.
if (data.startsWith("warning:")) if (data.startsWith("warning:"))
manager()->showApplicationOutput(_(data.mid(9))); // cut "warning: " manager()->messageAvailable(_(data.mid(9)), true); // cut "warning: "
break; break;
} }

View File

@@ -59,7 +59,7 @@ TermGdbAdapter::TermGdbAdapter(GdbEngine *engine, QObject *parent)
m_stubProc.setSettings(Core::ICore::instance()->settings()); m_stubProc.setSettings(Core::ICore::instance()->settings());
#endif #endif
connect(&m_stubProc, SIGNAL(processError(QString)), SLOT(stubError(QString))); connect(&m_stubProc, SIGNAL(processMessage(QString, bool)), SLOT(stubMessage(QString, bool)));
connect(&m_stubProc, SIGNAL(processStarted()), SLOT(handleInferiorStarted())); connect(&m_stubProc, SIGNAL(processStarted()), SLOT(handleInferiorStarted()));
connect(&m_stubProc, SIGNAL(wrapperStopped()), SLOT(stubExited())); connect(&m_stubProc, SIGNAL(wrapperStopped()), SLOT(stubExited()));
} }
@@ -165,7 +165,7 @@ void TermGdbAdapter::interruptInferior()
debugMessage(_("CANNOT INTERRUPT %1").arg(attachedPID)); debugMessage(_("CANNOT INTERRUPT %1").arg(attachedPID));
} }
void TermGdbAdapter::stubError(const QString &msg) void TermGdbAdapter::stubMessage(const QString &msg, bool)
{ {
showMessageBox(QMessageBox::Critical, tr("Debugger Error"), msg); showMessageBox(QMessageBox::Critical, tr("Debugger Error"), msg);
} }

View File

@@ -66,7 +66,7 @@ private:
Q_SLOT void handleInferiorStarted(); Q_SLOT void handleInferiorStarted();
Q_SLOT void stubExited(); Q_SLOT void stubExited();
Q_SLOT void stubError(const QString &msg); Q_SLOT void stubMessage(const QString &msg, bool isError);
Utils::ConsoleProcess m_stubProc; Utils::ConsoleProcess m_stubProc;
}; };

View File

@@ -70,19 +70,20 @@ public:
qint64 applicationPID() const; qint64 applicationPID() const;
signals: signals:
void applicationError(const QString &error); void appendMessage(const QString &message, bool isError);
void appendOutput(const QString &line); void appendOutput(const QString &line, bool onStdErr);
void processExited(int exitCode); void processExited(int exitCode);
void bringToForegroundRequested(qint64 pid); void bringToForegroundRequested(qint64 pid);
private slots: private slots:
void processStopped(); void processStopped();
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
void readWinDebugOutput(const QString &output); void readWinDebugOutput(const QString &output, bool onStdErr);
void processFinished(int exitCode); void processFinished(int exitCode);
#else #else
void guiProcessError(); void guiProcessError();
void readStandardOutput(); void readStandardOutput();
void readStandardError();
void processDone(int, QProcess::ExitStatus); void processDone(int, QProcess::ExitStatus);
#endif #endif

View File

@@ -43,16 +43,16 @@ ApplicationLauncher::ApplicationLauncher(QObject *parent)
m_currentMode = Gui; m_currentMode = Gui;
m_consoleProcess = new ConsoleProcess(this); m_consoleProcess = new ConsoleProcess(this);
connect(m_consoleProcess, SIGNAL(processError(const QString&)), connect(m_consoleProcess, SIGNAL(processMessage(const QString&, bool)),
this, SIGNAL(applicationError(const QString&))); this, SIGNAL(appendMessage(QString,bool)));
connect(m_consoleProcess, SIGNAL(processStopped()), connect(m_consoleProcess, SIGNAL(processStopped()),
this, SLOT(processStopped())); this, SLOT(processStopped()));
m_winGuiProcess = new WinGuiProcess(this); m_winGuiProcess = new WinGuiProcess(this);
connect(m_winGuiProcess, SIGNAL(processError(const QString&)), connect(m_winGuiProcess, SIGNAL(processMessage(const QString &, bool)),
this, SIGNAL(applicationError(const QString&))); this, SIGNAL(appendMessage(QString,bool)));
connect(m_winGuiProcess, SIGNAL(receivedDebugOutput(const QString&)), connect(m_winGuiProcess, SIGNAL(receivedDebugOutput(const QString&, bool)),
this, SLOT(readWinDebugOutput(const QString&))); this, SLOT(readWinDebugOutput(const QString&, bool)));
connect(m_winGuiProcess, SIGNAL(processFinished(int)), connect(m_winGuiProcess, SIGNAL(processFinished(int)),
this, SLOT(processFinished(int))); this, SLOT(processFinished(int)));
@@ -111,9 +111,10 @@ qint64 ApplicationLauncher::applicationPID() const
return result; return result;
} }
void ApplicationLauncher::readWinDebugOutput(const QString &output) void ApplicationLauncher::readWinDebugOutput(const QString &output,
bool onStdErr)
{ {
emit appendOutput(output); emit appendOutput(output, onStdErr);
} }
void ApplicationLauncher::processStopped() void ApplicationLauncher::processStopped()

View File

@@ -43,11 +43,13 @@ ApplicationLauncher::ApplicationLauncher(QObject *parent)
m_outputCodec = QTextCodec::codecForLocale(); m_outputCodec = QTextCodec::codecForLocale();
m_currentMode = Gui; m_currentMode = Gui;
m_guiProcess = new QProcess(this); m_guiProcess = new QProcess(this);
m_guiProcess->setReadChannelMode(QProcess::MergedChannels); m_guiProcess->setReadChannelMode(QProcess::SeparateChannels);
connect(m_guiProcess, SIGNAL(error(QProcess::ProcessError)), connect(m_guiProcess, SIGNAL(error(QProcess::ProcessError)),
this, SLOT(guiProcessError())); this, SLOT(guiProcessError()));
connect(m_guiProcess, SIGNAL(readyReadStandardOutput()), connect(m_guiProcess, SIGNAL(readyReadStandardOutput()),
this, SLOT(readStandardOutput())); this, SLOT(readStandardOutput()));
connect(m_guiProcess, SIGNAL(readyReadStandardError()),
this, SLOT(readStandardError()));
connect(m_guiProcess, SIGNAL(finished(int, QProcess::ExitStatus)), connect(m_guiProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(processDone(int, QProcess::ExitStatus))); this, SLOT(processDone(int, QProcess::ExitStatus)));
connect(m_guiProcess, SIGNAL(started()), connect(m_guiProcess, SIGNAL(started()),
@@ -55,8 +57,8 @@ ApplicationLauncher::ApplicationLauncher(QObject *parent)
m_consoleProcess = new ConsoleProcess(this); m_consoleProcess = new ConsoleProcess(this);
m_consoleProcess->setSettings(Core::ICore::instance()->settings()); m_consoleProcess->setSettings(Core::ICore::instance()->settings());
connect(m_consoleProcess, SIGNAL(processError(const QString&)), connect(m_consoleProcess, SIGNAL(processMessage(QString,bool)),
this, SIGNAL(applicationError(const QString&))); this, SIGNAL(appendMessage(QString,bool)));
connect(m_consoleProcess, SIGNAL(processStopped()), connect(m_consoleProcess, SIGNAL(processStopped()),
this, SLOT(processStopped())); this, SLOT(processStopped()));
} }
@@ -131,14 +133,23 @@ void ApplicationLauncher::guiProcessError()
default: default:
error = tr("Some error has occurred while running the program."); error = tr("Some error has occurred while running the program.");
} }
emit applicationError(error); emit appendMessage(error, true);
} }
void ApplicationLauncher::readStandardOutput() void ApplicationLauncher::readStandardOutput()
{ {
QByteArray data = m_guiProcess->readAllStandardOutput(); QByteArray data = m_guiProcess->readAllStandardOutput();
emit appendOutput(m_outputCodec->toUnicode( emit appendOutput(m_outputCodec->toUnicode(
data.constData(), data.length(), &m_outputCodecState)); data.constData(), data.length(), &m_outputCodecState),
false);
}
void ApplicationLauncher::readStandardError()
{
QByteArray data = m_guiProcess->readAllStandardError();
emit appendOutput(m_outputCodec->toUnicode(
data.constData(), data.length(), &m_outputCodecState),
true);
} }
void ApplicationLauncher::processStopped() void ApplicationLauncher::processStopped()

View File

@@ -101,10 +101,10 @@ LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfig
m_runMode = static_cast<ApplicationLauncher::Mode>(runConfiguration->runMode()); m_runMode = static_cast<ApplicationLauncher::Mode>(runConfiguration->runMode());
m_commandLineArguments = runConfiguration->commandLineArguments(); m_commandLineArguments = runConfiguration->commandLineArguments();
connect(&m_applicationLauncher, SIGNAL(applicationError(QString)), connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,bool)),
this, SLOT(slotError(QString))); this, SLOT(slotAppendMessage(QString,bool)));
connect(&m_applicationLauncher, SIGNAL(appendOutput(QString)), connect(&m_applicationLauncher, SIGNAL(appendOutput(QString, bool)),
this, SLOT(slotAddToOutputWindow(QString))); this, SLOT(slotAddToOutputWindow(QString, bool)));
connect(&m_applicationLauncher, SIGNAL(processExited(int)), connect(&m_applicationLauncher, SIGNAL(processExited(int)),
this, SLOT(processExited(int))); this, SLOT(processExited(int)));
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)), connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
@@ -120,7 +120,7 @@ void LocalApplicationRunControl::start()
m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments); m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments);
emit started(); emit started();
emit addToOutputWindow(this, tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable))); emit appendMessage(this, tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)), false);
} }
void LocalApplicationRunControl::stop() void LocalApplicationRunControl::stop()
@@ -133,20 +133,22 @@ bool LocalApplicationRunControl::isRunning() const
return m_applicationLauncher.isRunning(); return m_applicationLauncher.isRunning();
} }
void LocalApplicationRunControl::slotError(const QString & err) void LocalApplicationRunControl::slotAppendMessage(const QString &err,
bool isError)
{ {
emit error(this, err); emit appendMessage(this, err, isError);
emit finished(); emit finished();
} }
void LocalApplicationRunControl::slotAddToOutputWindow(const QString &line) void LocalApplicationRunControl::slotAddToOutputWindow(const QString &line,
bool stderr)
{ {
emit addToOutputWindowInline(this, line); emit addToOutputWindowInline(this, line, stderr);
} }
void LocalApplicationRunControl::processExited(int exitCode) void LocalApplicationRunControl::processExited(int exitCode)
{ {
emit addToOutputWindow(this, tr("%1 exited with code %2").arg(QDir::toNativeSeparators(m_executable)).arg(exitCode)); emit appendMessage(this, tr("%1 exited with code %2").arg(QDir::toNativeSeparators(m_executable)).arg(exitCode), false);
emit finished(); emit finished();
} }

View File

@@ -88,8 +88,8 @@ public:
virtual bool isRunning() const; virtual bool isRunning() const;
private slots: private slots:
void processExited(int exitCode); void processExited(int exitCode);
void slotAddToOutputWindow(const QString &line); void slotAddToOutputWindow(const QString &line, bool stderr);
void slotError(const QString & error); void slotAppendMessage(const QString &err, bool isError);
private: private:
ProjectExplorer::ApplicationLauncher m_applicationLauncher; ProjectExplorer::ApplicationLauncher m_applicationLauncher;
QString m_executable; QString m_executable;

View File

@@ -49,7 +49,7 @@ void OutputFormatter::setPlainTextEdit(QPlainTextEdit *plainText)
setParent(m_plainTextEdit); setParent(m_plainTextEdit);
} }
void OutputFormatter::appendOutput(const QString &text) void OutputFormatter::appendApplicationOutput(const QString &text, bool /*onStdErr*/)
{ {
QTextCharFormat format; QTextCharFormat format;
format.setForeground(plainTextEdit()->palette().text().color()); format.setForeground(plainTextEdit()->palette().text().color());
@@ -57,9 +57,9 @@ void OutputFormatter::appendOutput(const QString &text)
plainTextEdit()->insertPlainText(text); plainTextEdit()->insertPlainText(text);
} }
void OutputFormatter::appendError(const QString &text) void OutputFormatter::appendMessage(const QString &text, bool isError)
{ {
appendOutput(text); appendApplicationOutput(text, isError);
} }
void OutputFormatter::mousePressEvent(QMouseEvent * /*e*/) void OutputFormatter::mousePressEvent(QMouseEvent * /*e*/)

View File

@@ -50,8 +50,8 @@ public:
QPlainTextEdit *plainTextEdit() const; QPlainTextEdit *plainTextEdit() const;
void setPlainTextEdit(QPlainTextEdit *plainText); void setPlainTextEdit(QPlainTextEdit *plainText);
virtual void appendOutput(const QString &text); virtual void appendApplicationOutput(const QString &text, bool onStdErr);
virtual void appendError(const QString &text); virtual void appendMessage(const QString &text, bool isError);
virtual void mousePressEvent(QMouseEvent *e); virtual void mousePressEvent(QMouseEvent *e);
virtual void mouseReleaseEvent(QMouseEvent *e); virtual void mouseReleaseEvent(QMouseEvent *e);

View File

@@ -210,22 +210,25 @@ void OutputPane::createNewOutputWindow(RunControl *rc)
} }
} }
void OutputPane::appendOutput(RunControl *rc, const QString &out) void OutputPane::appendApplicationOutput(RunControl *rc, const QString &out,
bool onStdErr)
{ {
OutputWindow *ow = m_outputWindows.value(rc); OutputWindow *ow = m_outputWindows.value(rc);
ow->appendOutput(out); ow->appendApplicationOutput(out, onStdErr);
} }
void OutputPane::appendOutputInline(RunControl *rc, const QString &out) void OutputPane::appendApplicationOutputInline(RunControl *rc,
const QString &out,
bool onStdErr)
{ {
OutputWindow *ow = m_outputWindows.value(rc); OutputWindow *ow = m_outputWindows.value(rc);
ow->appendOutputInline(out); ow->appendApplicationOutputInline(out, onStdErr);
} }
void OutputPane::appendError(RunControl *rc, const QString &out) void OutputPane::appendMessage(RunControl *rc, const QString &out, bool isError)
{ {
OutputWindow *ow = m_outputWindows.value(rc); OutputWindow *ow = m_outputWindows.value(rc);
ow->appendError(out); ow->appendMessage(out, isError);
} }
void OutputPane::showTabFor(RunControl *rc) void OutputPane::showTabFor(RunControl *rc)
@@ -424,7 +427,7 @@ void OutputWindow::showEvent(QShowEvent *e)
m_scrollToBottom = false; m_scrollToBottom = false;
} }
QString OutputWindow::doNewlineMagic(const QString &out) QString OutputWindow::doNewlineEnfocement(const QString &out)
{ {
m_scrollToBottom = true; m_scrollToBottom = true;
QString s = out; QString s = out;
@@ -439,17 +442,17 @@ QString OutputWindow::doNewlineMagic(const QString &out)
return s; return s;
} }
void OutputWindow::appendOutput(const QString &out) void OutputWindow::appendApplicationOutput(const QString &out, bool onStdErr)
{ {
setMaximumBlockCount(MaxBlockCount); setMaximumBlockCount(MaxBlockCount);
const bool atBottom = isScrollbarAtBottom(); const bool atBottom = isScrollbarAtBottom();
m_formatter->appendOutput(doNewlineMagic(out)); m_formatter->appendApplicationOutput(doNewlineEnfocement(out), onStdErr);
if (atBottom) if (atBottom)
scrollToBottom(); scrollToBottom();
enableUndoRedo(); enableUndoRedo();
} }
void OutputWindow::appendOutputInline(const QString &out) void OutputWindow::appendApplicationOutputInline(const QString &out, bool onStdErr)
{ {
m_scrollToBottom = true; m_scrollToBottom = true;
setMaximumBlockCount(MaxBlockCount); setMaximumBlockCount(MaxBlockCount);
@@ -462,7 +465,7 @@ void OutputWindow::appendOutputInline(const QString &out)
if (!enforceNewline) { if (!enforceNewline) {
newline = out.indexOf(QLatin1Char('\n')); newline = out.indexOf(QLatin1Char('\n'));
moveCursor(QTextCursor::End); moveCursor(QTextCursor::End);
m_formatter->appendOutput(newline < 0 ? out : out.left(newline)); // doesn't enforce new paragraph like appendPlainText m_formatter->appendApplicationOutput(newline < 0 ? out : out.left(newline), onStdErr); // doesn't enforce new paragraph like appendPlainText
} }
QString s = out.mid(newline+1); QString s = out.mid(newline+1);
@@ -473,7 +476,7 @@ void OutputWindow::appendOutputInline(const QString &out)
m_enforceNewline = true; m_enforceNewline = true;
s.chop(1); s.chop(1);
} }
m_formatter->appendOutput(QLatin1Char('\n') + s); m_formatter->appendApplicationOutput(QLatin1Char('\n') + s, onStdErr);
} }
if (atBottom) if (atBottom)
@@ -481,10 +484,10 @@ void OutputWindow::appendOutputInline(const QString &out)
enableUndoRedo(); enableUndoRedo();
} }
void OutputWindow::appendError(const QString &out) void OutputWindow::appendMessage(const QString &out, bool isError)
{ {
setMaximumBlockCount(MaxBlockCount); setMaximumBlockCount(MaxBlockCount);
m_formatter->appendError(doNewlineMagic(out)); m_formatter->appendMessage(doNewlineEnfocement(out), isError);
enableUndoRedo(); enableUndoRedo();
} }

View File

@@ -92,9 +92,11 @@ public slots:
void projectRemoved(); void projectRemoved();
void coreAboutToClose(); void coreAboutToClose();
void appendOutput(RunControl *rc, const QString &out); void appendApplicationOutput(RunControl *rc, const QString &out,
void appendOutputInline(RunControl *rc, const QString &out); bool onStdErr);
void appendError(RunControl *rc, const QString &out); void appendApplicationOutputInline(RunControl *rc, const QString &out,
bool onStdErr);
void appendMessage(RunControl *rc, const QString &out, bool isError);
private slots: private slots:
void reRunRunControl(); void reRunRunControl();
@@ -127,9 +129,9 @@ public:
OutputFormatter* formatter() const; OutputFormatter* formatter() const;
void setFormatter(OutputFormatter *formatter); void setFormatter(OutputFormatter *formatter);
void appendOutput(const QString &out); void appendApplicationOutput(const QString &out, bool onStdErr);
void appendOutputInline(const QString &out); void appendApplicationOutputInline(const QString &out, bool onStdErr);
void appendError(const QString &out); void appendMessage(const QString &out, bool isError);
void grayOutOldContent(); void grayOutOldContent();
@@ -145,7 +147,7 @@ protected:
private: private:
void enableUndoRedo(); void enableUndoRedo();
QString doNewlineMagic(const QString &out); QString doNewlineEnfocement(const QString &out);
private: private:
Core::BaseContext *m_outputWindowContext; Core::BaseContext *m_outputWindowContext;

View File

@@ -1273,12 +1273,12 @@ void ProjectExplorerPlugin::startRunControl(RunControl *runControl, const QStrin
if (projectExplorerSettings().cleanOldAppOutput) if (projectExplorerSettings().cleanOldAppOutput)
d->m_outputPane->clearContents(); d->m_outputPane->clearContents();
connect(runControl, SIGNAL(addToOutputWindow(RunControl *, const QString &)), connect(runControl, SIGNAL(addToOutputWindow(RunControl *, const QString &, bool)),
d->m_outputPane, SLOT(appendOutput(RunControl*,const QString &))); d->m_outputPane, SLOT(appendApplicationOutput(RunControl*,const QString &, bool)));
connect(runControl, SIGNAL(addToOutputWindowInline(RunControl *, const QString &)), connect(runControl, SIGNAL(addToOutputWindowInline(RunControl *, const QString &, bool)),
d->m_outputPane, SLOT(appendOutputInline(RunControl*,const QString &))); d->m_outputPane, SLOT(appendApplicationOutputInline(RunControl*,const QString &, bool)));
connect(runControl, SIGNAL(error(RunControl *, const QString &)), connect(runControl, SIGNAL(appendMessage(RunControl*,QString,bool)),
d->m_outputPane, SLOT(appendError(RunControl *, const QString &))); d->m_outputPane, SLOT(appendMessage(RunControl *, const QString &, bool)));
connect(runControl, SIGNAL(finished()), connect(runControl, SIGNAL(finished()),
this, SLOT(runControlFinished())); this, SLOT(runControlFinished()));

View File

@@ -172,9 +172,9 @@ public:
virtual OutputFormatter *createOutputFormatter(QObject *parent = 0); virtual OutputFormatter *createOutputFormatter(QObject *parent = 0);
signals: signals:
void addToOutputWindow(RunControl *, const QString &line); void addToOutputWindow(RunControl *, const QString &line, bool onStdErr);
void addToOutputWindowInline(RunControl *, const QString &line); void addToOutputWindowInline(RunControl *, const QString &line, bool onStdErr);
void error(RunControl *, const QString &error); void appendMessage(RunControl *, const QString &error, bool isError);
void started(); void started();
void finished(); void finished();

View File

@@ -122,12 +122,12 @@ void WinGuiProcess::run()
&si, m_pid); &si, m_pid);
if (!started) { if (!started) {
emit processError(tr("The process could not be started!")); emit processMessage(tr("The process could not be started!"), true);
break; break;
} }
if (!dbgInterface) { if (!dbgInterface) {
emit receivedDebugOutput(tr("Cannot retrieve debugging output!")); emit receivedDebugOutput(tr("Cannot retrieve debugging output!"), true);
WaitForSingleObject(m_pid->hProcess, INFINITE); WaitForSingleObject(m_pid->hProcess, INFINITE);
} else { } else {
LPSTR message; LPSTR message;
@@ -148,7 +148,7 @@ void WinGuiProcess::run()
switch (ret) { switch (ret) {
case WAIT_OBJECT_0 + 0: case WAIT_OBJECT_0 + 0:
if (*processId == m_pid->dwProcessId) if (*processId == m_pid->dwProcessId)
emit receivedDebugOutput(QString::fromLocal8Bit(message)); emit receivedDebugOutput(QString::fromLocal8Bit(message), false);
SetEvent(bufferReadyEvent); SetEvent(bufferReadyEvent);
break; break;
case WAIT_OBJECT_0 + 1: case WAIT_OBJECT_0 + 1:

View File

@@ -61,8 +61,8 @@ public:
int exitCode() const; int exitCode() const;
signals: signals:
void processError(const QString &error); void processMessage(const QString &error, bool isError);
void receivedDebugOutput(const QString &output); void receivedDebugOutput(const QString &output, bool stderr);
void processFinished(int exitCode); void processFinished(int exitCode);
private: private:

View File

@@ -44,7 +44,7 @@ QmlOutputFormatter::QmlOutputFormatter(QObject *parent)
{ {
} }
void QmlOutputFormatter::appendOutput(const QString &text) void QmlOutputFormatter::appendApplicationOutput(const QString &text, bool /*onStdErr*/)
{ {
QTextCharFormat normalFormat, linkFormat; QTextCharFormat normalFormat, linkFormat;
normalFormat.setForeground(plainTextEdit()->palette().text().color()); normalFormat.setForeground(plainTextEdit()->palette().text().color());
@@ -72,9 +72,9 @@ void QmlOutputFormatter::appendOutput(const QString &text)
plainTextEdit()->insertPlainText(text.mid(index)); plainTextEdit()->insertPlainText(text.mid(index));
} }
void QmlOutputFormatter::appendError(const QString &text) void QmlOutputFormatter::appendMessage(const QString &text, bool isError)
{ {
appendOutput(text); appendApplicationOutput(text, isError);
} }
void QmlOutputFormatter::mousePressEvent(QMouseEvent * /*e*/) void QmlOutputFormatter::mousePressEvent(QMouseEvent * /*e*/)

View File

@@ -42,8 +42,8 @@ class QmlOutputFormatter: public ProjectExplorer::OutputFormatter
public: public:
QmlOutputFormatter(QObject *parent = 0); QmlOutputFormatter(QObject *parent = 0);
virtual void appendOutput(const QString &text); virtual void appendApplicationOutput(const QString &text, bool onStdErr);
virtual void appendError(const QString &text); virtual void appendMessage(const QString &text, bool isError);
virtual void mousePressEvent(QMouseEvent *e); virtual void mousePressEvent(QMouseEvent *e);
virtual void mouseReleaseEvent(QMouseEvent *e); virtual void mouseReleaseEvent(QMouseEvent *e);

View File

@@ -65,10 +65,10 @@ QmlRunControl::QmlRunControl(QmlProjectRunConfiguration *runConfiguration, bool
m_executable = runConfiguration->viewerPath(); m_executable = runConfiguration->viewerPath();
m_commandLineArguments = runConfiguration->viewerArguments(); m_commandLineArguments = runConfiguration->viewerArguments();
connect(&m_applicationLauncher, SIGNAL(applicationError(QString)), connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,bool)),
this, SLOT(slotError(QString))); this, SLOT(slotError(QString, bool)));
connect(&m_applicationLauncher, SIGNAL(appendOutput(QString)), connect(&m_applicationLauncher, SIGNAL(appendOutput(QString, bool)),
this, SLOT(slotAddToOutputWindow(QString))); this, SLOT(slotAddToOutputWindow(QString, bool)));
connect(&m_applicationLauncher, SIGNAL(processExited(int)), connect(&m_applicationLauncher, SIGNAL(processExited(int)),
this, SLOT(processExited(int))); this, SLOT(processExited(int)));
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)), connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
@@ -90,7 +90,7 @@ void QmlRunControl::start()
emit started(); emit started();
emit addToOutputWindow(this, tr("Starting %1 %2").arg(QDir::toNativeSeparators(m_executable), emit addToOutputWindow(this, tr("Starting %1 %2").arg(QDir::toNativeSeparators(m_executable),
m_commandLineArguments.join(QLatin1String(" ")))); m_commandLineArguments.join(QLatin1String(" "))), false);
} }
void QmlRunControl::stop() void QmlRunControl::stop()
@@ -113,25 +113,25 @@ void QmlRunControl::slotBringApplicationToForeground(qint64 pid)
bringApplicationToForeground(pid); bringApplicationToForeground(pid);
} }
void QmlRunControl::slotError(const QString &err) void QmlRunControl::slotError(const QString &err, bool isError)
{ {
emit error(this, err); emit appendMessage(this, err, isError);
emit finished(); emit finished();
} }
void QmlRunControl::slotAddToOutputWindow(const QString &line) void QmlRunControl::slotAddToOutputWindow(const QString &line, bool onStdErr)
{ {
if (m_debugMode && line.startsWith("QDeclarativeDebugServer: Waiting for connection")) { if (m_debugMode && line.startsWith("QDeclarativeDebugServer: Waiting for connection")) {
Core::ICore *core = Core::ICore::instance(); Core::ICore *core = Core::ICore::instance();
core->modeManager()->activateMode(Debugger::Constants::MODE_DEBUG); core->modeManager()->activateMode(Debugger::Constants::MODE_DEBUG);
} }
emit addToOutputWindowInline(this, line); emit addToOutputWindowInline(this, line, onStdErr);
} }
void QmlRunControl::processExited(int exitCode) void QmlRunControl::processExited(int exitCode)
{ {
emit addToOutputWindow(this, tr("%1 exited with code %2").arg(QDir::toNativeSeparators(m_executable)).arg(exitCode)); emit appendMessage(this, tr("%1 exited with code %2").arg(QDir::toNativeSeparators(m_executable)).arg(exitCode), exitCode != 0);
emit finished(); emit finished();
} }

View File

@@ -55,8 +55,8 @@ public:
private slots: private slots:
void processExited(int exitCode); void processExited(int exitCode);
void slotBringApplicationToForeground(qint64 pid); void slotBringApplicationToForeground(qint64 pid);
void slotAddToOutputWindow(const QString &line); void slotAddToOutputWindow(const QString &line, bool onStdErr);
void slotError(const QString & error); void slotError(const QString &error, bool isError);
private: private:
ProjectExplorer::ApplicationLauncher m_applicationLauncher; ProjectExplorer::ApplicationLauncher m_applicationLauncher;

View File

@@ -83,7 +83,7 @@ void AbstractMaemoRunControl::start()
void AbstractMaemoRunControl::startInitialCleanup() void AbstractMaemoRunControl::startInitialCleanup()
{ {
emit addToOutputWindow(this, tr("Cleaning up remote leftovers first ...")); emit appendMessage(this, tr("Cleaning up remote leftovers first ..."), false);
const QStringList appsToKill const QStringList appsToKill
= QStringList() << executableFileName() << QLatin1String("gdbserver"); = QStringList() << executableFileName() << QLatin1String("gdbserver");
killRemoteProcesses(appsToKill, true); killRemoteProcesses(appsToKill, true);
@@ -103,14 +103,14 @@ void AbstractMaemoRunControl::stop()
void AbstractMaemoRunControl::handleInitialCleanupFinished() void AbstractMaemoRunControl::handleInitialCleanupFinished()
{ {
if (m_stoppedByUser) { if (m_stoppedByUser) {
emit addToOutputWindow(this, tr("Initial cleanup canceled by user.")); emit appendMessage(this, tr("Initial cleanup canceled by user."), false);
emit finished(); emit finished();
} else if (m_initialCleaner->hasError()) { } else if (m_initialCleaner->hasError()) {
handleError(tr("Error running initial cleanup: %1.") handleError(tr("Error running initial cleanup: %1.")
.arg(m_initialCleaner->error())); .arg(m_initialCleaner->error()));
emit finished(); emit finished();
} else { } else {
emit addToOutputWindow(this, tr("Initial cleanup done.")); emit appendMessage(this, tr("Initial cleanup done."), false);
startInternal(); startInternal();
} }
} }
@@ -158,7 +158,7 @@ void AbstractMaemoRunControl::deploy()
files << srcFilePath; files << srcFilePath;
deploySpecs << SshDeploySpec(srcFilePath, tgtFilePath); deploySpecs << SshDeploySpec(srcFilePath, tgtFilePath);
} }
emit addToOutputWindow(this, tr("Files to deploy: %1.").arg(files.join(" "))); emit appendMessage(this, tr("Files to deploy: %1.").arg(files.join(" ")), false);
m_sshDeployer.reset(new MaemoSshDeployer(m_devConfig, deploySpecs)); m_sshDeployer.reset(new MaemoSshDeployer(m_devConfig, deploySpecs));
connect(m_sshDeployer.data(), SIGNAL(finished()), connect(m_sshDeployer.data(), SIGNAL(finished()),
this, SLOT(handleDeployThreadFinished())); this, SLOT(handleDeployThreadFinished()));
@@ -213,7 +213,7 @@ void AbstractMaemoRunControl::startExecution()
this, SLOT(handleRunThreadFinished())); this, SLOT(handleRunThreadFinished()));
connect(m_sshRunner.data(), SIGNAL(remoteOutput(QString)), connect(m_sshRunner.data(), SIGNAL(remoteOutput(QString)),
this, SLOT(handleRemoteOutput(QString))); this, SLOT(handleRemoteOutput(QString)));
emit addToOutputWindow(this, tr("Starting remote application.")); emit appendMessage(this, tr("Starting remote application."), false);
m_sshRunner->start(); m_sshRunner->start();
} }
@@ -257,13 +257,13 @@ void AbstractMaemoRunControl::handleDeployThreadFinished()
{ {
bool cancel; bool cancel;
if (m_stoppedByUser) { if (m_stoppedByUser) {
emit addToOutputWindow(this, tr("Deployment canceled by user.")); emit appendMessage(this, tr("Deployment canceled by user."), false);
cancel = true; cancel = true;
} else if (m_sshDeployer->hasError()) { } else if (m_sshDeployer->hasError()) {
handleError(tr("Deployment failed: %1").arg(m_sshDeployer->error())); handleError(tr("Deployment failed: %1").arg(m_sshDeployer->error()));
cancel = true; cancel = true;
} else { } else {
emit addToOutputWindow(this, tr("Deployment finished.")); emit appendMessage(this, tr("Deployment finished."), false);
cancel = false; cancel = false;
} }
@@ -280,13 +280,16 @@ void AbstractMaemoRunControl::handleDeployThreadFinished()
void AbstractMaemoRunControl::handleRunThreadFinished() void AbstractMaemoRunControl::handleRunThreadFinished()
{ {
if (m_stoppedByUser) { if (m_stoppedByUser) {
emit addToOutputWindow(this, emit appendMessage(this,
tr("Remote execution canceled due to user request.")); tr("Remote execution canceled due to user request."),
false);
} else if (m_sshRunner->hasError()) { } else if (m_sshRunner->hasError()) {
emit addToOutputWindow(this, tr("Error running remote process: %1") emit appendMessage(this, tr("Error running remote process: %1")
.arg(m_sshRunner->error())); .arg(m_sshRunner->error()),
true);
} else { } else {
emit addToOutputWindow(this, tr("Finished running remote process.")); emit appendMessage(this, tr("Finished running remote process."),
false);
} }
emit finished(); emit finished();
} }
@@ -335,7 +338,7 @@ QString AbstractMaemoRunControl::targetCmdLineSuffix() const
void AbstractMaemoRunControl::handleError(const QString &errString) void AbstractMaemoRunControl::handleError(const QString &errString)
{ {
QMessageBox::critical(0, tr("Remote Execution Failure"), errString); QMessageBox::critical(0, tr("Remote Execution Failure"), errString);
emit error(this, errString); emit appendMessage(this, errString, true);
} }
@@ -365,9 +368,9 @@ void MaemoRunControl::stopInternal()
AbstractMaemoRunControl::stopRunning(false); AbstractMaemoRunControl::stopRunning(false);
} }
void MaemoRunControl::handleRemoteOutput(const QString &output) void MaemoRunControl::handleRemoteOutput(const QString &output, bool onStdErr)
{ {
emit addToOutputWindowInline(this, output); emit addToOutputWindowInline(this, output, onStdErr);
} }
@@ -392,8 +395,8 @@ MaemoDebugRunControl::MaemoDebugRunControl(RunConfiguration *runConfiguration)
connect(m_debuggerManager, SIGNAL(debuggingFinished()), this, connect(m_debuggerManager, SIGNAL(debuggingFinished()), this,
SLOT(debuggingFinished()), Qt::QueuedConnection); SLOT(debuggingFinished()), Qt::QueuedConnection);
connect(m_debuggerManager, SIGNAL(applicationOutputAvailable(QString)), connect(m_debuggerManager, SIGNAL(applicationOutputAvailable(QString, bool)),
this, SLOT(debuggerOutput(QString)), Qt::QueuedConnection); this, SLOT(debuggerOutput(QString, bool)), Qt::QueuedConnection);
} }
MaemoDebugRunControl::~MaemoDebugRunControl() MaemoDebugRunControl::~MaemoDebugRunControl()
@@ -417,13 +420,13 @@ QString MaemoDebugRunControl::remoteCall() const
.arg(executableFilePathOnTarget()).arg(targetCmdLineSuffix()); .arg(executableFilePathOnTarget()).arg(targetCmdLineSuffix());
} }
void MaemoDebugRunControl::handleRemoteOutput(const QString &output) void MaemoDebugRunControl::handleRemoteOutput(const QString &output, bool onStdErr)
{ {
if (!m_debuggingStarted) { if (!m_debuggingStarted) {
m_debuggingStarted = true; m_debuggingStarted = true;
startDebugging(); startDebugging();
} }
emit addToOutputWindowInline(this, output); emit addToOutputWindowInline(this, output, onStdErr);
} }
void MaemoDebugRunControl::startDebugging() void MaemoDebugRunControl::startDebugging()
@@ -447,9 +450,9 @@ void MaemoDebugRunControl::debuggingFinished()
AbstractMaemoRunControl::stopRunning(true); AbstractMaemoRunControl::stopRunning(true);
} }
void MaemoDebugRunControl::debuggerOutput(const QString &output) void MaemoDebugRunControl::debuggerOutput(const QString &output, bool onStdErr)
{ {
emit addToOutputWindowInline(this, QLatin1String("[gdb says:] ") + output); emit appendMessage(this, QLatin1String("[gdb says:] ") + output, onStdErr);
} }
QString MaemoDebugRunControl::gdbServerPort() const QString MaemoDebugRunControl::gdbServerPort() const

View File

@@ -86,7 +86,7 @@ protected:
QString executableFilePathOnTarget() const; QString executableFilePathOnTarget() const;
private slots: private slots:
virtual void handleRemoteOutput(const QString &output)=0; virtual void handleRemoteOutput(const QString &output, bool onStdErr)=0;
void handleInitialCleanupFinished(); void handleInitialCleanupFinished();
void handleDeployThreadFinished(); void handleDeployThreadFinished();
void handleRunThreadFinished(); void handleRunThreadFinished();
@@ -138,7 +138,7 @@ public:
private: private:
virtual void startInternal(); virtual void startInternal();
virtual void stopInternal(); virtual void stopInternal();
virtual void handleRemoteOutput(const QString &output); virtual void handleRemoteOutput(const QString &output, bool onStdErr);
virtual QString remoteCall() const; virtual QString remoteCall() const;
}; };
@@ -151,13 +151,13 @@ public:
bool isRunning() const; bool isRunning() const;
private slots: private slots:
void debuggerOutput(const QString &output); void debuggerOutput(const QString &output, bool onStdErr);
void debuggingFinished(); void debuggingFinished();
private: private:
virtual void startInternal(); virtual void startInternal();
virtual void stopInternal(); virtual void stopInternal();
virtual void handleRemoteOutput(const QString &output); virtual void handleRemoteOutput(const QString &output, bool onStdErr);
virtual QString remoteCall() const; virtual QString remoteCall() const;
QString gdbServerPort() const; QString gdbServerPort() const;

View File

@@ -534,19 +534,19 @@ void S60DeviceRunControlBase::start()
emit started(); emit started();
if (m_serialPortName.isEmpty()) { if (m_serialPortName.isEmpty()) {
m_deployProgress->reportCanceled(); m_deployProgress->reportCanceled();
error(this, tr("There is no device plugged in.")); appendMessage(this, tr("There is no device plugged in."), true);
emit finished(); emit finished();
return; return;
} }
emit addToOutputWindow(this, tr("Executable file: %1").arg(msgListFile(m_executableFileName))); emit appendMessage(this, tr("Executable file: %1").arg(msgListFile(m_executableFileName)), false);
QString errorMessage; QString errorMessage;
QString settingsCategory; QString settingsCategory;
QString settingsPage; QString settingsPage;
if (!checkConfiguration(&errorMessage, &settingsCategory, &settingsPage)) { if (!checkConfiguration(&errorMessage, &settingsCategory, &settingsPage)) {
m_deployProgress->reportCanceled(); m_deployProgress->reportCanceled();
error(this, errorMessage); appendMessage(this, errorMessage, true);
emit finished(); emit finished();
Core::ICore::instance()->showWarningWithOptions(tr("Debugger for Symbian Platform"), Core::ICore::instance()->showWarningWithOptions(tr("Debugger for Symbian Platform"),
errorMessage, QString(), errorMessage, QString(),
@@ -566,14 +566,15 @@ void S60DeviceRunControlBase::start()
if (!packageInfo.exists() if (!packageInfo.exists()
|| packageInfo.lastModified() < packageWithTargetInfo.lastModified()) { || packageInfo.lastModified() < packageWithTargetInfo.lastModified()) {
// the 'targetname_armX_udeb.sis' crap exists and is new, rename it // the 'targetname_armX_udeb.sis' crap exists and is new, rename it
emit addToOutputWindow(this, tr("Renaming new package '%1' to '%2'") emit appendMessage(this, tr("Renaming new package '%1' to '%2'")
.arg(QDir::toNativeSeparators(m_packageFileNameWithTarget), .arg(QDir::toNativeSeparators(m_packageFileNameWithTarget),
QDir::toNativeSeparators(m_signedPackage))); QDir::toNativeSeparators(m_signedPackage)), false);
ok = renameFile(m_packageFileNameWithTarget, m_signedPackage, &errorMessage); ok = renameFile(m_packageFileNameWithTarget, m_signedPackage, &errorMessage);
} else { } else {
// the 'targetname_armX_udeb.sis' crap exists but is old, remove it // the 'targetname_armX_udeb.sis' crap exists but is old, remove it
emit addToOutputWindow(this, tr("Removing old package '%1'") emit appendMessage(this, tr("Removing old package '%1'")
.arg(QDir::toNativeSeparators(m_packageFileNameWithTarget))); .arg(QDir::toNativeSeparators(m_packageFileNameWithTarget)),
false);
QFile::remove(m_packageFileNameWithTarget); QFile::remove(m_packageFileNameWithTarget);
} }
} }
@@ -589,7 +590,7 @@ void S60DeviceRunControlBase::start()
} else { } else {
m_deployProgress->reportCanceled(); m_deployProgress->reportCanceled();
errorMessage = tr("Failed to find package '%1': %2").arg(m_signedPackage, errorMessage); errorMessage = tr("Failed to find package '%1': %2").arg(m_signedPackage, errorMessage);
error(this, errorMessage); appendMessage(this, errorMessage, true);
stop(); stop();
emit finished(); emit finished();
} }
@@ -651,7 +652,7 @@ void S60DeviceRunControlBase::startDeployment()
m_launcher->setCopyFileName(m_signedPackage, copyDst); m_launcher->setCopyFileName(m_signedPackage, copyDst);
m_launcher->setInstallFileName(copyDst); m_launcher->setInstallFileName(copyDst);
initLauncher(runFileName, m_launcher); initLauncher(runFileName, m_launcher);
emit addToOutputWindow(this, tr("Package: %1\nDeploying application to '%2'...").arg(msgListFile(m_signedPackage), m_serialPortFriendlyName)); emit appendMessage(this, tr("Package: %1\nDeploying application to '%2'...").arg(msgListFile(m_signedPackage), m_serialPortFriendlyName), false);
// Prompt the user to start up the Blue tooth connection // Prompt the user to start up the Blue tooth connection
const trk::PromptStartCommunicationResult src = const trk::PromptStartCommunicationResult src =
S60RunConfigBluetoothStarter::startCommunication(m_launcher->trkDevice(), S60RunConfigBluetoothStarter::startCommunication(m_launcher->trkDevice(),
@@ -668,7 +669,7 @@ void S60DeviceRunControlBase::startDeployment()
if (!success) { if (!success) {
if (!errorMessage.isEmpty()) if (!errorMessage.isEmpty())
error(this, errorMessage); appendMessage(this, errorMessage, true);
stop(); stop();
emit finished(); emit finished();
} }
@@ -676,28 +677,28 @@ void S60DeviceRunControlBase::startDeployment()
void S60DeviceRunControlBase::printCreateFileFailed(const QString &filename, const QString &errorMessage) void S60DeviceRunControlBase::printCreateFileFailed(const QString &filename, const QString &errorMessage)
{ {
emit addToOutputWindow(this, tr("Could not create file %1 on device: %2").arg(filename, errorMessage)); emit appendMessage(this, tr("Could not create file %1 on device: %2").arg(filename, errorMessage), true);
} }
void S60DeviceRunControlBase::printWriteFileFailed(const QString &filename, const QString &errorMessage) void S60DeviceRunControlBase::printWriteFileFailed(const QString &filename, const QString &errorMessage)
{ {
emit addToOutputWindow(this, tr("Could not write to file %1 on device: %2").arg(filename, errorMessage)); emit appendMessage(this, tr("Could not write to file %1 on device: %2").arg(filename, errorMessage), true);
} }
void S60DeviceRunControlBase::printCloseFileFailed(const QString &filename, const QString &errorMessage) void S60DeviceRunControlBase::printCloseFileFailed(const QString &filename, const QString &errorMessage)
{ {
const QString msg = tr("Could not close file %1 on device: %2. It will be closed when App TRK is closed."); const QString msg = tr("Could not close file %1 on device: %2. It will be closed when App TRK is closed.");
emit addToOutputWindow(this, msg.arg(filename, errorMessage)); emit appendMessage(this, msg.arg(filename, errorMessage), true);
} }
void S60DeviceRunControlBase::printConnectFailed(const QString &errorMessage) void S60DeviceRunControlBase::printConnectFailed(const QString &errorMessage)
{ {
emit addToOutputWindow(this, tr("Could not connect to App TRK on device: %1. Restarting App TRK might help.").arg(errorMessage)); emit appendMessage(this, tr("Could not connect to App TRK on device: %1. Restarting App TRK might help.").arg(errorMessage), true);
} }
void S60DeviceRunControlBase::printCopyingNotice() void S60DeviceRunControlBase::printCopyingNotice()
{ {
emit addToOutputWindow(this, tr("Copying install file...")); emit appendMessage(this, tr("Copying install file..."), false);
} }
void S60DeviceRunControlBase::printCopyProgress(int progress) void S60DeviceRunControlBase::printCopyProgress(int progress)
@@ -708,7 +709,7 @@ void S60DeviceRunControlBase::printCopyProgress(int progress)
void S60DeviceRunControlBase::printInstallingNotice() void S60DeviceRunControlBase::printInstallingNotice()
{ {
m_deployProgress->setProgressValue(PROGRESS_PACKAGEDEPLOYED); m_deployProgress->setProgressValue(PROGRESS_PACKAGEDEPLOYED);
emit addToOutputWindow(this, tr("Installing application...")); emit appendMessage(this, tr("Installing application..."), false);
} }
void S60DeviceRunControlBase::printInstallingFinished() void S60DeviceRunControlBase::printInstallingFinished()
@@ -724,7 +725,7 @@ void S60DeviceRunControlBase::printInstallFailed(const QString &filename, const
QTC_ASSERT(m_deployProgress, ;) QTC_ASSERT(m_deployProgress, ;)
if (m_deployProgress) if (m_deployProgress)
m_deployProgress->reportCanceled(); m_deployProgress->reportCanceled();
emit addToOutputWindow(this, tr("Could not install from package %1 on device: %2").arg(filename, errorMessage)); emit appendMessage(this, tr("Could not install from package %1 on device: %2").arg(filename, errorMessage), true);
} }
void S60DeviceRunControlBase::launcherFinished() void S60DeviceRunControlBase::launcherFinished()
@@ -749,7 +750,7 @@ void S60DeviceRunControlBase::reportDeployFinished()
void S60DeviceRunControlBase::processStopped(uint pc, uint pid, uint tid, const QString& reason) void S60DeviceRunControlBase::processStopped(uint pc, uint pid, uint tid, const QString& reason)
{ {
emit addToOutputWindow(this, trk::Launcher::msgStopped(pid, tid, pc, reason)); emit addToOutputWindow(this, trk::Launcher::msgStopped(pid, tid, pc, reason), false);
m_launcher->terminate(); m_launcher->terminate();
} }
@@ -779,20 +780,20 @@ void S60DeviceRunControlBase::slotWaitingForTrkClosed()
{ {
if (m_launcher && m_launcher->state() == trk::Launcher::WaitingForTrk) { if (m_launcher && m_launcher->state() == trk::Launcher::WaitingForTrk) {
stop(); stop();
error(this, tr("Canceled.")); appendMessage(this, tr("Canceled."), true);
emit finished(); emit finished();
} }
} }
void S60DeviceRunControlBase::printApplicationOutput(const QString &output) void S60DeviceRunControlBase::printApplicationOutput(const QString &output, bool onStdErr)
{ {
emit addToOutputWindowInline(this, output); emit addToOutputWindowInline(this, output, onStdErr);
} }
void S60DeviceRunControlBase::deviceRemoved(const SymbianUtils::SymbianDevice &d) void S60DeviceRunControlBase::deviceRemoved(const SymbianUtils::SymbianDevice &d)
{ {
if (m_handleDeviceRemoval && d.portName() == m_serialPortName) { if (m_handleDeviceRemoval && d.portName() == m_serialPortName) {
error(this, tr("The device '%1' has been disconnected").arg(d.friendlyName())); appendMessage(this, tr("The device '%1' has been disconnected").arg(d.friendlyName()), true);
emit finished(); emit finished();
} }
} }
@@ -824,21 +825,21 @@ void S60DeviceRunControl::initLauncher(const QString &executable, trk::Launcher
void S60DeviceRunControl::handleLauncherFinished() void S60DeviceRunControl::handleLauncherFinished()
{ {
emit finished(); emit finished();
emit addToOutputWindow(this, tr("Finished.")); emit appendMessage(this, tr("Finished."), false);
} }
void S60DeviceRunControl::printStartingNotice() void S60DeviceRunControl::printStartingNotice()
{ {
emit addToOutputWindow(this, tr("Starting application...")); emit appendMessage(this, tr("Starting application..."), false);
} }
void S60DeviceRunControl::printRunNotice(uint pid) void S60DeviceRunControl::printRunNotice(uint pid)
{ {
emit addToOutputWindow(this, tr("Application running with pid %1.").arg(pid)); emit appendMessage(this, tr("Application running with pid %1.").arg(pid), false);
} }
void S60DeviceRunControl::printRunFailNotice(const QString &errorMessage) { void S60DeviceRunControl::printRunFailNotice(const QString &errorMessage) {
emit addToOutputWindow(this, tr("Could not start application: %1").arg(errorMessage)); emit appendMessage(this, tr("Could not start application: %1").arg(errorMessage), true);
} }
// ======== S60DeviceDebugRunControl // ======== S60DeviceDebugRunControl
@@ -854,8 +855,8 @@ S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *ru
connect(dm, SIGNAL(debuggingFinished()), connect(dm, SIGNAL(debuggingFinished()),
this, SLOT(debuggingFinished()), Qt::QueuedConnection); this, SLOT(debuggingFinished()), Qt::QueuedConnection);
connect(dm, SIGNAL(applicationOutputAvailable(QString)), connect(dm, SIGNAL(applicationOutputAvailable(QString, bool)),
this, SLOT(printApplicationOutput(QString)), this, SLOT(printApplicationOutput(QString, bool)),
Qt::QueuedConnection); Qt::QueuedConnection);
m_startParams->remoteChannel = rc->serialPortName(); m_startParams->remoteChannel = rc->serialPortName();
@@ -892,7 +893,7 @@ void S60DeviceDebugRunControl::initLauncher(const QString &executable, trk::Laun
if (!QFileInfo(m_startParams->symbolFileName).isFile()) { if (!QFileInfo(m_startParams->symbolFileName).isFile()) {
m_startParams->symbolFileName.clear(); m_startParams->symbolFileName.clear();
emit addToOutputWindow(this, tr("Warning: Cannot locate the symbol file belonging to %1.").arg(m_localExecutableFileName)); emit appendMessage(this, tr("Warning: Cannot locate the symbol file belonging to %1.").arg(m_localExecutableFileName), true);
} }
launcher->addStartupActions(trk::Launcher::ActionCopyInstall); launcher->addStartupActions(trk::Launcher::ActionCopyInstall);
@@ -902,13 +903,13 @@ void S60DeviceDebugRunControl::initLauncher(const QString &executable, trk::Laun
void S60DeviceDebugRunControl::handleLauncherFinished() void S60DeviceDebugRunControl::handleLauncherFinished()
{ {
emit addToOutputWindow(this, tr("Launching debugger...")); emit appendMessage(this, tr("Launching debugger..."), false);
Debugger::DebuggerManager::instance()->startNewDebugger(m_startParams); Debugger::DebuggerManager::instance()->startNewDebugger(m_startParams);
} }
void S60DeviceDebugRunControl::debuggingFinished() void S60DeviceDebugRunControl::debuggingFinished()
{ {
emit addToOutputWindow(this, tr("Debugging finished.")); emit appendMessage(this, tr("Debugging finished."), false);
emit finished(); emit finished();
} }

View File

@@ -161,7 +161,7 @@ protected:
void setReleaseDeviceAfterLauncherFinish(bool); void setReleaseDeviceAfterLauncherFinish(bool);
protected slots: protected slots:
void printApplicationOutput(const QString &output); void printApplicationOutput(const QString &output, bool onStdErr);
void deviceRemoved(const SymbianUtils::SymbianDevice &); void deviceRemoved(const SymbianUtils::SymbianDevice &);
private slots: private slots:

View File

@@ -304,8 +304,8 @@ S60EmulatorRunControl::S60EmulatorRunControl(S60EmulatorRunConfiguration *runCon
m_executable = runConfiguration->executable(); m_executable = runConfiguration->executable();
connect(&m_applicationLauncher, SIGNAL(applicationError(QString)), connect(&m_applicationLauncher, SIGNAL(applicationError(QString)),
this, SLOT(slotError(QString))); this, SLOT(slotError(QString)));
connect(&m_applicationLauncher, SIGNAL(appendOutput(QString)), connect(&m_applicationLauncher, SIGNAL(appendOutput(QString, bool)),
this, SLOT(slotAddToOutputWindow(QString))); this, SLOT(slotAddToOutputWindow(QString, bool)));
connect(&m_applicationLauncher, SIGNAL(processExited(int)), connect(&m_applicationLauncher, SIGNAL(processExited(int)),
this, SLOT(processExited(int))); this, SLOT(processExited(int)));
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)), connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
@@ -317,7 +317,7 @@ void S60EmulatorRunControl::start()
m_applicationLauncher.start(ApplicationLauncher::Gui, m_executable, QStringList()); m_applicationLauncher.start(ApplicationLauncher::Gui, m_executable, QStringList());
emit started(); emit started();
emit addToOutputWindow(this, tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable))); emit appendMessage(this, tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)), false);
} }
void S60EmulatorRunControl::stop() void S60EmulatorRunControl::stop()
@@ -332,22 +332,22 @@ bool S60EmulatorRunControl::isRunning() const
void S60EmulatorRunControl::slotError(const QString & err) void S60EmulatorRunControl::slotError(const QString & err)
{ {
emit error(this, err); emit appendMessage(this, err, false);
emit finished(); emit finished();
} }
void S60EmulatorRunControl::slotAddToOutputWindow(const QString &line) void S60EmulatorRunControl::slotAddToOutputWindow(const QString &line, bool onStdErr)
{ {
static QString prefix = tr("[Qt Message]"); static QString prefix = tr("[Qt Message]");
static int prefixLength = prefix.length(); static int prefixLength = prefix.length();
int index = line.indexOf(prefix); int index = line.indexOf(prefix);
if (index != -1) { if (index != -1) {
emit addToOutputWindowInline(this, line.mid(index + prefixLength + 1)); emit addToOutputWindowInline(this, line.mid(index + prefixLength + 1), onStdErr);
} }
} }
void S60EmulatorRunControl::processExited(int exitCode) void S60EmulatorRunControl::processExited(int exitCode)
{ {
emit addToOutputWindow(this, tr("%1 exited with code %2").arg(QDir::toNativeSeparators(m_executable)).arg(exitCode)); emit appendMessage(this, tr("%1 exited with code %2").arg(QDir::toNativeSeparators(m_executable)).arg(exitCode), exitCode != 0);
emit finished(); emit finished();
} }

View File

@@ -137,7 +137,7 @@ public:
private slots: private slots:
void processExited(int exitCode); void processExited(int exitCode);
void slotAddToOutputWindow(const QString &line); void slotAddToOutputWindow(const QString &line, bool onStdErr);
void slotError(const QString & error); void slotError(const QString & error);
private: private: