Hello community, here is the log from the commit of package qbittorrent for openSUSE:Factory checked in at 2015-04-27 13:05:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qbittorrent (Old) and /work/SRC/openSUSE:Factory/.qbittorrent.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qbittorrent" Changes: -------- --- /work/SRC/openSUSE:Factory/qbittorrent/qbittorrent.changes 2015-02-24 13:07:21.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.qbittorrent.new/qbittorrent.changes 2015-04-27 13:05:08.000000000 +0200 @@ -1,0 +2,6 @@ +Sun Apr 26 10:06:30 UTC 2015 - [email protected] + +- Add qbittorrent-libtorrent-1.0.patch for libtorrent-rasterbar + 1.0 support. + +------------------------------------------------------------------- New: ---- qbittorrent-libtorrent-1.0.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qbittorrent.spec ++++++ --- /var/tmp/diff_new_pack.OXK3mt/_old 2015-04-27 13:05:08.000000000 +0200 +++ /var/tmp/diff_new_pack.OXK3mt/_new 2015-04-27 13:05:08.000000000 +0200 @@ -26,6 +26,8 @@ Group: Productivity/Networking/File-Sharing Url: http://qbittorrent.org/ Source: https://github.com/%{name}/%{_name}/archive/release-%{version}.tar.gz#/%{name}-%{version}.tar.gz +# PATCH-FIX-UPSTREAM qbittorrent-libtorrent-1.0.patch [email protected] -- Add libtorrent-rasterbar 1.0 support. +Patch0: %{name}-libtorrent-1.0.patch BuildRequires: boost-devel >= 1.35 BuildRequires: fdupes BuildRequires: hicolor-icon-theme @@ -63,6 +65,7 @@ %prep %setup -q -n %{_name}-release-%{version} +%patch0 -p1 sed -i 's/\(QMAKE_CXXFLAGS += \)/\1%{optflags} /' unixconf.pri %build @@ -104,16 +107,16 @@ %files %defattr(-,root,root) %doc AUTHORS Changelog COPYING NEWS README.md TODO -%doc %{_mandir}/man?/%{name}.?%{?ext_man} %{_bindir}/%{name} %{_datadir}/applications/%{_name}.desktop %{_datadir}/icons/hicolor/*/apps/%{name}.png %{_datadir}/pixmaps/%{name}.png +%{_mandir}/man?/%{name}.?%{?ext_man} %files nox %defattr(-,root,root) %doc AUTHORS Changelog COPYING NEWS README.md TODO -%doc %{_mandir}/man?/%{name}-nox.?%{?ext_man} %{_bindir}/%{name}-nox +%{_mandir}/man?/%{name}-nox.?%{?ext_man} %changelog ++++++ qbittorrent-libtorrent-1.0.patch ++++++ diff -aur a/src/misc.h b/src/misc.h --- a/src/misc.h +++ b/src/misc.h @@ -71,7 +71,11 @@ inline QString toQString(const libtorrent::sha1_hash &hash) { char out[41]; +#if LIBTORRENT_VERSION_NUM >= 10000 + libtorrent::to_hex((char const*)&hash[0], libtorrent::sha1_hash::size, out); +#else to_hex((char const*)&hash[0], libtorrent::sha1_hash::size, out); +#endif return QString(out); } diff -aur a/src/properties/peerlistwidget.cpp b/src/properties/peerlistwidget.cpp --- a/src/properties/peerlistwidget.cpp +++ b/src/properties/peerlistwidget.cpp @@ -161,16 +161,20 @@ empty_menu = false; } // Per Peer Speed limiting actions +#if LIBTORRENT_VERSION_NUM < 10000 QAction *upLimitAct = 0; QAction *dlLimitAct = 0; +#endif QAction *banAct = 0; QAction *copyIPAct = 0; if (!selectedPeerIPs.isEmpty()) { copyIPAct = menu.addAction(IconProvider::instance()->getIcon("edit-copy"), tr("Copy IP")); menu.addSeparator(); +#if LIBTORRENT_VERSION_NUM < 10000 dlLimitAct = menu.addAction(QIcon(":/Icons/skin/download.png"), tr("Limit download rate...")); upLimitAct = menu.addAction(QIcon(":/Icons/skin/seeding.png"), tr("Limit upload rate...")); menu.addSeparator(); +#endif banAct = menu.addAction(IconProvider::instance()->getIcon("user-group-delete"), tr("Ban peer permanently")); empty_menu = false; } @@ -191,6 +195,7 @@ } return; } +#if LIBTORRENT_VERSION_NUM < 10000 if (act == upLimitAct) { limitUpRateSelectedPeers(selectedPeerIPs); return; @@ -199,6 +204,7 @@ limitDlRateSelectedPeers(selectedPeerIPs); return; } +#endif if (act == banAct) { banSelectedPeers(selectedPeerIPs); return; @@ -230,6 +236,7 @@ loadPeers(m_properties->getCurrentTorrent()); } +#if LIBTORRENT_VERSION_NUM < 10000 void PeerListWidget::limitUpRateSelectedPeers(const QStringList& peer_ips) { if (peer_ips.empty()) @@ -299,7 +306,7 @@ } } } - +#endif void PeerListWidget::clear() { qDebug("clearing peer list"); @@ -384,7 +391,7 @@ m_missingFlags.insert(ip); } } - m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), getConnectionString(peer.connection_type)); + m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), getConnectionString(peer)); QString flags, tooltip; getFlags(peer, flags, tooltip); m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), flags); @@ -410,7 +417,7 @@ m_missingFlags.remove(ip); } } - m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), getConnectionString(peer.connection_type)); + m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), getConnectionString(peer)); QString flags, tooltip; getFlags(peer, flags, tooltip); m_listModel->setData(m_listModel->index(row, PeerListDelegate::PORT), QString::number(peer.ip.port())); @@ -442,14 +449,21 @@ } } -QString PeerListWidget::getConnectionString(int connection_type) +QString PeerListWidget::getConnectionString(const peer_info& peer) { +#if LIBTORRENT_VERSION_NUM >= 1600 +#if LIBTORRENT_VERSION_NUM < 10000 + if (peer.connection_type & peer_info::bittorrent_utp) { +#else + if (peer.flags & peer_info::utp_socket) { +#endif + return QString::fromUtf8("μTP"); + } +#endif + QString connection; - switch(connection_type) { + switch(peer.connection_type) { #if LIBTORRENT_VERSION_NUM >= 1600 - case peer_info::bittorrent_utp: - connection = QString::fromUtf8("μTP"); - break; case peer_info::http_seed: #endif case peer_info::web_seed: @@ -558,7 +572,11 @@ } #if LIBTORRENT_VERSION_NUM > 1500 //P = Peer is using uTorrent uTP +#if LIBTORRENT_VERSION_NUM < 10000 if (peer.connection_type & peer_info::bittorrent_utp) { +#else + if (peer.flags & peer_info::utp_socket) { +#endif flags += "P "; tooltip += QString::fromUtf8("μTP"); tooltip += ", "; diff -aur a/src/properties/peerlistwidget.h b/src/properties/peerlistwidget.h --- a/src/properties/peerlistwidget.h +++ b/src/properties/peerlistwidget.h @@ -77,13 +77,17 @@ void loadSettings(); void saveSettings() const; void showPeerListMenu(const QPoint&); + +#if LIBTORRENT_VERSION_NUM < 10000 void limitUpRateSelectedPeers(const QStringList& peer_ips); void limitDlRateSelectedPeers(const QStringList& peer_ips); +#endif + void banSelectedPeers(const QStringList& peer_ips); void handleSortColumnChanged(int col); private: - static QString getConnectionString(int connection_type); + static QString getConnectionString(const libtorrent::peer_info &peer); static void getFlags(const libtorrent::peer_info& peer, QString& flags, QString& tooltip); private: diff -aur a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -67,8 +67,6 @@ #include <libtorrent/identify_client.hpp> #include <libtorrent/alert_types.hpp> #include <libtorrent/torrent_info.hpp> -#include <libtorrent/upnp.hpp> -#include <libtorrent/natpmp.hpp> #if LIBTORRENT_VERSION_NUM < 1600 #include <boost/filesystem/exception.hpp> #include <boost/filesystem.hpp> @@ -77,6 +75,10 @@ #if LIBTORRENT_VERSION_NUM >= 1600 #include "libtorrent/error_code.hpp" #endif +#if LIBTORRENT_VERSION_NUM < 10000 +#include <libtorrent/upnp.hpp> +#include <libtorrent/natpmp.hpp> +#endif #include <queue> #include <string.h> #include "dnsupdater.h" @@ -114,8 +116,11 @@ #ifndef DISABLE_GUI , geoipDBLoaded(false), resolve_countries(false) #endif - , m_tracker(0), m_shutdownAct(NO_SHUTDOWN), - m_upnp(0), m_natpmp(0), m_dynDNSUpdater(0) + , m_tracker(0), m_shutdownAct(NO_SHUTDOWN) +#if LIBTORRENT_VERSION_NUM < 10000 + , m_upnp(0), m_natpmp(0) +#endif + , m_dynDNSUpdater(0) { BigRatioTimer = new QTimer(this); BigRatioTimer->setInterval(10000); @@ -1181,7 +1186,11 @@ if (resumed) { if (loadFastResumeData(hash, buf)) { fastResume = true; +#if LIBTORRENT_VERSION_NUM < 10000 p.resume_data = &buf; +#else + p.resume_data = buf; +#endif qDebug("Successfully loaded fast resume data"); } } @@ -1553,25 +1562,33 @@ void QBtSession::enableUPnP(bool b) { Preferences pref; if (b) { - if (!m_upnp) { - qDebug("Enabling UPnP / NAT-PMP"); - m_upnp = s->start_upnp(); - m_natpmp = s->start_natpmp(); - } + qDebug("Enabling UPnP / NAT-PMP"); +#if LIBTORRENT_VERSION_NUM < 10000 + m_upnp = s->start_upnp(); + m_natpmp = s->start_natpmp(); +#else + s->start_upnp(); + s->start_natpmp(); +#endif // Use UPnP/NAT-PMP for Web UI too if (pref.isWebUiEnabled() && pref.useUPnPForWebUIPort()) { const qint16 port = pref.getWebUiPort(); +#if LIBTORRENT_VERSION_NUM < 10000 m_upnp->add_mapping(upnp::tcp, port, port); m_natpmp->add_mapping(natpmp::tcp, port, port); +#else + s->add_port_mapping(session::tcp, port, port); +#endif } } else { - if (m_upnp) { - qDebug("Disabling UPnP / NAT-PMP"); - s->stop_upnp(); - s->stop_natpmp(); - m_upnp = 0; - m_natpmp = 0; - } + qDebug("Disabling UPnP / NAT-PMP"); + s->stop_upnp(); + s->stop_natpmp(); + +#if LIBTORRENT_VERSION_NUM < 10000 + m_upnp = 0; + m_natpmp = 0; +#endif } } diff -aur a/src/qtlibtorrent/qbtsession.h b/src/qtlibtorrent/qbtsession.h --- a/src/qtlibtorrent/qbtsession.h +++ b/src/qtlibtorrent/qbtsession.h @@ -280,9 +280,11 @@ QPointer<QTracker> m_tracker; TorrentSpeedMonitor *m_speedMonitor; shutDownAction m_shutdownAct; +#if LIBTORRENT_VERSION_NUM < 10000 // Port forwarding libtorrent::upnp *m_upnp; libtorrent::natpmp *m_natpmp; +#endif // DynDNS DNSUpdater *m_dynDNSUpdater; }; diff -aur a/src/qtlibtorrent/qtorrenthandle.cpp b/src/qtlibtorrent/qtorrenthandle.cpp --- a/src/qtlibtorrent/qtorrenthandle.cpp +++ b/src/qtlibtorrent/qtorrenthandle.cpp @@ -87,14 +87,22 @@ QString QTorrentHandle::name() const { QString name = TorrentPersistentData::getName(hash()); if (name.isEmpty()) { +#if LIBTORRENT_VERSION_NUM < 10000 name = misc::toQStringU(torrent_handle::name()); +#else + name = misc::toQStringU(status(query_name).name); +#endif } return name; } QString QTorrentHandle::creation_date() const { #if LIBTORRENT_VERSION_NUM >= 1600 +#if LIBTORRENT_VERSION_NUM < 10000 boost::optional<time_t> t = torrent_handle::get_torrent_info().creation_date(); +#else + boost::optional<time_t> t = torrent_handle::torrent_file()->creation_date(); +#endif return t ? misc::toQString(*t) : ""; #else boost::optional<boost::posix_time::ptime> boostDate = torrent_handle::get_torrent_info().creation_date(); @@ -168,38 +176,54 @@ } size_type QTorrentHandle::total_size() const { +#if LIBTORRENT_VERSION_NUM < 10000 return torrent_handle::get_torrent_info().total_size(); +#else + return torrent_handle::torrent_file()->total_size(); +#endif } size_type QTorrentHandle::piece_length() const { +#if LIBTORRENT_VERSION_NUM < 10000 return torrent_handle::get_torrent_info().piece_length(); +#else + return torrent_handle::torrent_file()->piece_length(); +#endif } int QTorrentHandle::num_pieces() const { +#if LIBTORRENT_VERSION_NUM < 10000 return torrent_handle::get_torrent_info().num_pieces(); +#else + return torrent_handle::torrent_file()->num_pieces(); +#endif } bool QTorrentHandle::first_last_piece_first() const { - const torrent_info& t = get_torrent_info(); +#if LIBTORRENT_VERSION_NUM < 10000 + torrent_info const* t = &get_torrent_info(); +#else + boost::intrusive_ptr<torrent_info const> t = torrent_file(); +#endif // Get int first media file int index = 0; - for (index = 0; index < t.num_files(); ++index) { + for (index = 0; index < t->num_files(); ++index) { #if LIBTORRENT_VERSION_NUM >= 1600 - QString path = misc::toQStringU(t.file_at(index).path); + QString path = misc::toQStringU(t->file_at(index).path); #else - QString path = misc::toQStringU(t.file_at(index).path.string()); + QString path = misc::toQStringU(t->file_at(index).path.string()); #endif const QString ext = fsutils::fileExtension(path); if (misc::isPreviewable(ext) && torrent_handle::file_priority(index) > 0) break; } - if (index >= t.num_files()) // No media file + if (index >= t->num_files()) // No media file return false; - QPair<int, int> extremities = get_file_extremity_pieces (t, index); + QPair<int, int> extremities = get_file_extremity_pieces (*t, index); return (torrent_handle::piece_priority(extremities.first) == 7) && (torrent_handle::piece_priority(extremities.second) == 7); @@ -328,11 +352,19 @@ } int QTorrentHandle::num_files() const { +#if LIBTORRENT_VERSION_NUM < 10000 return torrent_handle::get_torrent_info().num_files(); +#else + return torrent_handle::torrent_file()->num_files(); +#endif } QString QTorrentHandle::filename_at(unsigned int index) const { +#if LIBTORRENT_VERSION_NUM < 10000 Q_ASSERT(index < (unsigned int)torrent_handle::get_torrent_info().num_files()); +#else + Q_ASSERT(index < (unsigned int)torrent_handle::torrent_file()->num_files()); +#endif #if LIBTORRENT_VERSION_NUM >= 1600 return fsutils::fileName(filepath_at(index)); #else @@ -341,22 +373,35 @@ } size_type QTorrentHandle::filesize_at(unsigned int index) const { +#if LIBTORRENT_VERSION_NUM < 10000 Q_ASSERT(index < (unsigned int)torrent_handle::get_torrent_info().num_files()); - return torrent_handle::get_torrent_info().file_at(index).size; + return torrent_handle::get_torrent_info().files().file_size(index); +#else + Q_ASSERT(index < (unsigned int)torrent_handle::torrent_file()->num_files()); + return torrent_handle::torrent_file()->files().file_size(index); +#endif } QString QTorrentHandle::filepath_at(unsigned int index) const { #if LIBTORRENT_VERSION_NUM >= 1600 +#if LIBTORRENT_VERSION_NUM < 10000 return misc::toQStringU(torrent_handle::get_torrent_info().file_at(index).path); #else + return misc::toQStringU(torrent_handle::torrent_file()->files().file_path(index)); +#endif +#else return misc::toQStringU(torrent_handle::get_torrent_info().file_at(index).path.string()); #endif } QString QTorrentHandle::orig_filepath_at(unsigned int index) const { #if LIBTORRENT_VERSION_NUM >= 1600 +#if LIBTORRENT_VERSION_NUM < 10000 return misc::toQStringU(torrent_handle::get_torrent_info().orig_files().at(index).path); #else + return misc::toQStringU(torrent_handle::torrent_file()->orig_files().at(index).path); +#endif +#else return misc::toQStringU(torrent_handle::get_torrent_info().orig_files().at(index).path.string()); #endif } @@ -370,11 +415,19 @@ } QString QTorrentHandle::creator() const { +#if LIBTORRENT_VERSION_NUM < 10000 return misc::toQStringU(torrent_handle::get_torrent_info().creator()); +#else + return misc::toQStringU(torrent_handle::torrent_file()->creator()); +#endif } QString QTorrentHandle::comment() const { +#if LIBTORRENT_VERSION_NUM < 10000 return misc::toQStringU(torrent_handle::get_torrent_info().comment()); +#else + return misc::toQStringU(torrent_handle::torrent_file()->comment()); +#endif } size_type QTorrentHandle::total_failed_bytes() const { @@ -549,10 +602,15 @@ #endif } + bool QTorrentHandle::priv() const { if (!has_metadata()) return false; +#if LIBTORRENT_VERSION_NUM < 10000 return torrent_handle::get_torrent_info().priv(); +#else + return torrent_handle::torrent_file()->priv(); +#endif } QString QTorrentHandle::firstFileSavePath() const { @@ -704,10 +762,14 @@ bool QTorrentHandle::save_torrent_file(const QString& path) const { if (!has_metadata()) return false; - const torrent_info& t = torrent_handle::get_torrent_info(); +#if LIBTORRENT_VERSION_NUM < 10000 + torrent_info const* t = &get_torrent_info(); +#else + boost::intrusive_ptr<torrent_info const> t = torrent_file(); +#endif - entry meta = bdecode(t.metadata().get(), - t.metadata().get() + t.metadata_size()); + entry meta = bdecode(t->metadata().get(), + t->metadata().get() + t->metadata_size()); entry torrent_entry(entry::dictionary_t); torrent_entry["info"] = meta; if (!torrent_handle::trackers().empty())
