Browse Source

Use FileSystemPathEdit in automated rss downloader

adaptive-webui-19844
thalieht 5 years ago
parent
commit
e26573d97f
  1. 13
      src/gui/rss/automatedrssdownloader.cpp
  2. 1
      src/gui/rss/automatedrssdownloader.h
  3. 42
      src/gui/rss/automatedrssdownloader.ui

13
src/gui/rss/automatedrssdownloader.cpp

@ -77,6 +77,8 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent) @@ -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() @@ -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() @@ -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() @@ -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()) {

1
src/gui/rss/automatedrssdownloader.h

@ -61,7 +61,6 @@ public: @@ -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();

42
src/gui/rss/automatedrssdownloader.ui

@ -183,7 +183,7 @@ @@ -183,7 +183,7 @@
<item>
<widget class="QCheckBox" name="checkSmart">
<property name="toolTip">
<string>Smart Episode Filter will check the episode number to prevent downloading of duplicates.
<string>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)</string>
</property>
<property name="text">
@ -242,21 +242,7 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also @@ -242,21 +242,7 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineSavePath">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="browseSP">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string notr="true">...</string>
</property>
</widget>
<widget class="FileSystemPathLineEdit" name="lineSavePath" native="true"/>
</item>
</layout>
</item>
@ -428,6 +414,13 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also @@ -428,6 +414,13 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>FileSystemPathLineEdit</class>
<extends>QWidget</extends>
<header>fspathedit.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>removeRuleBtn</tabstop>
<tabstop>addRuleBtn</tabstop>
@ -440,7 +433,6 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also @@ -440,7 +433,6 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also
<tabstop>comboCategory</tabstop>
<tabstop>checkBoxSaveDiffDir</tabstop>
<tabstop>lineSavePath</tabstop>
<tabstop>browseSP</tabstop>
<tabstop>spinIgnorePeriod</tabstop>
<tabstop>comboAddPaused</tabstop>
<tabstop>listFeeds</tabstop>
@ -514,21 +506,5 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also @@ -514,21 +506,5 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also
</hint>
</hints>
</connection>
<connection>
<sender>checkBoxSaveDiffDir</sender>
<signal>toggled(bool)</signal>
<receiver>browseSP</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>544</x>
<y>166</y>
</hint>
<hint type="destinationlabel">
<x>549</x>
<y>209</y>
</hint>
</hints>
</connection>
</connections>
</ui>

Loading…
Cancel
Save