lobby_moc.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * lobby_moc.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 <QWidget>
  12. #include "lobby.h"
  13. namespace Ui {
  14. class Lobby;
  15. }
  16. class Lobby : public QWidget
  17. {
  18. Q_OBJECT
  19. public:
  20. explicit Lobby(QWidget *parent = nullptr);
  21. ~Lobby();
  22. private slots:
  23. void on_messageEdit_returnPressed();
  24. void chatMessage(QString title, QString body, bool isSystem = false);
  25. void sysMessage(QString body);
  26. void dispatchMessage(QString);
  27. void serverCommand(const ServerCommand &);
  28. void on_connectButton_toggled(bool checked);
  29. void on_newButton_clicked();
  30. void on_joinButton_clicked();
  31. void on_buttonLeave_clicked();
  32. void on_buttonReady_clicked();
  33. void onDisconnected();
  34. void on_sessionsTable_itemSelectionChanged();
  35. void on_playersList_currentRowChanged(int currentRow);
  36. void on_kickButton_clicked();
  37. private:
  38. QString serverUrl;
  39. int serverPort;
  40. Ui::Lobby *ui;
  41. SocketLobby socketLobby;
  42. QString hostSession;
  43. QString session;
  44. QString username;
  45. QStringList gameArgs;
  46. enum AuthStatus
  47. {
  48. AUTH_NONE, AUTH_OK, AUTH_ERROR
  49. };
  50. AuthStatus authentificationStatus = AUTH_NONE;
  51. private:
  52. QMap<QString, QString> buildModsMap() const;
  53. bool isModAvailable(const QString & modName, const QString & modVersion) const;
  54. void protocolAssert(bool);
  55. };