Changeset 23e7b34


Ignore:
Timestamp:
03/05/14 07:31:15 (8 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
0ed0d02
Parents:
5b19f8b
Message:

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).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/libpcbsd/utils/pcbsd-DLProcess.cpp

    r2e26400 r23e7b34  
    9595  }      
    9696  //Check if total is known   
    97   if(!totok){ 
     97  if(!totok && curok){ 
    9898    //Only Current is known 
    9999    tot = cur; //output current instead of total since no percent either 
    100100  } 
    101101  //OTHER input (speed, filename) 
    102   QString other; 
     102  QString other = "??"; 
    103103  //Check the speed 
    104104  if(!speed.isEmpty()){ 
    105105    spd = speed.toDouble(&spdok); 
    106     if(spdok && spd==0){ spdok=false; } 
    107     if(!spdok){ 
    108       spd = -1; //unknown 
     106    if(spdok && spd<=0){ spdok=false; } 
     107    if(spdok){ 
     108      other = kbToString(spd)+"/s"; 
    109109    } 
    110     other = kbToString(spd)+"/s"; 
    111110  //Check for a filename instead 
    112111  }else if(!filename.isEmpty() ){ 
     
    114113  } 
    115114  //Now emit the stats 
    116   emit UpdatePercent(QString::number(percent), kbToString(tot), other); 
     115  QString perc = "??"; 
     116  if(percent >= 0){ perc = QString::number(percent); } 
     117  QString tota = "??"; 
     118  if(tot >= 0){ tota = kbToString(tot); } 
     119   
     120  emit UpdatePercent(perc, tota, other); 
    117121} 
    118122 
Note: See TracChangeset for help on using the changeset viewer.