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
|
#ifndef OPIE_FILE_LAYER_H
#define OPIE_FILE_LAYER_H
#include <qmap.h>
#include "io_layer.h"
class QFile;
/**
* this is the layer for sending files
*/
class FileTransferLayer : public QObject {
Q_OBJECT
public:
enum Errors{
NotSupported,
StartError,
NoError,
Unknown,
Undefined,
Incomplete
};
enum Features {
Append = 0,
Twostop = 1,
Escape = 2,
Rename = 4,
FullPath = 8,
SendIfNewer = 16,
SendIfLonger = 32,
Resume = 64
};
enum Mode {
Ascii = 0,
Binary
};
enum BlockSize {
Block_1k,
Block_4k,
Block_8k
};
/**
*the io layer to be used
*/
FileTransferLayer( IOLayer* );
virtual ~FileTransferLayer();
public slots:
virtual void sendFile( const QString&,
Mode, BlockSize,
Features ) {};
/**
* send a file over the layer
*/
virtual void sendFile( const QString& file ) = 0;
virtual void sendFile( const QFile& ) = 0;
virtual void cancel() = 0;
signals:
/**
* sent the file
*/
void sent();
/**
* an error occured
*/
void error( int, const QString& );
/*
* @param file The file to send
* @param progress the progress made from 0-100
* @param speed Speed in bps
* @param hours The hours it take to finish
* @param minutes The minutes it takes to finish
* @param send The seconds...
*
*/
void progress( const QString& file, int progress, int speed, int hours, int minutes, int seconds );
protected:
IOLayer* layer();
private:
IOLayer* m_layer;
};
#endif
|