21 #ifndef BT_TORRENTFILESTREAM_H
22 #define BT_TORRENTFILESTREAM_H
25 #include <QWeakPointer>
26 #include <QSharedPointer>
27 #include <ktorrent_export.h>
28 #include <util/constants.h>
35 class TorrentInterface;
43 class KTORRENT_EXPORT TorrentFileStream :
public QIODevice
47 TorrentFileStream(TorrentControl* tc,ChunkManager* cman,
bool streaming_mode,QObject* parent);
48 TorrentFileStream(TorrentControl* tc,Uint32 file_index,ChunkManager* cman,
bool streaming_mode,QObject* parent);
49 ~TorrentFileStream()
override;
52 bool open(QIODevice::OpenMode mode)
override;
55 void close()
override;
58 qint64 pos()
const override;
61 qint64 size()
const override;
64 bool seek(qint64 pos)
override;
67 bool atEnd()
const override;
70 bool reset()
override;
73 qint64 bytesAvailable()
const override;
76 bool isSequential()
const override {
return false;}
85 Uint32 currentChunk()
const;
87 typedef QSharedPointer<TorrentFileStream> Ptr;
88 typedef QWeakPointer<TorrentFileStream> WPtr;
91 qint64 writeData(
const char* data, qint64 len)
override;
92 qint64 readData(
char* data, qint64 maxlen)
override;
93 void emitReadChannelFinished();
105 #endif // BT_TORRENTFILESTREAM_H