Mercurial > hg > svcore
comparison base/ProgressPrinter.cpp @ 517:77b4ce536d8f
* print Done when done
author | Chris Cannam |
---|---|
date | Thu, 11 Dec 2008 11:30:15 +0000 |
parents | 1aefb666ecfc |
children | 5ebcf099dab0 |
comparison
equal
deleted
inserted
replaced
516:5ab561f664f2 | 517:77b4ce536d8f |
---|---|
52 } | 52 } |
53 | 53 |
54 void | 54 void |
55 ProgressPrinter::done() | 55 ProgressPrinter::done() |
56 { | 56 { |
57 setProgress(100); | 57 std::cerr << "\r" |
58 << m_prefix.toStdString() | |
59 << (m_prefix == "" ? "" : " ") | |
60 << "Done" << std::endl; | |
58 } | 61 } |
59 | 62 |
60 void | 63 void |
61 ProgressPrinter::setProgress(int progress) | 64 ProgressPrinter::setProgress(int progress) |
62 { | 65 { |
63 if (progress == m_lastProgress) return; | 66 if (progress == m_lastProgress) return; |
64 if (progress == 100) std::cerr << "\r\n"; | 67 std::cerr << "\r" |
65 else { | 68 << m_prefix.toStdString() |
66 std::cerr << "\r" | 69 << (m_prefix == "" ? "" : " "); |
67 << m_prefix.toStdString() | 70 if (m_definite) { |
68 << (m_prefix == "" ? "" : " "); | 71 std::cerr << progress << "%"; |
69 if (m_definite) { | 72 } else { |
70 std::cerr << progress << "%"; | 73 std::cerr << "|/-\\"[progress % 4]; |
71 } else { | |
72 std::cerr << "|/-\\"[progress % 4]; | |
73 } | |
74 } | 74 } |
75 m_lastProgress = progress; | 75 m_lastProgress = progress; |
76 } | 76 } |
77 | 77 |