-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcharclient.h
43 lines (36 loc) · 847 Bytes
/
charclient.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
41
42
43
#ifndef CHATCLIENT_H
#define CHATCLIENT_H
#include <QWidget>
#include <QTcpSocket>
#include <QTextEdit>
#include <QLineEdit>
#include <QPushButton>
#include <QVBoxLayout>
#include <QDateTime>
class ChatClient : public QWidget
{
Q_OBJECT
public:
explicit ChatClient(QWidget* parent = nullptr);
private slots:
void onConnected();
void onDisconnected();
void onReadyRead();
void onTextChange();
void sendMessage();
void getAccessToken();
QString getAnswer(const QString& question);
private:
QTextEdit* m_textEdit;
QLineEdit* m_lineEdit;
QPushButton* m_sendButton;
QVBoxLayout* m_layout;
QTcpSocket* m_socket;
// 讯飞API相关信息
QString m_appId;
QString m_apiKey;
QString m_apiSecret;
QString m_accessToken;
QDateTime m_expireTime;
};
#endif // CHATCLIENT_H