summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-03-22 16:24:05 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2010-03-22 16:24:05 (GMT)
commit079b57230c5ccdf0fa4769e913a935047e789ff0 (patch)
tree9ada8a8b80901fb27ba8ea6939d7ce2c79ff40fb
parent259f5b62e76127318dccff592f9eb95ea726f306 (diff)
downloadQt-079b57230c5ccdf0fa4769e913a935047e789ff0.zip
Qt-079b57230c5ccdf0fa4769e913a935047e789ff0.tar.gz
Qt-079b57230c5ccdf0fa4769e913a935047e789ff0.tar.bz2
Replace download % display with a progress bar
This change is to avoid flooding the console when copying a large sis file (e.g. qt.sis) to the phone. Reviewed-by: axis
-rw-r--r--tools/runonphone/trksignalhandler.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/runonphone/trksignalhandler.cpp b/tools/runonphone/trksignalhandler.cpp
index 18a2c0c..2abf91f 100644
--- a/tools/runonphone/trksignalhandler.cpp
+++ b/tools/runonphone/trksignalhandler.cpp
@@ -54,6 +54,7 @@ private:
QTextStream out;
QTextStream err;
int loglevel;
+ int lastpercent;
};
void TrkSignalHandler::copyingStarted()
@@ -131,7 +132,12 @@ void TrkSignalHandler::applicationOutputReceived(const QString &output)
void TrkSignalHandler::copyProgress(int percent)
{
if (d->loglevel > 0) {
- d->out << percent << "% ";
+ if (d->lastpercent == 0)
+ d->out << "[ ]\r[" << flush;
+ while (percent > d->lastpercent) {
+ d->out << QLatin1Char('#');
+ d->lastpercent+=2; //because typical console is 80 chars wide
+ }
d->out.flush();
if (percent==100)
d->out << endl;
@@ -167,7 +173,8 @@ void TrkSignalHandler::timeout()
TrkSignalHandlerPrivate::TrkSignalHandlerPrivate()
: out(stdout),
err(stderr),
- loglevel(0)
+ loglevel(0),
+ lastpercent(0)
{
}