blob: 96b30e586f7ab6b774f328f4972737dcff340d81 (
plain) (
blame)
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
|
#ifndef SERVERFILETRANSFERT_H_
#define SERVERFILETRANSFERT_H_
#include <QtGui>
#include <QtNetwork>
#include "ui_clientFileSendDialog.h"
/*namespace Ui
{
class ClientFileSendDialogClass;
}*/
class ServerFileTransfert: public QDialog,
private Ui::ClientFileSendDialogClass
{
Q_OBJECT
public:
ServerFileTransfert (QWidget *parent=0);
~ServerFileTransfert ();
void sendFileToHost(QString host);
void sendFileToHost(QString host, QString filename);
void receiveFileFromHost(QTcpSocket* socket);
//Ui::ClientFileSendDialogClass* uitr;
private Q_SLOTS:
void sendHeader();
void receiveHeader();
void receiveAck();
void sendFile();
void receiveFile();
void close();
void error(QAbstractSocket::SocketError error);
private:
void sendAck(bool b);
QString formatSize(qint64 size);
QTcpSocket *_socket;
QFile *_file;
qint64 _bytesToWrite;
qint64 _bytesToRead;
int div;
};
#endif /* SERVERFILETRANSFERT_H_ */
|