-rw-r--r-- | noncore/apps/opie-console/file_layer.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/file_layer.h b/noncore/apps/opie-console/file_layer.h index bf31540..edb30e1 100644 --- a/noncore/apps/opie-console/file_layer.h +++ b/noncore/apps/opie-console/file_layer.h | |||
@@ -1,69 +1,94 @@ | |||
1 | #ifndef OPIE_FILE_LAYER_H | 1 | #ifndef OPIE_FILE_LAYER_H |
2 | #define OPIE_FILE_LAYER_H | 2 | #define OPIE_FILE_LAYER_H |
3 | 3 | ||
4 | #include <qmap.h> | 4 | #include <qmap.h> |
5 | 5 | ||
6 | #include "io_layer.h" | 6 | #include "io_layer.h" |
7 | 7 | ||
8 | class QFile; | 8 | class QFile; |
9 | /** | 9 | /** |
10 | * this is the layer for sending files | 10 | * this is the layer for sending files |
11 | */ | 11 | */ |
12 | class FileTransferLayer : public QObject { | 12 | class FileTransferLayer : public QObject { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | 14 | ||
15 | public: | 15 | public: |
16 | enum Errors{ | 16 | enum Errors{ |
17 | NotSupported, | 17 | NotSupported, |
18 | StartError, | 18 | StartError, |
19 | NoError, | 19 | NoError, |
20 | Unknown, | 20 | Unknown, |
21 | Undefined, | 21 | Undefined, |
22 | Incomplete | 22 | Incomplete |
23 | }; | 23 | }; |
24 | enum Features { | ||
25 | Append = 0, | ||
26 | Twostop = 1, | ||
27 | Escape = 2, | ||
28 | Rename = 4, | ||
29 | FullPath = 8, | ||
30 | SendIfNewer = 16, | ||
31 | SendIfLonger = 32, | ||
32 | Resume = 64 | ||
33 | |||
34 | }; | ||
35 | enum Mode { | ||
36 | Ascii = 0, | ||
37 | Binary | ||
38 | }; | ||
39 | enum BlockSize { | ||
40 | Block_1k, | ||
41 | Block_4k, | ||
42 | Block_8k | ||
43 | }; | ||
24 | /** | 44 | /** |
25 | *the io layer to be used | 45 | *the io layer to be used |
26 | */ | 46 | */ |
27 | FileTransferLayer( IOLayer* ); | 47 | FileTransferLayer( IOLayer* ); |
28 | virtual ~FileTransferLayer(); | 48 | virtual ~FileTransferLayer(); |
29 | 49 | ||
30 | public slots: | 50 | public slots: |
51 | |||
52 | virtual void sendFile( const QString& file, | ||
53 | Mode mode, BlockSize blk, | ||
54 | Features feat ) {}; | ||
55 | |||
31 | /** | 56 | /** |
32 | * send a file over the layer | 57 | * send a file over the layer |
33 | */ | 58 | */ |
34 | virtual void sendFile( const QString& file ) = 0; | 59 | virtual void sendFile( const QString& file ) = 0; |
35 | virtual void sendFile( const QFile& ) = 0; | 60 | virtual void sendFile( const QFile& ) = 0; |
36 | virtual void cancel() = 0; | 61 | virtual void cancel() = 0; |
37 | 62 | ||
38 | signals: | 63 | signals: |
39 | /** | 64 | /** |
40 | * sent the file | 65 | * sent the file |
41 | */ | 66 | */ |
42 | void sent(); | 67 | void sent(); |
43 | 68 | ||
44 | /** | 69 | /** |
45 | * an error occured | 70 | * an error occured |
46 | */ | 71 | */ |
47 | 72 | ||
48 | void error( int, const QString& ); | 73 | void error( int, const QString& ); |
49 | 74 | ||
50 | /* | 75 | /* |
51 | * @param file The file to send | 76 | * @param file The file to send |
52 | * @param progress the progress made from 0-100 | 77 | * @param progress the progress made from 0-100 |
53 | * @param speed Speed in bps | 78 | * @param speed Speed in bps |
54 | * @param hours The hours it take to finish | 79 | * @param hours The hours it take to finish |
55 | * @param minutes The minutes it takes to finish | 80 | * @param minutes The minutes it takes to finish |
56 | * @param send The seconds... | 81 | * @param send The seconds... |
57 | * | 82 | * |
58 | */ | 83 | */ |
59 | void progress( const QString& file, int progress, int speed, int hours, int minutes, int seconds ); | 84 | void progress( const QString& file, int progress, int speed, int hours, int minutes, int seconds ); |
60 | 85 | ||
61 | protected: | 86 | protected: |
62 | IOLayer* layer(); | 87 | IOLayer* layer(); |
63 | 88 | ||
64 | private: | 89 | private: |
65 | IOLayer* m_layer; | 90 | IOLayer* m_layer; |
66 | 91 | ||
67 | }; | 92 | }; |
68 | 93 | ||
69 | #endif | 94 | #endif |