diff options
author | Renato Filho <renato.filho@openbossa.org> | 2010-06-08 15:27:02 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-09 19:10:04 -0300 |
commit | 2cf5be8e2354e81298ab0df8c328949845143604 (patch) | |
tree | 434704ea20d8e69ebf6ac11b69967ebae970b5e2 /reporthandler.cpp | |
parent | 4b3801acb8ecbd95f73ee92e16f2a10f5a1a8c39 (diff) |
Make the progress message funny.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>,
Hugo Parente Lima <hugo.lima@openbossa.org>
Diffstat (limited to 'reporthandler.cpp')
-rw-r--r-- | reporthandler.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/reporthandler.cpp b/reporthandler.cpp index 03b580a3a..bc8729dcc 100644 --- a/reporthandler.cpp +++ b/reporthandler.cpp @@ -50,11 +50,13 @@ static QSet<QString> m_reportedWarnings; static QString m_progressBuffer; static int m_step_size = 0; static int m_step = -1; +static int m_step_warning = 0; static void printProgress() { std::printf("%s", m_progressBuffer.toAscii().data()); std::fflush(stdout); + m_progressBuffer.clear(); } ReportHandler::DebugLevel ReportHandler::debugLevel() @@ -105,15 +107,14 @@ void ReportHandler::warning(const QString &text) // Context is useless! // QString warningText = QString("\r" COLOR_YELLOW "WARNING(%1)" COLOR_END " :: %2").arg(m_context).arg(text); - QString warningText = QString("\033[1K\r" COLOR_YELLOW "WARNING" COLOR_END " :: %2").arg(text); - TypeDatabase *db = TypeDatabase::instance(); if (db && db->isSuppressedWarning(text)) { ++m_suppressedCount; } else if (!m_reportedWarnings.contains(text)) { - std::puts(qPrintable(warningText)); + m_progressBuffer = (m_step_warning == 0 ? "[" COLOR_YELLOW "WARNING" COLOR_END "]\n" : "") + text + "\n"; printProgress(); ++m_warningCount; + ++m_step_warning; m_reportedWarnings.insert(text); } @@ -130,13 +131,15 @@ void ReportHandler::progress(const QString& str, ...) buf.setFieldAlignment(QTextStream::AlignLeft); buf << str; printProgress(); - m_step = 1; - } else { - m_step++; - if (m_step == m_step_size) { - m_progressBuffer = "[OK]\n"; - m_step = -1; + m_step = 0; + } + m_step++; + if (m_step >= m_step_size) { + if (m_step_warning == 0) { + m_progressBuffer = "[" COLOR_GREEN "OK" COLOR_END "]\n"; + printProgress(); } + m_step_warning = 0; } } |