mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-10-22 10:46:04 +03:00
Allow to disable Automatic mode when "temp" path changed
This commit is contained in:
parent
04c1988665
commit
c5ff9b353c
4 changed files with 24 additions and 11 deletions
|
@ -611,7 +611,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2551,15 +2551,34 @@ void Session::setSavePath(const Path &path)
|
||||||
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))
|
||||||
void Session::networkOnlineStateChanged(const bool online)
|
void Session::networkOnlineStateChanged(const bool online)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1644,11 +1644,6 @@ void TorrentImpl::handleStateUpdate(const lt::torrent_status &nativeStatus)
|
||||||
updateStatus(nativeStatus);
|
updateStatus(nativeStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentImpl::handleDownloadPathChanged()
|
|
||||||
{
|
|
||||||
adjustStorageLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TorrentImpl::handleMoveStorageJobFinished(const bool hasOutstandingJob)
|
void TorrentImpl::handleMoveStorageJobFinished(const bool hasOutstandingJob)
|
||||||
{
|
{
|
||||||
m_session->handleTorrentNeedSaveResumeData(this);
|
m_session->handleTorrentNeedSaveResumeData(this);
|
||||||
|
|
|
@ -233,7 +233,6 @@ namespace BitTorrent
|
||||||
|
|
||||||
void handleAlert(const lt::alert *a);
|
void handleAlert(const lt::alert *a);
|
||||||
void handleStateUpdate(const lt::torrent_status &nativeStatus);
|
void handleStateUpdate(const lt::torrent_status &nativeStatus);
|
||||||
void handleDownloadPathChanged();
|
|
||||||
void handleCategoryOptionsChanged();
|
void handleCategoryOptionsChanged();
|
||||||
void handleAppendExtensionToggled();
|
void handleAppendExtensionToggled();
|
||||||
void saveResumeData();
|
void saveResumeData();
|
||||||
|
|
|
@ -1015,7 +1015,7 @@ Manual: Various torrent properties (e.g. save path) must be assigned manually</s
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="labelCategoryDefaultPathChanged">
|
<widget class="QLabel" name="labelCategoryDefaultPathChanged">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>When Default Save Path changed:</string>
|
<string>When Default Save/Incomplete Path changed:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in a new issue