forked from qt-creator/qt-creator
app output window reorga
- drop prefix magic - avoid inserting stray newlines this also fixes the overquoting of app output.
This commit is contained in:
@@ -590,9 +590,9 @@ void DebuggerManager::notifyInferiorPidChanged(int pid)
|
|||||||
emit inferiorPidChanged(pid);
|
emit inferiorPidChanged(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::showApplicationOutput(const QString &prefix, const QString &str)
|
void DebuggerManager::showApplicationOutput(const QString &str)
|
||||||
{
|
{
|
||||||
emit applicationOutputAvailable(prefix, str);
|
emit applicationOutputAvailable(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::shutdown()
|
void DebuggerManager::shutdown()
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ private:
|
|||||||
virtual ThreadsHandler *threadsHandler() = 0;
|
virtual ThreadsHandler *threadsHandler() = 0;
|
||||||
virtual WatchHandler *watchHandler() = 0;
|
virtual WatchHandler *watchHandler() = 0;
|
||||||
|
|
||||||
virtual void showApplicationOutput(const QString &prefix, const QString &data) = 0;
|
virtual void showApplicationOutput(const QString &data) = 0;
|
||||||
//virtual QAction *useCustomDumpersAction() const = 0;
|
//virtual QAction *useCustomDumpersAction() const = 0;
|
||||||
//virtual QAction *debugDumpersAction() const = 0;
|
//virtual QAction *debugDumpersAction() const = 0;
|
||||||
virtual bool skipKnownFrames() const = 0;
|
virtual bool skipKnownFrames() const = 0;
|
||||||
@@ -285,7 +285,7 @@ public slots:
|
|||||||
private slots:
|
private slots:
|
||||||
void showDebuggerOutput(const QString &prefix, const QString &msg);
|
void showDebuggerOutput(const QString &prefix, const QString &msg);
|
||||||
void showDebuggerInput(const QString &prefix, const QString &msg);
|
void showDebuggerInput(const QString &prefix, const QString &msg);
|
||||||
void showApplicationOutput(const QString &prefix, const QString &msg);
|
void showApplicationOutput(const QString &data);
|
||||||
|
|
||||||
void reloadDisassembler();
|
void reloadDisassembler();
|
||||||
void disassemblerDockToggled(bool on);
|
void disassemblerDockToggled(bool on);
|
||||||
@@ -365,7 +365,7 @@ signals:
|
|||||||
void setSessionValueRequested(const QString &name, const QVariant &value);
|
void setSessionValueRequested(const QString &name, const QVariant &value);
|
||||||
void configValueRequested(const QString &name, QVariant *value);
|
void configValueRequested(const QString &name, QVariant *value);
|
||||||
void setConfigValueRequested(const QString &name, const QVariant &value);
|
void setConfigValueRequested(const QString &name, const QVariant &value);
|
||||||
void applicationOutputAvailable(const QString &prefix, const QString &msg);
|
void applicationOutputAvailable(const QString &output);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// FIXME: make private
|
// FIXME: make private
|
||||||
|
|||||||
@@ -108,8 +108,8 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
|
|||||||
{
|
{
|
||||||
connect(m_manager, SIGNAL(debuggingFinished()),
|
connect(m_manager, SIGNAL(debuggingFinished()),
|
||||||
this, SLOT(debuggingFinished()));
|
this, SLOT(debuggingFinished()));
|
||||||
connect(m_manager, SIGNAL(applicationOutputAvailable(QString, QString)),
|
connect(m_manager, SIGNAL(applicationOutputAvailable(QString)),
|
||||||
this, SLOT(slotAddToOutputWindow(QString, QString)));
|
this, SLOT(slotAddToOutputWindowInline(QString)));
|
||||||
connect(m_manager, SIGNAL(inferiorPidChanged(qint64)),
|
connect(m_manager, SIGNAL(inferiorPidChanged(qint64)),
|
||||||
this, SLOT(bringApplicationToForeground(qint64)));
|
this, SLOT(bringApplicationToForeground(qint64)));
|
||||||
}
|
}
|
||||||
@@ -138,12 +138,9 @@ void DebuggerRunControl::start()
|
|||||||
debuggingFinished();
|
debuggingFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunControl::slotAddToOutputWindow(const QString &prefix, const QString &line)
|
void DebuggerRunControl::slotAddToOutputWindowInline(const QString &data)
|
||||||
{
|
{
|
||||||
Q_UNUSED(prefix);
|
emit addToOutputWindowInline(this, data);
|
||||||
foreach (const QString &l, line.split('\n'))
|
|
||||||
emit addToOutputWindow(this, prefix + Qt::escape(l));
|
|
||||||
//emit addToOutputWindow(this, prefix + Qt::escape(line));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunControl::stop()
|
void DebuggerRunControl::stop()
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void debuggingFinished();
|
void debuggingFinished();
|
||||||
void slotAddToOutputWindow(const QString &prefix, const QString &line);
|
void slotAddToOutputWindowInline(const QString &output);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DebuggerManager *m_manager;
|
DebuggerManager *m_manager;
|
||||||
|
|||||||
@@ -275,8 +275,8 @@ void GdbEngine::init()
|
|||||||
connect(this, SIGNAL(gdbInputAvailable(QString,QString)),
|
connect(this, SIGNAL(gdbInputAvailable(QString,QString)),
|
||||||
q, SLOT(showDebuggerInput(QString,QString)),
|
q, SLOT(showDebuggerInput(QString,QString)),
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
connect(this, SIGNAL(applicationOutputAvailable(QString,QString)),
|
connect(this, SIGNAL(applicationOutputAvailable(QString)),
|
||||||
q, SLOT(showApplicationOutput(QString,QString)),
|
q, SLOT(showApplicationOutput(QString)),
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ void GdbEngine::handleResponse()
|
|||||||
//s += '\n';
|
//s += '\n';
|
||||||
|
|
||||||
m_inbuffer = QByteArray(from, to - from);
|
m_inbuffer = QByteArray(from, to - from);
|
||||||
emit applicationOutputAvailable("app-stdout: ", s);
|
emit applicationOutputAvailable(s);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -591,7 +591,7 @@ static void fixMac(QByteArray &out)
|
|||||||
void GdbEngine::readGdbStandardError()
|
void GdbEngine::readGdbStandardError()
|
||||||
{
|
{
|
||||||
QByteArray err = m_gdbProc.readAllStandardError();
|
QByteArray err = m_gdbProc.readAllStandardError();
|
||||||
emit applicationOutputAvailable("app-stderr:", err);
|
emit applicationOutputAvailable(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::readGdbStandardOutput()
|
void GdbEngine::readGdbStandardOutput()
|
||||||
@@ -1078,7 +1078,7 @@ void GdbEngine::handleStreamOutput(const QString &data, char code)
|
|||||||
// 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:"))
|
||||||
qq->showApplicationOutput(QString(), data);
|
qq->showApplicationOutput(data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ signals:
|
|||||||
void gdbResponseAvailable();
|
void gdbResponseAvailable();
|
||||||
void gdbInputAvailable(const QString &prefix, const QString &msg);
|
void gdbInputAvailable(const QString &prefix, const QString &msg);
|
||||||
void gdbOutputAvailable(const QString &prefix, const QString &msg);
|
void gdbOutputAvailable(const QString &prefix, const QString &msg);
|
||||||
void applicationOutputAvailable(const QString &prefix, const QString &msg);
|
void applicationOutputAvailable(const QString &output);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -37,6 +37,9 @@
|
|||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
#include <QtCore/QProcess>
|
#include <QtCore/QProcess>
|
||||||
|
#ifndef Q_OS_WIN
|
||||||
|
#include <QtCore/QTextCodec>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -88,7 +91,12 @@ private:
|
|||||||
ConsoleProcess *m_consoleProcess;
|
ConsoleProcess *m_consoleProcess;
|
||||||
Mode m_currentMode;
|
Mode m_currentMode;
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
WinGuiProcess *m_winGuiProcess;
|
WinGuiProcess *m_winGuiProcess;
|
||||||
|
#else
|
||||||
|
QTextCodec *m_outputCodec;
|
||||||
|
QTextCodec::ConverterState m_outputCodecState;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -116,10 +116,7 @@ qint64 ApplicationLauncher::applicationPID() const
|
|||||||
|
|
||||||
void ApplicationLauncher::readWinDebugOutput(const QString &output)
|
void ApplicationLauncher::readWinDebugOutput(const QString &output)
|
||||||
{
|
{
|
||||||
QString s = output;
|
emit appendOutput(output);
|
||||||
if (s.endsWith(QLatin1Char('\n')))
|
|
||||||
s.chop(1);
|
|
||||||
emit appendOutput(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationLauncher::processStopped()
|
void ApplicationLauncher::processStopped()
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ using namespace ProjectExplorer::Internal;
|
|||||||
ApplicationLauncher::ApplicationLauncher(QObject *parent)
|
ApplicationLauncher::ApplicationLauncher(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
|
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::MergedChannels);
|
||||||
@@ -132,13 +133,9 @@ void ApplicationLauncher::guiProcessError()
|
|||||||
|
|
||||||
void ApplicationLauncher::readStandardOutput()
|
void ApplicationLauncher::readStandardOutput()
|
||||||
{
|
{
|
||||||
m_guiProcess->setReadChannel(QProcess::StandardOutput);
|
QByteArray data = m_guiProcess->readAllStandardOutput();
|
||||||
while (m_guiProcess->canReadLine()) {
|
emit appendOutput(m_outputCodec->toUnicode(
|
||||||
QString line = QString::fromLocal8Bit(m_guiProcess->readLine());
|
data.constData(), data.length(), &m_outputCodecState));
|
||||||
if (line.endsWith(QLatin1Char('\n')))
|
|
||||||
line.chop(1);
|
|
||||||
emit appendOutput(line);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationLauncher::processStopped()
|
void ApplicationLauncher::processStopped()
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ void ApplicationRunControl::slotError(const QString & err)
|
|||||||
|
|
||||||
void ApplicationRunControl::slotAddToOutputWindow(const QString &line)
|
void ApplicationRunControl::slotAddToOutputWindow(const QString &line)
|
||||||
{
|
{
|
||||||
emit addToOutputWindow(this, Qt::escape(line));
|
emit addToOutputWindowInline(this, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationRunControl::processExited(int exitCode)
|
void ApplicationRunControl::processExited(int exitCode)
|
||||||
|
|||||||
@@ -215,6 +215,12 @@ void OutputPane::appendOutput(RunControl *rc, const QString &out)
|
|||||||
ow->appendOutput(out);
|
ow->appendOutput(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OutputPane::appendOutputInline(RunControl *rc, const QString &out)
|
||||||
|
{
|
||||||
|
OutputWindow *ow = m_outputWindows.value(rc);
|
||||||
|
ow->appendOutputInline(out);
|
||||||
|
}
|
||||||
|
|
||||||
void OutputPane::showTabFor(RunControl *rc)
|
void OutputPane::showTabFor(RunControl *rc)
|
||||||
{
|
{
|
||||||
OutputWindow *ow = m_outputWindows.value(rc);
|
OutputWindow *ow = m_outputWindows.value(rc);
|
||||||
@@ -318,7 +324,16 @@ OutputWindow::~OutputWindow()
|
|||||||
|
|
||||||
void OutputWindow::appendOutput(const QString &out)
|
void OutputWindow::appendOutput(const QString &out)
|
||||||
{
|
{
|
||||||
appendPlainText(out);
|
if (out.endsWith('\n'))
|
||||||
|
appendPlainText(out);
|
||||||
|
else
|
||||||
|
appendPlainText(out + '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
void OutputWindow::appendOutputInline(const QString &out)
|
||||||
|
{
|
||||||
|
moveCursor(QTextCursor::End);
|
||||||
|
insertPlainText(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputWindow::insertLine()
|
void OutputWindow::insertLine()
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ public:
|
|||||||
// ApplicationOutputspecifics
|
// ApplicationOutputspecifics
|
||||||
void createNewOutputWindow(RunControl *rc);
|
void createNewOutputWindow(RunControl *rc);
|
||||||
void appendOutput(RunControl *rc, const QString &out);
|
void appendOutput(RunControl *rc, const QString &out);
|
||||||
|
void appendOutputInline(RunControl *rc, const QString &out);
|
||||||
void showTabFor(RunControl *rc);
|
void showTabFor(RunControl *rc);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@@ -119,6 +120,7 @@ public:
|
|||||||
~OutputWindow();
|
~OutputWindow();
|
||||||
|
|
||||||
void appendOutput(const QString &out);
|
void appendOutput(const QString &out);
|
||||||
|
void appendOutputInline(const QString &out);
|
||||||
void insertLine();
|
void insertLine();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1084,6 +1084,8 @@ void ProjectExplorerPlugin::buildQueueFinished(bool success)
|
|||||||
|
|
||||||
connect(control, SIGNAL(addToOutputWindow(RunControl *, const QString &)),
|
connect(control, SIGNAL(addToOutputWindow(RunControl *, const QString &)),
|
||||||
this, SLOT(addToApplicationOutputWindow(RunControl *, const QString &)));
|
this, SLOT(addToApplicationOutputWindow(RunControl *, const QString &)));
|
||||||
|
connect(control, SIGNAL(addToOutputWindowInline(RunControl *, const QString &)),
|
||||||
|
this, SLOT(addToApplicationOutputWindowInline(RunControl *, const QString &)));
|
||||||
connect(control, SIGNAL(error(RunControl *, const QString &)),
|
connect(control, SIGNAL(error(RunControl *, const QString &)),
|
||||||
this, SLOT(addErrorToApplicationOutputWindow(RunControl *, const QString &)));
|
this, SLOT(addErrorToApplicationOutputWindow(RunControl *, const QString &)));
|
||||||
connect(control, SIGNAL(finished()),
|
connect(control, SIGNAL(finished()),
|
||||||
@@ -1379,6 +1381,11 @@ void ProjectExplorerPlugin::addToApplicationOutputWindow(RunControl *rc, const Q
|
|||||||
m_outputPane->appendOutput(rc, line);
|
m_outputPane->appendOutput(rc, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProjectExplorerPlugin::addToApplicationOutputWindowInline(RunControl *rc, const QString &line)
|
||||||
|
{
|
||||||
|
m_outputPane->appendOutputInline(rc, line);
|
||||||
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::addErrorToApplicationOutputWindow(RunControl *rc, const QString &error)
|
void ProjectExplorerPlugin::addErrorToApplicationOutputWindow(RunControl *rc, const QString &error)
|
||||||
{
|
{
|
||||||
m_outputPane->appendOutput(rc, error);
|
m_outputPane->appendOutput(rc, error);
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ private slots:
|
|||||||
void updateRunAction();
|
void updateRunAction();
|
||||||
|
|
||||||
void addToApplicationOutputWindow(RunControl *, const QString &line);
|
void addToApplicationOutputWindow(RunControl *, const QString &line);
|
||||||
|
void addToApplicationOutputWindowInline(RunControl *, const QString &line);
|
||||||
void addErrorToApplicationOutputWindow(RunControl *, const QString &error);
|
void addErrorToApplicationOutputWindow(RunControl *, const QString &error);
|
||||||
void updateTaskActions();
|
void updateTaskActions();
|
||||||
|
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ public:
|
|||||||
QSharedPointer<RunConfiguration> runConfiguration();
|
QSharedPointer<RunConfiguration> runConfiguration();
|
||||||
signals:
|
signals:
|
||||||
void addToOutputWindow(RunControl *, const QString &line);
|
void addToOutputWindow(RunControl *, const QString &line);
|
||||||
|
void addToOutputWindowInline(RunControl *, const QString &line);
|
||||||
void error(RunControl *, const QString &error);
|
void error(RunControl *, const QString &error);
|
||||||
void started();
|
void started();
|
||||||
void finished();
|
void finished();
|
||||||
|
|||||||
Reference in New Issue
Block a user