Browse Source

Fix explicit Torrent Management Mode in Add New Torrent dialog. Closes #5602.

adaptive-webui-19844
sledgehammer999 7 years ago
parent
commit
6270433237
No known key found for this signature in database
GPG Key ID: 6E4A2D025B7CC9A2
  1. 1
      src/base/bittorrent/addtorrentparams.h
  2. 4
      src/base/bittorrent/session.cpp
  3. 7
      src/base/bittorrent/torrenthandle.cpp
  4. 4
      src/gui/addnewtorrentdialog.cpp

1
src/base/bittorrent/addtorrentparams.h

@ -51,5 +51,6 @@ namespace BitTorrent
bool ignoreShareLimits = false; bool ignoreShareLimits = false;
bool skipChecking = false; bool skipChecking = false;
TriStateBool createSubfolder; TriStateBool createSubfolder;
TriStateBool useAutoTMM;
}; };
} }

4
src/base/bittorrent/session.cpp

@ -1855,9 +1855,7 @@ bool Session::addTorrent(const TorrentInfo &torrentInfo, const AddTorrentParams
bool Session::addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri, bool Session::addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri,
TorrentInfo torrentInfo, const QByteArray &fastresumeData) TorrentInfo torrentInfo, const QByteArray &fastresumeData)
{ {
addData.savePath = normalizeSavePath( addData.savePath = normalizeSavePath(addData.savePath, "");
addData.savePath,
((!addData.resumed && isAutoTMMDisabledByDefault()) ? defaultSavePath() : ""));
if (!addData.category.isEmpty()) { if (!addData.category.isEmpty()) {
if (!m_categories.contains(addData.category) && !addCategory(addData.category)) { if (!m_categories.contains(addData.category) && !addCategory(addData.category)) {

7
src/base/bittorrent/torrenthandle.cpp

@ -120,6 +120,13 @@ AddTorrentData::AddTorrentData(const AddTorrentParams &params)
, 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)
{ {
bool useAutoTMM = (params.useAutoTMM == TriStateBool::Undefined
? !Session::instance()->isAutoTMMDisabledByDefault()
: params.useAutoTMM == TriStateBool::True);
if (useAutoTMM)
savePath = "";
else if (savePath.trimmed().isEmpty())
savePath = Session::instance()->defaultSavePath();
} }
// TorrentState // TorrentState

4
src/gui/addnewtorrentdialog.cpp

@ -624,11 +624,15 @@ void AddNewTorrentDialog::accept()
QString savePath = ui->savePath->selectedPath(); QString savePath = ui->savePath->selectedPath();
if (ui->comboTTM->currentIndex() != 1) { // 0 is Manual mode and 1 is Automatic mode. Handle all non 1 values as manual mode. if (ui->comboTTM->currentIndex() != 1) { // 0 is Manual mode and 1 is Automatic mode. Handle all non 1 values as manual mode.
m_torrentParams.useAutoTMM = TriStateBool::False;
m_torrentParams.savePath = savePath; m_torrentParams.savePath = savePath;
saveSavePathHistory(); saveSavePathHistory();
if (ui->defaultSavePathCheckBox->isChecked()) if (ui->defaultSavePathCheckBox->isChecked())
BitTorrent::Session::instance()->setDefaultSavePath(savePath); BitTorrent::Session::instance()->setDefaultSavePath(savePath);
} }
else {
m_torrentParams.useAutoTMM = TriStateBool::True;
}
setEnabled(!ui->never_show_cb->isChecked()); setEnabled(!ui->never_show_cb->isChecked());

Loading…
Cancel
Save