diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-16 03:50:31 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-16 03:50:31 (GMT) |
commit | ac0fc4e9b0ed314e7d49e8dc0e9ded0922aab8e9 (patch) | |
tree | 58eb9feaa85fb02c3c15980f58964b112ca9d02d /src/script/api/qscriptengine.cpp | |
parent | 140a96d0b860b045c18d53c1ac96e77b3893d31c (diff) | |
parent | 551d704cdafae46cdccc6217bb7f36da7e84be2d (diff) | |
download | Qt-ac0fc4e9b0ed314e7d49e8dc0e9ded0922aab8e9.zip Qt-ac0fc4e9b0ed314e7d49e8dc0e9ded0922aab8e9.tar.gz Qt-ac0fc4e9b0ed314e7d49e8dc0e9ded0922aab8e9.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (34 commits)
Fix duplicate project entry in visual studio solution file.
Doc
qdoc: Added the index and fixed images in the extra files list.
Speed up qsTr() by caching the translation context
Crash while printing from the portedcanvas example on Mac Cocoa.
qdoc: Fixed .qdocconf files for assistant.
Disable debug-only framework builds on Mac.
Compile (with -no-pch)
Add missing QT_NO_BEARERMANAGEMENT ifdefs.
Introduce a qconfig feature for Bearer Management
Fix MOBILITY-404
Remove holes in bearer management data structures.
Don't link bearer plugins against QtGui unnecessarily.
Added missing newline after warning message when using -L with qml
Doc: updating scripts
Fixed a crash on embedded due to uninitialized pointer.
Fix a race where QThread::exit() is "lost" when called after start()
qdoc: Removed all <table> attributes in favor of using css.
Autotest failure: dialogModality test fails on cocoa (macgui)
Force the bic test to compile in 32-bit mode on Mac
...
Diffstat (limited to 'src/script/api/qscriptengine.cpp')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 58c8d83..f732907 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -792,6 +792,7 @@ JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JS if ((args.size() > 2) && !args.at(2).isNumber()) return JSC::throwError(exec, JSC::GeneralError, "qsTranslate(): third argument (n) must be a number"); #ifndef QT_NO_QOBJECT + QScriptEnginePrivate *engine = scriptEngineFromExec(exec); JSC::UString context; // The first non-empty source URL in the call stack determines the translation context. { @@ -799,7 +800,7 @@ JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JS while (frame) { if (frame->codeBlock() && frame->codeBlock()->source() && !frame->codeBlock()->source()->url().isEmpty()) { - context = QFileInfo(frame->codeBlock()->source()->url()).baseName(); + context = engine->translationContextFromUrl(frame->codeBlock()->source()->url()); break; } frame = frame->callerFrame()->removeHostCallFrameFlag(); @@ -921,6 +922,8 @@ QScriptEnginePrivate::QScriptEnginePrivate() activeAgent = 0; agentLineNumber = -1; processEventsInterval = -1; + cachedTranslationUrl = JSC::UString(); + cachedTranslationContext = JSC::UString(); JSC::setCurrentIdentifierTable(oldTable); } @@ -3307,6 +3310,15 @@ bool QScriptEnginePrivate::hasDemarshalFunction(int type) const return info && (info->demarshal != 0); } +JSC::UString QScriptEnginePrivate::translationContextFromUrl(const JSC::UString &url) +{ + if (url != cachedTranslationUrl) { + cachedTranslationContext = QFileInfo(url).baseName(); + cachedTranslationUrl = url; + } + return cachedTranslationContext; +} + /*! \internal */ |