mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Use std::optional<bool> instead of custom TriStateBool
This commit is contained in:
parent
d0cac421bb
commit
531ae501ad
17 changed files with 75 additions and 235 deletions
|
@ -78,7 +78,6 @@
|
|||
#include "base/profile.h"
|
||||
#include "base/torrentfileguard.h"
|
||||
#include "base/torrentfilter.h"
|
||||
#include "base/tristatebool.h"
|
||||
#include "base/unicodestrings.h"
|
||||
#include "base/utils/bytearray.h"
|
||||
#include "base/utils/fs.h"
|
||||
|
@ -2058,16 +2057,12 @@ LoadTorrentParams Session::initLoadTorrentParams(const AddTorrentParams &addTorr
|
|||
loadTorrentParams.firstLastPiecePriority = addTorrentParams.firstLastPiecePriority;
|
||||
loadTorrentParams.hasSeedStatus = addTorrentParams.skipChecking; // do not react on 'torrent_finished_alert' when skipping
|
||||
loadTorrentParams.contentLayout = addTorrentParams.contentLayout.value_or(torrentContentLayout());
|
||||
loadTorrentParams.forced = (addTorrentParams.addForced == TriStateBool::True);
|
||||
loadTorrentParams.paused = ((addTorrentParams.addPaused == TriStateBool::Undefined)
|
||||
? isAddTorrentPaused()
|
||||
: (addTorrentParams.addPaused == TriStateBool::True));
|
||||
loadTorrentParams.forced = addTorrentParams.addForced;
|
||||
loadTorrentParams.paused = addTorrentParams.addPaused.value_or(isAddTorrentPaused());
|
||||
loadTorrentParams.ratioLimit = addTorrentParams.ratioLimit;
|
||||
loadTorrentParams.seedingTimeLimit = addTorrentParams.seedingTimeLimit;
|
||||
|
||||
const bool useAutoTMM = ((addTorrentParams.useAutoTMM == TriStateBool::Undefined)
|
||||
? !isAutoTMMDisabledByDefault()
|
||||
: (addTorrentParams.useAutoTMM == TriStateBool::True));
|
||||
const bool useAutoTMM = addTorrentParams.useAutoTMM.value_or(!isAutoTMMDisabledByDefault());
|
||||
if (useAutoTMM)
|
||||
loadTorrentParams.savePath = "";
|
||||
else if (addTorrentParams.savePath.trimmed().isEmpty())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue