From e26573d97f8602d11843b91c0673c589b560e6b3 Mon Sep 17 00:00:00 2001 From: thalieht Date: Tue, 20 Aug 2019 15:34:40 +0300 Subject: [PATCH] Use FileSystemPathEdit in automated rss downloader --- src/gui/rss/automatedrssdownloader.cpp | 13 +++----- src/gui/rss/automatedrssdownloader.h | 1 - src/gui/rss/automatedrssdownloader.ui | 42 ++++++-------------------- 3 files changed, 13 insertions(+), 43 deletions(-) diff --git a/src/gui/rss/automatedrssdownloader.cpp b/src/gui/rss/automatedrssdownloader.cpp index 8bd505e8f..11787cabc 100644 --- a/src/gui/rss/automatedrssdownloader.cpp +++ b/src/gui/rss/automatedrssdownloader.cpp @@ -77,6 +77,8 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent) m_ui->hsplitter->setCollapsible(0, false); m_ui->hsplitter->setCollapsible(1, false); m_ui->hsplitter->setCollapsible(2, true); // Only the preview list is collapsible + m_ui->lineSavePath->setDialogCaption(tr("Destination directory")); + m_ui->lineSavePath->setMode(FileSystemPathEdit::Mode::DirectorySave); connect(m_ui->checkRegex, &QAbstractButton::toggled, this, &AutomatedRssDownloader::updateFieldsToolTips); connect(m_ui->listRules, &QWidget::customContextMenuRequested, this, &AutomatedRssDownloader::displayRulesListMenu); @@ -251,7 +253,7 @@ void AutomatedRssDownloader::updateRuleDefinitionBox() else m_ui->lineEFilter->clear(); m_ui->checkBoxSaveDiffDir->setChecked(!m_currentRule.savePath().isEmpty()); - m_ui->lineSavePath->setText(Utils::Fs::toNativePath(m_currentRule.savePath())); + m_ui->lineSavePath->setSelectedPath(Utils::Fs::toNativePath(m_currentRule.savePath())); m_ui->checkRegex->blockSignals(true); m_ui->checkRegex->setChecked(m_currentRule.useRegex()); m_ui->checkRegex->blockSignals(false); @@ -331,7 +333,7 @@ void AutomatedRssDownloader::updateEditedRule() m_currentRule.setMustContain(m_ui->lineContains->text()); m_currentRule.setMustNotContain(m_ui->lineNotContains->text()); m_currentRule.setEpisodeFilter(m_ui->lineEFilter->text()); - m_currentRule.setSavePath(m_ui->checkBoxSaveDiffDir->isChecked() ? m_ui->lineSavePath->text() : ""); + m_currentRule.setSavePath(m_ui->checkBoxSaveDiffDir->isChecked() ? m_ui->lineSavePath->selectedPath() : ""); m_currentRule.setCategory(m_ui->comboCategory->currentText()); TriStateBool addPaused; // Undefined by default if (m_ui->comboAddPaused->currentIndex() == 1) @@ -386,13 +388,6 @@ void AutomatedRssDownloader::on_removeRuleBtn_clicked() RSS::AutoDownloader::instance()->removeRule(item->text()); } -void AutomatedRssDownloader::on_browseSP_clicked() -{ - QString savePath = QFileDialog::getExistingDirectory(this, tr("Destination directory"), QDir::homePath()); - if (!savePath.isEmpty()) - m_ui->lineSavePath->setText(Utils::Fs::toNativePath(savePath)); -} - void AutomatedRssDownloader::on_exportBtn_clicked() { if (RSS::AutoDownloader::instance()->rules().isEmpty()) { diff --git a/src/gui/rss/automatedrssdownloader.h b/src/gui/rss/automatedrssdownloader.h index 0ce3f707a..d158ecee2 100644 --- a/src/gui/rss/automatedrssdownloader.h +++ b/src/gui/rss/automatedrssdownloader.h @@ -61,7 +61,6 @@ public: private slots: void on_addRuleBtn_clicked(); void on_removeRuleBtn_clicked(); - void on_browseSP_clicked(); void on_exportBtn_clicked(); void on_importBtn_clicked(); diff --git a/src/gui/rss/automatedrssdownloader.ui b/src/gui/rss/automatedrssdownloader.ui index f1357eab4..c9616f3b4 100644 --- a/src/gui/rss/automatedrssdownloader.ui +++ b/src/gui/rss/automatedrssdownloader.ui @@ -183,7 +183,7 @@ - Smart Episode Filter will check the episode number to prevent downloading of duplicates. + Smart Episode Filter will check the episode number to prevent downloading of duplicates. Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also support - as a separator) @@ -242,21 +242,7 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also - - - false - - - - - - - false - - - ... - - + @@ -428,6 +414,13 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also + + + FileSystemPathLineEdit + QWidget +
fspathedit.h
+
+
removeRuleBtn addRuleBtn @@ -440,7 +433,6 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also comboCategory checkBoxSaveDiffDir lineSavePath - browseSP spinIgnorePeriod comboAddPaused listFeeds @@ -514,21 +506,5 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also - - checkBoxSaveDiffDir - toggled(bool) - browseSP - setEnabled(bool) - - - 544 - 166 - - - 549 - 209 - - -