OutputFormatter: Make clearLastLine() virtual

Make sure subclasses can call clearLastLine() to at the same time
remove last line from the editor and QtOutputFormatter, where it
is buffered too.

Change-Id: I33910943b96d821018e936f72e0c32a96b844e15
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
Kai Koehne
2012-05-08 15:55:29 +02:00
parent b3416a57d7
commit cd46079734
3 changed files with 14 additions and 4 deletions

View File

@@ -66,7 +66,7 @@ public:
protected: protected:
void initFormats(); void initFormats();
void clearLastLine(); virtual void clearLastLine();
QTextCharFormat charFormat(OutputFormat format) const; QTextCharFormat charFormat(OutputFormat format) const;
static QColor mixColors(const QColor &a, const QColor &b); static QColor mixColors(const QColor &a, const QColor &b);

View File

@@ -145,18 +145,19 @@ void QtOutputFormatter::appendMessage(const QString &txt, Utils::OutputFormat fo
if (!m_lastLine.isEmpty()) { if (!m_lastLine.isEmpty()) {
// Line continuation // Line continuation
const QString newPart = txt.mid(start); const QString newPart = txt.mid(start);
m_lastLine.append(newPart); const QString line = m_lastLine + newPart;
LinkResult lr = matchLine(m_lastLine); LinkResult lr = matchLine(line);
if (!lr.href.isEmpty()) { if (!lr.href.isEmpty()) {
// Found something && line continuation // Found something && line continuation
cursor.insertText(deferedText, charFormat(format)); cursor.insertText(deferedText, charFormat(format));
deferedText.clear(); deferedText.clear();
clearLastLine(); clearLastLine();
appendLine(cursor, lr, m_lastLine, format); appendLine(cursor, lr, line, format);
} else { } else {
// Found nothing, just emit the new part // Found nothing, just emit the new part
deferedText += newPart; deferedText += newPart;
} }
m_lastLine = line;
} else { } else {
m_lastLine = txt.mid(start); m_lastLine = txt.mid(start);
LinkResult lr = matchLine(m_lastLine); LinkResult lr = matchLine(m_lastLine);
@@ -246,6 +247,12 @@ void QtOutputFormatter::handleLink(const QString &href)
} }
} }
void QtOutputFormatter::clearLastLine()
{
OutputFormatter::clearLastLine();
m_lastLine.clear();
}
void QtOutputFormatter::updateProjectFileList() void QtOutputFormatter::updateProjectFileList()
{ {
if (m_project) if (m_project)

View File

@@ -67,6 +67,9 @@ public:
Utils::OutputFormat format); Utils::OutputFormat format);
virtual void handleLink(const QString &href); virtual void handleLink(const QString &href);
protected:
void clearLastLine();
private slots: private slots:
void updateProjectFileList(); void updateProjectFileList();