GUI: try to fix refresh bug when player joined an invite-only-game
This commit is contained in:
@@ -97,7 +97,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
|||||||
connect( pushButton_StartGame, SIGNAL( clicked() ), this, SLOT( startGame() ) );
|
connect( pushButton_StartGame, SIGNAL( clicked() ), this, SLOT( startGame() ) );
|
||||||
connect( pushButton_Kick, SIGNAL( clicked() ), this, SLOT( kickPlayer() ) );
|
connect( pushButton_Kick, SIGNAL( clicked() ), this, SLOT( kickPlayer() ) );
|
||||||
connect( pushButton_Leave, SIGNAL( clicked() ), this, SLOT( leaveGame() ) );
|
connect( pushButton_Leave, SIGNAL( clicked() ), this, SLOT( leaveGame() ) );
|
||||||
connect( myGameListSelectionModel, SIGNAL( currentChanged (const QModelIndex &, const QModelIndex &) ), this, SLOT( gameSelected(const QModelIndex &, const QModelIndex &) ) );
|
connect( myGameListSelectionModel, SIGNAL( currentChanged (const QModelIndex &, const QModelIndex &) ), this, SLOT( gameSelected(const QModelIndex &) ) );
|
||||||
connect( treeView_GameList, SIGNAL( doubleClicked (const QModelIndex &) ), this, SLOT( joinGame() ) );
|
connect( treeView_GameList, SIGNAL( doubleClicked (const QModelIndex &) ), this, SLOT( joinGame() ) );
|
||||||
connect( treeView_GameList->header(), SIGNAL( sortIndicatorChanged ( int , Qt::SortOrder )), this, SLOT( changeGameListSorting() ) );
|
connect( treeView_GameList->header(), SIGNAL( sortIndicatorChanged ( int , Qt::SortOrder )), this, SLOT( changeGameListSorting() ) );
|
||||||
connect( treeWidget_connectedPlayers, SIGNAL( currentItemChanged ( QTreeWidgetItem*, QTreeWidgetItem*) ), this, SLOT( playerSelected(QTreeWidgetItem*, QTreeWidgetItem*) ) );
|
connect( treeWidget_connectedPlayers, SIGNAL( currentItemChanged ( QTreeWidgetItem*, QTreeWidgetItem*) ), this, SLOT( playerSelected(QTreeWidgetItem*, QTreeWidgetItem*) ) );
|
||||||
@@ -337,10 +337,10 @@ void gameLobbyDialogImpl::removedFromGame(int /*reason*/)
|
|||||||
leftGameDialogUpdate();
|
leftGameDialogUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void gameLobbyDialogImpl::gameSelected(const QModelIndex &index, const QModelIndex &)
|
void gameLobbyDialogImpl::gameSelected(const QModelIndex &index, bool invitedRefreshHack)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!inGame && index.isValid())
|
if ((!inGame && index.isValid()) || (inGame && index.isValid() && invitedRefreshHack) )
|
||||||
{
|
{
|
||||||
pushButton_JoinGame->setEnabled(true);
|
pushButton_JoinGame->setEnabled(true);
|
||||||
|
|
||||||
@@ -760,6 +760,7 @@ void gameLobbyDialogImpl::joinedNetworkGame(unsigned playerId, QString playerNam
|
|||||||
inGame = true;
|
inGame = true;
|
||||||
joinedGameDialogUpdate();
|
joinedGameDialogUpdate();
|
||||||
|
|
||||||
|
|
||||||
myPlayerId = playerId;
|
myPlayerId = playerId;
|
||||||
isGameAdministrator = isGameAdmin;
|
isGameAdministrator = isGameAdmin;
|
||||||
addConnectedPlayer(playerId, playerName, isGameAdmin);
|
addConnectedPlayer(playerId, playerName, isGameAdmin);
|
||||||
@@ -770,6 +771,17 @@ void gameLobbyDialogImpl::joinedNetworkGame(unsigned playerId, QString playerNam
|
|||||||
infoMsgToShowId = 2;
|
infoMsgToShowId = 2;
|
||||||
showInfoMsgBoxTimer->start(1000);
|
showInfoMsgBoxTimer->start(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!myGameListSelectionModel->hasSelection() && mySession->getClientGameInfo(mySession->getClientCurrentGameId()).data.gameType == GAME_TYPE_INVITE_ONLY) {
|
||||||
|
int it = 0;
|
||||||
|
while (myGameListModel->item(it)) {
|
||||||
|
if (myGameListModel->item(it, 0)->data(Qt::UserRole) == mySession->getClientCurrentGameId()) {
|
||||||
|
gameSelected(treeView_GameList->model()->index(it,0), true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1317,7 +1329,7 @@ void gameLobbyDialogImpl::guestUserMode()
|
|||||||
|
|
||||||
void gameLobbyDialogImpl::showNickListContextMenu(QPoint p)
|
void gameLobbyDialogImpl::showNickListContextMenu(QPoint p)
|
||||||
{
|
{
|
||||||
if(treeWidget_NickList->topLevelItemCount()) {
|
if(treeWidget_NickList->topLevelItemCount() && !treeWidget_NickList->selectedItems().isEmpty()) {
|
||||||
|
|
||||||
assert(mySession);
|
assert(mySession);
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public slots:
|
|||||||
void createGame();
|
void createGame();
|
||||||
void joinGame();
|
void joinGame();
|
||||||
void joinAnyGame();
|
void joinAnyGame();
|
||||||
void gameSelected(const QModelIndex &, const QModelIndex &);
|
void gameSelected(const QModelIndex &, bool invitedRefreshHack = false);
|
||||||
void updateGameItem(QList <QStandardItem*>, unsigned gameId);
|
void updateGameItem(QList <QStandardItem*>, unsigned gameId);
|
||||||
void addGame(unsigned gameId);
|
void addGame(unsigned gameId);
|
||||||
void updateGameMode(unsigned gameId, int newMode);
|
void updateGameMode(unsigned gameId, int newMode);
|
||||||
|
|||||||
Reference in New Issue
Block a user