From 582b767a901a647a7d909acf879bce32410b8ce1 Mon Sep 17 00:00:00 2001 From: Imanol-Mikel Barba Sabariego Date: Fri, 27 Dec 2013 13:00:45 +0000 Subject: [PATCH] git-svn-id: svn://imanolbarba.net/PAD@43 c2ee353e-ed0d-4329-bf56-03aec153487f --- QChatClient/QChatClient.pro.user | 205 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ QChatClient/chatroom.cpp | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------ QChatClient/chatroom.h | 22 +++++++++++++++------- build-QChatClient-Desktop-Debug/Makefile | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------- build-QChatClient-Desktop-Debug/QChatClient | Bin 1885594 -> 0 bytes build-QChatClient-Desktop-Debug/chatwindow.o | Bin 602640 -> 0 bytes build-QChatClient-Desktop-Debug/loginscreen.o | Bin 546464 -> 0 bytes build-QChatClient-Desktop-Debug/main.o | Bin 239728 -> 0 bytes build-QChatClient-Desktop-Debug/moc_chatroom.cpp | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------ build-QChatClient-Desktop-Debug/moc_chatroom.o | Bin 434824 -> 0 bytes 10 files changed, 565 insertions(+), 95 deletions(-) diff --git a/QChatClient/QChatClient.pro.user b/QChatClient/QChatClient.pro.user index 6d9b420..6e8e9b3 100644 --- a/QChatClient/QChatClient.pro.user +++ b/QChatClient/QChatClient.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget @@ -51,9 +51,9 @@ ProjectExplorer.Project.Target.0 - Qt 5.0.1 (qt5) - Qt 5.0.1 (qt5) - {c01623e0-8a32-406c-bbaa-3e691c0f6afc} + Desktop + Desktop + {430bae4e-c8d6-488c-936e-c89fd5587cd0} 0 0 0 @@ -242,12 +242,205 @@ + ProjectExplorer.Project.Target.1 + + Desktop-qt4 + Desktop-qt4 + {09071c90-33f0-49f1-8c3d-15bcbd81cbe2} + 1 + 0 + 0 + + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + /home/imanol/devel/eclipse/PAD/build-QChatClient-Desktop_qt4-Debug + true + + + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + /home/imanol/devel/eclipse/PAD/build-QChatClient-Desktop_qt4-Release + true + + 2 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy locally + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + true + + false + false + false + false + true + 0.01 + 10 + true + 25 + + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + QChatClient + + Qt4ProjectManager.Qt4RunConfiguration:/home/imanol/devel/eclipse/PAD/QChatClient/QChatClient.pro + 2 + + QChatClient.pro + false + false + + + 3768 + true + false + false + true + + 1 + + + ProjectExplorer.Project.TargetCount - 1 + 2 ProjectExplorer.Project.Updater.EnvironmentId - {fd24a9a9-cdbc-49b3-845c-b174fda2a7ac} + {0fd5067a-d849-4d4e-9457-800baef2de83} ProjectExplorer.Project.Updater.FileVersion diff --git a/QChatClient/chatroom.cpp b/QChatClient/chatroom.cpp index f23cb74..9895005 100644 --- a/QChatClient/chatroom.cpp +++ b/QChatClient/chatroom.cpp @@ -38,7 +38,7 @@ void sendThread(Socket* s, Chatroom* chat) send = '0' + send; if(send.substr(1) != "/exit" && send.substr(1) != "/disconnect") { - chat->putMsgToPrintQueue(chat->getNickname().toStdString().append(": ").append(send.substr(1))); + chat->putMsgToPrintQueue(chat->getNickname().toStdString().append(": ").append(send.substr(1)),MSG_USER); } } msgLock->unlock(); @@ -77,23 +77,24 @@ void recvThread(Socket* s, Chatroom* chat) } catch(SocketException &e) { - chat->setConnected(false); + chat->toggleConnected(false); cout << e.description() << endl; msgListNotEmpty.notify_all(); - chat->close(); + string msg = "Connection to server lost"; + chat->putMsgToPrintQueue(msg,MSG_STATUS); break; } if(recv == "DISC_OK") { cout << "Disconnecting" << endl; - chat->setConnected(false); + chat->toggleConnected(false); msgListNotEmpty.notify_all(); break; } else if(recv == "EXIT_OK") { cout << "Exiting" << endl; - chat->setConnected(false); + chat->toggleConnected(true); msgListNotEmpty.notify_all(); chat->close(); break; @@ -105,7 +106,7 @@ void recvThread(Socket* s, Chatroom* chat) } else { - chat->putMsgToPrintQueue(recv); + chat->putMsgToPrintQueue(recv,MSG_USER); } } } @@ -137,8 +138,11 @@ Chatroom::Chatroom(QWidget *parent) : connect(ui->inputText,SIGNAL(msgReady()),this,SLOT(sendMsg())); connect(ui->sendButton,SIGNAL(clicked()),this,SLOT(sendMsg())); connect(this,SIGNAL(messagesToPrint()),this,SLOT(printMsg())); + connect(this,SIGNAL(serverMessagesToPrint()),this,SLOT(printServerMsg())); + connect(this,SIGNAL(statusMessagesToPrint()),this,SLOT(printStatusMsg())); connect(ui->userList,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(launchChatWindow(QModelIndex))); connect(this,SIGNAL(createChat(QString)),this,SLOT(newChat(QString))); + connect(this,SIGNAL(toggleConnected(bool)),this,SLOT(setConnected(bool))); } void Chatroom::closeEvent(QCloseEvent *event) @@ -156,6 +160,12 @@ void Chatroom::closeEvent(QCloseEvent *event) ui->inputText->setReadOnly(true); recv->join(); send->join(); + map::iterator it; + for(it = activeChats.begin(); it != activeChats.end(); it++) + { + ChatWindow* chat = (ChatWindow*) it->second; + chat->close(); + } ui->chatText->printServerMsg("Disconnected"); send = NULL; recv = NULL; @@ -174,6 +184,20 @@ void Chatroom::setConnected(bool status) { myMutex.lock(); connected = status; + if(status == false) + { + ui->chatText->printServerMsg("Disconnected"); + this->ui->inputText->setReadOnly(true); + this->ui->sendButton->setDisabled(true); + this->ui->actionDisconnect->setDisabled(true); + } + else if(status == true) + { + this->ui->inputText->setReadOnly(false); + this->ui->sendButton->setDisabled(false); + this->ui->actionDisconnect->setDisabled(false); + ui->chatText->printServerMsg("Connected to chatroom"); + } myMutex.unlock(); } @@ -240,11 +264,27 @@ void Chatroom::launchChatWindow(QModelIndex index) } } -void Chatroom::putMsgToPrintQueue(string &msg) +void Chatroom::putMsgToPrintQueue(string &msg, int type) { printMutex.lock(); - printQueue.push_back(msg); - emit messagesToPrint(); + if(type == MSG_USER) + { + printQueue.push_back(msg); + emit messagesToPrint(); + return; + } + else if(type == MSG_SERVER) + { + printServerQueue.push_back(msg); + emit serverMessagesToPrint(); + return; + } + else if(type == MSG_STATUS) + { + printStatusQueue.push_back(msg); + emit statusMessagesToPrint(); + return; + } } void Chatroom::printMsg() @@ -258,6 +298,28 @@ void Chatroom::printMsg() printMutex.unlock(); } +void Chatroom::printServerMsg() +{ + while(!printServerQueue.empty()) + { + string msg = printServerQueue.front(); + ui->chatText->printServerMsg(msg); + printServerQueue.pop_front(); + } + printMutex.unlock(); +} + +void Chatroom::printStatusMsg() +{ + while(!printStatusQueue.empty()) + { + string msg = printStatusQueue.front(); + ui->chatText->printStatusMsg(msg); + printStatusQueue.pop_front(); + } + printMutex.unlock(); +} + void Chatroom::putMsgToSendQueue(QString& msg) { msgMutex.lock(); @@ -302,10 +364,6 @@ void Chatroom::disconnectChatroom() msgMutex.lock(); sendQueue.clear(); sendQueue.push_back("/disconnect"); - ui->chatText->printServerMsg("Disconnected"); - this->ui->inputText->setReadOnly(true); - this->ui->sendButton->setDisabled(true); - this->ui->actionDisconnect->setDisabled(true); msgMutex.unlock(); msgListNotEmpty.notify_all(); } @@ -323,11 +381,7 @@ void Chatroom::startSession() { return; } - connected = true; - this->ui->inputText->setReadOnly(false); - this->ui->sendButton->setDisabled(false); - this->ui->actionDisconnect->setDisabled(false); - ui->chatText->printServerMsg("Connected to chatroom"); + setConnected(true); recv = new std::thread(recvThread,&s,this); send = new std::thread(sendThread,&s,this); } diff --git a/QChatClient/chatroom.h b/QChatClient/chatroom.h index 6d4eeca..61c06cf 100644 --- a/QChatClient/chatroom.h +++ b/QChatClient/chatroom.h @@ -11,6 +11,10 @@ #include "chatwindow.h" #include "Socket.h" +#define MSG_USER 0 +#define MSG_STATUS 1 +#define MSG_SERVER 2 + namespace Ui { class Chatroom; } @@ -22,13 +26,12 @@ class Chatroom : public QMainWindow public: explicit Chatroom(QWidget *parent = 0); bool getConnected(); - void setConnected(bool status); QString getNickname(); void setNickname(QString nick); void updateUserList(QString userlist); void relayMsg(string msg); void removeChat(QString &nickname); - void putMsgToPrintQueue(string& msg); + void putMsgToPrintQueue(string& msg, int type); void putMsgToSendQueue(QString& msg); ~Chatroom(); @@ -40,16 +43,14 @@ private: std::thread *recv; QString nickname; list printQueue; + list printServerQueue; + list printStatusQueue; map activeChats; std::mutex chatMutex; unique_lock* chatLock; std::condition_variable chatCreated; string getSender(string msg); -private slots: - void newChat(QString peerNick); - - protected: void closeEvent(QCloseEvent *event); @@ -58,13 +59,20 @@ public slots: void sendMsg(); void disconnectChatroom(); void launchChatWindow(QModelIndex index); + void setConnected(bool status); private slots: - void printMsg(); + void printMsg(); + void printServerMsg(); + void printStatusMsg(); + void newChat(QString peerNick); signals: void messagesToPrint(); + void serverMessagesToPrint(); + void statusMessagesToPrint(); void createChat(QString sender); + void toggleConnected(bool status); }; diff --git a/build-QChatClient-Desktop-Debug/Makefile b/build-QChatClient-Desktop-Debug/Makefile index 71a491f..b1fc16f 100644 --- a/build-QChatClient-Desktop-Debug/Makefile +++ b/build-QChatClient-Desktop-Debug/Makefile @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: QChatClient -# Generated by qmake (3.0) (Qt 5.0.2) on: vie dic 27 07:18:49 2013 +# Generated by qmake (3.0) (Qt 5.0.2) on: vie dic 27 14:11:32 2013 # Project: ../QChatClient/QChatClient.pro # Template: app # Command: /usr/lib/x86_64-linux-gnu/qt5/bin/qmake -spec linux-g++-64 CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug -o Makefile ../QChatClient/QChatClient.pro @@ -86,14 +86,8 @@ DIST = /usr/share/qt5/mkspecs/features/spec_pre.prf \ /usr/share/qt5/mkspecs/modules/qt_lib_opengl.pri \ /usr/share/qt5/mkspecs/modules/qt_lib_platformsupport.pri \ /usr/share/qt5/mkspecs/modules/qt_lib_printsupport.pri \ - /usr/share/qt5/mkspecs/modules/qt_lib_qml.pri \ - /usr/share/qt5/mkspecs/modules/qt_lib_qmldevtools.pri \ - /usr/share/qt5/mkspecs/modules/qt_lib_qmltest.pri \ - /usr/share/qt5/mkspecs/modules/qt_lib_quick.pri \ - /usr/share/qt5/mkspecs/modules/qt_lib_quickparticles.pri \ /usr/share/qt5/mkspecs/modules/qt_lib_sql.pri \ /usr/share/qt5/mkspecs/modules/qt_lib_testlib.pri \ - /usr/share/qt5/mkspecs/modules/qt_lib_v8.pri \ /usr/share/qt5/mkspecs/modules/qt_lib_widgets.pri \ /usr/share/qt5/mkspecs/modules/qt_lib_xml.pri \ /usr/share/qt5/mkspecs/features/qt_functions.prf \ @@ -173,14 +167,8 @@ Makefile: ../QChatClient/QChatClient.pro /usr/share/qt5/mkspecs/linux-g++-64/qma /usr/share/qt5/mkspecs/modules/qt_lib_opengl.pri \ /usr/share/qt5/mkspecs/modules/qt_lib_platformsupport.pri \ /usr/share/qt5/mkspecs/modules/qt_lib_printsupport.pri \ - /usr/share/qt5/mkspecs/modules/qt_lib_qml.pri \ - /usr/share/qt5/mkspecs/modules/qt_lib_qmldevtools.pri \ - /usr/share/qt5/mkspecs/modules/qt_lib_qmltest.pri \ - /usr/share/qt5/mkspecs/modules/qt_lib_quick.pri \ - /usr/share/qt5/mkspecs/modules/qt_lib_quickparticles.pri \ /usr/share/qt5/mkspecs/modules/qt_lib_sql.pri \ /usr/share/qt5/mkspecs/modules/qt_lib_testlib.pri \ - /usr/share/qt5/mkspecs/modules/qt_lib_v8.pri \ /usr/share/qt5/mkspecs/modules/qt_lib_widgets.pri \ /usr/share/qt5/mkspecs/modules/qt_lib_xml.pri \ /usr/share/qt5/mkspecs/features/qt_functions.prf \ @@ -230,14 +218,8 @@ Makefile: ../QChatClient/QChatClient.pro /usr/share/qt5/mkspecs/linux-g++-64/qma /usr/share/qt5/mkspecs/modules/qt_lib_opengl.pri: /usr/share/qt5/mkspecs/modules/qt_lib_platformsupport.pri: /usr/share/qt5/mkspecs/modules/qt_lib_printsupport.pri: -/usr/share/qt5/mkspecs/modules/qt_lib_qml.pri: -/usr/share/qt5/mkspecs/modules/qt_lib_qmldevtools.pri: -/usr/share/qt5/mkspecs/modules/qt_lib_qmltest.pri: -/usr/share/qt5/mkspecs/modules/qt_lib_quick.pri: -/usr/share/qt5/mkspecs/modules/qt_lib_quickparticles.pri: /usr/share/qt5/mkspecs/modules/qt_lib_sql.pri: /usr/share/qt5/mkspecs/modules/qt_lib_testlib.pri: -/usr/share/qt5/mkspecs/modules/qt_lib_v8.pri: /usr/share/qt5/mkspecs/modules/qt_lib_widgets.pri: /usr/share/qt5/mkspecs/modules/qt_lib_xml.pri: /usr/share/qt5/mkspecs/features/qt_functions.prf: @@ -1673,7 +1655,53 @@ loginscreen.o: ../QChatClient/loginscreen.cpp ../QChatClient/loginscreen.h \ ../QChatClient/chatwindow.h \ ../QChatClient/Socket.h \ ../QChatClient/SocketException.h \ - ui_loginscreen.h + ui_loginscreen.h \ + /usr/include/qt5/QtCore/QVariant \ + /usr/include/qt5/QtWidgets/QAction \ + /usr/include/qt5/QtWidgets/qaction.h \ + /usr/include/qt5/QtWidgets/qactiongroup.h \ + /usr/include/qt5/QtWidgets/QApplication \ + /usr/include/qt5/QtWidgets/qapplication.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtWidgets/qdesktopwidget.h \ + /usr/include/qt5/QtGui/qguiapplication.h \ + /usr/include/qt5/QtGui/qinputmethod.h \ + /usr/include/qt5/QtWidgets/QButtonGroup \ + /usr/include/qt5/QtWidgets/qbuttongroup.h \ + /usr/include/qt5/QtWidgets/QGridLayout \ + /usr/include/qt5/QtWidgets/qgridlayout.h \ + /usr/include/qt5/QtWidgets/qlayout.h \ + /usr/include/qt5/QtWidgets/qlayoutitem.h \ + /usr/include/qt5/QtWidgets/qboxlayout.h \ + /usr/include/qt5/QtWidgets/QHeaderView \ + /usr/include/qt5/QtWidgets/qheaderview.h \ + /usr/include/qt5/QtWidgets/qabstractitemview.h \ + /usr/include/qt5/QtWidgets/qabstractscrollarea.h \ + /usr/include/qt5/QtWidgets/qframe.h \ + /usr/include/qt5/QtCore/qitemselectionmodel.h \ + /usr/include/qt5/QtWidgets/qabstractitemdelegate.h \ + /usr/include/qt5/QtWidgets/qstyleoption.h \ + /usr/include/qt5/QtWidgets/qabstractspinbox.h \ + /usr/include/qt5/QtGui/qvalidator.h \ + /usr/include/qt5/QtWidgets/qslider.h \ + /usr/include/qt5/QtWidgets/qabstractslider.h \ + /usr/include/qt5/QtWidgets/qstyle.h \ + /usr/include/qt5/QtWidgets/qtabbar.h \ + /usr/include/qt5/QtWidgets/qrubberband.h \ + /usr/include/qt5/QtWidgets/QLabel \ + /usr/include/qt5/QtWidgets/qlabel.h \ + /usr/include/qt5/QtWidgets/QLineEdit \ + /usr/include/qt5/QtWidgets/qlineedit.h \ + /usr/include/qt5/QtGui/qtextcursor.h \ + /usr/include/qt5/QtGui/qtextformat.h \ + /usr/include/qt5/QtGui/qpen.h \ + /usr/include/qt5/QtGui/qtextoption.h \ + /usr/include/qt5/QtWidgets/QPushButton \ + /usr/include/qt5/QtWidgets/qpushbutton.h \ + /usr/include/qt5/QtWidgets/qabstractbutton.h \ + /usr/include/qt5/QtWidgets/QSpacerItem \ + /usr/include/qt5/QtWidgets/QWidget $(CXX) -c $(CXXFLAGS) $(INCPATH) -o loginscreen.o ../QChatClient/loginscreen.cpp chatroom.o: ../QChatClient/chatroom.cpp ../QChatClient/chatroom.h \ @@ -1796,7 +1824,69 @@ chatroom.o: ../QChatClient/chatroom.cpp ../QChatClient/chatroom.h \ ../QChatClient/Socket.h \ ../QChatClient/SocketException.h \ ../QChatClient/chatwindow.h \ - ui_chatroom.h + ui_chatroom.h \ + /usr/include/qt5/QtCore/QVariant \ + /usr/include/qt5/QtWidgets/QAction \ + /usr/include/qt5/QtWidgets/qaction.h \ + /usr/include/qt5/QtWidgets/qactiongroup.h \ + /usr/include/qt5/QtWidgets/QApplication \ + /usr/include/qt5/QtWidgets/qapplication.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtWidgets/qdesktopwidget.h \ + /usr/include/qt5/QtGui/qguiapplication.h \ + /usr/include/qt5/QtGui/qinputmethod.h \ + /usr/include/qt5/QtWidgets/QButtonGroup \ + /usr/include/qt5/QtWidgets/qbuttongroup.h \ + /usr/include/qt5/QtWidgets/QGridLayout \ + /usr/include/qt5/QtWidgets/qgridlayout.h \ + /usr/include/qt5/QtWidgets/qlayout.h \ + /usr/include/qt5/QtWidgets/qlayoutitem.h \ + /usr/include/qt5/QtWidgets/qboxlayout.h \ + /usr/include/qt5/QtWidgets/QHeaderView \ + /usr/include/qt5/QtWidgets/qheaderview.h \ + /usr/include/qt5/QtWidgets/qabstractitemview.h \ + /usr/include/qt5/QtWidgets/qabstractscrollarea.h \ + /usr/include/qt5/QtWidgets/qframe.h \ + /usr/include/qt5/QtCore/qitemselectionmodel.h \ + /usr/include/qt5/QtWidgets/qabstractitemdelegate.h \ + /usr/include/qt5/QtWidgets/qstyleoption.h \ + /usr/include/qt5/QtWidgets/qabstractspinbox.h \ + /usr/include/qt5/QtGui/qvalidator.h \ + /usr/include/qt5/QtWidgets/qslider.h \ + /usr/include/qt5/QtWidgets/qabstractslider.h \ + /usr/include/qt5/QtWidgets/qstyle.h \ + /usr/include/qt5/QtWidgets/qtabbar.h \ + /usr/include/qt5/QtWidgets/qrubberband.h \ + /usr/include/qt5/QtWidgets/QListWidget \ + /usr/include/qt5/QtWidgets/qlistwidget.h \ + /usr/include/qt5/QtWidgets/qlistview.h \ + /usr/include/qt5/QtWidgets/QMenu \ + /usr/include/qt5/QtWidgets/qmenu.h \ + /usr/include/qt5/QtWidgets/QMenuBar \ + /usr/include/qt5/QtWidgets/qmenubar.h \ + /usr/include/qt5/QtWidgets/QPushButton \ + /usr/include/qt5/QtWidgets/qpushbutton.h \ + /usr/include/qt5/QtWidgets/qabstractbutton.h \ + /usr/include/qt5/QtWidgets/QSplitter \ + /usr/include/qt5/QtWidgets/qsplitter.h \ + /usr/include/qt5/QtWidgets/QWidget \ + ../QChatClient/chatinputtext.h \ + /usr/include/qt5/QtWidgets/QTextEdit \ + /usr/include/qt5/QtWidgets/qtextedit.h \ + /usr/include/qt5/QtGui/qtextdocument.h \ + /usr/include/qt5/QtGui/qtextoption.h \ + /usr/include/qt5/QtGui/qtextcursor.h \ + /usr/include/qt5/QtGui/qtextformat.h \ + /usr/include/qt5/QtGui/qpen.h \ + /usr/include/qt5/QtGui/QKeyEvent \ + ../QChatClient/chatwidget.h \ + /usr/include/qt5/QtWidgets/QFileDialog \ + /usr/include/qt5/QtWidgets/qfiledialog.h \ + /usr/include/qt5/QtCore/qdir.h \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/QFile \ + /usr/include/qt5/QtCore/QTextStream $(CXX) -c $(CXXFLAGS) $(INCPATH) -o chatroom.o ../QChatClient/chatroom.cpp Socket.o: ../QChatClient/Socket.cpp ../QChatClient/Socket.h \ @@ -2048,7 +2138,67 @@ chatwindow.o: ../QChatClient/chatwindow.cpp ../QChatClient/chatwindow.h \ /usr/include/qt5/QtCore/QRegExp \ ../QChatClient/Socket.h \ ../QChatClient/SocketException.h \ - ui_chatwindow.h + ui_chatwindow.h \ + /usr/include/qt5/QtCore/QVariant \ + /usr/include/qt5/QtWidgets/QAction \ + /usr/include/qt5/QtWidgets/qaction.h \ + /usr/include/qt5/QtWidgets/qactiongroup.h \ + /usr/include/qt5/QtWidgets/QApplication \ + /usr/include/qt5/QtWidgets/qapplication.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtWidgets/qdesktopwidget.h \ + /usr/include/qt5/QtGui/qguiapplication.h \ + /usr/include/qt5/QtGui/qinputmethod.h \ + /usr/include/qt5/QtWidgets/QButtonGroup \ + /usr/include/qt5/QtWidgets/qbuttongroup.h \ + /usr/include/qt5/QtWidgets/QGridLayout \ + /usr/include/qt5/QtWidgets/qgridlayout.h \ + /usr/include/qt5/QtWidgets/qlayout.h \ + /usr/include/qt5/QtWidgets/qlayoutitem.h \ + /usr/include/qt5/QtWidgets/qboxlayout.h \ + /usr/include/qt5/QtWidgets/QHeaderView \ + /usr/include/qt5/QtWidgets/qheaderview.h \ + /usr/include/qt5/QtWidgets/qabstractitemview.h \ + /usr/include/qt5/QtWidgets/qabstractscrollarea.h \ + /usr/include/qt5/QtWidgets/qframe.h \ + /usr/include/qt5/QtCore/qitemselectionmodel.h \ + /usr/include/qt5/QtWidgets/qabstractitemdelegate.h \ + /usr/include/qt5/QtWidgets/qstyleoption.h \ + /usr/include/qt5/QtWidgets/qabstractspinbox.h \ + /usr/include/qt5/QtGui/qvalidator.h \ + /usr/include/qt5/QtWidgets/qslider.h \ + /usr/include/qt5/QtWidgets/qabstractslider.h \ + /usr/include/qt5/QtWidgets/qstyle.h \ + /usr/include/qt5/QtWidgets/qtabbar.h \ + /usr/include/qt5/QtWidgets/qrubberband.h \ + /usr/include/qt5/QtWidgets/QMenu \ + /usr/include/qt5/QtWidgets/qmenu.h \ + /usr/include/qt5/QtWidgets/QMenuBar \ + /usr/include/qt5/QtWidgets/qmenubar.h \ + /usr/include/qt5/QtWidgets/QPushButton \ + /usr/include/qt5/QtWidgets/qpushbutton.h \ + /usr/include/qt5/QtWidgets/qabstractbutton.h \ + /usr/include/qt5/QtWidgets/QSpacerItem \ + /usr/include/qt5/QtWidgets/QSplitter \ + /usr/include/qt5/QtWidgets/qsplitter.h \ + /usr/include/qt5/QtWidgets/QWidget \ + ../QChatClient/chatinputtext.h \ + /usr/include/qt5/QtWidgets/QTextEdit \ + /usr/include/qt5/QtWidgets/qtextedit.h \ + /usr/include/qt5/QtGui/qtextdocument.h \ + /usr/include/qt5/QtGui/qtextoption.h \ + /usr/include/qt5/QtGui/qtextcursor.h \ + /usr/include/qt5/QtGui/qtextformat.h \ + /usr/include/qt5/QtGui/qpen.h \ + /usr/include/qt5/QtGui/QKeyEvent \ + ../QChatClient/chatwidget.h \ + /usr/include/qt5/QtWidgets/QFileDialog \ + /usr/include/qt5/QtWidgets/qfiledialog.h \ + /usr/include/qt5/QtCore/qdir.h \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/QFile \ + /usr/include/qt5/QtCore/QTextStream $(CXX) -c $(CXXFLAGS) $(INCPATH) -o chatwindow.o ../QChatClient/chatwindow.cpp chatinputtext.o: ../QChatClient/chatinputtext.cpp ../QChatClient/chatinputtext.h \ diff --git a/build-QChatClient-Desktop-Debug/QChatClient b/build-QChatClient-Desktop-Debug/QChatClient index 20ab739..34c8c25 100755 Binary files a/build-QChatClient-Desktop-Debug/QChatClient and b/build-QChatClient-Desktop-Debug/QChatClient differ diff --git a/build-QChatClient-Desktop-Debug/chatwindow.o b/build-QChatClient-Desktop-Debug/chatwindow.o index ba8f827..9bc9f7f 100644 Binary files a/build-QChatClient-Desktop-Debug/chatwindow.o and b/build-QChatClient-Desktop-Debug/chatwindow.o differ diff --git a/build-QChatClient-Desktop-Debug/loginscreen.o b/build-QChatClient-Desktop-Debug/loginscreen.o index ea6eb09..50995e9 100644 Binary files a/build-QChatClient-Desktop-Debug/loginscreen.o and b/build-QChatClient-Desktop-Debug/loginscreen.o differ diff --git a/build-QChatClient-Desktop-Debug/main.o b/build-QChatClient-Desktop-Debug/main.o index caa5e80..e628880 100644 Binary files a/build-QChatClient-Desktop-Debug/main.o and b/build-QChatClient-Desktop-Debug/main.o differ diff --git a/build-QChatClient-Desktop-Debug/moc_chatroom.cpp b/build-QChatClient-Desktop-Debug/moc_chatroom.cpp index c5114d2..6da2c94 100644 --- a/build-QChatClient-Desktop-Debug/moc_chatroom.cpp +++ b/build-QChatClient-Desktop-Debug/moc_chatroom.cpp @@ -19,8 +19,8 @@ QT_BEGIN_MOC_NAMESPACE struct qt_meta_stringdata_Chatroom_t { - QByteArrayData data[13]; - char stringdata[134]; + QByteArrayData data[20]; + char stringdata[244]; }; #define QT_MOC_LITERAL(idx, ofs, len) \ Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ @@ -32,21 +32,31 @@ static const qt_meta_stringdata_Chatroom_t qt_meta_stringdata_Chatroom = { QT_MOC_LITERAL(0, 0, 8), QT_MOC_LITERAL(1, 9, 15), QT_MOC_LITERAL(2, 25, 0), -QT_MOC_LITERAL(3, 26, 10), -QT_MOC_LITERAL(4, 37, 6), -QT_MOC_LITERAL(5, 44, 7), -QT_MOC_LITERAL(6, 52, 8), -QT_MOC_LITERAL(7, 61, 12), -QT_MOC_LITERAL(8, 74, 7), -QT_MOC_LITERAL(9, 82, 18), -QT_MOC_LITERAL(10, 101, 16), -QT_MOC_LITERAL(11, 118, 5), -QT_MOC_LITERAL(12, 124, 8) +QT_MOC_LITERAL(3, 26, 21), +QT_MOC_LITERAL(4, 48, 21), +QT_MOC_LITERAL(5, 70, 10), +QT_MOC_LITERAL(6, 81, 6), +QT_MOC_LITERAL(7, 88, 15), +QT_MOC_LITERAL(8, 104, 6), +QT_MOC_LITERAL(9, 111, 12), +QT_MOC_LITERAL(10, 124, 7), +QT_MOC_LITERAL(11, 132, 18), +QT_MOC_LITERAL(12, 151, 16), +QT_MOC_LITERAL(13, 168, 5), +QT_MOC_LITERAL(14, 174, 12), +QT_MOC_LITERAL(15, 187, 8), +QT_MOC_LITERAL(16, 196, 14), +QT_MOC_LITERAL(17, 211, 14), +QT_MOC_LITERAL(18, 226, 7), +QT_MOC_LITERAL(19, 234, 8) }, - "Chatroom\0messagesToPrint\0\0createChat\0" - "sender\0newChat\0peerNick\0startSession\0" - "sendMsg\0disconnectChatroom\0launchChatWindow\0" - "index\0printMsg\0" + "Chatroom\0messagesToPrint\0\0" + "serverMessagesToPrint\0statusMessagesToPrint\0" + "createChat\0sender\0toggleConnected\0" + "status\0startSession\0sendMsg\0" + "disconnectChatroom\0launchChatWindow\0" + "index\0setConnected\0printMsg\0printServerMsg\0" + "printStatusMsg\0newChat\0peerNick\0" }; #undef QT_MOC_LITERAL @@ -56,36 +66,48 @@ static const uint qt_meta_data_Chatroom[] = { 7, // revision 0, // classname 0, 0, // classinfo - 8, 14, // methods + 14, 14, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors 0, // flags - 2, // signalCount + 5, // signalCount // signals: name, argc, parameters, tag, flags - 1, 0, 54, 2, 0x05, - 3, 1, 55, 2, 0x05, + 1, 0, 84, 2, 0x05, + 3, 0, 85, 2, 0x05, + 4, 0, 86, 2, 0x05, + 5, 1, 87, 2, 0x05, + 7, 1, 90, 2, 0x05, // slots: name, argc, parameters, tag, flags - 5, 1, 58, 2, 0x08, - 7, 0, 61, 2, 0x0a, - 8, 0, 62, 2, 0x0a, - 9, 0, 63, 2, 0x0a, - 10, 1, 64, 2, 0x0a, - 12, 0, 67, 2, 0x08, + 9, 0, 93, 2, 0x0a, + 10, 0, 94, 2, 0x0a, + 11, 0, 95, 2, 0x0a, + 12, 1, 96, 2, 0x0a, + 14, 1, 99, 2, 0x0a, + 15, 0, 102, 2, 0x08, + 16, 0, 103, 2, 0x08, + 17, 0, 104, 2, 0x08, + 18, 1, 105, 2, 0x08, // signals: parameters QMetaType::Void, - QMetaType::Void, QMetaType::QString, 4, + QMetaType::Void, + QMetaType::Void, + QMetaType::Void, QMetaType::QString, 6, + QMetaType::Void, QMetaType::Bool, 8, // slots: parameters - QMetaType::Void, QMetaType::QString, 6, QMetaType::Void, QMetaType::Void, QMetaType::Void, - QMetaType::Void, QMetaType::QModelIndex, 11, + QMetaType::Void, QMetaType::QModelIndex, 13, + QMetaType::Void, QMetaType::Bool, 8, QMetaType::Void, + QMetaType::Void, + QMetaType::Void, + QMetaType::Void, QMetaType::QString, 19, 0 // eod }; @@ -96,13 +118,19 @@ void Chatroom::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, vo Chatroom *_t = static_cast(_o); switch (_id) { case 0: _t->messagesToPrint(); break; - case 1: _t->createChat((*reinterpret_cast< QString(*)>(_a[1]))); break; - case 2: _t->newChat((*reinterpret_cast< QString(*)>(_a[1]))); break; - case 3: _t->startSession(); break; - case 4: _t->sendMsg(); break; - case 5: _t->disconnectChatroom(); break; - case 6: _t->launchChatWindow((*reinterpret_cast< QModelIndex(*)>(_a[1]))); break; - case 7: _t->printMsg(); break; + case 1: _t->serverMessagesToPrint(); break; + case 2: _t->statusMessagesToPrint(); break; + case 3: _t->createChat((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 4: _t->toggleConnected((*reinterpret_cast< bool(*)>(_a[1]))); break; + case 5: _t->startSession(); break; + case 6: _t->sendMsg(); break; + case 7: _t->disconnectChatroom(); break; + case 8: _t->launchChatWindow((*reinterpret_cast< QModelIndex(*)>(_a[1]))); break; + case 9: _t->setConnected((*reinterpret_cast< bool(*)>(_a[1]))); break; + case 10: _t->printMsg(); break; + case 11: _t->printServerMsg(); break; + case 12: _t->printStatusMsg(); break; + case 13: _t->newChat((*reinterpret_cast< QString(*)>(_a[1]))); break; default: ; } } else if (_c == QMetaObject::IndexOfMethod) { @@ -115,9 +143,27 @@ void Chatroom::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, vo } } { + typedef void (Chatroom::*_t)(); + if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&Chatroom::serverMessagesToPrint)) { + *result = 1; + } + } + { + typedef void (Chatroom::*_t)(); + if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&Chatroom::statusMessagesToPrint)) { + *result = 2; + } + } + { typedef void (Chatroom::*_t)(QString ); if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&Chatroom::createChat)) { - *result = 1; + *result = 3; + } + } + { + typedef void (Chatroom::*_t)(bool ); + if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&Chatroom::toggleConnected)) { + *result = 4; } } } @@ -148,13 +194,13 @@ int Chatroom::qt_metacall(QMetaObject::Call _c, int _id, void **_a) if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { - if (_id < 8) + if (_id < 14) qt_static_metacall(this, _c, _id, _a); - _id -= 8; + _id -= 14; } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { - if (_id < 8) + if (_id < 14) *reinterpret_cast(_a[0]) = -1; - _id -= 8; + _id -= 14; } return _id; } @@ -166,9 +212,28 @@ void Chatroom::messagesToPrint() } // SIGNAL 1 +void Chatroom::serverMessagesToPrint() +{ + QMetaObject::activate(this, &staticMetaObject, 1, 0); +} + +// SIGNAL 2 +void Chatroom::statusMessagesToPrint() +{ + QMetaObject::activate(this, &staticMetaObject, 2, 0); +} + +// SIGNAL 3 void Chatroom::createChat(QString _t1) { void *_a[] = { 0, const_cast(reinterpret_cast(&_t1)) }; - QMetaObject::activate(this, &staticMetaObject, 1, _a); + QMetaObject::activate(this, &staticMetaObject, 3, _a); +} + +// SIGNAL 4 +void Chatroom::toggleConnected(bool _t1) +{ + void *_a[] = { 0, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 4, _a); } QT_END_MOC_NAMESPACE diff --git a/build-QChatClient-Desktop-Debug/moc_chatroom.o b/build-QChatClient-Desktop-Debug/moc_chatroom.o index f1b49de..ea9df57 100644 Binary files a/build-QChatClient-Desktop-Debug/moc_chatroom.o and b/build-QChatClient-Desktop-Debug/moc_chatroom.o differ -- libgit2 0.22.2