GUI: next steps for extended info msg box system, new info msg about intive-only game type handling
This commit is contained in:
@@ -18,9 +18,10 @@
|
||||
#include "configfile.h"
|
||||
#include "gamedata.h"
|
||||
#include <net/socket_msg.h>
|
||||
#include "mymessagedialogimpl.h"
|
||||
|
||||
gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
: 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)
|
||||
: 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), infoMsgToShowId(0)
|
||||
{
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -46,7 +47,9 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
waitStartGameMsgBoxTimer->setSingleShot(TRUE);
|
||||
blinkingButtonAnimationTimer = new QTimer(this);
|
||||
blinkingButtonAnimationTimer->setInterval(1000);
|
||||
|
||||
showInfoMsgBoxTimer = new QTimer(this);
|
||||
showInfoMsgBoxTimer->setSingleShot(TRUE);
|
||||
|
||||
//fetch button colors for blinking
|
||||
groupBox_GameInfo->setEnabled(true);
|
||||
pushButton_StartGame->setEnabled(true);
|
||||
@@ -98,6 +101,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
connect( lineEdit_ChatInput, SIGNAL( textEdited (QString) ), myChat, SLOT( setChatTextEdited() ) );
|
||||
connect( waitStartGameMsgBoxTimer, SIGNAL(timeout()), this, SLOT( showWaitStartGameMsgBox() ));
|
||||
connect( blinkingButtonAnimationTimer, SIGNAL(timeout()), this, SLOT( blinkingStartButtonAnimation() ));
|
||||
connect( showInfoMsgBoxTimer, SIGNAL(timeout()), this, SLOT( showInfoMsgBox() ));
|
||||
connect( comboBox_gameListFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changeGameListFilter(int)));
|
||||
connect( treeWidget_NickList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( showNickListContextMenu(QPoint) ) );
|
||||
connect( nickListInviteAction, SIGNAL(triggered()), this, SLOT( invitePlayerToCurrentGame() ));
|
||||
@@ -746,13 +750,20 @@ void gameLobbyDialogImpl::blinkingStartButtonAnimation() {
|
||||
|
||||
void gameLobbyDialogImpl::joinedNetworkGame(unsigned playerId, QString playerName, bool isGameAdmin) {
|
||||
|
||||
// Update dialog
|
||||
inGame = true;
|
||||
joinedGameDialogUpdate();
|
||||
// Update dialog
|
||||
inGame = true;
|
||||
joinedGameDialogUpdate();
|
||||
|
||||
myPlayerId = playerId;
|
||||
isGameAdministrator = isGameAdmin;
|
||||
addConnectedPlayer(playerId, playerName, isGameAdmin);
|
||||
myPlayerId = playerId;
|
||||
isGameAdministrator = isGameAdmin;
|
||||
addConnectedPlayer(playerId, playerName, isGameAdmin);
|
||||
|
||||
//show msgBox about invite only game
|
||||
assert(mySession);
|
||||
if(mySession->getClientGameInfo(mySession->getClientCurrentGameId()).data.gameType == GAME_TYPE_INVITE_ONLY) {
|
||||
infoMsgToShowId = 2;
|
||||
showInfoMsgBoxTimer->start(1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1314,3 +1325,16 @@ void gameLobbyDialogImpl::invitePlayerToCurrentGame()
|
||||
{
|
||||
qDebug() << "invitePlayer";
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::showInfoMsgBox()
|
||||
{
|
||||
switch(infoMsgToShowId) {
|
||||
case 2: {
|
||||
myMessageDialogImpl dialog(myConfig, this);
|
||||
dialog.exec(2, tr("You've entered a game with invite-only type.\nYou can invite other players with right-click on their nick in the left available players list."), tr("PokerTH - Info Message"), QPixmap(":/gfx/ktip.png"), QDialogButtonBox::Ok);
|
||||
}
|
||||
break;
|
||||
default:;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +104,7 @@ public slots:
|
||||
void guestUserMode();
|
||||
void showNickListContextMenu(QPoint);
|
||||
void invitePlayerToCurrentGame();
|
||||
void showInfoMsgBox();
|
||||
|
||||
private:
|
||||
|
||||
@@ -123,6 +124,7 @@ private:
|
||||
QMessageBox *waitStartGameMsgBox;
|
||||
QTimer *waitStartGameMsgBoxTimer;
|
||||
QTimer *blinkingButtonAnimationTimer;
|
||||
QTimer *showInfoMsgBoxTimer;
|
||||
bool blinkingButtonAnimationState;
|
||||
QColor defaultStartButtonColor;
|
||||
QColor defaultStartButtonTextColor;
|
||||
@@ -135,6 +137,7 @@ private:
|
||||
MyGameListSortFilterProxyModel *myGameListSortFilterProxyModel;
|
||||
QMenu *nickListContextMenu;
|
||||
QAction *nickListInviteAction;
|
||||
int infoMsgToShowId;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@@ -3075,7 +3075,7 @@ void gameTableImpl::leaveCurrentNetworkGame() {
|
||||
myStartWindow->getSession()->sendLeaveCurrentGame();
|
||||
}
|
||||
else {
|
||||
if (dialog.exec(1, tr("Attention! Do you really want to leave the current game\nand go back to the lobby?"), "PokerTH - Internet Game Message", QPixmap(":/gfx/logoChip3D.png")) == QDialog::Accepted ) {
|
||||
if (dialog.exec(1, tr("Attention! Do you really want to leave the current game\nand go back to the lobby?"), tr("PokerTH - Internet Game Message"), QPixmap(":/gfx/logoChip3D.png"), QDialogButtonBox::Ok) == QDialog::Accepted ) {
|
||||
assert(myStartWindow->getSession());
|
||||
myStartWindow->getSession()->sendLeaveCurrentGame();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ myMessageDialogImpl::myMessageDialogImpl(ConfigFile *c, QWidget *parent)
|
||||
setupUi(this);
|
||||
}
|
||||
|
||||
int myMessageDialogImpl::exec(int messageId, QString msg, QString title, QPixmap pix)
|
||||
int myMessageDialogImpl::exec(int messageId, QString msg, QString title, QPixmap pix, QDialogButtonBox::StandardButtons buttons)
|
||||
{
|
||||
bool show = false;
|
||||
bool found = false;
|
||||
@@ -71,6 +71,7 @@ int myMessageDialogImpl::exec(int messageId, QString msg, QString title, QPixmap
|
||||
setWindowTitle(title);
|
||||
label_icon->setPixmap(pix.scaled(50,50,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
label->setText(msg);
|
||||
buttonBox->setStandardButtons(buttons);
|
||||
|
||||
return QDialog::exec();
|
||||
}
|
||||
@@ -92,7 +93,6 @@ void myMessageDialogImpl::reject()
|
||||
|
||||
void myMessageDialogImpl::writeConfig()
|
||||
{
|
||||
qDebug() << "jo1";
|
||||
if(checkBox->isChecked()) {
|
||||
|
||||
list<std::string>::iterator it1;
|
||||
@@ -101,7 +101,6 @@ void myMessageDialogImpl::writeConfig()
|
||||
QString tmpString = QString::fromUtf8(it1->c_str());
|
||||
if(QString("%1").arg(currentMsgId) == tmpString.split(",").at(1)) {
|
||||
|
||||
qDebug() << "jo2" << QString("0,%1").arg(currentMsgId).toUtf8().constData();
|
||||
(*it1) = QString("0,%1").arg(currentMsgId).toUtf8().constData();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
public slots:
|
||||
|
||||
bool checkIfMesssageWillBeDisplayed(int id);
|
||||
int exec(int messageId, QString msg, QString title, QPixmap pix);
|
||||
int exec(int messageId, QString msg, QString title, QPixmap pix, QDialogButtonBox::StandardButtons buttons);
|
||||
void accept();
|
||||
void reject();
|
||||
void writeConfig();
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
@@ -41,6 +41,7 @@
|
||||
<file>transform-rotate.png</file>
|
||||
<file>player_play.png</file>
|
||||
<file>logoChip3D.png</file>
|
||||
<file>ktip.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/cflags">
|
||||
<file>cflags/ad.png</file>
|
||||
|
||||
Reference in New Issue
Block a user