mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
The remote client now runs in an extra thread, fixing issue #29
This commit is contained in:
parent
542fd2c5c8
commit
4e4a7563db
26 changed files with 130 additions and 79 deletions
|
|
@ -14,6 +14,7 @@
|
|||
#include "pending_command.h"
|
||||
#include "pb/room_commands.pb.h"
|
||||
#include "pb/serverinfo_game.pb.h"
|
||||
#include "pb/response.pb.h"
|
||||
|
||||
GameSelector::GameSelector(AbstractClient *_client, TabSupervisor *_tabSupervisor, TabRoom *_room, const QMap<int, QString> &_rooms, const QMap<int, GameTypeMap> &_gameTypes, QWidget *parent)
|
||||
: QGroupBox(parent), client(_client), tabSupervisor(_tabSupervisor), room(_room)
|
||||
|
|
@ -82,14 +83,14 @@ void GameSelector::actCreate()
|
|||
dlg.exec();
|
||||
}
|
||||
|
||||
void GameSelector::checkResponse(Response::ResponseCode response)
|
||||
void GameSelector::checkResponse(const Response &response)
|
||||
{
|
||||
if (createButton)
|
||||
createButton->setEnabled(true);
|
||||
joinButton->setEnabled(true);
|
||||
spectateButton->setEnabled(true);
|
||||
|
||||
switch (response) {
|
||||
switch (response.response_code()) {
|
||||
case Response::RespNotInRoom: QMessageBox::critical(this, tr("Error"), tr("Please join the appropriate room first.")); break;
|
||||
case Response::RespWrongPassword: QMessageBox::critical(this, tr("Error"), tr("Wrong password.")); break;
|
||||
case Response::RespSpectatorsNotAllowed: QMessageBox::critical(this, tr("Error"), tr("Spectators are not allowed in this game.")); break;
|
||||
|
|
@ -132,7 +133,7 @@ void GameSelector::actJoin()
|
|||
}
|
||||
|
||||
PendingCommand *pend = r->prepareRoomCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response::ResponseCode)), this, SLOT(checkResponse(Response::ResponseCode)));
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(checkResponse(Response)));
|
||||
r->sendRoomCommand(pend);
|
||||
|
||||
if (createButton)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue