1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:07:35 +00:00

IRCClient: Add a little "(n)" indicator to window list for unread messages.

This commit is contained in:
Andreas Kling 2019-03-16 02:14:53 +01:00
parent 1394677528
commit b4f787090c
9 changed files with 68 additions and 14 deletions

View file

@ -61,3 +61,29 @@ void IRCWindow::set_log_buffer(const IRCLogBuffer& log_buffer)
m_log_buffer = &log_buffer;
m_table_view->set_model(OwnPtr<IRCLogBufferModel>((IRCLogBufferModel*)log_buffer.model()));
}
bool IRCWindow::is_active() const
{
return m_client.current_window() == this;
}
void IRCWindow::did_add_message()
{
if (!is_active()) {
++m_unread_count;
m_client.aid_update_window_list();
}
}
void IRCWindow::clear_unread_count()
{
if (!m_unread_count)
return;
m_unread_count = 0;
m_client.aid_update_window_list();
}
int IRCWindow::unread_count() const
{
return m_unread_count;
}