Browse Source

Add "Rename rule" button to RSS Downloader

PR #18141.
adaptive-webui-19844
BallsOfSpaghetti 2 years ago committed by GitHub
parent
commit
c3936cd4b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      src/gui/rss/automatedrssdownloader.cpp
  2. 1
      src/gui/rss/automatedrssdownloader.h
  3. 17
      src/gui/rss/automatedrssdownloader.ui

13
src/gui/rss/automatedrssdownloader.cpp

@ -75,6 +75,7 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent) @@ -75,6 +75,7 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
{
m_ui->setupUi(this);
// Icons
m_ui->renameRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"edit-rename"_qs));
m_ui->removeRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"edit-clear"_qs));
m_ui->addRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
m_ui->addCategoryBtn->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
@ -250,6 +251,13 @@ void AutomatedRssDownloader::updateRuleDefinitionBox() @@ -250,6 +251,13 @@ void AutomatedRssDownloader::updateRuleDefinitionBox()
{
const QList<QListWidgetItem *> selection = m_ui->listRules->selectedItems();
QListWidgetItem *currentRuleItem = ((selection.count() == 1) ? selection.first() : nullptr);
// Enable the edit rule button but only if we have 1 rule selected
if (selection.count() == 1)
m_ui->renameRuleBtn->setEnabled(true);
else
m_ui->renameRuleBtn->setEnabled(false);
if (m_currentRuleItem != currentRuleItem)
{
saveEditedRule(); // Save previous rule first
@ -427,6 +435,11 @@ void AutomatedRssDownloader::on_addCategoryBtn_clicked() @@ -427,6 +435,11 @@ void AutomatedRssDownloader::on_addCategoryBtn_clicked()
}
}
void AutomatedRssDownloader::on_renameRuleBtn_clicked()
{
renameSelectedRule();
}
void AutomatedRssDownloader::on_exportBtn_clicked()
{
if (RSS::AutoDownloader::instance()->rules().isEmpty())

1
src/gui/rss/automatedrssdownloader.h

@ -66,6 +66,7 @@ private slots: @@ -66,6 +66,7 @@ private slots:
void on_addCategoryBtn_clicked();
void on_exportBtn_clicked();
void on_importBtn_clicked();
void on_renameRuleBtn_clicked();
void handleRuleCheckStateChange(QListWidgetItem *ruleItem);
void handleFeedCheckStateChange(QListWidgetItem *feedItem);

17
src/gui/rss/automatedrssdownloader.ui

@ -60,6 +60,22 @@ @@ -60,6 +60,22 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="renameRuleBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Rename selected rule. You can also use the F2 hotkey to rename.</string>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="removeRuleBtn">
<property name="iconSize">
@ -466,6 +482,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also @@ -466,6 +482,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
</customwidget>
</customwidgets>
<tabstops>
<tabstop>renameRuleBtn</tabstop>
<tabstop>removeRuleBtn</tabstop>
<tabstop>addRuleBtn</tabstop>
<tabstop>listRules</tabstop>

Loading…
Cancel
Save