Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.3:Update
leechcraft-doc
leechcraft-0.6.70-6645-gcd10d7e-torrent110.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File leechcraft-0.6.70-6645-gcd10d7e-torrent110.diff of Package leechcraft-doc
commit 413ac2db92b280c1167769c8eaabbefe4c28da7b Author: 0xd34df00d <0xd34df00d@gmail.com> Date: Tue May 3 22:20:16 2016 -0400 [BitTorrent] Removed unneeded include. diff --git a/src/plugins/bittorrent/torrenttabwidget.cpp b/src/plugins/bittorrent/torrenttabwidget.cpp index 7588e75..59bdb53 100644 --- a/src/plugins/bittorrent/torrenttabwidget.cpp +++ b/src/plugins/bittorrent/torrenttabwidget.cpp @@ -30,7 +30,6 @@ #include "torrenttabwidget.h" #include <QSortFilterProxyModel> #include <QUrl> -#include <QTimer> #include <libtorrent/session.hpp> #include <util/util.h> #include <util/xpc/util.h> commit 920a6800f475fb7c2f8182ff9e63e27da973d8ad Author: 0xd34df00d <0xd34df00d@gmail.com> Date: Tue May 3 22:20:40 2016 -0400 [BitTorrent] Refactored announce → time conversion to a separate func. diff --git a/src/plugins/bittorrent/torrenttabwidget.cpp b/src/plugins/bittorrent/torrenttabwidget.cpp index 59bdb53..f7cf4c5 100644 --- a/src/plugins/bittorrent/torrenttabwidget.cpp +++ b/src/plugins/bittorrent/torrenttabwidget.cpp @@ -387,6 +387,19 @@ namespace BitTorrent Ui_.UploadingTorrents_->setValue (ssm->GetMaxUploadingTorrents ()); } + namespace + { + QTime Announce2Time (const boost::posix_time::time_duration& announce) + { + return QTime + { + announce.hours (), + announce.minutes (), + announce.seconds () + }; + } + } + void TorrentTabWidget::UpdateTorrentControl () { Ui_.TorrentDownloadRateController_->setValue (Core::Instance ()->GetTorrentDownloadRate (Index_)); @@ -416,11 +429,7 @@ namespace BitTorrent Ui_.LabelState_->setText (i->State_); Ui_.LabelDownloadRate_->setText (Util::MakePrettySize (i->Status_.download_rate) + tr ("/s")); Ui_.LabelUploadRate_->setText (Util::MakePrettySize (i->Status_.upload_rate) + tr ("/s")); - Ui_.LabelNextAnnounce_->setText (QTime { - i->Status_.next_announce.hours (), - i->Status_.next_announce.minutes (), - i->Status_.next_announce.seconds () - }.toString ()); + Ui_.LabelNextAnnounce_->setText (Announce2Time (i->Status_.next_announce).toString ()); Ui_.LabelProgress_->setText (QString::number (i->Status_.progress * 100, 'f', 2) + "%"); Ui_.LabelDownloaded_->setText (Util::MakePrettySize (i->Status_.total_download)); Ui_.LabelUploaded_->setText (Util::MakePrettySize (i->Status_.total_upload)); @@ -471,9 +480,7 @@ namespace BitTorrent Ui_.LabelFailed_->setText (Util::MakePrettySize (i->Status_.total_failed_bytes)); Ui_.LabelConnectedPeers_->setText (QString::number (i->Status_.num_peers)); Ui_.LabelConnectedSeeds_->setText (QString::number (i->Status_.num_seeds)); - Ui_.LabelAnnounceInterval_->setText (QTime (i->Status_.announce_interval.hours (), - i->Status_.announce_interval.minutes (), - i->Status_.announce_interval.seconds ()).toString ()); + Ui_.LabelAnnounceInterval_->setText (Announce2Time (i->Status_.announce_interval).toString ()); Ui_.LabelTotalPieces_->setText (QString::number (i->Info_->num_pieces ())); Ui_.LabelDownloadedPieces_->setText (QString::number (i->Status_.num_pieces)); Ui_.LabelPieceSize_->setText (Util::MakePrettySize (i->Info_->piece_length ())); commit 9f8ffc85bdd1ebec8d6931741a8de68fe273f32a Author: 0xd34df00d <0xd34df00d@gmail.com> Date: Wed May 4 03:35:12 2016 +0100 [BT] Slight code style fixes. diff --git a/src/plugins/bittorrent/core.cpp b/src/plugins/bittorrent/core.cpp index 69dfcd8..79092c9 100644 --- a/src/plugins/bittorrent/core.cpp +++ b/src/plugins/bittorrent/core.cpp @@ -1284,7 +1284,7 @@ namespace BitTorrent { int tor = row ? *row : CurrentTorrent_; if (!CheckValidity (tor)) - return std::vector<libtorrent::announce_entry> (); + return {}; return Handles_.at (tor).Handle_.trackers (); } diff --git a/src/plugins/bittorrent/torrentplugin.cpp b/src/plugins/bittorrent/torrentplugin.cpp index b337509..998f0ab 100644 --- a/src/plugins/bittorrent/torrentplugin.cpp +++ b/src/plugins/bittorrent/torrentplugin.cpp @@ -827,8 +827,7 @@ namespace BitTorrent { auto those = Core::Instance ()->GetTrackers (Core::Instance ()-> GetProxy ()->MapToSource (si).row ()); - std::copy (those.begin (), those.end (), - std::back_inserter (allTrackers)); + std::copy (those.begin (), those.end (), std::back_inserter (allTrackers)); } if (allTrackers.empty ()) commit 9ed0bca4ade841391cae0b1631fdfd21ed4c53b6 Author: 0xd34df00d <0xd34df00d@gmail.com> Date: Wed May 4 03:35:27 2016 +0100 [BitTorrent] Added some universally available includes. diff --git a/src/plugins/bittorrent/livestreamdevice.h b/src/plugins/bittorrent/livestreamdevice.h index c78d8c5..ff6010e 100644 --- a/src/plugins/bittorrent/livestreamdevice.h +++ b/src/plugins/bittorrent/livestreamdevice.h @@ -32,6 +32,7 @@ #include <QVector> #include <QFile> #include <libtorrent/torrent_handle.hpp> +#include <libtorrent/torrent_info.hpp> #include <libtorrent/alert_types.hpp> namespace LeechCraft diff --git a/src/plugins/bittorrent/torrentinfo.h b/src/plugins/bittorrent/torrentinfo.h index b7a4eb3..6e9a290 100644 --- a/src/plugins/bittorrent/torrentinfo.h +++ b/src/plugins/bittorrent/torrentinfo.h @@ -33,6 +33,7 @@ #include <QTime> #include <libtorrent/torrent_info.hpp> #include <libtorrent/torrent_handle.hpp> +#include <libtorrent/session_status.hpp> namespace LeechCraft { commit 7947cff1df3e9f7a00487aa242ab411a3a33c16d Author: 0xd34df00d <0xd34df00d@gmail.com> Date: Wed May 4 03:38:59 2016 +0100 [BitTorrent] Fixed build with libtorrent 1.1.0 diff --git a/src/plugins/bittorrent/addtorrent.cpp b/src/plugins/bittorrent/addtorrent.cpp index de7fdf5..21a345a 100644 --- a/src/plugins/bittorrent/addtorrent.cpp +++ b/src/plugins/bittorrent/addtorrent.cpp @@ -31,6 +31,11 @@ #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/filesystem/path.hpp> #include <boost/filesystem/operations.hpp> + +#if LIBTORRENT_VERSION_NUM >= 10100 +#include <libtorrent/announce_entry.hpp> +#endif + #include <QHeaderView> #include <QFileDialog> #include <QMessageBox> diff --git a/src/plugins/bittorrent/cachedstatuskeeper.h b/src/plugins/bittorrent/cachedstatuskeeper.h index 3834e5f..bac1412 100644 --- a/src/plugins/bittorrent/cachedstatuskeeper.h +++ b/src/plugins/bittorrent/cachedstatuskeeper.h @@ -32,6 +32,7 @@ #include <QObject> #include <QMap> #include <libtorrent/torrent_handle.hpp> +#include <libtorrent/torrent_status.hpp> namespace LeechCraft { diff --git a/src/plugins/bittorrent/core.cpp b/src/plugins/bittorrent/core.cpp index 79092c9..c8350f5 100644 --- a/src/plugins/bittorrent/core.cpp +++ b/src/plugins/bittorrent/core.cpp @@ -72,6 +72,12 @@ #include <libtorrent/ip_filter.hpp> #include <libtorrent/version.hpp> #include <libtorrent/session.hpp> + +#if LIBTORRENT_VERSION_NUM >= 10100 +#include <libtorrent/lazy_entry.hpp> +#include <libtorrent/announce_entry.hpp> +#endif + #include <interfaces/entitytesthandleresult.h> #include <interfaces/core/icoreproxy.h> #include <interfaces/core/itagsmanager.h> @@ -1021,7 +1027,11 @@ namespace BitTorrent libtorrent::add_torrent_params atp; try { +#if LIBTORRENT_VERSION_NUM >= 10100 + atp.ti = boost::make_shared<libtorrent::torrent_info> (GetTorrentInfo (filename)); +#else atp.ti = new libtorrent::torrent_info (GetTorrentInfo (filename)); +#endif atp.storage_mode = GetCurrentStorageMode (); atp.save_path = std::string (path.toUtf8 ().constData ()); if (!autoManaged) @@ -1667,7 +1677,14 @@ namespace BitTorrent QList<FileInfo> result; const auto& handle = Handles_.at (idx).Handle_; -#if LIBTORRENT_VERSION_NUM >= 10000 +#if LIBTORRENT_VERSION_NUM >= 10100 + const auto& infoPtr = StatusKeeper_->GetStatus (handle, + libtorrent::torrent_handle::query_torrent_file).torrent_file.lock (); + if (!infoPtr) + return {}; + + const auto& info = *infoPtr; +#elif LIBTORRENT_VERSION_NUM >= 10000 const auto& infoPtr = StatusKeeper_->GetStatus (handle, libtorrent::torrent_handle::query_torrent_file).torrent_file; if (!infoPtr) @@ -1677,7 +1694,8 @@ namespace BitTorrent #else const auto& info = handle.get_torrent_info (); #endif - std::vector<libtorrent::size_type> prbytes; + + std::vector<boost::int64_t> prbytes; int flags = 0; if (!XmlSettingsManager::Instance ()-> @@ -1802,7 +1820,11 @@ namespace BitTorrent if (priorities.empty ()) { -#if LIBTORRENT_VERSION_NUM >= 10000 +#if LIBTORRENT_VERSION_NUM >= 10100 + const auto& infoPtr = StatusKeeper_->GetStatus (handle, + libtorrent::torrent_handle::query_torrent_file).torrent_file.lock (); + const auto numFiles = infoPtr ? infoPtr->num_files () : 0; +#elif LIBTORRENT_VERSION_NUM >= 10000 const auto& infoPtr = StatusKeeper_->GetStatus (handle, libtorrent::torrent_handle::query_torrent_file).torrent_file; const auto numFiles = infoPtr ? infoPtr->num_files () : 0; @@ -1872,7 +1894,11 @@ namespace BitTorrent try { libtorrent::add_torrent_params atp; +#if LIBTORRENT_VERSION_NUM >= 10100 + atp.ti = boost::make_shared<libtorrent::torrent_info> (e); +#else atp.ti = new libtorrent::torrent_info (e); +#endif atp.storage_mode = GetCurrentStorageMode (); atp.save_path = path.string (); if (!automanaged) @@ -1919,7 +1945,12 @@ namespace BitTorrent #if LIBTORRENT_VERSION_NUM >= 10000 const auto& name = QString::fromStdString (status.name); - if (!status.torrent_file) + #if LIBTORRENT_VERSION_NUM >= 10100 + const auto filePtr = status.torrent_file.lock (); + #else + const auto filePtr = status.torrent_file; + #endif + if (!filePtr) { qWarning () << Q_FUNC_INFO << "torrent" @@ -1927,7 +1958,7 @@ namespace BitTorrent << "has finished, but we don't have its info"; return; } - const auto& info = *status.torrent_file; + const auto& info = *filePtr; #else const auto& info = torrent.Handle_.get_torrent_info (); const auto& name = QString::fromUtf8 (info.name ().c_str ()); diff --git a/src/plugins/bittorrent/livestreamdevice.cpp b/src/plugins/bittorrent/livestreamdevice.cpp index 24141c9..f9cec65 100644 --- a/src/plugins/bittorrent/livestreamdevice.cpp +++ b/src/plugins/bittorrent/livestreamdevice.cpp @@ -47,7 +47,11 @@ namespace BitTorrent { [&] { +#if LIBTORRENT_VERSION_NUM >= 10100 + const auto tf = keeper->GetStatus (h, th::query_pieces | th::query_torrent_file).torrent_file.lock (); +#else const auto tf = keeper->GetStatus (h, th::query_pieces | th::query_torrent_file).torrent_file; +#endif if (!tf) throw std::runtime_error { LiveStreamDevice::tr ("No metadata is available yet.").toStdString () }; return *tf; diff --git a/src/plugins/bittorrent/sessionsettingsmanager.cpp b/src/plugins/bittorrent/sessionsettingsmanager.cpp index 6bb9ee3..310c680 100644 --- a/src/plugins/bittorrent/sessionsettingsmanager.cpp +++ b/src/plugins/bittorrent/sessionsettingsmanager.cpp @@ -544,8 +544,6 @@ namespace BitTorrent property ("UPNPIgnoreNonrouters").toBool (); settings.send_buffer_watermark = XmlSettingsManager::Instance ()-> property ("SendBufferWatermark").toInt () * 1024; - settings.auto_upload_slots = XmlSettingsManager::Instance ()-> - property ("AutoUploadSlots").toBool (); settings.use_parole_mode = XmlSettingsManager::Instance ()-> property ("UseParoleMode").toBool (); settings.cache_size = 1048576 / 16384 * XmlSettingsManager::Instance ()-> @@ -557,7 +555,14 @@ namespace BitTorrent const auto& ports = XmlSettingsManager::Instance ()->property ("OutgoingPorts").toList (); if (ports.size () == 2) +#if LIBTORRENT_VERSION_NUM >= 10100 + { + settings.outgoing_port = ports.at (0).toInt (); + settings.num_outgoing_ports = ports.at (1).toInt () - ports.at (0).toInt (); + } +#else settings.outgoing_ports = std::make_pair (ports.at (0).toInt (), ports.at (1).toInt ()); +#endif settings.use_read_cache = XmlSettingsManager::Instance ()-> property ("UseReadCache").toBool (); diff --git a/src/plugins/bittorrent/torrentplugin.cpp b/src/plugins/bittorrent/torrentplugin.cpp index 998f0ab..dced3b9 100644 --- a/src/plugins/bittorrent/torrentplugin.cpp +++ b/src/plugins/bittorrent/torrentplugin.cpp @@ -53,6 +53,11 @@ #include <boost/preprocessor/repetition/repeat.hpp> #include <libtorrent/session.hpp> #include <libtorrent/version.hpp> + +#if LIBTORRENT_VERSION_NUM >= 10100 +#include <libtorrent/announce_entry.hpp> +#endif + #include <interfaces/entitytesthandleresult.h> #include <interfaces/core/icoreproxy.h> #include <interfaces/core/itagsmanager.h> diff --git a/src/plugins/bittorrent/torrenttab.cpp b/src/plugins/bittorrent/torrenttab.cpp index daae54f..ee55f6f 100644 --- a/src/plugins/bittorrent/torrenttab.cpp +++ b/src/plugins/bittorrent/torrenttab.cpp @@ -36,6 +36,11 @@ #include <QToolBar> #include <QMenu> #include <libtorrent/session.hpp> + +#if LIBTORRENT_VERSION_NUM >= 10100 +#include <libtorrent/announce_entry.hpp> +#endif + #include <util/tags/tagscompleter.h> #include <util/gui/clearlineeditaddon.h> #include <util/gui/lineeditbuttonmanager.h> diff --git a/src/plugins/bittorrent/torrenttabwidget.cpp b/src/plugins/bittorrent/torrenttabwidget.cpp index f7cf4c5..a3efbb1 100644 --- a/src/plugins/bittorrent/torrenttabwidget.cpp +++ b/src/plugins/bittorrent/torrenttabwidget.cpp @@ -28,9 +28,15 @@ **********************************************************************/ #include "torrenttabwidget.h" +#include <chrono> #include <QSortFilterProxyModel> #include <QUrl> #include <libtorrent/session.hpp> + +#if LIBTORRENT_VERSION_NUM >= 10100 +#include <libtorrent/lazy_entry.hpp> +#endif + #include <util/util.h> #include <util/xpc/util.h> #include <util/tags/tagscompleter.h> @@ -389,6 +395,13 @@ namespace BitTorrent namespace { +#if LIBTORRENT_VERSION_NUM >= 10100 + QTime Announce2Time (const libtorrent::time_duration& announce) + { + return QTime { 0, 0 } + .addMSecs (std::chrono::duration_cast<std::chrono::seconds> (announce).count ()); + } +#else QTime Announce2Time (const boost::posix_time::time_duration& announce) { return QTime @@ -398,6 +411,7 @@ namespace BitTorrent announce.seconds () }; } +#endif } void TorrentTabWidget::UpdateTorrentControl () diff --git a/src/plugins/bittorrent/trackerschanger.cpp b/src/plugins/bittorrent/trackerschanger.cpp index 5594a0d..bdf60b6 100644 --- a/src/plugins/bittorrent/trackerschanger.cpp +++ b/src/plugins/bittorrent/trackerschanger.cpp @@ -30,6 +30,12 @@ #include "trackerschanger.h" #include <QMessageBox> #include <QMainWindow> +#include <libtorrent/version.hpp> + +#if LIBTORRENT_VERSION_NUM >= 10100 +#include <libtorrent/announce_entry.hpp> +#endif + #include <interfaces/core/icoreproxy.h> #include <interfaces/core/irootwindowsmanager.h> #include "core.h" commit 9355b1448d0d58eaef64506fcb7b07981f9514b6 Author: 0xd34df00d <0xd34df00d@gmail.com> Date: Thu May 5 01:05:00 2016 +0100 [BT] Fixed build on libtorrent < 1.1.0. diff --git a/src/plugins/bittorrent/cachedstatuskeeper.h b/src/plugins/bittorrent/cachedstatuskeeper.h index bac1412..8f4b6fe 100644 --- a/src/plugins/bittorrent/cachedstatuskeeper.h +++ b/src/plugins/bittorrent/cachedstatuskeeper.h @@ -32,7 +32,10 @@ #include <QObject> #include <QMap> #include <libtorrent/torrent_handle.hpp> + +#if LIBTORRENT_VERSION_NUM >= 10100 #include <libtorrent/torrent_status.hpp> +#endif namespace LeechCraft { commit a837c64cd28c37915ec49144b445b2cd1fbfb913 Author: 0xd34df00d <0xd34df00d@gmail.com> Date: Thu May 5 01:21:23 2016 +0100 [BT] Also include version.hpp. diff --git a/src/plugins/bittorrent/cachedstatuskeeper.h b/src/plugins/bittorrent/cachedstatuskeeper.h index 8f4b6fe..40b9060 100644 --- a/src/plugins/bittorrent/cachedstatuskeeper.h +++ b/src/plugins/bittorrent/cachedstatuskeeper.h @@ -31,6 +31,7 @@ #include <QObject> #include <QMap> +#include <libtorrent/version.hpp> #include <libtorrent/torrent_handle.hpp> #if LIBTORRENT_VERSION_NUM >= 10100 commit 547fa4cae9f41c4b8c0424a494ea7a587be7dd82 Author: 0xd34df00d <0xd34df00d@gmail.com> Date: Sun May 8 14:01:28 2016 -0400 [BT] Dropped libtorrent < 1.0. diff --git a/src/plugins/bittorrent/core.cpp b/src/plugins/bittorrent/core.cpp index c8350f5..ecb6b75 100644 --- a/src/plugins/bittorrent/core.cpp +++ b/src/plugins/bittorrent/core.cpp @@ -501,12 +501,8 @@ namespace BitTorrent const auto& h = Handles_.at (row).Handle_; const auto& status = StatusKeeper_->GetStatus (h, -#if LIBTORRENT_VERSION_NUM >= 10000 libtorrent::torrent_handle::query_name | libtorrent::torrent_handle::query_save_path); -#else - 0); -#endif switch (role) { @@ -542,11 +538,7 @@ namespace BitTorrent case ColumnID: return row + 1; case ColumnName: -#if LIBTORRENT_VERSION_NUM >= 10000 return QString::fromStdString (status.name); -#else - return QString::fromUtf8 (h.name ().c_str ()); -#endif case ColumnState: return status.paused ? -1 : @@ -584,11 +576,7 @@ namespace BitTorrent case ColumnID: return row + 1; case ColumnName: -#if LIBTORRENT_VERSION_NUM >= 10000 return QString::fromStdString (status.name); -#else - return QString::fromUtf8 (h.name ().c_str ()); -#endif case ColumnState: return GetStringForStatus (status); { @@ -688,18 +676,10 @@ namespace BitTorrent case Qt::ToolTipRole: { QString result; -#if LIBTORRENT_VERSION_NUM >= 10000 const auto& name = QString::fromStdString (status.name); -#else - const auto& name = QString::fromUtf8 (h.name ().c_str ()); -#endif result += tr ("Name:") + " " + name + "\n"; result += tr ("Destination:") + " " + -#if LIBTORRENT_VERSION_NUM >= 10000 QString::fromStdString (status.save_path) + "\n"; -#else - QString::fromUtf8 (h.save_path ().c_str ()) + "\n"; -#endif result += tr ("Progress:") + " " + QString (tr ("%1% (%2 of %3)") .arg (status.progress * 100, 0, 'f', 2) @@ -847,14 +827,9 @@ namespace BitTorrent std::unique_ptr<TorrentInfo> result (new TorrentInfo); result->Status_ = StatusKeeper_->GetStatus (handle, 0xffffffff); -#if LIBTORRENT_VERSION_NUM >= 10000 if (const auto info = handle.torrent_file ()) result->Info_.reset (new libtorrent::torrent_info (*info)); result->Destination_ = QString::fromStdString (result->Status_.save_path); -#else - result->Info_.reset (new libtorrent::torrent_info (handle.get_torrent_info ())); - result->Destination_ = QString::fromUtf8 (handle.save_path ().c_str ()); -#endif result->State_ = GetStringForStatus (result->Status_); if (!result->Status_.error.empty ()) @@ -1072,12 +1047,8 @@ namespace BitTorrent handle.auto_managed (autoManaged); beginInsertRows (QModelIndex (), Handles_.size (), Handles_.size ()); -#if LIBTORRENT_VERSION_NUM >= 10000 auto torrentFileName = QString::fromStdString (handle .status (libtorrent::torrent_handle::query_name).name); -#else - QString torrentFileName = QString::fromUtf8 (handle.name ().c_str ()); -#endif if (!torrentFileName.endsWith (".torrent")) torrentFileName.append (".torrent"); @@ -1324,13 +1295,9 @@ namespace BitTorrent if (!CheckValidity (idx)) return QString (); -#if LIBTORRENT_VERSION_NUM >= 10000 const auto& handle = Handles_.at (idx).Handle_; const auto& path = StatusKeeper_->GetStatus (handle, libtorrent::torrent_handle::query_save_path).save_path; -#else - const auto& path = Handles_.at (idx).Handle_.save_path (); -#endif return QString::fromStdString (path); } @@ -1477,12 +1444,8 @@ namespace BitTorrent { qWarning () << Q_FUNC_INFO << "not saving erroneous torrent:" -#if LIBTORRENT_VERSION_NUM >= 10000 << StatusKeeper_->GetStatus (a.handle, libtorrent::torrent_handle::query_name) .name.c_str (); -#else - << a.handle.name ().c_str (); -#endif return; } @@ -1516,7 +1479,6 @@ namespace BitTorrent return; } -#if LIBTORRENT_VERSION_NUM >= 10000 const auto& file = a.handle.torrent_file (); if (!file) { @@ -1526,9 +1488,6 @@ namespace BitTorrent } const auto& info = *file; -#else - const auto& info = a.handle.get_torrent_info (); -#endif torrent->TorrentFileName_ = QString::fromUtf8 (info.name ().c_str ()) + ".torrent"; torrent->FilePriorities_.resize (info.num_files ()); std::fill (torrent->FilePriorities_.begin (), @@ -1577,12 +1536,8 @@ namespace BitTorrent { qWarning () << Q_FUNC_INFO << "unknown torrent handle" -#if LIBTORRENT_VERSION_NUM >= 10000 << StatusKeeper_->GetStatus (h, libtorrent::torrent_handle::query_name) .name.c_str (); -#else - << h.name ().c_str (); -#endif return; } @@ -1684,15 +1639,13 @@ namespace BitTorrent return {}; const auto& info = *infoPtr; -#elif LIBTORRENT_VERSION_NUM >= 10000 +#else const auto& infoPtr = StatusKeeper_->GetStatus (handle, libtorrent::torrent_handle::query_torrent_file).torrent_file; if (!infoPtr) return {}; const auto& info = *infoPtr; -#else - const auto& info = handle.get_torrent_info (); #endif std::vector<boost::int64_t> prbytes; @@ -1824,12 +1777,10 @@ namespace BitTorrent const auto& infoPtr = StatusKeeper_->GetStatus (handle, libtorrent::torrent_handle::query_torrent_file).torrent_file.lock (); const auto numFiles = infoPtr ? infoPtr->num_files () : 0; -#elif LIBTORRENT_VERSION_NUM >= 10000 +#else const auto& infoPtr = StatusKeeper_->GetStatus (handle, libtorrent::torrent_handle::query_torrent_file).torrent_file; const auto numFiles = infoPtr ? infoPtr->num_files () : 0; -#else - const auto numFiles = handle.get_torrent_info ().num_files (); #endif priorities.resize (numFiles); std::fill (priorities.begin (), priorities.end (), 1); @@ -1907,16 +1858,9 @@ namespace BitTorrent atp.flags |= libtorrent::add_torrent_params::flag_paused; atp.flags |= libtorrent::add_torrent_params::flag_duplicate_is_error; -#if LIBTORRENT_VERSION_NUM >= 10000 std::copy (resumeData.constData (), resumeData.constData () + resumeData.size (), std::back_inserter (atp.resume_data)); -#else - atp.resume_data = new std::vector<char>; - std::copy (resumeData.constData (), - resumeData.constData () + resumeData.size (), - std::back_inserter (*atp.resume_data)); -#endif handle = Session_->add_torrent (atp); if (XmlSettingsManager::Instance ()->property ("ResolveCountries").toBool ()) @@ -1935,14 +1879,11 @@ namespace BitTorrent { TorrentStruct torrent = Handles_.at (i); const auto& status = StatusKeeper_->GetStatus (torrent.Handle_, -#if LIBTORRENT_VERSION_NUM >= 10000 libtorrent::torrent_handle::query_save_path | libtorrent::torrent_handle::query_torrent_file | libtorrent::torrent_handle::query_name | -#endif libtorrent::torrent_handle::query_pieces); -#if LIBTORRENT_VERSION_NUM >= 10000 const auto& name = QString::fromStdString (status.name); #if LIBTORRENT_VERSION_NUM >= 10100 @@ -1959,10 +1900,6 @@ namespace BitTorrent return; } const auto& info = *filePtr; -#else - const auto& info = torrent.Handle_.get_torrent_info (); - const auto& name = QString::fromUtf8 (info.name ().c_str ()); -#endif if (LiveStreamManager_->IsEnabledOn (torrent.Handle_) && status.num_pieces != info.num_pieces ()) @@ -1977,11 +1914,7 @@ namespace BitTorrent "org.LC.Plugins.BitTorrent.DLFinished/" + name, QStringList (name)); -#if LIBTORRENT_VERSION_NUM >= 10000 const auto& savePath = status.save_path; -#else - const auto& savePath = torrent.Handle_.save_path (); -#endif const auto& savePathStr = QString::fromUtf8 (savePath.c_str ()); const auto iem = Proxy_->GetEntityManager (); @@ -2141,12 +2074,8 @@ namespace BitTorrent if (handle.need_save_resume_data ()) handle.save_resume_data (); -#if LIBTORRENT_VERSION_NUM >= 10000 const auto& savePath = StatusKeeper_->GetStatus (handle, libtorrent::torrent_handle::query_save_path).save_path; -#else - const auto& savePath = Handles_.at (i).Handle_.save_path (); -#endif settings.setValue ("SavePath", QString::fromUtf8 (savePath.c_str ())); settings.setValue ("Filename", @@ -2408,13 +2337,9 @@ namespace BitTorrent private: QString GetTorrentName (const libtorrent::torrent_handle& handle) const { -#if LIBTORRENT_VERSION_NUM >= 10000 const auto& status = Core::Instance ()->GetStatusKeeper ()-> GetStatus (handle, libtorrent::torrent_handle::query_name); return QString::fromStdString (status.name); -#else - return QString::fromStdString (handle.name ()); -#endif } }; diff --git a/src/plugins/bittorrent/livestreamdevice.cpp b/src/plugins/bittorrent/livestreamdevice.cpp index f9cec65..1bae83d 100644 --- a/src/plugins/bittorrent/livestreamdevice.cpp +++ b/src/plugins/bittorrent/livestreamdevice.cpp @@ -42,7 +42,6 @@ namespace BitTorrent : QIODevice (parent) , StatusKeeper_ (keeper) , Handle_ (h) -#if LIBTORRENT_VERSION_NUM >= 10000 , TI_ { [&] @@ -57,15 +56,8 @@ namespace BitTorrent return *tf; } () } -#else - , TI_ { h.get_torrent_info () } -#endif { -#if LIBTORRENT_VERSION_NUM >= 10000 const auto& tpath = keeper->GetStatus (h, th::query_save_path).save_path; -#else - const auto& tpath = h.save_path (); -#endif const auto& fpath = TI_.file_at (0).path; File_.setFileName (QString::fromStdString (tpath + '/' + fpath)); diff --git a/src/plugins/bittorrent/sessionsettingsmanager.cpp b/src/plugins/bittorrent/sessionsettingsmanager.cpp index 310c680..c49e386 100644 --- a/src/plugins/bittorrent/sessionsettingsmanager.cpp +++ b/src/plugins/bittorrent/sessionsettingsmanager.cpp @@ -58,11 +58,6 @@ namespace BitTorrent sslPortChanged (); tcpPortRangeChanged (); -#if LIBTORRENT_VERSION_NUM < 10000 - if (XmlSettingsManager::Instance ()-> - property ("EnableMetadata").toBool ()) - Session_->add_extension (&libtorrent::create_metadata_plugin); -#endif if (XmlSettingsManager::Instance ()-> property ("EnablePEX").toBool ()) Session_->add_extension (&libtorrent::create_ut_pex_plugin); diff --git a/src/plugins/bittorrent/tabwidget.cpp b/src/plugins/bittorrent/tabwidget.cpp index 2e7faa9..7341be7 100644 --- a/src/plugins/bittorrent/tabwidget.cpp +++ b/src/plugins/bittorrent/tabwidget.cpp @@ -140,14 +140,7 @@ namespace BitTorrent Ui_.LabelWantedSize_->setText (Util::MakePrettySize (i->Status_.total_wanted)); Ui_.LabelTotalUploaded_->setText (Util::MakePrettySize (i->Status_.all_time_upload)); Ui_.PiecesWidget_->setPieceMap (i->Status_.pieces); -#if LIBTORRENT_VERSION_NUM >= 10000 Ui_.LabelName_->setText (QString::fromStdString (i->Status_.name)); -#else - if (i->Info_) - Ui_.LabelName_->setText (QString::fromStdString (i->Info_->name ())); - else - Ui_.LabelName_->setText ({}); -#endif } void TabWidget::on_OverallDownloadRateController__valueChanged (int val) diff --git a/src/plugins/bittorrent/torrentfilesmodel.cpp b/src/plugins/bittorrent/torrentfilesmodel.cpp index d2a1959..47154a6 100644 --- a/src/plugins/bittorrent/torrentfilesmodel.cpp +++ b/src/plugins/bittorrent/torrentfilesmodel.cpp @@ -379,12 +379,8 @@ namespace BitTorrent void TorrentFilesModel::update () { const auto& handle = Core::Instance ()->GetTorrentHandle (Index_); -#if LIBTORRENT_VERSION_NUM >= 10000 const auto& base = Core::Instance ()->GetStatusKeeper ()-> GetStatus (handle, libtorrent::torrent_handle::query_save_path).save_path; -#else - const auto& base = handle.save_path (); -#endif const auto& files = Core::Instance ()->GetTorrentFiles (Index_); UpdateFiles (base, files); diff --git a/src/plugins/bittorrent/torrentsettings.xml b/src/plugins/bittorrent/torrentsettings.xml index e86d736..6bca3f7 100644 --- a/src/plugins/bittorrent/torrentsettings.xml +++ b/src/plugins/bittorrent/torrentsettings.xml @@ -106,11 +106,8 @@ <item type="checkbox" property="EnablePEX" default="true"> <label lang="en" value="Enable PeX" /> </item> - <item type="checkbox" property="EnableMetadata" default="true"> - <label lang="en" value="Allow to download metadata from the swarm" /> - </item> <item type="checkbox" property="EnableUTMetadata" default="true"> - <label lang="en" value="Same as the above, but µTorrent-compatible" /> + <label lang="en" value="Allow downloading the metadata from the swarm in a µTorrent-compatible way" /> </item> <item type="checkbox" property="EnableSmartBan" default="true"> <label lang="en" value="Enable Smart Ban" /> diff --git a/src/plugins/bittorrent/torrenttabwidget.cpp b/src/plugins/bittorrent/torrenttabwidget.cpp index a3efbb1..9c4a051 100644 --- a/src/plugins/bittorrent/torrenttabwidget.cpp +++ b/src/plugins/bittorrent/torrenttabwidget.cpp @@ -473,11 +473,7 @@ namespace BitTorrent Ui_.LabelTracker_->setText (QString::fromStdString (i->Status_.current_tracker)); Ui_.LabelDestination_->setText (QString ("<a href='%1'>%1</a>") .arg (i->Destination_)); -#if LIBTORRENT_VERSION_NUM >= 10000 Ui_.LabelName_->setText (QString::fromStdString (i->Status_.name)); -#else - Ui_.LabelName_->setText (QString::fromStdString (i->Info_->name ())); -#endif Ui_.LabelCreator_->setText (QString::fromStdString (i->Info_->creator ())); const auto& commentString = QString::fromStdString (i->Info_->comment ()); commit 81cd2d82a0f49b935c61c336f8322d46375c6c25 Author: 0xd34df00d <0xd34df00d@gmail.com> Date: Sun May 8 19:06:20 2016 +0100 [BT] Fixed build with libtorrent 1.1 and boost.chrono. diff --git a/src/plugins/bittorrent/torrenttabwidget.cpp b/src/plugins/bittorrent/torrenttabwidget.cpp index a3efbb1..d15affe 100644 --- a/src/plugins/bittorrent/torrenttabwidget.cpp +++ b/src/plugins/bittorrent/torrenttabwidget.cpp @@ -399,7 +399,7 @@ namespace BitTorrent QTime Announce2Time (const libtorrent::time_duration& announce) { return QTime { 0, 0 } - .addMSecs (std::chrono::duration_cast<std::chrono::seconds> (announce).count ()); + .addMSecs (libtorrent::duration_cast<libtorrent::seconds> (announce).count ()); } #else QTime Announce2Time (const boost::posix_time::time_duration& announce) commit f36242163844e9e1d8b722ea0cf3b4d82def9269 Author: 0xd34df00d <0xd34df00d@gmail.com> Date: Thu Jun 30 03:45:41 2016 +0100 [BT] Don't define BOOST_ASIO_DYN_LINK. Seems to fix defining some asio symbols with libtorrent 1.1.0. diff --git a/src/plugins/bittorrent/CMakeLists.txt b/src/plugins/bittorrent/CMakeLists.txt index 3ebef80..d75d260 100644 --- a/src/plugins/bittorrent/CMakeLists.txt +++ b/src/plugins/bittorrent/CMakeLists.txt @@ -127,10 +127,6 @@ if (UNIX) ) message (STATUS "BitTorrent: fetched flags for version ${RB_LT_VERSION}: ${RB_LT_CFLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RB_LT_CFLAGS}") - - if (RB_LT_VERSION VERSION_GREATER 0.15.9999) - add_definitions (-DBOOST_ASIO_DYN_LINK) - endif () endif () if (WIN32) commit 83dc80a1d238a0fb9d305f509eb4ba687e06a0ac Author: 0xd34df00d <0xd34df00d@gmail.com> Date: Thu Jun 30 03:51:53 2016 +0100 [BT] Set empty IP filter after initializing the session. Seems to fix a crash with libtorrent 1.1.0. diff --git a/src/plugins/bittorrent/core.cpp b/src/plugins/bittorrent/core.cpp index ecb6b75..1ce65a2 100644 --- a/src/plugins/bittorrent/core.cpp +++ b/src/plugins/bittorrent/core.cpp @@ -188,6 +188,7 @@ namespace BitTorrent ver.at (2).digitValue (), ver.at (3).digitValue ()), 0); + Session_->set_ip_filter ({}); SessionSettingsMgr_ = new SessionSettingsManager { Session_, Proxy_, this }; diff --git a/src/plugins/bittorrent/CMakeLists.txt b/src/plugins/bittorrent/CMakeLists.txt index d75d260..d522a7c 100644 --- a/src/plugins/bittorrent/CMakeLists.txt +++ b/src/plugins/bittorrent/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 2.8) project (leechcraft_bittorrent) include (InitLCPlugin OPTIONAL) -find_package (Boost REQUIRED COMPONENTS date_time filesystem system thread) +find_package (Boost REQUIRED COMPONENTS chrono date_time filesystem system thread) set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) @@ -161,6 +161,7 @@ target_link_libraries (leechcraft_bittorrent ${Boost_THREAD_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} + ${Boost_CHRONO_LIBRARY} ${QT_LIBRARIES} ${RBTorrent_LIBRARY} ${LEECHCRAFT_LIBRARIES}
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor