Revamp "Automated RSS downloader" dialog

This commit is contained in:
Vladimir Golovnev (Glassez) 2023-04-11 12:17:48 +03:00
parent 0a87bb368f
commit 905f141657
No known key found for this signature in database
GPG key ID: 52A2C7DEE2DFA6F7
9 changed files with 464 additions and 618 deletions

View file

@ -28,6 +28,8 @@
#include "addtorrentparams.h" #include "addtorrentparams.h"
#include <tuple>
#include <QJsonArray> #include <QJsonArray>
#include <QJsonObject> #include <QJsonObject>
#include <QJsonValue> #include <QJsonValue>
@ -97,6 +99,24 @@ namespace
} }
} }
bool BitTorrent::operator==(const AddTorrentParams &lhs, const AddTorrentParams &rhs)
{
return std::tie(lhs.name, lhs.category, lhs.tags,
lhs.savePath, lhs.useDownloadPath, lhs.downloadPath,
lhs.sequential, lhs.firstLastPiecePriority, lhs.addForced,
lhs.addToQueueTop, lhs.addPaused, lhs.stopCondition,
lhs.filePaths, lhs.filePriorities, lhs.skipChecking,
lhs.contentLayout, lhs.useAutoTMM, lhs.uploadLimit,
lhs.downloadLimit, lhs.seedingTimeLimit, lhs.ratioLimit)
== std::tie(rhs.name, rhs.category, rhs.tags,
rhs.savePath, rhs.useDownloadPath, rhs.downloadPath,
rhs.sequential, rhs.firstLastPiecePriority, rhs.addForced,
rhs.addToQueueTop, rhs.addPaused, rhs.stopCondition,
rhs.filePaths, rhs.filePriorities, rhs.skipChecking,
rhs.contentLayout, rhs.useAutoTMM, rhs.uploadLimit,
rhs.downloadLimit, rhs.seedingTimeLimit, rhs.ratioLimit);
}
BitTorrent::AddTorrentParams BitTorrent::parseAddTorrentParams(const QJsonObject &jsonObj) BitTorrent::AddTorrentParams BitTorrent::parseAddTorrentParams(const QJsonObject &jsonObj)
{ {
AddTorrentParams params; AddTorrentParams params;

View file

@ -70,6 +70,8 @@ namespace BitTorrent
qreal ratioLimit = Torrent::USE_GLOBAL_RATIO; qreal ratioLimit = Torrent::USE_GLOBAL_RATIO;
}; };
bool operator==(const AddTorrentParams &lhs, const AddTorrentParams &rhs);
AddTorrentParams parseAddTorrentParams(const QJsonObject &jsonObj); AddTorrentParams parseAddTorrentParams(const QJsonObject &jsonObj);
QJsonObject serializeAddTorrentParams(const AddTorrentParams &params); QJsonObject serializeAddTorrentParams(const AddTorrentParams &params);
} }

View file

