2010-06-22 17:39:49 +04:00
|
|
|
/*
|
2017-03-07 16:10:42 +03:00
|
|
|
* Bittorrent Client using Qt and libtorrent.
|
|
|
|
* Copyright (C) 2017 Vladimir Golovnev <glassez@yandex.ru>
|
|
|
|
* Copyright (C) 2010 Christophe Dumez <chris@qbittorrent.org>
|
2010-06-22 17:39:49 +04:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* In addition, as a special exception, the copyright holders give permission to
|
|
|
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
|
|
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
|
|
|
* and distribute the linked executables. You must obey the GNU General Public
|
|
|
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
|
|
|
* modify file(s), you may extend this exception to your version of the file(s),
|
|
|
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
|
|
|
* exception statement from your version.
|
|
|
|
*/
|
|
|
|
|
2020-12-10 20:56:37 +03:00
|
|
|
#pragma once
|
2010-06-22 17:39:49 +04:00
|
|
|
|
2010-10-31 15:35:07 +03:00
|
|
|
#include <QDialog>
|
2017-03-07 16:10:42 +03:00
|
|
|
#include <QHash>
|
2017-01-22 07:36:27 +03:00
|
|
|
#include <QPair>
|
|
|
|
#include <QSet>
|
2015-10-14 12:31:44 +03:00
|
|
|
|
2017-03-07 16:10:42 +03:00
|
|
|
#include "base/rss/rss_autodownloadrule.h"
|
2010-10-31 15:35:07 +03:00
|
|
|
|
2010-11-13 13:49:22 +03:00
|
|
|
class QListWidgetItem;
|
2017-02-11 08:33:18 +03:00
|
|
|
class QRegularExpression;
|
2017-03-07 16:10:42 +03:00
|
|
|
|
|
|
|
namespace RSS
|
|
|
|
{
|
|
|
|
class Feed;
|
|
|
|
}
|
2010-11-13 13:49:22 +03:00
|
|
|
|
2019-07-13 07:55:21 +03:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class AutomatedRssDownloader;
|
|
|
|
}
|
|
|
|
|
2018-05-31 12:19:07 +03:00
|
|
|
class AutomatedRssDownloader : public QDialog
|
2010-06-22 17:39:49 +04:00
|
|
|
{
|
2017-01-08 03:46:01 +03:00
|
|
|
Q_OBJECT
|
2020-04-29 16:23:54 +03:00
|
|
|
Q_DISABLE_COPY(AutomatedRssDownloader)
|
2010-06-22 17:39:49 +04:00
|
|
|
|
2010-10-31 15:35:07 +03:00
|
|
|
public:
|
2017-03-07 16:10:42 +03:00
|
|
|
explicit AutomatedRssDownloader(QWidget *parent = nullptr);
|
|
|
|
~AutomatedRssDownloader() override;
|
2010-11-13 13:49:22 +03:00
|
|
|
|
|
|
|
private slots:
|
2017-01-08 03:46:01 +03:00
|
|
|
void on_addRuleBtn_clicked();
|
|
|
|
void on_removeRuleBtn_clicked();
|
2021-02-06 16:13:57 +03:00
|
|
|
void on_addCategoryBtn_clicked();
|
2017-01-08 03:46:01 +03:00
|
|
|
void on_exportBtn_clicked();
|
|
|
|
void on_importBtn_clicked();
|
2017-03-07 16:10:42 +03:00
|
|
|
|
|
|
|
void handleRuleCheckStateChange(QListWidgetItem *ruleItem);
|
|
|
|
void handleFeedCheckStateChange(QListWidgetItem *feedItem);
|
|
|
|
void displayRulesListMenu();
|
2017-01-08 03:46:01 +03:00
|
|
|
void renameSelectedRule();
|
2017-03-07 16:10:42 +03:00
|
|
|
void updateRuleDefinitionBox();
|
2016-05-22 16:59:31 +03:00
|
|
|
void clearSelectedRuleDownloadedEpisodeList();
|
2017-01-08 03:46:01 +03:00
|
|
|
void updateFieldsToolTips(bool regex);
|
|
|
|
void updateMustLineValidity();
|
|
|
|
void updateMustNotLineValidity();
|
2016-11-06 08:53:06 +03:00
|
|
|
void updateEpisodeFilterValidity();
|
2017-03-07 16:10:42 +03:00
|
|
|
void handleRuleDefinitionChanged();
|
|
|
|
void handleRuleAdded(const QString &ruleName);
|
|
|
|
void handleRuleRenamed(const QString &ruleName, const QString &oldRuleName);
|
|
|
|
void handleRuleChanged(const QString &ruleName);
|
|
|
|
void handleRuleAboutToBeRemoved(const QString &ruleName);
|
|
|
|
|
|
|
|
void handleProcessingStateChanged(bool enabled);
|
2010-11-13 15:08:29 +03:00
|
|
|
|
2010-11-13 13:49:22 +03:00
|
|
|
private:
|
2017-03-07 16:10:42 +03:00
|
|
|
void loadSettings();
|
|
|
|
void saveSettings();
|
|
|
|
void createRuleItem(const RSS::AutoDownloadRule &rule);
|
2017-01-08 03:46:01 +03:00
|
|
|
void initCategoryCombobox();
|
2017-03-07 16:10:42 +03:00
|
|
|
void clearRuleDefinitionBox();
|
|
|
|
void updateEditedRule();
|
|
|
|
void updateMatchingArticles();
|
|
|
|
void saveEditedRule();
|
|
|
|
void loadFeedList();
|
|
|
|
void updateFeedList();
|
|
|
|
void addFeedArticlesToTree(RSS::Feed *feed, const QStringList &articles);
|
2010-10-31 15:35:07 +03:00
|
|
|
|
2017-11-23 10:25:43 +03:00
|
|
|
const QString m_formatFilterJSON;
|
|
|
|
const QString m_formatFilterLegacy;
|
|
|
|
|
2017-03-07 16:10:42 +03:00
|
|
|
Ui::AutomatedRssDownloader *m_ui;
|
|
|
|
QListWidgetItem *m_currentRuleItem;
|
|
|
|
QSet<QPair<QString, QString>> m_treeListEntries;
|
|
|
|
RSS::AutoDownloadRule m_currentRule;
|
|
|
|
QHash<QString, QListWidgetItem *> m_itemsByRuleName;
|
2017-02-11 08:33:18 +03:00
|
|
|
QRegularExpression *m_episodeRegex;
|
2010-10-31 15:35:07 +03:00
|
|
|
};
|