From df8d6f0e9d900d1e2780f23f2d1210d0709f6223 Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Fri, 7 Feb 2025 09:52:42 +0300 Subject: [PATCH] Don't export a torrent file in a deprecated way --- src/base/bittorrent/torrentimpl.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index fe01b01bc0f9..8bd031133f44 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -1,6 +1,6 @@ /* * Bittorrent Client using Qt and libtorrent. - * Copyright (C) 2015-2024 Vladimir Golovnev + * Copyright (C) 2015-2025 Vladimir Golovnev * Copyright (C) 2006 Christophe Dumez * * This program is free software; you can redistribute it and/or @@ -38,10 +38,10 @@ #include #include -#include #include #include #include +#include #ifdef QBT_USES_LIBTORRENT2 #include @@ -2888,18 +2888,9 @@ nonstd::expected TorrentImpl::exportTorrent() const try { -#ifdef QBT_USES_LIBTORRENT2 - const std::shared_ptr completeTorrentInfo = m_nativeHandle.torrent_file_with_hashes(); - const std::shared_ptr torrentInfo = (completeTorrentInfo ? completeTorrentInfo : info().nativeInfo()); -#else - const std::shared_ptr torrentInfo = info().nativeInfo(); -#endif - lt::create_torrent creator {*torrentInfo}; - - for (const TrackerEntryStatus &status : asConst(trackers())) - creator.add_tracker(status.url.toStdString(), status.tier); - - return creator.generate(); + lt::add_torrent_params addTorrentParams = m_ltAddTorrentParams; + addTorrentParams.ti = info().nativeInfo(); + return lt::write_torrent_file(addTorrentParams); } catch (const lt::system_error &err) {