summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-17 18:30:02 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-17 18:30:02 (GMT)
commit66620e60c9526baf0d3c7a7198e3ab15d9abc0f8 (patch)
tree10a0fd8097aa2322fd91fe477b5b44e62d850396 /src/script
parentfd36b47e8758562fc9ff350f292fc9ae9ed91d4e (diff)
parent14845c8f3bba8437a89fa0843a884a5bdd2ad07f (diff)
downloadQt-66620e60c9526baf0d3c7a7198e3ab15d9abc0f8.zip
Qt-66620e60c9526baf0d3c7a7198e3ab15d9abc0f8.tar.gz
Qt-66620e60c9526baf0d3c7a7198e3ab15d9abc0f8.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: (71 commits) Autotest: increase wait time to 3s on Windows to bypass 2s-granularity limitation Autotest: update to the new values for the locale do not expand variables in read()'s file name remove ability to use break() a block outside any loop don't add -unix to the qmake command line Increase the timeout for the QNAM getter test to 30 seconds Remove unstable hosts from the list qdoc: Output TOC for more class ref pages. Other fixes to the remote network stresstester Fix SSL connection problem. Make sure we don't try URLs that aren't HTTP or HTTPS Fix menu bar visibility. Add SSL remote host tests Split the remote and the local tests in two, in preparation for SSL tests Add tests for remote hosts Change the way we calculate the average transfer rates. Finish renaming Move these tests to tests/manual. Add a QNetworkAccessManager stresstest Add a non-blocking native function too ...
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/qscriptengine.cpp14
-rw-r--r--src/script/api/qscriptengine_p.h7
2 files changed, 19 insertions, 2 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 7e83277..0b8a2e4 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, "qsTr(): 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
*/
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index 5c2007f..fd47208 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -63,6 +63,7 @@
#include "RegExpObject.h"
#include "SourceProvider.h"
#include "Structure.h"
+#include "UString.h"
#include "JSGlobalObject.h"
#include "JSValue.h"
@@ -73,7 +74,6 @@ namespace JSC
typedef ExecState CallFrame;
class JSCell;
class JSGlobalObject;
- class UString;
}
@@ -298,6 +298,8 @@ public:
static inline QScriptDeclarativeClass *declarativeClass(JSC::JSValue);
static inline QScriptDeclarativeClass::Object *declarativeObject(JSC::JSValue);
+ JSC::UString translationContextFromUrl(const JSC::UString &);
+
#ifndef QT_NO_QOBJECT
JSC::JSValue newQObject(QObject *object,
QScriptEngine::ValueOwnership ownership = QScriptEngine::QtOwnership,
@@ -367,6 +369,9 @@ public:
QScriptValue abortResult;
bool inEval;
+ JSC::UString cachedTranslationUrl;
+ JSC::UString cachedTranslationContext;
+
QSet<QString> importedExtensions;
QSet<QString> extensionsBeingImported;