mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 13:18:06 -06:00
committed by
GitHub
parent
9d6d3a30eb
commit
2a20764d39
@@ -225,6 +225,8 @@ namespace BitTorrent
|
||||
virtual void setTrackerEnabled(bool enabled) = 0;
|
||||
virtual bool isAppendExtensionEnabled() const = 0;
|
||||
virtual void setAppendExtensionEnabled(bool enabled) = 0;
|
||||
virtual bool isUnwantedFolderEnabled() const = 0;
|
||||
virtual void setUnwantedFolderEnabled(bool enabled) = 0;
|
||||
virtual int refreshInterval() const = 0;
|
||||
virtual void setRefreshInterval(int value) = 0;
|
||||
virtual bool isPreallocationEnabled() const = 0;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -194,6 +194,8 @@ namespace BitTorrent
|
||||
void setTrackerEnabled(bool enabled) override;
|
||||
bool isAppendExtensionEnabled() const override;
|
||||
void setAppendExtensionEnabled(bool enabled) override;
|
||||
bool isUnwantedFolderEnabled() const override;
|
||||
void setUnwantedFolderEnabled(bool enabled) override;
|
||||
int refreshInterval() const override;
|
||||
void setRefreshInterval(int value) override;
|
||||
bool isPreallocationEnabled() const override;
|
||||
@@ -656,6 +658,7 @@ namespace BitTorrent
|
||||
CachedSettingValue<Torrent::StopCondition> m_torrentStopCondition;
|
||||
CachedSettingValue<TorrentContentLayout> m_torrentContentLayout;
|
||||
CachedSettingValue<bool> m_isAppendExtensionEnabled;
|
||||
CachedSettingValue<bool> m_isUnwantedFolderEnabled;
|
||||
CachedSettingValue<int> m_refreshInterval;
|
||||
CachedSettingValue<bool> m_isPreallocationEnabled;
|
||||
CachedSettingValue<Path> m_torrentExportDirectory;
|
||||
|
||||
@@ -573,7 +573,8 @@ Path TorrentImpl::makeActualPath(int index, const Path &path) const
|
||||
actualPath += QB_EXT;
|
||||
}
|
||||
|
||||
if (m_filePriorities[index] == DownloadPriority::Ignored)
|
||||
if (m_session->isUnwantedFolderEnabled()
|
||||
&& (m_filePriorities[index] == DownloadPriority::Ignored))
|
||||
{
|
||||
const Path parentPath = actualPath.parentPath();
|
||||
const QString fileName = actualPath.filename();
|
||||
@@ -2304,7 +2305,16 @@ void TorrentImpl::handleCategoryOptionsChanged()
|
||||
|
||||
void TorrentImpl::handleAppendExtensionToggled()
|
||||
{
|
||||
if (!hasMetadata()) return;
|
||||
if (!hasMetadata())
|
||||
return;
|
||||
|
||||
manageActualFilePaths();
|
||||
}
|
||||
|
||||
void TorrentImpl::handleUnwantedFolderToggled()
|
||||
{
|
||||
if (!hasMetadata())
|
||||
return;
|
||||
|
||||
manageActualFilePaths();
|
||||
}
|
||||
|
||||
@@ -263,6 +263,7 @@ namespace BitTorrent
|
||||
void handleStateUpdate(const lt::torrent_status &nativeStatus);
|
||||
void handleCategoryOptionsChanged();
|
||||
void handleAppendExtensionToggled();
|
||||
void handleUnwantedFolderToggled();
|
||||
void saveResumeData(lt::resume_data_flags_t flags = {});
|
||||
void handleMoveStorageJobFinished(const Path &path, MoveStorageContext context, bool hasOutstandingJob);
|
||||
void fileSearchFinished(const Path &savePath, const PathList &fileNames);
|
||||
|
||||
Reference in New Issue
Block a user