Idle Client Timeout Functionality

Added the functionality client side to log users out of servers if they
are idle for more than 1 hour without joining either a game or room.
Sending a message (room/game/private) or performing a game action.
This commit is contained in:
woogerboy21 2016-10-09 13:55:07 -04:00
parent e4127fead3
commit 7af2f3f057
15 changed files with 70 additions and 3 deletions

View file

@ -342,10 +342,12 @@ void TabSupervisor::gameJoined(const Event_GameJoined &event)
connect(tab, SIGNAL(gameClosing(TabGame *)), this, SLOT(gameLeft(TabGame *)));
connect(tab, SIGNAL(openMessageDialog(const QString &, bool)), this, SLOT(addMessageTab(const QString &, bool)));
connect(tab, SIGNAL(openDeckEditor(const DeckLoader *)), this, SLOT(addDeckEditorTab(const DeckLoader *)));
connect(tab, SIGNAL(notIdle()), this, SLOT(resetIdleTimer()));
int tabIndex = myAddTab(tab);
addCloseButtonToTab(tab, tabIndex);
gameTabs.insert(event.game_info().game_id(), tab);
setCurrentWidget(tab);
emit idleTimerReset();
}
void TabSupervisor::localGameJoined(const Event_GameJoined &event)
@ -383,11 +385,13 @@ void TabSupervisor::addRoomTab(const ServerInfo_Room &info, bool setCurrent)
connect(tab, SIGNAL(maximizeClient()), this, SLOT(maximizeMainWindow()));
connect(tab, SIGNAL(roomClosing(TabRoom *)), this, SLOT(roomLeft(TabRoom *)));
connect(tab, SIGNAL(openMessageDialog(const QString &, bool)), this, SLOT(addMessageTab(const QString &, bool)));
connect(tab, SIGNAL(notIdle()), this, SLOT(resetIdleTimer()));
int tabIndex = myAddTab(tab);
addCloseButtonToTab(tab, tabIndex);
roomTabs.insert(info.room_id(), tab);
if (setCurrent)
setCurrentWidget(tab);
emit idleTimerReset();
}
void TabSupervisor::roomLeft(TabRoom *tab)
@ -440,6 +444,7 @@ TabMessage *TabSupervisor::addMessageTab(const QString &receiverName, bool focus
tab = new TabMessage(this, client, *userInfo, otherUser);
connect(tab, SIGNAL(talkClosing(TabMessage *)), this, SLOT(talkLeft(TabMessage *)));
connect(tab, SIGNAL(maximizeClient()), this, SLOT(maximizeMainWindow()));
connect(tab, SIGNAL(notIdle()), this, SLOT(resetIdleTimer()));
int tabIndex = myAddTab(tab);
addCloseButtonToTab(tab, tabIndex);
messageTabs.insert(receiverName, tab);
@ -589,3 +594,7 @@ void TabSupervisor::processNotifyUserEvent(const Event_NotifyUser &event)
}
void TabSupervisor::resetIdleTimer()
{
emit idleTimerReset();
}