-
Notifications
You must be signed in to change notification settings - Fork 2
/
ChatWindow.h
40 lines (33 loc) · 840 Bytes
/
ChatWindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef CHATBOX_H
#define CHATBOX_H
#include <QMainWindow>
#include <QTcpSocket>
#include <QTimer>
#include <QtDebug>
#include <QJsonDocument>
#include <QJsonObject>
#include <QUdpSocket>
#include <QJsonArray>
namespace Ui {
class ChatWindow;
}
class ChatWindow : public QMainWindow
{
Q_OBJECT
public:
explicit ChatWindow(QJsonObject object, QTcpSocket *socket, QString name, QWidget *parent = 0, bool isGroupChat = false);
ChatWindow(QTcpSocket *socket, QString name, QWidget *parent, bool isGroupChat = false);
~ChatWindow();
QString chatId;
void update(QJsonObject object);
void update(QString message);
public slots:
void sendMessage();
void leaveChatRoom();
void addFriendInChatRoom();
private:
Ui::ChatWindow *ui;
QTcpSocket *socket;
bool isGroupChat;
};
#endif // CHATBOX_H