GlobalLobbyWindow.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * GlobalLobbyWindow.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "GlobalLobbyObserver.h"
  12. #include "../windows/CWindowObject.h"
  13. class GlobalLobbyWidget;
  14. struct GlobalLobbyAccount;
  15. struct GlobalLobbyRoom;
  16. class GlobalLobbyWindow final : public CWindowObject, public GlobalLobbyObserver
  17. {
  18. std::string chatHistory;
  19. std::string currentChannelType;
  20. std::string currentChannelName;
  21. std::shared_ptr<GlobalLobbyWidget> widget;
  22. std::set<std::string> unreadChannels;
  23. public:
  24. GlobalLobbyWindow();
  25. // Callbacks for UI
  26. void doSendChatMessage();
  27. void doCreateGameRoom();
  28. void doOpenChannel(const std::string & channelType, const std::string & channelName, const std::string & roomDescription);
  29. void doInviteAccount(const std::string & accountID);
  30. void doJoinRoom(const std::string & roomID);
  31. /// Returns true if provided chat channel is the one that is currently open in UI
  32. bool isChannelOpen(const std::string & channelType, const std::string & channelName) const;
  33. /// Returns true if provided channel has unread messages (only messages that were received after login)
  34. bool isChannelUnread(const std::string & channelType, const std::string & channelName) const;
  35. // Callbacks for network packs
  36. void onGameChatMessage(const std::string & sender, const std::string & message, const std::string & when, const std::string & channelType, const std::string & channelName);
  37. void refreshChatText();
  38. void refreshActiveChannels();
  39. void onActiveAccounts(const std::vector<GlobalLobbyAccount> & accounts) override;
  40. void onActiveGameRooms(const std::vector<GlobalLobbyRoom> & rooms) override;
  41. void onMatchesHistory(const std::vector<GlobalLobbyRoom> & history);
  42. void onInviteReceived(const std::string & invitedRoomID);
  43. void onJoinedRoom();
  44. void onLeftRoom();
  45. };