QTfrontend/util/FileEngine.cpp
author nemo
Fri, 14 Dec 2012 09:53:17 -0500
changeset 8290 3240f4500ac1
parent 8206 1633a6510834
child 8330 aaefa587e277
permissions -rw-r--r--
Try to be friendlier to small screen sizes. Use 800x600 if width/height of 2/3rds is smaller than 800x600 (things don't look smaller than that size), use desktop size if it is for some reason smaller than 800x600
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     1
/* borrowed from https://github.com/skhaz/qt-physfs-wrapper
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     2
 * TODO: add copyright header, determine license
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     3
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     4
8052
845b5ae03841 Mount .hwt files found in Data folder
unc0rr
parents: 7955
diff changeset
     5
#include "hwpacksmounter.h"
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     6
#include "FileEngine.h"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     7
7770
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
     8
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
     9
const QString FileEngineHandler::scheme = "physfs:/";
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
    10
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    11
FileEngine::FileEngine(const QString& filename)
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
    12
    : m_handle(NULL)
8206
1633a6510834 Create hedgewars.ini if not exists manually,
unc0rr
parents: 8178
diff changeset
    13
    , m_size(0)
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
    14
    , m_flags(0)
8112
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
    15
    , m_bufferSet(false)
8178
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    16
    , m_readWrite(false)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    17
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    18
    setFileName(filename);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    19
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    20
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    21
FileEngine::~FileEngine()
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    22
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    23
    close();
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    24
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    25
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    26
bool FileEngine::open(QIODevice::OpenMode openMode)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    27
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    28
    close();
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    29
8178
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    30
    if ((openMode & QIODevice::ReadWrite) == QIODevice::ReadWrite) {
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    31
        m_handle = PHYSFS_openAppend(m_fileName.toUtf8().constData());
8206
1633a6510834 Create hedgewars.ini if not exists manually,
unc0rr
parents: 8178
diff changeset
    32
        if(m_handle)
1633a6510834 Create hedgewars.ini if not exists manually,
unc0rr
parents: 8178
diff changeset
    33
        {
1633a6510834 Create hedgewars.ini if not exists manually,
unc0rr
parents: 8178
diff changeset
    34
            m_readWrite = true;
1633a6510834 Create hedgewars.ini if not exists manually,
unc0rr
parents: 8178
diff changeset
    35
            seek(0);
1633a6510834 Create hedgewars.ini if not exists manually,
unc0rr
parents: 8178
diff changeset
    36
        }
8178
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    37
    }
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    38
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    39
    else if (openMode & QIODevice::WriteOnly) {
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
    40
        m_handle = PHYSFS_openWrite(m_fileName.toUtf8().constData());
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
    41
        m_flags = QAbstractFileEngine::WriteOwnerPerm | QAbstractFileEngine::WriteUserPerm | QAbstractFileEngine::FileType;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    42
    }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    43
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    44
    else if (openMode & QIODevice::ReadOnly) {
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
    45
        m_handle = PHYSFS_openRead(m_fileName.toUtf8().constData());
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    46
    }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    47
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    48
    else if (openMode & QIODevice::Append) {
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
    49
        m_handle = PHYSFS_openAppend(m_fileName.toUtf8().constData());
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    50
    }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    51
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    52
    else {
8098
4efee370e2de - Fix saving .ini files
unc0rr
parents: 8085
diff changeset
    53
        qWarning("[PHYSFS] Bad file open mode: %d", (int)openMode);
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    54
    }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    55
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
    56
    if (!m_handle) {
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
    57
        qWarning("[PHYSFS] Failed to open %s, reason: %s", m_fileName.toUtf8().constData(), PHYSFS_getLastError());
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    58
        return false;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    59
    }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    60
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    61
    return true;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    62
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    63
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    64
bool FileEngine::close()
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    65
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    66
    if (isOpened()) {
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
    67
        int result = PHYSFS_close(m_handle);
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
    68
        m_handle = NULL;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    69
        return result != 0;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    70
    }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    71
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    72
    return true;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    73
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    74
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    75
bool FileEngine::flush()
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    76
{
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
    77
    return PHYSFS_flush(m_handle) != 0;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    78
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    79
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    80
qint64 FileEngine::size() const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    81
{
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
    82
    return m_size;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    83
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    84
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    85
qint64 FileEngine::pos() const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    86
{
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
    87
    return PHYSFS_tell(m_handle);
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    88
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    89
8178
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    90
bool FileEngine::setSize(qint64 size)
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    91
{
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    92
    if(size == 0)
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    93
    {
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    94
        m_size = 0;
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    95
        return open(QIODevice::WriteOnly);
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    96
    }
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    97
    else
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    98
        return false;
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
    99
}
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   100
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   101
bool FileEngine::seek(qint64 pos)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   102
{
8178
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   103
    bool ok = PHYSFS_seek(m_handle, pos) != 0;
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   104
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   105
    return ok;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   106
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   107
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   108
bool FileEngine::isSequential() const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   109
{
7770
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   110
    return false;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   111
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   112
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   113
bool FileEngine::remove()
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   114
{
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   115
    return PHYSFS_delete(m_fileName.toUtf8().constData()) != 0;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   116
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   117
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   118
bool FileEngine::mkdir(const QString &dirName, bool createParentDirectories) const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   119
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   120
    Q_UNUSED(createParentDirectories);
8206
1633a6510834 Create hedgewars.ini if not exists manually,
unc0rr
parents: 8178
diff changeset
   121
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   122
    return PHYSFS_mkdir(dirName.toUtf8().constData()) != 0;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   123
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   124
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   125
bool FileEngine::rmdir(const QString &dirName, bool recurseParentDirectories) const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   126
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   127
    Q_UNUSED(recurseParentDirectories);
8206
1633a6510834 Create hedgewars.ini if not exists manually,
unc0rr
parents: 8178
diff changeset
   128
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   129
    return PHYSFS_delete(dirName.toUtf8().constData()) != 0;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   130
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   131
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   132
bool FileEngine::caseSensitive() const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   133
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   134
    return true;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   135
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   136
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   137
bool FileEngine::isRelativePath() const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   138
{
8178
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   139
    return false;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   140
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   141
7770
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   142
QAbstractFileEngineIterator * FileEngine::beginEntryList(QDir::Filters filters, const QStringList &filterNames)
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   143
{
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   144
    return new FileEngineIterator(filters, filterNames, entryList(filters, filterNames));
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   145
}
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   146
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   147
QStringList FileEngine::entryList(QDir::Filters filters, const QStringList &filterNames) const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   148
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   149
    Q_UNUSED(filters);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   150
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   151
    QString file;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   152
    QStringList result;
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   153
    char **files = PHYSFS_enumerateFiles(m_fileName.toUtf8().constData());
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   154
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   155
    for (char **i = files; *i != NULL; i++) {
7770
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   156
        file = QString::fromUtf8(*i);
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   157
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   158
        if (filterNames.isEmpty() || QDir::match(filterNames, file)) {
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   159
            result << file;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   160
        }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   161
    }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   162
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   163
    PHYSFS_freeList(files);
7770
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   164
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   165
    return result;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   166
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   167
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   168
QAbstractFileEngine::FileFlags FileEngine::fileFlags(FileFlags type) const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   169
{
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   170
    return type & m_flags;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   171
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   172
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   173
QString FileEngine::fileName(FileName file) const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   174
{
8085
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   175
    switch(file)
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   176
    {
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   177
        case QAbstractFileEngine::AbsolutePathName:
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   178
        {
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   179
            QString s(PHYSFS_getWriteDir());
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   180
            return s;
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   181
        }
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   182
        case QAbstractFileEngine::BaseName:
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   183
        {
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   184
            int l = m_fileName.lastIndexOf('/');
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   185
            QString s = m_fileName.mid(l + 1);
8085
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   186
            return s;
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   187
        }
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   188
        case QAbstractFileEngine::DefaultName:
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   189
        case QAbstractFileEngine::AbsoluteName:
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   190
        default:
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   191
        {
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   192
            QString s = "physfs:/" + m_fileName;
8085
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   193
            return s;
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   194
        }
6c059add1560 Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
unc0rr
parents: 8052
diff changeset
   195
    }
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   196
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   197
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   198
QDateTime FileEngine::fileTime(FileTime time) const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   199
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   200
    switch (time)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   201
    {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   202
        case QAbstractFileEngine::ModificationTime:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   203
        default:
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   204
            return m_date;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   205
            break;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   206
    };
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   207
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   208
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   209
void FileEngine::setFileName(const QString &file)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   210
{
7770
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   211
    if(file.startsWith(FileEngineHandler::scheme))
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   212
        m_fileName = file.mid(FileEngineHandler::scheme.size());
7770
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   213
    else
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   214
        m_fileName = file;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   215
    PHYSFS_Stat stat;
8178
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   216
    if (PHYSFS_stat(m_fileName.toUtf8().constData(), &stat) != 0) {        
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   217
        m_size = stat.filesize;
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   218
        m_date = QDateTime::fromTime_t(stat.modtime);
8206
1633a6510834 Create hedgewars.ini if not exists manually,
unc0rr
parents: 8178
diff changeset
   219
//        m_flags |= QAbstractFileEngine::WriteOwnerPerm;
1633a6510834 Create hedgewars.ini if not exists manually,
unc0rr
parents: 8178
diff changeset
   220
        m_flags |= QAbstractFileEngine::ReadOwnerPerm;
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   221
        m_flags |= QAbstractFileEngine::ReadUserPerm;
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   222
        m_flags |= QAbstractFileEngine::ExistsFlag;
8206
1633a6510834 Create hedgewars.ini if not exists manually,
unc0rr
parents: 8178
diff changeset
   223
        m_flags |= QAbstractFileEngine::LocalDiskFlag;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   224
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   225
        switch (stat.filetype)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   226
        {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   227
            case PHYSFS_FILETYPE_REGULAR:
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   228
                m_flags |= QAbstractFileEngine::FileType;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   229
                break;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   230
            case PHYSFS_FILETYPE_DIRECTORY:
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   231
                m_flags |= QAbstractFileEngine::DirectoryType;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   232
                break;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   233
            case PHYSFS_FILETYPE_SYMLINK:
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   234
                m_flags |= QAbstractFileEngine::LinkType;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   235
                break;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   236
            default: ;
7955
85b3970b402a - Load teams via physfs
unc0rr
parents: 7931
diff changeset
   237
        }
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   238
    }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   239
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   240
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   241
bool FileEngine::atEnd() const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   242
{
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   243
    return PHYSFS_eof(m_handle) != 0;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   244
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   245
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   246
qint64 FileEngine::read(char *data, qint64 maxlen)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   247
{
8178
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   248
    if(m_readWrite)
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   249
    {
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   250
        if(pos() == 0)
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   251
            open(QIODevice::ReadOnly);
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   252
        else
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   253
            return -1;
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   254
    }
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   255
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   256
    qint64 len = PHYSFS_readBytes(m_handle, data, maxlen);
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   257
    return len;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   258
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   259
8112
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   260
qint64 FileEngine::readLine(char *data, qint64 maxlen)
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   261
{
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   262
    if(!m_bufferSet)
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   263
    {
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   264
        PHYSFS_setBuffer(m_handle, 4096);
8112
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   265
        m_bufferSet = true;
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   266
    }
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   267
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   268
    qint64 bytesRead = 0;
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   269
    while(PHYSFS_readBytes(m_handle, data, 1)
8112
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   270
          && maxlen
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   271
          && (*data == '\n'))
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   272
    {
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   273
        ++data;
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   274
        --maxlen;
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   275
        ++bytesRead;
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   276
    }
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   277
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   278
    return bytesRead;
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   279
}
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   280
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   281
qint64 FileEngine::write(const char *data, qint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   282
{
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   283
    return PHYSFS_writeBytes(m_handle, data, len);
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   284
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   285
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   286
bool FileEngine::isOpened() const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   287
{
8115
ac1007c6dea8 Refactor identifiers names
unc0rr
parents: 8112
diff changeset
   288
    return m_handle != NULL;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   289
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   290
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   291
QFile::FileError FileEngine::error() const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   292
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   293
    return QFile::UnspecifiedError;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   294
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   295
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   296
QString FileEngine::errorString() const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   297
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   298
    return PHYSFS_getLastError();
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   299
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   300
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   301
bool FileEngine::supportsExtension(Extension extension) const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   302
{
8112
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   303
    return
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   304
            (extension == QAbstractFileEngine::AtEndExtension)
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   305
            || (extension == QAbstractFileEngine::FastReadLineExtension)
d85dc8a8f41c Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents: 8098
diff changeset
   306
            ;
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   307
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   308
7770
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   309
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   310
FileEngineHandler::FileEngineHandler(char *argv0)
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   311
{
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   312
    PHYSFS_init(argv0);
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   313
}
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   314
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   315
FileEngineHandler::~FileEngineHandler()
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   316
{
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   317
    PHYSFS_deinit();
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   318
}
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   319
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   320
QAbstractFileEngine* FileEngineHandler::create(const QString &filename) const
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   321
{
7770
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   322
    if (filename.startsWith(scheme))
8178
8bd087478b48 Fix QSettings problems:
unc0rr
parents: 8115
diff changeset
   323
        return new FileEngine(filename);
7770
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   324
    else
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   325
        return NULL;
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   326
}
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   327
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   328
void FileEngineHandler::mount(const QString &path)
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   329
{
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   330
    PHYSFS_mount(path.toUtf8().constData(), NULL, 1);
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   331
}
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   332
7955
85b3970b402a - Load teams via physfs
unc0rr
parents: 7931
diff changeset
   333
void FileEngineHandler::mount(const QString & path, const QString & mountPoint)
85b3970b402a - Load teams via physfs
unc0rr
parents: 7931
diff changeset
   334
{
85b3970b402a - Load teams via physfs
unc0rr
parents: 7931
diff changeset
   335
    PHYSFS_mount(path.toUtf8().constData(), mountPoint.toUtf8().constData(), 1);
85b3970b402a - Load teams via physfs
unc0rr
parents: 7931
diff changeset
   336
}
85b3970b402a - Load teams via physfs
unc0rr
parents: 7931
diff changeset
   337
7770
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   338
void FileEngineHandler::setWriteDir(const QString &path)
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   339
{
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   340
    PHYSFS_setWriteDir(path.toUtf8().constData());
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   341
}
7770
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   342
8052
845b5ae03841 Mount .hwt files found in Data folder
unc0rr
parents: 7955
diff changeset
   343
void FileEngineHandler::mountPacks()
845b5ae03841 Mount .hwt files found in Data folder
unc0rr
parents: 7955
diff changeset
   344
{
845b5ae03841 Mount .hwt files found in Data folder
unc0rr
parents: 7955
diff changeset
   345
    hedgewarsMountPackages();
845b5ae03841 Mount .hwt files found in Data folder
unc0rr
parents: 7955
diff changeset
   346
}
7770
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   347
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   348
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   349
FileEngineIterator::FileEngineIterator(QDir::Filters filters, const QStringList &nameFilters, const QStringList &entries)
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   350
    : QAbstractFileEngineIterator(filters, nameFilters)
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   351
{
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   352
    m_entries = entries;
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   353
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   354
    /* heck.. docs are unclear on this
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   355
     * QDirIterator puts iterator before first entry
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   356
     * but QAbstractFileEngineIterator example puts iterator on first entry
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   357
     * though QDirIterator approach seems to be the right one
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   358
     */
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   359
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   360
    m_index = -1;
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   361
}
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   362
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   363
bool FileEngineIterator::hasNext() const
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   364
{
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   365
    return m_index < m_entries.size() - 1;
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   366
}
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   367
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   368
QString FileEngineIterator::next()
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   369
{
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   370
   if (!hasNext())
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   371
       return QString();
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   372
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   373
   ++m_index;
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   374
   return currentFilePath();
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   375
}
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   376
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   377
QString FileEngineIterator::currentFileName() const
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   378
{
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   379
    return m_entries.at(m_index);
ff3442338882 Many bugfixes and features to FileEngine
unc0rr
parents: 7768
diff changeset
   380
}