forked from vell001/VFeiQ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChatForm.h
150 lines (114 loc) · 3.51 KB
/
ChatForm.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/**********************************************************************
** Copyright (C) 2014 vell001
** Author: VellBibi
** Description:
**
**********************************************************************/
#ifndef CHATFORM_H
#define CHATFORM_H
#include <QWidget>
#include "service/ChatService.h"
#include "service/FileMessageService.h"
#include <QListWidgetItem>
#include <QKeyEvent>
#include <model/User.h>
#include <QList>
#include <QFontDialog>
#include <QColorDialog>
#include <QFileDialog>
#include <QSettings>
#include "service/ChatRecordService.h"
#include "service/IconService.h"
#include <QStringList>
#include <QFile>
#include <QHash>
#include <QPair>
#include <QStandardItemModel>
#include <QProgressBar>
#include <QMessageBox>
#include "model/FileSender.h"
#include "model/FileReceiver.h"
#include "model/FileMessage.h"
#include "MessageDialog.h"
#include <QDesktopServices>
#include "SharedFilesDialog.h"
#include "ScreenshotsWidget.h"
#include "FacesDialog.h"
namespace Ui {
class ChatForm;
}
class ChatForm : public QWidget
{
Q_OBJECT
public:
explicit ChatForm(User *receiver, QWidget *parent = 0);
~ChatForm();
protected:
void keyPressEvent(QKeyEvent *e);
virtual void closeEvent ( QCloseEvent * event );
private slots:
void on_sendButton_clicked();
void sendError(QUuid messageUuid, QString errorMessage);
void sendSuccess(QUuid messageUuid);
void receiveSuccess(QHostAddress senderIp, quint16 senderPort, ChatMessage message);
void fileMsgReceived(QHostAddress senderIp, quint16 senderPort, ChatMessage message);
void fileSendEnd(qint64);
void fileSendError(QString);
void fileSendProgress(qint64,qint64);
void fileReceiveEnd(qint64);
void fileReceiveError(QString);
void fileReceiveProgress(qint64,qint64);
void shakeTimeOut();
void facesClicked(Image image);
void screenshotsFinish(QPixmap);
void on_closeButton_clicked();
void on_fontButton_clicked();
void on_colorButton_clicked();
void on_facesButton_clicked();
void on_choseFileButton_clicked();
void on_cancelSendButton_clicked();
void on_sendFileButton_clicked();
void on_saveReceiveButton_clicked();
void on_cancelReceiveButton_clicked();
void on_chatRecordBrowser_anchorClicked(const QUrl &arg1);
void on_shakeButton_clicked();
void on_sharedFilesButton_clicked();
void on_grapScreenButton_clicked();
void on_sendImageButton_clicked();
signals:
void closed(QUuid receiverUuid);
private:
Ui::ChatForm *ui;
ChatService *mChatService;
User *sender;
User *receiver;
void sendMessage();
QList<ChatRecord *> mChatRecords;
void updateChatRecordView();
IconService *mIconService;
void loadSetting();
void saveSetting();
QStandardItemModel *sendFileModel;
QStandardItemModel *receiveFileModel;
FileSender *mFileSender;
FileReceiver *mFileReceiver;
FileMessage *mFileMessage;
FileMessageService *mFileMsgService;
int fileSendRow;
int fileReceiveRow;
QString saveDirName;
void clearSendFiles();
void clearReceiveFiles();
// shake
QTimer* mShakeTimer;
int mShakePosition;
QPoint mShakeCurPos;
int shakeMaxLimitTimes;
int shakeMaxLimitSpace;
void startShake();
// screen shot
ScreenshotsWidget *mScreenshotsWidget;
// faces
FacesDialog mFacesDialog;
};
#endif // CHATFORM_H