forked from liaoxl/moondark-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwidget.h
65 lines (50 loc) · 1.58 KB
/
widget.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
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <QUdpSocket>
#include <QTextFormat>
#include "tcpclient.h"
#include "tcpserver.h"
namespace Ui {
class Widget;
}
class TcpServer;
enum MessageType{Message, NewParticipant, ParticipantLeft, FileName, Refuse};
class Widget : public QWidget
{
Q_OBJECT
public:
explicit Widget(QWidget *parent = 0);
~Widget();
protected:
void newParticipant(QString userName, QString localHostName, QString ipAddress);
void participantLeft(QString userName, QString localHostName, QString time);
void sendMessage(MessageType type, QString serverAddress="");
void hasPendingFile(QString userName, QString serverAddress, QString clientAddress, QString fileName);
QString getIP();
QString getUserName();
QString getMessage();
void closeEvent(QCloseEvent *);
private:
Ui::Widget *ui;
QUdpSocket *udpSocket;
qint16 port;
QString fileName;
TcpServer *server;
QColor color;
private slots:
void processPendingDatagrams();
void getFileName(QString);
void currentFormatChanged(const QTextCharFormat &format);
void on_sendButton_clicked();
void on_sendToolBtn_clicked();
void on_fontComboBox_currentFontChanged(const QFont &f);
void on_sizeComboBox_currentIndexChanged(const QString &arg1);
void on_boldToolBtn_clicked(bool checked);
void on_italicToolBtn_clicked(bool checked);
void on_underlineToolBtn_clicked(bool checked);
void on_colorToolBtn_clicked();
void on_clearToolBtn_clicked();
void on_exitButton_clicked();
};
#endif // WIDGET_H