GUI: next steps advanced game infos in lobby, signals changed
This commit is contained in:
@@ -131,8 +131,8 @@ void ServerGuiWrapper::SignalNetClientNotification(int notificationId) { if (myC
|
||||
void ServerGuiWrapper::SignalNetClientStatsUpdate(const ServerStats &stats) { if (myClientcb) myClientcb->SignalNetClientStatsUpdate(stats); }
|
||||
void ServerGuiWrapper::SignalNetClientShowTimeoutDialog(NetTimeoutReason reason, unsigned remainingSec) { if (myClientcb) myClientcb->SignalNetClientShowTimeoutDialog(reason, remainingSec); }
|
||||
void ServerGuiWrapper::SignalNetClientRemovedFromGame(int notificationId) { if (myClientcb) myClientcb->SignalNetClientRemovedFromGame(notificationId); }
|
||||
void ServerGuiWrapper::SignalNetClientSelfJoined(unsigned playerId, const string &playerName, PlayerRights rights) { if (myClientcb) myClientcb->SignalNetClientSelfJoined(playerId, playerName, rights); }
|
||||
void ServerGuiWrapper::SignalNetClientPlayerJoined(unsigned playerId, const string &playerName, PlayerRights rights) { if (myClientcb) myClientcb->SignalNetClientPlayerJoined(playerId, playerName, rights); }
|
||||
void ServerGuiWrapper::SignalNetClientSelfJoined(unsigned playerId, const string &playerName, bool isGameAdmin) { if (myClientcb) myClientcb->SignalNetClientSelfJoined(playerId, playerName, isGameAdmin); }
|
||||
void ServerGuiWrapper::SignalNetClientPlayerJoined(unsigned playerId, const string &playerName, bool isGameAdmin) { if (myClientcb) myClientcb->SignalNetClientPlayerJoined(playerId, playerName, isGameAdmin); }
|
||||
void ServerGuiWrapper::SignalNetClientPlayerChanged(unsigned playerId, const string &newPlayerName) { if (myClientcb) myClientcb->SignalNetClientPlayerChanged(playerId, newPlayerName); }
|
||||
void ServerGuiWrapper::SignalNetClientPlayerLeft(unsigned playerId, const string &playerName, int removeReason) { if (myClientcb) myClientcb->SignalNetClientPlayerLeft(playerId, playerName, removeReason); }
|
||||
void ServerGuiWrapper::SignalNetClientNewGameAdmin(unsigned playerId, const string &playerName) { if (myClientcb) myClientcb->SignalNetClientNewGameAdmin(playerId, playerName); }
|
||||
|
||||
@@ -111,8 +111,8 @@ public:
|
||||
void SignalNetClientStatsUpdate(const ServerStats &stats);
|
||||
void SignalNetClientShowTimeoutDialog(NetTimeoutReason reason, unsigned remainingSec);
|
||||
void SignalNetClientRemovedFromGame(int notificationId);
|
||||
void SignalNetClientSelfJoined(unsigned playerId, const std::string &playerName, PlayerRights rights);
|
||||
void SignalNetClientPlayerJoined(unsigned playerId, const std::string &playerName, PlayerRights rights);
|
||||
void SignalNetClientSelfJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin);
|
||||
void SignalNetClientPlayerJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin);
|
||||
void SignalNetClientPlayerChanged(unsigned playerId, const std::string &newPlayerName);
|
||||
void SignalNetClientPlayerLeft(unsigned playerId, const std::string &playerName, int removeReason);
|
||||
void SignalNetClientNewGameAdmin(unsigned playerId, const std::string &playerName);
|
||||
|
||||
@@ -317,7 +317,7 @@ p, li { white-space: pre-wrap; }
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="label_gameType">
|
||||
<property name="text">
|
||||
<string>Game type:</string>
|
||||
</property>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <net/socket_msg.h>
|
||||
|
||||
gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
: QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), currentGameName(""), myPlayerId(0), myCurrentGameId(0), isAdmin(false), inGame(false), guestMode(false), blinkingButtonAnimationState(true), myChat(NULL), keyUpCounter(0)
|
||||
: QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), currentGameName(""), myPlayerId(0), myCurrentGameId(0), isGameAdministrator(false), inGame(false), guestMode(false), blinkingButtonAnimationState(true), myChat(NULL), keyUpCounter(0)
|
||||
{
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -195,7 +195,30 @@ void gameLobbyDialogImpl::createGame()
|
||||
|
||||
currentGameName = myCreateInternetGameDialog->lineEdit_gameName->text();
|
||||
|
||||
hideShowGameDescription(TRUE);
|
||||
switch (gameData.gameType) {
|
||||
case GAME_TYPE_NORMAL: {
|
||||
label_typeIcon->setPixmap(QPixmap(":/gfx/player_play.png"));
|
||||
label_typeText->setText(tr("Standard"));
|
||||
}
|
||||
break;
|
||||
case GAME_TYPE_REGISTERED_ONLY: {
|
||||
label_typeIcon->setPixmap(QPixmap(":/gfx/registered.png"));
|
||||
label_typeText->setText(tr("Registered players only"));
|
||||
}
|
||||
break;
|
||||
case GAME_TYPE_INVITE_ONLY: {
|
||||
label_typeIcon->setPixmap(QPixmap(":/gfx/list_add_user.png"));
|
||||
label_typeText->setText(tr("Invited players only"));
|
||||
}
|
||||
break;
|
||||
case GAME_TYPE_RANKING: {
|
||||
label_typeIcon->setPixmap(QPixmap(":/gfx/cup.png"));
|
||||
label_typeText->setText(tr("Ranking game"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
hideShowGameDescription(TRUE);
|
||||
|
||||
label_SmallBlind->setText(QString("%L1").arg(gameData.firstSmallBlind));
|
||||
label_StartCash->setText(QString("%L1").arg(gameData.startMoney));
|
||||
@@ -208,6 +231,8 @@ void gameLobbyDialogImpl::createGame()
|
||||
|
||||
label_TimeoutForPlayerAction->setText(QString::number(gameData.playerActionTimeoutSec));
|
||||
|
||||
|
||||
|
||||
mySession->clientCreateGame(gameData, currentGameName.toUtf8().constData(), myCreateInternetGameDialog->lineEdit_Password->text().toUtf8().constData());
|
||||
|
||||
}
|
||||
@@ -294,7 +319,7 @@ void gameLobbyDialogImpl::refresh(int actionID) {
|
||||
void gameLobbyDialogImpl::removedFromGame(int /*reason*/)
|
||||
{
|
||||
inGame = false;
|
||||
isAdmin = false;
|
||||
isGameAdministrator = false;
|
||||
leftGameDialogUpdate();
|
||||
}
|
||||
|
||||
@@ -313,6 +338,29 @@ void gameLobbyDialogImpl::gameSelected(const QModelIndex &index, const QModelInd
|
||||
assert(mySession);
|
||||
GameInfo info(mySession->getClientGameInfo(myGameListModel->item(myGameListSortFilterProxyModel->mapToSource(index).row(), 0)->data(Qt::UserRole).toUInt()));
|
||||
|
||||
switch (info.data.gameType) {
|
||||
case GAME_TYPE_NORMAL: {
|
||||
label_typeIcon->setPixmap(QPixmap(":/gfx/player_play.png"));
|
||||
label_typeText->setText(tr("Standard"));
|
||||
}
|
||||
break;
|
||||
case GAME_TYPE_REGISTERED_ONLY: {
|
||||
label_typeIcon->setPixmap(QPixmap(":/gfx/registered.png"));
|
||||
label_typeText->setText(tr("Registered players only"));
|
||||
}
|
||||
break;
|
||||
case GAME_TYPE_INVITE_ONLY: {
|
||||
label_typeIcon->setPixmap(QPixmap(":/gfx/list_add_user.png"));
|
||||
label_typeText->setText(tr("Invited players only"));
|
||||
}
|
||||
break;
|
||||
case GAME_TYPE_RANKING: {
|
||||
label_typeIcon->setPixmap(QPixmap(":/gfx/cup.png"));
|
||||
label_typeText->setText(tr("Ranking game"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
hideShowGameDescription(TRUE);
|
||||
label_SmallBlind->setText(QString("%L1").arg(info.data.firstSmallBlind));
|
||||
label_StartCash->setText(QString("%L1").arg(info.data.startMoney));
|
||||
@@ -583,6 +631,8 @@ void gameLobbyDialogImpl::clearDialog()
|
||||
header->setData(0, Qt::UserRole, 0);
|
||||
|
||||
hideShowGameDescription(FALSE);
|
||||
label_typeIcon->setText(" ");
|
||||
label_typeText->setText(" ");
|
||||
label_SmallBlind->setText("");
|
||||
label_StartCash->setText("");
|
||||
label_blindsRaiseIntervall->setText("");
|
||||
@@ -622,7 +672,7 @@ void gameLobbyDialogImpl::clearDialog()
|
||||
myChat->clearChat();
|
||||
treeWidget_NickList->clear();
|
||||
inGame = false;
|
||||
isAdmin = false;
|
||||
isGameAdministrator = false;
|
||||
myPlayerId = 0;
|
||||
|
||||
hideShowGameDescription(FALSE);
|
||||
@@ -637,7 +687,7 @@ void gameLobbyDialogImpl::clearDialog()
|
||||
|
||||
void gameLobbyDialogImpl::checkPlayerQuantity() {
|
||||
|
||||
if(isAdmin){
|
||||
if(isGameAdministrator){
|
||||
pushButton_Kick->show();
|
||||
pushButton_StartGame->show();
|
||||
checkBox_fillUpWithComputerOpponents->show();
|
||||
@@ -690,25 +740,25 @@ void gameLobbyDialogImpl::blinkingStartButtonAnimation() {
|
||||
}
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::joinedNetworkGame(unsigned playerId, QString playerName, int rights) {
|
||||
void gameLobbyDialogImpl::joinedNetworkGame(unsigned playerId, QString playerName, bool isGameAdmin) {
|
||||
|
||||
// Update dialog
|
||||
inGame = true;
|
||||
joinedGameDialogUpdate();
|
||||
|
||||
myPlayerId = playerId;
|
||||
isAdmin = rights == PLAYER_RIGHTS_ADMIN;
|
||||
addConnectedPlayer(playerId, playerName, rights);
|
||||
isGameAdministrator = isGameAdmin;
|
||||
addConnectedPlayer(playerId, playerName, isGameAdmin);
|
||||
}
|
||||
|
||||
|
||||
void gameLobbyDialogImpl::addConnectedPlayer(unsigned playerId, QString playerName, int rights) {
|
||||
void gameLobbyDialogImpl::addConnectedPlayer(unsigned playerId, QString playerName, bool isGameAdmin) {
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget_connectedPlayers, 0);
|
||||
item->setData(0, Qt::UserRole, playerId);
|
||||
item->setData(0, Qt::DisplayRole, playerName);
|
||||
|
||||
if(rights == PLAYER_RIGHTS_ADMIN) item->setBackground(0, QBrush(QColor(0, 255, 0, 127)));
|
||||
if(isGameAdmin) item->setBackground(0, QBrush(QColor(0, 255, 0, 127)));
|
||||
|
||||
if(this->isVisible() && inGame && myConfig->readConfigInt("PlayNetworkGameNotification")) {
|
||||
if(treeWidget_connectedPlayers->topLevelItemCount() < treeWidget_connectedPlayers->headerItem()->data(0, Qt::UserRole).toInt()) {
|
||||
@@ -822,7 +872,7 @@ void gameLobbyDialogImpl::newGameAdmin(unsigned playerId, QString)
|
||||
|
||||
if (inGame && myPlayerId == playerId)
|
||||
{
|
||||
isAdmin = true;
|
||||
isGameAdministrator = true;
|
||||
checkPlayerQuantity();
|
||||
}
|
||||
}
|
||||
@@ -875,7 +925,9 @@ void gameLobbyDialogImpl::leftGameDialogUpdate() {
|
||||
header->setText(0, tr("Connected players"));
|
||||
header->setData(0, Qt::UserRole, 0);
|
||||
|
||||
hideShowGameDescription(FALSE);
|
||||
hideShowGameDescription(FALSE);
|
||||
label_typeIcon->setText(" ");
|
||||
label_typeText->setText(" ");
|
||||
label_SmallBlind->setText("");
|
||||
label_StartCash->setText("");
|
||||
label_blindsRaiseIntervall->setText("");
|
||||
@@ -925,7 +977,7 @@ void gameLobbyDialogImpl::updateDialogBlinds(const GameData &gameData) {
|
||||
void gameLobbyDialogImpl::playerSelected(QTreeWidgetItem* item, QTreeWidgetItem*) {
|
||||
|
||||
if (item)
|
||||
pushButton_Kick->setEnabled(isAdmin);
|
||||
pushButton_Kick->setEnabled(isGameAdministrator);
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::startGame() {
|
||||
@@ -1007,6 +1059,7 @@ bool gameLobbyDialogImpl::event ( QEvent * event ) {
|
||||
void gameLobbyDialogImpl::hideShowGameDescription(bool show) {
|
||||
|
||||
if(show) {
|
||||
label_gameType->show();
|
||||
label_gameDesc2->show();
|
||||
label_gameDesc3->show();
|
||||
label_gameDesc4->show();
|
||||
@@ -1015,6 +1068,7 @@ void gameLobbyDialogImpl::hideShowGameDescription(bool show) {
|
||||
label_gameDesc7->show();
|
||||
}
|
||||
else {
|
||||
label_gameType->show();
|
||||
label_gameDesc2->hide();
|
||||
label_gameDesc3->hide();
|
||||
label_gameDesc4->hide();
|
||||
|
||||
@@ -81,8 +81,8 @@ public slots:
|
||||
void checkPlayerQuantity();
|
||||
void blinkingStartButtonAnimation();
|
||||
|
||||
void joinedNetworkGame(unsigned, QString, int);
|
||||
void addConnectedPlayer(unsigned, QString, int);
|
||||
void joinedNetworkGame(unsigned, QString, bool);
|
||||
void addConnectedPlayer(unsigned, QString, bool);
|
||||
void updatePlayer(unsigned, QString);
|
||||
void removePlayer(unsigned, QString);
|
||||
void newGameAdmin(unsigned, QString);
|
||||
@@ -128,7 +128,7 @@ private:
|
||||
QString currentGameName;
|
||||
unsigned myPlayerId;
|
||||
unsigned myCurrentGameId;
|
||||
bool isAdmin;
|
||||
bool isGameAdministrator;
|
||||
bool inGame;
|
||||
bool guestMode;
|
||||
|
||||
|
||||
@@ -134,8 +134,8 @@ void GuiWrapper::SignalNetClientNotification(int notificationId) { myStartWindow
|
||||
void GuiWrapper::SignalNetClientStatsUpdate(const ServerStats &stats) { myStartWindow->signalNetClientStatsUpdate(stats); }
|
||||
void GuiWrapper::SignalNetClientShowTimeoutDialog(NetTimeoutReason reason, unsigned remainingSec) { myStartWindow->signalNetClientShowTimeoutDialog(reason, remainingSec); }
|
||||
void GuiWrapper::SignalNetClientRemovedFromGame(int notificationId) { myStartWindow->signalNetClientRemovedFromGame(notificationId); }
|
||||
void GuiWrapper::SignalNetClientSelfJoined(unsigned playerId, const string &playerName, PlayerRights rights) { myStartWindow->signalNetClientSelfJoined(playerId, QString::fromUtf8(playerName.c_str()), rights); }
|
||||
void GuiWrapper::SignalNetClientPlayerJoined(unsigned playerId, const string &playerName, PlayerRights rights) { myStartWindow->signalNetClientPlayerJoined(playerId, QString::fromUtf8(playerName.c_str()), rights); }
|
||||
void GuiWrapper::SignalNetClientSelfJoined(unsigned playerId, const string &playerName, bool isGameAdmin) { myStartWindow->signalNetClientSelfJoined(playerId, QString::fromUtf8(playerName.c_str()), isGameAdmin); }
|
||||
void GuiWrapper::SignalNetClientPlayerJoined(unsigned playerId, const string &playerName, bool isGameAdmin) { myStartWindow->signalNetClientPlayerJoined(playerId, QString::fromUtf8(playerName.c_str()), isGameAdmin); }
|
||||
void GuiWrapper::SignalNetClientPlayerChanged(unsigned playerId, const string &newPlayerName)
|
||||
{
|
||||
myStartWindow->signalNetClientPlayerChanged(playerId, QString::fromUtf8(newPlayerName.c_str()));
|
||||
|
||||
@@ -122,8 +122,8 @@ public:
|
||||
void SignalNetClientStatsUpdate(const ServerStats &stats);
|
||||
void SignalNetClientShowTimeoutDialog(NetTimeoutReason reason, unsigned remainingSec);
|
||||
void SignalNetClientRemovedFromGame(int notificationId);
|
||||
void SignalNetClientSelfJoined(unsigned playerId, const std::string &playerName, PlayerRights rights);
|
||||
void SignalNetClientPlayerJoined(unsigned playerId, const std::string &playerName, PlayerRights rights);
|
||||
void SignalNetClientSelfJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin);
|
||||
void SignalNetClientPlayerJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin);
|
||||
void SignalNetClientPlayerChanged(unsigned playerId, const std::string &newPlayerName);
|
||||
void SignalNetClientPlayerLeft(unsigned playerId, const std::string &playerName, int removeReason);
|
||||
void SignalNetClientNewGameAdmin(unsigned playerId, const std::string &playerName);
|
||||
|
||||
@@ -70,14 +70,14 @@ void startNetworkGameDialogImpl::refresh(int actionID) {
|
||||
}
|
||||
}
|
||||
|
||||
void startNetworkGameDialogImpl::joinedNetworkGame(unsigned playerId, QString playerName, int rights) {
|
||||
void startNetworkGameDialogImpl::joinedNetworkGame(unsigned playerId, QString playerName, bool admin) {
|
||||
|
||||
myPlayerId = playerId;
|
||||
isAdmin = rights == PLAYER_RIGHTS_ADMIN;
|
||||
addConnectedPlayer(playerId, playerName, rights);
|
||||
isAdmin = admin;
|
||||
addConnectedPlayer(playerId, playerName, admin);
|
||||
}
|
||||
|
||||
void startNetworkGameDialogImpl::addConnectedPlayer(unsigned playerId, QString playerName, int /*rights*/) {
|
||||
void startNetworkGameDialogImpl::addConnectedPlayer(unsigned playerId, QString playerName, bool) {
|
||||
|
||||
// TODO mark admin
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget, 0);
|
||||
|
||||
@@ -49,8 +49,8 @@ public slots:
|
||||
void refresh(int actionID);
|
||||
void accept();
|
||||
void reject();
|
||||
void joinedNetworkGame(unsigned playerId, QString playerName, int rights);
|
||||
void addConnectedPlayer(unsigned playerId, QString playerName, int rights);
|
||||
void joinedNetworkGame(unsigned playerId, QString playerName, bool admin);
|
||||
void addConnectedPlayer(unsigned playerId, QString playerName, bool admin);
|
||||
void updatePlayer(unsigned playerId, QString newPlayerName);
|
||||
void removePlayer(unsigned playerId, QString playerName);
|
||||
void newGameAdmin(unsigned playerId, QString playerName);
|
||||
@@ -77,7 +77,7 @@ private:
|
||||
int maxPlayerNumber;
|
||||
int keyUpDownChatCounter;
|
||||
unsigned myPlayerId;
|
||||
bool isAdmin;
|
||||
bool isAdmin;
|
||||
ConfigFile *myConfig;
|
||||
boost::shared_ptr<Session> mySession;
|
||||
ChatTools *myChat;
|
||||
|
||||
@@ -128,8 +128,8 @@ startWindowImpl::startWindowImpl(ConfigFile *c)
|
||||
connect(this, SIGNAL(signalNetClientNewGameAdmin(unsigned, QString)), myStartNetworkGameDialog, SLOT(newGameAdmin(unsigned, QString)));
|
||||
connect(this, SIGNAL(signalNetClientGameListNew(unsigned)), myStartNetworkGameDialog, SLOT(gameCreated(unsigned)));
|
||||
|
||||
connect(this, SIGNAL(signalNetClientSelfJoined(unsigned, QString, int)), myGameLobbyDialog, SLOT(joinedNetworkGame(unsigned, QString, int)));
|
||||
connect(this, SIGNAL(signalNetClientPlayerJoined(unsigned, QString, int)), myGameLobbyDialog, SLOT(addConnectedPlayer(unsigned, QString, int)));
|
||||
connect(this, SIGNAL(signalNetClientSelfJoined(unsigned, QString, bool)), myGameLobbyDialog, SLOT(joinedNetworkGame(unsigned, QString, bool)));
|
||||
connect(this, SIGNAL(signalNetClientPlayerJoined(unsigned, QString, bool)), myGameLobbyDialog, SLOT(addConnectedPlayer(unsigned, QString, bool)));
|
||||
connect(this, SIGNAL(signalNetClientPlayerChanged(unsigned, QString)), myGameLobbyDialog, SLOT(updatePlayer(unsigned, QString)));
|
||||
connect(this, SIGNAL(signalNetClientPlayerLeft(unsigned, QString)), myGameLobbyDialog, SLOT(removePlayer(unsigned, QString)));
|
||||
connect(this, SIGNAL(signalNetClientNewGameAdmin(unsigned, QString)), myGameLobbyDialog, SLOT(newGameAdmin(unsigned, QString)));
|
||||
|
||||
Reference in New Issue
Block a user