Browse Source

Rename ASM to TMM and related stuff.

adaptive-webui-19844
sledgehammer999 9 years ago
parent
commit
81ea07abee
  1. 54
      src/base/bittorrent/session.cpp
  2. 28
      src/base/bittorrent/session.h
  3. 28
      src/base/bittorrent/torrenthandle.cpp
  4. 6
      src/base/bittorrent/torrenthandle.h
  5. 27
      src/gui/addnewtorrentdialog.cpp
  6. 2
      src/gui/addnewtorrentdialog.h
  7. 80
      src/gui/addnewtorrentdialog.ui
  8. 12
      src/gui/options.ui
  9. 16
      src/gui/options_imp.cpp
  10. 29
      src/gui/transferlistwidget.cpp
  11. 2
      src/gui/transferlistwidget.h

54
src/base/bittorrent/session.cpp

@ -98,10 +98,10 @@ const QString KEY_DEFAULTSAVEPATH = SETTINGS_KEY("DefaultSavePath");
const QString KEY_TEMPPATH = SETTINGS_KEY("TempPath"); const QString KEY_TEMPPATH = SETTINGS_KEY("TempPath");
const QString KEY_SUBCATEGORIESENABLED = SETTINGS_KEY("SubcategoriesEnabled"); const QString KEY_SUBCATEGORIESENABLED = SETTINGS_KEY("SubcategoriesEnabled");
const QString KEY_TEMPPATHENABLED = SETTINGS_KEY("TempPathEnabled"); const QString KEY_TEMPPATHENABLED = SETTINGS_KEY("TempPathEnabled");
const QString KEY_DISABLEASMBYDEFAULT = SETTINGS_KEY("DisableASMByDefault"); const QString KEY_DISABLE_AUTOTMM_BYDEFAULT = SETTINGS_KEY("DisableAutoTMMByDefault");
const QString KEY_DISABLEASMONCATEGORYCHANGED = SETTINGS_KEY("DisableASMTriggers/CategoryChanged"); const QString KEY_DISABLE_AUTOTMM_ONCATEGORYCHANGED = SETTINGS_KEY("DisableAutoTMMTriggers/CategoryChanged");
const QString KEY_DISABLEASMONDEFAULTSAVEPATHCHANGED = SETTINGS_KEY("DisableASMTriggers/DefaultSavePathChanged"); const QString KEY_DISABLE_AUTOTMM_ONDEFAULTSAVEPATHCHANGED = SETTINGS_KEY("DisableAutoTMMTriggers/DefaultSavePathChanged");
const QString KEY_DISABLEASMONCATEGORYSAVEPATHCHANGED = SETTINGS_KEY("DisableASMTriggers/CategorySavePathChanged"); const QString KEY_DISABLE_AUTOTMM_ONCATEGORYSAVEPATHCHANGED = SETTINGS_KEY("DisableAutoTMMTriggers/CategorySavePathChanged");
const QString KEY_ADDTORRENTPAUSED = SETTINGS_KEY("AddTorrentPaused"); const QString KEY_ADDTORRENTPAUSED = SETTINGS_KEY("AddTorrentPaused");
namespace namespace
@ -422,10 +422,10 @@ bool Session::editCategory(const QString &name, const QString &savePath)
if (categorySavePath(name) == savePath) return false; if (categorySavePath(name) == savePath) return false;
m_categories[name] = savePath; m_categories[name] = savePath;
if (isDisableASMWhenCategorySavePathChanged()) { if (isDisableAutoTMMWhenCategorySavePathChanged()) {
foreach (TorrentHandle *const torrent, torrents()) foreach (TorrentHandle *const torrent, torrents())
if (torrent->category() == name) if (torrent->category() == name)
torrent->setASMEnabled(false); torrent->setAutoTMMEnabled(false);
} }
else { else {
foreach (TorrentHandle *const torrent, torrents()) foreach (TorrentHandle *const torrent, torrents())
@ -491,44 +491,44 @@ void Session::setSubcategoriesEnabled(bool value)
emit subcategoriesSupportChanged(); 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 bool Session::isAddTorrentPaused() const
@ -1259,7 +1259,7 @@ bool Session::addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri
{ {
addData.savePath = normalizeSavePath( addData.savePath = normalizeSavePath(
addData.savePath, addData.savePath,
((!addData.resumed && isASMDisabledByDefault()) ? m_defaultSavePath : "")); ((!addData.resumed && isAutoTMMDisabledByDefault()) ? m_defaultSavePath : ""));
if (!addData.category.isEmpty()) { if (!addData.category.isEmpty()) {
if (!m_categories.contains(addData.category) && !addCategory(addData.category)) { 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; std::vector<boost::uint8_t> filePriorities;
QString savePath; QString savePath;
if (addData.savePath.isEmpty()) // using Advanced mode if (addData.savePath.isEmpty()) // using Automatic mode
savePath = categorySavePath(addData.category); savePath = categorySavePath(addData.category);
else // using Simple mode else // using Manual mode
savePath = addData.savePath; savePath = addData.savePath;
bool fromMagnetUri = magnetUri.isValid(); bool fromMagnetUri = magnetUri.isValid();
@ -1679,9 +1679,9 @@ void Session::setDefaultSavePath(QString path)
m_defaultSavePath = path; m_defaultSavePath = path;
m_settings->storeValue(KEY_DEFAULTSAVEPATH, m_defaultSavePath); m_settings->storeValue(KEY_DEFAULTSAVEPATH, m_defaultSavePath);
if (isDisableASMWhenDefaultSavePathChanged()) if (isDisableAutoTMMWhenDefaultSavePathChanged())
foreach (TorrentHandle *const torrent, torrents()) foreach (TorrentHandle *const torrent, torrents())
torrent->setASMEnabled(false); torrent->setAutoTMMEnabled(false);
else else
foreach (TorrentHandle *const torrent, torrents()) foreach (TorrentHandle *const torrent, torrents())
torrent->handleCategorySavePathChanged(); torrent->handleCategorySavePathChanged();

28
src/base/bittorrent/session.h

@ -199,25 +199,25 @@ namespace BitTorrent
bool isSubcategoriesEnabled() const; bool isSubcategoriesEnabled() const;
void setSubcategoriesEnabled(bool value); 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 // Each torrent can be either in Manual mode or in Automatic mode
// In Simple mode torrent has explicit save path // In Manual Mode various torrent properties are set explicitly(eg save path)
// In Advanced Mode torrent has implicit save path (based on Default // In Automatic Mode various torrent properties are set implicitly(eg save path)
// save path and Category save path) // based on the associated category.
// In Advanced Mode torrent save path can be changed in following cases: // In Automatic Mode torrent save path can be changed in following cases:
// 1. Default save path changed // 1. Default save path changed
// 2. Torrent category save path changed // 2. Torrent category save path changed
// 3. Torrent category changed // 3. Torrent category changed
// (unless otherwise is specified) // (unless otherwise is specified)
bool isASMDisabledByDefault() const; bool isAutoTMMDisabledByDefault() const;
void setASMDisabledByDefault(bool value); void setAutoTMMDisabledByDefault(bool value);
bool isDisableASMWhenCategoryChanged() const; bool isDisableAutoTMMWhenCategoryChanged() const;
void setDisableASMWhenCategoryChanged(bool value); void setDisableAutoTMMWhenCategoryChanged(bool value);
bool isDisableASMWhenDefaultSavePathChanged() const; bool isDisableAutoTMMWhenDefaultSavePathChanged() const;
void setDisableASMWhenDefaultSavePathChanged(bool value); void setDisableAutoTMMWhenDefaultSavePathChanged(bool value);
bool isDisableASMWhenCategorySavePathChanged() const; bool isDisableAutoTMMWhenCategorySavePathChanged() const;
void setDisableASMWhenCategorySavePathChanged(bool value); void setDisableAutoTMMWhenCategorySavePathChanged(bool value);
bool isAddTorrentPaused() const; bool isAddTorrentPaused() const;
void setAddTorrentPaused(bool value); void setAddTorrentPaused(bool value);

28
src/base/bittorrent/torrenthandle.cpp

@ -199,7 +199,7 @@ TorrentHandle::TorrentHandle(Session *session, const libtorrent::torrent_handle
, m_nativeHandle(nativeHandle) , m_nativeHandle(nativeHandle)
, m_state(TorrentState::Unknown) , m_state(TorrentState::Unknown)
, m_renameCount(0) , m_renameCount(0)
, m_useASM(data.savePath.isEmpty()) , m_useAutoTMM(data.savePath.isEmpty())
, m_name(data.name) , m_name(data.name)
, m_savePath(Utils::Fs::toNativePath(data.savePath)) , m_savePath(Utils::Fs::toNativePath(data.savePath))
, m_category(data.category) , m_category(data.category)
@ -210,7 +210,7 @@ TorrentHandle::TorrentHandle(Session *session, const libtorrent::torrent_handle
, m_pauseAfterRecheck(false) , m_pauseAfterRecheck(false)
, m_needSaveResumeData(false) , m_needSaveResumeData(false)
{ {
if (m_useASM) if (m_useAutoTMM)
m_savePath = Utils::Fs::toNativePath(m_session->categorySavePath(m_category)); m_savePath = Utils::Fs::toNativePath(m_session->categorySavePath(m_category));
updateStatus(); updateStatus();
@ -326,19 +326,19 @@ QString TorrentHandle::contentPath(bool actual) const
return rootPath(actual); 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); m_session->handleTorrentSavingModeChanged(this);
if (m_useASM) if (m_useAutoTMM)
move_impl(m_session->categorySavePath(m_category)); move_impl(m_session->categorySavePath(m_category));
} }
@ -1150,11 +1150,11 @@ bool TorrentHandle::setCategory(const QString &category)
m_needSaveResumeData = true; m_needSaveResumeData = true;
m_session->handleTorrentCategoryChanged(this, oldCategory); m_session->handleTorrentCategoryChanged(this, oldCategory);
if (m_useASM) { if (m_useAutoTMM) {
if (!m_session->isDisableASMWhenCategoryChanged()) if (!m_session->isDisableAutoTMMWhenCategoryChanged())
move_impl(m_session->categorySavePath(m_category)); move_impl(m_session->categorySavePath(m_category));
else else
setASMEnabled(false); setAutoTMMEnabled(false);
} }
} }
@ -1163,7 +1163,7 @@ bool TorrentHandle::setCategory(const QString &category)
void TorrentHandle::move(QString path) void TorrentHandle::move(QString path)
{ {
m_useASM = false; m_useAutoTMM = false;
m_session->handleTorrentSavingModeChanged(this); m_session->handleTorrentSavingModeChanged(this);
path = Utils::Fs::fromNativePath(path.trimmed()); path = Utils::Fs::fromNativePath(path.trimmed());
@ -1531,7 +1531,7 @@ void TorrentHandle::handleSaveResumeDataAlert(libtorrent::save_resume_data_alert
resumeData["qBt-paused"] = isPaused(); resumeData["qBt-paused"] = isPaused();
resumeData["qBt-forced"] = isForced(); 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-ratioLimit"] = Utils::String::toStdString(QString::number(m_ratioLimit));
resumeData["qBt-category"] = Utils::String::toStdString(m_category); resumeData["qBt-category"] = Utils::String::toStdString(m_category);
resumeData["qBt-name"] = Utils::String::toStdString(m_name); resumeData["qBt-name"] = Utils::String::toStdString(m_name);
@ -1656,7 +1656,7 @@ void TorrentHandle::handleTempPathChanged()
void TorrentHandle::handleCategorySavePathChanged() void TorrentHandle::handleCategorySavePathChanged()
{ {
if (m_useASM) if (m_useAutoTMM)
move_impl(m_session->categorySavePath(m_category)); move_impl(m_session->categorySavePath(m_category));
} }

6
src/base/bittorrent/torrenthandle.h

@ -229,8 +229,8 @@ namespace BitTorrent
QString rootPath(bool actual = false) const; QString rootPath(bool actual = false) const;
QString contentPath(bool actual = false) const; QString contentPath(bool actual = false) const;
bool isASMEnabled() const; bool isAutoTMMEnabled() const;
void setASMEnabled(bool enabled); void setAutoTMMEnabled(bool enabled);
QString category() const; QString category() const;
bool belongsToCategory(const QString &category) const; bool belongsToCategory(const QString &category) const;
bool setCategory(const QString &category); bool setCategory(const QString &category);
@ -412,7 +412,7 @@ namespace BitTorrent
QQueue<EventTrigger> m_moveFinishedTriggers; QQueue<EventTrigger> m_moveFinishedTriggers;
int m_renameCount; int m_renameCount;
bool m_useASM; bool m_useAutoTMM;
// Persistent data // Persistent data
QString m_name; QString m_name;

27
src/gui/addnewtorrentdialog.cpp

@ -89,7 +89,9 @@ AddNewTorrentDialog::AddNewTorrentDialog(QWidget *parent)
auto session = BitTorrent::Session::instance(); auto session = BitTorrent::Session::instance();
ui->startTorrentCheckBox->setChecked(!session->isAddTorrentPaused()); ui->startTorrentCheckBox->setChecked(!session->isAddTorrentPaused());
(session->isASMDisabledByDefault() ? ui->simpleModeRadioButton : ui->advancedModeRadioButton)->setChecked(true); ui->comboTTM->blockSignals(true); //the TreeView size isn't correct if the slot does it job at this point
ui->comboTTM->setCurrentIndex(!session->isAutoTMMDisabledByDefault());
ui->comboTTM->blockSignals(false);
populateSavePathComboBox(); populateSavePathComboBox();
connect(ui->savePathComboBox, SIGNAL(currentIndexChanged(int)), SLOT(onSavePathChanged(int))); connect(ui->savePathComboBox, SIGNAL(currentIndexChanged(int)), SLOT(onSavePathChanged(int)));
connect(ui->browseButton, SIGNAL(clicked()), SLOT(browseButton_clicked())); connect(ui->browseButton, SIGNAL(clicked()), SLOT(browseButton_clicked()));
@ -249,6 +251,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath)
ui->lblhash->setText(m_hash); ui->lblhash->setText(m_hash);
setupTreeview(); setupTreeview();
TMMChanged(ui->comboTTM->currentIndex());
return true; return true;
} }
@ -287,6 +290,7 @@ bool AddNewTorrentDialog::loadMagnet(const BitTorrent::MagnetUri &magnetUri)
setWindowTitle(torrent_name.isEmpty() ? tr("Magnet link") : torrent_name); setWindowTitle(torrent_name.isEmpty() ? tr("Magnet link") : torrent_name);
setupTreeview(); setupTreeview();
TMMChanged(ui->comboTTM->currentIndex());
// Set dialog position // Set dialog position
setdialogPosition(); setdialogPosition();
@ -402,7 +406,7 @@ void AddNewTorrentDialog::categoryChanged(int index)
{ {
Q_UNUSED(index); Q_UNUSED(index);
if (ui->advancedModeRadioButton->isChecked()) { if (ui->comboTTM->currentIndex() == 1) {
QString savePath = BitTorrent::Session::instance()->categorySavePath(ui->categoryComboBox->currentText()); QString savePath = BitTorrent::Session::instance()->categorySavePath(ui->categoryComboBox->currentText());
ui->savePathComboBox->setItemText(0, Utils::Fs::toNativePath(savePath)); ui->savePathComboBox->setItemText(0, Utils::Fs::toNativePath(savePath));
ui->savePathComboBox->setItemData(0, savePath); ui->savePathComboBox->setItemData(0, savePath);
@ -638,7 +642,7 @@ void AddNewTorrentDialog::accept()
params.addPaused = !ui->startTorrentCheckBox->isChecked(); params.addPaused = !ui->startTorrentCheckBox->isChecked();
QString savePath = ui->savePathComboBox->itemData(ui->savePathComboBox->currentIndex()).toString(); QString savePath = ui->savePathComboBox->itemData(ui->savePathComboBox->currentIndex()).toString();
if (ui->simpleModeRadioButton->isChecked()) { if (ui->comboTTM->currentIndex() != 1) { // 0 is Manual mode and 1 is Automatic mode. Handle all non 1 values as manual mode.
params.savePath = savePath; params.savePath = savePath;
saveSavePathHistory(); saveSavePathHistory();
if (ui->defaultSavePathCheckBox->isChecked()) if (ui->defaultSavePathCheckBox->isChecked())
@ -686,6 +690,7 @@ void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &info)
// Update UI // Update UI
setupTreeview(); setupTreeview();
TMMChanged(ui->comboTTM->currentIndex());
setMetadataProgressIndicator(false, tr("Metadata retrieval complete")); setMetadataProgressIndicator(false, tr("Metadata retrieval complete"));
} }
@ -770,25 +775,25 @@ void AddNewTorrentDialog::handleDownloadFinished(const QString &url, const QStri
this->deleteLater(); this->deleteLater();
} }
void AddNewTorrentDialog::savingModeChanged(bool enabled) void AddNewTorrentDialog::TMMChanged(int index)
{ {
if (!enabled) return; if (index != 1) { // 0 is Manual mode and 1 is Automatic mode. Handle all non 1 values as manual mode.
if (ui->simpleModeRadioButton->isChecked()) {
populateSavePathComboBox(); populateSavePathComboBox();
ui->savePathComboBox->setEnabled(true); ui->groupBoxSavePath->setEnabled(true);
ui->browseButton->setEnabled(true);
ui->savePathComboBox->blockSignals(false); ui->savePathComboBox->blockSignals(false);
ui->savePathComboBox->setCurrentIndex(m_oldIndex < ui->savePathComboBox->count() ? m_oldIndex : ui->savePathComboBox->count() - 1); ui->savePathComboBox->setCurrentIndex(m_oldIndex < ui->savePathComboBox->count() ? m_oldIndex : ui->savePathComboBox->count() - 1);
ui->adv_button->setEnabled(true);
} }
else { else {
ui->groupBoxSavePath->setEnabled(false);
ui->savePathComboBox->blockSignals(true); ui->savePathComboBox->blockSignals(true);
ui->savePathComboBox->clear(); ui->savePathComboBox->clear();
QString savePath = BitTorrent::Session::instance()->categorySavePath(ui->categoryComboBox->currentText()); QString savePath = BitTorrent::Session::instance()->categorySavePath(ui->categoryComboBox->currentText());
ui->savePathComboBox->addItem(Utils::Fs::toNativePath(savePath), savePath); ui->savePathComboBox->addItem(Utils::Fs::toNativePath(savePath), savePath);
ui->savePathComboBox->setEnabled(false);
ui->browseButton->setEnabled(false);
ui->defaultSavePathCheckBox->setVisible(false); ui->defaultSavePathCheckBox->setVisible(false);
ui->adv_button->setChecked(true);
ui->adv_button->setEnabled(false);
showAdvancedSettings(true);
} }
} }

2
src/gui/addnewtorrentdialog.h

@ -79,7 +79,7 @@ private slots:
void handleDownloadFailed(const QString &url, const QString &reason); void handleDownloadFailed(const QString &url, const QString &reason);
void handleRedirectedToMagnet(const QString &url, const QString &magnetUri); void handleRedirectedToMagnet(const QString &url, const QString &magnetUri);
void handleDownloadFinished(const QString &url, const QString &filePath); void handleDownloadFinished(const QString &url, const QString &filePath);
void savingModeChanged(bool enabled); void TMMChanged(int index);
void categoryChanged(int index); void categoryChanged(int index);
void doNotDeleteTorrentClicked(bool checked); void doNotDeleteTorrentClicked(bool checked);

80
src/gui/addnewtorrentdialog.ui

@ -11,39 +11,30 @@
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="AddNewTorrentDialogLayout"> <layout class="QVBoxLayout" name="AddNewTorrentDialogLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Save at</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>20</number>
</property>
<item> <item>
<widget class="QLabel" name="savingModeLabel"> <widget class="QLabel" name="labelTorrentManagementMode">
<property name="text"> <property name="text">
<string>Saving Management:</string> <string>Torrent Management Mode:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QRadioButton" name="simpleModeRadioButton"> <widget class="QComboBox" name="comboTTM">
<property name="text"> <property name="toolTip">
<string>Simple</string> <string>Automatic mode means that various torrent properties(eg save path) will be decided by the associated category</string>
</property> </property>
<property name="checked"> <item>
<bool>true</bool> <property name="text">
<string>Manual</string>
</property> </property>
</widget>
</item> </item>
<item> <item>
<widget class="QRadioButton" name="advancedModeRadioButton">
<property name="text"> <property name="text">
<string>Advanced</string> <string>Automatic</string>
</property> </property>
</item>
</widget> </widget>
</item> </item>
<item> <item>
@ -61,6 +52,12 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBoxSavePath">
<property name="title">
<string>Save at</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
@ -400,8 +397,6 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>simpleModeRadioButton</tabstop>
<tabstop>advancedModeRadioButton</tabstop>
<tabstop>savePathComboBox</tabstop> <tabstop>savePathComboBox</tabstop>
<tabstop>browseButton</tabstop> <tabstop>browseButton</tabstop>
<tabstop>defaultSavePathCheckBox</tabstop> <tabstop>defaultSavePathCheckBox</tabstop>
@ -449,50 +444,34 @@
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>simpleModeRadioButton</sender> <sender>categoryComboBox</sender>
<signal>toggled(bool)</signal> <signal>currentIndexChanged(int)</signal>
<receiver>AddNewTorrentDialog</receiver>
<slot>savingModeChanged(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>154</x>
<y>39</y>
</hint>
<hint type="destinationlabel">
<x>122</x>
<y>6</y>
</hint>
</hints>
</connection>
<connection>
<sender>advancedModeRadioButton</sender>
<signal>toggled(bool)</signal>
<receiver>AddNewTorrentDialog</receiver> <receiver>AddNewTorrentDialog</receiver>
<slot>savingModeChanged(bool)</slot> <slot>categoryChanged(int)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>218</x> <x>337</x>
<y>44</y> <y>205</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>209</x> <x>403</x>
<y>7</y> <y>160</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>categoryComboBox</sender> <sender>comboTTM</sender>
<signal>currentIndexChanged(int)</signal> <signal>currentIndexChanged(int)</signal>
<receiver>AddNewTorrentDialog</receiver> <receiver>AddNewTorrentDialog</receiver>
<slot>categoryChanged(int)</slot> <slot>TMMChanged(int)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>337</x> <x>200</x>
<y>205</y> <y>19</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>403</x> <x>206</x>
<y>160</y> <y>294</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -500,5 +479,6 @@
<slots> <slots>
<slot>savingModeChanged(bool)</slot> <slot>savingModeChanged(bool)</slot>
<slot>categoryChanged(int)</slot> <slot>categoryChanged(int)</slot>
<slot>TMMChanged(int)</slot>
</slots> </slots>
</ui> </ui>

12
src/gui/options.ui

@ -797,7 +797,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_40"> <widget class="QLabel" name="label_40">
<property name="text"> <property name="text">
<string>Default Saving Mode:</string> <string>Default Torrent Management Mode:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -856,7 +856,7 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Switch torrent to Simple Mode</string> <string>Switch torrent to Manual Mode</string>
</property> </property>
</item> </item>
</widget> </widget>
@ -897,7 +897,7 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Switch affected torrents to Simple Mode</string> <string>Switch affected torrents to Manual Mode</string>
</property> </property>
</item> </item>
</widget> </widget>
@ -938,7 +938,7 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Switch affected torrents to Simple Mode</string> <string>Switch affected torrents to Manual Mode</string>
</property> </property>
</item> </item>
</widget> </widget>
@ -1306,10 +1306,6 @@
</widget> </widget>
</item> </item>
</layout> </layout>
<zorder>gridLayoutWidget</zorder>
<zorder>label_2</zorder>
<zorder>checkSmtpSSL</zorder>
<zorder>groupMailNotifAuth</zorder>
</widget> </widget>
</item> </item>
<item> <item>

16
src/gui/options_imp.cpp

@ -496,10 +496,10 @@ void options_imp::saveOptions()
// Downloads preferences // Downloads preferences
session->setDefaultSavePath(Utils::Fs::expandPathAbs(textSavePath->text())); session->setDefaultSavePath(Utils::Fs::expandPathAbs(textSavePath->text()));
session->setSubcategoriesEnabled(checkUseSubcategories->isChecked()); session->setSubcategoriesEnabled(checkUseSubcategories->isChecked());
session->setASMDisabledByDefault(comboSavingMode->currentIndex() == 0); session->setAutoTMMDisabledByDefault(comboSavingMode->currentIndex() == 0);
session->setDisableASMWhenCategoryChanged(comboTorrentCategoryChanged->currentIndex() == 1); session->setDisableAutoTMMWhenCategoryChanged(comboTorrentCategoryChanged->currentIndex() == 1);
session->setDisableASMWhenCategorySavePathChanged(comboCategoryChanged->currentIndex() == 1); session->setDisableAutoTMMWhenCategorySavePathChanged(comboCategoryChanged->currentIndex() == 1);
session->setDisableASMWhenDefaultSavePathChanged(comboCategoryDefaultPathChanged->currentIndex() == 1); session->setDisableAutoTMMWhenDefaultSavePathChanged(comboCategoryDefaultPathChanged->currentIndex() == 1);
session->setTempPathEnabled(checkTempFolder->isChecked()); session->setTempPathEnabled(checkTempFolder->isChecked());
session->setTempPath(Utils::Fs::expandPathAbs(textTempPath->text())); session->setTempPath(Utils::Fs::expandPathAbs(textTempPath->text()));
pref->useIncompleteFilesExtension(checkAppendqB->isChecked()); pref->useIncompleteFilesExtension(checkAppendqB->isChecked());
@ -710,10 +710,10 @@ void options_imp::loadOptions()
textSavePath->setText(Utils::Fs::toNativePath(session->defaultSavePath())); textSavePath->setText(Utils::Fs::toNativePath(session->defaultSavePath()));
checkUseSubcategories->setChecked(session->isSubcategoriesEnabled()); checkUseSubcategories->setChecked(session->isSubcategoriesEnabled());
comboSavingMode->setCurrentIndex(!session->isASMDisabledByDefault()); comboSavingMode->setCurrentIndex(!session->isAutoTMMDisabledByDefault());
comboTorrentCategoryChanged->setCurrentIndex(session->isDisableASMWhenCategoryChanged()); comboTorrentCategoryChanged->setCurrentIndex(session->isDisableAutoTMMWhenCategoryChanged());
comboCategoryChanged->setCurrentIndex(session->isDisableASMWhenCategorySavePathChanged()); comboCategoryChanged->setCurrentIndex(session->isDisableAutoTMMWhenCategorySavePathChanged());
comboCategoryDefaultPathChanged->setCurrentIndex(session->isDisableASMWhenDefaultSavePathChanged()); comboCategoryDefaultPathChanged->setCurrentIndex(session->isDisableAutoTMMWhenDefaultSavePathChanged());
checkTempFolder->setChecked(session->isTempPathEnabled()); checkTempFolder->setChecked(session->isTempPathEnabled());
textTempPath->setEnabled(checkTempFolder->isChecked()); textTempPath->setEnabled(checkTempFolder->isChecked());
browseTempDirButton->setEnabled(checkTempFolder->isChecked()); browseTempDirButton->setEnabled(checkTempFolder->isChecked());

29
src/gui/transferlistwidget.cpp

@ -566,10 +566,10 @@ void TransferListWidget::toggleSelectedFirstLastPiecePrio() const
torrent->toggleFirstLastPiecePriority(); torrent->toggleFirstLastPiecePriority();
} }
void TransferListWidget::setSelectedASMEnabled(bool enabled) const void TransferListWidget::setSelectedAutoTMMEnabled(bool enabled) const
{ {
foreach (BitTorrent::TorrentHandle *const torrent, getSelectedTorrents()) foreach (BitTorrent::TorrentHandle *const torrent, getSelectedTorrents())
torrent->setASMEnabled(enabled); torrent->setAutoTMMEnabled(enabled);
} }
void TransferListWidget::askNewCategoryForSelection() void TransferListWidget::askNewCategoryForSelection()
@ -672,9 +672,10 @@ void TransferListWidget::displayListMenu(const QPoint&)
QAction actionFirstLastPiece_prio(tr("Download first and last pieces first"), 0); QAction actionFirstLastPiece_prio(tr("Download first and last pieces first"), 0);
actionFirstLastPiece_prio.setCheckable(true); actionFirstLastPiece_prio.setCheckable(true);
connect(&actionFirstLastPiece_prio, SIGNAL(triggered()), this, SLOT(toggleSelectedFirstLastPiecePrio())); connect(&actionFirstLastPiece_prio, SIGNAL(triggered()), this, SLOT(toggleSelectedFirstLastPiecePrio()));
QAction actionEnableASM(tr("Enable Advanced Saving Management"), 0); QAction actionAutoTMM(tr("Automatic Torrent Management"), 0);
actionEnableASM.setCheckable(true); actionAutoTMM.setCheckable(true);
connect(&actionEnableASM, SIGNAL(triggered(bool)), this, SLOT(setSelectedASMEnabled(bool))); actionAutoTMM.setToolTip(tr("Automatic mode means that various torrent properties(eg save path) will be decided by the associated category"));
connect(&actionAutoTMM, SIGNAL(triggered(bool)), this, SLOT(setSelectedAutoTMMEnabled(bool)));
// End of actions // End of actions
// Enable/disable pause/start action given the DL state // Enable/disable pause/start action given the DL state
@ -685,8 +686,8 @@ void TransferListWidget::displayListMenu(const QPoint&)
bool sequential_download_mode = false, prioritize_first_last = false; bool sequential_download_mode = false, prioritize_first_last = false;
bool one_has_metadata = false, one_not_seed = false; bool one_has_metadata = false, one_not_seed = false;
bool allSameCategory = true; bool allSameCategory = true;
bool allSameASM = true; bool allSameAutoTMM = true;
bool firstASM = false; bool firstAutoTMM = false;
QString firstCategory; QString firstCategory;
bool first = true; bool first = true;
@ -704,9 +705,9 @@ void TransferListWidget::displayListMenu(const QPoint&)
allSameCategory = false; allSameCategory = false;
if (first) if (first)
firstASM = torrent->isASMEnabled(); firstAutoTMM = torrent->isAutoTMMEnabled();
if (firstASM != torrent->isASMEnabled()) if (firstAutoTMM != torrent->isAutoTMMEnabled())
allSameASM = false; allSameAutoTMM = false;
if (torrent->hasMetadata()) if (torrent->hasMetadata())
one_has_metadata = true; one_has_metadata = true;
@ -750,7 +751,7 @@ void TransferListWidget::displayListMenu(const QPoint&)
if (one_has_metadata && one_not_seed && !all_same_sequential_download_mode if (one_has_metadata && one_not_seed && !all_same_sequential_download_mode
&& !all_same_prio_firstlast && !all_same_super_seeding && !allSameCategory && !all_same_prio_firstlast && !all_same_super_seeding && !allSameCategory
&& needs_start && needs_force && needs_pause && needs_preview && !allSameASM) { && needs_start && needs_force && needs_pause && needs_preview && !allSameAutoTMM) {
break; break;
} }
} }
@ -786,9 +787,9 @@ void TransferListWidget::displayListMenu(const QPoint&)
categoryActions << cat; categoryActions << cat;
} }
if (allSameASM) { if (allSameAutoTMM) {
actionEnableASM.setChecked(firstASM); actionAutoTMM.setChecked(firstAutoTMM);
listMenu.addAction(&actionEnableASM); listMenu.addAction(&actionAutoTMM);
} }
listMenu.addSeparator(); listMenu.addSeparator();

2
src/gui/transferlistwidget.h

@ -105,7 +105,7 @@ protected slots:
void toggleSelectedTorrentsSuperSeeding() const; void toggleSelectedTorrentsSuperSeeding() const;
void toggleSelectedTorrentsSequentialDownload() const; void toggleSelectedTorrentsSequentialDownload() const;
void toggleSelectedFirstLastPiecePrio() const; void toggleSelectedFirstLastPiecePrio() const;
void setSelectedASMEnabled(bool enabled) const; void setSelectedAutoTMMEnabled(bool enabled) const;
void askNewCategoryForSelection(); void askNewCategoryForSelection();
void saveSettings(); void saveSettings();

Loading…
Cancel
Save