Browse Source

Added tool tips on RSS fields

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
44011c9cd9
  1. 36
      src/rss/automatedrssdownloader.cpp
  2. 1
      src/rss/automatedrssdownloader.h

36
src/rss/automatedrssdownloader.cpp

@ -62,18 +62,26 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent) :
ui->hsplitter->setCollapsible(0, false); ui->hsplitter->setCollapsible(0, false);
ui->hsplitter->setCollapsible(1, false); ui->hsplitter->setCollapsible(1, false);
ui->hsplitter->setCollapsible(2, true); // Only the preview list is collapsible ui->hsplitter->setCollapsible(2, true); // Only the preview list is collapsible
bool ok; Q_UNUSED(ok);
connect(ui->listRules, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayRulesListMenu(const QPoint&))); ok = connect(ui->checkRegex, SIGNAL(toggled(bool)), SLOT(updateFieldsToolTips(bool)));
Q_ASSERT(ok);
ok = connect(ui->listRules, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayRulesListMenu(const QPoint&)));
Q_ASSERT(ok);
m_ruleList = RssDownloadRuleList::instance(); m_ruleList = RssDownloadRuleList::instance();
initLabelCombobox(); initLabelCombobox();
loadFeedList(); loadFeedList();
loadSettings(); loadSettings();
connect(ui->listRules, SIGNAL(itemSelectionChanged()), SLOT(updateRuleDefinitionBox())); ok = connect(ui->listRules, SIGNAL(itemSelectionChanged()), SLOT(updateRuleDefinitionBox()));
connect(ui->listRules, SIGNAL(itemSelectionChanged()), SLOT(updateFeedList())); Q_ASSERT(ok);
connect(ui->listFeeds, SIGNAL(itemChanged(QListWidgetItem*)), SLOT(handleFeedCheckStateChange(QListWidgetItem*))); ok = connect(ui->listRules, SIGNAL(itemSelectionChanged()), SLOT(updateFeedList()));
Q_ASSERT(ok);
ok = connect(ui->listFeeds, SIGNAL(itemChanged(QListWidgetItem*)), SLOT(handleFeedCheckStateChange(QListWidgetItem*)));
Q_ASSERT(ok);
// Update matching articles when necessary // Update matching articles when necessary
connect(ui->lineContains, SIGNAL(textEdited(QString)), SLOT(updateMatchingArticles())); ok = connect(ui->lineContains, SIGNAL(textEdited(QString)), SLOT(updateMatchingArticles()));
connect(ui->lineNotContains, SIGNAL(textEdited(QString)), SLOT(updateMatchingArticles())); Q_ASSERT(ok);
ok = connect(ui->lineNotContains, SIGNAL(textEdited(QString)), SLOT(updateMatchingArticles()));
Q_ASSERT(ok);
updateRuleDefinitionBox(); updateRuleDefinitionBox();
updateFeedList(); updateFeedList();
} }
@ -209,6 +217,7 @@ void AutomatedRssDownloader::updateRuleDefinitionBox()
clearRuleDefinitionBox(); clearRuleDefinitionBox();
ui->lineContains->setText(selection.first()->text()); ui->lineContains->setText(selection.first()->text());
} }
updateFieldsToolTips(ui->checkRegex->isChecked());
// Enable // Enable
ui->ruleDefBox->setEnabled(true); ui->ruleDefBox->setEnabled(true);
} else { } else {
@ -227,6 +236,7 @@ void AutomatedRssDownloader::clearRuleDefinitionBox()
ui->lineSavePath->clear(); ui->lineSavePath->clear();
ui->comboLabel->clearEditText(); ui->comboLabel->clearEditText();
ui->checkRegex->setChecked(false); ui->checkRegex->setChecked(false);
updateFieldsToolTips(ui->checkRegex->isChecked());
} }
RssDownloadRule AutomatedRssDownloader::getCurrentRule() const RssDownloadRule AutomatedRssDownloader::getCurrentRule() const
@ -496,4 +506,16 @@ void AutomatedRssDownloader::addFeedArticlesToTree(const RssFeed *feed, const QS
ui->treeMatchingArticles->expandItem(treeFeedItem); ui->treeMatchingArticles->expandItem(treeFeedItem);
} }
void AutomatedRssDownloader::updateFieldsToolTips(bool regex)
{
QString tip;
if(regex) {
tip = tr("Regex mode: use Perl-like regular expressions");
} else {
tip = tr("Wildcard mode: you can use:\n ? to match any single character.\n * to match zero or more of any characters.\n Whitespaces count as AND operators.");
}
ui->lineContains->setToolTip(tip);
ui->lineNotContains->setToolTip(tip);
}

1
src/rss/automatedrssdownloader.h

@ -75,6 +75,7 @@ private slots:
void on_importBtn_clicked(); void on_importBtn_clicked();
void renameSelectedRule(); void renameSelectedRule();
void updateMatchingArticles(); void updateMatchingArticles();
void updateFieldsToolTips(bool regex);
private: private:
RssDownloadRule getCurrentRule() const; RssDownloadRule getCurrentRule() const;

Loading…
Cancel
Save