diff options
Diffstat (limited to 'src/qml/qml/qqmlengine.cpp')
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 1320f51d25..f8e5ad5874 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -101,6 +101,9 @@ #ifdef Q_OS_WIN // for %APPDATA% #include <qt_windows.h> +# if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +# include <shlobj.h> +# endif #include <qlibrary.h> #include <windows.h> @@ -556,7 +559,7 @@ QQmlEnginePrivate::QQmlEnginePrivate(QQmlEngine *e) workerScriptEngine(0), activeVME(0), activeObjectCreator(0), networkAccessManager(0), networkAccessManagerFactory(0), urlInterceptor(0), - scarceResourcesRefCount(0), typeLoader(e), importDatabase(e), uniqueId(1), + scarceResourcesRefCount(0), importDatabase(e), typeLoader(e), uniqueId(1), incubatorCount(0), incubationController(0), mutex(QMutex::Recursive) { useNewCompiler = qmlUseNewCompiler(); @@ -1339,14 +1342,6 @@ void qmlExecuteDeferred(QObject *object) QQmlData *data = QQmlData::get(object); if (data && data->deferredData && !data->wasDeleted(object)) { - QQmlObjectCreatingProfiler prof; - if (prof.enabled) { - QQmlType *type = QQmlMetaType::qmlType(object->metaObject()); - prof.setTypeName(type ? type->qmlTypeName() - : QString::fromUtf8(object->metaObject()->className())); - if (data->outerContext) - prof.setLocation(data->outerContext->url, data->lineNumber, data->columnNumber); - } QQmlEnginePrivate *ep = QQmlEnginePrivate::get(data->context->engine); QQmlComponentPrivate::ConstructionState state; @@ -1734,6 +1729,16 @@ void QQmlData::setPendingBindingBit(QObject *obj, int coreIndex) QQmlData_setBit(this, obj, coreIndex * 2 + 1); } +void QQmlData::ensurePropertyCache(QQmlEngine *engine, QObject *object) +{ + Q_ASSERT(engine); + QQmlData *ddata = QQmlData::get(object, /*create*/true); + if (ddata->propertyCache) + return; + ddata->propertyCache = QQmlEnginePrivate::get(engine)->cache(object); + if (ddata->propertyCache) ddata->propertyCache->addref(); +} + void QQmlEnginePrivate::sendQuit() { Q_Q(QQmlEngine); @@ -2283,6 +2288,28 @@ bool QQmlEnginePrivate::isScriptLoaded(const QUrl &url) const return typeLoader.isScriptLoaded(url); } +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +// Normalize a file name using Shell API. As opposed to converting it +// to a short 8.3 name and back, this also works for drives where 8.3 notation +// is disabled (see 8dot3name options of fsutil.exe). +static inline QString shellNormalizeFileName(const QString &name) +{ + const QString nativeSeparatorName(QDir::toNativeSeparators(name)); + const LPCTSTR nameC = reinterpret_cast<LPCTSTR>(nativeSeparatorName.utf16()); + PIDLIST_ABSOLUTE file; + if (FAILED(SHParseDisplayName(nameC, NULL, &file, 0, NULL))) + return name; + TCHAR buffer[MAX_PATH]; + if (!SHGetPathFromIDList(file, buffer)) + return name; + QString canonicalName = QString::fromWCharArray(buffer); + // Upper case drive letter + if (canonicalName.size() > 2 && canonicalName.at(1) == QLatin1Char(':')) + canonicalName[0] = canonicalName.at(0).toUpper(); + return QDir::cleanPath(canonicalName); +} +#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT + bool QQml_isFileCaseCorrect(const QString &fileName, int lengthIn /* = -1 */) { #if defined(Q_OS_MAC) || defined(Q_OS_WIN) @@ -2292,14 +2319,7 @@ bool QQml_isFileCaseCorrect(const QString &fileName, int lengthIn /* = -1 */) #if defined(Q_OS_MAC) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) const QString canonical = info.canonicalFilePath(); #elif defined(Q_OS_WIN) - wchar_t buffer[1024]; - - DWORD rv = ::GetShortPathName((wchar_t*)absolute.utf16(), buffer, 1024); - if (rv == 0 || rv >= 1024) return true; - rv = ::GetLongPathName(buffer, buffer, 1024); - if (rv == 0 || rv >= 1024) return true; - - const QString canonical = QString::fromWCharArray(buffer); + const QString canonical = shellNormalizeFileName(absolute); #endif const int absoluteLength = absolute.length(); |