mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 16:37:21 -06:00
Rename ASM to TMM and related stuff.
This commit is contained in:
@@ -98,10 +98,10 @@ const QString KEY_DEFAULTSAVEPATH = SETTINGS_KEY("DefaultSavePath");
|
||||
const QString KEY_TEMPPATH = SETTINGS_KEY("TempPath");
|
||||
const QString KEY_SUBCATEGORIESENABLED = SETTINGS_KEY("SubcategoriesEnabled");
|
||||
const QString KEY_TEMPPATHENABLED = SETTINGS_KEY("TempPathEnabled");
|
||||
const QString KEY_DISABLEASMBYDEFAULT = SETTINGS_KEY("DisableASMByDefault");
|
||||
const QString KEY_DISABLEASMONCATEGORYCHANGED = SETTINGS_KEY("DisableASMTriggers/CategoryChanged");
|
||||
const QString KEY_DISABLEASMONDEFAULTSAVEPATHCHANGED = SETTINGS_KEY("DisableASMTriggers/DefaultSavePathChanged");
|
||||
const QString KEY_DISABLEASMONCATEGORYSAVEPATHCHANGED = SETTINGS_KEY("DisableASMTriggers/CategorySavePathChanged");
|
||||
const QString KEY_DISABLE_AUTOTMM_BYDEFAULT = SETTINGS_KEY("DisableAutoTMMByDefault");
|
||||
const QString KEY_DISABLE_AUTOTMM_ONCATEGORYCHANGED = SETTINGS_KEY("DisableAutoTMMTriggers/CategoryChanged");
|
||||
const QString KEY_DISABLE_AUTOTMM_ONDEFAULTSAVEPATHCHANGED = SETTINGS_KEY("DisableAutoTMMTriggers/DefaultSavePathChanged");
|
||||
const QString KEY_DISABLE_AUTOTMM_ONCATEGORYSAVEPATHCHANGED = SETTINGS_KEY("DisableAutoTMMTriggers/CategorySavePathChanged");
|
||||
const QString KEY_ADDTORRENTPAUSED = SETTINGS_KEY("AddTorrentPaused");
|
||||
|
||||
namespace
|
||||
@@ -422,10 +422,10 @@ bool Session::editCategory(const QString &name, const QString &savePath)
|
||||
if (categorySavePath(name) == savePath) return false;
|
||||
|
||||
m_categories[name] = savePath;
|
||||
if (isDisableASMWhenCategorySavePathChanged()) {
|
||||
if (isDisableAutoTMMWhenCategorySavePathChanged()) {
|
||||
foreach (TorrentHandle *const torrent, torrents())
|
||||
if (torrent->category() == name)
|
||||
torrent->setASMEnabled(false);
|
||||
torrent->setAutoTMMEnabled(false);
|
||||
}
|
||||
else {
|
||||
foreach (TorrentHandle *const torrent, torrents())
|
||||
@@ -491,44 +491,44 @@ void Session::setSubcategoriesEnabled(bool value)
|
||||
emit subcategoriesSupportChanged();
|
||||
}
|
||||
|
||||
bool Session::isASMDisabledByDefault() const
|
||||
bool Session::isAutoTMMDisabledByDefault() const
|
||||
{
|
||||
return m_settings->loadValue(KEY_DISABLEASMBYDEFAULT, true).toBool();
|
||||
return m_settings->loadValue(KEY_DISABLE_AUTOTMM_BYDEFAULT, true).toBool();
|
||||
}
|
||||
|
||||
void Session::setASMDisabledByDefault(bool value)
|
||||
void Session::setAutoTMMDisabledByDefault(bool value)
|
||||
{
|
||||
m_settings->storeValue(KEY_DISABLEASMBYDEFAULT, value);
|
||||
m_settings->storeValue(KEY_DISABLE_AUTOTMM_BYDEFAULT, value);
|
||||
}
|
||||
|
||||
bool Session::isDisableASMWhenCategoryChanged() const
|
||||
bool Session::isDisableAutoTMMWhenCategoryChanged() const
|
||||
{
|
||||
return m_settings->loadValue(KEY_DISABLEASMONCATEGORYCHANGED, false).toBool();
|
||||
return m_settings->loadValue(KEY_DISABLE_AUTOTMM_ONCATEGORYCHANGED, false).toBool();
|
||||
}
|
||||
|
||||
void Session::setDisableASMWhenCategoryChanged(bool value)
|
||||
void Session::setDisableAutoTMMWhenCategoryChanged(bool value)
|
||||
{
|
||||
m_settings->storeValue(KEY_DISABLEASMONCATEGORYCHANGED, value);
|
||||
m_settings->storeValue(KEY_DISABLE_AUTOTMM_ONCATEGORYCHANGED, value);
|
||||
}
|
||||
|
||||
bool Session::isDisableASMWhenDefaultSavePathChanged() const
|
||||
bool Session::isDisableAutoTMMWhenDefaultSavePathChanged() const
|
||||
{
|
||||
return m_settings->loadValue(KEY_DISABLEASMONDEFAULTSAVEPATHCHANGED, true).toBool();
|
||||
return m_settings->loadValue(KEY_DISABLE_AUTOTMM_ONDEFAULTSAVEPATHCHANGED, true).toBool();
|
||||
}
|
||||
|
||||
void Session::setDisableASMWhenDefaultSavePathChanged(bool value)
|
||||
void Session::setDisableAutoTMMWhenDefaultSavePathChanged(bool value)
|
||||
{
|
||||
m_settings->storeValue(KEY_DISABLEASMONDEFAULTSAVEPATHCHANGED, value);
|
||||
m_settings->storeValue(KEY_DISABLE_AUTOTMM_ONDEFAULTSAVEPATHCHANGED, value);
|
||||
}
|
||||
|
||||
bool Session::isDisableASMWhenCategorySavePathChanged() const
|
||||
bool Session::isDisableAutoTMMWhenCategorySavePathChanged() const
|
||||
{
|
||||
return m_settings->loadValue(KEY_DISABLEASMONCATEGORYSAVEPATHCHANGED, true).toBool();
|
||||
return m_settings->loadValue(KEY_DISABLE_AUTOTMM_ONCATEGORYSAVEPATHCHANGED, true).toBool();
|
||||
}
|
||||
|
||||
void Session::setDisableASMWhenCategorySavePathChanged(bool value)
|
||||
void Session::setDisableAutoTMMWhenCategorySavePathChanged(bool value)
|
||||
{
|
||||
m_settings->storeValue(KEY_DISABLEASMONCATEGORYSAVEPATHCHANGED, value);
|
||||
m_settings->storeValue(KEY_DISABLE_AUTOTMM_ONCATEGORYSAVEPATHCHANGED, value);
|
||||
}
|
||||
|
||||
bool Session::isAddTorrentPaused() const
|
||||
@@ -1259,7 +1259,7 @@ bool Session::addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri
|
||||
{
|
||||
addData.savePath = normalizeSavePath(
|
||||
addData.savePath,
|
||||
((!addData.resumed && isASMDisabledByDefault()) ? m_defaultSavePath : ""));
|
||||
((!addData.resumed && isAutoTMMDisabledByDefault()) ? m_defaultSavePath : ""));
|
||||
|
||||
if (!addData.category.isEmpty()) {
|
||||
if (!m_categories.contains(addData.category) && !addCategory(addData.category)) {
|
||||
@@ -1274,9 +1274,9 @@ bool Session::addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri
|
||||
std::vector<boost::uint8_t> filePriorities;
|
||||
|
||||
QString savePath;
|
||||
if (addData.savePath.isEmpty()) // using Advanced mode
|
||||
if (addData.savePath.isEmpty()) // using Automatic mode
|
||||
savePath = categorySavePath(addData.category);
|
||||
else // using Simple mode
|
||||
else // using Manual mode
|
||||
savePath = addData.savePath;
|
||||
|
||||
bool fromMagnetUri = magnetUri.isValid();
|
||||
@@ -1679,9 +1679,9 @@ void Session::setDefaultSavePath(QString path)
|
||||
m_defaultSavePath = path;
|
||||
m_settings->storeValue(KEY_DEFAULTSAVEPATH, m_defaultSavePath);
|
||||
|
||||
if (isDisableASMWhenDefaultSavePathChanged())
|
||||
if (isDisableAutoTMMWhenDefaultSavePathChanged())
|
||||
foreach (TorrentHandle *const torrent, torrents())
|
||||
torrent->setASMEnabled(false);
|
||||
torrent->setAutoTMMEnabled(false);
|
||||
else
|
||||
foreach (TorrentHandle *const torrent, torrents())
|
||||
torrent->handleCategorySavePathChanged();
|
||||
|
||||
@@ -199,25 +199,25 @@ namespace BitTorrent
|
||||
bool isSubcategoriesEnabled() const;
|
||||
void setSubcategoriesEnabled(bool value);
|
||||
|
||||
// Advanced Saving Management subsystem (ASM)
|
||||
// Torrent Management Mode subsystem (TMM)
|
||||
//
|
||||
// Each torrent can be either in Simple mode or in Advanced mode
|
||||
// In Simple mode torrent has explicit save path
|
||||
// In Advanced Mode torrent has implicit save path (based on Default
|
||||
// save path and Category save path)
|
||||
// In Advanced Mode torrent save path can be changed in following cases:
|
||||
// Each torrent can be either in Manual mode or in Automatic mode
|
||||
// In Manual Mode various torrent properties are set explicitly(eg save path)
|
||||
// In Automatic Mode various torrent properties are set implicitly(eg save path)
|
||||
// based on the associated category.
|
||||
// In Automatic Mode torrent save path can be changed in following cases:
|
||||
// 1. Default save path changed
|
||||
// 2. Torrent category save path changed
|
||||
// 3. Torrent category changed
|
||||
// (unless otherwise is specified)
|
||||
bool isASMDisabledByDefault() const;
|
||||
void setASMDisabledByDefault(bool value);
|
||||
bool isDisableASMWhenCategoryChanged() const;
|
||||
void setDisableASMWhenCategoryChanged(bool value);
|
||||
bool isDisableASMWhenDefaultSavePathChanged() const;
|
||||
void setDisableASMWhenDefaultSavePathChanged(bool value);
|
||||
bool isDisableASMWhenCategorySavePathChanged() const;
|
||||
void setDisableASMWhenCategorySavePathChanged(bool value);
|
||||
bool isAutoTMMDisabledByDefault() const;
|
||||
void setAutoTMMDisabledByDefault(bool value);
|
||||
bool isDisableAutoTMMWhenCategoryChanged() const;
|
||||
void setDisableAutoTMMWhenCategoryChanged(bool value);
|
||||
bool isDisableAutoTMMWhenDefaultSavePathChanged() const;
|
||||
void setDisableAutoTMMWhenDefaultSavePathChanged(bool value);
|
||||
bool isDisableAutoTMMWhenCategorySavePathChanged() const;
|
||||
void setDisableAutoTMMWhenCategorySavePathChanged(bool value);
|
||||
|
||||
bool isAddTorrentPaused() const;
|
||||
void setAddTorrentPaused(bool value);
|
||||
|
||||
@@ -199,7 +199,7 @@ TorrentHandle::TorrentHandle(Session *session, const libtorrent::torrent_handle
|
||||
, m_nativeHandle(nativeHandle)
|
||||
, m_state(TorrentState::Unknown)
|
||||
, m_renameCount(0)
|
||||
, m_useASM(data.savePath.isEmpty())
|
||||
, m_useAutoTMM(data.savePath.isEmpty())
|
||||
, m_name(data.name)
|
||||
, m_savePath(Utils::Fs::toNativePath(data.savePath))
|
||||
, m_category(data.category)
|
||||
@@ -210,7 +210,7 @@ TorrentHandle::TorrentHandle(Session *session, const libtorrent::torrent_handle
|
||||
, m_pauseAfterRecheck(false)
|
||||
, m_needSaveResumeData(false)
|
||||
{
|
||||
if (m_useASM)
|
||||
if (m_useAutoTMM)
|
||||
m_savePath = Utils::Fs::toNativePath(m_session->categorySavePath(m_category));
|
||||
|
||||
updateStatus();
|
||||
@@ -326,19 +326,19 @@ QString TorrentHandle::contentPath(bool actual) const
|
||||
return rootPath(actual);
|
||||
}
|
||||
|
||||
bool TorrentHandle::isASMEnabled() const
|
||||
bool TorrentHandle::isAutoTMMEnabled() const
|
||||
{
|
||||
return m_useASM;
|
||||
return m_useAutoTMM;
|
||||
}
|
||||
|
||||
void TorrentHandle::setASMEnabled(bool enabled)
|
||||
void TorrentHandle::setAutoTMMEnabled(bool enabled)
|
||||
{
|
||||
if (m_useASM == enabled) return;
|
||||
if (m_useAutoTMM == enabled) return;
|
||||
|
||||
m_useASM = enabled;
|
||||
m_useAutoTMM = enabled;
|
||||
m_session->handleTorrentSavingModeChanged(this);
|
||||
|
||||
if (m_useASM)
|
||||
if (m_useAutoTMM)
|
||||
move_impl(m_session->categorySavePath(m_category));
|
||||
}
|
||||
|
||||
@@ -1150,11 +1150,11 @@ bool TorrentHandle::setCategory(const QString &category)
|
||||
m_needSaveResumeData = true;
|
||||
m_session->handleTorrentCategoryChanged(this, oldCategory);
|
||||
|
||||
if (m_useASM) {
|
||||
if (!m_session->isDisableASMWhenCategoryChanged())
|
||||
if (m_useAutoTMM) {
|
||||
if (!m_session->isDisableAutoTMMWhenCategoryChanged())
|
||||
move_impl(m_session->categorySavePath(m_category));
|
||||
else
|
||||
setASMEnabled(false);
|
||||
setAutoTMMEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1163,7 +1163,7 @@ bool TorrentHandle::setCategory(const QString &category)
|
||||
|
||||
void TorrentHandle::move(QString path)
|
||||
{
|
||||
m_useASM = false;
|
||||
m_useAutoTMM = false;
|
||||
m_session->handleTorrentSavingModeChanged(this);
|
||||
|
||||
path = Utils::Fs::fromNativePath(path.trimmed());
|
||||
@@ -1531,7 +1531,7 @@ void TorrentHandle::handleSaveResumeDataAlert(libtorrent::save_resume_data_alert
|
||||
resumeData["qBt-paused"] = isPaused();
|
||||
resumeData["qBt-forced"] = isForced();
|
||||
}
|
||||
resumeData["qBt-savePath"] = m_useASM ? "" : Utils::String::toStdString(m_savePath);
|
||||
resumeData["qBt-savePath"] = m_useAutoTMM ? "" : Utils::String::toStdString(m_savePath);
|
||||
resumeData["qBt-ratioLimit"] = Utils::String::toStdString(QString::number(m_ratioLimit));
|
||||
resumeData["qBt-category"] = Utils::String::toStdString(m_category);
|
||||
resumeData["qBt-name"] = Utils::String::toStdString(m_name);
|
||||
@@ -1656,7 +1656,7 @@ void TorrentHandle::handleTempPathChanged()
|
||||
|
||||
void TorrentHandle::handleCategorySavePathChanged()
|
||||
{
|
||||
if (m_useASM)
|
||||
if (m_useAutoTMM)
|
||||
move_impl(m_session->categorySavePath(m_category));
|
||||
}
|
||||
|
||||
|
||||
@@ -229,8 +229,8 @@ namespace BitTorrent
|
||||
QString rootPath(bool actual = false) const;
|
||||
QString contentPath(bool actual = false) const;
|
||||
|
||||
bool isASMEnabled() const;
|
||||
void setASMEnabled(bool enabled);
|
||||
bool isAutoTMMEnabled() const;
|
||||
void setAutoTMMEnabled(bool enabled);
|
||||
QString category() const;
|
||||
bool belongsToCategory(const QString &category) const;
|
||||
bool setCategory(const QString &category);
|
||||
@@ -412,7 +412,7 @@ namespace BitTorrent
|
||||
QQueue<EventTrigger> m_moveFinishedTriggers;
|
||||
int m_renameCount;
|
||||
|
||||
bool m_useASM;
|
||||
bool m_useAutoTMM;
|
||||
|
||||
// Persistent data
|
||||
QString m_name;
|
||||
|
||||
Reference in New Issue
Block a user