Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
Adjust the default output of the DlProcess class to "??" instead of -…
Browse files Browse the repository at this point in the history
…1. This provides a much more "human-readable" output for errors or invalid information (easier to check programattically too).
  • Loading branch information
Ken Moore committed Mar 5, 2014
1 parent 5b19f8b commit 23e7b34
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src-qt4/libpcbsd/utils/pcbsd-DLProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down

0 comments on commit 23e7b34

Please sign in to comment.