diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2012-04-10 18:11:30 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-04 13:15:01 +0200 |
commit | 6f3bda0dce945a5fc75d8ebad302820fe9979d9b (patch) | |
tree | 6581aad8a7fb21ccbebe09d23c30af0e3236e266 /src/qml/qml/qqmldirparser.cpp | |
parent | 44f9412bf789d73dd462292038686f5b07026132 (diff) |
Initial bundle support
Change-Id: I095249f64ecf4ef1e3fbfb164e3d50edffab61e8
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmldirparser.cpp')
-rw-r--r-- | src/qml/qml/qqmldirparser.cpp | 48 |
1 files changed, 10 insertions, 38 deletions
diff --git a/src/qml/qml/qqmldirparser.cpp b/src/qml/qml/qqmldirparser.cpp index 82289311c9..2da4a3300b 100644 --- a/src/qml/qml/qqmldirparser.cpp +++ b/src/qml/qml/qqmldirparser.cpp @@ -43,6 +43,7 @@ #include "qqmlerror.h" #include "qqmlglobal_p.h" +#include <QtQml/qqmlfile.h> #include <QtCore/QTextStream> #include <QtCore/QFile> #include <QtCore/QtDebug> @@ -58,26 +59,6 @@ QQmlDirParser::~QQmlDirParser() { } -QUrl QQmlDirParser::url() const -{ - return _url; -} - -void QQmlDirParser::setUrl(const QUrl &url) -{ - _url = url; -} - -QString QQmlDirParser::fileSource() const -{ - return _filePathSouce; -} - -void QQmlDirParser::setFileSource(const QString &filePath) -{ - _filePathSouce = filePath; -} - QString QQmlDirParser::source() const { return _source; @@ -94,6 +75,9 @@ bool QQmlDirParser::isParsed() const return _isParsed; } +/*! +\a url is used for generating errors. +*/ bool QQmlDirParser::parse() { if (_isParsed) @@ -105,23 +89,6 @@ bool QQmlDirParser::parse() _components.clear(); _scripts.clear(); - if (_source.isEmpty() && !_filePathSouce.isEmpty()) { - QFile file(_filePathSouce); - if (!QQml_isFileCaseCorrect(_filePathSouce)) { - QQmlError error; - error.setDescription(QString::fromUtf8("cannot load module \"$$URI$$\": File name case mismatch for \"%1\"").arg(_filePathSouce)); - _errors.prepend(error); - return false; - } else if (file.open(QFile::ReadOnly)) { - _source = QString::fromUtf8(file.readAll()); - } else { - QQmlError error; - error.setDescription(QString::fromUtf8("module \"$$URI$$\" definition \"%1\" not readable").arg(_filePathSouce)); - _errors.prepend(error); - return false; - } - } - QTextStream stream(&_source); int lineNumber = 0; @@ -246,7 +213,6 @@ bool QQmlDirParser::parse() void QQmlDirParser::reportError(int line, int column, const QString &description) { QQmlError error; - error.setUrl(_url); error.setLine(line); error.setColumn(column); error.setDescription(description); @@ -261,6 +227,12 @@ bool QQmlDirParser::hasError() const return false; } +void QQmlDirParser::setError(const QQmlError &e) +{ + _errors.clear(); + _errors.append(e); +} + QList<QQmlError> QQmlDirParser::errors(const QString &uri) const { QList<QQmlError> errors = _errors; |