diff options
author | João Abecasis <joao.abecasis@nokia.com> | 2010-08-06 14:04:27 (GMT) |
---|---|---|
committer | João Abecasis <joao.abecasis@nokia.com> | 2010-08-09 17:45:24 (GMT) |
commit | 2e7d5def1fdabb5949fbffc629da500aa2bb78d7 (patch) | |
tree | d9801ac9b8faebe302cb4a37526ccc412e500532 /src | |
parent | b738719a192c49f9bab64cebfa2bad67b9630870 (diff) | |
download | Qt-2e7d5def1fdabb5949fbffc629da500aa2bb78d7.zip Qt-2e7d5def1fdabb5949fbffc629da500aa2bb78d7.tar.gz Qt-2e7d5def1fdabb5949fbffc629da500aa2bb78d7.tar.bz2 |
There goes QResourceFileEngineHandler
There's no reason why resources can't be handled in the default handler.
Reviewed-by: Marius Storm-Olsen
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qabstractfileengine.cpp | 7 | ||||
-rw-r--r-- | src/corelib/io/qresource.cpp | 23 |
2 files changed, 7 insertions, 23 deletions
diff --git a/src/corelib/io/qabstractfileengine.cpp b/src/corelib/io/qabstractfileengine.cpp index d6b6f11..75eaeb4 100644 --- a/src/corelib/io/qabstractfileengine.cpp +++ b/src/corelib/io/qabstractfileengine.cpp @@ -41,6 +41,9 @@ #include "qabstractfileengine.h" #include "private/qabstractfileengine_p.h" +#ifdef QT_BUILD_CORE_LIB +#include "private/qresource_p.h" +#endif #include "qdatetime.h" #include "qreadwritelock.h" #include "qvariant.h" @@ -179,7 +182,9 @@ QAbstractFileEngine *QAbstractFileEngine::create(const QString &fileName) #ifdef QT_BUILD_CORE_LIB if (!fileName.startsWith(QLatin1Char('/'))) { int prefixSeparator = fileName.indexOf(QLatin1Char(':')); - if (prefixSeparator > 1) { + if (prefixSeparator == 0) { + return new QResourceFileEngine(fileName); + } else if (prefixSeparator > 1) { QString prefix = fileName.left(prefixSeparator); QString fileNameWithoutPrefix = fileName.mid(prefixSeparator + 1).prepend(QLatin1Char('/')); const QStringList &paths = QDir::searchPaths(prefix); diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index ce9c57e..929885c 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -1185,21 +1185,6 @@ QResource::unregisterResource(const uchar *rccData, const QString &resourceRoot) return false; } -//file type handler -class QResourceFileEngineHandler : public QAbstractFileEngineHandler -{ -public: - QResourceFileEngineHandler() { } - ~QResourceFileEngineHandler() { } - QAbstractFileEngine *create(const QString &path) const; -}; -QAbstractFileEngine *QResourceFileEngineHandler::create(const QString &path) const -{ - if (path.size() > 0 && path.startsWith(QLatin1Char(':'))) - return new QResourceFileEngine(path); - return 0; -} - //resource engine class QResourceFileEnginePrivate : public QAbstractFileEnginePrivate { @@ -1506,12 +1491,6 @@ bool QResourceFileEnginePrivate::unmap(uchar *ptr) return true; } -//Initialization and cleanup -Q_GLOBAL_STATIC(QResourceFileEngineHandler, resource_file_handler) - -static int qt_force_resource_init() { resource_file_handler(); return 1; } -Q_CORE_EXPORT void qInitResourceIO() { resource_file_handler(); } -static int qt_forced_resource_init = qt_force_resource_init(); -Q_CONSTRUCTOR_FUNCTION(qt_force_resource_init) +Q_CORE_EXPORT void qInitResourceIO() { } // ### Qt 5: remove QT_END_NAMESPACE |