qBittorrent/src/gui/rss/automatedrssdownloader.h

110 lines
3.6 KiB
C
Raw Normal View History

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.
*/
#ifndef AUTOMATEDRSSDOWNLOADER_H
#define AUTOMATEDRSSDOWNLOADER_H
2010-06-22 17:39:49 +04:00
#include <QDialog>
2017-03-07 16:10:42 +03:00
#include <QHash>
#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"
namespace Ui
{
class AutomatedRssDownloader;
2010-06-22 17:39:49 +04:00
}
class QListWidgetItem;
class QRegularExpression;
2017-03-07 16:10:42 +03:00
class QShortcut;
namespace RSS
{
class Feed;
}
class AutomatedRssDownloader: public QDialog
2010-06-22 17:39:49 +04:00
{
Q_OBJECT
2010-06-22 17:39:49 +04:00
public:
2017-03-07 16:10:42 +03:00
explicit AutomatedRssDownloader(QWidget *parent = nullptr);
~AutomatedRssDownloader() override;
private slots:
void on_addRuleBtn_clicked();
void on_removeRuleBtn_clicked();
void on_browseSP_clicked();
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();
void renameSelectedRule();
2017-03-07 16:10:42 +03:00
void updateRuleDefinitionBox();
void updateFieldsToolTips(bool regex);
void updateMustLineValidity();
void updateMustNotLineValidity();
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);
private:
2017-03-07 16:10:42 +03:00
void loadSettings();
void saveSettings();
void createRuleItem(const RSS::AutoDownloadRule &rule);
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);
2017-03-07 16:10:42 +03:00
Ui::AutomatedRssDownloader *m_ui;
QListWidgetItem *m_currentRuleItem;
QShortcut *m_editHotkey;
QShortcut *m_deleteHotkey;
QSet<QPair<QString, QString>> m_treeListEntries;
RSS::AutoDownloadRule m_currentRule;
QHash<QString, QListWidgetItem *> m_itemsByRuleName;
QRegularExpression *m_episodeRegex;
};
#endif // AUTOMATEDRSSDOWNLOADER_H