Browse Source

Correctly handle changing of global save path

adaptive-webui-19844
Vladimir Golovnev (Glassez) 3 years ago
parent
commit
04c1988665
No known key found for this signature in database
GPG Key ID: 52A2C7DEE2DFA6F7
  1. 25
      src/base/bittorrent/session.cpp

25
src/base/bittorrent/session.cpp

@ -2525,18 +2525,27 @@ void Session::setSavePath(const Path &path) @@ -2525,18 +2525,27 @@ void Session::setSavePath(const Path &path)
if (newPath == m_savePath)
return;
m_savePath = newPath;
if (isDisableAutoTMMWhenDefaultSavePathChanged())
{
QSet<QString> affectedCatogories {{}}; // includes default (unnamed) category
for (auto it = m_categories.cbegin(); it != m_categories.cend(); ++it)
{
const QString &categoryName = it.key();
const CategoryOptions &categoryOptions = it.value();
if (categoryOptions.savePath.isRelative())
affectedCatogories.insert(categoryName);
}
for (TorrentImpl *const torrent : asConst(m_torrents))
torrent->setAutoTMMEnabled(false);
}
else
{
for (TorrentImpl *const torrent : asConst(m_torrents))
torrent->handleCategoryOptionsChanged();
{
if (affectedCatogories.contains(torrent->category()))
torrent->setAutoTMMEnabled(false);
}
}
m_savePath = newPath;
for (TorrentImpl *const torrent : asConst(m_torrents))
torrent->handleCategoryOptionsChanged();
}
void Session::setDownloadPath(const Path &path)

Loading…
Cancel
Save