-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RSS defer matching articles for rules until idle. Closes #6166. #6177
Conversation
Rebased on top of #6212 and uncrustified. |
// Set the loading icon and allow it to be displayed | ||
ui->treeMatchingLoading->setPixmap(QIcon(":/icons/loading.png").pixmap(16, 16)); | ||
m_updateMatchingArticlesDeferrals.ref(); | ||
// Need to have a 1ms delay here or we don't get the screen update - not sure why |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because UI updates happen after control has returned to the mainloop.
So instead of the timer+return I think you can safely do:
QCoreApplication::instance()->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers);
@@ -521,12 +522,36 @@ void AutomatedRssDownloader::handleFeedCheckStateChange(QListWidgetItem *feed_it | |||
void AutomatedRssDownloader::updateMatchingArticles() | |||
{ | |||
ui->treeMatchingArticles->clear(); | |||
saveEditedRule(); | |||
m_updateMatchingArticlesDeferrals.ref(); | |||
QTimer::singleShot(1000, this, SLOT(deferredUpdateMatchingArticles())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will create a multitude of temporary QTimers. If I read it correctly it will create one for each keystroke.
Instead do this. In the class constructor create a member Timer. Set its property to singleshot and its interval to 1000ms.
Then in this function/slot, just call start() on the timer. If it is already running it will be restarted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - I'll change it to work that way. Qt newbie ...
@sledgehammer999 Rebased on top of master. Changed to use a single timer for the 1-second delay before matching, and to use Also added a few closely-related changes:
|
|
||
foreach (const QListWidgetItem *rule_item, ui->listRules->selectedItems()) { | ||
Rss::DownloadRulePtr rule = m_editableRuleList->getRule(rule_item->text()); | ||
if (rule) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curly brackets aren't needed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same - must not have re-run uncrustify.
@@ -47,10 +50,35 @@ | |||
#include "ui_automatedrssdownloader.h" | |||
#include "automatedrssdownloader.h" | |||
|
|||
class AutomatedRssDownloader::DownloadRuleListMatchState |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see the usefulness of this class. Why not just make the QTimer and QSet privatemembers of the AutomatedRssDownloader
class?
I read the next commit too, but I still don't see the benefit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more useful for PR #6178 (200a815) which has to hold a lot more state. By including it in these commits it makes for more straightforward diffs IMO. But I'm happy to move them to AutomatedRssDownloader
if you'd prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll probably respond tomorrow. Today, I am not in a state where I can read complex PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problems - I can rework it on the weekend if needed. Working on things today because it's a public holiday here today (Australia Day).
AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer<Rss::Manager> &manager, QWidget *parent) | ||
: QDialog(parent), | ||
ui(new Ui::AutomatedRssDownloader), | ||
m_manager(manager), m_editedRule(0) | ||
m_manager(manager), m_editedRule(0), | ||
m_ruleMatcher(new AutomatedRssDownloader::DownloadRuleListMatchState()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something went wrong with uncrustify.
The initialization list should look like this:
AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer<Rss::Manager> &manager, QWidget *parent)
: QDialog(parent)
, ui(new Ui::AutomatedRssDownloader)
, m_manager(manager)
, m_editedRule(0)
, m_ruleMatcher(new AutomatedRssDownloader::DownloadRuleListMatchState())
{
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must not have re-run uncrustify on this - I'll do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take note that the lines that you didn't chagne in this diff are also wrong in the initialization list.
(comma goes in the start to reduce noise in the diff when adding new fields)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out that uncrustify doesn't fix that initialisation list - you might want to look at the uncrustify.cfg.
I'll fix it here manually.
--HG-- branch : magao-dev
--HG-- branch : magao-dev
@sledgehammer999 Rebased on top of master, added an uncrustify commit before all the other commits and ran uncrustify for each commit. |
This is one of a series of pull requests designed to improve the responsiveness of the UI. This pull request addresses #6166.
Currently when editing an RSS rule each modification (e.g. each keypress in "Must Contain") results in immediately matching articles to populate the tree. This matching can take a long time - seconds is not uncommon, and can be a lot longer (one of my filters takes ~1 minute) - during which no further input is accepted.
This pull requests delays the article matching until there has been at least 1 second without any changes to the rule. This allows typing, etc without delay and makes for a much more responsive UI.
This pull request also adds a processing indicator while the articles are being matched:
Note: this pull request includes a commit (ee0359c) which has been factored out to allow all the pull requests I am submitting to merge without conflicts.