forked from qt-creator/qt-creator
OutputWindow: Cleanup and modernize
Change-Id: Ie78c84e2677cabb144cfc678e5d1007fcae1f33a Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
André Hartmann
parent
30359f725e
commit
fff7e32877
@@ -49,7 +49,7 @@ namespace Internal {
|
|||||||
class OutputWindowPrivate
|
class OutputWindowPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OutputWindowPrivate(QTextDocument *document)
|
explicit OutputWindowPrivate(QTextDocument *document)
|
||||||
: cursor(document)
|
: cursor(document)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ OutputWindow::~OutputWindow()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputWindow::mousePressEvent(QMouseEvent * e)
|
void OutputWindow::mousePressEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
d->mouseButtonPressed = e->button();
|
d->mouseButtonPressed = e->button();
|
||||||
QPlainTextEdit::mousePressEvent(e);
|
QPlainTextEdit::mousePressEvent(e);
|
||||||
@@ -369,11 +369,11 @@ QString OutputWindow::doNewlineEnforcement(const QString &out)
|
|||||||
d->scrollToBottom = true;
|
d->scrollToBottom = true;
|
||||||
QString s = out;
|
QString s = out;
|
||||||
if (d->enforceNewline) {
|
if (d->enforceNewline) {
|
||||||
s.prepend(QLatin1Char('\n'));
|
s.prepend('\n');
|
||||||
d->enforceNewline = false;
|
d->enforceNewline = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s.endsWith(QLatin1Char('\n'))) {
|
if (s.endsWith('\n')) {
|
||||||
d->enforceNewline = true; // make appendOutputInline put in a newline next time
|
d->enforceNewline = true; // make appendOutputInline put in a newline next time
|
||||||
s.chop(1);
|
s.chop(1);
|
||||||
}
|
}
|
||||||
@@ -445,7 +445,7 @@ void OutputWindow::appendMessage(const QString &output, OutputFormat format)
|
|||||||
if (enforceNewline) {
|
if (enforceNewline) {
|
||||||
out.prepend('\n');
|
out.prepend('\n');
|
||||||
} else {
|
} else {
|
||||||
const int newline = out.indexOf(QLatin1Char('\n'));
|
const int newline = out.indexOf('\n');
|
||||||
moveCursor(QTextCursor::End);
|
moveCursor(QTextCursor::End);
|
||||||
if (newline != -1) {
|
if (newline != -1) {
|
||||||
if (d->formatter)
|
if (d->formatter)
|
||||||
@@ -457,7 +457,7 @@ void OutputWindow::appendMessage(const QString &output, OutputFormat format)
|
|||||||
if (out.isEmpty()) {
|
if (out.isEmpty()) {
|
||||||
d->enforceNewline = true;
|
d->enforceNewline = true;
|
||||||
} else {
|
} else {
|
||||||
if (out.endsWith(QLatin1Char('\n'))) {
|
if (out.endsWith('\n')) {
|
||||||
d->enforceNewline = true;
|
d->enforceNewline = true;
|
||||||
out.chop(1);
|
out.chop(1);
|
||||||
}
|
}
|
||||||
@@ -500,7 +500,7 @@ void OutputWindow::appendText(const QString &textIn, const QTextCharFormat &form
|
|||||||
tmp.setFontWeight(QFont::Bold);
|
tmp.setFontWeight(QFont::Bold);
|
||||||
d->cursor.insertText(doNewlineEnforcement(tr("Additional output omitted. You can increase "
|
d->cursor.insertText(doNewlineEnforcement(tr("Additional output omitted. You can increase "
|
||||||
"the limit in the \"Build & Run\" settings.")
|
"the limit in the \"Build & Run\" settings.")
|
||||||
+ QLatin1Char('\n')), tmp);
|
+ '\n'), tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->cursor.endEditBlock();
|
d->cursor.endEditBlock();
|
||||||
|
@@ -109,7 +109,7 @@ private:
|
|||||||
QString doNewlineEnforcement(const QString &out);
|
QString doNewlineEnforcement(const QString &out);
|
||||||
void filterNewContent();
|
void filterNewContent();
|
||||||
|
|
||||||
Internal::OutputWindowPrivate *d;
|
Internal::OutputWindowPrivate *d = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
Reference in New Issue
Block a user