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:
void initFormats();
void clearLastLine();
virtual void clearLastLine();
QTextCharFormat charFormat(OutputFormat format) const;
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()) {
// Line continuation
const QString newPart = txt.mid(start);
m_lastLine.append(newPart);
LinkResult lr = matchLine(m_lastLine);
const QString line = m_lastLine + newPart;
LinkResult lr = matchLine(line);
if (!lr.href.isEmpty()) {
// Found something && line continuation
cursor.insertText(deferedText, charFormat(format));
deferedText.clear();
clearLastLine();
appendLine(cursor, lr, m_lastLine, format);
appendLine(cursor, lr, line, format);
} else {
// Found nothing, just emit the new part
deferedText += newPart;
}
m_lastLine = line;
} else {
m_lastLine = txt.mid(start);
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()
{
if (m_project)

View File

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