|
|
@ -58,7 +58,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
#define SETTINGS_KEY(name) "AddNewTorrentDialog/" name |
|
|
|
#define SETTINGS_KEY(name) "AddNewTorrentDialog/" name |
|
|
|
const QString KEY_ENABLED = SETTINGS_KEY("Enabled"); |
|
|
|
const QString KEY_ENABLED = SETTINGS_KEY("Enabled"); |
|
|
|
const QString KEY_DEFAULTSAVEPATH = SETTINGS_KEY("DefaultSavePath"); |
|
|
|
|
|
|
|
const QString KEY_DEFAULTCATEGORY = SETTINGS_KEY("DefaultCategory"); |
|
|
|
const QString KEY_DEFAULTCATEGORY = SETTINGS_KEY("DefaultCategory"); |
|
|
|
const QString KEY_TREEHEADERSTATE = SETTINGS_KEY("TreeHeaderState"); |
|
|
|
const QString KEY_TREEHEADERSTATE = SETTINGS_KEY("TreeHeaderState"); |
|
|
|
const QString KEY_WIDTH = SETTINGS_KEY("Width"); |
|
|
|
const QString KEY_WIDTH = SETTINGS_KEY("Width"); |
|
|
@ -394,7 +393,7 @@ void AddNewTorrentDialog::onSavePathChanged(int index) |
|
|
|
ui->defaultSavePathCheckBox->setChecked(false); |
|
|
|
ui->defaultSavePathCheckBox->setChecked(false); |
|
|
|
ui->defaultSavePathCheckBox->setVisible( |
|
|
|
ui->defaultSavePathCheckBox->setVisible( |
|
|
|
QDir(ui->savePathComboBox->itemData(ui->savePathComboBox->currentIndex()).toString()) |
|
|
|
QDir(ui->savePathComboBox->itemData(ui->savePathComboBox->currentIndex()).toString()) |
|
|
|
!= QDir(defaultSavePath())); |
|
|
|
!= QDir(BitTorrent::Session::instance()->defaultSavePath())); |
|
|
|
|
|
|
|
|
|
|
|
// Remember index
|
|
|
|
// Remember index
|
|
|
|
m_oldIndex = index; |
|
|
|
m_oldIndex = index; |
|
|
@ -567,7 +566,7 @@ void AddNewTorrentDialog::setdialogPosition() |
|
|
|
|
|
|
|
|
|
|
|
void AddNewTorrentDialog::populateSavePathComboBox() |
|
|
|
void AddNewTorrentDialog::populateSavePathComboBox() |
|
|
|
{ |
|
|
|
{ |
|
|
|
QString defSavePath = defaultSavePath(); |
|
|
|
QString defSavePath = BitTorrent::Session::instance()->defaultSavePath(); |
|
|
|
|
|
|
|
|
|
|
|
ui->savePathComboBox->clear(); |
|
|
|
ui->savePathComboBox->clear(); |
|
|
|
ui->savePathComboBox->addItem(Utils::Fs::toNativePath(defSavePath), defSavePath); |
|
|
|
ui->savePathComboBox->addItem(Utils::Fs::toNativePath(defSavePath), defSavePath); |
|
|
@ -645,11 +644,9 @@ void AddNewTorrentDialog::accept() |
|
|
|
if (ui->comboTTM->currentIndex() != 1) { // 0 is Manual mode and 1 is Automatic mode. Handle all non 1 values as manual mode.
|
|
|
|
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()) |
|
|
|
settings()->storeValue(KEY_DEFAULTSAVEPATH, savePath); |
|
|
|
|
|
|
|
BitTorrent::Session::instance()->setDefaultSavePath(savePath); |
|
|
|
BitTorrent::Session::instance()->setDefaultSavePath(savePath); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setEnabled(!ui->never_show_cb->isChecked()); |
|
|
|
setEnabled(!ui->never_show_cb->isChecked()); |
|
|
|
|
|
|
|
|
|
|
@ -746,13 +743,6 @@ void AddNewTorrentDialog::setupTreeview() |
|
|
|
setdialogPosition(); |
|
|
|
setdialogPosition(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QString AddNewTorrentDialog::defaultSavePath() const |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return Utils::Fs::fromNativePath( |
|
|
|
|
|
|
|
settings()->loadValue(KEY_DEFAULTSAVEPATH, |
|
|
|
|
|
|
|
BitTorrent::Session::instance()->defaultSavePath()).toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AddNewTorrentDialog::handleDownloadFailed(const QString &url, const QString &reason) |
|
|
|
void AddNewTorrentDialog::handleDownloadFailed(const QString &url, const QString &reason) |
|
|
|
{ |
|
|
|
{ |
|
|
|
MessageBoxRaised::critical(0, tr("Download Error"), QString("Cannot download '%1': %2").arg(url).arg(reason)); |
|
|
|
MessageBoxRaised::critical(0, tr("Download Error"), QString("Cannot download '%1': %2").arg(url).arg(reason)); |
|
|
|