From b63a68c9dbb27f3e29114587afbf05c5d588ba93 Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Tue, 22 Sep 2015 19:16:04 +0300 Subject: [PATCH] Use libtorrent::torrent_status::added_time (Closes #3764). --- src/app/upgrade.h | 1 - src/core/bittorrent/session.cpp | 1 - src/core/bittorrent/torrenthandle.cpp | 4 +--- src/core/bittorrent/torrenthandle.h | 2 -- 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/app/upgrade.h b/src/app/upgrade.h index b84f29f36..49c9f8afc 100644 --- a/src/app/upgrade.h +++ b/src/app/upgrade.h @@ -89,7 +89,6 @@ bool upgradeResumeFile(const QString &filepath) libtorrent::entry fastNew; fastNew = fastOld; - fastNew["qBt-addedTime"] = fastOld.dict_find_int_value("qBt-added_time"); int priority = fastOld.dict_find_int_value("qBt-queuePosition"); QFile file2(QString("%1.%2").arg(filepath).arg(priority > 0 ? priority : 0)); diff --git a/src/core/bittorrent/session.cpp b/src/core/bittorrent/session.cpp index a025b92d3..a4a97e4b3 100644 --- a/src/core/bittorrent/session.cpp +++ b/src/core/bittorrent/session.cpp @@ -2369,7 +2369,6 @@ bool loadTorrentResumeData(const QByteArray &data, AddTorrentData &out, MagnetUr libt::lazy_bdecode(data.constData(), data.constData() + data.size(), fast, ec); if ((fast.type() != libt::lazy_entry::dict_t) && !ec) return false; - out.addedTime = QDateTime::fromTime_t(fast.dict_find_int_value("qBt-addedTime")); out.savePath = Utils::Fs::fromNativePath(Utils::String::fromStdString(fast.dict_find_string_value("qBt-savePath"))); out.ratioLimit = Utils::String::fromStdString(fast.dict_find_string_value("qBt-ratioLimit")).toDouble(); out.label = Utils::String::fromStdString(fast.dict_find_string_value("qBt-label")); diff --git a/src/core/bittorrent/torrenthandle.cpp b/src/core/bittorrent/torrenthandle.cpp index 3179603bc..bc8747ed2 100644 --- a/src/core/bittorrent/torrenthandle.cpp +++ b/src/core/bittorrent/torrenthandle.cpp @@ -192,7 +192,6 @@ TorrentHandle::TorrentHandle(Session *session, const libtorrent::torrent_handle , m_state(TorrentState::Unknown) , m_renameCount(0) , m_name(data.name) - , m_addedTime(data.resumed ? data.addedTime : QDateTime::currentDateTime()) , m_savePath(Utils::Fs::toNativePath(data.savePath)) , m_label(data.label) , m_hasSeedStatus(data.resumed ? data.hasSeedStatus : false) @@ -500,7 +499,7 @@ QString TorrentHandle::label() const QDateTime TorrentHandle::addedTime() const { - return m_addedTime; + return QDateTime::fromTime_t(m_nativeStatus.added_time); } qreal TorrentHandle::ratioLimit() const @@ -1429,7 +1428,6 @@ void TorrentHandle::handleSaveResumeDataAlert(libtorrent::save_resume_data_alert resumeData["qBt-paused"] = isPaused(); resumeData["qBt-forced"] = isForced(); } - resumeData["qBt-addedTime"] = m_addedTime.toTime_t(); resumeData["qBt-savePath"] = Utils::String::toStdString(m_savePath); resumeData["qBt-ratioLimit"] = Utils::String::toStdString(QString::number(m_ratioLimit)); resumeData["qBt-label"] = Utils::String::toStdString(m_label); diff --git a/src/core/bittorrent/torrenthandle.h b/src/core/bittorrent/torrenthandle.h index 7548aee6e..5a18e8eb8 100644 --- a/src/core/bittorrent/torrenthandle.h +++ b/src/core/bittorrent/torrenthandle.h @@ -97,7 +97,6 @@ namespace BitTorrent // for new torrents QVector filePriorities; // for resumed torrents - QDateTime addedTime; qreal ratioLimit; AddTorrentData(); @@ -363,7 +362,6 @@ namespace BitTorrent // Persistent data QString m_name; - QDateTime m_addedTime; QString m_savePath; QString m_label; bool m_hasSeedStatus;