-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchat.h
More file actions
84 lines (72 loc) · 1.89 KB
/
chat.h
File metadata and controls
84 lines (72 loc) · 1.89 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef CHAT_H
#define CHAT_H
#include <QDialog>
#include <QtNetwork>
#include <QtGui>
#include "tcpclient.h"
#include "tcpserver.h"
#include<QMessageBox>
#include<QScrollBar>
#include<QFileDialog>
#include<QColorDialog>
#include<QHostAddress>
namespace Ui {
class chat;
}
enum MessageType
{
Message,
NewParticipant,
ParticipantLeft,
FileName,
Refuse,
Xchat
};
class chat : public QDialog
{
Q_OBJECT
public:
~chat();
// chat();
chat(QString pasvusername, QString pasvuserip);
QString xpasvuserip;
QString xpasvusername;
QUdpSocket *xchat;
qint32 xport;
void sendMessage(MessageType type,QString serverAddress="");
quint16 a;
// static qint32 is_opened = 0;
bool is_opened;
public slots:
protected:
void hasPendingFile(QString userName,QString serverAddress, //接收文件
QString clientAddress,QString fileName);
void participantLeft(QString userName,QString localHostName,QString time);
bool eventFilter(QObject *target, QEvent *event); //事件过滤器
private:
Ui::chat *ui;
TcpServer *server;
QColor color;//颜色
bool saveFile(const QString& fileName);//保存聊天记录
QString getMessage();
QString getIP();
QString getUserName();
QString message;
QString fileName;
private slots:
void sentFileName(QString);
void on_sendfile_clicked();
void processPendingDatagrams();
void on_send_clicked();
void on_close_clicked();
void on_clear_clicked();
void on_save_clicked();
void on_textcolor_clicked();
void on_textUnderline_clicked(bool checked);
void on_textitalic_clicked(bool checked);
void on_textbold_clicked(bool checked);
void on_fontComboBox_currentFontChanged(QFont f);
void on_fontsizecomboBox_currentIndexChanged(QString );
void currentFormatChanged(const QTextCharFormat &format);
};
#endif // CHAT_H