Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adjust the default output of the DlProcess class to "??" instead of -…

…1. This provides a much more "human-readable" output for errors or invalid information (easier to check programattically too).
  • Loading branch information...
commit 23e7b34196268145dc563ac2cf5311fda25745e0 1 parent 5b19f8b
@beanpole135 beanpole135 authored
Showing with 11 additions and 7 deletions.
  1. +11 −7 src-qt4/libpcbsd/utils/pcbsd-DLProcess.cpp
View
18 src-qt4/libpcbsd/utils/pcbsd-DLProcess.cpp
@@ -94,26 +94,30 @@ void DLProcess::calculateStats(QString current, QString total, QString speed, QS
percent = -1;
}
//Check if total is known
- if(!totok){
+ if(!totok && curok){
//Only Current is known
tot = cur; //output current instead of total since no percent either
}
//OTHER input (speed, filename)
- QString other;
+ QString other = "??";
//Check the speed
if(!speed.isEmpty()){
spd = speed.toDouble(&spdok);
- if(spdok && spd==0){ spdok=false; }
- if(!spdok){
- spd = -1; //unknown
+ if(spdok && spd<=0){ spdok=false; }
+ if(spdok){
+ other = kbToString(spd)+"/s";
}
- other = kbToString(spd)+"/s";
//Check for a filename instead
}else if(!filename.isEmpty() ){
other = filename;
}
//Now emit the stats
- emit UpdatePercent(QString::number(percent), kbToString(tot), other);
+ QString perc = "??";
+ if(percent >= 0){ perc = QString::number(percent); }
+ QString tota = "??";
+ if(tot >= 0){ tota = kbToString(tot); }
+
+ emit UpdatePercent(perc, tota, other);
}
void DLProcess::parsePBILine(QString line){
Please sign in to comment.
Something went wrong with that request. Please try again.