|
|
|
@ -134,7 +134,9 @@ public:
@@ -134,7 +134,9 @@ public:
|
|
|
|
|
const qlonglong limit = index.data().toLongLong(); |
|
|
|
|
opt.displayAlignment = Qt::AlignRight; |
|
|
|
|
if (limit > 0) |
|
|
|
|
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::number(limit/1024., 'f', 1) + " " + tr("KiB/s", "KiB/second (.i.e per second)")); |
|
|
|
|
/* HACK because QString rounds up. Eg QString::number(0.999*100.0, 'f' ,1) == 99.9
|
|
|
|
|
** but QString::number(0.9999*100.0, 'f' ,1) == 100.0 */ |
|
|
|
|
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::number((int)((limit/1024.)*10)/10.0, 'f', 1) + " " + tr("KiB/s", "KiB/second (.i.e per second)")); |
|
|
|
|
else |
|
|
|
|
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("∞")); |
|
|
|
|
break; |
|
|
|
@ -160,7 +162,9 @@ public:
@@ -160,7 +162,9 @@ public:
|
|
|
|
|
if (ratio > QBtSession::MAX_RATIO) |
|
|
|
|
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("∞")); |
|
|
|
|
else |
|
|
|
|
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::number(ratio, 'f', 2)); |
|
|
|
|
/* HACK because QString rounds up. Eg QString::number(0.999*100.0, 'f' ,1) == 99.9
|
|
|
|
|
** but QString::number(0.9999*100.0, 'f' ,1) == 100.0 */ |
|
|
|
|
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::number((int)(ratio*100)/100.0, 'f', 2)); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case TorrentModelItem::TR_PRIORITY: { |
|
|
|
@ -178,12 +182,10 @@ public:
@@ -178,12 +182,10 @@ public:
|
|
|
|
|
case TorrentModelItem::TR_PROGRESS:{ |
|
|
|
|
QStyleOptionProgressBarV2 newopt; |
|
|
|
|
qreal progress = index.data().toDouble()*100.; |
|
|
|
|
// We don't want to display 100% unless
|
|
|
|
|
// the torrent is really complete
|
|
|
|
|
if (progress > 99.94 && progress < 100.) |
|
|
|
|
progress = 99.9; |
|
|
|
|
newopt.rect = opt.rect; |
|
|
|
|
newopt.text = QString::number(progress, 'f', 1)+"%"; |
|
|
|
|
/* HACK because QString rounds up. Eg QString::number(0.999*100.0, 'f' ,1) == 99.9
|
|
|
|
|
** but QString::number(0.9999*100.0, 'f' ,1) == 100.0 */ |
|
|
|
|
newopt.text = QString::number((int)(progress*10)/10.0, 'f', 1)+"%"; |
|
|
|
|
newopt.progress = (int)progress; |
|
|
|
|
newopt.maximum = 100; |
|
|
|
|
newopt.minimum = 0; |
|
|
|
|