@ -430,15 +430,8 @@ void AutoDownloader::processJob(const QSharedPointer<ProcessingJob> &job)
m_dirty = true; m_dirty = true;
storeDeferred(); storeDeferred();
BitTorrent::AddTorrentParams params;
params.savePath = rule.savePath();
params.category = rule.assignedCategory();
params.addPaused = rule.addPaused();
params.contentLayout = rule.torrentContentLayout();
if (!rule.savePath().isEmpty())
params.useAutoTMM = false;
const auto torrentURL = job->articleData.value(Article::KeyTorrentURL).toString(); const auto torrentURL = job->articleData.value(Article::KeyTorrentURL).toString();
BitTorrent::Session::instance()->addTorrent(torrentURL, params); BitTorrent::Session::instance()->addTorrent(torrentURL, rule.addTorrentParams());
if (BitTorrent::MagnetUri(torrentURL).isValid()) if (BitTorrent::MagnetUri(torrentURL).isValid())
{ {

View file

@ -1,6 +1,6 @@
/* /*
* Bittorrent Client using Qt and libtorrent. * Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2017 Vladimir Golovnev <glassez@yandex.ru> * Copyright (C) 2017-2023 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2010 Christophe Dumez <chris@qbittorrent.org> * Copyright (C) 2010 Christophe Dumez <chris@qbittorrent.org>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -101,22 +101,24 @@ namespace
} }
} }
const QString Str_Name = u"name"_qs; const QString S_NAME = u"name"_qs;
const QString Str_Enabled = u"enabled"_qs; const QString S_ENABLED = u"enabled"_qs;
const QString Str_UseRegex = u"useRegex"_qs; const QString S_USE_REGEX = u"useRegex"_qs;
const QString Str_MustContain = u"mustContain"_qs; const QString S_MUST_CONTAIN = u"mustContain"_qs;
const QString Str_MustNotContain = u"mustNotContain"_qs; const QString S_MUST_NOT_CONTAIN = u"mustNotContain"_qs;
const QString Str_EpisodeFilter = u"episodeFilter"_qs; const QString S_EPISODE_FILTER = u"episodeFilter"_qs;
const QString Str_AffectedFeeds = u"affectedFeeds"_qs; const QString S_AFFECTED_FEEDS = u"affectedFeeds"_qs;
const QString Str_SavePath = u"savePath"_qs; const QString S_LAST_MATCH = u"lastMatch"_qs;
const QString Str_AssignedCategory = u"assignedCategory"_qs; const QString S_IGNORE_DAYS = u"ignoreDays"_qs;
const QString Str_LastMatch = u"lastMatch"_qs; const QString S_SMART_FILTER = u"smartFilter"_qs;
const QString Str_IgnoreDays = u"ignoreDays"_qs; const QString S_PREVIOUSLY_MATCHED = u"previouslyMatchedEpisodes"_qs;
const QString Str_AddPaused = u"addPaused"_qs;
const QString Str_CreateSubfolder = u"createSubfolder"_qs; const QString S_SAVE_PATH = u"savePath"_qs;
const QString Str_ContentLayout = u"torrentContentLayout"_qs; const QString S_ASSIGNED_CATEGORY = u"assignedCategory"_qs;
const QString Str_SmartFilter = u"smartFilter"_qs; const QString S_ADD_PAUSED = u"addPaused"_qs;
const QString Str_PreviouslyMatched = u"previouslyMatchedEpisodes"_qs; const QString S_CONTENT_LAYOUT = u"torrentContentLayout"_qs;
const QString S_TORRENT_PARAMS = u"torrentParams"_qs;
namespace RSS namespace RSS
{ {
@ -133,10 +135,7 @@ namespace RSS
int ignoreDays = 0; int ignoreDays = 0;
QDateTime lastMatch; QDateTime lastMatch;
Path savePath; BitTorrent::AddTorrentParams addTorrentParams;
QString category;
std::optional<bool> addPaused;
std::optional<BitTorrent::TorrentContentLayout> contentLayout;
bool smartFilter = false; bool smartFilter = false;
QStringList previouslyMatchedEpisodes; QStringList previouslyMatchedEpisodes;
@ -155,11 +154,8 @@ namespace RSS
&& (left.useRegex == right.useRegex) && (left.useRegex == right.useRegex)
&& (left.ignoreDays == right.ignoreDays) && (left.ignoreDays == right.ignoreDays)
&& (left.lastMatch == right.lastMatch) && (left.lastMatch == right.lastMatch)
&& (left.savePath == right.savePath) && (left.smartFilter == right.smartFilter)
&& (left.category == right.category) && (left.addTorrentParams == right.addTorrentParams);
&& (left.addPaused == right.addPaused)
&& (left.contentLayout == right.contentLayout)
&& (left.smartFilter == right.smartFilter);
} }
}; };
@ -458,64 +454,45 @@ AutoDownloadRule &AutoDownloadRule::operator=(const AutoDownloadRule &other)
QJsonObject AutoDownloadRule::toJsonObject() const QJsonObject AutoDownloadRule::toJsonObject() const
{ {
return {{Str_Enabled, isEnabled()} const BitTorrent::AddTorrentParams &addTorrentParams = m_dataPtr->addTorrentParams;
, {Str_UseRegex, useRegex()}
, {Str_MustContain, mustContain()} return {{S_ENABLED, isEnabled()}
, {Str_MustNotContain, mustNotContain()} , {S_USE_REGEX, useRegex()}
, {Str_EpisodeFilter, episodeFilter()} , {S_MUST_CONTAIN, mustContain()}
, {Str_AffectedFeeds, QJsonArray::fromStringList(feedURLs())} , {S_MUST_NOT_CONTAIN, mustNotContain()}
, {Str_SavePath, savePath().toString()} , {S_EPISODE_FILTER, episodeFilter()}
, {Str_AssignedCategory, assignedCategory()} , {S_AFFECTED_FEEDS, QJsonArray::fromStringList(feedURLs())}
, {Str_LastMatch, lastMatch().toString(Qt::RFC2822Date)} , {S_LAST_MATCH, lastMatch().toString(Qt::RFC2822Date)}
, {Str_IgnoreDays, ignoreDays()} , {S_IGNORE_DAYS, ignoreDays()}
, {Str_AddPaused, toJsonValue(addPaused())} , {S_SMART_FILTER, useSmartFilter()}
, {Str_ContentLayout, contentLayoutToJsonValue(torrentContentLayout())} , {S_PREVIOUSLY_MATCHED, QJsonArray::fromStringList(previouslyMatchedEpisodes())}
, {Str_SmartFilter, useSmartFilter()}
, {Str_PreviouslyMatched, QJsonArray::fromStringList(previouslyMatchedEpisodes())}}; // TODO: The following code is deprecated. Replace with the commented one after several releases in 4.6.x.
// === BEGIN DEPRECATED CODE === //
, {S_ADD_PAUSED, toJsonValue(addTorrentParams.addPaused)}
, {S_CONTENT_LAYOUT, contentLayoutToJsonValue(addTorrentParams.contentLayout)}
, {S_SAVE_PATH, addTorrentParams.savePath.toString()}
, {S_ASSIGNED_CATEGORY, addTorrentParams.category}
// === END DEPRECATED CODE === //
, {S_TORRENT_PARAMS, BitTorrent::serializeAddTorrentParams(addTorrentParams)}
};
} }
AutoDownloadRule AutoDownloadRule::fromJsonObject(const QJsonObject &jsonObj, const QString &name) AutoDownloadRule AutoDownloadRule::fromJsonObject(const QJsonObject &jsonObj, const QString &name)
{ {
AutoDownloadRule rule(name.isEmpty() ? jsonObj.value(Str_Name).toString() : name); AutoDownloadRule rule {(name.isEmpty() ? jsonObj.value(S_NAME).toString() : name)};
rule.setUseRegex(jsonObj.value(Str_UseRegex).toBool(false)); rule.setUseRegex(jsonObj.value(S_USE_REGEX).toBool(false));
rule.setMustContain(jsonObj.value(Str_MustContain).toString()); rule.setMustContain(jsonObj.value(S_MUST_CONTAIN).toString());
rule.setMustNotContain(jsonObj.value(Str_MustNotContain).toString()); rule.setMustNotContain(jsonObj.value(S_MUST_NOT_CONTAIN).toString());
rule.setEpisodeFilter(jsonObj.value(Str_EpisodeFilter).toString()); rule.setEpisodeFilter(jsonObj.value(S_EPISODE_FILTER).toString());
rule.setEnabled(jsonObj.value(Str_Enabled).toBool(true)); rule.setEnabled(jsonObj.value(S_ENABLED).toBool(true));
rule.setSavePath(Path(jsonObj.value(Str_SavePath).toString())); rule.setLastMatch(QDateTime::fromString(jsonObj.value(S_LAST_MATCH).toString(), Qt::RFC2822Date));
rule.setCategory(jsonObj.value(Str_AssignedCategory).toString()); rule.setIgnoreDays(jsonObj.value(S_IGNORE_DAYS).toInt());
rule.setAddPaused(toOptionalBool(jsonObj.value(Str_AddPaused))); rule.setUseSmartFilter(jsonObj.value(S_SMART_FILTER).toBool(false));
// TODO: The following code is deprecated. Replace with the commented one after several releases in 4.4.x. const QJsonValue feedsVal = jsonObj.value(S_AFFECTED_FEEDS);
// === BEGIN DEPRECATED CODE === //
if (jsonObj.contains(Str_ContentLayout))
{
rule.setTorrentContentLayout(jsonValueToContentLayout(jsonObj.value(Str_ContentLayout)));
}
else
{
const std::optional<bool> createSubfolder = toOptionalBool(jsonObj.value(Str_CreateSubfolder));
std::optional<BitTorrent::TorrentContentLayout> contentLayout;
if (createSubfolder.has_value())
{
contentLayout = (*createSubfolder
? BitTorrent::TorrentContentLayout::Original
: BitTorrent::TorrentContentLayout::NoSubfolder);
}
rule.setTorrentContentLayout(contentLayout);
}
// === END DEPRECATED CODE === //
// === BEGIN REPLACEMENT CODE === //
// rule.setTorrentContentLayout(jsonValueToContentLayout(jsonObj.value(Str_ContentLayout)));
// === END REPLACEMENT CODE === //
rule.setLastMatch(QDateTime::fromString(jsonObj.value(Str_LastMatch).toString(), Qt::RFC2822Date));
rule.setIgnoreDays(jsonObj.value(Str_IgnoreDays).toInt());
rule.setUseSmartFilter(jsonObj.value(Str_SmartFilter).toBool(false));
const QJsonValue feedsVal = jsonObj.value(Str_AffectedFeeds);
QStringList feedURLs; QStringList feedURLs;
if (feedsVal.isString()) if (feedsVal.isString())
feedURLs << feedsVal.toString(); feedURLs << feedsVal.toString();
@ -523,7 +500,7 @@ AutoDownloadRule AutoDownloadRule::fromJsonObject(const QJsonObject &jsonObj, co
feedURLs << urlVal.toString(); feedURLs << urlVal.toString();
rule.setFeedURLs(feedURLs); rule.setFeedURLs(feedURLs);
const QJsonValue previouslyMatchedVal = jsonObj.value(Str_PreviouslyMatched); const QJsonValue previouslyMatchedVal = jsonObj.value(S_PREVIOUSLY_MATCHED);
QStringList previouslyMatched; QStringList previouslyMatched;
if (previouslyMatchedVal.isString()) if (previouslyMatchedVal.isString())
{ {
@ -536,20 +513,61 @@ AutoDownloadRule AutoDownloadRule::fromJsonObject(const QJsonObject &jsonObj, co
} }
rule.setPreviouslyMatchedEpisodes(previouslyMatched); rule.setPreviouslyMatchedEpisodes(previouslyMatched);
// TODO: The following code is deprecated. Replace with the commented one after several releases in 4.6.x.
// === BEGIN DEPRECATED CODE === //
BitTorrent::AddTorrentParams addTorrentParams;
if (auto it = jsonObj.find(S_TORRENT_PARAMS); it != jsonObj.end())
{
addTorrentParams = BitTorrent::parseAddTorrentParams(it->toObject());
}
else
{
addTorrentParams.savePath = Path(jsonObj.value(S_SAVE_PATH).toString());
addTorrentParams.category = jsonObj.value(S_ASSIGNED_CATEGORY).toString();
addTorrentParams.addPaused = toOptionalBool(jsonObj.value(S_ADD_PAUSED));
if (!addTorrentParams.savePath.isEmpty())
addTorrentParams.useAutoTMM = false;
if (jsonObj.contains(S_CONTENT_LAYOUT))
{
addTorrentParams.contentLayout = jsonValueToContentLayout(jsonObj.value(S_CONTENT_LAYOUT));
}
else
{
const std::optional<bool> createSubfolder = toOptionalBool(jsonObj.value(u"createSubfolder"));
std::optional<BitTorrent::TorrentContentLayout> contentLayout;
if (createSubfolder.has_value())
{
contentLayout = (*createSubfolder
? BitTorrent::TorrentContentLayout::Original
: BitTorrent::TorrentContentLayout::NoSubfolder);
}
addTorrentParams.contentLayout = contentLayout;
}
}
rule.setAddTorrentParams(addTorrentParams);
// === END DEPRECATED CODE === //
// === BEGIN REPLACEMENT CODE === //
// rule.setAddTorrentParams(BitTorrent::parseAddTorrentParams(jsonObj.value(S_TORRENT_PARAMS).object()));
// === END REPLACEMENT CODE === //
return rule; return rule;
} }
QVariantHash AutoDownloadRule::toLegacyDict() const QVariantHash AutoDownloadRule::toLegacyDict() const
{ {
const BitTorrent::AddTorrentParams &addTorrentParams = m_dataPtr->addTorrentParams;
return {{u"name"_qs, name()}, return {{u"name"_qs, name()},
{u"must_contain"_qs, mustContain()}, {u"must_contain"_qs, mustContain()},
{u"must_not_contain"_qs, mustNotContain()}, {u"must_not_contain"_qs, mustNotContain()},
{u"save_path"_qs, savePath().toString()}, {u"save_path"_qs, addTorrentParams.savePath.toString()},
{u"affected_feeds"_qs, feedURLs()}, {u"affected_feeds"_qs, feedURLs()},
{u"enabled"_qs, isEnabled()}, {u"enabled"_qs, isEnabled()},
{u"category_assigned"_qs, assignedCategory()}, {u"category_assigned"_qs, addTorrentParams.category},
{u"use_regex"_qs, useRegex()}, {u"use_regex"_qs, useRegex()},
{u"add_paused"_qs, toAddPausedLegacy(addPaused())}, {u"add_paused"_qs, toAddPausedLegacy(addTorrentParams.addPaused)},
{u"episode_filter"_qs, episodeFilter()}, {u"episode_filter"_qs, episodeFilter()},
{u"last_match"_qs, lastMatch()}, {u"last_match"_qs, lastMatch()},
{u"ignore_days"_qs, ignoreDays()}}; {u"ignore_days"_qs, ignoreDays()}};
@ -557,7 +575,14 @@ QVariantHash AutoDownloadRule::toLegacyDict() const
AutoDownloadRule AutoDownloadRule::fromLegacyDict(const QVariantHash &dict) AutoDownloadRule AutoDownloadRule::fromLegacyDict(const QVariantHash &dict)
{ {
AutoDownloadRule rule(dict.value(u"name"_qs).toString()); BitTorrent::AddTorrentParams addTorrentParams;
addTorrentParams.savePath = Path(dict.value(u"save_path"_qs).toString());
addTorrentParams.category = dict.value(u"category_assigned"_qs).toString();
addTorrentParams.addPaused = addPausedLegacyToOptionalBool(dict.value(u"add_paused"_qs).toInt());
if (!addTorrentParams.savePath.isEmpty())
addTorrentParams.useAutoTMM = false;
AutoDownloadRule rule {dict.value(u"name"_qs).toString()};
rule.setUseRegex(dict.value(u"use_regex"_qs, false).toBool()); rule.setUseRegex(dict.value(u"use_regex"_qs, false).toBool());
rule.setMustContain(dict.value(u"must_contain"_qs).toString()); rule.setMustContain(dict.value(u"must_contain"_qs).toString());
@ -565,11 +590,9 @@ AutoDownloadRule AutoDownloadRule::fromLegacyDict(const QVariantHash &dict)
rule.setEpisodeFilter(dict.value(u"episode_filter"_qs).toString()); rule.setEpisodeFilter(dict.value(u"episode_filter"_qs).toString());
rule.setFeedURLs(dict.value(u"affected_feeds"_qs).toStringList()); rule.setFeedURLs(dict.value(u"affected_feeds"_qs).toStringList());
rule.setEnabled(dict.value(u"enabled"_qs, false).toBool()); rule.setEnabled(dict.value(u"enabled"_qs, false).toBool());
rule.setSavePath(Path(dict.value(u"save_path"_qs).toString()));
rule.setCategory(dict.value(u"category_assigned"_qs).toString());
rule.setAddPaused(addPausedLegacyToOptionalBool(dict.value(u"add_paused"_qs).toInt()));
rule.setLastMatch(dict.value(u"last_match"_qs).toDateTime()); rule.setLastMatch(dict.value(u"last_match"_qs).toDateTime());
rule.setIgnoreDays(dict.value(u"ignore_days"_qs).toInt()); rule.setIgnoreDays(dict.value(u"ignore_days"_qs).toInt());
rule.setAddTorrentParams(addTorrentParams);
return rule; return rule;
} }
@ -622,44 +645,14 @@ void AutoDownloadRule::setName(const QString &name)
m_dataPtr->name = name; m_dataPtr->name = name;
} }
Path AutoDownloadRule::savePath() const BitTorrent::AddTorrentParams AutoDownloadRule::addTorrentParams() const
{ {
return m_dataPtr->savePath; return m_dataPtr->addTorrentParams;
} }
void AutoDownloadRule::setSavePath(const Path &savePath) void AutoDownloadRule::setAddTorrentParams(BitTorrent::AddTorrentParams addTorrentParams)
{ {
m_dataPtr->savePath = savePath; m_dataPtr->addTorrentParams = std::move(addTorrentParams);
}
std::optional<bool> AutoDownloadRule::addPaused() const
{
return m_dataPtr->addPaused;
}
void AutoDownloadRule::setAddPaused(const std::optional<bool> addPaused)
{
m_dataPtr->addPaused = addPaused;
}
std::optional<BitTorrent::TorrentContentLayout> AutoDownloadRule::torrentContentLayout() const
{
return m_dataPtr->contentLayout;
}
void AutoDownloadRule::setTorrentContentLayout(const std::optional<BitTorrent::TorrentContentLayout> contentLayout)
{
m_dataPtr->contentLayout = contentLayout;
}
QString AutoDownloadRule::assignedCategory() const
{
return m_dataPtr->category;
}
void AutoDownloadRule::setCategory(const QString &category)
{
m_dataPtr->category = category;
} }
bool AutoDownloadRule::isEnabled() const bool AutoDownloadRule::isEnabled() const

View file

@ -1,6 +1,6 @@
/* /*
* Bittorrent Client using Qt and libtorrent. * Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2017 Vladimir Golovnev <glassez@yandex.ru> * Copyright (C) 2017-2023 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2010 Christophe Dumez <chris@qbittorrent.org> * Copyright (C) 2010 Christophe Dumez <chris@qbittorrent.org>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -35,7 +35,7 @@
#include <QVariant> #include <QVariant>
#include "base/global.h" #include "base/global.h"
#include "base/bittorrent/torrentcontentlayout.h" #include "base/bittorrent/addtorrentparams.h"
#include "base/pathfwd.h" #include "base/pathfwd.h"
class QDateTime; class QDateTime;
@ -81,14 +81,8 @@ namespace RSS
QStringList previouslyMatchedEpisodes() const; QStringList previouslyMatchedEpisodes() const;
void setPreviouslyMatchedEpisodes(const QStringList &previouslyMatchedEpisodes); void setPreviouslyMatchedEpisodes(const QStringList &previouslyMatchedEpisodes);
Path savePath() const; BitTorrent::AddTorrentParams addTorrentParams() const;
void setSavePath(const Path &savePath); void setAddTorrentParams(BitTorrent::AddTorrentParams addTorrentParams);
std::optional<bool> addPaused() const;
void setAddPaused(std::optional<bool> addPaused);
std::optional<BitTorrent::TorrentContentLayout> torrentContentLayout() const;
void setTorrentContentLayout(std::optional<BitTorrent::TorrentContentLayout> contentLayout);
QString assignedCategory() const;
void setCategory(const QString &category);
bool matches(const QVariantHash &articleData) const; bool matches(const QVariantHash &articleData) const;
bool accepts(const QVariantHash &articleData); bool accepts(const QVariantHash &articleData);

View file

@ -43,7 +43,7 @@ class AddTorrentParamsWidget final : public QWidget
Q_DISABLE_COPY_MOVE(AddTorrentParamsWidget) Q_DISABLE_COPY_MOVE(AddTorrentParamsWidget)
public: public:
explicit AddTorrentParamsWidget(BitTorrent::AddTorrentParams addTorrentParams, QWidget *parent = nullptr); explicit AddTorrentParamsWidget(BitTorrent::AddTorrentParams addTorrentParams = {}, QWidget *parent = nullptr);
~AddTorrentParamsWidget() override; ~AddTorrentParamsWidget() override;
void setAddTorrentParams(BitTorrent::AddTorrentParams addTorrentParams); void setAddTorrentParams(BitTorrent::AddTorrentParams addTorrentParams);

View file

@ -1,6 +1,6 @@
/* /*
* Bittorrent Client using Qt and libtorrent. * Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2017 Vladimir Golovnev <glassez@yandex.ru> * Copyright (C) 2017, 2023 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2010 Christophe Dumez <chris@qbittorrent.org> * Copyright (C) 2010 Christophe Dumez <chris@qbittorrent.org>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -50,6 +50,7 @@
#include "base/utils/compare.h" #include "base/utils/compare.h"
#include "base/utils/io.h" #include "base/utils/io.h"
#include "base/utils/string.h" #include "base/utils/string.h"
#include "gui/addtorrentparamswidget.h"
#include "gui/autoexpandabledialog.h" #include "gui/autoexpandabledialog.h"
#include "gui/torrentcategorydialog.h" #include "gui/torrentcategorydialog.h"
#include "gui/uithememanager.h" #include "gui/uithememanager.h"
@ -61,37 +62,44 @@ const QString EXT_LEGACY = u".rssrules"_qs;
AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent) AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_formatFilterJSON(u"%1 (*%2)"_qs.arg(tr("Rules"), EXT_JSON)) , m_formatFilterJSON {u"%1 (*%2)"_qs.arg(tr("Rules"), EXT_JSON)}
, m_formatFilterLegacy(u"%1 (*%2)"_qs.arg(tr("Rules (legacy)"), EXT_LEGACY)) , m_formatFilterLegacy {u"%1 (*%2)"_qs.arg(tr("Rules (legacy)"), EXT_LEGACY)}
, m_ui(new Ui::AutomatedRssDownloader) , m_ui {new Ui::AutomatedRssDownloader}
, m_addTorrentParamsWidget {new AddTorrentParamsWidget}
, m_storeDialogSize {u"RssFeedDownloader/geometrySize"_qs} , m_storeDialogSize {u"RssFeedDownloader/geometrySize"_qs}
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
, m_storeHSplitterSize {u"GUI/Qt6/RSSFeedDownloader/HSplitterSizes"_qs} , m_storeMainSplitterState {u"GUI/Qt6/RSSFeedDownloader/HSplitterSizes"_qs}
, m_storeRuleDefSplitterState {u"GUI/Qt6/RSSFeedDownloader/RuleDefSplitterState"_qs}
#else #else
, m_storeHSplitterSize {u"RssFeedDownloader/qt5/hsplitterSizes"_qs} , m_storeMainSplitterState {u"RssFeedDownloader/qt5/hsplitterSizes"_qs}
, m_storeRuleDefSplitterState {u"RssFeedDownloader/qt5/RuleDefSplitterState"_qs}
#endif #endif
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
m_ui->torrentParametersGroupBox->layout()->addWidget(m_addTorrentParamsWidget);
connect(m_ui->addRuleBtn, &QPushButton::clicked, this, &AutomatedRssDownloader::onAddRuleBtnClicked);
connect(m_ui->removeRuleBtn, &QPushButton::clicked, this, &AutomatedRssDownloader::onRemoveRuleBtnClicked);
connect(m_ui->exportBtn, &QPushButton::clicked, this, &AutomatedRssDownloader::onExportBtnClicked);
connect(m_ui->importBtn, &QPushButton::clicked, this, &AutomatedRssDownloader::onImportBtnClicked);
connect(m_ui->renameRuleBtn, &QPushButton::clicked, this, &AutomatedRssDownloader::onRenameRuleBtnClicked);
// Icons // Icons
m_ui->renameRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"edit-rename"_qs)); m_ui->renameRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"edit-rename"_qs));
m_ui->removeRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs)); m_ui->removeRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs));
m_ui->addRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs)); m_ui->addRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
m_ui->addCategoryBtn->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
// Ui Settings // Ui Settings
m_ui->listRules->setSortingEnabled(true); m_ui->ruleList->setSortingEnabled(true);
m_ui->listRules->setSelectionMode(QAbstractItemView::ExtendedSelection); m_ui->ruleList->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_ui->treeMatchingArticles->setSortingEnabled(true); m_ui->matchingArticlesTree->setSortingEnabled(true);
m_ui->treeMatchingArticles->sortByColumn(0, Qt::AscendingOrder); m_ui->matchingArticlesTree->sortByColumn(0, Qt::AscendingOrder);
m_ui->hsplitter->setCollapsible(0, false); m_ui->mainSplitter->setCollapsible(0, false);
m_ui->hsplitter->setCollapsible(1, false); m_ui->mainSplitter->setCollapsible(1, false);
m_ui->hsplitter->setCollapsible(2, true); // Only the preview list is collapsible m_ui->mainSplitter->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->checkRegex, &QAbstractButton::toggled, this, &AutomatedRssDownloader::updateFieldsToolTips);
connect(m_ui->listRules, &QWidget::customContextMenuRequested, this, &AutomatedRssDownloader::displayRulesListMenu); connect(m_ui->ruleList, &QWidget::customContextMenuRequested, this, &AutomatedRssDownloader::displayRulesListMenu);
m_episodeRegex = new QRegularExpression(u"^(^\\d{1,4}x(\\d{1,4}(-(\\d{1,4})?)?;){1,}){1,1}"_qs m_episodeRegex = new QRegularExpression(u"^(^\\d{1,4}x(\\d{1,4}(-(\\d{1,4})?)?;){1,}){1,1}"_qs
, QRegularExpression::CaseInsensitiveOption); , QRegularExpression::CaseInsensitiveOption);
@ -106,7 +114,6 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
+ u"<li>" + tr("Infinite range: <b>1x25-;</b> matches episodes 25 and upward of season one, and all episodes of later seasons") + u"</li>" + u"</ul></li></ul>"; + u"<li>" + tr("Infinite range: <b>1x25-;</b> matches episodes 25 and upward of season one, and all episodes of later seasons") + u"</li>" + u"</ul></li></ul>";
m_ui->lineEFilter->setToolTip(tip); m_ui->lineEFilter->setToolTip(tip);
initCategoryCombobox();
loadSettings(); loadSettings();
connect(RSS::AutoDownloader::instance(), &RSS::AutoDownloader::ruleAdded, this, &AutomatedRssDownloader::handleRuleAdded); connect(RSS::AutoDownloader::instance(), &RSS::AutoDownloader::ruleAdded, this, &AutomatedRssDownloader::handleRuleAdded);
@ -130,27 +137,28 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
connect(m_ui->listFeeds, &QListWidget::itemChanged, this, &AutomatedRssDownloader::handleFeedCheckStateChange); connect(m_ui->listFeeds, &QListWidget::itemChanged, this, &AutomatedRssDownloader::handleFeedCheckStateChange);
connect(m_ui->listRules, &QListWidget::itemSelectionChanged, this, &AutomatedRssDownloader::updateRuleDefinitionBox); connect(m_ui->ruleList, &QListWidget::itemSelectionChanged, this, &AutomatedRssDownloader::updateRuleDefinitionBox);
connect(m_ui->listRules, &QListWidget::itemChanged, this, &AutomatedRssDownloader::handleRuleCheckStateChange); connect(m_ui->ruleList, &QListWidget::itemChanged, this, &AutomatedRssDownloader::handleRuleCheckStateChange);
const auto *editHotkey = new QShortcut(Qt::Key_F2, m_ui->listRules, nullptr, nullptr, Qt::WidgetShortcut); const auto *editHotkey = new QShortcut(Qt::Key_F2, m_ui->ruleList, nullptr, nullptr, Qt::WidgetShortcut);
connect(editHotkey, &QShortcut::activated, this, &AutomatedRssDownloader::renameSelectedRule); connect(editHotkey, &QShortcut::activated, this, &AutomatedRssDownloader::renameSelectedRule);
const auto *deleteHotkey = new QShortcut(QKeySequence::Delete, m_ui->listRules, nullptr, nullptr, Qt::WidgetShortcut); const auto *deleteHotkey = new QShortcut(QKeySequence::Delete, m_ui->ruleList, nullptr, nullptr, Qt::WidgetShortcut);
connect(deleteHotkey, &QShortcut::activated, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked); connect(deleteHotkey, &QShortcut::activated, this, &AutomatedRssDownloader::onRemoveRuleBtnClicked);
connect(m_ui->listRules, &QAbstractItemView::doubleClicked, this, &AutomatedRssDownloader::renameSelectedRule); connect(m_ui->ruleList, &QAbstractItemView::doubleClicked, this, &AutomatedRssDownloader::renameSelectedRule);
loadFeedList(); loadFeedList();
m_ui->listRules->blockSignals(true); m_ui->ruleList->blockSignals(true);
for (const RSS::AutoDownloadRule &rule : asConst(RSS::AutoDownloader::instance()->rules())) for (const RSS::AutoDownloadRule &rule : asConst(RSS::AutoDownloader::instance()->rules()))
createRuleItem(rule); createRuleItem(rule);
m_ui->listRules->blockSignals(false); m_ui->ruleList->blockSignals(false);
updateRuleDefinitionBox(); updateRuleDefinitionBox();
if (RSS::AutoDownloader::instance()->isProcessingEnabled()) if (RSS::AutoDownloader::instance()->isProcessingEnabled())
m_ui->labelWarn->hide(); m_ui->labelWarn->hide();
connect(RSS::AutoDownloader::instance(), &RSS::AutoDownloader::processingStateChanged connect(RSS::AutoDownloader::instance(), &RSS::AutoDownloader::processingStateChanged
, this, &AutomatedRssDownloader::handleProcessingStateChanged); , this, &AutomatedRssDownloader::handleProcessingStateChanged);
} }
@ -170,19 +178,23 @@ void AutomatedRssDownloader::loadSettings()
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid()) if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
resize(dialogSize); resize(dialogSize);
if (const QByteArray hSplitterSize = m_storeHSplitterSize; !hSplitterSize.isEmpty()) if (const QByteArray mainSplitterSize = m_storeMainSplitterState; !mainSplitterSize.isEmpty())
m_ui->hsplitter->restoreState(hSplitterSize); m_ui->mainSplitter->restoreState(mainSplitterSize);
if (const QByteArray ruleDefSplitterSize = m_storeRuleDefSplitterState; !ruleDefSplitterSize.isEmpty())
m_ui->ruleDefSplitter->restoreState(ruleDefSplitterSize);
} }
void AutomatedRssDownloader::saveSettings() void AutomatedRssDownloader::saveSettings()
{ {
m_storeDialogSize = size(); m_storeDialogSize = size();
m_storeHSplitterSize = m_ui->hsplitter->saveState(); m_storeMainSplitterState = m_ui->mainSplitter->saveState();
m_storeRuleDefSplitterState = m_ui->ruleDefSplitter->saveState();
} }
void AutomatedRssDownloader::createRuleItem(const RSS::AutoDownloadRule &rule) void AutomatedRssDownloader::createRuleItem(const RSS::AutoDownloadRule &rule)
{ {
QListWidgetItem *item = new QListWidgetItem(rule.name(), m_ui->listRules); QListWidgetItem *item = new QListWidgetItem(rule.name(), m_ui->ruleList);
m_itemsByRuleName.insert(rule.name(), item); m_itemsByRuleName.insert(rule.name(), item);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable); item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(rule.isEnabled() ? Qt::Checked : Qt::Unchecked); item->setCheckState(rule.isEnabled() ? Qt::Checked : Qt::Unchecked);
@ -211,7 +223,7 @@ void AutomatedRssDownloader::updateFeedList()
if (m_currentRuleItem) if (m_currentRuleItem)
selection << m_currentRuleItem; selection << m_currentRuleItem;
else else
selection = m_ui->listRules->selectedItems(); selection = m_ui->ruleList->selectedItems();
bool enable = !selection.isEmpty(); bool enable = !selection.isEmpty();
@ -248,7 +260,7 @@ void AutomatedRssDownloader::updateFeedList()
void AutomatedRssDownloader::updateRuleDefinitionBox() void AutomatedRssDownloader::updateRuleDefinitionBox()
{ {
const QList<QListWidgetItem *> selection = m_ui->listRules->selectedItems(); const QList<QListWidgetItem *> selection = m_ui->ruleList->selectedItems();
QListWidgetItem *currentRuleItem = ((selection.count() == 1) ? selection.first() : nullptr); QListWidgetItem *currentRuleItem = ((selection.count() == 1) ? selection.first() : nullptr);
// Enable the edit rule button but only if we have 1 rule selected // Enable the edit rule button but only if we have 1 rule selected
@ -261,7 +273,7 @@ void AutomatedRssDownloader::updateRuleDefinitionBox()
{ {
saveEditedRule(); // Save previous rule first saveEditedRule(); // Save previous rule first
m_currentRuleItem = currentRuleItem; m_currentRuleItem = currentRuleItem;
//m_ui->listRules->setCurrentItem(m_currentRuleItem); //m_ui->ruleList->setCurrentItem(m_currentRuleItem);
} }
// Update rule definition box // Update rule definition box
@ -269,31 +281,20 @@ void AutomatedRssDownloader::updateRuleDefinitionBox()
{ {
m_currentRule = RSS::AutoDownloader::instance()->ruleByName(m_currentRuleItem->text()); m_currentRule = RSS::AutoDownloader::instance()->ruleByName(m_currentRuleItem->text());
m_addTorrentParamsWidget->setAddTorrentParams(m_currentRule.addTorrentParams());
m_ui->lineContains->setText(m_currentRule.mustContain()); m_ui->lineContains->setText(m_currentRule.mustContain());
m_ui->lineNotContains->setText(m_currentRule.mustNotContain()); m_ui->lineNotContains->setText(m_currentRule.mustNotContain());
if (!m_currentRule.episodeFilter().isEmpty()) if (!m_currentRule.episodeFilter().isEmpty())
m_ui->lineEFilter->setText(m_currentRule.episodeFilter()); m_ui->lineEFilter->setText(m_currentRule.episodeFilter());
else else
m_ui->lineEFilter->clear(); m_ui->lineEFilter->clear();
m_ui->checkBoxSaveDiffDir->setChecked(!m_currentRule.savePath().isEmpty());
m_ui->lineSavePath->setSelectedPath(m_currentRule.savePath());
m_ui->checkRegex->blockSignals(true); m_ui->checkRegex->blockSignals(true);
m_ui->checkRegex->setChecked(m_currentRule.useRegex()); m_ui->checkRegex->setChecked(m_currentRule.useRegex());
m_ui->checkRegex->blockSignals(false); m_ui->checkRegex->blockSignals(false);
m_ui->checkSmart->blockSignals(true); m_ui->checkSmart->blockSignals(true);
m_ui->checkSmart->setChecked(m_currentRule.useSmartFilter()); m_ui->checkSmart->setChecked(m_currentRule.useSmartFilter());
m_ui->checkSmart->blockSignals(false); m_ui->checkSmart->blockSignals(false);
m_ui->comboCategory->setCurrentIndex(m_ui->comboCategory->findText(m_currentRule.assignedCategory()));
if (m_currentRule.assignedCategory().isEmpty())
m_ui->comboCategory->clearEditText();
int index = 0;
if (m_currentRule.addPaused().has_value())
index = (*m_currentRule.addPaused() ? 1 : 2);
m_ui->comboAddPaused->setCurrentIndex(index);
index = 0;
if (m_currentRule.torrentContentLayout())
index = static_cast<int>(*m_currentRule.torrentContentLayout()) + 1;
m_ui->comboContentLayout->setCurrentIndex(index);
m_ui->spinIgnorePeriod->setValue(m_currentRule.ignoreDays()); m_ui->spinIgnorePeriod->setValue(m_currentRule.ignoreDays());
QDateTime dateTime = m_currentRule.lastMatch(); QDateTime dateTime = m_currentRule.lastMatch();
QString lMatch; QString lMatch;
@ -307,13 +308,13 @@ void AutomatedRssDownloader::updateRuleDefinitionBox()
updateEpisodeFilterValidity(); updateEpisodeFilterValidity();
updateFieldsToolTips(m_ui->checkRegex->isChecked()); updateFieldsToolTips(m_ui->checkRegex->isChecked());
m_ui->ruleDefBox->setEnabled(true); m_ui->ruleScrollArea->setEnabled(true);
} }
else else
{ {
m_currentRule = RSS::AutoDownloadRule(); m_currentRule = RSS::AutoDownloadRule();
clearRuleDefinitionBox(); clearRuleDefinitionBox();
m_ui->ruleDefBox->setEnabled(false); m_ui->ruleScrollArea->setEnabled(false);
} }
updateFeedList(); updateFeedList();
@ -322,38 +323,23 @@ void AutomatedRssDownloader::updateRuleDefinitionBox()
void AutomatedRssDownloader::clearRuleDefinitionBox() void AutomatedRssDownloader::clearRuleDefinitionBox()
{ {
m_addTorrentParamsWidget->setAddTorrentParams({});
m_ui->lineContains->clear(); m_ui->lineContains->clear();
m_ui->lineNotContains->clear(); m_ui->lineNotContains->clear();
m_ui->lineEFilter->clear(); m_ui->lineEFilter->clear();
m_ui->checkBoxSaveDiffDir->setChecked(false);
m_ui->lineSavePath->clear();
m_ui->comboCategory->clearEditText();
m_ui->comboCategory->setCurrentIndex(-1);
m_ui->checkRegex->setChecked(false); m_ui->checkRegex->setChecked(false);
m_ui->checkSmart->setChecked(false); m_ui->checkSmart->setChecked(false);
m_ui->spinIgnorePeriod->setValue(0); m_ui->spinIgnorePeriod->setValue(0);
m_ui->comboAddPaused->clearEditText();
m_ui->comboAddPaused->setCurrentIndex(-1);
m_ui->comboContentLayout->clearEditText();
m_ui->comboContentLayout->setCurrentIndex(-1);
updateFieldsToolTips(m_ui->checkRegex->isChecked()); updateFieldsToolTips(m_ui->checkRegex->isChecked());
updateMustLineValidity(); updateMustLineValidity();
updateMustNotLineValidity(); updateMustNotLineValidity();
updateEpisodeFilterValidity(); updateEpisodeFilterValidity();
} }
void AutomatedRssDownloader::initCategoryCombobox()
{
// Load torrent categories
QStringList categories = BitTorrent::Session::instance()->categories();
std::sort(categories.begin(), categories.end(), Utils::Compare::NaturalLessThan<Qt::CaseInsensitive>());
m_ui->comboCategory->addItem(u""_qs);
m_ui->comboCategory->addItems(categories);
}
void AutomatedRssDownloader::updateEditedRule() void AutomatedRssDownloader::updateEditedRule()
{ {
if (!m_currentRuleItem || !m_ui->ruleDefBox->isEnabled()) return; if (!m_currentRuleItem || !m_ui->ruleScrollArea->isEnabled())
return;
m_currentRule.setEnabled(m_currentRuleItem->checkState() != Qt::Unchecked); m_currentRule.setEnabled(m_currentRuleItem->checkState() != Qt::Unchecked);
m_currentRule.setUseRegex(m_ui->checkRegex->isChecked()); m_currentRule.setUseRegex(m_ui->checkRegex->isChecked());
@ -361,32 +347,20 @@ void AutomatedRssDownloader::updateEditedRule()
m_currentRule.setMustContain(m_ui->lineContains->text()); m_currentRule.setMustContain(m_ui->lineContains->text());
m_currentRule.setMustNotContain(m_ui->lineNotContains->text()); m_currentRule.setMustNotContain(m_ui->lineNotContains->text());
m_currentRule.setEpisodeFilter(m_ui->lineEFilter->text()); m_currentRule.setEpisodeFilter(m_ui->lineEFilter->text());
m_currentRule.setSavePath(m_ui->checkBoxSaveDiffDir->isChecked() ? m_ui->lineSavePath->selectedPath() : Path());
m_currentRule.setCategory(m_ui->comboCategory->currentText());
std::optional<bool> addPaused;
if (m_ui->comboAddPaused->currentIndex() == 1)
addPaused = true;
else if (m_ui->comboAddPaused->currentIndex() == 2)
addPaused = false;
m_currentRule.setAddPaused(addPaused);
std::optional<BitTorrent::TorrentContentLayout> contentLayout;
if (m_ui->comboContentLayout->currentIndex() > 0)
contentLayout = static_cast<BitTorrent::TorrentContentLayout>(m_ui->comboContentLayout->currentIndex() - 1);
m_currentRule.setTorrentContentLayout(contentLayout);
m_currentRule.setIgnoreDays(m_ui->spinIgnorePeriod->value()); m_currentRule.setIgnoreDays(m_ui->spinIgnorePeriod->value());
m_currentRule.setAddTorrentParams(m_addTorrentParamsWidget->addTorrentParams());
} }
void AutomatedRssDownloader::saveEditedRule() void AutomatedRssDownloader::saveEditedRule()
{ {
if (!m_currentRuleItem || !m_ui->ruleDefBox->isEnabled()) return; if (!m_currentRuleItem || !m_ui->ruleScrollArea->isEnabled()) return;
updateEditedRule(); updateEditedRule();
RSS::AutoDownloader::instance()->insertRule(m_currentRule); RSS::AutoDownloader::instance()->insertRule(m_currentRule);
} }
void AutomatedRssDownloader::on_addRuleBtn_clicked() void AutomatedRssDownloader::onAddRuleBtnClicked()
{ {
// saveEditedRule(); // saveEditedRule();
@ -406,9 +380,9 @@ void AutomatedRssDownloader::on_addRuleBtn_clicked()
RSS::AutoDownloader::instance()->insertRule(RSS::AutoDownloadRule(ruleName)); RSS::AutoDownloader::instance()->insertRule(RSS::AutoDownloadRule(ruleName));
} }
void AutomatedRssDownloader::on_removeRuleBtn_clicked() void AutomatedRssDownloader::onRemoveRuleBtnClicked()
{ {
const QList<QListWidgetItem *> selection = m_ui->listRules->selectedItems(); const QList<QListWidgetItem *> selection = m_ui->ruleList->selectedItems();
if (selection.isEmpty()) return; if (selection.isEmpty()) return;
// Ask for confirmation // Ask for confirmation
@ -423,23 +397,12 @@ void AutomatedRssDownloader::on_removeRuleBtn_clicked()
RSS::AutoDownloader::instance()->removeRule(item->text()); RSS::AutoDownloader::instance()->removeRule(item->text());
} }
void AutomatedRssDownloader::on_addCategoryBtn_clicked() void AutomatedRssDownloader::onRenameRuleBtnClicked()
{
const QString newCategoryName = TorrentCategoryDialog::createCategory(this);
if (!newCategoryName.isEmpty())
{
m_ui->comboCategory->addItem(newCategoryName);
m_ui->comboCategory->setCurrentText(newCategoryName);
}
}
void AutomatedRssDownloader::on_renameRuleBtn_clicked()
{ {
renameSelectedRule(); renameSelectedRule();
} }
void AutomatedRssDownloader::on_exportBtn_clicked() void AutomatedRssDownloader::onExportBtnClicked()
{ {
if (RSS::AutoDownloader::instance()->rules().isEmpty()) if (RSS::AutoDownloader::instance()->rules().isEmpty())
{ {
@ -482,7 +445,7 @@ void AutomatedRssDownloader::on_exportBtn_clicked()
} }
} }
void AutomatedRssDownloader::on_importBtn_clicked() void AutomatedRssDownloader::onImportBtnClicked()
{ {
QString selectedFilter {m_formatFilterJSON}; QString selectedFilter {m_formatFilterJSON};
const Path path {QFileDialog::getOpenFileName( const Path path {QFileDialog::getOpenFileName(
@ -525,16 +488,16 @@ void AutomatedRssDownloader::displayRulesListMenu()
menu->setAttribute(Qt::WA_DeleteOnClose); menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("Add new rule...") menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("Add new rule...")
, this, &AutomatedRssDownloader::on_addRuleBtn_clicked); , this, &AutomatedRssDownloader::onAddRuleBtnClicked);
const QList<QListWidgetItem *> selection = m_ui->listRules->selectedItems(); const QList<QListWidgetItem *> selection = m_ui->ruleList->selectedItems();
if (!selection.isEmpty()) if (!selection.isEmpty())
{ {
if (selection.count() == 1) if (selection.count() == 1)
{ {
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Delete rule") menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Delete rule")
, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked); , this, &AutomatedRssDownloader::onRemoveRuleBtnClicked);
menu->addSeparator(); menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Rename rule...") menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Rename rule...")
, this, &AutomatedRssDownloader::renameSelectedRule); , this, &AutomatedRssDownloader::renameSelectedRule);
@ -542,7 +505,7 @@ void AutomatedRssDownloader::displayRulesListMenu()
else else
{ {
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Delete selected rules") menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Delete selected rules")
, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked); , this, &AutomatedRssDownloader::onRemoveRuleBtnClicked);
} }
menu->addSeparator(); menu->addSeparator();
@ -555,7 +518,7 @@ void AutomatedRssDownloader::displayRulesListMenu()
void AutomatedRssDownloader::renameSelectedRule() void AutomatedRssDownloader::renameSelectedRule()
{ {
const QList<QListWidgetItem *> selection = m_ui->listRules->selectedItems(); const QList<QListWidgetItem *> selection = m_ui->ruleList->selectedItems();
if (selection.isEmpty()) return; if (selection.isEmpty()) return;
QListWidgetItem *item = selection.first(); QListWidgetItem *item = selection.first();
@ -583,7 +546,7 @@ void AutomatedRssDownloader::renameSelectedRule()
void AutomatedRssDownloader::handleRuleCheckStateChange(QListWidgetItem *ruleItem) void AutomatedRssDownloader::handleRuleCheckStateChange(QListWidgetItem *ruleItem)
{ {
m_ui->listRules->setCurrentItem(ruleItem); m_ui->ruleList->setCurrentItem(ruleItem);
} }
void AutomatedRssDownloader::clearSelectedRuleDownloadedEpisodeList() void AutomatedRssDownloader::clearSelectedRuleDownloadedEpisodeList()
@ -604,7 +567,7 @@ void AutomatedRssDownloader::clearSelectedRuleDownloadedEpisodeList()
void AutomatedRssDownloader::handleFeedCheckStateChange(QListWidgetItem *feedItem) void AutomatedRssDownloader::handleFeedCheckStateChange(QListWidgetItem *feedItem)
{ {
const QString feedURL = feedItem->data(Qt::UserRole).toString(); const QString feedURL = feedItem->data(Qt::UserRole).toString();
for (QListWidgetItem *ruleItem : asConst(m_ui->listRules->selectedItems())) for (QListWidgetItem *ruleItem : asConst(m_ui->ruleList->selectedItems()))
{ {
RSS::AutoDownloadRule rule = (ruleItem == m_currentRuleItem RSS::AutoDownloadRule rule = (ruleItem == m_currentRuleItem
? m_currentRule ? m_currentRule
@ -627,9 +590,9 @@ void AutomatedRssDownloader::handleFeedCheckStateChange(QListWidgetItem *feedIte
void AutomatedRssDownloader::updateMatchingArticles() void AutomatedRssDownloader::updateMatchingArticles()
{ {
m_ui->treeMatchingArticles->clear(); m_ui->matchingArticlesTree->clear();
for (const QListWidgetItem *ruleItem : asConst(m_ui->listRules->selectedItems())) for (const QListWidgetItem *ruleItem : asConst(m_ui->ruleList->selectedItems()))
{ {
RSS::AutoDownloadRule rule = (ruleItem == m_currentRuleItem RSS::AutoDownloadRule rule = (ruleItem == m_currentRuleItem
? m_currentRule ? m_currentRule
@ -654,13 +617,13 @@ void AutomatedRssDownloader::updateMatchingArticles()
void AutomatedRssDownloader::addFeedArticlesToTree(RSS::Feed *feed, const QStringList &articles) void AutomatedRssDownloader::addFeedArticlesToTree(RSS::Feed *feed, const QStringList &articles)
{ {
// Turn off sorting while inserting // Turn off sorting while inserting
m_ui->treeMatchingArticles->setSortingEnabled(false); m_ui->matchingArticlesTree->setSortingEnabled(false);
// Check if this feed is already in the tree // Check if this feed is already in the tree
QTreeWidgetItem *treeFeedItem = nullptr; QTreeWidgetItem *treeFeedItem = nullptr;
for (int i = 0; i < m_ui->treeMatchingArticles->topLevelItemCount(); ++i) for (int i = 0; i < m_ui->matchingArticlesTree->topLevelItemCount(); ++i)
{ {
QTreeWidgetItem *item = m_ui->treeMatchingArticles->topLevelItem(i); QTreeWidgetItem *item = m_ui->matchingArticlesTree->topLevelItem(i);
if (item->data(0, Qt::UserRole).toString() == feed->url()) if (item->data(0, Qt::UserRole).toString() == feed->url())
{ {
treeFeedItem = item; treeFeedItem = item;
@ -678,7 +641,7 @@ void AutomatedRssDownloader::addFeedArticlesToTree(RSS::Feed *feed, const QStrin
treeFeedItem->setFont(0, f); treeFeedItem->setFont(0, f);
treeFeedItem->setData(0, Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"directory"_qs)); treeFeedItem->setData(0, Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"directory"_qs));
treeFeedItem->setData(0, Qt::UserRole, feed->url()); treeFeedItem->setData(0, Qt::UserRole, feed->url());
m_ui->treeMatchingArticles->addTopLevelItem(treeFeedItem); m_ui->matchingArticlesTree->addTopLevelItem(treeFeedItem);
} }
// Insert the articles // Insert the articles
@ -695,9 +658,9 @@ void AutomatedRssDownloader::addFeedArticlesToTree(RSS::Feed *feed, const QStrin
} }
} }
m_ui->treeMatchingArticles->expandItem(treeFeedItem); m_ui->matchingArticlesTree->expandItem(treeFeedItem);
m_ui->treeMatchingArticles->sortItems(0, Qt::AscendingOrder); m_ui->matchingArticlesTree->sortItems(0, Qt::AscendingOrder);
m_ui->treeMatchingArticles->setSortingEnabled(true); m_ui->matchingArticlesTree->setSortingEnabled(true);
} }
void AutomatedRssDownloader::updateFieldsToolTips(bool regex) void AutomatedRssDownloader::updateFieldsToolTips(bool regex)

View file

@ -1,6 +1,6 @@
/* /*
* Bittorrent Client using Qt and libtorrent. * Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2017 Vladimir Golovnev <glassez@yandex.ru> * Copyright (C) 2017, 2023 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2010 Christophe Dumez <chris@qbittorrent.org> * Copyright (C) 2010 Christophe Dumez <chris@qbittorrent.org>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -51,6 +51,8 @@ namespace Ui
class AutomatedRssDownloader; class AutomatedRssDownloader;
} }
class AddTorrentParamsWidget;
class AutomatedRssDownloader : public QDialog class AutomatedRssDownloader : public QDialog
{ {
Q_OBJECT Q_OBJECT
@ -61,13 +63,11 @@ public:
~AutomatedRssDownloader() override; ~AutomatedRssDownloader() override;
private slots: private slots:
void on_addRuleBtn_clicked(); void onAddRuleBtnClicked();
void on_removeRuleBtn_clicked(); void onRemoveRuleBtnClicked();
void on_addCategoryBtn_clicked(); void onExportBtnClicked();
void on_exportBtn_clicked(); void onImportBtnClicked();
void on_importBtn_clicked(); void onRenameRuleBtnClicked();
void on_renameRuleBtn_clicked();
void handleRuleCheckStateChange(QListWidgetItem *ruleItem); void handleRuleCheckStateChange(QListWidgetItem *ruleItem);
void handleFeedCheckStateChange(QListWidgetItem *feedItem); void handleFeedCheckStateChange(QListWidgetItem *feedItem);
void displayRulesListMenu(); void displayRulesListMenu();
@ -90,7 +90,6 @@ private:
void loadSettings(); void loadSettings();
void saveSettings(); void saveSettings();
void createRuleItem(const RSS::AutoDownloadRule &rule); void createRuleItem(const RSS::AutoDownloadRule &rule);
void initCategoryCombobox();
void clearRuleDefinitionBox(); void clearRuleDefinitionBox();
void updateEditedRule(); void updateEditedRule();
void updateMatchingArticles(); void updateMatchingArticles();
@ -103,6 +102,7 @@ private:
const QString m_formatFilterLegacy; const QString m_formatFilterLegacy;
Ui::AutomatedRssDownloader *m_ui = nullptr; Ui::AutomatedRssDownloader *m_ui = nullptr;
AddTorrentParamsWidget *m_addTorrentParamsWidget = nullptr;
QListWidgetItem *m_currentRuleItem = nullptr; QListWidgetItem *m_currentRuleItem = nullptr;
QSet<std::pair<QString, QString>> m_treeListEntries; QSet<std::pair<QString, QString>> m_treeListEntries;
RSS::AutoDownloadRule m_currentRule; RSS::AutoDownloadRule m_currentRule;
@ -110,5 +110,6 @@ private:
QRegularExpression *m_episodeRegex = nullptr; QRegularExpression *m_episodeRegex = nullptr;
SettingValue<QSize> m_storeDialogSize; SettingValue<QSize> m_storeDialogSize;
SettingValue<QByteArray> m_storeHSplitterSize; SettingValue<QByteArray> m_storeMainSplitterState;
SettingValue<QByteArray> m_storeRuleDefSplitterState;
}; };

View file

@ -7,13 +7,13 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>818</width> <width>818</width>
<height>571</height> <height>588</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>RSS Downloader</string> <string>RSS Downloader</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
<widget class="QLabel" name="labelWarn"> <widget class="QLabel" name="labelWarn">
<property name="font"> <property name="font">
@ -33,7 +33,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QSplitter" name="hsplitter"> <widget class="QSplitter" name="mainSplitter">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -43,15 +43,14 @@
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<widget class="QWidget" name="layoutWidget"> <widget class="QWidget" name="ruleListLayoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="ruleListLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="ruleListHeaderLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="ruleListLabel">
<property name="font"> <property name="font">
<font> <font>
<weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
@ -99,7 +98,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QListWidget" name="listRules"> <widget class="QListWidget" name="ruleList">
<property name="contextMenuPolicy"> <property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum> <enum>Qt::CustomContextMenu</enum>
</property> </property>
@ -107,14 +106,39 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="layoutWidget1"> <widget class="QSplitter" name="ruleDefSplitter">
<layout class="QVBoxLayout" name="verticalLayout_4"> <property name="orientation">
<item> <enum>Qt::Vertical</enum>
<widget class="QGroupBox" name="ruleDefBox">
<property name="title">
<string>Rule Definition</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_6"> <widget class="QScrollArea" name="ruleScrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>329</width>
<height>243</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8" stretch="0,0,0,0,0,0,1">
<item> <item>
<widget class="QCheckBox" name="checkRegex"> <widget class="QCheckBox" name="checkRegex">
<property name="text"> <property name="text">
@ -125,14 +149,14 @@
<item> <item>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="labelMustContain">
<property name="text"> <property name="text">
<string>Must Contain:</string> <string>Must Contain:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="labelMustNotContain">
<property name="text"> <property name="text">
<string>Must Not Contain:</string> <string>Must Not Contain:</string>
</property> </property>
@ -208,65 +232,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
</widget> </widget>
</item> </item>
<item> <item>
<widget class="Line" name="line"> <layout class="QHBoxLayout" name="ignorePeriodLayout">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Category:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboCategory">
<property name="editable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="addCategoryBtn"/>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxSaveDiffDir">
<property name="text">
<string>Save to a Different Directory</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_6">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Save to:</string>
</property>
</widget>
</item>
<item>
<widget class="FileSystemPathLineEdit" name="lineSavePath" native="true"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item> <item>
<widget class="QLabel" name="lblIgnoreDays"> <widget class="QLabel" name="lblIgnoreDays">
<property name="text"> <property name="text">
@ -306,92 +272,54 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_9"> <widget class="QGroupBox" name="torrentParametersGroupBox">
<item> <property name="title">
<widget class="QLabel" name="lblAddPaused"> <string>Torrent parameters</string>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="text"> <property name="flat">
<string>Add Paused:</string> <bool>true</bool>
</property> </property>
</widget> <layout class="QVBoxLayout" name="verticalLayout_7">
</item> <property name="leftMargin">
<item> <number>0</number>
<widget class="QComboBox" name="comboAddPaused">
<item>
<property name="text">
<string>Use global settings</string>
</property> </property>
</item> <property name="topMargin">
<item> <number>0</number>
<property name="text">
<string>Always</string>
</property> </property>
</item> <property name="rightMargin">
<item> <number>0</number>
<property name="text">
<string>Never</string>
</property> </property>
</item> <property name="bottomMargin">
</widget> <number>0</number>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLabel" name="lblContentLayout">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="text">
<string>Torrent content layout:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboContentLayout">
<item>
<property name="text">
<string>Use global settings</string>
</property>
</item>
<item>
<property name="text">
<string>Original</string>
</property>
</item>
<item>
<property name="text">
<string>Create subfolder</string>
</property>
</item>
<item>
<property name="text">
<string>Don't create subfolder</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item> <item>
<widget class="QLabel" name="lblListFeeds"> <widget class="QLabel" name="lblListFeeds">
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
@ -404,16 +332,14 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
<widget class="QListWidget" name="listFeeds"/> <widget class="QListWidget" name="listFeeds"/>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
<widget class="QWidget" name="layoutWidget2"> </widget>
<layout class="QVBoxLayout" name="verticalLayout_2"> <widget class="QWidget" name="matchingArticlesLayoutWidget">
<layout class="QVBoxLayout" name="matchingArticlesLayout">
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="matchingArticlesLabel">
<property name="font"> <property name="font">
<font> <font>
<weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
@ -423,7 +349,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTreeWidget" name="treeMatchingArticles"> <widget class="QTreeWidget" name="matchingArticlesTree">
<attribute name="headerVisible"> <attribute name="headerVisible">
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
@ -439,7 +365,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="buttonsLayout">
<item> <item>
<widget class="QPushButton" name="importBtn"> <widget class="QPushButton" name="importBtn">
<property name="enabled"> <property name="enabled">
@ -474,31 +400,17 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>FileSystemPathLineEdit</class>
<extends>QWidget</extends>
<header>gui/fspathedit.h</header>
</customwidget>
</customwidgets>
<tabstops> <tabstops>
<tabstop>renameRuleBtn</tabstop> <tabstop>renameRuleBtn</tabstop>
<tabstop>removeRuleBtn</tabstop> <tabstop>removeRuleBtn</tabstop>
<tabstop>addRuleBtn</tabstop> <tabstop>addRuleBtn</tabstop>
<tabstop>listRules</tabstop> <tabstop>ruleList</tabstop>
<tabstop>checkRegex</tabstop>
<tabstop>checkSmart</tabstop>
<tabstop>lineContains</tabstop> <tabstop>lineContains</tabstop>
<tabstop>lineNotContains</tabstop> <tabstop>lineNotContains</tabstop>
<tabstop>lineEFilter</tabstop> <tabstop>lineEFilter</tabstop>
<tabstop>comboCategory</tabstop>
<tabstop>checkBoxSaveDiffDir</tabstop>
<tabstop>lineSavePath</tabstop>
<tabstop>spinIgnorePeriod</tabstop> <tabstop>spinIgnorePeriod</tabstop>
<tabstop>comboAddPaused</tabstop>
<tabstop>comboContentLayout</tabstop>
<tabstop>listFeeds</tabstop> <tabstop>listFeeds</tabstop>
<tabstop>treeMatchingArticles</tabstop> <tabstop>matchingArticlesTree</tabstop>
<tabstop>importBtn</tabstop> <tabstop>importBtn</tabstop>
<tabstop>exportBtn</tabstop> <tabstop>exportBtn</tabstop>
</tabstops> </tabstops>
@ -536,37 +448,5 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>checkBoxSaveDiffDir</sender>
<signal>toggled(bool)</signal>
<receiver>label_6</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>304</x>
<y>171</y>
</hint>
<hint type="destinationlabel">
<x>377</x>
<y>205</y>
</hint>
</hints>
</connection>
<connection>
<sender>checkBoxSaveDiffDir</sender>
<signal>toggled(bool)</signal>
<receiver>lineSavePath</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>474</x>
<y>174</y>
</hint>
<hint type="destinationlabel">
<x>476</x>
<y>204</y>
</hint>
</hints>
</connection>
</connections> </connections>
</ui> </ui>