@ -66,12 +66,12 @@ public:
case TorrentModelItem : : TR_AMOUNT_UPLOADED :
case TorrentModelItem : : TR_AMOUNT_UPLOADED :
case TorrentModelItem : : TR_AMOUNT_LEFT :
case TorrentModelItem : : TR_AMOUNT_LEFT :
case TorrentModelItem : : TR_COMPLETED :
case TorrentModelItem : : TR_COMPLETED :
case TorrentModelItem : : TR_SIZE : {
case TorrentModelItem : : TR_SIZE : {
QItemDelegate : : drawBackground ( painter , opt , index ) ;
QItemDelegate : : drawBackground ( painter , opt , index ) ;
QItemDelegate : : drawDisplay ( painter , opt , option . rect , misc : : friendlyUnit ( index . data ( ) . toLongLong ( ) ) ) ;
QItemDelegate : : drawDisplay ( painter , opt , option . rect , misc : : friendlyUnit ( index . data ( ) . toLongLong ( ) ) ) ;
break ;
break ;
}
}
case TorrentModelItem : : TR_ETA : {
case TorrentModelItem : : TR_ETA : {
QItemDelegate : : drawBackground ( painter , opt , index ) ;
QItemDelegate : : drawBackground ( painter , opt , index ) ;
QItemDelegate : : drawDisplay ( painter , opt , option . rect , misc : : userFriendlyDuration ( index . data ( ) . toLongLong ( ) ) ) ;
QItemDelegate : : drawDisplay ( painter , opt , option . rect , misc : : userFriendlyDuration ( index . data ( ) . toLongLong ( ) ) ) ;
break ;
break ;
@ -134,14 +134,14 @@ public:
break ;
break ;
}
}
case TorrentModelItem : : TR_UPSPEED :
case TorrentModelItem : : TR_UPSPEED :
case TorrentModelItem : : TR_DLSPEED : {
case TorrentModelItem : : TR_DLSPEED : {
QItemDelegate : : drawBackground ( painter , opt , index ) ;
QItemDelegate : : drawBackground ( painter , opt , index ) ;
const qulonglong speed = index . data ( ) . toULongLong ( ) ;
const qulonglong speed = index . data ( ) . toULongLong ( ) ;
QItemDelegate : : drawDisplay ( painter , opt , opt . rect , misc : : friendlyUnit ( speed ) + tr ( " /s " , " /second (.i.e per second) " ) ) ;
QItemDelegate : : drawDisplay ( painter , opt , opt . rect , misc : : friendlyUnit ( speed ) + tr ( " /s " , " /second (.i.e per second) " ) ) ;
break ;
break ;
}
}
case TorrentModelItem : : TR_UPLIMIT :
case TorrentModelItem : : TR_UPLIMIT :
case TorrentModelItem : : TR_DLLIMIT : {
case TorrentModelItem : : TR_DLLIMIT : {
QItemDelegate : : drawBackground ( painter , opt , index ) ;
QItemDelegate : : drawBackground ( painter , opt , index ) ;
const qlonglong limit = index . data ( ) . toLongLong ( ) ;
const qlonglong limit = index . data ( ) . toLongLong ( ) ;
QItemDelegate : : drawDisplay ( painter , opt , opt . rect , limit > 0 ? misc : : accurateDoubleToString ( limit / 1024. , 1 ) + " " + tr ( " KiB/s " , " KiB/second (.i.e per second) " ) : QString : : fromUtf8 ( " ∞ " ) ) ;
QItemDelegate : : drawDisplay ( painter , opt , opt . rect , limit > 0 ? misc : : accurateDoubleToString ( limit / 1024. , 1 ) + " " + tr ( " KiB/s " , " KiB/second (.i.e per second) " ) : QString : : fromUtf8 ( " ∞ " ) ) ;
@ -161,10 +161,12 @@ public:
QItemDelegate : : drawBackground ( painter , opt , index ) ;
QItemDelegate : : drawBackground ( painter , opt , index ) ;
QItemDelegate : : drawDisplay ( painter , opt , opt . rect , index . data ( ) . toDateTime ( ) . toLocalTime ( ) . toString ( Qt : : DefaultLocaleShortDate ) ) ;
QItemDelegate : : drawDisplay ( painter , opt , opt . rect , index . data ( ) . toDateTime ( ) . toLocalTime ( ) . toString ( Qt : : DefaultLocaleShortDate ) ) ;
break ;
break ;
case TorrentModelItem : : TR_RATIO : {
case TorrentModelItem : : TR_RATIO_LIMIT :
case TorrentModelItem : : TR_RATIO : {
QItemDelegate : : drawBackground ( painter , opt , index ) ;
QItemDelegate : : drawBackground ( painter , opt , index ) ;
const qreal ratio = index . data ( ) . toDouble ( ) ;
const qreal ratio = index . data ( ) . toDouble ( ) ;
QItemDelegate : : drawDisplay ( painter , opt , opt . rect , ratio > QBtSession : : MAX_RATIO ? QString : : fromUtf8 ( " ∞ " ) : misc : : accurateDoubleToString ( ratio , 2 ) ) ;
QItemDelegate : : drawDisplay ( painter , opt , opt . rect ,
( ratio = = - 1 | | ratio > QBtSession : : MAX_RATIO ) ? QString : : fromUtf8 ( " ∞ " ) : misc : : accurateDoubleToString ( ratio , 2 ) ) ;
break ;
break ;
}
}
case TorrentModelItem : : TR_PRIORITY : {
case TorrentModelItem : : TR_PRIORITY : {
@ -177,7 +179,7 @@ public:
}
}
break ;
break ;
}
}
case TorrentModelItem : : TR_PROGRESS : {
case TorrentModelItem : : TR_PROGRESS : {
QStyleOptionProgressBarV2 newopt ;
QStyleOptionProgressBarV2 newopt ;
qreal progress = index . data ( ) . toDouble ( ) * 100. ;
qreal progress = index . data ( ) . toDouble ( ) * 100. ;
newopt . rect = opt . rect ;
newopt . rect = opt . rect ;