Browse Source

Merge pull request #14327 from zzandland/add-category-automated-rss-downloader

Add category button on AutomatedRSSDownloader
adaptive-webui-19844
Vladimir Golovnev 4 years ago committed by GitHub
parent
commit
0bac639a04
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. 5
      src/gui/rss/automatedrssdownloader.ui
  4. 8
      src/gui/torrentcategorydialog.cpp

13
src/gui/rss/automatedrssdownloader.cpp

@ -50,6 +50,7 @@
#include "base/utils/fs.h" #include "base/utils/fs.h"
#include "base/utils/string.h" #include "base/utils/string.h"
#include "gui/autoexpandabledialog.h" #include "gui/autoexpandabledialog.h"
#include "gui/torrentcategorydialog.h"
#include "gui/uithememanager.h" #include "gui/uithememanager.h"
#include "gui/utils.h" #include "gui/utils.h"
#include "ui_automatedrssdownloader.h" #include "ui_automatedrssdownloader.h"
@ -68,6 +69,7 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
// Icons // Icons
m_ui->removeRuleBtn->setIcon(UIThemeManager::instance()->getIcon("list-remove")); m_ui->removeRuleBtn->setIcon(UIThemeManager::instance()->getIcon("list-remove"));
m_ui->addRuleBtn->setIcon(UIThemeManager::instance()->getIcon("list-add")); m_ui->addRuleBtn->setIcon(UIThemeManager::instance()->getIcon("list-add"));
m_ui->addCategoryBtn->setIcon(UIThemeManager::instance()->getIcon("list-add"));
// Ui Settings // Ui Settings
m_ui->listRules->setSortingEnabled(true); m_ui->listRules->setSortingEnabled(true);
@ -405,6 +407,17 @@ void AutomatedRssDownloader::on_removeRuleBtn_clicked()
RSS::AutoDownloader::instance()->removeRule(item->text()); RSS::AutoDownloader::instance()->removeRule(item->text());
} }
void AutomatedRssDownloader::on_addCategoryBtn_clicked()
{
const QString newCategoryName = TorrentCategoryDialog::createCategory(this);
if (!newCategoryName.isEmpty())
{
m_ui->comboCategory->addItem(newCategoryName);
m_ui->comboCategory->setCurrentText(newCategoryName);
}
}
void AutomatedRssDownloader::on_exportBtn_clicked() void AutomatedRssDownloader::on_exportBtn_clicked()
{ {
if (RSS::AutoDownloader::instance()->rules().isEmpty()) if (RSS::AutoDownloader::instance()->rules().isEmpty())

1
src/gui/rss/automatedrssdownloader.h

@ -61,6 +61,7 @@ public:
private slots: private slots:
void on_addRuleBtn_clicked(); void on_addRuleBtn_clicked();
void on_removeRuleBtn_clicked(); void on_removeRuleBtn_clicked();
void on_addCategoryBtn_clicked();
void on_exportBtn_clicked(); void on_exportBtn_clicked();
void on_importBtn_clicked(); void on_importBtn_clicked();

5
src/gui/rss/automatedrssdownloader.ui

@ -209,7 +209,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Assign Category:</string> <string>Category:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -220,6 +220,9 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QToolButton" name="addCategoryBtn" />
</item>
</layout> </layout>
</item> </item>
<item> <item>

8
src/gui/torrentcategorydialog.cpp

@ -29,6 +29,7 @@
#include "torrentcategorydialog.h" #include "torrentcategorydialog.h"
#include <QMessageBox> #include <QMessageBox>
#include <QPushButton>
#include "base/bittorrent/session.h" #include "base/bittorrent/session.h"
#include "ui_torrentcategorydialog.h" #include "ui_torrentcategorydialog.h"
@ -40,6 +41,13 @@ TorrentCategoryDialog::TorrentCategoryDialog(QWidget *parent)
m_ui->setupUi(this); m_ui->setupUi(this);
m_ui->comboSavePath->setMode(FileSystemPathEdit::Mode::DirectorySave); m_ui->comboSavePath->setMode(FileSystemPathEdit::Mode::DirectorySave);
m_ui->comboSavePath->setDialogCaption(tr("Choose save path")); m_ui->comboSavePath->setDialogCaption(tr("Choose save path"));
// disable save button
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
connect(m_ui->textCategoryName, &QLineEdit::textChanged, this, [this](const QString &text)
{
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!text.isEmpty());
});
} }
TorrentCategoryDialog::~TorrentCategoryDialog() TorrentCategoryDialog::~TorrentCategoryDialog()

Loading…
Cancel
Save