lobby_moc.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. void changeEvent(QEvent *event) override;
  20. public:
  21. explicit Lobby(QWidget *parent = nullptr);
  22. ~Lobby();
  23. signals:
  24. void enableMod(QString mod);
  25. void disableMod(QString mod);
  26. public slots:
  27. void updateMods();
  28. private slots:
  29. void on_messageEdit_returnPressed();
  30. void chatMessage(QString title, QString body, bool isSystem = false);
  31. void sysMessage(QString body);
  32. void dispatchMessage(QString);
  33. void serverCommand(const ServerCommand &);
  34. void on_connectButton_toggled(bool checked);
  35. void on_newButton_clicked();
  36. void on_joinButton_clicked();
  37. void on_buttonLeave_clicked();
  38. void on_buttonReady_clicked();
  39. void onDisconnected();
  40. void on_sessionsTable_itemSelectionChanged();
  41. void on_playersList_currentRowChanged(int currentRow);
  42. void on_kickButton_clicked();
  43. void on_buttonResolve_clicked();
  44. void on_optNewGame_toggled(bool checked);
  45. void on_optLoadGame_toggled(bool checked);
  46. private:
  47. QString serverUrl;
  48. int serverPort;
  49. bool isLoadGameMode = false;
  50. Ui::Lobby *ui;
  51. SocketLobby socketLobby;
  52. QString hostSession;
  53. QString session;
  54. QString username;
  55. QStringList gameArgs;
  56. QMap<QString, QString> hostModsMap;
  57. enum AuthStatus
  58. {
  59. AUTH_NONE, AUTH_OK, AUTH_ERROR
  60. };
  61. AuthStatus authentificationStatus = AUTH_NONE;
  62. private:
  63. QMap<QString, QString> buildModsMap() const;
  64. bool isModAvailable(const QString & modName, const QString & modVersion) const;
  65. void protocolAssert(bool);
  66. };