Rename ASM to TMM and related stuff.

This commit is contained in:
sledgehammer999 2016-05-08 22:47:50 +03:00
parent bc270bd801
commit 81ea07abee
11 changed files with 162 additions and 180 deletions

View file

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