mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 00:04:48 -07:00
Selecting game already open in a tab brings user to that tab. (#4653)
* When trying to join a game from GameSelector that's already been joined by you, navigate to its game tab. * return immediately, do not change button states Co-authored-by: ebbit1q <ebbit1q@gmail.com>
This commit is contained in:
parent
8e4ddf366c
commit
72743e834e
10 changed files with 29 additions and 11 deletions
|
|
@ -10,6 +10,7 @@
|
|||
#include "pb/serverinfo_game.pb.h"
|
||||
#include "pending_command.h"
|
||||
#include "tab_account.h"
|
||||
#include "tab_game.h"
|
||||
#include "tab_room.h"
|
||||
#include "tab_supervisor.h"
|
||||
|
||||
|
|
@ -26,7 +27,7 @@
|
|||
#include <QVBoxLayout>
|
||||
|
||||
GameSelector::GameSelector(AbstractClient *_client,
|
||||
const TabSupervisor *_tabSupervisor,
|
||||
TabSupervisor *_tabSupervisor,
|
||||
TabRoom *_room,
|
||||
const QMap<int, QString> &_rooms,
|
||||
const QMap<int, GameTypeMap> &_gameTypes,
|
||||
|
|
@ -239,6 +240,9 @@ void GameSelector::actJoin()
|
|||
if (!ind.isValid())
|
||||
return;
|
||||
const ServerInfo_Game &game = gameListModel->getGame(ind.data(Qt::UserRole).toInt());
|
||||
if (tabSupervisor->switchToGameTabIfAlreadyExists(game.game_id())) {
|
||||
return;
|
||||
}
|
||||
bool spectator = sender() == spectateButton || game.player_count() == game.max_players();
|
||||
bool overrideRestrictions = !tabSupervisor->getAdminLocked();
|
||||
QString password;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue