mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-24 10:16:00 +03:00
Fix torrent availability computation
This commit is contained in:
parent
4fd10bc5f5
commit
f61bccf700
2 changed files with 3 additions and 4 deletions
|
@ -51,7 +51,7 @@ public:
|
||||||
setFixedHeight(BAR_HEIGHT);
|
setFixedHeight(BAR_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
double setAvailability(const std::vector<int>& avail) {
|
void setAvailability(const std::vector<int>& avail) {
|
||||||
double average = 0;
|
double average = 0;
|
||||||
if(avail.empty()) {
|
if(avail.empty()) {
|
||||||
// Empty bar
|
// Empty bar
|
||||||
|
@ -95,7 +95,6 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
return average;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
|
|
|
@ -355,8 +355,8 @@ void PropertiesWidget::loadDynamicData() {
|
||||||
showPiecesAvailability(true);
|
showPiecesAvailability(true);
|
||||||
std::vector<int> avail;
|
std::vector<int> avail;
|
||||||
h.piece_availability(avail);
|
h.piece_availability(avail);
|
||||||
double avail_average = pieces_availability->setAvailability(avail);
|
pieces_availability->setAvailability(avail);
|
||||||
avail_average_lbl->setText(QString::number(avail_average, 'f', 1));
|
avail_average_lbl->setText(QString::number(h.get_torrent_handle().status().distributed_copies, 'f', 1));
|
||||||
} else {
|
} else {
|
||||||
showPiecesAvailability(false);
|
showPiecesAvailability(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue