From 6028ae57b7dcdd0ffee2e48eb15e02e1e7e7444d Mon Sep 17 00:00:00 2001 From: doitux Date: Mon, 10 Jan 2011 21:40:48 +0000 Subject: [PATCH] servermessages via id implemented --- src/gui/generic/serverguiwrapper.cpp | 1 + src/gui/generic/serverguiwrapper.h | 1 + src/gui/qt/gametable/myavatarlabel.cpp | 6 +++--- src/gui/qt/guiwrapper.cpp | 1 + src/gui/qt/guiwrapper.h | 2 ++ src/gui/qt/startwindow/startwindowimpl.cpp | 24 ++++++++++++++++++++++ src/gui/qt/startwindow/startwindowimpl.h | 2 ++ src/net/clientcallback.h | 1 + 8 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/gui/generic/serverguiwrapper.cpp b/src/gui/generic/serverguiwrapper.cpp index 430dd219..e2748e72 100644 --- a/src/gui/generic/serverguiwrapper.cpp +++ b/src/gui/generic/serverguiwrapper.cpp @@ -146,6 +146,7 @@ void ServerGuiWrapper::SignalNetClientGameStart(boost::shared_ptr game) { void ServerGuiWrapper::SignalNetClientGameChatMsg(const string &playerName, const string &msg) { if (myClientcb) myClientcb->SignalNetClientGameChatMsg(playerName, msg); } void ServerGuiWrapper::SignalNetClientLobbyChatMsg(const string &playerName, const string &msg) { if (myClientcb) myClientcb->SignalNetClientLobbyChatMsg(playerName, msg); } void ServerGuiWrapper::SignalNetClientMsgBox(const string &msg) { if (myClientcb) myClientcb->SignalNetClientMsgBox(msg); } +void ServerGuiWrapper::SignalNetClientMsgBox(unsigned msgId) { if (myClientcb) myClientcb->SignalNetClientMsgBox(msgId); } void ServerGuiWrapper::SignalNetClientWaitDialog() { if (myClientcb) myClientcb->SignalNetClientWaitDialog(); } void ServerGuiWrapper::SignalNetClientWarningAutoFoldInRankingGame(unsigned remainingAutoFolds) { if (myClientcb) myClientcb->SignalNetClientWarningAutoFoldInRankingGame(remainingAutoFolds); } diff --git a/src/gui/generic/serverguiwrapper.h b/src/gui/generic/serverguiwrapper.h index d897b99d..cddd2425 100644 --- a/src/gui/generic/serverguiwrapper.h +++ b/src/gui/generic/serverguiwrapper.h @@ -148,6 +148,7 @@ public: void SignalIrcPlayerLeft(const std::string &nickName); void SignalIrcChatMsg(const std::string &nickName, const std::string &msg); void SignalNetClientMsgBox(const std::string &msg); + void SignalNetClientMsgBox(unsigned msgId); void SignalIrcError(int errorCode); void SignalIrcServerError(int errorCode); void SignalLobbyPlayerJoined(unsigned playerId, const std::string &nickName); diff --git a/src/gui/qt/gametable/myavatarlabel.cpp b/src/gui/qt/gametable/myavatarlabel.cpp index 5bf87191..2b225078 100644 --- a/src/gui/qt/gametable/myavatarlabel.cpp +++ b/src/gui/qt/gametable/myavatarlabel.cpp @@ -216,9 +216,9 @@ void MyAvatarLabel::reportBadAvatar() { QString nick = QString::fromUtf8((*it_c)->getMyName().c_str()); int ret = QMessageBox::question(this, tr("PokerTH - Question"), - tr("Are you sure you want to report the avatar of \"%1\" as inappropriate?").arg(nick), - QMessageBox::Yes | QMessageBox::No); - if(ret) { + tr("Are you sure you want to report the avatar of \"%1\" as inappropriate?").arg(nick), QMessageBox::Yes | QMessageBox::No); + + if(ret == QMessageBox::Yes) { QFileInfo fi(avatar); myW->getSession()->reportBadAvatar((*it_c)->getMyUniqueID(), fi.baseName().toStdString()); } diff --git a/src/gui/qt/guiwrapper.cpp b/src/gui/qt/guiwrapper.cpp index 10b1ee1d..681509ea 100644 --- a/src/gui/qt/guiwrapper.cpp +++ b/src/gui/qt/guiwrapper.cpp @@ -173,6 +173,7 @@ void GuiWrapper::SignalNetClientWarningAutoFoldInRankingGame(unsigned remainingA void GuiWrapper::SignalNetClientGameChatMsg(const string &playerName, const string &msg) { myStartWindow->signalNetClientGameChatMsg(QString::fromUtf8(playerName.c_str()), QString::fromUtf8(msg.c_str())); } void GuiWrapper::SignalNetClientLobbyChatMsg(const string &playerName, const string &msg) { myStartWindow->signalNetClientLobbyChatMsg(QString::fromUtf8(playerName.c_str()), QString::fromUtf8(msg.c_str())); } void GuiWrapper::SignalNetClientMsgBox(const string &msg) { myStartWindow->signalNetClientMsgBox(QString::fromUtf8(msg.c_str())); } +void GuiWrapper::SignalNetClientMsgBox(unsigned msgId) { myStartWindow->signalNetClientMsgBox(msgId); } void GuiWrapper::SignalNetServerSuccess(int /*actionID*/) { } void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { myStartWindow->signalNetServerError(errorID, osErrorID); } diff --git a/src/gui/qt/guiwrapper.h b/src/gui/qt/guiwrapper.h index efa642a0..5fb0d6df 100644 --- a/src/gui/qt/guiwrapper.h +++ b/src/gui/qt/guiwrapper.h @@ -132,6 +132,8 @@ public: void SignalNetClientGameChatMsg(const std::string &playerName, const std::string &msg); void SignalNetClientLobbyChatMsg(const std::string &playerName, const std::string &msg); void SignalNetClientMsgBox(const std::string &msg); + void SignalNetClientMsgBox(unsigned msgId); + void SignalNetClientWaitDialog(); void SignalNetClientWarningAutoFoldInRankingGame(unsigned remainingAutoFolds); diff --git a/src/gui/qt/startwindow/startwindowimpl.cpp b/src/gui/qt/startwindow/startwindowimpl.cpp index 5a59dc37..2a120b73 100644 --- a/src/gui/qt/startwindow/startwindowimpl.cpp +++ b/src/gui/qt/startwindow/startwindowimpl.cpp @@ -147,6 +147,7 @@ startWindowImpl::startWindowImpl(ConfigFile *c) connect(this, SIGNAL(signalNetClientLobbyChatMsg(QString, QString)), myStartNetworkGameDialog->getMyChat(), SLOT(receiveMessage(QString, QString))); connect(this, SIGNAL(signalNetClientLobbyChatMsg(QString, QString)), myGameLobbyDialog->getMyChat(), SLOT(receiveMessage(QString, QString))); connect(this, SIGNAL(signalNetClientMsgBox(QString)), this, SLOT(networkMessage(QString))); + connect(this, SIGNAL(signalNetClientMsgBox(unsigned)), this, SLOT(networkMessage(unsigned))); connect(this, SIGNAL(signalNetClientShowTimeoutDialog(int, unsigned)), this, SLOT(showTimeoutDialog(int, unsigned))); connect(this, SIGNAL(signalLobbyPlayerJoined(unsigned, QString)), myGameLobbyDialog, SLOT(playerJoinedLobby(unsigned, QString))); @@ -944,6 +945,29 @@ void startWindowImpl::networkMessage(QString msg) msgBox.exec(); } +void startWindowImpl::networkMessage(unsigned msgId) +{ + QString msgText; + + switch(msgId) { + + case 1: { msgText = tr("The avatar report was accepted by the server. Thank you."); } + break; + case 2: { msgText = tr("This avatar was already reported by another player."); } + break; + case 3: { msgText = tr("An error occurred while reporting the avatar."); } + break; + default:; + break; + } + + QMessageBox msgBox(QMessageBox::Information, tr("Server Message"), + msgText, QMessageBox::Close, this); +// msgBox.setTextFormat(Qt::RichText); + msgBox.exec(); +} + + void startWindowImpl::networkStart(boost::shared_ptr game) { mySession->startClientGame(game); diff --git a/src/gui/qt/startwindow/startwindowimpl.h b/src/gui/qt/startwindow/startwindowimpl.h index 8ed058e0..721bb6f8 100644 --- a/src/gui/qt/startwindow/startwindowimpl.h +++ b/src/gui/qt/startwindow/startwindowimpl.h @@ -91,6 +91,7 @@ signals: void signalNetClientGameChatMsg(QString nickName, QString msg); void signalNetClientLobbyChatMsg(QString nickName, QString msg); void signalNetClientMsgBox(QString msg); + void signalNetClientMsgBox(unsigned msgId); void signalLobbyPlayerJoined(unsigned playerId, QString nickName); void signalLobbyPlayerKicked(QString nickName, QString byWhom, QString reason); @@ -122,6 +123,7 @@ public slots: void networkError(int, int); void networkNotification(int); void networkMessage(QString); + void networkMessage(unsigned); void networkStart(boost::shared_ptr game); QStringList getPlayerNicksList(); diff --git a/src/net/clientcallback.h b/src/net/clientcallback.h index b2b34ad3..4eb6a011 100644 --- a/src/net/clientcallback.h +++ b/src/net/clientcallback.h @@ -59,6 +59,7 @@ public: virtual void SignalNetClientGameChatMsg(const std::string &playerName, const std::string &msg) = 0; virtual void SignalNetClientLobbyChatMsg(const std::string &playerName, const std::string &msg) = 0; virtual void SignalNetClientMsgBox(const std::string &msg) = 0; + virtual void SignalNetClientMsgBox(unsigned msgId) = 0; virtual void SignalNetClientWaitDialog() = 0; virtual void SignalNetClientWarningAutoFoldInRankingGame(unsigned remainingAutoFolds) = 0;