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;
//signals:
virtual void processError(const QString &error) = 0;
virtual void processMessage(const QString &error, bool isError) = 0;
#ifdef Q_OS_WIN
// Add PATH and SystemRoot environment variables in case they are missing

View File

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

View File

@@ -70,7 +70,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
const QString err = stubServerListen();
if (!err.isEmpty()) {
emit processError(msgCommChannelFailed(err));
emit processMessage(msgCommChannelFailed(err), true);
return false;
}
@@ -78,7 +78,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
m_tempFile = new QTemporaryFile();
if (!m_tempFile->open()) {
stubServerShutdown();
emit processError(msgCannotCreateTempFile(m_tempFile->errorString()));
emit processMessage(msgCannotCreateTempFile(m_tempFile->errorString()), true);
delete m_tempFile;
m_tempFile = 0;
return false;
@@ -108,7 +108,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
m_process.start(xterm, xtermArgs);
if (!m_process.waitForStarted()) {
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;
m_tempFile = 0;
return false;
@@ -189,9 +189,9 @@ void ConsoleProcess::readStubOutput()
QByteArray out = m_stubSocket->readLine();
out.chop(1); // \n
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 ")) {
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 ")) {
// Will not need it any more
delete m_tempFile;
@@ -210,7 +210,7 @@ void ConsoleProcess::readStubOutput()
m_appPid = 0;
emit processStopped();
} else {
emit processError(msgUnexpectedOutput());
emit processMessage(msgUnexpectedOutput(), true);
m_process.terminate();
break;
}

View File

@@ -68,7 +68,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
const QString err = stubServerListen();
if (!err.isEmpty()) {
emit processError(msgCommChannelFailed(err));
emit processMessage(msgCommChannelFailed(err), true);
return false;
}
@@ -76,7 +76,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
m_tempFile = new QTemporaryFile();
if (!m_tempFile->open()) {
stubServerShutdown();
emit processError(msgCannotCreateTempFile(m_tempFile->errorString()));
emit processMessage(msgCannotCreateTempFile(m_tempFile->errorString()), true);
delete m_tempFile;
m_tempFile = 0;
return false;
@@ -122,7 +122,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
delete m_tempFile;
m_tempFile = 0;
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;
}
@@ -179,9 +179,9 @@ void ConsoleProcess::readStubOutput()
QByteArray out = m_stubSocket->readLine();
out.chop(2); // \r\n
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 ")) {
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 ")) {
// Wil not need it any more
delete m_tempFile;
@@ -192,8 +192,8 @@ void ConsoleProcess::readStubOutput()
SYNCHRONIZE | PROCESS_QUERY_INFORMATION | PROCESS_TERMINATE,
FALSE, m_appPid);
if (m_hInferior == NULL) {
emit processError(tr("Cannot obtain a handle to the inferior: %1")
.arg(winErrorMessage(GetLastError())));
emit processMessage(tr("Cannot obtain a handle to the inferior: %1")
.arg(winErrorMessage(GetLastError())), true);
// Uhm, and now what?
continue;
}
@@ -201,7 +201,7 @@ void ConsoleProcess::readStubOutput()
connect(inferiorFinishedNotifier, SIGNAL(activated(HANDLE)), SLOT(inferiorExited()));
emit processStarted();
} else {
emit processError(msgUnexpectedOutput());
emit processMessage(msgUnexpectedOutput(), true);
TerminateProcess(m_pid->hProcess, (unsigned)-1);
break;
}
@@ -222,8 +222,8 @@ void ConsoleProcess::inferiorExited()
DWORD chldStatus;
if (!GetExitCodeProcess(m_hInferior, &chldStatus))
emit processError(tr("Cannot obtain exit status from inferior: %1")
.arg(winErrorMessage(GetLastError())));
emit processMessage(tr("Cannot obtain exit status from inferior: %1")
.arg(winErrorMessage(GetLastError())), true);
cleanupInferior();
m_appStatus = QProcess::NormalExit;
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->m_consoleStubProc.setMode(Utils::ConsoleProcess::Suspend);
connect(&m_d->m_consoleStubProc, SIGNAL(processError(QString)),
this, SLOT(slotConsoleStubError(QString)));
connect(&m_d->m_consoleStubProc, SIGNAL(processMessage(QString,bool)),
this, SLOT(slotConsoleStubMessage(QString, bool)));
connect(&m_d->m_consoleStubProc, SIGNAL(processStarted()),
this, SLOT(slotConsoleStubStarted()));
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);
}

