|
|
@ -613,7 +613,7 @@ void Session::setDownloadPathEnabled(const bool enabled) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_isDownloadPathEnabled = enabled; |
|
|
|
m_isDownloadPathEnabled = enabled; |
|
|
|
for (TorrentImpl *const torrent : asConst(m_torrents)) |
|
|
|
for (TorrentImpl *const torrent : asConst(m_torrents)) |
|
|
|
torrent->handleDownloadPathChanged(); |
|
|
|
torrent->handleCategoryOptionsChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2531,30 +2531,58 @@ void Session::setSavePath(const Path &path) |
|
|
|
if (newPath == m_savePath) |
|
|
|
if (newPath == m_savePath) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
m_savePath = newPath; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isDisableAutoTMMWhenDefaultSavePathChanged()) |
|
|
|
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)) |
|
|
|
for (TorrentImpl *const torrent : asConst(m_torrents)) |
|
|
|
torrent->setAutoTMMEnabled(false); |
|
|
|
{ |
|
|
|
} |
|
|
|
if (affectedCatogories.contains(torrent->category())) |
|
|
|
else |
|
|
|
torrent->setAutoTMMEnabled(false); |
|
|
|
{ |
|
|
|
} |
|
|
|
for (TorrentImpl *const torrent : asConst(m_torrents)) |
|
|
|
|
|
|
|
torrent->handleCategoryOptionsChanged(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_savePath = newPath; |
|
|
|
|
|
|
|
for (TorrentImpl *const torrent : asConst(m_torrents)) |
|
|
|
|
|
|
|
torrent->handleCategoryOptionsChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Session::setDownloadPath(const Path &path) |
|
|
|
void Session::setDownloadPath(const Path &path) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const Path newPath = (path.isAbsolute() ? path : (savePath() / Path("temp") / path)); |
|
|
|
const Path newPath = (path.isAbsolute() ? path : (savePath() / Path("temp") / path)); |
|
|
|
if (newPath != m_downloadPath) |
|
|
|
if (newPath == m_downloadPath) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isDisableAutoTMMWhenDefaultSavePathChanged()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_downloadPath = newPath; |
|
|
|
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(); |
|
|
|
|
|
|
|
const CategoryOptions::DownloadPathOption downloadPathOption = |
|
|
|
|
|
|
|
categoryOptions.downloadPath.value_or(CategoryOptions::DownloadPathOption {isDownloadPathEnabled(), downloadPath()}); |
|
|
|
|
|
|
|
if (downloadPathOption.enabled && downloadPathOption.path.isRelative()) |
|
|
|
|
|
|
|
affectedCatogories.insert(categoryName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (TorrentImpl *const torrent : asConst(m_torrents)) |
|
|
|
for (TorrentImpl *const torrent : asConst(m_torrents)) |
|
|
|
torrent->handleDownloadPathChanged(); |
|
|
|
{ |
|
|
|
|
|
|
|
if (affectedCatogories.contains(torrent->category())) |
|
|
|
|
|
|
|
torrent->setAutoTMMEnabled(false); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_downloadPath = newPath; |
|
|
|
|
|
|
|
for (TorrentImpl *const torrent : asConst(m_torrents)) |
|
|
|
|
|
|
|
torrent->handleCategoryOptionsChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) |
|
|
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) |
|
|
|