mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 13:04:23 +00:00
Merge pull request #6179 from magao/issue6165
RSS use red text to indicate invalid filter. Closes #6165.
This commit is contained in:
commit
769fe17a21
@ -73,8 +73,6 @@ AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer<Rss::Manager>
|
||||
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}",
|
||||
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: ")
|
||||
+ "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>"
|
||||
@ -105,6 +103,8 @@ AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer<Rss::Manager>
|
||||
Q_ASSERT(ok);
|
||||
ok = connect(ui->lineNotContains, SIGNAL(textEdited(QString)), SLOT(updateMustNotLineValidity()));
|
||||
Q_ASSERT(ok);
|
||||
ok = connect(ui->lineEFilter, SIGNAL(textEdited(QString)), SLOT(updateEpisodeFilterValidity()));
|
||||
Q_ASSERT(ok);
|
||||
ok = connect(ui->checkRegex, SIGNAL(stateChanged(int)), SLOT(updateMatchingArticles()));
|
||||
Q_ASSERT(ok);
|
||||
ok = connect(ui->checkRegex, SIGNAL(stateChanged(int)), SLOT(updateMustLineValidity()));
|
||||
@ -134,7 +134,6 @@ AutomatedRssDownloader::~AutomatedRssDownloader()
|
||||
delete deleteHotkey;
|
||||
delete ui;
|
||||
delete m_editableRuleList;
|
||||
delete m_episodeValidator;
|
||||
delete m_episodeRegex;
|
||||
}
|
||||
|
||||
@ -657,6 +656,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)
|
||||
{
|
||||
Q_UNUSED(result);
|
||||
|
@ -87,6 +87,7 @@ private slots:
|
||||
void updateFieldsToolTips(bool regex);
|
||||
void updateMustLineValidity();
|
||||
void updateMustNotLineValidity();
|
||||
void updateEpisodeFilterValidity();
|
||||
void onFinished(int result);
|
||||
|
||||
private:
|
||||
@ -101,7 +102,6 @@ private:
|
||||
Rss::DownloadRuleList *m_ruleList;
|
||||
Rss::DownloadRuleList *m_editableRuleList;
|
||||
QRegExp *m_episodeRegex;
|
||||
QRegExpValidator *m_episodeValidator;
|
||||
QShortcut *editHotkey;
|
||||
QShortcut *deleteHotkey;
|
||||
};
|
||||
|
@ -151,6 +151,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<widget class="QLineEdit" name="lineNotContains"/>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user