integrating chattools in mainwindow chat
This commit is contained in:
@@ -63,7 +63,7 @@ void ChatTools::nickAutoCompletition() {
|
||||
if(nickAutoCompletitionCounter == 0) {
|
||||
|
||||
if(myNickTreeWidget) {
|
||||
cout << "use Treewidget niclist" << endl;
|
||||
// cout << "use Treewidget niclist" << endl;
|
||||
QTreeWidgetItemIterator it(myNickTreeWidget);
|
||||
while (*it) {
|
||||
if ((*it)->text(0).startsWith(myChatStringList.last(), Qt::CaseInsensitive) && myChatStringList.last() != "")
|
||||
@@ -73,11 +73,14 @@ void ChatTools::nickAutoCompletition() {
|
||||
}
|
||||
|
||||
if(!myNickStringList.isEmpty()) {
|
||||
cout << "use static nickList" << endl;
|
||||
// cout << "use static nickList" << endl;
|
||||
|
||||
QStringListIterator it(myNickStringList);
|
||||
while (it.hasNext())
|
||||
cout << it.next().toLocal8Bit().constData() << endl;
|
||||
while (it.hasNext()) {
|
||||
QString next = it.next();
|
||||
if (next.startsWith(myChatStringList.last(), Qt::CaseInsensitive) && myChatStringList.last() != "")
|
||||
matchStringList << next;
|
||||
}
|
||||
//TODO code for static nickList
|
||||
}
|
||||
}
|
||||
@@ -91,6 +94,8 @@ void ChatTools::nickAutoCompletition() {
|
||||
|
||||
myChatStringList.removeLast();
|
||||
|
||||
// cout << nickAutoCompletitionCounter << endl;
|
||||
|
||||
if(nickAutoCompletitionCounter == 0) {
|
||||
//first one
|
||||
lastChatString = myChatStringList.join(" ");
|
||||
@@ -99,6 +104,8 @@ void ChatTools::nickAutoCompletition() {
|
||||
|
||||
if(nickAutoCompletitionCounter == lastMatchStringList.size()) nickAutoCompletitionCounter = 0;
|
||||
|
||||
cout << nickAutoCompletitionCounter << endl;
|
||||
|
||||
// cout << nickAutoCompletitionCounter << "\n";
|
||||
|
||||
if(lastChatString == "")
|
||||
|
||||
@@ -35,8 +35,6 @@ GuiWrapper::GuiWrapper(ConfigFile *c) : myLog(0), myW(0), myConfig(c)
|
||||
myW = new mainWindowImpl(myConfig);
|
||||
myW->show();
|
||||
myLog = new Log(myW, myConfig);
|
||||
myChat = new Chat(myW, myConfig);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +138,7 @@ void GuiWrapper::SignalNetClientGameListPlayerJoined(unsigned gameId, unsigned p
|
||||
void GuiWrapper::SignalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId) { myW->signalNetClientGameListPlayerLeft(gameId, playerId); }
|
||||
|
||||
void GuiWrapper::SignalNetClientGameStart(boost::shared_ptr<Game> game) { myW->signalNetClientGameStart(game); }
|
||||
void GuiWrapper::SignalNetClientChatMsg(const string &playerName, const string &msg) { myChat->signalChatMessage(QString::fromUtf8(playerName.c_str()), QString::fromUtf8(msg.c_str())); }
|
||||
void GuiWrapper::SignalNetClientChatMsg(const string &playerName, const string &msg) { myW->signalNetClientChatMsg(QString::fromUtf8(playerName.c_str()), QString::fromUtf8(msg.c_str())); }
|
||||
void GuiWrapper::SignalNetClientWaitDialog() { myW->signalShowClientDialog(); }
|
||||
|
||||
void GuiWrapper::SignalNetServerSuccess(int /*actionID*/) { }
|
||||
|
||||
@@ -28,10 +28,8 @@ using namespace std;
|
||||
|
||||
Chat::Chat(mainWindowImpl* w, ConfigFile *c) : myW(w), myConfig(c)
|
||||
{
|
||||
myW->setChat(this);
|
||||
|
||||
myChatTools = new ChatTools(myW->lineEdit_ChatInput);
|
||||
connect(this, SIGNAL(signalChatMessage(QString, QString)), this, SLOT(receiveMessage(QString, QString)));
|
||||
|
||||
}
|
||||
|
||||
Chat::~Chat()
|
||||
@@ -41,7 +39,8 @@ Chat::~Chat()
|
||||
}
|
||||
|
||||
void Chat::sendMessage() {
|
||||
|
||||
|
||||
fillChatLinesHistory(myW->lineEdit_ChatInput->text());
|
||||
myW->getSession().sendChatMessage(myW->lineEdit_ChatInput->text().toUtf8().constData());
|
||||
myW->lineEdit_ChatInput->setText("");
|
||||
}
|
||||
|
||||
@@ -37,9 +37,6 @@ public:
|
||||
|
||||
~Chat();
|
||||
|
||||
signals:
|
||||
void signalChatMessage(QString playerName, QString msg);
|
||||
|
||||
public slots:
|
||||
|
||||
void sendMessage();
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
using namespace std;
|
||||
|
||||
mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
||||
: QMainWindow(parent), myConfig(c), gameSpeed(0), myActionIsBet(0), myActionIsRaise(0), breakAfterActualHand(FALSE)
|
||||
: QMainWindow(parent), myChat(NULL), myConfig(c), gameSpeed(0), myActionIsBet(0), myActionIsRaise(0), breakAfterActualHand(FALSE)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -533,10 +533,12 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
||||
myCreateNetworkGameDialog = new createNetworkGameDialogImpl(this, myConfig);
|
||||
myAboutPokerthDialog = new aboutPokerthImpl(this, myConfig);
|
||||
myGameLobbyDialog = new gameLobbyDialogImpl(this, myConfig);
|
||||
|
||||
|
||||
myStartNetworkGameDialog->setMyW(this);
|
||||
myGameLobbyDialog->setMyW(this);
|
||||
|
||||
myChat = new Chat(this, myConfig);
|
||||
|
||||
// //ShortCuts
|
||||
// QShortcut *quitPokerTHKeys = new QShortcut(QKeySequence(Qt::Key_Control + Qt::Key_Q), this);
|
||||
// connect( quitPokerTHKeys, SIGNAL(activated() ), actionQuit, SLOT( trigger() ) );
|
||||
@@ -602,6 +604,7 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
||||
connect( tabWidget_Left, SIGNAL( currentChanged(int) ), this, SLOT( tabSwitchAction() ) );
|
||||
connect( lineEdit_ChatInput, SIGNAL( returnPressed () ), this, SLOT( sendChatMessage() ) );
|
||||
connect( lineEdit_ChatInput, SIGNAL( textChanged (QString) ), this, SLOT( checkChatInputLength(QString) ) );
|
||||
connect( lineEdit_ChatInput, SIGNAL( textEdited (QString) ), myChat, SLOT( setChatTextEdited() ) );
|
||||
|
||||
//Nachrichten Thread-Save
|
||||
connect(this, SIGNAL(signalInitGui(int)), this, SLOT(initGui(int)));
|
||||
@@ -683,6 +686,9 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
||||
connect(this, SIGNAL(signalNetServerError(int, int)), this, SLOT(networkError(int, int)));
|
||||
connect(this, SIGNAL(signalNetClientGameStart(boost::shared_ptr<Game>)), this, SLOT(networkStart(boost::shared_ptr<Game>)));
|
||||
|
||||
//Chat Messages
|
||||
connect(this, SIGNAL(signalNetClientChatMsg(QString, QString)), myChat, SLOT(receiveMessage(QString, QString)));
|
||||
|
||||
connect(this, SIGNAL(signalIrcConnect(QString)), myGameLobbyDialog->getLobbyChat(), SLOT(connected(QString)));
|
||||
connect(this, SIGNAL(signalIrcSelfJoined(QString, QString)), myGameLobbyDialog->getLobbyChat(), SLOT(selfJoined(QString, QString)));
|
||||
connect(this, SIGNAL(signalIrcPlayerJoined(QString)), myGameLobbyDialog->getLobbyChat(), SLOT(playerJoined(QString)));
|
||||
|
||||
@@ -67,8 +67,7 @@ public:
|
||||
void setSession(boost::shared_ptr<Session> session);
|
||||
|
||||
void setLog(Log* l) { myLog = l; }
|
||||
void setChat(Chat* c) { myChat = c; }
|
||||
|
||||
|
||||
SDLPlayer* getMySDLPlayer() const { return mySDLPlayer; }
|
||||
|
||||
void setSpeeds();
|
||||
@@ -140,6 +139,7 @@ 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 signalIrcConnect(QString server);
|
||||
void signalIrcSelfJoined(QString nickName, QString channel);
|
||||
|
||||
Reference in New Issue
Block a user