diff base/ProgressPrinter.cpp @ 439:beb2948baa77

* Merge revisions 1041 to 1130 from sv-rdf-import branch
author Chris Cannam
date Thu, 18 Sep 2008 12:09:32 +0000
parents cfd11e44ad87
children 1aefb666ecfc
line wrap: on
line diff
--- a/base/ProgressPrinter.cpp	Thu Aug 07 16:06:59 2008 +0000
+++ b/base/ProgressPrinter.cpp	Thu Sep 18 12:09:32 2008 +0000
@@ -20,7 +20,8 @@
 ProgressPrinter::ProgressPrinter(QString message, QObject *parent) :
     ProgressReporter(parent),
     m_prefix(message),
-    m_lastProgress(0)
+    m_lastProgress(0),
+    m_definite(true)
 {
 }
 
@@ -32,6 +33,18 @@
 //    std::cerr << "(progress printer dtor)" << std::endl;
 }
 
+bool
+ProgressPrinter::isDefinite() const
+{
+    return m_definite;
+}
+
+void
+ProgressPrinter::setDefinite(bool definite)
+{
+    m_definite = definite;
+}
+
 void
 ProgressPrinter::setMessage(QString message)
 {
@@ -46,8 +59,12 @@
     else {
         std::cerr << "\r"
                   << m_prefix.toStdString() 
-                  << (m_prefix == "" ? "" : " ")
-                  << progress << "%";
+                  << (m_prefix == "" ? "" : " ");
+        if (m_definite) {
+            std::cerr << progress << "%";
+        } else {
+            std::cerr << "|/-\\"[progress % 4];
+        }
     }
     m_lastProgress = progress;
 }