mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-26 22:44:36 +00:00
- Fixed share ratio display in properties widget and in Web UI
This commit is contained in:
parent
9ada7c809b
commit
4908458729
@ -258,7 +258,11 @@ void EventManager::modifiedTorrent(QTorrentHandle h)
|
||||
leechs += " ("+QString::number(h.num_incomplete())+")";
|
||||
event["num_leechs"] = QVariant(leechs);
|
||||
event["seed"] = QVariant(h.is_seed());
|
||||
event["ratio"] = QVariant(QString::number(BTSession->getRealRatio(hash), 'f', 1));
|
||||
double ratio = BTSession->getRealRatio(hash);
|
||||
if(ratio > 100.)
|
||||
QString::fromUtf8("∞");
|
||||
else
|
||||
event["ratio"] = QVariant(QString::number(ratio, 'f', 1));
|
||||
event["hash"] = QVariant(hash);
|
||||
event_list[hash] = event;
|
||||
}
|
||||
|
@ -320,19 +320,11 @@ void PropertiesWidget::loadDynamicData() {
|
||||
else
|
||||
lbl_connections->setText(QString::number(h.num_connections()));
|
||||
// Update ratio info
|
||||
float ratio;
|
||||
if(h.total_payload_download() == 0){
|
||||
if(h.total_payload_upload() == 0)
|
||||
ratio = 1.;
|
||||
else
|
||||
ratio = 10.; // Max ratio
|
||||
}else{
|
||||
ratio = (double)h.total_payload_upload()/(double)h.total_payload_download();
|
||||
if(ratio > 10.){
|
||||
ratio = 10.;
|
||||
}
|
||||
}
|
||||
shareRatio->setText(QString(QByteArray::number(ratio, 'f', 1)));
|
||||
double ratio = BTSession->getRealRatio(h.hash());
|
||||
if(ratio > 100.)
|
||||
shareRatio->setText(QString::fromUtf8("∞"));
|
||||
else
|
||||
shareRatio->setText(QString(QByteArray::number(ratio, 'f', 1)));
|
||||
if(!h.is_seed()) {
|
||||
// Downloaded pieces
|
||||
downloaded_pieces->setProgress(h.pieces());
|
||||
|
@ -101,10 +101,16 @@ var dynamicTable = new Class ({
|
||||
else
|
||||
return (tr2.getElements('td')[i].get('html').split(' ')[0].toInt() - tr1.getElements('td')[i].get('html').split(' ')[0].toInt());
|
||||
default: // Ratio
|
||||
var ratio1 = tr1.getElements('td')[i].get('html');
|
||||
if(ratio1 == '∞')
|
||||
ratio1 = '101.0';
|
||||
var ratio2 = tr2.getElements('td')[i].get('html');
|
||||
if(ratio2 == '∞')
|
||||
ratio2 = '101.0';
|
||||
if(order == "ASC")
|
||||
return (tr1.getElements('td')[i].get('html').toFloat() - tr2.getElements('td')[i].get('html')).toFloat();
|
||||
return (ratio1.toFloat() - ratio2.toFloat());
|
||||
else
|
||||
return (tr2.getElements('td')[i].get('html').toFloat() - tr1.getElements('td')[i].get('html')).toFloat();
|
||||
return (ratio2.toFloat() - ratio1.toFloat());
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user