From 928bb6dfe9b3d5db9c7d669979ae6ccdf661df38 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 28 Oct 2009 08:41:31 +0100 Subject: Fix namespace build. At least Qt fails building with a namespace on Mac without this change. What happends is that inserting a namespace before the includes, will add the namespace twize if the included files also inserts the namespace. Rev-By: Alexis --- src/gui/kernel/qdesktopwidget.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qdesktopwidget.cpp b/src/gui/kernel/qdesktopwidget.cpp index b1e1008..c6d5000 100644 --- a/src/gui/kernel/qdesktopwidget.cpp +++ b/src/gui/kernel/qdesktopwidget.cpp @@ -40,12 +40,11 @@ ****************************************************************************/ #include "qglobal.h" - -QT_BEGIN_NAMESPACE - #include "qdesktopwidget.h" #include "qwidget_p.h" +QT_BEGIN_NAMESPACE + const QRect QDesktopWidget::screenGeometry(const QWidget *widget) const { QRect rect = QWidgetPrivate::screenGeometry(widget); -- cgit v0.12 From 8cda1c6fef8bd9c4635743fae05158306c2ab09f Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 28 Oct 2009 09:38:21 +0100 Subject: Fix namespace build Looks like a couple of files missed the namespace macro... Rev-By: gunnar --- src/opengl/gl2paintengineex/qtriangulatingstroker.cpp | 4 ++++ src/opengl/gl2paintengineex/qtriangulatingstroker_p.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp index a3c8266..ec05020 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp @@ -42,6 +42,7 @@ #include "qtriangulatingstroker_p.h" #include +QT_BEGIN_NAMESPACE #define CURVE_FLATNESS Q_PI / 8 @@ -338,3 +339,6 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen) m_dash_stroker.end(); } + +QT_END_NAMESPACE + diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h index b7354db..483cea9 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h @@ -48,6 +48,7 @@ #include #include +QT_BEGIN_NAMESPACE class QTriangulatingStroker { @@ -295,5 +296,6 @@ void QTriangulatingStroker::join(const qreal *pts) emitLineSegment(m_cx, m_cy, m_nvx, m_nvy); } +QT_END_NAMESPACE #endif -- cgit v0.12 From 0533c709188d07be0c165838b503124cb6b271e1 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 26 Oct 2009 13:21:27 +0100 Subject: Say hello to QScriptProgram :-) QScriptProgram encapsulates a Qt Script program (AKA a script). It retains the compiled representation of the script, so that repeated evaluation of the same script becomes faster. An overload of QScriptEngine::evaluate() that takes a QScriptProgram has been added. Reviewed-by: Olivier Goffart --- src/script/api/api.pri | 3 + src/script/api/qscriptengine.cpp | 151 ++++++++------ src/script/api/qscriptengine.h | 3 + src/script/api/qscriptengine_p.h | 5 + src/script/api/qscriptprogram.cpp | 225 +++++++++++++++++++++ src/script/api/qscriptprogram.h | 86 ++++++++ src/script/api/qscriptprogram_p.h | 95 +++++++++ tests/auto/qscriptengine/tst_qscriptengine.cpp | 149 ++++++++++++++ .../qscriptengineagent/tst_qscriptengineagent.cpp | 86 ++++++++ .../benchmarks/qscriptengine/tst_qscriptengine.cpp | 19 +- 10 files changed, 763 insertions(+), 59 deletions(-) create mode 100644 src/script/api/qscriptprogram.cpp create mode 100644 src/script/api/qscriptprogram.h create mode 100644 src/script/api/qscriptprogram_p.h diff --git a/src/script/api/api.pri b/src/script/api/api.pri index 17ec9b6..aebadd5 100644 --- a/src/script/api/api.pri +++ b/src/script/api/api.pri @@ -6,6 +6,7 @@ SOURCES += \ $$PWD/qscriptengine.cpp \ $$PWD/qscriptengineagent.cpp \ $$PWD/qscriptextensionplugin.cpp \ + $$PWD/qscriptprogram.cpp \ $$PWD/qscriptstring.cpp \ $$PWD/qscriptvalue.cpp \ $$PWD/qscriptvalueiterator.cpp \ @@ -23,6 +24,8 @@ HEADERS += \ $$PWD/qscriptengineagent_p.h \ $$PWD/qscriptextensioninterface.h \ $$PWD/qscriptextensionplugin.h \ + $$PWD/qscriptprogram.h \ + $$PWD/qscriptprogram_p.h \ $$PWD/qscriptstring.h \ $$PWD/qscriptstring_p.h \ $$PWD/qscriptvalue.h \ diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 9288723..2b60a46 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -51,6 +51,8 @@ #include "qscriptvalue_p.h" #include "qscriptvalueiterator.h" #include "qscriptclass.h" +#include "qscriptprogram.h" +#include "qscriptprogram_p.h" #include "qdebug.h" #include @@ -1155,6 +1157,73 @@ void QScriptEnginePrivate::agentDeleted(QScriptEngineAgent *agent) } } +JSC::JSValue QScriptEnginePrivate::evaluateHelper(JSC::ExecState *exec, intptr_t sourceId, + JSC::EvalExecutable *executable, + bool &compile) +{ + Q_Q(QScriptEngine); + JSC::JSLock lock(false); // ### hmmm + QBoolBlocker inEvalBlocker(inEval, true); + q->currentContext()->activationObject(); //force the creation of a context for native function; + + JSC::Debugger* debugger = originalGlobalObject()->debugger(); + if (debugger) + debugger->evaluateStart(sourceId); + + q->clearExceptions(); + JSC::DynamicGlobalObjectScope dynamicGlobalObjectScope(exec, exec->scopeChain()->globalObject()); + + if (compile) { + JSC::JSObject* error = executable->compile(exec, exec->scopeChain()); + if (error) { + compile = false; + exec->setException(error); + + if (debugger) { + debugger->exceptionThrow(JSC::DebuggerCallFrame(exec, error), sourceId, false); + debugger->evaluateStop(error, sourceId); + } + + return error; + } + } + + JSC::JSValue thisValue = thisForContext(exec); + JSC::JSObject* thisObject = (!thisValue || thisValue.isUndefinedOrNull()) + ? exec->dynamicGlobalObject() : thisValue.toObject(exec); + JSC::JSValue exceptionValue; + timeoutChecker()->setShouldAbort(false); + if (processEventsInterval > 0) + timeoutChecker()->reset(); + + JSC::JSValue result = exec->interpreter()->execute(executable, exec, thisObject, exec->scopeChain(), &exceptionValue); + + if (timeoutChecker()->shouldAbort()) { + if (abortResult.isError()) + exec->setException(scriptValueToJSCValue(abortResult)); + + if (debugger) + debugger->evaluateStop(scriptValueToJSCValue(abortResult), sourceId); + + return scriptValueToJSCValue(abortResult); + } + + if (exceptionValue) { + exec->setException(exceptionValue); + + if (debugger) + debugger->evaluateStop(exceptionValue, sourceId); + + return exceptionValue; + } + + if (debugger) + debugger->evaluateStop(result, sourceId); + + Q_ASSERT(!exec->hadException()); + return result; +} + #ifndef QT_NO_QOBJECT JSC::JSValue QScriptEnginePrivate::newQObject( @@ -2115,75 +2184,41 @@ QScriptSyntaxCheckResult QScriptEnginePrivate::checkSyntax(const QString &progra QScriptValue QScriptEngine::evaluate(const QString &program, const QString &fileName, int lineNumber) { Q_D(QScriptEngine); - - JSC::JSLock lock(false); // ### hmmm - QBoolBlocker inEval(d->inEval, true); - currentContext()->activationObject(); //force the creation of a context for native function; - - JSC::Debugger* debugger = d->originalGlobalObject()->debugger(); - - JSC::UString jscProgram = program; - JSC::UString jscFileName = fileName; - JSC::ExecState* exec = d->currentFrame; WTF::PassRefPtr provider - = QScript::UStringSourceProviderWithFeedback::create(jscProgram, jscFileName, lineNumber, d); + = QScript::UStringSourceProviderWithFeedback::create(program, fileName, lineNumber, d); intptr_t sourceId = provider->asID(); JSC::SourceCode source(provider, lineNumber); //after construction of SourceCode provider variable will be null. - if (debugger) - debugger->evaluateStart(sourceId); - - clearExceptions(); - JSC::DynamicGlobalObjectScope dynamicGlobalObjectScope(exec, exec->scopeChain()->globalObject()); - + JSC::ExecState* exec = d->currentFrame; JSC::EvalExecutable executable(exec, source); - JSC::JSObject* error = executable.compile(exec, exec->scopeChain()); - if (error) { - exec->setException(error); - - if (debugger) { - debugger->exceptionThrow(JSC::DebuggerCallFrame(exec, error), sourceId, false); - debugger->evaluateStop(error, sourceId); - } - - return d->scriptValueFromJSCValue(error); - } - - JSC::JSValue thisValue = d->thisForContext(exec); - JSC::JSObject* thisObject = (!thisValue || thisValue.isUndefinedOrNull()) ? exec->dynamicGlobalObject() : thisValue.toObject(exec); - JSC::JSValue exceptionValue; - d->timeoutChecker()->setShouldAbort(false); - if (d->processEventsInterval > 0) - d->timeoutChecker()->reset(); - JSC::JSValue result = exec->interpreter()->execute(&executable, exec, thisObject, exec->scopeChain(), &exceptionValue); - - if (d->timeoutChecker()->shouldAbort()) { - if (d->abortResult.isError()) - exec->setException(d->scriptValueToJSCValue(d->abortResult)); - - if (debugger) - debugger->evaluateStop(d->scriptValueToJSCValue(d->abortResult), sourceId); - - return d->abortResult; - } - - if (exceptionValue) { - exec->setException(exceptionValue); - - if (debugger) - debugger->evaluateStop(exceptionValue, sourceId); + bool compile = true; + return d->scriptValueFromJSCValue(d->evaluateHelper(exec, sourceId, &executable, compile)); +} - return d->scriptValueFromJSCValue(exceptionValue); - } +/*! + \internal + \since 4.6 - if (debugger) - debugger->evaluateStop(result, sourceId); + Evaluates the given \a program and returns the result of the + evaluation. +*/ +QScriptValue QScriptEngine::evaluate(const QScriptProgram &program) +{ + Q_D(QScriptEngine); + QScriptProgramPrivate *program_d = QScriptProgramPrivate::get(program); + if (!program_d) + return QScriptValue(); - Q_ASSERT(!exec->hadException()); + JSC::ExecState* exec = d->currentFrame; + JSC::EvalExecutable *executable = program_d->executable(exec, d); + bool compile = !program_d->isCompiled; + JSC::JSValue result = d->evaluateHelper(exec, program_d->sourceId, + executable, compile); + if (compile) + program_d->isCompiled = true; return d->scriptValueFromJSCValue(result); } - /*! Returns the current context. diff --git a/src/script/api/qscriptengine.h b/src/script/api/qscriptengine.h index 701f9c6..3f438da 100644 --- a/src/script/api/qscriptengine.h +++ b/src/script/api/qscriptengine.h @@ -67,6 +67,7 @@ class QDateTime; class QScriptClass; class QScriptEngineAgent; class QScriptEnginePrivate; +class QScriptProgram; #ifndef QT_NO_QOBJECT @@ -166,6 +167,8 @@ public: QScriptValue evaluate(const QString &program, const QString &fileName = QString(), int lineNumber = 1); + QScriptValue evaluate(const QScriptProgram &program); + bool isEvaluating() const; void abortEvaluation(const QScriptValue &result = QScriptValue()); diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index ec7c144..d12b0f4 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -70,6 +70,7 @@ namespace JSC { + class EvalExecutable; class ExecState; typedef ExecState CallFrame; class JSCell; @@ -211,6 +212,10 @@ public: const QByteArray &targetType, void **result); + JSC::JSValue evaluateHelper(JSC::ExecState *exec, intptr_t sourceId, + JSC::EvalExecutable *executable, + bool &compile); + QScript::QObjectData *qobjectData(QObject *object); void disposeQObject(QObject *object); void emitSignalHandlerException(); diff --git a/src/script/api/qscriptprogram.cpp b/src/script/api/qscriptprogram.cpp new file mode 100644 index 0000000..c30f381 --- /dev/null +++ b/src/script/api/qscriptprogram.cpp @@ -0,0 +1,225 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "config.h" +#include "qscriptprogram.h" +#include "qscriptprogram_p.h" +#include "qscriptengine.h" +#include "qscriptengine_p.h" + +#include "Executable.h" + +QT_BEGIN_NAMESPACE + +/*! + \internal + + \since 4.6 + \class QScriptProgram + + \brief The QScriptProgram class encapsulates a Qt Script program. + + \ingroup script + + QScriptProgram retains the compiled representation of the script if + possible. Thus, QScriptProgram can be used to evaluate the same + script multiple times more efficiently. + + \code + QScriptEngine engine; + QScriptProgram program("1 + 2"); + QScriptValue result = engine.evaluate(program); + \endcode +*/ + +QScriptProgramPrivate::QScriptProgramPrivate(const QString &src, + const QString &fn, + int ln) + : sourceCode(src), fileName(fn), firstLineNumber(ln), + engine(0), _executable(0), sourceId(-1), isCompiled(false) +{ + ref = 0; +} + +QScriptProgramPrivate::~QScriptProgramPrivate() +{ + delete _executable; +} + +QScriptProgramPrivate *QScriptProgramPrivate::get(const QScriptProgram &q) +{ + return const_cast(q.d_func()); +} + +JSC::EvalExecutable *QScriptProgramPrivate::executable(JSC::ExecState *exec, + QScriptEnginePrivate *eng) +{ + if (_executable) { + if (eng == engine) + return _executable; + delete _executable; + } + WTF::PassRefPtr provider + = QScript::UStringSourceProviderWithFeedback::create(sourceCode, fileName, firstLineNumber, eng); + sourceId = provider->asID(); + JSC::SourceCode source(provider, firstLineNumber); //after construction of SourceCode provider variable will be null. + _executable = new JSC::EvalExecutable(exec, source); + engine = eng; + isCompiled = false; + return _executable; +} + +/*! + Constructs a null QScriptProgram. +*/ +QScriptProgram::QScriptProgram() + : d_ptr(0) +{ +} + +/*! + Constructs a new QScriptProgram with the given \a sourceCode, \a + fileName and \a firstLineNumber. +*/ +QScriptProgram::QScriptProgram(const QString &sourceCode, + const QString fileName, + int firstLineNumber) + : d_ptr(new QScriptProgramPrivate(sourceCode, fileName, firstLineNumber)) +{ +} + +/*! + Constructs a new QScriptProgram that is a copy of \a other. +*/ +QScriptProgram::QScriptProgram(const QScriptProgram &other) + : d_ptr(other.d_ptr) +{ +} + +/*! + Destroys this QScriptProgram. +*/ +QScriptProgram::~QScriptProgram() +{ + Q_D(QScriptProgram); + // if (d->engine && (d->ref == 1)) + // d->engine->unregisterScriptProgram(d); +} + +/*! + Assigns the \a other value to this QScriptProgram. +*/ +QScriptProgram &QScriptProgram::operator=(const QScriptProgram &other) +{ + // if (d_func() && d_func()->engine && (d_func()->ref == 1)) + // d_func()->engine->unregisterScriptProgram(d_func()); + // } + d_ptr = other.d_ptr; + return *this; +} + +/*! + Returns true if this QScriptProgram is null; otherwise + returns false. +*/ +bool QScriptProgram::isNull() const +{ + Q_D(const QScriptProgram); + return (d == 0); +} + +/*! + Returns the source code of this program. +*/ +QString QScriptProgram::sourceCode() const +{ + Q_D(const QScriptProgram); + if (!d) + return QString(); + return d->sourceCode; +} + +/*! + Returns the filename associated with this program. +*/ +QString QScriptProgram::fileName() const +{ + Q_D(const QScriptProgram); + if (!d) + return QString(); + return d->fileName; +} + +/*! + Returns the line number associated with this program. +*/ +int QScriptProgram::firstLineNumber() const +{ + Q_D(const QScriptProgram); + if (!d) + return -1; + return d->firstLineNumber; +} + +/*! + Returns true if this QScriptProgram is equal to \a other; + otherwise returns false. +*/ +bool QScriptProgram::operator==(const QScriptProgram &other) const +{ + Q_D(const QScriptProgram); + if (d == other.d_func()) + return true; + return (sourceCode() == other.sourceCode()) + && (fileName() == other.fileName()) + && (firstLineNumber() == other.firstLineNumber()); +} + +/*! + Returns true if this QScriptProgram is not equal to \a other; + otherwise returns false. +*/ +bool QScriptProgram::operator!=(const QScriptProgram &other) const +{ + return !operator==(other); +} + +QT_END_NAMESPACE diff --git a/src/script/api/qscriptprogram.h b/src/script/api/qscriptprogram.h new file mode 100644 index 0000000..de891cd --- /dev/null +++ b/src/script/api/qscriptprogram.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTPROGRAM_H +#define QSCRIPTPROGRAM_H + +#include + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Script) + +class QScriptProgramPrivate; +class Q_SCRIPT_EXPORT QScriptProgram +{ +public: + QScriptProgram(); + QScriptProgram(const QString &sourceCode, + const QString fileName = QString(), + int firstLineNumber = 1); + QScriptProgram(const QScriptProgram &other); + ~QScriptProgram(); + + QScriptProgram &operator=(const QScriptProgram &other); + + bool isNull() const; + + QString sourceCode() const; + QString fileName() const; + int firstLineNumber() const; + + bool operator==(const QScriptProgram &other) const; + bool operator!=(const QScriptProgram &other) const; + +private: + QExplicitlySharedDataPointer d_ptr; + Q_DECLARE_PRIVATE(QScriptProgram) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCRIPTPROGRAM_H diff --git a/src/script/api/qscriptprogram_p.h b/src/script/api/qscriptprogram_p.h new file mode 100644 index 0000000..5175079 --- /dev/null +++ b/src/script/api/qscriptprogram_p.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTPROGRAM_P_H +#define QSCRIPTPROGRAM_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +namespace JSC +{ + class EvalExecutable; + class ExecState; +} + +QT_BEGIN_NAMESPACE + +class QScriptEnginePrivate; + +class QScriptProgramPrivate +{ +public: + QScriptProgramPrivate(const QString &sourceCode, + const QString &fileName, + int firstLineNumber); + ~QScriptProgramPrivate(); + + static QScriptProgramPrivate *get(const QScriptProgram &q); + + JSC::EvalExecutable *executable(JSC::ExecState *exec, + QScriptEnginePrivate *engine); + + QBasicAtomicInt ref; + + QString sourceCode; + QString fileName; + int firstLineNumber; + + QScriptEnginePrivate *engine; + JSC::EvalExecutable *_executable; + intptr_t sourceId; + bool isCompiled; +}; + +QT_END_NAMESPACE + +#endif diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 25ee00f..804534f 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -44,6 +44,7 @@ #include #include +#include #include #include #include @@ -52,6 +53,7 @@ Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(QObjectList) +Q_DECLARE_METATYPE(QScriptProgram) //TESTED_CLASS= //TESTED_FILES= @@ -151,6 +153,7 @@ private slots: void installTranslatorFunctions(); void functionScopes(); void nativeFunctionScopes(); + void evaluateProgram(); void qRegExpInport_data(); void qRegExpInport(); @@ -4289,6 +4292,152 @@ void tst_QScriptEngine::nativeFunctionScopes() } } +static QScriptValue createProgram(QScriptContext *ctx, QScriptEngine *eng) +{ + QString code = ctx->argument(0).toString(); + QScriptProgram result(code); + return qScriptValueFromValue(eng, result); +} + +void tst_QScriptEngine::evaluateProgram() +{ + QScriptEngine eng; + + { + QString code("1 + 2"); + QString fileName("hello.js"); + int lineNumber(123); + QScriptProgram program(code, fileName, lineNumber); + QVERIFY(!program.isNull()); + QCOMPARE(program.sourceCode(), code); + QCOMPARE(program.fileName(), fileName); + QCOMPARE(program.firstLineNumber(), lineNumber); + + QScriptValue expected = eng.evaluate(code); + for (int x = 0; x < 10; ++x) { + QScriptValue ret = eng.evaluate(program); + QVERIFY(ret.equals(expected)); + } + + // operator= + QScriptProgram sameProgram = program; + QVERIFY(sameProgram == program); + QVERIFY(eng.evaluate(sameProgram).equals(expected)); + + // copy constructor + QScriptProgram sameProgram2(program); + QVERIFY(sameProgram2 == program); + QVERIFY(eng.evaluate(sameProgram2).equals(expected)); + + QScriptProgram differentProgram("2 + 3"); + QVERIFY(differentProgram != program); + QVERIFY(!eng.evaluate(differentProgram).equals(expected)); + } + + // Program that accesses variable in the scope + { + QScriptProgram program("a"); + QVERIFY(!program.isNull()); + { + QScriptValue ret = eng.evaluate(program); + QVERIFY(ret.isError()); + QCOMPARE(ret.toString(), QString::fromLatin1("ReferenceError: Can't find variable: a")); + } + + QScriptValue obj = eng.newObject(); + obj.setProperty("a", 123); + QScriptContext *ctx = eng.currentContext(); + ctx->pushScope(obj); + { + QScriptValue ret = eng.evaluate(program); + QVERIFY(!ret.isError()); + QVERIFY(ret.equals(obj.property("a"))); + } + + obj.setProperty("a", QScriptValue()); + { + QScriptValue ret = eng.evaluate(program); + QVERIFY(ret.isError()); + } + + QScriptValue obj2 = eng.newObject(); + obj2.setProperty("a", 456); + ctx->pushScope(obj2); + { + QScriptValue ret = eng.evaluate(program); + QVERIFY(!ret.isError()); + QVERIFY(ret.equals(obj2.property("a"))); + } + + ctx->popScope(); + } + + // Program that creates closure + { + QScriptProgram program("(function() { var count = 0; return function() { return count++; }; })"); + QVERIFY(!program.isNull()); + QScriptValue createCounter = eng.evaluate(program); + QVERIFY(createCounter.isFunction()); + QScriptValue counter = createCounter.call(); + QVERIFY(counter.isFunction()); + { + QScriptValue ret = counter.call(); + QVERIFY(ret.isNumber()); + } + QScriptValue counter2 = createCounter.call(); + QVERIFY(counter2.isFunction()); + QVERIFY(!counter2.equals(counter)); + { + QScriptValue ret = counter2.call(); + QVERIFY(ret.isNumber()); + } + } + + // Program created in a function call, then executed later + { + QScriptValue fun = eng.newFunction(createProgram); + QScriptProgram program = qscriptvalue_cast( + fun.call(QScriptValue(), QScriptValueList() << "a + 1")); + QVERIFY(!program.isNull()); + eng.globalObject().setProperty("a", QScriptValue()); + { + QScriptValue ret = eng.evaluate(program); + QVERIFY(ret.isError()); + QCOMPARE(ret.toString(), QString::fromLatin1("ReferenceError: Can't find variable: a")); + } + eng.globalObject().setProperty("a", 122); + { + QScriptValue ret = eng.evaluate(program); + QVERIFY(!ret.isError()); + QVERIFY(ret.isNumber()); + QCOMPARE(ret.toInt32(), 123); + } + } + + // Same program run in different engines + { + QString code("1 + 2"); + QScriptProgram program(code); + QVERIFY(!program.isNull()); + double expected = eng.evaluate(program).toNumber(); + for (int x = 0; x < 2; ++x) { + QScriptEngine eng2; + for (int y = 0; y < 2; ++y) { + double ret = eng2.evaluate(program).toNumber(); + QCOMPARE(ret, expected); + } + } + } + + // No program + { + QScriptProgram program; + QVERIFY(program.isNull()); + QScriptValue ret = eng.evaluate(program); + QVERIFY(!ret.isValid()); + } +} + static QRegExp minimal(QRegExp r) { r.setMinimal(true); return r; } void tst_QScriptEngine::qRegExpInport_data() diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 82c8ccd..032c34b 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -44,6 +44,7 @@ #include #include +#include #include //TESTED_CLASS= @@ -110,6 +111,9 @@ private slots: void extension(); void isEvaluatingInExtension(); void hasUncaughtException(); + void evaluateProgram(); + void evaluateProgram_SyntaxError(); + void evaluateNullProgram(); private: double m_testProperty; @@ -2219,6 +2223,88 @@ void tst_QScriptEngineAgent::hasUncaughtException() QVERIFY2(spy->isPass(), "At least one of a functionExit event should set hasUncaughtException flag."); } +void tst_QScriptEngineAgent::evaluateProgram() +{ + QScriptEngine eng; + QScriptProgram program("1 + 2", "foo.js", 123); + ScriptEngineSpy *spy = new ScriptEngineSpy(&eng); + qint64 scriptId = -1; + for (int x = 0; x < 10; ++x) { + spy->clear(); + (void)eng.evaluate(program); + QCOMPARE(spy->count(), (x == 0) ? 4 : 3); + + if (x == 0) { + // script is only loaded on first execution + QCOMPARE(spy->at(0).type, ScriptEngineEvent::ScriptLoad); + scriptId = spy->at(0).scriptId; + QVERIFY(scriptId != -1); + QCOMPARE(spy->at(0).script, program.sourceCode()); + QCOMPARE(spy->at(0).fileName, program.fileName()); + QCOMPARE(spy->at(0).lineNumber, program.firstLineNumber()); + spy->removeFirst(); + } + + QCOMPARE(spy->at(0).type, ScriptEngineEvent::FunctionEntry); // evaluate() + QCOMPARE(spy->at(0).scriptId, scriptId); + + QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange); + QCOMPARE(spy->at(1).scriptId, scriptId); + QCOMPARE(spy->at(1).lineNumber, program.firstLineNumber()); + + QCOMPARE(spy->at(2).type, ScriptEngineEvent::FunctionExit); // evaluate() + QCOMPARE(spy->at(2).scriptId, scriptId); + QVERIFY(spy->at(2).value.isNumber()); + QCOMPARE(spy->at(2).value.toNumber(), qsreal(3)); + } +} + +void tst_QScriptEngineAgent::evaluateProgram_SyntaxError() +{ + QScriptEngine eng; + QScriptProgram program("this is not valid syntax", "foo.js", 123); + ScriptEngineSpy *spy = new ScriptEngineSpy(&eng); + qint64 scriptId = -1; + for (int x = 0; x < 10; ++x) { + spy->clear(); + (void)eng.evaluate(program); + QCOMPARE(spy->count(), (x == 0) ? 8 : 7); + + if (x == 0) { + // script is only loaded on first execution + QCOMPARE(spy->at(0).type, ScriptEngineEvent::ScriptLoad); + scriptId = spy->at(0).scriptId; + QVERIFY(scriptId != -1); + QCOMPARE(spy->at(0).script, program.sourceCode()); + QCOMPARE(spy->at(0).fileName, program.fileName()); + QCOMPARE(spy->at(0).lineNumber, program.firstLineNumber()); + spy->removeFirst(); + } + + QCOMPARE(spy->at(0).type, ScriptEngineEvent::FunctionEntry); // evaluate() + QCOMPARE(spy->at(0).scriptId, scriptId); + + QCOMPARE(spy->at(1).type, ScriptEngineEvent::ContextPush); // SyntaxError constructor + QCOMPARE(spy->at(2).type, ScriptEngineEvent::FunctionEntry); // SyntaxError constructor + QCOMPARE(spy->at(3).type, ScriptEngineEvent::FunctionExit); // SyntaxError constructor + QCOMPARE(spy->at(4).type, ScriptEngineEvent::ContextPop); // SyntaxError constructor + + QCOMPARE(spy->at(5).type, ScriptEngineEvent::ExceptionThrow); + QVERIFY(spy->at(5).value.isError()); + QCOMPARE(spy->at(5).value.toString(), QString::fromLatin1("SyntaxError: Parse error")); + + QCOMPARE(spy->at(6).type, ScriptEngineEvent::FunctionExit); // evaluate() + QCOMPARE(spy->at(6).scriptId, scriptId); + } +} + +void tst_QScriptEngineAgent::evaluateNullProgram() +{ + QScriptEngine eng; + ScriptEngineSpy *spy = new ScriptEngineSpy(&eng); + (void)eng.evaluate(QScriptProgram()); + QCOMPARE(spy->count(), 0); +} QTEST_MAIN(tst_QScriptEngineAgent) #include "tst_qscriptengineagent.moc" diff --git a/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp b/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp index 4f011c4..8d5f6e6 100644 --- a/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp +++ b/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp @@ -60,6 +60,8 @@ private slots: void constructor(); void evaluate_data(); void evaluate(); + void evaluateProgram_data(); + void evaluateProgram(); void connectAndDisconnect(); void newObject(); void newQObject(); @@ -153,6 +155,22 @@ void tst_QScriptEngine::connectAndDisconnect() } } +void tst_QScriptEngine::evaluateProgram_data() +{ + evaluate_data(); +} + +void tst_QScriptEngine::evaluateProgram() +{ + QFETCH(QString, code); + QScriptEngine engine; + QScriptProgram program(code); + + QBENCHMARK { + (void)engine.evaluate(program); + } +} + void tst_QScriptEngine::newObject() { QScriptEngine engine; @@ -241,6 +259,5 @@ void tst_QScriptEngine::nativeCall() } } - QTEST_MAIN(tst_QScriptEngine) #include "tst_qscriptengine.moc" -- cgit v0.12 From 36e362cffe74d8f7fb3eb6b6a67fbab2ebda1a21 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 28 Oct 2009 15:15:46 +0100 Subject: Make Qt on QNX compile again Fix a typo, update the tmp path to match current qws behavior. --- mkspecs/unsupported/qnx-g++/qplatformdefs.h | 2 +- mkspecs/unsupported/qws/qnx-i386-g++/qmake.conf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mkspecs/unsupported/qnx-g++/qplatformdefs.h b/mkspecs/unsupported/qnx-g++/qplatformdefs.h index f309f81..1bf9ffcb 100644 --- a/mkspecs/unsupported/qnx-g++/qplatformdefs.h +++ b/mkspecs/unsupported/qnx-g++/qplatformdefs.h @@ -167,6 +167,6 @@ inline float strtof(const char *b, char **e) return float(strtod(b, e)); } -#define QT_QWS_TEMP_DIR qgetenv("TMP"); +#define QT_QWS_TEMP_DIR QString::fromLatin1(qgetenv("TMP")) #endif // QPLATFORMDEFS_H diff --git a/mkspecs/unsupported/qws/qnx-i386-g++/qmake.conf b/mkspecs/unsupported/qws/qnx-i386-g++/qmake.conf index 3f24cd9..fffb80f 100644 --- a/mkspecs/unsupported/qws/qnx-i386-g++/qmake.conf +++ b/mkspecs/unsupported/qws/qnx-i386-g++/qmake.conf @@ -56,10 +56,10 @@ QMAKE_PCH_OUTPUT_EXT = .gch QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list, -include(../../common/unix.conf) +include(../../../common/unix.conf) QMAKE_CFLAGS_THREAD = -D_REENTRANT -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CLFAGS_THREAD +QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD QMAKE_INCDIR = QMAKE_LIBDIR = -- cgit v0.12 From 5d8dcd57cd13fdd9c8643fa3bdda9f197a4351ff Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 28 Oct 2009 15:09:47 +0100 Subject: Greatly improve the performance of obtaining a state's transitions Transitions are children of their source state. We use QObject::children() and qobject_cast() each child to a QAbstractTransition to see if it is indeed a transition. However, calling qobject_cast() is very expensive. This commit introduces a cached list of transitions. The list is invalidated after a child object has been added or removed. In the typical case we expect the object hierarchy to remain fairly constant once the state machine has been started (states, child states and transitions are usually "static"), in other words the cached list is not likely to be invalidated much. Obtaining a state's transitions needs to be as fast as possible because it's in the critical path of the state machine algorithm. Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/corelib/statemachine/qstate.cpp | 23 +++++++++++++++-------- src/corelib/statemachine/qstate_p.h | 2 ++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index a6e4a57..9abf20b 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -124,7 +124,8 @@ QT_BEGIN_NAMESPACE */ QStatePrivate::QStatePrivate() - : errorState(0), initialState(0), childMode(QState::ExclusiveStates) + : errorState(0), initialState(0), childMode(QState::ExclusiveStates), + transitionsListNeedsRefresh(true) { } @@ -205,14 +206,17 @@ QList QStatePrivate::historyStates() const QList QStatePrivate::transitions() const { - QList result; - QList::const_iterator it; - for (it = children.constBegin(); it != children.constEnd(); ++it) { - QAbstractTransition *t = qobject_cast(*it); - if (t) - result.append(t); + if (transitionsListNeedsRefresh) { + transitionsList.clear(); + QList::const_iterator it; + for (it = children.constBegin(); it != children.constEnd(); ++it) { + QAbstractTransition *t = qobject_cast(*it); + if (t) + transitionsList.append(t); + } + transitionsListNeedsRefresh = false; } - return result; + return transitionsList; } #ifndef QT_NO_PROPERTIES @@ -468,6 +472,9 @@ void QState::setChildMode(ChildMode mode) */ bool QState::event(QEvent *e) { + Q_D(QState); + if ((e->type() == QEvent::ChildAdded) || (e->type() == QEvent::ChildRemoved)) + d->transitionsListNeedsRefresh = true; return QAbstractState::event(e); } diff --git a/src/corelib/statemachine/qstate_p.h b/src/corelib/statemachine/qstate_p.h index 20cda29..3b5f416 100644 --- a/src/corelib/statemachine/qstate_p.h +++ b/src/corelib/statemachine/qstate_p.h @@ -99,6 +99,8 @@ public: QAbstractState *errorState; QAbstractState *initialState; QState::ChildMode childMode; + mutable bool transitionsListNeedsRefresh; + mutable QList transitionsList; QList propertyAssignments; }; -- cgit v0.12 From 71913d435213188959441a89454de6308fd76484 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Wed, 28 Oct 2009 15:38:33 +0100 Subject: Delete the tst_QWebFrame::setHtmlWithBaseURL test until its fixed upstream. Reviewed-by: TrustMe --- .../WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 23 ---------------------- 1 file changed, 23 deletions(-) diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 80c9d72..100f272 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -586,7 +586,6 @@ private slots: void javaScriptWindowObjectClearedOnEvaluate(); void setHtml(); void setHtmlWithResource(); - void setHtmlWithBaseURL(); void ipv6HostEncoding(); void metaData(); void popupFocus(); @@ -2372,28 +2371,6 @@ void tst_QWebFrame::setHtmlWithResource() QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("red")); } -void tst_QWebFrame::setHtmlWithBaseURL() -{ - QString html("

