GUI: Lobby changes and invite preperation
This commit is contained in:
@@ -69,7 +69,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
QStringList headerList;
|
||||
headerList << tr("Game") << tr("Players") << tr("State") << tr("R") << tr("P");
|
||||
myGameListModel->setHorizontalHeaderLabels(headerList);
|
||||
|
||||
|
||||
treeView_GameList->setColumnWidth(0,220);
|
||||
treeView_GameList->setColumnWidth(1,65);
|
||||
treeView_GameList->setColumnWidth(2,65);
|
||||
@@ -79,6 +79,10 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
treeView_GameList->setStyleSheet("QTreeView {background-color: white; background-image: url(\""+myAppDataPath +"gfx/gui/misc/background_gamelist.png\"); background-attachment: fixed; background-position: top center ; background-repeat: no-repeat;}");
|
||||
treeView_GameList->setAutoFillBackground(TRUE);
|
||||
|
||||
nickListContextMenu = new QMenu();
|
||||
nickListInviteAction = new QAction(QIcon(":/gfx/list_add_user.png"), tr("Invite player"), nickListContextMenu);
|
||||
nickListContextMenu->addAction(nickListInviteAction);
|
||||
|
||||
connect( pushButton_CreateGame, SIGNAL( clicked() ), this, SLOT( createGame() ) );
|
||||
connect( pushButton_JoinGame, SIGNAL( clicked() ), this, SLOT( joinGame() ) );
|
||||
connect( pushButton_joinAnyGame, SIGNAL( clicked() ), this, SLOT( joinAnyGame() ) );
|
||||
@@ -95,6 +99,8 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
connect( waitStartGameMsgBoxTimer, SIGNAL(timeout()), this, SLOT( showWaitStartGameMsgBox() ));
|
||||
connect( blinkingButtonAnimationTimer, SIGNAL(timeout()), this, SLOT( blinkingStartButtonAnimation() ));
|
||||
connect( comboBox_gameListFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changeGameListFilter(int)));
|
||||
connect( treeWidget_NickList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( showNickListContextMenu(QPoint) ) );
|
||||
connect( nickListInviteAction, SIGNAL(triggered()), this, SLOT( invitePlayerToCurrentGame() ));
|
||||
|
||||
lineEdit_ChatInput->installEventFilter(this);
|
||||
|
||||
@@ -1065,15 +1071,17 @@ void gameLobbyDialogImpl::hideShowGameDescription(bool show) {
|
||||
label_gameDesc5->show();
|
||||
label_gameDesc6->show();
|
||||
label_gameDesc7->show();
|
||||
line->show();
|
||||
}
|
||||
else {
|
||||
label_gameType->show();
|
||||
label_gameType->hide();
|
||||
label_gameDesc2->hide();
|
||||
label_gameDesc3->hide();
|
||||
label_gameDesc4->hide();
|
||||
label_gameDesc5->hide();
|
||||
label_gameDesc6->hide();
|
||||
label_gameDesc7->hide();
|
||||
line->hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1289,3 +1297,20 @@ void gameLobbyDialogImpl::guestUserMode()
|
||||
lineEdit_ChatInput->setDisabled(true);
|
||||
guestMode = true;
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::showNickListContextMenu(QPoint p)
|
||||
{
|
||||
if(treeWidget_NickList->topLevelItemCount()) {
|
||||
|
||||
assert(mySession);
|
||||
|
||||
if(inGame && mySession->getClientGameInfo(mySession->getClientCurrentGameId()).data.gameType == GAME_TYPE_INVITE_ONLY && treeWidget_NickList->selectedItems().at(0)->data(0, Qt::UserRole).toUInt() != mySession->getClientUniquePlayerId()) {
|
||||
nickListContextMenu->popup(treeWidget_NickList->mapToGlobal(p));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::invitePlayerToCurrentGame()
|
||||
{
|
||||
qDebug() << "invitePlayer";
|
||||
}
|
||||
|
||||
@@ -55,68 +55,55 @@ public slots:
|
||||
void createGame();
|
||||
void joinGame();
|
||||
void joinAnyGame();
|
||||
|
||||
void gameSelected(const QModelIndex &, const QModelIndex &);
|
||||
void updateGameItem(QList <QStandardItem*>, unsigned gameId);
|
||||
|
||||
void addGame(unsigned gameId);
|
||||
void updateGameMode(unsigned gameId, int newMode);
|
||||
void updateGameAdmin(unsigned gameId, unsigned adminPlayerId);
|
||||
void removeGame(unsigned gameId);
|
||||
void gameAddPlayer(unsigned gameId, unsigned playerId);
|
||||
void gameRemovePlayer(unsigned gameId, unsigned playerId);
|
||||
|
||||
void playerJoinedLobby(unsigned playerId, QString playerName);
|
||||
void playerLeftLobby(unsigned playerId);
|
||||
|
||||
void updateStats(ServerStats stats);
|
||||
|
||||
void refreshGameStats();
|
||||
void refreshGameStats();
|
||||
void refreshPlayerStats();
|
||||
|
||||
void setCurrentGameName ( const QString& theValue ) { currentGameName = theValue; }
|
||||
QString getCurrentGameName() const { return currentGameName; }
|
||||
|
||||
gameTableImpl* getMyW() const { return myW; }
|
||||
void checkPlayerQuantity();
|
||||
void blinkingStartButtonAnimation();
|
||||
|
||||
void joinedNetworkGame(unsigned, QString, bool);
|
||||
void addConnectedPlayer(unsigned, QString, bool);
|
||||
void updatePlayer(unsigned, QString);
|
||||
void removePlayer(unsigned, QString);
|
||||
void newGameAdmin(unsigned, QString);
|
||||
|
||||
void refreshConnectedPlayerAvatars();
|
||||
|
||||
void playerSelected(QTreeWidgetItem*, QTreeWidgetItem*);
|
||||
void refresh(int actionID);
|
||||
void removedFromGame(int reason);
|
||||
void startGame();
|
||||
void leaveGame();
|
||||
void kickPlayer();
|
||||
|
||||
void joinedGameDialogUpdate();
|
||||
void leftGameDialogUpdate();
|
||||
void updateDialogBlinds(const GameData &gameData);
|
||||
void clearDialog();
|
||||
|
||||
void keyPressEvent(QKeyEvent * keyEvent);
|
||||
bool event(QEvent * event);
|
||||
void hideShowGameDescription(bool show);
|
||||
|
||||
void showWaitStartGameMsgBox();
|
||||
|
||||
void joinAnyGameButtonRefresh();
|
||||
void joinAnyGameButtonRefresh();
|
||||
void reject();
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void writeDialogSettings(int);
|
||||
void readDialogSettings();
|
||||
void changeGameListFilter(int);
|
||||
void changeGameListSorting();
|
||||
|
||||
void changeGameListSorting();
|
||||
void registeredUserMode();
|
||||
void guestUserMode();
|
||||
void showNickListContextMenu(QPoint);
|
||||
void invitePlayerToCurrentGame();
|
||||
|
||||
private:
|
||||
|
||||
@@ -146,6 +133,8 @@ private:
|
||||
QStandardItemModel *myGameListModel;
|
||||
QItemSelectionModel *myGameListSelectionModel;
|
||||
MyGameListSortFilterProxyModel *myGameListSortFilterProxyModel;
|
||||
QMenu *nickListContextMenu;
|
||||
QAction *nickListInviteAction;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user