GUI preperation for #129
This commit is contained in:
@@ -595,6 +595,9 @@
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
<property name="horizontalScrollBarPolicy">
|
<property name="horizontalScrollBarPolicy">
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -154,6 +154,11 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
|||||||
nickListOpenPlayerStats2 = new QAction(QIcon(":/gfx/view-statistics.png"), tr("Show player stats"), nickListContextMenu);
|
nickListOpenPlayerStats2 = new QAction(QIcon(":/gfx/view-statistics.png"), tr("Show player stats"), nickListContextMenu);
|
||||||
connectedPlayersListPlayerInfoSubMenu->addAction(nickListOpenPlayerStats2);
|
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_CreateGame, SIGNAL( clicked() ), this, SLOT( createGame() ) );
|
||||||
connect( pushButton_JoinGame, SIGNAL( clicked() ), this, SLOT( joinGame() ) );
|
connect( pushButton_JoinGame, SIGNAL( clicked() ), this, SLOT( joinGame() ) );
|
||||||
connect( pushButton_joinAnyGame, SIGNAL( clicked() ), this, SLOT( joinAnyGame() ) );
|
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( 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( 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( nickListInviteAction, SIGNAL(triggered()), this, SLOT( invitePlayerToCurrentGame() ));
|
||||||
connect( nickListIgnorePlayerAction, SIGNAL(triggered()), this, SLOT( putPlayerOnIgnoreList() ));
|
connect( nickListIgnorePlayerAction, SIGNAL(triggered()), this, SLOT( putPlayerOnIgnoreList() ));
|
||||||
connect( nickListOpenPlayerStats1, SIGNAL(triggered()), this, SLOT( openPlayerStats1() ));
|
connect( nickListOpenPlayerStats1, SIGNAL(triggered()), this, SLOT( openPlayerStats1() ));
|
||||||
connect( nickListOpenPlayerStats2, SIGNAL(triggered()), this, SLOT( openPlayerStats2() ));
|
connect( nickListOpenPlayerStats2, SIGNAL(triggered()), this, SLOT( openPlayerStats2() ));
|
||||||
connect( lineEdit_searchForPlayers, SIGNAL(textChanged(QString)),this, SLOT(searchForPlayerRegExpChanged()));
|
connect( lineEdit_searchForPlayers, SIGNAL(textChanged(QString)),this, SLOT(searchForPlayerRegExpChanged()));
|
||||||
|
connect( gameListReportBadGameNameAction, SIGNAL(triggered()), this, SLOT( reportBadGameName()));
|
||||||
|
|
||||||
lineEdit_searchForPlayers->installEventFilter(this);
|
lineEdit_searchForPlayers->installEventFilter(this);
|
||||||
lineEdit_ChatInput->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()
|
void gameLobbyDialogImpl::invitePlayerToCurrentGame()
|
||||||
{
|
{
|
||||||
if(myNickListSelectionModel->currentIndex().isValid()) {
|
if(myNickListSelectionModel->currentIndex().isValid()) {
|
||||||
@@ -2019,3 +2036,20 @@ void gameLobbyDialogImpl::closeAllChildDialogs()
|
|||||||
waitStartGameMsgBox->hide();
|
waitStartGameMsgBox->hide();
|
||||||
waitRejoinStartGameMsgBox->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 registeredUserMode();
|
||||||
void guestUserMode();
|
void guestUserMode();
|
||||||
void showNickListContextMenu(QPoint);
|
void showNickListContextMenu(QPoint);
|
||||||
|
void showGameListContextMenu(QPoint);
|
||||||
void showConnectedPlayersContextMenu(QPoint);
|
void showConnectedPlayersContextMenu(QPoint);
|
||||||
void invitePlayerToCurrentGame();
|
void invitePlayerToCurrentGame();
|
||||||
void showInfoMsgBox();
|
void showInfoMsgBox();
|
||||||
@@ -146,6 +147,7 @@ public slots:
|
|||||||
void openPlayerStats2();
|
void openPlayerStats2();
|
||||||
QString getFullCountryString(QString);
|
QString getFullCountryString(QString);
|
||||||
void closeAllChildDialogs();
|
void closeAllChildDialogs();
|
||||||
|
void reportBadGameName();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -180,6 +182,8 @@ private:
|
|||||||
QStandardItemModel *myGameListModel;
|
QStandardItemModel *myGameListModel;
|
||||||
QItemSelectionModel *myGameListSelectionModel;
|
QItemSelectionModel *myGameListSelectionModel;
|
||||||
MyGameListSortFilterProxyModel *myGameListSortFilterProxyModel;
|
MyGameListSortFilterProxyModel *myGameListSortFilterProxyModel;
|
||||||
|
QMenu *gameListContextMenu;
|
||||||
|
QAction *gameListReportBadGameNameAction;
|
||||||
QMenu *nickListContextMenu;
|
QMenu *nickListContextMenu;
|
||||||
QAction *nickListInviteAction;
|
QAction *nickListInviteAction;
|
||||||
QAction *nickListIgnorePlayerAction;
|
QAction *nickListIgnorePlayerAction;
|
||||||
|
|||||||
@@ -1073,6 +1073,18 @@ void startWindowImpl::networkMessage(unsigned msgId)
|
|||||||
msgText = tr("An error occurred while reporting the avatar.");
|
msgText = tr("An error occurred while reporting the avatar.");
|
||||||
}
|
}
|
||||||
break;
|
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:
|
default:
|
||||||
;
|
;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -157,6 +157,9 @@
|
|||||||
#define MSG_NET_AVATAR_REPORT_ACCEPTED MSG_NET_LIMIT_GAME + 1
|
#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_DUP MSG_NET_LIMIT_GAME + 2
|
||||||
#define MSG_NET_AVATAR_REPORT_REJECTED MSG_NET_LIMIT_GAME + 3
|
#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
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user