forked from qt-creator/qt-creator
debugger: make shrinking of log buffer faster
Change-Id: I09ff0bf0c5fcc7df5c5dc9a05752754faee9320a Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -156,7 +156,6 @@ public:
|
||||
DebuggerPane(QWidget *parent)
|
||||
: QPlainTextEdit(parent)
|
||||
{
|
||||
setMaximumBlockCount(100000);
|
||||
setFrameStyle(QFrame::NoFrame);
|
||||
m_clearContentsAction = new QAction(this);
|
||||
m_clearContentsAction->setText(tr("Clear Contents"));
|
||||
@@ -183,6 +182,18 @@ public:
|
||||
delete menu;
|
||||
}
|
||||
|
||||
void append(const QString &text)
|
||||
{
|
||||
const int N = 100000;
|
||||
if (blockCount() > N) {
|
||||
QTextBlock block = document()->findBlock(9 * N / 10);
|
||||
QTextCursor tc(block);
|
||||
tc.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
|
||||
tc.removeSelectedText();
|
||||
}
|
||||
appendPlainText(text);
|
||||
}
|
||||
|
||||
|
||||
private slots:
|
||||
void saveContents();
|
||||
@@ -434,7 +445,7 @@ void LogWindow::showOutput(int channel, const QString &output)
|
||||
}
|
||||
pos = nnpos + 1;
|
||||
}
|
||||
m_combinedText->appendPlainText(out);
|
||||
m_combinedText->append(out);
|
||||
|
||||
if (atEnd) {
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
@@ -455,8 +466,8 @@ void LogWindow::showInput(int channel, const QString &input)
|
||||
return;
|
||||
}
|
||||
if (debuggerCore()->boolSetting(LogTimeStamps))
|
||||
m_inputText->appendPlainText(logTimeStamp());
|
||||
m_inputText->appendPlainText(input);
|
||||
m_inputText->append(logTimeStamp());
|
||||
m_inputText->append(input);
|
||||
QTextCursor cursor = m_inputText->textCursor();
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
m_inputText->setTextCursor(cursor);
|
||||
|
@@ -47,6 +47,8 @@ QT_END_NAMESPACE
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
class DebuggerPane;
|
||||
|
||||
class LogWindow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -78,8 +80,8 @@ signals:
|
||||
void statusMessageRequested(const QString &msg, int);
|
||||
|
||||
private:
|
||||
QPlainTextEdit *m_combinedText; // combined input/output
|
||||
QPlainTextEdit *m_inputText; // scriptable input alone
|
||||
DebuggerPane *m_combinedText; // combined input/output
|
||||
DebuggerPane *m_inputText; // scriptable input alone
|
||||
QLineEdit *m_commandEdit;
|
||||
QLabel *m_commandLabel;
|
||||
bool m_ignoreNextInputEcho;
|
||||
|
Reference in New Issue
Block a user