View File

@@ -106,7 +106,7 @@ public slots:
private slots:
void slotConsoleStubStarted();
void slotConsoleStubError(const QString &msg);
void slotConsoleStubMessage(const QString &msg, bool);
void slotConsoleStubTerminated();
void slotBreakAttachToCrashed();
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()

View File

@@ -264,7 +264,7 @@ public slots: // FIXME
//private slots: // FIXME
void showDebuggerOutput(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 sourceFilesDockToggled(bool on);
@@ -329,7 +329,8 @@ signals:
void inferiorPidChanged(qint64 pid);
void stateChanged(int newstatus);
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 emitShowInput(int channel, const QString &input);

View File

@@ -179,9 +179,11 @@ void DebuggerRunControl::init()
connect(m_manager, SIGNAL(debuggingFinished()),
this, SLOT(debuggingFinished()),
Qt::QueuedConnection);
connect(m_manager, SIGNAL(applicationOutputAvailable(QString)),
this, SLOT(slotAddToOutputWindowInline(QString)),
connect(m_manager, SIGNAL(applicationOutputAvailable(QString, bool)),
this, SLOT(slotAddToOutputWindowInline(QString, bool)),
Qt::QueuedConnection);
connect(m_manager, SIGNAL(messageAvailable(QString, bool)),
this, SLOT(slotMessageAvailable(QString, bool)));
connect(m_manager, SIGNAL(inferiorPidChanged(qint64)),
this, SLOT(bringApplicationToForeground(qint64)),
Qt::QueuedConnection);
@@ -200,7 +202,7 @@ void DebuggerRunControl::start()
m_manager->startNewDebugger(m_startParameters);
emit started();
} else {
error(this, errorMessage);
appendMessage(this, errorMessage, true);
emit finished();
Core::ICore::instance()->showWarningWithOptions(tr("Debugger"), errorMessage,
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()

View File

@@ -87,7 +87,8 @@ signals:
void stopRequested();
private slots:
void slotAddToOutputWindowInline(const QString &output);
void slotAddToOutputWindowInline(const QString &output, bool onStdErr);
void slotMessageAvailable(const QString &data, bool isError);
private:
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)
{
m_manager->showApplicationOutput(m_outputCodec->toUnicode(
data.constData(), data.length(), &m_outputCodecState));
m_manager->messageAvailable(m_outputCodec->toUnicode(
data.constData(), data.length(), &m_outputCodecState), true);
}
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
// version and/or OS version used.
if (data.startsWith("warning:"))
manager()->showApplicationOutput(_(data.mid(9))); // cut "warning: "
manager()->messageAvailable(_(data.mid(9)), true); // cut "warning: "
break;
}

View File

@@ -59,7 +59,7 @@ TermGdbAdapter::TermGdbAdapter(GdbEngine *engine, QObject *parent)
m_stubProc.setSettings(Core::ICore::instance()->settings());
#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(wrapperStopped()), SLOT(stubExited()));
}
@@ -165,7 +165,7 @@ void TermGdbAdapter::interruptInferior()
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);
}

View File

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

View File

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

View File

@@ -43,16 +43,16 @@ ApplicationLauncher::ApplicationLauncher(QObject *parent)
m_currentMode = Gui;
m_consoleProcess = new ConsoleProcess(this);
connect(m_consoleProcess, SIGNAL(processError(const QString&)),
this, SIGNAL(applicationError(const QString&)));
connect(m_consoleProcess, SIGNAL(processMessage(const QString&, bool)),
this, SIGNAL(appendMessage(QString,bool)));
connect(m_consoleProcess, SIGNAL(processStopped()),
this, SLOT(processStopped()));
m_winGuiProcess = new WinGuiProcess(this);
connect(m_winGuiProcess, SIGNAL(processError(const QString&)),
this, SIGNAL(applicationError(const QString&)));
connect(m_winGuiProcess, SIGNAL(receivedDebugOutput(const QString&)),
this, SLOT(readWinDebugOutput(const QString&)));
connect(m_winGuiProcess, SIGNAL(processMessage(const QString &, bool)),
this, SIGNAL(appendMessage(QString,bool)));
connect(m_winGuiProcess, SIGNAL(receivedDebugOutput(const QString&, bool)),
this, SLOT(readWinDebugOutput(const QString&, bool)));
connect(m_winGuiProcess, SIGNAL(processFinished(int)),
this, SLOT(processFinished(int)));
@@ -111,9 +111,10 @@ qint64 ApplicationLauncher::applicationPID() const
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()

