mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-05 03:14:44 +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())+")";
|
leechs += " ("+QString::number(h.num_incomplete())+")";
|
||||||
event["num_leechs"] = QVariant(leechs);
|
event["num_leechs"] = QVariant(leechs);
|
||||||
event["seed"] = QVariant(h.is_seed());
|
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["hash"] = QVariant(hash);
|
||||||
event_list[hash] = event;
|
event_list[hash] = event;
|
||||||
}
|
}
|
||||||
|
@ -320,19 +320,11 @@ void PropertiesWidget::loadDynamicData() {
|
|||||||
else
|
else
|
||||||
lbl_connections->setText(QString::number(h.num_connections()));
|
lbl_connections->setText(QString::number(h.num_connections()));
|
||||||
// Update ratio info
|
// Update ratio info
|
||||||
float ratio;
|
double ratio = BTSession->getRealRatio(h.hash());
|
||||||
if(h.total_payload_download() == 0){
|
if(ratio > 100.)
|
||||||
if(h.total_payload_upload() == 0)
|
shareRatio->setText(QString::fromUtf8("∞"));
|
||||||
ratio = 1.;
|
else
|
||||||
else
|
shareRatio->setText(QString(QByteArray::number(ratio, 'f', 1)));
|
||||||
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)));
|
|
||||||
if(!h.is_seed()) {
|
if(!h.is_seed()) {
|
||||||
// Downloaded pieces
|
// Downloaded pieces
|
||||||
downloaded_pieces->setProgress(h.pieces());
|
downloaded_pieces->setProgress(h.pieces());
|
||||||
|
@ -101,10 +101,16 @@ var dynamicTable = new Class ({
|
|||||||
else
|
else
|
||||||
return (tr2.getElements('td')[i].get('html').split(' ')[0].toInt() - tr1.getElements('td')[i].get('html').split(' ')[0].toInt());
|
return (tr2.getElements('td')[i].get('html').split(' ')[0].toInt() - tr1.getElements('td')[i].get('html').split(' ')[0].toInt());
|
||||||
default: // Ratio
|
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")
|
if(order == "ASC")
|
||||||
return (tr1.getElements('td')[i].get('html').toFloat() - tr2.getElements('td')[i].get('html')).toFloat();
|
return (ratio1.toFloat() - ratio2.toFloat());
|
||||||
else
|
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