This commit is contained in:
doitux
2007-12-09 14:00:11 +00:00
parent 5aa2647ade
commit f3be7f204a
3 changed files with 10 additions and 15 deletions
+3 -7
View File
@@ -20,13 +20,12 @@
#include "chattools.h"
#include "session.h"
#include "configfile.h"
#include "sdlplayer.h"
#include <iostream>
using namespace std;
ChatTools::ChatTools(QLineEdit* l, ConfigFile *c, int notifyMode, QTextBrowser *b, QTreeWidget *t, SDLPlayer *s, QDialog *p) : nickAutoCompletitionCounter(0), myLineEdit(l), myNickTreeWidget(t), myNickStringList(NULL), myTextBrowser(b), myNotifyMode(notifyMode), myConfig(c), mySDLPlayer(s), myParentDialog(p)
ChatTools::ChatTools(QLineEdit* l, ConfigFile *c, int notifyMode, QTextBrowser *b, QTreeWidget *t) : nickAutoCompletitionCounter(0), myLineEdit(l), myNickTreeWidget(t), myNickStringList(NULL), myTextBrowser(b), myNotifyMode(notifyMode), myConfig(c)
{
}
@@ -75,14 +74,11 @@ void ChatTools::receiveMessage(QString playerName, QString message) {
case 2: tempMsg = QString("<span style=\"color:#FFFFFF;\">"+message+"</span>");
break;
default:;
}
}
}
myTextBrowser->append(playerName + ": " + tempMsg);
}
if(myParentDialog) {
if(myParentDialog->isVisible() && myConfig->readConfigInt("PlayLobbyChatNotification"))
mySDLPlayer->playSound("lobbychatnotify",0);
}
}
void ChatTools::clearChat() {
+2 -7
View File
@@ -26,14 +26,13 @@
class Session;
class ConfigFile;
class SDLPlayer;
class ChatTools : public QObject
{
Q_OBJECT
public:
ChatTools(QLineEdit* l, ConfigFile *c, int notifyMode = 0, QTextBrowser *b = NULL, QTreeWidget *t = NULL, SDLPlayer *s = NULL, QDialog *p = NULL );
ChatTools(QLineEdit* l, ConfigFile *c, int notifyMode = 0, QTextBrowser *b = NULL, QTreeWidget *t = NULL);
~ChatTools();
@@ -68,11 +67,7 @@ private:
Session *mySession;
int myNotifyMode; // 0 == no notification, 1 == bold notification, 2 == yellow notification
ConfigFile *myConfig;
SDLPlayer *mySDLPlayer;
QDialog *myParentDialog; //needed for visible check for audio-nick-notification
// friend class GuiWrapper;
};
#endif
@@ -32,7 +32,7 @@ using namespace std;
LobbyChat::LobbyChat(gameLobbyDialogImpl* l, ConfigFile *c) : myLobby(l), myConfig(c)
{
myChatTools = new ChatTools(myLobby->lineEdit_ChatInput, myConfig, 1, myLobby->textBrowser_ChatDisplay, myLobby->treeWidget_NickList, myLobby->getMyW()->getMySDLPlayer(), myLobby);
myChatTools = new ChatTools(myLobby->lineEdit_ChatInput, myConfig, 1, myLobby->textBrowser_ChatDisplay, myLobby->treeWidget_NickList);
}
LobbyChat::~LobbyChat()
@@ -129,6 +129,10 @@ void LobbyChat::playerLeft(QString playerName)
void LobbyChat::displayMessage(QString playerName, QString message) {
myChatTools->receiveMessage(playerName, message);
if(message.contains(QString::fromUtf8(myConfig->readConfigString("MyName").c_str()), Qt::CaseInsensitive) && myLobby->isVisible() && myConfig->readConfigInt("PlayLobbyChatNotification")) {
myLobby->getMyW()->getMySDLPlayer()->playSound("lobbychatnotify",0);
}
}
void LobbyChat::checkInputLength(QString string) {