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