|
|
@ -134,7 +134,9 @@ public: |
|
|
|
const qlonglong limit = index.data().toLongLong(); |
|
|
|
const qlonglong limit = index.data().toLongLong(); |
|
|
|
opt.displayAlignment = Qt::AlignRight; |
|
|
|
opt.displayAlignment = Qt::AlignRight; |
|
|
|
if (limit > 0) |
|
|
|
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 |
|
|
|
else |
|
|
|
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("∞")); |
|
|
|
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("∞")); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -160,7 +162,9 @@ public: |
|
|
|
if (ratio > QBtSession::MAX_RATIO) |
|
|
|
if (ratio > QBtSession::MAX_RATIO) |
|
|
|
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("∞")); |
|
|
|
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("∞")); |
|
|
|
else |
|
|
|
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; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
case TorrentModelItem::TR_PRIORITY: { |
|
|
|
case TorrentModelItem::TR_PRIORITY: { |
|
|
@ -177,13 +181,11 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
case TorrentModelItem::TR_PROGRESS:{ |
|
|
|
case TorrentModelItem::TR_PROGRESS:{ |
|
|
|
QStyleOptionProgressBarV2 newopt; |
|
|
|
QStyleOptionProgressBarV2 newopt; |
|
|
|
qreal progress = index.data().toDouble()*100.; |
|
|
|
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.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.progress = (int)progress; |
|
|
|
newopt.maximum = 100; |
|
|
|
newopt.maximum = 100; |
|
|
|
newopt.minimum = 0; |
|
|
|
newopt.minimum = 0; |
|
|
|