aboutsummaryrefslogtreecommitdiffstats
path: root/reporthandler.cpp
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-06-09 15:15:46 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:05 -0300
commit3e2500cab4c5a8b0bd0fb532ca6ed155c36c6dd5 (patch)
treee4276d953dac106b9debd43608925cb2669fd283 /reporthandler.cpp
parent3649c91f1bdad3ce7db3ff895ae40edf06fc232e (diff)
Fixed warning message output.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>, Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'reporthandler.cpp')
-rw-r--r--reporthandler.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/reporthandler.cpp b/reporthandler.cpp
index bc8729dc..22f7da6b 100644
--- a/reporthandler.cpp
+++ b/reporthandler.cpp
@@ -59,6 +59,18 @@ static void printProgress()
m_progressBuffer.clear();
}
+static void printWarnings()
+{
+ if (m_reportedWarnings.size() > 0) {
+ m_progressBuffer += "\t";
+ foreach(QString msg, m_reportedWarnings)
+ m_progressBuffer += msg + "\n\t";
+ m_progressBuffer += "\n\n";
+ m_reportedWarnings.clear();
+ printProgress();
+ }
+}
+
ReportHandler::DebugLevel ReportHandler::debugLevel()
{
return m_debugLevel;
@@ -111,12 +123,9 @@ void ReportHandler::warning(const QString &text)
if (db && db->isSuppressedWarning(text)) {
++m_suppressedCount;
} else if (!m_reportedWarnings.contains(text)) {
- m_progressBuffer = (m_step_warning == 0 ? "[" COLOR_YELLOW "WARNING" COLOR_END "]\n" : "") + text + "\n";
- printProgress();
++m_warningCount;
++m_step_warning;
-
- m_reportedWarnings.insert(text);
+ m_reportedWarnings << text;
}
}
@@ -137,12 +146,20 @@ void ReportHandler::progress(const QString& str, ...)
if (m_step >= m_step_size) {
if (m_step_warning == 0) {
m_progressBuffer = "[" COLOR_GREEN "OK" COLOR_END "]\n";
- printProgress();
+ } else {
+ m_progressBuffer = "[" COLOR_YELLOW "WARNING" COLOR_END "]\n";
}
+ printProgress();
m_step_warning = 0;
}
}
+void ReportHandler::flush()
+{
+ if (!m_silent)
+ printWarnings();
+}
+
void ReportHandler::debug(DebugLevel level, const QString &text)
{
if (m_debugLevel == NoDebug)