mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 13:58:51 +03:00
Merge pull request #1199 from Gelmir/stats_new
Minor improvements to stats gathering/dialog
This commit is contained in:
commit
e6b20d461e
6 changed files with 12 additions and 8 deletions
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB |
BIN
src/Icons/oxygen/view-statistics.png
Normal file
BIN
src/Icons/oxygen/view-statistics.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -294,7 +294,6 @@
|
||||||
<file>Icons/oxygen/network-server.png</file>
|
<file>Icons/oxygen/network-server.png</file>
|
||||||
<file>Icons/oxygen/network-wired.png</file>
|
<file>Icons/oxygen/network-wired.png</file>
|
||||||
<file>Icons/oxygen/object-locked.png</file>
|
<file>Icons/oxygen/object-locked.png</file>
|
||||||
<file>Icons/oxygen/office-chart-bar.png</file>
|
|
||||||
<file>Icons/oxygen/preferences-desktop.png</file>
|
<file>Icons/oxygen/preferences-desktop.png</file>
|
||||||
<file>Icons/oxygen/preferences-other.png</file>
|
<file>Icons/oxygen/preferences-other.png</file>
|
||||||
<file>Icons/oxygen/preferences-system-network.png</file>
|
<file>Icons/oxygen/preferences-system-network.png</file>
|
||||||
|
@ -315,6 +314,7 @@
|
||||||
<file>Icons/oxygen/view-filter.png</file>
|
<file>Icons/oxygen/view-filter.png</file>
|
||||||
<file>Icons/oxygen/view-preview.png</file>
|
<file>Icons/oxygen/view-preview.png</file>
|
||||||
<file>Icons/oxygen/view-refresh.png</file>
|
<file>Icons/oxygen/view-refresh.png</file>
|
||||||
|
<file>Icons/oxygen/view-statistics.png</file>
|
||||||
<file>Icons/oxygen/wallet-open.png</file>
|
<file>Icons/oxygen/wallet-open.png</file>
|
||||||
<file>Icons/oxygen/webui.png</file>
|
<file>Icons/oxygen/webui.png</file>
|
||||||
<file>Icons/skin/arrow-right.gif</file>
|
<file>Icons/skin/arrow-right.gif</file>
|
||||||
|
|
|
@ -127,7 +127,7 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa
|
||||||
actionSet_global_download_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/download.png")));
|
actionSet_global_download_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/download.png")));
|
||||||
actionCreate_torrent->setIcon(IconProvider::instance()->getIcon("document-edit"));
|
actionCreate_torrent->setIcon(IconProvider::instance()->getIcon("document-edit"));
|
||||||
actionAbout->setIcon(IconProvider::instance()->getIcon("help-about"));
|
actionAbout->setIcon(IconProvider::instance()->getIcon("help-about"));
|
||||||
actionStatistics->setIcon(IconProvider::instance()->getIcon("office-chart-bar"));
|
actionStatistics->setIcon(IconProvider::instance()->getIcon("view-statistics"));
|
||||||
actionBugReport->setIcon(IconProvider::instance()->getIcon("tools-report-bug"));
|
actionBugReport->setIcon(IconProvider::instance()->getIcon("tools-report-bug"));
|
||||||
actionDecreasePriority->setIcon(IconProvider::instance()->getIcon("go-down"));
|
actionDecreasePriority->setIcon(IconProvider::instance()->getIcon("go-down"));
|
||||||
actionDelete->setIcon(IconProvider::instance()->getIcon("list-remove"));
|
actionDelete->setIcon(IconProvider::instance()->getIcon("list-remove"));
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,8 @@ private:
|
||||||
// Will overflow at 15.9 EiB
|
// Will overflow at 15.9 EiB
|
||||||
quint64 alltimeUL;
|
quint64 alltimeUL;
|
||||||
quint64 alltimeDL;
|
quint64 alltimeDL;
|
||||||
|
quint64 sessionUL;
|
||||||
|
quint64 sessionDL;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TORRENTSPEEDMONITOR_H
|
#endif // TORRENTSPEEDMONITOR_H
|
||||||
|
|
Loading…
Reference in a new issue