View File

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

View File

@@ -101,10 +101,10 @@ LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfig
m_runMode = static_cast<ApplicationLauncher::Mode>(runConfiguration->runMode());
m_commandLineArguments = runConfiguration->commandLineArguments();
connect(&m_applicationLauncher, SIGNAL(applicationError(QString)),
this, SLOT(slotError(QString)));
connect(&m_applicationLauncher, SIGNAL(appendOutput(QString)),
this, SLOT(slotAddToOutputWindow(QString)));
connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,bool)),
this, SLOT(slotAppendMessage(QString,bool)));
connect(&m_applicationLauncher, SIGNAL(appendOutput(QString, bool)),
this, SLOT(slotAddToOutputWindow(QString, bool)));
connect(&m_applicationLauncher, SIGNAL(processExited(int)),
this, SLOT(processExited(int)));
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
@@ -120,7 +120,7 @@ void LocalApplicationRunControl::start()
m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments);
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()
@@ -133,20 +133,22 @@ bool LocalApplicationRunControl::isRunning() const
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();
}
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)
{
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();
}

View File

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

View File

@@ -49,7 +49,7 @@ void OutputFormatter::setPlainTextEdit(QPlainTextEdit *plainText)
setParent(m_plainTextEdit);
}
void OutputFormatter::appendOutput(const QString &text)
void OutputFormatter::appendApplicationOutput(const QString &text, bool /*onStdErr*/)
{
QTextCharFormat format;
format.setForeground(plainTextEdit()->palette().text().color());
@@ -57,9 +57,9 @@ void OutputFormatter::appendOutput(const QString &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*/)

View File

@@ -50,8 +50,8 @@ public:
QPlainTextEdit *plainTextEdit() const;
void setPlainTextEdit(QPlainTextEdit *plainText);
virtual void appendOutput(const QString &text);
virtual void appendError(const QString &text);
virtual void appendApplicationOutput(const QString &text, bool onStdErr);
virtual void appendMessage(const QString &text, bool isError);
virtual void mousePressEvent(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);
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);
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);
ow->appendError(out);
ow->appendMessage(out, isError);
}
void OutputPane::showTabFor(RunControl *rc)
@@ -424,7 +427,7 @@ void OutputWindow::showEvent(QShowEvent *e)
m_scrollToBottom = false;
}
QString OutputWindow::doNewlineMagic(const QString &out)
QString OutputWindow::doNewlineEnfocement(const QString &out)
{
m_scrollToBottom = true;
QString s = out;
@@ -439,17 +442,17 @@ QString OutputWindow::doNewlineMagic(const QString &out)
return s;
}
void OutputWindow::appendOutput(const QString &out)
void OutputWindow::appendApplicationOutput(const QString &out, bool onStdErr)
{
setMaximumBlockCount(MaxBlockCount);
const bool atBottom = isScrollbarAtBottom();
m_formatter->appendOutput(doNewlineMagic(out));
m_formatter->appendApplicationOutput(doNewlineEnfocement(out), onStdErr);
if (atBottom)
scrollToBottom();
enableUndoRedo();
}
void OutputWindow::appendOutputInline(const QString &out)
void OutputWindow::appendApplicationOutputInline(const QString &out, bool onStdErr)
{
m_scrollToBottom = true;
setMaximumBlockCount(MaxBlockCount);
@@ -462,7 +465,7 @@ void OutputWindow::appendOutputInline(const QString &out)
if (!enforceNewline) {
newline = out.indexOf(QLatin1Char('\n'));
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);
@@ -473,7 +476,7 @@ void OutputWindow::appendOutputInline(const QString &out)
m_enforceNewline = true;
s.chop(1);
}
m_formatter->appendOutput(QLatin1Char('\n') + s);
m_formatter->appendApplicationOutput(QLatin1Char('\n') + s, onStdErr);
}
if (atBottom)
@@ -481,10 +484,10 @@ void OutputWindow::appendOutputInline(const QString &out)
enableUndoRedo();
}
void OutputWindow::appendError(const QString &out)
void OutputWindow::appendMessage(const QString &out, bool isError)
{
setMaximumBlockCount(MaxBlockCount);
m_formatter->appendError(doNewlineMagic(out));
m_formatter->appendMessage(doNewlineEnfocement(out), isError);
enableUndoRedo();
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -61,8 +61,8 @@ public:
int exitCode() const;
signals:
void processError(const QString &error);
void receivedDebugOutput(const QString &output);
void processMessage(const QString &error, bool isError);
void receivedDebugOutput(const QString &output, bool stderr);
void processFinished(int exitCode);
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;
normalFormat.setForeground(plainTextEdit()->palette().text().color());
@@ -72,9 +72,9 @@ void QmlOutputFormatter::appendOutput(const QString &text)
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*/)

