author | unc0rr |
Thu, 22 Nov 2012 23:19:01 +0400 | |
branch | flibqtfrontend |
changeset 8094 | 6c5b4e69f03d |
parent 8055 | 04dd8b7fb605 |
child 8112 | d85dc8a8f41c |
permissions | -rw-r--r-- |
7768 | 1 |
#ifndef _FileEngine_h |
2 |
#define _FileEngine_h |
|
3 |
||
4 |
#include <QAbstractFileEngine> |
|
5 |
#include <QAbstractFileEngineHandler> |
|
7770 | 6 |
#include <QAbstractFileEngineIterator> |
7768 | 7 |
#include <QDateTime> |
8 |
||
9 |
#include "physfs.h" |
|
10 |
||
11 |
||
12 |
||
13 |
class FileEngine : public QAbstractFileEngine |
|
14 |
{ |
|
15 |
public: |
|
16 |
FileEngine(const QString& filename); |
|
17 |
||
18 |
virtual ~FileEngine(); |
|
19 |
||
20 |
virtual bool open(QIODevice::OpenMode openMode); |
|
21 |
virtual bool close(); |
|
22 |
virtual bool flush(); |
|
23 |
virtual qint64 size() const; |
|
24 |
virtual qint64 pos() const; |
|
25 |
virtual bool seek(qint64 pos); |
|
26 |
virtual bool isSequential() const; |
|
27 |
virtual bool remove(); |
|
28 |
virtual bool mkdir(const QString &dirName, bool createParentDirectories) const; |
|
29 |
virtual bool rmdir(const QString &dirName, bool recurseParentDirectories) const; |
|
30 |
virtual bool caseSensitive() const; |
|
31 |
virtual bool isRelativePath() const; |
|
7770 | 32 |
QAbstractFileEngineIterator *beginEntryList(QDir::Filters filters, const QStringList & filterNames); |
7768 | 33 |
virtual QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const; |
34 |
virtual FileFlags fileFlags(FileFlags type=FileInfoAll) const; |
|
35 |
virtual QString fileName(FileName file=DefaultName) const; |
|
36 |
virtual QDateTime fileTime(FileTime time) const; |
|
37 |
virtual void setFileName(const QString &file); |
|
38 |
bool atEnd() const; |
|
39 |
||
40 |
virtual qint64 read(char *data, qint64 maxlen); |
|
41 |
virtual qint64 write(const char *data, qint64 len); |
|
42 |
||
43 |
bool isOpened() const; |
|
44 |
||
45 |
QFile::FileError error() const; |
|
46 |
QString errorString() const; |
|
47 |
||
48 |
virtual bool supportsExtension(Extension extension) const; |
|
49 |
||
50 |
private: |
|
51 |
PHYSFS_file *_handler; |
|
52 |
qint64 _size; |
|
53 |
FileFlags _flags; |
|
54 |
QString _filename; |
|
55 |
QDateTime _datetime; |
|
56 |
}; |
|
57 |
||
58 |
class FileEngineHandler : public QAbstractFileEngineHandler |
|
59 |
{ |
|
60 |
public: |
|
7770 | 61 |
FileEngineHandler(char * argv0); |
62 |
~FileEngineHandler(); |
|
63 |
||
7768 | 64 |
QAbstractFileEngine *create(const QString &filename) const; |
7770 | 65 |
|
8055
04dd8b7fb605
- Download .hwp files into Data folder and mount them immediately (yes, could cause problems in case of overlapped contents)
unc0rr
parents:
8052
diff
changeset
|
66 |
static void mount(const QString & path); |
04dd8b7fb605
- Download .hwp files into Data folder and mount them immediately (yes, could cause problems in case of overlapped contents)
unc0rr
parents:
8052
diff
changeset
|
67 |
static void mount(const QString & path, const QString & mountPoint); |
04dd8b7fb605
- Download .hwp files into Data folder and mount them immediately (yes, could cause problems in case of overlapped contents)
unc0rr
parents:
8052
diff
changeset
|
68 |
static void setWriteDir(const QString & path); |
04dd8b7fb605
- Download .hwp files into Data folder and mount them immediately (yes, could cause problems in case of overlapped contents)
unc0rr
parents:
8052
diff
changeset
|
69 |
static void mountPacks(); |
7770 | 70 |
|
71 |
// private: |
|
72 |
static const QString scheme; |
|
73 |
}; |
|
74 |
||
75 |
class FileEngineIterator : public QAbstractFileEngineIterator |
|
76 |
{ |
|
77 |
public: |
|
78 |
FileEngineIterator(QDir::Filters filters, const QStringList & nameFilters, const QStringList & entries); |
|
79 |
||
80 |
bool hasNext() const; |
|
81 |
QString next(); |
|
82 |
QString currentFileName() const; |
|
83 |
private: |
|
84 |
QStringList m_entries; |
|
85 |
int m_index; |
|
7768 | 86 |
}; |
87 |
||
88 |
#endif |