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
bool skipChecking = false; bool skipChecking = false;
TriStateBool createSubfolder; TriStateBool createSubfolder;
TriStateBool useAutoTMM; 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
p.max_connections = maxConnectionsPerTorrent(); p.max_connections = maxConnectionsPerTorrent();
p.max_uploads = maxUploadsPerTorrent(); p.max_uploads = maxUploadsPerTorrent();
p.save_path = Utils::Fs::toNativePath(savePath).toStdString(); p.save_path = Utils::Fs::toNativePath(savePath).toStdString();
p.upload_limit = addData.uploadLimit;
p.download_limit = addData.downloadLimit;
m_addingTorrents.insert(hash, addData); m_addingTorrents.insert(hash, addData);
// Adding torrent to BitTorrent session // Adding torrent to BitTorrent session

4
src/base/bittorrent/torrenthandle.cpp

@ -95,6 +95,8 @@ AddTorrentData::AddTorrentData()
, hasRootFolder(true) , hasRootFolder(true)
, addForced(false) , addForced(false)
, addPaused(false) , addPaused(false)
, uploadLimit(-1)
, downloadLimit(-1)
, ratioLimit(TorrentHandle::USE_GLOBAL_RATIO) , ratioLimit(TorrentHandle::USE_GLOBAL_RATIO)
, seedingTimeLimit(TorrentHandle::USE_GLOBAL_SEEDING_TIME) , seedingTimeLimit(TorrentHandle::USE_GLOBAL_SEEDING_TIME)
{ {
@ -118,6 +120,8 @@ AddTorrentData::AddTorrentData(const AddTorrentParams &params)
, addPaused(params.addPaused == TriStateBool::Undefined , addPaused(params.addPaused == TriStateBool::Undefined
? Session::instance()->isAddTorrentPaused() ? Session::instance()->isAddTorrentPaused()
: params.addPaused == TriStateBool::True) : params.addPaused == TriStateBool::True)
, uploadLimit(params.uploadLimit)
, downloadLimit(params.downloadLimit)
, filePriorities(params.filePriorities) , filePriorities(params.filePriorities)
, ratioLimit(params.ignoreShareLimits ? TorrentHandle::NO_RATIO_LIMIT : TorrentHandle::USE_GLOBAL_RATIO) , ratioLimit(params.ignoreShareLimits ? TorrentHandle::NO_RATIO_LIMIT : TorrentHandle::USE_GLOBAL_RATIO)
, seedingTimeLimit(params.ignoreShareLimits ? TorrentHandle::NO_SEEDING_TIME_LIMIT : TorrentHandle::USE_GLOBAL_SEEDING_TIME) , 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
bool hasRootFolder; bool hasRootFolder;
bool addForced; bool addForced;
bool addPaused; bool addPaused;
int uploadLimit;
int downloadLimit;
// for new torrents // for new torrents
QVector<int> filePriorities; QVector<int> filePriorities;
// for resumed torrents // for resumed torrents

Loading…
Cancel
Save