|
|
@ -159,12 +159,12 @@ qlonglong TorrentSpeedMonitor::getETA(const QString &hash) const |
|
|
|
|
|
|
|
|
|
|
|
quint64 TorrentSpeedMonitor::getAlltimeDL() const { |
|
|
|
quint64 TorrentSpeedMonitor::getAlltimeDL() const { |
|
|
|
QMutexLocker l(&m_mutex); |
|
|
|
QMutexLocker l(&m_mutex); |
|
|
|
return alltimeDL; |
|
|
|
return alltimeDL + sessionDL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
quint64 TorrentSpeedMonitor::getAlltimeUL() const { |
|
|
|
quint64 TorrentSpeedMonitor::getAlltimeUL() const { |
|
|
|
QMutexLocker l(&m_mutex); |
|
|
|
QMutexLocker l(&m_mutex); |
|
|
|
return alltimeUL; |
|
|
|
return alltimeUL + sessionUL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void TorrentSpeedMonitor::getSamples() |
|
|
|
void TorrentSpeedMonitor::getSamples() |
|
|
@ -180,18 +180,19 @@ void TorrentSpeedMonitor::getSamples() |
|
|
|
int up = st.upload_payload_rate; |
|
|
|
int up = st.upload_payload_rate; |
|
|
|
int down = st.download_payload_rate; |
|
|
|
int down = st.download_payload_rate; |
|
|
|
m_samples[misc::toQString(it->info_hash())].addSample(down, up); |
|
|
|
m_samples[misc::toQString(it->info_hash())].addSample(down, up); |
|
|
|
alltimeDL += down; |
|
|
|
|
|
|
|
alltimeUL += up; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} catch(invalid_handle&) {} |
|
|
|
} catch(invalid_handle&) {} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
libtorrent::session_status ss = m_session->getSessionStatus(); |
|
|
|
|
|
|
|
sessionDL = ss.total_download; |
|
|
|
|
|
|
|
sessionUL = ss.total_upload; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void TorrentSpeedMonitor::saveStats() const { |
|
|
|
void TorrentSpeedMonitor::saveStats() const { |
|
|
|
QIniSettings s; |
|
|
|
QIniSettings s; |
|
|
|
QVariantHash v; |
|
|
|
QVariantHash v; |
|
|
|
v.insert("AlltimeDL", alltimeDL); |
|
|
|
v.insert("AlltimeDL", alltimeDL + sessionDL); |
|
|
|
v.insert("AlltimeUL", alltimeUL); |
|
|
|
v.insert("AlltimeUL", alltimeUL + sessionUL); |
|
|
|
s.setValue("Stats/AllStats", v); |
|
|
|
s.setValue("Stats/AllStats", v); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -200,4 +201,5 @@ void TorrentSpeedMonitor::loadStats() { |
|
|
|
QVariantHash v(s.value("Stats/AllStats", QVariantHash()).toHash()); |
|
|
|
QVariantHash v(s.value("Stats/AllStats", QVariantHash()).toHash()); |
|
|
|
alltimeDL = v["AlltimeDL"].toULongLong(); |
|
|
|
alltimeDL = v["AlltimeDL"].toULongLong(); |
|
|
|
alltimeUL = v["AlltimeUL"].toULongLong(); |
|
|
|
alltimeUL = v["AlltimeUL"].toULongLong(); |
|
|
|
|
|
|
|
sessionDL = sessionUL = 0; |
|
|
|
} |
|
|
|
} |
|
|
|