From c7d39e1335775979d43833d0b7f6c32cef898424 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 26 Mar 2010 14:09:26 +0100 Subject: uic3: -extract: Write XPM-images correctly. Add magic header '/* XPM */' and turn off wrapping of lines that broke image readers. Add a command line option to activate line-wrapping in case someone exclusively wants to use the extracted images for embedding in code. Also do line-wrapping in case images are embedded into the ui-file. Note: The current versions of MSVC do not seem to have a limitation of line lengths any more. Task-number: QTBUG-9207 Reviewed-by: Jarek Kobus --- src/tools/uic/cpp/cppextractimages.cpp | 2 +- src/tools/uic/cpp/cppwriteicondata.cpp | 12 ++++++++---- src/tools/uic/cpp/cppwriteicondata.h | 3 ++- src/tools/uic/option.h | 2 ++ src/tools/uic3/converter.cpp | 1 + src/tools/uic3/form.cpp | 1 + src/tools/uic3/main.cpp | 3 +++ src/tools/uic3/ui3reader.h | 3 ++- tests/auto/uic/baseline/config_fromuic3.ui.h | 1 + tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h | 1 + 10 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/tools/uic/cpp/cppextractimages.cpp b/src/tools/uic/cpp/cppextractimages.cpp index d452168..52c1b9d 100644 --- a/src/tools/uic/cpp/cppextractimages.cpp +++ b/src/tools/uic/cpp/cppextractimages.cpp @@ -134,7 +134,7 @@ void ExtractImages::acceptImage(DomImage *image) QTextStream *imageOut = new QTextStream(&f); imageOut->setCodec(QTextCodec::codecForName("UTF-8")); - CPP::WriteIconData::writeImage(*imageOut, QString(), image); + CPP::WriteIconData::writeImage(*imageOut, QString(), m_option.limitXPM_LineLength, image); delete imageOut; } else { CPP::WriteIconData::writeImage(f, image); diff --git a/src/tools/uic/cpp/cppwriteicondata.cpp b/src/tools/uic/cpp/cppwriteicondata.cpp index 81ef56b..7e4b5c8 100644 --- a/src/tools/uic/cpp/cppwriteicondata.cpp +++ b/src/tools/uic/cpp/cppwriteicondata.cpp @@ -114,10 +114,12 @@ void WriteIconData::acceptImages(DomImages *images) void WriteIconData::acceptImage(DomImage *image) { - writeImage(output, option.indent, image); + // Limit line length when writing code. + writeImage(output, option.indent, true, image); } -void WriteIconData::writeImage(QTextStream &output, const QString &indent, DomImage *image) +void WriteIconData::writeImage(QTextStream &output, const QString &indent, + bool limitXPM_LineLength, const DomImage *image) { QString img = image->attributeName() + QLatin1String("_data"); QString data = image->elementData()->text(); @@ -133,7 +135,8 @@ void WriteIconData::writeImage(QTextStream &output, const QString &indent, DomIm int a = 0; int column = 0; bool inQuote = false; - output << indent << "static const char* const " << img << "[] = { \n"; + output << indent << "/* XPM */\n" + << indent << "static const char* const " << img << "[] = { \n"; while (baunzip[a] != '\"') a++; for (; a < (int) length; a++) { @@ -144,7 +147,8 @@ void WriteIconData::writeImage(QTextStream &output, const QString &indent, DomIm inQuote = !inQuote; } - if (column++ >= 511 && inQuote) { + column++; + if (limitXPM_LineLength && column >= 512 && inQuote) { output << "\"\n\""; // be nice with MSVC & Co. column = 1; } diff --git a/src/tools/uic/cpp/cppwriteicondata.h b/src/tools/uic/cpp/cppwriteicondata.h index 40d56bc..42cfab0 100644 --- a/src/tools/uic/cpp/cppwriteicondata.h +++ b/src/tools/uic/cpp/cppwriteicondata.h @@ -64,7 +64,8 @@ public: void acceptImages(DomImages *images); void acceptImage(DomImage *image); - static void writeImage(QTextStream &output, const QString &indent, DomImage *image); + static void writeImage(QTextStream &output, const QString &indent, + bool limitXPM_LineLength, const DomImage *image); static void writeImage(QIODevice &output, DomImage *image); private: diff --git a/src/tools/uic/option.h b/src/tools/uic/option.h index f1198a0..8556728 100644 --- a/src/tools/uic/option.h +++ b/src/tools/uic/option.h @@ -61,6 +61,7 @@ struct Option unsigned int autoConnection : 1; unsigned int dependencies : 1; unsigned int extractImages : 1; + unsigned int limitXPM_LineLength : 1; unsigned int implicitIncludes: 1; Generator generator; @@ -85,6 +86,7 @@ struct Option autoConnection(1), dependencies(0), extractImages(0), + limitXPM_LineLength(0), implicitIncludes(1), generator(CppGenerator), prefix(QLatin1String("Ui_")) diff --git a/src/tools/uic3/converter.cpp b/src/tools/uic3/converter.cpp index e1b4b38..2ee939d 100644 --- a/src/tools/uic3/converter.cpp +++ b/src/tools/uic3/converter.cpp @@ -518,6 +518,7 @@ DomUI *Ui3Reader::generateUi4(const QDomElement &widget) if (m_extractImages) { Option opt; opt.extractImages = m_extractImages; + opt.limitXPM_LineLength = (m_options & LimitXPM_LineLength) ? 1 : 0; opt.qrcOutputFile = m_qrcOutputFile; CPP::ExtractImages(opt).acceptUI(ui); diff --git a/src/tools/uic3/form.cpp b/src/tools/uic3/form.cpp index df1314f..9df644a 100644 --- a/src/tools/uic3/form.cpp +++ b/src/tools/uic3/form.cpp @@ -256,6 +256,7 @@ void Ui3Reader::createFormDecl(const QDomElement &e) d.option().headerProtection = false; d.option().copyrightHeader = false; d.option().extractImages = m_extractImages; + d.option().limitXPM_LineLength = (m_options & LimitXPM_LineLength) ? 1 : 0; d.option().qrcOutputFile = m_qrcOutputFile; d.option().implicitIncludes = (m_options & ImplicitIncludes) ? 1 : 0; if (trmacro.size()) diff --git a/src/tools/uic3/main.cpp b/src/tools/uic3/main.cpp index 1ebb76a..d7657b1 100644 --- a/src/tools/uic3/main.cpp +++ b/src/tools/uic3/main.cpp @@ -149,6 +149,8 @@ int runUic3(int argc, char * argv[]) readerOptions &= ~Ui3Reader::CustomWidgetForwardDeclarations; } else if (opt == "layout-names") { readerOptions |= Ui3Reader::PreserveLayoutNames; + } else if (opt == "limit-xpm-linelength") { + readerOptions |= Ui3Reader::LimitXPM_LineLength; } else if (opt == "nounload") { // skip } else if (opt == "convert") { @@ -251,6 +253,7 @@ int runUic3(int argc, char * argv[]) "Options:\n" "\t-o file Write output to file rather than stdout\n" "\t-extract qrcFile Create resource file and extract embedded images into \"image\" dir\n" + "\t-limit-xpm-linelength Limit the line length of XPM files for -extract.\n" "\t-pch file Add #include \"file\" as the first statement in implementation\n" "\t-nofwd Omit forward declarations of custom classes\n" "\t-layout-names Preserve layout names of Qt Designer 3\n" diff --git a/src/tools/uic3/ui3reader.h b/src/tools/uic3/ui3reader.h index 144ef05..abe323e 100644 --- a/src/tools/uic3/ui3reader.h +++ b/src/tools/uic3/ui3reader.h @@ -68,7 +68,8 @@ typedef QList > ColorGroup; class Ui3Reader { public: - enum Options { CustomWidgetForwardDeclarations = 0x1, ImplicitIncludes = 0x2, PreserveLayoutNames = 0x4 }; + enum Options { CustomWidgetForwardDeclarations = 0x1, ImplicitIncludes = 0x2, + PreserveLayoutNames = 0x4, LimitXPM_LineLength = 0x8 }; explicit Ui3Reader(QTextStream &stream, unsigned options); ~Ui3Reader(); diff --git a/tests/auto/uic/baseline/config_fromuic3.ui.h b/tests/auto/uic/baseline/config_fromuic3.ui.h index c77b303..7e0189e 100644 --- a/tests/auto/uic/baseline/config_fromuic3.ui.h +++ b/tests/auto/uic/baseline/config_fromuic3.ui.h @@ -670,6 +670,7 @@ protected: }; static QPixmap qt_get_icon(IconID id) { + /* XPM */ static const char* const image0_data[] = { "22 22 2 1", ". c None", diff --git a/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h b/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h index 50cc4c8..40485ac 100644 --- a/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h +++ b/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h @@ -439,6 +439,7 @@ protected: }; static QPixmap qt_get_icon(IconID id) { + /* XPM */ static const char* const image0_data[] = { "22 22 2 1", ". c None", -- cgit v0.12 From 5de7a8578cf5ac563d8b17b2e1eadde06e469d8e Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Thu, 18 Mar 2010 23:00:09 +0900 Subject: Fix compile error with QT_NO_TEXTHTMLPARSER in QtGui Merge-request: 528 Reviewed-by: Zeno Albisser --- src/gui/text/qstatictext.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 1fabf12..798ae37 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -553,8 +553,11 @@ void QStaticTextPrivate::paintText(const QPointF &pos, QPainter *p) } else { QTextDocument document; document.setDefaultFont(font); +#ifndef QT_NO_TEXTHTMLPARSER document.setHtml(text); - +#else + document.setPlainText(text); +#endif QRectF rect = maximumSize.isValid() ? QRectF(pos, maximumSize) : QRectF(); document.adjustSize(); p->save(); -- cgit v0.12 From 6829ee30f02f162bbb399000c853c8d680f8f8de Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 26 Mar 2010 14:55:27 +0100 Subject: Compile on Maemo 5 qmake for Maemo 5 needs to be bootstrapped with an older gcc, which doesn't like foreach() in templates. Use a traditional for loop to iterate over the container instead. --- qmake/generators/symbian/symbian_makefile.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qmake/generators/symbian/symbian_makefile.h b/qmake/generators/symbian/symbian_makefile.h index f9d3c24..289f9ae 100644 --- a/qmake/generators/symbian/symbian_makefile.h +++ b/qmake/generators/symbian/symbian_makefile.h @@ -71,8 +71,9 @@ public: if (targetType == TypeExe) { generatePkg = true; } else { - foreach(QString item, this->project->values("DEPLOYMENT")) { - if (!this->project->values(item + ".sources").isEmpty()) { + const QStringList deployments = this->project->values("DEPLOYMENT"); + for (int i = 0; i < deployments.count(); ++i) { + if (!this->project->values(deployments.at(i) + ".sources").isEmpty()) { generatePkg = true; break; } -- cgit v0.12 From 61b488a965eebc52104243dce21eaeb203cfecae Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 26 Mar 2010 13:59:26 +0100 Subject: QtScript: Make sure the old identifier table is restored Use a shim to take care of that. --- src/script/api/qscriptengine.cpp | 2 +- src/script/api/qscriptengine_p.h | 1 - src/script/api/qscriptstring.cpp | 6 +++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index b322523..a393ead 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -915,7 +915,7 @@ QScriptEnginePrivate::QScriptEnginePrivate() QScriptEnginePrivate::~QScriptEnginePrivate() { - JSC::setCurrentIdentifierTable(globalData->identifierTable); + QScript::APIShim shim(this); //disconnect all loadedScripts and generate all jsc::debugger::scriptUnload events QHash::const_iterator it; diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index 70ab7c9..5c2007f 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -798,7 +798,6 @@ inline void QScriptEnginePrivate::unregisterScriptString(QScriptStringPrivate *v registeredScriptStrings = value->next; value->prev = 0; value->next = 0; - JSC::setCurrentIdentifierTable(globalData->identifierTable); } inline QScriptContext *QScriptEnginePrivate::contextForFrame(JSC::ExecState *frame) diff --git a/src/script/api/qscriptstring.cpp b/src/script/api/qscriptstring.cpp index 7978b61..d0b0ffd 100644 --- a/src/script/api/qscriptstring.cpp +++ b/src/script/api/qscriptstring.cpp @@ -92,8 +92,12 @@ QScriptString::~QScriptString() d->ref.ref(); // avoid deletion break; case QScriptStringPrivate::HeapAllocated: - if (d->engine && (d->ref == 1)) + if (d->engine && (d->ref == 1)) { + // Make sure the identifier is removed from the correct engine. + QScript::APIShim(d->engine); + d->identifier = JSC::Identifier(); d->engine->unregisterScriptString(d); + } break; } } -- cgit v0.12 From 7a11acd536d84ad22ef98a0fdbdb4322a55efafb Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 26 Mar 2010 14:00:02 +0100 Subject: QtScript: Add yet more missing API shims - for QScriptEngine and QScriptContext; we don't control what the JSC functions are doing, so it's better to have shims than not to have them (which can cause something to blow up), even if they might not be strictly necessary as of this writing. - for QScriptDeclarativeClass; otherwise the identifiers might be created/destroyed in the wrong engine. - for QScriptValueIterator destructor; otherwise the identifiers might be destroyed in the wrong engine. This is an attempt to fix a crash in Bauhaus, but it might still be crashing (i.e. still some shims missing, somewhere) ;( --- src/script/api/qscriptcontext.cpp | 14 ++++++++++++++ src/script/api/qscriptengine.cpp | 28 +++++++++++++++++++++++++++ src/script/api/qscriptvalueiterator.cpp | 6 ++++++ src/script/bridge/qscriptdeclarativeclass.cpp | 21 ++++++++++++++++---- 4 files changed, 65 insertions(+), 4 deletions(-) diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp index b1732ee..639af80 100644 --- a/src/script/api/qscriptcontext.cpp +++ b/src/script/api/qscriptcontext.cpp @@ -161,6 +161,7 @@ QScriptContext::QScriptContext() QScriptValue QScriptContext::throwValue(const QScriptValue &value) { JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); JSC::JSValue jscValue = QScript::scriptEngineFromExec(frame)->scriptValueToJSCValue(value); frame->setException(jscValue); return value; @@ -183,6 +184,7 @@ QScriptValue QScriptContext::throwValue(const QScriptValue &value) QScriptValue QScriptContext::throwError(Error error, const QString &text) { JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); JSC::ErrorType jscError = JSC::GeneralError; switch (error) { case UnknownError: @@ -218,6 +220,7 @@ QScriptValue QScriptContext::throwError(Error error, const QString &text) QScriptValue QScriptContext::throwError(const QString &text) { JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); JSC::JSObject *result = JSC::throwError(frame, JSC::GeneralError, text); return QScript::scriptEngineFromExec(frame)->scriptValueFromJSCValue(result); } @@ -265,6 +268,7 @@ QScriptValue QScriptContext::argument(int index) const QScriptValue QScriptContext::callee() const { const JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); return QScript::scriptEngineFromExec(frame)->scriptValueFromJSCValue(frame->callee()); } @@ -286,6 +290,7 @@ QScriptValue QScriptContext::callee() const QScriptValue QScriptContext::argumentsObject() const { JSC::CallFrame *frame = const_cast(QScriptEnginePrivate::frameForContext(this)); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); if (frame == frame->lexicalGlobalObject()->globalExec()) { // context doesn't have arguments. return an empty object @@ -322,6 +327,7 @@ QScriptValue QScriptContext::argumentsObject() const bool QScriptContext::isCalledAsConstructor() const { JSC::CallFrame *frame = const_cast(QScriptEnginePrivate::frameForContext(this)); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); //For native functions, look up flags. uint flags = QScriptEnginePrivate::contextFlags(frame); @@ -355,6 +361,7 @@ bool QScriptContext::isCalledAsConstructor() const QScriptContext *QScriptContext::parentContext() const { const JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); JSC::CallFrame *callerFrame = frame->callerFrame()->removeHostCallFrameFlag(); return QScriptEnginePrivate::contextForFrame(callerFrame); } @@ -412,6 +419,7 @@ void QScriptContext::setReturnValue(const QScriptValue &result) QScriptValue QScriptContext::activationObject() const { JSC::CallFrame *frame = const_cast(QScriptEnginePrivate::frameForContext(this)); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); JSC::JSObject *result = 0; uint flags = QScriptEnginePrivate::contextFlags(frame); @@ -477,6 +485,7 @@ void QScriptContext::setActivationObject(const QScriptValue &activation) } JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); QScriptEnginePrivate *engine = QScript::scriptEngineFromExec(frame); + QScript::APIShim shim(engine); JSC::JSObject *object = JSC::asObject(engine->scriptValueToJSCValue(activation)); if (object == engine->originalGlobalObjectProxy) object = engine->originalGlobalObject(); @@ -521,6 +530,7 @@ QScriptValue QScriptContext::thisObject() const { JSC::CallFrame *frame = const_cast(QScriptEnginePrivate::frameForContext(this)); QScriptEnginePrivate *engine = QScript::scriptEngineFromExec(frame); + QScript::APIShim shim(engine); JSC::JSValue result = engine->thisForContext(frame); if (!result || result.isNull()) result = frame->globalThisValue(); @@ -536,6 +546,7 @@ QScriptValue QScriptContext::thisObject() const void QScriptContext::setThisObject(const QScriptValue &thisObject) { JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); if (!thisObject.isObject()) return; if (thisObject.engine() != engine()) { @@ -662,6 +673,7 @@ QScriptValueList QScriptContext::scopeChain() const activationObject(); //ensure the creation of the normal scope for native context const JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); QScriptEnginePrivate *engine = QScript::scriptEngineFromExec(frame); + QScript::APIShim shim(engine); QScriptValueList result; JSC::ScopeChainNode *node = frame->scopeChain(); JSC::ScopeChainIterator it(node); @@ -700,6 +712,7 @@ void QScriptContext::pushScope(const QScriptValue &object) } JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); QScriptEnginePrivate *engine = QScript::scriptEngineFromExec(frame); + QScript::APIShim shim(engine); JSC::JSObject *jscObject = JSC::asObject(engine->scriptValueToJSCValue(object)); if (jscObject == engine->originalGlobalObjectProxy) jscObject = engine->originalGlobalObject(); @@ -733,6 +746,7 @@ QScriptValue QScriptContext::popScope() JSC::ScopeChainNode *scope = frame->scopeChain(); Q_ASSERT(scope != 0); QScriptEnginePrivate *engine = QScript::scriptEngineFromExec(frame); + QScript::APIShim shim(engine); QScriptValue result = engine->scriptValueFromJSCValue(scope->object); if (!scope->next) { // We cannot have a null scope chain, so just zap the object pointer. diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index a393ead..3e5249a 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1899,6 +1899,7 @@ QScriptEngine::~QScriptEngine() QScriptValue QScriptEngine::globalObject() const { Q_D(const QScriptEngine); + QScript::APIShim shim(const_cast(d)); JSC::JSObject *result = d->globalObject(); return const_cast(d)->scriptValueFromJSCValue(result); } @@ -1920,6 +1921,7 @@ void QScriptEngine::setGlobalObject(const QScriptValue &object) Q_D(QScriptEngine); if (!object.isObject()) return; + QScript::APIShim shim(d); JSC::JSObject *jscObject = JSC::asObject(d->scriptValueToJSCValue(object)); d->setGlobalObject(jscObject); } @@ -1976,6 +1978,7 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun, int length) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::ExecState* exec = d->currentFrame; JSC::JSValue function = new (exec)QScript::FunctionWrapper(exec, length, JSC::Identifier(exec, ""), fun); QScriptValue result = d->scriptValueFromJSCValue(function); @@ -1999,6 +2002,7 @@ extern QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax); QScriptValue QScriptEngine::newRegExp(const QRegExp ®exp) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->newRegExp(d->currentFrame, regexp)); } @@ -2017,6 +2021,7 @@ QScriptValue QScriptEngine::newRegExp(const QRegExp ®exp) QScriptValue QScriptEngine::newVariant(const QVariant &value) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->newVariant(value)); } @@ -2050,6 +2055,7 @@ QScriptValue QScriptEngine::newVariant(const QScriptValue &object, const QVariant &value) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::JSValue jsObject = d->scriptValueToJSCValue(object); return d->scriptValueFromJSCValue(d->newVariant(jsObject, value)); } @@ -2081,6 +2087,7 @@ QScriptValue QScriptEngine::newQObject(QObject *object, ValueOwnership ownership const QObjectWrapOptions &options) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::JSValue jscQObject = d->newQObject(object, ownership, options); return d->scriptValueFromJSCValue(jscQObject); } @@ -2117,8 +2124,10 @@ QScriptValue QScriptEngine::newQObject(const QScriptValue &scriptObject, ValueOwnership ownership, const QObjectWrapOptions &options) { + Q_D(QScriptEngine); if (!scriptObject.isObject()) return newQObject(qtObject, ownership, options); + QScript::APIShim shim(d); JSC::JSObject *jscObject = JSC::asObject(QScriptValuePrivate::get(scriptObject)->jscValue); if (!jscObject->inherits(&QScriptObject::info)) { qWarning("QScriptEngine::newQObject(): changing class of non-QScriptObject not supported"); @@ -2149,6 +2158,7 @@ QScriptValue QScriptEngine::newQObject(const QScriptValue &scriptObject, QScriptValue QScriptEngine::newObject() { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->newObject()); } @@ -2170,6 +2180,7 @@ QScriptValue QScriptEngine::newObject(QScriptClass *scriptClass, const QScriptValue &data) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::ExecState* exec = d->currentFrame; QScriptObject *result = new (exec) QScriptObject(d->scriptObjectStructure); result->setDelegate(new QScript::ClassObjectDelegate(scriptClass)); @@ -2237,6 +2248,7 @@ QScriptValue QScriptEngine::newActivationObject() QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun, int length) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::ExecState* exec = d->currentFrame; JSC::JSValue function = new (exec)QScript::FunctionWrapper(exec, length, JSC::Identifier(exec, ""), fun); QScriptValue result = d->scriptValueFromJSCValue(function); @@ -2254,6 +2266,7 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun, in QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionWithArgSignature fun, void *arg) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::ExecState* exec = d->currentFrame; JSC::JSValue function = new (exec)QScript::FunctionWithArgWrapper(exec, /*length=*/0, JSC::Identifier(exec, ""), fun, arg); QScriptValue result = d->scriptValueFromJSCValue(function); @@ -2272,6 +2285,7 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionWithArgSignature QScriptValue QScriptEngine::newArray(uint length) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->newArray(d->currentFrame, length)); } @@ -2285,6 +2299,7 @@ QScriptValue QScriptEngine::newArray(uint length) QScriptValue QScriptEngine::newRegExp(const QString &pattern, const QString &flags) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->newRegExp(d->currentFrame, pattern, flags)); } @@ -2296,6 +2311,7 @@ QScriptValue QScriptEngine::newRegExp(const QString &pattern, const QString &fla QScriptValue QScriptEngine::newDate(qsreal value) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->newDate(d->currentFrame, value)); } @@ -2307,6 +2323,7 @@ QScriptValue QScriptEngine::newDate(qsreal value) QScriptValue QScriptEngine::newDate(const QDateTime &value) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->newDate(d->currentFrame, value)); } @@ -2330,6 +2347,7 @@ QScriptValue QScriptEngine::newQMetaObject( const QMetaObject *metaObject, const QScriptValue &ctor) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::JSValue jscCtor = d->scriptValueToJSCValue(ctor); JSC::JSValue jscQMetaObject = d->newQMetaObject(metaObject, jscCtor); return d->scriptValueFromJSCValue(jscQMetaObject); @@ -2582,6 +2600,7 @@ QScriptContext *QScriptEngine::currentContext() const QScriptContext *QScriptEngine::pushContext() { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::CallFrame* newFrame = d->pushContext(d->currentFrame, d->currentFrame->globalData().dynamicGlobalObject, JSC::ArgList(), /*callee = */0); @@ -2673,6 +2692,7 @@ void QScriptEngine::popContext() if (agent()) agent()->contextPop(); Q_D(QScriptEngine); + QScript::APIShim shim(d); if (d->currentFrame->returnPC() != 0 || d->currentFrame->codeBlock() != 0 || !currentContext()->parentContext()) { qWarning("QScriptEngine::popContext() doesn't match with pushContext()"); @@ -2868,6 +2888,7 @@ void QScriptEngine::setDefaultPrototype(int metaTypeId, const QScriptValue &prot QScriptValue QScriptEngine::create(int type, const void *ptr) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->create(d->currentFrame, type, ptr)); } @@ -3277,6 +3298,7 @@ bool QScriptEnginePrivate::hasDemarshalFunction(int type) const bool QScriptEngine::convert(const QScriptValue &value, int type, void *ptr) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return QScriptEnginePrivate::convertValue(d->currentFrame, d->scriptValueToJSCValue(value), type, ptr); } @@ -3309,6 +3331,7 @@ void QScriptEngine::registerCustomType(int type, MarshalFunction mf, const QScriptValue &prototype) { Q_D(QScriptEngine); + QScript::APIShim shim(d); QScriptTypeInfo *info = d->m_typeInfos.value(type); if (!info) { info = new QScriptTypeInfo(); @@ -3341,6 +3364,7 @@ void QScriptEngine::registerCustomType(int type, MarshalFunction mf, void QScriptEngine::installTranslatorFunctions(const QScriptValue &object) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::ExecState* exec = d->currentFrame; JSC::JSValue jscObject = d->scriptValueToJSCValue(object); JSC::JSGlobalObject *glob = d->originalGlobalObject(); @@ -3374,6 +3398,7 @@ QScriptValue QScriptEngine::importExtension(const QString &extension) Q_UNUSED(extension); #else Q_D(QScriptEngine); + QScript::APIShim shim(d); if (d->importedExtensions.contains(extension)) return undefinedValue(); // already imported @@ -4014,6 +4039,7 @@ bool qScriptConnect(QObject *sender, const char *signal, if (receiver.isObject() && (receiver.engine() != function.engine())) return false; QScriptEnginePrivate *engine = QScriptEnginePrivate::get(function.engine()); + QScript::APIShim shim(engine); JSC::JSValue jscReceiver = engine->scriptValueToJSCValue(receiver); JSC::JSValue jscFunction = engine->scriptValueToJSCValue(function); return engine->scriptConnect(sender, signal, jscReceiver, jscFunction, @@ -4040,6 +4066,7 @@ bool qScriptDisconnect(QObject *sender, const char *signal, if (receiver.isObject() && (receiver.engine() != function.engine())) return false; QScriptEnginePrivate *engine = QScriptEnginePrivate::get(function.engine()); + QScript::APIShim shim(engine); JSC::JSValue jscReceiver = engine->scriptValueToJSCValue(receiver); JSC::JSValue jscFunction = engine->scriptValueToJSCValue(function); return engine->scriptDisconnect(sender, signal, jscReceiver, jscFunction); @@ -4145,6 +4172,7 @@ QScriptString QScriptEngine::toStringHandle(const QString &str) QScriptValue QScriptEngine::toObject(const QScriptValue &value) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::JSValue jscValue = d->scriptValueToJSCValue(value); if (!jscValue || jscValue.isUndefined() || jscValue.isNull()) return QScriptValue(); diff --git a/src/script/api/qscriptvalueiterator.cpp b/src/script/api/qscriptvalueiterator.cpp index 7fd7093..c58c046 100644 --- a/src/script/api/qscriptvalueiterator.cpp +++ b/src/script/api/qscriptvalueiterator.cpp @@ -139,6 +139,12 @@ QScriptValueIterator::QScriptValueIterator(const QScriptValue &object) */ QScriptValueIterator::~QScriptValueIterator() { + Q_D(QScriptValueIterator); + if (d && d->engine()) { + // Make sure identifiers are removed from the correct engine. + QScript::APIShim shim(d->engine()); + d->propertyNames.clear(); + } } /*! diff --git a/src/script/bridge/qscriptdeclarativeclass.cpp b/src/script/bridge/qscriptdeclarativeclass.cpp index acfb2a4..c72eb94 100644 --- a/src/script/bridge/qscriptdeclarativeclass.cpp +++ b/src/script/bridge/qscriptdeclarativeclass.cpp @@ -148,9 +148,12 @@ QScriptDeclarativeClass::PersistentIdentifier::PersistentIdentifier() QScriptDeclarativeClass::PersistentIdentifier::~PersistentIdentifier() { - if (engine) - JSC::setCurrentIdentifierTable(engine->globalData->identifierTable); - ((JSC::Identifier &)d).JSC::Identifier::~Identifier(); + if (engine) { + QScript::APIShim shim(engine); + ((JSC::Identifier &)d).JSC::Identifier::~Identifier(); + } else { + ((JSC::Identifier &)d).JSC::Identifier::~Identifier(); + } } QScriptDeclarativeClass::PersistentIdentifier::PersistentIdentifier(const PersistentIdentifier &other) @@ -184,7 +187,8 @@ QScriptValue QScriptDeclarativeClass::newObject(QScriptEngine *engine, Q_ASSERT(engine); Q_ASSERT(scriptClass); - QScriptEnginePrivate *p = static_cast(QObjectPrivate::get(engine)); + QScriptEnginePrivate *p = static_cast(QObjectPrivate::get(engine)); + QScript::APIShim shim(p); JSC::ExecState* exec = p->currentFrame; QScriptObject *result = new (exec) QScriptObject(p->scriptObjectStructure); @@ -201,6 +205,7 @@ QScriptDeclarativeClass::newObjectValue(QScriptEngine *engine, Q_ASSERT(scriptClass); QScriptEnginePrivate *p = static_cast(QObjectPrivate::get(engine)); + QScript::APIShim shim(p); JSC::ExecState* exec = p->currentFrame; QScriptObject *result = new (exec) QScriptObject(p->scriptObjectStructure); @@ -231,6 +236,7 @@ QScriptValue QScriptDeclarativeClass::function(const QScriptValue &v, const Iden if (!d->isObject()) return QScriptValue(); + QScript::APIShim shim(d->engine); JSC::ExecState *exec = d->engine->currentFrame; JSC::JSObject *object = d->jscValue.getObject(); JSC::PropertySlot slot(const_cast(object)); @@ -254,6 +260,7 @@ QScriptValue QScriptDeclarativeClass::property(const QScriptValue &v, const Iden if (!d->isObject()) return QScriptValue(); + QScript::APIShim shim(d->engine); JSC::ExecState *exec = d->engine->currentFrame; JSC::JSObject *object = d->jscValue.getObject(); JSC::PropertySlot slot(const_cast(object)); @@ -277,6 +284,7 @@ QScriptDeclarativeClass::functionValue(const QScriptValue &v, const Identifier & if (!d->isObject()) return Value(); + QScript::APIShim shim(d->engine); JSC::ExecState *exec = d->engine->currentFrame; JSC::JSObject *object = d->jscValue.getObject(); JSC::PropertySlot slot(const_cast(object)); @@ -301,6 +309,7 @@ QScriptDeclarativeClass::propertyValue(const QScriptValue &v, const Identifier & if (!d->isObject()) return Value(); + QScript::APIShim shim(d->engine); JSC::ExecState *exec = d->engine->currentFrame; JSC::JSObject *object = d->jscValue.getObject(); JSC::PropertySlot slot(const_cast(object)); @@ -326,6 +335,7 @@ QScriptValue QScriptDeclarativeClass::scopeChainValue(QScriptContext *context, i context->activationObject(); //ensure the creation of the normal scope for native context const JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(context); QScriptEnginePrivate *engine = QScript::scriptEngineFromExec(frame); + QScript::APIShim shim(engine); JSC::ScopeChainNode *node = frame->scopeChain(); JSC::ScopeChainIterator it(node); @@ -386,6 +396,7 @@ QScriptContext * QScriptDeclarativeClass::pushCleanContext(QScriptEngine *engine return 0; QScriptEnginePrivate *d = QScriptEnginePrivate::get(engine); + QScript::APIShim shim(d); JSC::CallFrame* newFrame = d->pushContext(d->currentFrame, d->currentFrame->globalData().dynamicGlobalObject, @@ -421,6 +432,7 @@ QScriptDeclarativeClass::createPersistentIdentifier(const QString &str) { QScriptEnginePrivate *p = static_cast(QObjectPrivate::get(d_ptr->engine)); + QScript::APIShim shim(p); JSC::ExecState* exec = p->currentFrame; PersistentIdentifier rv(p); @@ -434,6 +446,7 @@ QScriptDeclarativeClass::createPersistentIdentifier(const Identifier &id) { QScriptEnginePrivate *p = static_cast(QObjectPrivate::get(d_ptr->engine)); + QScript::APIShim shim(p); JSC::ExecState* exec = p->currentFrame; PersistentIdentifier rv(p); -- cgit v0.12 From f681d8e2ebf774f69f92359d33ff80dd13c1bf87 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 26 Mar 2010 15:05:07 +0100 Subject: Unskip test that used to crash After updating JavaScriptCore for 4.7 it no longer crashes. --- tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp index a3dfd6c..5f9a578 100644 --- a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp +++ b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp @@ -255,10 +255,6 @@ tst_Suite::tst_Suite() addTestExclusion("string-case", "V8-specific behavior? (Doesn't pass on SpiderMonkey either)"); -#ifdef Q_CC_MINGW - addTestExclusion("date$", "QTBUG-7698: Date.prototype.setMonth() crashes on win32-g++"); -#endif - #ifdef Q_OS_WINCE addTestExclusion("deep-recursion", "Demands too much memory on WinCE"); addTestExclusion("nested-repetition-count-overflow", "Demands too much memory on WinCE"); -- cgit v0.12 From 392aaba04d8eda52ec7f6c36c31bcd23b0458140 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 26 Mar 2010 16:44:41 +0100 Subject: Remove QGuard. This class is no longer in use by QtDeclarative. Task-number: QT-3031 Reviewed-by: Bradley T. Hughes --- src/corelib/kernel/kernel.pri | 1 - src/corelib/kernel/qguard_p.h | 157 ----------------------------------------- src/corelib/kernel/qobject.cpp | 9 --- src/corelib/kernel/qobject_p.h | 31 +------- 4 files changed, 1 insertion(+), 197 deletions(-) delete mode 100644 src/corelib/kernel/qguard_p.h diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index d0dad49..1851e04 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -33,7 +33,6 @@ HEADERS += \ kernel/qsystemsemaphore.h \ kernel/qsystemsemaphore_p.h \ kernel/qfunctions_p.h \ - kernel/qguard_p.h \ kernel/qmath.h SOURCES += \ diff --git a/src/corelib/kernel/qguard_p.h b/src/corelib/kernel/qguard_p.h deleted file mode 100644 index 0f7fd94..0000000 --- a/src/corelib/kernel/qguard_p.h +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtCore 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 QGUARD_P_H -#define QGUARD_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. -// -// We mean it. -// - -#include "QtCore/qglobal.h" - -QT_BEGIN_NAMESPACE - -class QObject; -template -class QGuard -{ - QObject *o; - QGuard *next; - QGuard **prev; - friend void q_guard_addGuard(QGuard *); - friend void q_guard_removeGuard(QGuard *); - friend class QObjectPrivate; -public: - inline QGuard(); - inline QGuard(T *); - inline QGuard(const QGuard &); - inline virtual ~QGuard(); - - inline QGuard &operator=(const QGuard &o); - inline QGuard &operator=(T *); - - inline bool isNull() const - { return !o; } - - inline T* operator->() const - { return static_cast(const_cast(o)); } - inline T& operator*() const - { return *static_cast(const_cast(o)); } - inline operator T*() const - { return static_cast(const_cast(o)); } - inline T* data() const - { return static_cast(const_cast(o)); } - -protected: - virtual void objectDestroyed(T *) {} -}; - -QT_END_NAMESPACE - -#include "private/qobject_p.h" - -QT_BEGIN_NAMESPACE - -inline void q_guard_addGuard(QGuard *); -inline void q_guard_removeGuard(QGuard *); - -template -QGuard::QGuard() -: o(0), next(0), prev(0) -{ -} - -template -QGuard::QGuard(T *g) -: o(g), next(0), prev(0) -{ - if (o) q_guard_addGuard(reinterpret_cast *>(this)); -} - -template -QGuard::QGuard(const QGuard &g) -: o(g.o), next(0), prev(0) -{ - if (o) q_guard_addGuard(reinterpret_cast *>(this)); -} - -template -QGuard::~QGuard() -{ - if (prev) q_guard_removeGuard(reinterpret_cast *>(this)); - o = 0; -} - -template -QGuard &QGuard::operator=(const QGuard &g) -{ - if (g.o != o) { - if (prev) - q_guard_removeGuard(reinterpret_cast *>(this)); - o = g.o; - if (o) q_guard_addGuard(reinterpret_cast *>(this)); - } - return *this; -} - -template -inline QGuard &QGuard::operator=(T *g) -{ - if (g != o) { - if (prev) - q_guard_removeGuard(reinterpret_cast *>(this)); - o = g; - if (o) q_guard_addGuard(reinterpret_cast *>(this)); - } - return *this; -} - -QT_END_NAMESPACE - -#endif // QGUARD_P_H diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 68f34ca..dbc6be2 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -496,15 +496,6 @@ void QMetaObject::changeGuard(QObject **ptr, QObject *o) void QObjectPrivate::clearGuards(QObject *object) { QObjectPrivate *priv = QObjectPrivate::get(object); - QGuard *guard = priv->extraData ? priv->extraData->objectGuards : 0; - while (guard) { - QGuard *g = guard; - guard = guard->next; - g->o = 0; - g->prev = 0; - g->next = 0; - g->objectDestroyed(object); - } if (!priv->hasGuards) return; diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index 20e3da1..3b59abb 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -60,7 +60,6 @@ #include "QtCore/qvector.h" #include "QtCore/qreadwritelock.h" #include "QtCore/qvariant.h" -#include "private/qguard_p.h" QT_BEGIN_NAMESPACE @@ -100,13 +99,12 @@ class Q_CORE_EXPORT QObjectPrivate : public QObjectData public: struct ExtraData { - ExtraData() : objectGuards(0) {} + ExtraData() {} #ifndef QT_NO_USERDATA QVector userData; #endif QList propertyNames; QList propertyValues; - QGuard *objectGuards; //linked list handle of QGuards }; struct Connection @@ -224,33 +222,6 @@ inline bool QObjectPrivate::isSignalConnected(uint signal_index) const } -inline void q_guard_addGuard(QGuard *g) -{ - QObjectPrivate *p = QObjectPrivate::get(g->o); - if (p->wasDeleted) { - qWarning("QGuard: cannot add guard to deleted object"); - g->o = 0; - return; - } - - if (!p->extraData) - p->extraData = new QObjectPrivate::ExtraData; - - g->next = p->extraData->objectGuards; - p->extraData->objectGuards = g; - g->prev = &p->extraData->objectGuards; - if (g->next) - g->next->prev = &g->next; -} - -inline void q_guard_removeGuard(QGuard *g) -{ - if (g->next) g->next->prev = g->prev; - *g->prev = g->next; - g->next = 0; - g->prev = 0; -} - Q_DECLARE_TYPEINFO(QObjectPrivate::Connection, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(QObjectPrivate::Sender, Q_MOVABLE_TYPE); -- cgit v0.12 From e69e397cee5ac1ce1bd6a1bca559e5607bb4258a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 27 Mar 2010 08:33:48 +0100 Subject: Autotests: oops, remove last traces of QGuard --- .../tst_qdeclarativeproperty.cpp | 137 ++++---- tests/auto/qguard/qguard.pro | 2 - tests/auto/qguard/tst_qguard.cpp | 350 --------------------- 3 files changed, 68 insertions(+), 421 deletions(-) delete mode 100644 tests/auto/qguard/qguard.pro delete mode 100644 tests/auto/qguard/tst_qguard.cpp diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp index 56166f2..7d51bb6 100644 --- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp +++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -138,9 +137,9 @@ void tst_qdeclarativeproperty::qmlmetaproperty() { QDeclarativeProperty prop; - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -169,10 +168,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty() QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -234,9 +233,9 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() { QDeclarativeProperty prop(&object); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -265,10 +264,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -279,10 +278,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() { QDeclarativeProperty prop(&dobject); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -312,11 +311,11 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, ":-1: Unable to assign null to int"); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding != 0); - QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data()); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -333,9 +332,9 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() { QDeclarativeProperty prop(&object, QString("defaultProperty")); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -364,10 +363,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -378,10 +377,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() { QDeclarativeProperty prop(&dobject, QString("defaultProperty")); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -411,11 +410,11 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, ":-1: Unable to assign null to int"); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding != 0); - QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data()); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -426,10 +425,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() { QDeclarativeProperty prop(&dobject, QString("onClicked")); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -458,12 +457,12 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression != 0); - QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression.data()); QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("clicked()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -473,10 +472,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() { QDeclarativeProperty prop(&dobject, QString("onPropertyWithNotifyChanged")); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -505,12 +504,12 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression != 0); - QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression.data()); QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -526,9 +525,9 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() { QDeclarativeProperty prop(&object, engine.rootContext()); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -557,10 +556,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -571,10 +570,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() { QDeclarativeProperty prop(&dobject, engine.rootContext()); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -604,11 +603,11 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, ":-1: Unable to assign null to int"); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding != 0); - QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data()); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -625,9 +624,9 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() { QDeclarativeProperty prop(&object, QString("defaultProperty"), engine.rootContext()); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -656,10 +655,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -670,10 +669,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() { QDeclarativeProperty prop(&dobject, QString("defaultProperty"), engine.rootContext()); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -703,11 +702,11 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, ":-1: Unable to assign null to int"); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding != 0); - QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data()); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -718,10 +717,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() { QDeclarativeProperty prop(&dobject, QString("onClicked"), engine.rootContext()); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -750,12 +749,12 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression != 0); - QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression.data()); QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("clicked()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -765,10 +764,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() { QDeclarativeProperty prop(&dobject, QString("onPropertyWithNotifyChanged"), engine.rootContext()); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -797,12 +796,12 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression != 0); - QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression.data()); QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); diff --git a/tests/auto/qguard/qguard.pro b/tests/auto/qguard/qguard.pro deleted file mode 100644 index f249dde..0000000 --- a/tests/auto/qguard/qguard.pro +++ /dev/null @@ -1,2 +0,0 @@ -load(qttest_p4) -SOURCES += tst_qguard.cpp diff --git a/tests/auto/qguard/tst_qguard.cpp b/tests/auto/qguard/tst_qguard.cpp deleted file mode 100644 index 465ad0e..0000000 --- a/tests/auto/qguard/tst_qguard.cpp +++ /dev/null @@ -1,350 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite 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$ -** -****************************************************************************/ - -// NOTE: This is identical to the QPointer autotest - -#include - -#include -#include -#include -#include - -class tst_QGuard : public QObject -{ - Q_OBJECT -public: - tst_QGuard(); - ~tst_QGuard(); - - inline tst_QGuard *me() const - { return const_cast(this); } - -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); -private slots: - void constructors(); - void destructor(); - void assignment_operators(); - void equality_operators(); - void isNull(); - void dereference_operators(); - void disconnect(); - void castDuringDestruction(); - void data() const; - void dataSignature() const; -}; - -tst_QGuard::tst_QGuard() -{ } - -tst_QGuard::~tst_QGuard() -{ } - -void tst_QGuard::initTestCase() -{ } - -void tst_QGuard::cleanupTestCase() -{ } - -void tst_QGuard::init() -{ } - -void tst_QGuard::cleanup() -{ } - -void tst_QGuard::constructors() -{ - QGuard p1; - QGuard p2(this); - QGuard p3(p2); - QCOMPARE(p1, QGuard(0)); - QCOMPARE(p2, QGuard(this)); - QCOMPARE(p3, QGuard(this)); -} - -void tst_QGuard::destructor() -{ - QObject *object = new QObject; - QGuard p = object; - QCOMPARE(p, QGuard(object)); - delete object; - QCOMPARE(p, QGuard(0)); -} - -void tst_QGuard::assignment_operators() -{ - QGuard p1; - QGuard p2; - - p1 = this; - p2 = p1; - - QCOMPARE(p1, QGuard(this)); - QCOMPARE(p2, QGuard(this)); - QCOMPARE(p1, QGuard(p2)); - - p1 = 0; - p2 = p1; - QCOMPARE(p1, QGuard(0)); - QCOMPARE(p2, QGuard(0)); - QCOMPARE(p1, QGuard(p2)); - - QObject *object = new QObject; - - p1 = object; - p2 = p1; - QCOMPARE(p1, QGuard(object)); - QCOMPARE(p2, QGuard(object)); - QCOMPARE(p1, QGuard(p2)); - - delete object; - QCOMPARE(p1, QGuard(0)); - QCOMPARE(p2, QGuard(0)); - QCOMPARE(p1, QGuard(p2)); -} - -void tst_QGuard::equality_operators() -{ - QGuard p1; - QGuard p2; - - QVERIFY(p1 == p2); - - QObject *object = 0; - QWidget *widget = 0; - - p1 = object; - QVERIFY(p1 == p2); - QVERIFY(p1 == object); - p2 = object; - QVERIFY(p2 == p1); - QVERIFY(p2 == object); - - p1 = this; - QVERIFY(p1 != p2); - p2 = p1; - QVERIFY(p1 == p2); - - // compare to zero - p1 = 0; - QVERIFY(p1 == 0); - QVERIFY(0 == p1); - QVERIFY(p2 != 0); - QVERIFY(0 != p2); - QVERIFY(p1 == object); - QVERIFY(object == p1); - QVERIFY(p2 != object); - QVERIFY(object != p2); - QVERIFY(p1 == widget); - QVERIFY(widget == p1); - QVERIFY(p2 != widget); - QVERIFY(widget != p2); -} - -void tst_QGuard::isNull() -{ - QGuard p1; - QVERIFY(p1.isNull()); - p1 = this; - QVERIFY(!p1.isNull()); - p1 = 0; - QVERIFY(p1.isNull()); -} - -void tst_QGuard::dereference_operators() -{ - QGuard p1 = this; - - QObject *object = p1->me(); - QVERIFY(object == this); - - QObject &ref = *p1; - QVERIFY(&ref == this); - - object = static_cast(p1); - QVERIFY(object == this); -} - -void tst_QGuard::disconnect() -{ - QGuard p1 = new QObject; - QVERIFY(!p1.isNull()); - p1->disconnect(); - QVERIFY(!p1.isNull()); - delete static_cast(p1); - QVERIFY(p1.isNull()); -} - -class ChildObject : public QObject -{ - QGuard guardedPointer; - -public: - ChildObject(QObject *parent) - : QObject(parent), guardedPointer(parent) - { } - ~ChildObject(); -}; - -ChildObject::~ChildObject() -{ - QCOMPARE(static_cast(guardedPointer), static_cast(0)); - QCOMPARE(qobject_cast(guardedPointer), static_cast(0)); -} - -class ChildWidget : public QWidget -{ - QGuard guardedPointer; - -public: - ChildWidget(QWidget *parent) - : QWidget(parent), guardedPointer(parent) - { } - ~ChildWidget(); -}; - -ChildWidget::~ChildWidget() -{ - QCOMPARE(static_cast(guardedPointer), static_cast(0)); - QCOMPARE(qobject_cast(guardedPointer), static_cast(0)); -} - -class DerivedChild; - -class DerivedParent : public QObject -{ - Q_OBJECT - - DerivedChild *derivedChild; - -public: - DerivedParent(); - ~DerivedParent(); -}; - -class DerivedChild : public QObject -{ - Q_OBJECT - - DerivedParent *parentPointer; - QGuard guardedParentPointer; - -public: - DerivedChild(DerivedParent *parent) - : QObject(parent), parentPointer(parent), guardedParentPointer(parent) - { } - ~DerivedChild(); -}; - -DerivedParent::DerivedParent() - : QObject() -{ - derivedChild = new DerivedChild(this); -} - -DerivedParent::~DerivedParent() -{ - delete derivedChild; -} - -DerivedChild::~DerivedChild() -{ - QCOMPARE(static_cast(guardedParentPointer), parentPointer); - QCOMPARE(qobject_cast(guardedParentPointer), parentPointer); -} - -void tst_QGuard::castDuringDestruction() -{ - { - QObject *parentObject = new QObject(); - (void) new ChildObject(parentObject); - delete parentObject; - } - - { - QWidget *parentWidget = new QWidget(); - (void) new ChildWidget(parentWidget); - delete parentWidget; - } - - { - delete new DerivedParent(); - } -} - -void tst_QGuard::data() const -{ - /* Check value of a default constructed object. */ - { - QGuard p; - QCOMPARE(p.data(), static_cast(0)); - } - - /* Check value of a default constructed object. */ - { - QObject *const object = new QObject(); - QGuard p(object); - QCOMPARE(p.data(), object); - } -} - -void tst_QGuard::dataSignature() const -{ - /* data() should be const. */ - { - const QGuard p; - p.data(); - } - - /* The return type should be T. */ - { - const QGuard p; - /* If the types differs, the QCOMPARE will fail to instansiate. */ - QCOMPARE(p.data(), static_cast(0)); - } -} - -QTEST_MAIN(tst_QGuard) -#include "tst_qguard.moc" -- cgit v0.12 From caada5afef099b0ba7ecedb8a08ef0ecc7b5802d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 27 Mar 2010 18:30:37 +0100 Subject: Autotest: oops, fix oops: remove qguard from auto.pro --- tests/auto/gui.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/gui.pro b/tests/auto/gui.pro index 10a760c..a8fd2b4 100644 --- a/tests/auto/gui.pro +++ b/tests/auto/gui.pro @@ -78,7 +78,6 @@ SUBDIRS=\ qgraphicswidget \ qgridlayout \ qgroupbox \ - qguard \ qguivariant \ qheaderview \ qhelpcontentmodel \ -- cgit v0.12 From dcb055cde3a8d31e52a2d2143f14ca8662859541 Mon Sep 17 00:00:00 2001 From: John Brooks Date: Sat, 27 Mar 2010 11:35:27 -0600 Subject: Trivial fix to JavaScriptCore to fix building with MSVC 2010 Reviewed-By: Thiago Macieira --- .../javascriptcore/JavaScriptCore/runtime/StructureTransitionTable.h | 4 ++-- src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StructureTransitionTable.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StructureTransitionTable.h index 35fb7e4..2ecf0d3 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StructureTransitionTable.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StructureTransitionTable.h @@ -143,14 +143,14 @@ namespace JSC { if (!specificValue) { TransitionTable::iterator find = table()->find(key); if (find == table()->end()) - table()->add(key, Transition(structure, 0)); + table()->add(key, Transition(structure, (Structure*)0)); else find->second.first = structure; } else { // If we're adding a transition to a specific value, then there cannot be // an existing transition ASSERT(!table()->contains(key)); - table()->add(key, Transition(0, structure)); + table()->add(key, Transition((Structure*)0, structure)); } } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h index 0fa7b73..f39560a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h @@ -143,14 +143,14 @@ namespace JSC { if (!specificValue) { TransitionTable::iterator find = table()->find(key); if (find == table()->end()) - table()->add(key, Transition(structure, 0)); + table()->add(key, Transition(structure, (Structure*)0)); else find->second.first = structure; } else { // If we're adding a transition to a specific value, then there cannot be // an existing transition ASSERT(!table()->contains(key)); - table()->add(key, Transition(0, structure)); + table()->add(key, Transition((Structure*)0, structure)); } } -- cgit v0.12 From a078587d6a0a3fc514d5395984b0c6e2efa76e9d Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Sun, 28 Mar 2010 21:22:11 +0200 Subject: Fixed a typo in the QDoubleValidotor doc. Reviewed-by: trustme --- src/gui/widgets/qvalidator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qvalidator.cpp b/src/gui/widgets/qvalidator.cpp index 0b5cc5a..b75db45 100644 --- a/src/gui/widgets/qvalidator.cpp +++ b/src/gui/widgets/qvalidator.cpp @@ -523,7 +523,7 @@ public: In addition, QDoubleValidator is always guaranteed to accept a number formatted according to the "C" locale. QDoubleValidator will not accept - numbers with thousand-seperators. + numbers with thousand-separators. \sa QIntValidator, QRegExpValidator, {Line Edits Example} */ -- cgit v0.12 From 1eb54209adca3ed93426598c1dcf51ca4ba675be Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Mon, 29 Mar 2010 13:34:36 +0200 Subject: QNAM HTTP: Fix invoking a method when being destructed right now Reviewed-by: Thiago Macieira --- src/network/access/qhttpnetworkconnectionchannel.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 1d8224c..0b97cbe 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -648,7 +648,8 @@ void QHttpNetworkConnectionChannel::allDone() close(); QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } else if (alreadyPipelinedRequests.isEmpty()) { - QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); + if (qobject_cast(connection)) + QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } } @@ -753,7 +754,8 @@ void QHttpNetworkConnectionChannel::handleStatus() } break; default: - QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); + if (qobject_cast(connection)) + QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } } @@ -801,7 +803,8 @@ void QHttpNetworkConnectionChannel::closeAndResendCurrentRequest() requeueCurrentlyPipelinedRequests(); close(); resendCurrent = true; - QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); + if (qobject_cast(connection)) + QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } bool QHttpNetworkConnectionChannel::isSocketBusy() const -- cgit v0.12 From 0e73e97548be067035dd5038b329abd50ecb3bf3 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 29 Mar 2010 14:22:43 +0200 Subject: Support EtchDisabledText with spin box on Windows style Reviewed-by: ogoffart Task-number: QTBUG-7525 --- src/gui/styles/qwindowsstyle.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 60c06ca..1653baa 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -3105,7 +3105,9 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On), ©.palette.brush(QPalette::Button)); copy.rect.adjust(4, 1, -5, -1); - if (!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) ) { + if ((!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled)) + && proxy()->styleHint(SH_EtchDisabledText, opt, widget) ) + { QStyleOptionSpinBox lightCopy = copy; lightCopy.rect.adjust(1, 1, 1, 1); lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light()); @@ -3138,7 +3140,9 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On), ©.palette.brush(QPalette::Button)); copy.rect.adjust(4, 0, -5, -1); - if (!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) ) { + if ((!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled)) + && proxy()->styleHint(SH_EtchDisabledText, opt, widget) ) + { QStyleOptionSpinBox lightCopy = copy; lightCopy.rect.adjust(1, 1, 1, 1); lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light()); -- cgit v0.12 From e1a1c2336c7344736f072bc29573662f6cb85f3e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 29 Mar 2010 14:46:05 +0200 Subject: scan some more file types by default - java & jui - js, qs & qml Task-number: QTBUG-9429 --- tools/linguist/lupdate/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 0003baa..e252780 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -409,7 +409,7 @@ static void processProjects( int main(int argc, char **argv) { QCoreApplication app(argc, argv); - m_defaultExtensions = QLatin1String("ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx"); + m_defaultExtensions = QLatin1String("java,jui,ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx,js,qs,qml"); QStringList args = app.arguments(); QStringList tsFileNames; -- cgit v0.12 From 5daac41683e679d869c586e8bdf9f184fd1e3557 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 29 Mar 2010 14:46:16 +0200 Subject: jui files are no c++ ... --- tools/linguist/lupdate/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index e252780..6c9157a 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -634,6 +634,7 @@ int main(int argc, char **argv) sourceFiles << fn; if (!fn.endsWith(QLatin1String(".java")) + && !fn.endsWith(QLatin1String(".jui")) && !fn.endsWith(QLatin1String(".ui")) && !fn.endsWith(QLatin1String(".js")) && !fn.endsWith(QLatin1String(".qs")) -- cgit v0.12 From 97b2272e91e25418f63328c681cef54bdc1e43ff Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Mar 2010 14:06:12 +0200 Subject: Update PLATFORM(SPARC64) to CPU(SPARC64) --- src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h index 5b655e8..85c8743 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h @@ -239,7 +239,7 @@ inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Bar inline int atomicIncrement(int volatile* addend) { return android_atomic_inc(addend); } inline int atomicDecrement(int volatile* addend) { return android_atomic_dec(addend); } -#elif COMPILER(GCC) && !PLATFORM(SPARC64) && !defined(__SYMBIAN32__) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc +#elif COMPILER(GCC) && !CPU(SPARC64) && !defined(__SYMBIAN32__) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc #define WTF_USE_LOCKFREE_THREADSAFESHARED 1 inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; } -- cgit v0.12 From cc5ae1831e54702f7bb8477ab3b14ab9832c064c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Mar 2010 14:25:16 +0200 Subject: Ensure that we return QPair in all cases. Fixes a compilation failure on AIX. Reviewed-By: Marius Storm-Olsen --- src/corelib/tools/qelapsedtimer_unix.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qelapsedtimer_unix.cpp b/src/corelib/tools/qelapsedtimer_unix.cpp index 85d7fa8..1a7bc71 100644 --- a/src/corelib/tools/qelapsedtimer_unix.cpp +++ b/src/corelib/tools/qelapsedtimer_unix.cpp @@ -97,19 +97,19 @@ static inline QPair do_gettime() #if (_POSIX_MONOTONIC_CLOCK-0 > 0) timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - return qMakePair(ts.tv_sec, ts.tv_nsec); + return qMakePair(ts.tv_sec, ts.tv_nsec); #else # if !defined(QT_NO_CLOCK_MONOTONIC) && !defined(QT_BOOTSTRAPPED) if (QElapsedTimer::isMonotonic()) { timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - return qMakePair(ts.tv_sec, ts.tv_nsec); + return qMakePair(ts.tv_sec, ts.tv_nsec); } # endif // use gettimeofday timeval tv; ::gettimeofday(&tv, 0); - return qMakePair(tv.tv_sec, tv.tv_usec); + return qMakePair(tv.tv_sec, tv.tv_usec); #endif } -- cgit v0.12 From 1a6d4970793f0696bf54a85346a12e83b6d03013 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Mar 2010 14:29:09 +0200 Subject: Fix compilation with Sun CC: "node.cpp", line 1337: Error: There is extra text on this line. Reviewed-by: Trust Me --- tools/qdoc3/node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index bd37443..ef75f6e 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1334,7 +1334,7 @@ QString QmlClassNode::fileBase() const void QmlClassNode::addInheritedBy(const QString& base, Node* sub) { inheritedBy.insert(base,sub); -#ifdef DEBUG_MULTIPLE-QDOCCONF_FILES +#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES qDebug() << "QmlClassNode::addInheritedBy(): insert" << base << sub->name() << inheritedBy.size(); #endif } -- cgit v0.12 From ec0fe5bb327f2533dcbb35855ca0d2a7f9a85581 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Mar 2010 15:10:14 +0200 Subject: Fix compilation on HP-UXi: _SC_MONOTONIC_CLOCK isn't defined Reviewed-by: Trust Me --- src/corelib/tools/qelapsedtimer_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qelapsedtimer_unix.cpp b/src/corelib/tools/qelapsedtimer_unix.cpp index 1a7bc71..2c4ea58 100644 --- a/src/corelib/tools/qelapsedtimer_unix.cpp +++ b/src/corelib/tools/qelapsedtimer_unix.cpp @@ -74,7 +74,7 @@ bool QElapsedTimer::isMonotonic() static int returnValue = 0; if (returnValue == 0) { -# if (_POSIX_MONOTONIC_CLOCK-0 < 0) +# if (_POSIX_MONOTONIC_CLOCK-0 < 0) || !defined(_SC_MONOTONIC_CLOCK) returnValue = -1; # elif (_POSIX_MONOTONIC_CLOCK == 0) // detect if the system support monotonic timers -- cgit v0.12 From b3eac3f43b087ee7939a607cd8a6e5ed398f6716 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 29 Mar 2010 16:22:52 +0200 Subject: Fix QComboBox ignoring foreground role in some styles Basically all styles using SH_Combobox_Popup would not previously respect the foreground role set. We need to set it for multiple color roles since styles sometimes interpret them differently. Reviewed-by: ogoffart Task-number: QTBUG-8796 --- src/gui/widgets/qcombobox.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index c16f18a..b1a27f2 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -108,7 +108,15 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt const QModelIndex &index) const { QStyleOptionMenuItem menuOption; - menuOption.palette = option.palette.resolve(QApplication::palette("QMenu")); + + QPalette resolvedpalette = option.palette.resolve(QApplication::palette("QMenu")); + QVariant value = index.data(Qt::ForegroundRole); + if (qVariantCanConvert(value)) { + resolvedpalette.setBrush(QPalette::WindowText, qvariant_cast(value)); + resolvedpalette.setBrush(QPalette::ButtonText, qvariant_cast(value)); + resolvedpalette.setBrush(QPalette::Text, qvariant_cast(value)); + } + menuOption.palette = resolvedpalette; menuOption.state = QStyle::State_None; if (mCombo->window()->isActiveWindow()) menuOption.state = QStyle::State_Active; -- cgit v0.12 From ffd4c014747f6842b9103d67204b5b54626bf876 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 29 Mar 2010 18:47:50 +0200 Subject: Do not override alternate background color in Plastique This palette tweak is no longer needed now that we set alternate row color on application startup. It also breaks on systems such as GNOME and KDE where you can configure this color. Reviewed-by: ogoffart Task-number: QTBUG-6516 --- src/gui/styles/qplastiquestyle.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 4ae9f79..fbb5e4d 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -5846,7 +5846,6 @@ void QPlastiqueStyle::polish(QApplication *app) void QPlastiqueStyle::polish(QPalette &pal) { QWindowsStyle::polish(pal); - pal.setBrush(QPalette::AlternateBase, pal.base().color().darker(110)); #ifdef Q_WS_MAC pal.setBrush(QPalette::Shadow, Qt::black); #endif -- cgit v0.12 From 30ada569454de1ec1d10bf7261d413ddd9b962a5 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 30 Mar 2010 01:58:07 +0200 Subject: Fix QFileSystemModel to not install useless watchers on the filesystem When someone call setRootPath we need to remove the previous watcher. This save memory and also it avoids Qt Creator to run out of filesystem watcher which then leads to a crash. If you call setRootPath on the previous path all changes that might happen in between will be propagated in the model. Task-number:QTBUG-8632 Reviewed-by:Friedemann Kleint --- src/gui/dialogs/qfilesystemmodel.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp index 6fd947c..3757ad7 100644 --- a/src/gui/dialogs/qfilesystemmodel.cpp +++ b/src/gui/dialogs/qfilesystemmodel.cpp @@ -1361,6 +1361,16 @@ QModelIndex QFileSystemModel::setRootPath(const QString &newPath) if (!showDrives && !newPathDir.exists()) return d->index(rootPath()); + //We remove the watcher on the previous path + if (!rootPath().isEmpty()) { + //This remove the watcher for the old rootPath + d->fileInfoGatherer.removePath(rootPath()); + //This line "marks" the node as dirty, so the next fetchMore + //call on the path will ask the gatherer to install a watcher again + //But it doesn't re-fetch everything + d->node(rootPath())->populatedChildren = false; + } + // We have a new valid root path d->rootDir = newPathDir; QModelIndex newRootIndex; -- cgit v0.12 From 87fae30fc63460e0ed2cc98f55a22e28d7520311 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 30 Mar 2010 03:01:27 +0200 Subject: Add a a layout property in QGraphicsWidget. Reviewed-by:michael brasser --- src/gui/graphicsview/qgraphicswidget.cpp | 1 + src/gui/graphicsview/qgraphicswidget.h | 2 ++ tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 131ee87..654a432 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -801,6 +801,7 @@ void QGraphicsWidget::setLayout(QGraphicsLayout *l) l->setParentLayoutItem(this); l->d_func()->reparentChildItems(this); l->invalidate(); + emit layoutChanged(); } /*! diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h index 468a134..730674c 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/gui/graphicsview/qgraphicswidget.h @@ -82,6 +82,7 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay Q_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags) Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry NOTIFY geometryChanged) + Q_PROPERTY(QGraphicsLayout* layout READ layout WRITE setLayout NOTIFY layoutChanged) public: QGraphicsWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); ~QGraphicsWidget(); @@ -176,6 +177,7 @@ public: Q_SIGNALS: void geometryChanged(); + void layoutChanged(); public Q_SLOTS: bool close(); diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 5a3a54c..b78ef26 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -942,6 +942,7 @@ void tst_QGraphicsWidget::layout() layout->addItem(item); children.append(item); } + QSignalSpy spy(&widget, SIGNAL(layoutChanged())); widget.setLayout(layout); QTRY_COMPARE(widget.layout(), static_cast(layout)); @@ -950,7 +951,7 @@ void tst_QGraphicsWidget::layout() QCOMPARE(item->parentWidget(), (QGraphicsWidget *)&widget); QVERIFY(item->geometry() != QRectF(0, 0, -1, -1)); } - + QCOMPARE(spy.count(), 1); // don't crash widget.setLayout(0); } -- cgit v0.12 From 1d094129c0c3994df4e59cd9eda6981a7b131903 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 30 Mar 2010 03:10:10 +0200 Subject: struct -> class, it's better. Reviewed-by:TrustMe --- src/gui/graphicsview/qgraphicsitem_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 669ae1b..eb5fac7 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -74,7 +74,8 @@ class QGraphicsItemPrivate; #ifndef QDECLARATIVELISTPROPERTY #define QDECLARATIVELISTPROPERTY template -struct QDeclarativeListProperty { +class QDeclarativeListProperty { +public: typedef void (*AppendFunction)(QDeclarativeListProperty *, T*); typedef int (*CountFunction)(QDeclarativeListProperty *); typedef T *(*AtFunction)(QDeclarativeListProperty *, int); -- cgit v0.12 From 0d7a0b1bf2ab50621ed662a3e178d2ad5add4114 Mon Sep 17 00:00:00 2001 From: Wolfgang Beck Date: Tue, 30 Mar 2010 11:53:42 +1000 Subject: MONILITY-645 Merging bearer header. --- src/network/bearer/qnetworkconfigmanager.h | 23 ++++++++++++++++----- src/network/bearer/qnetworkconfiguration.h | 30 ++++++++++++++++++++++------ src/network/bearer/qnetworksession.h | 28 +++++++++++++++++++------- src/plugins/bearer/nativewifi/platformdefs.h | 4 ++++ src/plugins/bearer/platformdefs_win.h | 4 ++++ 5 files changed, 71 insertions(+), 18 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h index bb4d8a0..19951f8 100644 --- a/src/network/bearer/qnetworkconfigmanager.h +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -42,17 +42,26 @@ #ifndef QNETWORKCONFIGURATIONMANAGER_H #define QNETWORKCONFIGURATIONMANAGER_H +#ifdef QT_MOBILITY_BEARER +# include "qmobilityglobal.h" +#endif + #include #include QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - -QT_MODULE(Network) +#ifndef QT_MOBILITY_BEARER + QT_BEGIN_NAMESPACE + #define QNetworkConfigurationManagerExport Q_NETWORK_EXPORT + QT_MODULE(Network) +#else + QTM_BEGIN_NAMESPACE + #define QNetworkConfigurationManagerExport Q_BEARER_EXPORT +#endif class QNetworkConfigurationManagerPrivate; -class Q_NETWORK_EXPORT QNetworkConfigurationManager : public QObject +class QNetworkConfigurationManagerExport QNetworkConfigurationManager : public QObject { Q_OBJECT @@ -94,7 +103,11 @@ Q_SIGNALS: Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkConfigurationManager::Capabilities) -QT_END_NAMESPACE +#ifndef QT_MOBILITY_BEARER + QT_END_NAMESPACE +#else + QTM_END_NAMESPACE +#endif QT_END_HEADER diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index dad6198..3b49d0a 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -42,19 +42,33 @@ #ifndef QNETWORKCONFIGURATION_H #define QNETWORKCONFIGURATION_H -#include +#ifndef QT_MOBILITY_BEARER +# include +#else +# include "qmobilityglobal.h" +#endif + #include #include #include -QT_BEGIN_HEADER +#if defined(Q_OS_WIN) && defined(interface) +#undef interface +#endif -QT_BEGIN_NAMESPACE +QT_BEGIN_HEADER -QT_MODULE(Network) +#ifndef QT_MOBILITY_BEARER + QT_BEGIN_NAMESPACE + QT_MODULE(Network) + #define QNetworkConfigurationExport Q_NETWORK_EXPORT +#else + QTM_BEGIN_NAMESPACE + #define QNetworkConfigurationExport Q_BEARER_EXPORT +#endif class QNetworkConfigurationPrivate; -class Q_NETWORK_EXPORT QNetworkConfiguration +class QNetworkConfigurationExport QNetworkConfiguration { public: QNetworkConfiguration(); @@ -108,7 +122,11 @@ private: QExplicitlySharedDataPointer d; }; -QT_END_NAMESPACE +#ifndef QT_MOBILITY_BEARER + QT_END_NAMESPACE +#else + QTM_END_NAMESPACE +#endif QT_END_HEADER diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 596f527..2681d1f 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -54,12 +54,19 @@ QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - -QT_MODULE(Network) +#ifndef QT_MOBILITY_BEARER + #include + QT_BEGIN_NAMESPACE + QT_MODULE(Network) + #define QNetworkSessionExport Q_NETWORK_EXPORT +#else + #include "qmobilityglobal.h" + QTM_BEGIN_NAMESPACE + #define QNetworkSessionExport Q_BEARER_EXPORT +#endif class QNetworkSessionPrivate; -class Q_NETWORK_EXPORT QNetworkSession : public QObject +class QNetworkSessionExport QNetworkSession : public QObject { Q_OBJECT public: @@ -80,8 +87,11 @@ public: OperationNotSupportedError, InvalidConfigurationError }; - - explicit QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0); +#ifndef QT_MOBILITY_BEARER + QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0); +#else + explicit QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0); +#endif virtual ~QNetworkSession(); bool isOpen() const; @@ -131,7 +141,11 @@ private: friend class QNetworkSessionPrivate; }; -QT_END_NAMESPACE +#ifndef QT_MOBILITY_BEARER + QT_END_NAMESPACE +#else + QTM_END_NAMESPACE +#endif QT_END_HEADER diff --git a/src/plugins/bearer/nativewifi/platformdefs.h b/src/plugins/bearer/nativewifi/platformdefs.h index 57ae852..d67525a 100644 --- a/src/plugins/bearer/nativewifi/platformdefs.h +++ b/src/plugins/bearer/nativewifi/platformdefs.h @@ -52,6 +52,8 @@ #define WLAN_AVAILABLE_NETWORK_HAS_PROFILE 2 #define DOT11_SSID_MAX_LENGTH 32 +QT_BEGIN_NAMESPACE + struct WLAN_NOTIFICATION_DATA { DWORD NotificationSource; DWORD NotificationCode; @@ -319,4 +321,6 @@ extern WlanScanProto local_WlanScan; extern WlanFreeMemoryProto local_WlanFreeMemory; extern WlanCloseHandleProto local_WlanCloseHandle; +QT_END_NAMESPACE + #endif // PLATFORMDEFS_H diff --git a/src/plugins/bearer/platformdefs_win.h b/src/plugins/bearer/platformdefs_win.h index 37d099c..1a10ba7 100644 --- a/src/plugins/bearer/platformdefs_win.h +++ b/src/plugins/bearer/platformdefs_win.h @@ -47,6 +47,8 @@ #undef interface #include +QT_BEGIN_NAMESPACE + #ifndef NS_NLA #define NS_NLA 15 @@ -131,4 +133,6 @@ enum NDIS_PHYSICAL_MEDIUM { #define IOCTL_NDIS_QUERY_GLOBAL_STATS \ CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, 0, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) +QT_END_NAMESPACE + #endif -- cgit v0.12 From b353f98da10f4b8b80f6be70951f147d580999e8 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 30 Mar 2010 14:33:12 +1000 Subject: Fix compile error on mingw. Compile error seems to be going back and forth between mingw and wince compilers. Prefer correctness and portability over brevity by initializing each field of the struct one-by-one to guarantee portability between compilers. Reviewed-by: Lincoln Ramsay --- src/corelib/io/qwindowspipewriter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp index eb42c20..3eb2411 100644 --- a/src/corelib/io/qwindowspipewriter.cpp +++ b/src/corelib/io/qwindowspipewriter.cpp @@ -100,7 +100,10 @@ qint64 QWindowsPipeWriter::write(const char *ptr, qint64 maxlen) void QWindowsPipeWriter::run() { - OVERLAPPED overl = {0, 0, {{ 0 }}, 0}; + OVERLAPPED overl; + overl.Internal = 0; + overl.InternalHigh = 0; + overl.Pointer = 0; overl.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); forever { lock.lock(); -- cgit v0.12 From 84c7f73e8405b7e89202a2d3dcab140a656d618a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 30 Mar 2010 12:06:10 +0200 Subject: Compile on MingW MingW apparently doesn't support the GDI function GetCharABCWidthsI(), so the getGlyphBearings()-optimization is disabled for that compiler. Reviewed-by: Friedemann Kleint --- src/gui/text/qfontengine_win.cpp | 2 ++ src/gui/text/qfontengine_win_p.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index a133b48..92fb7de 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -649,6 +649,7 @@ static const ushort char_table[] = { static const int char_table_entries = sizeof(char_table)/sizeof(ushort); +#ifndef Q_CC_MINGW void QFontEngineWin::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing) { HDC hdc = shared_dc(); @@ -673,6 +674,7 @@ void QFontEngineWin::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal * } #endif } +#endif // Q_CC_MINGW qreal QFontEngineWin::minLeftBearing() const { diff --git a/src/gui/text/qfontengine_win_p.h b/src/gui/text/qfontengine_win_p.h index f19e48e..68b53b5 100644 --- a/src/gui/text/qfontengine_win_p.h +++ b/src/gui/text/qfontengine_win_p.h @@ -106,7 +106,9 @@ public: virtual QImage alphaMapForGlyph(glyph_t, const QTransform &xform); virtual QImage alphaRGBMapForGlyph(glyph_t t, int margin, const QTransform &xform); +#ifndef Q_CC_MINGW virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0); +#endif int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs, bool mirrored) const; void getCMap(); -- cgit v0.12 From 12f0835ca0a8c6b4cb2a516616882fa03ccfd05b Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 30 Mar 2010 09:42:05 +0100 Subject: Added additional logging to Phonon MMF backend In addition to dumping the widget tree which contains the VideoOutput widget, the backend now also dumps the widget tree from the application's active window. This is to allow debugging of problems which stem from the fact that the VideoOutput widget subtree root is not the application's main window. In addition to dumping the Qt widget tree, the backend now also requests the window server to dump the entire window tree. Together, these changes allow easier debugging of video visibility- related problems. Reviewed-by: trustme --- src/3rdparty/phonon/mmf/abstractvideooutput.cpp | 8 ++++++++ src/3rdparty/phonon/mmf/abstractvideoplayer.cpp | 8 +++++++- src/3rdparty/phonon/mmf/videooutput_dsa.cpp | 6 ++++++ src/3rdparty/phonon/mmf/videoplayer_dsa.cpp | 25 +++++++++++++++++++++++-- 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractvideooutput.cpp b/src/3rdparty/phonon/mmf/abstractvideooutput.cpp index 3fe66fc..a8aabfd 100644 --- a/src/3rdparty/phonon/mmf/abstractvideooutput.cpp +++ b/src/3rdparty/phonon/mmf/abstractvideooutput.cpp @@ -28,6 +28,8 @@ along with this library. If not, see . #include #include +#include // for QApplication::activeWindow + #include QT_BEGIN_NAMESPACE @@ -162,6 +164,12 @@ void MMF::AbstractVideoOutput::dump() const QScopedPointer visitor(new ObjectDump::QVisitor); visitor->setPrefix("Phonon::MMF"); // to aid searchability of logs ObjectDump::addDefaultAnnotators(*visitor); + + if (QWidget *window = QApplication::activeWindow()) { + TRACE("Dumping from root window 0x%08x:", window); + ObjectDump::dumpTreeFromLeaf(*window, *visitor); + } + TRACE("Dumping tree from leaf 0x%08x:", this); ObjectDump::dumpTreeFromLeaf(*this, *visitor); diff --git a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp index 8cb9db5..c2bcce0 100644 --- a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp @@ -193,11 +193,14 @@ qint64 MMF::AbstractVideoPlayer::totalTime() const void MMF::AbstractVideoPlayer::videoWindowChanged() { - TRACE_CONTEXT(AbstractVideoPlayer::videoOutputRegionChanged, EVideoInternal); + TRACE_CONTEXT(AbstractVideoPlayer::videoWindowChanged, EVideoInternal); TRACE_ENTRY("state %d", state()); m_window = m_videoOutput ? m_videoOutput->videoWindow() : 0; + if (m_videoOutput) + m_videoOutput->dump(); + handleVideoWindowChanged(); TRACE_EXIT_0(); @@ -253,6 +256,9 @@ void MMF::AbstractVideoPlayer::MvpuoPrepareComplete(TInt aError) TRAPD(err, getVideoClipParametersL(aError)); if (KErrNone == err) { + if (m_videoOutput) + m_videoOutput->dump(); + maxVolumeChanged(m_player->MaxVolume()); if (m_videoOutput) diff --git a/src/3rdparty/phonon/mmf/videooutput_dsa.cpp b/src/3rdparty/phonon/mmf/videooutput_dsa.cpp index a5e2ac8..4f9ad7f 100644 --- a/src/3rdparty/phonon/mmf/videooutput_dsa.cpp +++ b/src/3rdparty/phonon/mmf/videooutput_dsa.cpp @@ -101,11 +101,17 @@ void MMF::DsaVideoOutput::ancestorMoved() void MMF::DsaVideoOutput::beginNativePaintEvent(const QRect & /*controlRect*/) { + TRACE_CONTEXT(DsaVideoOutput::beginNativePaintEvent, EVideoInternal); + TRACE_ENTRY_0(); + emit beginVideoWindowNativePaint(); } void MMF::DsaVideoOutput::endNativePaintEvent(const QRect & /*controlRect*/) { + TRACE_CONTEXT(DsaVideoOutput::endNativePaintEvent, EVideoInternal); + TRACE_ENTRY_0(); + // Ensure that draw ops are executed into the WSERV output framebuffer CCoeEnv::Static()->WsSession().Flush(); diff --git a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp index 732d2d9..226d079 100644 --- a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp +++ b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp @@ -190,6 +190,9 @@ public: void getDsaRegion(RWsSession &session, const RWindowBase &window) { + // Dump complete window tree + session.LogCommand(RWsSession::ELoggingStatusDump); + RDirectScreenAccess dsa(session); TInt err = dsa.Construct(); CDummyAO ao; @@ -214,7 +217,7 @@ void getDsaRegion(RWsSession &session, const RWindowBase &window) void MMF::DsaVideoPlayer::handleParametersChanged(VideoParameters parameters) { TRACE_CONTEXT(DsaVideoPlayer::handleParametersChanged, EVideoInternal); - TRACE_ENTRY_0(); + TRACE_ENTRY("parameters 0x%x", parameters); if (!m_window) return; @@ -265,17 +268,32 @@ void MMF::DsaVideoPlayer::handleParametersChanged(VideoParameters parameters) void MMF::DsaVideoPlayer::startDirectScreenAccess() { + TRACE_CONTEXT(DsaVideoPlayer::startDirectScreenAccess, EVideoInternal); + TRACE_ENTRY("dsaActive %d", m_dsaActive); + + int err = KErrNone; + if (!m_dsaActive) { - TRAPD(err, m_player->StartDirectScreenAccessL()); + TRAP(err, m_player->StartDirectScreenAccessL()); if (KErrNone == err) m_dsaActive = true; else setError(tr("Video display error"), err); } + + if (m_videoOutput) + m_videoOutput->dump(); + + TRACE_EXIT("error %d", err); } bool MMF::DsaVideoPlayer::stopDirectScreenAccess() { + TRACE_CONTEXT(DsaVideoPlayer::stopDirectScreenAccess, EVideoInternal); + TRACE_ENTRY("dsaActive %d", m_dsaActive); + + int err = KErrNone; + const bool dsaWasActive = m_dsaActive; if (m_dsaActive) { TRAPD(err, m_player->StopDirectScreenAccessL()); @@ -284,6 +302,9 @@ bool MMF::DsaVideoPlayer::stopDirectScreenAccess() else setError(tr("Video display error"), err); } + + TRACE_EXIT("error %d", err); + return dsaWasActive; } -- cgit v0.12 From 2d9260e863ff2e3a5bb77d37b2b9b90072bce825 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 30 Mar 2010 13:03:10 +0200 Subject: qdoc: Added
elements to some html output for class references. Task: QTBUG-9504 --- tools/qdoc3/codemarker.cpp | 2 +- tools/qdoc3/codemarker.h | 24 +++++++++++--- tools/qdoc3/cppcodemarker.cpp | 76 ++++++++++++++++++++++++++++--------------- tools/qdoc3/htmlgenerator.cpp | 8 ++++- tools/qdoc3/qscodemarker.cpp | 18 +++++----- 5 files changed, 86 insertions(+), 42 deletions(-) diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp index 15f2c2d..818a91f 100644 --- a/tools/qdoc3/codemarker.cpp +++ b/tools/qdoc3/codemarker.cpp @@ -457,7 +457,7 @@ bool CodeMarker::insertReimpFunc(FastSection& fs, Node* node, Status status) void CodeMarker::append(QList
& sectionList, const FastSection& fs) { if (!fs.isEmpty()) { - Section section(fs.name,fs.singularMember,fs.pluralMember); + Section section(fs.name,fs.divClass,fs.singularMember,fs.pluralMember); section.members = fs.memberMap.values(); section.reimpMembers = fs.reimpMemberMap.values(); section.inherited = fs.inherited; diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h index 1b21753..aab8a9c 100644 --- a/tools/qdoc3/codemarker.h +++ b/tools/qdoc3/codemarker.h @@ -58,6 +58,7 @@ class Tree; struct Section { QString name; + QString divClass; QString singularMember; QString pluralMember; NodeList members; @@ -66,9 +67,11 @@ struct Section Section() { } Section(const QString& name0, + const QString& divClass0, const QString& singularMember0, const QString& pluralMember0) - : name(name0), + : name(name0), + divClass(divClass0), singularMember(singularMember0), pluralMember(pluralMember0) { } void appendMember(Node* node) { members.append(node); } @@ -79,6 +82,7 @@ struct FastSection { const InnerNode *innerNode; QString name; + QString divClass; QString singularMember; QString pluralMember; QMap memberMap; @@ -86,20 +90,30 @@ struct FastSection QList > inherited; FastSection(const InnerNode *innerNode0, - const QString& name0 = "", - const QString& singularMember0 = "member", - const QString& pluralMember0 = "members") + const QString& name0, + const QString& divClass0, + const QString& singularMember0, + const QString& pluralMember0) : innerNode(innerNode0), name(name0), + divClass(divClass0), singularMember(singularMember0), pluralMember(pluralMember0) { } bool isEmpty() const { - return (memberMap.isEmpty() && inherited.isEmpty() && + return (memberMap.isEmpty() && + inherited.isEmpty() && reimpMemberMap.isEmpty()); } }; +#if 0 + const QString& name0 = "", + const QString& divClass0 = "", + const QString& singularMember0 = "member", + const QString& pluralMember0 = "members") +#endif + class CodeMarker { public: diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 3ff6ebe..c4ee054 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -482,55 +482,66 @@ QList
CppCodeMarker::sections(const InnerNode *inner, if (style == Summary) { FastSection privateFunctions(classe, "Private Functions", + "", "private function", "private functions"); - FastSection privateSlots(classe, "Private Slots", "private slot", "private slots"); - FastSection privateTypes(classe, "Private Types", "private type", "private types"); + FastSection privateSlots(classe, "Private Slots", "", "private slot", "private slots"); + FastSection privateTypes(classe, "Private Types", "", "private type", "private types"); FastSection protectedFunctions(classe, "Protected Functions", + "", "protected function", "protected functions"); FastSection protectedSlots(classe, "Protected Slots", + "", "protected slot", "protected slots"); FastSection protectedTypes(classe, "Protected Types", + "", "protected type", "protected types"); FastSection protectedVariables(classe, "Protected Variables", + "", "protected type", "protected variables"); FastSection publicFunctions(classe, "Public Functions", + "", "public function", "public functions"); - FastSection publicSignals(classe, "Signals", "signal", "signals"); - FastSection publicSlots(classe, "Public Slots", "public slot", "public slots"); - FastSection publicTypes(classe, "Public Types", "public type", "public types"); + FastSection publicSignals(classe, "Signals", "", "signal", "signals"); + FastSection publicSlots(classe, "Public Slots", "", "public slot", "public slots"); + FastSection publicTypes(classe, "Public Types", "", "public type", "public types"); FastSection publicVariables(classe, "Public Variables", - "public type", + "", + "public variable", "public variables"); - FastSection properties(classe, "Properties", "property", "properties"); + FastSection properties(classe, "Properties", "", "property", "properties"); FastSection relatedNonMembers(classe, "Related Non-Members", + "", "related non-member", "related non-members"); FastSection staticPrivateMembers(classe, "Static Private Members", + "", "static private member", "static private members"); FastSection staticProtectedMembers(classe, "Static Protected Members", + "", "static protected member", "static protected members"); FastSection staticPublicMembers(classe, "Static Public Members", + "", "static public member", "static public members"); - FastSection macros(inner, "Macros", "macro", "macros"); + FastSection macros(inner, "Macros", "", "macro", "macros"); NodeList::ConstIterator r = classe->relatedNodes().begin(); while (r != classe->relatedNodes().end()) { @@ -666,12 +677,12 @@ QList
CppCodeMarker::sections(const InnerNode *inner, append(sections, macros); } else if (style == Detailed) { - FastSection memberFunctions(classe,"Member Function Documentation"); - FastSection memberTypes(classe,"Member Type Documentation"); - FastSection memberVariables(classe,"Member Variable Documentation"); - FastSection properties(classe,"Property Documentation"); - FastSection relatedNonMembers(classe,"Related Non-Members"); - FastSection macros(classe,"Macro Documentation"); + FastSection memberFunctions(classe,"Member Function Documentation","func","member","members"); + FastSection memberTypes(classe,"Member Type Documentation","types","member","members"); + FastSection memberVariables(classe,"Member Variable Documentation","vars","member","members"); + FastSection properties(classe,"Property Documentation","prop","member","members"); + FastSection relatedNonMembers(classe,"Related Non-Members","relnonmem","member","members"); + FastSection macros(classe,"Macro Documentation","macros","member","members"); NodeList::ConstIterator r = classe->relatedNodes().begin(); while (r != classe->relatedNodes().end()) { @@ -717,7 +728,7 @@ QList
CppCodeMarker::sections(const InnerNode *inner, append(sections, macros); } else { - FastSection all(classe); + FastSection all(classe,"","","member","members"); QStack stack; stack.push(classe); @@ -747,25 +758,29 @@ QList
CppCodeMarker::sections(const InnerNode *inner, if (style == Summary || style == Detailed) { FastSection namespaces(inner, "Namespaces", + style == Detailed ? "nmspace" : "", "namespace", "namespaces"); FastSection classes(inner, "Classes", + style == Detailed ? "classes" : "", "class", "classes"); FastSection types(inner, - style == Summary ? - "Types" : "Type Documentation", + style == Summary ? "Types" : "Type Documentation", + style == Detailed ? "types" : "", "type", "types"); FastSection functions(inner, style == Summary ? "Functions" : "Function Documentation", + style == Detailed ? "func" : "", "function", "functions"); FastSection macros(inner, style == Summary ? "Macros" : "Macro Documentation", + style == Detailed ? "macros" : "", "macro", "macros"); @@ -1116,26 +1131,32 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, if (style == Summary) { FastSection qmlproperties(qmlClassNode, "Properties", + "", "property", "properties"); FastSection qmlattachedproperties(qmlClassNode, "Attached Properties", + "", "property", "properties"); FastSection qmlsignals(qmlClassNode, - "Signals", - "signal", - "signals"); + "Signals", + "", + "signal", + "signals"); FastSection qmlattachedsignals(qmlClassNode, "Attached Signals", + "", "signal", "signals"); FastSection qmlmethods(qmlClassNode, "Methods", + "", "method", "methods"); FastSection qmlattachedmethods(qmlClassNode, "Attached Methods", + "", "method", "methods"); @@ -1179,12 +1200,15 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, append(sections,qmlattachedmethods); } else if (style == Detailed) { - FastSection qmlproperties(qmlClassNode, "Property Documentation"); - FastSection qmlattachedproperties(qmlClassNode,"Attached Property Documentation"); - FastSection qmlsignals(qmlClassNode,"Signal Documentation"); - FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Documentation"); - FastSection qmlmethods(qmlClassNode,"Method Documentation"); - FastSection qmlattachedmethods(qmlClassNode,"Attached Method Documentation"); + FastSection qmlproperties(qmlClassNode, "Property Documentation","qmlprop","member","members"); + FastSection qmlattachedproperties(qmlClassNode,"Attached Property Documentation","qmlattprop", + "member","members"); + FastSection qmlsignals(qmlClassNode,"Signal Documentation","qmlsig","member","members"); + FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Documentation","qmlattsig", + "member","members"); + FastSection qmlmethods(qmlClassNode,"Method Documentation","qmlmeth","member","members"); + FastSection qmlattachedmethods(qmlClassNode,"Attached Method Documentation","qmlattmeth", + "member","members"); NodeList::ConstIterator c = qmlClassNode->childNodes().begin(); while (c != qmlClassNode->childNodes().end()) { if ((*c)->subType() == Node::QmlPropertyGroup) { diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index cd3da3e..fb9fa95 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -696,7 +696,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, QList
sections; QList
::ConstIterator s; for (int i=0; idoc().isEmpty()) { out() << "
\n" + << "
\n" << "

" << "Detailed Description" << "

\n"; generateBody(inner, marker); + out() << "
\n"; generateAlsoList(inner, marker); } @@ -1365,6 +1367,8 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, s = sections.begin(); while (s != sections.end()) { out() << "
\n"; + if (!(*s).divClass.isEmpty()) + out() << "
\n"; out() << "

" << protectEnc((*s).name) << "

\n"; NodeList::ConstIterator m = (*s).members.begin(); @@ -1414,6 +1418,8 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, } ++m; } + if (!(*s).divClass.isEmpty()) + out() << "
\n"; ++s; } generateFooter(inner); diff --git a/tools/qdoc3/qscodemarker.cpp b/tools/qdoc3/qscodemarker.cpp index 89c9c5c..d4b8e80 100644 --- a/tools/qdoc3/qscodemarker.cpp +++ b/tools/qdoc3/qscodemarker.cpp @@ -279,11 +279,11 @@ QList
QsCodeMarker::sections( const InnerNode *inner, SynopsisStyle sty const ClassNode *classe = static_cast(inner); if ( style == Summary ) { - FastSection enums(classe, "Enums", "enum", "enums"); - FastSection functions(classe, "Functions", "function", "functions"); - FastSection readOnlyProperties(classe, "Read-Only Properties", "property", "properties"); - FastSection signalz(classe, "Signals", "signal", "signals"); - FastSection writableProperties(classe, "Writable Properties", "property", "properties"); + FastSection enums(classe, "Enums", "", "enum", "enums"); + FastSection functions(classe, "Functions", "", "function", "functions"); + FastSection readOnlyProperties(classe, "", "Read-Only Properties", "property", "properties"); + FastSection signalz(classe, "Signals", "", "signal", "signals"); + FastSection writableProperties(classe, "", "Writable Properties", "property", "properties"); QStack stack; stack.push( classe ); @@ -328,9 +328,9 @@ QList
QsCodeMarker::sections( const InnerNode *inner, SynopsisStyle sty append( sections, functions ); append( sections, signalz ); } else if ( style == Detailed ) { - FastSection enums( classe, "Enum Documentation" ); - FastSection functionsAndSignals( classe, "Function and Signal Documentation" ); - FastSection properties( classe, "Property Documentation" ); + FastSection enums( classe, "Enum Documentation", "", "member", "members"); + FastSection functionsAndSignals( classe, "Function and Signal Documentation", "", "member", "members"); + FastSection properties( classe, "Property Documentation", "", "member", "members"); NodeList::ConstIterator c = classe->childNodes().begin(); while ( c != classe->childNodes().end() ) { @@ -349,7 +349,7 @@ QList
QsCodeMarker::sections( const InnerNode *inner, SynopsisStyle sty append( sections, properties ); append( sections, functionsAndSignals ); } else { // ( style == SeparateList ) - FastSection all( classe ); + FastSection all(classe, "", "", "member", "members"); QStack stack; stack.push( classe ); -- cgit v0.12 From 601b68cbff1d0fc3f718d658384e75fce189381a Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Tue, 30 Mar 2010 15:40:36 +0300 Subject: QS60Style: Custom QPushButton: Heigth is calculated wrongly If button contains a layout with widgets instead of having direct label and icon, QS60Style calculates the size of the content incorrectly. This is regression for a fix to QTBUG-7586. Now style ignores orginal size of pushbutton and tries to calculate correct height by itself. Issue is fixed by selecting teh bigger of orginal height and calculated height. Task-number: QT-3197 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 000696c..f49acc4 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2433,7 +2433,7 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, const int contentHeight = qMax(qMax(iconHeight, decoratorHeight) + pixelMetric(PM_ButtonMargin), textHeight + 2*pixelMetric(PM_ButtonMargin)); - sz.setHeight(contentHeight); + sz.setHeight(qMax(sz.height(), contentHeight)); sz += QSize(2 * pixelMetric(PM_ButtonMargin), 0); } break; -- cgit v0.12 From f39a71a6c44e5011a169dfa6840a33a9b5075c77 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Mar 2010 15:33:13 +0200 Subject: Autotest: don't allow choosing between debug/release mode. You can't build for debug mode on Windows if Qt wasn't built in debug mode. So force the selection to be exactly what Qt was built. Reviewed-by: Trust Me --- tests/auto/qsharedpointer/externaltests.cpp | 17 +++-------------- tests/auto/qsharedpointer/externaltests.h | 3 --- tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 2 +- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/tests/auto/qsharedpointer/externaltests.cpp b/tests/auto/qsharedpointer/externaltests.cpp index eb2f27d..0b1ef19 100644 --- a/tests/auto/qsharedpointer/externaltests.cpp +++ b/tests/auto/qsharedpointer/externaltests.cpp @@ -140,7 +140,6 @@ namespace QTest { QExternalTestPrivate() : qtModules(QExternalTest::QtCore | QExternalTest::QtGui | QExternalTest::QtTest), appType(QExternalTest::AutoApplication), - debugMode(true), exitCode(-1) { } @@ -156,7 +155,6 @@ namespace QTest { QByteArray programHeader; QExternalTest::QtModules qtModules; QExternalTest::ApplicationType appType; - bool debugMode; QString temporaryDir; QByteArray sourceCode; @@ -190,16 +188,6 @@ namespace QTest { delete d; } - bool QExternalTest::isDebugMode() const - { - return d->debugMode; - } - - void QExternalTest::setDebugMode(bool enable) - { - d->debugMode = enable; - } - QList QExternalTest::qmakeSettings() const { return d->qmakeLines; @@ -524,10 +512,11 @@ namespace QTest { "INCLUDEPATH += . "); projectFile.write(QFile::encodeName(QDir::currentPath())); - if (debugMode) +#ifndef QT_NO_DEBUG projectFile.write("\nCONFIG += debug\n"); - else +#else projectFile.write("\nCONFIG += release\n"); +#endif QByteArray extraSources = QFile::encodeName(extraProgramSources.join(" ")); if (!extraSources.isEmpty()) { diff --git a/tests/auto/qsharedpointer/externaltests.h b/tests/auto/qsharedpointer/externaltests.h index 5e79a7d..1170cd5 100644 --- a/tests/auto/qsharedpointer/externaltests.h +++ b/tests/auto/qsharedpointer/externaltests.h @@ -91,9 +91,6 @@ namespace QTest { QApplicationGuiServer }; - bool isDebugMode() const; - void setDebugMode(bool enable); - QList qmakeSettings() const; void setQmakeSettings(const QList &settings); diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index 7cfa868..cb32c9a 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -1717,11 +1717,11 @@ void tst_QSharedPointer::invalidConstructs() #endif QTest::QExternalTest test; - test.setDebugMode(true); test.setQtModules(QTest::QExternalTest::QtCore); test.setExtraProgramSources(QStringList() << SRCDIR "forwarddeclared.cpp"); test.setProgramHeader( "#define QT_SHAREDPOINTER_TRACK_POINTERS\n" + "#define QT_DEBUG\n" "#include \n" "#include \n" "\n" -- cgit v0.12 From c626bf34e14ea05c986053c0f87e02f4b0bd8cdd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 29 Mar 2010 20:37:20 +0200 Subject: no need for CONFIG += ordered here --- tools/linguist/linguist.pro | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/linguist/linguist.pro b/tools/linguist/linguist.pro index e1c8a63..85ecd5a 100644 --- a/tools/linguist/linguist.pro +++ b/tools/linguist/linguist.pro @@ -4,5 +4,3 @@ SUBDIRS = \ lrelease \ lupdate \ lconvert -CONFIG += ordered - -- cgit v0.12 From 5f8bf77862a425c39a683358aafa4d52db1b8ac3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 29 Mar 2010 21:04:51 +0200 Subject: speed up by removing nonsense why first determine how to make no newline just to make a newline right afterwards? --- configure | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/configure b/configure index 9a3ee32..de72c46 100755 --- a/configure +++ b/configure @@ -7780,12 +7780,7 @@ for file in .projects .projects.3; do QMAKE="$outpath/bin/qmake" QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS" if [ "$file" = ".projects.3" ]; then - if echo '\c' | grep '\c' >/dev/null; then - echo -n " (fast)" - else - echo " (fast)\c" - fi - echo + echo " (fast)" cat >"${OUTDIR}/Makefile" < Date: Mon, 29 Mar 2010 21:08:58 +0200 Subject: do not detect the echo-without-newline syntax over and over this is a) more maintainable and b) faster, as it was done in the makefile generation loop as well. --- configure | 42 ++++++++++++------------------------------ 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/configure b/configure index de72c46..0cf7542 100755 --- a/configure +++ b/configure @@ -173,6 +173,12 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +# detect the "echo without newline" style. usage: echo $ECHO_N "$ECHO_C" +if echo '\c' | grep '\c' >/dev/null; then + ECHO_N=-n +else + ECHO_C='\c' +fi #------------------------------------------------------------------------------- # window system detection @@ -399,11 +405,7 @@ elif [ $COMMERCIAL_USER = "yes" ]; then else if [ -z "$LicenseKeyExt" ]; then echo - if echo '\c' | grep '\c' >/dev/null; then - echo -n "Please enter your license key: " - else - echo "Please enter your license key: \c" - fi + echo $ECHO_N "Please enter your license key: $ECHO_C" read LicenseKeyExt Licensee="Unknown user" fi @@ -3966,11 +3968,7 @@ elif [ "$Edition" = "OpenSource" ]; then echo "Type 'yes' to accept this license offer." echo "Type 'no' to decline this license offer." echo - if echo '\c' | grep '\c' >/dev/null; then - echo -n "Do you accept the terms of $affix license? " - else - echo "Do you accept the terms of $affix license? \c" - fi + echo $ECHO_N "Do you accept the terms of $affix license? $ECHO_C" read acceptance fi echo @@ -4001,11 +3999,7 @@ elif [ "$Edition" = "Preview" ]; then echo "Type 'yes' to accept this license offer." echo "Type 'no' to decline this license offer." echo - if echo '\c' | grep '\c' >/dev/null; then - echo -n "Do you accept the terms of the license? " - else - echo "Do you accept the terms of the license? \c" - fi + echo $ECHO_N "Do you accept the terms of the license? $ECHO_C" read acceptance fi echo @@ -4091,11 +4085,7 @@ elif [ "$Edition" != "OpenSource" ]; then echo "Type 'yes' to accept this license offer." echo "Type 'no' to decline this license offer." echo - if echo '\c' | grep '\c' >/dev/null; then - echo -n "Do you accept the terms of the $TheLicense? " - else - echo "Do you accept the terms of the $TheLicense? \c" - fi + echo $ECHO_N "Do you accept the terms of the $TheLicense? $ECHO_C" read acceptance fi echo @@ -7390,11 +7380,7 @@ else fi if [ "$OPT_VERBOSE" = "yes" ]; then - if echo '\c' | grep '\c' >/dev/null; then - echo -n "qmake vars .......... " - else - echo "qmake vars .......... \c" - fi + echo $ECHO_N "qmake vars .......... $ECHO_C" cat "$QMAKE_VARS_FILE" | tr '\n' ' ' echo "qmake switches ...... $QMAKE_SWITCHES" fi @@ -7771,11 +7757,7 @@ for file in .projects .projects.3; do continue; fi QMAKE_SPEC_ARGS="-spec $SPEC" - if echo '\c' | grep '\c' >/dev/null; then - echo -n " for $a" - else - echo " for $a\c" - fi + echo $ECHO_N " for $a$ECHO_C" QMAKE="$outpath/bin/qmake" QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS" -- cgit v0.12 From 09ce407aaa4a00013a606bf0011faf6cbc654c72 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 30 Mar 2010 15:56:26 +0200 Subject: Doc: Added links and notes to modules, ActiveQt and XMLPatterns docs. Reviewed-by: Trust Me --- doc/src/frameworks-technologies/activeqt.qdoc | 5 ++++- doc/src/modules.qdoc | 11 +++++++++++ src/xmlpatterns/api/qxmlresultitems.cpp | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/src/frameworks-technologies/activeqt.qdoc b/doc/src/frameworks-technologies/activeqt.qdoc index 5e8473f..6273337 100644 --- a/doc/src/frameworks-technologies/activeqt.qdoc +++ b/doc/src/frameworks-technologies/activeqt.qdoc @@ -70,7 +70,10 @@ controls. \endlist - The ActiveQt framework consists of two frameworks: + For more information about using ActiveX with Qt, see + \l{Building ActiveX servers and controls with Qt}. + + The ActiveQt framework consists of two modules: \list \o The \l{Using ActiveX controls and COM objects in Qt}{QAxContainer} diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index 44d6ed6..2b749de 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -517,6 +517,13 @@ This module is part of the \l{Qt Full Framework Edition} and the \l{Open Source Versions of Qt}. + \section1 Further Links + + General overviews of XQuery and XSchema can be found in the + \l{Using XML Technologies} document. + + An introduction to the XQuery language can be found in \l{A Short Path to XQuery}. + \section1 License Information The XML Schema implementation provided by this module contains the \c xml.xsd file @@ -855,6 +862,8 @@ \brief The QAxContainer module is a Windows-only extension for accessing ActiveX controls and COM objects. + QAxServer is part of the \l{ActiveQt Framework}. + \section1 License Information The QAxContainer module is not covered by the \l{GNU General Public License (GPL)}, @@ -905,6 +914,8 @@ \brief The QAxServer module is a Windows-only static library that you can use to turn a standard Qt binary into a COM server. + QAxServer is part of the \l{ActiveQt Framework}. + \section1 License Information The QAxContainer module is not covered by the \l{GNU General Public License (GPL)}, diff --git a/src/xmlpatterns/api/qxmlresultitems.cpp b/src/xmlpatterns/api/qxmlresultitems.cpp index c474082..98c5bdc 100644 --- a/src/xmlpatterns/api/qxmlresultitems.cpp +++ b/src/xmlpatterns/api/qxmlresultitems.cpp @@ -70,6 +70,10 @@ QT_BEGIN_NAMESPACE sequence and returns it, and current() always returns the QXmlItem that next() returned the last time it was called. + \note When using the QXmlResultItems overload of QXmlQuery::evaluateTo() + to execute a query, it is advisable to create a new instance of this + class for each new set of results rather than reusing an old instance. + \sa QXmlItem::isNode(), QXmlItem::isAtomicValue(), QXmlNodeModelIndex */ -- cgit v0.12 From dbbd84e61bf433495268c639670f9b9f82eb56f4 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 30 Mar 2010 16:15:21 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( ecfa4583e573ce4dff1f0df12f6bdba3022376e5 ) Changes in WebKit/qt since the last update: * r56370 - https://bugs.webkit.org/show_bug.cgi?id=34350 -- [Symbian] More efficient aligned memory allocation for JSC Collector --- src/3rdparty/webkit/JavaScriptCore/ChangeLog | 28 +++++ .../webkit/JavaScriptCore/JavaScriptCore.pri | 6 + .../webkit/JavaScriptCore/runtime/Collector.cpp | 47 ++------ .../webkit/JavaScriptCore/runtime/Collector.h | 9 ++ .../wtf/symbian/BlockAllocatorSymbian.cpp | 132 +++++++++++++++++++++ .../wtf/symbian/BlockAllocatorSymbian.h | 120 +++++++++++++++++++ src/3rdparty/webkit/VERSION | 2 +- 7 files changed, 305 insertions(+), 39 deletions(-) create mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.h diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 6446773..8932b3b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,31 @@ +2010-03-22 Siddharth Mathur + + Reviewed by Laszlo Gombos. + + [Symbian] More efficient aligned memory allocation for JSC Collector + https://bugs.webkit.org/show_bug.cgi?id=34350 + + * JavaScriptCore.pri: Added 2 new Symbian source files and HAL linkage + + * runtime/Collector.cpp: Reduced port-specific code and added private data member + (JSC::Heap::Heap): + (JSC::Heap::~Heap): + (JSC::Heap::destroy): + (JSC::Heap::allocateBlock): + (JSC::Heap::freeBlockPtr): + + * runtime/Collector.h: Added private data member + + * wtf/symbian: Added. + * wtf/symbian/BlockAllocatorSymbian.cpp: Added. + (WTF::AlignedBlockAllocator::AlignedBlockAllocator): Helper class to allocate + aligned blocks more efficiently as required by Collector + (WTF::AlignedBlockAllocator::alloc): + (WTF::AlignedBlockAllocator::free): + (WTF::AlignedBlockAllocator::destroy): + (WTF::AlignedBlockAllocator::~AlignedBlockAllocator): + * wtf/symbian/BlockAllocatorSymbian.h: Added. + 2010-02-09 Janne Koskinen Reviewed by Laszlo Gombos. diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri index bb531e5..a0f9f8e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri @@ -9,6 +9,10 @@ CONFIG(debug, debug|release) { OBJECTS_DIR = obj/release } +symbian { + LIBS += -lhal +} + INCLUDEPATH = \ $$PWD \ $$PWD/.. \ @@ -23,6 +27,7 @@ INCLUDEPATH = \ $$PWD/runtime \ $$PWD/wrec \ $$PWD/wtf \ + $$PWD/wtf/symbian \ $$PWD/wtf/unicode \ $$PWD/yarr \ $$PWD/API \ @@ -243,6 +248,7 @@ SOURCES += \ profiler/TreeProfile.cpp \ wtf/DateMath.cpp \ wtf/FastMalloc.cpp \ + wtf/symbian/BlockAllocatorSymbian.cpp \ wtf/Threading.cpp \ wtf/qt/MainThreadQt.cpp diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp index 8b647a0..6626182 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp @@ -52,11 +52,6 @@ #include #include -#elif PLATFORM(SYMBIAN) -#include -#include -#include - #elif PLATFORM(WIN_OS) #include @@ -124,11 +119,6 @@ const size_t ALLOCATIONS_PER_COLLECTION = 4000; // a PIC branch in Mach-O binaries, see . #define MIN_ARRAY_SIZE (static_cast(14)) -#if PLATFORM(SYMBIAN) -const size_t MAX_NUM_BLOCKS = 256; // Max size of collector heap set to 16 MB -static RHeap* userChunk = 0; -#endif - #if ENABLE(JSC_MULTIPLE_THREADS) #if PLATFORM(DARWIN) @@ -165,29 +155,11 @@ Heap::Heap(JSGlobalData* globalData) , m_currentThreadRegistrar(0) #endif , m_globalData(globalData) +#if PLATFORM(SYMBIAN) + , m_blockallocator(JSCCOLLECTOR_VIRTUALMEM_RESERVATION, BLOCK_SIZE) +#endif { ASSERT(globalData); - -#if PLATFORM(SYMBIAN) - // Symbian OpenC supports mmap but currently not the MAP_ANON flag. - // Using fastMalloc() does not properly align blocks on 64k boundaries - // and previous implementation was flawed/incomplete. - // UserHeap::ChunkHeap allows allocation of continuous memory and specification - // of alignment value for (symbian) cells within that heap. - // - // Clarification and mapping of terminology: - // RHeap (created by UserHeap::ChunkHeap below) is continuos memory chunk, - // which can dynamically grow up to 8 MB, - // that holds all CollectorBlocks of this session (static). - // Each symbian cell within RHeap maps to a 64kb aligned CollectorBlock. - // JSCell objects are maintained as usual within CollectorBlocks. - if (!userChunk) { - userChunk = UserHeap::ChunkHeap(0, 0, MAX_NUM_BLOCKS * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE); - if (!userChunk) - CRASH(); - } -#endif // PLATFORM(SYMBIAN) - memset(&primaryHeap, 0, sizeof(CollectorHeap)); memset(&numberHeap, 0, sizeof(CollectorHeap)); } @@ -233,7 +205,9 @@ void Heap::destroy() t = next; } #endif - +#if PLATFORM(SYMBIAN) + m_blockallocator.destroy(); +#endif m_globalData = 0; } @@ -247,12 +221,9 @@ NEVER_INLINE CollectorBlock* Heap::allocateBlock() // FIXME: tag the region as a JavaScriptCore heap when we get a registered VM tag: . vm_map(current_task(), &address, BLOCK_SIZE, BLOCK_OFFSET_MASK, VM_FLAGS_ANYWHERE | VM_TAG_FOR_COLLECTOR_MEMORY, MEMORY_OBJECT_NULL, 0, FALSE, VM_PROT_DEFAULT, VM_PROT_DEFAULT, VM_INHERIT_DEFAULT); #elif PLATFORM(SYMBIAN) - // Allocate a 64 kb aligned CollectorBlock - unsigned char* mask = reinterpret_cast(userChunk->Alloc(BLOCK_SIZE)); - if (!mask) + void* address = m_blockallocator.alloc(); + if (!address) CRASH(); - uintptr_t address = reinterpret_cast(mask); - memset(reinterpret_cast(address), 0, BLOCK_SIZE); #elif PLATFORM(WINCE) void* address = VirtualAlloc(NULL, BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); @@ -339,7 +310,7 @@ NEVER_INLINE void Heap::freeBlock(CollectorBlock* block) #if PLATFORM(DARWIN) && !PLATFORM(QT) vm_deallocate(current_task(), reinterpret_cast(block), BLOCK_SIZE); #elif PLATFORM(SYMBIAN) - userChunk->Free(reinterpret_cast(block)); + m_blockallocator.free(reinterpret_cast(block)); #elif PLATFORM(WINCE) VirtualFree(block, 0, MEM_RELEASE); #elif PLATFORM(WIN_OS) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h index 9ca9d18..086e519 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h @@ -35,6 +35,10 @@ #include #endif +#if PLATFORM(SYMBIAN) +#include +#endif + #define ASSERT_CLASS_FITS_IN_CELL(class) COMPILE_ASSERT(sizeof(class) <= CELL_SIZE, class_fits_in_cell) namespace JSC { @@ -157,6 +161,11 @@ namespace JSC { pthread_key_t m_currentThreadRegistrar; #endif +#if PLATFORM(SYMBIAN) + // Allocates collector blocks with correct alignment + WTF::AlignedBlockAllocator m_blockallocator; +#endif + JSGlobalData* m_globalData; }; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.cpp new file mode 100644 index 0000000..cc8fd15 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.cpp @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if PLATFORM(SYMBIAN) + +#include "BlockAllocatorSymbian.h" + + +namespace WTF { + +/** Efficiently allocates blocks of size blockSize with blockSize alignment. + * Primarly designed for JSC Collector's needs. + * Not thread-safe. + */ +AlignedBlockAllocator::AlignedBlockAllocator(TUint32 reservationSize, TUint32 blockSize ) + : m_reservation(reservationSize), + m_blockSize(blockSize) +{ + + // Get system's page size value. + SYMBIAN_PAGESIZE(m_pageSize); + + // We only accept multiples of system page size for both initial reservation and the alignment/block size + m_reservation = SYMBIAN_ROUNDUPTOMULTIPLE(m_reservation, m_pageSize); + __ASSERT_ALWAYS(SYMBIAN_ROUNDUPTOMULTIPLE(m_blockSize, m_pageSize), User::Panic(_L("AlignedBlockAllocator1"), KErrArgument)); + + // Calculate max. bit flags we need to carve a reservationSize range into blockSize-sized blocks + m_map.numBits = m_reservation / m_blockSize; + const TUint32 bitsPerWord = 8*sizeof(TUint32); + const TUint32 numWords = (m_map.numBits + bitsPerWord -1) / bitsPerWord; + + m_map.bits = new TUint32[numWords]; + __ASSERT_ALWAYS(m_map.bits, User::Panic(_L("AlignedBlockAllocator2"), KErrNoMemory)); + m_map.clearAll(); + + // Open a Symbian RChunk, and reserve requested virtual address range + // Any thread in this process can operate this rchunk due to EOwnerProcess access rights. + TInt ret = m_chunk.CreateDisconnectedLocal(0 , 0, (TInt)m_reservation , EOwnerProcess); + if (ret != KErrNone) + User::Panic(_L("AlignedBlockAllocator3"), ret); + + // This is the offset to m_chunk.Base() required to make it m_blockSize-aligned + m_offset = SYMBIAN_ROUNDUPTOMULTIPLE(TUint32(m_chunk.Base()), m_blockSize) - TUint(m_chunk.Base()); + +} + +void* AlignedBlockAllocator::alloc() +{ + + TInt freeRam = 0; + void* address = 0; + + // Look up first free slot in bit map + const TInt freeIdx = m_map.findFree(); + + // Pseudo OOM: We ate up the address space we reserved.. + // ..even though the device may have free RAM left + if (freeIdx < 0) + return 0; + + TInt ret = m_chunk.Commit(m_offset + (m_blockSize * freeIdx), m_blockSize); + if (ret != KErrNone) + return 0; // True OOM: Device didn't have physical RAM to spare + + // Updated bit to mark region as in use. + m_map.set(freeIdx); + + // Calculate address of committed region (block) + address = (void*)( (m_chunk.Base() + m_offset) + (TUint)(m_blockSize * freeIdx) ); + + return address; +} + +void AlignedBlockAllocator::free(void* block) +{ + // Calculate index of block to be freed + TInt idx = TUint(static_cast(block) - m_chunk.Base() - m_offset) / m_blockSize; + + __ASSERT_DEBUG(idx >= 0 && idx < m_map.numBits, User::Panic(_L("AlignedBlockAllocator4"), KErrCorrupt)); // valid index check + __ASSERT_DEBUG(m_map.get(idx), User::Panic(_L("AlignedBlockAllocator5"), KErrCorrupt)); // in-use flag check + + // Return committed region to system RAM pool (the physical RAM becomes usable by others) + TInt ret = m_chunk.Decommit(m_offset + m_blockSize * idx, m_blockSize); + + // mark this available again + m_map.clear(idx); +} + +void AlignedBlockAllocator::destroy() +{ + // release everything! + m_chunk.Decommit(0, m_chunk.MaxSize()); + m_map.clearAll(); +} + +AlignedBlockAllocator::~AlignedBlockAllocator() +{ + destroy(); + m_chunk.Close(); + delete [] m_map.bits; +} + +} // end of namespace + +#endif // SYMBIAN diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.h b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.h new file mode 100644 index 0000000..21422f6 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.h @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef BlockAllocatorSymbian_h +#define BlockAllocatorSymbian_h + +#include +#include +#include + + +#define SYMBIAN_PAGESIZE(x) (HAL::Get(HALData::EMemoryPageSize, x)); +#define SYMBIAN_FREERAM(x) (HAL::Get(HALData::EMemoryRAMFree, x)); +#define SYMBIAN_ROUNDUPTOMULTIPLE(x, multipleof) ( (x + multipleof - 1) & ~(multipleof - 1) ) + +// Set sane defaults if -D wasn't provided via compiler args +#ifndef JSCCOLLECTOR_VIRTUALMEM_RESERVATION +#if defined(__WINS__) + // Emulator has limited virtual address space + #define JSCCOLLECTOR_VIRTUALMEM_RESERVATION (4*1024*1024) +#else + // HW has plenty of virtual addresses + #define JSCCOLLECTOR_VIRTUALMEM_RESERVATION (128*1024*1024) +#endif +#endif + +namespace WTF { + +/** + * Allocates contiguous region of size blockSize with blockSize-aligned address. + * blockSize must be a multiple of system page size (typically 4K on Symbian/ARM) + * + * @param reservationSize Virtual address range to be reserved upon creation of chunk (bytes). + * @param blockSize Size of a single allocation. Returned address will also be blockSize-aligned. + */ +class AlignedBlockAllocator { + public: + AlignedBlockAllocator(TUint32 reservationSize, TUint32 blockSize); + ~AlignedBlockAllocator(); + void destroy(); + void* alloc(); + void free(void* data); + + private: + RChunk m_chunk; // Symbian chunk that lets us reserve/commit/decommit + TUint m_offset; // offset of first committed region from base + TInt m_pageSize; // cached value of system page size, typically 4K on Symbian + TUint32 m_reservation; + TUint32 m_blockSize; + + // Tracks comitted/decommitted state of a blockSize region + struct { + + TUint32 *bits; // array of bit flags + TUint32 numBits; // number of regions to keep track of + + bool get(TUint32 n) const + { + return !!(bits[n >> 5] & (1 << (n & 0x1F))); + } + + void set(TUint32 n) + { + bits[n >> 5] |= (1 << (n & 0x1F)); + } + + void clear(TUint32 n) + { + bits[n >> 5] &= ~(1 << (n & 0x1F)); + } + + void clearAll() + { + for (TUint32 i = 0; i < numBits; i++) + clear(i); + } + + TInt findFree() const + { + for (TUint32 i = 0; i < numBits; i++) { + if (!get(i)) + return i; + } + return -1; + } + + } m_map; + +}; + +} + +#endif // end of BlockAllocatorSymbian_h + + diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index a8889b3..4de7ad8 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - e9151b11e974f0aa47fd40c225f88f35ced91496 + ecfa4583e573ce4dff1f0df12f6bdba3022376e5 -- cgit v0.12 From c8fc2b44213ded1bd789b4cd3106c4f0b0bfa78b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Mar 2010 17:21:42 +0200 Subject: Fix compilation on WinCE and MinGW by memsetting the OVERLAPPED struct. Apparently the SDKs cannot agree on the contents of this struct, so let's memset the entire thing. --- src/corelib/io/qwindowspipewriter.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp index 3eb2411..417439f 100644 --- a/src/corelib/io/qwindowspipewriter.cpp +++ b/src/corelib/io/qwindowspipewriter.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qwindowspipewriter_p.h" +#include QT_BEGIN_NAMESPACE @@ -101,9 +102,7 @@ qint64 QWindowsPipeWriter::write(const char *ptr, qint64 maxlen) void QWindowsPipeWriter::run() { OVERLAPPED overl; - overl.Internal = 0; - overl.InternalHigh = 0; - overl.Pointer = 0; + memset(&overl, 0, sizeof overl); overl.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); forever { lock.lock(); -- cgit v0.12 From 0d41d766d13bc6ee8a068aef4b88567c111d0e0c Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 31 Mar 2010 08:51:00 +1000 Subject: Another "off by 1" problem in OpenVG - in paths this time. Summary so far: paths and images do not need the 0.5 adjustment to the transform, but glyphs do. Not sure why glyphs do, but the fonts definitely look wrong without the adjustment. Task-number: QT-3192 Reviewed-by: trustme --- src/openvg/qpaintengine_vg.cpp | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index ce6e21b..ebf34f5 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -183,6 +183,7 @@ public: qreal penScale; // Pen scaling factor from "transform". QTransform pathTransform; // Calculated VG path transformation. + QTransform glyphTransform; // Calculated VG glyph transformation. QTransform imageTransform; // Calculated VG image transformation. bool pathTransformSet; // True if path transform set in the VG context. @@ -500,24 +501,31 @@ extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) { - VGfloat devh = pdev->height() - 1; + VGfloat devh = pdev->height(); // Construct the VG transform by combining the Qt transform with // the following viewport transformation: - // | 1 0 0 | | 1 0 0.5 | | 1 0 0.5 | - // | 0 -1 devh | * | 0 1 -0.5 | = | 0 -1 (0.5 + devh) | - // | 0 0 1 | | 0 0 1 | | 0 0 1 | + // | 1 0 0 | + // | 0 -1 devh | + // | 0 0 1 | + // The glyph transform uses a slightly different transformation: + // | 1 0 0 | | 1 0 0.5 | | 1 0 0.5 | + // | 0 -1 devh - 1 | * | 0 1 -0.5 | = | 0 -1 (devh - 0.5) | + // | 0 0 1 | | 0 0 1 | | 0 0 1 | // The full VG transform is effectively: // 1. Apply the user's transformation matrix. - // 2. Translate by (0.5, -0.5) to correct for Qt and VG putting - // the centre of the pixel at different positions. + // 2. Translate glyphs by an extra (0.5, -0.5). // 3. Flip the co-ordinate system upside down. QTransform viewport(1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, - 0.5f, devh + 0.5f, 1.0f); + 0.0f, devh, 1.0f); + QTransform gviewport(1.0f, 0.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + 0.5f, devh - 0.5f, 1.0f); // Compute the path transform and determine if it is projective. pathTransform = transform * viewport; + glyphTransform = transform * gviewport; bool projective = (pathTransform.m13() != 0.0f || pathTransform.m23() != 0.0f || pathTransform.m33() != 1.0f); @@ -526,6 +534,7 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) // so we will have to convert the co-ordinates ourselves. // Change the matrix to just the viewport transformation. pathTransform = viewport; + glyphTransform = gviewport; simpleTransform = false; } else { simpleTransform = true; @@ -533,13 +542,7 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) pathTransformSet = false; // The image transform is always the full transformation, - // because it can be projective. It also does not need the - // (0.5, -0.5) translation because vgDrawImage() implicitly - // adds 0.5 to each co-ordinate. - QTransform viewport2(1.0f, 0.0f, 0.0f, - 0.0f, -1.0f, 0.0f, - 0.0f, devh + 1, 1.0f); - imageTransform = transform * viewport2; + imageTransform = transform * viewport; // Calculate the scaling factor to use for turning cosmetic pens // into ordinary non-cosmetic pens. @@ -3317,7 +3320,7 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) } // Set the transformation to use for drawing the current glyphs. - QTransform glyphTransform(d->pathTransform); + QTransform glyphTransform(d->glyphTransform); glyphTransform.translate(p.x(), p.y()); #if defined(QVG_NO_IMAGE_GLYPHS) glyphTransform.scale(glyphCache->scaleX, glyphCache->scaleY); @@ -3650,10 +3653,10 @@ void QVGCompositionHelper::fillBackground } else { // Set the path transform to the default viewport transformation. - VGfloat devh = screenSize.height() - 1; + VGfloat devh = screenSize.height(); QTransform viewport(1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, - -0.5f, devh + 0.5f, 1.0f); + 0.0f, devh, 1.0f); d->setTransform(VG_MATRIX_PATH_USER_TO_SURFACE, viewport); // Set the brush to use to fill the background. @@ -3689,10 +3692,10 @@ void QVGCompositionHelper::drawCursorPixmap } // Set the image transformation and modes. - VGfloat devh = screenSize.height() - 1; + VGfloat devh = screenSize.height(); QTransform transform(1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, - -0.5f, devh + 0.5f, 1.0f); + 0.0f, devh, 1.0f); transform.translate(offset.x(), offset.y()); d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); d->setImageMode(VG_DRAW_IMAGE_NORMAL); -- cgit v0.12 From f17e398f661d903a9fda0bfb3725fd881656e9d4 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 31 Mar 2010 01:39:26 +0200 Subject: Add a workaround for a bug in Mac filesystem watcher. Reviewed-by:TrustMe --- src/gui/dialogs/qfilesystemmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp index 3757ad7..24faa59 100644 --- a/src/gui/dialogs/qfilesystemmodel.cpp +++ b/src/gui/dialogs/qfilesystemmodel.cpp @@ -1362,7 +1362,7 @@ QModelIndex QFileSystemModel::setRootPath(const QString &newPath) return d->index(rootPath()); //We remove the watcher on the previous path - if (!rootPath().isEmpty()) { + if (!rootPath().isEmpty() && rootPath() != QLatin1String(".")) { //This remove the watcher for the old rootPath d->fileInfoGatherer.removePath(rootPath()); //This line "marks" the node as dirty, so the next fetchMore -- cgit v0.12 From 4e4c0055d59978850796ff8c1b5015e17459e8d2 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 31 Mar 2010 02:17:28 +0200 Subject: Revert "Add a a layout property in QGraphicsWidget." This reverts commit 87fae30fc63460e0ed2cc98f55a22e28d7520311. This drop the support of QML on top of 4.6 --- src/gui/graphicsview/qgraphicswidget.cpp | 1 - src/gui/graphicsview/qgraphicswidget.h | 2 -- tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 3 +-- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 654a432..131ee87 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -801,7 +801,6 @@ void QGraphicsWidget::setLayout(QGraphicsLayout *l) l->setParentLayoutItem(this); l->d_func()->reparentChildItems(this); l->invalidate(); - emit layoutChanged(); } /*! diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h index 730674c..468a134 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/gui/graphicsview/qgraphicswidget.h @@ -82,7 +82,6 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay Q_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags) Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry NOTIFY geometryChanged) - Q_PROPERTY(QGraphicsLayout* layout READ layout WRITE setLayout NOTIFY layoutChanged) public: QGraphicsWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); ~QGraphicsWidget(); @@ -177,7 +176,6 @@ public: Q_SIGNALS: void geometryChanged(); - void layoutChanged(); public Q_SLOTS: bool close(); diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index b78ef26..5a3a54c 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -942,7 +942,6 @@ void tst_QGraphicsWidget::layout() layout->addItem(item); children.append(item); } - QSignalSpy spy(&widget, SIGNAL(layoutChanged())); widget.setLayout(layout); QTRY_COMPARE(widget.layout(), static_cast(layout)); @@ -951,7 +950,7 @@ void tst_QGraphicsWidget::layout() QCOMPARE(item->parentWidget(), (QGraphicsWidget *)&widget); QVERIFY(item->geometry() != QRectF(0, 0, -1, -1)); } - QCOMPARE(spy.count(), 1); + // don't crash widget.setLayout(0); } -- cgit v0.12 From ebd1c45822aca087be994c898cfb01cd41599429 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 31 Mar 2010 02:19:42 +0200 Subject: Revert "Better handling for NOTIFY in QGraphicsWidget regarding geometry changes" This reverts commit 13bccd4ade76dd8a9c1cc067cc2b8da69c11def2. Conflicts: src/gui/graphicsview/qgraphicswidget.cpp Drop the support of QML on top of 4.6 --- src/gui/graphicsview/qgraphicswidget.cpp | 3 ++- src/gui/graphicsview/qgraphicswidget.h | 7 ++++--- tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 131ee87..7be0096 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -392,7 +392,7 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) } QSizeF oldSize = size(); QGraphicsLayoutItem::setGeometry(newGeom); - emit geometryChanged(); + // Send resize event bool resized = newGeom.size() != oldSize; if (resized) { @@ -403,6 +403,7 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) emit widthChanged(); if (oldSize.height() != newGeom.size().height()) emit heightChanged(); + emit sizeChanged(); QApplication::sendEvent(this, &re); } } diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h index 468a134..56b5f88 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/gui/graphicsview/qgraphicswidget.h @@ -73,7 +73,7 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay Q_PROPERTY(QPalette palette READ palette WRITE setPalette) Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection) - Q_PROPERTY(QSizeF size READ size WRITE resize NOTIFY geometryChanged) + Q_PROPERTY(QSizeF size READ size WRITE resize NOTIFY sizeChanged) Q_PROPERTY(QSizeF minimumSize READ minimumSize WRITE setMinimumSize) Q_PROPERTY(QSizeF preferredSize READ preferredSize WRITE setPreferredSize) Q_PROPERTY(QSizeF maximumSize READ maximumSize WRITE setMaximumSize) @@ -81,10 +81,11 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy) Q_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags) Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) - Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry NOTIFY geometryChanged) + Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry) public: QGraphicsWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); ~QGraphicsWidget(); + QGraphicsLayout *layout() const; void setLayout(QGraphicsLayout *layout); void adjustSize(); @@ -175,7 +176,7 @@ public: #endif Q_SIGNALS: - void geometryChanged(); + void sizeChanged(); public Q_SLOTS: bool close(); diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 5a3a54c..ff3d19f 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -767,7 +767,7 @@ void tst_QGraphicsWidget::geometry() { SubQGraphicsWidget widget; QCOMPARE(widget.geometry(), QRectF(widget.pos(), widget.size())); - QSignalSpy spy(&widget, SIGNAL(geometryChanged())); + QSignalSpy spy(&widget, SIGNAL(sizeChanged())); QFETCH(QPointF, pos); QFETCH(QSizeF, size); widget.setPos(pos); -- cgit v0.12 From 6cb935dd89a391f792f8ad42012b5c7c38712f17 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 31 Mar 2010 02:24:39 +0200 Subject: Revert "Add NOTIFY to size property so QML bindings are working fine." This reverts commit 79a02c86c445e50630bcae62a4505f212281ec8b. Conflicts: src/gui/graphicsview/qgraphicswidget.cpp This drop the support of QML on top of 4.6 --- src/gui/graphicsview/qgraphicswidget.cpp | 5 ----- src/gui/graphicsview/qgraphicswidget.h | 5 +---- tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 4 +--- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 7be0096..3548fe3 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -399,11 +399,6 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) QGraphicsSceneResizeEvent re; re.setOldSize(oldSize); re.setNewSize(newGeom.size()); - if (oldSize.width() != newGeom.size().width()) - emit widthChanged(); - if (oldSize.height() != newGeom.size().height()) - emit heightChanged(); - emit sizeChanged(); QApplication::sendEvent(this, &re); } } diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h index 56b5f88..f1d382b 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/gui/graphicsview/qgraphicswidget.h @@ -73,7 +73,7 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay Q_PROPERTY(QPalette palette READ palette WRITE setPalette) Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection) - Q_PROPERTY(QSizeF size READ size WRITE resize NOTIFY sizeChanged) + Q_PROPERTY(QSizeF size READ size WRITE resize) Q_PROPERTY(QSizeF minimumSize READ minimumSize WRITE setMinimumSize) Q_PROPERTY(QSizeF preferredSize READ preferredSize WRITE setPreferredSize) Q_PROPERTY(QSizeF maximumSize READ maximumSize WRITE setMaximumSize) @@ -175,9 +175,6 @@ public: using QObject::children; #endif -Q_SIGNALS: - void sizeChanged(); - public Q_SLOTS: bool close(); diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index ff3d19f..e04d99d 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -767,13 +767,11 @@ void tst_QGraphicsWidget::geometry() { SubQGraphicsWidget widget; QCOMPARE(widget.geometry(), QRectF(widget.pos(), widget.size())); - QSignalSpy spy(&widget, SIGNAL(sizeChanged())); + QFETCH(QPointF, pos); QFETCH(QSizeF, size); widget.setPos(pos); widget.resize(size); - if (!size.isNull()) - QCOMPARE(spy.count(), 1); QCOMPARE(widget.geometry(), QRectF(pos, size)); } -- cgit v0.12 From 82a306e7dda06909801f576bbbbebb59dc41c563 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 31 Mar 2010 02:30:41 +0200 Subject: Revert "struct -> class, it's better." This reverts commit 1d094129c0c3994df4e59cd9eda6981a7b131903. --- src/gui/graphicsview/qgraphicsitem_p.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index eb5fac7..669ae1b 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -74,8 +74,7 @@ class QGraphicsItemPrivate; #ifndef QDECLARATIVELISTPROPERTY #define QDECLARATIVELISTPROPERTY template -class QDeclarativeListProperty { -public: +struct QDeclarativeListProperty { typedef void (*AppendFunction)(QDeclarativeListProperty *, T*); typedef int (*CountFunction)(QDeclarativeListProperty *); typedef T *(*AtFunction)(QDeclarativeListProperty *, int); -- cgit v0.12 From 880e4935410769b8337d75f219bef70493c4bb2c Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 31 Mar 2010 02:31:23 +0200 Subject: Revert "Add a children private property needed for QML to support QGraphicsObject" This reverts commit 4be83fa7337c5a4eb7b0ce085aa5854af5d33252. Conflicts: src/gui/graphicsview/qgraphicswidget.cpp This drops the support of QML on top of 4.6 --- src/gui/graphicsview/qgraphicsitem.cpp | 103 --------------------- src/gui/graphicsview/qgraphicsitem.h | 7 -- src/gui/graphicsview/qgraphicsitem_p.h | 67 -------------- src/gui/graphicsview/qgraphicswidget.cpp | 8 -- src/gui/graphicsview/qgraphicswidget_p.cpp | 51 ---------- src/gui/graphicsview/qgraphicswidget_p.h | 9 -- tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 28 ------ 7 files changed, 273 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 1b707b0..42abe59 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -5225,8 +5225,6 @@ void QGraphicsItemPrivate::addChild(QGraphicsItem *child) needSortChildren = 1; // ### maybe 0 child->d_ptr->siblingIndex = children.size(); children.append(child); - if (isObject) - emit static_cast(q_ptr)->childrenChanged(); } /*! @@ -5249,8 +5247,6 @@ void QGraphicsItemPrivate::removeChild(QGraphicsItem *child) // the child is not guaranteed to be at the index after the list is sorted. // (see ensureSortedChildren()). child->d_ptr->siblingIndex = -1; - if (isObject) - emit static_cast(q_ptr)->childrenChanged(); } /*! @@ -7458,88 +7454,6 @@ void QGraphicsObject::ungrabGesture(Qt::GestureType gesture) } } -void QGraphicsItemPrivate::append(QDeclarativeListProperty *list, QGraphicsObject *item) -{ - QGraphicsItemPrivate::get(item)->setParentItemHelper(static_cast(list->object), /*newParentVariant=*/0, /*thisPointerVariant=*/0); -} - -/*! - Returns a list of this item's children. - - The items are sorted by stacking order. This takes into account both the - items' insertion order and their Z-values. - -*/ -QDeclarativeListProperty QGraphicsItemPrivate::childrenList() -{ - Q_Q(QGraphicsItem); - if (isObject) { - QGraphicsObject *that = static_cast(q); - return QDeclarativeListProperty(that, &children, QGraphicsItemPrivate::append); - } else { - //QGraphicsItem is not supported for this property - return QDeclarativeListProperty(); - } -} - -/*! - \internal - Returns the width of the item - Reimplemented by QGraphicsWidget -*/ -qreal QGraphicsItemPrivate::width() const -{ - return 0; -} - -/*! - \internal - Set the width of the item - Reimplemented by QGraphicsWidget -*/ -void QGraphicsItemPrivate::setWidth(qreal w) -{ - Q_UNUSED(w); -} - -/*! - \internal - Reset the width of the item - Reimplemented by QGraphicsWidget -*/ -void QGraphicsItemPrivate::resetWidth() -{ -} - -/*! - \internal - Returns the height of the item - Reimplemented by QGraphicsWidget -*/ -qreal QGraphicsItemPrivate::height() const -{ - return 0; -} - -/*! - \internal - Set the height of the item - Reimplemented by QGraphicsWidget -*/ -void QGraphicsItemPrivate::setHeight(qreal h) -{ - Q_UNUSED(h); -} - -/*! - \internal - Reset the height of the item - Reimplemented by QGraphicsWidget -*/ -void QGraphicsItemPrivate::resetHeight() -{ -} - /*! \property QGraphicsObject::parent \brief the parent of the item @@ -7726,23 +7640,6 @@ void QGraphicsItemPrivate::resetHeight() \sa scale, rotation, QGraphicsItem::transformOriginPoint() */ -/*! - \fn void QGraphicsObject::widthChanged() - \internal -*/ - -/*! - \fn void QGraphicsObject::heightChanged() - \internal -*/ - -/*! - - \fn QGraphicsObject::childrenChanged() - - This signal gets emitted whenever the children list changes - \internal -*/ /*! \class QAbstractGraphicsShapeItem diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 5023f60..d72833b 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -547,10 +547,6 @@ class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint) - Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), QDeclarativeListProperty children READ childrenList DESIGNABLE false NOTIFY childrenChanged) - Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), qreal width READ width WRITE setWidth NOTIFY widthChanged RESET resetWidth FINAL) - Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), qreal height READ height WRITE setHeight NOTIFY heightChanged RESET resetHeight FINAL) - Q_CLASSINFO("DefaultProperty", "children") Q_INTERFACES(QGraphicsItem) public: QGraphicsObject(QGraphicsItem *parent = 0); @@ -575,9 +571,6 @@ Q_SIGNALS: void zChanged(); void rotationChanged(); void scaleChanged(); - void childrenChanged(); - void widthChanged(); - void heightChanged(); protected: QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 669ae1b..ea04e0b 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -71,62 +71,6 @@ QT_BEGIN_NAMESPACE class QGraphicsItemPrivate; -#ifndef QDECLARATIVELISTPROPERTY -#define QDECLARATIVELISTPROPERTY -template -struct QDeclarativeListProperty { - typedef void (*AppendFunction)(QDeclarativeListProperty *, T*); - typedef int (*CountFunction)(QDeclarativeListProperty *); - typedef T *(*AtFunction)(QDeclarativeListProperty *, int); - typedef void (*ClearFunction)(QDeclarativeListProperty *); - - QDeclarativeListProperty() - : object(0), data(0), append(0), count(0), at(0), clear(0), dummy1(0), dummy2(0) {} - QDeclarativeListProperty(QObject *o, QList &list) - : object(o), data(&list), append(qlist_append), count(qlist_count), at(qlist_at), - clear(qlist_clear), dummy1(0), dummy2(0) {} - QDeclarativeListProperty(QObject *o, void *d, AppendFunction a, CountFunction c = 0, AtFunction t = 0, - ClearFunction r = 0) - : object(o), data(d), append(a), count(c), at(t), clear(r), dummy1(0), dummy2(0) {} - - bool operator==(const QDeclarativeListProperty &o) const { - return object == o.object && - data == o.data && - append == o.append && - count == o.count && - at == o.at && - clear == o.clear; - } - - QObject *object; - void *data; - - AppendFunction append; - - CountFunction count; - AtFunction at; - - ClearFunction clear; - - void *dummy1; - void *dummy2; - -private: - static void qlist_append(QDeclarativeListProperty *p, T *v) { - ((QList *)p->data)->append(v); - } - static int qlist_count(QDeclarativeListProperty *p) { - return ((QList *)p->data)->count(); - } - static T *qlist_at(QDeclarativeListProperty *p, int idx) { - return ((QList *)p->data)->at(idx); - } - static void qlist_clear(QDeclarativeListProperty *p) { - return ((QList *)p->data)->clear(); - } -}; -#endif - class QGraphicsItemCache { public: @@ -293,7 +237,6 @@ public: void resolveDepth(); void addChild(QGraphicsItem *child); void removeChild(QGraphicsItem *child); - QDeclarativeListProperty childrenList(); void setParentItemHelper(QGraphicsItem *parent, const QVariant *newParentVariant, const QVariant *thisPointerVariant); void childrenBoundingRectHelper(QTransform *x, QRectF *rect); @@ -480,21 +423,11 @@ public: inline QTransform transformToParent() const; inline void ensureSortedChildren(); - static void append(QDeclarativeListProperty *list, QGraphicsObject *item); static inline bool insertionOrder(QGraphicsItem *a, QGraphicsItem *b); void ensureSequentialSiblingIndex(); inline void sendScenePosChange(); virtual void siblingOrderChange(); - // Private Properties - virtual qreal width() const; - virtual void setWidth(qreal); - virtual void resetWidth(); - - virtual qreal height() const; - virtual void setHeight(qreal); - virtual void resetHeight(); - QRectF childrenBoundingRect; QRectF needsRepaint; QMap paintedViewBoundingRects; diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 3548fe3..4c5cffa 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -324,14 +324,6 @@ void QGraphicsWidget::resize(const QSizeF &size) */ /*! - - \fn QGraphicsWidget::geometryChanged() - - This signal gets emitted whenever the geometry of the item changes - \internal -*/ - -/*! \property QGraphicsWidget::geometry \brief the geometry of the widget diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp index 6e397b6..1835c74 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp @@ -44,7 +44,6 @@ #ifndef QT_NO_GRAPHICSVIEW #include -#include #include "qgraphicswidget_p.h" #include "qgraphicslayout.h" #include "qgraphicsscene_p.h" @@ -826,56 +825,6 @@ void QGraphicsWidgetPrivate::setLayout_helper(QGraphicsLayout *l) } } -qreal QGraphicsWidgetPrivate::width() const -{ - Q_Q(const QGraphicsWidget); - return q->geometry().width(); -} - -void QGraphicsWidgetPrivate::setWidth(qreal w) -{ - if (qIsNaN(w)) - return; - Q_Q(QGraphicsWidget); - if (q->geometry().width() == w) - return; - - QRectF oldGeom = q->geometry(); - - q->setGeometry(QRectF(q->x(), q->y(), w, height())); -} - -void QGraphicsWidgetPrivate::resetWidth() -{ - Q_Q(QGraphicsWidget); - q->setGeometry(QRectF(q->x(), q->y(), 0, height())); -} - -qreal QGraphicsWidgetPrivate::height() const -{ - Q_Q(const QGraphicsWidget); - return q->geometry().height(); -} - -void QGraphicsWidgetPrivate::setHeight(qreal h) -{ - if (qIsNaN(h)) - return; - Q_Q(QGraphicsWidget); - if (q->geometry().height() == h) - return; - - QRectF oldGeom = q->geometry(); - - q->setGeometry(QRectF(q->x(), q->y(), width(), h)); -} - -void QGraphicsWidgetPrivate::resetHeight() -{ - Q_Q(QGraphicsWidget); - q->setGeometry(QRectF(q->x(), q->y(), width(), 0)); -} - QT_END_NAMESPACE #endif //QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h index f34a755..2c5b3bf 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.h +++ b/src/gui/graphicsview/qgraphicswidget_p.h @@ -130,15 +130,6 @@ public: void windowFrameHoverLeaveEvent(QGraphicsSceneHoverEvent *event); bool hasDecoration() const; - // Private Properties - qreal width() const; - void setWidth(qreal); - void resetWidth(); - - qreal height() const; - void setHeight(qreal); - void resetHeight(); - // State inline int attributeToBitIndex(Qt::WidgetAttribute att) const { diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index e04d99d..4a874be 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -111,8 +111,6 @@ private slots: void fontPropagationSceneChange(); void geometry_data(); void geometry(); - void width(); - void height(); void getContentsMargins_data(); void getContentsMargins(); void initStyleOption_data(); @@ -775,32 +773,6 @@ void tst_QGraphicsWidget::geometry() QCOMPARE(widget.geometry(), QRectF(pos, size)); } -void tst_QGraphicsWidget::width() -{ - QGraphicsWidget w; - QCOMPARE(w.property("width").toReal(), qreal(0)); - QSignalSpy spy(&w, SIGNAL(widthChanged())); - w.setProperty("width", qreal(50)); - QCOMPARE(w.property("width").toReal(), qreal(50)); - QCOMPARE(spy.count(), 1); - //calling old school setGeometry should work too - w.setGeometry(0, 0, 200, 200); - QCOMPARE(spy.count(), 2); -} - -void tst_QGraphicsWidget::height() -{ - QGraphicsWidget w; - QCOMPARE(w.property("height").toReal(), qreal(0)); - QSignalSpy spy(&w, SIGNAL(heightChanged())); - w.setProperty("height", qreal(50)); - QCOMPARE(w.property("height").toReal(), qreal(50)); - QCOMPARE(spy.count(), 1); - //calling old school setGeometry should work too - w.setGeometry(0, 0, 200, 200); - QCOMPARE(spy.count(), 2); -} - void tst_QGraphicsWidget::getContentsMargins_data() { QTest::addColumn("left"); -- cgit v0.12 From ffb3275775874a94a6882d5098ac963ad54c9bec Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Wed, 31 Mar 2010 10:40:42 +1000 Subject: Fixed incorrectly clipped video when rendered on QGLWidget Don't enable GL stencil/scissor test inside of native GL rendering block if it was not enabled by QPaintEngine (QGLWidget viewport case). Reviewed-by: Andrew den Exter --- src/multimedia/base/qpaintervideosurface.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/multimedia/base/qpaintervideosurface.cpp b/src/multimedia/base/qpaintervideosurface.cpp index b8028d8f..2fe941b 100644 --- a/src/multimedia/base/qpaintervideosurface.cpp +++ b/src/multimedia/base/qpaintervideosurface.cpp @@ -737,10 +737,15 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::paint( const QRectF &target, QPainter *painter, const QRectF &source) { if (m_frame.isValid()) { + bool stencilTestEnabled = glIsEnabled(GL_STENCIL_TEST); + bool scissorTestEnabled = glIsEnabled(GL_SCISSOR_TEST); + painter->beginNativePainting(); - glEnable(GL_STENCIL_TEST); - glEnable(GL_SCISSOR_TEST); + if (stencilTestEnabled) + glEnable(GL_STENCIL_TEST); + if (scissorTestEnabled) + glEnable(GL_SCISSOR_TEST); const float txLeft = source.left() / m_frameSize.width(); const float txRight = source.right() / m_frameSize.width(); @@ -815,9 +820,6 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::paint( glDisableClientState(GL_VERTEX_ARRAY); glDisable(GL_FRAGMENT_PROGRAM_ARB); - glDisable(GL_STENCIL_TEST); - glDisable(GL_SCISSOR_TEST); - painter->endNativePainting(); } return QAbstractVideoSurface::NoError; @@ -1063,10 +1065,15 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::paint( const QRectF &target, QPainter *painter, const QRectF &source) { if (m_frame.isValid()) { + bool stencilTestEnabled = glIsEnabled(GL_STENCIL_TEST); + bool scissorTestEnabled = glIsEnabled(GL_SCISSOR_TEST); + painter->beginNativePainting(); - glEnable(GL_STENCIL_TEST); - glEnable(GL_SCISSOR_TEST); + if (stencilTestEnabled) + glEnable(GL_STENCIL_TEST); + if (scissorTestEnabled) + glEnable(GL_SCISSOR_TEST); const int width = QGLContext::currentContext()->device()->width(); const int height = QGLContext::currentContext()->device()->height(); @@ -1158,9 +1165,6 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::paint( m_program.release(); - - glDisable(GL_SCISSOR_TEST); - glDisable(GL_STENCIL_TEST); painter->endNativePainting(); } return QAbstractVideoSurface::NoError; -- cgit v0.12 From 63f7da63891f07202453759d29a9657c3f9681a4 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 31 Mar 2010 12:08:03 +1000 Subject: More testing. --- tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml | 6 ++++++ .../qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml b/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml index 4207a1f..2fec9da 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml @@ -1,6 +1,7 @@ import Qt 4.6 QtObject { + //real property real test1: a + b property real test2: a - b property bool test3: (a < b) @@ -8,6 +9,7 @@ QtObject { property bool test5: (a == b) property bool test6: (a != b) + //int property int test7: c + d property int test8: d - c property bool test9: (c < d) @@ -15,17 +17,20 @@ QtObject { property bool test11: (c == d) property bool test12: (c != d) + //string property string test13: e + f property string test14: e + " " + f property bool test15: (e == f) property bool test16: (e != f) + //type conversion property int test17: a property real test18: d property int test19: g property real test20: g property string test21: g property string test22: h + property bool test23: i property real a: 4.5 property real b: 11.2 @@ -35,4 +40,5 @@ QtObject { property string f: "World" property var g: 6.7 property var h: "!" + property var i: true } diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 09e77a3..77dd4b8 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -2055,10 +2055,12 @@ void tst_qdeclarativeecmascript::compiled() QCOMPARE(object->property("test17").toInt(), 4); QCOMPARE(object->property("test18").toReal(), qreal(176)); - //QCOMPARE(object->property("test19").toInt(), 6); + QEXPECT_FAIL("", "QTBUG-9538", Continue); + QCOMPARE(object->property("test19").toInt(), 6); QCOMPARE(object->property("test20").toReal(), qreal(6.7)); QCOMPARE(object->property("test21").toString(), QLatin1String("6.7")); QCOMPARE(object->property("test22").toString(), QLatin1String("!")); + QCOMPARE(object->property("test23").toBool(), true); delete object; } -- cgit v0.12 From ff711bebd7a8857bc78b9a2854591489fcb15497 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 31 Mar 2010 13:05:00 +1000 Subject: VisibleArea is not a creatable type. --- src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 7bc74ce..97a22cf 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -130,7 +130,6 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType("Qt",4,6,"TextEdit"); qmlRegisterType("Qt",4,6,"TextInput"); qmlRegisterType("Qt",4,6,"ViewSection"); - qmlRegisterType("Qt",4,6,"VisibleArea"); qmlRegisterType("Qt",4,6,"VisualDataModel"); qmlRegisterType("Qt",4,6,"VisualItemModel"); @@ -148,6 +147,7 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); + qmlRegisterType(); #ifdef QT_WEBKIT_LIB qmlRegisterType(); #endif -- cgit v0.12 From 8c757e4b84748c19e5f66da432d8af2e7db40cde Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 31 Mar 2010 14:14:19 +1000 Subject: Minor cleanup for visual test framework. --- tools/qml/main.cpp | 2 +- tools/qml/qdeclarativetester.cpp | 381 +++++++++++++++++++++++++++++++++++++++ tools/qml/qdeclarativetester.h | 286 +++++++++++++++++++++++++++++ tools/qml/qfxtester.cpp | 381 --------------------------------------- tools/qml/qfxtester.h | 286 ----------------------------- tools/qml/qml.pro | 4 +- tools/qml/qmlruntime.cpp | 2 +- 7 files changed, 671 insertions(+), 671 deletions(-) create mode 100644 tools/qml/qdeclarativetester.cpp create mode 100644 tools/qml/qdeclarativetester.h delete mode 100644 tools/qml/qfxtester.cpp delete mode 100644 tools/qml/qfxtester.h diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 8062e8e..5099e49 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -47,7 +47,7 @@ #include #include #include -#include "qfxtester.h" +#include "qdeclarativetester.h" #include "qdeclarativefolderlistmodel.h" QT_USE_NAMESPACE diff --git a/tools/qml/qdeclarativetester.cpp b/tools/qml/qdeclarativetester.cpp new file mode 100644 index 0000000..6245124 --- /dev/null +++ b/tools/qml/qdeclarativetester.cpp @@ -0,0 +1,381 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + + +QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts, + QDeclarativeView *parent) +: QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts), + testscript(0), hasCompleted(false), hasFailed(false) +{ + parent->viewport()->installEventFilter(this); + parent->installEventFilter(this); + QUnifiedTimer::instance()->setConsistentTiming(true); + if (options & QDeclarativeViewer::Play) + this->run(); + start(); +} + +QDeclarativeTester::~QDeclarativeTester() +{ + if (!hasFailed && + options & QDeclarativeViewer::Record && + options & QDeclarativeViewer::SaveOnExit) + save(); +} + +int QDeclarativeTester::duration() const +{ + return -1; +} + +void QDeclarativeTester::addMouseEvent(Destination dest, QMouseEvent *me) +{ + MouseEvent e(me); + e.destination = dest; + m_mouseEvents << e; +} + +void QDeclarativeTester::addKeyEvent(Destination dest, QKeyEvent *ke) +{ + KeyEvent e(ke); + e.destination = dest; + m_keyEvents << e; +} + +bool QDeclarativeTester::eventFilter(QObject *o, QEvent *e) +{ + if (!filterEvents) + return false; + + Destination destination; + if (o == m_view) { + destination = View; + } else if (o == m_view->viewport()) { + destination = ViewPort; + } else { + return false; + } + + switch (e->type()) { + case QEvent::KeyPress: + case QEvent::KeyRelease: + addKeyEvent(destination, (QKeyEvent *)e); + return true; + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseMove: + case QEvent::MouseButtonDblClick: + addMouseEvent(destination, (QMouseEvent *)e); + return true; + default: + break; + } + return false; +} + +void QDeclarativeTester::executefailure() +{ + hasFailed = true; + + if (options & QDeclarativeViewer::ExitOnFailure) + exit(-1); +} + +void QDeclarativeTester::imagefailure() +{ + hasFailed = true; + + if (options & QDeclarativeViewer::ExitOnFailure) + exit(-1); +} + +void QDeclarativeTester::complete() +{ + if ((options & QDeclarativeViewer::TestErrorProperty) && !hasFailed) { + QString e = m_view->rootObject()->property("error").toString(); + if (!e.isEmpty()) { + qWarning() << "Test failed:" << e; + hasFailed = true; + } + } + if (options & QDeclarativeViewer::ExitOnComplete) + QApplication::exit(hasFailed?-1:0); + + if (hasCompleted) + return; + hasCompleted = true; + + if (options & QDeclarativeViewer::Play) + qWarning("Script playback complete"); +} + +void QDeclarativeTester::run() +{ + QDeclarativeComponent c(m_view->engine(), m_script + QLatin1String(".qml")); + + testscript = qobject_cast(c.create()); + if (testscript) testscript->setParent(this); + else { executefailure(); exit(-1); } + testscriptidx = 0; +} + +void QDeclarativeTester::save() +{ + QString filename = m_script + QLatin1String(".qml"); + QFileInfo filenameInfo(filename); + QDir saveDir = filenameInfo.absoluteDir(); + saveDir.mkpath("."); + + QFile file(filename); + file.open(QIODevice::WriteOnly); + QTextStream ts(&file); + + ts << "import Qt.VisualTest 4.6\n\n"; + ts << "VisualTest {\n"; + + int imgCount = 0; + QList keyevents = m_savedKeyEvents; + QList mouseevents = m_savedMouseEvents; + for (int ii = 0; ii < m_savedFrameEvents.count(); ++ii) { + const FrameEvent &fe = m_savedFrameEvents.at(ii); + ts << " Frame {\n"; + ts << " msec: " << fe.msec << "\n"; + if (!fe.hash.isEmpty()) { + ts << " hash: \"" << fe.hash.toHex() << "\"\n"; + } else if (!fe.image.isNull()) { + QString filename = filenameInfo.baseName() + "." + QString::number(imgCount) + ".png"; + fe.image.save(m_script + "." + QString::number(imgCount) + ".png"); + imgCount++; + ts << " image: \"" << filename << "\"\n"; + } + ts << " }\n"; + + while (!mouseevents.isEmpty() && + mouseevents.first().msec == fe.msec) { + MouseEvent me = mouseevents.takeFirst(); + + ts << " Mouse {\n"; + ts << " type: " << me.type << "\n"; + ts << " button: " << me.button << "\n"; + ts << " buttons: " << me.buttons << "\n"; + ts << " x: " << me.pos.x() << "; y: " << me.pos.y() << "\n"; + ts << " modifiers: " << me.modifiers << "\n"; + if (me.destination == ViewPort) + ts << " sendToViewport: true\n"; + ts << " }\n"; + } + + while (!keyevents.isEmpty() && + keyevents.first().msec == fe.msec) { + KeyEvent ke = keyevents.takeFirst(); + + ts << " Key {\n"; + ts << " type: " << ke.type << "\n"; + ts << " key: " << ke.key << "\n"; + ts << " modifiers: " << ke.modifiers << "\n"; + ts << " text: \"" << ke.text.toUtf8().toHex() << "\"\n"; + ts << " autorep: " << (ke.autorep?"true":"false") << "\n"; + ts << " count: " << ke.count << "\n"; + if (ke.destination == ViewPort) + ts << " sendToViewport: true\n"; + ts << " }\n"; + } + } + + ts << "}\n"; + file.close(); +} + +void QDeclarativeTester::updateCurrentTime(int msec) +{ + QDeclarativeItemPrivate::setConsistentTime(msec); + + QImage img(m_view->width(), m_view->height(), QImage::Format_RGB32); + + if (options & QDeclarativeViewer::TestImages) { + img.fill(qRgb(255,255,255)); + QPainter p(&img); + m_view->render(&p); + } + + FrameEvent fe; + fe.msec = msec; + if (msec == 0 || !(options & QDeclarativeViewer::TestImages)) { + // Skip first frame, skip if not doing images + } else if (0 == (m_savedFrameEvents.count() % 60)) { + fe.image = img; + } else { + QCryptographicHash hash(QCryptographicHash::Md5); + hash.addData((const char *)img.bits(), img.bytesPerLine() * img.height()); + fe.hash = hash.result(); + } + m_savedFrameEvents.append(fe); + + // Deliver mouse events + filterEvents = false; + + if (!testscript) { + for (int ii = 0; ii < m_mouseEvents.count(); ++ii) { + MouseEvent &me = m_mouseEvents[ii]; + me.msec = msec; + QMouseEvent event(me.type, me.pos, me.button, me.buttons, me.modifiers); + + if (me.destination == View) { + QCoreApplication::sendEvent(m_view, &event); + } else { + QCoreApplication::sendEvent(m_view->viewport(), &event); + } + } + + for (int ii = 0; ii < m_keyEvents.count(); ++ii) { + KeyEvent &ke = m_keyEvents[ii]; + ke.msec = msec; + QKeyEvent event(ke.type, ke.key, ke.modifiers, ke.text, ke.autorep, ke.count); + + if (ke.destination == View) { + QCoreApplication::sendEvent(m_view, &event); + } else { + QCoreApplication::sendEvent(m_view->viewport(), &event); + } + } + m_savedMouseEvents.append(m_mouseEvents); + m_savedKeyEvents.append(m_keyEvents); + } + + m_mouseEvents.clear(); + m_keyEvents.clear(); + + // Advance test script + while (testscript && testscript->count() > testscriptidx) { + + QObject *event = testscript->event(testscriptidx); + + if (QDeclarativeVisualTestFrame *frame = qobject_cast(event)) { + if (frame->msec() < msec) { + if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) { + qWarning() << "QDeclarativeTester: Extra frame. Seen:" + << msec << "Expected:" << frame->msec(); + imagefailure(); + } + } else if (frame->msec() == msec) { + if (!frame->hash().isEmpty() && frame->hash().toUtf8() != fe.hash.toHex()) { + if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) { + qWarning() << "QDeclarativeTester: Mismatched frame hash at" << msec + << ". Seen:" << fe.hash.toHex() + << "Expected:" << frame->hash().toUtf8(); + imagefailure(); + } + } + } else if (frame->msec() > msec) { + break; + } + + if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record) && !frame->image().isEmpty()) { + QImage goodImage(frame->image().toLocalFile()); + if (goodImage != img) { + QString reject(frame->image().toLocalFile() + ".reject.png"); + qWarning() << "QDeclarativeTester: Image mismatch. Reject saved to:" + << reject; + img.save(reject); + imagefailure(); + } + } + } else if (QDeclarativeVisualTestMouse *mouse = qobject_cast(event)) { + QPoint pos(mouse->x(), mouse->y()); + QPoint globalPos = m_view->mapToGlobal(QPoint(0, 0)) + pos; + QMouseEvent event((QEvent::Type)mouse->type(), pos, globalPos, (Qt::MouseButton)mouse->button(), (Qt::MouseButtons)mouse->buttons(), (Qt::KeyboardModifiers)mouse->modifiers()); + + MouseEvent me(&event); + me.msec = msec; + if (!mouse->sendToViewport()) { + QCoreApplication::sendEvent(m_view, &event); + me.destination = View; + } else { + QCoreApplication::sendEvent(m_view->viewport(), &event); + me.destination = ViewPort; + } + m_savedMouseEvents.append(me); + } else if (QDeclarativeVisualTestKey *key = qobject_cast(event)) { + + QKeyEvent event((QEvent::Type)key->type(), key->key(), (Qt::KeyboardModifiers)key->modifiers(), QString::fromUtf8(QByteArray::fromHex(key->text().toUtf8())), key->autorep(), key->count()); + + KeyEvent ke(&event); + ke.msec = msec; + if (!key->sendToViewport()) { + QCoreApplication::sendEvent(m_view, &event); + ke.destination = View; + } else { + QCoreApplication::sendEvent(m_view->viewport(), &event); + ke.destination = ViewPort; + } + m_savedKeyEvents.append(ke); + } + testscriptidx++; + } + + filterEvents = true; + + if (testscript && testscript->count() <= testscriptidx) + complete(); +} + +void QDeclarativeTester::registerTypes() +{ + qmlRegisterType("Qt.VisualTest", 4,6, "VisualTest"); + qmlRegisterType("Qt.VisualTest", 4,6, "Frame"); + qmlRegisterType("Qt.VisualTest", 4,6, "Mouse"); + qmlRegisterType("Qt.VisualTest", 4,6, "Key"); +} + +QT_END_NAMESPACE diff --git a/tools/qml/qdeclarativetester.h b/tools/qml/qdeclarativetester.h new file mode 100644 index 0000000..d49c9b8 --- /dev/null +++ b/tools/qml/qdeclarativetester.h @@ -0,0 +1,286 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications 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 QDECLARATIVETESTER_H +#define QDECLARATIVETESTER_H + +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QDeclarativeVisualTest : public QObject +{ + Q_OBJECT + Q_PROPERTY(QDeclarativeListProperty events READ events CONSTANT) + Q_CLASSINFO("DefaultProperty", "events") +public: + QDeclarativeVisualTest() {} + + QDeclarativeListProperty events() { return QDeclarativeListProperty(this, m_events); } + + int count() const { return m_events.count(); } + QObject *event(int idx) { return m_events.at(idx); } + +private: + QList m_events; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeVisualTest) + +QT_BEGIN_NAMESPACE + +class QDeclarativeVisualTestFrame : public QObject +{ + Q_OBJECT + Q_PROPERTY(int msec READ msec WRITE setMsec) + Q_PROPERTY(QString hash READ hash WRITE setHash) + Q_PROPERTY(QUrl image READ image WRITE setImage) +public: + QDeclarativeVisualTestFrame() : m_msec(-1) {} + + int msec() const { return m_msec; } + void setMsec(int m) { m_msec = m; } + + QString hash() const { return m_hash; } + void setHash(const QString &hash) { m_hash = hash; } + + QUrl image() const { return m_image; } + void setImage(const QUrl &image) { m_image = image; } + +private: + int m_msec; + QString m_hash; + QUrl m_image; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeVisualTestFrame) + +QT_BEGIN_NAMESPACE + +class QDeclarativeVisualTestMouse : public QObject +{ + Q_OBJECT + Q_PROPERTY(int type READ type WRITE setType) + Q_PROPERTY(int button READ button WRITE setButton) + Q_PROPERTY(int buttons READ buttons WRITE setButtons) + Q_PROPERTY(int x READ x WRITE setX) + Q_PROPERTY(int y READ y WRITE setY) + Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers) + Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport) +public: + QDeclarativeVisualTestMouse() : m_type(0), m_button(0), m_buttons(0), m_x(0), m_y(0), m_modifiers(0), m_viewport(false) {} + + int type() const { return m_type; } + void setType(int t) { m_type = t; } + + int button() const { return m_button; } + void setButton(int b) { m_button = b; } + + int buttons() const { return m_buttons; } + void setButtons(int b) { m_buttons = b; } + + int x() const { return m_x; } + void setX(int x) { m_x = x; } + + int y() const { return m_y; } + void setY(int y) { m_y = y; } + + int modifiers() const { return m_modifiers; } + void setModifiers(int modifiers) { m_modifiers = modifiers; } + + bool sendToViewport() const { return m_viewport; } + void setSendToViewport(bool v) { m_viewport = v; } +private: + int m_type; + int m_button; + int m_buttons; + int m_x; + int m_y; + int m_modifiers; + bool m_viewport; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeVisualTestMouse) + +QT_BEGIN_NAMESPACE + +class QDeclarativeVisualTestKey : public QObject +{ + Q_OBJECT + Q_PROPERTY(int type READ type WRITE setType) + Q_PROPERTY(int key READ key WRITE setKey) + Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers) + Q_PROPERTY(QString text READ text WRITE setText) + Q_PROPERTY(bool autorep READ autorep WRITE setAutorep) + Q_PROPERTY(int count READ count WRITE setCount) + Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport) +public: + QDeclarativeVisualTestKey() : m_type(0), m_key(0), m_modifiers(0), m_autorep(false), m_count(0), m_viewport(false) {} + + int type() const { return m_type; } + void setType(int t) { m_type = t; } + + int key() const { return m_key; } + void setKey(int k) { m_key = k; } + + int modifiers() const { return m_modifiers; } + void setModifiers(int m) { m_modifiers = m; } + + QString text() const { return m_text; } + void setText(const QString &t) { m_text = t; } + + bool autorep() const { return m_autorep; } + void setAutorep(bool a) { m_autorep = a; } + + int count() const { return m_count; } + void setCount(int c) { m_count = c; } + + bool sendToViewport() const { return m_viewport; } + void setSendToViewport(bool v) { m_viewport = v; } +private: + int m_type; + int m_key; + int m_modifiers; + QString m_text; + bool m_autorep; + int m_count; + bool m_viewport; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeVisualTestKey) + +QT_BEGIN_NAMESPACE + +class QDeclarativeTester : public QAbstractAnimation +{ +public: + QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions options, QDeclarativeView *parent); + ~QDeclarativeTester(); + + static void registerTypes(); + + virtual int duration() const; + + void run(); + void save(); + + void executefailure(); +protected: + virtual void updateCurrentTime(int msecs); + virtual bool eventFilter(QObject *, QEvent *); + +private: + QString m_script; + + void imagefailure(); + void complete(); + + enum Destination { View, ViewPort }; + void addKeyEvent(Destination, QKeyEvent *); + void addMouseEvent(Destination, QMouseEvent *); + QDeclarativeView *m_view; + + struct MouseEvent { + MouseEvent(QMouseEvent *e) + : type(e->type()), button(e->button()), buttons(e->buttons()), + pos(e->pos()), modifiers(e->modifiers()), destination(View) {} + + QEvent::Type type; + Qt::MouseButton button; + Qt::MouseButtons buttons; + QPoint pos; + Qt::KeyboardModifiers modifiers; + Destination destination; + + int msec; + }; + struct KeyEvent { + KeyEvent(QKeyEvent *e) + : type(e->type()), key(e->key()), modifiers(e->modifiers()), text(e->text()), + autorep(e->isAutoRepeat()), count(e->count()), destination(View) {} + QEvent::Type type; + int key; + Qt::KeyboardModifiers modifiers; + QString text; + bool autorep; + ushort count; + Destination destination; + + int msec; + }; + struct FrameEvent { + QImage image; + QByteArray hash; + int msec; + }; + QList m_mouseEvents; + QList m_keyEvents; + + QList m_savedMouseEvents; + QList m_savedKeyEvents; + QList m_savedFrameEvents; + bool filterEvents; + + QDeclarativeViewer::ScriptOptions options; + int testscriptidx; + QDeclarativeVisualTest *testscript; + + bool hasCompleted; + bool hasFailed; +}; + + +QT_END_NAMESPACE + +#endif // QDECLARATIVETESTER_H diff --git a/tools/qml/qfxtester.cpp b/tools/qml/qfxtester.cpp deleted file mode 100644 index 28bbf5e..0000000 --- a/tools/qml/qfxtester.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - - -QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts, - QDeclarativeView *parent) -: QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts), - testscript(0), hasCompleted(false), hasFailed(false) -{ - parent->viewport()->installEventFilter(this); - parent->installEventFilter(this); - QUnifiedTimer::instance()->setConsistentTiming(true); - if (options & QDeclarativeViewer::Play) - this->run(); - start(); -} - -QDeclarativeTester::~QDeclarativeTester() -{ - if (!hasFailed && - options & QDeclarativeViewer::Record && - options & QDeclarativeViewer::SaveOnExit) - save(); -} - -int QDeclarativeTester::duration() const -{ - return -1; -} - -void QDeclarativeTester::addMouseEvent(Destination dest, QMouseEvent *me) -{ - MouseEvent e(me); - e.destination = dest; - m_mouseEvents << e; -} - -void QDeclarativeTester::addKeyEvent(Destination dest, QKeyEvent *ke) -{ - KeyEvent e(ke); - e.destination = dest; - m_keyEvents << e; -} - -bool QDeclarativeTester::eventFilter(QObject *o, QEvent *e) -{ - if (!filterEvents) - return false; - - Destination destination; - if (o == m_view) { - destination = View; - } else if (o == m_view->viewport()) { - destination = ViewPort; - } else { - return false; - } - - switch (e->type()) { - case QEvent::KeyPress: - case QEvent::KeyRelease: - addKeyEvent(destination, (QKeyEvent *)e); - return true; - case QEvent::MouseButtonPress: - case QEvent::MouseButtonRelease: - case QEvent::MouseMove: - case QEvent::MouseButtonDblClick: - addMouseEvent(destination, (QMouseEvent *)e); - return true; - default: - break; - } - return false; -} - -void QDeclarativeTester::executefailure() -{ - hasFailed = true; - - if (options & QDeclarativeViewer::ExitOnFailure) - exit(-1); -} - -void QDeclarativeTester::imagefailure() -{ - hasFailed = true; - - if (options & QDeclarativeViewer::ExitOnFailure) - exit(-1); -} - -void QDeclarativeTester::complete() -{ - if ((options & QDeclarativeViewer::TestErrorProperty) && !hasFailed) { - QString e = m_view->rootObject()->property("error").toString(); - if (!e.isEmpty()) { - qWarning() << "Test failed:" << e; - hasFailed = true; - } - } - if (options & QDeclarativeViewer::ExitOnComplete) - QApplication::exit(hasFailed?-1:0); - - if (hasCompleted) - return; - hasCompleted = true; - - if (options & QDeclarativeViewer::Play) - qWarning("Script playback complete"); -} - -void QDeclarativeTester::run() -{ - QDeclarativeComponent c(m_view->engine(), m_script + QLatin1String(".qml")); - - testscript = qobject_cast(c.create()); - if (testscript) testscript->setParent(this); - else { executefailure(); exit(-1); } - testscriptidx = 0; -} - -void QDeclarativeTester::save() -{ - QString filename = m_script + QLatin1String(".qml"); - QFileInfo filenameInfo(filename); - QDir saveDir = filenameInfo.absoluteDir(); - saveDir.mkpath("."); - - QFile file(filename); - file.open(QIODevice::WriteOnly); - QTextStream ts(&file); - - ts << "import Qt.VisualTest 4.6\n\n"; - ts << "VisualTest {\n"; - - int imgCount = 0; - QList keyevents = m_savedKeyEvents; - QList mouseevents = m_savedMouseEvents; - for (int ii = 0; ii < m_savedFrameEvents.count(); ++ii) { - const FrameEvent &fe = m_savedFrameEvents.at(ii); - ts << " Frame {\n"; - ts << " msec: " << fe.msec << "\n"; - if (!fe.hash.isEmpty()) { - ts << " hash: \"" << fe.hash.toHex() << "\"\n"; - } else if (!fe.image.isNull()) { - QString filename = filenameInfo.baseName() + "." + QString::number(imgCount) + ".png"; - fe.image.save(m_script + "." + QString::number(imgCount) + ".png"); - imgCount++; - ts << " image: \"" << filename << "\"\n"; - } - ts << " }\n"; - - while (!mouseevents.isEmpty() && - mouseevents.first().msec == fe.msec) { - MouseEvent me = mouseevents.takeFirst(); - - ts << " Mouse {\n"; - ts << " type: " << me.type << "\n"; - ts << " button: " << me.button << "\n"; - ts << " buttons: " << me.buttons << "\n"; - ts << " x: " << me.pos.x() << "; y: " << me.pos.y() << "\n"; - ts << " modifiers: " << me.modifiers << "\n"; - if (me.destination == ViewPort) - ts << " sendToViewport: true\n"; - ts << " }\n"; - } - - while (!keyevents.isEmpty() && - keyevents.first().msec == fe.msec) { - KeyEvent ke = keyevents.takeFirst(); - - ts << " Key {\n"; - ts << " type: " << ke.type << "\n"; - ts << " key: " << ke.key << "\n"; - ts << " modifiers: " << ke.modifiers << "\n"; - ts << " text: \"" << ke.text.toUtf8().toHex() << "\"\n"; - ts << " autorep: " << (ke.autorep?"true":"false") << "\n"; - ts << " count: " << ke.count << "\n"; - if (ke.destination == ViewPort) - ts << " sendToViewport: true\n"; - ts << " }\n"; - } - } - - ts << "}\n"; - file.close(); -} - -void QDeclarativeTester::updateCurrentTime(int msec) -{ - QDeclarativeItemPrivate::setConsistentTime(msec); - - QImage img(m_view->width(), m_view->height(), QImage::Format_RGB32); - - if (options & QDeclarativeViewer::TestImages) { - img.fill(qRgb(255,255,255)); - QPainter p(&img); - m_view->render(&p); - } - - FrameEvent fe; - fe.msec = msec; - if (msec == 0 || !(options & QDeclarativeViewer::TestImages)) { - // Skip first frame, skip if not doing images - } else if (0 == (m_savedFrameEvents.count() % 60)) { - fe.image = img; - } else { - QCryptographicHash hash(QCryptographicHash::Md5); - hash.addData((const char *)img.bits(), img.bytesPerLine() * img.height()); - fe.hash = hash.result(); - } - m_savedFrameEvents.append(fe); - - // Deliver mouse events - filterEvents = false; - - if (!testscript) { - for (int ii = 0; ii < m_mouseEvents.count(); ++ii) { - MouseEvent &me = m_mouseEvents[ii]; - me.msec = msec; - QMouseEvent event(me.type, me.pos, me.button, me.buttons, me.modifiers); - - if (me.destination == View) { - QCoreApplication::sendEvent(m_view, &event); - } else { - QCoreApplication::sendEvent(m_view->viewport(), &event); - } - } - - for (int ii = 0; ii < m_keyEvents.count(); ++ii) { - KeyEvent &ke = m_keyEvents[ii]; - ke.msec = msec; - QKeyEvent event(ke.type, ke.key, ke.modifiers, ke.text, ke.autorep, ke.count); - - if (ke.destination == View) { - QCoreApplication::sendEvent(m_view, &event); - } else { - QCoreApplication::sendEvent(m_view->viewport(), &event); - } - } - m_savedMouseEvents.append(m_mouseEvents); - m_savedKeyEvents.append(m_keyEvents); - } - - m_mouseEvents.clear(); - m_keyEvents.clear(); - - // Advance test script - while (testscript && testscript->count() > testscriptidx) { - - QObject *event = testscript->event(testscriptidx); - - if (QDeclarativeVisualTestFrame *frame = qobject_cast(event)) { - if (frame->msec() < msec) { - if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) { - qWarning() << "QDeclarativeTester: Extra frame. Seen:" - << msec << "Expected:" << frame->msec(); - imagefailure(); - } - } else if (frame->msec() == msec) { - if (!frame->hash().isEmpty() && frame->hash().toUtf8() != fe.hash.toHex()) { - if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) { - qWarning() << "QDeclarativeTester: Mismatched frame hash. Seen:" - << fe.hash.toHex() << "Expected:" - << frame->hash().toUtf8(); - imagefailure(); - } - } - } else if (frame->msec() > msec) { - break; - } - - if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record) && !frame->image().isEmpty()) { - QImage goodImage(frame->image().toLocalFile()); - if (goodImage != img) { - QString reject(frame->image().toLocalFile() + ".reject.png"); - qWarning() << "QDeclarativeTester: Image mismatch. Reject saved to:" - << reject; - img.save(reject); - imagefailure(); - } - } - } else if (QDeclarativeVisualTestMouse *mouse = qobject_cast(event)) { - QPoint pos(mouse->x(), mouse->y()); - QPoint globalPos = m_view->mapToGlobal(QPoint(0, 0)) + pos; - QMouseEvent event((QEvent::Type)mouse->type(), pos, globalPos, (Qt::MouseButton)mouse->button(), (Qt::MouseButtons)mouse->buttons(), (Qt::KeyboardModifiers)mouse->modifiers()); - - MouseEvent me(&event); - me.msec = msec; - if (!mouse->sendToViewport()) { - QCoreApplication::sendEvent(m_view, &event); - me.destination = View; - } else { - QCoreApplication::sendEvent(m_view->viewport(), &event); - me.destination = ViewPort; - } - m_savedMouseEvents.append(me); - } else if (QDeclarativeVisualTestKey *key = qobject_cast(event)) { - - QKeyEvent event((QEvent::Type)key->type(), key->key(), (Qt::KeyboardModifiers)key->modifiers(), QString::fromUtf8(QByteArray::fromHex(key->text().toUtf8())), key->autorep(), key->count()); - - KeyEvent ke(&event); - ke.msec = msec; - if (!key->sendToViewport()) { - QCoreApplication::sendEvent(m_view, &event); - ke.destination = View; - } else { - QCoreApplication::sendEvent(m_view->viewport(), &event); - ke.destination = ViewPort; - } - m_savedKeyEvents.append(ke); - } - testscriptidx++; - } - - filterEvents = true; - - if (testscript && testscript->count() <= testscriptidx) - complete(); -} - -void QDeclarativeTester::registerTypes() -{ - qmlRegisterType("Qt.VisualTest", 4,6, "VisualTest"); - qmlRegisterType("Qt.VisualTest", 4,6, "Frame"); - qmlRegisterType("Qt.VisualTest", 4,6, "Mouse"); - qmlRegisterType("Qt.VisualTest", 4,6, "Key"); -} - -QT_END_NAMESPACE diff --git a/tools/qml/qfxtester.h b/tools/qml/qfxtester.h deleted file mode 100644 index 6521409..0000000 --- a/tools/qml/qfxtester.h +++ /dev/null @@ -1,286 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications 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 QFXTESTER_H -#define QFXTESTER_H - -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QDeclarativeVisualTest : public QObject -{ - Q_OBJECT - Q_PROPERTY(QDeclarativeListProperty events READ events CONSTANT) - Q_CLASSINFO("DefaultProperty", "events") -public: - QDeclarativeVisualTest() {} - - QDeclarativeListProperty events() { return QDeclarativeListProperty(this, m_events); } - - int count() const { return m_events.count(); } - QObject *event(int idx) { return m_events.at(idx); } - -private: - QList m_events; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeVisualTest) - -QT_BEGIN_NAMESPACE - -class QDeclarativeVisualTestFrame : public QObject -{ - Q_OBJECT - Q_PROPERTY(int msec READ msec WRITE setMsec) - Q_PROPERTY(QString hash READ hash WRITE setHash) - Q_PROPERTY(QUrl image READ image WRITE setImage) -public: - QDeclarativeVisualTestFrame() : m_msec(-1) {} - - int msec() const { return m_msec; } - void setMsec(int m) { m_msec = m; } - - QString hash() const { return m_hash; } - void setHash(const QString &hash) { m_hash = hash; } - - QUrl image() const { return m_image; } - void setImage(const QUrl &image) { m_image = image; } - -private: - int m_msec; - QString m_hash; - QUrl m_image; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeVisualTestFrame) - -QT_BEGIN_NAMESPACE - -class QDeclarativeVisualTestMouse : public QObject -{ - Q_OBJECT - Q_PROPERTY(int type READ type WRITE setType) - Q_PROPERTY(int button READ button WRITE setButton) - Q_PROPERTY(int buttons READ buttons WRITE setButtons) - Q_PROPERTY(int x READ x WRITE setX) - Q_PROPERTY(int y READ y WRITE setY) - Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers) - Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport) -public: - QDeclarativeVisualTestMouse() : m_type(0), m_button(0), m_buttons(0), m_x(0), m_y(0), m_modifiers(0), m_viewport(false) {} - - int type() const { return m_type; } - void setType(int t) { m_type = t; } - - int button() const { return m_button; } - void setButton(int b) { m_button = b; } - - int buttons() const { return m_buttons; } - void setButtons(int b) { m_buttons = b; } - - int x() const { return m_x; } - void setX(int x) { m_x = x; } - - int y() const { return m_y; } - void setY(int y) { m_y = y; } - - int modifiers() const { return m_modifiers; } - void setModifiers(int modifiers) { m_modifiers = modifiers; } - - bool sendToViewport() const { return m_viewport; } - void setSendToViewport(bool v) { m_viewport = v; } -private: - int m_type; - int m_button; - int m_buttons; - int m_x; - int m_y; - int m_modifiers; - bool m_viewport; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeVisualTestMouse) - -QT_BEGIN_NAMESPACE - -class QDeclarativeVisualTestKey : public QObject -{ - Q_OBJECT - Q_PROPERTY(int type READ type WRITE setType) - Q_PROPERTY(int key READ key WRITE setKey) - Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers) - Q_PROPERTY(QString text READ text WRITE setText) - Q_PROPERTY(bool autorep READ autorep WRITE setAutorep) - Q_PROPERTY(int count READ count WRITE setCount) - Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport) -public: - QDeclarativeVisualTestKey() : m_type(0), m_key(0), m_modifiers(0), m_autorep(false), m_count(0), m_viewport(false) {} - - int type() const { return m_type; } - void setType(int t) { m_type = t; } - - int key() const { return m_key; } - void setKey(int k) { m_key = k; } - - int modifiers() const { return m_modifiers; } - void setModifiers(int m) { m_modifiers = m; } - - QString text() const { return m_text; } - void setText(const QString &t) { m_text = t; } - - bool autorep() const { return m_autorep; } - void setAutorep(bool a) { m_autorep = a; } - - int count() const { return m_count; } - void setCount(int c) { m_count = c; } - - bool sendToViewport() const { return m_viewport; } - void setSendToViewport(bool v) { m_viewport = v; } -private: - int m_type; - int m_key; - int m_modifiers; - QString m_text; - bool m_autorep; - int m_count; - bool m_viewport; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeVisualTestKey) - -QT_BEGIN_NAMESPACE - -class QDeclarativeTester : public QAbstractAnimation -{ -public: - QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions options, QDeclarativeView *parent); - ~QDeclarativeTester(); - - static void registerTypes(); - - virtual int duration() const; - - void run(); - void save(); - - void executefailure(); -protected: - virtual void updateCurrentTime(int msecs); - virtual bool eventFilter(QObject *, QEvent *); - -private: - QString m_script; - - void imagefailure(); - void complete(); - - enum Destination { View, ViewPort }; - void addKeyEvent(Destination, QKeyEvent *); - void addMouseEvent(Destination, QMouseEvent *); - QDeclarativeView *m_view; - - struct MouseEvent { - MouseEvent(QMouseEvent *e) - : type(e->type()), button(e->button()), buttons(e->buttons()), - pos(e->pos()), modifiers(e->modifiers()), destination(View) {} - - QEvent::Type type; - Qt::MouseButton button; - Qt::MouseButtons buttons; - QPoint pos; - Qt::KeyboardModifiers modifiers; - Destination destination; - - int msec; - }; - struct KeyEvent { - KeyEvent(QKeyEvent *e) - : type(e->type()), key(e->key()), modifiers(e->modifiers()), text(e->text()), - autorep(e->isAutoRepeat()), count(e->count()), destination(View) {} - QEvent::Type type; - int key; - Qt::KeyboardModifiers modifiers; - QString text; - bool autorep; - ushort count; - Destination destination; - - int msec; - }; - struct FrameEvent { - QImage image; - QByteArray hash; - int msec; - }; - QList m_mouseEvents; - QList m_keyEvents; - - QList m_savedMouseEvents; - QList m_savedKeyEvents; - QList m_savedFrameEvents; - bool filterEvents; - - QDeclarativeViewer::ScriptOptions options; - int testscriptidx; - QDeclarativeVisualTest *testscript; - - bool hasCompleted; - bool hasFailed; -}; - - -QT_END_NAMESPACE - -#endif // QFXTESTER_H diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index a7eb6f5..ba283b6 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -15,13 +15,13 @@ contains(QT_CONFIG, opengl) { # Input HEADERS += qmlruntime.h \ proxysettings.h \ - qfxtester.h \ + qdeclarativetester.h \ deviceorientation.h \ qdeclarativefolderlistmodel.h SOURCES += main.cpp \ qmlruntime.cpp \ proxysettings.cpp \ - qfxtester.cpp \ + qdeclarativetester.cpp \ qdeclarativefolderlistmodel.cpp RESOURCES = qmlruntime.qrc maemo5 { diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 44cab97..1ab528e 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -95,7 +95,7 @@ #include #endif -#include +#include #if defined (Q_OS_SYMBIAN) #define SYMBIAN_NETWORK_INIT -- cgit v0.12 From 6905c23c8363ce3f6698b0bc81dc81eef0f8de20 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 31 Mar 2010 14:25:23 +1000 Subject: Improve flipable example. --- doc/src/snippets/declarative/flipable.qml | 37 +++++++++++++++++++ examples/declarative/flipable/back.png | Bin 5048 -> 0 bytes examples/declarative/flipable/content/5_heart.png | Bin 0 -> 3872 bytes examples/declarative/flipable/content/9_club.png | Bin 0 -> 6135 bytes examples/declarative/flipable/content/Card.qml | 38 ++++++++++++++++++++ examples/declarative/flipable/content/back.png | Bin 0 -> 1418 bytes examples/declarative/flipable/flipable-example.qml | 40 +++++---------------- examples/declarative/flipable/front.png | Bin 6431 -> 0 bytes .../graphicsitems/qdeclarativeflipable.cpp | 2 +- 9 files changed, 84 insertions(+), 33 deletions(-) create mode 100644 doc/src/snippets/declarative/flipable.qml delete mode 100644 examples/declarative/flipable/back.png create mode 100644 examples/declarative/flipable/content/5_heart.png create mode 100644 examples/declarative/flipable/content/9_club.png create mode 100644 examples/declarative/flipable/content/Card.qml create mode 100644 examples/declarative/flipable/content/back.png delete mode 100644 examples/declarative/flipable/front.png diff --git a/doc/src/snippets/declarative/flipable.qml b/doc/src/snippets/declarative/flipable.qml new file mode 100644 index 0000000..c837ebc --- /dev/null +++ b/doc/src/snippets/declarative/flipable.qml @@ -0,0 +1,37 @@ +//! [0] +import Qt 4.6 + +Flipable { + id: flipable + width: 240 + height: 240 + + property int angle: 0 + property bool flipped: false + + front: Image { source: "front.png" } + back: Image { source: "back.png" } + + transform: Rotation { + origin.x: flipable.width/2; origin.y: flipable.height/2 + axis.x: 0; axis.y: 1; axis.z: 0 // rotate around y-axis + angle: flipable.angle + } + + states: State { + name: "back" + PropertyChanges { target: flipable; angle: 180 } + when: flipable.flipped + } + + transitions: Transition { + NumberAnimation { properties: "angle"; duration: 1000 } + } + + MouseArea { + anchors.fill: parent + onClicked: flipable.flipped = !flipable.flipped + } +} +//! [0] + diff --git a/examples/declarative/flipable/back.png b/examples/declarative/flipable/back.png deleted file mode 100644 index 0b4cafc..0000000 Binary files a/examples/declarative/flipable/back.png and /dev/null differ diff --git a/examples/declarative/flipable/content/5_heart.png b/examples/declarative/flipable/content/5_heart.png new file mode 100644 index 0000000..fb59d81 Binary files /dev/null and b/examples/declarative/flipable/content/5_heart.png differ diff --git a/examples/declarative/flipable/content/9_club.png b/examples/declarative/flipable/content/9_club.png new file mode 100644 index 0000000..2545001 Binary files /dev/null and b/examples/declarative/flipable/content/9_club.png differ diff --git a/examples/declarative/flipable/content/Card.qml b/examples/declarative/flipable/content/Card.qml new file mode 100644 index 0000000..6b8fa69 --- /dev/null +++ b/examples/declarative/flipable/content/Card.qml @@ -0,0 +1,38 @@ +import Qt 4.6 + +Flipable { + id: container + + property alias image: frontImage.source + property bool flipped: true + property int xAxis: 0 + property int yAxis: 0 + property int angle: 0 + + width: front.width; height: front.height; state: "back" + + front: Image { id: frontImage; smooth: true } + back: Image { source: "back.png"; smooth: true } + + MouseArea { anchors.fill: parent; onClicked: container.flipped = !container.flipped } + + transform: Rotation { + id: rotation; origin.x: container.width / 2; origin.y: container.height / 2 + axis.x: container.xAxis; axis.y: container.yAxis; axis.z: 0 + } + + states: State { + name: "back"; when: container.flipped + PropertyChanges { target: rotation; angle: container.angle } + } + + transitions: Transition { + ParallelAnimation { + NumberAnimation { target: rotation; properties: "angle"; duration: 600 } + SequentialAnimation { + NumberAnimation { target: container; property: "scale"; to: 0.75; duration: 300 } + NumberAnimation { target: container; property: "scale"; to: 1.0; duration: 300 } + } + } + } +} diff --git a/examples/declarative/flipable/content/back.png b/examples/declarative/flipable/content/back.png new file mode 100644 index 0000000..f715d74 Binary files /dev/null and b/examples/declarative/flipable/content/back.png differ diff --git a/examples/declarative/flipable/flipable-example.qml b/examples/declarative/flipable/flipable-example.qml index c837ebc..eebc721 100644 --- a/examples/declarative/flipable/flipable-example.qml +++ b/examples/declarative/flipable/flipable-example.qml @@ -1,37 +1,13 @@ -//! [0] import Qt 4.6 +import "content" -Flipable { - id: flipable - width: 240 - height: 240 +Rectangle { + id: window; width: 480; height: 320 + color: "darkgreen" - property int angle: 0 - property bool flipped: false - - front: Image { source: "front.png" } - back: Image { source: "back.png" } - - transform: Rotation { - origin.x: flipable.width/2; origin.y: flipable.height/2 - axis.x: 0; axis.y: 1; axis.z: 0 // rotate around y-axis - angle: flipable.angle - } - - states: State { - name: "back" - PropertyChanges { target: flipable; angle: 180 } - when: flipable.flipped - } - - transitions: Transition { - NumberAnimation { properties: "angle"; duration: 1000 } - } - - MouseArea { - anchors.fill: parent - onClicked: flipable.flipped = !flipable.flipped + Row { + anchors.centerIn: parent; spacing: 30 + Card { image: "content/9_club.png"; angle: 180; yAxis: 1 } + Card { image: "content/5_heart.png"; angle: 540; xAxis: 1 } } } -//! [0] - diff --git a/examples/declarative/flipable/front.png b/examples/declarative/flipable/front.png deleted file mode 100644 index 796b605..0000000 Binary files a/examples/declarative/flipable/front.png and /dev/null differ diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index e670d3e..ccefc70 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -75,7 +75,7 @@ public: Here is a Flipable that flips whenever it is clicked: - \snippet examples/declarative/flipable/flipable-example.qml 0 + \snippet doc/src/snippets/declarative/flipable.qml 0 \image flipable.gif -- cgit v0.12 From 8ee60825b4fa864ef0f826e6452a6340ed8ebb86 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 31 Mar 2010 14:26:52 +1000 Subject: Minor cleanup. --- examples/declarative/clocks/clocks.qml | 7 +++---- examples/declarative/clocks/content/Clock.qml | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/declarative/clocks/clocks.qml b/examples/declarative/clocks/clocks.qml index 624748a..c5aa1dc 100644 --- a/examples/declarative/clocks/clocks.qml +++ b/examples/declarative/clocks/clocks.qml @@ -2,12 +2,11 @@ import Qt 4.6 import "content" Rectangle { - width: childrenRect.width - height: childrenRect.height + width: 640; height: 240 color: "#646464" - Grid { - columns: 3 + Row { + anchors.centerIn: parent Clock { city: "New York"; shift: -4 } Clock { city: "Mumbai"; shift: 5.5 } Clock { city: "Tokyo"; shift: 9 } diff --git a/examples/declarative/clocks/content/Clock.qml b/examples/declarative/clocks/content/Clock.qml index 75a1cf5..90c6be8 100644 --- a/examples/declarative/clocks/content/Clock.qml +++ b/examples/declarative/clocks/content/Clock.qml @@ -74,7 +74,7 @@ Item { } Text { - id: cityLabel; font.bold: true; font.pixelSize: 14; y:200; color: "white" - anchors.horizontalCenter: parent.horizontalCenter + id: cityLabel; font.bold: true; font.pixelSize: 14; y: 200; color: "white" + anchors.horizontalCenter: parent.horizontalCenter; style: Text.Raised; styleColor: "black" } } -- cgit v0.12 From e178cf86ff5007d5af31181d064b1bf824ffbc33 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 31 Mar 2010 15:27:17 +1000 Subject: Fix snapping in listview. --- .../graphicsitems/qdeclarativegridview.cpp | 4 +- .../graphicsitems/qdeclarativelistview.cpp | 46 +++++++++++++++------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 12ede34..30f04f6 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -815,7 +815,7 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m if (snapMode != QDeclarativeGridView::SnapToRow && highlightRange != QDeclarativeGridView::StrictlyEnforceRange) data.flickTarget = maxExtent; } - if ((maxDistance > 0 || overShoot) && (snapMode != QDeclarativeGridView::NoSnap || highlightRange == QDeclarativeGridView::StrictlyEnforceRange)) { + if (maxDistance > 0 || overShoot) { // This mode requires the grid to stop exactly on a row boundary. qreal v = velocity; if (maxVelocity != -1 && maxVelocity < qAbs(v)) { @@ -1856,6 +1856,8 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count) if (d->currentItem) d->currentItem->index = d->currentIndex; emit currentIndexChanged(); + } else if (d->currentIndex < 0) { + d->updateCurrent(0); } emit countChanged(); return; diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index cbf8eac..308612f 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -305,7 +305,7 @@ public: if (item->index == -1) continue; qreal itemTop = item->position(); - if (item->index == model->count()-1 || (itemTop+item->size()/2 >= pos)) + if (itemTop+item->size()/2 >= pos && itemTop <= pos) return item->position(); } if (visibleItems.count()) { @@ -1153,7 +1153,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m maxDistance = qAbs(minExtent - data.move.value()); } } - if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange) + if (snapMode == QDeclarativeListView::NoSnap && highlightRange != QDeclarativeListView::StrictlyEnforceRange) data.flickTarget = minExtent; } else { if (data.move.value() > maxExtent) { @@ -1164,10 +1164,10 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m maxDistance = qAbs(maxExtent - data.move.value()); } } - if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange) + if (snapMode == QDeclarativeListView::NoSnap && highlightRange != QDeclarativeListView::StrictlyEnforceRange) data.flickTarget = maxExtent; } - if ((maxDistance > 0 || overShoot) && (snapMode != QDeclarativeListView::NoSnap || highlightRange == QDeclarativeListView::StrictlyEnforceRange)) { + if (maxDistance > 0 || overShoot) { // These modes require the list to stop exactly on an item boundary. // The initial flick will estimate the boundary to stop on. // Since list items can have variable sizes, the boundary will be @@ -1183,18 +1183,35 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m // the initial flick - estimate boundary qreal accel = deceleration; qreal v2 = v * v; - if (maxDistance > 0.0 && v2 / (2.0f * maxDistance) < accel) { - // + averageSize/4 to encourage moving at least one item in the flick direction - qreal dist = v2 / (accel * 2.0) + averageSize/4; - if (v > 0) - dist = -dist; + overshootDist = 0.0; + // + averageSize/4 to encourage moving at least one item in the flick direction + qreal dist = v2 / (accel * 2.0) + averageSize/4; + if (maxDistance > 0) + dist = qMin(dist, maxDistance); + if (v > 0) + dist = -dist; + if ((maxDistance > 0.0 && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeListView::SnapOneItem) { data.flickTarget = -snapPosAt(-(data.move.value() - highlightRangeStart) + dist) + highlightRangeStart; + if (overShoot) { + if (data.flickTarget >= minExtent) { + overshootDist = overShootDistance(v, vSize); + data.flickTarget += overshootDist; + } else if (data.flickTarget <= maxExtent) { + overshootDist = overShootDistance(v, vSize); + data.flickTarget -= overshootDist; + } + } dist = -data.flickTarget + data.move.value(); accel = v2 / (2.0f * qAbs(dist)); - overshootDist = 0.0; - } else { - data.flickTarget = velocity > 0 ? minExtent : maxExtent; - overshootDist = overShoot ? overShootDistance(v, vSize) : 0; + } else if (overShoot) { + data.flickTarget = data.move.value() - dist; + if (data.flickTarget >= minExtent) { + overshootDist = overShootDistance(v, vSize); + data.flickTarget += overshootDist; + } else if (data.flickTarget <= maxExtent) { + overshootDist = overShootDistance(v, vSize); + data.flickTarget -= overshootDist; + } } timeline.reset(data.move); timeline.accel(data.move, v, accel, maxDistance + overshootDist); @@ -2381,6 +2398,8 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) if (d->currentItem) d->currentItem->index = d->currentIndex; emit currentIndexChanged(); + } else if (d->currentIndex < 0) { + d->updateCurrent(0); } emit countChanged(); return; @@ -2743,7 +2762,6 @@ void QDeclarativeListView::destroyingItem(QDeclarativeItem *item) void QDeclarativeListView::animStopped() { Q_D(QDeclarativeListView); - d->moveReason = QDeclarativeListViewPrivate::Other; d->bufferMode = QDeclarativeListViewPrivate::NoBuffer; } -- cgit v0.12 From a795a55cf2796a44cf30e002962ebad0588ef740 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 31 Mar 2010 08:36:16 +0200 Subject: QGraphicsEffect : Don't rely on the exposedArea when rendering the item into the cache. I forgot to change this line during fcb738161efc965e91c3d528c31ac77d3a05ac64 Task-number:QTBUG-9496 Reviewed-by:sroedal --- src/gui/graphicsview/qgraphicsitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index e5471b0..20c9faa 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -11054,7 +11054,7 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP &newEffectTransform, false, true); } else if (deviceCoordinates) { // Device coordinates with info. - scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, info->exposedRegion, + scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, 0, info->widget, info->opacity, &effectTransform, info->wasDirtySceneTransform, info->drawItem); } else { -- cgit v0.12 From 93135ba7f52e0ccbbcd8bda390a69d089da62b83 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 31 Mar 2010 12:12:43 +0200 Subject: Revert 4.6 commits that shouldn't be in 4.7. Commits reverted: 880e4935410769b8337d75f219bef70493c4bb2c 82a306e7dda06909801f576bbbbebb59dc41c563 6cb935dd89a391f792f8ad42012b5c7c38712f17 ebd1c45822aca087be994c898cfb01cd41599429 4e4c0055d59978850796ff8c1b5015e17459e8d2 --- src/gui/graphicsview/qgraphicsitem.cpp | 103 +++++++++++++++++++++ src/gui/graphicsview/qgraphicsitem.h | 7 ++ src/gui/graphicsview/qgraphicsitem_p.h | 68 ++++++++++++++ src/gui/graphicsview/qgraphicswidget.cpp | 15 ++- src/gui/graphicsview/qgraphicswidget.h | 2 + src/gui/graphicsview/qgraphicswidget_p.cpp | 51 ++++++++++ src/gui/graphicsview/qgraphicswidget_p.h | 9 ++ tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 35 ++++++- 8 files changed, 287 insertions(+), 3 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 65ccf72..e5471b0 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -5248,6 +5248,8 @@ void QGraphicsItemPrivate::addChild(QGraphicsItem *child) needSortChildren = 1; // ### maybe 0 child->d_ptr->siblingIndex = children.size(); children.append(child); + if (isObject) + emit static_cast(q_ptr)->childrenChanged(); } /*! @@ -5270,6 +5272,8 @@ void QGraphicsItemPrivate::removeChild(QGraphicsItem *child) // the child is not guaranteed to be at the index after the list is sorted. // (see ensureSortedChildren()). child->d_ptr->siblingIndex = -1; + if (isObject) + emit static_cast(q_ptr)->childrenChanged(); } /*! @@ -7477,6 +7481,88 @@ void QGraphicsObject::ungrabGesture(Qt::GestureType gesture) } } +void QGraphicsItemPrivate::append(QDeclarativeListProperty *list, QGraphicsObject *item) +{ + QGraphicsItemPrivate::get(item)->setParentItemHelper(static_cast(list->object), /*newParentVariant=*/0, /*thisPointerVariant=*/0); +} + +/*! + Returns a list of this item's children. + + The items are sorted by stacking order. This takes into account both the + items' insertion order and their Z-values. + +*/ +QDeclarativeListProperty QGraphicsItemPrivate::childrenList() +{ + Q_Q(QGraphicsItem); + if (isObject) { + QGraphicsObject *that = static_cast(q); + return QDeclarativeListProperty(that, &children, QGraphicsItemPrivate::append); + } else { + //QGraphicsItem is not supported for this property + return QDeclarativeListProperty(); + } +} + +/*! + \internal + Returns the width of the item + Reimplemented by QGraphicsWidget +*/ +qreal QGraphicsItemPrivate::width() const +{ + return 0; +} + +/*! + \internal + Set the width of the item + Reimplemented by QGraphicsWidget +*/ +void QGraphicsItemPrivate::setWidth(qreal w) +{ + Q_UNUSED(w); +} + +/*! + \internal + Reset the width of the item + Reimplemented by QGraphicsWidget +*/ +void QGraphicsItemPrivate::resetWidth() +{ +} + +/*! + \internal + Returns the height of the item + Reimplemented by QGraphicsWidget +*/ +qreal QGraphicsItemPrivate::height() const +{ + return 0; +} + +/*! + \internal + Set the height of the item + Reimplemented by QGraphicsWidget +*/ +void QGraphicsItemPrivate::setHeight(qreal h) +{ + Q_UNUSED(h); +} + +/*! + \internal + Reset the height of the item + Reimplemented by QGraphicsWidget +*/ +void QGraphicsItemPrivate::resetHeight() +{ +} + /*! \property QGraphicsObject::parent \brief the parent of the item @@ -7663,6 +7749,23 @@ void QGraphicsObject::ungrabGesture(Qt::GestureType gesture) \sa scale, rotation, QGraphicsItem::transformOriginPoint() */ +/*! + \fn void QGraphicsObject::widthChanged() + \internal +*/ + +/*! + \fn void QGraphicsObject::heightChanged() + \internal +*/ + +/*! + + \fn QGraphicsObject::childrenChanged() + + This signal gets emitted whenever the children list changes + \internal +*/ /*! \class QAbstractGraphicsShapeItem diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 56f94a2..22be64c 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -547,6 +547,10 @@ class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint) + Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), QDeclarativeListProperty children READ childrenList DESIGNABLE false NOTIFY childrenChanged) + Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), qreal width READ width WRITE setWidth NOTIFY widthChanged RESET resetWidth FINAL) + Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), qreal height READ height WRITE setHeight NOTIFY heightChanged RESET resetHeight FINAL) + Q_CLASSINFO("DefaultProperty", "children") Q_INTERFACES(QGraphicsItem) public: QGraphicsObject(QGraphicsItem *parent = 0); @@ -571,6 +575,9 @@ Q_SIGNALS: void zChanged(); void rotationChanged(); void scaleChanged(); + void childrenChanged(); + void widthChanged(); + void heightChanged(); protected: QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index c256f63..73b8f04 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -71,6 +71,63 @@ QT_BEGIN_NAMESPACE class QGraphicsItemPrivate; +#ifndef QDECLARATIVELISTPROPERTY +#define QDECLARATIVELISTPROPERTY +template +class QDeclarativeListProperty { +public: + typedef void (*AppendFunction)(QDeclarativeListProperty *, T*); + typedef int (*CountFunction)(QDeclarativeListProperty *); + typedef T *(*AtFunction)(QDeclarativeListProperty *, int); + typedef void (*ClearFunction)(QDeclarativeListProperty *); + + QDeclarativeListProperty() + : object(0), data(0), append(0), count(0), at(0), clear(0), dummy1(0), dummy2(0) {} + QDeclarativeListProperty(QObject *o, QList &list) + : object(o), data(&list), append(qlist_append), count(qlist_count), at(qlist_at), + clear(qlist_clear), dummy1(0), dummy2(0) {} + QDeclarativeListProperty(QObject *o, void *d, AppendFunction a, CountFunction c = 0, AtFunction t = 0, + ClearFunction r = 0) + : object(o), data(d), append(a), count(c), at(t), clear(r), dummy1(0), dummy2(0) {} + + bool operator==(const QDeclarativeListProperty &o) const { + return object == o.object && + data == o.data && + append == o.append && + count == o.count && + at == o.at && + clear == o.clear; + } + + QObject *object; + void *data; + + AppendFunction append; + + CountFunction count; + AtFunction at; + + ClearFunction clear; + + void *dummy1; + void *dummy2; + +private: + static void qlist_append(QDeclarativeListProperty *p, T *v) { + ((QList *)p->data)->append(v); + } + static int qlist_count(QDeclarativeListProperty *p) { + return ((QList *)p->data)->count(); + } + static T *qlist_at(QDeclarativeListProperty *p, int idx) { + return ((QList *)p->data)->at(idx); + } + static void qlist_clear(QDeclarativeListProperty *p) { + return ((QList *)p->data)->clear(); + } +}; +#endif + class QGraphicsItemCache { public: @@ -238,6 +295,7 @@ public: void resolveDepth(); void addChild(QGraphicsItem *child); void removeChild(QGraphicsItem *child); + QDeclarativeListProperty childrenList(); void setParentItemHelper(QGraphicsItem *parent, const QVariant *newParentVariant, const QVariant *thisPointerVariant); void childrenBoundingRectHelper(QTransform *x, QRectF *rect); @@ -424,11 +482,21 @@ public: inline QTransform transformToParent() const; inline void ensureSortedChildren(); + static void append(QDeclarativeListProperty *list, QGraphicsObject *item); static inline bool insertionOrder(QGraphicsItem *a, QGraphicsItem *b); void ensureSequentialSiblingIndex(); inline void sendScenePosChange(); virtual void siblingOrderChange(); + // Private Properties + virtual qreal width() const; + virtual void setWidth(qreal); + virtual void resetWidth(); + + virtual qreal height() const; + virtual void setHeight(qreal); + virtual void resetHeight(); + QRectF childrenBoundingRect; QRectF needsRepaint; QMap paintedViewBoundingRects; diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index edb648b..8e439be 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -324,6 +324,14 @@ void QGraphicsWidget::resize(const QSizeF &size) */ /*! + + \fn QGraphicsWidget::geometryChanged() + + This signal gets emitted whenever the geometry of the item changes + \internal +*/ + +/*! \property QGraphicsWidget::geometry \brief the geometry of the widget @@ -384,13 +392,17 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) } QSizeF oldSize = size(); QGraphicsLayoutItem::setGeometry(newGeom); - + emit geometryChanged(); // Send resize event bool resized = newGeom.size() != oldSize; if (resized) { QGraphicsSceneResizeEvent re; re.setOldSize(oldSize); re.setNewSize(newGeom.size()); + if (oldSize.width() != newGeom.size().width()) + emit widthChanged(); + if (oldSize.height() != newGeom.size().height()) + emit heightChanged(); QApplication::sendEvent(this, &re); } } @@ -795,6 +807,7 @@ void QGraphicsWidget::setLayout(QGraphicsLayout *l) l->setParentLayoutItem(this); l->d_func()->reparentChildItems(this); l->invalidate(); + emit layoutChanged(); } /*! diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h index 87c669b..a22b642 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/gui/graphicsview/qgraphicswidget.h @@ -83,6 +83,7 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry NOTIFY geometryChanged) Q_PROPERTY(bool autoFillBackground READ autoFillBackground WRITE setAutoFillBackground) + Q_PROPERTY(QGraphicsLayout* layout READ layout WRITE setLayout NOTIFY layoutChanged) public: QGraphicsWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); ~QGraphicsWidget(); @@ -180,6 +181,7 @@ public: Q_SIGNALS: void geometryChanged(); + void layoutChanged(); public Q_SLOTS: bool close(); diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp index 1835c74..6e397b6 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp @@ -44,6 +44,7 @@ #ifndef QT_NO_GRAPHICSVIEW #include +#include #include "qgraphicswidget_p.h" #include "qgraphicslayout.h" #include "qgraphicsscene_p.h" @@ -825,6 +826,56 @@ void QGraphicsWidgetPrivate::setLayout_helper(QGraphicsLayout *l) } } +qreal QGraphicsWidgetPrivate::width() const +{ + Q_Q(const QGraphicsWidget); + return q->geometry().width(); +} + +void QGraphicsWidgetPrivate::setWidth(qreal w) +{ + if (qIsNaN(w)) + return; + Q_Q(QGraphicsWidget); + if (q->geometry().width() == w) + return; + + QRectF oldGeom = q->geometry(); + + q->setGeometry(QRectF(q->x(), q->y(), w, height())); +} + +void QGraphicsWidgetPrivate::resetWidth() +{ + Q_Q(QGraphicsWidget); + q->setGeometry(QRectF(q->x(), q->y(), 0, height())); +} + +qreal QGraphicsWidgetPrivate::height() const +{ + Q_Q(const QGraphicsWidget); + return q->geometry().height(); +} + +void QGraphicsWidgetPrivate::setHeight(qreal h) +{ + if (qIsNaN(h)) + return; + Q_Q(QGraphicsWidget); + if (q->geometry().height() == h) + return; + + QRectF oldGeom = q->geometry(); + + q->setGeometry(QRectF(q->x(), q->y(), width(), h)); +} + +void QGraphicsWidgetPrivate::resetHeight() +{ + Q_Q(QGraphicsWidget); + q->setGeometry(QRectF(q->x(), q->y(), width(), 0)); +} + QT_END_NAMESPACE #endif //QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h index 3ab8737..7116a23 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.h +++ b/src/gui/graphicsview/qgraphicswidget_p.h @@ -131,6 +131,15 @@ public: void windowFrameHoverLeaveEvent(QGraphicsSceneHoverEvent *event); bool hasDecoration() const; + // Private Properties + qreal width() const; + void setWidth(qreal); + void resetWidth(); + + qreal height() const; + void setHeight(qreal); + void resetHeight(); + // State inline int attributeToBitIndex(Qt::WidgetAttribute att) const { diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 2a1c55a..3313240 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -111,6 +111,8 @@ private slots: void fontPropagationSceneChange(); void geometry_data(); void geometry(); + void width(); + void height(); void getContentsMargins_data(); void getContentsMargins(); void initStyleOption_data(); @@ -766,14 +768,42 @@ void tst_QGraphicsWidget::geometry() { SubQGraphicsWidget widget; QCOMPARE(widget.geometry(), QRectF(widget.pos(), widget.size())); - + QSignalSpy spy(&widget, SIGNAL(geometryChanged())); QFETCH(QPointF, pos); QFETCH(QSizeF, size); widget.setPos(pos); widget.resize(size); + if (!size.isNull()) + QCOMPARE(spy.count(), 1); QCOMPARE(widget.geometry(), QRectF(pos, size)); } +void tst_QGraphicsWidget::width() +{ + QGraphicsWidget w; + QCOMPARE(w.property("width").toReal(), qreal(0)); + QSignalSpy spy(&w, SIGNAL(widthChanged())); + w.setProperty("width", qreal(50)); + QCOMPARE(w.property("width").toReal(), qreal(50)); + QCOMPARE(spy.count(), 1); + //calling old school setGeometry should work too + w.setGeometry(0, 0, 200, 200); + QCOMPARE(spy.count(), 2); +} + +void tst_QGraphicsWidget::height() +{ + QGraphicsWidget w; + QCOMPARE(w.property("height").toReal(), qreal(0)); + QSignalSpy spy(&w, SIGNAL(heightChanged())); + w.setProperty("height", qreal(50)); + QCOMPARE(w.property("height").toReal(), qreal(50)); + QCOMPARE(spy.count(), 1); + //calling old school setGeometry should work too + w.setGeometry(0, 0, 200, 200); + QCOMPARE(spy.count(), 2); +} + void tst_QGraphicsWidget::getContentsMargins_data() { QTest::addColumn("left"); @@ -913,6 +943,7 @@ void tst_QGraphicsWidget::layout() layout->addItem(item); children.append(item); } + QSignalSpy spy(&widget, SIGNAL(layoutChanged())); widget.setLayout(layout); QTRY_COMPARE(widget.layout(), static_cast(layout)); @@ -921,7 +952,7 @@ void tst_QGraphicsWidget::layout() QCOMPARE(item->parentWidget(), (QGraphicsWidget *)&widget); QVERIFY(item->geometry() != QRectF(0, 0, -1, -1)); } - + QCOMPARE(spy.count(), 1); // don't crash widget.setLayout(0); } -- cgit v0.12 From 93ee746f5b63670af280dfe2e8acaebeb48723b8 Mon Sep 17 00:00:00 2001 From: mae Date: Wed, 31 Mar 2010 12:27:55 +0200 Subject: Optimize QDeclarativeEngine::importExtension Avoid double initialization of QPluginLoader and assert that modules are imported with a stable uri --- src/declarative/qml/qdeclarativeengine.cpp | 51 ++++++++++++++++++------------ 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index bb742ee..5058d4d 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -81,6 +81,7 @@ #include #include #include +#include #include #include #include @@ -342,7 +343,8 @@ void QDeclarativeEnginePrivate::clear(SimpleList &pss) } Q_GLOBAL_STATIC(QDeclarativeEngineDebugServer, qmlEngineDebugServer); -Q_GLOBAL_STATIC(QSet, qmlEnginePluginsWithRegisteredTypes); +typedef QMap StringStringMap; +Q_GLOBAL_STATIC(StringStringMap, qmlEnginePluginsWithRegisteredTypes); // stores the uri void QDeclarativeEnginePrivate::init() { @@ -1838,34 +1840,43 @@ bool QDeclarativeEngine::importExtension(const QString &fileName, const QString qDebug() << "QDeclarativeEngine::importExtension" << uri << "from" << fileName; QFileInfo fileInfo(fileName); const QString absoluteFilePath = fileInfo.absoluteFilePath(); - QPluginLoader loader(absoluteFilePath); - if (QDeclarativeExtensionInterface *iface = qobject_cast(loader.instance())) { - const QByteArray bytes = uri.toUtf8(); - const char *moduleId = bytes.constData(); + QDeclarativeEnginePrivate *d = QDeclarativeEnginePrivate::get(this); + bool engineInitialized = d->initializedPlugins.contains(absoluteFilePath); + bool typesRegistered = qmlEnginePluginsWithRegisteredTypes()->contains(absoluteFilePath); - // ### this code should probably be protected with a mutex. - if (! qmlEnginePluginsWithRegisteredTypes()->contains(absoluteFilePath)) { - // types should only be registered once (they're global). + if (typesRegistered) { + Q_ASSERT_X(qmlEnginePluginsWithRegisteredTypes()->value(absoluteFilePath) == uri, + "QDeclarativeEngine::importExtension", + "Internal error: Plugin imported previously with different uri"); + } - qmlEnginePluginsWithRegisteredTypes()->insert(absoluteFilePath); - iface->registerTypes(moduleId); - } + if (!engineInitialized || !typesRegistered) { + QPluginLoader loader(absoluteFilePath); - QDeclarativeEnginePrivate *d = QDeclarativeEnginePrivate::get(this); + if (QDeclarativeExtensionInterface *iface = qobject_cast(loader.instance())) { - if (! d->initializedPlugins.contains(absoluteFilePath)) { - // things on the engine (eg. adding new global objects) have to be done for every engine. + const QByteArray bytes = uri.toUtf8(); + const char *moduleId = bytes.constData(); + if (!typesRegistered) { - // protect against double initialization - d->initializedPlugins.insert(absoluteFilePath); - iface->initializeEngine(this, moduleId); - } + // ### this code should probably be protected with a mutex. + qmlEnginePluginsWithRegisteredTypes()->insert(absoluteFilePath, uri); + iface->registerTypes(moduleId); + } + if (!engineInitialized) { + // things on the engine (eg. adding new global objects) have to be done for every engine. - return true; + // protect against double initialization + d->initializedPlugins.insert(absoluteFilePath); + iface->initializeEngine(this, moduleId); + } + } else { + return false; + } } - return false; + return true; } /*! -- cgit v0.12 From 582cbf2d92addb34088830a3de97c08ddb147e30 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Mar 2010 16:54:26 +0200 Subject: Add QDateTime members that operate on 64-bit milliseconds. This complements QDateTime::currentMsecsSinceEpoch. Task-number: QTBUG-9017 Reviewed-by: Denis Dzyubenko --- src/corelib/tools/qdatetime.cpp | 117 ++++++++++++++++++++++++++++----- src/corelib/tools/qdatetime.h | 3 + tests/auto/qdatetime/tst_qdatetime.cpp | 69 +++++++++++++++++++ 3 files changed, 174 insertions(+), 15 deletions(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 54a4205..7628dd2 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2315,17 +2315,35 @@ void QDateTime::setTimeSpec(Qt::TimeSpec spec) } } -static uint toTime_tHelper(const QDate &utcDate, const QTime &utcTime) +qint64 toMsecsSinceEpoch_helper(qint64 jd, int msecs) { - int days = QDate(1970, 1, 1).daysTo(utcDate); - int secs = QTime().secsTo(utcTime); - if (days < 0 || (days == 0 && secs < 0)) - return uint(-1); + int days = jd - julianDayFromGregorianDate(1970, 1, 1); + qint64 retval = (qlonglong(days) * MSECS_PER_DAY) + msecs; + return retval; +} - qlonglong retval = (qlonglong(days) * SECS_PER_DAY) + secs; - if (retval >= Q_INT64_C(0xFFFFFFFF)) - return uint(-1); - return uint(retval); +/*! + \since 4.7 + + Returns the datetime as the number of milliseconds that have passed + since 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC). + + On systems that do not support time zones, this function will + behave as if local time were Qt::UTC. + + The behavior for this function is undefined if the datetime stored in + this object is not valid. However, for all valid dates, this function + returns a unique value. + + \sa toTime_t(), setMsecsSinceEpoch() +*/ +qint64 QDateTime::toMsecsSinceEpoch() const +{ + QDate utcDate; + QTime utcTime; + d->getUTC(utcDate, utcTime); + + return toMsecsSinceEpoch_helper(utcDate.jd, utcTime.ds()); } /*! @@ -2335,16 +2353,63 @@ static uint toTime_tHelper(const QDate &utcDate, const QTime &utcTime) On systems that do not support time zones, this function will behave as if local time were Qt::UTC. - \sa setTime_t() + \note This function returns a 32-bit unsigned integer, so it does not + support dates before 1970, but it does support dates after + 2038-01-19T03:14:06, which may not be valid time_t values. Be careful + when passing those time_t values to system functions, which could + interpret them as negative dates. + + If the date is outside the range 1970-01-01T00:00:00 to + 2106-02-07T06:28:14, this function returns -1 cast to an unsigned integer + (i.e., 0xFFFFFFFF). + + To get an extended range, use toMsecsSinceEpoch(). + + \sa toMsecsSinceEpoch(), setTime_t() */ uint QDateTime::toTime_t() const { - QDate utcDate; - QTime utcTime; - d->getUTC(utcDate, utcTime); + qint64 retval = toMsecsSinceEpoch() / 1000; + if (quint64(retval) >= Q_UINT64_C(0xFFFFFFFF)) + return uint(-1); + return uint(retval); +} - return toTime_tHelper(utcDate, utcTime); +/*! + \since 4.7 + + Sets the date and time given the number of \a mulliseconds that have + passed since 1970-01-01T00:00:00.000, Coordinated Universal Time + (Qt::UTC). On systems that do not support time zones this function + will behave as if local time were Qt::UTC. + + Note that there are possible values for \a msecs that lie outside the + valid range of QDateTime, both negative and positive. The behavior of + this function is undefined for those values. + + \sa toMsecsSinceEpoch(), setTime_t() +*/ +void QDateTime::setMsecsSinceEpoch(qint64 msecs) +{ + detach(); + + QDateTimePrivate::Spec oldSpec = d->spec; + + int ddays = msecs / MSECS_PER_DAY; + msecs %= MSECS_PER_DAY; + if (msecs < 0) { + // negative + --ddays; + msecs += MSECS_PER_DAY; + } + + d->date = QDate(1970, 1, 1).addDays(ddays); + d->time = QTime().addMSecs(msecs); + d->spec = QDateTimePrivate::UTC; + + if (oldSpec != QDateTimePrivate::UTC) + d->spec = d->getLocal(d->date, d->time); } /*! @@ -3088,6 +3153,27 @@ QDateTime QDateTime::fromTime_t(uint seconds) } /*! + \since 4.7 + + Returns a datetime whose date and time are the number of milliseconds \a msec + that have passed since 1970-01-01T00:00:00.000, Coordinated Universal + Time (Qt::UTC). On systems that do not support time zones, the time + will be set as if local time were Qt::UTC. + + Note that there are possible values for \a msecs that lie outside the valid + range of QDateTime, both negative and positive. The behavior of this + function is undefined for those values. + + \sa toTime_t(), setTime_t() +*/ +QDateTime QDateTime::fromMsecsSinceEpoch(qint64 msecs) +{ + QDateTime d; + d.setMsecsSinceEpoch(msecs); + return d; +} + +/*! \since 4.4 \internal @@ -3841,7 +3927,8 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time) { QDate fakeDate = adjustDate(date); - time_t secsSince1Jan1970UTC = toTime_tHelper(fakeDate, time); + // won't overflow because of fakeDate + time_t secsSince1Jan1970UTC = toMsecsSinceEpoch_helper(fakeDate.toJulianDay(), QTime().msecsTo(time)) / 1000; tm *brokenDown = 0; #if defined(Q_OS_WINCE) diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index ef5968e..248793b 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -230,10 +230,12 @@ public: QDate date() const; QTime time() const; Qt::TimeSpec timeSpec() const; + qint64 toMsecsSinceEpoch() const; uint toTime_t() const; void setDate(const QDate &date); void setTime(const QTime &time); void setTimeSpec(Qt::TimeSpec spec); + void setMsecsSinceEpoch(qint64 msecs); void setTime_t(uint secsSince1Jan1970UTC); #ifndef QT_NO_DATESTRING QString toString(Qt::DateFormat f = Qt::TextDate) const; @@ -267,6 +269,7 @@ public: static QDateTime fromString(const QString &s, const QString &format); #endif static QDateTime fromTime_t(uint secsSince1Jan1970UTC); + static QDateTime fromMsecsSinceEpoch(qint64 msecs); static qint64 currentMsecsSinceEpoch(); #ifdef QT3_SUPPORT diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index a6b9a5f..b04a1b5 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -83,6 +83,8 @@ private slots: void setTime(); void setTimeSpec(); void setTime_t(); + void setMsecsSinceEpoch_data(); + void setMsecsSinceEpoch(); void toString_enumformat(); void toString_strformat_data(); void toString_strformat(); @@ -437,6 +439,71 @@ void tst_QDateTime::setTime_t() } } +void tst_QDateTime::setMsecsSinceEpoch_data() +{ + QTest::addColumn("msecs"); + QTest::addColumn("utc"); + QTest::addColumn("european"); + + QTest::newRow("zero") + << Q_INT64_C(0) + << QDateTime(QDate(1970, 1, 1), QTime(), Qt::UTC) + << QDateTime(QDate(1970, 1, 1), QTime(1, 0)); + QTest::newRow("-1") + << Q_INT64_C(-1) + << QDateTime(QDate(1969, 12, 31), QTime(23, 59, 59, 999), Qt::UTC) + << QDateTime(QDate(1970, 1, 1), QTime(0, 59, 59, 999)); + QTest::newRow("123456789") + << Q_INT64_C(123456789) + << QDateTime(QDate(1970, 1, 2), QTime(10, 17, 36, 789), Qt::UTC) + << QDateTime(QDate(1970, 1, 2), QTime(11, 17, 36, 789), Qt::LocalTime); + QTest::newRow("-123456789") + << Q_INT64_C(-123456789) + << QDateTime(QDate(1969, 12, 30), QTime(13, 42, 23, 211), Qt::UTC) + << QDateTime(QDate(1969, 12, 30), QTime(14, 42, 23, 211), Qt::LocalTime); + QTest::newRow("non-time_t") + << (Q_INT64_C(1000) << 32) + << QDateTime(QDate(2106, 2, 7), QTime(6, 28, 16), Qt::UTC) + << QDateTime(QDate(2106, 2, 7), QTime(7, 28, 16)); + QTest::newRow("very-large") + << (Q_INT64_C(123456) << 32) + << QDateTime(QDate(18772, 8, 15), QTime(1, 8, 14, 976), Qt::UTC) + << QDateTime(QDate(18772, 8, 15), QTime(3, 8, 14, 976)); + QTest::newRow("min_date") // julian day 0 is an invalid date for QDate + << Q_INT64_C(-210866716800000) + << QDateTime(QDate::fromJulianDay(1), QTime(), Qt::UTC) + << QDateTime(QDate::fromJulianDay(1), QTime(1, 0)); + QTest::newRow("max_date") // technically jd is unsigned, but fromJulianDay takes int + << Q_INT64_C(185331720376799999) + << QDateTime(QDate::fromJulianDay(0x7fffffff), QTime(21, 59, 59, 999), Qt::UTC) + << QDateTime(QDate::fromJulianDay(0x7fffffff), QTime(23, 59, 59, 999)); +} + +void tst_QDateTime::setMsecsSinceEpoch() +{ + QFETCH(qint64, msecs); + QFETCH(QDateTime, utc); + QFETCH(QDateTime, european); + + QDateTime dt; + dt.setTimeSpec(Qt::UTC); + dt.setMsecsSinceEpoch(msecs); + + QCOMPARE(dt, utc); + if (europeanTimeZone) { + QCOMPARE(dt.toLocalTime(), european); + } + + QCOMPARE(dt.toMsecsSinceEpoch(), msecs); + + if (quint64(msecs / 1000) < 0xFFFFFFFF) { + QCOMPARE(qint64(dt.toTime_t()), msecs / 1000); + } + + QDateTime reference(QDate(1970, 1, 1), QTime(), Qt::UTC); + QCOMPARE(dt, reference.addMSecs(msecs)); +} + void tst_QDateTime::toString_enumformat() { QDateTime dt1(QDate(1995, 5, 20), QTime(12, 34, 56)); @@ -953,6 +1020,8 @@ void tst_QDateTime::currentDateTimeUtc2() // and finally, the time_t should equal our number QCOMPARE(qint64(utc.toTime_t()), msec / 1000); QCOMPARE(qint64(local.toTime_t()), msec / 1000); + QCOMPARE(utc.toMsecsSinceEpoch(), msec); + QCOMPARE(local.toMsecsSinceEpoch(), msec); } void tst_QDateTime::toTime_t_data() -- cgit v0.12 From 32f002486941c0cba246e08491e9a0800942cded Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Mar 2010 10:40:25 +0200 Subject: Rename the xxxMsecsSinceEpoch functions to xxxMSecsSinceEpoch. Matches the addMSecs existing functions in QTime and QDateTime. Reviewed-by: Marius Storm-Olsen --- src/corelib/tools/qdatetime.cpp | 32 ++++++++++++++--------------- src/corelib/tools/qdatetime.h | 8 ++++---- src/corelib/tools/qelapsedtimer_generic.cpp | 4 ++-- tests/auto/qdatetime/tst_qdatetime.cpp | 18 ++++++++-------- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 7628dd2..69b232d 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2315,7 +2315,7 @@ void QDateTime::setTimeSpec(Qt::TimeSpec spec) } } -qint64 toMsecsSinceEpoch_helper(qint64 jd, int msecs) +qint64 toMSecsSinceEpoch_helper(qint64 jd, int msecs) { int days = jd - julianDayFromGregorianDate(1970, 1, 1); qint64 retval = (qlonglong(days) * MSECS_PER_DAY) + msecs; @@ -2335,15 +2335,15 @@ qint64 toMsecsSinceEpoch_helper(qint64 jd, int msecs) this object is not valid. However, for all valid dates, this function returns a unique value. - \sa toTime_t(), setMsecsSinceEpoch() + \sa toTime_t(), setMSecsSinceEpoch() */ -qint64 QDateTime::toMsecsSinceEpoch() const +qint64 QDateTime::toMSecsSinceEpoch() const { QDate utcDate; QTime utcTime; d->getUTC(utcDate, utcTime); - return toMsecsSinceEpoch_helper(utcDate.jd, utcTime.ds()); + return toMSecsSinceEpoch_helper(utcDate.jd, utcTime.ds()); } /*! @@ -2363,14 +2363,14 @@ qint64 QDateTime::toMsecsSinceEpoch() const 2106-02-07T06:28:14, this function returns -1 cast to an unsigned integer (i.e., 0xFFFFFFFF). - To get an extended range, use toMsecsSinceEpoch(). + To get an extended range, use toMSecsSinceEpoch(). - \sa toMsecsSinceEpoch(), setTime_t() + \sa toMSecsSinceEpoch(), setTime_t() */ uint QDateTime::toTime_t() const { - qint64 retval = toMsecsSinceEpoch() / 1000; + qint64 retval = toMSecsSinceEpoch() / 1000; if (quint64(retval) >= Q_UINT64_C(0xFFFFFFFF)) return uint(-1); return uint(retval); @@ -2388,9 +2388,9 @@ uint QDateTime::toTime_t() const valid range of QDateTime, both negative and positive. The behavior of this function is undefined for those values. - \sa toMsecsSinceEpoch(), setTime_t() + \sa toMSecsSinceEpoch(), setTime_t() */ -void QDateTime::setMsecsSinceEpoch(qint64 msecs) +void QDateTime::setMSecsSinceEpoch(qint64 msecs) { detach(); @@ -2878,7 +2878,7 @@ bool QDateTime::operator<(const QDateTime &other) const */ /*! - \fn qint64 QDateTime::currentMsecsSinceEpoch() + \fn qint64 QDateTime::currentMSecsSinceEpoch() \since 4.7 Returns the number of milliseconds since 1970-01-01T00:00:00 Universal @@ -2941,7 +2941,7 @@ QDateTime QDateTime::currentDateTimeUtc() return QDateTime(d, t, Qt::UTC); } -qint64 QDateTime::currentMsecsSinceEpoch() +qint64 QDateTime::currentMSecsSinceEpoch() { QDate d; QTime t; @@ -3005,7 +3005,7 @@ QDateTime QDateTime::currentDateTimeUtc() return QDateTime(d, ct, Qt::UTC); } -qint64 QDateTime::currentMsecsSinceEpoch() +qint64 QDateTime::currentMSecsSinceEpoch() { QDate d; QTime ct; @@ -3122,7 +3122,7 @@ QDateTime QDateTime::currentDateTimeUtc() return dt; } -qint64 QDateTime::currentMsecsSinceEpoch() +qint64 QDateTime::currentMSecsSinceEpoch() { // posix compliant system // we have milliseconds @@ -3166,10 +3166,10 @@ QDateTime QDateTime::fromTime_t(uint seconds) \sa toTime_t(), setTime_t() */ -QDateTime QDateTime::fromMsecsSinceEpoch(qint64 msecs) +QDateTime QDateTime::fromMSecsSinceEpoch(qint64 msecs) { QDateTime d; - d.setMsecsSinceEpoch(msecs); + d.setMSecsSinceEpoch(msecs); return d; } @@ -3928,7 +3928,7 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time) QDate fakeDate = adjustDate(date); // won't overflow because of fakeDate - time_t secsSince1Jan1970UTC = toMsecsSinceEpoch_helper(fakeDate.toJulianDay(), QTime().msecsTo(time)) / 1000; + time_t secsSince1Jan1970UTC = toMSecsSinceEpoch_helper(fakeDate.toJulianDay(), QTime().msecsTo(time)) / 1000; tm *brokenDown = 0; #if defined(Q_OS_WINCE) diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 248793b..f445f1c 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -230,12 +230,12 @@ public: QDate date() const; QTime time() const; Qt::TimeSpec timeSpec() const; - qint64 toMsecsSinceEpoch() const; + qint64 toMSecsSinceEpoch() const; uint toTime_t() const; void setDate(const QDate &date); void setTime(const QTime &time); void setTimeSpec(Qt::TimeSpec spec); - void setMsecsSinceEpoch(qint64 msecs); + void setMSecsSinceEpoch(qint64 msecs); void setTime_t(uint secsSince1Jan1970UTC); #ifndef QT_NO_DATESTRING QString toString(Qt::DateFormat f = Qt::TextDate) const; @@ -269,8 +269,8 @@ public: static QDateTime fromString(const QString &s, const QString &format); #endif static QDateTime fromTime_t(uint secsSince1Jan1970UTC); - static QDateTime fromMsecsSinceEpoch(qint64 msecs); - static qint64 currentMsecsSinceEpoch(); + static QDateTime fromMSecsSinceEpoch(qint64 msecs); + static qint64 currentMSecsSinceEpoch(); #ifdef QT3_SUPPORT inline QT3_SUPPORT void setTime_t(uint secsSince1Jan1970UTC, Qt::TimeSpec spec) { diff --git a/src/corelib/tools/qelapsedtimer_generic.cpp b/src/corelib/tools/qelapsedtimer_generic.cpp index 9b589c1..85986e6 100644 --- a/src/corelib/tools/qelapsedtimer_generic.cpp +++ b/src/corelib/tools/qelapsedtimer_generic.cpp @@ -98,7 +98,7 @@ void QElapsedTimer::start() qint64 QElapsedTimer::restart() { qint64 old = t1; - t1 = QDateTime::currentMsecsSinceEpoch(); + t1 = QDateTime::currentMSecsSinceEpoch(); t2 = 0; return t1 - old; } @@ -112,7 +112,7 @@ qint64 QElapsedTimer::restart() */ qint64 QElapsedTimer::elapsed() const { - return QDateTime::currentMsecsSinceEpoch() - t1; + return QDateTime::currentMSecsSinceEpoch() - t1; } /*! diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index b04a1b5..6aca996 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -83,8 +83,8 @@ private slots: void setTime(); void setTimeSpec(); void setTime_t(); - void setMsecsSinceEpoch_data(); - void setMsecsSinceEpoch(); + void setMSecsSinceEpoch_data(); + void setMSecsSinceEpoch(); void toString_enumformat(); void toString_strformat_data(); void toString_strformat(); @@ -439,7 +439,7 @@ void tst_QDateTime::setTime_t() } } -void tst_QDateTime::setMsecsSinceEpoch_data() +void tst_QDateTime::setMSecsSinceEpoch_data() { QTest::addColumn("msecs"); QTest::addColumn("utc"); @@ -479,7 +479,7 @@ void tst_QDateTime::setMsecsSinceEpoch_data() << QDateTime(QDate::fromJulianDay(0x7fffffff), QTime(23, 59, 59, 999)); } -void tst_QDateTime::setMsecsSinceEpoch() +void tst_QDateTime::setMSecsSinceEpoch() { QFETCH(qint64, msecs); QFETCH(QDateTime, utc); @@ -487,14 +487,14 @@ void tst_QDateTime::setMsecsSinceEpoch() QDateTime dt; dt.setTimeSpec(Qt::UTC); - dt.setMsecsSinceEpoch(msecs); + dt.setMSecsSinceEpoch(msecs); QCOMPARE(dt, utc); if (europeanTimeZone) { QCOMPARE(dt.toLocalTime(), european); } - QCOMPARE(dt.toMsecsSinceEpoch(), msecs); + QCOMPARE(dt.toMSecsSinceEpoch(), msecs); if (quint64(msecs / 1000) < 0xFFFFFFFF) { QCOMPARE(qint64(dt.toTime_t()), msecs / 1000); @@ -999,7 +999,7 @@ void tst_QDateTime::currentDateTimeUtc2() do { local = QDateTime::currentDateTime(); utc = QDateTime::currentDateTimeUtc(); - msec = QDateTime::currentMsecsSinceEpoch(); + msec = QDateTime::currentMSecsSinceEpoch(); ok = local.time().msec() == utc.time().msec() && utc.time().msec() == (msec % 1000); } while (--i && !ok); @@ -1020,8 +1020,8 @@ void tst_QDateTime::currentDateTimeUtc2() // and finally, the time_t should equal our number QCOMPARE(qint64(utc.toTime_t()), msec / 1000); QCOMPARE(qint64(local.toTime_t()), msec / 1000); - QCOMPARE(utc.toMsecsSinceEpoch(), msec); - QCOMPARE(local.toMsecsSinceEpoch(), msec); + QCOMPARE(utc.toMSecsSinceEpoch(), msec); + QCOMPARE(local.toMSecsSinceEpoch(), msec); } void tst_QDateTime::toTime_t_data() -- cgit v0.12 From 524ee26ed5202aa45d337a0a852a2eb2896ac205 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 31 Mar 2010 12:38:21 +0200 Subject: Remove leading whitespace from Qt header macros. The tst_headers::macros test doesn't like it. It's easier to remove the spaces than to fix the test. Reviewed-by: Markus Goetz --- src/network/bearer/qnetworkconfigmanager.h | 14 +++++++------- src/network/bearer/qnetworkconfiguration.h | 14 +++++++------- src/network/bearer/qnetworksession.h | 18 +++++++++--------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h index 19951f8..79bb27c 100644 --- a/src/network/bearer/qnetworkconfigmanager.h +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -52,12 +52,12 @@ QT_BEGIN_HEADER #ifndef QT_MOBILITY_BEARER - QT_BEGIN_NAMESPACE - #define QNetworkConfigurationManagerExport Q_NETWORK_EXPORT - QT_MODULE(Network) +QT_BEGIN_NAMESPACE +#define QNetworkConfigurationManagerExport Q_NETWORK_EXPORT +QT_MODULE(Network) #else - QTM_BEGIN_NAMESPACE - #define QNetworkConfigurationManagerExport Q_BEARER_EXPORT +QTM_BEGIN_NAMESPACE +#define QNetworkConfigurationManagerExport Q_BEARER_EXPORT #endif class QNetworkConfigurationManagerPrivate; @@ -104,9 +104,9 @@ Q_SIGNALS: Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkConfigurationManager::Capabilities) #ifndef QT_MOBILITY_BEARER - QT_END_NAMESPACE +QT_END_NAMESPACE #else - QTM_END_NAMESPACE +QTM_END_NAMESPACE #endif QT_END_HEADER diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index 3b49d0a..dce39eb 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -59,12 +59,12 @@ QT_BEGIN_HEADER #ifndef QT_MOBILITY_BEARER - QT_BEGIN_NAMESPACE - QT_MODULE(Network) - #define QNetworkConfigurationExport Q_NETWORK_EXPORT +QT_BEGIN_NAMESPACE +QT_MODULE(Network) +#define QNetworkConfigurationExport Q_NETWORK_EXPORT #else - QTM_BEGIN_NAMESPACE - #define QNetworkConfigurationExport Q_BEARER_EXPORT +QTM_BEGIN_NAMESPACE +#define QNetworkConfigurationExport Q_BEARER_EXPORT #endif class QNetworkConfigurationPrivate; @@ -123,9 +123,9 @@ private: }; #ifndef QT_MOBILITY_BEARER - QT_END_NAMESPACE +QT_END_NAMESPACE #else - QTM_END_NAMESPACE +QTM_END_NAMESPACE #endif QT_END_HEADER diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 2681d1f..2911d0a 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -55,14 +55,14 @@ QT_BEGIN_HEADER #ifndef QT_MOBILITY_BEARER - #include - QT_BEGIN_NAMESPACE - QT_MODULE(Network) - #define QNetworkSessionExport Q_NETWORK_EXPORT +#include +QT_BEGIN_NAMESPACE +QT_MODULE(Network) +#define QNetworkSessionExport Q_NETWORK_EXPORT #else - #include "qmobilityglobal.h" - QTM_BEGIN_NAMESPACE - #define QNetworkSessionExport Q_BEARER_EXPORT +#include "qmobilityglobal.h" +QTM_BEGIN_NAMESPACE +#define QNetworkSessionExport Q_BEARER_EXPORT #endif class QNetworkSessionPrivate; @@ -142,9 +142,9 @@ private: }; #ifndef QT_MOBILITY_BEARER - QT_END_NAMESPACE +QT_END_NAMESPACE #else - QTM_END_NAMESPACE +QTM_END_NAMESPACE #endif QT_END_HEADER -- cgit v0.12 From f858af947c92ad77d0aa14bbf80171b9b822bd75 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 31 Mar 2010 12:53:12 +0200 Subject: Update Comment --- tests/auto/declarative/qdeclarativelayouts/tst_qdeclarativelayouts.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativelayouts/tst_qdeclarativelayouts.cpp b/tests/auto/declarative/qdeclarativelayouts/tst_qdeclarativelayouts.cpp index 879047e..412c3b7 100644 --- a/tests/auto/declarative/qdeclarativelayouts/tst_qdeclarativelayouts.cpp +++ b/tests/auto/declarative/qdeclarativelayouts/tst_qdeclarativelayouts.cpp @@ -130,7 +130,7 @@ void tst_QDeclarativeLayouts::test_qml() void tst_QDeclarativeLayouts::test_cpp() { - //TODO: Waiting on QT-2407 to write this test + //TODO: This test! } QDeclarativeView *tst_QDeclarativeLayouts::createView(const QString &filename) -- cgit v0.12 From 5323b5df1587d05de29857305ec0726e2f87610d Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 31 Mar 2010 12:54:44 +0200 Subject: Fix bug when adding import paths manually Paths were being added relatively even though they should be converted to a canoncial form. Patch originally by tmikola Reviewed-by: mae --- src/declarative/qml/qdeclarativeengine.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index bb742ee..2cae632 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1788,7 +1788,13 @@ void QDeclarativeEngine::addImportPath(const QString& path) if (qmlImportTrace()) qDebug() << "QDeclarativeEngine::addImportPath" << path; Q_D(QDeclarativeEngine); - d->fileImportPath.prepend(path); + QUrl url = QUrl(path); + if (url.isRelative() || url.scheme() == QString::fromLocal8Bit("file")) { + QDir dir = QDir(path); + d->fileImportPath.prepend(dir.canonicalPath()); + } else { + d->fileImportPath.prepend(path); + } } -- cgit v0.12 From 5746327c5566223f01f10f62baf8d7c3e47a6c9f Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Wed, 31 Mar 2010 15:23:39 +0200 Subject: Fixed: Declared properties cannot be assigned in declaration Task-number: QTBUG-7860 --- src/declarative/qml/parser/qdeclarativejs.g | 50 + src/declarative/qml/parser/qdeclarativejsast.cpp | 1 + src/declarative/qml/parser/qdeclarativejsast_p.h | 10 +- .../qml/parser/qdeclarativejsgrammar.cpp | 1665 ++++++++++---------- .../qml/parser/qdeclarativejsgrammar_p.h | 12 +- .../qml/parser/qdeclarativejsparser.cpp | 422 ++--- .../qml/parser/qdeclarativejsparser_p.h | 4 +- src/declarative/qml/qdeclarativescriptparser.cpp | 13 +- .../tst_qdeclarativelanguage.cpp | 1 - 9 files changed, 1138 insertions(+), 1040 deletions(-) diff --git a/src/declarative/qml/parser/qdeclarativejs.g b/src/declarative/qml/parser/qdeclarativejs.g index 6434d10..536989f 100644 --- a/src/declarative/qml/parser/qdeclarativejs.g +++ b/src/declarative/qml/parser/qdeclarativejs.g @@ -971,6 +971,56 @@ case $rule_number: { } break; ./ +UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_COLON T_LBRACKET UiArrayMemberList T_RBRACKET ; +/. +case $rule_number: { + AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(4).sval, sym(6).sval); + node->typeModifier = sym(2).sval; + node->propertyToken = loc(1); + node->typeModifierToken = loc(2); + node->typeToken = loc(4); + node->identifierToken = loc(6); + node->semicolonToken = loc(7); // insert a fake ';' before ':' + + AST::UiQualifiedId *propertyName = makeAstNode(driver->nodePool(), sym(6).sval); + propertyName->identifierToken = loc(6); + propertyName->next = 0; + + AST::UiArrayBinding *binding = makeAstNode (driver->nodePool(), + propertyName, sym(9).UiArrayMemberList->finish()); + binding->colonToken = loc(7); + binding->lbracketToken = loc(8); + binding->rbracketToken = loc(10); + + node->binding = binding; + + sym(1).Node = node; +} break; +./ + +UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON UiQualifiedId UiObjectInitializer ; +/. +case $rule_number: { + AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(3).sval); + node->propertyToken = loc(1); + node->typeToken = loc(2); + node->identifierToken = loc(3); + node->semicolonToken = loc(4); // insert a fake ';' before ':' + + AST::UiQualifiedId *propertyName = makeAstNode(driver->nodePool(), sym(3).sval); + propertyName->identifierToken = loc(3); + propertyName->next = 0; + + AST::UiObjectBinding *binding = makeAstNode (driver->nodePool(), + propertyName, sym(5).UiQualifiedId, sym(6).UiObjectInitializer); + binding->colonToken = loc(4); + + node->binding = binding; + + sym(1).Node = node; +} break; +./ + UiObjectMember: FunctionDeclaration ; /. case $rule_number: { diff --git a/src/declarative/qml/parser/qdeclarativejsast.cpp b/src/declarative/qml/parser/qdeclarativejsast.cpp index 3b569a7..e3d3a66 100644 --- a/src/declarative/qml/parser/qdeclarativejsast.cpp +++ b/src/declarative/qml/parser/qdeclarativejsast.cpp @@ -837,6 +837,7 @@ void UiPublicMember::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); + accept(binding, visitor); } visitor->endVisit(this); diff --git a/src/declarative/qml/parser/qdeclarativejsast_p.h b/src/declarative/qml/parser/qdeclarativejsast_p.h index c1945ce..b839413 100644 --- a/src/declarative/qml/parser/qdeclarativejsast_p.h +++ b/src/declarative/qml/parser/qdeclarativejsast_p.h @@ -2485,13 +2485,13 @@ public: UiPublicMember(NameId *memberType, NameId *name) - : type(Property), typeModifier(0), memberType(memberType), name(name), expression(0), isDefaultMember(false), isReadonlyMember(false), parameters(0) + : type(Property), typeModifier(0), memberType(memberType), name(name), expression(0), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0) { kind = K; } UiPublicMember(NameId *memberType, NameId *name, ExpressionNode *expression) - : type(Property), typeModifier(0), memberType(memberType), name(name), expression(expression), isDefaultMember(false), isReadonlyMember(false), parameters(0) + : type(Property), typeModifier(0), memberType(memberType), name(name), expression(expression), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0) { kind = K; } virtual SourceLocation firstSourceLocation() const @@ -2506,6 +2506,9 @@ public: virtual SourceLocation lastSourceLocation() const { + if (binding) + return binding->lastSourceLocation(); + return semicolonToken; } @@ -2516,7 +2519,8 @@ public: NameId *typeModifier; NameId *memberType; NameId *name; - ExpressionNode *expression; + ExpressionNode *expression; // initialized with a JS expression + UiObjectMember *binding; // initialized with a QML object or array. bool isDefaultMember; bool isReadonlyMember; UiParameterList *parameters; diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp index 89493ff..39a2d3f 100644 --- a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp +++ b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp @@ -64,35 +64,35 @@ const short QDeclarativeJSGrammar::lhs [] = { 106, 106, 106, 106, 106, 106, 106, 106, 126, 126, 126, 127, 127, 128, 128, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, - 106, 106, 106, 116, 116, 116, 116, 116, 131, 131, + 106, 106, 106, 106, 106, 116, 116, 116, 116, 116, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 131, 131, 131, 131, 121, 133, 133, 133, - 133, 132, 132, 135, 135, 137, 137, 137, 137, 137, - 137, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 131, 131, 131, 131, 131, 131, 131, 131, 121, 133, + 133, 133, 133, 132, 132, 135, 135, 137, 137, 137, + 137, 137, 137, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, - 138, 138, 139, 139, 114, 114, 114, 114, 114, 142, - 142, 143, 143, 143, 143, 141, 141, 144, 144, 145, - 145, 146, 146, 146, 147, 147, 147, 147, 147, 147, - 147, 147, 147, 147, 148, 148, 148, 148, 149, 149, - 149, 150, 150, 150, 150, 151, 151, 151, 151, 151, - 151, 151, 152, 152, 152, 152, 152, 152, 153, 153, - 153, 153, 153, 154, 154, 154, 154, 154, 155, 155, - 156, 156, 157, 157, 158, 158, 159, 159, 160, 160, - 161, 161, 162, 162, 163, 163, 164, 164, 165, 165, - 166, 166, 136, 136, 167, 167, 168, 168, 168, 168, - 168, 168, 168, 168, 168, 168, 168, 168, 104, 104, - 169, 169, 170, 170, 171, 171, 103, 103, 103, 103, + 138, 138, 138, 138, 139, 139, 114, 114, 114, 114, + 114, 142, 142, 143, 143, 143, 143, 141, 141, 144, + 144, 145, 145, 146, 146, 146, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, + 149, 149, 149, 150, 150, 150, 150, 151, 151, 151, + 151, 151, 151, 151, 152, 152, 152, 152, 152, 152, + 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, + 155, 155, 156, 156, 157, 157, 158, 158, 159, 159, + 160, 160, 161, 161, 162, 162, 163, 163, 164, 164, + 165, 165, 166, 166, 136, 136, 167, 167, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 104, 104, 169, 169, 170, 170, 171, 171, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, - 103, 122, 183, 183, 182, 182, 130, 130, 184, 184, - 185, 185, 187, 187, 186, 188, 191, 189, 189, 192, - 190, 190, 123, 124, 124, 125, 125, 172, 172, 172, - 172, 172, 172, 172, 173, 173, 173, 173, 174, 174, - 174, 174, 175, 175, 176, 178, 193, 193, 196, 196, - 194, 194, 197, 195, 177, 177, 177, 179, 179, 180, - 180, 180, 198, 199, 181, 181, 129, 140, 203, 203, - 200, 200, 201, 201, 204, 107, 205, 205, 105, 105, - 202, 202, 134, 134, 206}; + 103, 103, 103, 122, 183, 183, 182, 182, 130, 130, + 184, 184, 185, 185, 187, 187, 186, 188, 191, 189, + 189, 192, 190, 190, 123, 124, 124, 125, 125, 172, + 172, 172, 172, 172, 172, 172, 173, 173, 173, 173, + 174, 174, 174, 174, 175, 175, 176, 178, 193, 193, + 196, 196, 194, 194, 197, 195, 177, 177, 177, 179, + 179, 180, 180, 180, 198, 199, 181, 181, 129, 140, + 203, 203, 200, 200, 201, 201, 204, 107, 205, 205, + 105, 105, 202, 202, 134, 134, 206}; const short QDeclarativeJSGrammar::rhs [] = { 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, @@ -101,106 +101,107 @@ const short QDeclarativeJSGrammar::rhs [] = { 1, 5, 4, 4, 3, 3, 3, 3, 1, 1, 1, 0, 1, 2, 4, 6, 6, 3, 3, 7, 7, 4, 4, 5, 5, 6, 6, 7, 7, 7, - 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 3, 4, 5, 3, 4, 3, 1, 1, 2, 3, - 4, 1, 2, 3, 5, 1, 1, 1, 1, 1, + 7, 10, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 3, 3, 4, 5, 3, 4, 3, 1, 1, + 2, 3, 4, 1, 2, 3, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 4, 3, 5, 1, - 2, 4, 4, 4, 3, 0, 1, 1, 3, 1, - 1, 1, 2, 2, 1, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 1, 3, 3, 3, 1, 3, - 3, 1, 3, 3, 3, 1, 3, 3, 3, 3, - 3, 3, 1, 3, 3, 3, 3, 3, 1, 3, - 3, 3, 3, 1, 3, 3, 3, 3, 1, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 4, 3, + 5, 1, 2, 4, 4, 4, 3, 0, 1, 1, + 3, 1, 1, 1, 2, 2, 1, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 3, 3, 3, + 1, 3, 3, 1, 3, 3, 3, 1, 3, 3, + 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, + 1, 3, 3, 3, 3, 1, 3, 3, 3, 3, + 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, - 1, 3, 1, 3, 1, 3, 1, 3, 1, 5, - 1, 5, 1, 3, 1, 3, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 0, 1, 1, 3, 0, 1, 1, 1, 1, 1, + 1, 5, 1, 5, 1, 3, 1, 3, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 0, 1, 1, 3, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 1, 2, 0, 1, 3, 3, 1, 1, - 1, 3, 1, 3, 2, 2, 2, 0, 1, 2, - 0, 1, 1, 2, 2, 7, 5, 7, 7, 5, - 9, 10, 7, 8, 2, 2, 3, 3, 2, 2, - 3, 3, 3, 3, 5, 5, 3, 5, 1, 2, - 0, 1, 4, 3, 3, 3, 3, 3, 3, 3, - 3, 4, 5, 2, 2, 2, 8, 8, 1, 3, - 0, 1, 0, 1, 1, 1, 1, 2, 1, 1, - 0, 1, 0, 1, 2}; + 1, 1, 1, 3, 1, 2, 0, 1, 3, 3, + 1, 1, 1, 3, 1, 3, 2, 2, 2, 0, + 1, 2, 0, 1, 1, 2, 2, 7, 5, 7, + 7, 5, 9, 10, 7, 8, 2, 2, 3, 3, + 2, 2, 3, 3, 3, 3, 5, 5, 3, 5, + 1, 2, 0, 1, 4, 3, 3, 3, 3, 3, + 3, 3, 3, 4, 5, 2, 2, 2, 8, 8, + 1, 3, 0, 1, 0, 1, 1, 1, 1, 2, + 1, 1, 0, 1, 0, 1, 2}; const short QDeclarativeJSGrammar::action_default [] = { - 0, 0, 0, 0, 0, 0, 22, 0, 172, 239, - 203, 211, 207, 151, 223, 199, 3, 136, 70, 152, - 215, 219, 140, 169, 150, 155, 135, 189, 176, 0, - 77, 78, 73, 341, 64, 343, 0, 0, 0, 0, - 75, 0, 0, 71, 74, 68, 0, 0, 65, 67, - 66, 76, 69, 0, 72, 0, 0, 165, 0, 0, - 152, 171, 154, 153, 0, 0, 0, 167, 168, 166, - 170, 0, 200, 0, 0, 0, 0, 190, 0, 0, - 0, 0, 0, 0, 180, 0, 0, 0, 174, 175, - 173, 178, 182, 181, 179, 177, 192, 191, 193, 0, - 208, 0, 204, 0, 0, 146, 133, 145, 134, 102, - 103, 104, 129, 105, 130, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 131, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 132, - 0, 0, 144, 240, 147, 0, 148, 0, 149, 143, - 0, 236, 229, 227, 234, 235, 233, 232, 238, 231, - 230, 228, 237, 224, 0, 212, 0, 0, 216, 0, - 0, 220, 0, 0, 146, 138, 0, 137, 0, 142, - 156, 0, 342, 331, 332, 0, 329, 0, 330, 0, - 333, 247, 254, 253, 261, 249, 0, 250, 334, 0, - 340, 251, 252, 257, 255, 337, 335, 339, 258, 0, - 269, 0, 0, 0, 0, 341, 64, 0, 343, 65, - 241, 283, 66, 0, 0, 0, 270, 0, 0, 259, - 260, 0, 248, 256, 284, 285, 328, 338, 0, 299, - 300, 301, 302, 0, 295, 296, 297, 298, 325, 326, - 0, 0, 0, 0, 0, 288, 289, 245, 243, 205, - 213, 209, 225, 201, 246, 0, 152, 217, 221, 194, - 183, 0, 0, 202, 0, 0, 0, 0, 195, 0, - 0, 0, 0, 0, 187, 185, 188, 186, 184, 197, - 196, 198, 0, 210, 0, 206, 0, 244, 152, 0, - 226, 241, 242, 0, 241, 0, 0, 291, 0, 0, - 0, 293, 0, 214, 0, 0, 218, 0, 0, 222, - 281, 0, 273, 282, 276, 0, 280, 0, 241, 274, - 0, 241, 0, 0, 292, 0, 0, 0, 294, 342, - 331, 0, 0, 333, 0, 327, 0, 317, 0, 0, - 0, 287, 0, 286, 0, 344, 0, 101, 263, 266, - 0, 102, 269, 105, 130, 107, 108, 73, 112, 113, - 64, 114, 117, 71, 74, 65, 241, 66, 76, 120, - 69, 122, 72, 124, 125, 270, 127, 128, 132, 0, - 94, 0, 0, 96, 100, 98, 85, 97, 99, 0, - 95, 84, 264, 262, 140, 141, 146, 0, 139, 0, - 316, 0, 303, 304, 0, 315, 0, 0, 0, 306, - 311, 309, 312, 0, 0, 310, 311, 0, 307, 0, - 308, 265, 314, 0, 265, 313, 0, 318, 319, 0, - 265, 320, 321, 0, 0, 322, 0, 0, 0, 323, - 324, 158, 157, 0, 0, 0, 290, 0, 0, 0, - 305, 278, 271, 0, 279, 275, 0, 277, 267, 0, - 268, 272, 88, 0, 0, 92, 79, 0, 81, 90, - 0, 82, 91, 93, 83, 89, 80, 0, 86, 162, - 160, 164, 161, 159, 163, 6, 336, 4, 2, 62, - 87, 0, 0, 65, 67, 66, 31, 5, 0, 63, + 0, 0, 0, 0, 0, 0, 22, 0, 174, 241, + 205, 213, 209, 153, 225, 201, 3, 138, 72, 154, + 217, 221, 142, 171, 152, 157, 137, 191, 178, 0, + 79, 80, 75, 343, 66, 345, 0, 0, 0, 0, + 77, 0, 0, 73, 76, 70, 0, 0, 67, 69, + 68, 78, 71, 0, 74, 0, 0, 167, 0, 0, + 154, 173, 156, 155, 0, 0, 0, 169, 170, 168, + 172, 0, 202, 0, 0, 0, 0, 192, 0, 0, + 0, 0, 0, 0, 182, 0, 0, 0, 176, 177, + 175, 180, 184, 183, 181, 179, 194, 193, 195, 0, + 210, 0, 206, 0, 0, 148, 135, 147, 136, 104, + 105, 106, 131, 107, 132, 108, 109, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 133, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 134, + 0, 0, 146, 242, 149, 0, 150, 0, 151, 145, + 0, 238, 231, 229, 236, 237, 235, 234, 240, 233, + 232, 230, 239, 226, 0, 214, 0, 0, 218, 0, + 0, 222, 0, 0, 148, 140, 0, 139, 0, 144, + 158, 0, 344, 333, 334, 0, 331, 0, 332, 0, + 335, 249, 256, 255, 263, 251, 0, 252, 336, 0, + 342, 253, 254, 259, 257, 339, 337, 341, 260, 0, + 271, 0, 0, 0, 0, 343, 66, 0, 345, 67, + 243, 285, 68, 0, 0, 0, 272, 0, 0, 261, + 262, 0, 250, 258, 286, 287, 330, 340, 0, 301, + 302, 303, 304, 0, 297, 298, 299, 300, 327, 328, + 0, 0, 0, 0, 0, 290, 291, 247, 245, 207, + 215, 211, 227, 203, 248, 0, 154, 219, 223, 196, + 185, 0, 0, 204, 0, 0, 0, 0, 197, 0, + 0, 0, 0, 0, 189, 187, 190, 188, 186, 199, + 198, 200, 0, 212, 0, 208, 0, 246, 154, 0, + 228, 243, 244, 0, 243, 0, 0, 293, 0, 0, + 0, 295, 0, 216, 0, 0, 220, 0, 0, 224, + 283, 0, 275, 284, 278, 0, 282, 0, 243, 276, + 0, 243, 0, 0, 294, 0, 0, 0, 296, 344, + 333, 0, 0, 335, 0, 329, 0, 319, 0, 0, + 0, 289, 0, 288, 0, 346, 0, 103, 265, 268, + 0, 104, 271, 107, 132, 109, 110, 75, 114, 115, + 66, 116, 119, 73, 76, 67, 243, 68, 78, 122, + 71, 124, 74, 126, 127, 272, 129, 130, 134, 0, + 96, 0, 0, 98, 102, 100, 87, 99, 101, 0, + 97, 86, 266, 264, 142, 143, 148, 0, 141, 0, + 318, 0, 305, 306, 0, 317, 0, 0, 0, 308, + 313, 311, 314, 0, 0, 312, 313, 0, 309, 0, + 310, 267, 316, 0, 267, 315, 0, 320, 321, 0, + 267, 322, 323, 0, 0, 324, 0, 0, 0, 325, + 326, 160, 159, 0, 0, 0, 292, 0, 0, 0, + 307, 280, 273, 0, 281, 277, 0, 279, 269, 0, + 270, 274, 90, 0, 0, 94, 81, 0, 83, 92, + 0, 84, 93, 95, 85, 91, 82, 0, 88, 164, + 162, 166, 163, 161, 165, 6, 338, 4, 2, 64, + 89, 0, 0, 67, 69, 68, 31, 5, 0, 65, 0, 41, 40, 39, 0, 0, 54, 0, 55, 0, 60, 61, 0, 41, 0, 0, 0, 0, 0, 50, - 51, 0, 52, 0, 53, 0, 56, 57, 0, 0, - 0, 0, 0, 58, 59, 0, 48, 42, 49, 43, - 0, 0, 0, 0, 45, 0, 46, 47, 44, 0, - 0, 0, 30, 35, 36, 37, 38, 140, 265, 0, - 0, 102, 269, 105, 130, 107, 108, 73, 112, 113, - 64, 114, 117, 71, 74, 65, 241, 66, 76, 120, - 69, 122, 72, 124, 125, 270, 127, 128, 132, 140, - 0, 26, 0, 0, 32, 27, 33, 28, 24, 0, - 29, 25, 0, 34, 8, 0, 10, 0, 9, 0, - 1, 21, 12, 0, 13, 0, 14, 0, 19, 20, - 0, 15, 16, 0, 17, 18, 11, 23, 7, 345}; + 0, 51, 0, 0, 26, 0, 0, 62, 27, 0, + 30, 28, 24, 0, 29, 25, 0, 52, 0, 53, + 0, 142, 0, 56, 57, 63, 0, 0, 0, 0, + 0, 58, 59, 0, 48, 42, 49, 43, 0, 0, + 0, 0, 45, 0, 46, 47, 44, 0, 0, 35, + 36, 37, 38, 142, 267, 0, 0, 104, 271, 107, + 132, 109, 110, 75, 114, 115, 66, 116, 119, 73, + 76, 67, 243, 68, 78, 122, 71, 124, 74, 126, + 127, 272, 129, 130, 134, 0, 32, 33, 0, 34, + 8, 0, 10, 0, 9, 0, 1, 21, 12, 0, + 13, 0, 14, 0, 19, 20, 0, 15, 16, 0, + 17, 18, 11, 23, 7, 347}; const short QDeclarativeJSGrammar::goto_default [] = { - 7, 620, 207, 196, 205, 507, 495, 619, 638, 614, - 618, 616, 621, 22, 617, 18, 506, 609, 600, 562, - 508, 191, 195, 197, 201, 524, 550, 549, 200, 232, + 7, 626, 207, 196, 205, 507, 495, 625, 644, 620, + 624, 622, 627, 22, 623, 18, 506, 543, 533, 540, + 535, 191, 195, 197, 201, 524, 568, 567, 200, 232, 26, 474, 473, 356, 355, 9, 354, 357, 107, 17, 145, 24, 13, 144, 19, 25, 57, 23, 8, 28, 27, 269, 15, 263, 10, 259, 12, 261, 11, 260, @@ -211,775 +212,771 @@ const short QDeclarativeJSGrammar::goto_default [] = { 199, 181, 184, 198, 206, 0}; const short QDeclarativeJSGrammar::action_index [] = { - 314, 1273, 2404, 2404, 2307, 1001, 58, 98, 78, -101, - 95, 56, 4, 236, -101, 296, 86, -101, -101, 545, - 97, 115, 162, 197, -101, -101, -101, 447, 192, 1273, - -101, -101, -101, 369, -101, 2113, 1919, 1273, 1273, 1273, - -101, 732, 1273, -101, -101, -101, 1273, 1273, -101, -101, - -101, -101, -101, 1273, -101, 1273, 1273, -101, 1273, 1273, - 81, 195, -101, -101, 1273, 1273, 1273, -101, -101, -101, - 185, 1273, 283, 1273, 1273, 1273, 1273, 447, 1273, 1273, - 1273, 1273, 1273, 1273, 297, 1273, 1273, 1273, 107, 85, - 116, 297, 297, 297, 297, 191, 447, 447, 447, 1273, - 74, 1273, 102, 2016, 1273, 1273, -101, -101, -101, -101, + 421, 1288, 2322, 2322, 2419, 1016, -52, 37, 140, -101, + 35, -13, -40, 190, -101, 272, 34, -101, -101, 658, + 42, 103, 194, 201, -101, -101, -101, 439, 256, 1288, + -101, -101, -101, 282, -101, 2128, 1751, 1288, 1288, 1288, + -101, 917, 1288, -101, -101, -101, 1288, 1288, -101, -101, + -101, -101, -101, 1288, -101, 1288, 1288, -101, 1288, 1288, + 109, 245, -101, -101, 1288, 1288, 1288, -101, -101, -101, + 185, 1288, 295, 1288, 1288, 1288, 1288, 461, 1288, 1288, + 1288, 1288, 1288, 1288, 256, 1288, 1288, 1288, 155, 119, + 114, 176, 256, 332, 202, 332, 560, 560, 471, 1288, + -23, 1288, 53, 2031, 1288, 1288, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, - 112, 1273, -101, -101, 92, 61, -101, 1273, -101, -101, - 1273, -101, -101, -101, -101, -101, -101, -101, -101, -101, - -101, -101, -101, -101, 1273, 36, 1273, 1273, 65, 62, - 1273, -101, 2016, 1273, 1273, -101, 127, -101, 42, -101, - -101, 57, -101, 294, 60, 35, -101, 259, -101, 32, - 2404, -101, -101, -101, -101, -101, 200, -101, -101, 33, - -101, -101, -101, -101, -101, -101, 2404, -101, -101, 436, - -101, 433, 100, 2307, 34, 369, 67, 45, 2598, 71, - 1273, -101, 72, 51, 1273, 59, -101, 54, 55, -101, - -101, 324, -101, -101, -101, -101, -101, -101, 88, -101, - -101, -101, -101, 76, -101, -101, -101, -101, -101, -101, - 5, 49, 1273, 104, 84, -101, -101, 1457, -101, 70, - 41, 1, -101, 287, 68, 46, 643, 73, 77, 364, - 297, 369, 1273, 238, 1273, 1273, 1273, 1273, 341, 1273, - 1273, 1273, 1273, 1273, 297, 175, 167, 161, 176, 348, - 315, 331, 1273, -13, 1273, 63, 1273, -101, 545, 1273, - -101, 1273, 64, 40, 1273, 2, 2307, -101, 1273, 152, - 2307, -101, 1273, 69, 1273, 1273, 75, 79, 1273, -101, - 44, 149, 66, -101, -101, 1273, -101, 369, 1273, -101, - 52, 1273, -54, 2307, -101, 1273, 151, 2307, -101, -29, - 369, -41, -11, 2404, -46, -101, 2307, -101, 1273, 131, - 2307, -5, 2307, -101, 8, 13, -55, -101, -101, 2307, - -51, 360, -2, 352, 119, 1273, 2307, 39, -19, 366, - 3, -24, 910, 6, 7, -101, 1367, -101, 11, -16, - -4, 1273, -6, -31, 1273, 9, 1273, -12, 17, 1273, - -101, 2210, 37, -101, -101, -101, -101, -101, -101, 1273, - -101, -101, -101, -101, 258, -101, 1273, -15, -101, 2307, - -101, 117, -101, -101, 2307, -101, 1273, 106, 16, -101, - 38, -101, 135, 96, 1273, -101, 135, 43, -101, 18, - -101, 2307, -101, 101, 2307, -101, 179, -101, -101, 99, - 2307, 31, -101, -7, -8, -101, 369, -34, -1, -101, - -101, -101, -101, 1273, 124, 2307, -101, 1273, 122, 2307, - -101, 25, -101, 207, -101, -101, 1273, -101, -101, 290, - -101, -101, -101, 114, 1733, -101, -101, 1826, -101, -101, - 1550, -101, -101, -101, -101, -101, -101, 103, -101, -101, - -101, -101, -101, -101, -101, -101, 2404, -101, -101, -101, - 221, -43, 704, 164, -26, 12, -101, -101, 188, -101, - 196, -101, -101, -101, 369, 183, -101, 1273, -101, 165, - -101, -101, 170, 0, 369, 160, 10, 369, 113, -101, - -101, 215, -101, 1273, -101, 225, -101, -101, 203, 369, - 28, 1273, 229, -101, -101, 202, -101, 218, -101, 30, - -21, 369, 199, 278, -101, 110, -101, -101, -101, 1640, - 1092, 583, -101, -101, -101, -101, -101, 284, 2501, 1919, - 14, 388, 29, 424, 93, 1273, 2307, 39, -9, 338, - 21, -3, 821, 24, 23, -101, 1367, -101, 48, 20, - 47, 1273, 50, 26, 1273, 53, 1273, 27, 22, 264, - 120, -101, 15, 813, -101, -101, -101, -101, -101, 1183, - -101, -101, 19, -101, -101, 498, -101, 249, -82, 902, - -101, -101, 118, 369, -101, 204, -101, 80, -101, -101, - 369, -101, -101, 82, -101, -101, -101, -101, -101, -101, + 100, 1288, -101, -101, 70, 59, -101, 1288, -101, -101, + 1288, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, 1288, 41, 1288, 1288, 98, 91, + 1288, -101, 2031, 1288, 1288, -101, 121, -101, 73, -101, + -101, 39, -101, 385, 180, 78, -101, 391, -101, 64, + 2322, -101, -101, -101, -101, -101, 208, -101, -101, 82, + -101, -101, -101, -101, -101, -101, 2322, -101, -101, 538, + -101, 495, 128, 2419, 54, 358, 62, 44, 2613, 67, + 1288, -101, 76, 63, 1288, 58, -101, 60, 46, -101, + -101, 309, -101, -101, -101, -101, -101, -101, 86, -101, + -101, -101, -101, 107, -101, -101, -101, -101, -101, -101, + 28, 52, 1288, 101, 102, -101, -101, 1472, -101, 83, + 75, 79, -101, 287, 84, 80, 585, 69, 89, 321, + 177, 482, 1288, 297, 1288, 1288, 1288, 1288, 331, 1288, + 1288, 1288, 1288, 1288, 332, 222, 332, 332, 332, 410, + 410, 410, 1288, 57, 1288, 72, 1288, -101, 658, 1288, + -101, 1288, 71, 45, 1288, 61, 2419, -101, 1288, 132, + 2419, -101, 1288, 47, 1288, 1288, 66, 65, 1288, -101, + 68, 112, 81, -101, -101, 1288, -101, 369, 1288, -101, + 85, 1288, 74, 2419, -101, 1288, 122, 2419, -101, 77, + 294, 16, -29, 2322, -53, -101, 2419, -101, 1288, 127, + 2419, -15, 2419, -101, 10, 11, -34, -101, -101, 2419, + -48, 504, 4, 476, 113, 1288, 2419, 2, -28, 420, + 6, -21, 719, 7, 87, -101, 1382, -101, -4, -16, + 5, 1288, 3, -27, 1288, 9, 1288, -18, -31, 1288, + -101, 2225, -7, -101, -101, -101, -101, -101, -101, 1288, + -101, -101, -101, -101, 246, -101, 1288, -38, -101, 2419, + -101, 88, -101, -101, 2419, -101, 1288, 106, 26, -101, + 55, -101, 50, 105, 1288, -101, 48, 38, -101, -8, + -101, 2419, -101, 94, 2419, -101, 238, -101, -101, 104, + 2419, 31, -101, 21, 19, -101, 305, 1, 30, -101, + -101, -101, -101, 1288, 136, 2419, -101, 1288, 134, 2419, + -101, 49, -101, 173, -101, -101, 1288, -101, -101, 363, + -101, -101, -101, 137, 1565, -101, -101, 1658, -101, -101, + 1844, -101, -101, -101, -101, -101, -101, 95, -101, -101, + -101, -101, -101, -101, -101, -101, 2322, -101, -101, -101, + 92, 15, 925, 169, 27, -6, -101, -101, 212, -101, + 191, -101, -101, -101, 323, 211, -101, 1288, -101, 214, + -101, -101, 216, 40, 317, 210, 43, 259, 236, -101, + 36, -101, 747, 96, -101, 29, 747, -101, -101, 1198, + -101, -101, -101, 1107, -101, -101, 231, -101, 1288, -101, + 217, 286, 32, -101, -101, -101, 188, 340, 51, 1288, + 175, -101, -101, 171, -101, 179, -101, 56, -11, 351, + 181, 336, -101, 110, -101, -101, -101, 1934, 647, -101, + -101, -101, -101, 253, 2516, 1751, -5, 460, 22, 468, + 138, 1288, 2419, 24, -2, 412, 23, -3, 836, 20, + 87, -101, 1382, -101, 17, -10, 18, 1288, 25, 8, + 1288, 33, 1288, 12, 14, 120, -101, -101, 13, -101, + -101, 747, -101, 248, -47, 828, -101, -101, 152, 482, + -101, 150, -101, 123, -101, -101, 398, -101, -101, 117, + -101, -101, -101, -101, -101, -101, - -106, 17, -83, 19, 24, 228, -106, -106, -106, -106, - -106, -106, -106, -106, -106, -106, -106, -106, -106, -49, - -106, -106, -106, -106, -106, -106, -106, -106, -106, 101, - -106, -106, -106, 2, -106, -106, -2, 29, 107, 166, - -106, 204, 183, -106, -106, -106, 174, 169, -106, -106, - -106, -106, -106, 145, -106, 141, 137, -106, 152, 161, - -106, -106, -106, -106, 163, 158, 157, -106, -106, -106, - -106, 132, -106, 142, 138, 187, 178, -106, 167, 181, - 81, 82, 85, 83, -106, 93, 114, 96, -106, -106, - -106, -106, -106, -106, -106, -106, -106, -106, -106, 170, - -106, 74, -106, 109, 80, 51, -106, -106, -106, -106, + -106, 6, -92, 10, 5, 278, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -42, + -106, -106, -106, -106, -106, -106, -106, -106, -106, 109, + -106, -106, -106, -10, -106, -106, -35, 24, 73, 90, + -106, 219, 181, -106, -106, -106, 171, 120, -106, -106, + -106, -106, -106, 174, -106, 170, 167, -106, 175, 163, + -106, -106, -106, -106, 184, 177, 180, -106, -106, -106, + -106, 125, -106, 132, 134, 162, 130, -106, 121, 124, + 123, 141, 142, 152, -106, 154, 161, 160, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, 139, + -106, 143, -106, 156, 91, 55, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, - -106, 25, -106, -106, -106, -106, -106, 41, -106, -106, - 50, -106, -106, -106, -106, -106, -106, -106, -106, -106, - -106, -106, -106, -106, 98, -106, 104, 43, -106, -106, - 42, -106, 221, 64, 117, -106, -106, -106, -106, -106, - -106, -106, -106, 54, -106, -106, -106, 55, -106, -106, + -106, 32, -106, -106, -106, -106, -106, 33, -106, -106, + 26, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, 96, -106, 119, 52, -106, -106, + 66, -106, 220, 69, 71, -106, -106, -106, -106, -106, + -106, -106, -106, 25, -106, -106, -106, 64, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, - -106, -106, -106, -106, -106, -106, 47, -106, -106, 38, - -106, 33, -106, 92, -106, 73, -106, -106, 88, -106, - 86, -106, -106, -106, 94, 23, -106, -106, -106, -106, - -106, -11, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, 70, -106, -106, 61, + -106, 41, -106, 39, -106, 37, -106, -106, 42, -106, + 79, -106, -106, -106, 81, 72, -106, -106, -106, -106, + -106, -5, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, - -106, -106, 22, -106, -106, -106, -106, 105, -106, -106, + -106, -106, 21, -106, -106, -106, -106, 112, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, - -106, 7, 235, -106, 249, 219, 216, 222, -106, 124, - 125, 123, 122, 116, -106, -106, -106, -106, -106, -106, - -106, -106, 191, -106, 232, -106, 225, -106, -106, 231, - -106, 156, -106, -106, 130, -106, 91, -106, 5, -106, - 8, -106, 233, -106, 200, 189, -106, -106, 198, -106, - -106, -106, -106, -106, -106, 245, -106, 108, 95, -106, - -106, 298, -106, 195, -106, 89, -106, 71, -106, -106, - 120, -106, -106, -5, -106, -106, 52, -106, 53, -106, - 56, -106, 60, -106, -106, -106, -106, -106, -106, 39, - -106, 37, -106, 49, -106, 133, 69, -106, -106, 59, - -106, -106, 102, -106, -106, -106, 79, -106, -106, -106, - -106, 62, -106, 45, 67, -106, 75, -106, -106, 44, - -106, 1, -106, -106, -106, -106, -106, -106, -106, 46, - -106, -106, -106, -106, -106, -106, 115, -106, -106, 66, - -106, -106, -106, -106, 70, -106, 77, -106, -106, -106, - -106, -106, -9, -106, 72, -106, -38, -106, -106, -106, - -106, 97, -106, -106, 99, -106, -106, -106, -106, -106, - 40, -51, -106, -106, 36, -106, 34, -106, 63, -106, - -106, -106, -106, 35, -106, 48, -106, 58, -106, 57, - -106, -106, -106, -106, -106, -106, 28, -106, -106, 90, - -106, -106, -106, -106, 65, -106, -106, 159, -106, -106, - 61, -106, -106, -106, -106, -106, -106, -106, -106, -106, - -106, -106, -106, -106, -106, -106, 87, -106, -106, -106, - -106, -106, -13, -106, -106, -106, -106, -106, -106, -106, - -18, -106, -106, -106, -10, -106, -106, 0, -106, -106, - -106, -106, -106, -106, -4, -12, -106, -6, -106, -106, - -106, -106, -106, 3, -106, -106, -106, -106, -23, -14, - -106, 11, -106, -106, -106, -106, -106, 15, -106, -106, - -106, 16, 18, 14, -106, -106, -106, -106, -106, 292, - 399, 180, -106, -106, -106, -106, -106, -106, 26, 286, - 20, 21, -106, 30, -106, 177, 10, -106, -106, 31, - -106, -106, 193, -106, -106, -106, 32, -106, -106, -106, - -106, 27, -106, 13, 76, -106, 68, -106, -106, -106, - -106, -106, -106, 230, -106, -106, -106, -106, -106, 290, - -106, -106, -3, -106, -106, 6, -106, -106, 4, 270, - -106, -106, -106, 9, -106, -106, -106, -106, -106, -106, - 12, -106, -106, -106, -106, -106, -106, -106, -106, -106}; + -106, 17, 237, -106, 192, 236, 224, 225, -106, 97, + 98, 101, 99, 113, -106, -106, -106, -106, -106, -106, + -106, -106, 204, -106, 223, -106, 235, -106, -106, 239, + -106, 197, -106, -106, 228, -106, 27, -106, 13, -106, + 2, -106, 233, -106, 190, 198, -106, -106, 196, -106, + -106, -106, -106, -106, -106, 200, -106, 107, 135, -106, + -106, 186, -106, 84, -106, 80, -106, 76, -106, -106, + 89, -106, -106, -49, -106, -106, 47, -106, 40, -106, + 44, -106, 68, -106, -106, -106, -106, -106, -106, 53, + -106, 35, -106, 49, -106, 87, 63, -106, -106, 30, + -106, -106, 103, -106, -106, -106, 51, -106, -106, -106, + -106, 86, -106, 67, 114, -106, 74, -106, -106, 65, + -106, 56, -106, -106, -106, -106, -106, -106, -106, 62, + -106, -106, -106, -106, -106, -106, 95, -106, -106, 78, + -106, -106, -106, -106, 75, -106, 88, -106, -106, -106, + -106, -106, -54, -106, 45, -106, -40, -106, -106, -106, + -106, 94, -106, -106, 100, -106, -106, -106, -106, -106, + 150, -41, -106, -106, 54, -106, 43, -106, 48, -106, + -106, -106, -106, 59, -106, 57, -106, 60, -106, 58, + -106, -106, -106, -106, -106, -106, 38, -106, -106, 144, + -106, -106, -106, -106, 31, -106, -106, 202, -106, -106, + 50, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, 77, -106, -106, -106, + -106, -106, 82, -106, -106, -106, -106, -106, -106, -106, + -17, -106, -106, -106, -4, -106, -106, 12, -106, -106, + -106, -106, -106, -106, -14, 46, -106, -13, -106, -106, + -106, -106, 108, -106, -106, -106, 243, -106, -106, 295, + -106, -106, -106, 290, -106, -106, -106, -106, 346, -106, + -106, -106, 16, -106, -106, -106, 22, 23, -106, 34, + -106, -106, -106, -106, -106, 11, -106, -106, -106, 7, + 1, 8, -106, -106, -106, -106, -106, 307, 179, -106, + -106, -106, -106, -106, 18, 281, 9, 15, -106, 4, + -106, 83, 29, -106, -106, -2, -106, -106, 85, -106, + -106, -106, 3, -106, -106, -106, -106, 14, -106, 0, + 105, -106, 93, -106, -106, -106, -106, -106, -1, -106, + -106, 20, -106, -106, 28, 92, -106, -106, -106, 19, + -106, -106, -106, -106, -106, -106, -12, -106, -106, -106, + -106, -106, -106, -106, -106, -106}; const short QDeclarativeJSGrammar::action_info [] = { - 401, -123, 440, -121, 403, -129, 333, 340, 615, 345, - -96, 352, 348, -118, -100, 389, -126, 257, -99, 342, - 416, 391, 343, 510, 453, 440, 448, 257, -96, 446, - -100, -118, 440, 348, 527, 541, -129, 525, 552, 555, - 538, 545, 466, 424, 399, 408, -110, 560, 560, 420, - 431, 444, 560, 457, -121, -99, 416, -123, 457, 440, - -126, 325, 306, 453, 272, 190, 294, 164, 187, 170, - 257, 272, 141, 430, 346, 312, 296, 312, 409, 414, - 294, 348, 251, 101, 99, 252, 318, 416, 236, 292, - 453, 457, 440, 183, 141, 189, 71, 335, 639, 164, - 147, 304, 179, 71, 99, 443, 427, 301, 434, 141, - 0, 141, 141, 331, 141, 0, 0, 292, 58, 444, - 141, 149, 477, 62, 0, 58, 0, 314, 603, 59, - 141, 315, 141, 172, 63, 141, 59, 247, 246, 141, - 424, 629, 628, 635, 634, 256, 255, 58, 615, 242, - 241, 428, 173, 101, 249, 248, 58, 327, 59, 141, - 141, 249, 248, 488, 254, 166, 418, 59, 142, 167, - 478, 557, 556, 141, 530, 529, 604, 172, 413, 412, - 249, 248, 459, 177, 455, 172, 85, 141, 86, 511, - 517, 350, 85, 523, 86, 559, 173, 64, 174, 87, - 85, 85, 86, 86, 173, 87, 406, 64, 141, 64, - 328, 337, 310, 87, 87, 469, 85, 85, 86, 86, - 0, 560, 533, 0, 0, 511, 521, 520, 511, 87, - 87, 0, 511, 141, 0, 513, 172, 141, 547, 513, - 438, 437, 65, 0, 518, 516, 512, 511, 66, 0, - 512, 103, 65, 0, 65, 173, 274, 275, 66, 0, - 66, 235, 234, 548, 546, 632, 631, 0, 470, 468, - 104, 513, 105, 172, 513, 0, 534, 532, 513, 172, - 561, 0, 512, 276, 277, 512, 537, 536, 34, 512, - 544, 543, 173, 513, 406, 630, 625, -87, 173, 172, - 174, 73, 74, 0, 512, 274, 275, 34, 0, 0, - 626, 624, 0, 0, 73, 74, 0, -87, 173, 34, - 174, 0, 85, 34, 86, 48, 50, 49, 75, 76, - 0, 0, 276, 277, 0, 87, 0, 0, 279, 280, - 623, 75, 76, 0, 48, 50, 49, 281, 0, 0, - 282, 45, 283, 34, 279, 280, 48, 50, 49, 0, - 48, 50, 49, 281, 279, 280, 282, 34, 283, 0, - 45, 279, 280, 281, -341, 0, 282, 0, 283, 0, - 281, 34, 45, 282, 0, 283, 45, 279, 280, 34, - 48, 50, 49, 0, 0, 34, 281, 0, 34, 282, - 0, 283, -341, 0, 48, 50, 49, 6, 5, 4, - 1, 3, 2, 245, 244, 0, 45, 34, 48, 50, - 49, 240, 239, 0, 0, 0, 48, 50, 49, 0, - 45, 0, 48, 50, 49, 48, 50, 49, 0, 0, - 0, 0, 0, 0, 45, 0, 0, 0, 0, 240, - 239, 0, 45, 34, 48, 50, 49, 0, 45, 0, - 0, 45, 34, 0, 0, 34, 0, 0, 0, 0, - 78, 79, 0, 0, 0, 0, 0, 0, 80, 81, - 45, 0, 82, 0, 83, 245, 244, 0, 0, 0, - 48, 50, 49, 0, 245, 244, 0, 240, 239, 48, - 50, 49, 48, 50, 49, 0, 0, 0, 0, 0, - 30, 31, 0, 0, 0, 0, 45, 0, 0, 0, - 33, 0, 0, 0, 0, 45, 0, 34, 45, 0, + 399, 352, 345, -101, 343, 457, 440, 403, 257, -112, + -125, -131, -123, -98, -120, 348, -128, 389, 453, 391, + 416, 401, 408, 563, -101, -123, 416, -120, 539, -131, + -98, -112, -125, 348, 257, 99, 71, 645, 621, 101, + -128, 440, 141, 621, 164, 431, 539, 430, 453, 573, + 457, 444, 440, 424, 71, 424, 101, 446, 559, 420, + 424, 448, 539, 440, 570, 539, 466, 527, 312, 346, + 532, 312, 318, 272, 409, 183, 342, 525, 147, 141, + 348, 510, 457, 414, 272, 325, 0, 0, 252, 99, + 257, 440, 296, 556, -102, 292, 453, 190, 170, 416, + 164, 434, 141, 141, 536, 251, 304, 172, 141, 141, + 443, 0, 335, 340, 141, 427, 0, 0, 0, 149, + 327, 306, 0, 292, 444, 0, 173, 0, 536, 141, + 141, 0, 0, 179, 333, 141, 294, 236, 189, 314, + 141, 301, 141, 315, 141, 477, 331, 242, 241, 413, + 412, 62, 537, 166, 58, 488, 142, 167, 294, 58, + 428, 254, 63, 256, 255, 59, 418, 172, 247, 246, + 59, 575, 574, 328, 249, 248, 616, 177, 641, 640, + 58, 469, 337, 141, 635, 634, 173, 350, 187, 249, + 248, 59, 310, 478, 459, 58, 455, 64, 523, 249, + 248, 85, 85, 86, 86, 103, 59, 565, 511, 172, + 511, 638, 637, 64, 87, 87, 141, 511, 517, 577, + 511, 0, 141, 0, 104, 141, 105, 85, 173, 86, + 174, 172, 566, 564, 470, 468, 562, 561, 548, 511, + 87, 636, 65, 530, 513, 539, 141, 85, 66, 86, + 173, 0, 406, 0, 513, 512, 513, 64, 65, 0, + 87, 172, 0, 513, 66, 512, 513, 512, 172, 235, + 234, 0, 518, 516, 512, 521, 520, 512, 554, 553, + 173, 85, 406, 86, 0, 513, -89, 173, 34, 174, + 73, 74, 549, 547, 87, 631, 512, 531, 529, 438, + 437, 172, 65, 0, 578, 274, 275, 0, 66, 632, + 630, 34, 0, 73, 74, 274, 275, 75, 76, -89, + 173, 0, 174, 34, 0, 48, 50, 49, 0, 0, + 0, 0, 276, 277, 34, 0, 0, 0, 34, 629, + 75, 76, 276, 277, 279, 280, 34, 0, 48, 50, + 49, 45, 34, 281, 279, 280, 282, 85, 283, 86, + 48, 50, 49, 281, 0, 34, 282, 0, 283, 34, + 87, 48, 50, 49, 45, 48, 50, 49, 0, 0, + 34, 0, 0, 48, 50, 49, 45, 34, 0, 48, + 50, 49, 34, 0, 0, 0, 0, 45, 34, 0, + 0, 45, 48, 50, 49, 0, 48, 50, 49, 45, + 0, 0, 0, 0, 34, 45, 0, 48, 50, 49, + 34, 0, 0, 0, 48, 50, 49, 34, 45, 48, + 50, 49, 45, 279, 280, 48, 50, 49, 0, 0, + 0, 34, 281, 45, 0, 282, 0, 283, -343, 34, + 45, 48, 50, 49, 0, 45, -343, 48, 50, 49, + 0, 45, 78, 79, 48, 50, 49, 0, 0, 0, + 80, 81, 0, 0, 82, 0, 83, 45, 48, 50, + 49, 0, 0, 45, 78, 79, 48, 50, 49, 34, + 45, 0, 80, 81, 78, 79, 82, 34, 83, 0, + 0, 0, 80, 81, 45, 34, 82, 0, 83, 0, + 0, 34, 45, 0, 6, 5, 4, 1, 3, 2, + 0, 240, 239, 0, 34, 0, 48, 50, 49, 245, + 244, 0, 0, 34, 48, 50, 49, 245, 244, 0, + 0, 0, 48, 50, 49, 0, 0, 0, 48, 50, + 49, 0, 45, 0, 0, 0, 245, 244, 0, 0, + 45, 48, 50, 49, 0, 240, 239, 34, 45, 0, + 48, 50, 49, 0, 45, 0, 0, 0, 0, 0, + 0, 0, 0, 78, 79, 0, 0, 45, 151, 0, + 0, 80, 81, 0, 0, 82, 45, 83, 152, 240, + 239, 0, 153, 0, 48, 50, 49, 0, 0, 0, + 0, 154, 0, 155, 0, 0, 308, 0, 0, 0, + 0, 0, 0, 0, 156, 0, 157, 62, 0, 0, + 45, 0, 0, 0, 158, 0, 0, 159, 63, 0, + 0, 0, 0, 160, 0, 0, 0, 0, 0, 161, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, + 31, 151, 0, 0, 0, 162, 0, 0, 0, 33, + 0, 152, 0, 0, 0, 153, 34, 0, 0, 0, + 35, 36, 0, 37, 154, 0, 155, 0, 0, 0, + 502, 0, 0, 0, 44, 0, 0, 156, 0, 157, + 62, 0, 0, 0, 0, 0, 0, 158, 0, 0, + 159, 63, 51, 48, 50, 49, 160, 52, 0, 0, + 0, 0, 161, 0, 0, 0, 0, 0, 43, 54, + 32, 30, 31, 0, 40, 0, 0, 0, 162, 45, + 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, + 0, 0, 35, 36, 0, 37, 0, 0, 0, 30, + 31, 0, 41, 0, 0, 0, 44, 0, 0, 33, + 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, + 35, 36, 0, 37, 51, 48, 50, 49, 0, 52, + 502, 0, 0, 0, 44, 0, 0, 0, 0, 0, + 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, + 0, 45, 51, 48, 50, 49, 0, 52, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 43, 54, + 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, + 30, 31, 0, 0, 0, 0, 0, 0, 30, 31, + 33, 0, 0, 0, 0, 0, 0, 34, 33, 0, + 0, 35, 36, 0, 37, 34, 0, 0, 0, 35, + 36, 502, 37, 0, 0, 44, 0, 0, 0, 41, + 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 51, 48, 50, 49, 0, 52, 0, + 0, 51, 48, 50, 49, 0, 52, 0, 0, 43, + 54, 32, 0, 0, 0, 40, 0, 43, 54, 32, + 45, 0, 0, 40, 0, 0, 0, 0, 45, 30, + 31, 0, 0, 0, 0, 0, 0, 30, 31, 33, + 0, 0, 0, 0, 0, 0, 34, 33, 0, 0, + 35, 36, 0, 37, 34, 0, 0, 0, 35, 36, + 41, 37, 0, 0, 44, 0, 0, 0, 502, 0, + 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 51, 48, 50, 49, 0, 52, 0, 0, + 51, 48, 50, 49, 0, 52, 0, 0, 43, 54, + 32, 0, 0, 0, 40, 0, 43, 54, 32, 45, + 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, + 0, 0, 0, 0, 0, 0, 501, 0, 30, 31, + 0, 0, 0, 0, 0, 0, 0, 0, 215, 0, + 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, + 36, 0, 37, 0, 0, 0, 0, 0, 0, 502, + 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 51, 503, 505, 504, 0, 52, 0, 0, 0, + 0, 226, 0, 0, 0, 0, 0, 43, 54, 32, + 210, 0, 0, 40, 0, 0, 0, 0, 45, 0, + 0, 0, 0, 0, 0, 0, 0, 501, 0, 30, + 31, 0, 0, 0, 0, 0, 0, 0, 0, 215, + 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, + 35, 36, 0, 37, 0, 0, 0, 0, 0, 0, + 502, 0, 0, 0, 44, 0, 0, 0, 0, 0, + 0, 0, 544, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 51, 503, 505, 504, 0, 52, 0, 0, + 0, 0, 226, 0, 0, 0, 0, 0, 43, 54, + 32, 210, 0, 0, 40, 0, 0, 0, 0, 45, + 0, 0, 0, 0, 0, 0, 0, 0, 501, 0, + 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, + 215, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 0, 0, - 0, 502, 0, 0, 0, 44, 0, 0, 151, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 152, 0, - 0, 0, 153, 51, 48, 50, 49, 0, 52, 0, - 0, 154, 0, 155, 0, 0, 0, 0, 0, 43, - 54, 32, 0, 0, 156, 40, 157, 62, 0, 0, - 45, 0, 0, 0, 158, 30, 31, 159, 63, 0, - 0, 0, 0, 160, 0, 33, 0, 0, 0, 161, - 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, - 0, 0, 0, 0, 0, 162, 502, 0, 0, 0, - 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 151, 0, 51, 48, - 50, 49, 0, 52, 0, 0, 152, 0, 0, 0, - 153, 0, 0, 0, 43, 54, 32, 0, 0, 154, - 40, 155, 0, 0, 308, 45, 0, 0, 0, 0, - 0, 0, 156, 0, 157, 62, 0, 0, 0, 0, - 0, 0, 158, 0, 0, 159, 63, 0, 0, 0, - 0, 160, 0, 0, 0, 0, 0, 161, 0, 0, - 0, 0, 0, 0, 0, 0, 30, 31, 0, 0, - 0, 0, 0, 162, 0, 0, 33, 0, 0, 0, - 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, - 37, 0, 0, 0, 30, 31, 0, 502, 0, 0, - 0, 44, 0, 0, 33, 0, 0, 0, 0, 0, - 0, 34, 0, 0, 0, 35, 36, 0, 37, 51, - 48, 50, 49, 0, 52, 41, 0, 0, 0, 44, - 0, 0, 0, 0, 0, 43, 54, 32, 0, 0, - 0, 40, 0, 0, 0, 0, 45, 51, 48, 50, - 49, 0, 52, 0, 0, 0, 0, 0, 0, 0, + 0, 502, 0, 0, 0, 44, 0, 0, 0, 0, + 0, 0, 0, 541, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 51, 503, 505, 504, 0, 52, 0, + 0, 0, 0, 226, 0, 0, 0, 0, 0, 43, + 54, 32, 210, 0, 0, 40, 0, 0, 0, 0, + 45, 0, 0, 0, 0, 0, 0, 0, 0, 29, + 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, + 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, + 0, 35, 36, 0, 37, 0, 0, 0, 38, 0, + 39, 41, 42, 0, 0, 44, 0, 0, 0, 46, + 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 51, 48, 50, 49, 0, 52, 0, + 53, 0, 55, 0, 56, 0, 0, 0, 0, 43, + 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, + 45, 0, 0, 0, 0, 0, 0, 0, 0, -121, + 0, 0, 0, 29, 30, 31, 0, 0, 0, 0, + 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, + 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, + 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, + 0, 0, 0, 46, 0, 47, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 51, 48, 50, + 49, 0, 52, 0, 53, 0, 55, 0, 56, 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, 40, - 0, 0, 0, 0, 45, 30, 31, 0, 0, 0, - 0, 0, 0, 30, 31, 33, 0, 0, 0, 0, - 0, 0, 34, 33, 0, 0, 35, 36, 0, 37, - 34, 0, 0, 0, 35, 36, 502, 37, 0, 0, - 44, 0, 0, 0, 41, 0, 0, 0, 44, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 51, 48, - 50, 49, 0, 52, 0, 0, 51, 48, 50, 49, - 0, 52, 0, 0, 43, 54, 32, 0, 0, 0, - 40, 0, 43, 54, 32, 45, 0, 0, 40, 0, - 0, 0, 0, 45, 30, 31, 0, 0, 0, 0, - 0, 0, 30, 31, 33, 0, 0, 0, 0, 0, - 0, 34, 33, 0, 0, 35, 36, 0, 37, 34, - 0, 0, 0, 35, 36, 502, 37, 0, 0, 44, - 0, 0, 0, 41, 0, 0, 0, 44, 0, 0, + 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, + 0, 0, 0, 29, 30, 31, 0, 0, 0, 0, + 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, + 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, + 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, + 0, 0, 0, 46, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 48, 50, - 49, 0, 52, 0, 0, 51, 48, 50, 49, 0, - 52, 0, 0, 43, 54, 32, 0, 0, 0, 40, - 0, 43, 54, 32, 45, 0, 0, 40, 0, 0, - 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, - 0, 501, 0, 30, 31, 0, 0, 0, 0, 0, - 0, 0, 0, 215, 0, 0, 0, 0, 0, 0, + 49, 0, 52, 0, 53, 0, 55, 271, 56, 0, + 0, 0, 0, 43, 54, 32, 0, 0, 0, 40, + 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, + 0, 0, 0, 483, 0, 0, 29, 30, 31, 0, + 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, + 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, + 0, 37, 0, 0, 0, 38, 0, 39, 41, 42, + 0, 0, 44, 0, 0, 0, 46, 0, 47, 0, + 0, 486, 0, 0, 0, 0, 0, 0, 0, 0, + 51, 48, 50, 49, 0, 52, 0, 53, 0, 55, + 0, 56, 0, 0, 0, 0, 43, 54, 32, 0, + 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, + 0, 0, 0, 0, 0, 0, 475, 0, 0, 29, + 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, + 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, + 0, 35, 36, 0, 37, 0, 0, 0, 38, 0, + 39, 41, 42, 0, 0, 44, 0, 0, 0, 46, + 0, 47, 0, 0, 481, 0, 0, 0, 0, 0, + 0, 0, 0, 51, 48, 50, 49, 0, 52, 0, + 53, 0, 55, 0, 56, 0, 0, 0, 0, 43, + 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, + 45, 0, 0, 0, 0, 0, 0, 0, 0, 475, + 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, + 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, - 0, 0, 0, 0, 502, 0, 0, 0, 44, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 51, 503, 505, 504, - 0, 52, 0, 0, 0, 0, 226, 0, 0, 0, - 0, 0, 43, 54, 32, 210, 0, 0, 40, 0, + 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, + 0, 0, 46, 0, 47, 0, 0, 476, 0, 0, + 0, 0, 0, 0, 0, 0, 51, 48, 50, 49, + 0, 52, 0, 53, 0, 55, 0, 56, 0, 0, + 0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, - 0, 0, 501, 0, 30, 31, 0, 0, 0, 0, - 0, 0, 0, 0, 215, 0, 0, 0, 0, 0, - 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, - 0, 0, 0, 0, 0, 502, 0, 0, 0, 44, - 0, 0, 0, 0, 0, 0, 0, 607, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 51, 503, 505, - 504, 0, 52, 0, 0, 0, 0, 226, 0, 0, - 0, 0, 0, 43, 54, 32, 210, 0, 0, 40, - 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, - 0, 0, 0, 501, 0, 30, 31, 0, 0, 0, - 0, 0, 0, 0, 0, 215, 0, 0, 0, 0, - 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, - 0, 0, 0, 0, 0, 0, 502, 0, 0, 0, - 44, 0, 0, 0, 0, 0, 0, 0, 610, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 51, 503, - 505, 504, 0, 52, 0, 0, 0, 0, 226, 0, - 0, 0, 0, 0, 43, 54, 32, 210, 0, 0, - 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, - 0, 0, 0, 0, 29, 30, 31, 0, 0, 0, - 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, - 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, - 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, - 44, 0, 0, 0, 46, 0, 47, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 51, 48, - 50, 49, 0, 52, 0, 53, 0, 55, 0, 56, - 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, - 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, - 0, 0, 0, 0, -119, 0, 0, 0, 29, 30, - 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, - 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, - 35, 36, 0, 37, 0, 0, 0, 38, 0, 39, - 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, - 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 51, 48, 50, 49, 0, 52, 0, 53, - 0, 55, 0, 56, 0, 0, 0, 0, 43, 54, - 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, - 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, - 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, - 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, - 35, 36, 0, 37, 0, 0, 0, 38, 0, 39, - 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, - 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 51, 48, 50, 49, 0, 52, 0, 53, - 0, 55, 271, 56, 0, 0, 0, 0, 43, 54, - 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, - 0, 0, 0, 0, 0, 0, 0, 0, 483, 0, - 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, - 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, - 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, - 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, - 0, 46, 0, 47, 0, 0, 484, 0, 0, 0, - 0, 0, 0, 0, 0, 51, 48, 50, 49, 0, - 52, 0, 53, 0, 55, 0, 56, 0, 0, 0, - 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, - 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, - 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, - 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, - 217, 0, 0, 568, 569, 0, 37, 0, 0, 0, - 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, - 0, 46, 0, 47, 0, 0, 0, 0, 0, 0, - 0, 221, 0, 0, 0, 51, 48, 50, 49, 0, - 52, 0, 53, 0, 55, 0, 56, 0, 0, 0, - 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, - 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, - 0, 483, 0, 0, 29, 30, 31, 0, 0, 0, - 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, - 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, - 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, - 44, 0, 0, 0, 46, 0, 47, 0, 0, 486, - 0, 0, 0, 0, 0, 0, 0, 0, 51, 48, - 50, 49, 0, 52, 0, 53, 0, 55, 0, 56, - 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, - 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, - 0, 0, 0, 0, 475, 0, 0, 29, 30, 31, - 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, - 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, - 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, - 42, 0, 0, 44, 0, 0, 0, 46, 0, 47, - 0, 0, 481, 0, 0, 0, 0, 0, 0, 0, - 0, 51, 48, 50, 49, 0, 52, 0, 53, 0, - 55, 0, 56, 0, 0, 0, 0, 43, 54, 32, - 0, 0, 0, 40, 0, 0, 0, 0, 45, 0, - 0, 0, 0, 0, 0, 0, 0, 475, 0, 0, - 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, - 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, - 0, 0, 35, 36, 0, 37, 0, 0, 0, 38, - 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, - 46, 0, 47, 0, 0, 476, 0, 0, 0, 0, - 0, 0, 0, 0, 51, 48, 50, 49, 0, 52, - 0, 53, 0, 55, 0, 56, 0, 0, 0, 0, - 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, - 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, - 109, 110, 111, 0, 0, 113, 115, 116, 0, 0, - 117, 0, 118, 0, 0, 0, 120, 121, 122, 0, - 0, 0, 0, 0, 0, 34, 123, 124, 125, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 129, 0, 0, 0, 0, - 0, 0, 48, 50, 49, 130, 131, 132, 0, 134, - 135, 136, 137, 138, 139, 0, 0, 127, 133, 119, - 112, 114, 128, 0, 0, 0, 0, 0, 45, 0, - 0, 0, 0, 0, 0, 0, 0, 109, 110, 111, - 0, 0, 113, 115, 116, 0, 0, 117, 0, 118, - 0, 0, 0, 120, 121, 122, 0, 0, 0, 0, - 0, 0, 393, 123, 124, 125, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 126, 0, 0, 0, - 394, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 129, 0, 0, 0, 0, 0, 398, 395, - 397, 0, 130, 131, 132, 0, 134, 135, 136, 137, - 138, 139, 0, 0, 127, 133, 119, 112, 114, 128, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 109, 110, 111, 0, 0, 113, - 115, 116, 0, 0, 117, 0, 118, 0, 0, 0, - 120, 121, 122, 0, 0, 0, 0, 0, 0, 393, - 123, 124, 125, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 126, 0, 0, 0, 394, 0, 0, - 0, 0, 0, 0, 0, 396, 0, 0, 0, 129, - 0, 0, 0, 0, 0, 398, 395, 397, 0, 130, - 131, 132, 0, 134, 135, 136, 137, 138, 139, 0, - 0, 127, 133, 119, 112, 114, 128, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 209, 0, 0, 0, 0, 211, 0, 29, 30, - 31, 213, 0, 0, 0, 0, 0, 0, 214, 33, - 0, 0, 0, 0, 0, 0, 216, 217, 0, 0, - 218, 36, 0, 37, 0, 0, 0, 38, 0, 39, - 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, - 47, 0, 0, 0, 0, 0, 220, 0, 221, 0, - 0, 0, 51, 219, 222, 49, 223, 52, 224, 53, - 225, 55, 226, 56, 227, 228, 0, 0, 43, 54, - 32, 210, 212, 0, 40, 0, 0, 0, 0, 45, - 0, 0, 0, 0, 0, 0, 0, 0, 209, 0, - 0, 0, 0, 211, 0, 29, 30, 31, 213, 0, - 0, 0, 0, 0, 0, 214, 215, 0, 0, 0, - 0, 0, 0, 216, 217, 0, 0, 218, 36, 0, + 0, 0, 483, 0, 0, 29, 30, 31, 0, 0, + 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, + 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, + 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, + 0, 44, 0, 0, 0, 46, 0, 47, 0, 0, + 484, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 48, 50, 49, 0, 52, 0, 53, 0, 55, 0, + 56, 0, 0, 0, 0, 43, 54, 32, 0, 0, + 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, + 0, 0, 0, 0, 0, 29, 30, 31, 0, 0, + 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, + 0, 0, 0, 34, 217, 0, 0, 584, 585, 0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 0, - 0, 0, 0, 220, 0, 221, 0, 0, 0, 51, - 219, 222, 49, 223, 52, 224, 53, 225, 55, 226, - 56, 227, 228, 0, 0, 43, 54, 32, 210, 212, + 0, 0, 0, 0, 0, 221, 0, 0, 0, 51, + 48, 50, 49, 0, 52, 0, 53, 0, 55, 0, + 56, 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, - 0, 0, 0, 0, 0, 571, 110, 111, 0, 0, - 573, 115, 575, 30, 31, 576, 0, 118, 0, 0, - 0, 120, 578, 579, 0, 0, 0, 0, 0, 0, - 580, 581, 124, 125, 218, 36, 0, 37, 0, 0, - 0, 38, 0, 39, 582, 42, 0, 0, 584, 0, - 0, 0, 46, 0, 47, 0, 0, 0, 0, 0, - 586, 0, 221, 0, 0, 0, 588, 585, 587, 49, - 589, 590, 591, 53, 593, 594, 595, 596, 597, 598, - 0, 0, 583, 592, 577, 572, 574, 128, 40, 0, + 0, 0, 0, 0, 0, 109, 110, 111, 0, 0, + 113, 115, 116, 0, 0, 117, 0, 118, 0, 0, + 0, 120, 121, 122, 0, 0, 0, 0, 0, 0, + 34, 123, 124, 125, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 126, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 129, 0, 0, 0, 0, 0, 0, 48, 50, 49, + 130, 131, 132, 0, 134, 135, 136, 137, 138, 139, + 0, 0, 127, 133, 119, 112, 114, 128, 0, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, - 0, 0, 361, 110, 111, 0, 0, 363, 115, 365, - 30, 31, 366, 0, 118, 0, 0, 0, 120, 368, - 369, 0, 0, 0, 0, 0, 0, 370, 371, 124, - 125, 218, 36, 0, 37, 0, 0, 0, 38, 0, - 39, 372, 42, 0, 0, 374, 0, 0, 0, 46, - 0, 47, 0, -265, 0, 0, 0, 376, 0, 221, - 0, 0, 0, 378, 375, 377, 49, 379, 380, 381, - 53, 383, 384, 385, 386, 387, 388, 0, 0, 373, - 382, 367, 362, 364, 128, 40, 0, 0, 0, 0, - 45, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 109, 110, 111, 0, 0, 113, 115, 116, + 0, 0, 117, 0, 118, 0, 0, 0, 120, 121, + 122, 0, 0, 0, 0, 0, 0, 393, 123, 124, + 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 126, 0, 0, 0, 394, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 129, 0, 0, + 0, 0, 0, 398, 395, 397, 0, 130, 131, 132, + 0, 134, 135, 136, 137, 138, 139, 0, 0, 127, + 133, 119, 112, 114, 128, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, + 110, 111, 0, 0, 113, 115, 116, 0, 0, 117, + 0, 118, 0, 0, 0, 120, 121, 122, 0, 0, + 0, 0, 0, 0, 393, 123, 124, 125, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 126, 0, + 0, 0, 394, 0, 0, 0, 0, 0, 0, 0, + 396, 0, 0, 0, 129, 0, 0, 0, 0, 0, + 398, 395, 397, 0, 130, 131, 132, 0, 134, 135, + 136, 137, 138, 139, 0, 0, 127, 133, 119, 112, + 114, 128, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 209, 0, 0, 0, + 0, 211, 0, 29, 30, 31, 213, 0, 0, 0, + 0, 0, 0, 214, 215, 0, 0, 0, 0, 0, + 0, 216, 217, 0, 0, 218, 36, 0, 37, 0, + 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, + 0, 0, 0, 46, 0, 47, 0, 0, 0, 0, + 0, 220, 0, 221, 0, 0, 0, 51, 219, 222, + 49, 223, 52, 224, 53, 225, 55, 226, 56, 227, + 228, 0, 0, 43, 54, 32, 210, 212, 0, 40, + 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, + 0, 0, 0, 209, 0, 0, 0, 0, 211, 0, + 29, 30, 31, 213, 0, 0, 0, 0, 0, 0, + 214, 33, 0, 0, 0, 0, 0, 0, 216, 217, + 0, 0, 218, 36, 0, 37, 0, 0, 0, 38, + 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, + 46, 0, 47, 0, 0, 0, 0, 0, 220, 0, + 221, 0, 0, 0, 51, 219, 222, 49, 223, 52, + 224, 53, 225, 55, 226, 56, 227, 228, 0, 0, + 43, 54, 32, 210, 212, 0, 40, 0, 0, 0, + 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, + 587, 110, 111, 0, 0, 589, 115, 591, 30, 31, + 592, 0, 118, 0, 0, 0, 120, 594, 595, 0, + 0, 0, 0, 0, 0, 596, 597, 124, 125, 218, + 36, 0, 37, 0, 0, 0, 38, 0, 39, 598, + 42, 0, 0, 600, 0, 0, 0, 46, 0, 47, + 0, 0, 0, 0, 0, 602, 0, 221, 0, 0, + 0, 604, 601, 603, 49, 605, 606, 607, 53, 609, + 610, 611, 612, 613, 614, 0, 0, 599, 608, 593, + 588, 590, 128, 40, 0, 0, 0, 0, 45, 0, + 0, 0, 0, 0, 0, 0, 0, 361, 110, 111, + 0, 0, 363, 115, 365, 30, 31, 366, 0, 118, + 0, 0, 0, 120, 368, 369, 0, 0, 0, 0, + 0, 0, 370, 371, 124, 125, 218, 36, 0, 37, + 0, 0, 0, 38, 0, 39, 372, 42, 0, 0, + 374, 0, 0, 0, 46, 0, 47, 0, -267, 0, + 0, 0, 376, 0, 221, 0, 0, 0, 378, 375, + 377, 49, 379, 380, 381, 53, 383, 384, 385, 386, + 387, 388, 0, 0, 373, 382, 367, 362, 364, 128, + 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, + 0, 0, 0, 0, - 522, 540, 539, 519, 461, 515, 535, 514, 309, 528, - 311, 531, 250, 526, 542, 636, 613, 182, 150, 622, - 16, 496, 320, 497, 627, 253, 498, 633, 358, 554, - 436, 558, 487, 472, 439, 302, 238, 392, 454, 606, - 551, 402, 358, 553, 439, 243, 182, 445, 243, 447, - 456, 237, 238, 238, 347, 429, 349, 450, 351, 460, - 143, 458, 353, 467, 243, 436, 439, 176, 410, 186, - 188, 250, 415, 338, 182, 433, 148, 171, 169, 390, - 417, 400, 302, 140, 449, 163, 146, 425, 339, 302, - 358, 237, 336, 307, 250, 344, 482, 436, 302, 358, - 485, 358, 0, 0, 0, 461, 0, 0, 0, 0, - 0, 60, 60, 451, 452, 404, 0, 0, 60, 60, - 60, 452, 451, 320, 106, 60, 60, 60, 102, 60, - 92, 93, 95, 302, 94, 186, 0, 60, 0, 0, - 60, 88, 60, 405, 90, 60, 108, 180, 60, 266, - 146, 60, 146, 489, 270, 407, 165, 178, 60, 302, - 60, 0, 89, 330, 168, 288, 60, 60, 60, 60, - 0, 287, 286, 284, 285, 471, 60, 60, 432, 180, - 435, 60, 60, 452, 72, 60, 60, 451, 96, 60, - 480, 494, 77, 500, 479, 329, 60, 334, 305, 61, - 612, 60, 60, 69, 68, 60, 404, 60, 70, 67, - 60, 60, 490, 60, 60, 493, 84, 404, 60, 341, - 492, 60, 60, 180, 303, 60, 100, 60, 98, 491, - 91, 60, 0, 298, 405, 60, 106, 97, 270, 0, - 270, 500, 298, 500, 60, 405, 605, 270, 293, 270, - 602, 0, 0, 0, 0, 317, 499, 509, 108, 175, - 60, 316, 0, 60, 319, 270, 60, 290, 270, 298, - 289, 270, 0, 291, 270, 298, 60, 60, 0, 60, - 270, 270, 270, 500, 270, 0, 637, 295, 273, 298, - 602, 297, 313, 60, 270, 611, 0, 300, 270, 599, - 278, 302, 601, 500, 0, 567, 602, 0, 0, 0, - 0, 326, 570, 563, 564, 565, 566, 0, 499, 509, - 0, 472, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 332, 0, 0, 0, + 472, 546, 528, 639, 311, 182, 302, 498, 514, 16, + 461, 515, 496, 182, 497, 519, 309, 436, 619, 243, + 358, 439, 576, 572, 253, 150, 571, 487, 617, 307, + 238, 250, 320, 628, 633, 555, 569, 560, 558, 642, + 186, 250, 425, 349, 358, 182, 351, 557, 433, 347, + 238, 344, 339, 429, 302, 402, 243, 445, 447, 456, + 460, 163, 454, 458, 243, 250, 485, 143, 148, 449, + 353, 526, 176, 467, 237, 450, 238, 415, 338, 188, + 410, 237, 302, 336, 436, 482, 334, 169, 439, 436, + 146, 417, 392, 439, 140, 522, 358, 400, 404, 0, + 390, 171, 358, 0, 186, 500, 146, 0, 643, 0, + 0, 178, 0, 0, 0, 0, 404, 60, 60, 489, + 452, 500, 320, 0, 534, 0, 405, 60, 0, 180, + 146, 60, 0, 180, 60, 407, 490, 60, 302, 452, + 60, 60, 60, 60, 405, 60, 284, 285, 287, 60, + 286, 451, 358, 60, 165, 180, 266, 60, 60, 461, + 451, 270, 288, 60, 60, 60, 493, 60, 60, 60, + 84, 106, 92, 91, 60, 432, 60, 72, 60, 168, + 98, 435, 77, 60, 96, 60, 60, 60, 341, 302, + 93, 94, 500, 108, 329, 100, 60, 102, 60, 618, + 302, 95, 88, 330, 60, 60, 60, 60, 90, 89, + 70, 60, 97, 452, 60, 60, 451, 492, 60, 60, + 494, 60, 61, 68, 60, 60, 69, 491, 60, 471, + 67, 302, 404, 480, 60, 106, 60, 479, 0, 270, + 298, 270, 298, 278, 298, 270, 0, 270, 60, 270, + 0, 316, 0, 270, 332, 0, 500, 108, 175, 538, + 405, 293, 319, 0, 317, 303, 326, 60, 60, 60, + 0, 0, 270, 270, 270, 290, 291, 60, 295, 298, + 60, 60, 270, 298, 270, 270, 270, 289, 270, 0, + 273, 500, 313, 0, 551, 545, 305, 534, 508, 615, + 542, 297, 0, 500, 0, 300, 499, 509, 500, 0, + 508, 0, 0, 0, 0, 508, 472, 0, 499, 509, + 583, 0, 0, 499, 509, 0, 0, 586, 579, 580, + 581, 582, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 550, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 551, + 0, 0, 0, 0, 0, 0, 552, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 608, 0, 0, 0, 0, 0, - 0, 0, 500, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 499, 509, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0}; + 0, 0}; const short QDeclarativeJSGrammar::action_check [] = { - 55, 7, 33, 7, 55, 7, 60, 36, 90, 55, - 7, 16, 36, 7, 7, 7, 7, 36, 7, 60, - 36, 8, 33, 66, 36, 33, 60, 36, 7, 36, - 7, 7, 33, 36, 24, 7, 7, 37, 8, 60, - 66, 29, 17, 5, 7, 60, 7, 33, 33, 33, - 7, 20, 33, 36, 7, 7, 36, 7, 36, 33, - 7, 17, 60, 36, 1, 33, 79, 2, 8, 7, - 36, 1, 8, 55, 7, 2, 8, 2, 7, 7, - 79, 36, 77, 79, 48, 36, 7, 36, 55, 48, - 36, 36, 33, 36, 8, 60, 1, 31, 0, 2, - 8, 61, 60, 1, 48, 6, 10, 61, 7, 8, - -1, 8, 8, 61, 8, -1, -1, 48, 40, 20, - 8, 60, 8, 42, -1, 40, -1, 50, 8, 51, - 8, 54, 8, 15, 53, 8, 51, 61, 62, 8, - 5, 61, 62, 61, 62, 61, 62, 40, 90, 61, - 62, 55, 34, 79, 61, 62, 40, 8, 51, 8, - 8, 61, 62, 60, 60, 50, 60, 51, 56, 54, - 56, 61, 62, 8, 61, 62, 56, 15, 61, 62, - 61, 62, 60, 56, 60, 15, 25, 8, 27, 29, - 7, 60, 25, 29, 27, 7, 34, 12, 36, 38, - 25, 25, 27, 27, 34, 38, 36, 12, 8, 12, - 61, 60, 60, 38, 38, 8, 25, 25, 27, 27, - -1, 33, 7, -1, -1, 29, 61, 62, 29, 38, - 38, -1, 29, 8, -1, 75, 15, 8, 36, 75, - 61, 62, 57, -1, 61, 62, 86, 29, 63, -1, - 86, 15, 57, -1, 57, 34, 18, 19, 63, -1, - 63, 61, 62, 61, 62, 61, 62, -1, 61, 62, - 34, 75, 36, 15, 75, -1, 61, 62, 75, 15, - 92, -1, 86, 45, 46, 86, 61, 62, 29, 86, - 61, 62, 34, 75, 36, 91, 47, 33, 34, 15, - 36, 18, 19, -1, 86, 18, 19, 29, -1, -1, - 61, 62, -1, -1, 18, 19, -1, 33, 34, 29, - 36, -1, 25, 29, 27, 66, 67, 68, 45, 46, - -1, -1, 45, 46, -1, 38, -1, -1, 23, 24, - 91, 45, 46, -1, 66, 67, 68, 32, -1, -1, - 35, 92, 37, 29, 23, 24, 66, 67, 68, -1, - 66, 67, 68, 32, 23, 24, 35, 29, 37, -1, - 92, 23, 24, 32, 36, -1, 35, -1, 37, -1, - 32, 29, 92, 35, -1, 37, 92, 23, 24, 29, - 66, 67, 68, -1, -1, 29, 32, -1, 29, 35, - -1, 37, 36, -1, 66, 67, 68, 93, 94, 95, - 96, 97, 98, 61, 62, -1, 92, 29, 66, 67, - 68, 61, 62, -1, -1, -1, 66, 67, 68, -1, - 92, -1, 66, 67, 68, 66, 67, 68, -1, -1, - -1, -1, -1, -1, 92, -1, -1, -1, -1, 61, - 62, -1, 92, 29, 66, 67, 68, -1, 92, -1, - -1, 92, 29, -1, -1, 29, -1, -1, -1, -1, - 23, 24, -1, -1, -1, -1, -1, -1, 31, 32, - 92, -1, 35, -1, 37, 61, 62, -1, -1, -1, - 66, 67, 68, -1, 61, 62, -1, 61, 62, 66, - 67, 68, 66, 67, 68, -1, -1, -1, -1, -1, - 12, 13, -1, -1, -1, -1, 92, -1, -1, -1, - 22, -1, -1, -1, -1, 92, -1, 29, 92, -1, + 7, 16, 55, 7, 33, 36, 33, 55, 36, 7, + 7, 7, 7, 7, 7, 36, 7, 7, 36, 8, + 36, 55, 60, 29, 7, 7, 36, 7, 33, 7, + 7, 7, 7, 36, 36, 48, 1, 0, 90, 79, + 7, 33, 8, 90, 2, 7, 33, 55, 36, 60, + 36, 20, 33, 5, 1, 5, 79, 36, 7, 33, + 5, 60, 33, 33, 8, 33, 17, 24, 2, 7, + 34, 2, 7, 1, 7, 36, 60, 37, 8, 8, + 36, 66, 36, 7, 1, 17, -1, -1, 36, 48, + 36, 33, 8, 66, 7, 48, 36, 33, 7, 36, + 2, 7, 8, 8, 8, 77, 61, 15, 8, 8, + 6, -1, 31, 36, 8, 10, -1, -1, -1, 60, + 8, 60, -1, 48, 20, -1, 34, -1, 8, 8, + 8, -1, -1, 60, 60, 8, 79, 55, 60, 50, + 8, 61, 8, 54, 8, 8, 61, 61, 62, 61, + 62, 42, 56, 50, 40, 60, 56, 54, 79, 40, + 55, 60, 53, 61, 62, 51, 60, 15, 61, 62, + 51, 61, 62, 61, 61, 62, 56, 56, 61, 62, + 40, 8, 60, 8, 61, 62, 34, 60, 8, 61, + 62, 51, 60, 56, 60, 40, 60, 12, 29, 61, + 62, 25, 25, 27, 27, 15, 51, 36, 29, 15, + 29, 61, 62, 12, 38, 38, 8, 29, 7, 7, + 29, -1, 8, -1, 34, 8, 36, 25, 34, 27, + 36, 15, 61, 62, 61, 62, 61, 62, 7, 29, + 38, 91, 57, 7, 75, 33, 8, 25, 63, 27, + 34, -1, 36, -1, 75, 86, 75, 12, 57, -1, + 38, 15, -1, 75, 63, 86, 75, 86, 15, 61, + 62, -1, 61, 62, 86, 61, 62, 86, 61, 62, + 34, 25, 36, 27, -1, 75, 33, 34, 29, 36, + 18, 19, 61, 62, 38, 47, 86, 61, 62, 61, + 62, 15, 57, -1, 92, 18, 19, -1, 63, 61, + 62, 29, -1, 18, 19, 18, 19, 45, 46, 33, + 34, -1, 36, 29, -1, 66, 67, 68, -1, -1, + -1, -1, 45, 46, 29, -1, -1, -1, 29, 91, + 45, 46, 45, 46, 23, 24, 29, -1, 66, 67, + 68, 92, 29, 32, 23, 24, 35, 25, 37, 27, + 66, 67, 68, 32, -1, 29, 35, -1, 37, 29, + 38, 66, 67, 68, 92, 66, 67, 68, -1, -1, + 29, -1, -1, 66, 67, 68, 92, 29, -1, 66, + 67, 68, 29, -1, -1, -1, -1, 92, 29, -1, + -1, 92, 66, 67, 68, -1, 66, 67, 68, 92, + -1, -1, -1, -1, 29, 92, -1, 66, 67, 68, + 29, -1, -1, -1, 66, 67, 68, 29, 92, 66, + 67, 68, 92, 23, 24, 66, 67, 68, -1, -1, + -1, 29, 32, 92, -1, 35, -1, 37, 36, 29, + 92, 66, 67, 68, -1, 92, 36, 66, 67, 68, + -1, 92, 23, 24, 66, 67, 68, -1, -1, -1, + 31, 32, -1, -1, 35, -1, 37, 92, 66, 67, + 68, -1, -1, 92, 23, 24, 66, 67, 68, 29, + 92, -1, 31, 32, 23, 24, 35, 29, 37, -1, + -1, -1, 31, 32, 92, 29, 35, -1, 37, -1, + -1, 29, 92, -1, 93, 94, 95, 96, 97, 98, + -1, 61, 62, -1, 29, -1, 66, 67, 68, 61, + 62, -1, -1, 29, 66, 67, 68, 61, 62, -1, + -1, -1, 66, 67, 68, -1, -1, -1, 66, 67, + 68, -1, 92, -1, -1, -1, 61, 62, -1, -1, + 92, 66, 67, 68, -1, 61, 62, 29, 92, -1, + 66, 67, 68, -1, 92, -1, -1, -1, -1, -1, + -1, -1, -1, 23, 24, -1, -1, 92, 3, -1, + -1, 31, 32, -1, -1, 35, 92, 37, 13, 61, + 62, -1, 17, -1, 66, 67, 68, -1, -1, -1, + -1, 26, -1, 28, -1, -1, 31, -1, -1, -1, + -1, -1, -1, -1, 39, -1, 41, 42, -1, -1, + 92, -1, -1, -1, 49, -1, -1, 52, 53, -1, + -1, -1, -1, 58, -1, -1, -1, -1, -1, 64, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, + 13, 3, -1, -1, -1, 80, -1, -1, -1, 22, + -1, 13, -1, -1, -1, 17, 29, -1, -1, -1, + 33, 34, -1, 36, 26, -1, 28, -1, -1, -1, + 43, -1, -1, -1, 47, -1, -1, 39, -1, 41, + 42, -1, -1, -1, -1, -1, -1, 49, -1, -1, + 52, 53, 65, 66, 67, 68, 58, 70, -1, -1, + -1, -1, 64, -1, -1, -1, -1, -1, 81, 82, + 83, 12, 13, -1, 87, -1, -1, -1, 80, 92, + -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, + -1, -1, 33, 34, -1, 36, -1, -1, -1, 12, + 13, -1, 43, -1, -1, -1, 47, -1, -1, 22, + -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, + 33, 34, -1, 36, 65, 66, 67, 68, -1, 70, + 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, + 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, + -1, 92, 65, 66, 67, 68, -1, 70, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 81, 82, + 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, + 12, 13, -1, -1, -1, -1, -1, -1, 12, 13, + 22, -1, -1, -1, -1, -1, -1, 29, 22, -1, + -1, 33, 34, -1, 36, 29, -1, -1, -1, 33, + 34, 43, 36, -1, -1, 47, -1, -1, -1, 43, + -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, + -1, 65, 66, 67, 68, -1, 70, -1, -1, 81, + 82, 83, -1, -1, -1, 87, -1, 81, 82, 83, + 92, -1, -1, 87, -1, -1, -1, -1, 92, 12, + 13, -1, -1, -1, -1, -1, -1, 12, 13, 22, + -1, -1, -1, -1, -1, -1, 29, 22, -1, -1, + 33, 34, -1, 36, 29, -1, -1, -1, 33, 34, + 43, 36, -1, -1, 47, -1, -1, -1, 43, -1, + -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 65, 66, 67, 68, -1, 70, -1, -1, + 65, 66, 67, 68, -1, 70, -1, -1, 81, 82, + 83, -1, -1, -1, 87, -1, 81, 82, 83, 92, + -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, + -1, -1, -1, -1, -1, -1, 10, -1, 12, 13, + -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, + -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, + 34, -1, 36, -1, -1, -1, -1, -1, -1, 43, + -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 65, 66, 67, 68, -1, 70, -1, -1, -1, + -1, 75, -1, -1, -1, -1, -1, 81, 82, 83, + 84, -1, -1, 87, -1, -1, -1, -1, 92, -1, + -1, -1, -1, -1, -1, -1, -1, 10, -1, 12, + 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, + -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, + 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, + 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, + -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 65, 66, 67, 68, -1, 70, -1, -1, + -1, -1, 75, -1, -1, -1, -1, -1, 81, 82, + 83, 84, -1, -1, 87, -1, -1, -1, -1, 92, + -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, + 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, + 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, -1, -1, - -1, 43, -1, -1, -1, 47, -1, -1, 3, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 13, -1, - -1, -1, 17, 65, 66, 67, 68, -1, 70, -1, - -1, 26, -1, 28, -1, -1, -1, -1, -1, 81, - 82, 83, -1, -1, 39, 87, 41, 42, -1, -1, - 92, -1, -1, -1, 49, 12, 13, 52, 53, -1, - -1, -1, -1, 58, -1, 22, -1, -1, -1, 64, - -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, - -1, -1, -1, -1, -1, 80, 43, -1, -1, -1, - 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 3, -1, 65, 66, - 67, 68, -1, 70, -1, -1, 13, -1, -1, -1, - 17, -1, -1, -1, 81, 82, 83, -1, -1, 26, - 87, 28, -1, -1, 31, 92, -1, -1, -1, -1, - -1, -1, 39, -1, 41, 42, -1, -1, -1, -1, - -1, -1, 49, -1, -1, 52, 53, -1, -1, -1, - -1, 58, -1, -1, -1, -1, -1, 64, -1, -1, - -1, -1, -1, -1, -1, -1, 12, 13, -1, -1, - -1, -1, -1, 80, -1, -1, 22, -1, -1, -1, - -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, - 36, -1, -1, -1, 12, 13, -1, 43, -1, -1, - -1, 47, -1, -1, 22, -1, -1, -1, -1, -1, - -1, 29, -1, -1, -1, 33, 34, -1, 36, 65, - 66, 67, 68, -1, 70, 43, -1, -1, -1, 47, - -1, -1, -1, -1, -1, 81, 82, 83, -1, -1, - -1, 87, -1, -1, -1, -1, 92, 65, 66, 67, - 68, -1, 70, -1, -1, -1, -1, -1, -1, -1, + -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, + -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, + -1, -1, -1, 75, -1, -1, -1, -1, -1, 81, + 82, 83, 84, -1, -1, 87, -1, -1, -1, -1, + 92, -1, -1, -1, -1, -1, -1, -1, -1, 11, + 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, + 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, + -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, + 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, + -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, + 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, + 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, + 92, -1, -1, -1, -1, -1, -1, -1, -1, 7, + -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, + -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, + -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, + -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, + -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, + 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, - -1, -1, -1, -1, 92, 12, 13, -1, -1, -1, - -1, -1, -1, 12, 13, 22, -1, -1, -1, -1, - -1, -1, 29, 22, -1, -1, 33, 34, -1, 36, - 29, -1, -1, -1, 33, 34, 43, 36, -1, -1, - 47, -1, -1, -1, 43, -1, -1, -1, 47, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, - 67, 68, -1, 70, -1, -1, 65, 66, 67, 68, - -1, 70, -1, -1, 81, 82, 83, -1, -1, -1, - 87, -1, 81, 82, 83, 92, -1, -1, 87, -1, - -1, -1, -1, 92, 12, 13, -1, -1, -1, -1, - -1, -1, 12, 13, 22, -1, -1, -1, -1, -1, - -1, 29, 22, -1, -1, 33, 34, -1, 36, 29, - -1, -1, -1, 33, 34, 43, 36, -1, -1, 47, - -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, + -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, + -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, + -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, + -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, + -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, + -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, - 68, -1, 70, -1, -1, 65, 66, 67, 68, -1, - 70, -1, -1, 81, 82, 83, -1, -1, -1, 87, - -1, 81, 82, 83, 92, -1, -1, 87, -1, -1, - -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, - -1, 10, -1, 12, 13, -1, -1, -1, -1, -1, + 68, -1, 70, -1, 72, -1, 74, 75, 76, -1, + -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, + -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, + -1, -1, -1, 8, -1, -1, 11, 12, 13, -1, + -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, + -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, + -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, + -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, + -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, + 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, + -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, + -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, + -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, + 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, + 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, + -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, + 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, + -1, 53, -1, -1, 56, -1, -1, -1, -1, -1, + -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, + 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, + 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, + 92, -1, -1, -1, -1, -1, -1, -1, -1, 8, + -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, - -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, + -1, -1, 51, -1, 53, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, - -1, 70, -1, -1, -1, -1, 75, -1, -1, -1, - -1, -1, 81, 82, 83, 84, -1, -1, 87, -1, + -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, + -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, - -1, -1, 10, -1, 12, 13, -1, -1, -1, -1, - -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, - -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, - -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, - -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, - 68, -1, 70, -1, -1, -1, -1, 75, -1, -1, - -1, -1, -1, 81, 82, 83, 84, -1, -1, 87, - -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, - -1, -1, -1, 10, -1, 12, 13, -1, -1, -1, - -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, - -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, - -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, - 47, -1, -1, -1, -1, -1, -1, -1, 55, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, - 67, 68, -1, 70, -1, -1, -1, -1, 75, -1, - -1, -1, -1, -1, 81, 82, 83, 84, -1, -1, - 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, - -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, - -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, - -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, - -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, - 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, - 67, 68, -1, 70, -1, 72, -1, 74, -1, 76, - -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, - 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, - -1, -1, -1, -1, 7, -1, -1, -1, 11, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, - -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, - 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, - -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, - -1, 74, 75, 76, -1, -1, -1, -1, 81, 82, - 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, - -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, - -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, - -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, - -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, - 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, - -1, 51, -1, 53, -1, -1, 56, -1, -1, -1, - -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, - 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, - -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, - -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, - -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, - -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, - 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, - 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, - -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, - -1, 61, -1, -1, -1, 65, 66, 67, 68, -1, - 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, - -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, - -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, - -1, 8, -1, -1, 11, 12, 13, -1, -1, -1, - -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, - -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, - -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, - 47, -1, -1, -1, 51, -1, 53, -1, -1, 56, - -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, - 67, 68, -1, 70, -1, 72, -1, 74, -1, 76, - -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, - 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, - -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, - -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, - -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, - 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, - 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, - -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, - -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, - 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, - -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, - -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, - 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, - -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, - -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, - -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, - 51, -1, 53, -1, -1, 56, -1, -1, -1, -1, - -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, - -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, - 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, - -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, - 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, - 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, - -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, - -1, -1, 66, 67, 68, 69, 70, 71, -1, 73, - 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, - 84, 85, 86, -1, -1, -1, -1, -1, 92, -1, - -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, - -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, - -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, - -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, - 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 59, -1, -1, -1, -1, -1, 65, 66, - 67, -1, 69, 70, 71, -1, 73, 74, 75, 76, - 77, 78, -1, -1, 81, 82, 83, 84, 85, 86, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, - 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, - 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, - 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, - -1, -1, -1, -1, -1, 55, -1, -1, -1, 59, - -1, -1, -1, -1, -1, 65, 66, 67, -1, 69, - 70, 71, -1, 73, 74, 75, 76, 77, 78, -1, - -1, 81, 82, 83, 84, 85, 86, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 4, -1, -1, -1, -1, 9, -1, 11, 12, - 13, 14, -1, -1, -1, -1, -1, -1, 21, 22, - -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, - -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, - 83, 84, 85, -1, 87, -1, -1, -1, -1, 92, - -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, - -1, -1, -1, 9, -1, 11, 12, 13, 14, -1, - -1, -1, -1, -1, -1, 21, 22, -1, -1, -1, + -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, + -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, + -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, + 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, + -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, + 56, -1, -1, -1, -1, -1, -1, -1, -1, 65, + 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, + 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, + -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, + -1, -1, -1, -1, -1, 11, 12, 13, -1, -1, + -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, - -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, + -1, -1, -1, -1, -1, 61, -1, -1, -1, 65, + 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, + 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, - 9, 10, 11, 12, 13, 14, -1, 16, -1, -1, + 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, - 29, 30, 31, 32, 33, 34, -1, 36, -1, -1, - -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, - -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, - 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - -1, -1, 81, 82, 83, 84, 85, 86, 87, -1, + 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 59, -1, -1, -1, -1, -1, -1, 66, 67, 68, + 69, 70, 71, -1, 73, 74, 75, 76, 77, 78, + -1, -1, 81, 82, 83, 84, 85, 86, -1, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, - 12, 13, 14, -1, 16, -1, -1, -1, 20, 21, + -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, - 32, 33, 34, -1, 36, -1, -1, -1, 40, -1, - 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, - -1, 53, -1, 55, -1, -1, -1, 59, -1, 61, - -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, - 82, 83, 84, 85, 86, 87, -1, -1, -1, -1, - 92, -1, -1, -1, -1, -1, -1, -1, -1, + 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, + -1, -1, -1, 65, 66, 67, -1, 69, 70, 71, + -1, 73, 74, 75, 76, 77, 78, -1, -1, 81, + 82, 83, 84, 85, 86, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, + 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, + -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, + -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, + -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, + 55, -1, -1, -1, 59, -1, -1, -1, -1, -1, + 65, 66, 67, -1, 69, 70, 71, -1, 73, 74, + 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, + 85, 86, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, + -1, 9, -1, 11, 12, 13, 14, -1, -1, -1, + -1, -1, -1, 21, 22, -1, -1, -1, -1, -1, + -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, + -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, + -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, + -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, -1, -1, 81, 82, 83, 84, 85, -1, 87, + -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, + -1, -1, -1, 4, -1, -1, -1, -1, 9, -1, + 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, + 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, + -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, + -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, + 51, -1, 53, -1, -1, -1, -1, -1, 59, -1, + 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, -1, -1, + 81, 82, 83, 84, 85, -1, 87, -1, -1, -1, + -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, + 4, 5, 6, -1, -1, 9, 10, 11, 12, 13, + 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, + -1, -1, -1, -1, -1, 29, 30, 31, 32, 33, + 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, + 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, + -1, -1, -1, -1, -1, 59, -1, 61, -1, -1, + -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, + 84, 85, 86, 87, -1, -1, -1, -1, 92, -1, + -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, + -1, -1, 9, 10, 11, 12, 13, 14, -1, 16, + -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, + -1, -1, 29, 30, 31, 32, 33, 34, -1, 36, + -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, + 47, -1, -1, -1, 51, -1, 53, -1, 55, -1, + -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, -1, -1, 81, 82, 83, 84, 85, 86, + 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, + -1, -1, -1, -1, - 13, 15, 25, 3, 15, 15, 3, 25, 3, 15, - 2, 15, 2, 25, 3, 11, 19, 15, 67, 13, - 3, 104, 15, 4, 15, 3, 2, 15, 2, 15, - 3, 15, 3, 35, 21, 3, 15, 36, 3, 19, - 25, 2, 2, 25, 21, 15, 15, 98, 15, 15, - 2, 4, 15, 15, 2, 93, 3, 21, 2, 2, - 35, 3, 2, 35, 15, 3, 21, 3, 2, 15, - 15, 2, 2, 2, 15, 3, 35, 35, 35, 35, - 3, 35, 3, 3, 21, 35, 35, 96, 15, 3, - 2, 4, 3, 2, 2, 100, 35, 3, 3, 2, - 35, 2, -1, -1, -1, 15, -1, -1, -1, -1, - -1, 44, 44, 46, 46, 13, -1, -1, 44, 44, - 44, 46, 46, 15, 15, 44, 44, 44, 54, 44, - 49, 49, 49, 3, 49, 15, -1, 44, -1, -1, - 44, 48, 44, 41, 48, 44, 37, 46, 44, 44, - 35, 44, 35, 46, 49, 40, 58, 40, 44, 3, - 44, -1, 48, 68, 60, 49, 44, 44, 44, 44, - -1, 49, 49, 49, 49, 85, 44, 44, 81, 46, - 81, 44, 44, 46, 52, 44, 44, 46, 50, 44, - 31, 46, 50, 13, 35, 87, 44, 2, 68, 47, - 20, 44, 44, 46, 46, 44, 13, 44, 47, 46, - 44, 44, 46, 44, 44, 46, 49, 13, 44, 99, - 46, 44, 44, 46, 68, 44, 56, 44, 50, 46, - 49, 44, -1, 44, 41, 44, 15, 50, 49, -1, - 49, 13, 44, 13, 44, 41, 16, 49, 57, 49, - 20, -1, -1, -1, -1, 66, 28, 29, 37, 38, - 44, 61, -1, 44, 66, 49, 44, 51, 49, 44, - 51, 49, -1, 51, 49, 44, 44, 44, -1, 44, - 49, 49, 49, 13, 49, -1, 16, 55, 53, 44, - 20, 66, 59, 44, 49, 5, -1, 66, 49, 13, - 51, 3, 16, 13, -1, 13, 20, -1, -1, -1, - -1, 66, 20, 21, 22, 23, 24, -1, 28, 29, - -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 68, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 35, 15, 15, 15, 2, 15, 3, 2, 25, 3, + 15, 15, 104, 15, 4, 3, 3, 3, 19, 15, + 2, 21, 15, 15, 3, 67, 25, 3, 19, 2, + 15, 2, 15, 13, 15, 19, 25, 3, 15, 11, + 15, 2, 96, 3, 2, 15, 2, 25, 3, 2, + 15, 100, 15, 93, 3, 2, 15, 98, 15, 2, + 2, 35, 3, 3, 15, 2, 35, 35, 35, 21, + 2, 25, 3, 35, 4, 21, 15, 2, 2, 15, + 2, 4, 3, 3, 3, 35, 2, 35, 21, 3, + 35, 3, 36, 21, 3, 13, 2, 35, 13, -1, + 35, 35, 2, -1, 15, 13, 35, -1, 16, -1, + -1, 40, -1, -1, -1, -1, 13, 44, 44, 46, + 46, 13, 15, -1, 16, -1, 41, 44, -1, 46, + 35, 44, -1, 46, 44, 40, 46, 44, 3, 46, + 44, 44, 44, 44, 41, 44, 49, 49, 49, 44, + 49, 46, 2, 44, 58, 46, 44, 44, 44, 15, + 46, 49, 49, 44, 44, 44, 46, 44, 44, 44, + 49, 15, 49, 49, 44, 81, 44, 52, 44, 60, + 50, 81, 50, 44, 50, 44, 44, 44, 99, 3, + 49, 49, 13, 37, 87, 56, 44, 54, 44, 20, + 3, 49, 48, 68, 44, 44, 44, 44, 48, 48, + 47, 44, 50, 46, 44, 44, 46, 46, 44, 44, + 46, 44, 47, 46, 44, 44, 46, 46, 44, 85, + 46, 3, 13, 31, 44, 15, 44, 35, -1, 49, + 44, 49, 44, 51, 44, 49, -1, 49, 44, 49, + -1, 61, -1, 49, 68, -1, 13, 37, 38, 16, + 41, 57, 66, -1, 66, 68, 66, 44, 44, 44, + -1, -1, 49, 49, 49, 51, 51, 44, 55, 44, + 44, 44, 49, 44, 49, 49, 49, 51, 49, -1, + 53, 13, 59, -1, 13, 5, 68, 16, 20, 18, + 5, 66, -1, 13, -1, 66, 28, 29, 13, -1, + 20, -1, -1, -1, -1, 20, 35, -1, 28, 29, + 13, -1, -1, 28, 29, -1, -1, 20, 21, 22, + 23, 24, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 13, + -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, - -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -987,6 +984,6 @@ const short QDeclarativeJSGrammar::action_check [] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1}; + -1, -1}; QT_END_NAMESPACE diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar_p.h b/src/declarative/qml/parser/qdeclarativejsgrammar_p.h index 32bb12b..064c67a 100644 --- a/src/declarative/qml/parser/qdeclarativejsgrammar_p.h +++ b/src/declarative/qml/parser/qdeclarativejsgrammar_p.h @@ -164,15 +164,15 @@ public: T_XOR = 79, T_XOR_EQ = 80, - ACCEPT_STATE = 639, - RULE_COUNT = 345, - STATE_COUNT = 640, + ACCEPT_STATE = 645, + RULE_COUNT = 347, + STATE_COUNT = 646, TERMINAL_COUNT = 101, NON_TERMINAL_COUNT = 106, - GOTO_INDEX_OFFSET = 640, - GOTO_INFO_OFFSET = 2699, - GOTO_CHECK_OFFSET = 2699 + GOTO_INDEX_OFFSET = 646, + GOTO_INFO_OFFSET = 2714, + GOTO_CHECK_OFFSET = 2714 }; static const char *const spell []; diff --git a/src/declarative/qml/parser/qdeclarativejsparser.cpp b/src/declarative/qml/parser/qdeclarativejsparser.cpp index 3cf73b1..170c7fa 100644 --- a/src/declarative/qml/parser/qdeclarativejsparser.cpp +++ b/src/declarative/qml/parser/qdeclarativejsparser.cpp @@ -487,80 +487,124 @@ case 60: { } break; case 61: { - sym(1).Node = makeAstNode(driver->nodePool(), sym(1).Node); + AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(4).sval, sym(6).sval); + node->typeModifier = sym(2).sval; + node->propertyToken = loc(1); + node->typeModifierToken = loc(2); + node->typeToken = loc(4); + node->identifierToken = loc(6); + node->semicolonToken = loc(7); // insert a fake ';' before ':' + + AST::UiQualifiedId *propertyName = makeAstNode(driver->nodePool(), sym(6).sval); + propertyName->identifierToken = loc(6); + propertyName->next = 0; + + AST::UiArrayBinding *binding = makeAstNode (driver->nodePool(), + propertyName, sym(9).UiArrayMemberList->finish()); + binding->colonToken = loc(7); + binding->lbracketToken = loc(8); + binding->rbracketToken = loc(10); + + node->binding = binding; + + sym(1).Node = node; } break; case 62: { + AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(3).sval); + node->propertyToken = loc(1); + node->typeToken = loc(2); + node->identifierToken = loc(3); + node->semicolonToken = loc(4); // insert a fake ';' before ':' + + AST::UiQualifiedId *propertyName = makeAstNode(driver->nodePool(), sym(3).sval); + propertyName->identifierToken = loc(3); + propertyName->next = 0; + + AST::UiObjectBinding *binding = makeAstNode (driver->nodePool(), + propertyName, sym(5).UiQualifiedId, sym(6).UiObjectInitializer); + binding->colonToken = loc(4); + + node->binding = binding; + + sym(1).Node = node; +} break; + +case 63: { sym(1).Node = makeAstNode(driver->nodePool(), sym(1).Node); } break; case 64: { + sym(1).Node = makeAstNode(driver->nodePool(), sym(1).Node); +} break; + +case 66: { QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_PROPERTY]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 65: { +case 67: { QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_SIGNAL]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 66: { +case 68: { QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_READONLY]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 67: { +case 69: { QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_ON]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 68: { +case 70: { AST::ThisExpression *node = makeAstNode (driver->nodePool()); node->thisToken = loc(1); sym(1).Node = node; } break; -case 69: { +case 71: { AST::IdentifierExpression *node = makeAstNode (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 70: { +case 72: { AST::NullExpression *node = makeAstNode (driver->nodePool()); node->nullToken = loc(1); sym(1).Node = node; } break; -case 71: { +case 73: { AST::TrueLiteral *node = makeAstNode (driver->nodePool()); node->trueToken = loc(1); sym(1).Node = node; } break; -case 72: { +case 74: { AST::FalseLiteral *node = makeAstNode (driver->nodePool()); node->falseToken = loc(1); sym(1).Node = node; } break; -case 73: { +case 75: { AST::NumericLiteral *node = makeAstNode (driver->nodePool(), sym(1).dval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 74: -case 75: { +case 76: +case 77: { AST::StringLiteral *node = makeAstNode (driver->nodePool(), sym(1).sval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 76: { +case 78: { bool rx = lexer->scanRegExp(Lexer::NoPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -574,7 +618,7 @@ case 76: { sym(1).Node = node; } break; -case 77: { +case 79: { bool rx = lexer->scanRegExp(Lexer::EqualPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -588,28 +632,28 @@ case 77: { sym(1).Node = node; } break; -case 78: { +case 80: { AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), (AST::Elision *) 0); node->lbracketToken = loc(1); node->rbracketToken = loc(2); sym(1).Node = node; } break; -case 79: { +case 81: { AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).Elision->finish()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 80: { +case 82: { AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish ()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 81: { +case 83: { AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish (), (AST::Elision *) 0); node->lbracketToken = loc(1); @@ -618,7 +662,7 @@ case 81: { sym(1).Node = node; } break; -case 82: { +case 84: { AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision->finish()); node->lbracketToken = loc(1); @@ -627,7 +671,7 @@ case 82: { sym(1).Node = node; } break; -case 83: { +case 85: { AST::ObjectLiteral *node = 0; if (sym(2).Node) node = makeAstNode (driver->nodePool(), @@ -639,7 +683,7 @@ case 83: { sym(1).Node = node; } break; -case 84: { +case 86: { AST::ObjectLiteral *node = makeAstNode (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); node->lbraceToken = loc(1); @@ -647,14 +691,14 @@ case 84: { sym(1).Node = node; } break; -case 85: { +case 87: { AST::NestedExpression *node = makeAstNode(driver->nodePool(), sym(2).Expression); node->lparenToken = loc(1); node->rparenToken = loc(3); sym(1).Node = node; } break; -case 86: { +case 88: { if (AST::ArrayMemberExpression *mem = AST::cast(sym(1).Expression)) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, mem->lbracketToken, QLatin1String("Ignored annotation"))); @@ -674,48 +718,48 @@ case 86: { } } break; -case 87: { +case 89: { sym(1).Node = makeAstNode (driver->nodePool(), (AST::Elision *) 0, sym(1).Expression); } break; -case 88: { +case 90: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Elision->finish(), sym(2).Expression); } break; -case 89: { +case 91: { AST::ElementList *node = makeAstNode (driver->nodePool(), sym(1).ElementList, (AST::Elision *) 0, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 90: { +case 92: { AST::ElementList *node = makeAstNode (driver->nodePool(), sym(1).ElementList, sym(3).Elision->finish(), sym(4).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 91: { +case 93: { AST::Elision *node = makeAstNode (driver->nodePool()); node->commaToken = loc(1); sym(1).Node = node; } break; -case 92: { +case 94: { AST::Elision *node = makeAstNode (driver->nodePool(), sym(1).Elision); node->commaToken = loc(2); sym(1).Node = node; } break; -case 93: { +case 95: { AST::PropertyNameAndValueList *node = makeAstNode (driver->nodePool(), sym(1).PropertyName, sym(3).Expression); node->colonToken = loc(2); sym(1).Node = node; } break; -case 94: { +case 96: { AST::PropertyNameAndValueList *node = makeAstNode (driver->nodePool(), sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); node->commaToken = loc(2); @@ -723,40 +767,36 @@ case 94: { sym(1).Node = node; } break; -case 95: { +case 97: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 96: -case 97: { +case 98: +case 99: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount())); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 98: { +case 100: { AST::StringLiteralPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 99: { +case 101: { AST::NumericLiteralPropertyName *node = makeAstNode (driver->nodePool(), sym(1).dval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 100: { +case 102: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 101: - -case 102: - case 103: case 104: @@ -814,25 +854,29 @@ case 129: case 130: case 131: + +case 132: + +case 133: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); } break; -case 136: { +case 138: { AST::ArrayMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 137: { +case 139: { AST::FieldMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 138: { +case 140: { AST::NewMemberExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression, sym(4).ArgumentList); node->newToken = loc(1); node->lparenToken = loc(3); @@ -840,316 +884,309 @@ case 138: { sym(1).Node = node; } break; -case 140: { +case 142: { AST::NewExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->newToken = loc(1); sym(1).Node = node; } break; -case 141: { +case 143: { AST::CallExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 142: { +case 144: { AST::CallExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 143: { +case 145: { AST::ArrayMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 144: { +case 146: { AST::FieldMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 145: { +case 147: { sym(1).Node = 0; } break; -case 146: { +case 148: { sym(1).Node = sym(1).ArgumentList->finish(); } break; -case 147: { +case 149: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Expression); } break; -case 148: { +case 150: { AST::ArgumentList *node = makeAstNode (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 152: { +case 154: { AST::PostIncrementExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->incrementToken = loc(2); sym(1).Node = node; } break; -case 153: { +case 155: { AST::PostDecrementExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->decrementToken = loc(2); sym(1).Node = node; } break; -case 155: { +case 157: { AST::DeleteExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->deleteToken = loc(1); sym(1).Node = node; } break; -case 156: { +case 158: { AST::VoidExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->voidToken = loc(1); sym(1).Node = node; } break; -case 157: { +case 159: { AST::TypeOfExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->typeofToken = loc(1); sym(1).Node = node; } break; -case 158: { +case 160: { AST::PreIncrementExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->incrementToken = loc(1); sym(1).Node = node; } break; -case 159: { +case 161: { AST::PreDecrementExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->decrementToken = loc(1); sym(1).Node = node; } break; -case 160: { +case 162: { AST::UnaryPlusExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->plusToken = loc(1); sym(1).Node = node; } break; -case 161: { +case 163: { AST::UnaryMinusExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->minusToken = loc(1); sym(1).Node = node; } break; -case 162: { +case 164: { AST::TildeExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->tildeToken = loc(1); sym(1).Node = node; } break; -case 163: { +case 165: { AST::NotExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->notToken = loc(1); sym(1).Node = node; } break; -case 165: { +case 167: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Mul, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 166: { +case 168: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Div, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 167: { +case 169: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Mod, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 169: { +case 171: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Add, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 170: { +case 172: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Sub, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 172: { +case 174: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::LShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 173: { +case 175: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::RShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 174: { +case 176: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::URShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 176: { +case 178: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 177: { +case 179: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 178: { +case 180: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 179: { +case 181: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 180: { +case 182: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 181: { +case 183: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::In, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 183: { +case 185: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 184: { +case 186: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 185: { +case 187: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 186: { +case 188: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 187: { +case 189: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 189: { +case 191: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 190: { +case 192: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 191: { +case 193: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 192: { +case 194: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 194: { +case 196: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 195: { +case 197: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 196: { +case 198: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 197: { - AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::StrictNotEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; - case 199: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::BitAnd, sym(3).Expression); + QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1163,7 +1200,7 @@ case 201: { case 203: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::BitXor, sym(3).Expression); + QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1177,7 +1214,7 @@ case 205: { case 207: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::BitOr, sym(3).Expression); + QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1191,7 +1228,7 @@ case 209: { case 211: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::And, sym(3).Expression); + QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1205,7 +1242,7 @@ case 213: { case 215: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::Or, sym(3).Expression); + QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1218,6 +1255,13 @@ case 217: { } break; case 219: { + AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, + QSOperator::Or, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; +} break; + +case 221: { AST::ConditionalExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1225,7 +1269,7 @@ case 219: { sym(1).Node = node; } break; -case 221: { +case 223: { AST::ConditionalExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1233,112 +1277,112 @@ case 221: { sym(1).Node = node; } break; -case 223: { +case 225: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 225: { +case 227: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 226: { +case 228: { sym(1).ival = QSOperator::Assign; } break; -case 227: { +case 229: { sym(1).ival = QSOperator::InplaceMul; } break; -case 228: { +case 230: { sym(1).ival = QSOperator::InplaceDiv; } break; -case 229: { +case 231: { sym(1).ival = QSOperator::InplaceMod; } break; -case 230: { +case 232: { sym(1).ival = QSOperator::InplaceAdd; } break; -case 231: { +case 233: { sym(1).ival = QSOperator::InplaceSub; } break; -case 232: { +case 234: { sym(1).ival = QSOperator::InplaceLeftShift; } break; -case 233: { +case 235: { sym(1).ival = QSOperator::InplaceRightShift; } break; -case 234: { +case 236: { sym(1).ival = QSOperator::InplaceURightShift; } break; -case 235: { +case 237: { sym(1).ival = QSOperator::InplaceAnd; } break; -case 236: { +case 238: { sym(1).ival = QSOperator::InplaceXor; } break; -case 237: { +case 239: { sym(1).ival = QSOperator::InplaceOr; } break; -case 239: { +case 241: { AST::Expression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 240: { +case 242: { sym(1).Node = 0; } break; -case 243: { +case 245: { AST::Expression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 244: { +case 246: { sym(1).Node = 0; } break; -case 261: { +case 263: { AST::Block *node = makeAstNode (driver->nodePool(), sym(2).StatementList); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 262: { +case 264: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Statement); } break; -case 263: { +case 265: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).StatementList, sym(2).Statement); } break; -case 264: { +case 266: { sym(1).Node = 0; } break; -case 265: { +case 267: { sym(1).Node = sym(1).StatementList->finish (); } break; -case 267: { +case 269: { AST::VariableStatement *node = makeAstNode (driver->nodePool(), sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST)); node->declarationKindToken = loc(1); @@ -1346,76 +1390,76 @@ case 267: { sym(1).Node = node; } break; -case 268: { +case 270: { sym(1).ival = T_CONST; } break; -case 269: { +case 271: { sym(1).ival = T_VAR; } break; -case 270: { +case 272: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 271: { +case 273: { AST::VariableDeclarationList *node = makeAstNode (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); node->commaToken = loc(2); sym(1).Node = node; } break; -case 272: { +case 274: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 273: { +case 275: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); } break; -case 274: { +case 276: { AST::VariableDeclaration *node = makeAstNode (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 275: { +case 277: { AST::VariableDeclaration *node = makeAstNode (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 276: { +case 278: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 277: { +case 279: { sym(1).Node = 0; } break; -case 279: { +case 281: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 280: { +case 282: { sym(1).Node = 0; } break; -case 282: { +case 284: { AST::EmptyStatement *node = makeAstNode (driver->nodePool()); node->semicolonToken = loc(1); sym(1).Node = node; } break; -case 284: { +case 286: { AST::ExpressionStatement *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 285: { +case 287: { AST::IfStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1424,7 +1468,7 @@ case 285: { sym(1).Node = node; } break; -case 286: { +case 288: { AST::IfStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1432,7 +1476,7 @@ case 286: { sym(1).Node = node; } break; -case 288: { +case 290: { AST::DoWhileStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(5).Expression); node->doToken = loc(1); node->whileToken = loc(3); @@ -1442,7 +1486,7 @@ case 288: { sym(1).Node = node; } break; -case 289: { +case 291: { AST::WhileStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->whileToken = loc(1); node->lparenToken = loc(2); @@ -1450,7 +1494,7 @@ case 289: { sym(1).Node = node; } break; -case 290: { +case 292: { AST::ForStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); node->forToken = loc(1); @@ -1461,7 +1505,7 @@ case 290: { sym(1).Node = node; } break; -case 291: { +case 293: { AST::LocalForStatement *node = makeAstNode (driver->nodePool(), sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression, sym(8).Expression, sym(10).Statement); @@ -1474,7 +1518,7 @@ case 291: { sym(1).Node = node; } break; -case 292: { +case 294: { AST:: ForEachStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Statement); node->forToken = loc(1); @@ -1484,7 +1528,7 @@ case 292: { sym(1).Node = node; } break; -case 293: { +case 295: { AST::LocalForEachStatement *node = makeAstNode (driver->nodePool(), sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); node->forToken = loc(1); @@ -1495,14 +1539,14 @@ case 293: { sym(1).Node = node; } break; -case 295: { +case 297: { AST::ContinueStatement *node = makeAstNode (driver->nodePool()); node->continueToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 297: { +case 299: { AST::ContinueStatement *node = makeAstNode (driver->nodePool(), sym(2).sval); node->continueToken = loc(1); node->identifierToken = loc(2); @@ -1510,14 +1554,14 @@ case 297: { sym(1).Node = node; } break; -case 299: { +case 301: { AST::BreakStatement *node = makeAstNode (driver->nodePool()); node->breakToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 301: { +case 303: { AST::BreakStatement *node = makeAstNode (driver->nodePool(), sym(2).sval); node->breakToken = loc(1); node->identifierToken = loc(2); @@ -1525,14 +1569,14 @@ case 301: { sym(1).Node = node; } break; -case 303: { +case 305: { AST::ReturnStatement *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->returnToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 304: { +case 306: { AST::WithStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->withToken = loc(1); node->lparenToken = loc(2); @@ -1540,7 +1584,7 @@ case 304: { sym(1).Node = node; } break; -case 305: { +case 307: { AST::SwitchStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock); node->switchToken = loc(1); node->lparenToken = loc(2); @@ -1548,90 +1592,90 @@ case 305: { sym(1).Node = node; } break; -case 306: { +case 308: { AST::CaseBlock *node = makeAstNode (driver->nodePool(), sym(2).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 307: { +case 309: { AST::CaseBlock *node = makeAstNode (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(5); sym(1).Node = node; } break; -case 308: { +case 310: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).CaseClause); } break; -case 309: { +case 311: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause); } break; -case 310: { +case 312: { sym(1).Node = 0; } break; -case 311: { +case 313: { sym(1).Node = sym(1).CaseClauses->finish (); } break; -case 312: { +case 314: { AST::CaseClause *node = makeAstNode (driver->nodePool(), sym(2).Expression, sym(4).StatementList); node->caseToken = loc(1); node->colonToken = loc(3); sym(1).Node = node; } break; -case 313: { +case 315: { AST::DefaultClause *node = makeAstNode (driver->nodePool(), sym(3).StatementList); node->defaultToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 314: -case 315: { +case 316: +case 317: { AST::LabelledStatement *node = makeAstNode (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()), sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 316: { +case 318: { AST::LabelledStatement *node = makeAstNode (driver->nodePool(), sym(1).sval, sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 318: { +case 320: { AST::ThrowStatement *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->throwToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 319: { +case 321: { AST::TryStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(3).Catch); node->tryToken = loc(1); sym(1).Node = node; } break; -case 320: { +case 322: { AST::TryStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(3).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 321: { +case 323: { AST::TryStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 322: { +case 324: { AST::Catch *node = makeAstNode (driver->nodePool(), sym(3).sval, sym(5).Block); node->catchToken = loc(1); node->lparenToken = loc(2); @@ -1640,20 +1684,20 @@ case 322: { sym(1).Node = node; } break; -case 323: { +case 325: { AST::Finally *node = makeAstNode (driver->nodePool(), sym(2).Block); node->finallyToken = loc(1); sym(1).Node = node; } break; -case 325: { +case 327: { AST::DebuggerStatement *node = makeAstNode (driver->nodePool()); node->debuggerToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 326: { +case 328: { AST::FunctionDeclaration *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); node->identifierToken = loc(2); @@ -1664,7 +1708,7 @@ case 326: { sym(1).Node = node; } break; -case 327: { +case 329: { AST::FunctionExpression *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); if (sym(2).sval) @@ -1676,60 +1720,60 @@ case 327: { sym(1).Node = node; } break; -case 328: { +case 330: { AST::FormalParameterList *node = makeAstNode (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 329: { +case 331: { AST::FormalParameterList *node = makeAstNode (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval); node->commaToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 330: { +case 332: { sym(1).Node = 0; } break; -case 331: { +case 333: { sym(1).Node = sym(1).FormalParameterList->finish (); } break; -case 332: { +case 334: { sym(1).Node = 0; } break; -case 334: { +case 336: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElements->finish ()); } break; -case 335: { +case 337: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElements->finish ()); } break; -case 336: { +case 338: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElement); } break; -case 337: { +case 339: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement); } break; -case 338: { +case 340: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Statement); } break; -case 339: { +case 341: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).FunctionDeclaration); } break; -case 340: { +case 342: { sym(1).sval = 0; } break; -case 342: { +case 344: { sym(1).Node = 0; } break; diff --git a/src/declarative/qml/parser/qdeclarativejsparser_p.h b/src/declarative/qml/parser/qdeclarativejsparser_p.h index 3864398..8838fbe 100644 --- a/src/declarative/qml/parser/qdeclarativejsparser_p.h +++ b/src/declarative/qml/parser/qdeclarativejsparser_p.h @@ -235,9 +235,9 @@ protected: -#define J_SCRIPT_REGEXPLITERAL_RULE1 76 +#define J_SCRIPT_REGEXPLITERAL_RULE1 78 -#define J_SCRIPT_REGEXPLITERAL_RULE2 77 +#define J_SCRIPT_REGEXPLITERAL_RULE2 79 QT_QML_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index 9fff294..2b9cd4b 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -397,7 +397,7 @@ Object *ProcessAST::defineObjectBinding(AST::UiQualifiedId *qualifiedId, bool on if (string.isStringList()) { QStringList urls = string.asStringList(); // We need to add this as a resource - for (int ii = 0; ii < urls.count(); ++ii) + for (int ii = 0; ii < urls.count(); ++ii) _parser->_refUrls << QUrl(urls.at(ii)); } } @@ -503,7 +503,7 @@ bool ProcessAST::visit(AST::UiImport *node) error.setColumn(node->importIdToken.startColumn); _parser->_errors << error; return false; - } + } import.location = location(startLoc, endLoc); @@ -637,7 +637,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node) property.isDefaultProperty = node->isDefaultMember; property.type = type; if (type >= Object::DynamicProperty::Custom) { - QDeclarativeScriptParser::TypeReference *typeRef = + QDeclarativeScriptParser::TypeReference *typeRef = _parser->findOrCreateType(memberType); typeRef->refObjects.append(_stateStack.top().object); } @@ -660,9 +660,12 @@ bool ProcessAST::visit(AST::UiPublicMember *node) } _stateStack.top().object->dynamicProperties << property; + + // process QML-like initializers (e.g. property Object o: Object {}) + accept(node->binding); } - return true; + return false; } @@ -996,7 +999,7 @@ QDeclarativeParser::Object::ScriptBlock::Pragmas QDeclarativeScriptParser::extra for (int ii = 0; ii < length; ++ii) { const QChar &c = data[ii]; - if (c.isSpace()) + if (c.isSpace()) continue; if (c == forwardSlash) { diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index e2cf5ca..0f11498 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -1065,7 +1065,6 @@ void tst_qdeclarativelanguage::defaultPropertyListOrder() void tst_qdeclarativelanguage::declaredPropertyValues() { QDeclarativeComponent component(&engine, TEST_FILE("declaredPropertyValues.qml")); - QEXPECT_FAIL("", "QTBUG-7860", Abort); VERIFY_ERRORS(0); } -- cgit v0.12 From a0df2ac07c75882618b40657e1485dda3204880e Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Mon, 22 Feb 2010 14:53:52 +0100 Subject: adds a timeout option to QThreadPool::waitForDone(); Task-number: QTBUG-2695 Reviewed-by: Benjamin Poulain --- src/corelib/concurrent/qthreadpool.cpp | 18 +++++++++++++----- src/corelib/concurrent/qthreadpool.h | 2 +- src/corelib/concurrent/qthreadpool_p.h | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/corelib/concurrent/qthreadpool.cpp b/src/corelib/concurrent/qthreadpool.cpp index 9e4189e..a4057f1 100644 --- a/src/corelib/concurrent/qthreadpool.cpp +++ b/src/corelib/concurrent/qthreadpool.cpp @@ -41,6 +41,7 @@ #include "qthreadpool.h" #include "qthreadpool_p.h" +#include "qelapsedtimer.h" #ifndef QT_NO_THREAD @@ -288,11 +289,18 @@ void QThreadPoolPrivate::reset() isExiting = false; } -void QThreadPoolPrivate::waitForDone() +void QThreadPoolPrivate::waitForDone(int msecs) { QMutexLocker locker(&mutex); - while (!(queue.isEmpty() && activeThreads == 0)) - noActiveThreads.wait(locker.mutex()); + if (msecs < 0){ + while (!(queue.isEmpty() && activeThreads == 0)) + noActiveThreads.wait(locker.mutex()); + } else { + QElapsedTimer timer; + timer.start(); + while (!(queue.isEmpty() && activeThreads == 0) && (timer.elapsed() < msecs)) + noActiveThreads.wait(locker.mutex(), msecs - timer.elapsed()); + } } /*! \internal @@ -610,10 +618,10 @@ void QThreadPool::releaseThread() /*! Waits for each thread to exit and removes all threads from the thread pool. */ -void QThreadPool::waitForDone() +void QThreadPool::waitForDone(int msecs) { Q_D(QThreadPool); - d->waitForDone(); + d->waitForDone(msecs); d->reset(); } diff --git a/src/corelib/concurrent/qthreadpool.h b/src/corelib/concurrent/qthreadpool.h index cc1e059..9895c41 100644 --- a/src/corelib/concurrent/qthreadpool.h +++ b/src/corelib/concurrent/qthreadpool.h @@ -84,7 +84,7 @@ public: void reserveThread(); void releaseThread(); - void waitForDone(); + void waitForDone(int msecs = -1); }; QT_END_NAMESPACE diff --git a/src/corelib/concurrent/qthreadpool_p.h b/src/corelib/concurrent/qthreadpool_p.h index 8a2cf98..1a0e4ab 100644 --- a/src/corelib/concurrent/qthreadpool_p.h +++ b/src/corelib/concurrent/qthreadpool_p.h @@ -82,7 +82,7 @@ public: void startThread(QRunnable *runnable = 0); void reset(); - void waitForDone(); + void waitForDone(int msecs = -1); bool startFrontRunnable(); void stealRunnable(QRunnable *); -- cgit v0.12 From 33a2afa8cccc38302539573f8d3559976bf4cc91 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Thu, 18 Mar 2010 22:13:30 +0100 Subject: Remove the "Insert unicode control character" menu entry on X11. It's still displayed when it seems to make sense with respect to the active keyboard layouts. It can also be enabled from qtconfig. Task-number: QTBUG-9186 Reviewed-by: Denis --- src/gui/inputmethod/qximinputcontext_x11.cpp | 54 +++++++++++++++++++++++++++- src/gui/kernel/qkeymapper_x11.cpp | 5 ++- src/gui/text/qtextcontrol.cpp | 4 +-- src/gui/widgets/qlineedit.cpp | 4 +-- 4 files changed, 59 insertions(+), 8 deletions(-) diff --git a/src/gui/inputmethod/qximinputcontext_x11.cpp b/src/gui/inputmethod/qximinputcontext_x11.cpp index 68ade38..d048b36 100644 --- a/src/gui/inputmethod/qximinputcontext_x11.cpp +++ b/src/gui/inputmethod/qximinputcontext_x11.cpp @@ -344,7 +344,13 @@ static XFontSet getFontSet(const QFont &f) return (fontsetCache[i] == (XFontSet)-1) ? 0 : fontsetCache[i]; } - +extern bool qt_use_rtl_extensions; // from qapplication_x11.cpp +#ifndef QT_NO_XKB +extern void q_getLocaleAndDirection(QLocale *locale, + Qt::LayoutDirection *direction, + const QByteArray &layoutName, + const QByteArray &variantName); +#endif QXIMInputContext::QXIMInputContext() { @@ -375,6 +381,52 @@ QXIMInputContext::QXIMInputContext() else QXIMInputContext::create_xim(); #endif // USE_X11R6_XIM + +#ifndef QT_NO_XKB + if (X11->use_xkb) { + QByteArray layoutName; + QByteArray variantName; + + Atom type = XNone; + int format = 0; + ulong nitems = 0; + ulong bytesAfter = 0; + uchar *data = 0; + if (XGetWindowProperty(X11->display, RootWindow(X11->display, 0), ATOM(_XKB_RULES_NAMES), 0, 1024, + false, XA_STRING, &type, &format, &nitems, &bytesAfter, &data) == Success + && type == XA_STRING && format == 8 && nitems > 2) { + + char *names[5] = { 0, 0, 0, 0, 0 }; + char *p = reinterpret_cast(data), *end = p + nitems; + int i = 0; + do { + names[i++] = p; + p += qstrlen(p) + 1; + } while (p < end); + + QList layoutNames = QByteArray::fromRawData(names[2], qstrlen(names[2])).split(','); + QList variantNames = QByteArray::fromRawData(names[3], qstrlen(names[3])).split(','); + for (int i = 0; i < qMin(layoutNames.count(), variantNames.count()); ++i ) { + QLocale keyboardInputLocale; + Qt::LayoutDirection keyboardInputDirection; + QByteArray variantName = variantNames.at(i); + const int dashPos = variantName.indexOf("-"); + if (dashPos >= 0) + variantName.truncate(dashPos); + q_getLocaleAndDirection(&keyboardInputLocale, + &keyboardInputDirection, + layoutNames.at(i), + variantName); + if (keyboardInputDirection == Qt::RightToLeft) + qt_use_rtl_extensions = true; + } + } + + if (data) + XFree(data); + } +#endif // QT_NO_XKB + } diff --git a/src/gui/kernel/qkeymapper_x11.cpp b/src/gui/kernel/qkeymapper_x11.cpp index 428ac3e..807959c 100644 --- a/src/gui/kernel/qkeymapper_x11.cpp +++ b/src/gui/kernel/qkeymapper_x11.cpp @@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF)) #endif -static void getLocaleAndDirection(QLocale *locale, +void q_getLocaleAndDirection(QLocale *locale, Qt::LayoutDirection *direction, const QByteArray &layoutName, const QByteArray &variantName) @@ -523,7 +523,7 @@ void QKeyMapperPrivate::clearMappings() // if (keyboardLayoutName.isEmpty()) // qWarning("Qt: unable to determine keyboard layout, please talk to qt-bugs@trolltech.com"); ? - getLocaleAndDirection(&keyboardInputLocale, + q_getLocaleAndDirection(&keyboardInputLocale, &keyboardInputDirection, layoutName, variantName); @@ -534,7 +534,6 @@ void QKeyMapperPrivate::clearMappings() << "direction =" << keyboardInputDirection; #endif - if (data) XFree(data); } else diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 6864fe1..671dfc0 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -91,7 +91,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_CONTEXTMENU -#if defined(Q_WS_WIN) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) extern bool qt_use_rtl_extensions; #endif #endif @@ -2080,7 +2080,7 @@ QMenu *QTextControl::createStandardContextMenu(const QPointF &pos, QWidget *pare } #endif -#if defined(Q_WS_WIN) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) if ((d->interactionFlags & Qt::TextEditable) && qt_use_rtl_extensions) { #else if (d->interactionFlags & Qt::TextEditable) { diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 817547c..0b8dca9 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -2046,7 +2046,7 @@ void QLineEdit::contextMenuEvent(QContextMenuEvent *event) } } -#if defined(Q_WS_WIN) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) extern bool qt_use_rtl_extensions; #endif @@ -2118,7 +2118,7 @@ QMenu *QLineEdit::createStandardContextMenu() } #endif -#if defined(Q_WS_WIN) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) if (!d->control->isReadOnly() && qt_use_rtl_extensions) { #else if (!d->control->isReadOnly()) { -- cgit v0.12 From 6b074cf855276f7ec67f7b69fe91f0243291c50d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 31 Mar 2010 17:28:37 +0200 Subject: Fix compilation with Sun CC: no semi-colon after Q_ENUM. Error was: "graphicsitems/qdeclarativepathview_p.h", line 80: Error: "}" expected instead of ";" Reviewed-by: Olivier Goffart --- src/declarative/graphicsitems/qdeclarativepathview_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h index 0079891..a00f4c0 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h @@ -77,7 +77,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativePathView : public QDeclarativeItem Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) Q_PROPERTY(int pathItemCount READ pathItemCount WRITE setPathItemCount NOTIFY pathItemCountChanged) - Q_ENUMS(HighlightRangeMode); + Q_ENUMS(HighlightRangeMode) public: QDeclarativePathView(QDeclarativeItem *parent=0); -- cgit v0.12 From 664fdc07056b8497a68518d0f89d689ff399702e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 31 Mar 2010 11:15:58 +0200 Subject: interpret source language "en" as "POSIX" (more precisely: "none specified") we set it to that value when writing xliff, as the header is mandatory and no better value is possible. it seems unlikely that an unqualified "english" would be used if somebody meant to actually specify a source language, so this hack should be ok. --- tests/auto/linguist/lconvert/data/msgid.ts | 2 +- tools/linguist/shared/xliff.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/linguist/lconvert/data/msgid.ts b/tests/auto/linguist/lconvert/data/msgid.ts index ab65845..f89fa74 100644 --- a/tests/auto/linguist/lconvert/data/msgid.ts +++ b/tests/auto/linguist/lconvert/data/msgid.ts @@ -1,6 +1,6 @@ - + Dialog2 diff --git a/tools/linguist/shared/xliff.cpp b/tools/linguist/shared/xliff.cpp index 20303ec..6411426 100644 --- a/tools/linguist/shared/xliff.cpp +++ b/tools/linguist/shared/xliff.cpp @@ -503,6 +503,8 @@ bool XLIFFHandler::startElement(const QString& namespaceURI, m_language.replace(QLatin1Char('-'), QLatin1Char('_')); m_sourceLanguage = atts.value(QLatin1String("source-language")); m_sourceLanguage.replace(QLatin1Char('-'), QLatin1Char('_')); + if (m_sourceLanguage == QLatin1String("en")) + m_sourceLanguage.clear(); } else if (localName == QLatin1String("group")) { if (atts.value(QLatin1String("restype")) == QLatin1String(restypeContext)) { m_context = atts.value(QLatin1String("resname")); -- cgit v0.12 From 0226221643e9f88c9b50ede7677b523d143025f3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 30 Mar 2010 18:25:27 +0200 Subject: fix updating of X-Source-Language PO header --- tools/linguist/shared/po.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index 3354d61..393290c 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -630,6 +630,9 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) transl.remove(QRegExp(QLatin1String("\\bX-Language:[^\n]*\n"))); if (!translator.languageCode().isEmpty()) transl += QLatin1String("X-Language: ") + translator.languageCode() + QLatin1Char('\n'); + transl.remove(QRegExp(QLatin1String("\\bX-Source-Language:[^\n]*\n"))); + if (!translator.sourceLanguageCode().isEmpty()) + transl += QLatin1String("X-Source-Language: ") + translator.sourceLanguageCode() + QLatin1Char('\n'); } out << poEscapedString(prefix, QLatin1String("msgstr"), noWrap, transl); } else { -- cgit v0.12 From e07e8a02aab1dec4f91323d2912a54b3a78b075a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 31 Mar 2010 11:24:55 +0200 Subject: make PO header handling less of a monster hack instead of doing string editing magic, parse the header properly. don't add a template file comment, either - it's not mandatory, after all. --- tools/linguist/shared/po.cpp | 124 ++++++++++++++++++++++++++++--------------- 1 file changed, 80 insertions(+), 44 deletions(-) diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index 393290c..19e2f13 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -354,6 +354,11 @@ static void slurpComment(QString &msg, const QStringList &lines, int & l) --l; } +static QString makePoHeader(const QString &str) +{ + return QLatin1String("po-header-") + str.toLower().replace(QLatin1Char('-'), QLatin1Char('_')); +} + bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) { const QChar quote = QLatin1Char('"'); @@ -385,7 +390,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) lines.append(in.readLine().trimmed()); lines.append(QString()); - int l = 0; + int l = 0, lastCmtLine = -1; PoItem item; for (; l != lines.size(); ++l) { QString line = lines.at(l); @@ -406,23 +411,51 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) line = lines.at(l); } if (item.msgId.isEmpty()) { - QRegExp rx(QLatin1String("\\bX-Language: ([^\n]*)\n")); - int idx = rx.indexIn(item.msgStr.first()); - if (idx >= 0) { - translator.setLanguageCode(rx.cap(1)); - item.msgStr.first().remove(idx, rx.matchedLength()); - } - QRegExp rx2(QLatin1String("\\bX-Source-Language: ([^\n]*)\n")); - int idx2 = rx2.indexIn(item.msgStr.first()); - if (idx2 >= 0) { - translator.setSourceLanguageCode(rx2.cap(1)); - item.msgStr.first().remove(idx2, rx2.matchedLength()); + QStringList hdrOrder; + foreach (const QString &hdr, + item.msgStr.first().split(QLatin1Char('\n'), QString::SkipEmptyParts)) { + int idx = hdr.indexOf(QLatin1Char(':')); + if (idx < 0) { + cd.appendError(QString::fromLatin1("Unexpected PO header format '%1'\n") + .arg(hdr)); + error = true; + break; + } + QString hdrName = hdr.left(idx).trimmed(); + QString hdrValue = hdr.mid(idx + 1).trimmed(); + hdrOrder << hdrName; + if (hdrName == QLatin1String("X-Language")) + translator.setLanguageCode(hdrValue); + else if (hdrName == QLatin1String("X-Source-Language")) + translator.setSourceLanguageCode(hdrValue); + else if (hdrName == QLatin1String("X-Virgin-Header")) + ; // legacy + else + translator.setExtra(makePoHeader(hdrName), hdrValue); } - if (item.msgStr.first().indexOf( - QRegExp(QLatin1String("\\bX-Virgin-Header:[^\n]*\n"))) >= 0) { - item = PoItem(); - continue; + // Eliminate the field if only headers we added are present in standard order. + // Keep in sync with savePO + static const char * const dfltHdrs[] = { "X-Language", "X-Source-Language" }; + uint cdh = 0; + for (int cho = 0; cho < hdrOrder.length(); cho++) { + for (;; cdh++) { + if (cdh == sizeof(dfltHdrs)/sizeof(dfltHdrs[0])) { + translator.setExtra(QLatin1String("po-headers"), + hdrOrder.join(QLatin1String(","))); + goto doneho; + } + if (hdrOrder.at(cho) == QLatin1String(dfltHdrs[cdh])) { + cdh++; + break; + } + } } + doneho: + if (lastCmtLine != -1) + translator.setExtra(QLatin1String("po-header_comment"), + static_cast(lines.mid(0, lastCmtLine + 1)).join(QLatin1String("\n"))); + item = PoItem(); + continue; } // build translator message TranslatorMessage msg; @@ -533,6 +566,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) error = true; break; } + lastCmtLine = l; } else if (line.startsWith(QLatin1String("msgctxt "))) { item.tscomment = slurpEscapedString(lines, l, 8, QString(), cd); } else if (line.startsWith(QLatin1String("msgid "))) { @@ -551,33 +585,44 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) return !error && cd.errors().isEmpty(); } +static void addPoHeader(Translator::ExtraData &headers, QStringList &hdrOrder, + const char *name, const QString &value) +{ + QString qName = QLatin1String(name); + if (!hdrOrder.contains(qName)) + hdrOrder << qName; + headers[makePoHeader(qName)] = value; +} + bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) { bool ok = true; QTextStream out(&dev); out.setCodec(cd.m_outputCodec.isEmpty() ? QByteArray("UTF-8") : cd.m_outputCodec); - bool first = true; - if (translator.messages().isEmpty() || !translator.messages().first().sourceText().isEmpty()) { - out << - "# SOME DESCRIPTIVE TITLE.\n" - "# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n" - "# This file is distributed under the same license as the PACKAGE package.\n" - "# FIRST AUTHOR , YEAR.\n" - "#\n" - "#, fuzzy\n" - "msgid \"\"\n" - "msgstr \"\"\n" - "\"X-Virgin-Header: remove this line if you change anything in the header.\\n\"\n"; - if (!translator.languageCode().isEmpty()) - out << "\"X-Language: " << translator.languageCode() << "\\n\"\n"; - if (!translator.sourceLanguageCode().isEmpty()) - out << "\"X-Source-Language: " << translator.sourceLanguageCode() << "\\n\"\n"; - first = false; + QString cmt = translator.extra(QLatin1String("po-header_comment")); + if (!cmt.isEmpty()) + out << cmt << '\n'; + out << "msgid \"\"\n"; + Translator::ExtraData headers = translator.extras(); + QStringList hdrOrder = translator.extra(QLatin1String("po-headers")).split( + QLatin1Char(','), QString::SkipEmptyParts); + // Keep in sync with loadPO + if (!translator.languageCode().isEmpty()) + addPoHeader(headers, hdrOrder, "X-Language", translator.languageCode()); + if (!translator.sourceLanguageCode().isEmpty()) + addPoHeader(headers, hdrOrder, "X-Source-Language", translator.sourceLanguageCode()); + QString hdrStr; + foreach (const QString &hdr, hdrOrder) { + hdrStr += hdr; + hdrStr += QLatin1String(": "); + hdrStr += headers.value(makePoHeader(hdr)); + hdrStr += QLatin1Char('\n'); } + out << poEscapedString(QString(), QString::fromLatin1("msgstr"), true, hdrStr); + foreach (const TranslatorMessage &msg, translator.messages()) { - if (!first) - out << endl; + out << endl; if (!msg.translatorComment().isEmpty()) out << poEscapedLines(QLatin1String("#"), true, msg.translatorComment()); @@ -626,14 +671,6 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) out << poEscapedString(prefix, QLatin1String("msgid"), noWrap, msg.sourceText()); if (!msg.isPlural()) { QString transl = msg.translation(); - if (first) { - transl.remove(QRegExp(QLatin1String("\\bX-Language:[^\n]*\n"))); - if (!translator.languageCode().isEmpty()) - transl += QLatin1String("X-Language: ") + translator.languageCode() + QLatin1Char('\n'); - transl.remove(QRegExp(QLatin1String("\\bX-Source-Language:[^\n]*\n"))); - if (!translator.sourceLanguageCode().isEmpty()) - transl += QLatin1String("X-Source-Language: ") + translator.sourceLanguageCode() + QLatin1Char('\n'); - } out << poEscapedString(prefix, QLatin1String("msgstr"), noWrap, transl); } else { QString plural = msg.extra(QLatin1String("po-msgid_plural")); @@ -649,7 +686,6 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) str); } } - first = false; } return ok; } -- cgit v0.12 From 2aad03302a80f609359ba6bb29aab9fdad08d608 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 31 Mar 2010 11:30:49 +0200 Subject: fix writing of length variant separators in the singular case --- tools/linguist/shared/po.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index 19e2f13..bdd8c25 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -671,6 +671,8 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) out << poEscapedString(prefix, QLatin1String("msgid"), noWrap, msg.sourceText()); if (!msg.isPlural()) { QString transl = msg.translation(); + transl.replace(QChar(Translator::BinaryVariantSeparator), + QChar(Translator::TextVariantSeparator)); out << poEscapedString(prefix, QLatin1String("msgstr"), noWrap, transl); } else { QString plural = msg.extra(QLatin1String("po-msgid_plural")); -- cgit v0.12 From ba40d481456095304729d0ef4279e0a53281798a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 30 Mar 2010 12:40:34 +0200 Subject: support gettext POT files these are in fact the same as PO files, only that exporting to one automatically drops translations. --- tools/linguist/shared/po.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index bdd8c25..87b2a8a 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -692,6 +692,13 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) return ok; } +static bool savePOT(const Translator &translator, QIODevice &dev, ConversionData &cd) +{ + Translator ttor = translator; + ttor.dropTranslations(); + return savePO(ttor, dev, cd); +} + int initPO() { Translator::FileFormat format; @@ -702,6 +709,13 @@ int initPO() format.fileType = Translator::FileFormat::TranslationSource; format.priority = 1; Translator::registerFileFormat(format); + format.extension = QLatin1String("pot"); + format.description = QObject::tr("GNU Gettext localization template files"); + format.loader = &loadPO; + format.saver = &savePOT; + format.fileType = Translator::FileFormat::TranslationSource; + format.priority = -1; + Translator::registerFileFormat(format); return 1; } -- cgit v0.12 From 89c369f344455a11259b29854a3556650a88c63d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 31 Mar 2010 11:32:48 +0200 Subject: don't mark untranslated messages as fuzzy in PO files ... as this is what gettext processors expect. --- tests/auto/linguist/lconvert/data/endless-po-loop.ts | 4 ++-- tests/auto/linguist/lconvert/data/msgid.ts | 8 ++++---- tests/auto/linguist/lconvert/data/singular.po | 3 --- tests/auto/linguist/lconvert/data/wrapping.po | 1 - tools/linguist/shared/po.cpp | 4 ++-- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/auto/linguist/lconvert/data/endless-po-loop.ts b/tests/auto/linguist/lconvert/data/endless-po-loop.ts index 6212fbd..8aa7215 100644 --- a/tests/auto/linguist/lconvert/data/endless-po-loop.ts +++ b/tests/auto/linguist/lconvert/data/endless-po-loop.ts @@ -5,12 +5,12 @@ Assistant This is some text which introduces the DonauDampfSchifffahrtsKapitaensMuetzeMitKomischenUltraViolettenFransenUndEinemKnopf - + %n document(s) found. - + diff --git a/tests/auto/linguist/lconvert/data/msgid.ts b/tests/auto/linguist/lconvert/data/msgid.ts index f89fa74..39401d8 100644 --- a/tests/auto/linguist/lconvert/data/msgid.ts +++ b/tests/auto/linguist/lconvert/data/msgid.ts @@ -5,23 +5,23 @@ Dialog2 %n files - + %n cars - + Age: %1 - + func3 - + diff --git a/tests/auto/linguist/lconvert/data/singular.po b/tests/auto/linguist/lconvert/data/singular.po index a0d4019..e0cfafb 100644 --- a/tests/auto/linguist/lconvert/data/singular.po +++ b/tests/auto/linguist/lconvert/data/singular.po @@ -9,7 +9,6 @@ msgstr "translated" msgid "untranslated two" msgstr "translated" -#, fuzzy #| msgid "old untranslated" msgid "untranslated two b" msgstr "" @@ -20,7 +19,6 @@ msgstr "" msgid "untranslated three" msgstr "translated" -#, fuzzy #| msgid "old untranslated" #| msgid_plural "old untranslated plural" msgid "untranslated three b" @@ -31,7 +29,6 @@ msgstr "" msgid "untranslated four" msgstr "translated" -#, fuzzy #| msgid_plural "old untranslated only plural" msgid "untranslated four b" msgstr "" diff --git a/tests/auto/linguist/lconvert/data/wrapping.po b/tests/auto/linguist/lconvert/data/wrapping.po index 39b7fbe..8223611 100644 --- a/tests/auto/linguist/lconvert/data/wrapping.po +++ b/tests/auto/linguist/lconvert/data/wrapping.po @@ -3,7 +3,6 @@ # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index 87b2a8a..2895143 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -482,7 +482,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) msg.setTranslations(item.msgStr); if (isObsolete) msg.setType(TranslatorMessage::Obsolete); - else if (item.isFuzzy) + else if (item.isFuzzy || (!msg.sourceText().isEmpty() && !msg.isTranslated())) msg.setType(TranslatorMessage::Unfinished); else msg.setType(TranslatorMessage::Finished); @@ -645,7 +645,7 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) bool noWrap = false; QStringList flags; - if (msg.type() == TranslatorMessage::Unfinished) + if (msg.type() == TranslatorMessage::Unfinished && msg.isTranslated()) flags.append(QLatin1String("fuzzy")); TranslatorMessage::ExtraData::const_iterator itr = msg.extras().find(QLatin1String("po-flags")); -- cgit v0.12 From 1999331085a56242372c42f1dadfeeb0281e3f82 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 30 Mar 2010 15:33:48 +0200 Subject: simplify arabic plural rule --- tools/linguist/shared/numerus.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/shared/numerus.cpp b/tools/linguist/shared/numerus.cpp index d45dfed..287dd03 100644 --- a/tools/linguist/shared/numerus.cpp +++ b/tools/linguist/shared/numerus.cpp @@ -100,7 +100,7 @@ static const uchar arabicRules[] = Q_EQ, 1, Q_NEWRULE, Q_EQ, 2, Q_NEWRULE, Q_MOD_100 | Q_BETWEEN, 3, 10, Q_NEWRULE, - Q_MOD_100 | Q_NOT | Q_BETWEEN, 0, 2 }; + Q_MOD_100 | Q_GEQ, 11 }; static const uchar tagalogRules[] = { Q_LEQ, 1, Q_NEWRULE, Q_MOD_10 | Q_EQ, 4, Q_OR, Q_MOD_10 | Q_EQ, 6, Q_OR, Q_MOD_10 | Q_EQ, 9 }; -- cgit v0.12 From 81c35b4d95a0da4d2b104aa84ba5de93d0d94d1d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 31 Mar 2010 12:54:38 +0200 Subject: add Plural-Forms header in PO writer --- tests/auto/linguist/lconvert/data/makeplurals.pl | 9 ++-- .../auto/linguist/lconvert/data/test-kde-fuzzy.po | 2 +- .../linguist/lconvert/data/test-kde-multiline.po | 2 +- .../linguist/lconvert/data/test-kde-plurals.po | 2 +- tests/auto/linguist/lconvert/data/test1-de.po | 2 +- tools/linguist/linguist/messagemodel.cpp | 2 +- tools/linguist/shared/numerus.cpp | 57 ++++++++++++++-------- tools/linguist/shared/po.cpp | 24 ++++++++- tools/linguist/shared/qm.cpp | 4 +- tools/linguist/shared/translator.cpp | 2 +- tools/linguist/shared/translator.h | 2 +- 11 files changed, 74 insertions(+), 34 deletions(-) diff --git a/tests/auto/linguist/lconvert/data/makeplurals.pl b/tests/auto/linguist/lconvert/data/makeplurals.pl index d933a3e..9707ef0 100755 --- a/tests/auto/linguist/lconvert/data/makeplurals.pl +++ b/tests/auto/linguist/lconvert/data/makeplurals.pl @@ -57,7 +57,7 @@ sub makeit2($$$) } } -sub makeit($$) +sub makeit($$$) { open OUTFILE, ">${OUTDIR}plural-$_[0].po" || die "cannot write file in $OUTDIR"; print OUTFILE <=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"); diff --git a/tests/auto/linguist/lconvert/data/test-kde-fuzzy.po b/tests/auto/linguist/lconvert/data/test-kde-fuzzy.po index b3f6e03..fc9ae77 100644 --- a/tests/auto/linguist/lconvert/data/test-kde-fuzzy.po +++ b/tests/auto/linguist/lconvert/data/test-kde-fuzzy.po @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KAider 0.1\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" #: kgverify.cpp:459 #, fuzzy, kde-format diff --git a/tests/auto/linguist/lconvert/data/test-kde-multiline.po b/tests/auto/linguist/lconvert/data/test-kde-multiline.po index 0ca714c..662c02e 100644 --- a/tests/auto/linguist/lconvert/data/test-kde-multiline.po +++ b/tests/auto/linguist/lconvert/data/test-kde-multiline.po @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KAider 0.1\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" #: kdmshutdown.cpp:706 #, kde-format diff --git a/tests/auto/linguist/lconvert/data/test-kde-plurals.po b/tests/auto/linguist/lconvert/data/test-kde-plurals.po index 6c85d74..9f74de0 100644 --- a/tests/auto/linguist/lconvert/data/test-kde-plurals.po +++ b/tests/auto/linguist/lconvert/data/test-kde-plurals.po @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KAider 0.1\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Language: de_DE\n" #: kgverify.cpp:505 diff --git a/tests/auto/linguist/lconvert/data/test1-de.po b/tests/auto/linguist/lconvert/data/test1-de.po index 256b8e9..a4523bb 100644 --- a/tests/auto/linguist/lconvert/data/test1-de.po +++ b/tests/auto/linguist/lconvert/data/test1-de.po @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KAider 0.1\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Language: de_DE\n" #: lib/acl.c:107 lib/acl.c:121 lib/acl.c:138 lib/acl.c:165 lib/acl.c:174 diff --git a/tools/linguist/linguist/messagemodel.cpp b/tools/linguist/linguist/messagemodel.cpp index 4e2b473..39ba9fd 100644 --- a/tools/linguist/linguist/messagemodel.cpp +++ b/tools/linguist/linguist/messagemodel.cpp @@ -402,7 +402,7 @@ bool DataModel::setLanguageAndCountry(QLocale::Language lang, QLocale::Country c if (lang == QLocale::C || uint(lang) > uint(QLocale::LastLanguage)) // XXX does this make any sense? lang = QLocale::English; QByteArray rules; - bool ok = getNumerusInfo(lang, country, &rules, &m_numerusForms); + bool ok = getNumerusInfo(lang, country, &rules, &m_numerusForms, 0); m_localizedLanguage = QCoreApplication::translate("MessageEditor", QLocale::languageToString(lang).toAscii()); m_countRefNeeds.clear(); for (int i = 0; i < rules.size(); ++i) { diff --git a/tools/linguist/shared/numerus.cpp b/tools/linguist/shared/numerus.cpp index 287dd03..c002119 100644 --- a/tools/linguist/shared/numerus.cpp +++ b/tools/linguist/shared/numerus.cpp @@ -318,28 +318,45 @@ struct NumerusTableEntry { const char * const *forms; const QLocale::Language *languages; const QLocale::Country *countries; + const char * const gettextRules; }; static const NumerusTableEntry numerusTable[] = { - { 0, 0, japaneseStyleForms, japaneseStyleLanguages, 0 }, - { englishStyleRules, sizeof(englishStyleRules), englishStyleForms, englishStyleLanguages, 0 }, + { 0, 0, japaneseStyleForms, japaneseStyleLanguages, 0, "nplurals=1; plural=0;" }, + { englishStyleRules, sizeof(englishStyleRules), englishStyleForms, englishStyleLanguages, 0, + "nplurals=2; plural=(n != 1);" }, { frenchStyleRules, sizeof(frenchStyleRules), frenchStyleForms, frenchStyleLanguages, - frenchStyleCountries }, - { latvianRules, sizeof(latvianRules), latvianForms, latvianLanguage, 0 }, - { icelandicRules, sizeof(icelandicRules), icelandicForms, icelandicLanguage, 0 }, - { irishStyleRules, sizeof(irishStyleRules), irishStyleForms, irishStyleLanguages, 0 }, - { slovakRules, sizeof(slovakRules), slovakForms, slovakLanguages, 0 }, - { macedonianRules, sizeof(macedonianRules), macedonianForms, macedonianLanguage, 0 }, - { lithuanianRules, sizeof(lithuanianRules), lithuanianForms, lithuanianLanguage, 0 }, - { russianStyleRules, sizeof(russianStyleRules), russianStyleForms, russianStyleLanguages, 0 }, - { polishRules, sizeof(polishRules), polishForms, polishLanguage, 0 }, - { romanianRules, sizeof(romanianRules), romanianForms, romanianLanguages, 0 }, - { slovenianRules, sizeof(slovenianRules), slovenianForms, slovenianLanguage, 0 }, - { malteseRules, sizeof(malteseRules), malteseForms, malteseLanguage, 0 }, - { welshRules, sizeof(welshRules), welshForms, welshLanguage, 0 }, - { arabicRules, sizeof(arabicRules), arabicForms, arabicLanguage, 0 }, - { tagalogRules, sizeof(tagalogRules), tagalogForms, tagalogLanguage, 0 }, - { catalanRules, sizeof(catalanRules), catalanForms, catalanLanguage, 0 } + frenchStyleCountries, "nplurals=2; plural=(n > 1);" }, + { latvianRules, sizeof(latvianRules), latvianForms, latvianLanguage, 0, + "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);" }, + { icelandicRules, sizeof(icelandicRules), icelandicForms, icelandicLanguage, 0, + "nplurals=2; plural=(n%10==1 && n%100!=11 ? 0 : 1);" }, + { irishStyleRules, sizeof(irishStyleRules), irishStyleForms, irishStyleLanguages, 0, + "nplurals=3; plural=(n==1 ? 0 : n==2 ? 1 : 2);" }, + { slovakRules, sizeof(slovakRules), slovakForms, slovakLanguages, 0, + "nplurals=3; plural=((n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2);" }, + { macedonianRules, sizeof(macedonianRules), macedonianForms, macedonianLanguage, 0, + "nplurals=3; plural=(n%100==1 ? 0 : n%100==2 ? 1 : 2);" }, + { lithuanianRules, sizeof(lithuanianRules), lithuanianForms, lithuanianLanguage, 0, + "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);" }, + { russianStyleRules, sizeof(russianStyleRules), russianStyleForms, russianStyleLanguages, 0, + "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);" }, + { polishRules, sizeof(polishRules), polishForms, polishLanguage, 0, + "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);" }, + { romanianRules, sizeof(romanianRules), romanianForms, romanianLanguages, 0, + "nplurals=3; plural=(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2);" }, + { slovenianRules, sizeof(slovenianRules), slovenianForms, slovenianLanguage, 0, + "nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);" }, + { malteseRules, sizeof(malteseRules), malteseForms, malteseLanguage, 0, + "nplurals=4; plural=(n==1 ? 0 : (n==0 || (n%100>=1 && n%100<=10)) ? 1 : (n%100>=11 && n%100<=19) ? 2 : 3);" }, + { welshRules, sizeof(welshRules), welshForms, welshLanguage, 0, + "nplurals=5; plural=(n==0 ? 0 : n==1 ? 1 : (n>=2 && n<=5) ? 2 : n==6 ? 3 : 4);" }, + { arabicRules, sizeof(arabicRules), arabicForms, arabicLanguage, 0, + "nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : (n%100>=3 && n%100<=10) ? 3 : n%100>=11 ? 4 : 5);" }, + { tagalogRules, sizeof(tagalogRules), tagalogForms, tagalogLanguage, 0, + "nplurals=3; plural=(n==1 ? 0 : (n%10==4 || n%10==6 || n%10== 9) ? 1 : 2);" }, + { catalanRules, sizeof(catalanRules), catalanForms, catalanLanguage, 0, + "nplurals=3; plural=(n==1 ? 0 : (n==11 || n/1000==11 || n/1000000==11 || n/1000000000==11) ? 1 : 2);" }, }; static const int NumerusTableSize = sizeof(numerusTable) / sizeof(numerusTable[0]); @@ -352,7 +369,7 @@ static const uchar magic[MagicLength] = { }; bool getNumerusInfo(QLocale::Language language, QLocale::Country country, - QByteArray *rules, QStringList *forms) + QByteArray *rules, QStringList *forms, const char **gettextRules) { while (true) { for (int i = 0; i < NumerusTableSize; ++i) { @@ -365,6 +382,8 @@ bool getNumerusInfo(QLocale::Language language, QLocale::Country country, *rules = QByteArray::fromRawData(reinterpret_cast(entry.rules), entry.rulesSize); } + if (gettextRules) + *gettextRules = entry.gettextRules; if (forms) { forms->clear(); for (int k = 0; entry.forms[k]; ++k) diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index 2895143..ab24e15 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -412,6 +412,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) } if (item.msgId.isEmpty()) { QStringList hdrOrder; + QString pluralForms; foreach (const QString &hdr, item.msgStr.first().split(QLatin1Char('\n'), QString::SkipEmptyParts)) { int idx = hdr.indexOf(QLatin1Char(':')); @@ -428,14 +429,26 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) translator.setLanguageCode(hdrValue); else if (hdrName == QLatin1String("X-Source-Language")) translator.setSourceLanguageCode(hdrValue); + else if (hdrName == QLatin1String("Plural-Forms")) + pluralForms = hdrValue; else if (hdrName == QLatin1String("X-Virgin-Header")) ; // legacy else translator.setExtra(makePoHeader(hdrName), hdrValue); } + if (!pluralForms.isEmpty()) { + if (translator.languageCode().isEmpty()) { + translator.setExtra(makePoHeader(QLatin1String("Plural-Forms")), + pluralForms); + } else { + // FIXME: have fun with making a consistency check ... + } + } // Eliminate the field if only headers we added are present in standard order. // Keep in sync with savePO - static const char * const dfltHdrs[] = { "X-Language", "X-Source-Language" }; + static const char * const dfltHdrs[] = { + "Plural-Forms", "X-Language", "X-Source-Language" + }; uint cdh = 0; for (int cho = 0; cho < hdrOrder.length(); cho++) { for (;; cdh++) { @@ -608,8 +621,15 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) QStringList hdrOrder = translator.extra(QLatin1String("po-headers")).split( QLatin1Char(','), QString::SkipEmptyParts); // Keep in sync with loadPO - if (!translator.languageCode().isEmpty()) + if (!translator.languageCode().isEmpty()) { + QLocale::Language l; + QLocale::Country c; + Translator::languageAndCountry(translator.languageCode(), &l, &c); + const char *gettextRules; + if (getNumerusInfo(l, c, 0, 0, &gettextRules)) + addPoHeader(headers, hdrOrder, "Plural-Forms", QLatin1String(gettextRules)); addPoHeader(headers, hdrOrder, "X-Language", translator.languageCode()); + } if (!translator.sourceLanguageCode().isEmpty()) addPoHeader(headers, hdrOrder, "X-Source-Language", translator.sourceLanguageCode()); QString hdrStr; diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index de1284f..e2c4f4a 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -564,7 +564,7 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) Translator::languageAndCountry(translator.languageCode(), &l, &c); QStringList numerusForms; bool guessPlurals = true; - if (getNumerusInfo(l, c, 0, &numerusForms)) + if (getNumerusInfo(l, c, 0, &numerusForms, 0)) guessPlurals = (numerusForms.count() == 1); QString context, contextUtf8; @@ -704,7 +704,7 @@ static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData QLocale::Country c; Translator::languageAndCountry(translator.languageCode(), &l, &c); QByteArray rules; - if (getNumerusInfo(l, c, &rules, 0)) + if (getNumerusInfo(l, c, &rules, 0, 0)) releaser.setNumerusRules(rules); releaser.setCodecName(translator.codecName()); diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index 4331ce6..465355d 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -652,7 +652,7 @@ void Translator::normalizeTranslations(ConversionData &cd) int numPlurals = 1; if (l != QLocale::C) { QStringList forms; - if (getNumerusInfo(l, c, 0, &forms)) + if (getNumerusInfo(l, c, 0, &forms, 0)) numPlurals = forms.count(); // includes singular } for (int i = 0; i < m_messages.count(); ++i) { diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index 0b88c07..bb199f0 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -233,7 +233,7 @@ private: }; bool getNumerusInfo(QLocale::Language language, QLocale::Country country, - QByteArray *rules, QStringList *forms); + QByteArray *rules, QStringList *forms, const char **gettextRules); /* This is a quick hack. The proper way to handle this would be -- cgit v0.12 From 11330487204a69a8afc998666f18350730ec1b09 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 30 Mar 2010 16:09:09 +0200 Subject: make variable naming politically correct :-D --- tools/linguist/shared/numerus.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/linguist/shared/numerus.cpp b/tools/linguist/shared/numerus.cpp index c002119..6066732 100644 --- a/tools/linguist/shared/numerus.cpp +++ b/tools/linguist/shared/numerus.cpp @@ -64,7 +64,7 @@ static const uchar icelandicRules[] = static const uchar irishStyleRules[] = { Q_EQ, 1, Q_NEWRULE, Q_EQ, 2 }; -static const uchar slovakRules[] = +static const uchar slovakStyleRules[] = { Q_EQ, 1, Q_NEWRULE, Q_BETWEEN, 2, 4 }; static const uchar macedonianRules[] = @@ -114,7 +114,7 @@ static const char * const frenchStyleForms[] = { "Singular", "Plural", 0 }; static const char * const icelandicForms[] = { "Singular", "Plural", 0 }; static const char * const latvianForms[] = { "Singular", "Plural", "Nullar", 0 }; static const char * const irishStyleForms[] = { "Singular", "Dual", "Plural", 0 }; -static const char * const slovakForms[] = { "Singular", "Paucal", "Plural", 0 }; +static const char * const slovakStyleForms[] = { "Singular", "Paucal", "Plural", 0 }; static const char * const macedonianForms[] = { "Singular", "Dual", "Plural", 0 }; static const char * const lithuanianForms[] = { "Singular", "Paucal", "Plural", 0 }; static const char * const russianStyleForms[] = { "Singular", "Dual", "Plural", 0 }; @@ -279,7 +279,7 @@ static const QLocale::Language irishStyleLanguages[] = { QLocale::Sanskrit, EOL }; -static const QLocale::Language slovakLanguages[] = { QLocale::Slovak, QLocale::Czech, EOL }; +static const QLocale::Language slovakStyleLanguages[] = { QLocale::Slovak, QLocale::Czech, EOL }; static const QLocale::Language macedonianLanguage[] = { QLocale::Macedonian, EOL }; static const QLocale::Language lithuanianLanguage[] = { QLocale::Lithuanian, EOL }; static const QLocale::Language russianStyleLanguages[] = { @@ -333,7 +333,7 @@ static const NumerusTableEntry numerusTable[] = { "nplurals=2; plural=(n%10==1 && n%100!=11 ? 0 : 1);" }, { irishStyleRules, sizeof(irishStyleRules), irishStyleForms, irishStyleLanguages, 0, "nplurals=3; plural=(n==1 ? 0 : n==2 ? 1 : 2);" }, - { slovakRules, sizeof(slovakRules), slovakForms, slovakLanguages, 0, + { slovakStyleRules, sizeof(slovakStyleRules), slovakStyleForms, slovakStyleLanguages, 0, "nplurals=3; plural=((n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2);" }, { macedonianRules, sizeof(macedonianRules), macedonianForms, macedonianLanguage, 0, "nplurals=3; plural=(n%100==1 ? 0 : n%100==2 ? 1 : 2);" }, -- cgit v0.12 From 1294e8cbcf2b0c6b52aef0c948ee32260bff8230 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 31 Mar 2010 14:46:30 +0200 Subject: handle encoding of PO files --- tests/auto/linguist/lconvert/data/makeplurals.pl | 3 + tests/auto/linguist/lconvert/data/singular.po | 3 + .../linguist/lconvert/data/test-broken-utf8.po.out | 3 + .../linguist/lconvert/data/test-escapes.po.out | 3 + .../auto/linguist/lconvert/data/test-slurp.po.out | 3 + tests/auto/linguist/lconvert/data/wrapping.po | 2 +- tools/linguist/shared/po.cpp | 336 +++++++++++++-------- 7 files changed, 218 insertions(+), 135 deletions(-) diff --git a/tests/auto/linguist/lconvert/data/makeplurals.pl b/tests/auto/linguist/lconvert/data/makeplurals.pl index 9707ef0..a2d1d700 100755 --- a/tests/auto/linguist/lconvert/data/makeplurals.pl +++ b/tests/auto/linguist/lconvert/data/makeplurals.pl @@ -63,6 +63,9 @@ sub makeit($$$) print OUTFILE <\n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #, no-wrap diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index ab24e15..bf1a142 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -201,55 +202,54 @@ public: public: - QString id; - QString context; - QString tscomment; - QString oldTscomment; - QString lineNumber; - QString fileName; - QString references; - QString translatorComments; - QString automaticComments; - QString msgId; - QString oldMsgId; - QStringList msgStr; + QByteArray id; + QByteArray context; + QByteArray tscomment; + QByteArray oldTscomment; + QByteArray lineNumber; + QByteArray fileName; + QByteArray references; + QByteArray translatorComments; + QByteArray automaticComments; + QByteArray msgId; + QByteArray oldMsgId; + QList msgStr; bool isPlural; bool isFuzzy; QHash extra; }; -static bool isTranslationLine(const QString &line) +static bool isTranslationLine(const QByteArray &line) { - return line.startsWith(QLatin1String("#~ msgstr")) - || line.startsWith(QLatin1String("msgstr")); + return line.startsWith("#~ msgstr") || line.startsWith("msgstr"); } -static QString slurpEscapedString(const QStringList &lines, int & l, - int offset, const QString &prefix, ConversionData &cd) +static QByteArray slurpEscapedString(const QList &lines, int &l, + int offset, const QByteArray &prefix, ConversionData &cd) { - QString msg; + QByteArray msg; int stoff; for (; l < lines.size(); ++l) { - const QString &line = lines.at(l); + const QByteArray &line = lines.at(l); if (line.isEmpty() || !line.startsWith(prefix)) break; - while (line[offset].isSpace()) // No length check, as string has no trailing spaces. + while (::isspace(line[offset])) // No length check, as string has no trailing spaces. offset++; - if (line[offset].unicode() != '"') + if (line[offset] != '"') break; offset++; forever { if (offset == line.length()) goto premature_eol; - ushort c = line[offset++].unicode(); + uchar c = line[offset++]; if (c == '"') { if (offset == line.length()) break; - while (line[offset].isSpace()) + while (::isspace(line[offset])) offset++; - if (line[offset++].unicode() != '"') { + if (line[offset++] != '"') { cd.appendError(QString::fromLatin1( "PO parsing error: extra characters on line %1.") .arg(l + 1)); @@ -260,34 +260,34 @@ static QString slurpEscapedString(const QStringList &lines, int & l, if (c == '\\') { if (offset == line.length()) goto premature_eol; - c = line[offset++].unicode(); + c = line[offset++]; switch (c) { case 'r': - msg += QLatin1Char('\r'); // Maybe just throw it away? + msg += '\r'; // Maybe just throw it away? break; case 'n': - msg += QLatin1Char('\n'); + msg += '\n'; break; case 't': - msg += QLatin1Char('\t'); + msg += '\t'; break; case 'v': - msg += QLatin1Char('\v'); + msg += '\v'; break; case 'a': - msg += QLatin1Char('\a'); + msg += '\a'; break; case 'b': - msg += QLatin1Char('\b'); + msg += '\b'; break; case 'f': - msg += QLatin1Char('\f'); + msg += '\f'; break; case '"': - msg += QLatin1Char('"'); + msg += '"'; break; case '\\': - msg += QLatin1Char('\\'); + msg += '\\'; break; case '0': case '1': @@ -298,28 +298,28 @@ static QString slurpEscapedString(const QStringList &lines, int & l, case '6': case '7': stoff = offset - 1; - while ((c = line[offset].unicode()) >= '0' && c <= '7') + while ((c = line[offset]) >= '0' && c <= '7') if (++offset == line.length()) goto premature_eol; - msg += QChar(line.mid(stoff, offset - stoff).toUInt(0, 8)); + msg += line.mid(stoff, offset - stoff).toUInt(0, 8); break; case 'x': stoff = offset; - while (isxdigit(line[offset].unicode())) + while (::isxdigit(line[offset])) if (++offset == line.length()) goto premature_eol; - msg += QChar(line.mid(stoff, offset - stoff).toUInt(0, 16)); + msg += line.mid(stoff, offset - stoff).toUInt(0, 16); break; default: cd.appendError(QString::fromLatin1( "PO parsing error: invalid escape '\\%1' (line %2).") - .arg(QChar(c)).arg(l + 1)); - msg += QLatin1Char('\\'); - msg += QChar(c); + .arg(QChar((uint)c)).arg(l + 1)); + msg += '\\'; + msg += c; break; } } else { - msg += QChar(c); + msg += c; } } offset = prefix.size(); @@ -330,26 +330,25 @@ static QString slurpEscapedString(const QStringList &lines, int & l, premature_eol: cd.appendError(QString::fromLatin1( "PO parsing error: premature end of line %1.").arg(l + 1)); - return QString(); + return QByteArray(); } -static void slurpComment(QString &msg, const QStringList &lines, int & l) +static void slurpComment(QByteArray &msg, const QList &lines, int & l) { - const QChar newline = QLatin1Char('\n'); - QString prefix = lines.at(l); + QByteArray prefix = lines.at(l); for (int i = 1; ; i++) { - if (prefix.at(i).unicode() != ' ') { + if (prefix.at(i) != ' ') { prefix.truncate(i); break; } } for (; l < lines.size(); ++l) { - const QString &line = lines.at(l); + const QByteArray &line = lines.at(l); if (line.startsWith(prefix)) msg += line.mid(prefix.size()); - else if (line != QLatin1String("#")) + else if (line != "#") break; - msg += newline; + msg += '\n'; } --l; } @@ -359,12 +358,33 @@ static QString makePoHeader(const QString &str) return QLatin1String("po-header-") + str.toLower().replace(QLatin1Char('-'), QLatin1Char('_')); } +static QByteArray QByteArrayList_join(const QList &that, char sep) +{ + int totalLength = 0; + const int size = that.size(); + + for (int i = 0; i < size; ++i) + totalLength += that.at(i).size(); + + if (size > 0) + totalLength += size - 1; + + QByteArray res; + if (totalLength == 0) + return res; + res.reserve(totalLength); + for (int i = 0; i < that.size(); ++i) { + if (i) + res += sep; + res += that.at(i); + } + return res; +} + bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) { - const QChar quote = QLatin1Char('"'); - const QChar newline = QLatin1Char('\n'); - QTextStream in(&dev); - in.setCodec(cd.m_codecForSource.isEmpty() ? QByteArray("UTF-8") : cd.m_codecForSource); + QTextCodec *codec = QTextCodec::codecForName( + cd.m_codecForSource.isEmpty() ? QByteArray("UTF-8") : cd.m_codecForSource); bool error = false; // format of a .po file entry: @@ -385,25 +405,23 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) // ... // we need line based lookahead below. - QStringList lines; - while (!in.atEnd()) - lines.append(in.readLine().trimmed()); - lines.append(QString()); + QList lines; + while (!dev.atEnd()) + lines.append(dev.readLine().trimmed()); + lines.append(QByteArray()); int l = 0, lastCmtLine = -1; PoItem item; for (; l != lines.size(); ++l) { - QString line = lines.at(l); + QByteArray line = lines.at(l); if (line.isEmpty()) continue; if (isTranslationLine(line)) { - bool isObsolete = line.startsWith(QLatin1String("#~ msgstr")); - const QString prefix = QLatin1String(isObsolete ? "#~ " : ""); + bool isObsolete = line.startsWith("#~ msgstr"); + const QByteArray prefix = isObsolete ? "#~ " : ""; while (true) { - int idx = line.indexOf(QLatin1Char(' '), prefix.length()); - QString str = slurpEscapedString(lines, l, idx, prefix, cd); - str.replace(QChar(Translator::TextVariantSeparator), - QChar(Translator::BinaryVariantSeparator)); + int idx = line.indexOf(' ', prefix.length()); + QByteArray str = slurpEscapedString(lines, l, idx, prefix, cd); item.msgStr.append(str); if (l + 1 >= lines.size() || !isTranslationLine(lines.at(l + 1))) break; @@ -411,35 +429,67 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) line = lines.at(l); } if (item.msgId.isEmpty()) { - QStringList hdrOrder; - QString pluralForms; - foreach (const QString &hdr, - item.msgStr.first().split(QLatin1Char('\n'), QString::SkipEmptyParts)) { - int idx = hdr.indexOf(QLatin1Char(':')); + QHash extras; + QList hdrOrder; + QByteArray pluralForms; + foreach (const QByteArray &hdr, item.msgStr.first().split('\n')) { + if (hdr.isEmpty()) + continue; + int idx = hdr.indexOf(':'); if (idx < 0) { cd.appendError(QString::fromLatin1("Unexpected PO header format '%1'\n") - .arg(hdr)); + .arg(QString::fromLatin1(hdr))); error = true; break; } - QString hdrName = hdr.left(idx).trimmed(); - QString hdrValue = hdr.mid(idx + 1).trimmed(); + QByteArray hdrName = hdr.left(idx).trimmed(); + QByteArray hdrValue = hdr.mid(idx + 1).trimmed(); hdrOrder << hdrName; - if (hdrName == QLatin1String("X-Language")) - translator.setLanguageCode(hdrValue); - else if (hdrName == QLatin1String("X-Source-Language")) - translator.setSourceLanguageCode(hdrValue); - else if (hdrName == QLatin1String("Plural-Forms")) + if (hdrName == "X-Language") { + translator.setLanguageCode(QString::fromLatin1(hdrValue)); + } else if (hdrName == "X-Source-Language") { + translator.setSourceLanguageCode(QString::fromLatin1(hdrValue)); + } else if (hdrName == "Plural-Forms") { pluralForms = hdrValue; - else if (hdrName == QLatin1String("X-Virgin-Header")) - ; // legacy - else - translator.setExtra(makePoHeader(hdrName), hdrValue); + } else if (hdrName == "MIME-Version") { + // just assume it is 1.0 + } else if (hdrName == "Content-Type") { + if (cd.m_codecForSource.isEmpty()) { + if (!hdrValue.startsWith("text/plain; charset=")) { + cd.appendError(QString::fromLatin1("Unexpected Content-Type header '%1'\n") + .arg(QString::fromLatin1(hdrValue))); + error = true; + // This will avoid a flood of conversion errors. + codec = QTextCodec::codecForName("latin1"); + } else { + QByteArray cod = hdrValue.mid(20); + QTextCodec *cdc = QTextCodec::codecForName(cod); + if (!cdc) { + cd.appendError(QString::fromLatin1("Unsupported codec '%1'\n") + .arg(QString::fromLatin1(cod))); + error = true; + // This will avoid a flood of conversion errors. + codec = QTextCodec::codecForName("latin1"); + } else { + codec = cdc; + } + } + } + } else if (hdrName == "Content-Transfer-Encoding") { + if (hdrValue != "8bit") { + cd.appendError(QString::fromLatin1("Unexpected Content-Transfer-Encoding '%1'\n") + .arg(QString::fromLatin1(hdrValue))); + return false; + } + } else if (hdrName == "X-Virgin-Header") { + // legacy + } else { + extras[makePoHeader(QString::fromLatin1(hdrName))] = hdrValue; + } } if (!pluralForms.isEmpty()) { if (translator.languageCode().isEmpty()) { - translator.setExtra(makePoHeader(QLatin1String("Plural-Forms")), - pluralForms); + extras[makePoHeader(QLatin1String("Plural-Forms"))] = pluralForms; } else { // FIXME: have fun with making a consistency check ... } @@ -447,17 +497,18 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) // Eliminate the field if only headers we added are present in standard order. // Keep in sync with savePO static const char * const dfltHdrs[] = { + "MIME-Version", "Content-Type", "Content-Transfer-Encoding", "Plural-Forms", "X-Language", "X-Source-Language" }; uint cdh = 0; for (int cho = 0; cho < hdrOrder.length(); cho++) { for (;; cdh++) { if (cdh == sizeof(dfltHdrs)/sizeof(dfltHdrs[0])) { - translator.setExtra(QLatin1String("po-headers"), - hdrOrder.join(QLatin1String(","))); + extras[QLatin1String("po-headers")] = + QByteArrayList_join(hdrOrder, ','); goto doneho; } - if (hdrOrder.at(cho) == QLatin1String(dfltHdrs[cdh])) { + if (hdrOrder.at(cho) == dfltHdrs[cdh]) { cdh++; break; } @@ -465,18 +516,22 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) } doneho: if (lastCmtLine != -1) - translator.setExtra(QLatin1String("po-header_comment"), - static_cast(lines.mid(0, lastCmtLine + 1)).join(QLatin1String("\n"))); + extras[QLatin1String("po-header_comment")] = + QByteArrayList_join(lines.mid(0, lastCmtLine + 1), '\n'); + for (QHash::ConstIterator it = extras.constBegin(), + end = extras.constEnd(); + it != end; ++it) + translator.setExtra(it.key(), codec->toUnicode(it.value())); item = PoItem(); continue; } // build translator message TranslatorMessage msg; - msg.setContext(item.context); + msg.setContext(codec->toUnicode(item.context)); if (!item.references.isEmpty()) { foreach (const QString &ref, - item.references.split(QRegExp(QLatin1String("\\s")), - QString::SkipEmptyParts)) { + codec->toUnicode(item.references).split( + QRegExp(QLatin1String("\\s")), QString::SkipEmptyParts)) { int pos = ref.lastIndexOf(QLatin1Char(':')); if (pos != -1) msg.addReference(ref.left(pos), ref.mid(pos + 1).toInt()); @@ -484,15 +539,22 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) } else if (isObsolete) { msg.setFileName(QLatin1String(MAGIC_OBSOLETE_REFERENCE)); } - msg.setId(item.id); - msg.setSourceText(item.msgId); - msg.setOldSourceText(item.oldMsgId); - msg.setComment(item.tscomment); - msg.setOldComment(item.oldTscomment); - msg.setExtraComment(item.automaticComments); - msg.setTranslatorComment(item.translatorComments); + msg.setId(codec->toUnicode(item.id)); + msg.setSourceText(codec->toUnicode(item.msgId)); + msg.setOldSourceText(codec->toUnicode(item.oldMsgId)); + msg.setComment(codec->toUnicode(item.tscomment)); + msg.setOldComment(codec->toUnicode(item.oldTscomment)); + msg.setExtraComment(codec->toUnicode(item.automaticComments)); + msg.setTranslatorComment(codec->toUnicode(item.translatorComments)); msg.setPlural(item.isPlural || item.msgStr.size() > 1); - msg.setTranslations(item.msgStr); + QStringList translations; + foreach (const QByteArray &bstr, item.msgStr) { + QString str = codec->toUnicode(bstr); + str.replace(QChar(Translator::TextVariantSeparator), + QChar(Translator::BinaryVariantSeparator)); + translations << str; + } + msg.setTranslations(translations); if (isObsolete) msg.setType(TranslatorMessage::Obsolete); else if (item.isFuzzy || (!msg.sourceText().isEmpty() && !msg.isTranslated())) @@ -506,16 +568,16 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) //qDebug() << flags << msg.m_extra; translator.append(msg); item = PoItem(); - } else if (line.startsWith(QLatin1Char('#'))) { - switch(line.size() < 2 ? 0 : line.at(1).unicode()) { + } else if (line.startsWith('#')) { + switch (line.size() < 2 ? 0 : line.at(1)) { case ':': item.references += line.mid(3); - item.references += newline; + item.references += '\n'; break; case ',': { QStringList flags = - line.mid(2).split(QRegExp(QLatin1String("[, ]")), - QString::SkipEmptyParts); + QString::fromLatin1(line.mid(2)).split( + QRegExp(QLatin1String("[, ]")), QString::SkipEmptyParts); if (flags.removeOne(QLatin1String("fuzzy"))) item.isFuzzy = true; TranslatorMessage::ExtraData::const_iterator it = @@ -527,71 +589,73 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) break; } case 0: - item.translatorComments += newline; + item.translatorComments += '\n'; break; case ' ': slurpComment(item.translatorComments, lines, l); break; case '.': - if (line.startsWith(QLatin1String("#. ts-context "))) { + if (line.startsWith("#. ts-context ")) { item.context = line.mid(14); - } else if (line.startsWith(QLatin1String("#. ts-id "))) { + } else if (line.startsWith("#. ts-id ")) { item.id = line.mid(9); } else { item.automaticComments += line.mid(3); - item.automaticComments += newline; + item.automaticComments += '\n'; } break; case '|': - if (line.startsWith(QLatin1String("#| msgid "))) { - item.oldMsgId = slurpEscapedString(lines, l, 9, QLatin1String("#| "), cd); - } else if (line.startsWith(QLatin1String("#| msgid_plural "))) { - QString extra = slurpEscapedString(lines, l, 16, QLatin1String("#| "), cd); + if (line.startsWith("#| msgid ")) { + item.oldMsgId = slurpEscapedString(lines, l, 9, "#| ", cd); + } else if (line.startsWith("#| msgid_plural ")) { + QByteArray extra = slurpEscapedString(lines, l, 16, "#| ", cd); if (extra != item.oldMsgId) - item.extra[QLatin1String("po-old_msgid_plural")] = extra; - } else if (line.startsWith(QLatin1String("#| msgctxt "))) { - item.oldTscomment = slurpEscapedString(lines, l, 11, QLatin1String("#| "), cd); + item.extra[QLatin1String("po-old_msgid_plural")] = + codec->toUnicode(extra); + } else if (line.startsWith("#| msgctxt ")) { + item.oldTscomment = slurpEscapedString(lines, l, 11, "#| ", cd); } else { cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'\n")) - .arg(l + 1).arg(lines[l])); + .arg(l + 1).arg(codec->toUnicode(lines[l]))); error = true; } break; case '~': - if (line.startsWith(QLatin1String("#~ msgid "))) { - item.msgId = slurpEscapedString(lines, l, 9, QLatin1String("#~ "), cd); - } else if (line.startsWith(QLatin1String("#~ msgid_plural "))) { - QString extra = slurpEscapedString(lines, l, 16, QLatin1String("#~ "), cd); + if (line.startsWith("#~ msgid ")) { + item.msgId = slurpEscapedString(lines, l, 9, "#~ ", cd); + } else if (line.startsWith("#~ msgid_plural ")) { + QByteArray extra = slurpEscapedString(lines, l, 16, "#~ ", cd); if (extra != item.msgId) - item.extra[QLatin1String("po-msgid_plural")] = extra; + item.extra[QLatin1String("po-msgid_plural")] = + codec->toUnicode(extra); item.isPlural = true; - } else if (line.startsWith(QLatin1String("#~ msgctxt "))) { - item.tscomment = slurpEscapedString(lines, l, 11, QLatin1String("#~ "), cd); + } else if (line.startsWith("#~ msgctxt ")) { + item.tscomment = slurpEscapedString(lines, l, 11, "#~ ", cd); } else { cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'\n")) - .arg(l + 1).arg(lines[l])); + .arg(l + 1).arg(codec->toUnicode(lines[l]))); error = true; } break; default: cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'\n")) - .arg(l + 1).arg(lines[l])); + .arg(l + 1).arg(codec->toUnicode(lines[l]))); error = true; break; } lastCmtLine = l; - } else if (line.startsWith(QLatin1String("msgctxt "))) { - item.tscomment = slurpEscapedString(lines, l, 8, QString(), cd); - } else if (line.startsWith(QLatin1String("msgid "))) { - item.msgId = slurpEscapedString(lines, l, 6, QString(), cd); - } else if (line.startsWith(QLatin1String("msgid_plural "))) { - QString extra = slurpEscapedString(lines, l, 13, QString(), cd); + } else if (line.startsWith("msgctxt ")) { + item.tscomment = slurpEscapedString(lines, l, 8, QByteArray(), cd); + } else if (line.startsWith("msgid ")) { + item.msgId = slurpEscapedString(lines, l, 6, QByteArray(), cd); + } else if (line.startsWith("msgid_plural ")) { + QByteArray extra = slurpEscapedString(lines, l, 13, QByteArray(), cd); if (extra != item.msgId) - item.extra[QLatin1String("po-msgid_plural")] = extra; + item.extra[QLatin1String("po-msgid_plural")] = codec->toUnicode(extra); item.isPlural = true; } else { cd.appendError(QString(QLatin1String("PO-format error in line %1: '%2'\n")) - .arg(l + 1).arg(lines[l])); + .arg(l + 1).arg(codec->toUnicode(lines[l]))); error = true; } } @@ -621,6 +685,10 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) QStringList hdrOrder = translator.extra(QLatin1String("po-headers")).split( QLatin1Char(','), QString::SkipEmptyParts); // Keep in sync with loadPO + addPoHeader(headers, hdrOrder, "MIME-Version", QLatin1String("1.0")); + addPoHeader(headers, hdrOrder, "Content-Type", + QLatin1String("text/plain; charset=" + out.codec()->name())); + addPoHeader(headers, hdrOrder, "Content-Transfer-Encoding", QLatin1String("8bit")); if (!translator.languageCode().isEmpty()) { QLocale::Language l; QLocale::Country c; -- cgit v0.12 From 15f0dccc03440cb3c07133d2565da32b892ca2fc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 30 Mar 2010 19:46:59 +0200 Subject: handle qt-format PO flags --- tools/linguist/shared/po.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index bf1a142..097b4bf 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -580,6 +580,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) QRegExp(QLatin1String("[, ]")), QString::SkipEmptyParts); if (flags.removeOne(QLatin1String("fuzzy"))) item.isFuzzy = true; + flags.removeOne(QLatin1String("qt-format")); TranslatorMessage::ExtraData::const_iterator it = item.extra.find(QLatin1String("po-flags")); if (it != item.extra.end()) @@ -673,6 +674,8 @@ static void addPoHeader(Translator::ExtraData &headers, QStringList &hdrOrder, bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) { + QString str_format = QLatin1String("-format"); + bool ok = true; QTextStream out(&dev); out.setCodec(cd.m_outputCodec.isEmpty() ? QByteArray("UTF-8") : cd.m_outputCodec); @@ -732,16 +735,36 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) } bool noWrap = false; + bool skipFormat = false; QStringList flags; if (msg.type() == TranslatorMessage::Unfinished && msg.isTranslated()) flags.append(QLatin1String("fuzzy")); TranslatorMessage::ExtraData::const_iterator itr = msg.extras().find(QLatin1String("po-flags")); if (itr != msg.extras().end()) { - if (itr->split(QLatin1String(", ")).contains(QLatin1String("no-wrap"))) + QStringList atoms = itr->split(QLatin1String(", ")); + foreach (const QString &atom, atoms) + if (atom.endsWith(str_format)) { + skipFormat = true; + break; + } + if (atoms.contains(QLatin1String("no-wrap"))) noWrap = true; flags.append(*itr); } + if (!skipFormat) { + QString source = msg.sourceText(); + // This is fuzzy logic, as we don't know whether the string is + // actually used with QString::arg(). + for (int off = 0; (off = source.indexOf(QLatin1Char('%'), off)) >= 0; ) { + if (++off >= source.length()) + break; + if (source.at(off) == QLatin1Char('n') || source.at(off).isDigit()) { + flags.append(QLatin1String("qt-format")); + break; + } + } + } if (!flags.isEmpty()) out << "#, " << flags.join(QLatin1String(", ")) << '\n'; -- cgit v0.12 From bf04c256c8d39df1206c197821df8913f90bb43c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 31 Mar 2010 21:12:17 +0200 Subject: Fix compilation on Windows: forgot to change one toTime_tHelper --- src/corelib/tools/qdatetime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 69b232d..dc1666a 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -4013,7 +4013,7 @@ static void localToUtc(QDate &date, QTime &time, int isdst) localTM.tm_year = fakeDate.year() - 1900; localTM.tm_isdst = (int)isdst; #if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) - time_t secsSince1Jan1970UTC = toTime_tHelper(fakeDate, time); + time_t secsSince1Jan1970UTC = toMSecsSinceEpoch_helper(fakeDate.toJulianDay(), QTime().msecsTo(time)); #else #if defined(Q_OS_WIN) _tzset(); -- cgit v0.12