diff --git a/src/gui/qt/gamelobbydialog.ui b/src/gui/qt/gamelobbydialog.ui index bc391de5..998ec47e 100644 --- a/src/gui/qt/gamelobbydialog.ui +++ b/src/gui/qt/gamelobbydialog.ui @@ -64,6 +64,9 @@ 16777215 + + Qt::CustomContextMenu + 5 @@ -304,65 +307,310 @@ p, li { white-space: pre-wrap; } Game Info - + + + 3 + + + 7 + - 4 + 2 + + + 7 - 5 + 7 - - 5 - - - - - - - Game type: + + + + + 0 + 174 + + + + true + + + + + 0 + 0 + 248 + 175 + + + + + 2 - - - - - - - 16 - 16 - + + 2 - - - 16 - 16 - - - - true - - - - - - - - 0 - 0 - - - - - - - - + + + + + + Start Cash: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + QLabel { color:rgb(0, 0, 255); } + + + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing + + + + + + + + + + + First small blind: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + QLabel { color:rgb(0, 0, 255); } + + + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing + + + + + + + + + + + Blinds raise interval: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + QLabel { color:rgb(0, 0, 255); } + + + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing + + + true + + + + + + + + + + + Blinds raise mode: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + QLabel { color:rgb(0, 0, 255); } + + + + + + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing + + + true + + + + + + + + + + + Manual blinds list: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + QLabel { color:rgb(0, 0, 255); } + + + + + + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing + + + true + + + + + + + + + + + Timeout for player action (sec): + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + QLabel { color:rgb(0, 0, 255); } + + + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing + + + + + + + + + + + + 0 + 0 + + + + Game type: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + Qt::Horizontal + + + + + + - + 221 - 221 + 240 @@ -384,227 +632,134 @@ p, li { white-space: pre-wrap; } - - - - Fill up with computer opponents - - - - - - - 6 - - - 3 - - - 4 - + + - + + + + 0 + 0 + + + + Fill up with computer opponents + + + + :/gfx/swbuttonlocalgame.png:/gfx/swbuttonlocalgame.png + + + + + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed - 40 - 20 + 0 + 21 + + + + + + 3 + + + 0 + + + 0 + false + + + 0 + 0 + + + + + 0 + 26 + + + + + 16777215 + 26 + + &Start Game + + + :/gfx/dialog_ok_apply.png:/gfx/dialog_ok_apply.png + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 0 + 26 + + + + + + + 0 + 0 + + + + + 0 + 26 + + + + + 16777215 + 26 + + &Kick Player + + + :/gfx/editdelete.png:/gfx/editdelete.png + - - - - true - - - - - 0 - 0 - 244 - 159 - - - - - 1 - - - 2 - - - 3 - - - - - - - Start Cash: - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - First small blind: - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - Blinds raise interval: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing - - - - - - - - - - - Blinds raise mode: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - - - Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing - - - true - - - - - - - - - - - Manual blinds list: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - - - Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing - - - true - - - - - - - - - - - Timeout for player action (sec): - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - + 0 @@ -620,7 +775,7 @@ p, li { white-space: pre-wrap; } 0 - 27 + 26 @@ -633,9 +788,25 @@ p, li { white-space: pre-wrap; } 0 + + + 0 + 26 + + + + + 16777215 + 26 + + &Leave Game + + + :/gfx/arrow_left_double.png:/gfx/arrow_left_double.png + @@ -660,6 +831,8 @@ p, li { white-space: pre-wrap; } pushButton_Kick pushButton_Leave - + + + diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp index 804eabaa..9f04892a 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp @@ -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"; +} diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h index 49d870f2..3d492f5c 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h @@ -55,68 +55,55 @@ public slots: void createGame(); void joinGame(); void joinAnyGame(); - void gameSelected(const QModelIndex &, const QModelIndex &); void updateGameItem(QList , 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: diff --git a/src/gui/qt/resources/player_play.png b/src/gui/qt/resources/player_play.png index c930ee7a..80ff3a1d 100644 Binary files a/src/gui/qt/resources/player_play.png and b/src/gui/qt/resources/player_play.png differ