GUI: next steps invitation system
This commit is contained in:
@@ -151,6 +151,11 @@ public:
|
|||||||
void SignalLobbyPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason);
|
void SignalLobbyPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason);
|
||||||
void SignalLobbyPlayerLeft(unsigned playerId);
|
void SignalLobbyPlayerLeft(unsigned playerId);
|
||||||
|
|
||||||
|
void SignalSelfGameInvitation(unsigned gameId, unsigned playerIdFrom);
|
||||||
|
void SignalPlayerGameInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom);
|
||||||
|
void SignalRejectedGameInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
boost::shared_ptr<Session> mySession;
|
boost::shared_ptr<Session> mySession;
|
||||||
|
|||||||
@@ -17,11 +17,12 @@
|
|||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
#include "gamedata.h"
|
#include "gamedata.h"
|
||||||
|
#include "game_defs.h"
|
||||||
#include <net/socket_msg.h>
|
#include <net/socket_msg.h>
|
||||||
#include "mymessagedialogimpl.h"
|
#include "mymessagedialogimpl.h"
|
||||||
|
|
||||||
gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
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), infoMsgToShowId(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), currentInvitationGameId(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
@@ -1030,7 +1031,7 @@ void gameLobbyDialogImpl::kickPlayer() {
|
|||||||
|
|
||||||
void gameLobbyDialogImpl::keyPressEvent ( QKeyEvent * event ) {
|
void gameLobbyDialogImpl::keyPressEvent ( QKeyEvent * event ) {
|
||||||
|
|
||||||
// std::cout << "key" << "\n";
|
// qDebug() << event->key() << "\n";
|
||||||
|
|
||||||
if (event->key() == Qt::Key_Enter && lineEdit_ChatInput->hasFocus()) { myChat->sendMessage(); }
|
if (event->key() == Qt::Key_Enter && lineEdit_ChatInput->hasFocus()) { myChat->sendMessage(); }
|
||||||
|
|
||||||
@@ -1048,7 +1049,7 @@ void gameLobbyDialogImpl::keyPressEvent ( QKeyEvent * event ) {
|
|||||||
|
|
||||||
// if (event->key() == Qt::Key_Tab) event->ignore(); else { /*blah*/ }
|
// if (event->key() == Qt::Key_Tab) event->ignore(); else { /*blah*/ }
|
||||||
|
|
||||||
// if (event->key() == Qt::Key_N) registeredUserMode();
|
// if (event->key() == Qt::Key_N) showInvitationDialog();
|
||||||
// if (event->key() == Qt::Key_M) guestUserMode();
|
// if (event->key() == Qt::Key_M) guestUserMode();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1323,7 +1324,9 @@ void gameLobbyDialogImpl::showNickListContextMenu(QPoint p)
|
|||||||
|
|
||||||
void gameLobbyDialogImpl::invitePlayerToCurrentGame()
|
void gameLobbyDialogImpl::invitePlayerToCurrentGame()
|
||||||
{
|
{
|
||||||
qDebug() << "invitePlayer";
|
if(!treeWidget_NickList->selectedItems().isEmpty()) {
|
||||||
|
mySession->invitePlayerToCurrentGame(treeWidget_NickList->selectedItems().at(0)->data(0, Qt::UserRole).toUInt());
|
||||||
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
void gameLobbyDialogImpl::showInfoMsgBox()
|
void gameLobbyDialogImpl::showInfoMsgBox()
|
||||||
@@ -1338,3 +1341,32 @@ void gameLobbyDialogImpl::showInfoMsgBox()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gameLobbyDialogImpl::showInvitationDialog(unsigned gameId, unsigned playerIdFrom)
|
||||||
|
{
|
||||||
|
|
||||||
|
myMessageDialogImpl dialog(myConfig, this);
|
||||||
|
if(dialog.exec(3, tr("You've been invited to the game <b>%1</b> by <b>%2</b>.<br>Do you want to join this game?").arg(QString::fromUtf8(mySession->getClientGameInfo(gameId).name.c_str())).arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdFrom).playerName.c_str())), tr("PokerTH - Info Message"), QPixmap(":/gfx/list_add_user_64.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, false)) {
|
||||||
|
|
||||||
|
mySession->acceptGameInvitation(currentInvitationGameId);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mySession->rejectGameInvitation(currentInvitationGameId, DENY_GAME_INVITATION_NO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void gameLobbyDialogImpl::chatInfoPlayerInviation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom)
|
||||||
|
{
|
||||||
|
textBrowser_ChatDisplay->append(tr("<span style='color:blue;'>Player %1 has been invited to %2 by %3.</span>").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdFrom).playerName.c_str())).arg(QString::fromUtf8(mySession->getClientGameInfo(gameId).name.c_str())).arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdFrom).playerName.c_str())));
|
||||||
|
}
|
||||||
|
|
||||||
|
void gameLobbyDialogImpl::chatInfoPlayerRejectedInviation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason)
|
||||||
|
{
|
||||||
|
QString string;
|
||||||
|
if(reason == DENY_GAME_INVITATION_NO) string = tr("<span style='color:red;'>Player %1 has rejected intivation to %2.</span>");
|
||||||
|
|
||||||
|
if(reason == DENY_GAME_INVITATION_BUSY) string = tr("<span style='color:red;'>Player %1 can not join %2 because he is busy.</span>");
|
||||||
|
|
||||||
|
textBrowser_ChatDisplay->append(string.arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdWho).playerName.c_str())).arg(QString::fromUtf8(mySession->getClientGameInfo(gameId).name.c_str())));
|
||||||
|
}
|
||||||
|
|||||||
@@ -105,6 +105,9 @@ public slots:
|
|||||||
void showNickListContextMenu(QPoint);
|
void showNickListContextMenu(QPoint);
|
||||||
void invitePlayerToCurrentGame();
|
void invitePlayerToCurrentGame();
|
||||||
void showInfoMsgBox();
|
void showInfoMsgBox();
|
||||||
|
void showInvitationDialog(unsigned gameId, unsigned playerIdFrom);
|
||||||
|
void chatInfoPlayerInviation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom);
|
||||||
|
void chatInfoPlayerRejectedInviation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -137,7 +140,9 @@ private:
|
|||||||
MyGameListSortFilterProxyModel *myGameListSortFilterProxyModel;
|
MyGameListSortFilterProxyModel *myGameListSortFilterProxyModel;
|
||||||
QMenu *nickListContextMenu;
|
QMenu *nickListContextMenu;
|
||||||
QAction *nickListInviteAction;
|
QAction *nickListInviteAction;
|
||||||
|
QAction *ignorePlayerAction;
|
||||||
int infoMsgToShowId;
|
int infoMsgToShowId;
|
||||||
|
int currentInvitationGameId;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ bool MyGameListSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QMode
|
|||||||
QModelIndex index3 = sourceModel()->index(sourceRow, 3, sourceParent);
|
QModelIndex index3 = sourceModel()->index(sourceRow, 3, sourceParent);
|
||||||
QModelIndex index4 = sourceModel()->index(sourceRow, 4, sourceParent);
|
QModelIndex index4 = sourceModel()->index(sourceRow, 4, sourceParent);
|
||||||
|
|
||||||
|
qDebug() << sourceModel()->data(index1, 16).toString() << sourceModel()->data(index2, 16).toString() << sourceModel()->data(index3, 16).toString() << sourceModel()->data(index4, 16).toString();
|
||||||
|
|
||||||
return ((sourceModel()->data(index1, 16).toString().contains(column1RegExp)
|
return ((sourceModel()->data(index1, 16).toString().contains(column1RegExp)
|
||||||
&& sourceModel()->data(index2, 16).toString().contains(column2RegExp)
|
&& sourceModel()->data(index2, 16).toString().contains(column2RegExp)
|
||||||
&& sourceModel()->data(index3, 16).toString().contains(column3RegExp)
|
&& sourceModel()->data(index3, 16).toString().contains(column3RegExp)
|
||||||
|
|||||||
@@ -185,3 +185,7 @@ void GuiWrapper::SignalIrcServerError(int /*errorCode*/) {/*myStartWindow->signa
|
|||||||
void GuiWrapper::SignalLobbyPlayerJoined(unsigned playerId, const string &nickName) { myStartWindow->signalLobbyPlayerJoined(playerId, QString::fromUtf8(nickName.c_str())); }
|
void GuiWrapper::SignalLobbyPlayerJoined(unsigned playerId, const string &nickName) { myStartWindow->signalLobbyPlayerJoined(playerId, QString::fromUtf8(nickName.c_str())); }
|
||||||
void GuiWrapper::SignalLobbyPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason) { myStartWindow->signalLobbyPlayerKicked(QString::fromUtf8(nickName.c_str()), QString::fromUtf8(byWhom.c_str()), QString::fromUtf8(reason.c_str())); }
|
void GuiWrapper::SignalLobbyPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason) { myStartWindow->signalLobbyPlayerKicked(QString::fromUtf8(nickName.c_str()), QString::fromUtf8(byWhom.c_str()), QString::fromUtf8(reason.c_str())); }
|
||||||
void GuiWrapper::SignalLobbyPlayerLeft(unsigned playerId) { myStartWindow->signalLobbyPlayerLeft(playerId); }
|
void GuiWrapper::SignalLobbyPlayerLeft(unsigned playerId) { myStartWindow->signalLobbyPlayerLeft(playerId); }
|
||||||
|
|
||||||
|
void GuiWrapper::SignalSelfGameInvitation(unsigned gameId, unsigned playerIdFrom) { myStartWindow->signalSelfGameInvitation(gameId, playerIdFrom); }
|
||||||
|
void GuiWrapper::SignalPlayerGameInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom) { myStartWindow->signalPlayerGameInvitation(gameId, playerIdWho, playerIdFrom); }
|
||||||
|
void GuiWrapper::SignalRejectedGameInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason) { myStartWindow->signalRejectedGameInvitation(gameId, playerIdWho, reason); }
|
||||||
|
|||||||
@@ -157,6 +157,9 @@ public:
|
|||||||
void SignalLobbyPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason);
|
void SignalLobbyPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason);
|
||||||
void SignalLobbyPlayerLeft(unsigned playerId);
|
void SignalLobbyPlayerLeft(unsigned playerId);
|
||||||
|
|
||||||
|
void SignalSelfGameInvitation(unsigned gameId, unsigned playerIdFrom);
|
||||||
|
void SignalPlayerGameInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom);
|
||||||
|
void SignalRejectedGameInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,11 @@ myMessageDialogImpl::myMessageDialogImpl(ConfigFile *c, QWidget *parent)
|
|||||||
setupUi(this);
|
setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
int myMessageDialogImpl::exec(int messageId, QString msg, QString title, QPixmap pix, QDialogButtonBox::StandardButtons buttons)
|
int myMessageDialogImpl::exec(int messageId, QString msg, QString title, QPixmap pix, QDialogButtonBox::StandardButtons buttons, bool showCheckBox)
|
||||||
{
|
{
|
||||||
|
if(showCheckBox) checkBox->show();
|
||||||
|
else checkBox->hide();
|
||||||
|
|
||||||
bool show = false;
|
bool show = false;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
bool checkIfMesssageWillBeDisplayed(int id);
|
bool checkIfMesssageWillBeDisplayed(int id);
|
||||||
int exec(int messageId, QString msg, QString title, QPixmap pix, QDialogButtonBox::StandardButtons buttons);
|
int exec(int messageId, QString msg, QString title, QPixmap pix, QDialogButtonBox::StandardButtons buttons, bool showCheckBox = false);
|
||||||
void accept();
|
void accept();
|
||||||
void reject();
|
void reject();
|
||||||
void writeConfig();
|
void writeConfig();
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
<file>player_play.png</file>
|
<file>player_play.png</file>
|
||||||
<file>logoChip3D.png</file>
|
<file>logoChip3D.png</file>
|
||||||
<file>ktip.png</file>
|
<file>ktip.png</file>
|
||||||
|
<file>system_help_64.png</file>
|
||||||
|
<file>list_add_user_64.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/cflags">
|
<qresource prefix="/cflags">
|
||||||
<file>cflags/ad.png</file>
|
<file>cflags/ad.png</file>
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
@@ -161,6 +161,10 @@ startWindowImpl::startWindowImpl(ConfigFile *c)
|
|||||||
connect(this, SIGNAL(signalNetClientRemovedFromGame(int)), this, SLOT(networkNotification(int)));
|
connect(this, SIGNAL(signalNetClientRemovedFromGame(int)), this, SLOT(networkNotification(int)));
|
||||||
connect(this, SIGNAL(signalNetClientGameStart(boost::shared_ptr<Game>)), this, SLOT(networkStart(boost::shared_ptr<Game>)));
|
connect(this, SIGNAL(signalNetClientGameStart(boost::shared_ptr<Game>)), this, SLOT(networkStart(boost::shared_ptr<Game>)));
|
||||||
|
|
||||||
|
connect(this, SIGNAL(signalSelfGameInvitation(unsigned, unsigned)), myGameLobbyDialog, SLOT(showInvitationDialog(unsigned, unsigned)));
|
||||||
|
connect(this, SIGNAL(signalPlayerGameInvitation(unsigned, unsigned, unsigned)), myGameLobbyDialog, SLOT(chatInfoPlayerInviation(unsigned, unsigned, unsigned)));
|
||||||
|
connect(this, SIGNAL(signalRejectedGameInvitation(unsigned, unsigned, DenyGameInvitationReason)), myGameLobbyDialog, SLOT(chatInfoPlayerRejectedInviation(unsigned, unsigned, DenyGameInvitationReason)));
|
||||||
|
|
||||||
this->show();
|
this->show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,6 +102,10 @@ signals:
|
|||||||
void signalLobbyPlayerKicked(QString nickName, QString byWhom, QString reason);
|
void signalLobbyPlayerKicked(QString nickName, QString byWhom, QString reason);
|
||||||
void signalLobbyPlayerLeft(unsigned playerId);
|
void signalLobbyPlayerLeft(unsigned playerId);
|
||||||
|
|
||||||
|
void signalSelfGameInvitation(unsigned gameId, unsigned playerIdFrom);
|
||||||
|
void signalPlayerGameInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom);
|
||||||
|
void signalRejectedGameInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void callAboutPokerthDialog();
|
void callAboutPokerthDialog();
|
||||||
|
|||||||
Reference in New Issue
Block a user