Skip to content
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

Throttle RSS unread signal handling in MainWindow #16377

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,9 +681,19 @@ void MainWindow::on_actionLock_triggered()
hide();
}

void MainWindow::handleRSSUnreadCountUpdated(int count)
void MainWindow::handleRSSUnreadCountUpdated(int)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the parameter entirely.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void MainWindow::handleRSSUnreadCountUpdated(int)
void MainWindow::handleRSSUnreadCountUpdated()

{
m_tabs->setTabText(m_tabs->indexOf(m_rssWidget), tr("RSS (%1)").arg(count));
if (m_rssUnreadUpdateEnqueued)
return;

m_rssUnreadUpdateEnqueued = true;
QTimer::singleShot(256, m_rssWidget, [this]()
{
m_rssUnreadUpdateEnqueued = false;

const int unreadCount = RSS::Session::instance()->rootFolder()->unreadCount();
m_tabs->setTabText(m_tabs->indexOf(m_rssWidget), tr("RSS (%1)").arg(unreadCount));
});
}

void MainWindow::displayRSSTab(bool enable)
Expand Down
2 changes: 2 additions & 0 deletions src/gui/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ private slots:
SettingValue<bool> m_storeNotificationTorrentAdded;
CachedSettingValue<Log::MsgTypes> m_storeExecutionLogTypes;

bool m_rssUnreadUpdateEnqueued = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please place it out of "Setting values" section.


#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
SettingValue<int> m_storeNotificationTimeOut;
#endif
Expand Down