From 1d3dbcb9d2b2aed4645f9af2cb6521212d2ac533 Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Mon, 1 May 2017 19:58:40 +0300 Subject: [PATCH] Don't use deprecated fields of torrent-related alerts --- src/base/bittorrent/torrenthandle.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/base/bittorrent/torrenthandle.cpp b/src/base/bittorrent/torrenthandle.cpp index 3f4227e61..386ca8ba4 100644 --- a/src/base/bittorrent/torrenthandle.cpp +++ b/src/base/bittorrent/torrenthandle.cpp @@ -1382,7 +1382,11 @@ void TorrentHandle::handleStorageMovedAlert(libtorrent::storage_moved_alert *p) return; } +#if LIBTORRENT_VERSION_NUM < 10100 const QString newPath = QString::fromStdString(p->path); +#else + const QString newPath(p->storage_path()); +#endif if (newPath != m_newPath) { qWarning() << Q_FUNC_INFO << ": New path doesn't match a path in a queue."; return; @@ -1432,7 +1436,11 @@ void TorrentHandle::handleStorageMovedFailedAlert(libtorrent::storage_moved_fail void TorrentHandle::handleTrackerReplyAlert(libtorrent::tracker_reply_alert *p) { +#if LIBTORRENT_VERSION_NUM < 10100 QString trackerUrl = QString::fromStdString(p->url); +#else + QString trackerUrl(p->tracker_url()); +#endif qDebug("Received a tracker reply from %s (Num_peers = %d)", qPrintable(trackerUrl), p->num_peers); // Connection was successful now. Remove possible old errors m_trackerInfos[trackerUrl].lastMessage.clear(); // Reset error/warning message @@ -1443,8 +1451,13 @@ void TorrentHandle::handleTrackerReplyAlert(libtorrent::tracker_reply_alert *p) void TorrentHandle::handleTrackerWarningAlert(libtorrent::tracker_warning_alert *p) { +#if LIBTORRENT_VERSION_NUM < 10100 QString trackerUrl = QString::fromStdString(p->url); QString message = QString::fromStdString(p->msg); +#else + QString trackerUrl(p->tracker_url()); + QString message = QString::fromStdString(p->message()); +#endif qDebug("Received a tracker warning for %s: %s", qPrintable(trackerUrl), qPrintable(message)); // Connection was successful now but there is a warning message m_trackerInfos[trackerUrl].lastMessage = message; // Store warning message @@ -1454,8 +1467,13 @@ void TorrentHandle::handleTrackerWarningAlert(libtorrent::tracker_warning_alert void TorrentHandle::handleTrackerErrorAlert(libtorrent::tracker_error_alert *p) { +#if LIBTORRENT_VERSION_NUM < 10100 QString trackerUrl = QString::fromStdString(p->url); QString message = QString::fromStdString(p->msg); +#else + QString trackerUrl(p->tracker_url()); + QString message = QString::fromStdString(p->message()); +#endif qDebug("Received a tracker error for %s: %s", qPrintable(trackerUrl), qPrintable(message)); m_trackerInfos[trackerUrl].lastMessage = message; @@ -1592,7 +1610,11 @@ void TorrentHandle::handleFastResumeRejectedAlert(libtorrent::fastresume_rejecte void TorrentHandle::handleFileRenamedAlert(libtorrent::file_renamed_alert *p) { +#if LIBTORRENT_VERSION_NUM < 10100 QString newName = Utils::Fs::fromNativePath(QString::fromStdString(p->name)); +#else + QString newName = Utils::Fs::fromNativePath(p->new_name()); +#endif // TODO: Check this! if (filesCount() > 1) {