Browse Source

Merge pull request #3844 from glassez/added_time

Use libtorrent::torrent_status::added_time (Closes #3764).
adaptive-webui-19844
sledgehammer999 9 years ago
parent
commit
9646794bb1
  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)
libtorrent::entry fastNew; libtorrent::entry fastNew;
fastNew = fastOld; fastNew = fastOld;
fastNew["qBt-addedTime"] = fastOld.dict_find_int_value("qBt-added_time");
int priority = fastOld.dict_find_int_value("qBt-queuePosition"); int priority = fastOld.dict_find_int_value("qBt-queuePosition");
QFile file2(QString("%1.%2").arg(filepath).arg(priority > 0 ? priority : 0)); 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
libt::lazy_bdecode(data.constData(), data.constData() + data.size(), fast, ec); libt::lazy_bdecode(data.constData(), data.constData() + data.size(), fast, ec);
if ((fast.type() != libt::lazy_entry::dict_t) && !ec) return false; 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.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.ratioLimit = Utils::String::fromStdString(fast.dict_find_string_value("qBt-ratioLimit")).toDouble();
out.label = Utils::String::fromStdString(fast.dict_find_string_value("qBt-label")); 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
, m_state(TorrentState::Unknown) , m_state(TorrentState::Unknown)
, m_renameCount(0) , m_renameCount(0)
, m_name(data.name) , m_name(data.name)
, m_addedTime(data.resumed ? data.addedTime : QDateTime::currentDateTime())
, m_savePath(Utils::Fs::toNativePath(data.savePath)) , m_savePath(Utils::Fs::toNativePath(data.savePath))
, m_label(data.label) , m_label(data.label)
, m_hasSeedStatus(data.resumed ? data.hasSeedStatus : false) , m_hasSeedStatus(data.resumed ? data.hasSeedStatus : false)
@ -500,7 +499,7 @@ QString TorrentHandle::label() const
QDateTime TorrentHandle::addedTime() const QDateTime TorrentHandle::addedTime() const
{ {
return m_addedTime; return QDateTime::fromTime_t(m_nativeStatus.added_time);
} }
qreal TorrentHandle::ratioLimit() const qreal TorrentHandle::ratioLimit() const
@ -1429,7 +1428,6 @@ void TorrentHandle::handleSaveResumeDataAlert(libtorrent::save_resume_data_alert
resumeData["qBt-paused"] = isPaused(); resumeData["qBt-paused"] = isPaused();
resumeData["qBt-forced"] = isForced(); resumeData["qBt-forced"] = isForced();
} }
resumeData["qBt-addedTime"] = m_addedTime.toTime_t();
resumeData["qBt-savePath"] = Utils::String::toStdString(m_savePath); resumeData["qBt-savePath"] = Utils::String::toStdString(m_savePath);
resumeData["qBt-ratioLimit"] = Utils::String::toStdString(QString::number(m_ratioLimit)); resumeData["qBt-ratioLimit"] = Utils::String::toStdString(QString::number(m_ratioLimit));
resumeData["qBt-label"] = Utils::String::toStdString(m_label); resumeData["qBt-label"] = Utils::String::toStdString(m_label);

2
src/core/bittorrent/torrenthandle.h

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

Loading…
Cancel
Save