debugger: speed up logging by collecting bigger chunks

Change-Id: Ie2171e0afdc0e3296f57974b1e4e5ee952658626
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2012-06-28 08:15:50 +02:00
parent 27fbe170d4
commit 68ce7a667b
2 changed files with 24 additions and 5 deletions

View File

@@ -394,6 +394,8 @@ LogWindow::LogWindow(QWidget *parent)
connect(m_inputText, SIGNAL(executeLineRequested()), connect(m_inputText, SIGNAL(executeLineRequested()),
SLOT(executeLine())); SLOT(executeLine()));
connect(&m_outputTimer, SIGNAL(timeout()), SLOT(doOutput()));
setMinimumHeight(60); setMinimumHeight(60);
} }
@@ -414,9 +416,6 @@ void LogWindow::showOutput(int channel, const QString &output)
if (output.isEmpty()) if (output.isEmpty())
return; return;
QTextCursor cursor = m_combinedText->textCursor();
const bool atEnd = cursor.atEnd();
const QChar cchar = charForChannel(channel); const QChar cchar = charForChannel(channel);
const QChar nchar = QLatin1Char('\n'); const QChar nchar = QLatin1Char('\n');
@@ -445,7 +444,24 @@ void LogWindow::showOutput(int channel, const QString &output)
} }
pos = nnpos + 1; pos = nnpos + 1;
} }
m_combinedText->append(out); if (!out.endsWith(nchar))
out.append(nchar);
m_queuedOutput.append(out);
m_outputTimer.setSingleShot(true);
m_outputTimer.start(80);
}
void LogWindow::doOutput()
{
if (m_queuedOutput.isEmpty())
return;
QTextCursor cursor = m_combinedText->textCursor();
const bool atEnd = cursor.atEnd();
m_combinedText->append(m_queuedOutput);
m_queuedOutput.clear();
if (atEnd) { if (atEnd) {
cursor.movePosition(QTextCursor::End); cursor.movePosition(QTextCursor::End);

View File

@@ -36,6 +36,7 @@
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include <QWidget> #include <QWidget>
#include <QTimer>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QCursor; class QCursor;
@@ -74,6 +75,7 @@ public slots:
void executeLine(); void executeLine();
void showOutput(int channel, const QString &output); void showOutput(int channel, const QString &output);
void showInput(int channel, const QString &input); void showInput(int channel, const QString &input);
void doOutput();
signals: signals:
void showPage(); void showPage();
@@ -82,12 +84,13 @@ signals:
private: private:
DebuggerPane *m_combinedText; // combined input/output DebuggerPane *m_combinedText; // combined input/output
DebuggerPane *m_inputText; // scriptable input alone DebuggerPane *m_inputText; // scriptable input alone
QTimer m_outputTimer;
QString m_queuedOutput;
QLineEdit *m_commandEdit; QLineEdit *m_commandEdit;
QLabel *m_commandLabel; QLabel *m_commandLabel;
bool m_ignoreNextInputEcho; bool m_ignoreNextInputEcho;
}; };
} // namespace Internal } // namespace Internal
} // namespace Debugger } // namespace Debugger