1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-10 14:57:52 +00:00

Code optimization

This commit is contained in:
Christophe Dumez 2011-04-17 15:00:48 +00:00
parent 104ebbc9a1
commit 0ead6f72c6
3 changed files with 11 additions and 3 deletions

View File

@ -373,7 +373,7 @@ void PropertiesWidget::loadDynamicData() {
std::vector<int> avail;
h.piece_availability(avail);
pieces_availability->setAvailability(avail);
avail_average_lbl->setText(QString::number(h.status().distributed_copies, 'f', 3));
avail_average_lbl->setText(QString::number(h.distributed_copies(), 'f', 3));
} else {
showPiecesAvailability(false);
}

View File

@ -559,13 +559,20 @@ void QTorrentHandle::downloading_pieces(bitfield &bf) const {
bool QTorrentHandle::has_metadata() const {
#if LIBTORRENT_VERSION_MINOR > 15
torrent_status st = torrent_handle::status(0x0);
return st.has_metadata;
return torrent_handle::status(query_distributed_copies).has_metadata;
#else
return torrent_handle::has_metadata();
#endif
}
float QTorrentHandle::distributed_copies() const {
#if LIBTORRENT_VERSION_MINOR > 15
return torrent_handle::status(0x0).distributed_copies;
#else
return torrent_handle::status().distributed_copies;
#endif
}
//
// Setters
//

View File

@ -118,6 +118,7 @@ public:
QString error() const;
void downloading_pieces(libtorrent::bitfield &bf) const;
bool has_metadata() const;
float distributed_copies() const;
//
// Setters