QtOutputFormatter: Fix style issues

Change-Id: I9f97b5c545639217155fb46dfd32af3b435f00a5
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
Kai Koehne
2012-05-08 16:00:29 +02:00
parent cd46079734
commit b3a3072edd
2 changed files with 19 additions and 20 deletions

View File

@@ -102,7 +102,7 @@ void QtOutputFormatter::appendMessage(const QString &txt, Utils::OutputFormat fo
cursor.movePosition(QTextCursor::End); cursor.movePosition(QTextCursor::End);
cursor.beginEditBlock(); cursor.beginEditBlock();
QString deferedText; QString deferredText;
int start = 0; int start = 0;
int pos = txt.indexOf(QLatin1Char('\n')); int pos = txt.indexOf(QLatin1Char('\n'));
@@ -115,13 +115,13 @@ void QtOutputFormatter::appendMessage(const QString &txt, Utils::OutputFormat fo
LinkResult lr = matchLine(line); 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(deferredText, charFormat(format));
deferedText.clear(); deferredText.clear();
clearLastLine(); clearLastLine();
appendLine(cursor, lr, line, format); appendLine(cursor, lr, line, format);
} else { } else {
// Found nothing, just emit the new part // Found nothing, just emit the new part
deferedText += newPart; deferredText += newPart;
} }
// Handled line continuation // Handled line continuation
m_lastLine.clear(); m_lastLine.clear();
@@ -129,11 +129,11 @@ void QtOutputFormatter::appendMessage(const QString &txt, Utils::OutputFormat fo
const QString line = txt.mid(start, pos - start + 1); const QString line = txt.mid(start, pos - start + 1);
LinkResult lr = matchLine(line); LinkResult lr = matchLine(line);
if (!lr.href.isEmpty()) { if (!lr.href.isEmpty()) {
cursor.insertText(deferedText, charFormat(format)); cursor.insertText(deferredText, charFormat(format));
deferedText.clear(); deferredText.clear();
appendLine(cursor, lr, line, format); appendLine(cursor, lr, line, format);
} else { } else {
deferedText += line; deferredText += line;
} }
} }
start = pos + 1; start = pos + 1;
@@ -149,29 +149,28 @@ void QtOutputFormatter::appendMessage(const QString &txt, Utils::OutputFormat fo
LinkResult lr = matchLine(line); 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(deferredText, charFormat(format));
deferedText.clear(); deferredText.clear();
clearLastLine(); clearLastLine();
appendLine(cursor, lr, line, format); appendLine(cursor, lr, line, format);
} else { } else {
// Found nothing, just emit the new part // Found nothing, just emit the new part
deferedText += newPart; deferredText += newPart;
} }
m_lastLine = line; 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);
if (!lr.href.isEmpty()) { if (!lr.href.isEmpty()) {
cursor.insertText(deferedText, charFormat(format)); cursor.insertText(deferredText, charFormat(format));
deferedText.clear(); deferredText.clear();
appendLine(cursor, lr, m_lastLine, format); appendLine(cursor, lr, m_lastLine, format);
} else { } else {
deferedText += m_lastLine; deferredText += m_lastLine;
} }
} }
} }
cursor.insertText(deferedText, charFormat(format)); cursor.insertText(deferredText, charFormat(format));
// deferedText.clear();
cursor.endEditBlock(); cursor.endEditBlock();
} }

View File

@@ -61,11 +61,11 @@ class QTSUPPORT_EXPORT QtOutputFormatter
{ {
Q_OBJECT Q_OBJECT
public: public:
QtOutputFormatter(ProjectExplorer::Project *project); explicit QtOutputFormatter(ProjectExplorer::Project *project);
virtual void appendMessage(const QString &text, void appendMessage(const QString &text,
Utils::OutputFormat format); Utils::OutputFormat format);
virtual void handleLink(const QString &href); void handleLink(const QString &href);
protected: protected:
void clearLastLine(); void clearLastLine();
@@ -75,8 +75,8 @@ private slots:
private: private:
LinkResult matchLine(const QString &line) const; LinkResult matchLine(const QString &line) const;
void appendLine(QTextCursor & cursor, LinkResult lr, void appendLine(QTextCursor &cursor, LinkResult lr, const QString &line,
const QString &line, Utils::OutputFormat); Utils::OutputFormat);
mutable QRegExp m_qmlError; mutable QRegExp m_qmlError;
mutable QRegExp m_qtError; mutable QRegExp m_qtError;