Browse Source

Fix AddTorrentData field types

adaptive-webui-19844
Vladimir Golovnev (Glassez) 8 years ago
parent
commit
711be50e9c
  1. 14
      src/base/bittorrent/session.cpp
  2. 9
      src/base/bittorrent/torrenthandle.cpp
  3. 4
      src/base/bittorrent/torrenthandle.h

14
src/base/bittorrent/session.cpp

@ -3372,8 +3372,8 @@ void Session::createTorrentHandle(const libt::torrent_handle &nativeHandle) @@ -3372,8 +3372,8 @@ void Session::createTorrentHandle(const libt::torrent_handle &nativeHandle)
bool fromMagnetUri = !torrent->hasMetadata();
if (data.resumed) {
if (fromMagnetUri && (data.addPaused != TriStateBool::True))
torrent->resume(data.addForced == TriStateBool::True);
if (fromMagnetUri && !data.addPaused)
torrent->resume(data.addForced);
logger->addMessage(tr("'%1' resumed. (fast resume)", "'torrent name' was resumed. (fast resume)")
.arg(torrent->name()));
@ -3399,12 +3399,8 @@ void Session::createTorrentHandle(const libt::torrent_handle &nativeHandle) @@ -3399,12 +3399,8 @@ void Session::createTorrentHandle(const libt::torrent_handle &nativeHandle)
if (isAddTrackersEnabled() && !torrent->isPrivate())
torrent->addTrackers(m_additionalTrackerList);
bool addPaused = (data.addPaused == TriStateBool::True);
if (data.addPaused == TriStateBool::Undefined)
addPaused = isAddTorrentPaused();
// Start torrent because it was added in paused state
if (!addPaused)
if (!data.addPaused)
torrent->resume();
logger->addMessage(tr("'%1' added to download list.", "'torrent name' was added to download list.")
.arg(torrent->name()));
@ -3664,8 +3660,8 @@ namespace @@ -3664,8 +3660,8 @@ namespace
torrentData.hasRootFolder = fast.dict_find_int_value("qBt-hasRootFolder");
magnetUri = MagnetUri(QString::fromStdString(fast.dict_find_string_value("qBt-magnetUri")));
torrentData.addPaused = TriStateBool(fast.dict_find_int_value("qBt-paused"));
torrentData.addForced = TriStateBool(fast.dict_find_int_value("qBt-forced"));
torrentData.addPaused = fast.dict_find_int_value("qBt-paused");
torrentData.addForced = fast.dict_find_int_value("qBt-forced");
prio = fast.dict_find_int_value("qBt-queuePosition");

9
src/base/bittorrent/torrenthandle.cpp

@ -76,6 +76,9 @@ AddTorrentData::AddTorrentData() @@ -76,6 +76,9 @@ AddTorrentData::AddTorrentData()
, sequential(false)
, hasSeedStatus(false)
, skipChecking(false)
, hasRootFolder(true)
, addForced(false)
, addPaused(false)
, ratioLimit(TorrentHandle::USE_GLOBAL_RATIO)
{
}
@ -90,8 +93,10 @@ AddTorrentData::AddTorrentData(const AddTorrentParams &params) @@ -90,8 +93,10 @@ AddTorrentData::AddTorrentData(const AddTorrentParams &params)
, hasSeedStatus(params.skipChecking) // do not react on 'torrent_finished_alert' when skipping
, skipChecking(params.skipChecking)
, hasRootFolder(params.createSubfolder)
, addForced(params.addForced)
, addPaused(params.addPaused)
, addForced(params.addForced == TriStateBool::True)
, addPaused(params.addPaused == TriStateBool::Undefined
? Session::instance()->isAddTorrentPaused()
: params.addPaused == TriStateBool::True)
, filePriorities(params.filePriorities)
, ratioLimit(params.ignoreShareRatio ? TorrentHandle::NO_RATIO_LIMIT : TorrentHandle::USE_GLOBAL_RATIO)
{

4
src/base/bittorrent/torrenthandle.h

@ -99,8 +99,8 @@ namespace BitTorrent @@ -99,8 +99,8 @@ namespace BitTorrent
bool hasSeedStatus;
bool skipChecking;
bool hasRootFolder;
TriStateBool addForced;
TriStateBool addPaused;
bool addForced;
bool addPaused;
// for new torrents
QVector<int> filePriorities;
// for resumed torrents

Loading…
Cancel
Save