|
|
@ -68,6 +68,11 @@ AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer<RssManager>& m |
|
|
|
Q_ASSERT(ok); |
|
|
|
Q_ASSERT(ok); |
|
|
|
m_ruleList = manager.toStrongRef()->downloadRules(); |
|
|
|
m_ruleList = manager.toStrongRef()->downloadRules(); |
|
|
|
m_editableRuleList = new RssDownloadRuleList; // Read rule list from disk
|
|
|
|
m_editableRuleList = new RssDownloadRuleList; // Read rule list from disk
|
|
|
|
|
|
|
|
m_episodeValidator = new QRegExpValidator( |
|
|
|
|
|
|
|
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), |
|
|
|
|
|
|
|
ui->lineEFilter); |
|
|
|
|
|
|
|
ui->lineEFilter->setValidator(m_episodeValidator); |
|
|
|
initLabelCombobox(); |
|
|
|
initLabelCombobox(); |
|
|
|
loadFeedList(); |
|
|
|
loadFeedList(); |
|
|
|
loadSettings(); |
|
|
|
loadSettings(); |
|
|
@ -94,6 +99,8 @@ AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer<RssManager>& m |
|
|
|
Q_ASSERT(ok); |
|
|
|
Q_ASSERT(ok); |
|
|
|
ok = connect(this, SIGNAL(finished(int)), SLOT(on_finished(int))); |
|
|
|
ok = connect(this, SIGNAL(finished(int)), SLOT(on_finished(int))); |
|
|
|
Q_ASSERT(ok); |
|
|
|
Q_ASSERT(ok); |
|
|
|
|
|
|
|
ok = connect(ui->lineEFilter, SIGNAL(textEdited(QString)), SLOT(updateMatchingArticles())); |
|
|
|
|
|
|
|
Q_ASSERT(ok); |
|
|
|
editHotkey = new QShortcut(QKeySequence("F2"), ui->listRules, 0, 0, Qt::WidgetShortcut); |
|
|
|
editHotkey = new QShortcut(QKeySequence("F2"), ui->listRules, 0, 0, Qt::WidgetShortcut); |
|
|
|
ok = connect(editHotkey, SIGNAL(activated()), SLOT(renameSelectedRule())); |
|
|
|
ok = connect(editHotkey, SIGNAL(activated()), SLOT(renameSelectedRule())); |
|
|
|
Q_ASSERT(ok); |
|
|
|
Q_ASSERT(ok); |
|
|
@ -113,6 +120,7 @@ AutomatedRssDownloader::~AutomatedRssDownloader() |
|
|
|
delete deleteHotkey; |
|
|
|
delete deleteHotkey; |
|
|
|
delete ui; |
|
|
|
delete ui; |
|
|
|
delete m_editableRuleList; |
|
|
|
delete m_editableRuleList; |
|
|
|
|
|
|
|
delete m_episodeValidator; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AutomatedRssDownloader::loadSettings() |
|
|
|
void AutomatedRssDownloader::loadSettings() |
|
|
@ -223,6 +231,11 @@ void AutomatedRssDownloader::updateRuleDefinitionBox() |
|
|
|
if (rule) { |
|
|
|
if (rule) { |
|
|
|
ui->lineContains->setText(rule->mustContain()); |
|
|
|
ui->lineContains->setText(rule->mustContain()); |
|
|
|
ui->lineNotContains->setText(rule->mustNotContain()); |
|
|
|
ui->lineNotContains->setText(rule->mustNotContain()); |
|
|
|
|
|
|
|
QString ep = rule->episodeFilter(); |
|
|
|
|
|
|
|
if (!ep.isEmpty()) |
|
|
|
|
|
|
|
ui->lineEFilter->setText(ep); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
ui->lineEFilter->clear(); |
|
|
|
ui->saveDiffDir_check->setChecked(!rule->savePath().isEmpty()); |
|
|
|
ui->saveDiffDir_check->setChecked(!rule->savePath().isEmpty()); |
|
|
|
ui->lineSavePath->setText(fsutils::toNativePath(rule->savePath())); |
|
|
|
ui->lineSavePath->setText(fsutils::toNativePath(rule->savePath())); |
|
|
|
ui->checkRegex->setChecked(rule->useRegex()); |
|
|
|
ui->checkRegex->setChecked(rule->useRegex()); |
|
|
@ -301,6 +314,7 @@ void AutomatedRssDownloader::saveEditedRule() |
|
|
|
rule->setUseRegex(ui->checkRegex->isChecked()); |
|
|
|
rule->setUseRegex(ui->checkRegex->isChecked()); |
|
|
|
rule->setMustContain(ui->lineContains->text()); |
|
|
|
rule->setMustContain(ui->lineContains->text()); |
|
|
|
rule->setMustNotContain(ui->lineNotContains->text()); |
|
|
|
rule->setMustNotContain(ui->lineNotContains->text()); |
|
|
|
|
|
|
|
rule->setEpisodeFilter(ui->lineEFilter->text()); |
|
|
|
if (ui->saveDiffDir_check->isChecked()) |
|
|
|
if (ui->saveDiffDir_check->isChecked()) |
|
|
|
rule->setSavePath(ui->lineSavePath->text()); |
|
|
|
rule->setSavePath(ui->lineSavePath->text()); |
|
|
|
else |
|
|
|
else |
|
|
|