hello world

"); - - QWebPage page; - QWebFrame* frame = page.mainFrame(); - - // in few seconds, the image should be completey loaded - QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); - - frame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath())); - QTest::qWait(200); - QCOMPARE(spy.count(), 1); - - QCOMPARE(frame->evaluateJavaScript("document.images.length").toInt(), 1); - QCOMPARE(frame->evaluateJavaScript("document.images[0].width").toInt(), 128); - QCOMPARE(frame->evaluateJavaScript("document.images[0].height").toInt(), 128); - - // no history item has to be added. - QCOMPARE(m_view->page()->history()->count(), 0); -} - class TestNetworkManager : public QNetworkAccessManager { public: -- cgit v0.12 From ee52cd0bb8ec4f5f74efc9c26be81dd93f1881c8 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 28 Oct 2009 11:41:52 +0100 Subject: QNativeSocketEngine: Actually use translations Task-number: QTBUG-4984 Reviewed-by: Thiago --- src/network/socket/qnativesocketengine.cpp | 52 +++++++++++++++--------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index e7f8401..8de821b 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -194,82 +194,82 @@ void QNativeSocketEnginePrivate::setError(QAbstractSocket::SocketError error, Er switch (errorString) { case NonBlockingInitFailedErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unable to initialize non-blocking socket")); + socketErrorString = QNativeSocketEngine::tr("Unable to initialize non-blocking socket"); break; case BroadcastingInitFailedErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unable to initialize broadcast socket")); + socketErrorString = QNativeSocketEngine::tr("Unable to initialize broadcast socket"); break; case NoIpV6ErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Attempt to use IPv6 socket on a platform with no IPv6 support")); + socketErrorString = QNativeSocketEngine::tr("Attempt to use IPv6 socket on a platform with no IPv6 support"); break; case RemoteHostClosedErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "The remote host closed the connection")); + socketErrorString = QNativeSocketEngine::tr("The remote host closed the connection"); break; case TimeOutErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Network operation timed out")); + socketErrorString = QNativeSocketEngine::tr("Network operation timed out"); break; case ResourceErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Out of resources")); + socketErrorString = QNativeSocketEngine::tr("Out of resources"); break; case OperationUnsupportedErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unsupported socket operation")); + socketErrorString = QNativeSocketEngine::tr("Unsupported socket operation"); break; case ProtocolUnsupportedErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Protocol type not supported")); + socketErrorString = QNativeSocketEngine::tr("Protocol type not supported"); break; case InvalidSocketErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Invalid socket descriptor")); + socketErrorString = QNativeSocketEngine::tr("Invalid socket descriptor"); break; case HostUnreachableErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Host unreachable")); + socketErrorString = QNativeSocketEngine::tr("Host unreachable"); break; case NetworkUnreachableErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Network unreachable")); + socketErrorString = QNativeSocketEngine::tr("Network unreachable"); break; case AccessErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Permission denied")); + socketErrorString = QNativeSocketEngine::tr("Permission denied"); break; case ConnectionTimeOutErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Connection timed out")); + socketErrorString = QNativeSocketEngine::tr("Connection timed out"); break; case ConnectionRefusedErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Connection refused")); + socketErrorString = QNativeSocketEngine::tr("Connection refused"); break; case AddressInuseErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "The bound address is already in use")); + socketErrorString = QNativeSocketEngine::tr("The bound address is already in use"); break; case AddressNotAvailableErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "The address is not available")); + socketErrorString = QNativeSocketEngine::tr("The address is not available"); break; case AddressProtectedErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "The address is protected")); + socketErrorString = QNativeSocketEngine::tr("The address is protected"); break; case DatagramTooLargeErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Datagram was too large to send")); + socketErrorString = QNativeSocketEngine::tr("Datagram was too large to send"); break; case SendDatagramErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unable to send a message")); + socketErrorString = QNativeSocketEngine::tr("Unable to send a message"); break; case ReceiveDatagramErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unable to receive a message")); + socketErrorString = QNativeSocketEngine::tr("Unable to receive a message"); break; case WriteErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unable to write")); + socketErrorString = QNativeSocketEngine::tr("Unable to write"); break; case ReadErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Network error")); + socketErrorString = QNativeSocketEngine::tr("Network error"); break; case PortInuseErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Another socket is already listening on the same port")); + socketErrorString = QNativeSocketEngine::tr("Another socket is already listening on the same port"); break; case NotSocketErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Operation on non-socket")); + socketErrorString = QNativeSocketEngine::tr("Operation on non-socket"); break; case InvalidProxyTypeString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "The proxy type is invalid for this operation")); + socketErrorString = QNativeSocketEngine::tr("The proxy type is invalid for this operation"); break; case UnknownSocketErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unknown error")); + socketErrorString = QNativeSocketEngine::tr("Unknown error"); break; } } -- cgit v0.12 From da1519020a53dbdc717fb3bffeaad07c5142a6e3 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 28 Oct 2009 15:01:44 +0100 Subject: QSslError: Actually make strings show up in the ts file I suspect because of missing quotation marks those strings were not showing up. Also, wrapping QT_TRANSLATE_NOOP inside a tr() call makes no sense. Also changed the class from QObject to QSslSocket. Task-number: QTBUG-5059 Reviewed-by: ossi --- src/network/ssl/qsslerror.cpp | 57 +++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp index 62fcd4c..4bb58b1 100644 --- a/src/network/ssl/qsslerror.cpp +++ b/src/network/ssl/qsslerror.cpp @@ -91,6 +91,7 @@ */ #include "qsslerror.h" +#include "qsslsocket.h" #ifndef QT_NO_DEBUG_STREAM #include @@ -209,81 +210,79 @@ QString QSslError::errorString() const QString errStr; switch (d->error) { case NoError: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "No error")); + errStr = QSslSocket::tr("No error"); break; case UnableToGetIssuerCertificate: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The issuer certificate could not be found")); + errStr = QSslSocket::tr("The issuer certificate could not be found"); break; case UnableToDecryptCertificateSignature: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The certificate signature could not be decrypted")); + errStr = QSslSocket::tr("The certificate signature could not be decrypted"); break; case UnableToDecodeIssuerPublicKey: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The public key in the certificate could not be read")); + errStr = QSslSocket::tr("The public key in the certificate could not be read"); break; case CertificateSignatureFailed: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The signature of the certificate is invalid")); + errStr = QSslSocket::tr("The signature of the certificate is invalid"); break; case CertificateNotYetValid: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The certificate is not yet valid")); + errStr = QSslSocket::tr("The certificate is not yet valid"); break; case CertificateExpired: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The certificate has expired")); + errStr = QSslSocket::tr("The certificate has expired"); break; case InvalidNotBeforeField: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The certificate's notBefore field contains an invalid time")); + errStr = QSslSocket::tr("The certificate's notBefore field contains an invalid time"); break; case InvalidNotAfterField: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The certificate's notAfter field contains an invalid time")); + errStr = QSslSocket::tr("The certificate's notAfter field contains an invalid time"); break; case SelfSignedCertificate: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The certificate is self-signed, and untrusted")); + errStr = QSslSocket::tr("The certificate is self-signed, and untrusted"); break; case SelfSignedCertificateInChain: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The root certificate of the certificate chain is self-signed, and untrusted")); + errStr = QSslSocket::tr("The root certificate of the certificate chain is self-signed, and untrusted"); break; case UnableToGetLocalIssuerCertificate: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The issuer certificate of a locally looked up certificate could not be found")); + errStr = QSslSocket::tr("The issuer certificate of a locally looked up certificate could not be found"); break; case UnableToVerifyFirstCertificate: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "No certificates could be verified")); + errStr = QSslSocket::tr("No certificates could be verified"); break; case InvalidCaCertificate: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "One of the CA certificates is invalid")); + errStr = QSslSocket::tr("One of the CA certificates is invalid"); break; case PathLengthExceeded: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The basicConstraints pathlength parameter has been exceeded")); + errStr = QSslSocket::tr("The basicConstraints pathlength parameter has been exceeded"); break; case InvalidPurpose: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The supplied certificate is unsuited for this purpose")); + errStr = QSslSocket::tr("The supplied certificate is unsuited for this purpose"); break; case CertificateUntrusted: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The root CA certificate is not trusted for this purpose")); + errStr = QSslSocket::tr("The root CA certificate is not trusted for this purpose"); break; case CertificateRejected: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The root CA certificate is marked to reject the specified purpose")); + errStr = QSslSocket::tr("The root CA certificate is marked to reject the specified purpose"); break; case SubjectIssuerMismatch: // hostname mismatch - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, - "The current candidate issuer certificate was rejected because its" - " subject name did not match the issuer name of the current certificate")); + errStr = QSslSocket::tr("The current candidate issuer certificate was rejected because its" + " subject name did not match the issuer name of the current certificate"); break; case AuthorityIssuerSerialNumberMismatch: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The current candidate issuer certificate was rejected because" - " its issuer name and serial number was present and did not match the" - " authority key identifier of the current certificate")); + errStr = QSslSocket::tr("The current candidate issuer certificate was rejected because" + " its issuer name and serial number was present and did not match the" + " authority key identifier of the current certificate"); break; case NoPeerCertificate: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The peer did not present any certificate")); + errStr = QSslSocket::tr("The peer did not present any certificate"); break; case HostNameMismatch: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, - "The host name did not match any of the valid hosts" - " for this certificate")); + errStr = QSslSocket::tr("The host name did not match any of the valid hosts" + " for this certificate"); break; case NoSslSupport: break; default: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "Unknown error")); + errStr = QSslSocket::tr("Unknown error"); break; } -- cgit v0.12 From d9b009bfed86ac273da4fc589daa34d852437254 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 28 Oct 2009 17:46:14 +0100 Subject: make magic comment parsing stricter there must be a space after the //: and similar comments, otherwise harmless comments of the sort of //====== foo here ===== will be parsed as message ids, etc. --- tools/linguist/lupdate/cpp.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 7a616e3..6374912 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1899,25 +1899,25 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) case Tok_Comment: if (!tor) goto case_default; - if (yyWord.startsWith(QLatin1Char(':'))) { - yyWord.remove(0, 1); + if (yyWord.at(0) == QLatin1Char(':') && yyWord.at(1).isSpace()) { + yyWord.remove(0, 2); extracomment += yyWord; extracomment.detach(); - } else if (yyWord.startsWith(QLatin1Char('='))) { - yyWord.remove(0, 1); + } else if (yyWord.at(0) == QLatin1Char('=') && yyWord.at(1).isSpace()) { + yyWord.remove(0, 2); msgid = yyWord.simplified(); msgid.detach(); - } else if (yyWord.startsWith(QLatin1Char('~'))) { - yyWord.remove(0, 1); + } else if (yyWord.at(0) == QLatin1Char('~') && yyWord.at(1).isSpace()) { + yyWord.remove(0, 2); text = yyWord.trimmed(); int k = text.indexOf(QLatin1Char(' ')); if (k > -1) extra.insert(text.left(k), text.mid(k + 1).trimmed()); text.clear(); - } else if (yyWord.startsWith(QLatin1Char('%'))) { - sourcetext.reserve(sourcetext.length() + yyWord.length()); + } else if (yyWord.at(0) == QLatin1Char('%') && yyWord.at(1).isSpace()) { + sourcetext.reserve(sourcetext.length() + yyWord.length() - 2); ushort *ptr = (ushort *)sourcetext.data() + sourcetext.length(); - int p = 1, c; + int p = 2, c; forever { if (p >= yyWord.length()) break; -- cgit v0.12 From 9fbece67bacee0f88261c3cd07c443fdf6385f81 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 29 Oct 2009 08:03:27 +1000 Subject: Remove QVGEGLWindowSurfaceQImage from QtOpenVG Rendering into a QImage as a window backing store isn't very efficient and isn't needed by any of our current platforms. If a specific graphics system needs it in the future, it can implement it directly. Reviewed-by: trustme --- src/openvg/qwindowsurface_vg.cpp | 4 +-- src/openvg/qwindowsurface_vgegl.cpp | 59 ------------------------------------- src/openvg/qwindowsurface_vgegl_p.h | 19 ------------ 3 files changed, 2 insertions(+), 80 deletions(-) diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp index 661e06a..f8486a6 100644 --- a/src/openvg/qwindowsurface_vg.cpp +++ b/src/openvg/qwindowsurface_vg.cpp @@ -54,8 +54,8 @@ QT_BEGIN_NAMESPACE QVGWindowSurface::QVGWindowSurface(QWidget *window) : QWindowSurface(window) { - d_ptr = QVGEGLWindowSurfacePrivate::create - (QVGEGLWindowSurfacePrivate::WindowSurface, this); + // Create the default type of EGL window surface for windows. + d_ptr = new QVGEGLWindowSurfaceDirect(this); } QVGWindowSurface::QVGWindowSurface diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index d622c1f..103f84d 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -101,18 +101,6 @@ QImage::Format qt_vg_config_to_image_format(QEglContext *context) return argbFormat; // XXX } -static void copySubImage(QImage *image, VGImage vgImage, const QRect& rect) -{ - vgGetImageSubData - (vgImage, - image->bits() + rect.bottom() * image->bytesPerLine() + - rect.x() * (image->depth() / 8), - -(image->bytesPerLine()), - qt_vg_image_to_vg_format(image->format()), - rect.x(), (image->height() - 1) - rect.bottom(), - rect.width(), rect.height()); -} - #if !defined(QVG_NO_SINGLE_CONTEXT) class QVGSharedContext @@ -336,20 +324,6 @@ QVGEGLWindowSurfacePrivate::~QVGEGLWindowSurfacePrivate() destroyPaintEngine(); } -QVGEGLWindowSurfacePrivate *QVGEGLWindowSurfacePrivate::create - (SurfaceType type, QWindowSurface *win) -{ -#if defined(QVG_VGIMAGE_BACKBUFFERS) - if (type == VGImageSurface) - return new QVGEGLWindowSurfaceVGImage(win); - else if (type == QImageSurface) - return new QVGEGLWindowSurfaceQImage(win); -#endif - if (type == WindowSurface) - return new QVGEGLWindowSurfaceDirect(win); - return 0; -} - QVGPaintEngine *QVGEGLWindowSurfacePrivate::paintEngine() { if (!engine) @@ -514,39 +488,6 @@ EGLSurface QVGEGLWindowSurfaceVGImage::mainSurface() const return qt_vg_shared_surface(); } -QVGEGLWindowSurfaceQImage::QVGEGLWindowSurfaceQImage(QWindowSurface *win) - : QVGEGLWindowSurfaceVGImage(win) -{ -} - -QVGEGLWindowSurfaceQImage::~QVGEGLWindowSurfaceQImage() -{ -} - -void QVGEGLWindowSurfaceQImage::endPaint - (QWidget *widget, const QRegion& region, QImage *image) -{ - QEglContext *context = ensureContext(widget); - if (context) { - if (backBufferSurface != EGL_NO_SURFACE) { - if (isPaintingActive) - vgFlush(); - context->makeCurrent(mainSurface()); - QRegion rgn = region.intersected - (QRect(0, 0, image->width(), image->height())); - if (rgn.numRects() == 1) { - copySubImage(image, backBuffer, rgn.boundingRect()); - } else { - QVector rects = rgn.rects(); - for (int index = 0; index < rects.size(); ++index) - copySubImage(image, backBuffer, rects[index]); - } - context->lazyDoneCurrent(); - } - isPaintingActive = false; - } -} - #endif // QVG_VGIMAGE_BACKBUFFERS QVGEGLWindowSurfaceDirect::QVGEGLWindowSurfaceDirect(QWindowSurface *win) diff --git a/src/openvg/qwindowsurface_vgegl_p.h b/src/openvg/qwindowsurface_vgegl_p.h index fa36b94..7fa60ea 100644 --- a/src/openvg/qwindowsurface_vgegl_p.h +++ b/src/openvg/qwindowsurface_vgegl_p.h @@ -70,16 +70,6 @@ public: QVGEGLWindowSurfacePrivate(QWindowSurface *win); virtual ~QVGEGLWindowSurfacePrivate(); - enum SurfaceType - { - WindowSurface, - VGImageSurface, - QImageSurface - }; - - static QVGEGLWindowSurfacePrivate *create - (SurfaceType type, QWindowSurface *win); - QVGPaintEngine *paintEngine(); virtual QEglContext *ensureContext(QWidget *widget) = 0; virtual void beginPaint(QWidget *widget) = 0; @@ -126,15 +116,6 @@ protected: EGLSurface mainSurface() const; }; -class Q_OPENVG_EXPORT QVGEGLWindowSurfaceQImage : public QVGEGLWindowSurfaceVGImage -{ -public: - QVGEGLWindowSurfaceQImage(QWindowSurface *win); - virtual ~QVGEGLWindowSurfaceQImage(); - - void endPaint(QWidget *widget, const QRegion& region, QImage *image); -}; - #endif // EGL_OPENVG_IMAGE class Q_OPENVG_EXPORT QVGEGLWindowSurfaceDirect : public QVGEGLWindowSurfacePrivate -- cgit v0.12 From cabfa68f3e37e79a18775a9970f6d166e75ece07 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 29 Oct 2009 08:29:23 +1000 Subject: Remove shader/program binary support for now After API review discussions, it was decided to remove shader binary support until we have a better handle on what we need. Applications can directly load shader binaries on the shaderId() using glShaderBinary() directly so they aren't prevented from using the feature. Reviewed-by: trustme --- src/opengl/qglshaderprogram.cpp | 213 ---------------------------------------- src/opengl/qglshaderprogram.h | 9 -- 2 files changed, 222 deletions(-) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index d028522..90b496e 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -612,95 +612,6 @@ bool QGLShader::compileFile(const QString& fileName) } /*! - Sets the binary code for this shader to the \a length bytes from - the array \a binary. The \a format specifies how the binary data - should be interpreted by the OpenGL engine. Returns true if the - binary was set on the shader; false otherwise. - - This function cannot be used with PartialVertexShader or - PartialFragmentShader. - - If this function succeeds, then the shader will be considered compiled. - - \sa shaderBinaryFormats() -*/ -bool QGLShader::setShaderBinary(GLenum format, const void *binary, int length) -{ - Q_D(QGLShader); -#if !defined(QT_OPENGL_ES_2) - if (!glShaderBinary) - return false; -#endif - GLuint shader = d->shaderGuard.id(); - if (d->isPartial || !shader) - return false; - glGetError(); // Clear error state. - glShaderBinary(1, &shader, format, binary, length); - d->compiled = (glGetError() == GL_NO_ERROR); - return d->compiled; -} - -/*! - Sets the binary code for this shader to the \a length bytes from - the array \a binary. The \a format specifies how the binary data - should be interpreted by the OpenGL engine. Returns true if the - binary was set on the shader; false otherwise. - - The \a otherShader will also have binary code set on it. This is - for the case where \a binary contains both vertex and fragment - shader code. - - This function cannot be used with PartialVertexShader or - PartialFragmentShader. - - If this function succeeds, then the shader will be considered compiled. - - \sa shaderBinaryFormats() -*/ -bool QGLShader::setShaderBinary - (QGLShader& otherShader, GLenum format, const void *binary, int length) -{ - Q_D(QGLShader); -#if !defined(QT_OPENGL_ES_2) - if (!glShaderBinary) - return false; -#endif - if (d->isPartial || !d->shaderGuard.id()) - return false; - if (otherShader.d_func()->isPartial || !otherShader.d_func()->shaderGuard.id()) - return false; - glGetError(); // Clear error state. - GLuint shaders[2]; - shaders[0] = d->shaderGuard.id(); - shaders[1] = otherShader.d_func()->shaderGuard.id(); - glShaderBinary(2, shaders, format, binary, length); - d->compiled = (glGetError() == GL_NO_ERROR); - otherShader.d_func()->compiled = d->compiled; - return d->compiled; -} - -/*! - Returns a list of all binary formats that are supported by - setShaderBinary() on this system. - - \sa setShaderBinary() -*/ -QList QGLShader::shaderBinaryFormats() -{ - GLint num; - QList list; - glGetError(); // Clear error state. - glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &num); - if (glGetError() != GL_NO_ERROR || num <= 0) - return list; - QVarLengthArray formats(num); - glGetIntegerv(GL_SHADER_BINARY_FORMATS, formats.data()); - for (GLint i = 0; i < num; ++i) - list += (GLenum)(formats[i]); - return list; -} - -/*! Returns the source code for this shader. \sa compile() @@ -1068,130 +979,6 @@ void QGLShaderProgram::removeAllShaders() d->removingShaders = false; } -#if defined(QT_OPENGL_ES_2) - -#ifndef GL_PROGRAM_BINARY_LENGTH_OES -#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 -#endif -#ifndef GL_NUM_PROGRAM_BINARY_FORMATS_OES -#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE -#endif -#ifndef GL_PROGRAM_BINARY_FORMATS_OES -#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF -#endif - -#endif - -/*! - Returns the program binary associated with this shader program. - The numeric identifier of the program binary format is returned - in \a format. The \c OES_get_program_binary extension will need - to be supported by the system for binary retrieval to succeed. - - Returns an empty QByteArray if the program binary cannot be - retrieved on this system, or the shader program has not yet - been linked. - - The returned binary can be supplied to setProgramBinary() on the - same machine at some future point to reload the program. It contains - the compiled code of all of the shaders that were attached to the - program at the time programBinary() is called. - - \sa setProgramBinary(), programBinaryFormats() -*/ -QByteArray QGLShaderProgram::programBinary(int *format) const -{ -#if defined(QT_OPENGL_ES_2) - Q_D(const QGLShaderProgram); - if (!isLinked()) - return QByteArray(); - - // Get the length of the binary data, bailing out if there is none. - GLint length = 0; - GLuint program = d->programGuard.id(); - glGetProgramiv(program, GL_PROGRAM_BINARY_LENGTH_OES, &length); - if (length <= 0) - return QByteArray(); - - // Retrieve the binary data. - QByteArray binary(length, 0); - GLenum binaryFormat; - glGetProgramBinaryOES(program, length, 0, &binaryFormat, binary.data()); - if (format) - *format = (int)binaryFormat; - return binary; -#else - Q_UNUSED(format); - return QByteArray(); -#endif -} - -/*! - Sets the \a binary for this shader program according to \a format. - Returns true if the binary was set, or false if the binary format - is not supported or this system does not support program binaries. - The program will be linked if the load succeeds. - - \sa programBinary(), programBinaryFormats(), isLinked() -*/ -bool QGLShaderProgram::setProgramBinary(int format, const QByteArray& binary) -{ -#if defined(QT_OPENGL_ES_2) - // Load the binary and check that it was linked correctly. - Q_D(QGLShaderProgram); - GLuint program = d->programGuard.id(); - if (!program) - return false; - glProgramBinaryOES(program, (GLenum)format, - binary.constData(), binary.size()); - GLint value = 0; - glGetProgramiv(program, GL_LINK_STATUS, &value); - d->linked = (value != 0); - value = 0; - glGetProgramiv(program, GL_INFO_LOG_LENGTH, &value); - d->log = QString(); - if (value > 1) { - char *logbuf = new char [value]; - GLint len; - glGetProgramInfoLog(program, value, &len, logbuf); - d->log = QString::fromLatin1(logbuf); - QString name = objectName(); - if (name.isEmpty()) - qWarning() << "QGLShader::setProgramBinary:" << d->log; - else - qWarning() << "QGLShader::setProgramBinary[" << name << "]:" << d->log; - delete [] logbuf; - } - return d->linked; -#else - Q_UNUSED(format); - Q_UNUSED(binary); - return false; -#endif -} - -/*! - Returns the list of program binary formats that are accepted by - this system for use with setProgramBinary(). - - \sa programBinary(), setProgramBinary() -*/ -QList QGLShaderProgram::programBinaryFormats() -{ -#if defined(QT_OPENGL_ES_2) - GLint count = 0; - glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS_OES, &count); - if (count <= 0) - return QList(); - QVector list; - list.resize(count); - glGetIntegerv(GL_PROGRAM_BINARY_FORMATS_OES, list.data()); - return list.toList(); -#else - return QList(); -#endif -} - /*! Links together the shaders that were added to this program with addShader(). Returns true if the link was successful or diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index d8b9a0c..708cf09 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -88,11 +88,6 @@ public: bool compile(const QString& source); bool compileFile(const QString& fileName); - bool setShaderBinary(GLenum format, const void *binary, int length); - bool setShaderBinary(QGLShader& otherShader, GLenum format, const void *binary, int length); - - static QList shaderBinaryFormats(); - QByteArray sourceCode() const; bool isCompiled() const; @@ -133,10 +128,6 @@ public: void removeAllShaders(); - QByteArray programBinary(int *format) const; - bool setProgramBinary(int format, const QByteArray& binary); - static QList programBinaryFormats(); - virtual bool link(); bool isLinked() const; QString log() const; -- cgit v0.12 From 526fdcafdba2b2984924b09b68c473b5160443a1 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 28 Oct 2009 10:19:24 +1000 Subject: Change all valid Task-Tracker references to bugreports.qt.nokia.com reference. --- tests/auto/qdatawidgetmapper/tst_qdatawidgetmapper.cpp | 2 +- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 2 +- tests/auto/qsound/tst_qsound.cpp | 2 +- tests/auto/qwidget/tst_qwidget.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/qdatawidgetmapper/tst_qdatawidgetmapper.cpp b/tests/auto/qdatawidgetmapper/tst_qdatawidgetmapper.cpp index 002aeb7..dedc0cb 100644 --- a/tests/auto/qdatawidgetmapper/tst_qdatawidgetmapper.cpp +++ b/tests/auto/qdatawidgetmapper/tst_qdatawidgetmapper.cpp @@ -379,7 +379,7 @@ void tst_QDataWidgetMapper::comboBox() model->setData(model->index(0, 1), QString("read write item z"), Qt::EditRole); QCOMPARE(readOnlyBox.currentIndex(), 2); - QEXPECT_FAIL("", "See tasks 125493 and 147153", Abort); + QEXPECT_FAIL("", "See task 125493 and QTBUG-428", Abort); QCOMPARE(readWriteBox.currentText(), QString("read write item z")); } diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index dc08d0e..9b5e114 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -3735,7 +3735,7 @@ void tst_QGraphicsView::task259503_scrollingArtifacts() { // qDebug() << event->region(); // qDebug() << updateRegion; - QEXPECT_FAIL("", "The event region doesn't include the original item position region. See task #259503.", Continue); + QEXPECT_FAIL("", "The event region doesn't include the original item position region. See QTBUG-4416", Continue); QCOMPARE(event->region(), updateRegion); } } diff --git a/tests/auto/qsound/tst_qsound.cpp b/tests/auto/qsound/tst_qsound.cpp index fdbf6a2..56a330b 100644 --- a/tests/auto/qsound/tst_qsound.cpp +++ b/tests/auto/qsound/tst_qsound.cpp @@ -66,7 +66,7 @@ void tst_QSound::checkFinished() QTest::qWait(5000); #if defined(Q_WS_QWS) - QEXPECT_FAIL("", "QSound buggy on embedded (task 122221)", Abort); + QEXPECT_FAIL("", "QSound buggy on embedded (task QTBUG-157)", Abort); #endif QVERIFY(sound.isFinished() ); } diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 050d1c5..5630370 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -2982,7 +2982,7 @@ void tst_QWidget::stackUnder() qApp->processEvents(); #endif #ifndef Q_WS_MAC - QEXPECT_FAIL(0, "Task 153869", Continue); + QEXPECT_FAIL(0, "See QTBUG-493", Continue); #endif QCOMPARE(child->numPaintEvents, 0); } else { -- cgit v0.12 From f425c08d4f2e7f061a0ee8e4a1eee2b17fa64962 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 29 Oct 2009 13:20:50 +1000 Subject: doc typo --- doc/src/frameworks-technologies/eventsandfilters.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/frameworks-technologies/eventsandfilters.qdoc b/doc/src/frameworks-technologies/eventsandfilters.qdoc index c769884..52d596a 100644 --- a/doc/src/frameworks-technologies/eventsandfilters.qdoc +++ b/doc/src/frameworks-technologies/eventsandfilters.qdoc @@ -215,7 +215,7 @@ \l{QCoreApplication::}{postEvent()} posts the event on a queue for later dispatch. The next time Qt's main event loop runs, it dispatches all posted events, with some optimization. For example, if there are - several resize events, they are are compressed into one. The same + several resize events, they are compressed into one. The same applies to paint events: QWidget::update() calls \l{QCoreApplication::}{postEvent()}, which eliminates flickering and increases speed by avoiding multiple repaints. -- cgit v0.12