|
|
@ -148,7 +148,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) |
|
|
|
QList<QAbstractButton *> buttons = m_ui->buttonBox->buttons(); |
|
|
|
QList<QAbstractButton *> buttons = m_ui->buttonBox->buttons(); |
|
|
|
foreach (QAbstractButton *button, buttons) { |
|
|
|
foreach (QAbstractButton *button, buttons) { |
|
|
|
if (m_ui->buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole) { |
|
|
|
if (m_ui->buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole) { |
|
|
|
applyButton = button; |
|
|
|
m_applyButton = button; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -410,13 +410,13 @@ OptionsDialog::OptionsDialog(QWidget *parent) |
|
|
|
connect(m_ui->btnEditRules, &QPushButton::clicked, this, [this]() { AutomatedRssDownloader(this).exec(); }); |
|
|
|
connect(m_ui->btnEditRules, &QPushButton::clicked, this, [this]() { AutomatedRssDownloader(this).exec(); }); |
|
|
|
|
|
|
|
|
|
|
|
// Disable apply Button
|
|
|
|
// Disable apply Button
|
|
|
|
applyButton->setEnabled(false); |
|
|
|
m_applyButton->setEnabled(false); |
|
|
|
// Tab selection mechanism
|
|
|
|
// Tab selection mechanism
|
|
|
|
connect(m_ui->tabSelection, &QListWidget::currentItemChanged, this, &ThisType::changePage); |
|
|
|
connect(m_ui->tabSelection, &QListWidget::currentItemChanged, this, &ThisType::changePage); |
|
|
|
// Load Advanced settings
|
|
|
|
// Load Advanced settings
|
|
|
|
advancedSettings = new AdvancedSettings(m_ui->tabAdvancedPage); |
|
|
|
m_advancedSettings = new AdvancedSettings(m_ui->tabAdvancedPage); |
|
|
|
m_ui->advPageLayout->addWidget(advancedSettings); |
|
|
|
m_ui->advPageLayout->addWidget(m_advancedSettings); |
|
|
|
connect(advancedSettings, &AdvancedSettings::settingsChanged, this, &ThisType::enableApplyButton); |
|
|
|
connect(m_advancedSettings, &AdvancedSettings::settingsChanged, this, &ThisType::enableApplyButton); |
|
|
|
|
|
|
|
|
|
|
|
m_ui->textFileLogPath->setDialogCaption(tr("Choose a save directory")); |
|
|
|
m_ui->textFileLogPath->setDialogCaption(tr("Choose a save directory")); |
|
|
|
m_ui->textFileLogPath->setMode(FileSystemPathEdit::Mode::DirectorySave); |
|
|
|
m_ui->textFileLogPath->setMode(FileSystemPathEdit::Mode::DirectorySave); |
|
|
@ -479,7 +479,7 @@ OptionsDialog::~OptionsDialog() |
|
|
|
|
|
|
|
|
|
|
|
saveWindowState(); |
|
|
|
saveWindowState(); |
|
|
|
|
|
|
|
|
|
|
|
foreach (const QString &path, addedScanDirs) |
|
|
|
foreach (const QString &path, m_addedScanDirs) |
|
|
|
ScanFoldersModel::instance()->removePath(path); |
|
|
|
ScanFoldersModel::instance()->removePath(path); |
|
|
|
ScanFoldersModel::instance()->configure(); // reloads "removed" paths
|
|
|
|
ScanFoldersModel::instance()->configure(); // reloads "removed" paths
|
|
|
|
delete m_ui; |
|
|
|
delete m_ui; |
|
|
@ -527,7 +527,7 @@ void OptionsDialog::saveWindowState() const |
|
|
|
|
|
|
|
|
|
|
|
void OptionsDialog::saveOptions() |
|
|
|
void OptionsDialog::saveOptions() |
|
|
|
{ |
|
|
|
{ |
|
|
|
applyButton->setEnabled(false); |
|
|
|
m_applyButton->setEnabled(false); |
|
|
|
Preferences *const pref = Preferences::instance(); |
|
|
|
Preferences *const pref = Preferences::instance(); |
|
|
|
// Load the translation
|
|
|
|
// Load the translation
|
|
|
|
QString locale = getLocale(); |
|
|
|
QString locale = getLocale(); |
|
|
@ -611,11 +611,11 @@ void OptionsDialog::saveOptions() |
|
|
|
AddNewTorrentDialog::setTopLevel(m_ui->checkAdditionDialogFront->isChecked()); |
|
|
|
AddNewTorrentDialog::setTopLevel(m_ui->checkAdditionDialogFront->isChecked()); |
|
|
|
session->setAddTorrentPaused(addTorrentsInPause()); |
|
|
|
session->setAddTorrentPaused(addTorrentsInPause()); |
|
|
|
session->setCreateTorrentSubfolder(m_ui->checkCreateSubfolder->isChecked()); |
|
|
|
session->setCreateTorrentSubfolder(m_ui->checkCreateSubfolder->isChecked()); |
|
|
|
ScanFoldersModel::instance()->removeFromFSWatcher(removedScanDirs); |
|
|
|
ScanFoldersModel::instance()->removeFromFSWatcher(m_removedScanDirs); |
|
|
|
ScanFoldersModel::instance()->addToFSWatcher(addedScanDirs); |
|
|
|
ScanFoldersModel::instance()->addToFSWatcher(m_addedScanDirs); |
|
|
|
ScanFoldersModel::instance()->makePersistent(); |
|
|
|
ScanFoldersModel::instance()->makePersistent(); |
|
|
|
removedScanDirs.clear(); |
|
|
|
m_removedScanDirs.clear(); |
|
|
|
addedScanDirs.clear(); |
|
|
|
m_addedScanDirs.clear(); |
|
|
|
session->setTorrentExportDirectory(getTorrentExportDir()); |
|
|
|
session->setTorrentExportDirectory(getTorrentExportDir()); |
|
|
|
session->setFinishedTorrentExportDirectory(getFinishedTorrentExportDir()); |
|
|
|
session->setFinishedTorrentExportDirectory(getFinishedTorrentExportDir()); |
|
|
|
pref->setMailNotificationEnabled(m_ui->groupMailNotification->isChecked()); |
|
|
|
pref->setMailNotificationEnabled(m_ui->groupMailNotification->isChecked()); |
|
|
@ -734,7 +734,7 @@ void OptionsDialog::saveOptions() |
|
|
|
// End Web UI
|
|
|
|
// End Web UI
|
|
|
|
// End preferences
|
|
|
|
// End preferences
|
|
|
|
// Save advanced settings
|
|
|
|
// Save advanced settings
|
|
|
|
advancedSettings->saveAdvancedSettings(); |
|
|
|
m_advancedSettings->saveAdvancedSettings(); |
|
|
|
// Assume that user changed multiple settings
|
|
|
|
// Assume that user changed multiple settings
|
|
|
|
// so it's best to save immediately
|
|
|
|
// so it's best to save immediately
|
|
|
|
pref->apply(); |
|
|
|
pref->apply(); |
|
|
@ -1226,7 +1226,7 @@ int OptionsDialog::getMaxUploadsPerTorrent() const |
|
|
|
|
|
|
|
|
|
|
|
void OptionsDialog::on_buttonBox_accepted() |
|
|
|
void OptionsDialog::on_buttonBox_accepted() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (applyButton->isEnabled()) { |
|
|
|
if (m_applyButton->isEnabled()) { |
|
|
|
if (!schedTimesOk()) { |
|
|
|
if (!schedTimesOk()) { |
|
|
|
m_ui->tabSelection->setCurrentRow(TAB_SPEED); |
|
|
|
m_ui->tabSelection->setCurrentRow(TAB_SPEED); |
|
|
|
return; |
|
|
|
return; |
|
|
@ -1235,7 +1235,7 @@ void OptionsDialog::on_buttonBox_accepted() |
|
|
|
m_ui->tabSelection->setCurrentRow(TAB_WEBUI); |
|
|
|
m_ui->tabSelection->setCurrentRow(TAB_WEBUI); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
applyButton->setEnabled(false); |
|
|
|
m_applyButton->setEnabled(false); |
|
|
|
this->hide(); |
|
|
|
this->hide(); |
|
|
|
saveOptions(); |
|
|
|
saveOptions(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1245,7 +1245,7 @@ void OptionsDialog::on_buttonBox_accepted() |
|
|
|
|
|
|
|
|
|
|
|
void OptionsDialog::applySettings(QAbstractButton *button) |
|
|
|
void OptionsDialog::applySettings(QAbstractButton *button) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (button == applyButton) { |
|
|
|
if (button == m_applyButton) { |
|
|
|
if (!schedTimesOk()) { |
|
|
|
if (!schedTimesOk()) { |
|
|
|
m_ui->tabSelection->setCurrentRow(TAB_SPEED); |
|
|
|
m_ui->tabSelection->setCurrentRow(TAB_SPEED); |
|
|
|
return; |
|
|
|
return; |
|
|
@ -1277,7 +1277,7 @@ bool OptionsDialog::useAdditionDialog() const |
|
|
|
|
|
|
|
|
|
|
|
void OptionsDialog::enableApplyButton() |
|
|
|
void OptionsDialog::enableApplyButton() |
|
|
|
{ |
|
|
|
{ |
|
|
|
applyButton->setEnabled(true); |
|
|
|
m_applyButton->setEnabled(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void OptionsDialog::toggleComboRatioLimitAct() |
|
|
|
void OptionsDialog::toggleComboRatioLimitAct() |
|
|
@ -1472,7 +1472,7 @@ void OptionsDialog::on_addScanFolderButton_clicked() |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
pref->setScanDirsLastPath(dir); |
|
|
|
pref->setScanDirsLastPath(dir); |
|
|
|
addedScanDirs << dir; |
|
|
|
m_addedScanDirs << dir; |
|
|
|
for (int i = 0; i < ScanFoldersModel::instance()->columnCount(); ++i) |
|
|
|
for (int i = 0; i < ScanFoldersModel::instance()->columnCount(); ++i) |
|
|
|
m_ui->scanFoldersView->resizeColumnToContents(i); |
|
|
|
m_ui->scanFoldersView->resizeColumnToContents(i); |
|
|
|
enableApplyButton(); |
|
|
|
enableApplyButton(); |
|
|
@ -1492,7 +1492,7 @@ void OptionsDialog::on_removeScanFolderButton_clicked() |
|
|
|
Q_ASSERT(selected.count() == ScanFoldersModel::instance()->columnCount()); |
|
|
|
Q_ASSERT(selected.count() == ScanFoldersModel::instance()->columnCount()); |
|
|
|
foreach (const QModelIndex &index, selected) { |
|
|
|
foreach (const QModelIndex &index, selected) { |
|
|
|
if (index.column() == ScanFoldersModel::WATCH) |
|
|
|
if (index.column() == ScanFoldersModel::WATCH) |
|
|
|
removedScanDirs << index.data().toString(); |
|
|
|
m_removedScanDirs << index.data().toString(); |
|
|
|
} |
|
|
|
} |
|
|
|
ScanFoldersModel::instance()->removePath(selected.first().row(), false); |
|
|
|
ScanFoldersModel::instance()->removePath(selected.first().row(), false); |
|
|
|
} |
|
|
|
} |
|
|
|