mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-07 21:51:25 -07:00
parent
9d6d3a30eb
commit
2a20764d39
9 changed files with 58 additions and 2 deletions
|
@ -225,6 +225,8 @@ namespace BitTorrent
|
||||||
virtual void setTrackerEnabled(bool enabled) = 0;
|
virtual void setTrackerEnabled(bool enabled) = 0;
|
||||||
virtual bool isAppendExtensionEnabled() const = 0;
|
virtual bool isAppendExtensionEnabled() const = 0;
|
||||||
virtual void setAppendExtensionEnabled(bool enabled) = 0;
|
virtual void setAppendExtensionEnabled(bool enabled) = 0;
|
||||||
|
virtual bool isUnwantedFolderEnabled() const = 0;
|
||||||
|
virtual void setUnwantedFolderEnabled(bool enabled) = 0;
|
||||||
virtual int refreshInterval() const = 0;
|
virtual int refreshInterval() const = 0;
|
||||||
virtual void setRefreshInterval(int value) = 0;
|
virtual void setRefreshInterval(int value) = 0;
|
||||||
virtual bool isPreallocationEnabled() const = 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_torrentStopCondition(BITTORRENT_SESSION_KEY(u"TorrentStopCondition"_s), Torrent::StopCondition::None)
|
||||||
, m_torrentContentLayout(BITTORRENT_SESSION_KEY(u"TorrentContentLayout"_s), TorrentContentLayout::Original)
|
, m_torrentContentLayout(BITTORRENT_SESSION_KEY(u"TorrentContentLayout"_s), TorrentContentLayout::Original)
|
||||||
, m_isAppendExtensionEnabled(BITTORRENT_SESSION_KEY(u"AddExtensionToIncompleteFiles"_s), false)
|
, 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_refreshInterval(BITTORRENT_SESSION_KEY(u"RefreshInterval"_s), 1500)
|
||||||
, m_isPreallocationEnabled(BITTORRENT_SESSION_KEY(u"Preallocation"_s), false)
|
, m_isPreallocationEnabled(BITTORRENT_SESSION_KEY(u"Preallocation"_s), false)
|
||||||
, m_torrentExportDirectory(BITTORRENT_SESSION_KEY(u"TorrentExportDirectory"_s))
|
, 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
|
int SessionImpl::refreshInterval() const
|
||||||
{
|
{
|
||||||
return m_refreshInterval;
|
return m_refreshInterval;
|
||||||
|
|
|
@ -194,6 +194,8 @@ namespace BitTorrent
|
||||||
void setTrackerEnabled(bool enabled) override;
|
void setTrackerEnabled(bool enabled) override;
|
||||||
bool isAppendExtensionEnabled() const override;
|
bool isAppendExtensionEnabled() const override;
|
||||||
void setAppendExtensionEnabled(bool enabled) override;
|
void setAppendExtensionEnabled(bool enabled) override;
|
||||||
|
bool isUnwantedFolderEnabled() const override;
|
||||||
|
void setUnwantedFolderEnabled(bool enabled) override;
|
||||||
int refreshInterval() const override;
|
int refreshInterval() const override;
|
||||||
void setRefreshInterval(int value) override;
|
void setRefreshInterval(int value) override;
|
||||||
bool isPreallocationEnabled() const override;
|
bool isPreallocationEnabled() const override;
|
||||||
|
@ -656,6 +658,7 @@ namespace BitTorrent
|
||||||
CachedSettingValue<Torrent::StopCondition> m_torrentStopCondition;
|
CachedSettingValue<Torrent::StopCondition> m_torrentStopCondition;
|
||||||
CachedSettingValue<TorrentContentLayout> m_torrentContentLayout;
|
CachedSettingValue<TorrentContentLayout> m_torrentContentLayout;
|
||||||
CachedSettingValue<bool> m_isAppendExtensionEnabled;
|
CachedSettingValue<bool> m_isAppendExtensionEnabled;
|
||||||
|
CachedSettingValue<bool> m_isUnwantedFolderEnabled;
|
||||||
CachedSettingValue<int> m_refreshInterval;
|
CachedSettingValue<int> m_refreshInterval;
|
||||||
CachedSettingValue<bool> m_isPreallocationEnabled;
|
CachedSettingValue<bool> m_isPreallocationEnabled;
|
||||||
CachedSettingValue<Path> m_torrentExportDirectory;
|
CachedSettingValue<Path> m_torrentExportDirectory;
|
||||||
|
|
|
@ -573,7 +573,8 @@ Path TorrentImpl::makeActualPath(int index, const Path &path) const
|
||||||
actualPath += QB_EXT;
|
actualPath += QB_EXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_filePriorities[index] == DownloadPriority::Ignored)
|
if (m_session->isUnwantedFolderEnabled()
|
||||||
|
&& (m_filePriorities[index] == DownloadPriority::Ignored))
|
||||||
{
|
{
|
||||||
const Path parentPath = actualPath.parentPath();
|
const Path parentPath = actualPath.parentPath();
|
||||||
const QString fileName = actualPath.filename();
|
const QString fileName = actualPath.filename();
|
||||||
|
@ -2304,7 +2305,16 @@ void TorrentImpl::handleCategoryOptionsChanged()
|
||||||
|
|
||||||
void TorrentImpl::handleAppendExtensionToggled()
|
void TorrentImpl::handleAppendExtensionToggled()
|
||||||
{
|
{
|
||||||
if (!hasMetadata()) return;
|
if (!hasMetadata())
|
||||||
|
return;
|
||||||
|
|
||||||
|
manageActualFilePaths();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TorrentImpl::handleUnwantedFolderToggled()
|
||||||
|
{
|
||||||
|
if (!hasMetadata())
|
||||||
|
return;
|
||||||
|
|
||||||
manageActualFilePaths();
|
manageActualFilePaths();
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,6 +263,7 @@ namespace BitTorrent
|
||||||
void handleStateUpdate(const lt::torrent_status &nativeStatus);
|
void handleStateUpdate(const lt::torrent_status &nativeStatus);
|
||||||
void handleCategoryOptionsChanged();
|
void handleCategoryOptionsChanged();
|
||||||
void handleAppendExtensionToggled();
|
void handleAppendExtensionToggled();
|
||||||
|
void handleUnwantedFolderToggled();
|
||||||
void saveResumeData(lt::resume_data_flags_t flags = {});
|
void saveResumeData(lt::resume_data_flags_t flags = {});
|
||||||
void handleMoveStorageJobFinished(const Path &path, MoveStorageContext context, bool hasOutstandingJob);
|
void handleMoveStorageJobFinished(const Path &path, MoveStorageContext context, bool hasOutstandingJob);
|
||||||
void fileSearchFinished(const Path &savePath, const PathList &fileNames);
|
void fileSearchFinished(const Path &savePath, const PathList &fileNames);
|
||||||
|
|
|
@ -563,6 +563,7 @@ void OptionsDialog::loadDownloadsTabOptions()
|
||||||
|
|
||||||
m_ui->checkPreallocateAll->setChecked(session->isPreallocationEnabled());
|
m_ui->checkPreallocateAll->setChecked(session->isPreallocationEnabled());
|
||||||
m_ui->checkAppendqB->setChecked(session->isAppendExtensionEnabled());
|
m_ui->checkAppendqB->setChecked(session->isAppendExtensionEnabled());
|
||||||
|
m_ui->checkUnwantedFolder->setChecked(session->isUnwantedFolderEnabled());
|
||||||
m_ui->checkRecursiveDownload->setChecked(pref->isRecursiveDownloadEnabled());
|
m_ui->checkRecursiveDownload->setChecked(pref->isRecursiveDownloadEnabled());
|
||||||
|
|
||||||
m_ui->comboSavingMode->setCurrentIndex(!session->isAutoTMMDisabledByDefault());
|
m_ui->comboSavingMode->setCurrentIndex(!session->isAutoTMMDisabledByDefault());
|
||||||
|
@ -666,6 +667,7 @@ void OptionsDialog::loadDownloadsTabOptions()
|
||||||
|
|
||||||
connect(m_ui->checkPreallocateAll, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkPreallocateAll, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkAppendqB, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkAppendqB, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
|
connect(m_ui->checkUnwantedFolder, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkRecursiveDownload, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkRecursiveDownload, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
|
|
||||||
connect(m_ui->comboSavingMode, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
|
connect(m_ui->comboSavingMode, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
|
||||||
|
@ -732,6 +734,7 @@ void OptionsDialog::saveDownloadsTabOptions() const
|
||||||
|
|
||||||
session->setPreallocationEnabled(preAllocateAllFiles());
|
session->setPreallocationEnabled(preAllocateAllFiles());
|
||||||
session->setAppendExtensionEnabled(m_ui->checkAppendqB->isChecked());
|
session->setAppendExtensionEnabled(m_ui->checkAppendqB->isChecked());
|
||||||
|
session->setUnwantedFolderEnabled(m_ui->checkUnwantedFolder->isChecked());
|
||||||
pref->setRecursiveDownloadEnabled(m_ui->checkRecursiveDownload->isChecked());
|
pref->setRecursiveDownloadEnabled(m_ui->checkRecursiveDownload->isChecked());
|
||||||
|
|
||||||
session->setAutoTMMDisabledByDefault(m_ui->comboSavingMode->currentIndex() == 0);
|
session->setAutoTMMDisabledByDefault(m_ui->comboSavingMode->currentIndex() == 0);
|
||||||
|
|
|
@ -1094,6 +1094,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkUnwantedFolder">
|
||||||
|
<property name="text">
|
||||||
|
<string>Keep unselected files in ".unwanted" folder</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkRecursiveDownload">
|
<widget class="QCheckBox" name="checkRecursiveDownload">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -3906,6 +3913,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.</string>
|
||||||
<tabstop>checkUseDownloadPath</tabstop>
|
<tabstop>checkUseDownloadPath</tabstop>
|
||||||
<tabstop>textDownloadPath</tabstop>
|
<tabstop>textDownloadPath</tabstop>
|
||||||
<tabstop>checkAppendqB</tabstop>
|
<tabstop>checkAppendqB</tabstop>
|
||||||
|
<tabstop>checkUnwantedFolder</tabstop>
|
||||||
<tabstop>scanFoldersView</tabstop>
|
<tabstop>scanFoldersView</tabstop>
|
||||||
<tabstop>addWatchedFolderButton</tabstop>
|
<tabstop>addWatchedFolderButton</tabstop>
|
||||||
<tabstop>editWatchedFolderButton</tabstop>
|
<tabstop>editWatchedFolderButton</tabstop>
|
||||||
|
|
|
@ -130,6 +130,7 @@ void AppController::preferencesAction()
|
||||||
data[u"auto_delete_mode"_s] = static_cast<int>(TorrentFileGuard::autoDeleteMode());
|
data[u"auto_delete_mode"_s] = static_cast<int>(TorrentFileGuard::autoDeleteMode());
|
||||||
data[u"preallocate_all"_s] = session->isPreallocationEnabled();
|
data[u"preallocate_all"_s] = session->isPreallocationEnabled();
|
||||||
data[u"incomplete_files_ext"_s] = session->isAppendExtensionEnabled();
|
data[u"incomplete_files_ext"_s] = session->isAppendExtensionEnabled();
|
||||||
|
data[u"use_unwanted_folder"_s] = session->isUnwantedFolderEnabled();
|
||||||
// Saving Management
|
// Saving Management
|
||||||
data[u"auto_tmm_enabled"_s] = !session->isAutoTMMDisabledByDefault();
|
data[u"auto_tmm_enabled"_s] = !session->isAutoTMMDisabledByDefault();
|
||||||
data[u"torrent_changed_tmm_enabled"_s] = !session->isDisableAutoTMMWhenCategoryChanged();
|
data[u"torrent_changed_tmm_enabled"_s] = !session->isDisableAutoTMMWhenCategoryChanged();
|
||||||
|
@ -513,6 +514,8 @@ void AppController::setPreferencesAction()
|
||||||
session->setPreallocationEnabled(it.value().toBool());
|
session->setPreallocationEnabled(it.value().toBool());
|
||||||
if (hasKey(u"incomplete_files_ext"_s))
|
if (hasKey(u"incomplete_files_ext"_s))
|
||||||
session->setAppendExtensionEnabled(it.value().toBool());
|
session->setAppendExtensionEnabled(it.value().toBool());
|
||||||
|
if (hasKey(u"use_unwanted_folder"_s))
|
||||||
|
session->setUnwantedFolderEnabled(it.value().toBool());
|
||||||
|
|
||||||
// Saving Management
|
// Saving Management
|
||||||
if (hasKey(u"auto_tmm_enabled"_s))
|
if (hasKey(u"auto_tmm_enabled"_s))
|
||||||
|
|
|
@ -86,6 +86,12 @@
|
||||||
<label for="appendext_checkbox">QBT_TR(Append .!qB extension to incomplete files)QBT_TR[CONTEXT=OptionsDialog]</label>
|
<label for="appendext_checkbox">QBT_TR(Append .!qB extension to incomplete files)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="formRow">
|
||||||
|
<span id="unwantedfoldertr">
|
||||||
|
<input type="checkbox" id="unwantedfolder_checkbox" />
|
||||||
|
<label for="unwantedfolder_checkbox">QBT_TR(Keep unselected files in ".unwanted" folder)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<fieldset class="settings">
|
<fieldset class="settings">
|
||||||
<legend>QBT_TR(Saving Management)QBT_TR[CONTEXT=HttpServer]</legend>
|
<legend>QBT_TR(Saving Management)QBT_TR[CONTEXT=HttpServer]</legend>
|
||||||
|
@ -1997,6 +2003,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
|
|
||||||
$('preallocateall_checkbox').setProperty('checked', pref.preallocate_all);
|
$('preallocateall_checkbox').setProperty('checked', pref.preallocate_all);
|
||||||
$('appendext_checkbox').setProperty('checked', pref.incomplete_files_ext);
|
$('appendext_checkbox').setProperty('checked', pref.incomplete_files_ext);
|
||||||
|
$('unwantedfolder_checkbox').setProperty('checked', pref.use_unwanted_folder);
|
||||||
|
|
||||||
// Saving Management
|
// Saving Management
|
||||||
$('default_tmm_combobox').setProperty('value', pref.auto_tmm_enabled);
|
$('default_tmm_combobox').setProperty('value', pref.auto_tmm_enabled);
|
||||||
|
@ -2374,6 +2381,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
|
|
||||||
settings.set('preallocate_all', $('preallocateall_checkbox').getProperty('checked'));
|
settings.set('preallocate_all', $('preallocateall_checkbox').getProperty('checked'));
|
||||||
settings.set('incomplete_files_ext', $('appendext_checkbox').getProperty('checked'));
|
settings.set('incomplete_files_ext', $('appendext_checkbox').getProperty('checked'));
|
||||||
|
settings.set('use_unwanted_folder', $('unwantedfolder_checkbox').getProperty('checked'));
|
||||||
|
|
||||||
// Saving Management
|
// Saving Management
|
||||||
settings.set('auto_tmm_enabled', $('default_tmm_combobox').getProperty('value'));
|
settings.set('auto_tmm_enabled', $('default_tmm_combobox').getProperty('value'));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue