Browse Source

Use upstream defined namespace alias

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

185
src/base/bittorrent/torrenthandle.cpp

@ -65,7 +65,6 @@
const QString QB_EXT {QStringLiteral(".!qB")}; const QString QB_EXT {QStringLiteral(".!qB")};
namespace libt = libtorrent;
using namespace BitTorrent; using namespace BitTorrent;
namespace namespace
@ -92,7 +91,7 @@ namespace
return out; return out;
} }
using ListType = libt::entry::list_type; using ListType = lt::entry::list_type;
ListType setToEntryList(const QSet<QString> &input) ListType setToEntryList(const QSet<QString> &input)
{ {
@ -371,7 +370,7 @@ bool TorrentHandle::isAutoManaged() const
#if (LIBTORRENT_VERSION_NUM < 10200) #if (LIBTORRENT_VERSION_NUM < 10200)
return m_nativeStatus.auto_managed; return m_nativeStatus.auto_managed;
#else #else
return (m_nativeStatus.flags & libt::torrent_flags::auto_managed); return (m_nativeStatus.flags & lt::torrent_flags::auto_managed);
#endif #endif
} }
@ -381,18 +380,18 @@ void TorrentHandle::setAutoManaged(const bool enable)
m_nativeHandle.auto_managed(enable); m_nativeHandle.auto_managed(enable);
#else #else
if (enable) if (enable)
m_nativeHandle.set_flags(libt::torrent_flags::auto_managed); m_nativeHandle.set_flags(lt::torrent_flags::auto_managed);
else else
m_nativeHandle.unset_flags(libt::torrent_flags::auto_managed); m_nativeHandle.unset_flags(lt::torrent_flags::auto_managed);
#endif #endif
} }
QList<TrackerEntry> TorrentHandle::trackers() const QList<TrackerEntry> TorrentHandle::trackers() const
{ {
QList<TrackerEntry> entries; QList<TrackerEntry> entries;
const std::vector<libt::announce_entry> announces = m_nativeHandle.trackers(); const std::vector<lt::announce_entry> announces = m_nativeHandle.trackers();
for (const libt::announce_entry &tracker : announces) for (const lt::announce_entry &tracker : announces)
entries << tracker; entries << tracker;
return entries; return entries;
@ -420,7 +419,7 @@ void TorrentHandle::replaceTrackers(const QList<TrackerEntry> &trackers)
QList<TrackerEntry> existingTrackers = this->trackers(); QList<TrackerEntry> existingTrackers = this->trackers();
QList<TrackerEntry> addedTrackers; QList<TrackerEntry> addedTrackers;
std::vector<libt::announce_entry> announces; std::vector<lt::announce_entry> announces;
for (const TrackerEntry &tracker : trackers) { for (const TrackerEntry &tracker : trackers) {
announces.push_back(tracker.nativeEntry()); announces.push_back(tracker.nativeEntry());
if (!existingTrackers.contains(tracker)) if (!existingTrackers.contains(tracker))
@ -505,8 +504,8 @@ bool TorrentHandle::removeUrlSeed(const QUrl &urlSeed)
bool TorrentHandle::connectPeer(const PeerAddress &peerAddress) bool TorrentHandle::connectPeer(const PeerAddress &peerAddress)
{ {
libt::error_code ec; lt::error_code ec;
const libt::address addr = libt::address::from_string(peerAddress.ip.toString().toStdString(), ec); const lt::address addr = lt::address::from_string(peerAddress.ip.toString().toStdString(), ec);
if (ec) return false; if (ec) return false;
const boost::asio::ip::tcp::endpoint ep(addr, peerAddress.port); const boost::asio::ip::tcp::endpoint ep(addr, peerAddress.port);
@ -709,7 +708,7 @@ bool TorrentHandle::isPaused() const
#if (LIBTORRENT_VERSION_NUM < 10200) #if (LIBTORRENT_VERSION_NUM < 10200)
return (m_nativeStatus.paused && !isAutoManaged()); return (m_nativeStatus.paused && !isAutoManaged());
#else #else
return ((m_nativeStatus.flags & libt::torrent_flags::paused) return ((m_nativeStatus.flags & lt::torrent_flags::paused)
&& !isAutoManaged()); && !isAutoManaged());
#endif #endif
} }
@ -724,15 +723,15 @@ bool TorrentHandle::isQueued() const
#if (LIBTORRENT_VERSION_NUM < 10200) #if (LIBTORRENT_VERSION_NUM < 10200)
return (m_nativeStatus.paused && isAutoManaged()); return (m_nativeStatus.paused && isAutoManaged());
#else #else
return ((m_nativeStatus.flags & libt::torrent_flags::paused) return ((m_nativeStatus.flags & lt::torrent_flags::paused)
&& isAutoManaged()); && isAutoManaged());
#endif #endif
} }
bool TorrentHandle::isChecking() const bool TorrentHandle::isChecking() const
{ {
return ((m_nativeStatus.state == libt::torrent_status::checking_files) return ((m_nativeStatus.state == lt::torrent_status::checking_files)
|| (m_nativeStatus.state == libt::torrent_status::checking_resume_data)); || (m_nativeStatus.state == lt::torrent_status::checking_resume_data));
} }
bool TorrentHandle::isDownloading() const bool TorrentHandle::isDownloading() const
@ -798,8 +797,8 @@ bool TorrentHandle::isSeed() const
// May suffer from approximation problems // May suffer from approximation problems
//return (progress() == 1.); //return (progress() == 1.);
// This looks safe // This looks safe
return ((m_nativeStatus.state == libt::torrent_status::finished) return ((m_nativeStatus.state == lt::torrent_status::finished)
|| (m_nativeStatus.state == libt::torrent_status::seeding)); || (m_nativeStatus.state == lt::torrent_status::seeding));
} }
bool TorrentHandle::isForced() const bool TorrentHandle::isForced() const
@ -807,7 +806,7 @@ bool TorrentHandle::isForced() const
#if (LIBTORRENT_VERSION_NUM < 10200) #if (LIBTORRENT_VERSION_NUM < 10200)
return (!m_nativeStatus.paused && !isAutoManaged()); return (!m_nativeStatus.paused && !isAutoManaged());
#else #else
return (!(m_nativeStatus.flags & libt::torrent_flags::paused) return (!(m_nativeStatus.flags & lt::torrent_flags::paused)
&& !isAutoManaged()); && !isAutoManaged());
#endif #endif
} }
@ -817,7 +816,7 @@ bool TorrentHandle::isSequentialDownload() const
#if (LIBTORRENT_VERSION_NUM < 10200) #if (LIBTORRENT_VERSION_NUM < 10200)
return m_nativeStatus.sequential_download; return m_nativeStatus.sequential_download;
#else #else
return (m_nativeStatus.flags & libt::torrent_flags::sequential_download); return (m_nativeStatus.flags & lt::torrent_flags::sequential_download);
#endif #endif
} }
@ -851,7 +850,7 @@ TorrentState TorrentHandle::state() const
void TorrentHandle::updateState() void TorrentHandle::updateState()
{ {
if (m_nativeStatus.state == libt::torrent_status::checking_resume_data) { if (m_nativeStatus.state == lt::torrent_status::checking_resume_data) {
m_state = TorrentState::CheckingResumeData; m_state = TorrentState::CheckingResumeData;
} }
else if (isMoveInProgress()) { else if (isMoveInProgress()) {
@ -871,23 +870,23 @@ void TorrentHandle::updateState()
} }
else { else {
switch (m_nativeStatus.state) { switch (m_nativeStatus.state) {
case libt::torrent_status::finished: case lt::torrent_status::finished:
case libt::torrent_status::seeding: case lt::torrent_status::seeding:
if (isForced()) if (isForced())
m_state = TorrentState::ForcedUploading; m_state = TorrentState::ForcedUploading;
else else
m_state = m_nativeStatus.upload_payload_rate > 0 ? TorrentState::Uploading : TorrentState::StalledUploading; m_state = m_nativeStatus.upload_payload_rate > 0 ? TorrentState::Uploading : TorrentState::StalledUploading;
break; break;
case libt::torrent_status::allocating: case lt::torrent_status::allocating:
m_state = TorrentState::Allocating; m_state = TorrentState::Allocating;
break; break;
case libt::torrent_status::checking_files: case lt::torrent_status::checking_files:
m_state = m_hasSeedStatus ? TorrentState::CheckingUploading : TorrentState::CheckingDownloading; m_state = m_hasSeedStatus ? TorrentState::CheckingUploading : TorrentState::CheckingDownloading;
break; break;
case libt::torrent_status::downloading_metadata: case lt::torrent_status::downloading_metadata:
m_state = TorrentState::DownloadingMetadata; m_state = TorrentState::DownloadingMetadata;
break; break;
case libt::torrent_status::downloading: case lt::torrent_status::downloading:
if (isForced()) if (isForced())
m_state = TorrentState::ForcedDownloading; m_state = TorrentState::ForcedDownloading;
else else
@ -916,7 +915,7 @@ bool TorrentHandle::hasError() const
#if (LIBTORRENT_VERSION_NUM < 10200) #if (LIBTORRENT_VERSION_NUM < 10200)
return (m_nativeStatus.paused && m_nativeStatus.errc); return (m_nativeStatus.paused && m_nativeStatus.errc);
#else #else
return ((m_nativeStatus.flags & libt::torrent_flags::paused) return ((m_nativeStatus.flags & lt::torrent_flags::paused)
&& m_nativeStatus.errc); && m_nativeStatus.errc);
#endif #endif
} }
@ -961,7 +960,7 @@ qlonglong TorrentHandle::activeTime() const
#if (LIBTORRENT_VERSION_NUM < 10200) #if (LIBTORRENT_VERSION_NUM < 10200)
return m_nativeStatus.active_time; return m_nativeStatus.active_time;
#else #else
return libt::total_seconds(m_nativeStatus.active_duration); return lt::total_seconds(m_nativeStatus.active_duration);
#endif #endif
} }
@ -970,7 +969,7 @@ qlonglong TorrentHandle::finishedTime() const
#if (LIBTORRENT_VERSION_NUM < 10200) #if (LIBTORRENT_VERSION_NUM < 10200)
return m_nativeStatus.finished_time; return m_nativeStatus.finished_time;
#else #else
return libt::total_seconds(m_nativeStatus.finished_duration); return lt::total_seconds(m_nativeStatus.finished_duration);
#endif #endif
} }
@ -979,7 +978,7 @@ qlonglong TorrentHandle::seedingTime() const
#if (LIBTORRENT_VERSION_NUM < 10200) #if (LIBTORRENT_VERSION_NUM < 10200)
return m_nativeStatus.seeding_time; return m_nativeStatus.seeding_time;
#else #else
return libt::total_seconds(m_nativeStatus.seeding_duration); return lt::total_seconds(m_nativeStatus.seeding_duration);
#endif #endif
} }
@ -1024,7 +1023,7 @@ qulonglong TorrentHandle::eta() const
QVector<qreal> TorrentHandle::filesProgress() const QVector<qreal> TorrentHandle::filesProgress() const
{ {
std::vector<boost::int64_t> fp; std::vector<boost::int64_t> fp;
m_nativeHandle.file_progress(fp, libt::torrent_handle::piece_granularity); m_nativeHandle.file_progress(fp, lt::torrent_handle::piece_granularity);
const int count = static_cast<int>(fp.size()); const int count = static_cast<int>(fp.size());
QVector<qreal> result; QVector<qreal> result;
@ -1104,7 +1103,7 @@ qlonglong TorrentHandle::timeSinceUpload() const
#if (LIBTORRENT_VERSION_NUM < 10200) #if (LIBTORRENT_VERSION_NUM < 10200)
return m_nativeStatus.time_since_upload; return m_nativeStatus.time_since_upload;
#else #else
return libt::total_seconds(libt::clock_type::now() - m_nativeStatus.last_upload); return lt::total_seconds(lt::clock_type::now() - m_nativeStatus.last_upload);
#endif #endif
} }
@ -1113,7 +1112,7 @@ qlonglong TorrentHandle::timeSinceDownload() const
#if (LIBTORRENT_VERSION_NUM < 10200) #if (LIBTORRENT_VERSION_NUM < 10200)
return m_nativeStatus.time_since_download; return m_nativeStatus.time_since_download;
#else #else
return libt::total_seconds(libt::clock_type::now() - m_nativeStatus.last_download); return lt::total_seconds(lt::clock_type::now() - m_nativeStatus.last_download);
#endif #endif
} }
@ -1141,18 +1140,18 @@ bool TorrentHandle::superSeeding() const
#if (LIBTORRENT_VERSION_NUM < 10200) #if (LIBTORRENT_VERSION_NUM < 10200)
return m_nativeStatus.super_seeding; return m_nativeStatus.super_seeding;
#else #else
return (m_nativeStatus.flags & libt::torrent_flags::super_seeding); return (m_nativeStatus.flags & lt::torrent_flags::super_seeding);
#endif #endif
} }
QList<PeerInfo> TorrentHandle::peers() const QList<PeerInfo> TorrentHandle::peers() const
{ {
QList<PeerInfo> peers; QList<PeerInfo> peers;
std::vector<libt::peer_info> nativePeers; std::vector<lt::peer_info> nativePeers;
m_nativeHandle.get_peer_info(nativePeers); m_nativeHandle.get_peer_info(nativePeers);
for (const libt::peer_info &peer : nativePeers) for (const lt::peer_info &peer : nativePeers)
peers << PeerInfo(this, peer); peers << PeerInfo(this, peer);
return peers; return peers;
@ -1172,11 +1171,11 @@ QBitArray TorrentHandle::downloadingPieces() const
{ {
QBitArray result(piecesCount()); QBitArray result(piecesCount());
std::vector<libt::partial_piece_info> queue; std::vector<lt::partial_piece_info> queue;
m_nativeHandle.get_download_queue(queue); m_nativeHandle.get_download_queue(queue);
std::vector<libt::partial_piece_info>::const_iterator it = queue.begin(); std::vector<lt::partial_piece_info>::const_iterator it = queue.begin();
std::vector<libt::partial_piece_info>::const_iterator itend = queue.end(); std::vector<lt::partial_piece_info>::const_iterator itend = queue.end();
for (; it != itend; ++it) for (; it != itend; ++it)
result.setBit(it->piece_index); result.setBit(it->piece_index);
@ -1258,7 +1257,7 @@ int TorrentHandle::connectionsLimit() const
qlonglong TorrentHandle::nextAnnounce() const qlonglong TorrentHandle::nextAnnounce() const
{ {
return libt::total_seconds(m_nativeStatus.next_announce); return lt::total_seconds(m_nativeStatus.next_announce);
} }
void TorrentHandle::setName(const QString &name) void TorrentHandle::setName(const QString &name)
@ -1339,7 +1338,7 @@ void TorrentHandle::forceRecheck()
#if (LIBTORRENT_VERSION_NUM < 10200) #if (LIBTORRENT_VERSION_NUM < 10200)
m_nativeHandle.stop_when_ready(true); m_nativeHandle.stop_when_ready(true);
#else #else
m_nativeHandle.set_flags(libt::torrent_flags::stop_when_ready); m_nativeHandle.set_flags(lt::torrent_flags::stop_when_ready);
#endif #endif
resume_impl(false); resume_impl(false);
} }
@ -1352,12 +1351,12 @@ void TorrentHandle::setSequentialDownload(const bool enable)
m_nativeStatus.sequential_download = enable; // prevent return cached value m_nativeStatus.sequential_download = enable; // prevent return cached value
#else #else
if (enable) { if (enable) {
m_nativeHandle.set_flags(libt::torrent_flags::sequential_download); m_nativeHandle.set_flags(lt::torrent_flags::sequential_download);
m_nativeStatus.flags |= libt::torrent_flags::sequential_download; // prevent return cached value m_nativeStatus.flags |= lt::torrent_flags::sequential_download; // prevent return cached value
} }
else { else {
m_nativeHandle.unset_flags(libt::torrent_flags::sequential_download); m_nativeHandle.unset_flags(lt::torrent_flags::sequential_download);
m_nativeStatus.flags &= ~libt::torrent_flags::sequential_download; // prevent return cached value m_nativeStatus.flags &= ~lt::torrent_flags::sequential_download; // prevent return cached value
} }
#endif #endif
} }
@ -1468,10 +1467,10 @@ void TorrentHandle::moveStorage(const QString &newPath, bool overwrite)
// Actually move the storage // Actually move the storage
#if (LIBTORRENT_VERSION_NUM < 10200) #if (LIBTORRENT_VERSION_NUM < 10200)
m_nativeHandle.move_storage(newPath.toUtf8().constData() m_nativeHandle.move_storage(newPath.toUtf8().constData()
, (overwrite ? libt::always_replace_files : libt::dont_replace)); , (overwrite ? lt::always_replace_files : lt::dont_replace));
#else #else
m_nativeHandle.move_storage(newPath.toUtf8().constData() m_nativeHandle.move_storage(newPath.toUtf8().constData()
, (overwrite ? libt::move_flags_t::always_replace_files : libt::move_flags_t::dont_replace)); , (overwrite ? lt::move_flags_t::always_replace_files : lt::move_flags_t::dont_replace));
#endif #endif
m_moveStorageInfo.oldPath = oldPath; m_moveStorageInfo.oldPath = oldPath;
m_moveStorageInfo.newPath = newPath; m_moveStorageInfo.newPath = newPath;
@ -1490,14 +1489,14 @@ bool TorrentHandle::saveTorrentFile(const QString &path)
{ {
if (!m_torrentInfo.isValid()) return false; if (!m_torrentInfo.isValid()) return false;
#if (LIBTORRENT_VERSION_NUM < 10200) #if (LIBTORRENT_VERSION_NUM < 10200)
const libt::create_torrent torrentCreator = libt::create_torrent(*(m_torrentInfo.nativeInfo()), true); const lt::create_torrent torrentCreator = lt::create_torrent(*(m_torrentInfo.nativeInfo()), true);
#else #else
const libt::create_torrent torrentCreator = libt::create_torrent(*(m_torrentInfo.nativeInfo())); const lt::create_torrent torrentCreator = lt::create_torrent(*(m_torrentInfo.nativeInfo()));
#endif #endif
const libt::entry torrentEntry = torrentCreator.generate(); const lt::entry torrentEntry = torrentCreator.generate();
QVector<char> out; QVector<char> out;
libt::bencode(std::back_inserter(out), torrentEntry); lt::bencode(std::back_inserter(out), torrentEntry);
QFile torrentFile(path); QFile torrentFile(path);
if (!out.empty() && torrentFile.open(QIODevice::WriteOnly)) if (!out.empty() && torrentFile.open(QIODevice::WriteOnly))
return (torrentFile.write(&out[0], out.size()) == out.size()); return (torrentFile.write(&out[0], out.size()) == out.size());
@ -1505,7 +1504,7 @@ bool TorrentHandle::saveTorrentFile(const QString &path)
return false; return false;
} }
void TorrentHandle::handleStateUpdate(const libt::torrent_status &nativeStatus) void TorrentHandle::handleStateUpdate(const lt::torrent_status &nativeStatus)
{ {
updateStatus(nativeStatus); updateStatus(nativeStatus);
} }
@ -1725,7 +1724,7 @@ void TorrentHandle::handleSaveResumeDataFailedAlert(const libtorrent::save_resum
{ {
// if torrent has no metadata we should save dummy fastresume data // if torrent has no metadata we should save dummy fastresume data
// containing Magnet URI and qBittorrent own resume data only // containing Magnet URI and qBittorrent own resume data only
if (p->error.value() == libt::errors::no_metadata) if (p->error.value() == lt::errors::no_metadata)
handleSaveResumeDataAlert(nullptr); handleSaveResumeDataAlert(nullptr);
else else
m_session->handleTorrentResumeDataFailed(this); m_session->handleTorrentResumeDataFailed(this);
@ -1733,7 +1732,7 @@ void TorrentHandle::handleSaveResumeDataFailedAlert(const libtorrent::save_resum
void TorrentHandle::handleFastResumeRejectedAlert(const libtorrent::fastresume_rejected_alert *p) void TorrentHandle::handleFastResumeRejectedAlert(const libtorrent::fastresume_rejected_alert *p)
{ {
if (p->error.value() == libt::errors::mismatching_file_size) { if (p->error.value() == lt::errors::mismatching_file_size) {
// Mismatching file size (files were probably moved) // Mismatching file size (files were probably moved)
m_hasMissingFiles = true; m_hasMissingFiles = true;
LogMsg(tr("File sizes mismatch for torrent '%1', pausing it.").arg(name()), Log::CRITICAL); LogMsg(tr("File sizes mismatch for torrent '%1', pausing it.").arg(name()), Log::CRITICAL);
@ -1804,12 +1803,12 @@ void TorrentHandle::handleFileCompletedAlert(const libtorrent::file_completed_al
void TorrentHandle::handleStatsAlert(const libtorrent::stats_alert *p) void TorrentHandle::handleStatsAlert(const libtorrent::stats_alert *p)
{ {
Q_ASSERT(p->interval >= 1000); Q_ASSERT(p->interval >= 1000);
const SpeedSample transferred(p->transferred[libt::stats_alert::download_payload] * 1000LL / p->interval, const SpeedSample transferred(p->transferred[lt::stats_alert::download_payload] * 1000LL / p->interval,
p->transferred[libt::stats_alert::upload_payload] * 1000LL / p->interval); p->transferred[lt::stats_alert::upload_payload] * 1000LL / p->interval);
m_speedMonitor.addSample(transferred); m_speedMonitor.addSample(transferred);
} }
void TorrentHandle::handleMetadataReceivedAlert(const libt::metadata_received_alert *p) void TorrentHandle::handleMetadataReceivedAlert(const lt::metadata_received_alert *p)
{ {
Q_UNUSED(p); Q_UNUSED(p);
qDebug("Metadata received for torrent %s.", qUtf8Printable(name())); qDebug("Metadata received for torrent %s.", qUtf8Printable(name()));
@ -1858,56 +1857,56 @@ void TorrentHandle::handleAppendExtensionToggled()
void TorrentHandle::handleAlert(const libtorrent::alert *a) void TorrentHandle::handleAlert(const libtorrent::alert *a)
{ {
switch (a->type()) { switch (a->type()) {
case libt::stats_alert::alert_type: case lt::stats_alert::alert_type:
handleStatsAlert(static_cast<const libt::stats_alert*>(a)); handleStatsAlert(static_cast<const lt::stats_alert*>(a));
break; break;
case libt::file_renamed_alert::alert_type: case lt::file_renamed_alert::alert_type:
handleFileRenamedAlert(static_cast<const libt::file_renamed_alert*>(a)); handleFileRenamedAlert(static_cast<const lt::file_renamed_alert*>(a));
break; break;
case libt::file_rename_failed_alert::alert_type: case lt::file_rename_failed_alert::alert_type:
handleFileRenameFailedAlert(static_cast<const libt::file_rename_failed_alert*>(a)); handleFileRenameFailedAlert(static_cast<const lt::file_rename_failed_alert*>(a));
break; break;
case libt::file_completed_alert::alert_type: case lt::file_completed_alert::alert_type:
handleFileCompletedAlert(static_cast<const libt::file_completed_alert*>(a)); handleFileCompletedAlert(static_cast<const lt::file_completed_alert*>(a));
break; break;
case libt::torrent_finished_alert::alert_type: case lt::torrent_finished_alert::alert_type:
handleTorrentFinishedAlert(static_cast<const libt::torrent_finished_alert*>(a)); handleTorrentFinishedAlert(static_cast<const lt::torrent_finished_alert*>(a));
break; break;
case libt::save_resume_data_alert::alert_type: case lt::save_resume_data_alert::alert_type:
handleSaveResumeDataAlert(static_cast<const libt::save_resume_data_alert*>(a)); handleSaveResumeDataAlert(static_cast<const lt::save_resume_data_alert*>(a));
break; break;
case libt::save_resume_data_failed_alert::alert_type: case lt::save_resume_data_failed_alert::alert_type:
handleSaveResumeDataFailedAlert(static_cast<const libt::save_resume_data_failed_alert*>(a)); handleSaveResumeDataFailedAlert(static_cast<const lt::save_resume_data_failed_alert*>(a));
break; break;
case libt::storage_moved_alert::alert_type: case lt::storage_moved_alert::alert_type:
handleStorageMovedAlert(static_cast<const libt::storage_moved_alert*>(a)); handleStorageMovedAlert(static_cast<const lt::storage_moved_alert*>(a));
break; break;
case libt::storage_moved_failed_alert::alert_type: case lt::storage_moved_failed_alert::alert_type:
handleStorageMovedFailedAlert(static_cast<const libt::storage_moved_failed_alert*>(a)); handleStorageMovedFailedAlert(static_cast<const lt::storage_moved_failed_alert*>(a));
break; break;
case libt::torrent_paused_alert::alert_type: case lt::torrent_paused_alert::alert_type:
handleTorrentPausedAlert(static_cast<const libt::torrent_paused_alert*>(a)); handleTorrentPausedAlert(static_cast<const lt::torrent_paused_alert*>(a));
break; break;
case libt::torrent_resumed_alert::alert_type: case lt::torrent_resumed_alert::alert_type:
handleTorrentResumedAlert(static_cast<const libt::torrent_resumed_alert*>(a)); handleTorrentResumedAlert(static_cast<const lt::torrent_resumed_alert*>(a));
break; break;
case libt::tracker_error_alert::alert_type: case lt::tracker_error_alert::alert_type:
handleTrackerErrorAlert(static_cast<const libt::tracker_error_alert*>(a)); handleTrackerErrorAlert(static_cast<const lt::tracker_error_alert*>(a));
break; break;
case libt::tracker_reply_alert::alert_type: case lt::tracker_reply_alert::alert_type:
handleTrackerReplyAlert(static_cast<const libt::tracker_reply_alert*>(a)); handleTrackerReplyAlert(static_cast<const lt::tracker_reply_alert*>(a));
break; break;
case libt::tracker_warning_alert::alert_type: case lt::tracker_warning_alert::alert_type:
handleTrackerWarningAlert(static_cast<const libt::tracker_warning_alert*>(a)); handleTrackerWarningAlert(static_cast<const lt::tracker_warning_alert*>(a));
break; break;
case libt::metadata_received_alert::alert_type: case lt::metadata_received_alert::alert_type:
handleMetadataReceivedAlert(static_cast<const libt::metadata_received_alert*>(a)); handleMetadataReceivedAlert(static_cast<const lt::metadata_received_alert*>(a));
break; break;
case libt::fastresume_rejected_alert::alert_type: case lt::fastresume_rejected_alert::alert_type:
handleFastResumeRejectedAlert(static_cast<const libt::fastresume_rejected_alert*>(a)); handleFastResumeRejectedAlert(static_cast<const lt::fastresume_rejected_alert*>(a));
break; break;
case libt::torrent_checked_alert::alert_type: case lt::torrent_checked_alert::alert_type:
handleTorrentCheckedAlert(static_cast<const libt::torrent_checked_alert*>(a)); handleTorrentCheckedAlert(static_cast<const lt::torrent_checked_alert*>(a));
break; break;
} }
} }
@ -2050,9 +2049,9 @@ void TorrentHandle::setSuperSeeding(const bool enable)
m_nativeHandle.super_seeding(enable); m_nativeHandle.super_seeding(enable);
#else #else
if (enable) if (enable)
m_nativeHandle.set_flags(libt::torrent_flags::super_seeding); m_nativeHandle.set_flags(lt::torrent_flags::super_seeding);
else else
m_nativeHandle.unset_flags(libt::torrent_flags::super_seeding); m_nativeHandle.unset_flags(lt::torrent_flags::super_seeding);
#endif #endif
} }
@ -2063,7 +2062,7 @@ void TorrentHandle::flushCache()
QString TorrentHandle::toMagnetUri() const QString TorrentHandle::toMagnetUri() const
{ {
return QString::fromStdString(libt::make_magnet_uri(m_nativeHandle)); return QString::fromStdString(lt::make_magnet_uri(m_nativeHandle));
} }
void TorrentHandle::prioritizeFiles(const QVector<DownloadPriority> &priorities) void TorrentHandle::prioritizeFiles(const QVector<DownloadPriority> &priorities)

Loading…
Cancel
Save