First attempt at removing QtQuick 1.1 hardcoding from qml files.
[harmattan/cameraplus] / src / main.cpp
index 9f83baa..7f9758b 100644 (file)
 #include "qt_private/qdeclarativedebughelper_p.h"
 #endif /* QMLJSDEBUGGER */
 
+#include <QAbstractFileEngineHandler>
+#include "qmlfileengine.h"
+
+class QmlFileEngineHandler : public QAbstractFileEngineHandler {
+  QAbstractFileEngine *create(const QString& fileName) const {
+    QString fn = fileName.toLower();
+    if (fn.startsWith(':') && fn.endsWith(".qml")) {
+      return new QmlFileEngine(fileName);
+    }
+
+    return 0;
+  }
+};
+
 Q_DECL_EXPORT int main(int argc, char *argv[]) {
   QApplication::setAttribute(Qt::AA_X11InitThreads, true);
   QApplication app(argc, argv);
 
+  QmlFileEngineHandler handler;
+  Q_UNUSED(handler);
+
 #ifdef QMLJSDEBUGGER
   QDeclarativeDebugHelper::enableDebugging();
 #endif /* QMLJSDEBUGGER */