Browse Source

Statistics: handle case where user has gone back to older version.

adaptive-webui-19844
sledgehammer999 11 years ago
parent
commit
8bbdcc78ce
  1. 9
      src/qtlibtorrent/torrentspeedmonitor.cpp

9
src/qtlibtorrent/torrentspeedmonitor.cpp

@ -223,6 +223,15 @@ void TorrentSpeedMonitor::loadStats() {
if (s_old.contains("Stats/AllStats")) { if (s_old.contains("Stats/AllStats")) {
v = s_old.value("Stats/AllStats").toHash(); v = s_old.value("Stats/AllStats").toHash();
dirty = true; dirty = true;
// If the user has used qbt > 3.1.5 and then reinstalled/used
// qbt < 3.1.6, there will be stats in qbittorrent-data.ini too
// so we need to merge those 2.
if (s.contains("Stats/AllStats")) {
QVariantHash tmp = s.value("Stats/AllStats").toHash();
v["AlltimeDL"] = v["AlltimeDL"].toULongLong() + tmp["AlltimeDL"].toULongLong();
v["AlltimeUL"] = v["AlltimeUL"].toULongLong() + tmp["AlltimeUL"].toULongLong();
}
} }
else else
v = s.value("Stats/AllStats").toHash(); v = s.value("Stats/AllStats").toHash();

Loading…
Cancel
Save