mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 16:58:06 -06:00
Improve torrent loading code
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <libtorrent/add_torrent_params.hpp>
|
||||
#include <libtorrent/fwd.hpp>
|
||||
#include <libtorrent/torrent_handle.hpp>
|
||||
#include <libtorrent/torrent_status.hpp>
|
||||
@@ -53,35 +54,26 @@ namespace BitTorrent
|
||||
class Session;
|
||||
struct AddTorrentParams;
|
||||
|
||||
struct CreateTorrentParams
|
||||
struct LoadTorrentParams
|
||||
{
|
||||
CreateTorrentParams() = default;
|
||||
explicit CreateTorrentParams(const AddTorrentParams ¶ms);
|
||||
lt::add_torrent_params ltAddTorrentParams {};
|
||||
|
||||
// for both new and restored torrents
|
||||
QString name;
|
||||
QString category;
|
||||
QSet<QString> tags;
|
||||
QString savePath;
|
||||
int uploadLimit = -1;
|
||||
int downloadLimit = -1;
|
||||
bool disableTempPath = false;
|
||||
bool sequential = false;
|
||||
bool firstLastPiecePriority = false;
|
||||
bool hasSeedStatus = false;
|
||||
bool skipChecking = false;
|
||||
bool hasRootFolder = true;
|
||||
bool forced = false;
|
||||
bool paused = false;
|
||||
bool restored = false; // is existing torrent job?
|
||||
|
||||
// for new torrents
|
||||
QVector<DownloadPriority> filePriorities;
|
||||
QDateTime addedTime;
|
||||
|
||||
// for restored torrents
|
||||
qreal ratioLimit = TorrentHandle::USE_GLOBAL_RATIO;
|
||||
int seedingTimeLimit = TorrentHandle::USE_GLOBAL_SEEDING_TIME;
|
||||
|
||||
bool restored = false; // is existing torrent job?
|
||||
};
|
||||
|
||||
enum class MoveStorageMode
|
||||
@@ -97,7 +89,7 @@ namespace BitTorrent
|
||||
|
||||
public:
|
||||
TorrentHandleImpl(Session *session, const lt::torrent_handle &nativeHandle,
|
||||
const CreateTorrentParams ¶ms);
|
||||
const LoadTorrentParams ¶ms);
|
||||
~TorrentHandleImpl() override;
|
||||
|
||||
bool isValid() const;
|
||||
@@ -329,5 +321,7 @@ namespace BitTorrent
|
||||
bool m_useAutoTMM;
|
||||
|
||||
bool m_unchecked = false;
|
||||
|
||||
lt::add_torrent_params m_ltAddTorrentParams;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user