diff --git a/cockatrice/src/gameselector.cpp b/cockatrice/src/gameselector.cpp index 424c6b51..02891695 100644 --- a/cockatrice/src/gameselector.cpp +++ b/cockatrice/src/gameselector.cpp @@ -29,6 +29,8 @@ GameSelector::GameSelector(Client *_client, QWidget *parent) connect(joinButton, SIGNAL(clicked()), this, SLOT(actJoin())); connect(client, SIGNAL(gameListEvent(ServerGame *)), gameListModel, SLOT(updateGameList(ServerGame *))); + connect(client, SIGNAL(statusChanged(ProtocolStatus)), this, SLOT(statusChanged(ProtocolStatus))); + client->listGames(); } @@ -44,6 +46,12 @@ void GameSelector::actRefresh() client->listGames(); } +void GameSelector::statusChanged(ProtocolStatus status) +{ + if (status == StatusDisconnected) + deleteLater(); +} + void GameSelector::checkResponse(ServerResponse response) { createButton->setEnabled(true); diff --git a/cockatrice/src/gameselector.h b/cockatrice/src/gameselector.h index 35dd463e..2d4b447c 100644 --- a/cockatrice/src/gameselector.h +++ b/cockatrice/src/gameselector.h @@ -18,6 +18,7 @@ private slots: void actRefresh(); void actJoin(); void checkResponse(ServerResponse response); + void statusChanged(ProtocolStatus status); private: Client *client;