View File

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

View File

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

View File

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

View File

@@ -83,7 +83,7 @@ void AbstractMaemoRunControl::start()
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
= QStringList() << executableFileName() << QLatin1String("gdbserver");
killRemoteProcesses(appsToKill, true);
@@ -103,14 +103,14 @@ void AbstractMaemoRunControl::stop()
void AbstractMaemoRunControl::handleInitialCleanupFinished()
{
if (m_stoppedByUser) {
emit addToOutputWindow(this, tr("Initial cleanup canceled by user."));
emit appendMessage(this, tr("Initial cleanup canceled by user."), false);
emit finished();
} else if (m_initialCleaner->hasError()) {
handleError(tr("Error running initial cleanup: %1.")
.arg(m_initialCleaner->error()));
emit finished();
} else {
emit addToOutputWindow(this, tr("Initial cleanup done."));
emit appendMessage(this, tr("Initial cleanup done."), false);
startInternal();
}
}
@@ -158,7 +158,7 @@ void AbstractMaemoRunControl::deploy()
files << srcFilePath;
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));
connect(m_sshDeployer.data(), SIGNAL(finished()),
this, SLOT(handleDeployThreadFinished()));
@@ -213,7 +213,7 @@ void AbstractMaemoRunControl::startExecution()
this, SLOT(handleRunThreadFinished()));
connect(m_sshRunner.data(), SIGNAL(remoteOutput(QString)),
this, SLOT(handleRemoteOutput(QString)));
emit addToOutputWindow(this, tr("Starting remote application."));
emit appendMessage(this, tr("Starting remote application."), false);
m_sshRunner->start();
}
@@ -257,13 +257,13 @@ void AbstractMaemoRunControl::handleDeployThreadFinished()
{
bool cancel;
if (m_stoppedByUser) {
emit addToOutputWindow(this, tr("Deployment canceled by user."));
emit appendMessage(this, tr("Deployment canceled by user."), false);
cancel = true;
} else if (m_sshDeployer->hasError()) {
handleError(tr("Deployment failed: %1").arg(m_sshDeployer->error()));
cancel = true;
} else {
emit addToOutputWindow(this, tr("Deployment finished."));
emit appendMessage(this, tr("Deployment finished."), false);
cancel = false;
}
@@ -280,13 +280,16 @@ void AbstractMaemoRunControl::handleDeployThreadFinished()
void AbstractMaemoRunControl::handleRunThreadFinished()
{
if (m_stoppedByUser) {
emit addToOutputWindow(this,
tr("Remote execution canceled due to user request."));
emit appendMessage(this,
tr("Remote execution canceled due to user request."),
false);
} else if (m_sshRunner->hasError()) {
emit addToOutputWindow(this, tr("Error running remote process: %1")
.arg(m_sshRunner->error()));
emit appendMessage(this, tr("Error running remote process: %1")
.arg(m_sshRunner->error()),
true);
} else {
emit addToOutputWindow(this, tr("Finished running remote process."));
emit appendMessage(this, tr("Finished running remote process."),
false);
}
emit finished();
}
@@ -335,7 +338,7 @@ QString AbstractMaemoRunControl::targetCmdLineSuffix() const
void AbstractMaemoRunControl::handleError(const QString &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);
}
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,
SLOT(debuggingFinished()), Qt::QueuedConnection);
connect(m_debuggerManager, SIGNAL(applicationOutputAvailable(QString)),
this, SLOT(debuggerOutput(QString)), Qt::QueuedConnection);
connect(m_debuggerManager, SIGNAL(applicationOutputAvailable(QString, bool)),
this, SLOT(debuggerOutput(QString, bool)), Qt::QueuedConnection);
}
MaemoDebugRunControl::~MaemoDebugRunControl()
@@ -417,13 +420,13 @@ QString MaemoDebugRunControl::remoteCall() const
.arg(executableFilePathOnTarget()).arg(targetCmdLineSuffix());
}
void MaemoDebugRunControl::handleRemoteOutput(const QString &output)
void MaemoDebugRunControl::handleRemoteOutput(const QString &output, bool onStdErr)
{
if (!m_debuggingStarted) {
m_debuggingStarted = true;
startDebugging();
}
emit addToOutputWindowInline(this, output);
emit addToOutputWindowInline(this, output, onStdErr);
}
void MaemoDebugRunControl::startDebugging()
@@ -447,9 +450,9 @@ void MaemoDebugRunControl::debuggingFinished()
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

View File

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

View File

@@ -534,19 +534,19 @@ void S60DeviceRunControlBase::start()
emit started();
if (m_serialPortName.isEmpty()) {
m_deployProgress->reportCanceled();
error(this, tr("There is no device plugged in."));
appendMessage(this, tr("There is no device plugged in."), true);
emit finished();
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 settingsCategory;
QString settingsPage;
if (!checkConfiguration(&errorMessage, &settingsCategory, &settingsPage)) {
m_deployProgress->reportCanceled();
error(this, errorMessage);
appendMessage(this, errorMessage, true);
emit finished();
Core::ICore::instance()->showWarningWithOptions(tr("Debugger for Symbian Platform"),
errorMessage, QString(),
@@ -566,14 +566,15 @@ void S60DeviceRunControlBase::start()
if (!packageInfo.exists()
|| packageInfo.lastModified() < packageWithTargetInfo.lastModified()) {
// the 'targetname_armX_udeb.sis' crap exists and is new, rename it
emit addToOutputWindow(this, tr("Renaming new package '%1' to '%2'")
.arg(QDir::toNativeSeparators(m_packageFileNameWithTarget),
QDir::toNativeSeparators(m_signedPackage)));
emit appendMessage(this, tr("Renaming new package '%1' to '%2'")
.arg(QDir::toNativeSeparators(m_packageFileNameWithTarget),
QDir::toNativeSeparators(m_signedPackage)), false);
ok = renameFile(m_packageFileNameWithTarget, m_signedPackage, &errorMessage);
} else {
// the 'targetname_armX_udeb.sis' crap exists but is old, remove it
emit addToOutputWindow(this, tr("Removing old package '%1'")
.arg(QDir::toNativeSeparators(m_packageFileNameWithTarget)));
emit appendMessage(this, tr("Removing old package '%1'")
.arg(QDir::toNativeSeparators(m_packageFileNameWithTarget)),
false);
QFile::remove(m_packageFileNameWithTarget);
}
}
@@ -589,7 +590,7 @@ void S60DeviceRunControlBase::start()
} else {
m_deployProgress->reportCanceled();
errorMessage = tr("Failed to find package '%1': %2").arg(m_signedPackage, errorMessage);
error(this, errorMessage);
appendMessage(this, errorMessage, true);
stop();
emit finished();
}
@@ -651,7 +652,7 @@ void S60DeviceRunControlBase::startDeployment()
m_launcher->setCopyFileName(m_signedPackage, copyDst);
m_launcher->setInstallFileName(copyDst);
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
const trk::PromptStartCommunicationResult src =
S60RunConfigBluetoothStarter::startCommunication(m_launcher->trkDevice(),
@@ -668,7 +669,7 @@ void S60DeviceRunControlBase::startDeployment()
if (!success) {
if (!errorMessage.isEmpty())
error(this, errorMessage);
appendMessage(this, errorMessage, true);
stop();
emit finished();
}
@@ -676,28 +677,28 @@ void S60DeviceRunControlBase::startDeployment()
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)
{
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)
{
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)
{
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()
{
emit addToOutputWindow(this, tr("Copying install file..."));
emit appendMessage(this, tr("Copying install file..."), false);
}
void S60DeviceRunControlBase::printCopyProgress(int progress)
@@ -708,7 +709,7 @@ void S60DeviceRunControlBase::printCopyProgress(int progress)
void S60DeviceRunControlBase::printInstallingNotice()
{
m_deployProgress->setProgressValue(PROGRESS_PACKAGEDEPLOYED);
emit addToOutputWindow(this, tr("Installing application..."));
emit appendMessage(this, tr("Installing application..."), false);
}
void S60DeviceRunControlBase::printInstallingFinished()
@@ -724,7 +725,7 @@ void S60DeviceRunControlBase::printInstallFailed(const QString &filename, const
QTC_ASSERT(m_deployProgress, ;)
if (m_deployProgress)
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()
@@ -749,7 +750,7 @@ void S60DeviceRunControlBase::reportDeployFinished()
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();
}
@@ -779,20 +780,20 @@ void S60DeviceRunControlBase::slotWaitingForTrkClosed()
{
if (m_launcher && m_launcher->state() == trk::Launcher::WaitingForTrk) {
stop();
error(this, tr("Canceled."));
appendMessage(this, tr("Canceled."), true);
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)
{
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();
}
}
@@ -824,21 +825,21 @@ void S60DeviceRunControl::initLauncher(const QString &executable, trk::Launcher
void S60DeviceRunControl::handleLauncherFinished()
{
emit finished();
emit addToOutputWindow(this, tr("Finished."));
emit appendMessage(this, tr("Finished."), false);
}
void S60DeviceRunControl::printStartingNotice()
{
emit addToOutputWindow(this, tr("Starting application..."));
emit appendMessage(this, tr("Starting application..."), false);
}
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) {
emit addToOutputWindow(this, tr("Could not start application: %1").arg(errorMessage));
emit appendMessage(this, tr("Could not start application: %1").arg(errorMessage), true);
}
// ======== S60DeviceDebugRunControl
@@ -854,8 +855,8 @@ S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *ru
connect(dm, SIGNAL(debuggingFinished()),
this, SLOT(debuggingFinished()), Qt::QueuedConnection);
connect(dm, SIGNAL(applicationOutputAvailable(QString)),
this, SLOT(printApplicationOutput(QString)),
connect(dm, SIGNAL(applicationOutputAvailable(QString, bool)),
this, SLOT(printApplicationOutput(QString, bool)),
Qt::QueuedConnection);
m_startParams->remoteChannel = rc->serialPortName();
@@ -892,7 +893,7 @@ void S60DeviceDebugRunControl::initLauncher(const QString &executable, trk::Laun
if (!QFileInfo(m_startParams->symbolFileName).isFile()) {
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);
@@ -902,13 +903,13 @@ void S60DeviceDebugRunControl::initLauncher(const QString &executable, trk::Laun
void S60DeviceDebugRunControl::handleLauncherFinished()
{
emit addToOutputWindow(this, tr("Launching debugger..."));
emit appendMessage(this, tr("Launching debugger..."), false);
Debugger::DebuggerManager::instance()->startNewDebugger(m_startParams);
}
void S60DeviceDebugRunControl::debuggingFinished()
{
emit addToOutputWindow(this, tr("Debugging finished."));
emit appendMessage(this, tr("Debugging finished."), false);
emit finished();
}

View File

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

View File

@@ -304,8 +304,8 @@ S60EmulatorRunControl::S60EmulatorRunControl(S60EmulatorRunConfiguration *runCon
m_executable = runConfiguration->executable();
connect(&m_applicationLauncher, SIGNAL(applicationError(QString)),
this, SLOT(slotError(QString)));
connect(&m_applicationLauncher, SIGNAL(appendOutput(QString)),
this, SLOT(slotAddToOutputWindow(QString)));
connect(&m_applicationLauncher, SIGNAL(appendOutput(QString, bool)),
this, SLOT(slotAddToOutputWindow(QString, bool)));
connect(&m_applicationLauncher, SIGNAL(processExited(int)),
this, SLOT(processExited(int)));
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
@@ -317,7 +317,7 @@ void S60EmulatorRunControl::start()
m_applicationLauncher.start(ApplicationLauncher::Gui, m_executable, QStringList());
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()
@@ -332,22 +332,22 @@ bool S60EmulatorRunControl::isRunning() const
void S60EmulatorRunControl::slotError(const QString & err)
{
emit error(this, err);
emit appendMessage(this, err, false);
emit finished();
}
void S60EmulatorRunControl::slotAddToOutputWindow(const QString &line)
void S60EmulatorRunControl::slotAddToOutputWindow(const QString &line, bool onStdErr)
{
static QString prefix = tr("[Qt Message]");
static int prefixLength = prefix.length();
int index = line.indexOf(prefix);
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)
{
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();
}

View File

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