From 20086543de846649743e1c01ff8cf0468e773ee1 Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Mon, 23 Dec 2013 00:01:21 +0400 Subject: [PATCH] 1. Use a better icon for stats dialog. 2. Use more reliable session_status.total_download/upload for statistics --- src/Icons/oxygen/office-chart-bar.png | Bin 1874 -> 0 bytes src/Icons/oxygen/view-statistics.png | Bin 0 -> 1280 bytes src/icons.qrc | 2 +- src/mainwindow.cpp | 2 +- src/qtlibtorrent/torrentspeedmonitor.cpp | 14 ++++++++------ src/qtlibtorrent/torrentspeedmonitor.h | 2 ++ 6 files changed, 12 insertions(+), 8 deletions(-) delete mode 100644 src/Icons/oxygen/office-chart-bar.png create mode 100644 src/Icons/oxygen/view-statistics.png diff --git a/src/Icons/oxygen/office-chart-bar.png b/src/Icons/oxygen/office-chart-bar.png deleted file mode 100644 index dd8ae4e42755fe5c4c95d175640f8991871b2fc2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1874 zcmV-Y2d(&tP)e{sEOvKesa-weDDJtDTNB z#X40Sv4T}AOV+n0AsXBUt+o{`sAW^r5OrK|K}6iDf*=SkkU$a*plqVT%ggCGAz@Ml zr{jn8!g`y3Y{WZ&ML*DLwVY0;TaM4;f&&>D09ZVR z6fFKD%d%5~6huXG2&3tZu>(Kh49p6)|NrR#0+sPX7^L9m0D!@k;@e@s%OdcMAQ?t)wLf^& z)b4}!9v^tSWw`5=VGG)DEoO)k^c9DGd5RyTXt*K7x1Wzgcm)A07~BVhXi?yXf(La% zFEG3)jox&y_P)1!z}NS@U+(SemtBuv_{heKhPMK~w7ZI?v7BfegEE#Ejc=1(2<8~B z1Mgr5)Cgc!h+|$djblaAL`*b+lQJeC*8v~`7BS>kH#yp#LwolNpSSb5uhG*7Xlusy z#|V;XET4P%WJYoQBXjX>x4F31Efv+b@L5F(0;i)6M2$3rtMx25N96U4ZhKJ@mtWUr zDy-=+7S?u1g>{|UoJ;2gDPtTJ;r3l`rlRhSXNt3}PpN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R*9@O9`}l5l(jld+8KdWC*eBz#FI`oS|cCwr5K8(93rQQXLXu%9Q0zX zR+EkZ-V5EnhrhYdoj@4;MZ|NFw~0d7Wdd#U>COc6at7091n>h&iwTKqF~TaIs(! z01kncJy`}D01 zklzK&>XbT^x0iblaM83vUiI`53B(G@gg|9x2?R-np3YJd@zO5}E}#@N=eeA@3d{oN zm3ma3t@Iw?`wu~*#tP4iMJWooC)bT;4p*BG8QZj0FIJsz6kqto9z@n_|!> zk}6nI8z=*CS|%v4uKxL}J=nN+o@PGiwyoP-iRtYgFfK8ozNy}OfYZ64u{+*p$z3y_ zt%Sh3`bSe4UigS|n!?)xjZcZkE&HuG0E5ziUP~`7w_f%hpmitc`m6$$bRK}>KC~aH zz>A;SIZefz3L2LlhZ*|}G=c^yQH66O=P*sCA)FGt2WZ(2x^ed|CxEL7T~<{3;oFKT zB-YtDO?9T4#%9GrD{67Yas@q>9_MMOm9#*^e>jdC5+%C1D4osT>goY^B?Q(~UzdJ? zmb3OJWQxeRT4T9I;UiUZK4=qR!QGcm*SeLyeifl8L@OlYVanwKZp zrlvq-nN3D^T9vOaMvfgL>$|$ReO();p@|1Kff9?m0*(gMv#$?Mk)HKwG-iG1L-^W&U%s+OSuC93k=4F5x!N)D2~Ry%fdDk`1YYkP<@^ot28wdvrUTfc0>O%4Adkg;pw-ei zHb&SI*d58;q9R*@pP0>`nBW8tJ>pNdH#q>txETqGrT8)hc;nJA=O4T&n6d*217v^$ zFe;3|TP&_nr=w|XOg5Wcvv+F>{{HM;0(ft1j1xTY&{F#9Y34_UZwopBf>6JOY4#3s z{>EpF6rTY%%eL8Y1QW{ah1%Vq7L? z{17UM;`Q0o&R;uLqW0OpNOs?K&OhX-5IL+dOu8yuIcons/oxygen/network-server.png Icons/oxygen/network-wired.png Icons/oxygen/object-locked.png - Icons/oxygen/office-chart-bar.png Icons/oxygen/preferences-desktop.png Icons/oxygen/preferences-other.png Icons/oxygen/preferences-system-network.png @@ -315,6 +314,7 @@ Icons/oxygen/view-filter.png Icons/oxygen/view-preview.png Icons/oxygen/view-refresh.png + Icons/oxygen/view-statistics.png Icons/oxygen/wallet-open.png Icons/oxygen/webui.png Icons/skin/arrow-right.gif diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e7f24264a..54c3f475b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -127,7 +127,7 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa actionSet_global_download_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/download.png"))); actionCreate_torrent->setIcon(IconProvider::instance()->getIcon("document-edit")); 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")); actionDecreasePriority->setIcon(IconProvider::instance()->getIcon("go-down")); actionDelete->setIcon(IconProvider::instance()->getIcon("list-remove")); diff --git a/src/qtlibtorrent/torrentspeedmonitor.cpp b/src/qtlibtorrent/torrentspeedmonitor.cpp index 571671503..042e2a35a 100644 --- a/src/qtlibtorrent/torrentspeedmonitor.cpp +++ b/src/qtlibtorrent/torrentspeedmonitor.cpp @@ -159,12 +159,12 @@ qlonglong TorrentSpeedMonitor::getETA(const QString &hash) const quint64 TorrentSpeedMonitor::getAlltimeDL() const { QMutexLocker l(&m_mutex); - return alltimeDL; + return alltimeDL + sessionDL; } quint64 TorrentSpeedMonitor::getAlltimeUL() const { QMutexLocker l(&m_mutex); - return alltimeUL; + return alltimeUL + sessionUL; } void TorrentSpeedMonitor::getSamples() @@ -184,18 +184,19 @@ void TorrentSpeedMonitor::getSamples() int up = st.upload_payload_rate; int down = st.download_payload_rate; m_samples[misc::toQString(it->info_hash())].addSample(down, up); - alltimeDL += down; - alltimeUL += up; } } catch(invalid_handle&) {} } + libtorrent::session_status ss = m_session->getSessionStatus(); + sessionDL = ss.total_download; + sessionUL = ss.total_upload; } void TorrentSpeedMonitor::saveStats() const { QIniSettings s; QVariantHash v; - v.insert("AlltimeDL", alltimeDL); - v.insert("AlltimeUL", alltimeUL); + v.insert("AlltimeDL", alltimeDL + sessionDL); + v.insert("AlltimeUL", alltimeUL + sessionUL); s.setValue("Stats/AllStats", v); } @@ -204,4 +205,5 @@ void TorrentSpeedMonitor::loadStats() { QVariantHash v(s.value("Stats/AllStats", QVariantHash()).toHash()); alltimeDL = v["AlltimeDL"].toULongLong(); alltimeUL = v["AlltimeUL"].toULongLong(); + sessionDL = sessionUL = 0; } diff --git a/src/qtlibtorrent/torrentspeedmonitor.h b/src/qtlibtorrent/torrentspeedmonitor.h index 3a310a719..134d18e88 100644 --- a/src/qtlibtorrent/torrentspeedmonitor.h +++ b/src/qtlibtorrent/torrentspeedmonitor.h @@ -73,6 +73,8 @@ private: // Will overflow at 15.9 EiB quint64 alltimeUL; quint64 alltimeDL; + quint64 sessionUL; + quint64 sessionDL; }; #endif // TORRENTSPEEDMONITOR_H