bugfix for "Show player stats" item doesn't work in game info field

(#100)
This commit is contained in:
doitux
2012-01-11 21:38:42 +00:00
parent a72c212972
commit 8dacafa498
2 changed files with 23 additions and 7 deletions
@@ -143,11 +143,12 @@ 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);
nickListOpenPlayerStats1 = new QAction(QIcon(":/gfx/view-statistics.png"), tr("Show player stats"), nickListContextMenu);
nickListContextMenu->addAction(nickListOpenPlayerStats1);
connectedPlayersListPlayerInfoSubMenu = new QMenu();
connectedPlayersListPlayerInfoSubMenu->addAction(nickListOpenPlayerStats);
nickListOpenPlayerStats2 = new QAction(QIcon(":/gfx/view-statistics.png"), tr("Show player stats"), nickListContextMenu);
connectedPlayersListPlayerInfoSubMenu->addAction(nickListOpenPlayerStats2);
connect( pushButton_CreateGame, SIGNAL( clicked() ), this, SLOT( createGame() ) );
connect( pushButton_JoinGame, SIGNAL( clicked() ), this, SLOT( joinGame() ) );
@@ -172,7 +173,8 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
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( nickListOpenPlayerStats1, SIGNAL(triggered()), this, SLOT( openPlayerStats1() ));
connect( nickListOpenPlayerStats2, SIGNAL(triggered()), this, SLOT( openPlayerStats2() ));
connect( lineEdit_searchForPlayers, SIGNAL(textChanged(QString)),this, SLOT(searchForPlayerRegExpChanged()));
lineEdit_searchForPlayers->installEventFilter(this);
@@ -1689,7 +1691,7 @@ void gameLobbyDialogImpl::updateAutoStartTimer()
}
}
void gameLobbyDialogImpl::openPlayerStats()
void gameLobbyDialogImpl::openPlayerStats1()
{
if(myNickListSelectionModel->currentIndex().isValid()) {
@@ -1701,6 +1703,18 @@ void gameLobbyDialogImpl::openPlayerStats()
}
}
void gameLobbyDialogImpl::openPlayerStats2()
{
if(treeWidget_connectedPlayers->currentItem()) {
unsigned playerId = treeWidget_connectedPlayers->currentItem()->data(0, Qt::UserRole).toUInt();
if(!mySession->getClientPlayerInfo(playerId).isGuest) {
QUrl url("http://pokerth.net/redirect_user_profile.php?nick="+QUrl::toPercentEncoding(treeWidget_connectedPlayers->currentItem()->data(0, Qt::DisplayRole).toString()));
QDesktopServices::openUrl(url);
}
}
}
void gameLobbyDialogImpl::showConnectedPlayersContextMenu(QPoint p)
{
if(treeWidget_connectedPlayers->currentItem()) {
@@ -138,7 +138,8 @@ public slots:
void searchForPlayerRegExpChanged();
void showAutoStartTimer();
void updateAutoStartTimer();
void openPlayerStats();
void openPlayerStats1();
void openPlayerStats2();
QString getFullCountryString(QString);
void closeAllChildDialogs();
@@ -181,7 +182,8 @@ private:
QMenu *nickListPlayerInfoSubMenu;
QMenu *connectedPlayersListPlayerInfoSubMenu;
QAction *nickListPlayerInGameInfo;
QAction *nickListOpenPlayerStats;
QAction *nickListOpenPlayerStats1;
QAction *nickListOpenPlayerStats2;
int infoMsgToShowId;
int currentInvitationGameId;
bool inviteDialogIsCurrentlyShown;