Add option to enable ".unwanted" folder

PR #19926.
This commit is contained in:
Vladimir Golovnev 2023-11-13 14:25:27 +03:00 committed by GitHub
parent 9d6d3a30eb
commit 2a20764d39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 58 additions and 2 deletions

View file

@ -455,6 +455,7 @@ SessionImpl::SessionImpl(QObject *parent)
, m_torrentStopCondition(BITTORRENT_SESSION_KEY(u"TorrentStopCondition"_s), Torrent::StopCondition::None)
, m_torrentContentLayout(BITTORRENT_SESSION_KEY(u"TorrentContentLayout"_s), TorrentContentLayout::Original)
, m_isAppendExtensionEnabled(BITTORRENT_SESSION_KEY(u"AddExtensionToIncompleteFiles"_s), false)
, m_isUnwantedFolderEnabled(BITTORRENT_SESSION_KEY(u"UseUnwantedFolder"_s), false)
, m_refreshInterval(BITTORRENT_SESSION_KEY(u"RefreshInterval"_s), 1500)
, m_isPreallocationEnabled(BITTORRENT_SESSION_KEY(u"Preallocation"_s), false)
, m_torrentExportDirectory(BITTORRENT_SESSION_KEY(u"TorrentExportDirectory"_s))
@ -695,6 +696,23 @@ void SessionImpl::setAppendExtensionEnabled(const bool enabled)
}
}
bool SessionImpl::isUnwantedFolderEnabled() const
{
return m_isUnwantedFolderEnabled;
}
void SessionImpl::setUnwantedFolderEnabled(const bool enabled)
{
if (isUnwantedFolderEnabled() != enabled)
{
m_isUnwantedFolderEnabled = enabled;
// append or remove .!qB extension for incomplete files
for (TorrentImpl *const torrent : asConst(m_torrents))
torrent->handleUnwantedFolderToggled();
}
}
int SessionImpl::refreshInterval() const
{
return m_refreshInterval;