lobby_moc.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 dispatchMessage(QString);
  30. void serverCommand(const ServerCommand &);
  31. void onMessageSent(QString message);
  32. void onChannelSwitch(QString channel);
  33. void on_connectButton_toggled(bool checked);
  34. void on_newButton_clicked();
  35. void on_joinButton_clicked();
  36. void on_buttonLeave_clicked();
  37. void on_buttonReady_clicked();
  38. void onDisconnected();
  39. void on_sessionsTable_itemSelectionChanged();
  40. void on_playersList_currentRowChanged(int currentRow);
  41. void on_kickButton_clicked();
  42. void on_buttonResolve_clicked();
  43. void on_optNewGame_toggled(bool checked);
  44. void on_optLoadGame_toggled(bool checked);
  45. private:
  46. QString serverUrl;
  47. int serverPort;
  48. bool isLoadGameMode = false;
  49. Ui::Lobby *ui;
  50. SocketLobby socketLobby;
  51. QString hostSession;
  52. QString session;
  53. QString username;
  54. QStringList gameArgs;
  55. QMap<QString, QString> hostModsMap;
  56. enum AuthStatus
  57. {
  58. AUTH_NONE, AUTH_OK, AUTH_ERROR
  59. };
  60. AuthStatus authentificationStatus = AUTH_NONE;
  61. private:
  62. QMap<QString, QString> buildModsMap() const;
  63. bool isModAvailable(const QString & modName, const QString & modVersion) const;
  64. void protocolAssert(bool);
  65. };