Use own lobby chat instead of IRC. First steps, still incomplete.

This commit is contained in:
lotodore
2009-08-15 10:25:13 +00:00
parent 94db67bbd5
commit 4c340d5bdc
18 changed files with 104 additions and 93 deletions
+2 -1
View File
@@ -141,7 +141,8 @@ void ServerGuiWrapper::SignalNetClientGameListUpdateAdmin(unsigned gameId, unsig
void ServerGuiWrapper::SignalNetClientGameListPlayerJoined(unsigned gameId, unsigned playerId) { if (myClientcb) myClientcb->SignalNetClientGameListPlayerJoined(gameId, playerId); }
void ServerGuiWrapper::SignalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId) { if (myClientcb) myClientcb->SignalNetClientGameListPlayerLeft(gameId, playerId); }
void ServerGuiWrapper::SignalNetClientGameStart(boost::shared_ptr<Game> game) { if (myClientcb) myClientcb->SignalNetClientGameStart(game); }
void ServerGuiWrapper::SignalNetClientChatMsg(const string &playerName, const string &msg) { if (myClientcb) myClientcb->SignalNetClientChatMsg(playerName, msg); }
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::SignalNetClientWaitDialog() { if (myClientcb) myClientcb->SignalNetClientWaitDialog(); }
+2 -1
View File
@@ -116,7 +116,8 @@ public:
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);
void SignalNetClientChatMsg(const std::string &playerName, const std::string &msg);
void SignalNetClientGameChatMsg(const std::string &playerName, const std::string &msg);
void SignalNetClientLobbyChatMsg(const std::string &playerName, const std::string &msg);
void SignalNetClientWaitDialog();
void SignalNetClientGameListNew(unsigned gameId);
+1 -1
View File
@@ -40,7 +40,7 @@ void ChatTools::sendMessage() {
fillChatLinesHistory(myLineEdit->text());
if(mySession) {
mySession->sendChatMessage(myLineEdit->text().toUtf8().constData());
mySession->sendGameChatMessage(myLineEdit->text().toUtf8().constData());
myLineEdit->setText("");
}
else { cout << "Session is not valid" << endl;}
@@ -42,13 +42,16 @@ LobbyChat::~LobbyChat()
void LobbyChat::sendMessage() {
if (myNick.size())
if (myNick.isEmpty())
myNick = QString::fromUtf8(myConfig->readConfigString("MyName").c_str());
if (!myNick.isEmpty())
{
fillChatLinesHistory(myLobby->lineEdit_ChatInput->text());
QString tmpMsg(myLobby->lineEdit_ChatInput->text());
if (tmpMsg.size())
{
myLobby->getSession()->sendIrcChatMessage(tmpMsg.toUtf8().constData());
myLobby->getSession()->sendLobbyChatMessage(tmpMsg.toUtf8().constData());
myLobby->lineEdit_ChatInput->setText("");
displayMessage(myNick, tmpMsg);
@@ -145,8 +148,6 @@ void LobbyChat::clearChat() {
myNick = "";
myLobby->treeWidget_NickList->clear();
myLobby->textBrowser_ChatDisplay->clear();
myLobby->textBrowser_ChatDisplay->append(tr("Connecting to Chat server..."));
myLobby->lineEdit_ChatInput->setEnabled(false);
}
void LobbyChat::chatError(int errorCode)
+1 -1
View File
@@ -67,7 +67,7 @@ void Chat::sendMessage() {
}
fillChatLinesHistory(myW->lineEdit_ChatInput->text());
myW->getSession()->sendChatMessage(myW->lineEdit_ChatInput->text().toUtf8().constData());
myW->getSession()->sendGameChatMessage(myW->lineEdit_ChatInput->text().toUtf8().constData());
myW->lineEdit_ChatInput->setText("");
}
+2 -1
View File
@@ -165,7 +165,8 @@ void GuiWrapper::SignalNetClientGameListPlayerLeft(unsigned gameId, unsigned pla
void GuiWrapper::SignalNetClientGameStart(boost::shared_ptr<Game> game) { myStartWindow->signalNetClientGameStart(game); }
void GuiWrapper::SignalNetClientWaitDialog() { myStartWindow->signalShowClientDialog(); }
void GuiWrapper::SignalNetClientChatMsg(const string &playerName, const string &msg) { myStartWindow->signalNetClientChatMsg(QString::fromUtf8(playerName.c_str()), QString::fromUtf8(msg.c_str())); }
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::SignalNetServerSuccess(int /*actionID*/) { }
+2 -1
View File
@@ -127,7 +127,8 @@ public:
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);
void SignalNetClientChatMsg(const std::string &playerName, const std::string &msg);
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 SignalNetClientWaitDialog();
+3 -31
View File
@@ -141,8 +141,9 @@ startWindowImpl::startWindowImpl(ConfigFile *c)
connect(this, SIGNAL(signalNetClientRemovedFromGame(int)), myGameLobbyDialog, SLOT(removedFromGame(int)));
connect(this, SIGNAL(signalNetClientStatsUpdate(ServerStats)), myGameLobbyDialog, SLOT(updateStats(ServerStats)));
connect(this, SIGNAL(signalNetClientChatMsg(QString, QString)), myStartNetworkGameDialog, SLOT(receiveChatMsg(QString, QString)));
connect(this, SIGNAL(signalNetClientChatMsg(QString, QString)), myGuiInterface->getMyW()->getMyChat(), SLOT(receiveMessage(QString, QString)));
connect(this, SIGNAL(signalNetClientGameChatMsg(QString, QString)), myStartNetworkGameDialog, SLOT(receiveChatMsg(QString, QString)));
connect(this, SIGNAL(signalNetClientGameChatMsg(QString, QString)), myGuiInterface->getMyW()->getMyChat(), SLOT(receiveMessage(QString, QString)));
connect(this, SIGNAL(signalNetClientLobbyChatMsg(QString, QString)), myGameLobbyDialog->getLobbyChat(), SLOT(displayMessage(QString, QString)));
connect(this, SIGNAL(signalNetClientMsgBox(QString)), this, SLOT(networkMessage(QString)));
connect(this, SIGNAL(signalNetClientShowTimeoutDialog(int, unsigned)), this, SLOT(showTimeoutDialog(int, unsigned)));
@@ -316,35 +317,6 @@ void startWindowImpl::joinGameLobby() {
// Clear Lobby dialog.
myGameLobbyDialog->clearDialog();
//set clean irc nick
QString myNick(QString::fromUtf8(myConfig->readConfigString("MyName").c_str()));
myNick.replace(QString::fromUtf8("ä"),"ae");
myNick.replace(QString::fromUtf8("Ä"),"Ae");
myNick.replace(QString::fromUtf8("ü"),"ue");
myNick.replace(QString::fromUtf8("Ü"),"Ue");
myNick.replace(QString::fromUtf8("ö"),"oe");
myNick.replace(QString::fromUtf8("Ö"),"Oe");
myNick.replace(QString::fromUtf8("é"),"e");
myNick.replace(QString::fromUtf8("è"),"e");
myNick.replace(QString::fromUtf8("á"),"a");
myNick.replace(QString::fromUtf8("à"),"a");
myNick.replace(QString::fromUtf8("ó"),"o");
myNick.replace(QString::fromUtf8("ò"),"o");
myNick.replace(QString::fromUtf8("ú"),"u");
myNick.replace(QString::fromUtf8("ù"),"u");
myNick.replace(QString::fromUtf8("É"),"E");
myNick.replace(QString::fromUtf8("È"),"E");
myNick.replace(QString::fromUtf8("Á"),"A");
myNick.replace(QString::fromUtf8("À"),"A");
myNick.replace(QString::fromUtf8("Ó"),"O");
myNick.replace(QString::fromUtf8("Ò"),"O");
myNick.replace(QString::fromUtf8("Ú"),"U");
myNick.replace(QString::fromUtf8("Ù"),"U");
myNick.remove(QRegExp("[^A-Z^a-z^0-9|\\-_\\\\^`]*"));
myNick = myNick.mid(0,16);
mySession->setIrcNick(myNick.toUtf8().constData());
// Start client for dedicated server.
mySession->startInternetClient();
+2 -1
View File
@@ -80,7 +80,8 @@ signals:
void signalNetClientGameListPlayerJoined(unsigned gameId, unsigned playerId);
void signalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId);
void signalNetClientGameStart(boost::shared_ptr<Game> game);
void signalNetClientChatMsg(QString nickName, QString msg);
void signalNetClientGameChatMsg(QString nickName, QString msg);
void signalNetClientLobbyChatMsg(QString nickName, QString msg);
void signalNetClientMsgBox(QString msg);
void signalIrcConnect(QString server);