20 #ifndef BTMULTIFILECACHE_H
21 #define BTMULTIFILECACHE_H
26 #include "cachefile.h"
39 class KTORRENT_EXPORT MultiFileCache :
public Cache
42 MultiFileCache(Torrent& tor,
const QString & tmpdir,
const QString & datadir,
bool custom_output_name);
43 ~MultiFileCache()
override;
45 void changeTmpDir(
const QString& ndir)
override;
46 void create()
override;
47 PieceData::Ptr loadPiece(Chunk* c, Uint32 off, Uint32 length)
override;
48 PieceData::Ptr preparePiece(Chunk* c, Uint32 off, Uint32 length)
override;
49 void savePiece(PieceData::Ptr piece)
override;
50 void close()
override;
52 Job* moveDataFiles(
const QString & ndir)
override;
53 void moveDataFilesFinished(Job* job)
override;
54 Job* moveDataFiles(
const QMap<TorrentFileInterface*, QString> & files)
override;
55 void moveDataFilesFinished(
const QMap<TorrentFileInterface*, QString> & files, Job* job)
override;
56 QString getOutputPath()
const override;
57 void changeOutputPath(
const QString & outputpath)
override;
59 bool hasMissingFiles(QStringList & sl)
override;
60 Job* deleteDataFiles()
override;
61 Uint64 diskUsage()
override;
62 void loadFileMap()
override;
63 void saveFileMap()
override;
64 bool getMountPoints(QSet<QString>& mps)
override;
68 void downloadStatusChanged(
TorrentFile*,
bool)
override;
69 void saveFirstAndLastChunk(
TorrentFile* tf,
const QString & src_file,
const QString & dst_file);
70 void recreateFile(
TorrentFile* tf,
const QString & dnd_file,
const QString & output_file);
71 PieceData::Ptr createPiece(
Chunk* c, Uint32 off, Uint32 length,
bool read_only);
72 void calculateOffsetAndLength(Uint32 piece_off, Uint32 piece_len, Uint64 file_off, Uint32 chunk_off, Uint32 chunk_len, Uint64 & off, Uint32 & len);
75 QString cache_dir, output_dir;
76 QMap<Uint32, CacheFile::Ptr> files;
77 QMap<Uint32, DNDFile::Ptr> dnd_files;
78 QString new_output_dir;