-
Notifications
You must be signed in to change notification settings - Fork 7
/
chatwidget.h
165 lines (137 loc) · 4.15 KB
/
chatwidget.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/* DUKTO - A simple, fast and multi-platform file transfer tool for LAN users
* Copyright (C) 2011 Emanuele Colombo
* 2020 KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef CHATWIDGET_H
#define CHATWIDGET_H
#include <QDesktopWidget>
#include <QDialog>
#include <QMouseEvent>
#include <QDateTime>
#include <QDesktopServices>
#include <QClipboard>
#include <QFileDialog>
#include <QUrl>
#include <QRegExp>
#include <QTimer>
#include <QIcon>
#include <QDragEnterEvent>
#include <QDragMoveEvent>
#include <QDragLeaveEvent>
#include <QDropEvent>
#include <QDebug>
#include <QObject>
#include <QNetworkInterface>
#include <QHostAddress>
#include <QScrollBar>
#include "buddylistitemmodel.h"
#include "destinationbuddy.h"
#include "settings.h"
#include "theme.h"
#include "ipaddressitemmodel.h"
#include "daemonipcdbus.h"
#define MAXINPUTLEN 800
class Settings;
namespace Ui {
class ChatWidget;
}
class ChatWidget : public QDialog
{
Q_OBJECT
public:
explicit ChatWidget(QDialog *parent = 0);
~ChatWidget();
void firstStyle();
void showme();
void disableInput();
void focusOut();
void focusIn();
inline Settings* settings() { return mSettings; }
static const QString SPACE_STR;
static const QString SPACE_STR_HTML;
Theme * theme;
DestinationBuddy * dbuddy;
QString ip;
QString myIp;
QTimer *alertTimer;
QHash<QString, QStandardItem*> * buddies;
public slots:
void addTextLog(QString text);
void addLogDirect(QString text);
void onSendCompleted();
void enableInput();
void startTransfer(bool isSend);
void updateTransferStatus(int percent, QString text, bool isSend);
void stopTransfer(bool isSend);
void slotTransferMsg(int code);
void setOnLine(bool isOnLine);
void recvCancel();
void getIsInitiativeConn(bool);
void reSetCw(QString ip, QString user_name , QString system , QString mac , QString Platform);
// 键盘F1响应用户手册
void keyPressEvent(QKeyEvent *event);
protected:
// 注释后使用主题拖动
// void mousePressEvent(QMouseEvent *event);
// void mouseMoveEvent(QMouseEvent *event);
// void mouseReleaseEvent(QMouseEvent *event);
bool eventFilter(QObject *, QEvent *);
signals:
void sendMsg(QString msg);
void sendFiles(QStringList files);
void sendDir(QString dirname);
void sendFileCanceled();
void reSaveCw(QString ip_mac);
void reBindSocket(ChatWidget *);
private slots:
void on_pb_sendmsg_clicked();
void on_pb_sendfile_clicked();
void on_pb_senddir_clicked();
void on_pb_titleicon_clicked();
void leTextChanged(QString);
void teTextChanged();
void openUrl(QUrl url);
void msgAlert();
void on_pb_w_cancel_clicked();
void on_pb_addname_clicked();
void on_pb_checkname_clicked();
private:
Ui::ChatWidget *ui;
enum sendType_ {
Text,
Files,
Dir,
Idle
};
int sendType;
bool isOnLine;
QString textToSend;
QString dirToSend;
QStringList fileToSend;
QPoint mMovePosition;
bool mMoveing;
int timeFlag;
QIcon iconDukto;
QIcon iconBlank;
bool isFocus;
bool isIpExists();
bool findFile(QString path);
Settings *mSettings;
IpAddressItemModel mIpAddresses;
DaemonIpcDbus *mDaemonIpcDbus;
};
#endif // CHATWIDGET_H