From 62da7257d56eecaa1f37c4fcf8bc39c4bdd81bfc Mon Sep 17 00:00:00 2001 From: doitux Date: Sat, 5 Mar 2011 21:20:08 +0000 Subject: [PATCH] implement new "open stats page" context menu (ticket #63) --- src/game_defs.h | 2 +- src/gui/qt/gamelobbydialog.ui | 3 ++ .../gamelobbydialog/gamelobbydialogimpl.cpp | 36 ++++++++++++++++++ .../qt/gamelobbydialog/gamelobbydialogimpl.h | 4 ++ src/gui/qt/resources/pokerth.qrc | 1 + src/gui/qt/resources/view-statistics.png | Bin 0 -> 495 bytes 6 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/gui/qt/resources/view-statistics.png diff --git a/src/game_defs.h b/src/game_defs.h index 2f2bf073..c03e3d9d 100644 --- a/src/game_defs.h +++ b/src/game_defs.h @@ -35,7 +35,7 @@ #define POKERTH_VERSION ((POKERTH_VERSION_MAJOR << 8) | POKERTH_VERSION_MINOR) #define POKERTH_BETA_REVISION 0 -#define POKERTH_BETA_RELEASE_STRING "0.8.3" +#define POKERTH_BETA_RELEASE_STRING "0.9 beta1" #define RANKING_GAME_START_CASH 10000 #define RANKING_GAME_NUMBER_OF_PLAYERS 10 diff --git a/src/gui/qt/gamelobbydialog.ui b/src/gui/qt/gamelobbydialog.ui index e1a90409..699f9a9d 100644 --- a/src/gui/qt/gamelobbydialog.ui +++ b/src/gui/qt/gamelobbydialog.ui @@ -144,6 +144,9 @@ 237 + + Qt::CustomContextMenu + 1 diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp index b490b6e2..8bd016a1 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp @@ -125,6 +125,11 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c) nickListPlayerInfoSubMenu = nickListContextMenu->addMenu(QIcon(":/gfx/dialog-information.png"), tr("Player infos ...")); nickListPlayerInGameInfo = new QAction(nickListContextMenu); nickListPlayerInfoSubMenu->addAction(nickListPlayerInGameInfo); + nickListOpenPlayerStats = new QAction(QIcon(":/gfx/view-statistics.png"), tr("Show player stats"), nickListContextMenu); + nickListContextMenu->addAction(nickListOpenPlayerStats); + + connectedPlayersListPlayerInfoSubMenu = new QMenu(); + connectedPlayersListPlayerInfoSubMenu->addAction(nickListOpenPlayerStats); connect( pushButton_CreateGame, SIGNAL( clicked() ), this, SLOT( createGame() ) ); connect( pushButton_JoinGame, SIGNAL( clicked() ), this, SLOT( joinGame() ) ); @@ -146,8 +151,10 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c) connect( comboBox_gameListFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changeGameListFilter(int))); connect( comboBox_nickListFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changeNickListFilter(int))); connect( treeView_NickList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( showNickListContextMenu(QPoint) ) ); + connect( treeWidget_connectedPlayers, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( showConnectedPlayersContextMenu(QPoint) ) ); connect( nickListInviteAction, SIGNAL(triggered()), this, SLOT( invitePlayerToCurrentGame() )); connect( nickListIgnorePlayerAction, SIGNAL(triggered()), this, SLOT( putPlayerOnIgnoreList() )); + connect( nickListOpenPlayerStats, SIGNAL(triggered()), this, SLOT( openPlayerStats() )); connect( lineEdit_searchForPlayers, SIGNAL(textChanged(QString)),this, SLOT(searchForPlayerRegExpChanged())); lineEdit_searchForPlayers->installEventFilter(this); @@ -1630,3 +1637,32 @@ void gameLobbyDialogImpl::updateAutoStartTimer() autoStartTimerOverlay->hide(); } } + +void gameLobbyDialogImpl::openPlayerStats() +{ + if(myNickListSelectionModel->currentIndex().isValid()) { + + unsigned playerId = myNickListSelectionModel->currentIndex().data(Qt::UserRole).toUInt(); + if(!mySession->getClientPlayerInfo(playerId).isGuest) { + QUrl url("http://pokerth.net/redirect_user_profile.php?nick="+QUrl::toPercentEncoding(myNickListSelectionModel->currentIndex().data(Qt::DisplayRole).toString())); + QDesktopServices::openUrl(url); + } + } +} + +void gameLobbyDialogImpl::showConnectedPlayersContextMenu(QPoint p) +{ + if(treeWidget_connectedPlayers->currentItem()) { + + assert(mySession); + unsigned playerUid = treeWidget_connectedPlayers->currentItem()->data(0, Qt::UserRole).toUInt(); + + if(!mySession->getClientPlayerInfo(playerUid).isGuest) { + + //popup a little more to the right to avaoid double click action + QPoint tempPoint = p; + tempPoint.setX(p.x()+5); + connectedPlayersListPlayerInfoSubMenu->popup(treeWidget_connectedPlayers->mapToGlobal(tempPoint)); + } + } +} diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h index 1060ce4f..627894ba 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h @@ -119,6 +119,7 @@ public slots: void registeredUserMode(); void guestUserMode(); void showNickListContextMenu(QPoint); + void showConnectedPlayersContextMenu(QPoint); void invitePlayerToCurrentGame(); void showInfoMsgBox(); void showInvitationDialog(unsigned gameId, unsigned playerIdFrom); @@ -129,6 +130,7 @@ public slots: void searchForPlayerRegExpChanged(); void showAutoStartTimer(); void updateAutoStartTimer(); + void openPlayerStats(); private: @@ -163,7 +165,9 @@ private: QAction *nickListInviteAction; QAction *nickListIgnorePlayerAction; QMenu *nickListPlayerInfoSubMenu; + QMenu *connectedPlayersListPlayerInfoSubMenu; QAction *nickListPlayerInGameInfo; + QAction *nickListOpenPlayerStats; int infoMsgToShowId; int currentInvitationGameId; bool inviteDialogIsCurrentlyShown; diff --git a/src/gui/qt/resources/pokerth.qrc b/src/gui/qt/resources/pokerth.qrc index 63b6fba2..963557d0 100644 --- a/src/gui/qt/resources/pokerth.qrc +++ b/src/gui/qt/resources/pokerth.qrc @@ -52,6 +52,7 @@ emblem-important.png emblem-important-64.png dialog-information.png + view-statistics.png cflags/ad.png diff --git a/src/gui/qt/resources/view-statistics.png b/src/gui/qt/resources/view-statistics.png new file mode 100644 index 0000000000000000000000000000000000000000..5a05fa48df66de304d39d3804991b47ee97e910f GIT binary patch literal 495 zcmVV5RYPi+ulaS zte_KiJZoMciX!xudf*8Mk2$Pg^D*{wHuae@Al88V2E;GG-NixBKHu@62=|wVT>vW? zAT*F@fc^l+FOS~p`X*E&@N{!l$|GlgVT@Am1Y>JxP&({1ACxNP&=r;EdyT zbPH=%RvE>B>gg?za5;q&iDuHogLpuZim>W?d%?xlmX{KtUajU?iBAA%z#x#I9O#ex z7#c%h5m?a6dTunl(%KplDG}7`dDesvpy(A!zCn(rNo{6lm!UMkG!V5~Flx2zF(TK+ zPto`t%m~38Af?>RrlRl#*m_yrQYj$E@fBluaoqreLG}kub~l2nW5)*=`Zvn~(9Qbg lqjF%Lnm#nJ+}8bnuTK`U*?x�oMQk002ovPDHLkV1mwa*^mGL literal 0 HcmV?d00001