#ifndef CHATROOM_H #define CHATROOM_H #include #include "Socket.h" #include "loginscreen.h" #include #include #include #include "chatwindow.h" #include namespace Ui { class Chatroom; } class Chatroom : public QMainWindow { Q_OBJECT public: explicit Chatroom(QWidget *parent = 0); bool getConnected(); void setConnected(bool status); void relayMsg(string& msg); void setNickname(QString nick); QString getNickname(); void putMsgToPrintQueue(string& msg); ~Chatroom(); public slots: void startSession(); void sendMsg(); void printMsg(); private slots: void finishThreads(bool exit); void finish(); void disconnectChatroom(); signals: void threadsFinished(bool exit); void messagesToPrint(); private: Ui::Chatroom *ui; map activeChats; bool connected; string getSender(string& msg); void putMsgToSendQueue(QString& msg); std::thread *send; std::thread *recv; Socket s; QString nickname; list printQueue; }; void sendThread(Socket* s, Chatroom *chat); void recvThread(Socket *s, Chatroom *chat); #endif // CHATROOM_H