lobby_moc.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. void on_buttonResolve_clicked();
  38. void on_optNewGame_toggled(bool checked);
  39. void on_optLoadGame_toggled(bool checked);
  40. private:
  41. QString serverUrl;
  42. int serverPort;
  43. bool isLoadGameMode = false;
  44. Ui::Lobby *ui;
  45. SocketLobby socketLobby;
  46. QString hostSession;
  47. QString session;
  48. QString username;
  49. QStringList gameArgs;
  50. enum AuthStatus
  51. {
  52. AUTH_NONE, AUTH_OK, AUTH_ERROR
  53. };
  54. AuthStatus authentificationStatus = AUTH_NONE;
  55. private:
  56. QMap<QString, QString> buildModsMap() const;
  57. bool isModAvailable(const QString & modName, const QString & modVersion) const;
  58. void protocolAssert(bool);
  59. };