From 5d889e4a8f0e44c12c30177e6a60e39625152874 Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Sat, 20 Mar 2021 15:15:28 +0300 Subject: [PATCH] Drop deprecated code --- src/base/bittorrent/session.cpp | 46 +---------------------------- src/base/bittorrent/torrentimpl.cpp | 17 ----------- src/base/bittorrent/torrentimpl.h | 1 - 3 files changed, 1 insertion(+), 63 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 683daa5f1..d4c1b4fe3 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -4253,51 +4253,7 @@ bool Session::loadTorrentResumeData(const QByteArray &data, const TorrentInfo &m const bool hasMetadata = (p.ti && p.ti->is_valid()); if (!hasMetadata && !root.dict_find("info-hash")) - { - // TODO: The following code is deprecated. Remove after several releases in 4.3.x. - // === BEGIN DEPRECATED CODE === // - // Try to load from legacy data used in older versions for torrents w/o metadata - const lt::bdecode_node magnetURINode = root.dict_find("qBt-magnetUri"); - if (magnetURINode.type() == lt::bdecode_node::string_t) - { - lt::parse_magnet_uri(magnetURINode.string_value(), p, ec); - - if (isTempPathEnabled()) - { - p.save_path = Utils::Fs::toNativePath(tempPath()).toStdString(); - } - else - { - // If empty then Automatic mode, otherwise Manual mode - const QString savePath = torrentParams.savePath.isEmpty() ? categorySavePath(torrentParams.category) : torrentParams.savePath; - p.save_path = Utils::Fs::toNativePath(savePath).toStdString(); - } - - // Preallocation mode - p.storage_mode = (isPreallocationEnabled() ? lt::storage_mode_allocate : lt::storage_mode_sparse); - - const lt::bdecode_node addedTimeNode = root.dict_find("qBt-addedTime"); - if (addedTimeNode.type() == lt::bdecode_node::int_t) - p.added_time = addedTimeNode.int_value(); - - const lt::bdecode_node sequentialNode = root.dict_find("qBt-sequential"); - if (sequentialNode.type() == lt::bdecode_node::int_t) - { - if (static_cast(sequentialNode.int_value())) - p.flags |= lt::torrent_flags::sequential_download; - else - p.flags &= ~lt::torrent_flags::sequential_download; - } - - if (torrentParams.name.isEmpty() && !p.name.empty()) - torrentParams.name = QString::fromStdString(p.name); - } - // === END DEPRECATED CODE === // - else - { - return false; - } - } + return false; return true; } diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index 066e0fa74..cae29edb8 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -1797,23 +1797,6 @@ void TorrentImpl::handleSaveResumeDataAlert(const lt::save_resume_data_alert *p) auto resumeDataPtr = std::make_shared(lt::write_resume_data(m_ltAddTorrentParams)); lt::entry &resumeData = *resumeDataPtr; - // TODO: The following code is deprecated. Remove after several releases in 4.3.x. - // === BEGIN DEPRECATED CODE === // - const bool useDummyResumeData = !hasMetadata(); - if (useDummyResumeData) - { - updateStatus(); - - resumeData["qBt-magnetUri"] = createMagnetURI().toStdString(); - // sequentialDownload needs to be stored in the - // resume data if there is no metadata, otherwise they won't be - // restored if qBittorrent quits before the metadata are retrieved: - resumeData["qBt-sequential"] = isSequentialDownload(); - - resumeData["qBt-addedTime"] = addedTime().toSecsSinceEpoch(); - } - // === END DEPRECATED CODE === // - resumeData["qBt-savePath"] = m_useAutoTMM ? "" : Profile::instance()->toPortablePath(m_savePath).toStdString(); resumeData["qBt-ratioLimit"] = static_cast(m_ratioLimit * 1000); resumeData["qBt-seedingTimeLimit"] = m_seedingTimeLimit; diff --git a/src/base/bittorrent/torrentimpl.h b/src/base/bittorrent/torrentimpl.h index 16a935066..9aef754dd 100644 --- a/src/base/bittorrent/torrentimpl.h +++ b/src/base/bittorrent/torrentimpl.h @@ -68,7 +68,6 @@ namespace BitTorrent bool forced = false; bool paused = false; - qreal ratioLimit = Torrent::USE_GLOBAL_RATIO; int seedingTimeLimit = Torrent::USE_GLOBAL_SEEDING_TIME;