-
Notifications
You must be signed in to change notification settings - Fork 0
/
chatwindow.h
66 lines (51 loc) · 1.21 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef CHATWINDOW_H
#define CHATWINDOW_H
#include "vpetinterface.h"
#include "qheaders.h"
#include "secondthread.h"
#include "voicethread.h"
namespace Ui {
class ChatWindow;
}
class ChatWindow : public QWidget
{
Q_OBJECT
public:
explicit ChatWindow(QWidget *mainApp = nullptr, QWidget *parent = nullptr);
~ChatWindow();
enum MsgType
{
User = 0,
LLM = 1
};
void InitializeUI();
void InitializeChat();
void addMessage(const QString &text, MsgType type);
inline int countNewLine(const QString &text)
{
int cnt = 0;
for(int i = 0; i < text.length(); i++)
{
if(text[i] == '\n')
cnt++;
}
return cnt;
}
signals:
void windowClose();
void returnPressed();
public slots:
void onSettingsClicked();
void onMessageSent();
void onGetResult(QString result);
protected:
void closeEvent(QCloseEvent *event) override;
// void paintEvent(QPaintEvent *event) override;
bool eventFilter(QObject *target, QEvent *event) override;
private:
Ui::ChatWindow *ui;
VPetInterface *p = nullptr;
SecondThread *thread;
// QVBoxLayout *layout = nullptr;
};
#endif // CHATWINDOW_H