mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 21:52:32 -06:00
fewer calls to hash()
This commit is contained in:
@@ -220,7 +220,7 @@ void QBtSession::processBigRatios() {
|
||||
if (!h.is_valid()) continue;
|
||||
if (h.is_seed()) {
|
||||
const QString hash = h.hash();
|
||||
const qreal ratio = getRealRatio(hash);
|
||||
const qreal ratio = getRealRatio(h);
|
||||
qreal ratio_limit = TorrentPersistentData::getRatioLimit(hash);
|
||||
if (ratio_limit == TorrentPersistentData::USE_GLOBAL_RATIO)
|
||||
ratio_limit = global_ratio_limit;
|
||||
@@ -1556,8 +1556,7 @@ bool QBtSession::enableDHT(bool b) {
|
||||
return true;
|
||||
}
|
||||
|
||||
qreal QBtSession::getRealRatio(const QString &hash) const {
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
qreal QBtSession::getRealRatio(QTorrentHandle h) const {
|
||||
if (!h.is_valid()) {
|
||||
return 0.;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
qreal getPayloadUploadRate() const;
|
||||
libtorrent::session_status getSessionStatus() const;
|
||||
int getListenPort() const;
|
||||
qreal getRealRatio(const QString& hash) const;
|
||||
qreal getRealRatio(QTorrentHandle h) const;
|
||||
QHash<QString, TrackerInfos> getTrackersInfo(const QString &hash) const;
|
||||
bool hasActiveTorrents() const;
|
||||
bool hasDownloadingTorrents() const;
|
||||
|
||||
@@ -191,10 +191,10 @@ QVariant TorrentModelItem::data(int column, int role) const
|
||||
case TR_ETA: {
|
||||
// XXX: Is this correct?
|
||||
if (m_torrent.is_paused() || m_torrent.is_queued()) return MAX_ETA;
|
||||
return QBtSession::instance()->getETA(m_torrent.hash());
|
||||
return QBtSession::instance()->getETA(m_hash);
|
||||
}
|
||||
case TR_RATIO:
|
||||
return QBtSession::instance()->getRealRatio(m_torrent.hash());
|
||||
return QBtSession::instance()->getRealRatio(m_torrent);
|
||||
case TR_LABEL:
|
||||
return m_label;
|
||||
case TR_ADD_DATE:
|
||||
|
||||
Reference in New Issue
Block a user