implement new "open stats page" context menu (ticket #63)

This commit is contained in:
doitux
2011-03-05 21:20:08 +00:00
parent 5122c26f8a
commit 62da7257d5
6 changed files with 45 additions and 1 deletions
+1 -1
View File
@@ -35,7 +35,7 @@
#define POKERTH_VERSION ((POKERTH_VERSION_MAJOR << 8) | POKERTH_VERSION_MINOR) #define POKERTH_VERSION ((POKERTH_VERSION_MAJOR << 8) | POKERTH_VERSION_MINOR)
#define POKERTH_BETA_REVISION 0 #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_START_CASH 10000
#define RANKING_GAME_NUMBER_OF_PLAYERS 10 #define RANKING_GAME_NUMBER_OF_PLAYERS 10
+3
View File
@@ -144,6 +144,9 @@
<height>237</height> <height>237</height>
</size> </size>
</property> </property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="midLineWidth"> <property name="midLineWidth">
<number>1</number> <number>1</number>
</property> </property>
@@ -125,6 +125,11 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
nickListPlayerInfoSubMenu = nickListContextMenu->addMenu(QIcon(":/gfx/dialog-information.png"), tr("Player infos ...")); nickListPlayerInfoSubMenu = nickListContextMenu->addMenu(QIcon(":/gfx/dialog-information.png"), tr("Player infos ..."));
nickListPlayerInGameInfo = new QAction(nickListContextMenu); nickListPlayerInGameInfo = new QAction(nickListContextMenu);
nickListPlayerInfoSubMenu->addAction(nickListPlayerInGameInfo); 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_CreateGame, SIGNAL( clicked() ), this, SLOT( createGame() ) );
connect( pushButton_JoinGame, SIGNAL( clicked() ), this, SLOT( joinGame() ) ); 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_gameListFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changeGameListFilter(int)));
connect( comboBox_nickListFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changeNickListFilter(int))); connect( comboBox_nickListFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changeNickListFilter(int)));
connect( treeView_NickList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( showNickListContextMenu(QPoint) ) ); 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( nickListInviteAction, SIGNAL(triggered()), this, SLOT( invitePlayerToCurrentGame() ));
connect( nickListIgnorePlayerAction, SIGNAL(triggered()), this, SLOT( putPlayerOnIgnoreList() )); connect( nickListIgnorePlayerAction, SIGNAL(triggered()), this, SLOT( putPlayerOnIgnoreList() ));
connect( nickListOpenPlayerStats, SIGNAL(triggered()), this, SLOT( openPlayerStats() ));
connect( lineEdit_searchForPlayers, SIGNAL(textChanged(QString)),this, SLOT(searchForPlayerRegExpChanged())); connect( lineEdit_searchForPlayers, SIGNAL(textChanged(QString)),this, SLOT(searchForPlayerRegExpChanged()));
lineEdit_searchForPlayers->installEventFilter(this); lineEdit_searchForPlayers->installEventFilter(this);
@@ -1630,3 +1637,32 @@ void gameLobbyDialogImpl::updateAutoStartTimer()
autoStartTimerOverlay->hide(); 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));
}
}
}
@@ -119,6 +119,7 @@ public slots:
void registeredUserMode(); void registeredUserMode();
void guestUserMode(); void guestUserMode();
void showNickListContextMenu(QPoint); void showNickListContextMenu(QPoint);
void showConnectedPlayersContextMenu(QPoint);
void invitePlayerToCurrentGame(); void invitePlayerToCurrentGame();
void showInfoMsgBox(); void showInfoMsgBox();
void showInvitationDialog(unsigned gameId, unsigned playerIdFrom); void showInvitationDialog(unsigned gameId, unsigned playerIdFrom);
@@ -129,6 +130,7 @@ public slots:
void searchForPlayerRegExpChanged(); void searchForPlayerRegExpChanged();
void showAutoStartTimer(); void showAutoStartTimer();
void updateAutoStartTimer(); void updateAutoStartTimer();
void openPlayerStats();
private: private:
@@ -163,7 +165,9 @@ private:
QAction *nickListInviteAction; QAction *nickListInviteAction;
QAction *nickListIgnorePlayerAction; QAction *nickListIgnorePlayerAction;
QMenu *nickListPlayerInfoSubMenu; QMenu *nickListPlayerInfoSubMenu;
QMenu *connectedPlayersListPlayerInfoSubMenu;
QAction *nickListPlayerInGameInfo; QAction *nickListPlayerInGameInfo;
QAction *nickListOpenPlayerStats;
int infoMsgToShowId; int infoMsgToShowId;
int currentInvitationGameId; int currentInvitationGameId;
bool inviteDialogIsCurrentlyShown; bool inviteDialogIsCurrentlyShown;
+1
View File
@@ -52,6 +52,7 @@
<file>emblem-important.png</file> <file>emblem-important.png</file>
<file>emblem-important-64.png</file> <file>emblem-important-64.png</file>
<file>dialog-information.png</file> <file>dialog-information.png</file>
<file>view-statistics.png</file>
</qresource> </qresource>
<qresource prefix="/cflags"> <qresource prefix="/cflags">
<file>cflags/ad.png</file> <file>cflags/ad.png</file>
Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B