Browse Source

Use libtorrent::torrent_status::added_time (Closes #3764).

adaptive-webui-19844
Vladimir Golovnev (Glassez) 9 years ago
parent
commit
b63a68c9db
  1. 1
      src/app/upgrade.h
  2. 1
      src/core/bittorrent/session.cpp
  3. 4
      src/core/bittorrent/torrenthandle.cpp
  4. 2
      src/core/bittorrent/torrenthandle.h

1
src/app/upgrade.h

@ -89,7 +89,6 @@ bool upgradeResumeFile(const QString &filepath) @@ -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));

1
src/core/bittorrent/session.cpp

@ -2369,7 +2369,6 @@ bool loadTorrentResumeData(const QByteArray &data, AddTorrentData &out, MagnetUr @@ -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"));

4
src/core/bittorrent/torrenthandle.cpp

@ -192,7 +192,6 @@ TorrentHandle::TorrentHandle(Session *session, const libtorrent::torrent_handle @@ -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 @@ -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 @@ -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);

2
src/core/bittorrent/torrenthandle.h

@ -97,7 +97,6 @@ namespace BitTorrent @@ -97,7 +97,6 @@ namespace BitTorrent
// for new torrents
QVector<int> filePriorities;
// for resumed torrents
QDateTime addedTime;
qreal ratioLimit;
AddTorrentData();
@ -363,7 +362,6 @@ namespace BitTorrent @@ -363,7 +362,6 @@ namespace BitTorrent
// Persistent data
QString m_name;
QDateTime m_addedTime;
QString m_savePath;
QString m_label;
bool m_hasSeedStatus;

Loading…
Cancel
Save