GUI preperation for #129
This commit is contained in:
@@ -595,6 +595,9 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
|
||||
@@ -154,6 +154,11 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
nickListOpenPlayerStats2 = new QAction(QIcon(":/gfx/view-statistics.png"), tr("Show player stats"), nickListContextMenu);
|
||||
connectedPlayersListPlayerInfoSubMenu->addAction(nickListOpenPlayerStats2);
|
||||
|
||||
gameListContextMenu = new QMenu();
|
||||
gameListReportBadGameNameAction = new QAction(QIcon(":/gfx/emblem-important.png"), tr("Report inappropriate game name"), gameListContextMenu);
|
||||
gameListContextMenu->addAction(gameListReportBadGameNameAction);
|
||||
|
||||
|
||||
connect( pushButton_CreateGame, SIGNAL( clicked() ), this, SLOT( createGame() ) );
|
||||
connect( pushButton_JoinGame, SIGNAL( clicked() ), this, SLOT( joinGame() ) );
|
||||
connect( pushButton_joinAnyGame, SIGNAL( clicked() ), this, SLOT( joinAnyGame() ) );
|
||||
@@ -175,11 +180,13 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
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( treeView_GameList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( showGameListContextMenu(QPoint) ) );
|
||||
connect( nickListInviteAction, SIGNAL(triggered()), this, SLOT( invitePlayerToCurrentGame() ));
|
||||
connect( nickListIgnorePlayerAction, SIGNAL(triggered()), this, SLOT( putPlayerOnIgnoreList() ));
|
||||
connect( nickListOpenPlayerStats1, SIGNAL(triggered()), this, SLOT( openPlayerStats1() ));
|
||||
connect( nickListOpenPlayerStats2, SIGNAL(triggered()), this, SLOT( openPlayerStats2() ));
|
||||
connect( lineEdit_searchForPlayers, SIGNAL(textChanged(QString)),this, SLOT(searchForPlayerRegExpChanged()));
|
||||
connect( gameListReportBadGameNameAction, SIGNAL(triggered()), this, SLOT( reportBadGameName()));
|
||||
|
||||
lineEdit_searchForPlayers->installEventFilter(this);
|
||||
lineEdit_ChatInput->installEventFilter(this);
|
||||
@@ -1579,6 +1586,16 @@ void gameLobbyDialogImpl::showNickListContextMenu(QPoint p)
|
||||
}
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::showGameListContextMenu(QPoint p)
|
||||
{
|
||||
if(myGameListModel->rowCount() && myGameListSelectionModel->currentIndex().isValid()) {
|
||||
//popup a little more to the right to avaoid double click action
|
||||
QPoint tempPoint = p;
|
||||
tempPoint.setX(p.x()+5);
|
||||
gameListContextMenu->popup(treeView_GameList->mapToGlobal(tempPoint));
|
||||
}
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::invitePlayerToCurrentGame()
|
||||
{
|
||||
if(myNickListSelectionModel->currentIndex().isValid()) {
|
||||
@@ -2019,3 +2036,20 @@ void gameLobbyDialogImpl::closeAllChildDialogs()
|
||||
waitStartGameMsgBox->hide();
|
||||
waitRejoinStartGameMsgBox->hide();
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::reportBadGameName()
|
||||
{
|
||||
assert(mySession);
|
||||
QItemSelectionModel *selection = treeView_GameList->selectionModel();
|
||||
if (!inGame && selection->hasSelection()) {
|
||||
unsigned gameId = selection->selectedRows().first().data(Qt::UserRole).toUInt();
|
||||
GameInfo info(mySession->getClientGameInfo(gameId));
|
||||
|
||||
int ret = QMessageBox::question(this, tr("PokerTH - Question"),
|
||||
tr("Are you sure you want to report the game name:\n\"%1\" as inappropriate?").arg(QString::fromUtf8(info.name.c_str())), QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if(ret == QMessageBox::Yes) {
|
||||
// mySession->reportBadGameName(gameId); TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,6 +131,7 @@ public slots:
|
||||
void registeredUserMode();
|
||||
void guestUserMode();
|
||||
void showNickListContextMenu(QPoint);
|
||||
void showGameListContextMenu(QPoint);
|
||||
void showConnectedPlayersContextMenu(QPoint);
|
||||
void invitePlayerToCurrentGame();
|
||||
void showInfoMsgBox();
|
||||
@@ -146,6 +147,7 @@ public slots:
|
||||
void openPlayerStats2();
|
||||
QString getFullCountryString(QString);
|
||||
void closeAllChildDialogs();
|
||||
void reportBadGameName();
|
||||
|
||||
private:
|
||||
|
||||
@@ -180,6 +182,8 @@ private:
|
||||
QStandardItemModel *myGameListModel;
|
||||
QItemSelectionModel *myGameListSelectionModel;
|
||||
MyGameListSortFilterProxyModel *myGameListSortFilterProxyModel;
|
||||
QMenu *gameListContextMenu;
|
||||
QAction *gameListReportBadGameNameAction;
|
||||
QMenu *nickListContextMenu;
|
||||
QAction *nickListInviteAction;
|
||||
QAction *nickListIgnorePlayerAction;
|
||||
|
||||
@@ -1073,6 +1073,18 @@ void startWindowImpl::networkMessage(unsigned msgId)
|
||||
msgText = tr("An error occurred while reporting the avatar.");
|
||||
}
|
||||
break;
|
||||
case MSG_NET_GAMENAME_REPORT_ACCEPTED: {
|
||||
msgText = tr("The game name report was accepted by the server. Thank you.");
|
||||
}
|
||||
break;
|
||||
case MSG_NET_GAMENAME_REPORT_DUP: {
|
||||
msgText = tr("This game name was already reported by another player.");
|
||||
}
|
||||
break;
|
||||
case MSG_NET_GAMENAME_REPORT_REJECTED: {
|
||||
msgText = tr("An error occurred while reporting the game name.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
;
|
||||
break;
|
||||
|
||||
@@ -157,6 +157,9 @@
|
||||
#define MSG_NET_AVATAR_REPORT_ACCEPTED MSG_NET_LIMIT_GAME + 1
|
||||
#define MSG_NET_AVATAR_REPORT_DUP MSG_NET_LIMIT_GAME + 2
|
||||
#define MSG_NET_AVATAR_REPORT_REJECTED MSG_NET_LIMIT_GAME + 3
|
||||
#define MSG_NET_GAMENAME_REPORT_ACCEPTED MSG_NET_LIMIT_GAME + 4
|
||||
#define MSG_NET_GAMENAME_REPORT_DUP MSG_NET_LIMIT_GAME + 5
|
||||
#define MSG_NET_GAMENAME_REPORT_REJECTED MSG_NET_LIMIT_GAME + 6
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user