-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.h
More file actions
110 lines (81 loc) · 2.27 KB
/
mainwindow.h
File metadata and controls
110 lines (81 loc) · 2.27 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
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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTcpSocket>
#include "filemessage.h"
#include <QFile>
#include <QElapsedTimer>
#include <QTimer>
#include "notificationmanager.h"
#include <QQueue>
#include "SimpleStreamCipher.h"
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE
class encryptionwindow;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
QTcpSocket *socket;
QByteArray sendEncryptionRequest();
void sendEncryptionTest();
QString document_folder;
QString cache_file_path;
QString transfer_file_path;
QString root_folder_name;
private:
Ui::MainWindow *ui;
QString selectedFilePath;
QString selectedFolderPath;
int mode = 0;
int pairPartnerId = -1;
int myId = -1;
long long current_total_file_size;
long long current_file_size;
QString current_file_name;
fileMessage *currentFileMessage = nullptr;
QFile* current_file = nullptr;
qint64 bytesReceivedThisSecond = 0;
QElapsedTimer speedTimer;
QTimer *updateTimer = nullptr;
int flushIndex = 0;
bool sendingFile = false;
bool sendingFolder = false;
QMetaObject::Connection uploadConn;
bool hardSend = false;
qint64 CHUNK_SIZE = 1024*256;
QQueue<QString> fileQueue;
NotificationManager *notificationManager = nullptr;
void sendFile(bool);
void sendMessage(const QString messageToSend);
void sendFileChunk();
void scrollToBottom();
void UpdateLastIp();
void sendDirectories();
quint16 filesToRecieve = 0;
int lastProgress = -1;
QByteArray encryptionKey;
QByteArray nonce;
encryptionwindow *encryptionDialogWindow = nullptr;
SimpleStreamCipher *recCipher = nullptr;
SimpleStreamCipher *sendCipher = nullptr;
private slots:
void on_fileDialogButton_clicked();
void on_folderDialogButton_clicked();
void on_connectButton_clicked();
void on_RemoveFileButton_clicked();
void on_pairButton_clicked();
void on_sendButton_clicked();
void on_AddIpButton_clicked();
void on_settingsButton_clicked();
signals:
void fileCheckReplyReceived();
protected:
void closeEvent(QCloseEvent *event) override;
};
#endif // MAINWINDOW_H