Browse Source

Add uploadLimit, downloadLimit fields to AddTorrentData & AddTorrentParams

adaptive-webui-19844
Chocobo1 7 years ago
parent
commit
66b86888fc
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 2
      src/base/bittorrent/addtorrentparams.h
  2. 2
      src/base/bittorrent/session.cpp
  3. 4
      src/base/bittorrent/torrenthandle.cpp
  4. 2
      src/base/bittorrent/torrenthandle.h

2
src/base/bittorrent/addtorrentparams.h

@ -52,5 +52,7 @@ namespace BitTorrent @@ -52,5 +52,7 @@ namespace BitTorrent
bool skipChecking = false;
TriStateBool createSubfolder;
TriStateBool useAutoTMM;
int uploadLimit = -1;
int downloadLimit = -1;
};
}

2
src/base/bittorrent/session.cpp

@ -2193,6 +2193,8 @@ bool Session::addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri @@ -2193,6 +2193,8 @@ bool Session::addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri
p.max_connections = maxConnectionsPerTorrent();
p.max_uploads = maxUploadsPerTorrent();
p.save_path = Utils::Fs::toNativePath(savePath).toStdString();
p.upload_limit = addData.uploadLimit;
p.download_limit = addData.downloadLimit;
m_addingTorrents.insert(hash, addData);
// Adding torrent to BitTorrent session

4
src/base/bittorrent/torrenthandle.cpp

@ -95,6 +95,8 @@ AddTorrentData::AddTorrentData() @@ -95,6 +95,8 @@ AddTorrentData::AddTorrentData()
, hasRootFolder(true)
, addForced(false)
, addPaused(false)
, uploadLimit(-1)
, downloadLimit(-1)
, ratioLimit(TorrentHandle::USE_GLOBAL_RATIO)
, seedingTimeLimit(TorrentHandle::USE_GLOBAL_SEEDING_TIME)
{
@ -118,6 +120,8 @@ AddTorrentData::AddTorrentData(const AddTorrentParams &params) @@ -118,6 +120,8 @@ AddTorrentData::AddTorrentData(const AddTorrentParams &params)
, addPaused(params.addPaused == TriStateBool::Undefined
? Session::instance()->isAddTorrentPaused()
: params.addPaused == TriStateBool::True)
, uploadLimit(params.uploadLimit)
, downloadLimit(params.downloadLimit)
, filePriorities(params.filePriorities)
, ratioLimit(params.ignoreShareLimits ? TorrentHandle::NO_RATIO_LIMIT : TorrentHandle::USE_GLOBAL_RATIO)
, seedingTimeLimit(params.ignoreShareLimits ? TorrentHandle::NO_SEEDING_TIME_LIMIT : TorrentHandle::USE_GLOBAL_SEEDING_TIME)

2
src/base/bittorrent/torrenthandle.h

@ -104,6 +104,8 @@ namespace BitTorrent @@ -104,6 +104,8 @@ namespace BitTorrent
bool hasRootFolder;
bool addForced;
bool addPaused;
int uploadLimit;
int downloadLimit;
// for new torrents
QVector<int> filePriorities;
// for resumed torrents

Loading…
Cancel
Save