mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Merge branch 'master' into 6186/target-older-x86-macos
This commit is contained in:
commit
9b201cd8c3
2 changed files with 26 additions and 8 deletions
|
|
@ -60,6 +60,7 @@ void PlayerManager::removePlayer(int playerId)
|
|||
emit playerRemoved(player);
|
||||
emit playerCountChanged();
|
||||
players.remove(playerId);
|
||||
player->deleteLater();
|
||||
}
|
||||
|
||||
Player *PlayerManager::getPlayer(int playerId) const
|
||||
|
|
|
|||
|
|
@ -650,14 +650,6 @@ void TabGame::notifyPlayerKicked()
|
|||
msgBox.exec();
|
||||
}
|
||||
|
||||
void TabGame::processPlayerLeave(Player *leavingPlayer)
|
||||
{
|
||||
QString playerName = "@" + leavingPlayer->getPlayerInfo()->getName();
|
||||
removePlayerFromAutoCompleteList(playerName);
|
||||
|
||||
scene->removePlayer(leavingPlayer);
|
||||
}
|
||||
|
||||
Player *TabGame::addPlayer(Player *newPlayer)
|
||||
{
|
||||
QString newPlayerName = "@" + newPlayer->getPlayerInfo()->getName();
|
||||
|
|
@ -707,6 +699,31 @@ void TabGame::addLocalPlayer(Player *newPlayer, int playerId)
|
|||
}
|
||||
}
|
||||
|
||||
void TabGame::processPlayerLeave(Player *leavingPlayer)
|
||||
{
|
||||
QString playerName = "@" + leavingPlayer->getPlayerInfo()->getName();
|
||||
removePlayerFromAutoCompleteList(playerName);
|
||||
|
||||
scene->removePlayer(leavingPlayer);
|
||||
|
||||
// When we inserted the playerMenu into the gameMenu earlier, Qt wrapped the playerMenu into a QAction*, which lives
|
||||
// independently and does not get cleaned up when the source menu gets destroyed. We have to manually clean here.
|
||||
if (leavingPlayer->getPlayerMenu()) {
|
||||
QMenu *menu = leavingPlayer->getPlayerMenu()->getPlayerMenu();
|
||||
if (menu) {
|
||||
// Find and remove the QAction pointing to this menu
|
||||
QList<QAction *> actions = gameMenu->actions();
|
||||
for (QAction *act : actions) {
|
||||
if (act->menu() == menu) {
|
||||
gameMenu->removeAction(act);
|
||||
delete act; // deletes the QAction wrapper around the submenu
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TabGame::processRemotePlayerDeckSelect(QString deckList, int playerId, QString playerName)
|
||||
{
|
||||
DeckList loader;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue