From 91443717927ee648a0c1c4185aae171ccdf87e2b Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 7 Sep 2009 10:37:42 +1000 Subject: Fixed compile on Solaris. The `test' builtin in Solaris' /bin/sh does not understand `-e', use `-f' instead. Fixes: configure: test: argument expected Note, using the `-nokia-developer' configure option hides this breakage. Reviewed-by: Rhys Weatherley --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index af8c209..2e2b474 100755 --- a/configure +++ b/configure @@ -3742,7 +3742,7 @@ elif [ "$Edition" = "OpenSource" ]; then while true; do echo "You are licensed to use this software under the terms of" echo "the Lesser GNU General Public License (LGPL) versions 2.1." - if [ -e "$relpath/LICENSE.GPL3" ]; then + if [ -f "$relpath/LICENSE.GPL3" ]; then echo "You are also licensed to use this software under the terms of" echo "the GNU General Public License (GPL) versions 3." affix="either" @@ -3754,7 +3754,7 @@ elif [ "$Edition" = "OpenSource" ]; then echo "You have already accepted the terms of the $LicenseType license." acceptance=yes else - if [ -e "$relpath/LICENSE.GPL3" ]; then + if [ -f "$relpath/LICENSE.GPL3" ]; then echo "Type '3' to view the GNU General Public License version 3." fi echo "Type 'L' to view the Lesser GNU General Public License version 2.1." -- cgit v0.12 From 5175f0f5079dc160f515f6069d0e287a2b08f0f8 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 7 Sep 2009 10:53:32 +1000 Subject: Unit tests for QGLFramebufferObjectFormat Reviewed-by: trustme --- tests/auto/qgl/tst_qgl.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 0fefbf3..d0f45b5 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -79,6 +79,7 @@ private slots: void glWidgetReparent(); void stackedFBOs(); void colormap(); + void fboFormat(); }; tst_QGL::tst_QGL() @@ -1321,5 +1322,60 @@ void tst_QGL::colormap() QCOMPARE(cmap4.size(), 256); } +#ifndef QT_OPENGL_ES +#define DEFAULT_FORMAT GL_RGBA8 +#else +#define DEFAULT_FORMAT GL_RGBA +#endif + +#ifndef GL_TEXTURE_3D +#define GL_TEXTURE_3D 0x806F +#endif + +#ifndef GL_RGB16 +#define GL_RGB16 0x8054 +#endif + +void tst_QGL::fboFormat() +{ + // Check the initial conditions. + QGLFramebufferObjectFormat format1; + QCOMPARE(format1.samples(), 0); + QVERIFY(format1.attachment() == QGLFramebufferObject::NoAttachment); + QCOMPARE(int(format1.textureTarget()), int(GL_TEXTURE_2D)); + QCOMPARE(int(format1.internalTextureFormat()), int(DEFAULT_FORMAT)); + + // Modify the values and re-check. + format1.setSamples(8); + format1.setAttachment(QGLFramebufferObject::CombinedDepthStencil); + format1.setTextureTarget(GL_TEXTURE_3D); + format1.setInternalTextureFormat(GL_RGB16); + QCOMPARE(format1.samples(), 8); + QVERIFY(format1.attachment() == QGLFramebufferObject::CombinedDepthStencil); + QCOMPARE(int(format1.textureTarget()), int(GL_TEXTURE_3D)); + QCOMPARE(int(format1.internalTextureFormat()), int(GL_RGB16)); + + // Make copies and check that they are the same. + QGLFramebufferObjectFormat format2(format1); + QGLFramebufferObjectFormat format3; + QCOMPARE(format2.samples(), 8); + QVERIFY(format2.attachment() == QGLFramebufferObject::CombinedDepthStencil); + QCOMPARE(int(format2.textureTarget()), int(GL_TEXTURE_3D)); + QCOMPARE(int(format2.internalTextureFormat()), int(GL_RGB16)); + format3 = format1; + QCOMPARE(format3.samples(), 8); + QVERIFY(format3.attachment() == QGLFramebufferObject::CombinedDepthStencil); + QCOMPARE(int(format3.textureTarget()), int(GL_TEXTURE_3D)); + QCOMPARE(int(format3.internalTextureFormat()), int(GL_RGB16)); + + // Modify the copies and check that the original is unchanged. + format2.setSamples(9); + format3.setTextureTarget(GL_TEXTURE_2D); + QCOMPARE(format1.samples(), 8); + QVERIFY(format1.attachment() == QGLFramebufferObject::CombinedDepthStencil); + QCOMPARE(int(format1.textureTarget()), int(GL_TEXTURE_3D)); + QCOMPARE(int(format1.internalTextureFormat()), int(GL_RGB16)); +} + QTEST_MAIN(tst_QGL) #include "tst_qgl.moc" -- cgit v0.12 From 9409897cfb5e8add609164c250395529fef95086 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 7 Sep 2009 11:42:26 +1000 Subject: Unit tests for QGLFormat::defaultFormat and ::defaultOverlayFormat() Reviewed-by: trustme --- tests/auto/qgl/tst_qgl.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index d0f45b5..e7d1367 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -500,6 +500,47 @@ void tst_QGL::getSetCheck() QCOMPARE(format1.redBufferSize(), 8); QCOMPARE(format1.plane(), 8); + // The default format should be the same as QGLFormat(). + QVERIFY(QGLFormat::defaultFormat() == QGLFormat()); + + // Modify the default format and check that it was changed. + QGLFormat::setDefaultFormat(format1); + QVERIFY(QGLFormat::defaultFormat() == format1); + + // Restore the default format. + QGLFormat::setDefaultFormat(QGLFormat()); + QVERIFY(QGLFormat::defaultFormat() == QGLFormat()); + + // Check the default overlay format's expected values. + QGLFormat overlay(QGLFormat::defaultOverlayFormat()); + QCOMPARE(overlay.depthBufferSize(), -1); + QCOMPARE(overlay.accumBufferSize(), -1); + QCOMPARE(overlay.redBufferSize(), -1); + QCOMPARE(overlay.greenBufferSize(), -1); + QCOMPARE(overlay.blueBufferSize(), -1); + QCOMPARE(overlay.alphaBufferSize(), -1); + QCOMPARE(overlay.samples(), -1); + QCOMPARE(overlay.swapInterval(), -1); + QCOMPARE(overlay.plane(), 1); + QVERIFY(!overlay.sampleBuffers()); + QVERIFY(!overlay.doubleBuffer()); + QVERIFY(!overlay.depth()); + QVERIFY(!overlay.rgba()); + QVERIFY(!overlay.alpha()); + QVERIFY(!overlay.accum()); + QVERIFY(!overlay.stencil()); + QVERIFY(!overlay.stereo()); + QVERIFY(overlay.directRendering()); // Only option that should be on. + QVERIFY(!overlay.hasOverlay()); // Overlay doesn't need an overlay! + + // Modify the default overlay format and check that it was changed. + QGLFormat::setDefaultOverlayFormat(format1); + QVERIFY(QGLFormat::defaultOverlayFormat() == format1); + + // Restore the default overlay format. + QGLFormat::setDefaultOverlayFormat(overlay); + QVERIFY(QGLFormat::defaultOverlayFormat() == overlay); + MyGLContext obj2(obj1); // bool QGLContext::windowCreated() // void QGLContext::setWindowCreated(bool) -- cgit v0.12 From ecab54e9af3f768c2704876e695a685671eab605 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 7 Sep 2009 11:56:58 +1000 Subject: Unit tests for QGLFormat option constructor Reviewed-by: trustme --- tests/auto/qgl/tst_qgl.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index e7d1367..535e6ae 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -500,6 +500,16 @@ void tst_QGL::getSetCheck() QCOMPARE(format1.redBufferSize(), 8); QCOMPARE(format1.plane(), 8); + // Check the QGLFormat constructor that takes an option list. + QGLFormat format5 + (QGL::DepthBuffer | QGL::StereoBuffers | QGL::ColorIndex, 3); + QVERIFY(format5.depth()); + QVERIFY(format5.stereo()); + QVERIFY(format5.doubleBuffer()); // From defaultFormat() + QVERIFY(!format5.hasOverlay()); // From defaultFormat() + QVERIFY(!format5.rgba()); + QCOMPARE(format5.plane(), 3); + // The default format should be the same as QGLFormat(). QVERIFY(QGLFormat::defaultFormat() == QGLFormat()); -- cgit v0.12 From 365f00905e3cbe0b5b55258f38df9cb323b56524 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 7 Sep 2009 12:42:03 +1000 Subject: Sample buffers are on by default for OpenGL/ES 2.0, off for others. Reviewed-by: trustme --- tests/auto/qgl/tst_qgl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 535e6ae..650c1ca 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -231,9 +231,15 @@ void tst_QGL::getSetCheck() // bool QGLFormat::sampleBuffers() // void QGLFormat::setSampleBuffers(bool) +#if !defined(QT_OPENGL_ES_2) QCOMPARE(false, obj1.sampleBuffers()); QVERIFY(!obj1.testOption(QGL::SampleBuffers)); QVERIFY(obj1.testOption(QGL::NoSampleBuffers)); +#else + QCOMPARE(true, obj1.sampleBuffers()); + QVERIFY(obj1.testOption(QGL::SampleBuffers)); + QVERIFY(!obj1.testOption(QGL::NoSampleBuffers)); +#endif obj1.setSampleBuffers(false); QCOMPARE(false, obj1.sampleBuffers()); QVERIFY(obj1.testOption(QGL::NoSampleBuffers)); -- cgit v0.12 From 07ad7b4e6257026c1c5e939e91a919e5f0a03807 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 7 Sep 2009 13:49:36 +1000 Subject: DB2 - Don't return an error when the table is just empty. Makes the behaviour consistent with the ODBC driver behaviour Reviewed-by: Justin McPherson --- src/sql/drivers/db2/qsql_db2.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp index 6187e6b..7bbe122 100644 --- a/src/sql/drivers/db2/qsql_db2.cpp +++ b/src/sql/drivers/db2/qsql_db2.cpp @@ -908,8 +908,9 @@ bool QDB2Result::fetchFirst() SQL_FETCH_FIRST, 0); if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) { - setLastError(qMakeError(QCoreApplication::translate("QDB2Result", "Unable to fetch first"), - QSqlError::StatementError, d)); + if(r!= SQL_NO_DATA) + setLastError(qMakeError(QCoreApplication::translate("QDB2Result", "Unable to fetch first"), + QSqlError::StatementError, d)); return false; } setAt(0); -- cgit v0.12 From 40914d716690bda5733bd2f69bd74e9837a6e159 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 7 Sep 2009 13:52:13 +1000 Subject: Mark these as fix later. The unicode logic is beyond me, leave these for fixing by someone else with more unicode knowledge. --- tests/auto/qsqlquery/tst_qsqlquery.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index deebb1b..36b17ed 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -381,6 +381,9 @@ void tst_QSqlQuery::char1SelectUnicode() QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + if(db.driverName().startsWith("QDB2")) + QSKIP("Needs someone with more Unicode knowledge than I have to fix", SkipSingle); + if ( db.driver()->hasFeature( QSqlDriver::Unicode ) ) { QString uniStr( QChar( 0xfb50 ) ); QSqlQuery q( db ); @@ -1613,6 +1616,8 @@ void tst_QSqlQuery::prepare_bind_exec() CHECK_DATABASE( db ); if(db.driverName().startsWith("QIBASE") && (db.databaseName() == "silence.nokia.troll.no:c:\\ibase\\testdb_ascii" || db.databaseName() == "/opt/interbase/qttest.gdb")) QSKIP("Can't transliterate extended unicode to ascii", SkipSingle); + if(db.driverName().startsWith("QDB2")) + QSKIP("Needs someone with more Unicode knowledge than I have to fix", SkipSingle); { // new scope for SQLITE -- cgit v0.12 From 252a61de1dda0cb315968875288ff5f2d730621c Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 7 Sep 2009 14:21:59 +1000 Subject: qdoc: improve the QGLFormat documentation Reviewed-by: trustme --- src/opengl/qgl.cpp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index aa67677..9e0c5f8 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -207,9 +207,10 @@ QGLSignalProxy *QGLSignalProxy::instance() \i \link setSampleBuffers() Multisample buffers.\endlink \endlist - You can also specify preferred bit depths for the depth buffer, - alpha buffer, accumulation buffer and the stencil buffer with the - functions: setDepthBufferSize(), setAlphaBufferSize(), + You can also specify preferred bit depths for the color buffer, + depth buffer, alpha buffer, accumulation buffer and the stencil + buffer with the functions: setRedBufferSize(), setGreenBufferSize(), + setBlueBufferSize(), setDepthBufferSize(), setAlphaBufferSize(), setAccumBufferSize() and setStencilBufferSize(). Note that even if you specify that you prefer a 32 bit depth @@ -293,19 +294,20 @@ static inline GLint qgluProject(GLdouble objx, GLdouble objy, GLdouble objz, } /*! - Constructs a QGLFormat object with the factory default settings: + Constructs a QGLFormat object with the following default settings: \list \i \link setDoubleBuffer() Double buffer:\endlink Enabled. \i \link setDepth() Depth buffer:\endlink Enabled. \i \link setRgba() RGBA:\endlink Enabled (i.e., color index disabled). \i \link setAlpha() Alpha channel:\endlink Disabled. \i \link setAccum() Accumulator buffer:\endlink Disabled. - \i \link setStencil() Stencil buffer:\endlink Disabled. + \i \link setStencil() Stencil buffer:\endlink Enabled. \i \link setStereo() Stereo:\endlink Disabled. \i \link setDirectRendering() Direct rendering:\endlink Enabled. \i \link setOverlay() Overlay:\endlink Disabled. \i \link setPlane() Plane:\endlink 0 (i.e., normal plane). - \i \link setSampleBuffers() Multisample buffers:\endlink Disabled. + \i \link setSampleBuffers() Multisample buffers:\endlink Enabled on + OpenGL/ES 2.0, disabled on other platforms. \endlist */ @@ -316,26 +318,26 @@ QGLFormat::QGLFormat() /*! - Creates a QGLFormat object that is a copy of the current \link - defaultFormat() application default format\endlink. + Creates a QGLFormat object that is a copy of the current + defaultFormat(). - If \a options is not 0, this copy is modified by these format - options. The \a options parameter should be \c FormatOption values - OR'ed together. + If \a options is not 0, the default format is modified by the + specified format options. The \a options parameter should be + QGL::FormatOption values OR'ed together. This constructor makes it easy to specify a certain desired format in classes derived from QGLWidget, for example: \snippet doc/src/snippets/code/src_opengl_qgl.cpp 3 - Note that there are \c FormatOption values to turn format settings - both on and off, e.g. \c DepthBuffer and \c NoDepthBuffer, - \c DirectRendering and \c IndirectRendering, etc. + Note that there are QGL::FormatOption values to turn format settings + both on and off, e.g. QGL::DepthBuffer and QGL::NoDepthBuffer, + QGL::DirectRendering and QGL::IndirectRendering, etc. The \a plane parameter defaults to 0 and is the plane which this format should be associated with. Not all OpenGL implementations supports overlay/underlay rendering planes. - \sa defaultFormat(), setOption() + \sa defaultFormat(), setOption(), setPlane() */ QGLFormat::QGLFormat(QGL::FormatOptions options, int plane) @@ -742,7 +744,7 @@ void QGLFormat::setOverlay(bool enable) is 0, which means the normal plane. The default for overlay formats is 1, which is the first overlay plane. - \sa setPlane() + \sa setPlane(), defaultOverlayFormat() */ int QGLFormat::plane() const { @@ -1225,7 +1227,7 @@ void QGLFormat::setDefaultFormat(const QGLFormat &f) /*! Returns the default QGLFormat for overlay contexts. - The factory default overlay format is: + The default overlay format is: \list \i \link setDoubleBuffer() Double buffer:\endlink Disabled. \i \link setDepth() Depth buffer:\endlink Disabled. @@ -1236,6 +1238,7 @@ void QGLFormat::setDefaultFormat(const QGLFormat &f) \i \link setStereo() Stereo:\endlink Disabled. \i \link setDirectRendering() Direct rendering:\endlink Enabled. \i \link setOverlay() Overlay:\endlink Disabled. + \i \link setSampleBuffers() Multisample buffers:\endlink Disabled. \i \link setPlane() Plane:\endlink 1 (i.e., first overlay plane). \endlist -- cgit v0.12 From a8586e786cb2aab173ddb419b1b1151aecae84e0 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 7 Sep 2009 17:18:12 +1000 Subject: Make dynamic cube maps work again in boxes Reviewed-by: trustme --- demos/boxes/glbuffers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/boxes/glbuffers.cpp b/demos/boxes/glbuffers.cpp index a3d26f6..3b16d17 100644 --- a/demos/boxes/glbuffers.cpp +++ b/demos/boxes/glbuffers.cpp @@ -372,7 +372,7 @@ void GLRenderTargetCube::getViewMatrix(QMatrix4x4& mat, int face) {-1.0f, -1.0f, +1.0f}, }; - memset(mat.data(), 0, sizeof(float) * 16); + mat.fill(0.0f); for (int i = 0; i < 3; ++i) mat(i, perm[face][i]) = signs[face][i]; mat(3, 3) = 1.0f; -- cgit v0.12 From bd4771a8a135bf2307c6fb2e27ccdac64637992d Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 7 Sep 2009 09:17:55 +0200 Subject: Fix tiled blit in 16-bit mode Optimizations in change 8e447e8a did not handle the case when the target width is less than the width of a tile. Task-number: 260759 Reviewed-by: Samuel --- src/gui/painting/qdrawhelper.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index ab192c5..e9b1bd3 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -4953,15 +4953,18 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTiled(int count, const QSpan *spans, void * if (modeSource && coverage == 255) { // Copy the first texture block - length = image_width; + length = qMin(image_width,length); + int tx = x; while (length) { int l = qMin(image_width - sx, length); if (buffer_size < l) l = buffer_size; - DST *dest = ((DST*)data->rasterBuffer->scanLine(spans->y)) + x; + DST *dest = ((DST*)data->rasterBuffer->scanLine(spans->y)) + tx; const SRC *src = (SRC*)data->texture.scanLine(sy) + sx; + qt_memconvert(dest, src, l); length -= l; + tx += l; sx = 0; } @@ -4971,8 +4974,8 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTiled(int count, const QSpan *spans, void * // We are dealing with one block of data // - More likely to fit in the cache // - can use memcpy - int copy_image_width = image_width; - length = spans->len - image_width; + int copy_image_width = qMin(image_width, int(spans->len)); + length = spans->len - copy_image_width; DST *src = ((DST*)data->rasterBuffer->scanLine(spans->y)) + x; DST *dest = src + copy_image_width; while (copy_image_width < length) { -- cgit v0.12 From d9abfdc26d711ffdfcbb8ac04a314aa80396e56f Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Thu, 3 Sep 2009 17:12:15 +0200 Subject: Few expected fails were fixed in QScriptEngineAgent functionExit event was partially fixed. The time point in JS execution with JIT enabled works now but still there is no returning value in few cases. Autotest was corrected. Reviewed-by: Kent Hansen --- src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp | 4 ++++ src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp | 10 ++++++++++ src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h | 1 + src/script/api/qscriptengineagent.cpp | 4 ---- .../auto/qscriptengineagent/tst_qscriptengineagent.cpp | 17 +---------------- 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp index 4a33e67..dab6682 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp @@ -285,6 +285,10 @@ void JIT::emit_op_tear_off_arguments(Instruction*) void JIT::emit_op_ret(Instruction* currentInstruction) { +#ifdef QT_BUILD_SCRIPT_LIB + JITStubCall stubCall(this, JITStubs::cti_op_debug_return); + stubCall.call(); +#endif // We could JIT generate the deref, only calling out to C when the refcount hits zero. if (m_codeBlock->needsFullScopeChain()) JITStubCall(this, JITStubs::cti_op_ret_scopeChain).call(); diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index 0eb0799..1d39ba4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -2750,6 +2750,16 @@ DEFINE_STUB_FUNCTION(void, op_debug_catch) debugger->exceptionCatch(DebuggerCallFrame(callFrame), callFrame->codeBlock()->ownerNode()->sourceID()); } } + +DEFINE_STUB_FUNCTION(void, op_debug_return) +{ + STUB_INIT_STACK_FRAME(stackFrame); + CallFrame* callFrame = stackFrame.callFrame; + if (JSC::Debugger* debugger = callFrame->lexicalGlobalObject()->debugger() ) { + debugger->functionExit(JSValue(), callFrame->codeBlock()->ownerNode()->sourceID()); + } +} + #endif DEFINE_STUB_FUNCTION(EncodedJSValue, vm_throw) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h index 60bf64a..325c3fd 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h @@ -223,6 +223,7 @@ namespace JITStubs { extern "C" { void JIT_STUB cti_op_debug(STUB_ARGS_DECLARATION); #ifdef QT_BUILD_SCRIPT_LIB void JIT_STUB cti_op_debug_catch(STUB_ARGS_DECLARATION); + void JIT_STUB cti_op_debug_return(STUB_ARGS_DECLARATION); #endif void JIT_STUB cti_op_end(STUB_ARGS_DECLARATION); void JIT_STUB cti_op_jmp_scopes(STUB_ARGS_DECLARATION); diff --git a/src/script/api/qscriptengineagent.cpp b/src/script/api/qscriptengineagent.cpp index 333a415..13bc6a6 100644 --- a/src/script/api/qscriptengineagent.cpp +++ b/src/script/api/qscriptengineagent.cpp @@ -146,11 +146,7 @@ void QScriptEngineAgentPrivate::returnEvent(const JSC::DebuggerCallFrame& frame, { Q_UNUSED(frame); Q_UNUSED(lineno); -#if ENABLE(JIT) - functionExit(JSC::JSValue(), sourceID); -#else Q_UNUSED(sourceID); -#endif } void QScriptEngineAgentPrivate::exceptionThrow(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, bool hasHandler) diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 8fe6839..f92bec3 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -176,7 +176,6 @@ struct ScriptEngineEvent : type(ExceptionThrow), scriptId(scriptId), value(exception), hasExceptionHandler(hasHandler) { } - }; class ScriptEngineSpy : public QScriptEngineAgent, public QList @@ -1834,7 +1833,7 @@ void tst_QScriptEngineAgent::eventOrder_functions() eng.evaluate("foo('ciao')"); - //QCOMPARE(spy->count(), 45); + QCOMPARE(spy->count(), 45); // load QCOMPARE(spy->at(25).type, ScriptEngineEvent::ScriptLoad); @@ -1875,33 +1874,21 @@ void tst_QScriptEngineAgent::eventOrder_functions() // bar() exit QCOMPARE(spy->at(39).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(39).scriptId, spy->at(21).scriptId); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(39).value.isError()); // restore context QCOMPARE(spy->at(40).type, ScriptEngineEvent::ContextPop); // foo() exit QCOMPARE(spy->at(41).type, ScriptEngineEvent::FunctionExit); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "script ID for function exit is not correct when JIT is enabled", Continue); QCOMPARE(spy->at(41).scriptId, spy->at(0).scriptId); QVERIFY(spy->at(41).value.isError()); // restore context QCOMPARE(spy->at(42).type, ScriptEngineEvent::ContextPop); // evaluate() exit QCOMPARE(spy->at(43).type, ScriptEngineEvent::FunctionExit); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "script ID for function exit is not correct when JIT is enabled", Continue); QCOMPARE(spy->at(43).scriptId, spy->at(26).scriptId); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(43).value.isError()); // unload - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "wrong event type when JIT is enabled", Continue); QCOMPARE(spy->at(44).type, ScriptEngineEvent::ScriptUnload); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "wrong script ID when JIT is enabled", Continue); QCOMPARE(spy->at(44).scriptId, spy->at(25).scriptId); } delete spy; @@ -1958,8 +1945,6 @@ void tst_QScriptEngineAgent::eventOrder_signalsHandling() emit testSignal(123); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "too many events reported when JIT is enabled", Abort); QCOMPARE(spy->count(), 14); // new context QCOMPARE(spy->at(4).type, ScriptEngineEvent::ContextPush); -- cgit v0.12 From 4a1c5f08328e369ae285a26738694b33542f5047 Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Thu, 3 Sep 2009 17:21:27 +0200 Subject: New function added to QScriptEngineAgent autotest Function convert numeric ScriptEngineEvent::Type to QString. It is not used in test but really useful in debugging Reviewed-by: Kent Hansen --- tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index f92bec3..3d1cbe8 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -176,6 +176,22 @@ struct ScriptEngineEvent : type(ExceptionThrow), scriptId(scriptId), value(exception), hasExceptionHandler(hasHandler) { } + + static QString typeToQString(Type t) + { + switch (t) { + case ScriptEngineEvent::ScriptLoad: return "ScriptLoad"; + case ScriptEngineEvent::ScriptUnload: return "ScriptUnload"; + case ScriptEngineEvent::ContextPush: return "ContextPush"; + case ScriptEngineEvent::ContextPop: return "ContextPop"; + case ScriptEngineEvent::FunctionEntry: return "FunctionEntry"; + case ScriptEngineEvent::FunctionExit: return "FunctionExit"; + case ScriptEngineEvent::PositionChange: return "PositionChange"; + case ScriptEngineEvent::ExceptionThrow: return "ExceptionThrow"; + case ScriptEngineEvent::ExceptionCatch: return "ExceptionCatch"; + case ScriptEngineEvent::DebuggerInvocationRequest: return "DebuggerInvocationRequest"; + } + } }; class ScriptEngineSpy : public QScriptEngineAgent, public QList -- cgit v0.12 From 0648f93cce7b721b31b0bb11a91e332b56518cb0 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 7 Sep 2009 10:05:14 +0200 Subject: Fixed compilation error for qmdiarea and qmdisubwindow test. Reviewed-by: Olivier --- src/testlib/qtestmouse.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h index 8b06a29..1ab7401 100644 --- a/src/testlib/qtestmouse.h +++ b/src/testlib/qtestmouse.h @@ -117,7 +117,7 @@ namespace QTest static const char *mouseActionNames[] = { "MousePress", "MouseRelease", "MouseClick", "MouseDClick", "MouseMove" }; QString warning = QString::fromLatin1("Mouse event \"%1\" not accepted by receiving widget"); - QTest::qWarn(warning.arg(mouseActionNames[static_cast(action)]).toAscii().data()); + QTest::qWarn(warning.arg(QString::fromLatin1(mouseActionNames[static_cast(action)])).toAscii().data()); } } -- cgit v0.12 From acc3a45f557253329fbb693fd112808a148f83f6 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 7 Sep 2009 09:58:01 +0200 Subject: Stabilize QTreeView test --- tests/auto/qtreeview/tst_qtreeview.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 6709807..fae4b26 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -2042,7 +2042,7 @@ void tst_QTreeView::scrollTo() view.show(); view.setVerticalScrollMode(QAbstractItemView::ScrollPerItem); //some styles change that in Polish - + view.resize(300, 200); //view.verticalScrollBar()->setValue(0); @@ -2055,7 +2055,7 @@ void tst_QTreeView::scrollTo() QCOMPARE(view.verticalScrollBar()->value(), 5); view.scrollTo(model.index(60, 60, QModelIndex())); - + CHECK_VISIBLE(60,60); view.scrollTo(model.index(60, 30, QModelIndex())); CHECK_VISIBLE(60,30); @@ -3059,12 +3059,12 @@ void tst_QTreeView::task216717_updateChildren() tree.refreshed = false; QTreeWidgetItem *parent = new QTreeWidgetItem(QStringList() << "parent"); tree.addTopLevelItem(parent); - QTest::qWait(100); - QVERIFY(tree.refreshed); + QTest::qWait(10); + QTRY_VERIFY(tree.refreshed); tree.refreshed = false; parent->addChild(new QTreeWidgetItem(QStringList() << "child")); - QTest::qWait(100); - QVERIFY(tree.refreshed); + QTest::qWait(10); + QTRY_VERIFY(tree.refreshed); } @@ -3259,7 +3259,7 @@ void tst_QTreeView::task202039_closePersistentEditor() view.closePersistentEditor(current); QVERIFY(view.indexWidget(current) == 0); - //here was the bug: closing the persistent editor would not reset the state + //here was the bug: closing the persistent editor would not reset the state //and it was impossible to go into editinon again QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.visualRect(current).center()); QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, view.visualRect(current).center()); @@ -3313,7 +3313,7 @@ void tst_QTreeView::task244304_clickOnDecoration() QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, rect.topLeft()+QPoint(-rect.left()/2,rect.height()/2)); QVERIFY(!view.currentIndex().isValid()); QVERIFY(view.isExpanded(item0.index())); - + rect = view.visualRect(item1.index()); //the item has no decoration, it should get selected QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, rect.topLeft()+QPoint(-rect.left()/2,rect.height()/2)); -- cgit v0.12 From c2fccced314dbbafdda965602a71f1ef13c749d2 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 4 Sep 2009 18:01:43 +0200 Subject: make JavaScriptCore compile on HPUX Get rid of circular dependency (don't include StructureChain.h from Structure.h). Disable some time stuff that isn't available on HPUX. Reviewed-by: Simon Hausmann --- src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h | 1 + src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h | 1 + src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h | 1 + src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h | 2 +- src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp | 6 ++++++ src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h | 2 +- src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h | 2 +- 7 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h index eeeac6f..594c4dd 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h @@ -32,6 +32,7 @@ #include "MacroAssembler.h" #include "Opcode.h" #include "Structure.h" +#include "StructureChain.h" #include #define POLYMORPHIC_LIST_CACHE_SIZE 8 diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h index dc11fee..98e9b68 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h @@ -27,6 +27,7 @@ #include "NativeFunctionWrapper.h" #include "NumberPrototype.h" #include "StringPrototype.h" +#include "StructureChain.h" #include #include diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h index b4382f4..67ee9c8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h @@ -24,6 +24,7 @@ #include "CallFrame.h" #include "Identifier.h" #include "Structure.h" +#include "StructureChain.h" #include #include diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h index 0de03a3..dcd4e50 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h @@ -30,7 +30,6 @@ #include "JSType.h" #include "JSValue.h" #include "PropertyMapHashTable.h" -#include "StructureChain.h" #include "StructureTransitionTable.h" #include "TypeInfo.h" #include "UString.h" @@ -47,6 +46,7 @@ namespace JSC { class PropertyNameArray; class PropertyNameArrayData; + class StructureChain; class Structure : public RefCounted { public: diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp index 85049b1..acebc86 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "StructureChain.h" +#include "Structure.h" #include "JSObject.h" #include "Structure.h" @@ -46,6 +47,11 @@ StructureChain::StructureChain(Structure* head) m_vector[i] = 0; } +PassRefPtr StructureChain::create(Structure* head) +{ + return adoptRef(new StructureChain(head)); +} + bool StructureChain::isCacheable() const { uint32_t i = 0; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h index c48749d..5990e17 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h @@ -37,7 +37,7 @@ namespace JSC { class StructureChain : public RefCounted { public: - static PassRefPtr create(Structure* head) { return adoptRef(new StructureChain(head)); } + static PassRefPtr create(Structure* head); RefPtr* head() { return m_vector.get(); } bool isCacheable() const; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h index e1e4ba3..fa37d55 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h @@ -501,7 +501,7 @@ #endif #if !PLATFORM(WIN_OS) && !PLATFORM(SOLARIS) && !PLATFORM(QNX) \ - && !PLATFORM(SYMBIAN) && !COMPILER(RVCT) && !PLATFORM(AIX) + && !PLATFORM(SYMBIAN) && !COMPILER(RVCT) && !PLATFORM(AIX) && !PLATFORM(HPUX) #define HAVE_TM_GMTOFF 1 #define HAVE_TM_ZONE 1 #define HAVE_TIMEGM 1 -- cgit v0.12 From da4bfa273c955574d68dde1b44681de31a478ee0 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 7 Sep 2009 10:37:01 +0200 Subject: Stabilize QFontMetrics test On Mac, the text may be elided if we give the exact length as the size. Giving one pixel bigger makes sure the text is not elided --- tests/auto/qfontmetrics/tst_qfontmetrics.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp index 3a2d90f..5d4c520 100644 --- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp +++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp @@ -180,7 +180,7 @@ void tst_QFontMetrics::elidedText() QFETCH(QString, text); QFontMetrics fm(font); int w = fm.width(text); - QString newtext = fm.elidedText(text,Qt::ElideRight,w, 0); + QString newtext = fm.elidedText(text,Qt::ElideRight,w+1, 0); QCOMPARE(text,newtext); // should not elide newtext = fm.elidedText(text,Qt::ElideRight,w-1, 0); QVERIFY(text != newtext); // should elide @@ -212,10 +212,10 @@ void tst_QFontMetrics::elidedMultiLength() QFontMetrics fm = QFontMetrics(QFont()); int width_long = fm.width(text1_long); QCOMPARE(fm.elidedText(text1,Qt::ElideRight, 8000), text1_long); - QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_long), text1_long); + QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_long + 1), text1_long); QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_long - 1), text1_short); int width_short = fm.width(text1_short); - QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short), text1_short); + QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short + 1), text1_short); QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short - 1), text1_small); // Not even wide enough for "small" - should use ellipsis -- cgit v0.12 From 206769af3fe145dbc46628dba67ed3115fcbabf2 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 7 Sep 2009 10:44:58 +0200 Subject: Stabilize QComboBox test. On Mac, there is long fading animation before the popups hide --- tests/auto/qcombobox/tst_qcombobox.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index be33862..0773184 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -879,12 +879,12 @@ void tst_QComboBox::hide() { testWidget->addItem("foo"); testWidget->showPopup(); - QTest::qWait(500); //allow combobox effect to complete - QVERIFY(testWidget->view()); - QVERIFY(testWidget->view()->isVisible()); + QTest::qWait(200); //allow combobox effect to complete + QTRY_VERIFY(testWidget->view()); + QTRY_VERIFY(testWidget->view()->isVisible()); testWidget->hidePopup(); - QTest::qWait(500); //allow combobox effect to complete - QVERIFY(!testWidget->view()->isVisible()); + QTest::qWait(200); //allow combobox effect to complete + QTRY_VERIFY(!testWidget->view()->isVisible()); testWidget->hide(); QVERIFY(!testWidget->isVisible()); } -- cgit v0.12 From 84bd6d5e10506d179e12f842659d98f7f9ef7e62 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 7 Sep 2009 10:54:35 +0200 Subject: Support setting font size in shorthand font properties The fontSizeAdjustment defaulted to 0 which means "medium" in internal semantics. This will override any font size you set in the short-hand. In other locations, fontSizeAdjustment defaults to -255 which has no meaning attached. To allow setting the font size in short-hand (as in "font: 20px Arial"), we can't default to a specific adjustment. Two tests are added: The first verifies the case that already worked, where you specify the font size using the "font-size" property. The other verifies the short-hand case and would previously fail. Task-number: 207189 Reviewed-by: Simon Hausmann --- src/gui/text/qcssparser.cpp | 2 +- tests/auto/qtextdocument/tst_qtextdocument.cpp | 61 +++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index f252444..a38f276 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -1171,7 +1171,7 @@ static void parseShorthandFontProperty(const QVector &values, QFont *font { font->setStyle(QFont::StyleNormal); font->setWeight(QFont::Normal); - *fontSizeAdjustment = 0; + *fontSizeAdjustment = -255; int i = 0; while (i < values.count()) { diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp index 34b6f14..0c1d334 100644 --- a/tests/auto/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp @@ -100,6 +100,9 @@ private slots: void task240325(); + void stylesheetFont_data(); + void stylesheetFont(); + void toHtml_data(); void toHtml(); void toHtml2(); @@ -571,6 +574,63 @@ void tst_QTextDocument::task240325() } } +void tst_QTextDocument::stylesheetFont_data() +{ + QTest::addColumn("stylesheet"); + QTest::addColumn("font"); + + { + QFont font; + font.setBold(true); + font.setPixelSize(64); + + QTest::newRow("Regular font specification") + << "font-size: 64px; font-weight: bold;" + << font; + } + + + { + QFont font; + font.setBold(true); + font.setPixelSize(64); + + QTest::newRow("Shorthand font specification") + << "font: normal bold 64px Arial;" + << font; + } + +} + +void tst_QTextDocument::stylesheetFont() +{ + QFETCH(QString, stylesheet); + QFETCH(QFont, font); + + QString html = QString::fromLatin1("" + "" + "
" + "Foobar" + "
" + "" + "").arg(stylesheet); + + qDebug() << html; + doc->setHtml(html); + QCOMPARE(doc->blockCount(), 1); + + // First and only block + QTextBlock block = doc->firstBlock(); + + QString text = block.text(); + QCOMPARE(text, QString::fromLatin1("Foobar")); + + QFont actualFont = block.charFormat().font(); + + QCOMPARE(actualFont.bold(), font.bold()); + QCOMPARE(actualFont.pixelSize(), font.pixelSize()); +} + void tst_QTextDocument::noundo_moreIsModified() { doc->setUndoRedoEnabled(false); @@ -1458,7 +1518,6 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("list-ul-margin") << QTextDocumentFragment(&doc) << QString("EMPTYBLOCK") + QString("
  • Blah
"); - } } -- cgit v0.12 From 4d044d5947bd7b49b93146097d934ccdce3746c2 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Mon, 7 Sep 2009 11:16:39 +0200 Subject: Fixed resolving colors of the form "rgb(r,g,b)" in SVGs. The bug was introduced by 13bcc92274d52fa6df2d636c78cf6ea457d670aa. Instead of comparing only the beginning of a string with "rgb(", a full string compare was used. I also added some error handling to avoid crashing on noncompliant SVG files. Reviewed-by: Trond --- src/svg/qsvghandler.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index e2c3d92..35b8595 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -810,24 +810,27 @@ static bool resolveColor(const QStringRef &colorStr, QColor &color, QSvgHandler case 'r': { - // starts with "rgb(" - if (colorStrTr == QLatin1String("rgb(")) { + // starts with "rgb(", ends with ")" and consists of at least 7 characters "rgb(,,)" + if (colorStrTr.length() >= 7 && colorStrTr.at(colorStrTr.length() - 1) == QLatin1Char(')') + && QStringRef(colorStrTr.string(), colorStrTr.position(), 4) == QLatin1String("rgb(")) { const QChar *s = colorStrTr.constData() + 4; QVector compo = parseNumbersList(s); //1 means that it failed after reaching non-parsable //character which is going to be "%" if (compo.size() == 1) { - const QChar *s = colorStrTr.constData() + 4; + s = colorStrTr.constData() + 4; compo = parsePercentageList(s); - compo[0] *= (qreal)2.55; - compo[1] *= (qreal)2.55; - compo[2] *= (qreal)2.55; + for (int i = 0; i < compo.size(); ++i) + compo[i] *= (qreal)2.55; } - color = QColor(int(compo[0]), - int(compo[1]), - int(compo[2])); - return true; + if (compo.size() == 3) { + color = QColor(int(compo[0]), + int(compo[1]), + int(compo[2])); + return true; + } + return false; } } break; -- cgit v0.12 From d4b695977171177f5f302b845273039aebd618ac Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 7 Sep 2009 11:29:24 +0200 Subject: Fix tst_QItemDelegate::task257859_finalizeEdit on Mac qFindChildren would also find the QFocusFrame in addition to the line edit --- tests/auto/qitemdelegate/tst_qitemdelegate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp index dc013b9..1ef77c0 100644 --- a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp @@ -1155,7 +1155,7 @@ void tst_QItemDelegate::task257859_finalizeEdit() view.edit(index); QTest::qWait(30); - QList lineEditors = qFindChildren(view.viewport()); + QList lineEditors = qFindChildren(view.viewport()); QCOMPARE(lineEditors.count(), 1); QPointer editor = lineEditors.at(0); -- cgit v0.12 From 6b7330ee075a62138f005492a6448059106554af Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 7 Sep 2009 11:30:36 +0200 Subject: Fixed qsubmdiarea setFont test. The compared fonts didn't have the same styleHint because it's resolved setting the font. Reviewed-by: Olivier --- tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp index 8c4415c..78ba46b 100644 --- a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp @@ -1835,7 +1835,10 @@ void tst_QMdiSubWindow::setFont() newFont.setBold(true); subWindow->setFont(newFont); qApp->processEvents(); - QCOMPARE(subWindow->font(), newFont); + const QFont &swFont = subWindow->font(); + QCOMPARE(swFont.family(), newFont.family()); + QCOMPARE(swFont.pointSize(), newFont.pointSize()); + QCOMPARE(swFont.weight(), newFont.weight()); QImage newTitleBar = QPixmap::grabWidget(subWindow, titleBarRect).toImage(); QVERIFY(newTitleBar != originalTitleBar); -- cgit v0.12 From 1cac9a68bab207cab3fd3790baec4569a0acd385 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 7 Sep 2009 12:48:18 +0300 Subject: Createpackage support for signing SIS with multiple certificates. This commit extends createpackage with capability to sign the SIS file with several certificates. The certificates need to be listed in text file. The file can have several certificates, each specified in separate line. The certificate, key and passphrase in line must be ';' separated. Lines starting with '#' are treated as a comments. Also empty lines in the file are ignored. The paths in certificate info file can be absolute or relative to the given file. Example syntax for certificateinfo file (mycerts.txt): # This is comment line, also the empty lines are ignored rd.cer;rd-key.pem .\cert\mycert.cer;.\cert\mykey.key;yourpassword X:\QtS60\selfsigned.cer;X:\QtS60\selfsigned.key To use this file the creatapackage has to be invokes as follows: createpackage.pl -c=mycerts.txt templatepkg release-armv5 Reviewed-by: Shane Kearns Reviewed-by: Miikka Heikkinen --- bin/createpackage.pl | 120 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 93 insertions(+), 27 deletions(-) diff --git a/bin/createpackage.pl b/bin/createpackage.pl index 2e31544..1a83abb 100644 --- a/bin/createpackage.pl +++ b/bin/createpackage.pl @@ -52,42 +52,70 @@ use strict; use Getopt::Long; # Use file name parsing module use File::Basename; +# Use File::Spec services mainly rel2abs +use File::Spec; +# use CWD abs_bath, which is exported only on request +use Cwd 'abs_path'; + sub Usage() { - print "\n"; - print "==========================================================================================\n"; - print "Convenience script for creating signed packages you can install on your phone.\n"; - print "\n"; - print "Usage: createpackage.pl [-i] templatepkg target-platform [certificate key [passphrase]]\n"; - print "\n"; - print "Where parameters are as follows:\n"; - print " [-i|install] = Install the package right away using PC suite\n"; - print " [-p|preprocess] = Only preprocess the template .pkg file.\n"; - print " templatepkg = Name of .pkg file template\n"; - print " target = Either debug or release\n"; - print " platform = One of the supported platform\n"; - print " winscw | gcce | armv5 | armv6 | armv7\n"; - print " certificate = The certificate file used for signing\n"; - print " key = The certificate's private key file\n"; - print " passphrase = The certificate's private key file's passphrase\n"; - print "\n"; - print "For example:\n"; - print " createpackage.pl fluidlauncher_template.pkg release-armv5\n"; - print "\n"; - print "If no certificate and key files are provided, either a RnD certificate or\n"; - print "a self-signed certificate from Qt installation root directory is used.\n"; - print "\n"; - print "==========================================================================================\n"; + print <] = The file containing certificate information for signing. + The file can have several certificates, each specified in + separate line. The certificate, key and passphrase in line + must be ';' separated. Lines starting with '#' are treated + as a comments. Also empty lines are ignored. The paths in + can be absolute or relative to . +Where parameters are as follows: + templatepkg = Name of .pkg file template + target = Either debug or release + platform = One of the supported platform + winscw | gcce | armv5 | armv6 | armv7 + certificate = The certificate file used for signing + key = The certificate's private key file + passphrase = The certificate's private key file's passphrase + +Example: + createpackage.pl fluidlauncher_template.pkg release-armv5 + +Example with certfile: + createpackage.pl -c=mycerts.txt fluidlauncher_template.pkg release-armv5 + + Content of 'mycerts.txt' must be something like this: + # This is comment line, also the empty lines are ignored + rd.cer;rd-key.pem + .\\cert\\mycert.cer;.\\cert\\mykey.key;yourpassword + X:\\QtS60\\selfsigned.cer;X:\\QtS60\\selfsigned.key + +If no certificate and key files are provided, either a RnD certificate or +a self-signed certificate from Qt installation root directory is used. +============================================================================================== + +ENDUSAGESTRING + exit(); } # Read given options my $install = ""; my $preprocessonly = ""; -unless (GetOptions('i|install' => \$install, 'p|preprocess' => \$preprocessonly)){ +my $certfile = ""; + +unless (GetOptions('i|install' => \$install, 'p|preprocess' => \$preprocessonly, 'c|certfile=s' => \$certfile)){ Usage(); } +my $certfilepath = abs_path(dirname($certfile)); + # Read params to variables my $templatepkg = $ARGV[0]; my $targetplatform = lc $ARGV[1]; @@ -155,6 +183,32 @@ if (length($certificate)) { } } +# Read the certificates from file to two dimensional array +my @certificates; +if (length($certfile)) { + open CERTFILE, "<$certfile" or die $!; + while(){ + s/#.*//; # ignore comments by erasing them + next if /^(\s)*$/; # skip blank lines + chomp; # remove trailing newline characters + my @certinfo = split(';', $_); # split row to certinfo + + # Trim spaces + for(@certinfo) { + s/^\s+//; + s/\s+$//; + } + + # Do some validation + unless(scalar(@certinfo) >= 2 && scalar(@certinfo) <= 3 && length($certinfo[0]) && length($certinfo[1]) ) { + print "\nError: $certfile line '$_' does not contain valid information!\n"; + Usage(); + } + + push @certificates, [@certinfo]; # push data to two dimensional array + } +} + # Remove any existing .sis packages unlink $unsigned_sis_name; unlink $signed_sis_name; @@ -180,15 +234,27 @@ if ($preprocessonly) { exit; } -# Create and sign SIS +# Create SIS. system ("makesis $pkgoutput $unsigned_sis_name"); + +# Sign SIS with certificate info given as an argument. system ("signsis $unsigned_sis_name $signed_sis_name $certificate $key $passphrase"); # Check if creating signed SIS Succeeded stat($signed_sis_name); if( -e _ ) { - print ("\nSuccessfully created $signed_sis_name using certificate $certtext!\n"); + print ("\nSuccessfully created $signed_sis_name using certificate: $certtext!\n"); + # Sign with additional certificates & keys + for my $row ( @certificates ) { + # Get certificate absolute file names, relative paths are relative to certfilepath + my $abscert = File::Spec->rel2abs( $row->[0], $certfilepath); + my $abskey = File::Spec->rel2abs( $row->[1], $certfilepath); + + system ("signsis $signed_sis_name $signed_sis_name $abscert $abskey $row->[2]"); + print ("\tAdditionally signed the SIS with certificate: $row->[0]!\n"); + } + # remove temporary pkg and unsigned sis unlink $pkgoutput; unlink $unsigned_sis_name; -- cgit v0.12 From c4c9b4457f0f760c1bf46dd8a309ab76eb128c1d Mon Sep 17 00:00:00 2001 From: aavit Date: Mon, 7 Sep 2009 11:14:12 +0200 Subject: Fix for qfileinfo autotest: LocalDiskFile set also for non-existing file Change 53576b4d3c3e7325d01efba6c4da80299492f2db introduced the behaviour that QFSFileEngine sets LocalDiskFlag regardless of whether the file exists or not, but it just did it for Windows. This change makes fsengine for unix/mac behave likewise. Reviewed-by: trustme --- src/corelib/io/qfsfileengine_unix.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 022211c..50b4af7 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -731,6 +731,8 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const } QAbstractFileEngine::FileFlags ret = 0; + if (type & FlagsMask) + ret |= LocalDiskFlag; bool exists = d->doStat(); if (!exists && !d->isSymlink()) return ret; @@ -796,7 +798,6 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const } } if (type & FlagsMask) { - ret |= LocalDiskFlag; if (exists) ret |= ExistsFlag; #if defined(Q_OS_SYMBIAN) -- cgit v0.12 From 3a275174d9a61f7f6451b1da39da82fd8286f9f7 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 7 Sep 2009 12:49:07 +0200 Subject: Fix tst_QListView::task254449_draggingItemToNegativeCoordinates on Mac On Mac, QWidget::repaint() is the same thing as update(), it needs to reenter the event loop to get processed (this has always been like that) --- tests/auto/qlistview/tst_qlistview.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index c598aeb..2be1a03 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -1614,13 +1614,6 @@ void tst_QListView::task254449_draggingItemToNegativeCoordinates() list.setModel(&model); list.setViewMode(QListView::IconMode); list.show(); - QTest::qWait(200); //makes sure the layout is done - - const QPoint topLeft(-6, 0); - - - list.setPositionForIndex(topLeft, index); - class MyItemDelegate : public QStyledItemDelegate { public: @@ -1634,15 +1627,18 @@ void tst_QListView::task254449_draggingItemToNegativeCoordinates() mutable int numPaints; } delegate; - list.setItemDelegate(&delegate); + QTest::qWait(200); //makes sure the layout is done + + const QPoint topLeft(-6, 0); + list.setPositionForIndex(topLeft, index); + //we'll make sure the item is repainted delegate.numPaints = 0; - list.viewport()->repaint(); - - QCOMPARE(list.visualRect(index).topLeft(), topLeft); - QCOMPARE(delegate.numPaints, 1); + QApplication::processEvents(); + QCOMPARE(list.visualRect(index).topLeft(), topLeft); + QCOMPARE(delegate.numPaints, 1); } -- cgit v0.12 From 807185d250fd8f5152cafdb416f28abe4438275f Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Mon, 7 Sep 2009 12:57:50 +0200 Subject: Fix some issues with Shift-selection in QAbstractItemView This commit fixes some issues which occur when pressing the Shift key while selecting items (new unit tests included): 1. The offset of the visible area is missing at one point in QAbstractItemView::keyPressEvent, causing Shift-Arrow selection to fail if the view is scrolled down. 2. Shift-click and Shift-Arrow selection fail after a rubberband selection because d->pressedPosition does not correspond to a valid QModelIndex. The problems have been found in Dolphin: http://bugs.kde.org/show_bug.cgi?id=163451 Merge-request: 1426 Reviewed-by: Olivier Goffart --- src/gui/itemviews/qabstractitemview.cpp | 7 +- .../qabstractitemview/tst_qabstractitemview.cpp | 111 +++++++++++++++++++++ 2 files changed, 114 insertions(+), 4 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index ea98cb2..52529ff 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -1537,8 +1537,7 @@ void QAbstractItemView::mousePressEvent(QMouseEvent *event) QPoint offset = d->offset(); if ((command & QItemSelectionModel::Current) == 0) d->pressedPosition = pos + offset; - - if (d->pressedPosition == QPoint(-1, -1)) + else if (!indexAt(d->pressedPosition).isValid()) d->pressedPosition = visualRect(currentIndex()).center() + offset; if (edit(index, NoEditTriggers, event)) @@ -2089,8 +2088,8 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) // note that we don't check if the new current index is enabled because moveCursor() makes sure it is if (command & QItemSelectionModel::Current) { d->selectionModel->setCurrentIndex(newCurrent, QItemSelectionModel::NoUpdate); - if (d->pressedPosition == QPoint(-1, -1)) - d->pressedPosition = visualRect(oldCurrent).center(); + if (!indexAt(d->pressedPosition).isValid()) + d->pressedPosition = visualRect(oldCurrent).center() + d->offset(); QRect rect(d->pressedPosition - d->offset(), visualRect(newCurrent).center()); setSelection(rect, command); } else { diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp index a43b727..eae830f 100644 --- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp @@ -217,6 +217,8 @@ private slots: void task250754_fontChange(); void task200665_itemEntered(); void task257481_emptyEditor(); + void shiftArrowSelectionAfterScrolling(); + void shiftSelectionAfterRubberbandSelection(); }; class MyAbstractItemDelegate : public QAbstractItemDelegate @@ -1261,6 +1263,115 @@ void tst_QAbstractItemView::task257481_emptyEditor() QVERIFY(!lineEditors.first()->size().isEmpty()); } +void tst_QAbstractItemView::shiftArrowSelectionAfterScrolling() +{ + QStandardItemModel model; + for (int i=0; i<10; ++i) { + QStandardItem *item = new QStandardItem(QString("%1").arg(i)); + model.setItem(i, 0, item); + } + + QListView view; + view.setFixedSize(150, 250); + view.setFlow(QListView::LeftToRight); + view.setGridSize(QSize(100, 100)); + view.setSelectionMode(QListView::ExtendedSelection); + view.setViewMode(QListView::IconMode); + view.setModel(&model); + view.show(); + QTest::qWait(30); + + QModelIndex index0 = model.index(0, 0); + QModelIndex index1 = model.index(1, 0); + QModelIndex index9 = model.index(9, 0); + + view.selectionModel()->setCurrentIndex(index0, QItemSelectionModel::NoUpdate); + QCOMPARE(view.currentIndex(), index0); + + view.scrollTo(index9); + QTest::keyClick(&view, Qt::Key_Down, Qt::ShiftModifier); + + QCOMPARE(view.currentIndex(), index1); + QModelIndexList selected = view.selectionModel()->selectedIndexes(); + QCOMPARE(selected.count(), 2); + QVERIFY(selected.contains(index0)); + QVERIFY(selected.contains(index1)); +} + +void tst_QAbstractItemView::shiftSelectionAfterRubberbandSelection() +{ + QStandardItemModel model; + for (int i=0; i<3; ++i) { + QStandardItem *item = new QStandardItem(QString("%1").arg(i)); + model.setItem(i, 0, item); + } + + QListView view; + view.setFixedSize(150, 450); + view.setFlow(QListView::LeftToRight); + view.setGridSize(QSize(100, 100)); + view.setSelectionMode(QListView::ExtendedSelection); + view.setViewMode(QListView::IconMode); + view.setModel(&model); + view.show(); + QTest::qWait(30); + + QModelIndex index0 = model.index(0, 0); + QModelIndex index1 = model.index(1, 0); + QModelIndex index2 = model.index(2, 0); + + view.setCurrentIndex(index0); + QCOMPARE(view.currentIndex(), index0); + + // Determine the points where the rubberband selection starts and ends + QPoint pressPos = view.visualRect(index1).bottomRight() + QPoint(1, 1); + QPoint releasePos = view.visualRect(index1).center(); + QVERIFY(!view.indexAt(pressPos).isValid()); + QCOMPARE(view.indexAt(releasePos), index1); + + // Select item 1 using a rubberband selection + // The mouse move event has to be created manually because the QTest framework does not + // contain a function for mouse moves with buttons pressed + QTest::mousePress(view.viewport(), Qt::LeftButton, Qt::NoModifier, pressPos); + QMouseEvent moveEvent(QEvent::MouseMove, releasePos, Qt::NoButton, Qt::LeftButton, Qt::NoModifier); + bool moveEventReceived = qApp->notify(view.viewport(), &moveEvent); + QVERIFY(moveEventReceived); + QTest::mouseRelease(view.viewport(), Qt::LeftButton, Qt::NoModifier, releasePos); + QCOMPARE(view.currentIndex(), index1); + + // Shift-click item 2 + QPoint item2Pos = view.visualRect(index2).center(); + QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ShiftModifier, item2Pos); + QCOMPARE(view.currentIndex(), index2); + + // Verify that the selection worked OK + QModelIndexList selected = view.selectionModel()->selectedIndexes(); + QCOMPARE(selected.count(), 2); + QVERIFY(selected.contains(index1)); + QVERIFY(selected.contains(index2)); + + // Select item 0 to revert the selection + view.setCurrentIndex(index0); + QCOMPARE(view.currentIndex(), index0); + + // Repeat the same steps as above, but with a Shift-Arrow selection + QTest::mousePress(view.viewport(), Qt::LeftButton, Qt::NoModifier, pressPos); + QMouseEvent moveEvent2(QEvent::MouseMove, releasePos, Qt::NoButton, Qt::LeftButton, Qt::NoModifier); + moveEventReceived = qApp->notify(view.viewport(), &moveEvent2); + QVERIFY(moveEventReceived); + QTest::mouseRelease(view.viewport(), Qt::LeftButton, Qt::NoModifier, releasePos); + QCOMPARE(view.currentIndex(), index1); + + // Press Shift-Down + QTest::keyClick(&view, Qt::Key_Down, Qt::ShiftModifier); + QCOMPARE(view.currentIndex(), index2); + + // Verify that the selection worked OK + selected = view.selectionModel()->selectedIndexes(); + QCOMPARE(selected.count(), 2); + QVERIFY(selected.contains(index1)); + QVERIFY(selected.contains(index2)); +} QTEST_MAIN(tst_QAbstractItemView) #include "tst_qabstractitemview.moc" -- cgit v0.12 From 3ae1da01af275d830cb9a648692bb3266dee6410 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 7 Sep 2009 12:39:32 +0200 Subject: New Benchmark: file:// with QFile vs QNetworkAccessManager Reviewed-by: Leo --- tests/benchmarks/benchmarks.pro | 1 + .../qfile_vs_qnetworkaccessmanager/main.cpp | 158 +++++++++++++++++++++ .../qfile_vs_qnetworkaccessmanager.pro | 13 ++ 3 files changed, 172 insertions(+) create mode 100644 tests/benchmarks/qfile_vs_qnetworkaccessmanager/main.cpp create mode 100644 tests/benchmarks/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro index bf02731..ad1920b 100644 --- a/tests/benchmarks/benchmarks.pro +++ b/tests/benchmarks/benchmarks.pro @@ -3,6 +3,7 @@ SUBDIRS = containers-associative \ containers-sequential \ qanimation \ qbytearray \ + qfile_vs_qnetworkaccessmanager \ qpainter \ qtestlib-simple events \ qiodevice \ diff --git a/tests/benchmarks/qfile_vs_qnetworkaccessmanager/main.cpp b/tests/benchmarks/qfile_vs_qnetworkaccessmanager/main.cpp new file mode 100644 index 0000000..6a95c81 --- /dev/null +++ b/tests/benchmarks/qfile_vs_qnetworkaccessmanager/main.cpp @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** 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$ +** +****************************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include "../../auto/network-settings.h" + +class qfile_vs_qnetworkaccessmanager : public QObject +{ + Q_OBJECT + // do not use on symbian.. 100 MB is too large.. + // but.. this is a manual test anyway, so :) +protected: + void qnamFileRead_iteration(QNetworkAccessManager &manager, QNetworkRequest &request); + void qfileFileRead_iteration(); + static const int iterations = 10; + +private slots: + void qnamFileRead(); + void qfileFileRead(); + + void initTestCase(); + void cleanupTestCase(); + +public: + qint64 size; + QTemporaryFile testFile; + + qfile_vs_qnetworkaccessmanager() : QObject(), size(0) {}; +}; + +void qfile_vs_qnetworkaccessmanager::initTestCase() +{ + testFile.open(); + QByteArray qba(1*1024*1024, 'x'); // 1 MB + for (int i = 0; i < 100; i++) { + testFile.write(qba); + testFile.flush(); + size += qba.size(); + } // 100 MB + testFile.reset(); +} + +void qfile_vs_qnetworkaccessmanager::cleanupTestCase() +{ + +} + +void qfile_vs_qnetworkaccessmanager::qnamFileRead_iteration(QNetworkAccessManager &manager, QNetworkRequest &request) +{ + QNetworkReply* reply = manager.get(request); + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + QByteArray qba = reply->readAll(); + delete reply; +} + +void qfile_vs_qnetworkaccessmanager::qnamFileRead() +{ + QNetworkAccessManager manager; + QTime t; + QNetworkRequest request(QUrl(testFile.fileName())); + + // do 3 dry runs for cache warmup + qnamFileRead_iteration(manager, request); + qnamFileRead_iteration(manager, request); + qnamFileRead_iteration(manager, request); + + t.start(); + // 10 real runs + QBENCHMARK_ONCE { + for (int i = 0; i < iterations; i++) { + qnamFileRead_iteration(manager, request); + } + } + + qint64 elapsed = t.elapsed(); + qDebug() << endl << "Finished!"; + qDebug() << "Bytes:" << size; + qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec"; +} + +void qfile_vs_qnetworkaccessmanager::qfileFileRead_iteration() +{ + testFile.reset(); + QByteArray qba = testFile.readAll(); +} + +void qfile_vs_qnetworkaccessmanager::qfileFileRead() +{ + QTime t; + + // do 3 dry runs for cache warmup + qfileFileRead_iteration(); + qfileFileRead_iteration(); + qfileFileRead_iteration(); + + t.start(); + // 10 real runs + QBENCHMARK_ONCE { + for (int i = 0; i < iterations; i++) { + qfileFileRead_iteration(); + } + } + + qint64 elapsed = t.elapsed(); + qDebug() << endl << "Finished!"; + qDebug() << "Bytes:" << size; + qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec"; +} + +QTEST_MAIN(qfile_vs_qnetworkaccessmanager) + +#include "main.moc" diff --git a/tests/benchmarks/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro b/tests/benchmarks/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro new file mode 100644 index 0000000..99d1935 --- /dev/null +++ b/tests/benchmarks/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro @@ -0,0 +1,13 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = qfile_vs_qnetworkaccessmanager +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui +QT += network + +CONFIG += release + +# Input +SOURCES += main.cpp -- cgit v0.12 From 77fd77d601263662904a376bb89202b9a36fcb51 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Mon, 7 Sep 2009 14:05:12 +0200 Subject: Doc: Some animation examples had no docs in qtdemo. Task-number: 260779 Reviewed-by: Morten Engvoldsen --- demos/qtdemo/xml/examples.xml | 2 +- doc/src/examples/animatedtiles.qdoc | 50 +++++++++++++++++++++++++++++ doc/src/examples/appchooser.qdoc | 52 +++++++++++++++++++++++++++++++ doc/src/examples/easing.qdoc | 51 ++++++++++++++++++++++++++++++ doc/src/examples/states.qdoc | 50 +++++++++++++++++++++++++++++ doc/src/getting-started/examples.qdoc | 4 +++ doc/src/images/animatedtiles-example.png | Bin 0 -> 148019 bytes doc/src/images/appchooser-example.png | Bin 0 -> 29447 bytes doc/src/images/easing-example.png | Bin 0 -> 23843 bytes doc/src/images/states-example.png | Bin 0 -> 34844 bytes 10 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 doc/src/examples/animatedtiles.qdoc create mode 100644 doc/src/examples/appchooser.qdoc create mode 100644 doc/src/examples/easing.qdoc create mode 100644 doc/src/examples/states.qdoc create mode 100644 doc/src/images/animatedtiles-example.png create mode 100644 doc/src/images/appchooser-example.png create mode 100644 doc/src/images/easing-example.png create mode 100644 doc/src/images/states-example.png diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml index 77006c2..b545e1d 100644 --- a/demos/qtdemo/xml/examples.xml +++ b/demos/qtdemo/xml/examples.xml @@ -25,7 +25,7 @@ - + diff --git a/doc/src/examples/animatedtiles.qdoc b/doc/src/examples/animatedtiles.qdoc new file mode 100644 index 0000000..87f1f95 --- /dev/null +++ b/doc/src/examples/animatedtiles.qdoc @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation 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$ +** +****************************************************************************/ + +/*! + \example animation/animatedtiles + \title Animated Tiles Example + + The Animated Tiles example animates items in a graphics scene. + + \image animatedtiles-example.png +*/ + diff --git a/doc/src/examples/appchooser.qdoc b/doc/src/examples/appchooser.qdoc new file mode 100644 index 0000000..540291e --- /dev/null +++ b/doc/src/examples/appchooser.qdoc @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation 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$ +** +****************************************************************************/ + +/*! + \example animation/appchooser + \title Application Chooser Example + + The Application Chooser example shows how to use the Qt state + machine and the animation framework to select between + applications. + + \image appchooser-example.png + +*/ diff --git a/doc/src/examples/easing.qdoc b/doc/src/examples/easing.qdoc new file mode 100644 index 0000000..20cccd2 --- /dev/null +++ b/doc/src/examples/easing.qdoc @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation 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$ +** +****************************************************************************/ + +/*! + \example animation/easing + \title Easing Curves Example + + The Easing Curves example shows how to use easing curves to + control the speed of an animation. + + \image easing-example.png + +*/ diff --git a/doc/src/examples/states.qdoc b/doc/src/examples/states.qdoc new file mode 100644 index 0000000..c17abd0 --- /dev/null +++ b/doc/src/examples/states.qdoc @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation 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$ +** +****************************************************************************/ + +/*! + \example animation/states + \title States Example + + The States example shows how to use the Qt state machine to play + animations. + + \image states-example.png +*/ diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index b2a9997..0639bf0 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -1045,7 +1045,11 @@ \image animation-examples.png Animation \list + \o \l{animation/animatedtiles}{Animated Tiles} + \o \l{animation/appchooser}{Application Chooser} + \o \l{animation/easing}{Easing Curves} \o \l{animation/moveblocks}{Move Blocks}\raisedaster + \o \l{animation/states}{States} \o \l{animation/stickman}{Stick man}\raisedaster \endlist */ diff --git a/doc/src/images/animatedtiles-example.png b/doc/src/images/animatedtiles-example.png new file mode 100644 index 0000000..082ac57 Binary files /dev/null and b/doc/src/images/animatedtiles-example.png differ diff --git a/doc/src/images/appchooser-example.png b/doc/src/images/appchooser-example.png new file mode 100644 index 0000000..885476e Binary files /dev/null and b/doc/src/images/appchooser-example.png differ diff --git a/doc/src/images/easing-example.png b/doc/src/images/easing-example.png new file mode 100644 index 0000000..de48667 Binary files /dev/null and b/doc/src/images/easing-example.png differ diff --git a/doc/src/images/states-example.png b/doc/src/images/states-example.png new file mode 100644 index 0000000..f87b99b Binary files /dev/null and b/doc/src/images/states-example.png differ -- cgit v0.12 From c41e03887ca8fb749b6edd12cdb04dbc6590328a Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 7 Sep 2009 15:22:16 +0300 Subject: Re-added Symbian specific plugins documentation that had gotten lost. Documentation structure changes had caused Symbian plugin documentation to be lost, so revised and re-added it to plugins-howto.qdoc. Reviewed-by: Janne Anttila --- doc/src/frameworks-technologies/plugins-howto.qdoc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/src/frameworks-technologies/plugins-howto.qdoc b/doc/src/frameworks-technologies/plugins-howto.qdoc index 78e5c20..43bc695 100644 --- a/doc/src/frameworks-technologies/plugins-howto.qdoc +++ b/doc/src/frameworks-technologies/plugins-howto.qdoc @@ -226,6 +226,20 @@ located to your applications root folder (i.e., do not include the \c plugins directory). + \note In Symbian all binaries must be located in the directory \\sys\\bin, + so each Qt plugin has a stub with the same basename as the plugin dll + and suffix ".qtplugin" to make Qt extension plugins work similarly to + other platforms. + When trying to locate the plugin, Qt actually looks for the stub + instead of the plugin binary. While plugin stub files have the + suffix ".qtplugin", they can still be loaded also by specifying a filename + with the normal library suffix ".dll" for QPluginLoader, so normally application + developer doesn't need to care about the different suffix of the stub. + Because of the way applications can be installed + on ROM or various other drives in Symbian, Qt looks for the stub from + the same directory on all available drives if it is not located in the given + directory when loading a plugin. + For more information about deployment, see the \l {Deploying Qt Applications} and \l {Deploying Plugins} documentation. -- cgit v0.12 From f868eae7d0cd3297e2512b5651747fda689cc848 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Mon, 7 Sep 2009 14:28:44 +0200 Subject: Fixed crash in print preview dialog with graphicssystem OpenGL. Avoid crashing when framebuffer object created in one context is used in a shared context after the original context is destroyed. Task-number: 260874 Reviewed-by: Samuel --- src/opengl/qglframebufferobject.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 94e3930..c50608c 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool); -#define QGL_FUNC_CONTEXT QGLContext *ctx = d_ptr->ctx; +#define QGL_FUNC_CONTEXT QGLContextGroup *ctx = d_ptr->ctx; #define QT_CHECK_GLERROR() \ { \ @@ -288,7 +288,7 @@ public: QGLFramebufferObjectFormat format; uint valid : 1; QGLFramebufferObject::Attachment fbo_attachment; - QGLContext *ctx; // for Windows extension ptrs + QGLContextGroup *ctx; // for Windows extension ptrs GLuint previous_fbo; mutable QPaintEngine *engine; }; @@ -340,9 +340,10 @@ bool QGLFramebufferObjectPrivate::checkFramebufferStatus() const void QGLFramebufferObjectPrivate::init(const QSize &sz, QGLFramebufferObject::Attachment attachment, GLenum texture_target, GLenum internal_format, GLint samples) { - ctx = const_cast(QGLContext::currentContext()); + QGLContext *currentContext = const_cast(QGLContext::currentContext()); + ctx = QGLContextPrivate::contextGroup(currentContext); bool ext_detected = (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject); - if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(ctx))) + if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(currentContext))) return; size = sz; @@ -466,7 +467,7 @@ void QGLFramebufferObjectPrivate::init(const QSize &sz, QGLFramebufferObject::At fbo_attachment = QGLFramebufferObject::NoAttachment; } - glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo); + glBindFramebuffer(GL_FRAMEBUFFER_EXT, currentContext->d_ptr->current_fbo); if (!valid) { if (color_buffer) glDeleteRenderbuffers(1, &color_buffer); @@ -736,16 +737,19 @@ QGLFramebufferObject::~QGLFramebufferObject() delete d->engine; - if (isValid() - && (d->ctx == QGLContext::currentContext() - || qgl_share_reg()->checkSharing(d->ctx, QGLContext::currentContext()))) - { + if (isValid()) { + const QGLContext *oldContext = QGLContext::currentContext(); + bool switchContext = !oldContext || QGLContextPrivate::contextGroup(oldContext) != ctx; + if (switchContext) + const_cast(ctx->context())->makeCurrent(); glDeleteTextures(1, &d->texture); if (d->color_buffer) glDeleteRenderbuffers(1, &d->color_buffer); if (d->depth_stencil_buffer) glDeleteRenderbuffers(1, &d->depth_stencil_buffer); glDeleteFramebuffers(1, &d->fbo); + if (oldContext && switchContext) + const_cast(oldContext)->makeCurrent(); } } @@ -897,7 +901,7 @@ QImage QGLFramebufferObject::toImage() const bool wasBound = isBound(); if (!wasBound) const_cast(this)->bind(); - QImage image = qt_gl_read_framebuffer(d->size, d->ctx->format().alpha(), true); + QImage image = qt_gl_read_framebuffer(d->size, format().textureTarget() != GL_RGB, true); if (!wasBound) const_cast(this)->release(); @@ -969,16 +973,14 @@ bool QGLFramebufferObject::hasOpenGLFramebufferObjects() */ void QGLFramebufferObject::drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget) { - Q_D(QGLFramebufferObject); - d->ctx->drawTexture(target, textureId, textureTarget); + const_cast(QGLContext::currentContext())->drawTexture(target, textureId, textureTarget); } #ifdef Q_MAC_COMPAT_GL_FUNCTIONS /*! \internal */ void QGLFramebufferObject::drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget) { - Q_D(QGLFramebufferObject); - d->ctx->drawTexture(target, textureId, textureTarget); + const_cast(QGLContext::currentContext())->drawTexture(target, textureId, textureTarget); } #endif @@ -994,8 +996,7 @@ void QGLFramebufferObject::drawTexture(const QRectF &target, QMacCompatGLuint te */ void QGLFramebufferObject::drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget) { - Q_D(QGLFramebufferObject); - d->ctx->drawTexture(point, textureId, textureTarget); + const_cast(QGLContext::currentContext())->drawTexture(point, textureId, textureTarget); } #ifdef Q_MAC_COMPAT_GL_FUNCTIONS @@ -1100,7 +1101,7 @@ QGLFramebufferObject::Attachment QGLFramebufferObject::attachment() const bool QGLFramebufferObject::isBound() const { Q_D(const QGLFramebufferObject); - return d->ctx->d_ptr->current_fbo == d->fbo; + return QGLContext::currentContext()->d_ptr->current_fbo == d->fbo; } /*! -- cgit v0.12 From 23e1c7afed25ccb95cc24d2caa692853f35464ec Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 7 Sep 2009 14:53:59 +0200 Subject: Doc: Added a note that a state machine requires a running event loop. Reviewed-by: Trust Me --- .../src_corelib_statemachine_qstatemachine.cpp | 15 ++++++++ src/corelib/statemachine/qstatemachine.cpp | 42 ++++++---------------- 2 files changed, 26 insertions(+), 31 deletions(-) create mode 100644 doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp diff --git a/doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp b/doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp new file mode 100644 index 0000000..128799f --- /dev/null +++ b/doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp @@ -0,0 +1,15 @@ +//! [simple state machine] +QPushButton button; + +QStateMachine machine; +QState *s1 = new QState(); +s1->assignProperty(&button, "text", "Click me"); + +QFinalState *s2 = new QFinalState(); +s1->addTransition(&button, SIGNAL(clicked()), s2); + +machine.addState(s1); +machine.addState(s2); +machine.setInitialState(s1); +machine.start(); +//! [simple state machine] diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index f562fb3..a5cdd45 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -78,13 +78,13 @@ QT_BEGIN_NAMESPACE /*! - \class QStateMachine - \reentrant + \class QStateMachine + \reentrant - \brief The QStateMachine class provides a hierarchical finite state machine. + \brief The QStateMachine class provides a hierarchical finite state machine. - \since 4.6 - \ingroup statemachine + \since 4.6 + \ingroup statemachine QStateMachine is based on the concepts and notation of \l{Statecharts: A visual formalism for complex @@ -128,21 +128,7 @@ QT_BEGIN_NAMESPACE The following snippet shows a state machine that will finish when a button is clicked: - \code - QPushButton button; - - QStateMachine machine; - QState *s1 = new QState(); - s1->assignProperty(&button, "text", "Click me"); - - QFinalState *s2 = new QFinalState(); - s1->addTransition(&button, SIGNAL(clicked()), s2); - - machine.addState(s1); - machine.addState(s2); - machine.setInitialState(s1); - machine.start(); - \endcode + \snippet doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp simple state machine This code example uses QState, which inherits QAbstractState. The QState class provides a state that you can use to set properties @@ -160,17 +146,7 @@ QT_BEGIN_NAMESPACE no error state applies to the erroneous state, the machine will stop executing and an error message will be printed to the console. - \omit This stuff will be moved elsewhere -This is - typically used in conjunction with \l{Signals and Slots}{signals}; the - signals determine the flow of the state graph, whereas the states' property - assignments and method invocations are the actions. - - The postEvent() function posts an event to the state machine. This is useful - when you are using custom events to trigger transitions. - \endomit - - \sa QAbstractState, QAbstractTransition, QState, {The State Machine Framework} + \sa QAbstractState, QAbstractTransition, QState, {The State Machine Framework} */ /*! @@ -1748,6 +1724,10 @@ bool QStateMachine::isRunning() const transition to the initial state. When a final top-level state (QFinalState) is entered, the machine will emit the finished() signal. + \note A state machine will not run without a running event loop, such as + the main application event loop started with QCoreApplication::exec() or + QApplication::exec(). + \sa started(), finished(), stop(), initialState() */ void QStateMachine::start() -- cgit v0.12 From 63c3aede3998725960fbe17887e966a7acecbc53 Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Mon, 7 Sep 2009 11:55:55 +0200 Subject: Fix QScriptEngineAgent::exceptionCatch (JIT enabled) Event exceptionCatch fixed, now exceptionValue is correctly passed as an argument to debugger. Two QEXCEPT_FAIL were removed from autotest. Reviewed-by: Kent Hansen --- src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp | 1 + src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp | 4 +++- tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp | 4 ---- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp index dab6682..dc192f0 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp @@ -690,6 +690,7 @@ void JIT::emit_op_catch(Instruction* currentInstruction) emitPutVirtualRegister(currentInstruction[1].u.operand); #ifdef QT_BUILD_SCRIPT_LIB JITStubCall stubCall(this, JITStubs::cti_op_debug_catch); + stubCall.addArgument(Imm32(currentInstruction[1].u.operand)); stubCall.call(); #endif } diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index 1d39ba4..c84d115 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -2747,7 +2747,9 @@ DEFINE_STUB_FUNCTION(void, op_debug_catch) STUB_INIT_STACK_FRAME(stackFrame); CallFrame* callFrame = stackFrame.callFrame; if (JSC::Debugger* debugger = callFrame->lexicalGlobalObject()->debugger() ) { - debugger->exceptionCatch(DebuggerCallFrame(callFrame), callFrame->codeBlock()->ownerNode()->sourceID()); + JSValue exceptionValue = callFrame->r(stackFrame.args[0].int32()).jsValue(); + DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue); + debugger->exceptionCatch(debuggerCallFrame, callFrame->codeBlock()->ownerNode()->sourceID()); } } diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 3d1cbe8..96277b3 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -1619,8 +1619,6 @@ void tst_QScriptEngineAgent::exceptionThrowAndCatch() QCOMPARE(spy->at(1).type, ScriptEngineEvent::ExceptionCatch); QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "Exception value is not passed in exceptionCatch event when JIT is enabled", Continue); QVERIFY(spy->at(1).value.strictlyEquals(spy->at(0).value)); } } @@ -1764,8 +1762,6 @@ void tst_QScriptEngineAgent::eventOrder_throwAndCatch() QVERIFY(spy->at(7).hasExceptionHandler); // catch QCOMPARE(spy->at(8).type, ScriptEngineEvent::ExceptionCatch); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "Exception value is not passed in exceptionCatch event when JIT is enabled", Continue); QVERIFY(spy->at(8).value.isError()); // void(e) QCOMPARE(spy->at(9).type, ScriptEngineEvent::PositionChange); -- cgit v0.12 From 54fc571caf61b81442449f5586276cf782488cdd Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Mon, 7 Sep 2009 14:26:48 +0200 Subject: Fix QScriptEngineAgent::functionExit (JIT enabled) Event functionExit was fixed, now returnValue is correctly passed as an argument to debugger. Few QEXCEPT_FAIL were removed from autotest. Reviewed-by: Kent Hansen --- src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp | 1 + src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp | 4 +++- tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp | 16 ---------------- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp index dc192f0..da541c5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp @@ -287,6 +287,7 @@ void JIT::emit_op_ret(Instruction* currentInstruction) { #ifdef QT_BUILD_SCRIPT_LIB JITStubCall stubCall(this, JITStubs::cti_op_debug_return); + stubCall.addArgument(Imm32(currentInstruction[1].u.operand)); stubCall.call(); #endif // We could JIT generate the deref, only calling out to C when the refcount hits zero. diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index c84d115..0a5eb07 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -2758,7 +2758,9 @@ DEFINE_STUB_FUNCTION(void, op_debug_return) STUB_INIT_STACK_FRAME(stackFrame); CallFrame* callFrame = stackFrame.callFrame; if (JSC::Debugger* debugger = callFrame->lexicalGlobalObject()->debugger() ) { - debugger->functionExit(JSValue(), callFrame->codeBlock()->ownerNode()->sourceID()); + JSValue returnValue = callFrame->r(stackFrame.args[0].int32()).jsValue(); + intptr_t sourceID = callFrame->codeBlock()->ownerNode()->sourceID(); + debugger->functionExit(returnValue, sourceID); } } diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 96277b3..75f7a12 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -589,11 +589,7 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionCall() // anonymous function exit QCOMPARE(spy->at(2).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(2).value.isNumber()); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QCOMPARE(spy->at(2).value.toNumber(), qsreal(123)); // evaluate() exit @@ -670,11 +666,7 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionDefinition() // foo() exit QCOMPARE(spy->at(4).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(4).scriptId, spy->at(0).scriptId); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(4).value.isNumber()); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QCOMPARE(spy->at(4).value.toNumber(), qsreal(456)); // evaluate() exit @@ -1059,11 +1051,7 @@ void tst_QScriptEngineAgent::functionEntryAndExit_call() // exit QCOMPARE(spy->at(1).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(1).value.isNumber()); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QCOMPARE(spy->at(1).value.toNumber(), qsreal(123)); } delete spy; @@ -1812,16 +1800,12 @@ void tst_QScriptEngineAgent::eventOrder_functions() // bar() exit QCOMPARE(spy->at(15).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(15).scriptId, spy->at(3).scriptId); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(15).value.isNumber()); // restore context QCOMPARE(spy->at(16).type, ScriptEngineEvent::ContextPop); // foo() exit QCOMPARE(spy->at(17).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(17).scriptId, spy->at(0).scriptId); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(17).value.isNumber()); // restore context QCOMPARE(spy->at(18).type, ScriptEngineEvent::ContextPop); -- cgit v0.12 From bb9b4f4eb76d323ddafa24dc811d0b0b3d2ef4ec Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Mon, 7 Sep 2009 15:00:06 +0200 Subject: Doc: Minor adjustments to the rogue example docs. Reviewed-by: Trust Me --- doc/src/examples/rogue.qdoc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/src/examples/rogue.qdoc b/doc/src/examples/rogue.qdoc index 8f97696..1327df6 100644 --- a/doc/src/examples/rogue.qdoc +++ b/doc/src/examples/rogue.qdoc @@ -52,8 +52,8 @@ \c{@} in the screenshot? That's you, the rogue. The \c{#} characters are walls, and the dots represent floor. In a real game, other ASCII characters would represent all kinds of objects - and creatures. For instance, ancient dragons (\c{D}'s) or food - rations (\c{%}'s). But let's not get carried away. In this game, + and creatures, for instance, ancient dragons (\c{D}s) or food + rations (\c{%}s). But let's not get carried away. In this game, the rogue is simply running around in an empty room. The rogue is moved with the keypad (2, 4, 8, 6). That aside, we @@ -61,12 +61,12 @@ types \c {q}. The player is then asked if he/she really wants to quit. - Most games have commands that need more than one key press and - that may require a different sequence of keys based on questions - asked the user. In this game, only the \c quit command falls under - this category, but for the sake of argument, let's imagine a - fully-fledged game with a rich set of commands. If we were to - implement these by catching key events in + Most games have commands that need more than one key press (we + think of consecutive presses, i.e., not of several keys being + pressed at the same time). In this game, only the \c quit command + falls under this category, but for the sake of argument, let's + imagine a fully-fledged game with a rich set of commands. If we + were to implement these by catching key events in \l{QWidget::}{keyPressEvent()}, we would have to keep a lot of class member variables to track the sequence of keys already typed (or find some other way of deducing the current state of a -- cgit v0.12 From d724c91a0ae9ed38fd2dc33bcdd4edbe6aa69085 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 7 Sep 2009 15:15:34 +0200 Subject: Fix crash on QGraphicsItem destruction related to focus handling Do not call clearFocus() for child item in setParentItemHelper() if called from destructor: At this time, the ~QGraphicsItem destructor already deleted all its children. Reviewed-by: Andreas Aardal Hanssen --- 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 eae3e63..7023e9e 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -934,7 +934,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) } QGraphicsItem *lastSubFocusItem = subFocusItem; - if (subFocusItem) { + if (subFocusItem && !inDestructor) { // Update the child focus chain; when reparenting an item that has a // focus child, ensure that that focus child clears its focus child // chain from our parents before it's reparented. -- cgit v0.12 From 7f37724eff30c858dcec1a4a94422feaa6a9ab4f Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 7 Sep 2009 16:17:20 +0300 Subject: Minor fix to network-settings.h in Symbian OS Reviewed-by: Aleksandar Sasha Babic --- tests/auto/network-settings.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h index d1c179e..a7fa20c 100644 --- a/tests/auto/network-settings.h +++ b/tests/auto/network-settings.h @@ -143,8 +143,8 @@ public: } return QHostAddress(serverIp.data()); } -#endif - return QHostInfo::fromName(serverName()).addresses().first(); +#endif // Q_OS_SYMBIAN + return QHostInfo::fromName(serverName()).addresses().first(); } #endif @@ -161,12 +161,11 @@ public: } return imapExpectedReply.data(); } -#else - QByteArray expected( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] " ); +#endif + QByteArray expected( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] " );s expected = expected.append(QtNetworkSettings::serverName().toAscii()); expected = expected.append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); return expected; -#endif } static QByteArray expectedReplySSL() -- cgit v0.12 From f049c1b99ed41e5ccf6100cb12a0f443481b4ea5 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Mon, 7 Sep 2009 15:40:44 +0200 Subject: Fix a crash in the Win32 event dispatcher Not clearing the timerVec and timerDict containers can cause crashes during application shutdown when code tries to unregister timers (that were unregistered in closingDown()). Reviewed-by: dt --- src/corelib/kernel/qeventdispatcher_win.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 9c308a3..c6ac6d4 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -1021,6 +1021,8 @@ void QEventDispatcherWin32::closingDown() // clean up any timers for (int i = 0; i < d->timerVec.count(); ++i) d->unregisterTimer(d->timerVec.at(i), true); + d->timerVec.clear(); + d->timerDict.clear(); } bool QEventDispatcherWin32::event(QEvent *e) -- cgit v0.12 From 5c15ea9cdfeb39d0f040e144756a7d4e2bd23670 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 7 Sep 2009 15:47:20 +0200 Subject: Fix warning when compiling with QT_NO_EXCEPTIONS src/corelib/global/qglobal.h:1368:1: warning: "QT_NO_EXCEPTIONS" redefined Reviewed-by: Alexis --- src/corelib/global/qglobal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index a2c532f..7285f69 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1364,7 +1364,7 @@ inline void qt_noop() {} #ifdef QT_BOOTSTRAPPED # define QT_NO_EXCEPTIONS #endif -#if defined(Q_CC_GNU) && !defined (__EXCEPTIONS) && !defined(Q_MOC_RUN) +#if !defined(QT_NO_EXCEPTIONS) && defined(Q_CC_GNU) && !defined (__EXCEPTIONS) && !defined(Q_MOC_RUN) # define QT_NO_EXCEPTIONS #endif -- cgit v0.12 From 0f4c89bc38e124a8b308f25754e84642194cc2a6 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 7 Sep 2009 16:26:11 +0200 Subject: Use icons on QDialogButtonBox in KDE Oxygen did not use icons in dialogs. This is obviously incorrect compared with other KDE apps. We changed common style to enable button icons by default on X11 and explicitly disabled them for Windows and Motif styles. We also updated the icons for YES and NO actions to use dialog-ok and process-stop to reflect the usaged in KDE itself. Reviewed-by: ogoffart --- src/gui/styles/qcommonstyle.cpp | 56 ++++++++++++++++++++++++++++---------- src/gui/styles/qmotifstyle.cpp | 3 ++ src/gui/styles/qplastiquestyle.cpp | 5 ++++ src/gui/styles/qwindowsstyle.cpp | 3 ++ 4 files changed, 52 insertions(+), 15 deletions(-) diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 7fefb19..817401e 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -5126,6 +5126,9 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget ret = Qt::LinksAccessibleByMouse; break; case SH_DialogButtonBox_ButtonsHaveIcons: +#ifdef Q_WS_X11 + return true; +#endif ret = 0; break; case SH_SpellCheckUnderlineStyle: @@ -5222,6 +5225,19 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) { switch (sp) { + case SP_DialogYesButton: + case SP_DialogOkButton: + pixmap = QIcon::fromTheme(QLatin1String("dialog-ok")).pixmap(16); + break; + case SP_DialogApplyButton: + pixmap = QIcon::fromTheme(QLatin1String("dialog-ok-apply")).pixmap(16); + break; + case SP_DialogDiscardButton: + pixmap = QIcon::fromTheme(QLatin1String("edit-delete")).pixmap(16); + break; + case SP_DialogCloseButton: + pixmap = QIcon::fromTheme(QLatin1String("dialog-close")).pixmap(16); + break; case SP_DirHomeIcon: pixmap = QIcon::fromTheme(QLatin1String("user-home")).pixmap(16); break; @@ -5336,13 +5352,15 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti case SP_DialogHelpButton: pixmap = QIcon::fromTheme(QLatin1String("help-contents")).pixmap(24); break; + case SP_DialogNoButton: case SP_DialogCancelButton: - pixmap = QIcon::fromTheme(QLatin1String("process-stop")).pixmap(24); + pixmap = QIcon::fromTheme(QLatin1String("dialog-cancel"), + QIcon::fromTheme(QLatin1String("process-stop"))).pixmap(24); break; case SP_DialogSaveButton: pixmap = QIcon::fromTheme(QLatin1String("document-save")).pixmap(24); break; - case SP_FileLinkIcon: + case SP_FileLinkIcon: pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16); if (!pixmap.isNull()) { QPixmap fileIcon = QIcon::fromTheme(QLatin1String("text-x-generic")).pixmap(16); @@ -5530,6 +5548,25 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons case SP_DirOpenIcon: icon = QIcon::fromTheme(QLatin1String("folder-open")); break; + case SP_DialogSaveButton: + icon = QIcon::fromTheme(QLatin1String("document-save")); + break; + case SP_DialogApplyButton: + icon = QIcon::fromTheme(QLatin1String("dialog-ok-apply")); + break; + case SP_DialogYesButton: + case SP_DialogOkButton: + icon = QIcon::fromTheme(QLatin1String("dialog-ok")); + break; + case SP_DialogDiscardButton: + icon = QIcon::fromTheme(QLatin1String("edit-delete")); + break; + case SP_DialogResetButton: + icon = QIcon::fromTheme(QLatin1String("edit-clear")); + break; + case SP_DialogHelpButton: + icon = QIcon::fromTheme(QLatin1String("help-contents")); + break; case SP_FileIcon: icon = QIcon::fromTheme(QLatin1String("text-x-generic")); break; @@ -5575,21 +5612,13 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons case SP_ArrowLeft: icon = QIcon::fromTheme(QLatin1String("go-previous")); break; - case SP_DialogHelpButton: - icon = QIcon::fromTheme(QLatin1String("help-contents")); - break; case SP_DialogCancelButton: - icon = QIcon::fromTheme(QLatin1String("process-stop")); + icon = QIcon::fromTheme(QLatin1String("dialog-cancel"), + QIcon::fromTheme(QLatin1String("process-stop"))); break; case SP_DialogCloseButton: icon = QIcon::fromTheme(QLatin1String("window-close")); break; - case SP_DialogApplyButton: - icon = QIcon::fromTheme(QLatin1String("dialog-ok-apply")); - break; - case SP_DialogOkButton: - icon = QIcon::fromTheme(QLatin1String("dialog-ok")); - break; case SP_FileDialogDetailedView: icon = QIcon::fromTheme(QLatin1String("view-list-details")); break; @@ -5629,9 +5658,6 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons case SP_MediaVolumeMuted: icon = QIcon::fromTheme(QLatin1String("audio-volume-muted")); break; - case SP_DialogResetButton: - icon = QIcon::fromTheme(QLatin1String("edit-clear")); - break; case SP_ArrowForward: if (rtl) return standardIconImplementation(SP_ArrowLeft, option, widget); diff --git a/src/gui/styles/qmotifstyle.cpp b/src/gui/styles/qmotifstyle.cpp index 3550408..904a8f56 100644 --- a/src/gui/styles/qmotifstyle.cpp +++ b/src/gui/styles/qmotifstyle.cpp @@ -2683,6 +2683,9 @@ QMotifStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *w case SH_LineEdit_PasswordCharacter: ret = '*'; break; + case SH_DialogButtonBox_ButtonsHaveIcons: + ret = 0; + break; default: ret = QCommonStyle::styleHint(hint, opt, widget, returnData); break; diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 8250013..bdd72b7 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -5435,6 +5435,11 @@ int QPlastiqueStyle::styleHint(StyleHint hint, const QStyleOption *option, const case SH_Menu_SubMenuPopupDelay: ret = 96; // from Plastik break; +#ifdef Q_WS_X11 + case SH_DialogButtonBox_ButtonsHaveIcons: + ret = true; + break; +#endif #ifndef Q_OS_WIN case SH_Menu_AllowActiveAndDisabled: ret = false; diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 31f96c3..2a88578 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -1206,6 +1206,9 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid case SH_ItemView_ArrowKeysNavigateIntoChildren: ret = true; break; + case SH_DialogButtonBox_ButtonsHaveIcons: + ret = 0; + break; default: ret = QCommonStyle::styleHint(hint, opt, widget, returnData); break; -- cgit v0.12 From 87f023a692d5b469f6c8f796c8cf217057e92813 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 7 Sep 2009 16:29:01 +0200 Subject: tst_qnetworkreply: Check for NoError before event loop timeout. This makes sure we show a proper "Host not found" error instead of the "Event loop timed out". Rev-By: Peter Hartmann --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index a223d1c..7c70819 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -2653,6 +2653,7 @@ void tst_QNetworkReply::ioPutToFileFromSocket() connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); QTestEventLoop::instance().enterLoop(10); + QCOMPARE(reply->error(), QNetworkReply::NoError); QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->url(), url); @@ -2699,6 +2700,7 @@ void tst_QNetworkReply::ioPutToFileFromLocalSocket() connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); QTestEventLoop::instance().enterLoop(10); + QCOMPARE(reply->error(), QNetworkReply::NoError); QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->url(), url); @@ -2971,6 +2973,7 @@ void tst_QNetworkReply::ioPostToHttpFromSocket() this, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); disconnect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + QCOMPARE(reply->error(), QNetworkReply::NoError); QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->url(), url); @@ -3295,6 +3298,7 @@ void tst_QNetworkReply::uploadPerformance() QTimer::singleShot(5000, &generator, SLOT(stop())); QTestEventLoop::instance().enterLoop(10); + QCOMPARE(reply->error(), QNetworkReply::NoError); QVERIFY(!QTestEventLoop::instance().timeout()); } @@ -3320,6 +3324,7 @@ void tst_QNetworkReply::httpUploadPerformance() generator.start(); time.start(); QTestEventLoop::instance().enterLoop(40); + QCOMPARE(reply->error(), QNetworkReply::NoError); QVERIFY(!QTestEventLoop::instance().timeout()); qint64 elapsed = time.elapsed(); @@ -3387,6 +3392,7 @@ void tst_QNetworkReply::httpDownloadPerformance() QTime time; time.start(); QTestEventLoop::instance().enterLoop(40); + QCOMPARE(reply->error(), QNetworkReply::NoError); QVERIFY(!QTestEventLoop::instance().timeout()); qint64 elapsed = time.elapsed(); @@ -3456,6 +3462,7 @@ void tst_QNetworkReply::downloadProgress() spy.clear(); QTestEventLoop::instance().enterLoop(2); + QCOMPARE(reply->error(), QNetworkReply::NoError); QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(spy.count() > 0); QVERIFY(!reply->isRunning()); -- cgit v0.12 From 16cdfbc5464a9468fbd5515d77fea82d116b3b51 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 7 Sep 2009 16:44:51 +0200 Subject: Network tests: Fix typo in network-settings.h to make it compile --- tests/auto/network-settings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h index a7fa20c..144f7b3 100644 --- a/tests/auto/network-settings.h +++ b/tests/auto/network-settings.h @@ -162,7 +162,7 @@ public: return imapExpectedReply.data(); } #endif - QByteArray expected( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] " );s + QByteArray expected( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] " ); expected = expected.append(QtNetworkSettings::serverName().toAscii()); expected = expected.append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); return expected; -- cgit v0.12 From 3d038b2990da8cda7da2bca752eb0851b3cfe1a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 7 Sep 2009 18:42:08 +0200 Subject: Fixed compile failure on Mac OS X. --- src/opengl/qglframebufferobject.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index c50608c..c53ed3a 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -1003,8 +1003,7 @@ void QGLFramebufferObject::drawTexture(const QPointF &point, GLuint textureId, G /*! \internal */ void QGLFramebufferObject::drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget) { - Q_D(QGLFramebufferObject); - d->ctx->drawTexture(point, textureId, textureTarget); + const_cast(QGLContext::currentContext())->drawTexture(point, textureId, textureTarget); } #endif -- cgit v0.12 From 4680ca9955aa7e38c4279b62f350971298279863 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 7 Sep 2009 19:32:22 +0200 Subject: Remove extra invalid semi-colon Reviewed-By: Trust Me --- src/opengl/qgl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 0d72469..daac760 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -408,7 +408,7 @@ private: Q_DISABLE_COPY(QGLContext) }; -Q_DECLARE_OPERATORS_FOR_FLAGS(QGLContext::BindOptions); +Q_DECLARE_OPERATORS_FOR_FLAGS(QGLContext::BindOptions) class Q_OPENGL_EXPORT QGLWidget : public QWidget { -- cgit v0.12 From 166f16d42b33048bc379ea5f67aab05e58e95538 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 7 Sep 2009 15:58:27 +0200 Subject: Only depend on phonon when building webkit if phonon was configured for Reviewed-by: Denis --- src/src.pro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/src.pro b/src/src.pro index 780e56e..240e1f7 100644 --- a/src/src.pro +++ b/src/src.pro @@ -120,7 +120,8 @@ src_webkit.target = sub-webkit src_tools_activeqt.depends = src_tools_idc src_gui src_plugins.depends = src_gui src_sql src_svg contains(QT_CONFIG, webkit) { - src_webkit.depends = src_gui src_sql src_network src_xml src_phonon + src_webkit.depends = src_gui src_sql src_network src_xml + contains(QT_CONFIG, phonon):src_webkit.depends += src_phonon #exists($$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro): src_webkit.depends += src_javascriptcore } contains(QT_CONFIG, qt3support): src_plugins.depends += src_qt3support -- cgit v0.12 From 0cbbc9cb9e87a3a39ee1597f4cea1c2b77d8f8da Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 7 Sep 2009 21:23:26 +0200 Subject: Fixed the spelling of canceled in the QGesture api brought up by David Boddie. Reviewed-by: trustme --- src/gui/kernel/qgesture.cpp | 10 +++++----- src/gui/kernel/qgesture.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 7831893..32502db 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -131,9 +131,9 @@ private: about the gesture is contained in the signal sender object. */ -/*! \fn void QGesture::cancelled() +/*! \fn void QGesture::canceled() - The signal is emitted when the gesture is cancelled, for example the + The signal is emitted when the gesture is canceled, for example the reset() function is called while the gesture was in the process of emitting a triggered() signal. Extended information about the gesture is contained in the sender object. @@ -230,7 +230,7 @@ Qt::GestureState QGesture::state() const \a state, and it should be called after all the internal properties have been initialized. - \sa started(), triggered(), finished(), cancelled() + \sa started(), triggered(), finished(), canceled() */ void QGesture::updateState(Qt::GestureState state) { @@ -258,7 +258,7 @@ void QGesture::updateState(Qt::GestureState state) else if (state == Qt::GestureFinished) emit finished(); else if (state == Qt::NoGesture) - emit cancelled(); + emit canceled(); if (state == Qt::GestureFinished) { // gesture is finished, so we reset the internal state. @@ -301,7 +301,7 @@ QGraphicsItem* QGesture::graphicsItem() const Resets the internal state of the gesture. This function might be called by the filterEvent() implementation in a derived class, or by the user to cancel a gesture. The base class implementation calls - updateState(Qt::NoGesture) which emits the cancelled() + updateState(Qt::NoGesture) which emits the canceled() signal if the state() of the gesture indicated it was active. */ void QGesture::reset() diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index ee6f8b3..23c64b2 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -90,7 +90,7 @@ Q_SIGNALS: void started(); void triggered(); void finished(); - void cancelled(); + void canceled(); private: friend class QWidget; -- cgit v0.12 From 4bb098ed9449bd3b2798000bc5394bda98c9165f Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 8 Sep 2009 10:19:40 +1000 Subject: Convert QGLFramebufferObjectFormat to use implicit sharing Reviewed-by: Sarah Smith --- src/opengl/qglframebufferobject.cpp | 71 +++++++++++++++++++++++++++++-------- src/opengl/qglframebufferobject.h | 4 ++- 2 files changed, 59 insertions(+), 16 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index c53ed3a..452f155 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -74,9 +74,34 @@ extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool); } \ } +#ifndef QT_OPENGL_ES +#define DEFAULT_FORMAT GL_RGBA8 +#else +#define DEFAULT_FORMAT GL_RGBA +#endif + class QGLFramebufferObjectFormatPrivate { public: + QGLFramebufferObjectFormatPrivate() + : ref(1), + samples(0), + attachment(QGLFramebufferObject::NoAttachment), + target(GL_TEXTURE_2D), + internal_format(DEFAULT_FORMAT) + { + } + QGLFramebufferObjectFormatPrivate + (const QGLFramebufferObjectFormatPrivate *other) + : ref(1), + samples(other->samples), + attachment(other->attachment), + target(other->target), + internal_format(other->internal_format) + { + } + + QAtomicInt ref; int samples; QGLFramebufferObject::Attachment attachment; GLenum target; @@ -109,6 +134,20 @@ public: */ /*! + \internal +*/ +void QGLFramebufferObjectFormat::detach() +{ + if (d->ref != 1) { + QGLFramebufferObjectFormatPrivate *newd + = new QGLFramebufferObjectFormatPrivate(d); + if (!d->ref.deref()) + delete d; + d = newd; + } +} + +/*! Creates a QGLFramebufferObjectFormat object for specifying the format of an OpenGL framebuffer object. @@ -118,19 +157,9 @@ public: \sa samples(), attachment(), target(), internalTextureFormat() */ -#ifndef QT_OPENGL_ES -#define DEFAULT_FORMAT GL_RGBA8 -#else -#define DEFAULT_FORMAT GL_RGBA -#endif - QGLFramebufferObjectFormat::QGLFramebufferObjectFormat() { d = new QGLFramebufferObjectFormatPrivate; - d->samples = 0; - d->attachment = QGLFramebufferObject::NoAttachment; - d->target = GL_TEXTURE_2D; - d->internal_format = DEFAULT_FORMAT; } /*! @@ -139,8 +168,8 @@ QGLFramebufferObjectFormat::QGLFramebufferObjectFormat() QGLFramebufferObjectFormat::QGLFramebufferObjectFormat(const QGLFramebufferObjectFormat &other) { - d = new QGLFramebufferObjectFormatPrivate; - *d = *other.d; + d = other.d; + d->ref.ref(); } /*! @@ -149,7 +178,12 @@ QGLFramebufferObjectFormat::QGLFramebufferObjectFormat(const QGLFramebufferObjec QGLFramebufferObjectFormat &QGLFramebufferObjectFormat::operator=(const QGLFramebufferObjectFormat &other) { - *d = *other.d; + if (d != other.d) { + other.d->ref.ref(); + if (!d->ref.deref()) + delete d; + d = other.d; + } return *this; } @@ -158,7 +192,8 @@ QGLFramebufferObjectFormat &QGLFramebufferObjectFormat::operator=(const QGLFrame */ QGLFramebufferObjectFormat::~QGLFramebufferObjectFormat() { - delete d; + if (!d->ref.deref()) + delete d; } /*! @@ -176,6 +211,7 @@ QGLFramebufferObjectFormat::~QGLFramebufferObjectFormat() */ void QGLFramebufferObjectFormat::setSamples(int samples) { + detach(); d->samples = samples; } @@ -197,6 +233,7 @@ int QGLFramebufferObjectFormat::samples() const */ void QGLFramebufferObjectFormat::setAttachment(QGLFramebufferObject::Attachment attachment) { + detach(); d->attachment = attachment; } @@ -219,6 +256,7 @@ QGLFramebufferObject::Attachment QGLFramebufferObjectFormat::attachment() const */ void QGLFramebufferObjectFormat::setTextureTarget(GLenum target) { + detach(); d->target = target; } @@ -242,6 +280,7 @@ GLenum QGLFramebufferObjectFormat::textureTarget() const */ void QGLFramebufferObjectFormat::setInternalTextureFormat(GLenum internalTextureFormat) { + detach(); d->internal_format = internalTextureFormat; } @@ -260,12 +299,14 @@ GLenum QGLFramebufferObjectFormat::internalTextureFormat() const /*! \internal */ void QGLFramebufferObjectFormat::setTextureTarget(QMacCompatGLenum target) { + detach(); d->target = target; } /*! \internal */ void QGLFramebufferObjectFormat::setInternalTextureFormat(QMacCompatGLenum internalTextureFormat) { + detach(); d->internal_format = internalTextureFormat; } #endif @@ -871,7 +912,7 @@ QSize QGLFramebufferObject::size() const /*! Returns the format of this framebuffer object. */ -const QGLFramebufferObjectFormat &QGLFramebufferObject::format() const +QGLFramebufferObjectFormat QGLFramebufferObject::format() const { Q_D(const QGLFramebufferObject); return d->format; diff --git a/src/opengl/qglframebufferobject.h b/src/opengl/qglframebufferobject.h index ec1ae7d..6c1c0be 100644 --- a/src/opengl/qglframebufferobject.h +++ b/src/opengl/qglframebufferobject.h @@ -93,7 +93,7 @@ public: virtual ~QGLFramebufferObject(); - const QGLFramebufferObjectFormat &format() const; + QGLFramebufferObjectFormat format() const; bool isValid() const; bool isBound() const; @@ -161,6 +161,8 @@ public: private: QGLFramebufferObjectFormatPrivate *d; + + void detach(); }; QT_END_NAMESPACE -- cgit v0.12