mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-16 05:01:37 +03:00
RSS use red text to indicate invalid filter. Closes #6165.
--HG-- branch : magao-dev
This commit is contained in:
parent
2244b7cb66
commit
935b30b17a
3 changed files with 27 additions and 4 deletions
|
@ -73,8 +73,6 @@ AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer<Rss::Manager>
|
||||||
m_editableRuleList = new Rss::DownloadRuleList; // Read rule list from disk
|
m_editableRuleList = new Rss::DownloadRuleList; // Read rule list from disk
|
||||||
m_episodeRegex = new QRegExp("^(^[1-9]{1,1}\\d{0,3}x([1-9]{1,1}\\d{0,3}(-([1-9]{1,1}\\d{0,3})?)?;){1,}){1,1}",
|
m_episodeRegex = new QRegExp("^(^[1-9]{1,1}\\d{0,3}x([1-9]{1,1}\\d{0,3}(-([1-9]{1,1}\\d{0,3})?)?;){1,}){1,1}",
|
||||||
Qt::CaseInsensitive);
|
Qt::CaseInsensitive);
|
||||||
m_episodeValidator = new QRegExpValidator(*m_episodeRegex, ui->lineEFilter);
|
|
||||||
ui->lineEFilter->setValidator(m_episodeValidator);
|
|
||||||
QString tip = "<p>" + tr("Matches articles based on episode filter.") + "</p><p><b>" + tr("Example: ")
|
QString tip = "<p>" + tr("Matches articles based on episode filter.") + "</p><p><b>" + tr("Example: ")
|
||||||
+ "1x2;8-15;5;30-;</b>" + tr(" will match 2, 5, 8 through 15, 30 and onward episodes of season one", "example X will match") + "</p>";
|
+ "1x2;8-15;5;30-;</b>" + tr(" will match 2, 5, 8 through 15, 30 and onward episodes of season one", "example X will match") + "</p>";
|
||||||
tip += "<p>" + tr("Episode filter rules: ") + "</p><ul><li>" + tr("Season number is a mandatory non-zero value") + "</li>"
|
tip += "<p>" + tr("Episode filter rules: ") + "</p><ul><li>" + tr("Season number is a mandatory non-zero value") + "</li>"
|
||||||
|
@ -103,6 +101,8 @@ AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer<Rss::Manager>
|
||||||
Q_ASSERT(ok);
|
Q_ASSERT(ok);
|
||||||
ok = connect(ui->lineNotContains, SIGNAL(textEdited(QString)), SLOT(updateMustNotLineValidity()));
|
ok = connect(ui->lineNotContains, SIGNAL(textEdited(QString)), SLOT(updateMustNotLineValidity()));
|
||||||
Q_ASSERT(ok);
|
Q_ASSERT(ok);
|
||||||
|
ok = connect(ui->lineEFilter, SIGNAL(textEdited(QString)), SLOT(updateEpisodeFilterValidity()));
|
||||||
|
Q_ASSERT(ok);
|
||||||
ok = connect(ui->checkRegex, SIGNAL(stateChanged(int)), SLOT(updateMatchingArticles()));
|
ok = connect(ui->checkRegex, SIGNAL(stateChanged(int)), SLOT(updateMatchingArticles()));
|
||||||
Q_ASSERT(ok);
|
Q_ASSERT(ok);
|
||||||
ok = connect(ui->checkRegex, SIGNAL(stateChanged(int)), SLOT(updateMustLineValidity()));
|
ok = connect(ui->checkRegex, SIGNAL(stateChanged(int)), SLOT(updateMustLineValidity()));
|
||||||
|
@ -132,7 +132,6 @@ AutomatedRssDownloader::~AutomatedRssDownloader()
|
||||||
delete deleteHotkey;
|
delete deleteHotkey;
|
||||||
delete ui;
|
delete ui;
|
||||||
delete m_editableRuleList;
|
delete m_editableRuleList;
|
||||||
delete m_episodeValidator;
|
|
||||||
delete m_episodeRegex;
|
delete m_episodeRegex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,6 +641,20 @@ void AutomatedRssDownloader::updateMustNotLineValidity()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AutomatedRssDownloader::updateEpisodeFilterValidity()
|
||||||
|
{
|
||||||
|
const QString text = ui->lineEFilter->text();
|
||||||
|
bool valid = m_episodeRegex->indexIn(text) != -1;
|
||||||
|
if (valid) {
|
||||||
|
ui->lineEFilter->setStyleSheet("");
|
||||||
|
ui->lbl_epfilter_stat->setPixmap(QPixmap());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->lineEFilter->setStyleSheet("QLineEdit { color: #ff0000; }");
|
||||||
|
ui->lbl_epfilter_stat->setPixmap(GuiIconProvider::instance()->getIcon("task-attention").pixmap(16, 16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AutomatedRssDownloader::onFinished(int result)
|
void AutomatedRssDownloader::onFinished(int result)
|
||||||
{
|
{
|
||||||
Q_UNUSED(result);
|
Q_UNUSED(result);
|
||||||
|
|
|
@ -86,6 +86,7 @@ private slots:
|
||||||
void updateFieldsToolTips(bool regex);
|
void updateFieldsToolTips(bool regex);
|
||||||
void updateMustLineValidity();
|
void updateMustLineValidity();
|
||||||
void updateMustNotLineValidity();
|
void updateMustNotLineValidity();
|
||||||
|
void updateEpisodeFilterValidity();
|
||||||
void onFinished(int result);
|
void onFinished(int result);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -100,7 +101,6 @@ private:
|
||||||
Rss::DownloadRuleList *m_ruleList;
|
Rss::DownloadRuleList *m_ruleList;
|
||||||
Rss::DownloadRuleList *m_editableRuleList;
|
Rss::DownloadRuleList *m_editableRuleList;
|
||||||
QRegExp *m_episodeRegex;
|
QRegExp *m_episodeRegex;
|
||||||
QRegExpValidator *m_episodeValidator;
|
|
||||||
QShortcut *editHotkey;
|
QShortcut *editHotkey;
|
||||||
QShortcut *deleteHotkey;
|
QShortcut *deleteHotkey;
|
||||||
};
|
};
|
||||||
|
|
|
@ -151,6 +151,16 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QLabel" name="lbl_epfilter_stat">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>18</width>
|
||||||
|
<height>18</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QLineEdit" name="lineNotContains"/>
|
<widget class="QLineEdit" name="lineNotContains"/>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in a new issue