summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2011-07-06 13:43:47 +1000
committerQt by Nokia <qt-info@nokia.com>2011-08-30 13:18:28 +0200
commit809ee66b67ce70dba89a04b92daccc9445af2e75 (patch)
tree84c6d4023312d72583ccfcd2ad79df4fdf714527 /tools
parentf8f9db6cc74a34d3648ac693196c0f5d4bda9c50 (diff)
More efficient type name cache
Instead of creating completely separate hashes for all the types used by every QML file, we simply link to the QDeclarativeTypeModule. This uses much less memory, and is faster to construct at startup. Change-Id: I28bc2807074f9c6f38096d6e4ce8be744159d023 Reviewed-on: http://codereview.qt.nokia.com/3741 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlscene/main.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index e6603adbd8..ed2512c1f4 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -358,6 +358,7 @@ static void checkAndAdaptVersion(const QUrl &url)
}
QRegExp quick1("^\\s*import +QtQuick +1\\.");
+ QRegExp quick2("^\\s*import +QtQuick +2\\.");
QRegExp qt47("^\\s*import +Qt +4\\.7");
QString envToWrite;
@@ -365,16 +366,20 @@ static void checkAndAdaptVersion(const QUrl &url)
QTextStream stream(&f);
bool codeFound= false;
- while (!codeFound && envToWrite.isEmpty()) {
+ while (!codeFound) {
QString line = stream.readLine();
if (line.contains("{"))
codeFound = true;
- if (quick1.indexIn(line) >= 0) {
+ if (envToWrite.isEmpty() && quick1.indexIn(line) >= 0) {
envToWrite = QLatin1String("quick1");
compat = QLatin1String("QtQuick 1.0");
- } else if (qt47.indexIn(line) >= 0) {
+ } else if (envToWrite.isEmpty() && qt47.indexIn(line) >= 0) {
envToWrite = QLatin1String("qt");
compat = QLatin1String("Qt 4.7");
+ } else if (quick2.indexIn(line) >= 0) {
+ envToWrite.clear();
+ compat.clear();
+ break;
}
}