Browse Source

Use newer libtorrent API

adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
2bc91fba3e
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 11
      src/base/bittorrent/torrenthandle.cpp

11
src/base/bittorrent/torrenthandle.cpp

@ -45,6 +45,10 @@ @@ -45,6 +45,10 @@
#include <libtorrent/time.hpp>
#include <libtorrent/version.hpp>
#if (LIBTORRENT_VERSION_NUM >= 10200)
#include <libtorrent/write_resume_data.hpp>
#endif
#include <QBitArray>
#include <QDateTime>
#include <QDebug>
@ -1689,10 +1693,17 @@ void TorrentHandle::handleTorrentResumedAlert(const lt::torrent_resumed_alert *p @@ -1689,10 +1693,17 @@ void TorrentHandle::handleTorrentResumedAlert(const lt::torrent_resumed_alert *p
void TorrentHandle::handleSaveResumeDataAlert(const lt::save_resume_data_alert *p)
{
#if (LIBTORRENT_VERSION_NUM < 10200)
const bool useDummyResumeData = !(p && p->resume_data);
lt::entry dummyEntry;
lt::entry &resumeData = useDummyResumeData ? dummyEntry : *(p->resume_data);
#else
const bool useDummyResumeData = !p;
lt::entry resumeData = useDummyResumeData ? lt::entry() : lt::write_resume_data(p->params);
#endif
if (useDummyResumeData) {
resumeData["qBt-magnetUri"] = toMagnetUri().toStdString();
resumeData["qBt-paused"] = isPaused();

Loading…
Cancel
Save