From b140721d5058103e8d969230b215a767cd376827 Mon Sep 17 00:00:00 2001 From: backendr Date: Sat, 6 May 2017 00:18:49 +0200 Subject: [PATCH] Add flag for checking inital server message --- cockatrice/src/tab_server.cpp | 7 ++++++- cockatrice/src/tab_server.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/tab_server.cpp b/cockatrice/src/tab_server.cpp index 787b08d8..a85fe1c0 100644 --- a/cockatrice/src/tab_server.cpp +++ b/cockatrice/src/tab_server.cpp @@ -168,7 +168,12 @@ void TabServer::retranslateUi() void TabServer::processServerMessageEvent(const Event_ServerMessage &event) { serverInfoBox->setHtml(QString::fromStdString(event.message())); - emit userEvent(); + if (shouldEmitUpdate) { + // prevent the initial server message from taking attention from ping icon + emit userEvent(); + } else { + shouldEmitUpdate = true; + } } void TabServer::joinRoom(int id, bool setCurrent) diff --git a/cockatrice/src/tab_server.h b/cockatrice/src/tab_server.h index baa8b6a6..e52d715c 100644 --- a/cockatrice/src/tab_server.h +++ b/cockatrice/src/tab_server.h @@ -47,6 +47,7 @@ private: AbstractClient *client; RoomSelector *roomSelector; QTextBrowser *serverInfoBox; + bool shouldEmitUpdate = false; public: TabServer(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent = 0); void retranslateUi();