summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-09-04 00:28:26 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-09-04 00:28:26 (GMT)
commit72cca6fe7739c7b5ccd5fc17fb3e1913cc82dce1 (patch)
tree4de2902aba198d339a2ea75d14bbc3d2b2d11723 /src
parent9e57401d403ca31a880636ab91301158a085de09 (diff)
parent4c501d7fce503a610edabfba5d6efc3ef2778bef (diff)
downloadQt-72cca6fe7739c7b5ccd5fc17fb3e1913cc82dce1.zip
Qt-72cca6fe7739c7b5ccd5fc17fb3e1913cc82dce1.tar.gz
Qt-72cca6fe7739c7b5ccd5fc17fb3e1913cc82dce1.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/phonon/ds9/mediaobject.cpp2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp4
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp15
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h3
-rw-r--r--src/activeqt/container/qaxwidget.cpp7
-rw-r--r--src/corelib/arch/alpha/qatomic_alpha.s40
-rw-r--r--src/corelib/arch/i386/qatomic_i386.s40
-rw-r--r--src/corelib/arch/ia64/qatomic_ia64.s40
-rw-r--r--src/corelib/arch/macosx/qatomic32_ppc.s40
-rw-r--r--src/corelib/arch/mips/qatomic_mips32.s40
-rw-r--r--src/corelib/arch/mips/qatomic_mips64.s40
-rw-r--r--src/corelib/arch/parisc/q_ldcw.s40
-rw-r--r--src/corelib/arch/powerpc/qatomic32.s40
-rw-r--r--src/corelib/arch/powerpc/qatomic64.s40
-rw-r--r--src/corelib/arch/qatomic_windows.h34
-rw-r--r--src/corelib/arch/sparc/qatomic32.s40
-rw-r--r--src/corelib/arch/sparc/qatomic64.s40
-rw-r--r--src/corelib/arch/x86_64/qatomic_sun.s40
-rw-r--r--src/corelib/global/qglobal.cpp1
-rw-r--r--src/corelib/global/qglobal.h5
-rw-r--r--src/corelib/global/qnamespace.h5
-rw-r--r--src/corelib/global/qnamespace.qdoc8
-rw-r--r--src/corelib/io/qfile_p.h1
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp8
-rw-r--r--src/corelib/io/qiodevice.cpp7
-rw-r--r--src/corelib/io/qprocess.cpp2
-rw-r--r--src/corelib/io/qtemporaryfile.cpp38
-rw-r--r--src/corelib/io/qtextstream.cpp2
-rw-r--r--src/corelib/io/qtextstream.h2
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp2
-rw-r--r--src/corelib/kernel/qmetaobject.cpp11
-rw-r--r--src/corelib/kernel/qobject.cpp8
-rw-r--r--src/corelib/kernel/qsharedmemory_unix.cpp1
-rw-r--r--src/corelib/statemachine/qsignaltransition.cpp14
-rw-r--r--src/corelib/tools/qbytearray.cpp33
-rw-r--r--src/corelib/tools/qbytearray.h2
-rw-r--r--src/corelib/tools/qcache.h2
-rw-r--r--src/corelib/tools/qlist.h1
-rw-r--r--src/corelib/tools/qlocale.cpp3
-rw-r--r--src/corelib/tools/qmargins.cpp8
-rw-r--r--src/corelib/tools/qmargins.h7
-rw-r--r--src/corelib/tools/qscopedpointer.cpp4
-rwxr-xr-xsrc/corelib/xml/make-parser.sh40
-rw-r--r--src/corelib/xml/qxmlstream.g3
-rw-r--r--src/gui/accessible/qaccessible_mac_cocoa.mm2
-rw-r--r--src/gui/dialogs/qdialog_p.h2
-rw-r--r--src/gui/dialogs/qfiledialog_embedded.ui3
-rw-r--r--src/gui/dialogs/qprintdialog_unix.cpp8
-rw-r--r--src/gui/effects/qgraphicseffect.cpp59
-rw-r--r--src/gui/effects/qgraphicseffect.h20
-rw-r--r--src/gui/effects/qgraphicseffect_p.h1
-rw-r--r--src/gui/embedded/directfb.pri39
-rw-r--r--src/gui/embedded/embedded.pri4
-rw-r--r--src/gui/embedded/qscreendriverfactory_qws.cpp9
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp85
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.h4
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp39
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h22
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp15
-rw-r--r--src/gui/graphicsview/qsimplex_p.h4
-rw-r--r--src/gui/gui.pro5
-rw-r--r--src/gui/image/qbitmap.cpp4
-rw-r--r--src/gui/image/qicon.cpp25
-rw-r--r--src/gui/image/qiconloader.cpp7
-rw-r--r--src/gui/image/qiconloader_p.h2
-rw-r--r--src/gui/image/qimage.cpp6
-rw-r--r--src/gui/inputmethod/qinputcontext.cpp2
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp8
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h10
-rw-r--r--src/gui/itemviews/qcolumnview_p.h4
-rw-r--r--src/gui/itemviews/qtreewidget.cpp6
-rw-r--r--src/gui/kernel/qaction.cpp20
-rw-r--r--src/gui/kernel/qapplication.cpp1
-rw-r--r--src/gui/kernel/qapplication.h2
-rw-r--r--src/gui/kernel/qapplication_s60.cpp132
-rw-r--r--src/gui/kernel/qapplication_win.cpp17
-rw-r--r--src/gui/kernel/qapplication_x11.cpp7
-rw-r--r--src/gui/kernel/qcocoaapplication_mac.mm3
-rw-r--r--src/gui/kernel/qcocoaapplicationdelegate_mac.mm3
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac.mm3
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm11
-rw-r--r--src/gui/kernel/qcocoaview_mac_p.h1
-rw-r--r--src/gui/kernel/qcocoawindow_mac.mm3
-rw-r--r--src/gui/kernel/qcocoawindowdelegate_mac.mm3
-rw-r--r--src/gui/kernel/qgesture.cpp30
-rw-r--r--src/gui/kernel/qgesture_p.h5
-rw-r--r--src/gui/kernel/qstandardgestures.cpp204
-rw-r--r--src/gui/kernel/qstandardgestures.h28
-rw-r--r--src/gui/kernel/qstandardgestures_p.h18
-rw-r--r--src/gui/kernel/qt_s60_p.h1
-rw-r--r--src/gui/kernel/qwidget.cpp4
-rw-r--r--src/gui/kernel/qwidget.h2
-rw-r--r--src/gui/kernel/qwidget_p.h10
-rw-r--r--src/gui/kernel/qwidget_s60.cpp4
-rw-r--r--src/gui/kernel/qwidget_win.cpp28
-rwxr-xr-xsrc/gui/painting/makepsheader.pl40
-rw-r--r--src/gui/painting/painting.pri2
-rw-r--r--src/gui/painting/qcolor.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_mmx_p.h2
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_sse_p.h2
-rw-r--r--src/gui/painting/qemulationpaintengine_p.h2
-rw-r--r--src/gui/painting/qgrayraster.c3
-rw-r--r--src/gui/painting/qpaintbuffer.cpp1745
-rw-r--r--src/gui/painting/qpaintbuffer_p.h439
-rw-r--r--src/gui/painting/qpaintengine.h2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp14
-rw-r--r--src/gui/painting/qpaintengineex.cpp34
-rw-r--r--src/gui/painting/qpaintengineex_p.h8
-rw-r--r--src/gui/painting/qpainter.cpp81
-rw-r--r--src/gui/painting/qpainterpath.h2
-rw-r--r--src/gui/painting/qpainterpath_p.h36
-rw-r--r--src/gui/painting/qvectorpath_p.h3
-rw-r--r--src/gui/s60framework/qs60mainapplication.cpp (renamed from src/s60main/qts60mainapplication.cpp)29
-rw-r--r--src/gui/s60framework/qs60mainapplication_p.h (renamed from src/s60main/qts60mainapplication_p.h)76
-rw-r--r--src/gui/s60framework/qs60mainappui.cpp (renamed from src/s60main/qts60mainappui.cpp)70
-rw-r--r--src/gui/s60framework/qs60mainappui_p.h130
-rw-r--r--src/gui/s60framework/qs60maindocument.cpp (renamed from src/s60main/qts60maindocument.cpp)38
-rw-r--r--src/gui/s60framework/qs60maindocument_p.h139
-rw-r--r--src/gui/s60framework/s60framework.pri7
-rw-r--r--src/gui/styles/gtksymbols.cpp19
-rw-r--r--src/gui/styles/gtksymbols_p.h3
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp364
-rw-r--r--src/gui/styles/qcommonstyle.cpp4
-rw-r--r--src/gui/styles/qgtkstyle.cpp5
-rw-r--r--src/gui/styles/qstyle.cpp8
-rw-r--r--src/gui/styles/qwindowsvistastyle.cpp2
-rw-r--r--src/gui/text/qcssparser.cpp1
-rw-r--r--src/gui/text/qcssscanner.cpp86
-rw-r--r--src/gui/text/qfont.h2
-rw-r--r--src/gui/text/qfontdatabase.cpp2
-rw-r--r--src/gui/util/qcompleter.cpp5
-rw-r--r--src/gui/widgets/qabstractscrollarea.cpp6
-rw-r--r--src/gui/widgets/qcalendarwidget.cpp9
-rw-r--r--src/gui/widgets/qcocoamenu_mac.mm3
-rw-r--r--src/gui/widgets/qdockarealayout.cpp8
-rw-r--r--src/gui/widgets/qmaccocoaviewcontainer_mac.mm3
-rw-r--r--src/gui/widgets/qmacnativewidget_mac.mm3
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm3
-rw-r--r--src/gui/widgets/qplaintextedit.cpp4
-rw-r--r--src/gui/widgets/qplaintextedit_p.h1
-rw-r--r--src/gui/widgets/qtabbar.cpp27
-rw-r--r--src/gui/widgets/qtabbar_p.h1
-rw-r--r--src/gui/widgets/qtextedit.cpp2
-rw-r--r--src/multimedia/audio/qaudioformat.cpp24
-rw-r--r--src/multimedia/multimedia.pro2
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp41
-rw-r--r--src/network/access/qnetworkaccessbackend.cpp14
-rw-r--r--src/network/access/qnetworkaccesscachebackend.cpp1
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp3
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp36
-rw-r--r--src/network/access/qnetworkreplyimpl_p.h3
-rw-r--r--src/network/socket/qhttpsocketengine.cpp1
-rw-r--r--src/network/socket/qnativesocketengine.cpp17
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp5
-rw-r--r--src/network/ssl/qsslcertificate.cpp10
-rw-r--r--src/network/ssl/qsslsocket.cpp8
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp2
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h1
-rw-r--r--src/opengl/gl2paintengineex/qglcustomshaderstage.cpp10
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager.cpp433
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager_p.h159
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp74
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h21
-rw-r--r--src/opengl/qgl.cpp52
-rw-r--r--src/opengl/qgl_p.h4
-rw-r--r--src/opengl/qglextensions_p.h4
-rw-r--r--src/opengl/qglframebufferobject.cpp89
-rw-r--r--src/opengl/qglframebufferobject.h18
-rw-r--r--src/opengl/qglpixelbuffer.cpp4
-rw-r--r--src/opengl/qglpixmapfilter.cpp2
-rw-r--r--src/opengl/qglshaderprogram.cpp21
-rw-r--r--src/opengl/qpixmapdata_gl.cpp2
-rw-r--r--src/opengl/qwindowsurface_gl.cpp2
-rwxr-xr-xsrc/opengl/util/glsl_to_include.sh40
-rw-r--r--src/plugins/gfxdrivers/directfb/directfb.pro38
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp4
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp108
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h17
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp103
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp35
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h6
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp109
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h12
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp63
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h3
-rw-r--r--src/plugins/graphicssystems/graphicssystems.pro1
-rw-r--r--src/plugins/graphicssystems/trace/main.cpp69
-rw-r--r--src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp133
-rw-r--r--src/plugins/graphicssystems/trace/qgraphicssystem_trace_p.h71
-rw-r--r--src/plugins/graphicssystems/trace/trace.pro12
-rw-r--r--src/plugins/imageformats/gif/qgifhandler.cpp4
-rw-r--r--src/plugins/qpluginbase.pri2
-rw-r--r--src/s60main/qts60main.cpp20
-rw-r--r--src/s60main/qts60main_mcrt0.cpp3
-rw-r--r--src/s60main/qts60mainappui_p.h146
-rw-r--r--src/s60main/qts60maindocument_p.h133
-rw-r--r--src/s60main/s60main.pro8
-rw-r--r--src/script/api/qscriptengine.cpp44
-rw-r--r--src/script/api/qscriptengine_p.h29
-rw-r--r--src/script/api/qscriptstring.cpp64
-rw-r--r--src/script/api/qscriptstring.h3
-rw-r--r--src/script/api/qscriptstring_p.h54
-rw-r--r--src/script/bridge/qscriptclassobject.cpp20
-rw-r--r--src/script/bridge/qscriptqobject.cpp1
-rw-r--r--src/script/parser/qscript.g3
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp51
-rw-r--r--src/sql/drivers/oci/qsql_oci.cpp29
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp12
-rw-r--r--src/svg/qgraphicssvgitem.h1
-rw-r--r--src/svg/qsvghandler.cpp496
-rwxr-xr-xsrc/tools/moc/util/generate.sh41
-rw-r--r--src/xmlpatterns/data/qatomicvalue.cpp18
-rwxr-xr-xsrc/xmlpatterns/environment/createReportContext.sh41
-rwxr-xr-xsrc/xmlpatterns/parser/createParser.sh40
-rwxr-xr-xsrc/xmlpatterns/parser/createTokenLookup.sh41
-rwxr-xr-xsrc/xmlpatterns/parser/createXSLTTokenLookup.sh41
217 files changed, 6433 insertions, 1976 deletions
diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp
index e42dff9..250b94a 100644
--- a/src/3rdparty/phonon/ds9/mediaobject.cpp
+++ b/src/3rdparty/phonon/ds9/mediaobject.cpp
@@ -21,7 +21,9 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <QtCore/QTime>
#include <QtCore/QLibrary>
+#ifndef Q_CC_MSVC
#include <dshow.h>
+#endif
#include <objbase.h>
#include <initguid.h>
#include <qnetwork.h>
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp
index 8371229..4a33e67 100644
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp
@@ -684,6 +684,10 @@ void JIT::emit_op_catch(Instruction* currentInstruction)
killLastResultRegister(); // FIXME: Implicitly treat op_catch as a labeled statement, and remove this line of code.
peek(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*));
emitPutVirtualRegister(currentInstruction[1].u.operand);
+#ifdef QT_BUILD_SCRIPT_LIB
+ JITStubCall stubCall(this, JITStubs::cti_op_debug_catch);
+ stubCall.call();
+#endif
}
void JIT::emit_op_jmp_scopes(Instruction* currentInstruction)
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp
index 2563848..f0d3b84 100644
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp
@@ -2713,15 +2713,22 @@ DEFINE_STUB_FUNCTION(void, op_debug)
int debugHookID = stackFrame.args[0].int32();
int firstLine = stackFrame.args[1].int32();
int lastLine = stackFrame.args[2].int32();
-#ifdef QT_BUILD_SCRIPT_LIB
int column = stackFrame.args[3].int32();
-#else
- int column = -1;
-#endif
stackFrame.globalData->interpreter->debug(callFrame, static_cast<DebugHookID>(debugHookID), firstLine, lastLine, column);
}
+#ifdef QT_BUILD_SCRIPT_LIB
+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());
+ }
+}
+#endif
+
DEFINE_STUB_FUNCTION(EncodedJSValue, vm_throw)
{
STUB_INIT_STACK_FRAME(stackFrame);
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h
index 0493189..60bf64a 100644
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h
+++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h
@@ -221,6 +221,9 @@ namespace JITStubs { extern "C" {
void JIT_STUB cti_op_create_arguments(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_create_arguments_no_params(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_debug(STUB_ARGS_DECLARATION);
+#ifdef QT_BUILD_SCRIPT_LIB
+ void JIT_STUB cti_op_debug_catch(STUB_ARGS_DECLARATION);
+#endif
void JIT_STUB cti_op_end(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_jmp_scopes(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_pop_scope(STUB_ARGS_DECLARATION);
diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp
index 621c836..94f85a5 100644
--- a/src/activeqt/container/qaxwidget.cpp
+++ b/src/activeqt/container/qaxwidget.cpp
@@ -1437,6 +1437,9 @@ extern Q_GUI_EXPORT bool qt_win_ignoreNextMouseReleaseEvent;
HRESULT WINAPI QAxClientSite::EnableModeless(BOOL fEnable)
{
+#if !defined(Q_OS_WINCE)
+ LockWindowUpdate(host->window()->winId());
+#endif
EnableWindow(host->window()->winId(), fEnable);
if (!fEnable) {
@@ -1447,7 +1450,9 @@ HRESULT WINAPI QAxClientSite::EnableModeless(BOOL fEnable)
QApplicationPrivate::leaveModal(host);
}
qt_win_ignoreNextMouseReleaseEvent = false;
-
+#if !defined(Q_OS_WINCE)
+ LockWindowUpdate(0);
+#endif
return S_OK;
}
diff --git a/src/corelib/arch/alpha/qatomic_alpha.s b/src/corelib/arch/alpha/qatomic_alpha.s
index 9363b35..44fa932 100644
--- a/src/corelib/arch/alpha/qatomic_alpha.s
+++ b/src/corelib/arch/alpha/qatomic_alpha.s
@@ -1,3 +1,43 @@
+;/****************************************************************************
+;**
+;** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+;** Contact: Nokia Corporation (qt-info@nokia.com)
+;**
+;** This file is part of the QtGui module of the Qt Toolkit.
+;**
+;** $QT_BEGIN_LICENSE:LGPL$
+;** No Commercial Usage
+;** This file contains pre-release code and may not be distributed.
+;** You may use this file in accordance with the terms and conditions
+;** contained in the Technology Preview License Agreement accompanying
+;** this package.
+;**
+;** GNU Lesser General Public License Usage
+;** Alternatively, this file may be used under the terms of the GNU Lesser
+;** General Public License version 2.1 as published by the Free Software
+;** Foundation and appearing in the file LICENSE.LGPL included in the
+;** packaging of this file. Please review the following information to
+;** ensure the GNU Lesser General Public License version 2.1 requirements
+;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+;**
+;** In addition, as a special exception, Nokia gives you certain
+;** additional rights. These rights are described in the Nokia Qt LGPL
+;** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+;** package.
+;**
+;** If you have questions regarding the use of this file, please contact
+;** Nokia at qt-info@nokia.com.
+;**
+;**
+;**
+;**
+;**
+;**
+;**
+;**
+;** $QT_END_LICENSE$
+;**
+;****************************************************************************/
.set noreorder
.set volatile
.set noat
diff --git a/src/corelib/arch/i386/qatomic_i386.s b/src/corelib/arch/i386/qatomic_i386.s
index 08158f9..63facc1 100644
--- a/src/corelib/arch/i386/qatomic_i386.s
+++ b/src/corelib/arch/i386/qatomic_i386.s
@@ -1,3 +1,43 @@
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!
+!! Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+!! Contact: Nokia Corporation (qt-info@nokia.com)
+!!
+!! This file is part of the QtGui module of the Qt Toolkit.
+!!
+!! $QT_BEGIN_LICENSE:LGPL$
+!! No Commercial Usage
+!! This file contains pre-release code and may not be distributed.
+!! You may use this file in accordance with the terms and conditions
+!! contained in the Technology Preview License Agreement accompanying
+!! this package.
+!!
+!! GNU Lesser General Public License Usage
+!! Alternatively, this file may be used under the terms of the GNU Lesser
+!! General Public License version 2.1 as published by the Free Software
+!! Foundation and appearing in the file LICENSE.LGPL included in the
+!! packaging of this file. Please review the following information to
+!! ensure the GNU Lesser General Public License version 2.1 requirements
+!! will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+!!
+!! In addition, as a special exception, Nokia gives you certain
+!! additional rights. These rights are described in the Nokia Qt LGPL
+!! Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+!! package.
+!!
+!! If you have questions regarding the use of this file, please contact
+!! Nokia at qt-info@nokia.com.
+!!
+!!
+!!
+!!
+!!
+!!
+!!
+!!
+!! $QT_END_LICENSE$
+!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.text
.align 4,0x90
diff --git a/src/corelib/arch/ia64/qatomic_ia64.s b/src/corelib/arch/ia64/qatomic_ia64.s
index 6b8a204..f6be4dd 100644
--- a/src/corelib/arch/ia64/qatomic_ia64.s
+++ b/src/corelib/arch/ia64/qatomic_ia64.s
@@ -1,3 +1,43 @@
+;/****************************************************************************
+;**
+;** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+;** Contact: Nokia Corporation (qt-info@nokia.com)
+;**
+;** This file is part of the QtGui module of the Qt Toolkit.
+;**
+;** $QT_BEGIN_LICENSE:LGPL$
+;** No Commercial Usage
+;** This file contains pre-release code and may not be distributed.
+;** You may use this file in accordance with the terms and conditions
+;** contained in the Technology Preview License Agreement accompanying
+;** this package.
+;**
+;** GNU Lesser General Public License Usage
+;** Alternatively, this file may be used under the terms of the GNU Lesser
+;** General Public License version 2.1 as published by the Free Software
+;** Foundation and appearing in the file LICENSE.LGPL included in the
+;** packaging of this file. Please review the following information to
+;** ensure the GNU Lesser General Public License version 2.1 requirements
+;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+;**
+;** In addition, as a special exception, Nokia gives you certain
+;** additional rights. These rights are described in the Nokia Qt LGPL
+;** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+;** package.
+;**
+;** If you have questions regarding the use of this file, please contact
+;** Nokia at qt-info@nokia.com.
+;**
+;**
+;**
+;**
+;**
+;**
+;**
+;**
+;** $QT_END_LICENSE$
+;**
+;****************************************************************************/
.pred.safe_across_calls p1-p5,p16-p63
.text
.align 16
diff --git a/src/corelib/arch/macosx/qatomic32_ppc.s b/src/corelib/arch/macosx/qatomic32_ppc.s
index 13fff67..f87a152 100644
--- a/src/corelib/arch/macosx/qatomic32_ppc.s
+++ b/src/corelib/arch/macosx/qatomic32_ppc.s
@@ -1,3 +1,43 @@
+;/****************************************************************************
+;**
+;** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+;** Contact: Nokia Corporation (qt-info@nokia.com)
+;**
+;** This file is part of the QtGui module of the Qt Toolkit.
+;**
+;** $QT_BEGIN_LICENSE:LGPL$
+;** No Commercial Usage
+;** This file contains pre-release code and may not be distributed.
+;** You may use this file in accordance with the terms and conditions
+;** contained in the Technology Preview License Agreement accompanying
+;** this package.
+;**
+;** GNU Lesser General Public License Usage
+;** Alternatively, this file may be used under the terms of the GNU Lesser
+;** General Public License version 2.1 as published by the Free Software
+;** Foundation and appearing in the file LICENSE.LGPL included in the
+;** packaging of this file. Please review the following information to
+;** ensure the GNU Lesser General Public License version 2.1 requirements
+;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+;**
+;** In addition, as a special exception, Nokia gives you certain
+;** additional rights. These rights are described in the Nokia Qt LGPL
+;** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+;** package.
+;**
+;** If you have questions regarding the use of this file, please contact
+;** Nokia at qt-info@nokia.com.
+;**
+;**
+;**
+;**
+;**
+;**
+;**
+;**
+;** $QT_END_LICENSE$
+;**
+;****************************************************************************/
.section __TEXT,__text,regular,pure_instructions
.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
.section __TEXT,__text,regular,pure_instructions
diff --git a/src/corelib/arch/mips/qatomic_mips32.s b/src/corelib/arch/mips/qatomic_mips32.s
index e7a449b..2bd2dc3 100644
--- a/src/corelib/arch/mips/qatomic_mips32.s
+++ b/src/corelib/arch/mips/qatomic_mips32.s
@@ -1,3 +1,43 @@
+;/****************************************************************************
+;**
+;** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+;** Contact: Nokia Corporation (qt-info@nokia.com)
+;**
+;** This file is part of the QtGui module of the Qt Toolkit.
+;**
+;** $QT_BEGIN_LICENSE:LGPL$
+;** No Commercial Usage
+;** This file contains pre-release code and may not be distributed.
+;** You may use this file in accordance with the terms and conditions
+;** contained in the Technology Preview License Agreement accompanying
+;** this package.
+;**
+;** GNU Lesser General Public License Usage
+;** Alternatively, this file may be used under the terms of the GNU Lesser
+;** General Public License version 2.1 as published by the Free Software
+;** Foundation and appearing in the file LICENSE.LGPL included in the
+;** packaging of this file. Please review the following information to
+;** ensure the GNU Lesser General Public License version 2.1 requirements
+;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+;**
+;** In addition, as a special exception, Nokia gives you certain
+;** additional rights. These rights are described in the Nokia Qt LGPL
+;** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+;** package.
+;**
+;** If you have questions regarding the use of this file, please contact
+;** Nokia at qt-info@nokia.com.
+;**
+;**
+;**
+;**
+;**
+;**
+;**
+;**
+;** $QT_END_LICENSE$
+;**
+;****************************************************************************/
.set nobopt
.set noreorder
.option pic2
diff --git a/src/corelib/arch/mips/qatomic_mips64.s b/src/corelib/arch/mips/qatomic_mips64.s
index d2bd8fe..08dc76f 100644
--- a/src/corelib/arch/mips/qatomic_mips64.s
+++ b/src/corelib/arch/mips/qatomic_mips64.s
@@ -1,3 +1,43 @@
+;/****************************************************************************
+;**
+;** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+;** Contact: Nokia Corporation (qt-info@nokia.com)
+;**
+;** This file is part of the QtGui module of the Qt Toolkit.
+;**
+;** $QT_BEGIN_LICENSE:LGPL$
+;** No Commercial Usage
+;** This file contains pre-release code and may not be distributed.
+;** You may use this file in accordance with the terms and conditions
+;** contained in the Technology Preview License Agreement accompanying
+;** this package.
+;**
+;** GNU Lesser General Public License Usage
+;** Alternatively, this file may be used under the terms of the GNU Lesser
+;** General Public License version 2.1 as published by the Free Software
+;** Foundation and appearing in the file LICENSE.LGPL included in the
+;** packaging of this file. Please review the following information to
+;** ensure the GNU Lesser General Public License version 2.1 requirements
+;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+;**
+;** In addition, as a special exception, Nokia gives you certain
+;** additional rights. These rights are described in the Nokia Qt LGPL
+;** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+;** package.
+;**
+;** If you have questions regarding the use of this file, please contact
+;** Nokia at qt-info@nokia.com.
+;**
+;**
+;**
+;**
+;**
+;**
+;**
+;**
+;** $QT_END_LICENSE$
+;**
+;****************************************************************************/
.set nobopt
.set noreorder
.option pic2
diff --git a/src/corelib/arch/parisc/q_ldcw.s b/src/corelib/arch/parisc/q_ldcw.s
index f901ad9..99205fc 100644
--- a/src/corelib/arch/parisc/q_ldcw.s
+++ b/src/corelib/arch/parisc/q_ldcw.s
@@ -1,3 +1,43 @@
+;/****************************************************************************
+;**
+;** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+;** Contact: Nokia Corporation (qt-info@nokia.com)
+;**
+;** This file is part of the QtGui module of the Qt Toolkit.
+;**
+;** $QT_BEGIN_LICENSE:LGPL$
+;** No Commercial Usage
+;** This file contains pre-release code and may not be distributed.
+;** You may use this file in accordance with the terms and conditions
+;** contained in the Technology Preview License Agreement accompanying
+;** this package.
+;**
+;** GNU Lesser General Public License Usage
+;** Alternatively, this file may be used under the terms of the GNU Lesser
+;** General Public License version 2.1 as published by the Free Software
+;** Foundation and appearing in the file LICENSE.LGPL included in the
+;** packaging of this file. Please review the following information to
+;** ensure the GNU Lesser General Public License version 2.1 requirements
+;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+;**
+;** In addition, as a special exception, Nokia gives you certain
+;** additional rights. These rights are described in the Nokia Qt LGPL
+;** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+;** package.
+;**
+;** If you have questions regarding the use of this file, please contact
+;** Nokia at qt-info@nokia.com.
+;**
+;**
+;**
+;**
+;**
+;**
+;**
+;**
+;** $QT_END_LICENSE$
+;**
+;****************************************************************************/
.SPACE $PRIVATE$
.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
diff --git a/src/corelib/arch/powerpc/qatomic32.s b/src/corelib/arch/powerpc/qatomic32.s
index 811ba84..a84e0a3 100644
--- a/src/corelib/arch/powerpc/qatomic32.s
+++ b/src/corelib/arch/powerpc/qatomic32.s
@@ -1,3 +1,43 @@
+############################################################################
+##
+## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is part of the QtGui module of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## No Commercial Usage
+## This file contains pre-release code and may not be distributed.
+## You may use this file in accordance with the terms and conditions
+## contained in the Technology Preview License Agreement accompanying
+## this package.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 2.1 requirements
+## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## In addition, as a special exception, Nokia gives you certain
+## additional rights. These rights are described in the Nokia Qt LGPL
+## Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+## package.
+##
+## If you have questions regarding the use of this file, please contact
+## Nokia at qt-info@nokia.com.
+##
+##
+##
+##
+##
+##
+##
+##
+## $QT_END_LICENSE$
+##
+############################################################################
.machine "ppc"
.toc
.csect .text[PR]
diff --git a/src/corelib/arch/powerpc/qatomic64.s b/src/corelib/arch/powerpc/qatomic64.s
index 88c2bbd..e56a239 100644
--- a/src/corelib/arch/powerpc/qatomic64.s
+++ b/src/corelib/arch/powerpc/qatomic64.s
@@ -1,3 +1,43 @@
+############################################################################
+##
+## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is part of the QtGui module of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## No Commercial Usage
+## This file contains pre-release code and may not be distributed.
+## You may use this file in accordance with the terms and conditions
+## contained in the Technology Preview License Agreement accompanying
+## this package.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 2.1 requirements
+## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## In addition, as a special exception, Nokia gives you certain
+## additional rights. These rights are described in the Nokia Qt LGPL
+## Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+## package.
+##
+## If you have questions regarding the use of this file, please contact
+## Nokia at qt-info@nokia.com.
+##
+##
+##
+##
+##
+##
+##
+##
+## $QT_END_LICENSE$
+##
+############################################################################
.machine "ppc64"
.toc
.csect .text[PR]
diff --git a/src/corelib/arch/qatomic_windows.h b/src/corelib/arch/qatomic_windows.h
index 50dedc1..6082d0b 100644
--- a/src/corelib/arch/qatomic_windows.h
+++ b/src/corelib/arch/qatomic_windows.h
@@ -68,7 +68,7 @@
# if _WIN32_WCE < 0x600 && defined(_X86_)
// For X86 Windows CE, include winbase.h to catch inline functions which
-// overwrite the regular definitions inside of coredll.dll.
+// override the regular definitions inside of coredll.dll.
// Though one could use the original version of Increment/Decrement, others are
// not exported at all.
# include <winbase.h>
@@ -76,19 +76,21 @@
// It's safer to remove the volatile and let the compiler add it as needed.
# define QT_INTERLOCKED_NO_VOLATILE
-# else // _WIN32_WCE >= 0x600 || _X86_
+# else // _WIN32_WCE >= 0x600 || !_X86_
# define QT_INTERLOCKED_PROTOTYPE __cdecl
# define QT_INTERLOCKED_DECLARE_PROTOTYPES
-# if _WIN32_WCE >= 0x600 && defined(_X86_)
-# define QT_INTERLOCKED_PREFIX _
-# define QT_INTERLOCKED_INTRINSIC
+# if _WIN32_WCE >= 0x600
+# if defined(_X86_)
+# define QT_INTERLOCKED_PREFIX _
+# define QT_INTERLOCKED_INTRINSIC
+# endif
# else
# define QT_INTERLOCKED_NO_VOLATILE
# endif
-# endif // _WIN32_WCE >= 0x600 || _X86_
+# endif // _WIN32_WCE >= 0x600 || !_X86_
#endif // Q_OS_WINCE
@@ -131,10 +133,10 @@ extern "C" {
long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedExchange )(long QT_INTERLOCKED_VOLATILE *, long);
long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long);
-# if !defined(__i386__) && !defined(_M_IX86)
- long QT_INTERLOCKED_FUNCTION( InterlockedCompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *);
- long QT_INTERLOCKED_FUNCTION( InterlockedExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *);
- __int64 QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, long);
+# if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
+ void * QT_INTERLOCKED_FUNCTION( InterlockedCompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *);
+ void * QT_INTERLOCKED_FUNCTION( InterlockedExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *);
+ __int64 QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64);
# endif
}
@@ -142,7 +144,6 @@ extern "C" {
#endif // QT_INTERLOCKED_DECLARE_PROTOTYPES
#undef QT_INTERLOCKED_PROTOTYPE
-#undef QT_INTERLOCKED_VOLATILE
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -190,7 +191,7 @@ extern "C" {
QT_INTERLOCKED_REMOVE_VOLATILE( value ), \
valueToAdd )
-#if defined(__i386__) || defined(_M_IX86)
+#if defined(Q_OS_WINCE) || defined(__i386__) || defined(_M_IX86)
# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
reinterpret_cast<void *>( \
@@ -209,17 +210,17 @@ extern "C" {
QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
valueToAdd )
-#else // !defined(__i386__) && !defined(_M_IX86)
+#else // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
QT_INTERLOCKED_FUNCTION(InterlockedCompareExchangePointer)( \
- QT_INTERLOCKED_REMOVE_VOLATILE( value ), \
+ reinterpret_cast<void * QT_INTERLOCKED_VOLATILE *>( QT_INTERLOCKED_REMOVE_VOLATILE( value ) ), \
newValue, \
expectedValue )
# define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \
QT_INTERLOCKED_FUNCTION(InterlockedExchangePointer)( \
- QT_INTERLOCKED_REMOVE_VOLATILE( value ), \
+ reinterpret_cast<void * QT_INTERLOCKED_VOLATILE *>( QT_INTERLOCKED_REMOVE_VOLATILE( value ) ), \
newValue )
# define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \
@@ -227,7 +228,7 @@ extern "C" {
QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
valueToAdd )
-#endif // !defined(__i386__) && !defined(_M_IX86)
+#endif // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -469,6 +470,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueTo
#undef QT_INTERLOCKED_PREFIX
#undef QT_INTERLOCKED_NO_VOLATILE
+#undef QT_INTERLOCKED_VOLATILE
#undef QT_INTERLOCKED_REMOVE_VOLATILE
#undef QT_INTERLOCKED_INCREMENT
diff --git a/src/corelib/arch/sparc/qatomic32.s b/src/corelib/arch/sparc/qatomic32.s
index f0ab0d1..6e6b199 100644
--- a/src/corelib/arch/sparc/qatomic32.s
+++ b/src/corelib/arch/sparc/qatomic32.s
@@ -1,3 +1,43 @@
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!
+!! Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+!! Contact: Nokia Corporation (qt-info@nokia.com)
+!!
+!! This file is part of the QtGui module of the Qt Toolkit.
+!!
+!! $QT_BEGIN_LICENSE:LGPL$
+!! No Commercial Usage
+!! This file contains pre-release code and may not be distributed.
+!! You may use this file in accordance with the terms and conditions
+!! contained in the Technology Preview License Agreement accompanying
+!! this package.
+!!
+!! GNU Lesser General Public License Usage
+!! Alternatively, this file may be used under the terms of the GNU Lesser
+!! General Public License version 2.1 as published by the Free Software
+!! Foundation and appearing in the file LICENSE.LGPL included in the
+!! packaging of this file. Please review the following information to
+!! ensure the GNU Lesser General Public License version 2.1 requirements
+!! will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+!!
+!! In addition, as a special exception, Nokia gives you certain
+!! additional rights. These rights are described in the Nokia Qt LGPL
+!! Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+!! package.
+!!
+!! If you have questions regarding the use of this file, please contact
+!! Nokia at qt-info@nokia.com.
+!!
+!!
+!!
+!!
+!!
+!!
+!!
+!!
+!! $QT_END_LICENSE$
+!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.section ".text"
.align 4
diff --git a/src/corelib/arch/sparc/qatomic64.s b/src/corelib/arch/sparc/qatomic64.s
index edd1716..64560a0 100644
--- a/src/corelib/arch/sparc/qatomic64.s
+++ b/src/corelib/arch/sparc/qatomic64.s
@@ -1,3 +1,43 @@
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!
+!! Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+!! Contact: Nokia Corporation (qt-info@nokia.com)
+!!
+!! This file is part of the QtGui module of the Qt Toolkit.
+!!
+!! $QT_BEGIN_LICENSE:LGPL$
+!! No Commercial Usage
+!! This file contains pre-release code and may not be distributed.
+!! You may use this file in accordance with the terms and conditions
+!! contained in the Technology Preview License Agreement accompanying
+!! this package.
+!!
+!! GNU Lesser General Public License Usage
+!! Alternatively, this file may be used under the terms of the GNU Lesser
+!! General Public License version 2.1 as published by the Free Software
+!! Foundation and appearing in the file LICENSE.LGPL included in the
+!! packaging of this file. Please review the following information to
+!! ensure the GNU Lesser General Public License version 2.1 requirements
+!! will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+!!
+!! In addition, as a special exception, Nokia gives you certain
+!! additional rights. These rights are described in the Nokia Qt LGPL
+!! Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+!! package.
+!!
+!! If you have questions regarding the use of this file, please contact
+!! Nokia at qt-info@nokia.com.
+!!
+!!
+!!
+!!
+!!
+!!
+!!
+!!
+!! $QT_END_LICENSE$
+!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.section ".text"
.align 4
diff --git a/src/corelib/arch/x86_64/qatomic_sun.s b/src/corelib/arch/x86_64/qatomic_sun.s
index 37969e6..4517fe4 100644
--- a/src/corelib/arch/x86_64/qatomic_sun.s
+++ b/src/corelib/arch/x86_64/qatomic_sun.s
@@ -1,3 +1,43 @@
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!
+!! Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+!! Contact: Nokia Corporation (qt-info@nokia.com)
+!!
+!! This file is part of the QtGui module of the Qt Toolkit.
+!!
+!! $QT_BEGIN_LICENSE:LGPL$
+!! No Commercial Usage
+!! This file contains pre-release code and may not be distributed.
+!! You may use this file in accordance with the terms and conditions
+!! contained in the Technology Preview License Agreement accompanying
+!! this package.
+!!
+!! GNU Lesser General Public License Usage
+!! Alternatively, this file may be used under the terms of the GNU Lesser
+!! General Public License version 2.1 as published by the Free Software
+!! Foundation and appearing in the file LICENSE.LGPL included in the
+!! packaging of this file. Please review the following information to
+!! ensure the GNU Lesser General Public License version 2.1 requirements
+!! will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+!!
+!! In addition, as a special exception, Nokia gives you certain
+!! additional rights. These rights are described in the Nokia Qt LGPL
+!! Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+!! package.
+!!
+!! If you have questions regarding the use of this file, please contact
+!! Nokia at qt-info@nokia.com.
+!!
+!!
+!!
+!!
+!!
+!!
+!!
+!!
+!! $QT_END_LICENSE$
+!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.code64
.globl q_atomic_increment
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 935c99b..787eba7 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1189,6 +1189,7 @@ bool qSharedBuild()
\value SV_S60_3_2 S60 3rd Edition Feature Pack 2
\value SV_S60_5_0 S60 5th Edition
\value SV_S60_Unknown An unknown and currently unsupported platform
+ \omitvalue SV_S60_None
\sa SymbianVersion, WinVersion, MacVersion
*/
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index c34fc31..d279891 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1364,6 +1364,9 @@ inline void qt_noop() {}
#ifdef QT_BOOTSTRAPPED
# define QT_NO_EXCEPTIONS
#endif
+#if defined(Q_CC_GNU) && !defined (__EXCEPTIONS)
+# define QT_NO_EXCEPTIONS
+#endif
#ifdef QT_NO_EXCEPTIONS
# define QT_TRY if (true)
@@ -2161,7 +2164,7 @@ public:
inline bool operator!() const { return !i; }
- inline bool testFlag(Enum f) const { return (i & f) == f && (f != 0 || i == f ); }
+ inline bool testFlag(Enum f) const { return (i & f) == f && (f != 0 || i == int(f) ); }
};
#define Q_DECLARE_FLAGS(Flags, Enum)\
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index a6f5907..8f34e30 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -501,6 +501,8 @@ public:
WA_WState_AcceptedTouchBeginEvent = 122,
WA_TouchPadAcceptSingleTouchEvents = 123,
+ WA_DontUseStandardGestures = 124,
+
// Add new attributes before this line
WA_AttributeCount
};
@@ -1652,7 +1654,8 @@ public:
Pbuffer = 0x06, // GL pbuffer
FramebufferObject = 0x07, // GL framebuffer object
CustomRaster = 0x08,
- MacQuartz = 0x09
+ MacQuartz = 0x09,
+ PaintBuffer = 0x0a
};
enum RelayoutType {
RelayoutNormal,
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index ace70ff..06eea68 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -612,6 +612,12 @@
*/
/*!
+ \enum Qt::CoordinateSystem
+ \value DeviceCoordinates
+ \value LogicalCoordinates
+ */
+
+/*!
\enum Qt::CaseSensitivity
\value CaseInsensitive
@@ -1216,6 +1222,8 @@
\value WA_TouchPadAcceptSingleTouchEvents Allows touchpad single
touch events to be sent to the widget.
+ \value WA_DontUseStandardGestures Disables standard gestures on Qt widgets.
+
\omitvalue WA_SetLayoutDirection
\omitvalue WA_InputMethodTransparent
\omitvalue WA_WState_CompressKeys
diff --git a/src/corelib/io/qfile_p.h b/src/corelib/io/qfile_p.h
index f35cdeb..781c6d5 100644
--- a/src/corelib/io/qfile_p.h
+++ b/src/corelib/io/qfile_p.h
@@ -72,7 +72,6 @@ protected:
QString fileName;
mutable QAbstractFileEngine *fileEngine;
- bool isOpen;
bool lastWasWrite;
QRingBuffer writeBuffer;
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 5ff0716..a5ed95c 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -89,7 +89,8 @@ typedef INT_PTR intptr_t;
# define INVALID_FILE_ATTRIBUTES (DWORD (-1))
#endif
-#if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE)
+# if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE)
typedef struct _REPARSE_DATA_BUFFER {
ULONG ReparseTag;
USHORT ReparseDataLength;
@@ -115,8 +116,9 @@ typedef struct _REPARSE_DATA_BUFFER {
} GenericReparseBuffer;
};
} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
+# define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
+# endif // !defined(REPARSE_DATA_BUFFER_HEADER_SIZE)
-# define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
# ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE
# define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384
# endif
@@ -126,7 +128,7 @@ typedef struct _REPARSE_DATA_BUFFER {
# ifndef FSCTL_GET_REPARSE_POINT
# define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
# endif
-#endif
+#endif // !defined(Q_OS_WINCE)
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 75f8e54..ac9f532 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -122,7 +122,12 @@ void debugBinaryString(const char *data, qint64 maxlen)
*/
QIODevicePrivate::QIODevicePrivate()
: openMode(QIODevice::NotOpen), buffer(QIODEVICE_BUFFERSIZE),
- pos(0), devicePos(0), accessMode(Unset)
+ pos(0), devicePos(0)
+ , baseReadLineDataCalled(false)
+ , accessMode(Unset)
+#ifdef QT_NO_QOBJECT
+ , q_ptr(0)
+#endif
{
}
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 5b6830c..1e3b6eb 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1572,7 +1572,7 @@ void QProcess::setProcessEnvironment(const QProcessEnvironment &environment)
\note The environment settings are ignored on Windows CE,
as there is no concept of an environment.
- \sa setProcessEnvironment(), setEnvironment(), QProcessEnvironment::isValid()
+ \sa setProcessEnvironment(), setEnvironment(), QProcessEnvironment::isEmpty()
*/
QProcessEnvironment QProcess::processEnvironment() const
{
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index 48f34d6..fa3ed09 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -292,14 +292,20 @@ class QTemporaryFileEngine : public QFSFileEngine
Q_DECLARE_PRIVATE(QFSFileEngine)
public:
QTemporaryFileEngine(const QString &file, bool fileIsTemplate = true)
- : QFSFileEngine(file), filePathIsTemplate(fileIsTemplate)
+ : QFSFileEngine(), filePathIsTemplate(fileIsTemplate)
{
+ Q_D(QFSFileEngine);
+ d->filePath = file;
+
+ if (!filePathIsTemplate)
+ QFSFileEngine::setFileName(file);
}
~QTemporaryFileEngine();
bool isReallyOpen();
void setFileName(const QString &file);
+ void setFileTemplate(const QString &fileTemplate);
bool open(QIODevice::OpenMode flags);
bool remove();
@@ -336,6 +342,13 @@ void QTemporaryFileEngine::setFileName(const QString &file)
QFSFileEngine::setFileName(file);
}
+void QTemporaryFileEngine::setFileTemplate(const QString &fileTemplate)
+{
+ Q_D(QFSFileEngine);
+ if (filePathIsTemplate)
+ d->filePath = fileTemplate;
+}
+
bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode)
{
Q_D(QFSFileEngine);
@@ -382,12 +395,19 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode)
return false;
}
+ QString template_ = d->filePath;
d->filePath = QString::fromLocal8Bit(filename);
- filePathIsTemplate = false;
d->nativeInitFileName();
- d->closeFileHandle = true;
delete [] filename;
- return QFSFileEngine::open(openMode);
+
+ if (QFSFileEngine::open(openMode)) {
+ filePathIsTemplate = false;
+ return true;
+ }
+
+ d->filePath = template_;
+ d->nativeFilePath.clear();
+ return false;
#endif
}
@@ -533,7 +553,8 @@ QTemporaryFile::QTemporaryFile()
QTemporaryFile::QTemporaryFile(const QString &templateName)
: QFile(*new QTemporaryFilePrivate, 0)
{
- setFileTemplate(templateName);
+ Q_D(QTemporaryFile);
+ d->templateName = templateName;
}
/*!
@@ -567,7 +588,8 @@ QTemporaryFile::QTemporaryFile(QObject *parent)
QTemporaryFile::QTemporaryFile(const QString &templateName, QObject *parent)
: QFile(*new QTemporaryFilePrivate, parent)
{
- setFileTemplate(templateName);
+ Q_D(QTemporaryFile);
+ d->templateName = templateName;
}
#endif
@@ -671,10 +693,10 @@ QString QTemporaryFile::fileTemplate() const
*/
void QTemporaryFile::setFileTemplate(const QString &name)
{
- Q_ASSERT(!isOpen());
Q_D(QTemporaryFile);
- fileEngine()->setFileName(name);
d->templateName = name;
+ if (d->fileEngine)
+ static_cast<QTemporaryFileEngine*>(d->fileEngine)->setFileTemplate(name);
}
/*!
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 72388b5..c70804a 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -937,7 +937,7 @@ inline bool QTextStreamPrivate::putString(const QString &s, bool number)
// handle padding
int padSize = fieldWidth - s.size();
if (padSize > 0) {
- QString pad(padSize > 0 ? padSize : 0, padChar);
+ QString pad(padSize, padChar);
if (fieldAlignment == QTextStream::AlignLeft) {
tmp.append(QString(padSize, padChar));
} else if (fieldAlignment == QTextStream::AlignRight
diff --git a/src/corelib/io/qtextstream.h b/src/corelib/io/qtextstream.h
index c922833..d83455a 100644
--- a/src/corelib/io/qtextstream.h
+++ b/src/corelib/io/qtextstream.h
@@ -274,7 +274,7 @@ class Q_CORE_EXPORT QTextStreamManipulator
{
public:
QTextStreamManipulator(QTSMFI m, int a) { mf = m; mc = 0; arg = a; }
- QTextStreamManipulator(QTSMFC m, QChar c) { mf = 0; mc = m; ch = c; }
+ QTextStreamManipulator(QTSMFC m, QChar c) { mf = 0; mc = m; ch = c; arg = -1; }
void exec(QTextStream &s) { if (mf) { (s.*mf)(arg); } else { (s.*mc)(ch); } }
private:
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index 0a6c628..ec8fb76 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -601,7 +601,6 @@ void QAbstractItemModelPrivate::rowsInserted(const QModelIndex &parent,
void QAbstractItemModelPrivate::itemsAboutToBeMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation)
{
- Q_Q(QAbstractItemModel);
QVector<QPersistentModelIndexData *> persistent_moved_explicitly;
QVector<QPersistentModelIndexData *> persistent_moved_in_source;
QVector<QPersistentModelIndexData *> persistent_moved_in_destination;
@@ -2469,7 +2468,6 @@ void QAbstractItemModel::endRemoveRows()
*/
bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int start, int end, const QModelIndex &destinationParent, int destinationStart, Qt::Orientation orientation)
{
- Q_Q(QAbstractItemModel);
// Don't move the range within itself.
if ( ( destinationParent == srcParent )
&& ( destinationStart >= start )
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 30f1cc8..c311465 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -943,7 +943,7 @@ QByteArray QMetaObject::normalizedType(const char *type)
if (!type || !*type)
return result;
- QVarLengthArray<char> stackbuf((int)strlen(type));
+ QVarLengthArray<char> stackbuf(int(strlen(type)) + 1);
qRemoveWhitespace(type, stackbuf.data());
int templdepth = 0;
qNormalizeType(stackbuf.data(), templdepth, result);
@@ -968,10 +968,9 @@ QByteArray QMetaObject::normalizedSignature(const char *method)
if (!method || !*method)
return result;
int len = int(strlen(method));
- char stackbuf[64];
- char *buf = (len >= 64 ? new char[len+1] : stackbuf);
- qRemoveWhitespace(method, buf);
- char *d = buf;
+ QVarLengthArray<char> stackbuf(len + 1);
+ char *d = stackbuf.data();
+ qRemoveWhitespace(method, d);
result.reserve(len);
@@ -987,8 +986,6 @@ QByteArray QMetaObject::normalizedSignature(const char *method)
result += *d++;
}
- if (buf != stackbuf)
- delete [] buf;
return result;
}
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 4d9d3b2..c0c97b8 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -3364,10 +3364,10 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
&& (currentThreadData != sender->d_func()->threadData
|| receiver->d_func()->threadData != sender->d_func()->threadData))
|| (c->connectionType == Qt::QueuedConnection)) {
- queued_activate(sender, signal_absolute_index, c, argv);
+ queued_activate(sender, signal_absolute_index, c, argv ? argv : empty_argv);
continue;
} else if (c->connectionType == Qt::BlockingQueuedConnection) {
- blocking_activate(sender, signal_absolute_index, c, argv);
+ blocking_activate(sender, signal_absolute_index, c, argv ? argv : empty_argv);
continue;
}
@@ -3442,7 +3442,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
void QMetaObject::activate(QObject *sender, int signal_index, void **argv)
{
const QMetaObject *mo = sender->metaObject();
- while (mo && mo->methodOffset() > signal_index)
+ while (mo->methodOffset() > signal_index)
mo = mo->superClass();
activate(sender, mo, signal_index - mo->methodOffset(), argv);
}
@@ -3706,7 +3706,7 @@ void QObject::dumpObjectInfo()
const QMetaObject *mo = metaObject();
int signalOffset, methodOffset;
computeOffsets(mo, &signalOffset, &methodOffset);
- while (mo && signalOffset > signal_index) {
+ while (signalOffset > signal_index) {
mo = mo->superClass();
offsetToNextMetaObject = signalOffset;
computeOffsets(mo, &signalOffset, &methodOffset);
diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp
index e411681..f62577e 100644
--- a/src/corelib/kernel/qsharedmemory_unix.cpp
+++ b/src/corelib/kernel/qsharedmemory_unix.cpp
@@ -283,7 +283,6 @@ bool QSharedMemoryPrivate::detach()
// If there are no attachments then remove it.
if (shmid_ds.shm_nattch == 0) {
// mark for removal
- struct shmid_ds shmid_ds;
if (-1 == shmctl(id, IPC_RMID, &shmid_ds)) {
setErrorString(QLatin1String("QSharedMemory::remove"));
switch (errno) {
diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp
index ac2aac8..2fc6a58 100644
--- a/src/corelib/statemachine/qsignaltransition.cpp
+++ b/src/corelib/statemachine/qsignaltransition.cpp
@@ -249,17 +249,15 @@ void QSignalTransitionPrivate::callOnTransition(QEvent *e)
{
Q_Q(QSignalTransition);
- QSignalEvent *se = static_cast<QSignalEvent *>(e);
- int savedSignalIndex;
if (e->type() == QEvent::Signal) {
- savedSignalIndex = se->m_signalIndex;
+ QSignalEvent *se = static_cast<QSignalEvent *>(e);
+ int savedSignalIndex = se->m_signalIndex;
se->m_signalIndex = originalSignalIndex;
- }
-
- q->onTransition(e);
-
- if (e->type() == QEvent::Signal)
+ q->onTransition(e);
se->m_signalIndex = savedSignalIndex;
+ } else {
+ q->onTransition(e);
+ }
}
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 840f6a5..145b631 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -1467,8 +1467,19 @@ QByteArray &QByteArray::prepend(const QByteArray &ba)
QByteArray &QByteArray::prepend(const char *str)
{
+ return prepend(str, qstrlen(str));
+}
+
+/*!
+ \overload
+ \since 4.6
+
+ Prepends \a len bytes of the string \a str to this byte array.
+*/
+
+QByteArray &QByteArray::prepend(const char *str, int len)
+{
if (str) {
- int len = qstrlen(str);
if (d->ref != 1 || d->size + len > d->alloc)
realloc(qAllocMore(d->size + len, sizeof(Data)));
memmove(d->data+len, d->data, d->size);
@@ -1679,6 +1690,22 @@ QByteArray &QByteArray::insert(int i, const char *str)
/*!
\overload
+ \since 4.6
+
+ Inserts \a len bytes of the string \a str at position
+ \a i in the byte array.
+
+ If \a i is greater than size(), the array is first extended using
+ resize().
+*/
+
+QByteArray &QByteArray::insert(int i, const char *str, int len)
+{
+ return qbytearray_insert(this, i, str, len);
+}
+
+/*!
+ \overload
Inserts character \a ch at index position \a i in the byte array.
If \a i is greater than size(), the array is first extended using
@@ -4099,6 +4126,10 @@ QByteArray QByteArray::toPercentEncoding(const QByteArray &exclude, const QByteA
\internal
*/
+/*! \typedef QByteArray::value_type
+ \internal
+ */
+
/*!
\fn QByteArray::QByteArray(int size)
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index f7e790d..34dd44f 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -224,6 +224,7 @@ public:
QByteArray &prepend(char c);
QByteArray &prepend(const char *s);
+ QByteArray &prepend(const char *s, int len);
QByteArray &prepend(const QByteArray &a);
QByteArray &append(char c);
QByteArray &append(const char *s);
@@ -231,6 +232,7 @@ public:
QByteArray &append(const QByteArray &a);
QByteArray &insert(int i, char c);
QByteArray &insert(int i, const char *s);
+ QByteArray &insert(int i, const char *s, int len);
QByteArray &insert(int i, const QByteArray &a);
QByteArray &remove(int index, int len);
QByteArray &replace(int index, int len, const char *s);
diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h
index b369e53..8621908 100644
--- a/src/corelib/tools/qcache.h
+++ b/src/corelib/tools/qcache.h
@@ -131,7 +131,7 @@ private:
template <class Key, class T>
inline QCache<Key, T>::QCache(int amaxCost)
- : f(0), l(0), mx(amaxCost), total(0) {}
+ : f(0), l(0), unused(0), mx(amaxCost), total(0) {}
template <class Key, class T>
inline void QCache<Key,T>::clear()
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index ba8ae56..c2bdbee 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -52,6 +52,7 @@
#endif
#include <new>
+#include <string.h>
QT_BEGIN_HEADER
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index ded36c2..623d63e 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -636,6 +636,9 @@ static QString winSystemPMText()
return QString();
}
+/*!
+ Returns the fallback locale obtained from the system.
+ */
QLocale QSystemLocale::fallbackLocale() const
{
return QLocale(QString::fromLatin1(getWinLocaleName()));
diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp
index df08da1..747ea5e 100644
--- a/src/corelib/tools/qmargins.cpp
+++ b/src/corelib/tools/qmargins.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
\class QMargins
\ingroup painting
- \brief The QMargins
+ \brief The QMargins class defines the four margins of a rectangle.
QMargin defines a set of four margins; left, top, right and bottom,
that describe the size of the borders surrounding a rectangle.
@@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE
Constructs a margins object with all margins set to 0.
- \sa isValid()
+ \sa isNull()
*/
/*!
@@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE
Constructs margins with the given \a left, \a top, \a right, \a bottom
- \sa setWidth(), setHeight()
+ \sa setLeft(), setRight(), setTop(), setBottom()
*/
/*!
@@ -86,8 +86,6 @@ QT_BEGIN_NAMESPACE
Returns true if all margins are is 0; otherwise returns
false.
-
- \sa isValid(), isEmpty()
*/
diff --git a/src/corelib/tools/qmargins.h b/src/corelib/tools/qmargins.h
index be918cc..549c634 100644
--- a/src/corelib/tools/qmargins.h
+++ b/src/corelib/tools/qmargins.h
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
-class Q_CORE_EXPORT QMargins
+class QMargins
{
public:
QMargins();
@@ -68,11 +68,6 @@ public:
void setRight(int right);
void setBottom(int bottom);
- int &rleft();
- int &rtop();
- int &rright();
- int &rbottom();
-
private:
int m_left;
int m_top;
diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp
index 44238a8..7dcac71 100644
--- a/src/corelib/tools/qscopedpointer.cpp
+++ b/src/corelib/tools/qscopedpointer.cpp
@@ -219,4 +219,8 @@ QT_BEGIN_NAMESPACE
\sa isNull()
*/
+/*! \fn void QScopedPointer::swap(QScopedPointer<T, Cleanup> &other)
+ Swap this pointer with \a other.
+ */
+
QT_END_NAMESPACE
diff --git a/src/corelib/xml/make-parser.sh b/src/corelib/xml/make-parser.sh
index 0e2cbe1..e18dda3 100755
--- a/src/corelib/xml/make-parser.sh
+++ b/src/corelib/xml/make-parser.sh
@@ -1,4 +1,44 @@
#!/bin/sh
+#############################################################################
+##
+## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is the build configuration utility 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$
+##
+#############################################################################
me=$(dirname $0)
mkdir -p $me/out
diff --git a/src/corelib/xml/qxmlstream.g b/src/corelib/xml/qxmlstream.g
index b9659ba..39edcbc 100644
--- a/src/corelib/xml/qxmlstream.g
+++ b/src/corelib/xml/qxmlstream.g
@@ -37,9 +37,6 @@
--
-- $QT_END_LICENSE$
--
--- This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
--- WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
---
----------------------------------------------------------------------------
%parser QXmlStreamReader_Table
diff --git a/src/gui/accessible/qaccessible_mac_cocoa.mm b/src/gui/accessible/qaccessible_mac_cocoa.mm
index dd02f6c..9a50036 100644
--- a/src/gui/accessible/qaccessible_mac_cocoa.mm
+++ b/src/gui/accessible/qaccessible_mac_cocoa.mm
@@ -1,4 +1,3 @@
-
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
@@ -40,6 +39,7 @@
**
****************************************************************************/
+
#include "qaccessible.h"
#include "qaccessible_mac_p.h"
#include "qdebug.h"
diff --git a/src/gui/dialogs/qdialog_p.h b/src/gui/dialogs/qdialog_p.h
index 5239d09..a90d6e6 100644
--- a/src/gui/dialogs/qdialog_p.h
+++ b/src/gui/dialogs/qdialog_p.h
@@ -98,7 +98,7 @@ public:
#endif
#ifdef Q_WS_MAC
- virtual void mac_nativeDialogModalHelp(){};
+ virtual void mac_nativeDialogModalHelp() {}
#endif
int rescode;
diff --git a/src/gui/dialogs/qfiledialog_embedded.ui b/src/gui/dialogs/qfiledialog_embedded.ui
index 454af4b..1bd189e 100644
--- a/src/gui/dialogs/qfiledialog_embedded.ui
+++ b/src/gui/dialogs/qfiledialog_embedded.ui
@@ -37,9 +37,6 @@
**
** $QT_END_LICENSE$
**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
*********************************************************************</comment>
<class>QFileDialog</class>
<widget class="QDialog" name="QFileDialog" >
diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp
index 54e0046..cb19511 100644
--- a/src/gui/dialogs/qprintdialog_unix.cpp
+++ b/src/gui/dialogs/qprintdialog_unix.cpp
@@ -193,12 +193,12 @@ public:
description(desc),
selected(-1),
selDescription(0),
- parentItem(pi) {};
+ parentItem(pi) {}
~QOptionTreeItem() {
while (!childItems.isEmpty())
delete childItems.takeFirst();
- };
+ }
ItemType type;
int index;
@@ -238,8 +238,8 @@ class QPPDOptionsEditor : public QStyledItemDelegate
{
Q_OBJECT
public:
- QPPDOptionsEditor(QObject* parent = 0) : QStyledItemDelegate(parent) {};
- ~QPPDOptionsEditor() {};
+ QPPDOptionsEditor(QObject* parent = 0) : QStyledItemDelegate(parent) {}
+ ~QPPDOptionsEditor() {}
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const;
void setEditorData(QWidget* editor, const QModelIndex& index) const;
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index ccbf7fc..6629a6d 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -256,7 +256,8 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse
}
/*!
- Constructs a new QGraphicsEffect instance.
+ Constructs a new QGraphicsEffect instance having the
+ specified \a parent.
*/
QGraphicsEffect::QGraphicsEffect(QObject *parent)
: QObject(*new QGraphicsEffectPrivate, parent)
@@ -335,7 +336,7 @@ void QGraphicsEffect::setEnabled(bool enable)
d->isEnabled = enable;
if (d->source)
- d->source->update();
+ d->source->d_func()->effectBoundingRectChanged();
emit enabledChanged(enable);
}
@@ -349,6 +350,22 @@ void QGraphicsEffect::setEnabled(bool enable)
*/
/*!
+ Schedules a redraw of the source. Call this function whenever the source
+ needs to be redrawn.
+
+ This convenience function is equivalent to calling
+ QGraphicsEffectSource::update().
+
+ \sa updateBoundingRect(), QGraphicsEffectSource::update()
+*/
+void QGraphicsEffect::update()
+{
+ Q_D(QGraphicsEffect);
+ if (d->source)
+ d->source->update();
+}
+
+/*!
Returns a pointer to the source, which provides extra context information
that can be useful for the effect.
@@ -366,13 +383,15 @@ QGraphicsEffectSource *QGraphicsEffect::source() const
function whenever you change any parameters that will cause the virtual
boundingRectFor() function to return a different value.
+ This function will call update() if this is necessary.
+
\sa boundingRectFor(), boundingRect()
*/
void QGraphicsEffect::updateBoundingRect()
{
Q_D(QGraphicsEffect);
if (d->source)
- d->source->update();
+ d->source->d_func()->effectBoundingRectChanged();
}
/*!
@@ -523,6 +542,7 @@ void QGraphicsColorizeEffect::setColor(const QColor &color)
return;
d->filter->setColor(color);
+ update();
emit colorChanged(color);
}
@@ -610,6 +630,7 @@ void QGraphicsPixelizeEffect::setPixelSize(int size)
return;
d->pixelSize = size;
+ update();
emit pixelSizeChanged(size);
}
@@ -820,7 +841,7 @@ QGraphicsDropShadowEffect::~QGraphicsDropShadowEffect()
By default, the offset is 8 pixels towards the lower right.
- \sa blurRadius(), color()
+ \sa xOffset(), yOffset(), blurRadius(), color()
*/
QPointF QGraphicsDropShadowEffect::offset() const
{
@@ -840,6 +861,24 @@ void QGraphicsDropShadowEffect::setOffset(const QPointF &offset)
}
/*!
+ \property QGraphicsDropShadowEffect::xOffset
+ \brief the horizontal shadow offset in pixels.
+
+ By default, the horizontal shadow offset is 8 pixels.
+
+ \sa yOffset(), offset()
+*/
+
+/*!
+ \property QGraphicsDropShadowEffect::yOffset
+ \brief the vertical shadow offset in pixels.
+
+ By default, the vertical shadow offset is 8 pixels.
+
+ \sa xOffset(), offset()
+*/
+
+/*!
\fn void QGraphicsDropShadowEffect::offsetChanged(const QPointF &offset)
This signal is emitted whenever the effect's shadow offset changes.
@@ -903,6 +942,7 @@ void QGraphicsDropShadowEffect::setColor(const QColor &color)
return;
d->filter->setColor(color);
+ update();
emit colorChanged(color);
}
@@ -1012,6 +1052,7 @@ void QGraphicsOpacityEffect::setOpacity(qreal opacity)
d->isFullyOpaque = 0;
else
d->isFullyOpaque = qFuzzyIsNull(d->opacity - 1);
+ update();
emit opacityChanged(opacity);
}
@@ -1050,6 +1091,7 @@ void QGraphicsOpacityEffect::setOpacityMask(const QBrush &mask)
d->opacityMask = mask;
d->hasOpacityMask = (mask.style() != Qt::NoBrush);
+ update();
emit opacityMaskChanged(mask);
}
@@ -1088,19 +1130,20 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour
const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset);
painter->drawPixmap(offset, pixmap);
} else {
- QRectF srcBrect = source->boundingRect();
- QPixmap pixmap(srcBrect.size().toSize());
+ QRect srcBrect = source->boundingRect().toAlignedRect();
+ offset = srcBrect.topLeft();
+ QPixmap pixmap(srcBrect.size());
pixmap.fill(Qt::transparent);
QPainter pixmapPainter(&pixmap);
pixmapPainter.setRenderHints(painter->renderHints());
- pixmapPainter.translate(-srcBrect.topLeft());
+ pixmapPainter.translate(-offset);
source->draw(&pixmapPainter);
pixmapPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
pixmapPainter.fillRect(srcBrect, d->opacityMask);
pixmapPainter.end();
- painter->drawPixmap(srcBrect.topLeft(), pixmap);
+ painter->drawPixmap(offset, pixmap);
}
} else {
// Draw pixmap in device coordinates to avoid pixmap scaling;
diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h
index ca3f778..61aa21a 100644
--- a/src/gui/effects/qgraphicseffect.h
+++ b/src/gui/effects/qgraphicseffect.h
@@ -118,7 +118,7 @@ public:
public Q_SLOTS:
void setEnabled(bool enable);
- // ### add update() slot
+ void update();
Q_SIGNALS:
void enabledChanged(bool enabled);
@@ -237,6 +237,8 @@ class Q_GUI_EXPORT QGraphicsDropShadowEffect: public QGraphicsEffect
{
Q_OBJECT
Q_PROPERTY(QPointF offset READ offset WRITE setOffset NOTIFY offsetChanged)
+ Q_PROPERTY(qreal xOffset READ xOffset WRITE setXOffset NOTIFY offsetChanged)
+ Q_PROPERTY(qreal yOffset READ yOffset WRITE setYOffset NOTIFY offsetChanged)
Q_PROPERTY(int blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
public:
@@ -245,15 +247,31 @@ public:
QRectF boundingRectFor(const QRectF &rect) const;
QPointF offset() const;
+
+ inline qreal xOffset() const
+ { return offset().x(); }
+
+ inline qreal yOffset() const
+ { return offset().y(); }
+
int blurRadius() const;
QColor color() const;
public Q_SLOTS:
void setOffset(const QPointF &ofs);
+
inline void setOffset(qreal dx, qreal dy)
{ setOffset(QPointF(dx, dy)); }
+
inline void setOffset(qreal d)
{ setOffset(QPointF(d, d)); }
+
+ inline void setXOffset(qreal dx)
+ { setOffset(QPointF(dx, yOffset())); }
+
+ inline void setYOffset(qreal dy)
+ { setOffset(QPointF(xOffset(), dy)); }
+
void setBlurRadius(int blurRadius);
void setColor(const QColor &color);
diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h
index bfabfc0..24b605f 100644
--- a/src/gui/effects/qgraphicseffect_p.h
+++ b/src/gui/effects/qgraphicseffect_p.h
@@ -76,6 +76,7 @@ public:
virtual void update() = 0;
virtual bool isPixmap() const = 0;
virtual QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset = 0) const = 0;
+ virtual void effectBoundingRectChanged() = 0;
friend class QGraphicsScenePrivate;
friend class QGraphicsItem;
friend class QGraphicsItemPrivate;
diff --git a/src/gui/embedded/directfb.pri b/src/gui/embedded/directfb.pri
new file mode 100644
index 0000000..7dae9d5
--- /dev/null
+++ b/src/gui/embedded/directfb.pri
@@ -0,0 +1,39 @@
+# These defines might be necessary if your DirectFB driver doesn't
+# support all of the DirectFB API.
+#
+#DEFINES += QT_NO_DIRECTFB_SUBSURFACE
+#DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR
+#DEFINES += QT_NO_DIRECTFB_IMAGEPROVIDER
+#DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
+#DEFINES += QT_DIRECTFB_IMAGECACHE
+#DEFINES += QT_NO_DIRECTFB_WM
+#DEFINES += QT_NO_DIRECTFB_LAYER
+#DEFINES += QT_NO_DIRECTFB_PALETTE
+#DEFINES += QT_NO_DIRECTFB_PREALLOCATED
+#DEFINES += QT_NO_DIRECTFB_MOUSE
+#DEFINES += QT_NO_DIRECTFB_KEYBOARD
+#DEFINES += QT_DIRECTFB_TIMING
+#DEFINES += QT_NO_DIRECTFB_OPAQUE_DETECTION
+#DIRECTFB_DRAWINGOPERATIONS=DRAW_RECTS|DRAW_LINES|DRAW_IMAGE|DRAW_PIXMAP|DRAW_TILED_PIXMAP|STROKE_PATH|DRAW_PATH|DRAW_POINTS|DRAW_ELLIPSE|DRAW_POLYGON|DRAW_TEXT|FILL_PATH|FILL_RECT|DRAW_COLORSPANS
+#DEFINES += \"QT_DIRECTFB_WARN_ON_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
+#DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
+
+HEADERS += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h
+
+SOURCES += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
+
+
+QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB
+LIBS += $$QT_LIBS_DIRECTFB
diff --git a/src/gui/embedded/embedded.pri b/src/gui/embedded/embedded.pri
index 255a504..eb13d8d 100644
--- a/src/gui/embedded/embedded.pri
+++ b/src/gui/embedded/embedded.pri
@@ -139,6 +139,10 @@ embedded {
SOURCES += embedded/qscreentransformed_qws.cpp
}
+ contains( gfx-drivers, directfb ) {
+ INCLUDEPATH += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb
+ include($$PWD/directfb.pri)
+ }
#
# Keyboard drivers
#
diff --git a/src/gui/embedded/qscreendriverfactory_qws.cpp b/src/gui/embedded/qscreendriverfactory_qws.cpp
index 21058af..99ee8f2 100644
--- a/src/gui/embedded/qscreendriverfactory_qws.cpp
+++ b/src/gui/embedded/qscreendriverfactory_qws.cpp
@@ -51,7 +51,9 @@
#include <stdlib.h>
#include "private/qfactoryloader_p.h"
#include "qscreendriverplugin_qws.h"
-
+#ifndef QT_NO_QWS_DIRECTFB
+#include "qdirectfbscreen.h"
+#endif
#ifndef QT_NO_QWS_VNC
#include "qscreenvnc_qws.h"
#endif
@@ -118,6 +120,10 @@ QScreen *QScreenDriverFactory::create(const QString& key, int displayId)
if (driver == QLatin1String("linuxfb") || driver.isEmpty())
return new QLinuxFbScreen(displayId);
#endif
+#ifndef QT_NO_QWS_DIRECTFB
+ if (driver == QLatin1String("directfb") || driver.isEmpty())
+ return new QDirectFBScreen(displayId);
+#endif
#ifndef QT_NO_QWS_TRANSFORMED
if (driver == QLatin1String("transformed"))
return new QTransformedScreen(displayId);
@@ -130,7 +136,6 @@ QScreen *QScreenDriverFactory::create(const QString& key, int displayId)
if (driver == QLatin1String("multi"))
return new QMultiScreen(displayId);
#endif
-
#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
#ifndef QT_NO_LIBRARY
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index 8065526..871f009 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -525,23 +525,33 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP
endOfSequence = true;
}
}
- if (endOfSequence && candidates.count() >= 2) {
+ if (endOfSequence && candidates.count() >= 1) {
int i;
AnchorVertex *afterSequence= 0;
- QList<AnchorVertex *> adjacentOfSecondLastVertex = g.adjacentVertices(candidates.last());
- Q_ASSERT(adjacentOfSecondLastVertex.count() == 2);
- if (adjacentOfSecondLastVertex.first() == candidates.at(candidates.count() - 2))
- afterSequence = adjacentOfSecondLastVertex.last();
- else
- afterSequence = adjacentOfSecondLastVertex.first();
-
AnchorVertex *beforeSequence = 0;
- QList<AnchorVertex *> adjacentOfSecondVertex = g.adjacentVertices(candidates.first());
- Q_ASSERT(adjacentOfSecondVertex.count() == 2);
- if (adjacentOfSecondVertex.first() == candidates.at(1))
- beforeSequence = adjacentOfSecondVertex.last();
- else
- beforeSequence = adjacentOfSecondVertex.first();
+ // find the items before and after the valid sequence
+ if (candidates.count() == 1) {
+ QList<AnchorVertex *> beforeAndAfterVertices = g.adjacentVertices(candidates.at(0));
+ Q_ASSERT(beforeAndAfterVertices.count() == 2);
+ // Since we only have one vertex, we can pick
+ // any of the two vertices to become before/after.
+ afterSequence = beforeAndAfterVertices.last();
+ beforeSequence = beforeAndAfterVertices.first();
+ } else {
+ QList<AnchorVertex *> adjacentOfSecondLastVertex = g.adjacentVertices(candidates.last());
+ Q_ASSERT(adjacentOfSecondLastVertex.count() == 2);
+ if (adjacentOfSecondLastVertex.first() == candidates.at(candidates.count() - 2))
+ afterSequence = adjacentOfSecondLastVertex.last();
+ else
+ afterSequence = adjacentOfSecondLastVertex.first();
+
+ QList<AnchorVertex *> adjacentOfSecondVertex = g.adjacentVertices(candidates.first());
+ Q_ASSERT(adjacentOfSecondVertex.count() == 2);
+ if (adjacentOfSecondVertex.first() == candidates.at(1))
+ beforeSequence = adjacentOfSecondVertex.last();
+ else
+ beforeSequence = adjacentOfSecondVertex.first();
+ }
// The complete path of the sequence to simplify is: beforeSequence, <candidates>, afterSequence
// where beforeSequence and afterSequence are the endpoints where the anchor is inserted
// between.
@@ -583,34 +593,37 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP
// start and the end of the sequence. We never want to simplify internal
// center anchors where there is an external anchor connected to the center.
AnchorVertex *intervalVertexFrom = intervalFrom == 0 ? beforeSequence : candidates.at(intervalFrom - 1);
+ int effectiveIntervalFrom = intervalFrom;
if (intervalVertexFrom->m_edge == centerEdge
- && intervalVertexFrom->m_item == candidates.at(intervalFrom)->m_item) {
- ++intervalFrom;
- intervalVertexFrom = candidates.at(intervalFrom - 1);
+ && intervalVertexFrom->m_item == candidates.at(effectiveIntervalFrom)->m_item) {
+ ++effectiveIntervalFrom;
+ intervalVertexFrom = candidates.at(effectiveIntervalFrom - 1);
}
AnchorVertex *intervalVertexTo = intervalTo <= candidates.count() ? candidates.at(intervalTo - 1) : afterSequence;
+ int effectiveIntervalTo = intervalTo;
if (intervalVertexTo->m_edge == centerEdge
- && intervalVertexTo->m_item == candidates.at(intervalTo - 2)->m_item) {
- --intervalTo;
- intervalVertexTo = candidates.at(intervalTo - 1);
- }
-
- QVector<AnchorVertex*> subCandidates;
- if (forward) {
- subCandidates = candidates.mid(intervalFrom, intervalTo - intervalFrom - 1);
- } else {
- // reverse the order of the candidates.
- qSwap(intervalVertexFrom, intervalVertexTo);
- do {
- ++intervalFrom;
- subCandidates.prepend(candidates.at(intervalFrom - 1));
- } while (intervalFrom < intervalTo - 1);
+ && intervalVertexTo->m_item == candidates.at(effectiveIntervalTo - 2)->m_item) {
+ --effectiveIntervalTo;
+ intervalVertexTo = candidates.at(effectiveIntervalTo - 1);
}
- if (simplifySequentialChunk(&g, intervalVertexFrom, subCandidates, intervalVertexTo)) {
- dirty = true;
- break;
+ if (effectiveIntervalTo - effectiveIntervalFrom >= 2) {
+ QVector<AnchorVertex*> subCandidates;
+ if (forward) {
+ subCandidates = candidates.mid(effectiveIntervalFrom, effectiveIntervalTo - effectiveIntervalFrom - 1);
+ } else {
+ // reverse the order of the candidates.
+ qSwap(intervalVertexFrom, intervalVertexTo);
+ do {
+ ++effectiveIntervalFrom;
+ subCandidates.prepend(candidates.at(effectiveIntervalFrom - 1));
+ } while (effectiveIntervalFrom < effectiveIntervalTo - 1);
+ }
+ if (simplifySequentialChunk(&g, intervalVertexFrom, subCandidates, intervalVertexTo)) {
+ dirty = true;
+ break;
+ }
+ // finished simplification of chunk with same direction
}
- // finished simplification of chunk with same direction
}
if (forward == (prev == data->from))
--intervalTo;
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
index b64f787..098407c 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
@@ -170,7 +170,7 @@ struct AnchorData : public QSimplexVariable {
skipInPreferred(0), type(Normal), hasSize(false),
isLayoutAnchor(false) {}
- virtual void updateChildrenSizes() { };
+ virtual void updateChildrenSizes() {}
virtual void refreshSizeHints(qreal effectiveSpacing);
virtual ~AnchorData() {}
@@ -299,7 +299,7 @@ struct ParallelAnchorData : public AnchorData
class GraphPath
{
public:
- GraphPath() {};
+ GraphPath() {}
QSimplexConstraint *constraint(const GraphPath &path) const;
#ifdef QT_DEBUG
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 822c208..b7c2e26 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -198,20 +198,19 @@
\o hoverEnterEvent(), hoverMoveEvent(), and hoverLeaveEvent() handles
hover enter, move and leave events
\o inputMethodEvent() handles input events, for accessibility support
- \o keyPressEvent() and keyReleaseEvent handle key press and release events
+ \o keyPressEvent() and keyReleaseEvent() handle key press and release events
\o mousePressEvent(), mouseMoveEvent(), mouseReleaseEvent(), and
mouseDoubleClickEvent() handles mouse press, move, release, click and
doubleclick events
\endlist
- You can filter events for any other item by installing event
- filters. This functionaly is separate from from Qt's regular
- event filters (see QObject::installEventFilter()), which only
- work on subclasses of QObject. After installing your item as an
- event filter for another item by calling
- installSceneEventFilter(), the filtered events will be received
- by the virtual function sceneEventFilter(). You can remove item
- event filters by calling removeSceneEventFilter().
+ You can filter events for any other item by installing event filters. This
+ functionality is separate from Qt's regular event filters (see
+ QObject::installEventFilter()), which only work on subclasses of QObject. After
+ installing your item as an event filter for another item by calling
+ installSceneEventFilter(), the filtered events will be received by the virtual
+ function sceneEventFilter(). You can remove item event filters by calling
+ removeSceneEventFilter().
\section1 Custom Data
@@ -414,11 +413,11 @@
(same as transform()), and QGraphicsItem ignores the return value for this
notification (i.e., a read-only notification).
- \value ItemSelectedChange The item's selected state changes. If the item
- is presently selected, it will become unselected, and vice verca. The
- value argument is the new selected state (i.e., true or false). Do not
- call setSelected() in itemChange() as this notification is delivered();
- instead, you can return the new selected state from itemChange().
+ \value ItemSelectedChange The item's selected state changes. If the item is
+ presently selected, it will become unselected, and vice verca. The value
+ argument is the new selected state (i.e., true or false). Do not call
+ setSelected() in itemChange() as this notification is delivered; instead, you
+ can return the new selected state from itemChange().
\value ItemSelectedHasChanged The item's selected state has changed. The
value argument is the new selected state (i.e., true or false). Do not
@@ -10358,10 +10357,14 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
effectRect.setY(0);
}
// NB! We use +-1 for historical reasons (see QRect documentation).
- if (right + 1 > info->widget->width())
- effectRect.setRight(info->widget->width() - 1);
- if (bottom + 1 > info->widget->height())
- effectRect.setBottom(info->widget->height() -1);
+ QPaintDevice *device = info->painter->device();
+ const int deviceWidth = device->width();
+ const int deviceHeight = device->height();
+ if (right + 1 > deviceWidth)
+ effectRect.setRight(deviceWidth - 1);
+ if (bottom + 1 > deviceHeight)
+ effectRect.setBottom(deviceHeight -1);
+
}
if (effectRect.isEmpty())
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 1090620..1bf8993 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -517,17 +517,20 @@ struct QGraphicsItemPrivate::TransformData
return transform * *postmultiplyTransform;
}
- QMatrix4x4 x(transform);
- for (int i = 0; i < graphicsTransforms.size(); ++i)
- graphicsTransforms.at(i)->applyTo(&x);
+ QTransform x(transform);
+ if (!graphicsTransforms.isEmpty()) {
+ QMatrix4x4 m;
+ for (int i = 0; i < graphicsTransforms.size(); ++i)
+ graphicsTransforms.at(i)->applyTo(&m);
+ x *= m.toTransform();
+ }
x.translate(xOrigin, yOrigin);
- x.rotate(rotation, 0, 0, 1);
- x.scale(scale);
+ x.rotate(rotation);
+ x.scale(scale, scale);
x.translate(-xOrigin, -yOrigin);
- QTransform t = x.toTransform(); // project the 3D matrix back to 2D.
if (postmultiplyTransform)
- t *= *postmultiplyTransform;
- return t;
+ x *= *postmultiplyTransform;
+ return x;
}
};
@@ -572,6 +575,9 @@ public:
inline void update()
{ item->update(); }
+ inline void effectBoundingRectChanged()
+ { item->prepareGeometryChange(); }
+
inline bool isPixmap() const
{
return (item->type() == QGraphicsPixmapItem::Type);
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 2ac1dca..5dd71e2 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4616,7 +4616,8 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b
return;
}
- bool hasNoContents = item->d_ptr->flags & QGraphicsItem::ItemHasNoContents;
+ bool hasNoContents = item->d_ptr->flags & QGraphicsItem::ItemHasNoContents
+ && !item->d_ptr->graphicsEffect;
if (!hasNoContents) {
item->d_ptr->dirty = 1;
if (fullItemUpdate)
@@ -4706,11 +4707,15 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
return;
}
- const bool itemHasContents = !(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents);
+ bool itemHasContents = !(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents);
const bool itemHasChildren = !item->d_ptr->children.isEmpty();
- if (!itemHasContents && !itemHasChildren) {
- resetDirtyItem(item);
- return; // Item has neither contents nor children!(?)
+ if (!itemHasContents) {
+ if (!itemHasChildren) {
+ resetDirtyItem(item);
+ return; // Item has neither contents nor children!(?)
+ }
+ if (item->d_ptr->graphicsEffect)
+ itemHasContents = true;
}
const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity);
diff --git a/src/gui/graphicsview/qsimplex_p.h b/src/gui/graphicsview/qsimplex_p.h
index 9ee3863..eac74ac 100644
--- a/src/gui/graphicsview/qsimplex_p.h
+++ b/src/gui/graphicsview/qsimplex_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
struct QSimplexVariable
{
- QSimplexVariable() : result(0), index(0) {};
+ QSimplexVariable() : result(0), index(0) {}
qreal result;
uint index;
@@ -80,7 +80,7 @@ struct QSimplexVariable
*/
struct QSimplexConstraint
{
- QSimplexConstraint() : constant(0), ratio(Equal), artificial(0) {};
+ QSimplexConstraint() : constant(0), ratio(Equal), artificial(0) {}
enum Ratio {
LessOrEqual = 0,
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index eb3a33f..7c24002 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -17,7 +17,10 @@ x11:include(kernel/x11.pri)
mac:include(kernel/mac.pri)
win32:include(kernel/win.pri)
embedded:include(embedded/embedded.pri)
-symbian:include(kernel/symbian.pri)
+symbian {
+ include(kernel/symbian.pri)
+ include(s60framework/s60framework.pri)
+}
#modules
include(animation/animation.pri)
diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp
index 8c3b9be..b5ffeed 100644
--- a/src/gui/image/qbitmap.cpp
+++ b/src/gui/image/qbitmap.cpp
@@ -92,13 +92,15 @@ QT_BEGIN_NAMESPACE
\sa QPixmap, QImage, QImageReader, QImageWriter
*/
+/*! \typedef QBitmap::DataPtr
+ \internal
+ */
/*!
Constructs a null bitmap.
\sa QPixmap::isNull()
*/
-
QBitmap::QBitmap()
: QPixmap(QSize(0, 0), QPixmapData::BitmapType)
{
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index a4ea6af..1140cd8 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -879,21 +879,20 @@ void QIcon::setThemeSearchPaths(const QStringList &paths)
}
/*!
- \since 4.6
-
- Returns the search paths for icon themes.
+ \since 4.6
- The default value will depend on the platform:
+ Returns the search paths for icon themes.
- On X11, the search path will use the XDG_DATA_DIRS environment
- variable if available.
+ The default value will depend on the platform:
- On Windows the search path defaults to [Application Directory]/icons
+ On X11, the search path will use the XDG_DATA_DIRS environment
+ variable if available.
- On Mac the default search path will search in the
- [Contents/Resources/icons] part of the application bundle.
+ By default all platforms will have the resource directory
+ \c{:\icons} as a fallback. You can use "rcc -project" to generate a
+ resource file from your icon theme.
- \sa setThemeSearchPaths(), fromTheme(), setThemeName()
+ \sa setThemeSearchPaths(), fromTheme(), setThemeName()
*/
QStringList QIcon::themeSearchPaths()
{
@@ -906,7 +905,7 @@ QStringList QIcon::themeSearchPaths()
Sets the current icon theme to \a name.
The \a name should correspond to a directory name in the
- current themeSearchPath() containing an index.theme
+ themeSearchPath() containing an index.theme
file describing it's contents.
\sa themeSearchPaths(), themeName()
@@ -939,10 +938,6 @@ QString QIcon::themeName()
icon theme. If no such icon is found in the current theme
\a fallback is return instead.
- To use an icon theme on Windows or Mac, you will need to
- bundle a compliant theme with your application and make sure
- it is located in your themeSarchPaths.
-
The lastest version of the freedesktop icon specification and naming
spesification can be obtained here:
http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 279703c..cb1cc61 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -187,14 +187,17 @@ QStringList QIconLoader::themeSearchPaths() const
QDir homeDir(QDir::homePath() + QLatin1String("/.icons"));
if (homeDir.exists())
m_iconDirs.prepend(homeDir.path());
-
-#elif defined(Q_WS_WIN)
+#endif
+
+#if defined(Q_WS_WIN)
m_iconDirs.append(qApp->applicationDirPath() +
QLatin1String("/icons"));
#elif defined(Q_WS_MAC)
m_iconDirs.append(qApp->applicationDirPath() +
QLatin1String("/../Resources/icons"));
#endif
+ // Allways add resource directory as search path
+ m_iconDirs.append(QLatin1String(":/icons"));
}
return m_iconDirs;
}
diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h
index ba05a54..8c1cd4e 100644
--- a/src/gui/image/qiconloader_p.h
+++ b/src/gui/image/qiconloader_p.h
@@ -139,7 +139,7 @@ class QIconTheme
{
public:
QIconTheme(const QString &name);
- QIconTheme() : m_valid(false) {};
+ QIconTheme() : m_valid(false) {}
QStringList parents() { return m_parents; }
QList <QIconDirInfo> keyList() { return m_keyList; }
QString contentDir() { return m_contentDir; }
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 2b82f49..89af452 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -2892,6 +2892,12 @@ static void convert_Indexed8_to_X32(QImageData *dest, const QImageData *src, Qt:
Q_ASSERT(src->height == dest->height);
QVector<QRgb> colorTable = fix_color_table(src->colortable, dest->format);
+ if (colorTable.size() == 0) {
+ colorTable.resize(256);
+ for (int i=0; i<256; ++i)
+ colorTable[i] = qRgb(i, i, i);
+
+ }
int w = src->width;
const uchar *src_data = src->data;
diff --git a/src/gui/inputmethod/qinputcontext.cpp b/src/gui/inputmethod/qinputcontext.cpp
index 2422355..ed30810 100644
--- a/src/gui/inputmethod/qinputcontext.cpp
+++ b/src/gui/inputmethod/qinputcontext.cpp
@@ -176,7 +176,7 @@ QWidget *QInputContext::focusWidget() const
/*!
- Sets the widget that has an input focus for this input context.
+ Sets the \a widget that has an input focus for this input context.
\warning Ordinary input methods must not call this function
directly.
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 07c5454..ea98cb2 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -956,6 +956,7 @@ QModelIndex QAbstractItemView::currentIndex() const
void QAbstractItemView::reset()
{
Q_D(QAbstractItemView);
+ d->delayedReset.stop(); //make sure we stop the timer
QList<QEditorInfo>::const_iterator it = d->editors.constBegin();
for (; it != d->editors.constEnd(); ++it)
d->releaseEditor(it->editor);
@@ -2208,7 +2209,9 @@ void QAbstractItemView::timerEvent(QTimerEvent *event)
Q_D(QAbstractItemView);
if (event->timerId() == d->fetchMoreTimer.timerId())
d->fetchMore();
- if (event->timerId() == d->autoScrollTimer.timerId())
+ else if (event->timerId() == d->delayedReset.timerId())
+ reset();
+ else if (event->timerId() == d->autoScrollTimer.timerId())
doAutoScroll();
else if (event->timerId() == d->updateTimer.timerId())
d->updateDirtyRegion();
@@ -3132,9 +3135,8 @@ void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &, int, int)
*/
void QAbstractItemViewPrivate::_q_modelDestroyed()
{
- Q_Q(QAbstractItemView);
model = QAbstractItemModelPrivate::staticEmptyModel();
- QMetaObject::invokeMethod(q, "reset", Qt::QueuedConnection);
+ doDelayedReset();
}
/*!
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index 4517941..434d644 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -328,6 +328,15 @@ public:
QStyleOptionViewItemV4 viewOptionsV4() const;
+ void doDelayedReset()
+ {
+ //we delay the reset of the timer because some views (QTableView)
+ //with headers can't handle the fact that the model has been destroyed
+ //all _q_modelDestroyed slots must have been called
+ if (!delayedReset.isActive())
+ delayedReset.start(0, q_func());
+ }
+
QAbstractItemModel *model;
QPointer<QAbstractItemDelegate> itemDelegate;
QMap<int, QPointer<QAbstractItemDelegate> > rowDelegates;
@@ -389,6 +398,7 @@ public:
QBasicTimer updateTimer;
QBasicTimer delayedEditing;
QBasicTimer delayedAutoScroll; //used when an item is clicked
+ QBasicTimer delayedReset;
QAbstractItemView::ScrollMode verticalScrollMode;
QAbstractItemView::ScrollMode horizontalScrollMode;
diff --git a/src/gui/itemviews/qcolumnview_p.h b/src/gui/itemviews/qcolumnview_p.h
index 97def07..ca1d334 100644
--- a/src/gui/itemviews/qcolumnview_p.h
+++ b/src/gui/itemviews/qcolumnview_p.h
@@ -174,8 +174,8 @@ class QColumnViewDelegate : public QItemDelegate
{
public:
- explicit QColumnViewDelegate(QObject *parent = 0) : QItemDelegate(parent) {};
- ~QColumnViewDelegate() {};
+ explicit QColumnViewDelegate(QObject *parent = 0) : QItemDelegate(parent) {}
+ ~QColumnViewDelegate() {}
void paint(QPainter *painter,
const QStyleOptionViewItem &option,
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index 7d6439f..6a7b27c 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -622,6 +622,10 @@ void QTreeModel::ensureSorted(int column, Qt::SortOrder order,
QTreeWidgetItem *item = lst.takeAt(oldRow);
lit = sortedInsertionIterator(lit, lst.end(), order, item);
int newRow = qMax(lit - lst.begin(), 0);
+
+ if ((newRow < oldRow) && !(*item < *lst.at(oldRow - 1)))
+ newRow = oldRow;
+
lit = lst.insert(lit, item);
if (newRow != oldRow) {
// we are going to change the persistent indexes, so we need to prepare
@@ -2074,7 +2078,7 @@ void QTreeWidgetItemPrivate::sortChildren(int column, Qt::SortOrder order, bool
{
QTreeModel *model = (q->view ? qobject_cast<QTreeModel*>(q->view->model()) : 0);
if (!model)
- return;
+ return;
model->sortItems(&q->children, column, order);
if (climb) {
QList<QTreeWidgetItem*>::iterator it = q->children.begin();
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp
index d2a25fd..2a28c71 100644
--- a/src/gui/kernel/qaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -269,6 +269,26 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
MenuRole for the actions in that submenu have no effect. They will never be moved.
*/
+/*! \enum QAction::SoftKeyRole
+ \value OptionsSoftKey
+ \value SelectSoftKey
+ \value BackSoftKey
+ \value NextSoftKey
+ \value PreviousSoftKey
+ \value OkSoftKey
+ \value CancelSoftKey
+ \value EditSoftKey
+ \value ViewSoftKey
+ \value BackSpaceSoftKey
+ \value EndEditSoftKey
+ \value RevertEditSoftKey
+ \value DeselectSoftKey
+ \value FinishSoftKey
+ \value MenuSoftKey
+ \value ContextMenuSoftKey
+ \value ExitSoftKey
+ */
+
/*!
Constructs an action with \a parent. If \a parent is an action
group the action will be automatically inserted into the group.
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index f049a58..511c797 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -3625,6 +3625,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick:
d->toolTipFallAsleep.stop();
+ // fall-through
case QEvent::Leave:
d->toolTipWakeUp.stop();
default:
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index 92cf0f8..f1e3cb0 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -327,7 +327,7 @@ public:
{ if (replace) changeOverrideCursor(cursor); else setOverrideCursor(cursor); }
# endif
inline static QT3_SUPPORT bool hasGlobalMouseTracking() {return true;}
- inline static QT3_SUPPORT void setGlobalMouseTracking(bool) {};
+ inline static QT3_SUPPORT void setGlobalMouseTracking(bool) {}
inline static QT3_SUPPORT void flushX() { flush(); }
static inline QT3_SUPPORT void setWinStyleHighlightColor(const QColor &c) {
QPalette p(palette());
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 1bbf332..220b222 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -63,10 +63,13 @@
#include "apgwgnam.h" // For CApaWindowGroupName
#include <MdaAudioTonePlayer.h> // For CMdaAudioToneUtility
-#if !defined(QT_NO_IM) && defined(Q_WS_S60)
-#include "qinputcontext.h"
-#include <private/qcoefepinputcontext_p.h>
-#endif // !defined(QT_NO_IM) && defined(Q_WS_S60)
+#if defined(Q_WS_S60)
+# if !defined(QT_NO_IM)
+# include "qinputcontext.h"
+# include <private/qcoefepinputcontext_p.h>
+# endif
+# include <private/qs60mainapplication_p.h>
+#endif
#include "private/qstylesheetstyle_p.h"
@@ -347,21 +350,21 @@ void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, cons
QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons | Qt::RightButton;
QMouseEvent mEvent(QEvent::MouseButtonPress, alienWidget->mapFrom(qwidget, widgetPos), globalPos,
Qt::RightButton, QApplicationPrivate::mouse_buttons, Qt::NoModifier);
-
+
bool res = sendMouseEvent(alienWidget, &mEvent);
#if !defined(QT_NO_CONTEXTMENU)
QContextMenuEvent contextMenuEvent(QContextMenuEvent::Mouse, widgetPos, globalPos, mEvent.modifiers());
qt_sendSpontaneousEvent(alienWidget, &contextMenuEvent);
-#endif
-
+#endif
+
m_previousEventLongTap = true;
}
void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent)
{
m_longTapDetector->PointerEventL(pEvent);
- QT_TRYCATCH_LEAVING(HandlePointerEvent(pEvent));
+ QT_TRYCATCH_LEAVING(HandlePointerEvent(pEvent));
}
void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent)
@@ -396,15 +399,6 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent)
if (!alienWidget)
alienWidget = qwidget;
S60->mousePressTarget = alienWidget;
- //pointer grab
- SetGloballyCapturing(ETrue);
- SetPointerCapture(ETrue);
- }
- else if (type == QEvent::MouseButtonRelease)
- {
- //release pointer grab
- SetGloballyCapturing(EFalse);
- SetPointerCapture(EFalse);
}
alienWidget = S60->mousePressTarget;
@@ -724,6 +718,22 @@ TTypeUid::Ptr QSymbianControl::MopSupplyObject(TTypeUid id)
void qt_init(QApplicationPrivate * /* priv */, int)
{
+ if (!CCoeEnv::Static()) {
+ // The S60 framework has not been initalized. We need to do it.
+ TApaApplicationFactory factory(NewApplication);
+ CApaCommandLine* commandLine = 0;
+ TInt err = CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine);
+ // After this construction, CEikonEnv will be available from CEikonEnv::Static().
+ // (much like our qApp).
+ CEikonEnv* coe = new CEikonEnv;
+ QT_TRAP_THROWING(coe->ConstructAppFromCommandLineL(factory,*commandLine));
+ delete commandLine;
+
+ S60->qtOwnsS60Environment = true;
+ } else {
+ S60->qtOwnsS60Environment = false;
+ }
+
#ifdef QT_NO_DEBUG
if (!qgetenv("QT_S60_AUTO_FLUSH_WSERV").isEmpty())
#endif
@@ -775,6 +785,13 @@ void qt_cleanup()
// it dies.
delete QApplicationPrivate::inputContext;
QApplicationPrivate::inputContext = 0;
+
+ if (S60->qtOwnsS60Environment) {
+ CEikonEnv* coe = CEikonEnv::Static();
+ coe->PrepareToExit();
+ // The CEikonEnv itself is destroyed in here.
+ coe->DestroyEnvironment();
+ }
}
void QApplicationPrivate::initializeWidgetPaletteHash()
@@ -801,14 +818,27 @@ bool QApplicationPrivate::modalState()
void QApplicationPrivate::enterModal_sys(QWidget *widget)
{
+ if (widget) {
+ widget->effectiveWinId()->DrawableWindow()->FadeBehind(ETrue);
+ // Modal partial screen dialogs (like queries) capture pointer events.
+ // ### FixMe: Add specialized behaviour for fullscreen modal dialogs
+ widget->effectiveWinId()->SetGloballyCapturing(ETrue);
+ widget->effectiveWinId()->SetPointerCapture(ETrue);
+ }
if (!qt_modal_stack)
qt_modal_stack = new QWidgetList;
qt_modal_stack->insert(0, widget);
- app_do_modal = true;
+ app_do_modal = true;
}
void QApplicationPrivate::leaveModal_sys(QWidget *widget)
{
+ if (widget) {
+ widget->effectiveWinId()->DrawableWindow()->FadeBehind(EFalse);
+ // ### FixMe: Add specialized behaviour for fullscreen modal dialogs
+ widget->effectiveWinId()->SetGloballyCapturing(EFalse);
+ widget->effectiveWinId()->SetPointerCapture(EFalse);
+ }
if (qt_modal_stack && qt_modal_stack->removeAll(widget)) {
if (qt_modal_stack->isEmpty()) {
delete qt_modal_stack;
@@ -824,18 +854,31 @@ void QApplicationPrivate::openPopup(QWidget *popup)
QApplicationPrivate::popupWidgets = new QWidgetList;
QApplicationPrivate::popupWidgets->append(popup);
- if (QApplicationPrivate::popupWidgets->count() == 1 && !qt_nograb()) {
+
+ // Cancel focus widget pointer capture and long tap timer
+ if (QApplication::focusWidget()) {
+ static_cast<QSymbianControl*>(QApplication::focusWidget()->effectiveWinId())->CancelLongTapTimer();
+ QApplication::focusWidget()->effectiveWinId()->SetPointerCapture(false);
+ }
+
+ if (!qt_nograb()) {
+ // Cancel pointer capture and long tap timer for earlier popup
+ int popupCount = QApplicationPrivate::popupWidgets->count();
+ if (popupCount > 1) {
+ QWidget* prevPopup = QApplicationPrivate::popupWidgets->at(popupCount-2);
+ static_cast<QSymbianControl*>(prevPopup->effectiveWinId())->CancelLongTapTimer();
+ prevPopup->effectiveWinId()->SetPointerCapture(false);
+ }
+
+ // Enable pointer capture for this (topmost) popup
Q_ASSERT(popup->testAttribute(Qt::WA_WState_Created));
WId id = popup->effectiveWinId();
id->SetPointerCapture(true);
- id->SetGloballyCapturing(true);
}
// popups are not focus-handled by the window system (the first
// popup grabbed the keyboard), so we have to do that manually: A
// new popup gets the focus
- if (QApplication::focusWidget())
- static_cast<QSymbianControl*>(QApplication::focusWidget()->effectiveWinId())->CancelLongTapTimer();
QWidget *fw = popup->focusWidget();
if (fw) {
fw->setFocus(Qt::PopupFocusReason);
@@ -854,14 +897,16 @@ void QApplicationPrivate::closePopup(QWidget *popup)
return;
QApplicationPrivate::popupWidgets->removeAll(popup);
+ // Cancel pointer capture and long tap for this popup
+ WId id = popup->effectiveWinId();
+ id->SetPointerCapture(false);
+ static_cast<QSymbianControl*>(id)->CancelLongTapTimer();
+
if (QApplicationPrivate::popupWidgets->isEmpty()) { // this was the last popup
delete QApplicationPrivate::popupWidgets;
QApplicationPrivate::popupWidgets = 0;
if (!qt_nograb()) { // grabbing not disabled
Q_ASSERT(popup->testAttribute(Qt::WA_WState_Created));
- WId id = popup->effectiveWinId();
- id->SetPointerCapture(false);
- id->SetGloballyCapturing(false);
if (QWidgetPrivate::mouseGrabber != 0)
QWidgetPrivate::mouseGrabber->grabMouse();
@@ -880,6 +925,7 @@ void QApplicationPrivate::closePopup(QWidget *popup)
}
}
} else {
+
// popups are not focus-handled by the window system (the
// first popup grabbed the keyboard), so we have to do that
// manually: A popup was closed, so the previous popup gets
@@ -889,6 +935,11 @@ void QApplicationPrivate::closePopup(QWidget *popup)
QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason);
q_func()->sendEvent(fw, &e);
}
+
+ // Enable pointer capture for previous popup
+ if (aw) {
+ aw->effectiveWinId()->SetPointerCapture(true);
+ }
}
}
@@ -972,11 +1023,14 @@ void QApplication::beep()
beep=NULL;
}
-/*! \fn int QApplication::s60ProcessEvent(TWsEvent *event)
- This function does the core processing of individual s60
- \a{event}s. It returns 1 if the event was handled, 0 if
+/*!
+ \warning This function is only available on Symbian.
+
+ This function processes an individual Symbian window server
+ \a event. It returns 1 if the event was handled, 0 if
the \a event was not handled, and -1 if the event was
- not handled because the event handle was not in the map.
+ not handled because the event handle (\c{TWsEvent::Handle()})
+ is not known to Qt.
*/
int QApplication::s60ProcessEvent(TWsEvent *event)
{
@@ -1065,7 +1119,16 @@ int QApplication::s60ProcessEvent(TWsEvent *event)
}
/*!
- Returns false. Does nothing with the TWsEvent \a aEvent.
+ \warning This virtual function is only available on Symbian.
+
+ If you create an application that inherits QApplication and reimplement
+ this function, you get direct access to events that the are received
+ from the Symbian window server. The events are passed in the TWsEvent
+ \a aEvent parameter.
+
+ Return true if you want to stop the event from being processed. Return
+ false for normal event dispatching. The default implementation
+ false, and does nothing with \a aEvent.
*/
bool QApplication::s60EventFilter(TWsEvent * /* aEvent */)
{
@@ -1073,9 +1136,11 @@ bool QApplication::s60EventFilter(TWsEvent * /* aEvent */)
}
/*!
+ \warning This function is only available on Symbian.
+
Handles \a{command}s which are typically handled by
CAknAppUi::HandleCommandL(). Qts Ui integration into Symbian is
- partially achieved by deriving from CAknAppUi. Currently, exit,
+ partially achieved by deriving from CAknAppUi. Currently, exit,
menu and softkey commands are handled.
\sa s60EventFilter(), s60ProcessEvent()
@@ -1107,7 +1172,12 @@ void QApplication::symbianHandleCommand(int command)
}
/*!
+ \warning This function is only available on Symbian.
+
Handles the resource change specified by \a type.
+
+ Currently, KEikDynamicLayoutVariantSwitch and
+ KAknsMessageSkinChange are handled.
*/
void QApplication::symbianResourceChange(int type)
{
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index a3de120..84edf1f 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1903,11 +1903,9 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
QHideEvent e;
qt_sendSpontaneousEvent(widget, &e);
widget->hideChildren(true);
-#ifndef Q_WS_WINCE
const QString title = widget->windowIconText();
if (!title.isEmpty())
widget->setWindowTitle_helper(title);
-#endif
}
result = false;
break;
@@ -1926,11 +1924,9 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
widget->showChildren(true);
QShowEvent e;
qt_sendSpontaneousEvent(widget, &e);
-#ifndef Q_WS_WINCE
const QString title = widget->windowTitle();
if (!title.isEmpty())
widget->setWindowTitle_helper(title);
-#endif
}
result = false;
break;
@@ -1943,7 +1939,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
QWindowStateChangeEvent e(oldstate);
qt_sendSpontaneousEvent(widget, &e);
}
-#endif
+#endif // #ifndef Q_OS_WINCE
break;
}
@@ -2030,13 +2026,16 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
// WM_ACTIVATEAPP handles the "true" false case, as this is only when the application
// loses focus. Doing it here would result in the widget getting focus to not know
// where it got it from; it would simply get a 0 value as the old focus widget.
-#ifndef Q_WS_WINCE_WM
- if (!(widget->windowState() & Qt::WindowMinimized)) {
- // Ignore the activate message send by WindowsXP to a minimized window
-#else
+#ifdef Q_WS_WINCE
{
if (widget->windowState() & Qt::WindowMinimized)
widget->dataPtr()->window_state &= ~Qt::WindowMinimized;
+#else
+ if (!(widget->windowState() & Qt::WindowMinimized)) {
+#endif
+ // Ignore the activate message send by WindowsXP to a minimized window
+#ifdef Q_WS_WINCE_WM
+ {
if (widget->windowState() & Qt::WindowFullScreen)
qt_wince_hide_taskbar(widget->winId());
#endif
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 0056b9e..a7a6504 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -79,6 +79,7 @@
#include <private/qcolor_p.h>
#include <private/qcursor_p.h>
#include <private/qiconloader_p.h>
+#include <private/gtksymbols_p.h>
#include "qstyle.h"
#include "qmetaobject.h"
#include "qtimer.h"
@@ -2287,6 +2288,12 @@ void qt_init(QApplicationPrivate *priv, int,
if (X11->desktopEnvironment == DE_KDE)
X11->desktopVersion = QString::fromLocal8Bit(qgetenv("KDE_SESSION_VERSION")).toInt();
+#if !defined(QT_NO_STYLE_GTK)
+ if (X11->desktopEnvironment == DE_GNOME) {
+ static bool menusHaveIcons = QGtk::getGConfBool(QLatin1String("/desktop/gnome/interface/menus_have_icons"), true);
+ QApplication::setAttribute(Qt::AA_DontShowIconsInMenus, !menusHaveIcons);
+ }
+#endif
qt_set_input_encoding();
qt_set_x11_resources(appFont, appFGCol, appBGCol, appBTNCol);
diff --git a/src/gui/kernel/qcocoaapplication_mac.mm b/src/gui/kernel/qcocoaapplication_mac.mm
index ed62d02..2f1d88d 100644
--- a/src/gui/kernel/qcocoaapplication_mac.mm
+++ b/src/gui/kernel/qcocoaapplication_mac.mm
@@ -37,9 +37,6 @@
**
** $QT_END_LICENSE$
**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
****************************************************************************/
/****************************************************************************
diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
index cbf5cb6..b6aa454 100644
--- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
+++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
@@ -37,9 +37,6 @@
**
** $QT_END_LICENSE$
**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
****************************************************************************/
/****************************************************************************
diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm
index 1bdb123..14e4510 100644
--- a/src/gui/kernel/qcocoamenuloader_mac.mm
+++ b/src/gui/kernel/qcocoamenuloader_mac.mm
@@ -37,9 +37,6 @@
**
** $QT_END_LICENSE$
**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
****************************************************************************/
#include "qmacdefines_mac.h"
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index bc32078..59494a7 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -201,7 +201,6 @@ extern "C" {
composingText = new QString();
composing = false;
sendKeyEvents = true;
- inKeyDown = false;
currentCustomTypes = 0;
[self setHidden:YES];
return self;
@@ -1037,7 +1036,6 @@ extern "C" {
- (void)keyDown:(NSEvent *)theEvent
{
- inKeyDown = true;
sendKeyEvents = true;
QWidget *widgetToGetKey = qwidget;
@@ -1057,7 +1055,6 @@ extern "C" {
if (!keyOK && !sendToPopup)
[super keyDown:theEvent];
}
- inKeyDown = false;
}
@@ -1104,13 +1101,7 @@ extern "C" {
};
}
- if ([aString length] && !inKeyDown) {
- // Handle the case where insertText is called from somewhere else than the keyDown
- // implementation, for example when inserting text from the character palette.
- QInputMethodEvent e;
- e.setCommitString(commitText);
- qt_sendSpontaneousEvent(qwidget, &e);
- } else if ([aString length] && composing) {
+ if ([aString length] && composing) {
// Send the commit string to the widget.
composing = false;
sendKeyEvents = false;
diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h
index 9d4e3d0..3810a2b 100644
--- a/src/gui/kernel/qcocoaview_mac_p.h
+++ b/src/gui/kernel/qcocoaview_mac_p.h
@@ -86,7 +86,6 @@ Q_GUI_EXPORT
bool composing;
int composingLength;
bool sendKeyEvents;
- bool inKeyDown;
QString *composingText;
QStringList *currentCustomTypes;
NSInteger dragEnterSequence;
diff --git a/src/gui/kernel/qcocoawindow_mac.mm b/src/gui/kernel/qcocoawindow_mac.mm
index 59e8254..57dca6d 100644
--- a/src/gui/kernel/qcocoawindow_mac.mm
+++ b/src/gui/kernel/qcocoawindow_mac.mm
@@ -37,9 +37,6 @@
**
** $QT_END_LICENSE$
**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
****************************************************************************/
#include "qmacdefines_mac.h"
diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm
index 0a7a00f..6704fda 100644
--- a/src/gui/kernel/qcocoawindowdelegate_mac.mm
+++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm
@@ -37,9 +37,6 @@
**
** $QT_END_LICENSE$
**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
****************************************************************************/
#import "private/qcocoawindowdelegate_mac_p.h"
diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp
index d5e7167..7831893 100644
--- a/src/gui/kernel/qgesture.cpp
+++ b/src/gui/kernel/qgesture.cpp
@@ -133,21 +133,22 @@ private:
/*! \fn void QGesture::cancelled()
- The signal is emitted when the gesture is cancelled, 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.
+ The signal is emitted when the gesture is cancelled, 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.
*/
-
/*!
- Creates a new gesture handler object and marks it as a child of \a parent.
+ Creates a new gesture handler object and marks it as a child of \a
+ parent. \a gestureTarget is the object that the gesture will watch
+ for events.
- The \a parent object is also the default event source for the gesture,
- meaning that the gesture installs itself as an event filter for the \a
- parent.
+ The \a parent object is also the default event source for the
+ gesture, meaning that the gesture installs itself as an event filter
+ for the \a parent.
- \sa setGraphicsItem()
+ \sa setGraphicsItem()
*/
QGesture::QGesture(QObject *gestureTarget, QObject *parent)
: QObject(*new QGesturePrivate, parent)
@@ -173,7 +174,7 @@ QGesture::~QGesture()
/*!
\property QGesture::gestureTarget
- Gesture target is the object that the gesture will observe for events.
+ Gesture target is the object that the gesture will watch for events.
Typically this means that the gesture installs an event filter on the
target object.
*/
@@ -240,15 +241,18 @@ void QGesture::updateState(Qt::GestureState state)
return;
}
const Qt::GestureState oldState = d->state;
- d->state = state;
if (state != Qt::NoGesture && oldState > state) {
// comparing the state as ints: state should only be changed from
// started to (optionally) updated and to finished.
+ d->state = state;
qWarning("QGesture::updateState: incorrect new state");
return;
}
- if (oldState == Qt::NoGesture)
+ if (oldState == Qt::NoGesture) {
+ d->state = Qt::GestureStarted;
emit started();
+ }
+ d->state = state;
if (state == Qt::GestureUpdated)
emit triggered();
else if (state == Qt::GestureFinished)
diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h
index 2cfabef..ddca79e 100644
--- a/src/gui/kernel/qgesture_p.h
+++ b/src/gui/kernel/qgesture_p.h
@@ -70,7 +70,7 @@ class QGesturePrivate : public QObjectPrivate
public:
QGesturePrivate()
: gestureTarget(0), graphicsItem(0), eventFilterProxyGraphicsItem(0),
- state(Qt::NoGesture)
+ state(Qt::NoGesture), implicitGesture(false)
{
}
@@ -81,6 +81,9 @@ public:
QGraphicsItem *eventFilterProxyGraphicsItem;
Qt::GestureState state;
+
+ // the flag specifies if the gesture was created implicitely by Qt.
+ bool implicitGesture;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index cc30049..8e76715 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -47,6 +47,7 @@
#include <private/qapplication_p.h>
#include <private/qevent_p.h>
#include <private/qwidget_p.h>
+#include <qmath.h>
QT_BEGIN_NAMESPACE
@@ -90,9 +91,12 @@ QPanGesture::QPanGesture(QWidget *gestureTarget, QObject *parent)
void QPanGesturePrivate::setupGestureTarget(QObject *newGestureTarget)
{
Q_Q(QPanGesture);
+ QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
+
if (gestureTarget && gestureTarget->isWidgetType()) {
QWidget *w = static_cast<QWidget*>(gestureTarget.data());
- QApplicationPrivate::instance()->widgetGestures[w].pan = 0;
+ if (qAppPriv->widgetGestures[w].pan == q)
+ qAppPriv->widgetGestures[w].pan = 0;
#if defined(Q_WS_WIN)
qt_widget_private(w)->winSetupGestures();
#elif defined(Q_WS_MAC)
@@ -103,7 +107,7 @@ void QPanGesturePrivate::setupGestureTarget(QObject *newGestureTarget)
if (newGestureTarget && newGestureTarget->isWidgetType()) {
QWidget *w = static_cast<QWidget*>(newGestureTarget);
- QApplicationPrivate::instance()->widgetGestures[w].pan = q;
+ qAppPriv->widgetGestures[w].pan = q;
#if defined(Q_WS_WIN)
qt_widget_private(w)->winSetupGestures();
#elif defined(Q_WS_MAC)
@@ -133,8 +137,13 @@ bool QPanGesture::event(QEvent *event)
bool QPanGesture::eventFilter(QObject *receiver, QEvent *event)
{
-#ifdef Q_WS_WIN
Q_D(QPanGesture);
+
+ if (d->implicitGesture && d->gestureTarget && d->gestureTarget->isWidgetType() &&
+ static_cast<QWidget*>(d->gestureTarget.data())->testAttribute(Qt::WA_DontUseStandardGestures))
+ return false;
+
+#ifdef Q_WS_WIN
if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) {
QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event);
QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
@@ -164,11 +173,12 @@ bool QPanGesture::eventFilter(QObject *receiver, QEvent *event)
return false;
}
if (state() == Qt::NoGesture) {
- d->lastOffset = d->totalOffset = QSize();
+ d->lastOffset = d->totalOffset = d->offset = QSize();
} else {
- d->lastOffset = QSize(ev->position.x() - d->lastPosition.x(),
- ev->position.y() - d->lastPosition.y());
- d->totalOffset += d->lastOffset;
+ d->lastOffset = d->offset;
+ d->offset = QSize(ev->position.x() - d->lastPosition.x(),
+ ev->position.y() - d->lastPosition.y());
+ d->totalOffset += d->offset;
}
d->lastPosition = ev->position;
updateState(nextState);
@@ -181,23 +191,29 @@ bool QPanGesture::eventFilter(QObject *receiver, QEvent *event)
/*! \internal */
bool QPanGesture::filterEvent(QEvent *event)
{
-#if defined(Q_WS_WIN)
Q_D(QPanGesture);
+
+ if (d->implicitGesture && d->gestureTarget && d->gestureTarget->isWidgetType() &&
+ static_cast<QWidget*>(d->gestureTarget.data())->testAttribute(Qt::WA_DontUseStandardGestures))
+ return false;
+
+#if defined(Q_WS_WIN)
const QTouchEvent *ev = static_cast<const QTouchEvent*>(event);
if (event->type() == QEvent::TouchBegin) {
QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
d->lastPosition = p.pos().toPoint();
- d->lastOffset = d->totalOffset = QSize();
+ d->lastOffset = d->totalOffset = d->offset = QSize();
} else if (event->type() == QEvent::TouchEnd) {
if (state() != Qt::NoGesture) {
if (ev->touchPoints().size() == 2) {
QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0);
QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1);
- d->lastOffset =
+ d->lastOffset = d->offset;
+ d->offset =
QSize(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(),
p1.pos().y() - p1.lastPos().y() + p2.pos().y() - p2.lastPos().y()) / 2;
- d->totalOffset += d->lastOffset;
+ d->totalOffset += d->offset;
}
updateState(Qt::GestureFinished);
}
@@ -206,10 +222,11 @@ bool QPanGesture::filterEvent(QEvent *event)
if (ev->touchPoints().size() == 2) {
QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0);
QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1);
- d->lastOffset =
+ d->lastOffset = d->offset;
+ d->offset =
QSize(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(),
p1.pos().y() - p1.lastPos().y() + p2.pos().y() - p2.lastPos().y()) / 2;
- d->totalOffset += d->lastOffset;
+ d->totalOffset += d->offset;
if (d->totalOffset.width() > 10 || d->totalOffset.height() > 10 ||
d->totalOffset.width() < -10 || d->totalOffset.height() < -10) {
updateState(Qt::GestureUpdated);
@@ -219,7 +236,6 @@ bool QPanGesture::filterEvent(QEvent *event)
#elif defined(QT_MAC_USE_COCOA)
// The following implements single touch
// panning on Mac:
- Q_D(QPanGesture);
const int panBeginDelay = 300;
const int panBeginRadius = 3;
const QTouchEvent *ev = static_cast<const QTouchEvent*>(event);
@@ -252,8 +268,9 @@ bool QPanGesture::filterEvent(QEvent *event)
QPointF mousePos = QCursor::pos();
QPointF dist = mousePos - d->lastPosition;
d->lastPosition = mousePos;
- d->lastOffset = QSizeF(dist.x(), dist.y());
- d->totalOffset += d->lastOffset;
+ d->lastOffset = d->offset;
+ d->offset = QSizeF(dist.x(), dist.y());
+ d->totalOffset += d->offset;
updateState(Qt::GestureUpdated);
}
} else if (state() == Qt::NoGesture) {
@@ -273,7 +290,7 @@ bool QPanGesture::filterEvent(QEvent *event)
void QPanGesture::reset()
{
Q_D(QPanGesture);
- d->lastOffset = d->totalOffset = QSize(0, 0);
+ d->lastOffset = d->totalOffset = d->offset = QSize(0, 0);
d->lastPosition = QPoint(0, 0);
#if defined(QT_MAC_USE_COCOA)
@@ -298,8 +315,7 @@ QSizeF QPanGesture::totalOffset() const
/*!
\property QPanGesture::lastOffset
- Specifies a pan offset since the last time the gesture was
- triggered.
+ Specifies a pan offset the last time the gesture was triggered.
*/
QSizeF QPanGesture::lastOffset() const
{
@@ -307,6 +323,18 @@ QSizeF QPanGesture::lastOffset() const
return d->lastOffset;
}
+/*!
+ \property QPanGesture::offset
+
+ Specifies the current pan offset since the last time the gesture was
+ triggered.
+*/
+QSizeF QPanGesture::offset() const
+{
+ Q_D(const QPanGesture);
+ return d->offset;
+}
+
//////////////////////////////////////////////////////////////////////////////
/*!
@@ -360,8 +388,13 @@ bool QPinchGesture::event(QEvent *event)
bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event)
{
-#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
Q_D(QPinchGesture);
+
+ if (d->implicitGesture && d->gestureTarget && d->gestureTarget->isWidgetType() &&
+ static_cast<QWidget*>(d->gestureTarget.data())->testAttribute(Qt::WA_DontUseStandardGestures))
+ return false;
+
+#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) {
QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event);
#if defined(Q_WS_WIN)
@@ -380,39 +413,80 @@ bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event)
// next we might receive the first gesture update event, so we
// prepare for it.
d->state = Qt::NoGesture;
- d->scaleFactor = d->lastScaleFactor = 1;
- d->rotationAngle = d->lastRotationAngle = 0;
+ d->changes = 0;
+ d->totalScaleFactor = d->scaleFactor = d->lastScaleFactor = 1.;
+ d->totalRotationAngle = d->rotationAngle = d->lastRotationAngle = 0.;
d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPointF();
#if defined(Q_WS_WIN)
d->initialDistance = 0;
+ d->lastSequenceId = ev->sequenceId;
#endif
return false;
- case QNativeGestureEvent::Rotate:
- d->scaleFactor = 0;
+ case QNativeGestureEvent::Rotate: {
+ d->lastScaleFactor = d->scaleFactor;
d->lastRotationAngle = d->rotationAngle;
-#if defined(Q_WS_WIN)
- d->rotationAngle = -1 * GID_ROTATE_ANGLE_FROM_ARGUMENT(ev->argument);
-#elif defined(Q_WS_MAC)
- d->rotationAngle = ev->percentage;
-#endif
+#if defined(Q_WS_MAC)
+ d->rotationAngle += ev->percentage;
nextState = Qt::GestureUpdated;
+#elif defined(Q_WS_WIN)
+ // This is a workaround for an issue with the native rotation
+ // gesture on Windows 7. For some reason the rotation angle in the
+ // first WM_GESTURE message in a sequence contains value that is
+ // off a little bit and causes the rotating item to "jump", so
+ // we just ignore the first WM_GESTURE in every sequence.
+ bool windowsRotateWorkaround = false;
+ if (!d->lastSequenceId) {
+ windowsRotateWorkaround = true;
+ d->lastSequenceId = ev->sequenceId;
+ }
+ if (d->lastSequenceId > 0 && d->lastSequenceId != (ulong)-1 && ev->sequenceId != d->lastSequenceId) {
+ // this is the first WM_GESTURE message in a sequence.
+ d->totalRotationAngle += d->rotationAngle;
+ windowsRotateWorkaround = true;
+ // a magic value to mark that the next WM_GESTURE message is
+ // the second message in a sequence and we should clear the
+ // lastRotationAngle
+ d->lastSequenceId = (ulong)-1;
+ }
+ if (!windowsRotateWorkaround) {
+ d->rotationAngle = -1 * GID_ROTATE_ANGLE_FROM_ARGUMENT(ev->argument) * 180. / M_PI;
+ if (d->lastSequenceId == (ulong)-1) {
+ // a special case since we need to set the lastRotationAngle to
+ // rotationAngle when the first WM_GESTURE is received in each
+ // sequence.
+ d->lastRotationAngle = d->rotationAngle;
+ }
+ d->lastSequenceId = ev->sequenceId;
+ }
+ if (!windowsRotateWorkaround)
+ nextState = Qt::GestureUpdated;
+#endif
+ d->changes = QPinchGesture::RotationAngleChanged;
event->accept();
break;
+ }
case QNativeGestureEvent::Zoom:
- d->rotationAngle = 0;
+ d->lastRotationAngle = d->rotationAngle;
+ d->lastScaleFactor = d->scaleFactor;
#if defined(Q_WS_WIN)
if (d->initialDistance != 0) {
- d->lastScaleFactor = d->scaleFactor;
int distance = int(qint64(ev->argument));
- d->scaleFactor = (qreal) distance / d->initialDistance;
+ if (d->lastSequenceId && ev->sequenceId != d->lastSequenceId) {
+ d->totalScaleFactor *= d->scaleFactor;
+ d->initialDistance = int(qint64(ev->argument));
+ d->lastScaleFactor = d->scaleFactor = (qreal) distance / d->initialDistance;
+ } else {
+ d->scaleFactor = (qreal) distance / d->initialDistance;
+ }
+ d->lastSequenceId = ev->sequenceId;
} else {
d->initialDistance = int(qint64(ev->argument));
}
#elif defined(Q_WS_MAC)
- d->lastScaleFactor = d->scaleFactor;
- d->scaleFactor = ev->percentage;
+ d->scaleFactor += ev->percentage;
#endif
nextState = Qt::GestureUpdated;
+ d->changes = QPinchGesture::ScaleFactorChanged;
event->accept();
break;
case QNativeGestureEvent::GestureEnd:
@@ -427,6 +501,8 @@ bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event)
d->startCenterPoint = d->centerPoint;
d->lastCenterPoint = d->centerPoint;
d->centerPoint = static_cast<QWidget*>(receiver)->mapFromGlobal(ev->position);
+ if (d->lastCenterPoint != d->centerPoint)
+ d->changes |= QPinchGesture::CenterPointChanged;
updateState(nextState);
return true;
}
@@ -438,6 +514,12 @@ bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event)
/*! \internal */
bool QPinchGesture::filterEvent(QEvent *event)
{
+ Q_D(QPinchGesture);
+
+ if (d->implicitGesture && d->gestureTarget && d->gestureTarget->isWidgetType() &&
+ static_cast<QWidget*>(d->gestureTarget.data())->testAttribute(Qt::WA_DontUseStandardGestures))
+ return false;
+
Q_UNUSED(event);
return false;
}
@@ -446,16 +528,44 @@ bool QPinchGesture::filterEvent(QEvent *event)
void QPinchGesture::reset()
{
Q_D(QPinchGesture);
- d->scaleFactor = d->lastScaleFactor = 0;
- d->rotationAngle = d->lastRotationAngle = 0;
+ d->changes = 0;
+ d->totalScaleFactor = d->scaleFactor = d->lastScaleFactor = 1.;
+ d->totalRotationAngle = d->rotationAngle = d->lastRotationAngle = 0.;
d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPointF();
QGesture::reset();
}
/*!
+ \property QPinchGesture::whatChanged
+
+ Specifies which values were changed in the gesture.
+*/
+QPinchGesture::WhatChanged QPinchGesture::whatChanged() const
+{
+ return d_func()->changes;
+}
+
+/*!
+ \property QPinchGesture::totalScaleFactor
+
+ Specifies a total scale factor of the pinch gesture since the gesture
+ started.
+*/
+qreal QPinchGesture::totalScaleFactor() const
+{
+ Q_D(const QPinchGesture);
+ return d->totalScaleFactor * d->scaleFactor;
+}
+
+/*!
\property QPinchGesture::scaleFactor
Specifies a scale factor of the pinch gesture.
+
+ If the gesture consists of several pinch sequences (i.e. zoom and rotate
+ sequences), then this property specifies the scale factor in the current
+ sequence. When pinching changes the rotation angle only, the value of this
+ property is 1.
*/
qreal QPinchGesture::scaleFactor() const
{
@@ -473,9 +583,29 @@ qreal QPinchGesture::lastScaleFactor() const
}
/*!
+ \property QPinchGesture::totalRotationAngle
+
+ Specifies a total rotation angle of the gesture since the gesture started.
+
+ The angle is specified in degrees.
+*/
+qreal QPinchGesture::totalRotationAngle() const
+{
+ Q_D(const QPinchGesture);
+ return d->totalRotationAngle + d->rotationAngle;
+}
+
+/*!
\property QPinchGesture::rotationAngle
Specifies a rotation angle of the gesture.
+
+ If the gesture consists of several pinch sequences (i.e. zoom and rotate
+ sequences), then this property specifies the rotation angle in the current
+ sequence. When pinching changes the scale factor only, the value of this
+ property is 0.
+
+ The angle is specified in degrees.
*/
qreal QPinchGesture::rotationAngle() const
{
@@ -486,6 +616,8 @@ qreal QPinchGesture::rotationAngle() const
\property QPinchGesture::lastRotationAngle
Specifies a previous rotation angle of the gesture.
+
+ The angle is specified in degrees.
*/
qreal QPinchGesture::lastRotationAngle() const
{
diff --git a/src/gui/kernel/qstandardgestures.h b/src/gui/kernel/qstandardgestures.h
index bb6f3b6..53c4416 100644
--- a/src/gui/kernel/qstandardgestures.h
+++ b/src/gui/kernel/qstandardgestures.h
@@ -61,6 +61,7 @@ class Q_GUI_EXPORT QPanGesture : public QGesture
Q_PROPERTY(QSizeF totalOffset READ totalOffset)
Q_PROPERTY(QSizeF lastOffset READ lastOffset)
+ Q_PROPERTY(QSizeF offset READ offset)
public:
QPanGesture(QWidget *gestureTarget, QObject *parent = 0);
@@ -69,6 +70,7 @@ public:
QSizeF totalOffset() const;
QSizeF lastOffset() const;
+ QSizeF offset() const;
protected:
void reset();
@@ -78,6 +80,7 @@ private:
bool eventFilter(QObject *receiver, QEvent *event);
friend class QWidget;
+ friend class QAbstractScrollAreaPrivate;
};
class QPinchGesturePrivate;
@@ -86,31 +89,48 @@ class Q_GUI_EXPORT QPinchGesture : public QGesture
Q_OBJECT
Q_DECLARE_PRIVATE(QPinchGesture)
- Q_PROPERTY(qreal scaleFactor READ scaleFactor)
+public:
+ enum WhatChange {
+ ScaleFactorChanged = 0x1,
+ RotationAngleChanged = 0x2,
+ CenterPointChanged = 0x4
+ };
+ Q_DECLARE_FLAGS(WhatChanged, WhatChange)
+
+ Q_PROPERTY(WhatChanged whatChanged READ whatChanged)
+
+ Q_PROPERTY(qreal totalScaleFactor READ totalScaleFactor)
Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor)
+ Q_PROPERTY(qreal scaleFactor READ scaleFactor)
- Q_PROPERTY(qreal rotationAngle READ rotationAngle)
+ Q_PROPERTY(qreal totalRotationAngle READ totalRotationAngle)
Q_PROPERTY(qreal lastRotationAngle READ lastRotationAngle)
+ Q_PROPERTY(qreal rotationAngle READ rotationAngle)
Q_PROPERTY(QPointF startCenterPoint READ startCenterPoint)
Q_PROPERTY(QPointF lastCenterPoint READ lastCenterPoint)
Q_PROPERTY(QPointF centerPoint READ centerPoint)
public:
+
QPinchGesture(QWidget *gestureTarget, QObject *parent = 0);
bool filterEvent(QEvent *event);
void reset();
+ WhatChanged whatChanged() const;
+
QPointF startCenterPoint() const;
QPointF lastCenterPoint() const;
QPointF centerPoint() const;
- qreal scaleFactor() const;
+ qreal totalScaleFactor() const;
qreal lastScaleFactor() const;
+ qreal scaleFactor() const;
- qreal rotationAngle() const;
+ qreal totalRotationAngle() const;
qreal lastRotationAngle() const;
+ qreal rotationAngle() const;
private:
bool event(QEvent *event);
diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h
index 270f307..354ebee 100644
--- a/src/gui/kernel/qstandardgestures_p.h
+++ b/src/gui/kernel/qstandardgestures_p.h
@@ -74,6 +74,7 @@ public:
QSizeF totalOffset;
QSizeF lastOffset;
+ QSizeF offset;
QPointF lastPosition;
#if defined(QT_MAC_USE_COCOA)
@@ -88,25 +89,32 @@ class QPinchGesturePrivate : public QGesturePrivate
public:
QPinchGesturePrivate()
- : scaleFactor(0), lastScaleFactor(0),
- rotationAngle(0), lastRotationAngle(0)
+ : changes(0), totalScaleFactor(0.), lastScaleFactor(0.), scaleFactor(0.),
+ totalRotationAngle(0.), lastRotationAngle(0.), rotationAngle(0.)
#ifdef Q_WS_WIN
- ,initialDistance(0)
+ ,initialDistance(0), lastSequenceId(0)
#endif
{
}
void setupGestureTarget(QObject *o);
- qreal scaleFactor;
+ QPinchGesture::WhatChanged changes;
+
+ qreal totalScaleFactor; // total scale factor, excluding the current sequence.
qreal lastScaleFactor;
- qreal rotationAngle;
+ qreal scaleFactor; // scale factor in the current sequence.
+
+ qreal totalRotationAngle; // total rotation angle, excluding the current sequence.
qreal lastRotationAngle;
+ qreal rotationAngle; // rotation angle in the current sequence.
+
QPointF startCenterPoint;
QPointF lastCenterPoint;
QPointF centerPoint;
#ifdef Q_WS_WIN
int initialDistance;
+ ulong lastSequenceId;
#endif
};
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 78301af..ea1ca69 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -95,6 +95,7 @@ public:
int screenHeightInTwips;
int defaultDpiX;
int defaultDpiY;
+ int qtOwnsS60Environment : 1;
static inline void updateScreenSize();
static inline RWsSession& wsSession();
static inline RWindowGroup& windowGroup();
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 37ffa8fb..44f9db1 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -82,8 +82,6 @@
#include "private/qstyle_p.h"
#include "private/qinputcontext_p.h"
#include "qfileinfo.h"
-#include "qstandardgestures.h"
-#include "qstandardgestures_p.h"
#if defined (Q_WS_WIN)
# include <private/qwininputcontext_p.h>
@@ -5962,6 +5960,8 @@ bool QWidget::hasFocus() const
isActiveWindow() active window\endlink. The \a reason argument will
be passed into any focus event sent from this function, it is used
to give an explanation of what caused the widget to get focus.
+ If the window is not active, the widget will be given the focus when
+ the window becomes active.
First, a focus out event is sent to the focus widget (if any) to
tell it that it is about to lose the focus. Then a focus in event
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index f398dbd..284558f 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -830,7 +830,7 @@ public:
inline QT3_SUPPORT void setFont(const QFont &f, bool) { setFont(f); }
inline QT3_SUPPORT void setPalette(const QPalette &p, bool) { setPalette(p); }
enum BackgroundOrigin { WidgetOrigin, ParentOrigin, WindowOrigin, AncestorOrigin };
- inline QT3_SUPPORT void setBackgroundOrigin(BackgroundOrigin){};
+ inline QT3_SUPPORT void setBackgroundOrigin(BackgroundOrigin) {}
inline QT3_SUPPORT BackgroundOrigin backgroundOrigin() const { return WindowOrigin; }
inline QT3_SUPPORT QPoint backgroundOffset() const { return QPoint(); }
inline QT3_SUPPORT void repaint(bool) { repaint(); }
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index ff0c453..f69c3a7 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -727,6 +727,16 @@ public:
inline bool isPixmap() const
{ return false; }
+ inline void effectBoundingRectChanged()
+ {
+ // ### This function should take a rect parameter; then we can avoid
+ // updating too much on the parent widget.
+ if (QWidget *parent = m_widget->parentWidget())
+ parent->update();
+ else
+ m_widget->update();
+ }
+
inline const QStyleOption *styleOption() const
{ return 0; }
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 6da35d8..d630143 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -722,7 +722,9 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
// The API to get title_pane graphics size is not public -> assume square space based
// on titlebar font height. CAknBitmap would be optimum, wihtout setting the size, since
// then title pane would automatically scale the bitmap. Unfortunately it is not public API
- const CFont * font = AknLayoutUtils::FontFromId(EAknLogicalFontTitleFont);
+ // Also this function is leaving, although it is not named as such.
+ const CFont * font;
+ QT_TRAP_THROWING(font = AknLayoutUtils::FontFromId(EAknLogicalFontTitleFont));
TSize iconSize(font->HeightInPixels(), font->HeightInPixels());
QIcon icon = q->windowIcon();
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 8e60fb3..0ec7e7e 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -2062,29 +2062,21 @@ void QWidgetPrivate::registerTouchWindow()
void QWidgetPrivate::winSetupGestures()
{
Q_Q(QWidget);
- if (!q)
- return;
- if (!q->isVisible())
+ if (!q || !q->isVisible())
return;
QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
- bool needh = false;
- bool needv = false;
- bool singleFingerPanEnabled = false;
QApplicationPrivate::WidgetStandardGesturesMap::const_iterator it =
qAppPriv->widgetGestures.find(q);
if (it == qAppPriv->widgetGestures.end())
return;
const QStandardGestures &gestures = it.value();
- WId winid = 0;
+ WId winid = q->effectiveWinId();
- if (QAbstractScrollArea *asa = qobject_cast<QAbstractScrollArea*>(q)) {
- winid = asa->viewport()->internalWinId();
- if (!winid) {
- QWidget *nativeParent = asa->viewport()->nativeParentWidget();
- if (!nativeParent)
- return;
- winid = nativeParent->internalWinId();
- }
+ bool needh = false;
+ bool needv = false;
+ bool singleFingerPanEnabled = false;
+
+ if (QAbstractScrollArea *asa = qobject_cast<QAbstractScrollArea*>(q->parent())) {
QScrollBar *hbar = asa->horizontalScrollBar();
QScrollBar *vbar = asa->verticalScrollBar();
Qt::ScrollBarPolicy hbarpolicy = asa->horizontalScrollBarPolicy();
@@ -2094,12 +2086,6 @@ void QWidgetPrivate::winSetupGestures()
needv = (vbarpolicy == Qt::ScrollBarAlwaysOn ||
(vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum()));
singleFingerPanEnabled = asa->d_func()->singleFingerPanEnabled;
- } else {
- winid = q->internalWinId();
- if (!winid) {
- if (QWidget *nativeParent = q->nativeParentWidget())
- winid = nativeParent->internalWinId();
- }
}
if (winid && qAppPriv->SetGestureConfig) {
GESTURECONFIG gc[3];
diff --git a/src/gui/painting/makepsheader.pl b/src/gui/painting/makepsheader.pl
index 30a5eea..de13209 100755
--- a/src/gui/painting/makepsheader.pl
+++ b/src/gui/painting/makepsheader.pl
@@ -1,4 +1,44 @@
#!/usr/bin/perl
+#############################################################################
+##
+## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is part of the QtGui module of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## No Commercial Usage
+## This file contains pre-release code and may not be distributed.
+## You may use this file in accordance with the terms and conditions
+## contained in the Technology Preview License Agreement accompanying
+## this package.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 2.1 requirements
+## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## In addition, as a special exception, Nokia gives you certain
+## additional rights. These rights are described in the Nokia Qt LGPL
+## Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+## package.
+##
+## If you have questions regarding the use of this file, please contact
+## Nokia at qt-info@nokia.com.
+##
+##
+##
+##
+##
+##
+##
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
open(INPUT, 'qpsprinter.ps')
or die "Can't open qpsprinter.ps";
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index feef15a..5abac2f 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -42,6 +42,7 @@ HEADERS += \
painting/qtransform.h \
painting/qwindowsurface_p.h \
painting/qwmatrix.h \
+ painting/qpaintbuffer_p.h
SOURCES += \
@@ -79,6 +80,7 @@ SOURCES += \
painting/qtextureglyphcache.cpp \
painting/qtransform.cpp \
painting/qwindowsurface.cpp \
+ painting/qpaintbuffer.cpp
SOURCES += \
painting/qpaintengine_raster.cpp \
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 422d5a3..173c870 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -298,7 +298,7 @@ QT_BEGIN_NAMESPACE
/*!
\enum QColor::Spec
- The type of color specified, either RGB, HSV or CMYK.
+ The type of color specified, either RGB, HSV, CMYK or HSL.
\value Rgb
\value Hsv
diff --git a/src/gui/painting/qdrawhelper_mmx_p.h b/src/gui/painting/qdrawhelper_mmx_p.h
index e107c72..68d9ec0 100644
--- a/src/gui/painting/qdrawhelper_mmx_p.h
+++ b/src/gui/painting/qdrawhelper_mmx_p.h
@@ -65,7 +65,7 @@
#define C_80 const m64 mmx_0x0080 = _mm_set1_pi16(0x80)
#define C_00 const m64 mmx_0x0000 = _mm_setzero_si64()
-#if defined(Q_OS_WIN)
+#ifdef Q_CC_MSVC
# pragma warning(disable: 4799) // No EMMS at end of function
#endif
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index 5e8fce5..32a8432 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -183,7 +183,7 @@ void qt_bitmapblit16_sse2(QRasterBuffer *rasterBuffer, int x, int y,
const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16);
const __m128i c128 = _mm_set1_epi16(c);
-#if defined(Q_OS_WIN)
+#if defined(Q_CC_MSVC)
# pragma warning(disable: 4309) // truncation of constant value
#endif
const __m128i maskmask = _mm_set_epi16(0x0101, 0x0202, 0x0404, 0x0808,
diff --git a/src/gui/painting/qdrawhelper_sse_p.h b/src/gui/painting/qdrawhelper_sse_p.h
index dd75bd9..23b629e 100644
--- a/src/gui/painting/qdrawhelper_sse_p.h
+++ b/src/gui/painting/qdrawhelper_sse_p.h
@@ -132,7 +132,7 @@ inline void qt_bitmapblit16_sse_template(QRasterBuffer *rasterBuffer,
const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16);
const __m64 c64 = _mm_set1_pi16(c);
-#if defined(Q_OS_WIN)
+#ifdef Q_CC_MSVC
# pragma warning(disable: 4309) // truncation of constant value
#endif
const __m64 maskmask1 = _mm_set_pi16(0x1010, 0x2020, 0x4040, 0x8080);
diff --git a/src/gui/painting/qemulationpaintengine_p.h b/src/gui/painting/qemulationpaintengine_p.h
index 1c3445c..358066e 100644
--- a/src/gui/painting/qemulationpaintengine_p.h
+++ b/src/gui/painting/qemulationpaintengine_p.h
@@ -92,6 +92,8 @@ public:
virtual void setState(QPainterState *s);
+ virtual uint flags() const {return QPaintEngineEx::IsEmulationEngine | QPaintEngineEx::DoNotEmulate;}
+
inline QPainterState *state() { return (QPainterState *)QPaintEngine::state; }
inline const QPainterState *state() const { return (const QPainterState *)QPaintEngine::state; }
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index 83f1cb9..d89144e 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -1,5 +1,8 @@
/****************************************************************************
**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp
new file mode 100644
index 0000000..04ddd7d
--- /dev/null
+++ b/src/gui/painting/qpaintbuffer.cpp
@@ -0,0 +1,1745 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qmath.h>
+#include <private/qpainterpath_p.h>
+#include <private/qpaintbuffer_p.h>
+//#include <private/qtextengine_p.h>
+#include <private/qfontengine_p.h>
+#include <private/qemulationpaintengine_p.h>
+
+#include <QDebug>
+
+//#define QPAINTBUFFER_DEBUG_DRAW
+
+extern int qt_defaultDpiX();
+extern int qt_defaultDpiY();
+extern void qt_format_text(const QFont &font,
+ const QRectF &_r, int tf, const QTextOption *option, const QString& str, QRectF *brect,
+ int tabstops, int* tabarray, int tabarraylen,
+ QPainter *painter);
+
+QTextItemIntCopy::QTextItemIntCopy(const QTextItem &item)
+ : m_item(static_cast<const QTextItemInt &>(item))
+{
+ QChar *chars = new QChar[m_item.num_chars];
+ unsigned short *logClusters = new unsigned short[m_item.num_chars];
+ memcpy(chars, m_item.chars, m_item.num_chars * sizeof(QChar));
+ memcpy(logClusters, m_item.logClusters, m_item.num_chars * sizeof(unsigned short));
+ m_item.chars = chars;
+ m_item.logClusters = logClusters;
+
+ const int size = QGlyphLayout::spaceNeededForGlyphLayout(m_item.glyphs.numGlyphs);
+ char *glyphLayoutData = new char[size];
+ QGlyphLayout glyphs(glyphLayoutData, m_item.glyphs.numGlyphs);
+ memcpy(glyphs.offsets, m_item.glyphs.offsets, m_item.glyphs.numGlyphs * sizeof(QFixedPoint));
+ memcpy(glyphs.glyphs, m_item.glyphs.glyphs, m_item.glyphs.numGlyphs * sizeof(HB_Glyph));
+ memcpy(glyphs.advances_x, m_item.glyphs.advances_x, m_item.glyphs.numGlyphs * sizeof(QFixed));
+ memcpy(glyphs.advances_y, m_item.glyphs.advances_y, m_item.glyphs.numGlyphs * sizeof(QFixed));
+ memcpy(glyphs.justifications, m_item.glyphs.justifications, m_item.glyphs.numGlyphs * sizeof(QGlyphJustification));
+ memcpy(glyphs.attributes, m_item.glyphs.attributes, m_item.glyphs.numGlyphs * sizeof(HB_GlyphAttributes));
+ m_item.glyphs = glyphs;
+
+ m_font = *m_item.f;
+ m_item.f = &m_font;
+
+ m_item.fontEngine->ref.ref(); // Increment reference count.
+}
+
+QTextItemIntCopy::~QTextItemIntCopy()
+{
+ delete m_item.chars;
+ delete m_item.logClusters;
+ delete m_item.glyphs.data();
+ if (!m_item.fontEngine->ref.deref())
+ delete m_item.fontEngine;
+}
+
+/************************************************************************
+ *
+ * QPaintBufferSignalProxy
+ *
+ ************************************************************************/
+
+Q_GLOBAL_STATIC(QPaintBufferSignalProxy, theSignalProxy)
+
+QPaintBufferSignalProxy *QPaintBufferSignalProxy::instance()
+{
+ return theSignalProxy();
+}
+
+/************************************************************************
+ *
+ * QPaintBufferPrivate
+ *
+ ************************************************************************/
+
+QPaintBufferPrivate::QPaintBufferPrivate()
+ : ref(1), engine(0), penWidthAdjustment(0)
+ , calculateBoundingRect(true)
+ , cache(0)
+{
+}
+
+QPaintBufferPrivate::~QPaintBufferPrivate()
+{
+ QPaintBufferSignalProxy::instance()->emitAboutToDestroy(this);
+
+ for (int i = 0; i < commands.size(); ++i) {
+ const QPaintBufferCommand &cmd = commands.at(i);
+ if (cmd.id == QPaintBufferPrivate::Cmd_DrawTextItem)
+ delete reinterpret_cast<QTextItemIntCopy *>(qVariantValue<void *>(variants.at(cmd.offset)));
+ }
+}
+
+
+inline void QPaintBufferPrivate::updateBoundingRect(const QRectF &br)
+{
+ // transform to device coords and adjust for pen width
+ Q_ASSERT(engine && engine->painter());
+ QPainter *painter = engine->painter();
+ const QTransform transform = painter->transform();
+ QRectF devRect = transform.mapRect(br);
+ if (penWidthAdjustment > 0) {
+ devRect = devRect.adjusted(-penWidthAdjustment, -penWidthAdjustment,
+ penWidthAdjustment, penWidthAdjustment);
+ }
+
+ if (boundingRect.isEmpty()) {
+ boundingRect = devRect;
+ } else {
+ qreal min_x = qMin(devRect.left(), boundingRect.left());
+ qreal min_y = qMin(devRect.top(), boundingRect.top());
+ qreal max_x = qMax(devRect.right(), boundingRect.right());
+ qreal max_y = qMax(devRect.bottom(), boundingRect.bottom());
+ boundingRect = QRectF(min_x, min_y, max_x - min_x, max_y - min_y);
+ }
+ if (painter->hasClipping())
+ boundingRect &= transform.mapRect(painter->clipRegion().boundingRect());
+}
+
+
+/************************************************************************
+ *
+ * QPaintBuffer
+ *
+ ************************************************************************/
+
+
+
+QPaintBuffer::QPaintBuffer()
+ : d_ptr(new QPaintBufferPrivate)
+{
+}
+
+QPaintBuffer::~QPaintBuffer()
+{
+ if (!d_ptr->ref.deref())
+ delete d_ptr;
+}
+
+QPaintBuffer::QPaintBuffer(const QPaintBuffer &other)
+ : QPaintDevice(), d_ptr(other.d_ptr)
+{
+ d_ptr->ref.ref();
+}
+
+QPaintEngine *QPaintBuffer::paintEngine() const
+{
+ QPaintBufferPrivate *d = const_cast<QPaintBuffer *>(this)->d_ptr;
+ if (!d->engine)
+ d->engine = new QPaintBufferEngine(d);
+ return d->engine;
+}
+
+
+int QPaintBuffer::metric(PaintDeviceMetric metric) const
+{
+ int val = 0;
+ switch (metric) {
+ case PdmWidth:
+ val = qCeil(d_ptr->boundingRect.width());
+ break;
+ case PdmHeight:
+ val = qCeil(d_ptr->boundingRect.height());
+ break;
+ case PdmDpiX:
+ case PdmPhysicalDpiX:
+ val = qt_defaultDpiX();
+ break;
+ case PdmDpiY:
+ case PdmPhysicalDpiY:
+ val = qt_defaultDpiY();
+ break;
+ default:
+ val = QPaintDevice::metric(metric);
+ }
+
+ return val;
+}
+
+int QPaintBuffer::devType() const
+{
+ return QInternal::PaintBuffer;
+}
+
+QPaintBuffer &QPaintBuffer::operator=(const QPaintBuffer &other)
+{
+ if (other.d_ptr != d_ptr) {
+ QPaintBufferPrivate *data = other.d_ptr;
+ data->ref.ref();
+ if (d_ptr->ref.deref())
+ delete d_ptr;
+ d_ptr = data;
+ }
+ return *this;
+}
+
+bool QPaintBuffer::isEmpty() const
+{
+ return d_ptr->commands.isEmpty();
+}
+
+
+
+void QPaintBuffer::draw(QPainter *painter) const
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBuffer::draw() --------------------------------";
+
+// printf("Float buffer:");
+// for (int i=0; i<d->floats.size(); i++) {
+// if ((i % 10) == 0) {
+// printf("\n%4d-%4d: ", i, i+9);
+// }
+// printf("%4.2f ", d->floats[i]);
+// }
+// printf("\n");
+
+// printf("Int Buffer:");
+// for (int i=0; i<d->ints.size(); i++) {
+// if ((i % 10) == 0) {
+// printf("\n%4d-%4d: ", i, i+10);
+// }
+// printf("%5d", d->ints[i]);
+// }
+// printf("\n");
+#endif
+
+ if (painter && !painter->isActive())
+ return;
+
+ QPaintEngineEx *xengine = painter->paintEngine()->isExtended()
+ ? (QPaintEngineEx *) painter->paintEngine() : 0;
+ if (xengine) {
+ QPaintEngineExReplayer player;
+ player.draw(*this, painter);
+ } else {
+ QPainterReplayer player;
+ player.draw(*this, painter);
+ }
+
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBuffer::draw() -------------------------------- DONE!";
+#endif
+}
+
+
+QRectF QPaintBuffer::boundingRect() const
+{
+ return d_ptr->boundingRect;
+}
+
+void QPaintBuffer::setBoundingRect(const QRectF &rect)
+{
+ d_ptr->boundingRect = rect;
+ d_ptr->calculateBoundingRect = false;
+}
+
+
+class QPaintBufferEnginePrivate : public QPaintEngineExPrivate
+{
+ Q_DECLARE_PUBLIC(QPaintBufferEngine)
+public:
+ void systemStateChanged() {
+ Q_Q(QPaintBufferEngine);
+ q->buffer->addCommand(QPaintBufferPrivate::Cmd_SystemStateChanged, QVariant(systemClip));
+ }
+};
+
+
+/************************************************************************
+ *
+ * QPaintBufferEngine
+ *
+ ************************************************************************/
+
+QPaintBufferEngine::QPaintBufferEngine(QPaintBufferPrivate *b)
+ : QPaintEngineEx(*(new QPaintBufferEnginePrivate))
+ , buffer(b)
+ , m_begin_detected(false)
+ , m_save_detected(false)
+ , m_stream_raw_text_items(false)
+{
+}
+
+bool QPaintBufferEngine::begin(QPaintDevice *)
+{
+ Q_D(QPaintBufferEngine);
+ painter()->save();
+ d->systemStateChanged();
+ return true;
+}
+
+bool QPaintBufferEngine::end()
+{
+ painter()->restore();
+ m_created_state = 0;
+ return true;
+}
+
+QPainterState *QPaintBufferEngine::createState(QPainterState *orig) const
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: createState, orig=" << orig << ", current=" << state();
+#endif
+
+ Q_ASSERT(!m_begin_detected);
+ Q_ASSERT(!m_save_detected);
+
+ if (orig == 0) {
+ m_begin_detected = true;
+ return new QPainterState();
+ } else {
+ m_save_detected = true;
+ return new QPainterState(orig);
+ }
+}
+
+void QPaintBufferEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: clip vpath:" << path.elementCount() << "op:" << op;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_ClipVectorPath, path);
+ cmd->extra = op;
+}
+
+void QPaintBufferEngine::clip(const QRect &rect, Qt::ClipOperation op)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: clip rect:" << rect << "op:" << op;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_ClipRect, (int *) &rect, 4, 1);
+ cmd->extra = op;
+}
+
+void QPaintBufferEngine::clip(const QRegion &region, Qt::ClipOperation op)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: clip region br:" << region.boundingRect() << "op:" << op;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_ClipRegion, QVariant(region));
+ cmd->extra = op;
+}
+
+void QPaintBufferEngine::clip(const QPainterPath &path, Qt::ClipOperation op)
+{
+ // ### TODO
+// QPaintBufferCommand *cmd =
+// buffer->addCommand(QPaintBufferPrivate::Cmd_ClipPath, QVariant(path));
+// cmd->extra = op;
+ QPaintEngineEx::clip(path, op);
+}
+
+void QPaintBufferEngine::clipEnabledChanged()
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: clip enable change" << state()->clipEnabled;
+#endif
+
+ buffer->addCommand(QPaintBufferPrivate::Cmd_SetClipEnabled, state()->clipEnabled);
+}
+
+void QPaintBufferEngine::penChanged()
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine:" << state()->pen;
+#endif
+ const QPen &pen = state()->pen;
+
+ if (!buffer->commands.isEmpty()
+ && buffer->commands.last().id == QPaintBufferPrivate::Cmd_SetPen) {
+ buffer->variants[buffer->commands.last().offset] = pen;
+ return;
+ }
+ if (buffer->calculateBoundingRect) {
+ if (pen.style() == Qt::NoPen) {
+ buffer->penWidthAdjustment = 0;
+ } else {
+ qreal penWidth = (pen.widthF() == 0) ? 1 : pen.widthF();
+ QPointF transformedWidth(penWidth, penWidth);
+ if (!pen.isCosmetic())
+ transformedWidth = painter()->transform().map(transformedWidth);
+ buffer->penWidthAdjustment = transformedWidth.x() / 2.0;
+ }
+ }
+ buffer->addCommand(QPaintBufferPrivate::Cmd_SetPen, pen);
+}
+
+void QPaintBufferEngine::brushChanged()
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine:" << state()->brush;
+#endif
+ const QBrush &brush = state()->brush;
+
+ if (!buffer->commands.isEmpty()
+ && buffer->commands.last().id == QPaintBufferPrivate::Cmd_SetBrush) {
+ buffer->variants[buffer->commands.last().offset] = brush;
+ return;
+ }
+
+ buffer->addCommand(QPaintBufferPrivate::Cmd_SetBrush, brush);
+}
+
+void QPaintBufferEngine::brushOriginChanged()
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: brush origin changed" << state()->brushOrigin;
+#endif
+ buffer->addCommand(QPaintBufferPrivate::Cmd_SetBrushOrigin, state()->brushOrigin);
+}
+
+void QPaintBufferEngine::opacityChanged()
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: opacity changed" << state()->opacity;
+#endif
+ buffer->addCommand(QPaintBufferPrivate::Cmd_SetOpacity, state()->opacity);
+}
+
+void QPaintBufferEngine::compositionModeChanged()
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: composition mode" << state()->composition_mode;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_SetCompositionMode);
+ cmd->extra = state()->composition_mode;
+}
+
+void QPaintBufferEngine::renderHintsChanged()
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: render hints changed" << state()->renderHints;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_SetRenderHints);
+ cmd->extra = state()->renderHints;
+}
+
+void QPaintBufferEngine::transformChanged()
+{
+ // ### accumulate, like in QBrush case...
+ if (!buffer->commands.isEmpty()
+ && buffer->commands.last().id == QPaintBufferPrivate::Cmd_SetTransform) {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: compressing " << state()->matrix;
+#endif
+ buffer->variants[buffer->commands.last().offset] = state()->matrix;
+ return;
+ }
+
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: " << state()->matrix;
+#endif
+ buffer->addCommand(QPaintBufferPrivate::Cmd_SetTransform, state()->matrix);
+}
+
+void QPaintBufferEngine::backgroundModeChanged()
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintEngineBuffer: background mode changed" << state()->bgMode;
+#endif
+ QPaintBufferCommand *cmd = buffer->addCommand(QPaintBufferPrivate::Cmd_SetBackgroundMode);
+ cmd->extra = state()->bgMode;
+}
+
+void QPaintBufferEngine::draw(const QVectorPath &path)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: draw vpath:" << path.elementCount();
+#endif
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawVectorPath, path);
+// if (buffer->calculateBoundingRect) {
+// QRealRect r = path.controlPointRect();
+// buffer->updateBoundingRect(QRectF(r.x1, r.y1, r.x2 - r.x1, r.y2 - r.y1));
+// }
+}
+
+void QPaintBufferEngine::fill(const QVectorPath &path, const QBrush &brush)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: fill vpath:" << path.elementCount() << brush;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_FillVectorPath, path);
+ cmd->extra = buffer->addData(QVariant(brush));
+// if (buffer->calculateBoundingRect) {
+// QRealRect r = path.controlPointRect();
+// buffer->updateBoundingRect(QRectF(r.x1, r.y1, r.x2 - r.x1, r.y2 - r.y1));
+// }
+}
+
+void QPaintBufferEngine::stroke(const QVectorPath &path, const QPen &pen)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: stroke vpath:" << path.elementCount() << pen;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_StrokeVectorPath, path);
+ cmd->extra = buffer->addData(QVariant(pen));
+// if (buffer->calculateBoundingRect) {
+// QRealRect r = path.controlPointRect();
+// buffer->updateBoundingRect(QRectF(r.x1, r.y1, r.x2 - r.x1, r.y2 - r.y1));
+// }
+}
+
+void QPaintBufferEngine::fillRect(const QRectF &rect, const QBrush &brush)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: fillRect brush:" << rect << brush;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_FillRectBrush, (qreal *) &rect, 4, 1);
+ cmd->extra = buffer->addData(brush);
+ if (buffer->calculateBoundingRect)
+ buffer->updateBoundingRect(rect);
+}
+
+void QPaintBufferEngine::fillRect(const QRectF &rect, const QColor &color)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: fillRect color:" << rect << color;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_FillRectColor, (qreal *) &rect, 4, 1);
+ cmd->extra = buffer->addData(color);
+ if (buffer->calculateBoundingRect)
+ buffer->updateBoundingRect(rect);
+}
+
+void QPaintBufferEngine::drawRects(const QRect *rects, int rectCount)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawRectsI:" << rectCount;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawRectI, (int *) rects, 4 * rectCount, rectCount);
+ cmd->extra = rectCount;
+
+ if (buffer->calculateBoundingRect) {
+ if (rectCount == 1) {
+ buffer->updateBoundingRect(rects[0]);
+ } else {
+ int min_x = rects[0].left();
+ int min_y = rects[0].top();
+ int max_x = rects[0].left() + rects[0].width();
+ int max_y = rects[0].top() + rects[0].height();
+ for (int i=1; i< rectCount; ++i) {
+ if (rects[i].left() < min_x)
+ min_x = rects[i].left();
+ if (rects[i].top() < min_y)
+ min_y = rects[i].top();
+ if (rects[i].right() > max_x)
+ max_x = rects[i].left() + rects[i].width();
+ if (rects[i].bottom() > max_y)
+ max_y = rects[i].top() + rects[i].height();
+
+ }
+ buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
+ }
+ }
+}
+
+void QPaintBufferEngine::drawRects(const QRectF *rects, int rectCount)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawRectsF:" << rectCount;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawRectF, (qreal *) rects, 4 * rectCount, rectCount);
+ cmd->extra = rectCount;
+
+ if (buffer->calculateBoundingRect) {
+ if (rectCount == 1) {
+ buffer->updateBoundingRect(rects[0]);
+ } else {
+ qreal min_x = rects[0].left();
+ qreal min_y = rects[0].top();
+ qreal max_x = rects[0].right();
+ qreal max_y = rects[0].bottom();
+ for (int i=1; i< rectCount; ++i) {
+ if (rects[i].left() < min_x)
+ min_x = rects[i].left();
+ if (rects[i].top() < min_y)
+ min_y = rects[i].top();
+ if (rects[i].right() > max_x)
+ max_x = rects[i].right();
+ if (rects[i].bottom() > max_y)
+ max_y = rects[i].bottom();
+
+ }
+ buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
+ }
+ }
+}
+
+void QPaintBufferEngine::drawLines(const QLine *lines, int lineCount)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawLinesI:" << lineCount;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawLineI, (int *) lines, 4 * lineCount, lineCount);
+ cmd->extra = lineCount;
+
+ if (buffer->calculateBoundingRect) {
+ int min_x = lines[0].p1().x();
+ int min_y = lines[0].p1().y();
+ int max_x = lines[0].p2().x();
+ int max_y = lines[0].p2().y();
+ if (min_x > max_x)
+ qSwap(min_x, max_x);
+ if (min_y > max_y)
+ qSwap(min_y, max_y);
+ for (int i=1; i < lineCount; ++i) {
+ int p1_x = lines[i].p1().x();
+ int p1_y = lines[i].p1().y();
+ int p2_x = lines[i].p2().x();
+ int p2_y = lines[i].p2().y();
+ if (p1_x > p2_x) {
+ min_x = qMin(p2_x, min_x);
+ max_x = qMax(p1_x, max_x);
+ } else {
+ min_x = qMin(p1_x, min_x);
+ max_x = qMax(p2_x, max_x);
+ }
+ if (p1_y > p2_y) {
+ min_y = qMin(p2_y, min_y);
+ max_y = qMax(p1_y, max_y);
+ } else {
+ min_y = qMin(p1_y, min_y);
+ max_y = qMax(p2_y, max_y);
+ }
+ }
+ buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
+ }
+}
+
+void QPaintBufferEngine::drawLines(const QLineF *lines, int lineCount)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawLinesF:" << lineCount;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawLineF, (qreal *) lines, 4 * lineCount, lineCount);
+ cmd->extra = lineCount;
+
+ if (buffer->calculateBoundingRect) {
+ qreal min_x = lines[0].p1().x();
+ qreal min_y = lines[0].p1().y();
+ qreal max_x = lines[0].p2().x();
+ qreal max_y = lines[0].p2().y();
+ if (min_x > max_x)
+ qSwap(min_x, max_x);
+ if (min_y > max_y)
+ qSwap(min_y, max_y);
+ for (int i=1; i < lineCount; ++i) {
+ qreal p1_x = lines[i].p1().x();
+ qreal p1_y = lines[i].p1().y();
+ qreal p2_x = lines[i].p2().x();
+ qreal p2_y = lines[i].p2().y();
+ if (p1_x > p2_x) {
+ min_x = qMin(p2_x, min_x);
+ max_x = qMax(p1_x, max_x);
+ } else {
+ min_x = qMin(p1_x, min_x);
+ max_x = qMax(p2_x, max_x);
+ }
+ if (p1_y > p2_y) {
+ min_y = qMin(p2_y, min_y);
+ max_y = qMax(p1_y, max_y);
+ } else {
+ min_y = qMin(p1_y, min_y);
+ max_y = qMax(p2_y, max_y);
+ }
+ }
+ buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
+ }
+}
+
+void QPaintBufferEngine::drawEllipse(const QRectF &r)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawEllipseF:" << r;
+#endif
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawEllipseF, (qreal *) &r, 4, 1);
+ if (buffer->calculateBoundingRect)
+ buffer->updateBoundingRect(r);
+}
+
+void QPaintBufferEngine::drawEllipse(const QRect &r)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawEllipseI:" << r;
+#endif
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawEllipseI, (int *) &r, 4, 1);
+ if (buffer->calculateBoundingRect)
+ buffer->updateBoundingRect(r);
+}
+
+void QPaintBufferEngine::drawPath(const QPainterPath &path)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawPath: element count:" << path.elementCount();
+#endif
+ // ### Path -> QVariant
+ // buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPath, QVariant(path));
+ QPaintEngineEx::drawPath(path);
+
+ if (buffer->calculateBoundingRect)
+ buffer->updateBoundingRect(path.boundingRect());
+}
+
+void QPaintBufferEngine::drawPoints(const QPoint *points, int pointCount)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawPointsI: " << pointCount;
+#endif
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPointsI, (int *) points, 2 * pointCount, pointCount);
+
+ if (buffer->calculateBoundingRect) {
+ int min_x = points[0].x();
+ int min_y = points[0].y();
+ int max_x = points[0].x()+1;
+ int max_y = points[0].y()+1;
+ for (int i=1; i<pointCount; ++i) {
+ int x = points[i].x();
+ int y = points[i].y();
+ min_x = qMin(min_x, x);
+ min_y = qMin(min_y, y);
+ max_x = qMax(max_x, x+1);
+ max_y = qMax(max_y, y+1);
+ }
+ buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
+ }
+}
+
+void QPaintBufferEngine::drawPoints(const QPointF *points, int pointCount)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawPointsF: " << pointCount;
+#endif
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPointsF, (qreal *) points, 2 * pointCount, pointCount);
+
+ if (buffer->calculateBoundingRect) {
+ qreal min_x = points[0].x();
+ qreal min_y = points[0].y();
+ qreal max_x = points[0].x()+1;
+ qreal max_y = points[0].y()+1;
+ for (int i=1; i<pointCount; ++i) {
+ qreal x = points[i].x();
+ qreal y = points[i].y();
+ min_x = qMin(min_x, x);
+ min_y = qMin(min_y, y);
+ max_x = qMax(max_x, x+1);
+ max_y = qMax(max_y, y+1);
+ }
+ buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
+ }
+}
+
+void QPaintBufferEngine::drawPolygon(const QPoint *pts, int count, PolygonDrawMode mode)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawPolygonI: size:" << count << ", mode:" << mode;
+#endif
+ if (mode == QPaintEngine::OddEvenMode || mode == QPaintEngine::WindingMode) {
+ QPaintBufferCommand *cmd = buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPolygonI,
+ (int *) pts, 2 * count, count);
+ cmd->extra = mode;
+ } else if (mode == QPaintEngine::PolylineMode) {
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPolylineI, (int *) pts, 2 * count, count);
+ } else {
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawConvexPolygonI, (int *) pts, 2 * count, count);
+ }
+
+ if (buffer->calculateBoundingRect) {
+ int min_x = pts[0].x();
+ int min_y = pts[0].y();
+ int max_x = pts[0].x();
+ int max_y = pts[0].y();
+ for (int i=1; i<count; ++i) {
+ int x = pts[i].x();
+ int y = pts[i].y();
+ min_x = qMin(min_x, x);
+ min_y = qMin(min_y, y);
+ max_x = qMax(max_x, x);
+ max_y = qMax(max_y, y);
+ }
+ buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
+ }
+}
+
+void QPaintBufferEngine::drawPolygon(const QPointF *pts, int count, PolygonDrawMode mode)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawPolygonF: size:" << count << ", mode:" << mode;
+#endif
+ if (mode == QPaintEngine::OddEvenMode || mode == QPaintEngine::WindingMode) {
+ QPaintBufferCommand *cmd = buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPolygonF,
+ (qreal *) pts, 2 * count, count);
+ cmd->extra = mode;
+ } else if (mode == QPaintEngine::PolylineMode) {
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPolylineF, (qreal *) pts, 2 * count, count);
+ } else {
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawConvexPolygonF, (qreal *) pts, 2 * count, count);
+ }
+
+ if (buffer->calculateBoundingRect) {
+ qreal min_x = pts[0].x();
+ qreal min_y = pts[0].y();
+ qreal max_x = pts[0].x();
+ qreal max_y = pts[0].y();
+ for (int i=1; i<count; ++i) {
+ qreal x = pts[i].x();
+ qreal y = pts[i].y();
+ min_x = qMin(min_x, x);
+ min_y = qMin(min_y, y);
+ max_x = qMax(max_x, x);
+ max_y = qMax(max_y, y);
+ }
+ buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
+ }
+}
+
+void QPaintBufferEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawPixmap: src/dest rects " << r << sr;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPixmapRect, QVariant(pm));
+ cmd->extra = buffer->addData((qreal *) &r, 4);
+ buffer->addData((qreal *) &sr, 4);
+ if (buffer->calculateBoundingRect)
+ buffer->updateBoundingRect(r);
+}
+
+void QPaintBufferEngine::drawPixmap(const QPointF &pos, const QPixmap &pm)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawPixmap: pos:" << pos;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPixmapPos, QVariant(pm));
+ cmd->extra = buffer->addData((qreal *) &pos, 2);
+ if (buffer->calculateBoundingRect)
+ buffer->updateBoundingRect(QRectF(pos, pm.size()));
+}
+
+void QPaintBufferEngine::drawImage(const QRectF &r, const QImage &image, const QRectF &sr,
+ Qt::ImageConversionFlags /*flags */)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawImage: src/dest rects " << r << sr;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPixmapRect, QVariant(image));
+ cmd->extra = buffer->addData((qreal *) &r, 4);
+ buffer->addData((qreal *) &sr, 4);
+ // ### flags...
+ if (buffer->calculateBoundingRect)
+ buffer->updateBoundingRect(r);
+}
+
+void QPaintBufferEngine::drawImage(const QPointF &pos, const QImage &image)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawImage: pos:" << pos;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawImagePos, QVariant(image));
+ cmd->extra = buffer->addData((qreal *) &pos, 2);
+ if (buffer->calculateBoundingRect)
+ buffer->updateBoundingRect(QRectF(pos, image.size()));
+}
+
+void QPaintBufferEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &s)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawTiledPixmap: src rect/offset:" << r << s;
+#endif
+ QPaintBufferCommand *cmd =
+ buffer->addCommand(QPaintBufferPrivate::Cmd_DrawTiledPixmap, QVariant(pm));
+ cmd->extra = buffer->addData((qreal *) &r, 4);
+ buffer->addData((qreal *) &s, 2);
+ if (buffer->calculateBoundingRect)
+ buffer->updateBoundingRect(r);
+}
+
+void QPaintBufferEngine::drawTextItem(const QPointF &pos, const QTextItem &ti)
+{
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: drawTextItem: pos:" << pos << ti.text();
+#endif
+ if (m_stream_raw_text_items) {
+ QPaintBufferCommand *cmd = buffer->addCommand(QPaintBufferPrivate::Cmd_DrawTextItem, qVariantFromValue<void *>(new QTextItemIntCopy(ti)));
+
+ QFont font(ti.font());
+ font.setUnderline(false);
+ font.setStrikeOut(false);
+ font.setOverline(false);
+
+ const QTextItemInt &si = static_cast<const QTextItemInt &>(ti);
+ qreal justificationWidth = 0;
+ if (si.justified)
+ justificationWidth = si.width.toReal();
+ int renderFlags = ti.renderFlags();
+ qreal scaleFactor = font.d->dpi/qreal(qt_defaultDpiY());
+
+ buffer->addData(QVariant(font));
+ cmd->extra = buffer->addData((qreal *) &pos, 2);
+ buffer->addData((qreal *) &justificationWidth, 1);
+ buffer->addData((qreal *) &scaleFactor, 1);
+ cmd->offset2 = buffer->addData((int *) &renderFlags, 1);
+ } else {
+ QList<QVariant> variants;
+ variants << QVariant(ti.font()) << QVariant(ti.text());
+ QPaintBufferCommand *cmd = buffer->addCommand(QPaintBufferPrivate::Cmd_DrawText, QVariant(variants));
+ cmd->extra = buffer->addData((qreal *) &pos, 2);
+ }
+
+ if (buffer->calculateBoundingRect)
+ buffer->updateBoundingRect(QRectF(pos, QSize(ti.width(), ti.ascent() + ti.descent() + 1)));
+}
+
+
+void QPaintBufferEngine::setState(QPainterState *s)
+{
+ if (m_begin_detected) {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: setState: begin, ignoring.";
+#endif
+ m_begin_detected = false;
+ } else if (m_save_detected) {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: setState: save.";
+#endif
+ m_save_detected = false;
+ buffer->addCommand(QPaintBufferPrivate::Cmd_Save);
+ } else {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << "QPaintBufferEngine: setState: restore.";
+#endif
+ buffer->addCommand(QPaintBufferPrivate::Cmd_Restore);
+ }
+
+ QPaintEngineEx::setState(s);
+}
+
+
+/***********************************************************************
+ *
+ * class QPaintBufferPlayback_Painter
+ *
+ */
+
+// QFakeDevice is used to create fonts with a custom DPI
+//
+class QFakeDevice : public QPaintDevice
+{
+public:
+ QFakeDevice() { dpi_x = qt_defaultDpiX(); dpi_y = qt_defaultDpiY(); }
+ void setDpiX(int dpi) { dpi_x = dpi; }
+ void setDpiY(int dpi) { dpi_y = dpi; }
+ QPaintEngine *paintEngine() const { return 0; }
+ int metric(PaintDeviceMetric m) const
+ {
+ switch(m) {
+ case PdmPhysicalDpiX:
+ case PdmDpiX:
+ return dpi_x;
+ case PdmPhysicalDpiY:
+ case PdmDpiY:
+ return dpi_y;
+ default:
+ return QPaintDevice::metric(m);
+ }
+ }
+
+private:
+ int dpi_x;
+ int dpi_y;
+};
+
+
+void QPainterReplayer::setupTransform(QPainter *_painter)
+{
+ painter = _painter;
+ m_world_matrix = painter->transform();
+ m_world_matrix.scale(qreal(painter->device()->logicalDpiX()) / qreal(qt_defaultDpiX()),
+ qreal(painter->device()->logicalDpiY()) / qreal(qt_defaultDpiY()));
+ painter->setTransform(m_world_matrix);
+}
+
+void QPainterReplayer::draw(const QPaintBuffer &buffer, QPainter *_painter)
+{
+ d = buffer.d_ptr;
+ setupTransform(_painter);
+
+ for (int cmdIndex=0; cmdIndex<d->commands.size(); ++cmdIndex) {
+ const QPaintBufferCommand &cmd = d->commands.at(cmdIndex);
+ process(cmd);
+ }
+}
+
+void QPainterReplayer::process(const QPaintBufferCommand &cmd)
+{
+ switch (cmd.id) {
+ case QPaintBufferPrivate::Cmd_Save: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_Save";
+#endif
+ painter->save();
+ break; }
+
+ case QPaintBufferPrivate::Cmd_Restore: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_Restore";
+#endif
+ painter->restore();
+ break; }
+
+ case QPaintBufferPrivate::Cmd_SetPen: {
+ QPen pen = qVariantValue<QPen>(d->variants.at(cmd.offset));
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_SetPen: " << pen;
+#endif
+ painter->setPen(pen);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_SetBrush: {
+ QBrush brush = qVariantValue<QBrush>(d->variants.at(cmd.offset));
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_SetBrush: " << brush;
+#endif
+ painter->setBrush(brush);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_SetBrushOrigin: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_SetBrushOrigin: " << d->variants.at(cmd.offset).toPointF();
+#endif
+ painter->setBrushOrigin(d->variants.at(cmd.offset).toPointF());
+ break; }
+
+ case QPaintBufferPrivate::Cmd_SetTransform: {
+ QTransform xform = qVariantValue<QTransform>(d->variants.at(cmd.offset));
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_SetTransform, offset: " << cmd.offset << xform;
+#endif
+ painter->setTransform(xform * m_world_matrix);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_SetCompositionMode: {
+ QPainter::CompositionMode mode = (QPainter::CompositionMode) cmd.extra;
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_SetCompositionMode, mode: " << mode;
+#endif
+ painter->setCompositionMode(mode);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_SetRenderHints: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_SetRenderHints, hints: " << cmd.extra;
+#endif
+ QPainter::RenderHints ph = painter->renderHints();
+ QPainter::RenderHints nh = (QPainter::RenderHints) cmd.extra;
+ QPainter::RenderHints xored = ph ^ nh;
+ if (xored & QPainter::Antialiasing)
+ painter->setRenderHint(QPainter::Antialiasing, nh & QPainter::Antialiasing);
+ if (xored & QPainter::HighQualityAntialiasing)
+ painter->setRenderHint(QPainter::HighQualityAntialiasing, nh & QPainter::HighQualityAntialiasing);
+ if (xored & QPainter::TextAntialiasing)
+ painter->setRenderHint(QPainter::TextAntialiasing, nh & QPainter::TextAntialiasing);
+ if (xored & QPainter::SmoothPixmapTransform)
+ painter->setRenderHint(QPainter::SmoothPixmapTransform, nh & QPainter::SmoothPixmapTransform);
+ if (xored & QPainter::NonCosmeticDefaultPen)
+ painter->setRenderHint(QPainter::NonCosmeticDefaultPen, nh & QPainter::NonCosmeticDefaultPen);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_SetOpacity: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_SetOpacity: " << d->variants.at(cmd.offset).toDouble();
+#endif
+ painter->setOpacity(d->variants.at(cmd.offset).toDouble());
+ break; }
+
+ case QPaintBufferPrivate::Cmd_SetBackgroundMode: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_SetBackgroundMode: " << cmd.extra;
+#endif
+ painter->setBackgroundMode((Qt::BGMode)cmd.extra);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawVectorPath: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawVectorPath: size: " << cmd.size
+// << ", hints:" << d->ints[cmd.offset2+cmd.size]
+ << "pts/elms:" << cmd.offset << cmd.offset2;
+#endif
+ QVectorPathCmd path(d, cmd);
+ painter->drawPath(path().convertToPainterPath());
+ break; }
+
+ case QPaintBufferPrivate::Cmd_StrokeVectorPath: {
+ QPen pen = qVariantValue<QPen>(d->variants.at(cmd.extra));
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_StrokeVectorPath: size: " << cmd.size
+// << ", hints:" << d->ints[cmd.offset2+cmd.size]
+ << "pts/elms:" << cmd.offset << cmd.offset2;
+#endif
+ QVectorPathCmd path(d, cmd);
+ painter->strokePath(path().convertToPainterPath(), pen);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_FillVectorPath: {
+ QBrush brush = qVariantValue<QBrush>(d->variants.at(cmd.extra));
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_FillVectorPath: size: " << cmd.size
+// << ", hints:" << d->ints[cmd.offset2+cmd.size]
+ << "pts/elms:" << cmd.offset << cmd.offset2 << brush;
+#endif
+ QVectorPathCmd path(d, cmd);
+ painter->fillPath(path().convertToPainterPath(), brush);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawPolygonF: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawPolygonF, offset: " << cmd.offset << " size: " << cmd.size
+ << " mode: " << cmd.extra
+ << d->floats.at(cmd.offset)
+ << d->floats.at(cmd.offset+1);
+#endif
+ Qt::FillRule fill = (QPaintEngine::PolygonDrawMode) cmd.extra == QPaintEngine::OddEvenMode
+ ? Qt::OddEvenFill : Qt::WindingFill;
+ painter->drawPolygon((QPointF *) (d->floats.constData() + cmd.offset), cmd.size, fill);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawPolygonI: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawPolygonI, offset: " << cmd.offset << " size: " << cmd.size
+ << " mode: " << cmd.extra
+ << d->ints.at(cmd.offset)
+ << d->ints.at(cmd.offset+1);
+#endif
+ Qt::FillRule fill = (QPaintEngine::PolygonDrawMode) cmd.extra == QPaintEngine::OddEvenMode
+ ? Qt::OddEvenFill : Qt::WindingFill;
+ painter->drawPolygon((QPoint *) (d->ints.constData() + cmd.offset), cmd.size, fill);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawPolylineF: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawPolylineF, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ painter->drawPolyline((QPointF *) (d->floats.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawPolylineI: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawPolylineI, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ painter->drawPolyline((QPoint *) (d->ints.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawConvexPolygonF: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawConvexPolygonF, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ painter->drawConvexPolygon((QPointF *) (d->floats.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawConvexPolygonI: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawConvexPolygonI, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ painter->drawConvexPolygon((QPoint *) (d->ints.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawEllipseF: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawEllipseF, offset: " << cmd.offset;
+#endif
+ painter->drawEllipse(*(QRectF *)(d->floats.constData() + cmd.offset));
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawEllipseI: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawEllipseI, offset: " << cmd.offset;
+#endif
+ painter->drawEllipse(*(QRect *)(d->ints.constData() + cmd.offset));
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawLineF: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawLineF, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ painter->drawLines((QLineF *)(d->floats.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawLineI: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawLineI, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ painter->drawLines((QLine *)(d->ints.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawPointsF: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawPointsF, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ painter->drawPoints((QPointF *)(d->floats.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawPointsI: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawPointsI, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ painter->drawPoints((QPoint *)(d->ints.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawPixmapRect: {
+ QPixmap pm(d->variants.at(cmd.offset).value<QPixmap>());
+ QRectF r(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1),
+ d->floats.at(cmd.extra+2), d->floats.at(cmd.extra+3));
+
+ QRectF sr(d->floats.at(cmd.extra+4), d->floats.at(cmd.extra+5),
+ d->floats.at(cmd.extra+6), d->floats.at(cmd.extra+7));
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawPixmapRect:" << r << sr;
+#endif
+ painter->drawPixmap(r, pm, sr);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawPixmapPos: {
+ QPixmap pm(d->variants.at(cmd.offset).value<QPixmap>());
+ QPointF pos(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1));
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawPixmapPos:" << pos;
+#endif
+ painter->drawPixmap(pos, pm);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawTiledPixmap: {
+ QPixmap pm(d->variants.at(cmd.offset).value<QPixmap>());
+ QRectF r(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1),
+ d->floats.at(cmd.extra+2), d->floats.at(cmd.extra+3));
+
+ QPointF offset(d->floats.at(cmd.extra+4), d->floats.at(cmd.extra+5));
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawTiledPixmap:" << r << offset;
+#endif
+ painter->drawTiledPixmap(r, pm, offset);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawImageRect: {
+ QImage image(d->variants.at(cmd.offset).value<QImage>());
+ QRectF r(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1),
+ d->floats.at(cmd.extra+2), d->floats.at(cmd.extra+3));
+ QRectF sr(d->floats.at(cmd.extra+4), d->floats.at(cmd.extra+5),
+ d->floats.at(cmd.extra+6), d->floats.at(cmd.extra+7));
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawImageRect:" << r << sr;
+#endif
+ painter->drawImage(r, image, sr);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawImagePos: {
+ QImage image(d->variants.at(cmd.offset).value<QImage>());
+ QPointF pos(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1));
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawImagePos:" << pos;
+#endif
+ painter->drawImage(pos, image);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawRectF: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawRectF, offset: " << cmd.offset;
+#endif
+ painter->drawRects((QRectF *)(d->floats.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawRectI: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawRectI, offset: " << cmd.offset;
+#endif
+ painter->drawRects((QRect *)(d->ints.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_FillRectBrush: {
+ QBrush brush = qVariantValue<QBrush>(d->variants.at(cmd.extra));
+ QRectF *rect = (QRectF *)(d->floats.constData() + cmd.offset);
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " brush: " << brush;
+#endif
+ painter->fillRect(*rect, brush);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_FillRectColor: {
+ QColor color = qVariantValue<QColor>(d->variants.at(cmd.extra));
+ QRectF *rect = (QRectF *)(d->floats.constData() + cmd.offset);
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " color: " << color;
+#endif
+ painter->fillRect(*rect, color);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_SetClipEnabled: {
+ bool clipEnabled = d->variants.at(cmd.offset).toBool();
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_SetClipEnabled:" << clipEnabled;
+#endif
+ painter->setClipping(clipEnabled);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_ClipVectorPath: {
+ QVectorPathCmd path(d, cmd);
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_ClipVectorPath:" << path().elementCount();
+#endif
+ painter->setClipPath(path().convertToPainterPath(), Qt::ClipOperation(cmd.extra));
+ break; }
+
+
+ case QPaintBufferPrivate::Cmd_ClipRect: {
+ QRect rect(QPoint(d->ints.at(cmd.offset), d->ints.at(cmd.offset + 1)),
+ QPoint(d->ints.at(cmd.offset + 2), d->ints.at(cmd.offset + 3)));
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_ClipRect:" << rect << cmd.extra;
+#endif
+ painter->setClipRect(rect, Qt::ClipOperation(cmd.extra));
+ break; }
+
+ case QPaintBufferPrivate::Cmd_ClipRegion: {
+ QRegion region(d->variants.at(cmd.offset).value<QRegion>());
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_ClipRegion:" << region.boundingRect() << cmd.extra;
+#endif
+ painter->setClipRegion(region, Qt::ClipOperation(cmd.extra));
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawText: {
+ QPointF pos(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1));
+ QList<QVariant> variants(d->variants.at(cmd.offset).value<QList<QVariant> >());
+
+ QFont font(variants.at(0).value<QFont>());
+ QString text(variants.at(1).value<QString>());
+
+ painter->setFont(font);
+ painter->drawText(pos, text);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawTextItem: {
+ QPointF pos(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1));
+ QTextItemIntCopy *tiCopy = reinterpret_cast<QTextItemIntCopy *>(qVariantValue<void *>(d->variants.at(cmd.offset)));
+ QTextItemInt &ti = (*tiCopy)();
+ QString text(ti.text());
+
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_DrawTextItem:" << pos << " " << text << " " << scaleFactor;
+#endif
+
+ QFont font(ti.font());
+ font.setUnderline(false);
+ font.setStrikeOut(false);
+ font.setOverline(false);
+
+ const QTextItemInt &si = static_cast<const QTextItemInt &>(ti);
+ qreal justificationWidth = 0;
+ if (si.justified)
+ justificationWidth = si.width.toReal();
+ qreal scaleFactor = font.d->dpi/qreal(qt_defaultDpiY());
+
+ if (scaleFactor != 1.0) {
+ QFont fnt(font);
+ QFakeDevice fake;
+ fake.setDpiX(qRound(scaleFactor*qt_defaultDpiX()));
+ fake.setDpiY(qRound(scaleFactor*qt_defaultDpiY()));
+ font = QFont(fnt, &fake);
+ }
+
+ int flags = Qt::TextSingleLine | Qt::TextDontClip | Qt::TextForceLeftToRight;
+ QSizeF size(1, 1);
+ if (justificationWidth > 0) {
+ size.setWidth(justificationWidth);
+ flags |= Qt::TextJustificationForced;
+ flags |= Qt::AlignJustify;
+ }
+
+ QFontMetrics fm(font);
+ QPointF pt(pos.x(), pos.y() - fm.ascent());
+ qt_format_text(font, QRectF(pt, size), flags, /*opt*/0,
+ text, /*brect=*/0, /*tabstops=*/0, /*...*/0, /*tabarraylen=*/0, painter);
+ break; }
+ case QPaintBufferPrivate::Cmd_SystemStateChanged: {
+ QRegion systemClip(d->variants.at(cmd.offset).value<QRegion>());
+
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> Cmd_SystemStateChanged:" << systemClip;
+#endif
+
+ painter->paintEngine()->setSystemClip(systemClip);
+ painter->paintEngine()->d_ptr->systemStateChanged();
+ break; }
+ }
+}
+
+void QPaintEngineExReplayer::process(const QPaintBufferCommand &cmd)
+{
+ Q_ASSERT(painter->paintEngine()->isExtended());
+ QPaintEngineEx *xengine = static_cast<QPaintEngineEx *>(painter->paintEngine());
+
+ switch (cmd.id) {
+ case QPaintBufferPrivate::Cmd_SetBrushOrigin: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_SetBrushOrigin: " << d->variants.at(cmd.offset).toPointF();
+#endif
+ xengine->state()->brushOrigin = d->variants.at(cmd.offset).toPointF();
+ xengine->brushOriginChanged();
+ break; }
+
+ case QPaintBufferPrivate::Cmd_SetCompositionMode: {
+ QPainter::CompositionMode mode = (QPainter::CompositionMode) cmd.extra;
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_SetCompositionMode, mode: " << mode;
+#endif
+ xengine->state()->composition_mode = mode;
+ xengine->compositionModeChanged();
+ break; }
+
+ case QPaintBufferPrivate::Cmd_SetOpacity: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_SetOpacity: " << d->variants.at(cmd.offset).toDouble();
+#endif
+ xengine->state()->opacity = d->variants.at(cmd.offset).toDouble();
+ xengine->opacityChanged();
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawVectorPath: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_DrawVectorPath: size: " << cmd.size
+// << ", hints:" << d->ints[cmd.offset2+cmd.size]
+ << "pts/elms:" << cmd.offset << cmd.offset2;
+#endif
+ QVectorPathCmd path(d, cmd);
+ xengine->draw(path());
+ break; }
+
+ case QPaintBufferPrivate::Cmd_StrokeVectorPath: {
+ QPen pen = qVariantValue<QPen>(d->variants.at(cmd.extra));
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_StrokeVectorPath: size: " << cmd.size
+// << ", hints:" << d->ints[cmd.offset2+cmd.size]
+ << "pts/elms:" << cmd.offset << cmd.offset2;
+#endif
+ QVectorPathCmd path(d, cmd);
+ xengine->stroke(path(), pen);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_FillVectorPath: {
+ QBrush brush = qVariantValue<QBrush>(d->variants.at(cmd.extra));
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_FillVectorPath: size: " << cmd.size
+// << ", hints:" << d->ints[cmd.offset2+cmd.size]
+ << "pts/elms:" << cmd.offset << cmd.offset2 << brush;
+#endif
+ QVectorPathCmd path(d, cmd);
+ xengine->fill(path(), brush);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_FillRectBrush: {
+ QBrush brush = qVariantValue<QBrush>(d->variants.at(cmd.extra));
+ QRectF *rect = (QRectF *)(d->floats.constData() + cmd.offset);
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " brush: " << brush;
+#endif
+ xengine->fillRect(*rect, brush);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_FillRectColor: {
+ QColor color = qVariantValue<QColor>(d->variants.at(cmd.extra));
+ QRectF *rect = (QRectF *)(d->floats.constData() + cmd.offset);
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " color: " << color;
+#endif
+ xengine->fillRect(*rect, color);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawPolygonF: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_DrawPolygonF, offset: " << cmd.offset << " size: " << cmd.size
+ << " mode: " << cmd.extra
+ << d->floats.at(cmd.offset)
+ << d->floats.at(cmd.offset+1);
+#endif
+ xengine->drawPolygon((QPointF *) (d->floats.constData() + cmd.offset), cmd.size,
+ (QPaintEngine::PolygonDrawMode) cmd.extra);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawPolygonI: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_DrawPolygonI, offset: " << cmd.offset << " size: " << cmd.size
+ << " mode: " << cmd.extra
+ << d->ints.at(cmd.offset)
+ << d->ints.at(cmd.offset+1);
+#endif
+ xengine->drawPolygon((QPoint *) (d->ints.constData() + cmd.offset), cmd.size,
+ (QPaintEngine::PolygonDrawMode) cmd.extra);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawEllipseF: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_DrawEllipseF, offset: " << cmd.offset;
+#endif
+ xengine->drawEllipse(*(QRectF *)(d->floats.constData() + cmd.offset));
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawEllipseI: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_DrawEllipseI, offset: " << cmd.offset;
+#endif
+ xengine->drawEllipse(*(QRect *)(d->ints.constData() + cmd.offset));
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawLineF: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_DrawLineF, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ xengine->drawLines((QLineF *)(d->floats.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawLineI: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_DrawLineI, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ xengine->drawLines((QLine *)(d->ints.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawPointsF: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_DrawPointsF, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ xengine->drawPoints((QPointF *)(d->floats.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawPointsI: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_DrawPointsI, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ xengine->drawPoints((QPoint *)(d->ints.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawPolylineF: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_DrawPolylineF, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ xengine->drawPolygon((QPointF *) (d->floats.constData() + cmd.offset), cmd.size, QPaintEngine::PolylineMode);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawPolylineI: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_DrawPolylineI, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ xengine->drawPolygon((QPoint *) (d->ints.constData() + cmd.offset), cmd.size, QPaintEngine::PolylineMode);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawRectF: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_DrawRectF, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ xengine->drawRects((QRectF *) (d->floats.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_DrawRectI: {
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_DrawRectI, offset: " << cmd.offset << " size: " << cmd.size;
+#endif
+ xengine->drawRects((QRect *) (d->ints.constData() + cmd.offset), cmd.size);
+ break; }
+
+ case QPaintBufferPrivate::Cmd_SetClipEnabled: {
+ bool clipEnabled = d->variants.at(cmd.offset).toBool();
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_SetClipEnabled:" << clipEnabled;
+#endif
+ xengine->state()->clipEnabled = clipEnabled;
+ xengine->clipEnabledChanged();
+ break; }
+
+ case QPaintBufferPrivate::Cmd_ClipVectorPath: {
+ QVectorPathCmd path(d, cmd);
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_ClipVectorPath:" << path().elementCount();
+#endif
+ xengine->clip(path(), Qt::ClipOperation(cmd.extra));
+ break; }
+
+
+ case QPaintBufferPrivate::Cmd_ClipRect: {
+ QRect rect(QPoint(d->ints.at(cmd.offset), d->ints.at(cmd.offset + 1)),
+ QPoint(d->ints.at(cmd.offset + 2), d->ints.at(cmd.offset + 3)));
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_ClipRect:" << rect << cmd.extra;
+#endif
+ xengine->clip(rect, Qt::ClipOperation(cmd.extra));
+ break; }
+
+ case QPaintBufferPrivate::Cmd_ClipRegion: {
+ QRegion region(d->variants.at(cmd.offset).value<QRegion>());
+#ifdef QPAINTBUFFER_DEBUG_DRAW
+ qDebug() << " -> ExCmd_ClipRegion:" << region.boundingRect() << cmd.extra;
+#endif
+ xengine->clip(region, Qt::ClipOperation(cmd.extra));
+ break; }
+
+ default:
+ QPainterReplayer::process(cmd);
+ break;
+ }
+}
+
+QPaintBufferResource::QPaintBufferResource(FreeFunc f, QObject *parent) : QObject(parent), free(f)
+{
+ connect(QPaintBufferSignalProxy::instance(), SIGNAL(aboutToDestroy(const QPaintBufferPrivate *)), this, SLOT(remove(const QPaintBufferPrivate *)));
+}
+
+QPaintBufferResource::~QPaintBufferResource()
+{
+ for (Cache::iterator it = m_cache.begin(); it != m_cache.end(); ++it)
+ free(it.value());
+}
+
+void QPaintBufferResource::insert(const QPaintBufferPrivate *key, void *value)
+{
+ Cache::iterator it = m_cache.find(key);
+ if (it != m_cache.end()) {
+ free(it.value());
+ it.value() = value;
+ } else {
+ m_cache.insert(key, value);
+ }
+}
+
+void *QPaintBufferResource::value(const QPaintBufferPrivate *key)
+{
+ Cache::iterator it = m_cache.find(key);
+ if (it != m_cache.end())
+ return it.value();
+ return 0;
+}
+
+void QPaintBufferResource::remove(const QPaintBufferPrivate *key)
+{
+ Cache::iterator it = m_cache.find(key);
+ if (it != m_cache.end()) {
+ free(it.value());
+ m_cache.erase(it);
+ }
+}
+
+QDataStream &operator<<(QDataStream &stream, const QPaintBufferCommand &command)
+{
+ quint32 id = command.id;
+ quint32 size = command.size;
+ stream << id << size;
+ stream << command.offset << command.offset2 << command.extra;
+ return stream;
+}
+
+QDataStream &operator>>(QDataStream &stream, QPaintBufferCommand &command)
+{
+ quint32 id;
+ quint32 size;
+ stream >> id >> size;
+ stream >> command.offset >> command.offset2 >> command.extra;
+ command.id = id;
+ command.size = size;
+ return stream;
+}
+
+QDataStream &operator<<(QDataStream &stream, const QPaintBuffer &buffer)
+{
+ stream << buffer.d_ptr->ints;
+ stream << buffer.d_ptr->floats;
+ stream << buffer.d_ptr->variants;
+ stream << buffer.d_ptr->commands;
+ stream << buffer.d_ptr->boundingRect;
+
+ return stream;
+}
+
+QDataStream &operator>>(QDataStream &stream, QPaintBuffer &buffer)
+{
+ stream >> buffer.d_ptr->ints;
+ stream >> buffer.d_ptr->floats;
+ stream >> buffer.d_ptr->variants;
+ stream >> buffer.d_ptr->commands;
+ stream >> buffer.d_ptr->boundingRect;
+
+ return stream;
+}
+
diff --git a/src/gui/painting/qpaintbuffer_p.h b/src/gui/painting/qpaintbuffer_p.h
new file mode 100644
index 0000000..b360279
--- /dev/null
+++ b/src/gui/painting/qpaintbuffer_p.h
@@ -0,0 +1,439 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPAINTBUFFER_P_H
+#define QPAINTBUFFER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qpaintdevice.h>
+
+#include <private/qpaintengineex_p.h>
+#include <private/qtextengine_p.h>
+#include <QDebug>
+
+class QPaintBufferPrivate;
+class QPaintBufferPlayback;
+
+class Q_GUI_EXPORT QPaintBuffer : public QPaintDevice
+{
+public:
+ QPaintBuffer();
+ QPaintBuffer(const QPaintBuffer &other);
+ ~QPaintBuffer();
+
+ bool isEmpty() const;
+
+ void draw(QPainter *painter) const;
+ void setBoundingRect(const QRectF &rect);
+ QRectF boundingRect() const;
+
+ virtual QPaintEngine *paintEngine() const;
+ virtual int metric(PaintDeviceMetric m) const;
+ virtual int devType() const;
+
+ QPaintBuffer &operator=(const QPaintBuffer &other);
+
+private:
+ friend class QPainterReplayer;
+ friend class QOpenGLReplayer;
+
+ friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QPaintBuffer &buffer);
+ friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPaintBuffer &buffer);
+
+ QPaintBufferPrivate *d_ptr;
+};
+
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QPaintBuffer &buffer);
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPaintBuffer &buffer);
+
+class QPaintBufferEngine;
+
+class QTextItemIntCopy
+{
+public:
+ QTextItemIntCopy(const QTextItem &item);
+ ~QTextItemIntCopy();
+ QTextItemInt &operator () () {return m_item;}
+private:
+ QTextItemInt m_item;
+ QFont m_font;
+};
+
+struct QPaintBufferCommand
+{
+ uint id : 8;
+ uint size : 24;
+
+ int offset;
+ int offset2;
+ int extra;
+};
+
+QDataStream &operator<<(QDataStream &stream, const QPaintBufferCommand &command);
+QDataStream &operator>>(QDataStream &stream, QPaintBufferCommand &command);
+
+Q_DECLARE_TYPEINFO(QPaintBufferCommand, Q_MOVABLE_TYPE);
+
+class QPaintBufferPrivate
+{
+public:
+ enum Command {
+ Cmd_Save,
+ Cmd_Restore,
+
+ Cmd_SetBrush,
+ Cmd_SetBrushOrigin,
+ Cmd_SetClipEnabled,
+ Cmd_SetCompositionMode,
+ Cmd_SetOpacity,
+ Cmd_SetPen,
+ Cmd_SetRenderHints,
+ Cmd_SetTransform,
+ Cmd_SetBackgroundMode,
+
+ Cmd_ClipPath,
+ Cmd_ClipRect,
+ Cmd_ClipRegion,
+ Cmd_ClipVectorPath,
+
+ Cmd_DrawVectorPath,
+ Cmd_FillVectorPath,
+ Cmd_StrokeVectorPath,
+
+ Cmd_DrawConvexPolygonF,
+ Cmd_DrawConvexPolygonI,
+ Cmd_DrawEllipseF,
+ Cmd_DrawEllipseI,
+ Cmd_DrawLineF,
+ Cmd_DrawLineI,
+ Cmd_DrawPath,
+ Cmd_DrawPointsF,
+ Cmd_DrawPointsI,
+ Cmd_DrawPolygonF,
+ Cmd_DrawPolygonI,
+ Cmd_DrawPolylineF,
+ Cmd_DrawPolylineI,
+ Cmd_DrawRectF,
+ Cmd_DrawRectI,
+
+ Cmd_FillRectBrush,
+ Cmd_FillRectColor,
+
+ Cmd_DrawText,
+ Cmd_DrawTextItem,
+
+ Cmd_DrawImagePos,
+ Cmd_DrawImageRect,
+ Cmd_DrawPixmapPos,
+ Cmd_DrawPixmapRect,
+ Cmd_DrawTiledPixmap,
+
+ Cmd_SystemStateChanged,
+
+ Cmd_LastCommand
+ };
+
+ QPaintBufferPrivate();
+ ~QPaintBufferPrivate();
+
+ int addData(const int *data, int count) {
+ if (count <= 0)
+ return 0;
+ int pos = ints.size();
+ ints.resize(pos + count);
+ memcpy(ints.data() + pos, data, count * sizeof(int));
+ return pos;
+ }
+
+ int addData(const qreal *data, int count) {
+ if (count <= 0)
+ return 0;
+ int pos = floats.size();
+ floats.resize(pos + count);
+ memcpy(floats.data() + pos, data, count * sizeof(qreal));
+ return pos;
+ }
+
+ int addData(const QVariant &var) {
+ variants << var;
+ return variants.size() - 1;
+ }
+
+ QPaintBufferCommand *addCommand(Command command) {
+ QPaintBufferCommand cmd;
+ cmd.id = command;
+ cmd.size = cmd.offset = cmd.offset2 = cmd.extra = 0;
+ commands << cmd;
+ return &commands.last();
+ }
+
+ QPaintBufferCommand *addCommand(Command command, const QVariant &var) {
+ QPaintBufferCommand cmd;
+ cmd.id = command;
+ cmd.offset = addData(var);
+ cmd.size = cmd.offset2 = cmd.extra = 0;
+ commands << cmd;
+ return &commands.last();
+ }
+
+ QPaintBufferCommand *addCommand(Command command, const QVectorPath &path) {
+ QPaintBufferCommand cmd;
+ cmd.id = command;
+ cmd.offset = addData(path.points(), path.elementCount() * 2);
+ cmd.offset2 = ints.size();
+ ints << path.hints();
+ // The absence of path elements is indicated by setting the highest bit in 'cmd.offset2'.
+ if (path.elements())
+ addData((const int *) path.elements(), path.elementCount());
+ else
+ cmd.offset2 |= 0x80000000;
+ cmd.size = path.elementCount();
+ cmd.extra = 0;
+ commands << cmd;
+ return &commands.last();
+ }
+
+ QPaintBufferCommand *addCommand(Command command , const qreal *pts, int arrayLength, int elementCount) {
+ QPaintBufferCommand cmd;
+ cmd.id = command;
+ cmd.offset = addData(pts, arrayLength);
+ cmd.size = elementCount;
+ cmd.offset2 = cmd.extra = 0;
+ commands << cmd;
+ return &commands.last();
+ }
+
+ QPaintBufferCommand *addCommand(Command command , const int *pts, int arrayLength, int elementCount) {
+ QPaintBufferCommand cmd;
+ cmd.id = command;
+ cmd.offset = addData(pts, arrayLength);
+ cmd.size = elementCount;
+ cmd.offset2 = cmd.extra = 0;
+ commands << cmd;
+ return &commands.last();
+ }
+
+ inline void updateBoundingRect(const QRectF &rect);
+
+ QAtomicInt ref;
+
+ QVector<int> ints;
+ QVector<qreal> floats;
+ QVector<QVariant> variants;
+
+ QVector<QPaintBufferCommand> commands;
+
+ QPaintBufferEngine *engine;
+ QRectF boundingRect;
+ qreal penWidthAdjustment;
+ uint calculateBoundingRect : 1;
+
+ void *cache;
+};
+
+
+struct QVectorPathCmd
+{
+ // The absence of path elements is indicated by setting the highest bit in 'cmd.offset2'.
+ QVectorPathCmd(QPaintBufferPrivate *d, const QPaintBufferCommand &cmd)
+ : vectorPath(d->floats.constData() + cmd.offset,
+ cmd.size,
+ cmd.offset2 & 0x80000000
+ ? 0
+ : (const QPainterPath::ElementType *) (d->ints.constData() + cmd.offset2 + 1),
+ *(d->ints.constData() + (cmd.offset2 & 0x7fffffff))) {}
+
+ inline const QVectorPath &operator()() const { return vectorPath; }
+
+ QVectorPath vectorPath;
+};
+
+
+class Q_GUI_EXPORT QPainterReplayer
+{
+public:
+ QPainterReplayer() { }
+
+ virtual ~QPainterReplayer() { }
+
+ void setupTransform(QPainter *painter);
+ void process(const QPaintBufferCommand &cmd);
+ void draw(const QPaintBuffer &buffer, QPainter *painter);
+
+protected:
+ QPaintBufferPrivate *d;
+ QTransform m_world_matrix;
+
+ QPainter *painter;
+};
+
+class Q_GUI_EXPORT QPaintEngineExReplayer : public QPainterReplayer
+{
+public:
+ QPaintEngineExReplayer() { }
+
+ void process(const QPaintBufferCommand &cmd);
+};
+
+class QPaintBufferEnginePrivate;
+
+class QPaintBufferEngine : public QPaintEngineEx
+{
+ Q_DECLARE_PRIVATE(QPaintBufferEngine)
+public:
+ QPaintBufferEngine(QPaintBufferPrivate *buffer);
+
+ virtual bool begin(QPaintDevice *device);
+ virtual bool end();
+
+ virtual Type type() const { return QPaintEngine::PaintBuffer; }
+
+ virtual QPainterState *createState(QPainterState *orig) const;
+
+ virtual void draw(const QVectorPath &path);
+ virtual void fill(const QVectorPath &path, const QBrush &brush);
+ virtual void stroke(const QVectorPath &path, const QPen &pen);
+
+ virtual void clip(const QVectorPath &path, Qt::ClipOperation op);
+ virtual void clip(const QRect &rect, Qt::ClipOperation op);
+ virtual void clip(const QRegion &region, Qt::ClipOperation op);
+ virtual void clip(const QPainterPath &path, Qt::ClipOperation op);
+
+ virtual void clipEnabledChanged();
+ virtual void penChanged();
+ virtual void brushChanged();
+ virtual void brushOriginChanged();
+ virtual void opacityChanged();
+ virtual void compositionModeChanged();
+ virtual void renderHintsChanged();
+ virtual void transformChanged();
+ virtual void backgroundModeChanged();
+
+ virtual void fillRect(const QRectF &rect, const QBrush &brush);
+ virtual void fillRect(const QRectF &rect, const QColor &color);
+
+ virtual void drawRects(const QRect *rects, int rectCount);
+ virtual void drawRects(const QRectF *rects, int rectCount);
+
+ virtual void drawLines(const QLine *lines, int lineCount);
+ virtual void drawLines(const QLineF *lines, int lineCount);
+
+ virtual void drawEllipse(const QRectF &r);
+ virtual void drawEllipse(const QRect &r);
+
+ virtual void drawPath(const QPainterPath &path);
+
+ virtual void drawPoints(const QPointF *points, int pointCount);
+ virtual void drawPoints(const QPoint *points, int pointCount);
+
+ virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
+ virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode);
+
+ virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
+ virtual void drawPixmap(const QPointF &pos, const QPixmap &pm);
+
+ virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
+ Qt::ImageConversionFlags flags = Qt::AutoColor);
+ virtual void drawImage(const QPointF &pos, const QImage &image);
+
+ virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
+
+ virtual void drawTextItem(const QPointF &pos, const QTextItem &ti);
+
+ virtual void setState(QPainterState *s);
+ virtual uint flags() const {return QPaintEngineEx::DoNotEmulate;}
+
+ QPaintBufferPrivate *buffer;
+
+ mutable int m_begin_detected : 1;
+ mutable int m_save_detected : 1;
+ mutable int m_stream_raw_text_items : 1;
+ mutable int m_unused : 29;
+
+ mutable QPainterState *m_created_state;
+};
+
+class Q_GUI_EXPORT QPaintBufferSignalProxy : public QObject
+{
+ Q_OBJECT
+public:
+ QPaintBufferSignalProxy() : QObject() {}
+ void emitAboutToDestroy(const QPaintBufferPrivate *buffer) {
+ emit aboutToDestroy(buffer);
+ }
+ static QPaintBufferSignalProxy *instance();
+Q_SIGNALS:
+ void aboutToDestroy(const QPaintBufferPrivate *buffer);
+};
+
+// One resource per paint buffer and vice versa.
+class Q_GUI_EXPORT QPaintBufferResource : public QObject
+{
+ Q_OBJECT
+public:
+ typedef void (*FreeFunc)(void *);
+
+ QPaintBufferResource(FreeFunc f, QObject *parent = 0);
+ ~QPaintBufferResource();
+ // Set resource 'value' for 'key'.
+ void insert(const QPaintBufferPrivate *key, void *value);
+ // Return resource for 'key'.
+ void *value(const QPaintBufferPrivate *key);
+public slots:
+ // Remove entry 'key' from cache and delete resource.
+ void remove(const QPaintBufferPrivate *key);
+private:
+ typedef QHash<const QPaintBufferPrivate *, void *> Cache;
+ Cache m_cache;
+ FreeFunc free;
+};
+
+#endif // QPAINTBUFFER_P_H
diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h
index 5cd17fe..921db4f 100644
--- a/src/gui/painting/qpaintengine.h
+++ b/src/gui/painting/qpaintengine.h
@@ -212,6 +212,7 @@ public:
Pdf,
OpenVG,
OpenGL2,
+ PaintBuffer,
User = 50, // first user type id
MaxUser = 100 // last user type id
@@ -248,6 +249,7 @@ private:
bool autoDestruct() const { return selfDestruct; }
Q_DISABLE_COPY(QPaintEngine)
+ friend class QPainterReplayer;
friend class QFontEngineBox;
friend class QFontEngineMac;
friend class QFontEngineWin;
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 86b2d0f..81924ff 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1391,7 +1391,7 @@ void QRasterPaintEngine::clip(const QRegion &region, Qt::ClipOperation op)
if (curClip->hasRectClip)
newClip->setClipRegion(r & curClip->clipRect);
else if (curClip->hasRegionClip)
- newClip->setClipRegion(r & clip->clipRegion);
+ newClip->setClipRegion(r & curClip->clipRegion);
qrasterpaintengine_dirty_clip(d, s);
}
@@ -3079,11 +3079,11 @@ bool QRasterPaintEnginePrivate::isUnclipped_normalized(const QRect &r) const
}
- // currently all painting functions clips to deviceRect internally
- if (cl->clipRect == deviceRect)
- return true;
-
if (cl->hasRectClip) {
+ // currently all painting functions clips to deviceRect internally
+ if (cl->clipRect == deviceRect)
+ return true;
+
// inline contains() for performance (we know the rects are normalized)
const QRect &r1 = cl->clipRect;
return (r.left() >= r1.left() && r.right() <= r1.right()
@@ -3109,7 +3109,7 @@ bool QRasterPaintEnginePrivate::isUnclipped(const QRect &rect,
// currently all painting functions that call this function clip to deviceRect internally
- if (cl->clipRect == deviceRect)
+ if (cl->hasRectClip && cl->clipRect == deviceRect)
return true;
if (s->flags.antialiased)
@@ -3123,7 +3123,7 @@ bool QRasterPaintEnginePrivate::isUnclipped(const QRect &rect,
r.setHeight(r.height() + 2 * penWidth);
}
- if (!cl->clipRect.isEmpty()) {
+ if (cl->hasRectClip) {
// inline contains() for performance (we know the rects are normalized)
const QRect &r1 = cl->clipRect;
return (r.left() >= r1.left() && r.right() <= r1.right()
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index c2703bc..4b0f8ae 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -92,40 +92,6 @@ QRectF QVectorPath::controlPointRect() const
return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2));
}
-QPainterPath QVectorPath::convertToPainterPath() const
-{
- QPainterPath path;
-
- if (m_count == 0)
- return path;
-
- const QPointF *points = (const QPointF *) m_points;
-
- if (m_elements) {
- for (int i=0; i<m_count; ++i) {
- switch (m_elements[i]) {
- case QPainterPath::MoveToElement:
- path.moveTo(points[i]);
- break;
- case QPainterPath::LineToElement:
- path.lineTo(points[i]);
- break;
- case QPainterPath::CurveToElement:
- path.cubicTo(points[i], points[i+1], points[i+2]);
- break;
- default:
- break;
- }
- }
- } else {
- path.moveTo(points[0]);
- for (int i=1; i<m_count; ++i)
- path.lineTo(points[i]);
- }
-
- return path;
-}
-
const QVectorPath &qtVectorPathForPath(const QPainterPath &path)
{
Q_ASSERT(path.d_func());
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index a252b5e..1fc1bd1 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -209,6 +209,14 @@ public:
virtual QPixmapFilter *createPixmapFilter(int /*type*/) const { return 0; }
+ // These flags are needed in the implementation of paint buffers.
+ enum Flags
+ {
+ DoNotEmulate = 0x01, // If set, QPainter will not wrap this engine in an emulation engine.
+ IsEmulationEngine = 0x02 // If set, this object is a QEmulationEngine.
+ };
+ virtual uint flags() const {return 0;}
+
protected:
QPaintEngineEx(QPaintEngineExPrivate &data);
};
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index d82e7ee..a6bea76 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -162,6 +162,9 @@ static bool qt_painter_thread_test(int devType, const char *what, bool extraCond
void QPainterPrivate::checkEmulation()
{
Q_ASSERT(extended);
+ if (extended->flags() & QPaintEngineEx::DoNotEmulate)
+ return;
+
bool doEmulation = false;
if (state->bgMode == Qt::OpaqueMode)
doEmulation = true;
@@ -1835,11 +1838,6 @@ bool QPainter::end()
return true;
}
- if (d->states.size() > 1) {
- qWarning("QPainter::end: Painter ended with %d saved states",
- d->states.size());
- }
-
bool ended = true;
if (d->engine->isActive()) {
@@ -1853,6 +1851,11 @@ bool QPainter::end()
}
}
+ if (d->states.size() > 1) {
+ qWarning("QPainter::end: Painter ended with %d saved states",
+ d->states.size());
+ }
+
if (d->engine->autoDestruct()) {
delete d->engine;
}
@@ -7542,9 +7545,10 @@ void qt_format_text(const QFont &fnt, const QRectF &_r,
if (!painter)
tf |= Qt::TextDontPrint;
- uint maxUnderlines = 0;
+ int maxUnderlines = 0;
int numUnderlines = 0;
- QVarLengthArray<int, 32> underlinePositions(1);
+ int underlinePositionStack[32];
+ int *underlinePositions = underlinePositionStack;
QFontMetricsF fm(fnt);
QString text = str;
@@ -7553,46 +7557,54 @@ start_lengthVariant:
bool hasMoreLengthVariants = false;
// compatible behaviour to the old implementation. Replace
// tabs by spaces
+ QChar *chr = text.data() + offset;
+ QChar *end = text.data() + text.length();
bool has_tab = false;
- int old_offset = offset;
- for (; offset < text.length(); offset++) {
- QChar chr = text.at(offset);
- if (chr == QLatin1Char('\r') || (singleline && chr == QLatin1Char('\n'))) {
- text[offset] = QLatin1Char(' ');
- } else if (chr == QLatin1Char('\n')) {
- chr = QChar::LineSeparator;
- } else if (chr == QLatin1Char('&')) {
+ while (chr != end) {
+ if (*chr == QLatin1Char('\r') || (singleline && *chr == QLatin1Char('\n'))) {
+ *chr = QLatin1Char(' ');
+ } else if (*chr == QLatin1Char('\n')) {
+ *chr = QChar::LineSeparator;
+ } else if (*chr == QLatin1Char('&')) {
++maxUnderlines;
- } else if (chr == QLatin1Char('\t')) {
- if (!expandtabs) {
- text[offset] = QLatin1Char(' ');
- } else if (!tabarraylen && !tabstops) {
- tabstops = qRound(fm.width(QLatin1Char('x'))*8);
- }
+ } else if (*chr == QLatin1Char('\t')) {
has_tab = true;
- } else if (chr == QChar(ushort(0x9c))) {
+ } else if (*chr == QChar(ushort(0x9c))) {
// string with multiple length variants
+ end = chr;
hasMoreLengthVariants = true;
break;
}
+ ++chr;
+ }
+ if (has_tab) {
+ if (!expandtabs) {
+ chr = text.data() + offset;
+ while (chr != end) {
+ if (*chr == QLatin1Char('\t'))
+ *chr = QLatin1Char(' ');
+ ++chr;
+ }
+ } else if (!tabarraylen && !tabstops) {
+ tabstops = qRound(fm.width(QLatin1Char('x'))*8);
+ }
}
- int length = offset - old_offset;
- if ((hidemnmemonic || showmnemonic) && maxUnderlines > 0) {
- underlinePositions.resize(maxUnderlines + 1);
-
- QChar *cout = text.data() + old_offset;
+ QChar *cout = end;
+ if (hidemnmemonic || showmnemonic) {
+ if (maxUnderlines > 32)
+ underlinePositions = new int[maxUnderlines];
+ cout = text.data() + offset;
QChar *cin = cout;
- int l = length;
+ int l = end - cout;
while (l) {
if (*cin == QLatin1Char('&')) {
++cin;
- --length;
--l;
if (!l)
break;
if (*cin != QLatin1Char('&') && !hidemnmemonic)
- underlinePositions[numUnderlines++] = cout - text.data() - old_offset;
+ underlinePositions[numUnderlines++] = cout - text.unicode();
}
*cout = *cin;
++cout;
@@ -7609,7 +7621,7 @@ start_lengthVariant:
qreal height = 0;
qreal width = 0;
- QString finalText = text.mid(old_offset, length);
+ QString finalText = text.mid(offset, cout - (text.data() + offset));
QStackTextEngine engine(finalText, fnt);
if (option) {
engine.option = *option;
@@ -7628,7 +7640,7 @@ start_lengthVariant:
engine.forceJustification = true;
QTextLayout textLayout(&engine);
textLayout.setCacheEnabled(true);
- textLayout.engine()->underlinePositions = underlinePositions.data();
+ textLayout.engine()->underlinePositions = underlinePositions;
if (finalText.isEmpty()) {
height = fm.height();
@@ -7697,7 +7709,7 @@ start_lengthVariant:
QRectF bounds = QRectF(r.x() + xoff, r.y() + yoff, width, height);
if (hasMoreLengthVariants && !(tf & Qt::TextLongestVariant) && !r.contains(bounds)) {
- offset++;
+ offset = end - text.data() + 1;
goto start_lengthVariant;
}
if (brect)
@@ -7726,6 +7738,9 @@ start_lengthVariant:
painter->restore();
}
}
+
+ if (underlinePositions != underlinePositionStack)
+ delete [] underlinePositions;
}
/*!
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index 9d472e8..a0ee749 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -220,6 +220,7 @@ private:
friend class QPainterPathStrokerPrivate;
friend class QMatrix;
friend class QTransform;
+ friend class QVectorPath;
friend Q_GUI_EXPORT const QVectorPath &qtVectorPathForPath(const QPainterPath &);
#ifndef QT_NO_DATASTREAM
@@ -237,6 +238,7 @@ public:
friend class QPainterPathStrokerPrivate;
friend class QMatrix;
friend class QTransform;
+ friend class QVectorPath;
friend struct QPainterPathPrivateDeleter;
#ifndef QT_NO_DATASTREAM
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &);
diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h
index bb455cf..94be339 100644
--- a/src/gui/painting/qpainterpath_p.h
+++ b/src/gui/painting/qpainterpath_p.h
@@ -176,6 +176,42 @@ public:
};
+inline const QPainterPath QVectorPath::convertToPainterPath() const
+{
+ QPainterPath path;
+ path.ensureData();
+ QPainterPathData *data = path.d_func();
+ data->elements.reserve(m_count);
+ int index = 0;
+ data->elements[0].x = m_points[index++];
+ data->elements[0].y = m_points[index++];
+
+ if (m_elements) {
+ data->elements[0].type = m_elements[0];
+ for (int i=1; i<m_count; ++i) {
+ QPainterPath::Element element;
+ element.x = m_points[index++];
+ element.y = m_points[index++];
+ element.type = m_elements[i];
+ data->elements << element;
+ }
+ } else {
+ data->elements[0].type = QPainterPath::MoveToElement;
+ for (int i=1; i<m_count; ++i) {
+ QPainterPath::Element element;
+ element.x = m_points[index++];
+ element.y = m_points[index++];
+ element.type = QPainterPath::LineToElement;
+ data->elements << element;
+ }
+ }
+
+ if (m_hints & OddEvenFill)
+ data->fillRule = Qt::OddEvenFill;
+ else
+ data->fillRule = Qt::WindingFill;
+ return path;
+}
void Q_GUI_EXPORT qt_find_ellipse_coords(const QRectF &r, qreal angle, qreal length,
QPointF* startPoint, QPointF *endPoint);
diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h
index 1e909d4..199d0d6 100644
--- a/src/gui/painting/qvectorpath_p.h
+++ b/src/gui/painting/qvectorpath_p.h
@@ -127,11 +127,10 @@ public:
inline bool isEmpty() const { return m_points == 0; }
inline int elementCount() const { return m_count; }
+ inline const QPainterPath convertToPainterPath() const;
static inline uint polygonFlags(QPaintEngine::PolygonDrawMode mode);
- QPainterPath convertToPainterPath() const;
-
private:
Q_DISABLE_COPY(QVectorPath)
diff --git a/src/s60main/qts60mainapplication.cpp b/src/gui/s60framework/qs60mainapplication.cpp
index f4e7def..45a1a3d 100644
--- a/src/s60main/qts60mainapplication.cpp
+++ b/src/gui/s60framework/qs60mainapplication.cpp
@@ -41,44 +41,54 @@
// INCLUDE FILES
#include <exception>
-#include "qts60maindocument_p.h"
-#include "qts60mainapplication_p.h"
+#include "qs60maindocument_p.h"
+#include "qs60mainapplication_p.h"
#include <bautils.h>
#include <coemain.h>
+QT_BEGIN_NAMESPACE
+
+/**
+ * factory function to create the QtS60Main application class
+ */
+CApaApplication* NewApplication()
+{
+ return new QS60MainApplication;
+}
+
// ============================ MEMBER FUNCTIONS ===============================
_LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main.rsc");
// -----------------------------------------------------------------------------
-// CQtS60MainApplication::CreateDocumentL()
+// QS60MainApplication::CreateDocumentL()
// Creates CApaDocument object
// -----------------------------------------------------------------------------
//
-CApaDocument* CQtS60MainApplication::CreateDocumentL()
+CApaDocument* QS60MainApplication::CreateDocumentL()
{
// Create an QtS60Main document, and return a pointer to it
- return (static_cast<CApaDocument*>(CQtS60MainDocument::NewL(*this)));
+ return (static_cast<CApaDocument*>(QS60MainDocument::NewL(*this)));
}
// -----------------------------------------------------------------------------
-// CQtS60MainApplication::AppDllUid()
+// QS60MainApplication::AppDllUid()
// Returns application UID
// -----------------------------------------------------------------------------
//
-TUid CQtS60MainApplication::AppDllUid() const
+TUid QS60MainApplication::AppDllUid() const
{
// Return the UID for the QtS60Main application
return ProcessUid();
}
// -----------------------------------------------------------------------------
-// CQtS60MainApplication::ResourceFileName()
+// QS60MainApplication::ResourceFileName()
// Returns application resource filename
// -----------------------------------------------------------------------------
//
-TFileName CQtS60MainApplication::ResourceFileName() const
+TFileName QS60MainApplication::ResourceFileName() const
{
TFindFile finder(iCoeEnv->FsSession());
TInt err = finder.FindByDir(KQtWrapperResourceFile, KNullDesC);
@@ -87,5 +97,6 @@ TFileName CQtS60MainApplication::ResourceFileName() const
return KNullDesC();
}
+QT_END_NAMESPACE
// End of File
diff --git a/src/s60main/qts60mainapplication_p.h b/src/gui/s60framework/qs60mainapplication_p.h
index f9d2ebb..572bbd3 100644
--- a/src/s60main/qts60mainapplication_p.h
+++ b/src/gui/s60framework/qs60mainapplication_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef __QtS60MainAPPLICATION_H__
-#define __QtS60MainAPPLICATION_H__
+#ifndef QS60MAINAPPLICATION_P_H
+#define QS60MAINAPPLICATION_P_H
//
// W A R N I N G
@@ -56,49 +56,57 @@
// INCLUDES
#include <aknapp.h>
+#include <qglobal.h>
+
// CLASS DECLARATION
+QT_BEGIN_NAMESPACE
+
+CApaApplication* NewApplication();
+
static TUid ProcessUid()
- {
+{
RProcess me;
TSecureId securId = me.SecureId();
me.Close();
return securId.operator TUid();
- }
+}
/**
-* CQtS60MainApplication application class.
+* QS60MainApplication application class.
* Provides factory to create concrete document object.
-* An instance of CQtS60MainApplication is the application part of the
+* An instance of QS60MainApplication is the application part of the
* AVKON application framework for the QtS60Main example application.
*/
-class CQtS60MainApplication : public CAknApplication
- {
- public: // Functions from base classes
-
- /**
- * From CApaApplication, AppDllUid.
- * @return Application's UID (KUidQtS60MainApp).
- */
- TUid AppDllUid() const;
-
- /**
- * From CApaApplication, ResourceFileName
- * @return Application's resource filename (KUidQtS60MainApp).
- */
- TFileName ResourceFileName() const;
-
- protected: // Functions from base classes
-
- /**
- * From CApaApplication, CreateDocumentL.
- * Creates CQtS60MainDocument document object. The returned
- * pointer in not owned by the CQtS60MainApplication object.
- * @return A pointer to the created document object.
- */
- CApaDocument* CreateDocumentL();
- };
-
-#endif // __QtS60MainAPPLICATION_H__
+class QS60MainApplication : public CAknApplication
+{
+public: // Functions from base classes
+
+ /**
+ * From CApaApplication, AppDllUid.
+ * @return Application's UID (KUidQtS60MainApp).
+ */
+ TUid AppDllUid() const;
+
+ /**
+ * From CApaApplication, ResourceFileName
+ * @return Application's resource filename (KUidQtS60MainApp).
+ */
+ TFileName ResourceFileName() const;
+
+protected: // Functions from base classes
+
+ /**
+ * From CApaApplication, CreateDocumentL.
+ * Creates QS60MainDocument document object. The returned
+ * pointer in not owned by the QS60MainApplication object.
+ * @return A pointer to the created document object.
+ */
+ CApaDocument* CreateDocumentL();
+};
+
+QT_END_NAMESPACE
+
+#endif // QS60MAINAPPLICATION_P_H
// End of File
diff --git a/src/s60main/qts60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp
index eb3b62a..7b5ea1d 100644
--- a/src/s60main/qts60mainappui.cpp
+++ b/src/gui/s60framework/qs60mainappui.cpp
@@ -48,20 +48,22 @@
#include <s60main.rsg>
#include <avkon.rsg>
-#include "qts60mainappui_p.h"
+#include "qs60mainappui_p.h"
#include <QtGui/qapplication.h>
#include <QtGui/qmenu.h>
#include <QtGui/private/qt_s60_p.h>
+QT_BEGIN_NAMESPACE
+
// ============================ MEMBER FUNCTIONS ===============================
// -----------------------------------------------------------------------------
-// CQtS60MainAppUi::ConstructL()
+// QS60MainAppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
-void CQtS60MainAppUi::ConstructL()
+void QS60MainAppUi::ConstructL()
{
// Cone's heap and handle checks on app destruction are not suitable for Qt apps, as many
// objects can still exist in static data at that point. Instead we will print relevant information
@@ -76,51 +78,44 @@ void CQtS60MainAppUi::ConstructL()
CEikButtonGroupContainer* nativeContainer = Cba();
nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
-
- // Create async callback to call Qt main,
- // this is required to give S60 app FW to finish starting correctly
- TCallBack callBack(OpenCMainStaticCallBack, this);
- iAsyncCallBack = new(ELeave) CAsyncCallBack(callBack, CActive::EPriorityIdle);
- iAsyncCallBack->Call();
}
// -----------------------------------------------------------------------------
-// CQtS60MainAppUi::CQtS60MainAppUi()
+// QS60MainAppUi::QS60MainAppUi()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
-CQtS60MainAppUi::CQtS60MainAppUi()
+QS60MainAppUi::QS60MainAppUi()
{
// No implementation required
}
// -----------------------------------------------------------------------------
-// CQtS60MainAppUi::~CQtS60MainAppUi()
+// QS60MainAppUi::~QS60MainAppUi()
// Destructor.
// -----------------------------------------------------------------------------
//
-CQtS60MainAppUi::~CQtS60MainAppUi()
+QS60MainAppUi::~QS60MainAppUi()
{
- delete iAsyncCallBack;
}
// -----------------------------------------------------------------------------
-// CQtS60MainAppUi::HandleCommandL()
+// QS60MainAppUi::HandleCommandL()
// Takes care of command handling.
// -----------------------------------------------------------------------------
//
-void CQtS60MainAppUi::HandleCommandL(TInt aCommand)
+void QS60MainAppUi::HandleCommandL(TInt aCommand)
{
if (qApp)
qApp->symbianHandleCommand(aCommand);
}
// -----------------------------------------------------------------------------
-// CQtS60MainAppUi::HandleResourceChangeL()
+// QS60MainAppUi::HandleResourceChangeL()
// Takes care of event handling.
// -----------------------------------------------------------------------------
//
-void CQtS60MainAppUi::HandleResourceChangeL(TInt aType)
+void QS60MainAppUi::HandleResourceChangeL(TInt aType)
{
CAknAppUi::HandleResourceChangeL(aType);
@@ -128,7 +123,7 @@ void CQtS60MainAppUi::HandleResourceChangeL(TInt aType)
qApp->symbianResourceChange(aType);
}
-void CQtS60MainAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl *control)
+void QS60MainAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl *control)
{
int result = 0;
if (qApp)
@@ -147,44 +142,17 @@ void CQtS60MainAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl *contro
// AppView
// -----------------------------------------------------------------------------
//
-void CQtS60MainAppUi::HandleStatusPaneSizeChange()
+void QS60MainAppUi::HandleStatusPaneSizeChange()
{
HandleResourceChangeL(KInternalStatusPaneChange);
HandleStackedControlsResourceChange(KInternalStatusPaneChange);
}
-// -----------------------------------------------------------------------------
-// Called asynchronously from ConstructL() - passes call to nan static method
-// -----------------------------------------------------------------------------
-//
-TInt CQtS60MainAppUi::OpenCMainStaticCallBack(TAny* aObject)
-{
- CQtS60MainAppUi* myObj = static_cast<CQtS60MainAppUi*>(aObject);
- myObj->OpenCMainCallBack();
- return 0;
-}
-
-#include "qtS60main_mcrt0.cpp"
-
-// -----------------------------------------------------------------------------
-// Invokes Qt main, the Qt main will block and when we return from there
-// application should be closed. -> Call Exit();
-// -----------------------------------------------------------------------------
-//
-void CQtS60MainAppUi::OpenCMainCallBack()
+void QS60MainAppUi::DynInitMenuBarL(TInt, CEikMenuBar *)
{
- TInt ret;
- TRAPD(err, ret = QtMainWrapper());
- Q_UNUSED(ret);
- Q_UNUSED(err);
- Exit();
}
-void CQtS60MainAppUi::DynInitMenuBarL(TInt, CEikMenuBar *)
-{
-}
-
-void CQtS60MainAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane)
+void QS60MainAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane)
{
if (aResourceId == R_QT_WRAPPERAPP_MENU) {
if (aMenuPane->NumberOfItemsInPane() <= 1)
@@ -195,7 +163,7 @@ void CQtS60MainAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane
}
}
-void CQtS60MainAppUi::RestoreMenuL(CCoeControl* aMenuWindow, TInt aMenuId, TMenuType aMenuType)
+void QS60MainAppUi::RestoreMenuL(CCoeControl* aMenuWindow, TInt aMenuId, TMenuType aMenuType)
{
if ((aMenuId == R_QT_WRAPPERAPP_MENUBAR) || (aMenuId == R_AVKON_MENUPANE_FEP_DEFAULT)) {
TResourceReader reader;
@@ -210,4 +178,6 @@ void CQtS60MainAppUi::RestoreMenuL(CCoeControl* aMenuWindow, TInt aMenuId, TMenu
DynInitMenuBarL(aMenuId, (CEikMenuBar*)aMenuWindow);
}
+QT_END_NAMESPACE
+
// End of File
diff --git a/src/gui/s60framework/qs60mainappui_p.h b/src/gui/s60framework/qs60mainappui_p.h
new file mode 100644
index 0000000..ef2de27
--- /dev/null
+++ b/src/gui/s60framework/qs60mainappui_p.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Symbian application wrapper of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QS60MAINAPPUI_P_H
+#define QS60MAINAPPUI_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+// INCLUDES
+#include <aknappui.h>
+
+#include <qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+/**
+* QS60MainAppUi application UI class.
+* Interacts with the user through the UI and request message processing
+* from the handler class
+*/
+class QS60MainAppUi : public CAknAppUi
+{
+public: // Constructors and destructor
+
+ /**
+ * ConstructL.
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ /**
+ * QS60MainAppUi.
+ * C++ default constructor. This needs to be public due to
+ * the way the framework constructs the AppUi
+ */
+ QS60MainAppUi();
+
+ /**
+ * ~QS60MainAppUi.
+ * Virtual Destructor.
+ */
+ virtual ~QS60MainAppUi();
+
+protected:
+ void RestoreMenuL(CCoeControl* aMenuWindow,TInt aMenuId,TMenuType aMenuType);
+ void DynInitMenuBarL(TInt aResourceId, CEikMenuBar *aMenuBar);
+ void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane);
+
+private: // Functions from base classes
+
+ /**
+ * From CEikAppUi, HandleCommandL.
+ * Takes care of command handling.
+ * @param aCommand Command to be handled.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * From CAknAppUi, HandleResourceChangeL
+ * Handles resource change events such as layout switches in global level.
+ * @param aType event type.
+ */
+ void HandleResourceChangeL(TInt aType);
+
+ /**
+ * HandleStatusPaneSizeChange.
+ * Called by the framework when the application status pane
+ * size is changed.
+ */
+ void HandleStatusPaneSizeChange();
+
+protected:
+ void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination);
+};
+
+QT_END_NAMESPACE
+
+#endif // QS60MAINAPPUI_P_H
+
+// End of File
diff --git a/src/s60main/qts60maindocument.cpp b/src/gui/s60framework/qs60maindocument.cpp
index 0f134bf..5a34a14 100644
--- a/src/s60main/qts60maindocument.cpp
+++ b/src/gui/s60framework/qs60maindocument.cpp
@@ -41,77 +41,81 @@
// INCLUDE FILES
#include <exception>
-#include "qts60mainappui_p.h"
-#include "qts60maindocument_p.h"
+#include "qs60mainappui_p.h"
+#include "qs60maindocument_p.h"
+
+QT_BEGIN_NAMESPACE
// ============================ MEMBER FUNCTIONS ===============================
// -----------------------------------------------------------------------------
-// CQtS60MainDocument::NewL()
+// QS60MainDocument::NewL()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
-CQtS60MainDocument* CQtS60MainDocument::NewL(CEikApplication& aApp)
+QS60MainDocument* QS60MainDocument::NewL(CEikApplication& aApp)
{
- CQtS60MainDocument* self = NewLC(aApp);
+ QS60MainDocument* self = NewLC(aApp);
CleanupStack::Pop(self);
return self;
}
// -----------------------------------------------------------------------------
-// CQtS60MainDocument::NewLC()
+// QS60MainDocument::NewLC()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
-CQtS60MainDocument* CQtS60MainDocument::NewLC(CEikApplication& aApp)
+QS60MainDocument* QS60MainDocument::NewLC(CEikApplication& aApp)
{
- CQtS60MainDocument* self = new(ELeave) CQtS60MainDocument(aApp);
+ QS60MainDocument* self = new(ELeave) QS60MainDocument(aApp);
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
// -----------------------------------------------------------------------------
-// CQtS60MainDocument::ConstructL()
+// QS60MainDocument::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
-void CQtS60MainDocument::ConstructL()
+void QS60MainDocument::ConstructL()
{
// No implementation required
}
// -----------------------------------------------------------------------------
-// CQtS60MainDocument::CQtS60MainDocument()
+// QS60MainDocument::QS60MainDocument()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
-CQtS60MainDocument::CQtS60MainDocument(CEikApplication& aApp)
+QS60MainDocument::QS60MainDocument(CEikApplication& aApp)
: CAknDocument(aApp)
{
// No implementation required
}
// ---------------------------------------------------------------------------
-// CQtS60MainDocument::~CQtS60MainDocument()
+// QS60MainDocument::~QS60MainDocument()
// Destructor.
// ---------------------------------------------------------------------------
//
-CQtS60MainDocument::~CQtS60MainDocument()
+QS60MainDocument::~QS60MainDocument()
{
// No implementation required
}
// ---------------------------------------------------------------------------
-// CQtS60MainDocument::CreateAppUiL()
+// QS60MainDocument::CreateAppUiL()
// Constructs CreateAppUi.
// ---------------------------------------------------------------------------
//
-CEikAppUi* CQtS60MainDocument::CreateAppUiL()
+CEikAppUi* QS60MainDocument::CreateAppUiL()
{
// Create the application user interface, and return a pointer to it;
// the framework takes ownership of this object
- return (static_cast <CEikAppUi*>(new(ELeave)CQtS60MainAppUi));
+ return (static_cast <CEikAppUi*>(new(ELeave)QS60MainAppUi));
}
+QT_END_NAMESPACE
+
// End of File
diff --git a/src/gui/s60framework/qs60maindocument_p.h b/src/gui/s60framework/qs60maindocument_p.h
new file mode 100644
index 0000000..dfb439f
--- /dev/null
+++ b/src/gui/s60framework/qs60maindocument_p.h
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Symbian application wrapper of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QS60MAINDOCUMENT_P_H
+#define QS60MAINDOCUMENT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+// INCLUDES
+#include <akndoc.h>
+
+#include <qglobal.h>
+
+class CEikApplication;
+
+QT_BEGIN_NAMESPACE
+
+// FORWARD DECLARATIONS
+class QS60MainAppUi;
+
+// CLASS DECLARATION
+
+/**
+* QS60MainDocument application class.
+* An instance of class QS60MainDocument is the Document part of the
+* AVKON application framework for the QtS60Main application.
+*/
+class QS60MainDocument : public CAknDocument
+{
+public: // Constructors and destructor
+
+ /**
+ * NewL.
+ * Two-phased constructor.
+ * Construct a QS60MainDocument for the AVKON application aApp
+ * using two phase construction, and return a pointer
+ * to the created object.
+ * @param aApp Application creating this document.
+ * @return A pointer to the created instance of QS60MainDocument.
+ */
+ static QS60MainDocument* NewL( CEikApplication& aApp );
+
+ /**
+ * NewLC.
+ * Two-phased constructor.
+ * Construct a QS60MainDocument for the AVKON application aApp
+ * using two phase construction, and return a pointer
+ * to the created object.
+ * @param aApp Application creating this document.
+ * @return A pointer to the created instance of QS60MainDocument.
+ */
+ static QS60MainDocument* NewLC( CEikApplication& aApp );
+
+ /**
+ * ~QS60MainDocument
+ * Virtual Destructor.
+ */
+ virtual ~QS60MainDocument();
+
+public: // Functions from base classes
+
+ /**
+ * CreateAppUiL
+ * From CEikDocument, CreateAppUiL.
+ * Create a QS60MainAppUi object and return a pointer to it.
+ * The object returned is owned by the Uikon framework.
+ * @return Pointer to created instance of AppUi.
+ */
+ CEikAppUi* CreateAppUiL();
+
+private: // Constructors
+
+ /**
+ * ConstructL
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ /**
+ * QS60MainDocument.
+ * C++ default constructor.
+ * @param aApp Application creating this document.
+ */
+ QS60MainDocument( CEikApplication& aApp );
+
+};
+
+QT_END_NAMESPACE
+
+#endif // QS60MAINDOCUMENT_P_H
+
+// End of File
diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri
new file mode 100644
index 0000000..f9a6d95
--- /dev/null
+++ b/src/gui/s60framework/s60framework.pri
@@ -0,0 +1,7 @@
+SOURCES += s60framework/qs60mainapplication.cpp \
+ s60framework/qs60mainappui.cpp \
+ s60framework/qs60maindocument.cpp
+
+HEADERS += s60framework/qs60mainapplication_p.h \
+ s60framework/qs60mainappui_p.h \
+ s60framework/qs60maindocument_p.h
diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp
index 0d34c77..b61675b 100644
--- a/src/gui/styles/gtksymbols.cpp
+++ b/src/gui/styles/gtksymbols.cpp
@@ -194,6 +194,7 @@ Ptr_gdk_x11_drawable_get_xdisplay QGtk::gdk_x11_drawable_get_xdisplay = 0;
Ptr_gconf_client_get_default QGtk::gconf_client_get_default = 0;
Ptr_gconf_client_get_string QGtk::gconf_client_get_string = 0;
+Ptr_gconf_client_get_bool QGtk::gconf_client_get_bool = 0;
static QString classPath(GtkWidget *widget)
{
@@ -336,6 +337,7 @@ static bool resolveGConf()
if (!QGtk::gconf_client_get_default) {
QGtk::gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_default");
QGtk::gconf_client_get_string = (Ptr_gconf_client_get_string)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_string");
+ QGtk::gconf_client_get_bool = (Ptr_gconf_client_get_bool)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_bool");
}
return (QGtk::gconf_client_get_default !=0);
}
@@ -361,6 +363,23 @@ QString QGtk::getGConfString(const QString &value, const QString &fallback)
return retVal;
}
+bool QGtk::getGConfBool(const QString &key, bool fallback)
+{
+ bool retVal = fallback;
+ if (resolveGConf()) {
+ g_type_init();
+ GConfClient* client = QGtk::gconf_client_get_default();
+ GError *err = 0;
+ bool result = QGtk::gconf_client_get_bool(client, qPrintable(key), &err);
+ g_object_unref(client);
+ if (!err)
+ retVal = result;
+ else
+ g_error_free (err);
+ }
+ return retVal;
+}
+
static QString getThemeName()
{
QString themeName;
diff --git a/src/gui/styles/gtksymbols_p.h b/src/gui/styles/gtksymbols_p.h
index 596a312..fb9d129 100644
--- a/src/gui/styles/gtksymbols_p.h
+++ b/src/gui/styles/gtksymbols_p.h
@@ -77,6 +77,7 @@ class GConfClient;
typedef GConfClient* (*Ptr_gconf_client_get_default)();
typedef char* (*Ptr_gconf_client_get_string)(GConfClient*, const char*, GError **);
+typedef bool (*Ptr_gconf_client_get_bool)(GConfClient*, const char*, GError **);
typedef void (*Ptr_gtk_init)(int *, char ***);
typedef GtkWidget* (*Ptr_gtk_window_new) (GtkWindowType);
@@ -217,6 +218,7 @@ public:
static QStringList openFilenames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
QString *selectedFilter, QFileDialog::Options options);
static QString getGConfString(const QString &key, const QString &fallback = QString());
+ static bool getGConfBool(const QString &key, bool fallback = 0);
static Ptr_gtk_container_forall gtk_container_forall;
static Ptr_gtk_init gtk_init;
@@ -330,6 +332,7 @@ public:
static Ptr_gconf_client_get_default gconf_client_get_default;
static Ptr_gconf_client_get_string gconf_client_get_string;
+ static Ptr_gconf_client_get_bool gconf_client_get_bool;
};
// Helper to ensure that we have polished all our gtk widgets
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 6d957ca..20f1d26 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -561,14 +561,20 @@ static void qt_cleanlooks_draw_mdibutton(QPainter *painter, const QStyleOptionTi
QColor mdiButtonBorderColor(active ? option->palette.highlight().color().darker(180): dark.darker(110));
painter->setPen(QPen(mdiButtonBorderColor, 1));
- painter->drawLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top());
- painter->drawLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom());
- painter->drawLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2);
- painter->drawLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2);
- painter->drawPoint(tmp.left() + 1, tmp.top() + 1);
- painter->drawPoint(tmp.right() - 1, tmp.top() + 1);
- painter->drawPoint(tmp.left() + 1, tmp.bottom() - 1);
- painter->drawPoint(tmp.right() - 1, tmp.bottom() - 1);
+ const QLine lines[4] = {
+ QLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top()),
+ QLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom()),
+ QLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2),
+ QLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2)
+ };
+ painter->drawLines(lines, 4);
+ const QPoint points[4] = {
+ QPoint(tmp.left() + 1, tmp.top() + 1),
+ QPoint(tmp.right() - 1, tmp.top() + 1),
+ QPoint(tmp.left() + 1, tmp.bottom() - 1),
+ QPoint(tmp.right() - 1, tmp.bottom() - 1)
+ };
+ painter->drawPoints(points, 4);
painter->setPen(titleBarHighlight);
painter->drawLine(tmp.left() + 2, tmp.top() + 1, tmp.right() - 2, tmp.top() + 1);
@@ -900,14 +906,17 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
QRect r = rect.adjusted(0, 1, 0, -1);
painter->setPen(buttonShadowAlpha);
painter->drawLine(QPoint(r.left() + 2, r.top() - 1), QPoint(r.right() - 2, r.top() - 1));
- painter->drawPoint(r.right() - 1, r.top());
- painter->drawPoint(r.right(), r.top() + 1);
- painter->drawPoint(r.right() - 1, r.bottom());
- painter->drawPoint(r.right(), r.bottom() - 1);
- painter->drawPoint(r.left() + 1, r.top() );
- painter->drawPoint(r.left(), r.top() + 1);
- painter->drawPoint(r.left() + 1, r.bottom() );
- painter->drawPoint(r.left(), r.bottom() - 1);
+ const QPoint points[8] = {
+ QPoint(r.right() - 1, r.top()),
+ QPoint(r.right(), r.top() + 1),
+ QPoint(r.right() - 1, r.bottom()),
+ QPoint(r.right(), r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() ),
+ QPoint(r.left(), r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() ),
+ QPoint(r.left(), r.bottom() - 1)
+ };
+ painter->drawPoints(points, 8);
painter->setPen(QPen(option->palette.background().color(), 1));
painter->drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1));
@@ -939,10 +948,13 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
painter->drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
painter->drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2));
painter->drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right() - 2, r.bottom()));
- painter->drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.right() - 1, r.top() + 1));
- painter->drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.left() + 1, r.top() + 1));
+ const QPoint points2[4] = {
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1)
+ };
+ painter->drawPoints(points2, 4);
painter->drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top()));
painter->setPen(oldPen);
}
@@ -1040,10 +1052,13 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
painter->setBrush(QBrush(dark.darker(120), Qt::Dense4Pattern));
painter->setBrushOrigin(rect.topLeft());
painter->setPen(Qt::NoPen);
- painter->drawRect(rect.left(), rect.top(), rect.width(), 1); // Top
- painter->drawRect(rect.left(), rect.bottom(), rect.width(), 1); // Bottom
- painter->drawRect(rect.left(), rect.top(), 1, rect.height()); // Left
- painter->drawRect(rect.right(), rect.top(), 1, rect.height()); // Right
+ const QRect rects[4] = {
+ QRect(rect.left(), rect.top(), rect.width(), 1), // Top
+ QRect(rect.left(), rect.bottom(), rect.width(), 1), // Bottom
+ QRect(rect.left(), rect.top(), 1, rect.height()), // Left
+ QRect(rect.right(), rect.top(), 1, rect.height()) // Right
+ };
+ painter->drawRects(rects, 4);
painter->restore();
}
break;
@@ -1065,18 +1080,24 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
if (isDefault) {
r = option->rect.adjusted(0, 1, 0, -1);
painter->setPen(QPen(Qt::black, 0));
- painter->drawLine(QPoint(r.left() + 2, r.top()),
- QPoint(r.right() - 2, r.top()));
- painter->drawLine(QPoint(r.left(), r.top() + 2),
- QPoint(r.left(), r.bottom() - 2));
- painter->drawLine(QPoint(r.right(), r.top() + 2),
- QPoint(r.right(), r.bottom() - 2));
- painter->drawLine(QPoint(r.left() + 2, r.bottom()),
- QPoint(r.right() - 2, r.bottom()));
- painter->drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.right() - 1, r.top() + 1));
- painter->drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.left() + 1, r.top() + 1));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left() + 2, r.top()),
+ QPoint(r.right() - 2, r.top())),
+ QLine(QPoint(r.left(), r.top() + 2),
+ QPoint(r.left(), r.bottom() - 2)),
+ QLine(QPoint(r.right(), r.top() + 2),
+ QPoint(r.right(), r.bottom() - 2)),
+ QLine(QPoint(r.left() + 2, r.bottom()),
+ QPoint(r.right() - 2, r.bottom()))
+ };
+ painter->drawLines(lines, 4);
+ const QPoint points[4] = {
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1)
+ };
+ painter->drawPoints(points, 4);
painter->setPen(oldPen);
}
return;
@@ -1140,10 +1161,13 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
QPoint(r.right(), r.bottom() - 2));
p->drawLine(QPoint(r.left() + 2, r.bottom()),
QPoint(r.right() - 2, r.bottom()));
- p->drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- p->drawPoint(QPoint(r.right() - 1, r.top() + 1));
- p->drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- p->drawPoint(QPoint(r.left() + 1, r.top() + 1));
+ const QPoint points[4] = {
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1)
+ };
+ p->drawPoints(points, 4);
if (!isDefault && !hasFocus && isEnabled)
p->setPen(QPen(darkOutline.darker(110), 0));
@@ -1163,14 +1187,17 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
topShadow.setAlpha(60);
p->setPen(topShadow);
- p->drawPoint(QPoint(r.right(), r.top() + 1));
- p->drawPoint(QPoint(r.right() - 1, r.top() ));
- p->drawPoint(QPoint(r.right(), r.bottom() - 1));
- p->drawPoint(QPoint(r.right() - 1, r.bottom() ));
- p->drawPoint(QPoint(r.left() + 1, r.bottom()));
- p->drawPoint(QPoint(r.left(), r.bottom() - 1));
- p->drawPoint(QPoint(r.left() + 1, r.top()));
- p->drawPoint(QPoint(r.left(), r.top() + 1));
+ const QPoint points2[8] = {
+ QPoint(r.right(), r.top() + 1),
+ QPoint(r.right() - 1, r.top() ),
+ QPoint(r.right(), r.bottom() - 1),
+ QPoint(r.right() - 1, r.bottom() ),
+ QPoint(r.left() + 1, r.bottom()),
+ QPoint(r.left(), r.bottom() - 1),
+ QPoint(r.left() + 1, r.top()),
+ QPoint(r.left(), r.top() + 1)
+ };
+ p->drawPoints(points2, 8);
topShadow.setAlpha(30);
p->setPen(topShadow);
@@ -1183,18 +1210,24 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
if (isDefault) {
r.adjust(-1, -1, 1, 1);
p->setPen(buttonShadowAlpha.darker(120));
- p->drawLine(r.topLeft() + QPoint(3, 0), r.topRight() - QPoint(3, 0));
- p->drawLine(r.bottomLeft() + QPoint(3, 0), r.bottomRight() - QPoint(3, 0));
- p->drawLine(r.topLeft() + QPoint(0, 3), r.bottomLeft() - QPoint(0, 3));
- p->drawLine(r.topRight() + QPoint(0, 3), r.bottomRight() - QPoint(0, 3));
- p->drawPoint(r.topRight() + QPoint(-2, 1));
- p->drawPoint(r.topRight() + QPoint(-1, 2));
- p->drawPoint(r.bottomRight() + QPoint(-1, -2));
- p->drawPoint(r.bottomRight() + QPoint(-2, -1));
- p->drawPoint(r.topLeft() + QPoint(1, 2));
- p->drawPoint(r.topLeft() + QPoint(2, 1));
- p->drawPoint(r.bottomLeft() + QPoint(1, -2));
- p->drawPoint(r.bottomLeft() + QPoint(2, -1));
+ const QLine lines[4] = {
+ QLine(r.topLeft() + QPoint(3, 0), r.topRight() - QPoint(3, 0)),
+ QLine(r.bottomLeft() + QPoint(3, 0), r.bottomRight() - QPoint(3, 0)),
+ QLine(r.topLeft() + QPoint(0, 3), r.bottomLeft() - QPoint(0, 3)),
+ QLine(r.topRight() + QPoint(0, 3), r.bottomRight() - QPoint(0, 3))
+ };
+ p->drawLines(lines, 4);
+ const QPoint points3[8] = {
+ r.topRight() + QPoint(-2, 1),
+ r.topRight() + QPoint(-1, 2),
+ r.bottomRight() + QPoint(-1, -2),
+ r.bottomRight() + QPoint(-2, -1),
+ r.topLeft() + QPoint(1, 2),
+ r.topLeft() + QPoint(2, 1),
+ r.bottomLeft() + QPoint(1, -2),
+ r.bottomLeft() + QPoint(2, -1)
+ };
+ p->drawPoints(points3, 8);
}
painter->setPen(oldPen);
painter->setBrush(oldBrush);
@@ -1307,12 +1340,15 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
painter->drawLine(innerBottomLine);
painter->setPen(alphaCornerColor);
- painter->drawPoint(leftBottomInnerCorner1);
- painter->drawPoint(leftBottomInnerCorner2);
- painter->drawPoint(rightBottomInnerCorner1);
- painter->drawPoint(rightBottomInnerCorner2);
- painter->drawPoint(leftTopInnerCorner1);
- painter->drawPoint(leftTopInnerCorner2);
+ const QPoint points[6] = {
+ leftBottomInnerCorner1,
+ leftBottomInnerCorner2,
+ rightBottomInnerCorner1,
+ rightBottomInnerCorner2,
+ leftTopInnerCorner1,
+ leftTopInnerCorner2
+ };
+ painter->drawPoints(points, 6);
}
#endif // QT_NO_TABWIDGET
painter->restore();
@@ -1670,19 +1706,25 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
painter->fillRect(rect, option->palette.base());
QColor borderColor = dark.lighter(110);
painter->setPen(QPen(borderColor, 0));
- painter->drawLine(QPoint(rect.left() + 1, rect.top()), QPoint(rect.right() - 1, rect.top()));
- painter->drawLine(QPoint(rect.left() + 1, rect.bottom()), QPoint(rect.right() - 1, rect.bottom()));
- painter->drawLine(QPoint(rect.left(), rect.top() + 1), QPoint(rect.left(), rect.bottom() - 1));
- painter->drawLine(QPoint(rect.right(), rect.top() + 1), QPoint(rect.right(), rect.bottom() - 1));
+ const QLine lines[4] = {
+ QLine(QPoint(rect.left() + 1, rect.top()), QPoint(rect.right() - 1, rect.top())),
+ QLine(QPoint(rect.left() + 1, rect.bottom()), QPoint(rect.right() - 1, rect.bottom())),
+ QLine(QPoint(rect.left(), rect.top() + 1), QPoint(rect.left(), rect.bottom() - 1)),
+ QLine(QPoint(rect.right(), rect.top() + 1), QPoint(rect.right(), rect.bottom() - 1))
+ };
+ painter->drawLines(lines, 4);
QColor alphaCorner = mergedColors(borderColor, option->palette.background().color());
QColor innerShadow = mergedColors(borderColor, option->palette.base().color());
//corner smoothing
painter->setPen(alphaCorner);
- painter->drawPoint(rect.topRight());
- painter->drawPoint(rect.topLeft());
- painter->drawPoint(rect.bottomRight());
- painter->drawPoint(rect.bottomLeft());
+ const QPoint points[4] = {
+ rect.topRight(),
+ rect.topLeft(),
+ rect.bottomRight(),
+ rect.bottomLeft()
+ };
+ painter->drawPoints(points, 4);
//inner shadow
painter->setPen(innerShadow);
@@ -1807,10 +1849,13 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
option->palette.highlight());
painter->setPen(QPen(highlightOutline, 0));
- painter->drawLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom()));
- painter->drawLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom()));
- painter->drawLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom()));
- painter->drawLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom())),
+ QLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom())),
+ QLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())),
+ QLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()))
+ };
+ painter->drawLines(lines, 4);
//draw text
QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText;
@@ -1864,10 +1909,13 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
highlight);
r = r.adjusted(-1, 0, 1, 0);
painter->setPen(QPen(highlightOutline, 0));
- painter->drawLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom() - 1));
- painter->drawLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom() - 1));
- painter->drawLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom()));
- painter->drawLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom() - 1)),
+ QLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom() - 1)),
+ QLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())),
+ QLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()))
+ };
+ painter->drawLines(lines, 4);
} else {
painter->fillRect(option->rect, menuBackground);
}
@@ -2447,14 +2495,17 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
cachePainter.setPen(topShadow);
// antialias corners
- cachePainter.drawPoint(QPoint(r.right(), r.top() + 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.top() ));
- cachePainter.drawPoint(QPoint(r.right(), r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.bottom() ));
- cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom()));
- cachePainter.drawPoint(QPoint(r.left(), r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.left() + 1, r.top()));
- cachePainter.drawPoint(QPoint(r.left(), r.top() + 1));
+ const QPoint points[8] = {
+ QPoint(r.right(), r.top() + 1),
+ QPoint(r.right() - 1, r.top() ),
+ QPoint(r.right(), r.bottom() - 1),
+ QPoint(r.right() - 1, r.bottom() ),
+ QPoint(r.left() + 1, r.bottom()),
+ QPoint(r.left(), r.bottom() - 1),
+ QPoint(r.left() + 1, r.top()),
+ QPoint(r.left(), r.top() + 1)
+ };
+ cachePainter.drawPoints(points, 8);
// draw frame
topShadow.setAlpha(30);
@@ -2482,10 +2533,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
cachePainter.setPen(QPen(darkOutline, 1));
// top and bottom lines
- cachePainter.drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- 2, r.bottom()));
- cachePainter.drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top()));
- cachePainter.drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2));
- cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- 2, r.bottom())),
+ QLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top())),
+ QLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2)),
+ QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2))
+ };
+ cachePainter.drawLines(lines, 4);
}
// gradients
@@ -2519,10 +2573,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
if (spinBox->frame) {
// rounded corners
- cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.left() + 1, r.top() + 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.top() + 1));
+ const QPoint points[4] = {
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1),
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1)
+ };
+ cachePainter.drawPoints(points, 4);
if (option->state & State_HasFocus) {
QColor darkoutline = option->palette.highlight().color().darker(150);
@@ -2531,10 +2588,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
if (spinBox->direction == Qt::LeftToRight) {
cachePainter.drawRect(rect.adjusted(1, 2, -3 -downRect.width(), -3));
cachePainter.setPen(QPen(darkoutline, 0));
- cachePainter.drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- downRect.width() - 1, r.bottom()));
- cachePainter.drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - downRect.width() - 1, r.top()));
- cachePainter.drawLine(QPoint(r.right() - downRect.width() - 1, r.top() + 1), QPoint(r.right()- downRect.width() - 1, r.bottom() - 1));
- cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- downRect.width() - 1, r.bottom())),
+ QLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - downRect.width() - 1, r.top())),
+ QLine(QPoint(r.right() - downRect.width() - 1, r.top() + 1), QPoint(r.right()- downRect.width() - 1, r.bottom() - 1)),
+ QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2))
+ };
+ cachePainter.drawLines(lines, 4);
cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
cachePainter.drawPoint(QPoint(r.left() + 1, r.top() + 1));
cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
@@ -2679,18 +2739,24 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
// top outline
painter->drawLine(fullRect.left() + 5, fullRect.top(), fullRect.right() - 5, fullRect.top());
painter->drawLine(fullRect.left(), fullRect.top() + 4, fullRect.left(), fullRect.bottom());
- painter->drawPoint(fullRect.left() + 4, fullRect.top() + 1);
- painter->drawPoint(fullRect.left() + 3, fullRect.top() + 1);
- painter->drawPoint(fullRect.left() + 2, fullRect.top() + 2);
- painter->drawPoint(fullRect.left() + 1, fullRect.top() + 3);
- painter->drawPoint(fullRect.left() + 1, fullRect.top() + 4);
+ const QPoint points[5] = {
+ QPoint(fullRect.left() + 4, fullRect.top() + 1),
+ QPoint(fullRect.left() + 3, fullRect.top() + 1),
+ QPoint(fullRect.left() + 2, fullRect.top() + 2),
+ QPoint(fullRect.left() + 1, fullRect.top() + 3),
+ QPoint(fullRect.left() + 1, fullRect.top() + 4)
+ };
+ painter->drawPoints(points, 5);
painter->drawLine(fullRect.right(), fullRect.top() + 4, fullRect.right(), fullRect.bottom());
- painter->drawPoint(fullRect.right() - 3, fullRect.top() + 1);
- painter->drawPoint(fullRect.right() - 4, fullRect.top() + 1);
- painter->drawPoint(fullRect.right() - 2, fullRect.top() + 2);
- painter->drawPoint(fullRect.right() - 1, fullRect.top() + 3);
- painter->drawPoint(fullRect.right() - 1, fullRect.top() + 4);
+ const QPoint points2[5] = {
+ QPoint(fullRect.right() - 3, fullRect.top() + 1),
+ QPoint(fullRect.right() - 4, fullRect.top() + 1),
+ QPoint(fullRect.right() - 2, fullRect.top() + 2),
+ QPoint(fullRect.right() - 1, fullRect.top() + 3),
+ QPoint(fullRect.right() - 1, fullRect.top() + 4)
+ };
+ painter->drawPoints(points2, 5);
// draw bottomline
painter->drawLine(fullRect.right(), fullRect.bottom(), fullRect.left(), fullRect.bottom());
@@ -2749,10 +2815,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->drawLine(maxButtonIconRect.left() + 1, maxButtonIconRect.top() + 1,
maxButtonIconRect.right() - 1, maxButtonIconRect.top() + 1);
painter->setPen(textAlphaColor);
- painter->drawPoint(maxButtonIconRect.topLeft());
- painter->drawPoint(maxButtonIconRect.topRight());
- painter->drawPoint(maxButtonIconRect.bottomLeft());
- painter->drawPoint(maxButtonIconRect.bottomRight());
+ const QPoint points[4] = {
+ maxButtonIconRect.topLeft(),
+ maxButtonIconRect.topRight(),
+ maxButtonIconRect.bottomLeft(),
+ maxButtonIconRect.bottomRight()
+ };
+ painter->drawPoints(points, 4);
}
}
@@ -2765,18 +2834,24 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
qt_cleanlooks_draw_mdibutton(painter, titleBar, closeButtonRect, hover, sunken);
QRect closeIconRect = closeButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
painter->setPen(textAlphaColor);
- painter->drawLine(closeIconRect.left() + 1, closeIconRect.top(),
- closeIconRect.right(), closeIconRect.bottom() - 1);
- painter->drawLine(closeIconRect.left(), closeIconRect.top() + 1,
- closeIconRect.right() - 1, closeIconRect.bottom());
- painter->drawLine(closeIconRect.right() - 1, closeIconRect.top(),
- closeIconRect.left(), closeIconRect.bottom() - 1);
- painter->drawLine(closeIconRect.right(), closeIconRect.top() + 1,
- closeIconRect.left() + 1, closeIconRect.bottom());
- painter->drawPoint(closeIconRect.topLeft());
- painter->drawPoint(closeIconRect.topRight());
- painter->drawPoint(closeIconRect.bottomLeft());
- painter->drawPoint(closeIconRect.bottomRight());
+ const QLine lines[4] = {
+ QLine(closeIconRect.left() + 1, closeIconRect.top(),
+ closeIconRect.right(), closeIconRect.bottom() - 1),
+ QLine(closeIconRect.left(), closeIconRect.top() + 1,
+ closeIconRect.right() - 1, closeIconRect.bottom()),
+ QLine(closeIconRect.right() - 1, closeIconRect.top(),
+ closeIconRect.left(), closeIconRect.bottom() - 1),
+ QLine(closeIconRect.right(), closeIconRect.top() + 1,
+ closeIconRect.left() + 1, closeIconRect.bottom())
+ };
+ painter->drawLines(lines, 4);
+ const QPoint points[4] = {
+ closeIconRect.topLeft(),
+ closeIconRect.topRight(),
+ closeIconRect.bottomLeft(),
+ closeIconRect.bottomRight()
+ };
+ painter->drawPoints(points, 4);
painter->setPen(textColor);
painter->drawLine(closeIconRect.left() + 1, closeIconRect.top() + 1,
@@ -2806,10 +2881,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->drawLine(frontWindowRect.left() + 1, frontWindowRect.top() + 1,
frontWindowRect.right() - 1, frontWindowRect.top() + 1);
painter->setPen(textAlphaColor);
- painter->drawPoint(frontWindowRect.topLeft());
- painter->drawPoint(frontWindowRect.topRight());
- painter->drawPoint(frontWindowRect.bottomLeft());
- painter->drawPoint(frontWindowRect.bottomRight());
+ const QPoint points[4] = {
+ frontWindowRect.topLeft(),
+ frontWindowRect.topRight(),
+ frontWindowRect.bottomLeft(),
+ frontWindowRect.bottomRight()
+ };
+ painter->drawPoints(points, 4);
QRect backWindowRect = normalButtonIconRect.adjusted(3, 0, 0, -3);
QRegion clipRegion = backWindowRect;
@@ -2821,10 +2899,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->drawLine(backWindowRect.left() + 1, backWindowRect.top() + 1,
backWindowRect.right() - 1, backWindowRect.top() + 1);
painter->setPen(textAlphaColor);
- painter->drawPoint(backWindowRect.topLeft());
- painter->drawPoint(backWindowRect.topRight());
- painter->drawPoint(backWindowRect.bottomLeft());
- painter->drawPoint(backWindowRect.bottomRight());
+ const QPoint points2[4] = {
+ backWindowRect.topLeft(),
+ backWindowRect.topRight(),
+ backWindowRect.bottomLeft(),
+ backWindowRect.bottomRight()
+ };
+ painter->drawPoints(points2, 4);
painter->restore();
}
}
@@ -3498,10 +3579,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
handlePainter.save();
handlePainter.setRenderHint(QPainter::Antialiasing);
handlePainter.translate(0.5, 0.5);
- handlePainter.drawLine(QPoint(r.left(), r.bottom() - 2), QPoint(r.left() + 2, r.bottom()));
- handlePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left() + 2, r.top()));
- handlePainter.drawLine(QPoint(r.right(), r.bottom() - 2), QPoint(r.right() - 2, r.bottom()));
- handlePainter.drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right() - 2, r.top()));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left(), r.bottom() - 2), QPoint(r.left() + 2, r.bottom())),
+ QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left() + 2, r.top())),
+ QLine(QPoint(r.right(), r.bottom() - 2), QPoint(r.right() - 2, r.bottom())),
+ QLine(QPoint(r.right(), r.top() + 2), QPoint(r.right() - 2, r.top()))
+ };
+ handlePainter.drawLines(lines, 4);
handlePainter.restore();;
handlePainter.setPen(QPen(outline.darker(130), 1));
handlePainter.drawLine(QPoint(r.left() + 3, r.top()), QPoint(r.right() - 3, r.top()));
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index c9bdb7f..41f9ec0 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -5219,7 +5219,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
Q_UNUSED(sp);
#else
QPixmap pixmap;
- const bool rtl = (option && option->direction == Qt::RightToLeft) || !option && QApplication::isRightToLeft();
+ const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
switch (sp) {
@@ -5509,7 +5509,7 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons
const QWidget *widget) const
{
QIcon icon;
- const bool rtl = (option && option->direction == Qt::RightToLeft) || !option && QApplication::isRightToLeft();
+ const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
switch (standardIcon) {
case SP_DirHomeIcon:
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index 87fa322..0ccf219 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -656,6 +656,11 @@ int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidg
return !scrollbars_within_bevel;
}
+ case SH_DialogButtonBox_ButtonsHaveIcons: {
+ static bool buttonsHaveIcons = QGtk::getGConfBool(QLS("/desktop/gnome/interface/buttons_have_icons"));
+ return buttonsHaveIcons;
+ }
+
default:
return QCleanlooksStyle::styleHint(hint, option, widget, returnData);
}
diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp
index d61d291..a5d524c 100644
--- a/src/gui/styles/qstyle.cpp
+++ b/src/gui/styles/qstyle.cpp
@@ -1897,11 +1897,9 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
Returns an integer representing the specified style \a hint for
the given \a widget described by the provided style \a option.
- Note that currently, the \a returnData and \a widget parameters
- are not used; they are provided for future enhancement. In
- addition, the \a option parameter is used only in case of the
- SH_ComboBox_Popup, SH_ComboBox_LayoutDirection, and
- SH_GroupBox_TextLabelColor style hints.
+ \a returnData is used when the querying widget needs more detailed data than
+ the integer that styleHint() returns. See the QStyleHintReturn class
+ description for details.
*/
/*!
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp
index a54c701..3789854 100644
--- a/src/gui/styles/qwindowsvistastyle.cpp
+++ b/src/gui/styles/qwindowsvistastyle.cpp
@@ -1094,7 +1094,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
XPThemeData theme(widget, painter, QLatin1String("PROGRESS"), vertical ? PP_FILLVERT : PP_FILL);
theme.rect = option->rect;
- bool reverse = bar->direction == (Qt::LeftToRight && inverted) || (bar->direction == Qt::RightToLeft && !inverted);
+ bool reverse = (bar->direction == Qt::LeftToRight && inverted) || (bar->direction == Qt::RightToLeft && !inverted);
QTime current = QTime::currentTime();
if (isIndeterminate) {
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 6978b45..f252444 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -2126,6 +2126,7 @@ void Parser::init(const QString &css, bool isFile)
hasEscapeSequences = false;
symbols.resize(0);
+ symbols.reserve(8);
Scanner::scan(Scanner::preprocess(styleSheet, &hasEscapeSequences), &symbols);
index = 0;
errorIndex = -1;
diff --git a/src/gui/text/qcssscanner.cpp b/src/gui/text/qcssscanner.cpp
index 74ab7d9..5bbf638 100644
--- a/src/gui/text/qcssscanner.cpp
+++ b/src/gui/text/qcssscanner.cpp
@@ -46,7 +46,7 @@ public:
QCssScanner_Generated(const QString &inp);
inline QChar next() {
- return (pos < input.length()) ? input.at(pos++).toLower() : QChar();
+ return (pos < input.length()) ? input.at(pos++) : QChar();
}
int handleCommentStart();
int lex();
@@ -73,7 +73,7 @@ int QCssScanner_Generated::lex()
int lastAcceptingPos = -1;
int token = -1;
QChar ch;
-
+
// initial state
ch = next();
if (ch.unicode() >= 9 && ch.unicode() <= 10)
@@ -146,7 +146,7 @@ int QCssScanner_Generated::lex()
}
if (ch.unicode() == 95)
goto state_24;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_24;
if (ch.unicode() == 123)
goto state_25;
@@ -196,7 +196,7 @@ int QCssScanner_Generated::lex()
goto state_32;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
goto state_30;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_30;
if (ch.unicode() >= 123)
goto state_30;
@@ -211,7 +211,7 @@ int QCssScanner_Generated::lex()
goto state_34;
if (ch.unicode() == 95)
goto state_33;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_33;
goto out;
state_5:
@@ -232,7 +232,7 @@ int QCssScanner_Generated::lex()
goto state_37;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
goto state_35;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_35;
if (ch.unicode() >= 123)
goto state_35;
@@ -255,7 +255,7 @@ int QCssScanner_Generated::lex()
goto state_22;
if (ch.unicode() == 95)
goto state_24;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_24;
goto out;
state_12:
@@ -290,7 +290,7 @@ int QCssScanner_Generated::lex()
goto state_45;
if (ch.unicode() == 95)
goto state_46;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_46;
goto out;
state_17:
@@ -310,7 +310,7 @@ int QCssScanner_Generated::lex()
goto state_49;
if (ch.unicode() == 95)
goto state_50;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_50;
goto out;
state_22:
@@ -340,7 +340,7 @@ int QCssScanner_Generated::lex()
goto state_54;
if (ch.unicode() == 95)
goto state_53;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_53;
goto out;
state_25:
@@ -400,7 +400,7 @@ int QCssScanner_Generated::lex()
goto state_32;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
goto state_30;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_30;
if (ch.unicode() >= 123)
goto state_30;
@@ -440,7 +440,7 @@ int QCssScanner_Generated::lex()
goto state_62;
if (ch.unicode() == 95)
goto state_61;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_61;
goto out;
state_34:
@@ -474,7 +474,7 @@ int QCssScanner_Generated::lex()
goto state_37;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
goto state_35;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_35;
if (ch.unicode() >= 123)
goto state_35;
@@ -523,7 +523,7 @@ int QCssScanner_Generated::lex()
goto state_45;
if (ch.unicode() == 95)
goto state_46;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_46;
goto out;
state_41:
@@ -536,7 +536,7 @@ int QCssScanner_Generated::lex()
goto state_45;
if (ch.unicode() == 95)
goto state_46;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_46;
goto out;
state_43:
@@ -560,7 +560,7 @@ int QCssScanner_Generated::lex()
goto state_45;
if (ch.unicode() == 95)
goto state_46;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_46;
goto out;
state_45:
@@ -588,7 +588,7 @@ int QCssScanner_Generated::lex()
goto state_72;
if (ch.unicode() == 95)
goto state_71;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_71;
goto out;
state_47:
@@ -602,7 +602,7 @@ int QCssScanner_Generated::lex()
goto state_49;
if (ch.unicode() == 95)
goto state_50;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_50;
goto out;
state_49:
@@ -630,7 +630,7 @@ int QCssScanner_Generated::lex()
goto state_76;
if (ch.unicode() == 95)
goto state_75;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_75;
goto out;
state_51:
@@ -647,7 +647,7 @@ int QCssScanner_Generated::lex()
goto state_54;
if (ch.unicode() == 95)
goto state_53;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_53;
goto out;
state_52:
@@ -668,7 +668,7 @@ int QCssScanner_Generated::lex()
goto state_54;
if (ch.unicode() == 95)
goto state_53;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_53;
goto out;
state_54:
@@ -702,7 +702,7 @@ int QCssScanner_Generated::lex()
goto state_32;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
goto state_30;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_30;
if (ch.unicode() >= 123)
goto state_30;
@@ -725,7 +725,7 @@ int QCssScanner_Generated::lex()
goto state_32;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
goto state_30;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_30;
if (ch.unicode() >= 123)
goto state_30;
@@ -748,7 +748,7 @@ int QCssScanner_Generated::lex()
goto state_32;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
goto state_30;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_30;
if (ch.unicode() >= 123)
goto state_30;
@@ -773,7 +773,7 @@ int QCssScanner_Generated::lex()
goto state_32;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
goto state_30;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_30;
if (ch.unicode() >= 123)
goto state_30;
@@ -790,7 +790,7 @@ int QCssScanner_Generated::lex()
goto state_62;
if (ch.unicode() == 95)
goto state_61;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_61;
goto out;
state_62:
@@ -818,7 +818,7 @@ int QCssScanner_Generated::lex()
goto state_62;
if (ch.unicode() == 95)
goto state_61;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_61;
goto out;
state_64:
@@ -839,7 +839,7 @@ int QCssScanner_Generated::lex()
goto state_37;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
goto state_35;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_35;
if (ch.unicode() >= 123)
goto state_35;
@@ -862,7 +862,7 @@ int QCssScanner_Generated::lex()
goto state_37;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
goto state_35;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_35;
if (ch.unicode() >= 123)
goto state_35;
@@ -885,7 +885,7 @@ int QCssScanner_Generated::lex()
goto state_37;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
goto state_35;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_35;
if (ch.unicode() >= 123)
goto state_35;
@@ -910,7 +910,7 @@ int QCssScanner_Generated::lex()
goto state_37;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
goto state_35;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_35;
if (ch.unicode() >= 123)
goto state_35;
@@ -929,7 +929,7 @@ int QCssScanner_Generated::lex()
goto state_45;
if (ch.unicode() == 95)
goto state_46;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_46;
goto out;
state_70:
@@ -944,7 +944,7 @@ int QCssScanner_Generated::lex()
goto state_72;
if (ch.unicode() == 95)
goto state_71;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_71;
goto out;
state_71:
@@ -959,7 +959,7 @@ int QCssScanner_Generated::lex()
goto state_72;
if (ch.unicode() == 95)
goto state_71;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_71;
goto out;
state_72:
@@ -994,7 +994,7 @@ int QCssScanner_Generated::lex()
goto state_76;
if (ch.unicode() == 95)
goto state_75;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_75;
goto out;
state_75:
@@ -1009,7 +1009,7 @@ int QCssScanner_Generated::lex()
goto state_76;
if (ch.unicode() == 95)
goto state_75;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_75;
goto out;
state_76:
@@ -1039,7 +1039,7 @@ int QCssScanner_Generated::lex()
goto state_54;
if (ch.unicode() == 95)
goto state_53;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_53;
goto out;
state_78:
@@ -1060,7 +1060,7 @@ int QCssScanner_Generated::lex()
goto state_32;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
goto state_30;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_30;
if (ch.unicode() >= 123)
goto state_30;
@@ -1077,7 +1077,7 @@ int QCssScanner_Generated::lex()
goto state_62;
if (ch.unicode() == 95)
goto state_61;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_61;
goto out;
state_80:
@@ -1098,7 +1098,7 @@ int QCssScanner_Generated::lex()
goto state_37;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
goto state_35;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_35;
if (ch.unicode() >= 123)
goto state_35;
@@ -1115,7 +1115,7 @@ int QCssScanner_Generated::lex()
goto state_72;
if (ch.unicode() == 95)
goto state_71;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_71;
goto out;
state_83:
@@ -1130,12 +1130,12 @@ int QCssScanner_Generated::lex()
goto state_76;
if (ch.unicode() == 95)
goto state_75;
- if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || ch.unicode() >= 256)
+ if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
goto state_75;
goto out;
found:
lastAcceptingPos = pos;
-
+
out:
if (lastAcceptingPos != -1) {
lexemLength = lastAcceptingPos - lexemStart;
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index 323a171..9fe660a 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -307,6 +307,8 @@ private:
friend class QPainterPath;
friend class QTextItemInt;
friend class QPicturePaintEngine;
+ friend class QPainterReplayer;
+ friend class QPaintBufferEngine;
#ifndef QT_NO_DATASTREAM
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QFont &);
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 0e2dc31..78847ef 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -595,7 +595,7 @@ static QList<QFontDatabase::WritingSystem> determineWritingSystemsFromTrueTypeBi
class QFontDatabaseS60Store
{
public:
- virtual ~QFontDatabaseS60Store() {};
+ virtual ~QFontDatabaseS60Store() {}
};
#endif
diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp
index 6196f0f..87dab42 100644
--- a/src/gui/util/qcompleter.cpp
+++ b/src/gui/util/qcompleter.cpp
@@ -823,12 +823,11 @@ void QCompleterPrivate::_q_complete(QModelIndex index, bool highlighted)
Q_Q(QCompleter);
QString completion;
- if (!(index.flags() & Qt::ItemIsEnabled))
- return;
-
if (!index.isValid() || (!proxy->showAll && (index.row() >= proxy->engine->matchCount()))) {
completion = prefix;
} else {
+ if (!(index.flags() & Qt::ItemIsEnabled))
+ return;
QModelIndex si = proxy->mapToSource(index);
si = si.sibling(si.row(), column); // for clicked()
completion = q->pathFromIndex(si);
diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp
index 770e769..6de7c10 100644
--- a/src/gui/widgets/qabstractscrollarea.cpp
+++ b/src/gui/widgets/qabstractscrollarea.cpp
@@ -54,6 +54,7 @@
#ifdef Q_WS_WIN
#include "qstandardgestures.h"
+#include <private/qstandardgestures_p.h>
#endif
#include "qabstractscrollarea_p.h"
@@ -299,8 +300,11 @@ void QAbstractScrollAreaPrivate::init()
layoutChildren();
#ifdef Q_WS_WIN
- panGesture = new QPanGesture(viewport);
+ panGesture = new QPanGesture(viewport, q);
+ panGesture->d_func()->implicitGesture = true;
+ QObject::connect(panGesture, SIGNAL(started()), q, SLOT(_q_gestureTriggered()));
QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered()));
+ QObject::connect(panGesture, SIGNAL(finished()), q, SLOT(_q_gestureTriggered()));
#endif // Q_WS_WIN
}
diff --git a/src/gui/widgets/qcalendarwidget.cpp b/src/gui/widgets/qcalendarwidget.cpp
index dfd8639..8ed57cd 100644
--- a/src/gui/widgets/qcalendarwidget.cpp
+++ b/src/gui/widgets/qcalendarwidget.cpp
@@ -1967,9 +1967,7 @@ void QCalendarWidgetPrivate::_q_editingFinished()
The widget is initialized with the current month and year, but
QCalendarWidget provides several public slots to change the year
- and month that is shown. The currently displayed month and year
- can be retrieved using the currentPageMonth() and currentPageYear()
- functions, respectively.
+ and month that is shown.
By default, today's date is selected, and the user can select a
date using both mouse and keyboard. The currently selected date
@@ -1982,6 +1980,9 @@ void QCalendarWidgetPrivate::_q_editingFinished()
all. Note that a date also can be selected programmatically using
the setSelectedDate() slot.
+ The currently displayed month and year can be retrieved using the
+ monthShown() and yearShown() functions, respectively.
+
A newly created calendar widget uses abbreviated day names, and
both Saturdays and Sundays are marked in red. The calendar grid is
not visible. The week numbers are displayed, and the first column
@@ -2287,7 +2288,7 @@ int QCalendarWidget::monthShown() const
selected date.
The currently displayed month and year can be retrieved using the
- currentPageMonth() and currentPageYear() functions respectively.
+ monthShown() and yearShown() functions respectively.
\sa yearShown(), monthShown(), showPreviousMonth(), showNextMonth(),
showPreviousYear(), showNextYear()
diff --git a/src/gui/widgets/qcocoamenu_mac.mm b/src/gui/widgets/qcocoamenu_mac.mm
index bda9352..5f95b70 100644
--- a/src/gui/widgets/qcocoamenu_mac.mm
+++ b/src/gui/widgets/qcocoamenu_mac.mm
@@ -37,9 +37,6 @@
**
** $QT_END_LICENSE$
**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
****************************************************************************/
#include "qmacdefines_mac.h"
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp
index 3d1d3b1..3920ae9 100644
--- a/src/gui/widgets/qdockarealayout.cpp
+++ b/src/gui/widgets/qdockarealayout.cpp
@@ -2601,28 +2601,28 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list,
center_rect.setBottom(rect.bottom() - docks[QInternal::BottomDock].rect.height() - sep);
QSize left_hint = docks[QInternal::LeftDock].size();
- if (!left_hint.isValid())
+ if (left_hint.isNull())
left_hint = docks[QInternal::LeftDock].sizeHint();
QSize left_min = docks[QInternal::LeftDock].minimumSize();
QSize left_max = docks[QInternal::LeftDock].maximumSize();
left_hint = left_hint.boundedTo(left_max).expandedTo(left_min);
QSize right_hint = docks[QInternal::RightDock].size();
- if (!right_hint.isValid())
+ if (right_hint.isNull())
right_hint = docks[QInternal::RightDock].sizeHint();
QSize right_min = docks[QInternal::RightDock].minimumSize();
QSize right_max = docks[QInternal::RightDock].maximumSize();
right_hint = right_hint.boundedTo(right_max).expandedTo(right_min);
QSize top_hint = docks[QInternal::TopDock].size();
- if (!top_hint.isValid())
+ if (top_hint.isNull())
top_hint = docks[QInternal::TopDock].sizeHint();
QSize top_min = docks[QInternal::TopDock].minimumSize();
QSize top_max = docks[QInternal::TopDock].maximumSize();
top_hint = top_hint.boundedTo(top_max).expandedTo(top_min);
QSize bottom_hint = docks[QInternal::BottomDock].size();
- if (!bottom_hint.isValid())
+ if (bottom_hint.isNull())
bottom_hint = docks[QInternal::BottomDock].sizeHint();
QSize bottom_min = docks[QInternal::BottomDock].minimumSize();
QSize bottom_max = docks[QInternal::BottomDock].maximumSize();
diff --git a/src/gui/widgets/qmaccocoaviewcontainer_mac.mm b/src/gui/widgets/qmaccocoaviewcontainer_mac.mm
index 2ed2e5f..a45d992 100644
--- a/src/gui/widgets/qmaccocoaviewcontainer_mac.mm
+++ b/src/gui/widgets/qmaccocoaviewcontainer_mac.mm
@@ -37,9 +37,6 @@
**
** $QT_END_LICENSE$
**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
****************************************************************************/
#import <Cocoa/Cocoa.h>
diff --git a/src/gui/widgets/qmacnativewidget_mac.mm b/src/gui/widgets/qmacnativewidget_mac.mm
index 28fa1ec..224a51f 100644
--- a/src/gui/widgets/qmacnativewidget_mac.mm
+++ b/src/gui/widgets/qmacnativewidget_mac.mm
@@ -37,9 +37,6 @@
**
** $QT_END_LICENSE$
**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
****************************************************************************/
#import <Cocoa/Cocoa.h>
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index 2ccd3e7..797c7c5 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -37,9 +37,6 @@
**
** $QT_END_LICENSE$
**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
****************************************************************************/
#include <private/qmainwindowlayout_p.h>
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index c79e482..085341c 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -794,10 +794,6 @@ void QPlainTextEditPrivate::init(const QString &txt)
viewport->setCursor(Qt::IBeamCursor);
#endif
originalOffsetY = 0;
-#ifdef Q_WS_WIN
- panGesture = new QPanGesture(q);
- QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered()));
-#endif
}
void QPlainTextEditPrivate::_q_repaintContents(const QRectF &contentsRect)
diff --git a/src/gui/widgets/qplaintextedit_p.h b/src/gui/widgets/qplaintextedit_p.h
index 7ff0c03..cda1d92 100644
--- a/src/gui/widgets/qplaintextedit_p.h
+++ b/src/gui/widgets/qplaintextedit_p.h
@@ -182,7 +182,6 @@ public:
#ifdef Q_WS_WIN
void _q_gestureTriggered();
- QPanGesture *panGesture;
#endif
};
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp
index 64e383f..560b76c 100644
--- a/src/gui/widgets/qtabbar.cpp
+++ b/src/gui/widgets/qtabbar.cpp
@@ -1897,13 +1897,8 @@ void QTabBar::keyPressEvent(QKeyEvent *event)
event->ignore();
return;
}
- int dx = event->key() == (isRightToLeft() ? Qt::Key_Right : Qt::Key_Left) ? -1 : 1;
- for (int index = d->currentIndex + dx; d->validIndex(index); index += dx) {
- if (d->tabList.at(index).enabled) {
- setCurrentIndex(index);
- break;
- }
- }
+ int offset = event->key() == (isRightToLeft() ? Qt::Key_Right : Qt::Key_Left) ? -1 : 1;
+ d->setCurrentNextEnabledIndex(offset);
}
/*!\reimp
@@ -1912,15 +1907,23 @@ void QTabBar::keyPressEvent(QKeyEvent *event)
void QTabBar::wheelEvent(QWheelEvent *event)
{
Q_D(QTabBar);
- int overIndex = d->indexAtPos(event->pos());
- if (overIndex != -1) {
- int offset = event->delta() > 0 ? -1 : 1;
- setCurrentIndex(currentIndex() + offset);
- }
+ int offset = event->delta() > 0 ? -1 : 1;
+ d->setCurrentNextEnabledIndex(offset);
QWidget::wheelEvent(event);
}
#endif //QT_NO_WHEELEVENT
+void QTabBarPrivate::setCurrentNextEnabledIndex(int offset)
+{
+ Q_Q(QTabBar);
+ for (int index = currentIndex + offset; validIndex(index); index += offset) {
+ if (tabList.at(index).enabled) {
+ q->setCurrentIndex(index);
+ break;
+ }
+ }
+}
+
/*!\reimp
*/
void QTabBar::changeEvent(QEvent *event)
diff --git a/src/gui/widgets/qtabbar_p.h b/src/gui/widgets/qtabbar_p.h
index 150909e..2ddd8bb 100644
--- a/src/gui/widgets/qtabbar_p.h
+++ b/src/gui/widgets/qtabbar_p.h
@@ -159,6 +159,7 @@ public:
int indexAtPos(const QPoint &p) const;
inline bool validIndex(int index) const { return index >= 0 && index < tabList.count(); }
+ void setCurrentNextEnabledIndex(int offset);
QSize minimumTabSizeHint(int index);
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp
index 547a4fb..cc79464 100644
--- a/src/gui/widgets/qtextedit.cpp
+++ b/src/gui/widgets/qtextedit.cpp
@@ -67,8 +67,6 @@
#include <qtexttable.h>
#include <qvariant.h>
-#include <qstandardgestures.h>
-
#include <qinputcontext.h>
#endif
diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp
index 71bbf83..6ae230f 100644
--- a/src/multimedia/audio/qaudioformat.cpp
+++ b/src/multimedia/audio/qaudioformat.cpp
@@ -57,10 +57,32 @@ public:
sampleType = QAudioFormat::Unknown;
}
+ QAudioFormatPrivate(const QAudioFormatPrivate &other):
+ QSharedData(other),
+ codec(other.codec),
+ byteOrder(other.byteOrder),
+ sampleType(other.sampleType),
+ frequency(other.frequency),
+ channels(other.channels),
+ sampleSize(other.sampleSize)
+ {
+ }
+
+ QAudioFormatPrivate& operator=(const QAudioFormatPrivate &other)
+ {
+ codec = other.codec;
+ byteOrder = other.byteOrder;
+ sampleType = other.sampleType;
+ frequency = other.frequency;
+ channels = other.channels;
+ sampleSize = other.sampleSize;
+
+ return *this;
+ }
+
QString codec;
QAudioFormat::Endian byteOrder;
QAudioFormat::SampleType sampleType;
-
int frequency;
int channels;
int sampleSize;
diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro
index 53fcb49..c729103 100644
--- a/src/multimedia/multimedia.pro
+++ b/src/multimedia/multimedia.pro
@@ -10,3 +10,5 @@ include(../qbase.pri)
include(audio/audio.pri)
include(video/video.pri)
+
+symbian: TARGET.UID3 = 0x2001E627 \ No newline at end of file
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index e68aa3a..bd6fa57 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -425,32 +425,25 @@ void QHttpNetworkConnectionPrivate::dequeueAndSendRequest(QAbstractSocket *socke
int i = indexOf(socket);
if (!highPriorityQueue.isEmpty()) {
- for (int j = highPriorityQueue.count() - 1; j >= 0; --j) {
- HttpMessagePair &messagePair = highPriorityQueue[j];
- if (!messagePair.second->d_func()->requestIsPrepared)
- prepareRequest(messagePair);
-
- channels[i].request = messagePair.first;
- channels[i].reply = messagePair.second;
- // remove before sendRequest! else we might pipeline the same request again
- highPriorityQueue.removeAt(j);
- channels[i].sendRequest();
- return;
- }
+ // remove from queue before sendRequest! else we might pipeline the same request again
+ HttpMessagePair messagePair = highPriorityQueue.takeLast();
+ if (!messagePair.second->d_func()->requestIsPrepared)
+ prepareRequest(messagePair);
+ channels[i].request = messagePair.first;
+ channels[i].reply = messagePair.second;
+ channels[i].sendRequest();
+ return;
}
if (!lowPriorityQueue.isEmpty()) {
- for (int j = lowPriorityQueue.count() - 1; j >= 0; --j) {
- HttpMessagePair &messagePair = lowPriorityQueue[j];
- if (!messagePair.second->d_func()->requestIsPrepared)
- prepareRequest(messagePair);
- channels[i].request = messagePair.first;
- channels[i].reply = messagePair.second;
- // remove before sendRequest! else we might pipeline the same request again
- lowPriorityQueue.removeAt(j);
- channels[i].sendRequest();
- return;
- }
+ // remove from queue before sendRequest! else we might pipeline the same request again
+ HttpMessagePair messagePair = lowPriorityQueue.takeLast();
+ if (!messagePair.second->d_func()->requestIsPrepared)
+ prepareRequest(messagePair);
+ channels[i].request = messagePair.first;
+ channels[i].reply = messagePair.second;
+ channels[i].sendRequest();
+ return;
}
}
@@ -519,7 +512,7 @@ bool QHttpNetworkConnectionPrivate::fillPipeline(QList<HttpMessagePair> &queue,
if (queue.isEmpty())
return true;
- for (int i = 0; i < queue.length(); i++) {
+ for (int i = queue.count() - 1; i >= 0; --i) {
HttpMessagePair messagePair = queue.at(i);
const QHttpNetworkRequest &request = messagePair.first;
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp
index b624c24..be7896b 100644
--- a/src/network/access/qnetworkaccessbackend.cpp
+++ b/src/network/access/qnetworkaccessbackend.cpp
@@ -92,8 +92,11 @@ QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessM
QNetworkRequest::PreferNetwork).toInt());
if (mode == QNetworkRequest::AlwaysCache
&& (op == QNetworkAccessManager::GetOperation
- || op == QNetworkAccessManager::HeadOperation))
- return new QNetworkAccessCacheBackend;
+ || op == QNetworkAccessManager::HeadOperation)) {
+ QNetworkAccessBackend *backend = new QNetworkAccessCacheBackend;
+ backend->manager = this;
+ return backend;
+ }
if (!factoryDataShutdown) {
QMutexLocker locker(&factoryData()->mutex);
@@ -111,7 +114,6 @@ QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessM
return 0;
}
-
QNonContiguousByteDevice* QNetworkAccessBackend::createUploadByteDevice()
{
QNonContiguousByteDevice* device = 0;
@@ -143,6 +145,8 @@ void QNetworkAccessBackend::emitReplyUploadProgress(qint64 bytesSent, qint64 byt
}
QNetworkAccessBackend::QNetworkAccessBackend()
+ : manager(0)
+ , reply(0)
{
}
@@ -205,7 +209,9 @@ QList<QNetworkProxy> QNetworkAccessBackend::proxyList() const
QAbstractNetworkCache *QNetworkAccessBackend::networkCache() const
{
- return reply->networkCache; // should be the same as manager->networkCache
+ if (!manager)
+ return 0;
+ return manager->networkCache;
}
void QNetworkAccessBackend::setCachingEnabled(bool enable)
diff --git a/src/network/access/qnetworkaccesscachebackend.cpp b/src/network/access/qnetworkaccesscachebackend.cpp
index df66c9d..2be10db 100644
--- a/src/network/access/qnetworkaccesscachebackend.cpp
+++ b/src/network/access/qnetworkaccesscachebackend.cpp
@@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE
QNetworkAccessCacheBackend::QNetworkAccessCacheBackend()
: QNetworkAccessBackend()
+ , device(0)
{
}
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index d925e77..bc01e82 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -711,9 +711,6 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
// fourth step: setup the reply
priv->setup(op, request, outgoingData);
- if (request.attribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork).toInt() !=
- QNetworkRequest::AlwaysNetwork)
- priv->setNetworkCache(d->networkCache);
#ifndef QT_NO_NETWORKPROXY
QList<QNetworkProxy> proxyList = d->queryProxy(QNetworkProxyQuery(request.url()));
priv->proxyList = proxyList;
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 3b0948b..a60a8dd 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate()
: backend(0), outgoingData(0), outgoingDataBuffer(0),
- copyDevice(0), networkCache(0),
+ copyDevice(0),
cacheEnabled(false), cacheSaveDevice(0),
notificationHandlingPaused(false),
bytesDownloaded(0), lastBytesDownloaded(-1), bytesUploaded(-1),
@@ -252,11 +252,6 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const
q->QIODevice::open(QIODevice::ReadOnly);
}
-void QNetworkReplyImplPrivate::setNetworkCache(QAbstractNetworkCache *nc)
-{
- networkCache = nc;
-}
-
void QNetworkReplyImplPrivate::backendNotify(InternalNotifications notification)
{
Q_Q(QNetworkReplyImpl);
@@ -318,17 +313,28 @@ void QNetworkReplyImplPrivate::resumeNotificationHandling()
QCoreApplication::postEvent(q, new QEvent(QEvent::NetworkReplyUpdated));
}
+QAbstractNetworkCache *QNetworkReplyImplPrivate::networkCache() const
+{
+ if (!backend)
+ return 0;
+ return backend->networkCache();
+}
+
void QNetworkReplyImplPrivate::createCache()
{
// check if we can save and if we're allowed to
- if (!networkCache || !request.attribute(QNetworkRequest::CacheSaveControlAttribute, true).toBool())
+ if (!networkCache()
+ || !request.attribute(QNetworkRequest::CacheSaveControlAttribute, true).toBool()
+ || request.attribute(QNetworkRequest::CacheLoadControlAttribute,
+ QNetworkRequest::PreferNetwork).toInt()
+ == QNetworkRequest::AlwaysNetwork)
return;
cacheEnabled = true;
}
bool QNetworkReplyImplPrivate::isCachingEnabled() const
{
- return (cacheEnabled && networkCache != 0);
+ return (cacheEnabled && networkCache() != 0);
}
void QNetworkReplyImplPrivate::setCachingEnabled(bool enable)
@@ -352,7 +358,7 @@ void QNetworkReplyImplPrivate::setCachingEnabled(bool enable)
qDebug("QNetworkReplyImpl: setCachingEnabled(true) called after setCachingEnabled(false) -- "
"backend %s probably needs to be fixed",
backend->metaObject()->className());
- networkCache->remove(url);
+ networkCache()->remove(url);
cacheSaveDevice = 0;
cacheEnabled = false;
}
@@ -361,9 +367,9 @@ void QNetworkReplyImplPrivate::setCachingEnabled(bool enable)
void QNetworkReplyImplPrivate::completeCacheSave()
{
if (cacheEnabled && errorCode != QNetworkReplyImpl::NoError) {
- networkCache->remove(url);
+ networkCache()->remove(url);
} else if (cacheEnabled && cacheSaveDevice) {
- networkCache->insert(cacheSaveDevice);
+ networkCache()->insert(cacheSaveDevice);
}
cacheSaveDevice = 0;
cacheEnabled = false;
@@ -410,15 +416,15 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QByteDataBuffer &data)
metaData.setAttributes(attributes);
}
- cacheSaveDevice = networkCache->prepare(metaData);
+ cacheSaveDevice = networkCache()->prepare(metaData);
if (!cacheSaveDevice || (cacheSaveDevice && !cacheSaveDevice->isOpen())) {
if (cacheSaveDevice && !cacheSaveDevice->isOpen())
qCritical("QNetworkReplyImpl: network cache returned a device that is not open -- "
"class %s probably needs to be fixed",
- networkCache->metaObject()->className());
+ networkCache()->metaObject()->className());
- networkCache->remove(url);
+ networkCache()->remove(url);
cacheSaveDevice = 0;
cacheEnabled = false;
}
@@ -566,7 +572,7 @@ QNetworkReplyImpl::~QNetworkReplyImpl()
{
Q_D(QNetworkReplyImpl);
if (d->isCachingEnabled())
- d->networkCache->remove(url());
+ d->networkCache()->remove(url());
}
void QNetworkReplyImpl::abort()
diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h
index 8cda7a4..04f8aa8 100644
--- a/src/network/access/qnetworkreplyimpl_p.h
+++ b/src/network/access/qnetworkreplyimpl_p.h
@@ -131,7 +131,6 @@ public:
void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request,
QIODevice *outgoingData);
- void setNetworkCache(QAbstractNetworkCache *networkCache);
void pauseNotificationHandling();
void resumeNotificationHandling();
@@ -160,7 +159,7 @@ public:
QIODevice *outgoingData;
QRingBuffer *outgoingDataBuffer;
QIODevice *copyDevice;
- QAbstractNetworkCache *networkCache;
+ QAbstractNetworkCache *networkCache() const;
bool cacheEnabled;
QIODevice *cacheSaveDevice;
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index bb0915a..9ef92e1 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -752,6 +752,7 @@ QHttpSocketEnginePrivate::QHttpSocketEnginePrivate()
, readNotificationPending(false)
, writeNotificationPending(false)
, connectionNotificationPending(false)
+ , pendingResponseData(0)
{
socket = 0;
state = QHttpSocketEngine::None;
diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp
index 3e56995..3d9aa61 100644
--- a/src/network/socket/qnativesocketengine.cpp
+++ b/src/network/socket/qnativesocketengine.cpp
@@ -389,10 +389,19 @@ bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType socketType, QAb
qWarning("QNativeSocketEngine::initialize unable to inline out-of-band data");
}
- // Set the send and receive buffer sizes to a magic size, found
- // most optimal for our platforms.
- setReceiveBufferSize(49152);
- setSendBufferSize(49152);
+ // Before Qt 4.6, we always set the send and receive buffer size to 49152 as
+ // this was found to be an optimal value. However, modern OS
+ // all have some kind of auto tuning for this and we therefore don't set
+ // this explictly anymore.
+ // If it introduces any performance regressions for Qt 4.6.x (x > 0) then
+ // it will be put back in.
+ //
+ // You can use tests/manual/qhttpnetworkconnection to test HTTP download speed
+ // with this.
+ //
+ // pre-4.6:
+ // setReceiveBufferSize(49152);
+ // setSendBufferSize(49152);
d->socketType = socketType;
d->socketProtocol = protocol;
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index ec9f103..3df3ab7 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -563,9 +563,12 @@ int QNativeSocketEnginePrivate::nativeAccept()
if(acceptedDescriptor > 0) {
// Ensure that the socket is closed on exec*()
::fcntl(acceptedDescriptor, F_SETFD, FD_CLOEXEC);
- } else {
+ }
+#ifdef Q_OS_SYMBIAN
+ else {
qWarning("QNativeSocketEnginePrivate::nativeAccept() - acceptedDescriptor <= 0");
}
+#endif
return acceptedDescriptor;
}
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index 666770d..3793b1e 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -250,14 +250,22 @@ void QSslCertificate::clear()
*/
QByteArray QSslCertificate::version() const
{
+ if (d->versionString.isEmpty() && d->x509)
+ d->versionString =
+ QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->version)) + 1);
+
return d->versionString;
}
/*!
- Returns the certificate's serial number string.
+ Returns the certificate's serial number string in decimal format.
*/
QByteArray QSslCertificate::serialNumber() const
{
+ if (d->serialNumberString.isEmpty() && d->x509)
+ d->serialNumberString =
+ QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->serialNumber)));
+
return d->serialNumberString;
}
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 6858d40..0e0c347 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -1745,7 +1745,13 @@ qint64 QSslSocket::writeData(const char *data, qint64 len)
\internal
*/
QSslSocketPrivate::QSslSocketPrivate()
- : initialized(false), readyReadEmittedPointer(0), plainSocket(0)
+ : initialized(false)
+ , mode(QSslSocket::UnencryptedMode)
+ , autoStartHandshake(false)
+ , connectionEncrypted(false)
+ , ignoreAllSslErrors(false)
+ , readyReadEmittedPointer(0)
+ , plainSocket(0)
{
QSslConfigurationPrivate::deepCopyDefaultConfiguration(&configuration);
}
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index 5b04a57..d3dcd51 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -94,6 +94,7 @@ QT_BEGIN_NAMESPACE
#ifdef SSLEAY_MACROS
DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c, return 0, return)
#endif
+DEFINEFUNC(long, ASN1_INTEGER_get, ASN1_INTEGER *a, a, return 0, return)
DEFINEFUNC(unsigned char *, ASN1_STRING_data, ASN1_STRING *a, a, return 0, return)
DEFINEFUNC(int, ASN1_STRING_length, ASN1_STRING *a, a, return 0, return)
DEFINEFUNC4(long, BIO_ctrl, BIO *a, a, int b, b, long c, c, void *d, d, return -1, return)
@@ -608,6 +609,7 @@ bool q_resolveOpenSslSymbols()
#ifdef SSLEAY_MACROS
RESOLVEFUNC(ASN1_dup)
#endif
+ RESOLVEFUNC(ASN1_INTEGER_get)
RESOLVEFUNC(ASN1_STRING_data)
RESOLVEFUNC(ASN1_STRING_length)
RESOLVEFUNC(BIO_ctrl)
diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h
index f9c92e5..30762ca 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -201,6 +201,7 @@ QT_BEGIN_NAMESPACE
#endif // !defined QT_LINKED_OPENSSL
bool q_resolveOpenSslSymbols();
+long q_ASN1_INTEGER_get(ASN1_INTEGER *a);
unsigned char * q_ASN1_STRING_data(ASN1_STRING *a);
int q_ASN1_STRING_length(ASN1_STRING *a);
long q_BIO_ctrl(BIO *a, int b, long c, void *d);
diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp
index e025736..0b93320 100644
--- a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp
+++ b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp
@@ -86,9 +86,8 @@ bool QGLCustomShaderStage::setOnPainter(QPainter* p)
return false;
}
- // Might as well go through the paint engine to get to the context
- const QGLContext* ctx = static_cast<QGL2PaintEngineEx*>(p->paintEngine())->context();
- d->m_manager = QGLEngineShaderManager::managerForContext(ctx);
+ QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx*>(p->paintEngine());
+ d->m_manager = QGL2PaintEngineExPrivate::shaderManagerForEngine(engine);
Q_ASSERT(d->m_manager);
d->m_manager->setCustomStage(this);
@@ -101,9 +100,8 @@ void QGLCustomShaderStage::removeFromPainter(QPainter* p)
if (p->paintEngine()->type() != QPaintEngine::OpenGL2)
return;
- // Might as well go through the paint engine to get to the context
- const QGLContext* ctx = static_cast<QGL2PaintEngineEx*>(p->paintEngine())->context();
- d->m_manager = QGLEngineShaderManager::managerForContext(ctx);
+ QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx*>(p->paintEngine());
+ d->m_manager = QGL2PaintEngineExPrivate::shaderManagerForEngine(engine);
Q_ASSERT(d->m_manager);
// Just set the stage to null, don't call removeCustomStage().
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
index 891c027..e7c11fd 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
@@ -49,47 +49,38 @@
QT_BEGIN_NAMESPACE
-static void QGLEngineShaderManager_free(void *ptr)
+static void qt_shared_shaders_free(void *data)
{
- delete reinterpret_cast<QGLEngineShaderManager *>(ptr);
+ delete reinterpret_cast<QGLEngineSharedShaders *>(data);
}
-Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_shader_managers, (QGLEngineShaderManager_free))
+Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_shared_shaders, (qt_shared_shaders_free))
-QGLEngineShaderManager *QGLEngineShaderManager::managerForContext(const QGLContext *context)
+QGLEngineSharedShaders *QGLEngineSharedShaders::shadersForContext(const QGLContext *context)
{
- QGLEngineShaderManager *p = reinterpret_cast<QGLEngineShaderManager *>(qt_shader_managers()->value(context));
+ QGLEngineSharedShaders *p = reinterpret_cast<QGLEngineSharedShaders *>(qt_shared_shaders()->value(context));
if (!p) {
QGLContext *oldContext = const_cast<QGLContext *>(QGLContext::currentContext());
if (oldContext != context)
const_cast<QGLContext *>(context)->makeCurrent();
- p = new QGLEngineShaderManager(const_cast<QGLContext *>(context));
- qt_shader_managers()->insert(context, p);
+ qt_shared_shaders()->insert(context, p = new QGLEngineSharedShaders(context));
if (oldContext && oldContext != context)
oldContext->makeCurrent();
}
return p;
}
-const char* QGLEngineShaderManager::qglEngineShaderSourceCode[] = {
+const char* QGLEngineSharedShaders::qglEngineShaderSourceCode[] = {
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0
};
-QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context)
- : ctx(context),
- shaderProgNeedsChanging(true),
- srcPixelType(Qt::NoBrush),
- useGlobalOpacity(false),
- maskType(NoMask),
- useTextureCoords(false),
- compositionMode(QPainter::CompositionMode_SourceOver),
- customSrcStage(0),
- blitShaderProg(0),
- simpleShaderProg(0),
- currentShaderProg(0)
+QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context)
+ : ctx(QGLContextPrivate::contextGroup(context))
+ , blitShaderProg(0)
+ , simpleShaderProg(0)
{
memset(compiledShaders, 0, sizeof(compiledShaders));
@@ -174,7 +165,7 @@ QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context)
}
// Compile up the simple shader:
- simpleShaderProg = new QGLShaderProgram(ctx, this);
+ simpleShaderProg = new QGLShaderProgram(context, this);
compileNamedShader(MainVertexShader, QGLShader::PartialVertexShader);
compileNamedShader(PositionOnlyVertexShader, QGLShader::PartialVertexShader);
compileNamedShader(MainFragmentShader, QGLShader::PartialFragmentShader);
@@ -191,7 +182,7 @@ QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context)
}
// Compile the blit shader:
- blitShaderProg = new QGLShaderProgram(ctx, this);
+ blitShaderProg = new QGLShaderProgram(context, this);
compileNamedShader(MainWithTexCoordsVertexShader, QGLShader::PartialVertexShader);
compileNamedShader(UntransformedPositionVertexShader, QGLShader::PartialVertexShader);
compileNamedShader(MainFragmentShader, QGLShader::PartialFragmentShader);
@@ -209,6 +200,145 @@ QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context)
}
}
+void QGLEngineSharedShaders::shaderDestroyed(QObject *shader)
+{
+ // Remove any shader programs which has this as the srcPixel shader:
+ for (int i = 0; i < cachedPrograms.size(); ++i) {
+ if (cachedPrograms.at(i).srcPixelFragShader == shader) {
+ delete cachedPrograms.at(i).program;
+ cachedPrograms.removeAt(i--);
+ }
+ }
+
+ emit shaderProgNeedsChanging();
+}
+
+QGLShader *QGLEngineSharedShaders::compileNamedShader(ShaderName name, QGLShader::ShaderType type)
+{
+ Q_ASSERT(name != CustomImageSrcFragmentShader);
+ if (compiledShaders[name])
+ return compiledShaders[name];
+
+ QByteArray source = qglEngineShaderSourceCode[name];
+ QGLShader *newShader = new QGLShader(type, ctx->context(), this);
+ newShader->compile(source);
+
+#if defined(QT_DEBUG)
+ // Name the shader for easier debugging
+ QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("ShaderName"));
+ newShader->setObjectName(QLatin1String(m.valueToKey(name)));
+#endif
+
+ compiledShaders[name] = newShader;
+ return newShader;
+}
+
+QGLShader *QGLEngineSharedShaders::compileCustomShader(QGLCustomShaderStage *stage, QGLShader::ShaderType type)
+{
+ QByteArray source = stage->source();
+ source += qglslCustomSrcFragmentShader;
+
+ QGLShader *newShader = customShaderCache.object(source);
+ if (newShader)
+ return newShader;
+
+ newShader = new QGLShader(type, ctx->context(), this);
+ newShader->compile(source);
+ customShaderCache.insert(source, newShader);
+
+ connect(newShader, SIGNAL(destroyed(QObject *)),
+ this, SLOT(shaderDestroyed(QObject *)));
+
+#if defined(QT_DEBUG)
+ // Name the shader for easier debugging
+ QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("ShaderName"));
+ newShader->setObjectName(QLatin1String(m.valueToKey(CustomImageSrcFragmentShader)));
+#endif
+
+ return newShader;
+}
+
+// The address returned here will only be valid until next time this function is called.
+QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineShaderProg &prog)
+{
+ for (int i = 0; i < cachedPrograms.size(); ++i) {
+ if (cachedPrograms[i] == prog)
+ return &cachedPrograms[i];
+ }
+
+ cachedPrograms.append(prog);
+ QGLEngineShaderProg &cached = cachedPrograms.last();
+
+ // If the shader program's not found in the cache, create it now.
+ cached.program = new QGLShaderProgram(ctx->context(), this);
+ cached.program->addShader(cached.mainVertexShader);
+ cached.program->addShader(cached.positionVertexShader);
+ cached.program->addShader(cached.mainFragShader);
+ cached.program->addShader(cached.srcPixelFragShader);
+ cached.program->addShader(cached.maskFragShader);
+ cached.program->addShader(cached.compositionFragShader);
+
+ // We have to bind the vertex attribute names before the program is linked:
+ cached.program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
+ cached.program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
+
+ cached.program->link();
+ if (!cached.program->isLinked()) {
+ QLatin1String none("none");
+ QLatin1String br("\n");
+ QString error;
+ error = QLatin1String("Shader program failed to link,")
+#if defined(QT_DEBUG)
+ + br
+ + QLatin1String(" Shaders Used:\n")
+ + QLatin1String(" mainVertexShader = ")
+ + (cached.mainVertexShader ?
+ cached.mainVertexShader->objectName() : none) + br
+ + QLatin1String(" positionVertexShader = ")
+ + (cached.positionVertexShader ?
+ cached.positionVertexShader->objectName() : none) + br
+ + QLatin1String(" mainFragShader = ")
+ + (cached.mainFragShader ?
+ cached.mainFragShader->objectName() : none) + br
+ + QLatin1String(" srcPixelFragShader = ")
+ + (cached.srcPixelFragShader ?
+ cached.srcPixelFragShader->objectName() : none) + br
+ + QLatin1String(" maskFragShader = ")
+ + (cached.maskFragShader ?
+ cached.maskFragShader->objectName() : none) + br
+ + QLatin1String(" compositionFragShader = ")
+ + (cached.compositionFragShader ?
+ cached.compositionFragShader->objectName() : none) + br
+#endif
+ + QLatin1String(" Error Log:\n")
+ + QLatin1String(" ") + cached.program->log();
+ qWarning() << error;
+ delete cached.program;
+ cachedPrograms.removeLast();
+ return 0;
+ } else {
+ // taking the address here is safe since
+ // cachePrograms isn't resized anywhere else
+ return &cached;
+ }
+}
+
+QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context)
+ : ctx(context),
+ shaderProgNeedsChanging(true),
+ srcPixelType(Qt::NoBrush),
+ useGlobalOpacity(false),
+ maskType(NoMask),
+ useTextureCoords(false),
+ compositionMode(QPainter::CompositionMode_SourceOver),
+ customSrcStage(0),
+ currentShaderProg(0),
+ customShader(0)
+{
+ sharedShaders = QGLEngineSharedShaders::shadersForContext(context);
+ connect(sharedShaders, SIGNAL(shaderProgNeedsChanging()), this, SLOT(shaderProgNeedsChangingSlot()));
+}
+
QGLEngineShaderManager::~QGLEngineShaderManager()
{
//###
@@ -312,24 +442,8 @@ void QGLEngineShaderManager::setCompositionMode(QPainter::CompositionMode mode)
void QGLEngineShaderManager::setCustomStage(QGLCustomShaderStage* stage)
{
- // If the custom shader has changed, then destroy the previous compilation.
- if (customSrcStage && stage && customSrcStage != stage)
- removeCustomStage(customSrcStage);
-
customSrcStage = stage;
- shaderProgNeedsChanging = true;
-}
-
-void QGLEngineShaderManager::shaderDestroyed(QObject *shader)
-{
- // Remove any shader programs which has this as the srcPixel shader:
- for (int i = 0; i < cachedPrograms.size(); ++i) {
- if (cachedPrograms.at(i).srcPixelFragShader == shader) {
- delete cachedPrograms.at(i).program;
- cachedPrograms.removeAt(i--);
- }
- }
-
+ customShader = 0; // Will be compiled from 'customSrcStage' later.
shaderProgNeedsChanging = true;
}
@@ -337,13 +451,8 @@ void QGLEngineShaderManager::removeCustomStage(QGLCustomShaderStage* stage)
{
Q_UNUSED(stage); // Currently we only support one at a time...
- QGLShader *compiledShader = compiledShaders[CustomImageSrcFragmentShader];
-
- if (!compiledShader)
- return;
-
- compiledShaders[CustomImageSrcFragmentShader] = 0;
customSrcStage = 0;
+ customShader = 0;
shaderProgNeedsChanging = true;
}
@@ -355,12 +464,12 @@ QGLShaderProgram* QGLEngineShaderManager::currentProgram()
QGLShaderProgram* QGLEngineShaderManager::simpleProgram()
{
- return simpleShaderProg;
+ return sharedShaders->simpleProgram();
}
QGLShaderProgram* QGLEngineShaderManager::blitProgram()
{
- return blitShaderProg;
+ return sharedShaders->blitProgram();
}
@@ -382,26 +491,25 @@ bool QGLEngineShaderManager::useCorrectShaderProg()
requiredProgram.program = 0;
// Choose vertex shader main function
- QGLEngineShaderManager::ShaderName mainVertexShaderName = InvalidShaderName;
+ QGLEngineSharedShaders::ShaderName mainVertexShaderName = QGLEngineSharedShaders::InvalidShaderName;
if (useTextureCoords)
- mainVertexShaderName = MainWithTexCoordsVertexShader;
+ mainVertexShaderName = QGLEngineSharedShaders::MainWithTexCoordsVertexShader;
else
- mainVertexShaderName = MainVertexShader;
- compileNamedShader(mainVertexShaderName, QGLShader::PartialVertexShader);
- requiredProgram.mainVertexShader = compiledShaders[mainVertexShaderName];
+ mainVertexShaderName = QGLEngineSharedShaders::MainVertexShader;
+ requiredProgram.mainVertexShader = sharedShaders->compileNamedShader(mainVertexShaderName, QGLShader::PartialVertexShader);
// Choose vertex shader shader position function (which typically also sets
// varyings) and the source pixel (srcPixel) fragment shader function:
- QGLEngineShaderManager::ShaderName positionVertexShaderName = InvalidShaderName;
- QGLEngineShaderManager::ShaderName srcPixelFragShaderName = InvalidShaderName;
+ QGLEngineSharedShaders::ShaderName positionVertexShaderName = QGLEngineSharedShaders::InvalidShaderName;
+ QGLEngineSharedShaders::ShaderName srcPixelFragShaderName = QGLEngineSharedShaders::InvalidShaderName;
bool isAffine = brushTransform.isAffine();
if ( (srcPixelType >= Qt::Dense1Pattern) && (srcPixelType <= Qt::DiagCrossPattern) ) {
if (isAffine)
- positionVertexShaderName = AffinePositionWithPatternBrushVertexShader;
+ positionVertexShaderName = QGLEngineSharedShaders::AffinePositionWithPatternBrushVertexShader;
else
- positionVertexShaderName = PositionWithPatternBrushVertexShader;
+ positionVertexShaderName = QGLEngineSharedShaders::PositionWithPatternBrushVertexShader;
- srcPixelFragShaderName = PatternBrushSrcFragmentShader;
+ srcPixelFragShaderName = QGLEngineSharedShaders::PatternBrushSrcFragmentShader;
}
else switch (srcPixelType) {
default:
@@ -409,190 +517,143 @@ bool QGLEngineShaderManager::useCorrectShaderProg()
qCritical("QGLEngineShaderManager::useCorrectShaderProg() - I'm scared, Qt::NoBrush style is set");
break;
case QGLEngineShaderManager::ImageSrc:
- srcPixelFragShaderName = useCustomSrc ? CustomImageSrcFragmentShader : ImageSrcFragmentShader;
- positionVertexShaderName = PositionOnlyVertexShader;
+ srcPixelFragShaderName = QGLEngineSharedShaders::ImageSrcFragmentShader;
+ positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader;
break;
case QGLEngineShaderManager::NonPremultipliedImageSrc:
- srcPixelFragShaderName = NonPremultipliedImageSrcFragmentShader;
- positionVertexShaderName = PositionOnlyVertexShader;
+ srcPixelFragShaderName = QGLEngineSharedShaders::NonPremultipliedImageSrcFragmentShader;
+ positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader;
break;
case QGLEngineShaderManager::PatternSrc:
- srcPixelFragShaderName = ImageSrcWithPatternFragmentShader;
- positionVertexShaderName = PositionOnlyVertexShader;
+ srcPixelFragShaderName = QGLEngineSharedShaders::ImageSrcWithPatternFragmentShader;
+ positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader;
break;
case QGLEngineShaderManager::TextureSrcWithPattern:
- srcPixelFragShaderName = TextureBrushSrcWithPatternFragmentShader;
- positionVertexShaderName = isAffine ? AffinePositionWithTextureBrushVertexShader
- : PositionWithTextureBrushVertexShader;
+ srcPixelFragShaderName = QGLEngineSharedShaders::TextureBrushSrcWithPatternFragmentShader;
+ positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader
+ : QGLEngineSharedShaders::PositionWithTextureBrushVertexShader;
break;
case Qt::SolidPattern:
- srcPixelFragShaderName = SolidBrushSrcFragmentShader;
- positionVertexShaderName = PositionOnlyVertexShader;
+ srcPixelFragShaderName = QGLEngineSharedShaders::SolidBrushSrcFragmentShader;
+ positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader;
break;
case Qt::LinearGradientPattern:
- srcPixelFragShaderName = LinearGradientBrushSrcFragmentShader;
- positionVertexShaderName = isAffine ? AffinePositionWithLinearGradientBrushVertexShader
- : PositionWithLinearGradientBrushVertexShader;
+ srcPixelFragShaderName = QGLEngineSharedShaders::LinearGradientBrushSrcFragmentShader;
+ positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithLinearGradientBrushVertexShader
+ : QGLEngineSharedShaders::PositionWithLinearGradientBrushVertexShader;
break;
case Qt::ConicalGradientPattern:
- srcPixelFragShaderName = ConicalGradientBrushSrcFragmentShader;
- positionVertexShaderName = isAffine ? AffinePositionWithConicalGradientBrushVertexShader
- : PositionWithConicalGradientBrushVertexShader;
+ srcPixelFragShaderName = QGLEngineSharedShaders::ConicalGradientBrushSrcFragmentShader;
+ positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithConicalGradientBrushVertexShader
+ : QGLEngineSharedShaders::PositionWithConicalGradientBrushVertexShader;
break;
case Qt::RadialGradientPattern:
- srcPixelFragShaderName = RadialGradientBrushSrcFragmentShader;
- positionVertexShaderName = isAffine ? AffinePositionWithRadialGradientBrushVertexShader
- : PositionWithRadialGradientBrushVertexShader;
+ srcPixelFragShaderName = QGLEngineSharedShaders::RadialGradientBrushSrcFragmentShader;
+ positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithRadialGradientBrushVertexShader
+ : QGLEngineSharedShaders::PositionWithRadialGradientBrushVertexShader;
break;
case Qt::TexturePattern:
- srcPixelFragShaderName = TextureBrushSrcFragmentShader;
- positionVertexShaderName = isAffine ? AffinePositionWithTextureBrushVertexShader
- : PositionWithTextureBrushVertexShader;
+ srcPixelFragShaderName = QGLEngineSharedShaders::TextureBrushSrcFragmentShader;
+ positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader
+ : QGLEngineSharedShaders::PositionWithTextureBrushVertexShader;
break;
};
- compileNamedShader(positionVertexShaderName, QGLShader::PartialVertexShader);
- compileNamedShader(srcPixelFragShaderName, QGLShader::PartialFragmentShader);
- requiredProgram.positionVertexShader = compiledShaders[positionVertexShaderName];
- requiredProgram.srcPixelFragShader = compiledShaders[srcPixelFragShaderName];
+ requiredProgram.positionVertexShader = sharedShaders->compileNamedShader(positionVertexShaderName, QGLShader::PartialVertexShader);
+ if (useCustomSrc) {
+ if (!customShader)
+ customShader = sharedShaders->compileCustomShader(customSrcStage, QGLShader::PartialFragmentShader);
+ requiredProgram.srcPixelFragShader = customShader;
+ } else {
+ requiredProgram.srcPixelFragShader = sharedShaders->compileNamedShader(srcPixelFragShaderName, QGLShader::PartialFragmentShader);
+ }
const bool hasCompose = compositionMode > QPainter::CompositionMode_Plus;
const bool hasMask = maskType != QGLEngineShaderManager::NoMask;
// Choose fragment shader main function:
- QGLEngineShaderManager::ShaderName mainFragShaderName;
+ QGLEngineSharedShaders::ShaderName mainFragShaderName;
if (hasCompose && hasMask && useGlobalOpacity)
- mainFragShaderName = MainFragmentShader_CMO;
+ mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_CMO;
if (hasCompose && hasMask && !useGlobalOpacity)
- mainFragShaderName = MainFragmentShader_CM;
+ mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_CM;
if (!hasCompose && hasMask && useGlobalOpacity)
- mainFragShaderName = MainFragmentShader_MO;
+ mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_MO;
if (!hasCompose && hasMask && !useGlobalOpacity)
- mainFragShaderName = MainFragmentShader_M;
+ mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_M;
if (hasCompose && !hasMask && useGlobalOpacity)
- mainFragShaderName = MainFragmentShader_CO;
+ mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_CO;
if (hasCompose && !hasMask && !useGlobalOpacity)
- mainFragShaderName = MainFragmentShader_C;
+ mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_C;
if (!hasCompose && !hasMask && useGlobalOpacity)
- mainFragShaderName = MainFragmentShader_O;
+ mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_O;
if (!hasCompose && !hasMask && !useGlobalOpacity)
- mainFragShaderName = MainFragmentShader;
+ mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader;
- compileNamedShader(mainFragShaderName, QGLShader::PartialFragmentShader);
- requiredProgram.mainFragShader = compiledShaders[mainFragShaderName];
+ requiredProgram.mainFragShader = sharedShaders->compileNamedShader(mainFragShaderName, QGLShader::PartialFragmentShader);
if (hasMask) {
- QGLEngineShaderManager::ShaderName maskShaderName = QGLEngineShaderManager::InvalidShaderName;
+ QGLEngineSharedShaders::ShaderName maskShaderName = QGLEngineSharedShaders::InvalidShaderName;
if (maskType == PixelMask)
- maskShaderName = MaskFragmentShader;
+ maskShaderName = QGLEngineSharedShaders::MaskFragmentShader;
else if (maskType == SubPixelMask)
- maskShaderName = RgbMaskFragmentShader;
+ maskShaderName = QGLEngineSharedShaders::RgbMaskFragmentShader;
else if (maskType == SubPixelWithGammaMask)
- maskShaderName = RgbMaskWithGammaFragmentShader;
+ maskShaderName = QGLEngineSharedShaders::RgbMaskWithGammaFragmentShader;
else
qCritical("QGLEngineShaderManager::useCorrectShaderProg() - Unknown mask type");
- compileNamedShader(maskShaderName, QGLShader::PartialFragmentShader);
- requiredProgram.maskFragShader = compiledShaders[maskShaderName];
- }
- else
+ requiredProgram.maskFragShader = sharedShaders->compileNamedShader(maskShaderName, QGLShader::PartialFragmentShader);
+ } else {
requiredProgram.maskFragShader = 0;
+ }
if (hasCompose) {
- QGLEngineShaderManager::ShaderName compositionShaderName = QGLEngineShaderManager::InvalidShaderName;
+ QGLEngineSharedShaders::ShaderName compositionShaderName = QGLEngineSharedShaders::InvalidShaderName;
switch (compositionMode) {
case QPainter::CompositionMode_Multiply:
- compositionShaderName = MultiplyCompositionModeFragmentShader;
+ compositionShaderName = QGLEngineSharedShaders::MultiplyCompositionModeFragmentShader;
break;
case QPainter::CompositionMode_Screen:
- compositionShaderName = ScreenCompositionModeFragmentShader;
+ compositionShaderName = QGLEngineSharedShaders::ScreenCompositionModeFragmentShader;
break;
case QPainter::CompositionMode_Overlay:
- compositionShaderName = OverlayCompositionModeFragmentShader;
+ compositionShaderName = QGLEngineSharedShaders::OverlayCompositionModeFragmentShader;
break;
case QPainter::CompositionMode_Darken:
- compositionShaderName = DarkenCompositionModeFragmentShader;
+ compositionShaderName = QGLEngineSharedShaders::DarkenCompositionModeFragmentShader;
break;
case QPainter::CompositionMode_Lighten:
- compositionShaderName = LightenCompositionModeFragmentShader;
+ compositionShaderName = QGLEngineSharedShaders::LightenCompositionModeFragmentShader;
break;
case QPainter::CompositionMode_ColorDodge:
- compositionShaderName = ColorDodgeCompositionModeFragmentShader;
+ compositionShaderName = QGLEngineSharedShaders::ColorDodgeCompositionModeFragmentShader;
break;
case QPainter::CompositionMode_ColorBurn:
- compositionShaderName = ColorBurnCompositionModeFragmentShader;
+ compositionShaderName = QGLEngineSharedShaders::ColorBurnCompositionModeFragmentShader;
break;
case QPainter::CompositionMode_HardLight:
- compositionShaderName = HardLightCompositionModeFragmentShader;
+ compositionShaderName = QGLEngineSharedShaders::HardLightCompositionModeFragmentShader;
break;
case QPainter::CompositionMode_SoftLight:
- compositionShaderName = SoftLightCompositionModeFragmentShader;
+ compositionShaderName = QGLEngineSharedShaders::SoftLightCompositionModeFragmentShader;
break;
case QPainter::CompositionMode_Difference:
- compositionShaderName = DifferenceCompositionModeFragmentShader;
+ compositionShaderName = QGLEngineSharedShaders::DifferenceCompositionModeFragmentShader;
break;
case QPainter::CompositionMode_Exclusion:
- compositionShaderName = ExclusionCompositionModeFragmentShader;
+ compositionShaderName = QGLEngineSharedShaders::ExclusionCompositionModeFragmentShader;
break;
default:
qWarning("QGLEngineShaderManager::useCorrectShaderProg() - Unsupported composition mode");
}
- compileNamedShader(compositionShaderName, QGLShader::PartialFragmentShader);
- requiredProgram.compositionFragShader = compiledShaders[compositionShaderName];
- }
- else
+ requiredProgram.compositionFragShader = sharedShaders->compileNamedShader(compositionShaderName, QGLShader::PartialFragmentShader);
+ } else {
requiredProgram.compositionFragShader = 0;
-
- // At this point, requiredProgram is fully populated so try to find the program in the cache
- bool foundProgramInCache = false;
- for (int i = 0; i < cachedPrograms.size(); ++i) {
- if (cachedPrograms[i] == requiredProgram) {
- currentShaderProg = &cachedPrograms[i];
- foundProgramInCache = true;
- break;
- }
}
- // If the shader program's not found in the cache, create it now.
- if (!foundProgramInCache) {
- requiredProgram.program = new QGLShaderProgram(ctx, this);
- requiredProgram.program->addShader(requiredProgram.mainVertexShader);
- requiredProgram.program->addShader(requiredProgram.positionVertexShader);
- requiredProgram.program->addShader(requiredProgram.mainFragShader);
- requiredProgram.program->addShader(requiredProgram.srcPixelFragShader);
- requiredProgram.program->addShader(requiredProgram.maskFragShader);
- requiredProgram.program->addShader(requiredProgram.compositionFragShader);
-
- // We have to bind the vertex attribute names before the program is linked:
- requiredProgram.program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
- if (useTextureCoords)
- requiredProgram.program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
-
- requiredProgram.program->link();
- if (!requiredProgram.program->isLinked()) {
- QString error;
- qWarning() << "Shader program failed to link,"
-#if defined(QT_DEBUG)
- << '\n'
- << " Shaders Used:" << '\n'
- << " mainVertexShader = " << requiredProgram.mainVertexShader->objectName() << '\n'
- << " positionVertexShader = " << requiredProgram.positionVertexShader->objectName() << '\n'
- << " mainFragShader = " << requiredProgram.mainFragShader->objectName() << '\n'
- << " srcPixelFragShader = " << requiredProgram.srcPixelFragShader->objectName() << '\n'
- << " maskFragShader = " << requiredProgram.maskFragShader->objectName() << '\n'
- << " compositionFragShader = "<< requiredProgram.compositionFragShader->objectName() << '\n'
-#endif
- << " Error Log:" << '\n'
- << " " << requiredProgram.program->log();
- qWarning() << error;
- delete requiredProgram.program;
- } else {
- cachedPrograms.append(requiredProgram);
- // taking the address here is safe since
- // cachePrograms isn't resized anywhere else
- currentShaderProg = &cachedPrograms.last();
- }
- }
+ // At this point, requiredProgram is fully populated so try to find the program in the cache
+ currentShaderProg = sharedShaders->findProgramInCache(requiredProgram);
if (currentShaderProg) {
currentShaderProg->program->enable();
@@ -604,40 +665,4 @@ bool QGLEngineShaderManager::useCorrectShaderProg()
return true;
}
-void QGLEngineShaderManager::compileNamedShader(QGLEngineShaderManager::ShaderName name, QGLShader::ShaderType type)
-{
- if (compiledShaders[name])
- return;
-
- QGLShader *newShader;
-
- QByteArray source;
- if (name == CustomImageSrcFragmentShader) {
- source = customSrcStage->source();
- source += qglslCustomSrcFragmentShader;
-
- newShader = customShaderCache.object(source);
- if (!newShader) {
- newShader = new QGLShader(type, ctx, this);
- newShader->compile(source);
- customShaderCache.insert(source, newShader);
-
- connect(newShader, SIGNAL(destroyed(QObject *)),
- this, SLOT(shaderDestroyed(QObject *)));
- }
- } else {
- source = qglEngineShaderSourceCode[name];
- newShader = new QGLShader(type, ctx, this);
- newShader->compile(source);
- }
-
-#if defined(QT_DEBUG)
- // Name the shader for easier debugging
- QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("ShaderName"));
- newShader->setObjectName(QLatin1String(m.valueToKey(name)));
-#endif
-
- compiledShaders[name] = newShader;
-}
-
QT_END_NAMESPACE
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
index 99cd82e..0cfdcf1 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
@@ -275,65 +275,10 @@ struct QGLEngineCachedShaderProg
static const GLuint QT_VERTEX_COORDS_ATTR = 0;
static const GLuint QT_TEXTURE_COORDS_ATTR = 1;
-class Q_OPENGL_EXPORT QGLEngineShaderManager : public QObject
+class QGLEngineSharedShaders : public QObject
{
Q_OBJECT
public:
- QGLEngineShaderManager(QGLContext* context);
- ~QGLEngineShaderManager();
-
- enum MaskType {NoMask, PixelMask, SubPixelMask, SubPixelWithGammaMask};
- enum PixelSrcType {
- ImageSrc = Qt::TexturePattern+1,
- NonPremultipliedImageSrc = Qt::TexturePattern+2,
- PatternSrc = Qt::TexturePattern+3,
- TextureSrcWithPattern = Qt::TexturePattern+4
- };
-
- enum Uniform {
- ImageTexture,
- PatternColor,
- GlobalOpacity,
- Depth,
- PmvMatrix,
- MaskTexture,
- FragmentColor,
- LinearData,
- Angle,
- HalfViewportSize,
- Fmp,
- Fmp2MRadius2,
- Inverse2Fmp2MRadius2,
- InvertedTextureSize,
- BrushTransform,
- BrushTexture,
- NumUniforms
- };
-
- // There are optimisations we can do, depending on the brush transform:
- // 1) May not have to apply perspective-correction
- // 2) Can use lower precision for matrix
- void optimiseForBrushTransform(const QTransform &transform);
- void setSrcPixelType(Qt::BrushStyle);
- void setSrcPixelType(PixelSrcType); // For non-brush sources, like pixmaps & images
- void setTextureCoordsEnabled(bool); // For images & text glyphs
- void setUseGlobalOpacity(bool);
- void setMaskType(MaskType);
- void setCompositionMode(QPainter::CompositionMode);
- void setCustomStage(QGLCustomShaderStage* stage);
- void removeCustomStage(QGLCustomShaderStage* stage);
-
- uint getUniformLocation(Uniform id);
-
- void setDirty(); // someone has manually changed the current shader program
- bool useCorrectShaderProg(); // returns true if the shader program needed to be changed
-
- QGLShaderProgram* currentProgram(); // Returns pointer to the shader the manager has chosen
- QGLShaderProgram* simpleProgram(); // Used to draw into e.g. stencil buffers
- QGLShaderProgram* blitProgram(); // Used to blit a texture into the framebuffer
-
- static QGLEngineShaderManager *managerForContext(const QGLContext *context);
-
enum ShaderName {
MainVertexShader,
MainWithTexCoordsVertexShader,
@@ -392,6 +337,92 @@ public:
TotalShaderCount, InvalidShaderName
};
+ QGLEngineSharedShaders(const QGLContext *context);
+
+ QGLShader *compileNamedShader(ShaderName name, QGLShader::ShaderType type);
+
+ QGLShaderProgram *simpleProgram() { return simpleShaderProg; }
+ QGLShaderProgram *blitProgram() { return blitShaderProg; }
+ // Compile the program if it's not already in the cache, return the item in the cache.
+ QGLEngineShaderProg *findProgramInCache(const QGLEngineShaderProg &prog);
+ // Compile the custom shader if it's not already in the cache, return the item in the cache.
+ QGLShader *compileCustomShader(QGLCustomShaderStage *stage, QGLShader::ShaderType type);
+
+ static QGLEngineSharedShaders *shadersForContext(const QGLContext *context);
+
+signals:
+ void shaderProgNeedsChanging();
+
+private slots:
+ void shaderDestroyed(QObject *shader);
+
+private:
+ QGLContextGroup *ctx;
+ QGLShaderProgram *blitShaderProg;
+ QGLShaderProgram *simpleShaderProg;
+ QList<QGLEngineShaderProg> cachedPrograms;
+ QCache<QByteArray, QGLShader> customShaderCache;
+ QGLShader* compiledShaders[TotalShaderCount];
+
+ static const char* qglEngineShaderSourceCode[TotalShaderCount];
+};
+
+class Q_OPENGL_EXPORT QGLEngineShaderManager : public QObject
+{
+ Q_OBJECT
+public:
+ QGLEngineShaderManager(QGLContext* context);
+ ~QGLEngineShaderManager();
+
+ enum MaskType {NoMask, PixelMask, SubPixelMask, SubPixelWithGammaMask};
+ enum PixelSrcType {
+ ImageSrc = Qt::TexturePattern+1,
+ NonPremultipliedImageSrc = Qt::TexturePattern+2,
+ PatternSrc = Qt::TexturePattern+3,
+ TextureSrcWithPattern = Qt::TexturePattern+4
+ };
+
+ enum Uniform {
+ ImageTexture,
+ PatternColor,
+ GlobalOpacity,
+ Depth,
+ PmvMatrix,
+ MaskTexture,
+ FragmentColor,
+ LinearData,
+ Angle,
+ HalfViewportSize,
+ Fmp,
+ Fmp2MRadius2,
+ Inverse2Fmp2MRadius2,
+ InvertedTextureSize,
+ BrushTransform,
+ BrushTexture,
+ NumUniforms
+ };
+
+ // There are optimisations we can do, depending on the brush transform:
+ // 1) May not have to apply perspective-correction
+ // 2) Can use lower precision for matrix
+ void optimiseForBrushTransform(const QTransform &transform);
+ void setSrcPixelType(Qt::BrushStyle);
+ void setSrcPixelType(PixelSrcType); // For non-brush sources, like pixmaps & images
+ void setTextureCoordsEnabled(bool); // For images & text glyphs
+ void setUseGlobalOpacity(bool);
+ void setMaskType(MaskType);
+ void setCompositionMode(QPainter::CompositionMode);
+ void setCustomStage(QGLCustomShaderStage* stage);
+ void removeCustomStage(QGLCustomShaderStage* stage);
+
+ uint getUniformLocation(Uniform id);
+
+ void setDirty(); // someone has manually changed the current shader program
+ bool useCorrectShaderProg(); // returns true if the shader program needed to be changed
+
+ QGLShaderProgram* currentProgram(); // Returns pointer to the shader the manager has chosen
+ QGLShaderProgram* simpleProgram(); // Used to draw into e.g. stencil buffers
+ QGLShaderProgram* blitProgram(); // Used to blit a texture into the framebuffer
/*
// These allow the ShaderName enum to be used as a cache key
@@ -408,7 +439,7 @@ public:
#endif
private slots:
- void shaderDestroyed(QObject *shader);
+ void shaderProgNeedsChangingSlot() { shaderProgNeedsChanging = true; }
private:
QGLContext* ctx;
@@ -423,19 +454,9 @@ private:
QPainter::CompositionMode compositionMode;
QGLCustomShaderStage* customSrcStage;
- QGLShaderProgram* blitShaderProg;
- QGLShaderProgram* simpleShaderProg;
QGLEngineShaderProg* currentShaderProg;
-
- // TODO: Possibly convert to a LUT
- QList<QGLEngineShaderProg> cachedPrograms;
- QCache<QByteArray, QGLShader> customShaderCache;
-
- QGLShader* compiledShaders[TotalShaderCount];
-
- void compileNamedShader(QGLEngineShaderManager::ShaderName name, QGLShader::ShaderType type);
-
- static const char* qglEngineShaderSourceCode[TotalShaderCount];
+ QGLEngineSharedShaders *sharedShaders;
+ QGLShader *customShader;
};
QT_END_NAMESPACE
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index a976a02..e24539b 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -316,6 +316,7 @@ extern QImage qt_imageForBrush(int brushStyle, bool invert);
QGL2PaintEngineExPrivate::~QGL2PaintEngineExPrivate()
{
+ delete shaderManager;
}
void QGL2PaintEngineExPrivate::updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id)
@@ -380,7 +381,7 @@ void QGL2PaintEngineExPrivate::useSimpleShader()
}
if (simpleShaderDepthUniformDirty) {
- shaderManager->simpleProgram()->setUniformValue("depth", (GLfloat)q->state()->currentDepth);
+ shaderManager->simpleProgram()->setUniformValue("depth", normalizedDeviceDepth(q->state()->currentDepth));
simpleShaderDepthUniformDirty = false;
}
}
@@ -731,7 +732,6 @@ void QGL2PaintEngineExPrivate::resetGLState()
glActiveTexture(GL_TEXTURE0);
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
- glDepthFunc(GL_LESS);
glDepthMask(true);
glClearDepth(1);
}
@@ -959,7 +959,7 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
}
if (depthUniformDirty) {
- shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), (GLfloat)q->state()->currentDepth);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), normalizedDeviceDepth(q->state()->currentDepth));
depthUniformDirty = false;
}
@@ -1331,8 +1331,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
qt_resolve_version_2_0_functions(d->ctx);
#endif
- d->shaderManager = QGLEngineShaderManager::managerForContext(d->ctx);
- d->shaderManager->setDirty();
+ d->shaderManager = new QGLEngineShaderManager(d->ctx);
glViewport(0, 0, d->width, d->height);
@@ -1351,7 +1350,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
if (!d->inRenderText) {
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
- glDepthFunc(GL_LEQUAL);
+ glDepthFunc(GL_LESS);
glDepthMask(false);
}
@@ -1416,6 +1415,9 @@ bool QGL2PaintEngineEx::end()
d->resetGLState();
+ delete d->shaderManager;
+ d->shaderManager = 0;
+
return false;
}
@@ -1431,17 +1433,19 @@ void QGL2PaintEngineEx::ensureActive()
p->transferMode(BrushDrawingMode);
p->drawable.doneCurrent();
}
+ d->drawable.context()->makeCurrent();
d->drawable.makeCurrent();
ctx->d_ptr->active_engine = this;
-
d->needsSync = true;
+ } else {
+ d->drawable.context()->makeCurrent();
}
if (d->needsSync) {
glViewport(0, 0, d->width, d->height);
glDepthMask(false);
- glDepthFunc(GL_LEQUAL);
+ glDepthFunc(GL_LESS);
setState(state());
d->needsSync = false;
}
@@ -1492,7 +1496,7 @@ void QGL2PaintEngineEx::clipEnabledChanged()
d->regenerateDepthClip();
} else {
if (d->use_system_clip) {
- state()->currentDepth = -0.5f;
+ state()->currentDepth = 0;
} else {
state()->depthTestEnabled = false;
}
@@ -1501,7 +1505,7 @@ void QGL2PaintEngineEx::clipEnabledChanged()
}
}
-void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, float depth)
+void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint depth)
{
transferMode(BrushDrawingMode);
@@ -1510,7 +1514,7 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, float depth)
if (q->state()->needsDepthBufferClear) {
glDepthMask(true);
- glClearDepth(0.5);
+ glClearDepth(rawDepth(2));
glClear(GL_DEPTH_BUFFER_BIT);
q->state()->needsDepthBufferClear = false;
glDepthMask(false);
@@ -1532,7 +1536,7 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, float depth)
glColorMask(false, false, false, false);
glDepthMask(true);
- shaderManager->simpleProgram()->setUniformValue("depth", depth);
+ shaderManager->simpleProgram()->setUniformValue("depth", normalizedDeviceDepth(depth));
simpleShaderDepthUniformDirty = true;
glEnable(GL_DEPTH_TEST);
@@ -1596,12 +1600,12 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
glDepthFunc(GL_ALWAYS);
- state()->maxDepth = 0.5f;
+ state()->maxDepth = 4;
d->writeClip(qtVectorPathForPath(path), state()->maxDepth);
- state()->currentDepth = 0.25f;
+ state()->currentDepth = 3;
state()->depthTestEnabled = true;
- glDepthFunc(GL_LEQUAL);
+ glDepthFunc(GL_LESS);
glEnable(GL_DEPTH_TEST);
}
@@ -1610,7 +1614,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
if (d->use_system_clip) {
glEnable(GL_DEPTH_TEST);
state()->depthTestEnabled = true;
- state()->currentDepth = -0.5;
+ state()->currentDepth = 0;
} else {
glDisable(GL_DEPTH_TEST);
state()->depthTestEnabled = false;
@@ -1618,18 +1622,18 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
state()->canRestoreClip = false;
break;
case Qt::IntersectClip:
- state()->maxDepth = (1.0f + state()->maxDepth) * 0.5;
+ ++state()->maxDepth;
d->writeClip(path, state()->maxDepth);
- state()->currentDepth = 1.5 * state()->maxDepth - 0.5f;
+ state()->currentDepth = state()->maxDepth - 1;
state()->depthTestEnabled = true;
break;
case Qt::ReplaceClip:
d->systemStateChanged();
state()->rectangleClip = QRect();
- state()->maxDepth = 0.5f;
+ state()->maxDepth = 4;
glDepthFunc(GL_ALWAYS);
d->writeClip(path, state()->maxDepth);
- state()->currentDepth = 0.25f;
+ state()->currentDepth = 3;
state()->canRestoreClip = false;
state()->depthTestEnabled = true;
break;
@@ -1641,7 +1645,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
break;
}
- glDepthFunc(GL_LEQUAL);
+ glDepthFunc(GL_LESS);
if (state()->depthTestEnabled) {
glEnable(GL_DEPTH_TEST);
d->simpleShaderDepthUniformDirty = true;
@@ -1659,10 +1663,16 @@ void QGL2PaintEngineExPrivate::systemStateChanged()
{
Q_Q(QGL2PaintEngineEx);
- if (q->paintDevice()->devType() == QInternal::Widget)
+ if (systemClip.isEmpty()) {
use_system_clip = false;
- else
- use_system_clip = !systemClip.isEmpty();
+ } else {
+ if (q->paintDevice()->devType() == QInternal::Widget && currentClipWidget) {
+ QWidgetPrivate *widgetPrivate = qt_widget_private(currentClipWidget->window());
+ use_system_clip = widgetPrivate->extra && widgetPrivate->extra->inRenderWithPainter;
+ } else {
+ use_system_clip = true;
+ }
+ }
glDisable(GL_DEPTH_TEST);
q->state()->depthTestEnabled = false;
@@ -1672,8 +1682,8 @@ void QGL2PaintEngineExPrivate::systemStateChanged()
glDisable(GL_SCISSOR_TEST);
- q->state()->currentDepth = -0.5f;
- q->state()->maxDepth = 0.5f;
+ q->state()->currentDepth = 1;
+ q->state()->maxDepth = 4;
q->state()->rectangleClip = QRect(0, 0, width, height);
@@ -1708,8 +1718,8 @@ void QGL2PaintEngineExPrivate::systemStateChanged()
path.addRegion(systemClip);
glDepthFunc(GL_ALWAYS);
- writeClip(qtVectorPathForPath(path), 0.0f);
- glDepthFunc(GL_LEQUAL);
+ writeClip(qtVectorPathForPath(path), 2);
+ glDepthFunc(GL_LESS);
glEnable(GL_DEPTH_TEST);
q->state()->depthTestEnabled = true;
@@ -1718,7 +1728,7 @@ void QGL2PaintEngineExPrivate::systemStateChanged()
q->transformChanged();
}
- q->state()->currentDepth = -0.5f;
+ q->state()->currentDepth = 1;
simpleShaderDepthUniformDirty = true;
depthUniformDirty = true;
}
@@ -1757,7 +1767,7 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state)
if (old_state && old_state != s && old_state->canRestoreClip) {
d->updateDepthScissorTest();
glDepthMask(false);
- glDepthFunc(GL_LEQUAL);
+ glDepthFunc(GL_LESS);
s->maxDepth = old_state->maxDepth;
} else {
d->regenerateDepthClip();
@@ -1802,8 +1812,8 @@ QOpenGL2PaintEngineState::QOpenGL2PaintEngineState()
needsDepthBufferClear = true;
depthTestEnabled = false;
scissorTestEnabled = false;
- currentDepth = -0.5f;
- maxDepth = 0.5f;
+ currentDepth = 1;
+ maxDepth = 4;
canRestoreClip = true;
hasRectangleClip = false;
}
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 58fcde1..cb23b11 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -82,8 +82,8 @@ public:
bool depthTestEnabled;
bool scissorTestEnabled;
- qreal currentDepth;
- qreal maxDepth;
+ uint maxDepth;
+ uint currentDepth;
bool canRestoreClip;
QRect rectangleClip;
@@ -196,6 +196,8 @@ public:
float zValueForRenderText() const;
+ static QGLEngineShaderManager* shaderManagerForEngine(QGL2PaintEngineEx *engine) { return engine->d_func()->shaderManager; }
+
QGL2PaintEngineEx* q;
QGLDrawable drawable;
int width, height;
@@ -230,13 +232,26 @@ public:
QGLEngineShaderManager* shaderManager;
- void writeClip(const QVectorPath &path, float depth);
+ void writeClip(const QVectorPath &path, uint depth);
void updateDepthScissorTest();
void setScissor(const QRect &rect);
void regenerateDepthClip();
void systemStateChanged();
uint use_system_clip : 1;
+ static inline GLfloat rawDepth(uint depth)
+ {
+ // assume at least 16 bits in the depth buffer, and
+ // use 2^15 depth levels to be safe with regard to
+ // rounding issues etc
+ return depth * (1.0f / GLfloat((1 << 15) - 1));
+ }
+
+ static inline GLfloat normalizedDeviceDepth(uint depth)
+ {
+ return 2.0f * rawDepth(depth) - 1.0f;
+ }
+
uint location(QGLEngineShaderManager::Uniform uniform)
{
return shaderManager->getUniformLocation(uniform);
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 8b7674e..dde4eba 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -2005,9 +2005,15 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
QImage::Format target_format = img.format();
bool premul = options & QGLContext::PremultipliedAlphaBindOption;
- GLenum texture_format = QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2
- ? GL_BGRA : GL_RGBA;
- GLuint pixel_type = GL_UNSIGNED_BYTE;
+ GLenum texture_format;
+ GLuint pixel_type;
+ if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2) {
+ texture_format = GL_BGRA;
+ pixel_type = GL_UNSIGNED_INT_8_8_8_8_REV;
+ } else {
+ texture_format = GL_RGBA;
+ pixel_type = GL_UNSIGNED_BYTE;
+ }
switch (target_format) {
case QImage::Format_ARGB32:
@@ -2034,7 +2040,6 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
if (format == GL_RGBA)
format = GL_RGB;
break;
-
default:
if (img.hasAlphaChannel()) {
img = img.convertToFormat(premul
@@ -2062,6 +2067,30 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
}
}
+ if (texture_format == GL_RGBA) {
+ // The only case where we end up with a depth different from
+ // 32 in the switch above is for the RGB16 case, where we set
+ // the format to GL_RGB
+ Q_ASSERT(img.depth() == 32);
+ const int width = img.width();
+ const int height = img.height();
+
+ if (pixel_type == GL_UNSIGNED_INT_8_8_8_8_REV
+ || (pixel_type == GL_UNSIGNED_BYTE && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) {
+ for (int i=0; i < height; ++i) {
+ uint *p = (uint *) img.scanLine(i);
+ for (int x=0; x<width; ++x)
+ p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00);
+ }
+ } else {
+ for (int i=0; i < height; ++i) {
+ uint *p = (uint *) img.scanLine(i);
+ for (int x=0; x<width; ++x)
+ p[x] = (p[x] << 8) | ((p[x] >> 24) & 0xff);
+ }
+ }
+ }
+
const QImage &constRef = img; // to avoid detach in bits()...
glTexImage2D(target, 0, format, img.width(), img.height(), 0, texture_format,
pixel_type, constRef.bits());
@@ -3533,12 +3562,7 @@ bool QGLWidget::event(QEvent *e)
#elif defined(Q_WS_WIN)
if (e->type() == QEvent::ParentChange) {
QGLContext *newContext = new QGLContext(d->glcx->requestedFormat(), this);
- QList<const QGLContext *> shares = qgl_share_reg()->shares(d->glcx);
- setContext(newContext);
- for (int i = 0; i < shares.size(); ++i) {
- if (newContext != shares.at(i))
- qgl_share_reg()->addShare(newContext, shares.at(i));
- }
+ setContext(newContext, d->glcx);
// the overlay needs to be recreated as well
delete d->olcx;
@@ -4922,13 +4946,13 @@ void QGLShareRegister::removeShare(const QGLContext *context) {
QGLContextResource::QGLContextResource(FreeFunc f, QObject *parent)
: QObject(parent), free(f)
{
- connect(QGLSignalProxy::instance(), SIGNAL(aboutToDestroyContext(const QGLContext *)), this, SLOT(aboutToDestroyContext(const QGLContext *)));
+ connect(QGLSignalProxy::instance(), SIGNAL(aboutToDestroyContext(const QGLContext *)), this, SLOT(removeOne(const QGLContext *)));
}
QGLContextResource::~QGLContextResource()
{
while (!m_resources.empty())
- remove(m_resources.begin().key());
+ removeGroup(m_resources.begin().key());
}
void QGLContextResource::insert(const QGLContext *key, void *value)
@@ -4976,7 +5000,7 @@ void *QGLContextResource::value(const QGLContext *key)
return it.value();
}
-void QGLContextResource::remove(const QGLContext *key)
+void QGLContextResource::removeGroup(const QGLContext *key)
{
QList<const QGLContext *> shares = qgl_share_reg()->shares(key);
if (shares.size() == 0)
@@ -5000,7 +5024,7 @@ void QGLContextResource::remove(const QGLContext *key)
}
}
-void QGLContextResource::aboutToDestroyContext(const QGLContext *key)
+void QGLContextResource::removeOne(const QGLContext *key)
{
ResourceHash::iterator it = m_resources.find(key);
if (it == m_resources.end())
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index a39c52c..72ec35e 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -540,10 +540,10 @@ public:
// Return resource for 'key' or a shared context.
void *value(const QGLContext *key);
// Free resource for 'key' and all its shared contexts.
- void remove(const QGLContext *key);
+ void removeGroup(const QGLContext *key);
private slots:
// Remove entry 'key' from cache and delete resource if there are no shared contexts.
- void aboutToDestroyContext(const QGLContext *key);
+ void removeOne(const QGLContext *key);
private:
typedef QHash<const QGLContext *, void *> ResourceHash;
ResourceHash m_resources;
diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h
index 8839f60..b1c9503 100644
--- a/src/opengl/qglextensions_p.h
+++ b/src/opengl/qglextensions_p.h
@@ -418,6 +418,10 @@ struct QGLExtensionFuncs
#define GL_UNSIGNED_SHORT_5_6_5 33635
#endif
+#ifndef GL_UNSIGNED_INT_8_8_8_8_REV
+#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
+#endif
+
#ifndef GL_MULTISAMPLE
#define GL_MULTISAMPLE 0x809D
#endif
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 9659654..a03e627 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -109,38 +109,28 @@ public:
*/
/*!
- Creates a QGLFramebufferObjectFormat object with properties specifying
+ Creates a QGLFramebufferObjectFormat object for specifying
the format of an OpenGL framebuffer object.
- A multisample framebuffer object is specified by setting \a samples
- to a value different from zero. If the desired amount of samples per pixel is
- not supported by the hardware then the maximum number of samples per pixel
- will be used. Note that multisample framebuffer objects can not be bound as
- textures. Also, the \c{GL_EXT_framebuffer_multisample} extension is required
- to create a framebuffer with more than one sample per pixel.
-
- For multisample framebuffer objects a color render buffer is created,
- otherwise a texture with the texture target \a target is created.
- The color render buffer or texture will have the internal format
- \a internalFormat, and will be bound to the \c GL_COLOR_ATTACHMENT0
- attachment in the framebuffer object.
-
- The \a attachment parameter describes the depth/stencil buffer
- configuration.
+ By default the format specifies a non-multisample framebuffer object with no
+ attachments, texture target \c GL_TEXTURE_2D, and internal format \c GL_RGBA8.
\sa samples(), attachment(), target(), internalFormat()
*/
-QGLFramebufferObjectFormat::QGLFramebufferObjectFormat(int samples,
- QGLFramebufferObject::Attachment attachment,
- GLenum target,
- GLenum internalFormat)
+#ifndef QT_OPENGL_ES
+#define DEFAULT_FORMAT GL_RGBA8
+#else
+#define DEFAULT_FORMAT GL_RGBA
+#endif
+
+QGLFramebufferObjectFormat::QGLFramebufferObjectFormat()
{
d = new QGLFramebufferObjectFormatPrivate;
- d->samples = samples;
- d->attachment = attachment;
- d->target = target;
- d->internal_format = internalFormat;
+ d->samples = 0;
+ d->attachment = QGLFramebufferObject::NoAttachment;
+ d->target = GL_TEXTURE_2D;
+ d->internal_format = DEFAULT_FORMAT;
}
/*!
@@ -176,6 +166,12 @@ QGLFramebufferObjectFormat::~QGLFramebufferObjectFormat()
to \a samples.
A sample count of 0 represents a regular non-multisample framebuffer object.
+ If the desired amount of samples per pixel is not supported by the hardware
+ then the maximum number of samples per pixel will be used. Note that
+ multisample framebuffer objects can not be bound as textures. Also, the
+ \c{GL_EXT_framebuffer_multisample} extension is required to create a
+ framebuffer with more than one sample per pixel.
+
\sa samples()
*/
void QGLFramebufferObjectFormat::setSamples(int samples)
@@ -195,7 +191,7 @@ int QGLFramebufferObjectFormat::samples() const
}
/*!
- Sets the attachments a framebuffer object should have to \a attachment.
+ Sets the attachment configuration of a framebuffer object to \a attachment.
\sa attachment()
*/
@@ -259,6 +255,20 @@ GLenum QGLFramebufferObjectFormat::internalFormat() const
return d->internal_format;
}
+#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
+/*! \internal */
+void QGLFramebufferObjectFormat::setTextureTarget(QMacCompatGLenum target)
+{
+ d->target = target;
+}
+
+/*! \internal */
+void QGLFramebufferObjectFormat::setInternalFormat(QMacCompatGLenum internalFormat)
+{
+ d->internal_format = internalFormat;
+}
+#endif
+
class QGLFramebufferObjectPrivate
{
public:
@@ -526,6 +536,12 @@ void QGLFramebufferObjectPrivate::init(const QSize &sz, QGLFramebufferObject::At
the constructors that take a QGLFramebufferObject parameter, and set the
QGLFramebufferObject::samples() property to a non-zero value.
+ For multisample framebuffer objects a color render buffer is created,
+ otherwise a texture with the specified texture target is created.
+ The color render buffer or texture will have the specified internal
+ format, and will be bound to the \c GL_COLOR_ATTACHMENT0
+ attachment in the framebuffer object.
+
If you want to use a framebuffer object with multisampling enabled
as a texture, you first need to copy from it to a regular framebuffer
object using QGLContext::blitFramebuffer().
@@ -579,12 +595,6 @@ void QGLFramebufferObjectPrivate::init(const QSize &sz, QGLFramebufferObject::At
\sa size(), texture(), attachment()
*/
-#ifndef QT_OPENGL_ES
-#define DEFAULT_FORMAT GL_RGBA8
-#else
-#define DEFAULT_FORMAT GL_RGBA
-#endif
-
QGLFramebufferObject::QGLFramebufferObject(const QSize &size, GLenum target)
: d_ptr(new QGLFramebufferObjectPrivate)
{
@@ -875,9 +885,22 @@ QImage QGLFramebufferObject::toImage() const
if (!d->valid)
return QImage();
- const_cast<QGLFramebufferObject *>(this)->bind();
+ // qt_gl_read_framebuffer doesn't work on a multisample FBO
+ if (format().samples() != 0) {
+ QGLFramebufferObject temp(size(), QGLFramebufferObjectFormat());
+
+ QRect rect(QPoint(0, 0), size());
+ blitFramebuffer(&temp, rect, const_cast<QGLFramebufferObject *>(this), rect);
+
+ return temp.toImage();
+ }
+
+ bool wasBound = isBound();
+ if (!wasBound)
+ const_cast<QGLFramebufferObject *>(this)->bind();
QImage image = qt_gl_read_framebuffer(d->size, d->ctx->format().alpha(), true);
- const_cast<QGLFramebufferObject *>(this)->release();
+ if (!wasBound)
+ const_cast<QGLFramebufferObject *>(this)->release();
return image;
}
diff --git a/src/opengl/qglframebufferobject.h b/src/opengl/qglframebufferobject.h
index cfc824b..ad14e50 100644
--- a/src/opengl/qglframebufferobject.h
+++ b/src/opengl/qglframebufferobject.h
@@ -137,18 +137,7 @@ class QGLFramebufferObjectFormatPrivate;
class Q_OPENGL_EXPORT QGLFramebufferObjectFormat
{
public:
-#if !defined(QT_OPENGL_ES) || defined(Q_QDOC)
- QGLFramebufferObjectFormat(int samples = 0,
- QGLFramebufferObject::Attachment attachment = QGLFramebufferObject::NoAttachment,
- GLenum target = GL_TEXTURE_2D,
- GLenum internalFormat = GL_RGBA8);
-#else
- QGLFramebufferObjectFormat(int samples = 0,
- QGLFramebufferObject::Attachment attachment = QGLFramebufferObject::NoAttachment,
- GLenum target = GL_TEXTURE_2D,
- GLenum internalFormat = GL_RGBA);
-#endif
-
+ QGLFramebufferObjectFormat();
QGLFramebufferObjectFormat(const QGLFramebufferObjectFormat &other);
QGLFramebufferObjectFormat &operator=(const QGLFramebufferObjectFormat &other);
~QGLFramebufferObjectFormat();
@@ -165,6 +154,11 @@ public:
void setInternalFormat(GLenum internalFormat);
GLenum internalFormat() const;
+#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
+ void setTextureTarget(QMacCompatGLenum target);
+ void setInternalFormat(QMacCompatGLenum internalFormat);
+#endif
+
private:
QGLFramebufferObjectFormatPrivate *d;
};
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index 54d54e9..f082ff0 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -110,8 +110,10 @@ void QGLPixelBufferPrivate::common_init(const QSize &size, const QGLFormat &form
invalid = false;
qctx = new QGLContext(format);
qctx->d_func()->sharing = (shareWidget != 0);
- if (shareWidget != 0 && shareWidget->d_func()->glcx)
+ if (shareWidget != 0 && shareWidget->d_func()->glcx) {
qgl_share_reg()->addShare(qctx, shareWidget->d_func()->glcx);
+ shareWidget->d_func()->glcx->d_func()->sharing = true;
+ }
qctx->d_func()->paintDevice = q;
qctx->d_func()->valid = true;
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index c51ccc7..56e5baa 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -324,7 +324,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const
filter->setSource(generateBlurShader(radius(), quality() == Qt::SmoothTransformation));
QGLFramebufferObjectFormat format;
- format.setInternalFormat(src.hasAlphaChannel() ? GL_RGBA : GL_RGB);
+ format.setInternalFormat(GLenum(src.hasAlphaChannel() ? GL_RGBA : GL_RGB));
QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(src.size(), format);
if (!fbo)
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index c4d9322..56b55d0 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -501,6 +501,25 @@ bool QGLShader::compile(const char *source)
return d->compile(this);
} else if (d->shader) {
QVarLengthArray<const char *> src;
+ int headerLen = 0;
+ while (source && source[headerLen] == '#') {
+ // Skip #version and #extension directives at the start of
+ // the shader code. We need to insert the qualifierDefines
+ // and redefineHighp just after them.
+ if (qstrncmp(source + headerLen, "#version", 8) != 0 &&
+ qstrncmp(source + headerLen, "#extension", 10) != 0) {
+ break;
+ }
+ while (source[headerLen] != '\0' && source[headerLen] != '\n')
+ ++headerLen;
+ if (source[headerLen] == '\n')
+ ++headerLen;
+ }
+ QByteArray header;
+ if (headerLen > 0) {
+ header = QByteArray(source, headerLen);
+ src.append(header.constData());
+ }
#ifdef QGL_DEFINE_QUALIFIERS
src.append(qualifierDefines);
#endif
@@ -509,7 +528,7 @@ bool QGLShader::compile(const char *source)
d->shaderType == PartialFragmentShader)
src.append(redefineHighp);
#endif
- src.append(source);
+ src.append(source + headerLen);
QGLContextGroup *ctx = d->ctx;
glShaderSource(d->shader, src.size(), src.data(), 0);
return d->compile(this);
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index 5e87e96..b6f5012 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -467,7 +467,7 @@ QPaintEngine* QGLPixmapData::paintEngine() const
QGLFramebufferObjectFormat format;
format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
format.setSamples(4);
- format.setInternalFormat(m_hasAlpha ? GL_RGBA : GL_RGB);
+ format.setInternalFormat(GLenum(m_hasAlpha ? GL_RGBA : GL_RGB));
m_renderFbo = qgl_fbo_pool()->acquire(size(), format);
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index a59501c..f974938 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -569,7 +569,7 @@ void QGLWindowSurface::updateGeometry()
QGLFramebufferObjectFormat format;
format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
- format.setInternalFormat(GL_RGBA);
+ format.setInternalFormat(GLenum(GL_RGBA));
format.setTextureTarget(target);
if (QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit)
diff --git a/src/opengl/util/glsl_to_include.sh b/src/opengl/util/glsl_to_include.sh
index 59d4693..083ad1e 100755
--- a/src/opengl/util/glsl_to_include.sh
+++ b/src/opengl/util/glsl_to_include.sh
@@ -1,4 +1,44 @@
#! /bin/sh
+#############################################################################
+##
+## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is the build configuration utility 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$
+##
+#############################################################################
# Compile a .glsl file to a file that can be included in a C++ program
USAGE="Usage: $0 <file.glsl>"
diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro
index c5da3df..d397050 100644
--- a/src/plugins/gfxdrivers/directfb/directfb.pro
+++ b/src/plugins/gfxdrivers/directfb/directfb.pro
@@ -1,47 +1,15 @@
TARGET = qdirectfbscreen
include(../../qpluginbase.pri)
+include($$QT_SOURCE_TREE/src/gui/embedded/directfb.pri)
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers
-# These defines might be necessary if your DirectFB driver doesn't
-# support all of the DirectFB API.
-#
-#DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR
-#DEFINES += QT_NO_DIRECTFB_IMAGEPROVIDER
-#DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
-#DEFINES += QT_DIRECTFB_IMAGECACHE
-#DEFINES += QT_NO_DIRECTFB_WM
-#DEFINES += QT_NO_DIRECTFB_LAYER
-#DEFINES += QT_NO_DIRECTFB_PALETTE
-#DEFINES += QT_NO_DIRECTFB_PREALLOCATED
-#DEFINES += QT_NO_DIRECTFB_MOUSE
-#DEFINES += QT_NO_DIRECTFB_KEYBOARD
-#DEFINES += QT_DIRECTFB_TIMING
-#DEFINES += QT_NO_DIRECTFB_OPAQUE_DETECTION
-#DIRECTFB_DRAWINGOPERATIONS=DRAW_RECTS|DRAW_LINES|DRAW_IMAGE|DRAW_PIXMAP|DRAW_TILED_PIXMAP|STROKE_PATH|DRAW_PATH|DRAW_POINTS|DRAW_ELLIPSE|DRAW_POLYGON|DRAW_TEXT|FILL_PATH|FILL_RECT|DRAW_COLORSPANS
-#DEFINES += \"QT_DIRECTFB_WARN_ON_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
-#DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
-
target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers
INSTALLS += target
-HEADERS = qdirectfbscreen.h \
- qdirectfbwindowsurface.h \
- qdirectfbpaintengine.h \
- qdirectfbpaintdevice.h \
- qdirectfbpixmap.h \
- qdirectfbkeyboard.h \
- qdirectfbmouse.h
-
-SOURCES = qdirectfbscreen.cpp \
- qdirectfbscreenplugin.cpp \
- qdirectfbwindowsurface.cpp \
- qdirectfbpaintengine.cpp \
- qdirectfbpaintdevice.cpp \
- qdirectfbpixmap.cpp \
- qdirectfbkeyboard.cpp \
- qdirectfbmouse.cpp
+SOURCES += qdirectfbscreenplugin.cpp
QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB
LIBS += $$QT_LIBS_DIRECTFB
DEFINES += $$QT_DEFINES_DIRECTFB
+contains(gfx-plugins, directfb):DEFINES += QT_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
index 2fb1520..896f512 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
@@ -121,8 +121,8 @@ QDirectFBMouseHandlerPrivate::QDirectFBMouseHandlerPrivate(QDirectFBMouseHandler
return;
}
- int flags = ::fcntl(fd, F_GETFL, 0);
- ::fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+ int flags = fcntl(fd, F_GETFL, 0);
+ fcntl(fd, F_SETFL, flags | O_NONBLOCK);
// DirectFB seems to assume that the mouse always starts centered
prevPoint = QPoint(screen->deviceWidth() / 2, screen->deviceHeight() / 2);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
index 106de0d..b82433d 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
@@ -48,14 +48,26 @@
QT_BEGIN_NAMESPACE
QDirectFBPaintDevice::QDirectFBPaintDevice(QDirectFBScreen *scr)
- : QCustomRasterPaintDevice(0), dfbSurface(0), lockedImage(0), screen(scr),
- bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0),
- imageFormat(QImage::Format_Invalid)
-{}
+ : QCustomRasterPaintDevice(0), dfbSurface(0), screen(scr),
+ bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0), imageFormat(QImage::Format_Invalid)
+{
+#ifdef QT_DIRECTFB_SUBSURFACE
+ subSurface = 0;
+ syncPending = false;
+#endif
+}
QDirectFBPaintDevice::~QDirectFBPaintDevice()
{
- delete lockedImage;
+ if (QDirectFBScreen::instance()) {
+ unlockSurface();
+#ifdef QT_DIRECTFB_SUBSURFACE
+ releaseSubSurface();
+#endif
+ if (dfbSurface) {
+ screen->releaseDFBSurface(dfbSurface);
+ }
+ }
delete engine;
}
@@ -64,30 +76,58 @@ IDirectFBSurface *QDirectFBPaintDevice::directFBSurface() const
return dfbSurface;
}
-void QDirectFBPaintDevice::lockDirectFB(DFBSurfaceLockFlags flags)
+bool QDirectFBPaintDevice::lockSurface(DFBSurfaceLockFlags lockFlags)
{
- if (!(lockFlgs & flags)) {
- if (lockFlgs)
- unlockDirectFB();
- mem = QDirectFBScreen::lockSurface(dfbSurface, flags, &bpl);
+ if (lockFlgs && (lockFlags & ~lockFlgs))
+ unlockSurface();
+ if (!mem) {
+ Q_ASSERT(dfbSurface);
+#ifdef QT_DIRECTFB_SUBSURFACE
+ if (!subSurface) {
+ DFBResult result;
+ subSurface = screen->getSubSurface(dfbSurface, QRect(), QDirectFBScreen::TrackSurface, &result);
+ if (result != DFB_OK || !subSurface) {
+ DirectFBError("Couldn't create sub surface", result);
+ return false;
+ }
+ }
+ IDirectFBSurface *surface = subSurface;
+#else
+ IDirectFBSurface *surface = dfbSurface;
+#endif
+ Q_ASSERT(surface);
+ mem = QDirectFBScreen::lockSurface(surface, lockFlags, &bpl);
+ lockFlgs = lockFlags;
Q_ASSERT(mem);
+ Q_ASSERT(bpl > 0);
const QSize s = size();
- lockedImage = new QImage(mem, s.width(), s.height(), bpl,
- QDirectFBScreen::getImageFormat(dfbSurface));
- lockFlgs = flags;
+ lockedImage = QImage(mem, s.width(), s.height(), bpl,
+ QDirectFBScreen::getImageFormat(dfbSurface));
+ return true;
}
+#ifdef QT_DIRECTFB_SUBSURFACE
+ if (syncPending) {
+ syncPending = false;
+ screen->waitIdle();
+ }
+#endif
+ return false;
}
-void QDirectFBPaintDevice::unlockDirectFB()
+void QDirectFBPaintDevice::unlockSurface()
{
- if (!lockedImage || !QDirectFBScreen::instance())
- return;
-
- dfbSurface->Unlock(dfbSurface);
- delete lockedImage;
- lockedImage = 0;
- mem = 0;
- lockFlgs = DFBSurfaceLockFlags(0);
+ if (QDirectFBScreen::instance() && lockFlgs) {
+#ifdef QT_DIRECTFB_SUBSURFACE
+ IDirectFBSurface *surface = subSurface;
+#else
+ IDirectFBSurface *surface = dfbSurface;
+#endif
+ if (surface) {
+ surface->Unlock(surface);
+ lockFlgs = static_cast<DFBSurfaceLockFlags>(0);
+ mem = 0;
+ }
+ }
}
void *QDirectFBPaintDevice::memory() const
@@ -102,17 +142,10 @@ QImage::Format QDirectFBPaintDevice::format() const
int QDirectFBPaintDevice::bytesPerLine() const
{
- if (bpl == -1) {
- // Can only get the stride when we lock the surface
- Q_ASSERT(!lockedImage);
- QDirectFBPaintDevice* that = const_cast<QDirectFBPaintDevice*>(this);
- that->lockDirectFB(DSLF_READ|DSLF_WRITE);
- Q_ASSERT(bpl != -1);
- }
+ Q_ASSERT(!mem || bpl != -1);
return bpl;
}
-
QSize QDirectFBPaintDevice::size() const
{
int w, h;
@@ -142,8 +175,8 @@ int QDirectFBPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
case QPaintDevice::PdmDepth:
return QDirectFBScreen::depth(imageFormat);
case QPaintDevice::PdmNumColors: {
- if (lockedImage)
- return lockedImage->numColors();
+ if (!lockedImage.isNull())
+ return lockedImage.numColors();
DFBResult result;
IDirectFBPalette *palette = 0;
@@ -171,6 +204,17 @@ QPaintEngine *QDirectFBPaintDevice::paintEngine() const
return engine;
}
+#ifdef QT_DIRECTFB_SUBSURFACE
+void QDirectFBPaintDevice::releaseSubSurface()
+{
+ Q_ASSERT(QDirectFBScreen::instance());
+ if (subSurface) {
+ screen->releaseDFBSurface(subSurface);
+ subSurface = 0;
+ }
+}
+#endif
+
QT_END_NAMESPACE
#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
index f5de44b..adb80e2 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
@@ -62,8 +62,8 @@ public:
virtual IDirectFBSurface *directFBSurface() const;
- void lockDirectFB(DFBSurfaceLockFlags lock);
- void unlockDirectFB();
+ bool lockSurface(DFBSurfaceLockFlags lockFlags);
+ void unlockSurface();
// Reimplemented from QCustomRasterPaintDevice:
void *memory() const;
@@ -73,7 +73,6 @@ public:
int metric(QPaintDevice::PaintDeviceMetric metric) const;
DFBSurfaceLockFlags lockFlags() const { return lockFlgs; }
QPaintEngine *paintEngine() const;
-
protected:
QDirectFBPaintDevice(QDirectFBScreen *scr);
inline int dotsPerMeterX() const
@@ -84,17 +83,21 @@ protected:
{
return (screen->deviceHeight() * 1000) / screen->physicalHeight();
}
-protected:
+
IDirectFBSurface *dfbSurface;
- QImage *lockedImage;
+#ifdef QT_DIRECTFB_SUBSURFACE
+ void releaseSubSurface();
+ IDirectFBSurface *subSurface;
+ friend class QDirectFBPaintEnginePrivate;
+ bool syncPending;
+#endif
+ QImage lockedImage;
QDirectFBScreen *screen;
int bpl;
DFBSurfaceLockFlags lockFlgs;
uchar *mem;
QDirectFBPaintEngine *engine;
QImage::Format imageFormat;
-private:
- Q_DISABLE_COPY(QDirectFBPaintDevice);
};
QT_END_NAMESPACE
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 9a9553e..6535d65 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -93,6 +93,7 @@ public:
inline void lock();
inline void unlock();
+ static inline void unlock(QDirectFBPaintDevice *device);
inline bool isSimpleBrush(const QBrush &brush) const;
@@ -109,7 +110,7 @@ public:
#endif
void prepareForBlit(bool alpha);
-private:
+
IDirectFBSurface *surface;
bool antialiased;
@@ -129,7 +130,6 @@ private:
QRect currentClip;
QDirectFBPaintEngine *q;
- friend class QDirectFBPaintEngine;
};
class SurfaceCache
@@ -222,6 +222,7 @@ template <class T>
static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface);
#define CLIPPED_PAINT(operation) { \
+ d->unlock(); \
DFBRegion clipRegion; \
switch (d->clipType) { \
case QDirectFBPaintEnginePrivate::NoClip: \
@@ -269,6 +270,7 @@ bool QDirectFBPaintEngine::begin(QPaintDevice *device)
QPixmapData *data = static_cast<QPixmap*>(device)->pixmapData();
Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
QDirectFBPixmapData *dfbPixmapData = static_cast<QDirectFBPixmapData*>(data);
+ QDirectFBPaintEnginePrivate::unlock(dfbPixmapData);
d->dfbDevice = static_cast<QDirectFBPaintDevice*>(dfbPixmapData);
}
@@ -409,14 +411,13 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount)
QRasterPaintEngine::drawRects(rects, rectCount);
return;
}
- d->unlock();
if (brush != Qt::NoBrush) {
d->setDFBColor(brush.color());
- CLIPPED_PAINT(::fillRects<QRect>(rects, rectCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(QT_PREPEND_NAMESPACE(fillRects<QRect>)(rects, rectCount, state()->matrix, d->surface));
}
if (pen != Qt::NoPen) {
d->setDFBColor(pen.color());
- CLIPPED_PAINT(::drawRects<QRect>(rects, rectCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects<QRect>)(rects, rectCount, state()->matrix, d->surface));
}
}
@@ -438,14 +439,13 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount)
QRasterPaintEngine::drawRects(rects, rectCount);
return;
}
- d->unlock();
if (brush != Qt::NoBrush) {
d->setDFBColor(brush.color());
- CLIPPED_PAINT(::fillRects<QRectF>(rects, rectCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(fillRects<QRectF>(rects, rectCount, state()->matrix, d->surface));
}
if (pen != Qt::NoPen) {
d->setDFBColor(pen.color());
- CLIPPED_PAINT(::drawRects<QRectF>(rects, rectCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects<QRectF>)(rects, rectCount, state()->matrix, d->surface));
}
}
@@ -464,9 +464,8 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount)
const QPen &pen = state()->pen;
if (pen != Qt::NoPen) {
- d->unlock();
d->setDFBColor(pen.color());
- CLIPPED_PAINT(::drawLines<QLine>(lines, lineCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines<QLine>)(lines, lineCount, state()->matrix, d->surface));
}
}
@@ -485,9 +484,8 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount)
const QPen &pen = state()->pen;
if (pen != Qt::NoPen) {
- d->unlock();
d->setDFBColor(pen.color());
- CLIPPED_PAINT(::drawLines<QLineF>(lines, lineCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines<QLineF>)(lines, lineCount, state()->matrix, d->surface));
}
}
@@ -533,7 +531,6 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
return;
}
#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE
- d->unlock();
bool release;
IDirectFBSurface *imgSurface = d->getSurface(image, &release);
d->prepareForBlit(QDirectFBScreen::hasAlphaChannel(imgSurface));
@@ -561,25 +558,25 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap,
RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
d->lock();
QRasterPaintEngine::drawPixmap(r, pixmap, sr);
- } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
- || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
- || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
- || (state()->renderHints & QPainter::SmoothPixmapTransform
- && state()->matrix.mapRect(r).size() != sr.size())) {
- RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
- const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ);
- d->lock();
- QRasterPaintEngine::drawImage(r, *img, sr);
} else {
- d->unlock();
- d->prepareForBlit(pixmap.hasAlphaChannel());
QPixmapData *data = pixmap.pixmapData();
Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
- dfbData->unlockDirectFB();
- IDirectFBSurface *s = dfbData->directFBSurface();
-
- CLIPPED_PAINT(d->blit(r, s, sr));
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
+ || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
+ || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
+ || (state()->renderHints & QPainter::SmoothPixmapTransform
+ && state()->matrix.mapRect(r).size() != sr.size())) {
+ RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
+ const QImage *img = dfbData->buffer();
+ d->lock();
+ QRasterPaintEngine::drawImage(r, *img, sr);
+ } else {
+ QDirectFBPaintEnginePrivate::unlock(dfbData);
+ d->prepareForBlit(pixmap.hasAlphaChannel());
+ IDirectFBSurface *s = dfbData->directFBSurface();
+ CLIPPED_PAINT(d->blit(r, s, sr));
+ }
}
}
@@ -602,14 +599,16 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
|| d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
|| (state()->renderHints & QPainter::SmoothPixmapTransform && state()->matrix.isScaling())) {
RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset);
- const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ);
+ QPixmapData *pixmapData = pixmap.pixmapData();
+ Q_ASSERT(pixmapData->classId() == QPixmapData::DirectFBClass);
+ QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(pixmapData);
+ const QImage *img = dfbData->buffer();
d->lock();
QRasterPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType);
data->fromImage(*img, Qt::AutoColor);
const QPixmap pix(data);
QRasterPaintEngine::drawTiledPixmap(r, pix, offset);
} else {
- d->unlock();
CLIPPED_PAINT(d->drawTiledPixmap(r, pixmap, offset));
}
}
@@ -708,7 +707,6 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
const QColor color = brush.color();
if (!color.isValid())
return;
- d->unlock();
d->setDFBColor(color);
const QRect r = state()->matrix.mapRect(rect).toRect();
CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()));
@@ -725,7 +723,6 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
if (texture.pixmapData()->classId() != QPixmapData::DirectFBClass)
break;
- d->unlock();
CLIPPED_PAINT(d->drawTiledPixmap(rect, texture, rect.topLeft() - state()->brushOrigin));
return; }
default:
@@ -749,7 +746,6 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color)
d->lock();
QRasterPaintEngine::fillRect(rect, color);
} else {
- d->unlock();
d->setDFBColor(color);
const QRect r = state()->matrix.mapRect(rect).toRect();
CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()));
@@ -811,8 +807,7 @@ void QDirectFBPaintEnginePrivate::lock()
// lock so we need to call the base implementation of prepare so
// it updates its rasterBuffer to point to the new buffer address.
Q_ASSERT(dfbDevice);
- if (dfbDevice->lockFlags() != (DSLF_WRITE|DSLF_READ)) {
- dfbDevice->lockDirectFB(DSLF_READ|DSLF_WRITE);
+ if (dfbDevice->lockSurface(DSLF_READ|DSLF_WRITE)) {
prepare(dfbDevice);
}
}
@@ -820,7 +815,21 @@ void QDirectFBPaintEnginePrivate::lock()
void QDirectFBPaintEnginePrivate::unlock()
{
Q_ASSERT(dfbDevice);
- dfbDevice->unlockDirectFB();
+#ifdef QT_DIRECTFB_SUBSURFACE
+ dfbDevice->syncPending = true;
+#else
+ QDirectFBPaintEnginePrivate::unlock(dfbDevice);
+#endif
+}
+
+void QDirectFBPaintEnginePrivate::unlock(QDirectFBPaintDevice *device)
+{
+#ifdef QT_NO_DIRECTFB_SUBSURFACE
+ Q_ASSERT(device);
+ device->unlockSurface();
+#else
+ Q_UNUSED(device);
+#endif
}
void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform)
@@ -895,10 +904,10 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m
case QPainter::CompositionMode_Plus:
surface->SetPorterDuff(surface, DSPD_ADD);
break;
-#endif
case QPainter::CompositionMode_Xor:
surface->SetPorterDuff(surface, DSPD_XOR);
break;
+#endif
default:
compositionModeStatus = 0;
break;
@@ -1031,7 +1040,7 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix
QPixmapData *data = pixmap.pixmapData();
Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
- dfbData->unlockDirectFB();
+ QDirectFBPaintEnginePrivate::unlock(dfbData);
const QSize pixmapSize = dfbData->size();
IDirectFBSurface *sourceSurface = dfbData->directFBSurface();
if (transform.isScaling()) {
@@ -1040,8 +1049,8 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix
offset.ry() *= transform.m22();
const QSizeF mappedSize(pixmapSize.width() * transform.m11(), pixmapSize.height() * transform.m22());
- qreal y = ::fixCoord(destinationRect.y(), mappedSize.height(), offset.y());
- const qreal startX = ::fixCoord(destinationRect.x(), mappedSize.width(), offset.x());
+ qreal y = fixCoord(destinationRect.y(), mappedSize.height(), offset.y());
+ const qreal startX = fixCoord(destinationRect.x(), mappedSize.width(), offset.x());
while (y <= destinationRect.bottom()) {
qreal x = startX;
while (x <= destinationRect.right()) {
@@ -1052,8 +1061,8 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix
y += mappedSize.height();
}
} else {
- qreal y = ::fixCoord(destinationRect.y(), pixmapSize.height(), offset.y());
- const qreal startX = ::fixCoord(destinationRect.x(), pixmapSize.width(), offset.x());
+ qreal y = fixCoord(destinationRect.y(), pixmapSize.height(), offset.y());
+ const qreal startX = fixCoord(destinationRect.x(), pixmapSize.width(), offset.x());
int horizontal = qMax(1, destinationRect.width() / pixmapSize.width()) + 1;
if (startX != destinationRect.x())
++horizontal;
@@ -1165,12 +1174,12 @@ template <class T>
static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface)
{
if (n == 1) {
- const QLine l = ::map(transform, lines[0]);
+ const QLine l = map(transform, lines[0]);
surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2());
} else {
QVarLengthArray<DFBRegion, 32> lineArray(n);
for (int i=0; i<n; ++i) {
- const QLine l = ::map(transform, lines[i]);
+ const QLine l = map(transform, lines[i]);
lineArray[i].x1 = l.x1();
lineArray[i].y1 = l.y1();
lineArray[i].x2 = l.x2();
@@ -1184,12 +1193,12 @@ template <class T>
static inline void fillRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface)
{
if (n == 1) {
- const QRect r = ::mapRect(transform, rects[0]);
+ const QRect r = mapRect(transform, rects[0]);
surface->FillRectangle(surface, r.x(), r.y(), r.width(), r.height());
} else {
QVarLengthArray<DFBRectangle, 32> rectArray(n);
for (int i=0; i<n; ++i) {
- const QRect r = ::mapRect(transform, rects[i]);
+ const QRect r = mapRect(transform, rects[i]);
rectArray[i].x = r.x();
rectArray[i].y = r.y();
rectArray[i].w = r.width();
@@ -1203,7 +1212,7 @@ template <class T>
static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface)
{
for (int i=0; i<n; ++i) {
- const QRect r = ::mapRect(transform, rects[i]);
+ const QRect r = mapRect(transform, rects[i]);
surface->DrawRectangle(surface, r.x(), r.y(), r.width(), r.height());
}
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 0717020..6550683 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -64,9 +64,6 @@ QDirectFBPixmapData::QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixe
QDirectFBPixmapData::~QDirectFBPixmapData()
{
- unlockDirectFB();
- if (dfbSurface && QDirectFBScreen::instance())
- screen->releaseDFBSurface(dfbSurface);
}
void QDirectFBPixmapData::resize(int width, int height)
@@ -167,7 +164,7 @@ static bool checkForAlphaPixels(const QImage &img)
bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img)
{
#ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION
- return ::checkForAlphaPixels(img);
+ return checkForAlphaPixels(img);
#else
return img.hasAlphaChannel();
#endif
@@ -375,9 +372,13 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect)
QPixmapData::copy(data, rect);
return;
}
- unlockDirectFB();
const QDirectFBPixmapData *otherData = static_cast<const QDirectFBPixmapData*>(data);
+#ifdef QT_NO_DIRECTFB_SUBSURFACE
+ if (otherData->lockFlags()) {
+ const_cast<QDirectFBPixmapData*>(otherData)->unlockSurface();
+ }
+#endif
IDirectFBSurface *src = otherData->directFBSurface();
alpha = data->hasAlphaChannel();
imageFormat = (alpha
@@ -405,6 +406,7 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect)
h = rect.height();
d = otherData->d;
is_null = (w <= 0 || h <= 0);
+ unlockSurface();
DFBResult result = dfbSurface->Blit(dfbSurface, src, &blitRect, 0, 0);
#if (Q_DIRECTFB_VERSION >= 0x010000)
dfbSurface->ReleaseSource(dfbSurface);
@@ -443,7 +445,7 @@ void QDirectFBPixmapData::fill(const QColor &color)
alpha = (color.alpha() < 255);
- if (alpha && ::isOpaqueFormat(imageFormat)) {
+ if (alpha && isOpaqueFormat(imageFormat)) {
QSize size;
dfbSurface->GetSize(dfbSurface, &size.rwidth(), &size.rheight());
screen->releaseDFBSurface(dfbSurface);
@@ -465,18 +467,21 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform,
Qt::TransformationMode mode) const
{
QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this);
+#ifdef QT_NO_DIRECTFB_SUBSURFACE
+ if (lockFlags())
+ that->unlockSurface();
+#endif
+
if (!dfbSurface || transform.type() != QTransform::TxScale
|| mode != Qt::FastTransformation)
{
const QImage *image = that->buffer();
Q_ASSERT(image);
const QImage transformed = image->transformed(transform, mode);
- that->unlockDirectFB();
QDirectFBPixmapData *data = new QDirectFBPixmapData(screen, QPixmapData::PixmapType);
data->fromImage(transformed, Qt::AutoColor);
return QPixmap(data);
}
- that->unlockDirectFB();
const QSize size = transform.mapRect(QRect(0, 0, w, h)).size();
if (size.isEmpty())
@@ -556,14 +561,12 @@ QPaintEngine *QDirectFBPixmapData::paintEngine() const
QImage *QDirectFBPixmapData::buffer()
{
- lockDirectFB(DSLF_READ|DSLF_WRITE);
- return lockedImage;
-}
-
-QImage * QDirectFBPixmapData::buffer(DFBSurfaceLockFlags lockFlags)
-{
- lockDirectFB(lockFlags);
- return lockedImage;
+ if (!lockFlgs) {
+ lockSurface(DSLF_READ|DSLF_WRITE);
+ }
+ Q_ASSERT(lockFlgs);
+ Q_ASSERT(!lockedImage.isNull());
+ return &lockedImage;
}
void QDirectFBPixmapData::invalidate()
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
index 7b4ae47..5d3a2f6 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
@@ -81,11 +81,9 @@ public:
virtual QImage toImage() const;
virtual QPaintEngine *paintEngine() const;
virtual QImage *buffer();
- virtual int metric(QPaintDevice::PaintDeviceMetric m) const {return QDirectFBPaintDevice::metric(m);}
-
- QImage *buffer(DFBSurfaceLockFlags lockFlags);
-
// Pure virtual in QPixmapData, so re-implement here and delegate to QDirectFBPaintDevice
+ virtual int metric(QPaintDevice::PaintDeviceMetric m) const { return QDirectFBPaintDevice::metric(m); }
+
inline QImage::Format pixelFormat() const { return imageFormat; }
static bool hasAlphaChannel(const QImage &img);
inline bool hasAlphaChannel() const { return alpha; }
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 59fa191..5651506 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -319,14 +319,38 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc,
if (options & TrackSurface) {
d_ptr->allocatedSurfaces.insert(newSurface);
-
- //qDebug("Created a new DirectFB surface at %p. New count = %d",
- // newSurface, d_ptr->allocatedSurfaces.count());
}
return newSurface;
}
+#ifdef QT_DIRECTFB_SUBSURFACE
+IDirectFBSurface *QDirectFBScreen::getSubSurface(IDirectFBSurface *surface,
+ const QRect &rect,
+ SurfaceCreationOptions options,
+ DFBResult *resultPtr)
+{
+ Q_ASSERT(!(options & NoPreallocated));
+ Q_ASSERT(surface);
+ DFBResult res;
+ DFBResult &result = (resultPtr ? *resultPtr : res);
+ IDirectFBSurface *subSurface = 0;
+ if (rect.isNull()) {
+ result = surface->GetSubSurface(surface, 0, &subSurface);
+ } else {
+ const DFBRectangle subRect = { rect.x(), rect.y(), rect.width(), rect.height() };
+ result = surface->GetSubSurface(surface, &subRect, &subSurface);
+ }
+ if (result != DFB_OK) {
+ DirectFBError("Can't get sub surface", result);
+ } else if (options & TrackSurface) {
+ d_ptr->allocatedSurfaces.insert(subSurface);
+ }
+ return subSurface;
+}
+#endif
+
+
void QDirectFBScreen::releaseDFBSurface(IDirectFBSurface *surface)
{
Q_ASSERT(QDirectFBScreen::instance());
@@ -999,9 +1023,9 @@ static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface)
dev.name, dev.vendor, dev.driver.name, dev.driver.major,
dev.driver.minor, dev.driver.vendor, DFB_PIXELFORMAT_INDEX(pixelFormat),
QDirectFBScreen::getImageFormat(primarySurface), dev.acceleration_mask,
- ::flagDescriptions(dev.acceleration_mask, accelerationDescriptions).constData(),
- dev.blitting_flags, ::flagDescriptions(dev.blitting_flags, blitDescriptions).constData(),
- dev.drawing_flags, ::flagDescriptions(dev.drawing_flags, drawDescriptions).constData(),
+ flagDescriptions(dev.acceleration_mask, accelerationDescriptions).constData(),
+ dev.blitting_flags, flagDescriptions(dev.blitting_flags, blitDescriptions).constData(),
+ dev.drawing_flags, flagDescriptions(dev.drawing_flags, drawDescriptions).constData(),
(dev.video_memory >> 10));
}
#endif
@@ -1067,7 +1091,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
#ifdef QT_DIRECTFB_IMAGECACHE
int imageCacheSize = 4 * 1024 * 1024; // 4 MB
- ::setIntOption(displayArgs, QLatin1String("imagecachesize"), &imageCacheSize);
+ setIntOption(displayArgs, QLatin1String("imagecachesize"), &imageCacheSize);
QDirectFBPaintEngine::initImageCache(imageCacheSize);
#endif
@@ -1168,6 +1192,33 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
lstep = 0;
size = 0;
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreen::connect: "
+ "Unable to get screen!", result);
+ return false;
+ }
+ const QString qws_size = qgetenv("QWS_SIZE");
+ if (!qws_size.isEmpty()) {
+ QRegExp rx(QLatin1String("(\\d+)x(\\d+)"));
+ if (!rx.exactMatch(qws_size)) {
+ qWarning("QDirectFBScreen::connect: Can't parse QWS_SIZE=\"%s\"", qPrintable(qws_size));
+ } else {
+ int *ints[2] = { &w, &h };
+ for (int i=0; i<2; ++i) {
+ *ints[i] = rx.cap(i + 1).toInt();
+ if (*ints[i] <= 0) {
+ qWarning("QDirectFBScreen::connect: %s is not a positive integer",
+ qPrintable(rx.cap(i + 1)));
+ w = h = 0;
+ break;
+ }
+ }
+ }
+ }
+
+ setIntOption(displayArgs, QLatin1String("width"), &w);
+ setIntOption(displayArgs, QLatin1String("height"), &h);
+
#ifndef QT_NO_DIRECTFB_LAYER
result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, DLID_PRIMARY,
&d_ptr->dfbLayer);
@@ -1180,19 +1231,26 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
#else
result = d_ptr->dfb->GetScreen(d_ptr->dfb, 0, &d_ptr->dfbScreen);
#endif
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen::connect: "
- "Unable to get screen!", result);
- return false;
- }
- result = d_ptr->dfbScreen->GetSize(d_ptr->dfbScreen, &w, &h);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen::connect: "
- "Unable to get screen size!", result);
+
+ if (w <= 0 || h <= 0) {
+#ifdef QT_NO_DIRECTFB_WM
+ result = d_ptr->primarySurface->GetSize(d_ptr->primarySurface, &w, &h);
+#elif (Q_DIRECTFB_VERSION >= 0x010000)
+ result = d_ptr->dfbScreen->GetSize(d_ptr->dfbScreen, &w, &h);
+#else
+ qWarning("QDirectFBScreen::connect: DirectFB versions prior to 1.0 do not offer a way\n"
+ "query the size of the primary surface in windowed mode. You have to specify\n"
+ "the size of the display using QWS_SIZE=[0-9]x[0-9] or\n"
+ "QWS_DISPLAY=directfb:width=[0-9]:height=[0-9]");
return false;
+#endif
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreen::connect: "
+ "Unable to get screen size!", result);
+ return false;
+ }
}
- ::setIntOption(displayArgs, QLatin1String("width"), &w);
- ::setIntOption(displayArgs, QLatin1String("height"), &h);
+
dw = w;
dh = h;
@@ -1200,8 +1258,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
Q_ASSERT(dw != 0 && dh != 0);
physWidth = physHeight = -1;
- ::setIntOption(displayArgs, QLatin1String("mmWidth"), &physWidth);
- ::setIntOption(displayArgs, QLatin1String("mmHeight"), &physHeight);
+ setIntOption(displayArgs, QLatin1String("mmWidth"), &physWidth);
+ setIntOption(displayArgs, QLatin1String("mmHeight"), &physHeight);
const int dpi = 72;
if (physWidth < 0)
physWidth = qRound(dw * 25.4 / dpi);
@@ -1432,7 +1490,7 @@ void QDirectFBScreen::solidFill(const QColor &color, const QRegion &region)
color.red(), color.green(), color.blue(),
color.alpha());
const int n = region.numRects();
- if (n > 1) {
+ if (n == 1) {
const QRect r = region.boundingRect();
d_ptr->primarySurface->FillRectangle(d_ptr->primarySurface, r.x(), r.y(), r.width(), r.height());
} else {
@@ -1527,6 +1585,11 @@ void QDirectFBScreen::setDirectFBImageProvider(IDirectFBImageProvider *provider)
}
#endif
+void QDirectFBScreen::waitIdle()
+{
+ d_ptr->dfb->WaitIdle(d_ptr->dfb);
+}
+
IDirectFBSurface * QDirectFBScreen::surfaceForWidget(const QWidget *widget, QRect *rect) const
{
Q_ASSERT(widget);
@@ -1540,6 +1603,7 @@ IDirectFBSurface * QDirectFBScreen::surfaceForWidget(const QWidget *widget, QRec
return 0;
}
+#ifdef QT_DIRECTFB_SUBSURFACE
IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, const QRect &area) const
{
Q_ASSERT(widget);
@@ -1550,7 +1614,7 @@ IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, co
if (!area.isNull())
rect &= area.translated(widget->mapTo(widget->window(), QPoint(0, 0)));
if (!rect.isNull()) {
- const DFBRectangle subRect = {rect.x(), rect.y(), rect.width(), rect.height() };
+ const DFBRectangle subRect = { rect.x(), rect.y(), rect.width(), rect.height() };
const DFBResult result = surface->GetSubSurface(surface, &subRect, &subSurface);
if (result != DFB_OK) {
DirectFBError("QDirectFBScreen::subSurface(): Can't get sub surface", result);
@@ -1559,6 +1623,7 @@ IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, co
}
return subSurface;
}
+#endif
QT_END_NAMESPACE
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index e74adb1..0ce7a53 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -54,6 +54,9 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
+#if !defined QT_NO_DIRECTFB_SUBSURFACE && !defined QT_DIRECTFB_SUBSURFACE
+#define QT_DIRECTFB_SUBSURFACE
+#endif
#if !defined QT_NO_DIRECTFB_LAYER && !defined QT_DIRECTFB_LAYER
#define QT_DIRECTFB_LAYER
#endif
@@ -166,8 +169,11 @@ public:
return static_cast<QDirectFBScreen*>(inst);
}
+ void waitIdle();
IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const;
+#ifdef QT_DIRECTFB_SUBSURFACE
IDirectFBSurface *subSurfaceForWidget(const QWidget *widget, const QRect &area = QRect()) const;
+#endif
IDirectFB *dfb();
#ifdef QT_NO_DIRECTFB_WM
@@ -199,6 +205,12 @@ public:
IDirectFBSurface *createDFBSurface(DFBSurfaceDescription desc,
SurfaceCreationOptions options,
DFBResult *result);
+#ifdef QT_DIRECTFB_SUBSURFACE
+ IDirectFBSurface *getSubSurface(IDirectFBSurface *surface,
+ const QRect &rect,
+ SurfaceCreationOptions options,
+ DFBResult *result);
+#endif
void flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags,
const QRegion &region, const QPoint &offset);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index 73a6dd7..9e0691d 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -100,6 +100,13 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
QDirectFBWindowSurface::~QDirectFBWindowSurface()
{
+ releaseSurface();
+ // these are not tracked by QDirectFBScreen so we don't want QDirectFBPaintDevice to release it
+}
+
+bool QDirectFBWindowSurface::isValid() const
+{
+ return true;
}
#ifdef QT_DIRECTFB_WM
@@ -111,15 +118,8 @@ void QDirectFBWindowSurface::raise()
sibling->raise();
}
}
-#endif
-
-bool QDirectFBWindowSurface::isValid() const
-{
- return true;
-}
-#ifndef QT_NO_DIRECTFB_WM
-void QDirectFBWindowSurface::createWindow()
+void QDirectFBWindowSurface::createWindow(const QRect &rect)
{
IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer();
if (!layer)
@@ -127,8 +127,12 @@ void QDirectFBWindowSurface::createWindow()
DFBWindowDescription description;
description.caps = DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER;
- description.flags = DWDESC_CAPS|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT;
+ description.flags = DWDESC_CAPS|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT|DWDESC_HEIGHT|DWDESC_WIDTH|DWDESC_POSX|DWDESC_POSY;
+ description.posx = rect.x();
+ description.posy = rect.y();
+ description.width = rect.width();
+ description.height = rect.height();
description.surface_caps = DSCAPS_NONE;
if (screen->directFBFlags() & QDirectFBScreen::VideoOnly)
description.surface_caps |= DSCAPS_VIDEOONLY;
@@ -148,10 +152,8 @@ void QDirectFBWindowSurface::createWindow()
dfbWindow->GetSurface(dfbWindow, &dfbSurface);
updateFormat();
}
-#endif // QT_NO_DIRECTFB_WM
-#ifndef QT_NO_DIRECTFB_WM
-static DFBResult setGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const QRect &rect)
+static DFBResult setWindowGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const QRect &rect)
{
DFBResult result = DFB_OK;
const bool isMove = old.isEmpty() || rect.topLeft() != old.topLeft();
@@ -178,7 +180,7 @@ static DFBResult setGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const
#endif
return result;
}
-#endif
+#endif // QT_NO_DIRECTFB_WM
void QDirectFBWindowSurface::setGeometry(const QRect &rect)
{
@@ -205,11 +207,12 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect)
const QRect oldRect = geometry();
DFBResult result = DFB_OK;
// If we're in a resize, the surface shouldn't be locked
- Q_ASSERT((lockedImage == 0) || (rect.size() == geometry().size()));
#ifdef QT_DIRECTFB_WM
- if (!dfbWindow)
- createWindow();
- ::setGeometry(dfbWindow, oldRect, rect);
+ if (!dfbWindow) {
+ createWindow(rect);
+ } else {
+ setWindowGeometry(dfbWindow, oldRect, rect);
+ }
#else
if (mode == Primary) {
if (dfbSurface && dfbSurface != primarySurface)
@@ -271,12 +274,12 @@ bool QDirectFBWindowSurface::scroll(const QRegion &region, int dx, int dy)
return false;
dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
if (region.numRects() == 1) {
- ::scrollSurface(dfbSurface, region.boundingRect(), dx, dy);
+ scrollSurface(dfbSurface, region.boundingRect(), dx, dy);
} else {
const QVector<QRect> rects = region.rects();
const int n = rects.size();
for (int i=0; i<n; ++i) {
- ::scrollSurface(dfbSurface, rects.at(i), dx, dy);
+ scrollSurface(dfbSurface, rects.at(i), dx, dy);
}
}
return true;
@@ -420,7 +423,9 @@ void QDirectFBWindowSurface::beginPaint(const QRegion &)
void QDirectFBWindowSurface::endPaint(const QRegion &)
{
- unlockDirectFB();
+#ifdef QT_NO_DIRECTFB_SUBSURFACE
+ unlockSurface();
+#endif
}
IDirectFBSurface *QDirectFBWindowSurface::directFBSurface() const
@@ -457,6 +462,24 @@ void QDirectFBWindowSurface::updateFormat()
imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid;
}
+void QDirectFBWindowSurface::releaseSurface()
+{
+ if (dfbSurface) {
+#ifdef QT_NO_DIRECTFB_SUBSURFACE
+ if (lockFlgs)
+ unlockSurface();
+#endif
+#ifdef QT_NO_DIRECTFB_WM
+ Q_ASSERT(screen->primarySurface());
+ if (dfbSurface != screen->primarySurface())
+#endif
+
+ dfbSurface->Release(dfbSurface);
+ dfbSurface = 0;
+ }
+}
+
+
QT_END_NAMESPACE
#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
index ca76613..7ae9bfe 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
@@ -95,10 +95,11 @@ public:
IDirectFBSurface *directFBSurface() const;
private:
void updateFormat();
+ void releaseSurface();
QDirectFBWindowSurface *sibling;
#ifdef QT_DIRECTFB_WM
- void createWindow();
+ void createWindow(const QRect &rect);
IDirectFBWindow *dfbWindow;
#else
enum Mode {
diff --git a/src/plugins/graphicssystems/graphicssystems.pro b/src/plugins/graphicssystems/graphicssystems.pro
index bfdec6a..14e3cfc 100644
--- a/src/plugins/graphicssystems/graphicssystems.pro
+++ b/src/plugins/graphicssystems/graphicssystems.pro
@@ -1,4 +1,5 @@
TEMPLATE = subdirs
+SUBDIRS += trace
contains(QT_CONFIG, opengl):SUBDIRS += opengl
contains(QT_CONFIG, openvg):contains(QT_CONFIG, egl):SUBDIRS += openvg
diff --git a/src/plugins/graphicssystems/trace/main.cpp b/src/plugins/graphicssystems/trace/main.cpp
new file mode 100644
index 0000000..908e3f4
--- /dev/null
+++ b/src/plugins/graphicssystems/trace/main.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins 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 <private/qgraphicssystemplugin_p.h>
+#include "qgraphicssystem_trace_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QTraceGraphicsSystemPlugin : public QGraphicsSystemPlugin
+{
+public:
+ QStringList keys() const;
+ QGraphicsSystem *create(const QString&);
+};
+
+QStringList QTraceGraphicsSystemPlugin::keys() const
+{
+ return QStringList(QLatin1String("Trace"));
+}
+
+QGraphicsSystem* QTraceGraphicsSystemPlugin::create(const QString& system)
+{
+ if (system.toLower() == QLatin1String("trace"))
+ return new QTraceGraphicsSystem;
+
+ return 0;
+}
+
+Q_EXPORT_PLUGIN2(trace, QTraceGraphicsSystemPlugin)
+
+QT_END_NAMESPACE
diff --git a/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp b/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp
new file mode 100644
index 0000000..36a8df1
--- /dev/null
+++ b/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins 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 "qgraphicssystem_trace_p.h"
+#include <private/qpixmap_raster_p.h>
+#include <private/qpaintbuffer_p.h>
+#include <private/qwindowsurface_raster_p.h>
+
+#include <QFile>
+#include <QPainter>
+#include <QtDebug>
+
+QT_BEGIN_NAMESPACE
+
+class QTraceWindowSurface : public QRasterWindowSurface
+{
+public:
+ QTraceWindowSurface(QWidget *widget);
+ ~QTraceWindowSurface();
+
+ QPaintDevice *paintDevice();
+ void endPaint(const QRegion &rgn);
+
+private:
+ QPaintBuffer *buffer;
+
+ QFile *outputFile;
+ QDataStream *out;
+
+ int frameId;
+};
+
+QTraceWindowSurface::QTraceWindowSurface(QWidget *widget)
+ : QRasterWindowSurface(widget)
+ , buffer(0)
+ , outputFile(0)
+ , out(0)
+ , frameId(0)
+{
+}
+
+QTraceWindowSurface::~QTraceWindowSurface()
+{
+ delete out;
+ delete outputFile;
+}
+
+QPaintDevice *QTraceWindowSurface::paintDevice()
+{
+ if (!buffer) {
+ buffer = new QPaintBuffer;
+ buffer->setBoundingRect(geometry());
+ }
+ return buffer;
+}
+
+void QTraceWindowSurface::endPaint(const QRegion &rgn)
+{
+ if (!out) {
+ outputFile = new QFile(QString(QLatin1String("qtgraphics-%0.trace")).arg((qulonglong)window()->winId()));
+ if (outputFile->open(QIODevice::WriteOnly))
+ out = new QDataStream(outputFile);
+ }
+
+ QPainter p(QRasterWindowSurface::paintDevice());
+ buffer->draw(&p);
+ p.end();
+
+ if (out) {
+ *out << frameId++;
+ *out << (qulonglong)window()->winId();
+ *out << geometry();
+ *out << rgn;
+ *out << *buffer;
+ }
+
+ delete buffer;
+ buffer = 0;
+}
+
+QTraceGraphicsSystem::QTraceGraphicsSystem()
+{
+}
+
+QPixmapData *QTraceGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
+{
+ return new QRasterPixmapData(type);
+}
+
+QWindowSurface *QTraceGraphicsSystem::createWindowSurface(QWidget *widget) const
+{
+ return new QTraceWindowSurface(widget);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/graphicssystems/trace/qgraphicssystem_trace_p.h b/src/plugins/graphicssystems/trace/qgraphicssystem_trace_p.h
new file mode 100644
index 0000000..5deafc9
--- /dev/null
+++ b/src/plugins/graphicssystems/trace/qgraphicssystem_trace_p.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGRAPHICSSYSTEM_TRACE_P_H
+#define QGRAPHICSSYSTEM_TRACE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qgraphicssystem_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QTraceGraphicsSystem : public QGraphicsSystem
+{
+public:
+ QTraceGraphicsSystem();
+
+ QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
+ QWindowSurface *createWindowSurface(QWidget *widget) const;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/graphicssystems/trace/trace.pro b/src/plugins/graphicssystems/trace/trace.pro
new file mode 100644
index 0000000..d548a6c
--- /dev/null
+++ b/src/plugins/graphicssystems/trace/trace.pro
@@ -0,0 +1,12 @@
+TARGET = qtracegraphicssystem
+include(../../qpluginbase.pri)
+
+QT += network
+
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems
+
+SOURCES = main.cpp qgraphicssystem_trace.cpp
+
+target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems
+INSTALLS += target
+INCLUDEPATH += ../../../3rdparty/harfbuzz/src
diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp
index de985d8..0f6a349 100644
--- a/src/plugins/imageformats/gif/qgifhandler.cpp
+++ b/src/plugins/imageformats/gif/qgifhandler.cpp
@@ -234,7 +234,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
#define LM(l, m) (((m)<<8)|l)
digress = false;
- int initial = length;
+ const int initial = length;
while (!digress && length) {
length--;
unsigned char ch=*buffer++;
@@ -333,7 +333,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
sheight = newtop + newheight;
QImage::Format format = trans_index >= 0 ? QImage::Format_ARGB32 : QImage::Format_RGB32;
- if (image->isNull() || (image->size() != QSize(swidth, sheight)) || image->format() != format) {
+ if (image->isNull()) {
(*image) = QImage(swidth, sheight, format);
memset(image->bits(), 0, image->numBytes());
diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri
index 10563c1..a3abc98 100644
--- a/src/plugins/qpluginbase.pri
+++ b/src/plugins/qpluginbase.pri
@@ -1,6 +1,6 @@
TEMPLATE = lib
isEmpty(QT_MAJOR_VERSION) {
- VERSION=4.5.3
+ VERSION=4.6.0
} else {
VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
}
diff --git a/src/s60main/qts60main.cpp b/src/s60main/qts60main.cpp
index bac8f3a..2b17b27 100644
--- a/src/s60main/qts60main.cpp
+++ b/src/s60main/qts60main.cpp
@@ -40,17 +40,10 @@
****************************************************************************/
// INCLUDE FILES
-#include <exception>
-#include <eikstart.h>
-#include "qts60mainapplication_p.h"
+#include <e32base.h>
+#include <qglobal.h>
-/**
- * factory function to create the QtS60Main application class
- */
-LOCAL_C CApaApplication* NewApplication()
-{
- return new CQtS60MainApplication;
-}
+GLDEF_C TInt QtMainWrapper();
/**
* A normal Symbian OS executable provides an E32Main() function which is
@@ -58,5 +51,10 @@ LOCAL_C CApaApplication* NewApplication()
*/
GLDEF_C TInt E32Main()
{
- return EikStart::RunApplication(NewApplication);
+ CTrapCleanup *cleanupStack = q_check_ptr(CTrapCleanup::New());
+ TInt err = 0;
+ TRAP(err, QtMainWrapper());
+ delete cleanupStack;
+
+ return err;
}
diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp
index ea6132f..4a30380 100644
--- a/src/s60main/qts60main_mcrt0.cpp
+++ b/src/s60main/qts60main_mcrt0.cpp
@@ -51,6 +51,9 @@
#include <e32base.h>
#include "estlib.h"
+// Needed for QT_TRYCATCH_LEAVING.
+#include <qglobal.h>
+
#ifdef __ARMCC__
__asm int CallMain(int argc, char *argv[], char *envp[])
{
diff --git a/src/s60main/qts60mainappui_p.h b/src/s60main/qts60mainappui_p.h
deleted file mode 100644
index 7f8d730..0000000
--- a/src/s60main/qts60mainappui_p.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Symbian application wrapper of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef __QtS60MainAPPUI_H__
-#define __QtS60MainAPPUI_H__
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-// INCLUDES
-#include <aknappui.h>
-
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-/**
-* CQtS60MainAppUi application UI class.
-* Interacts with the user through the UI and request message processing
-* from the handler class
-*/
-class CQtS60MainAppUi : public CAknAppUi
- {
- public: // Constructors and destructor
-
- /**
- * ConstructL.
- * 2nd phase constructor.
- */
- void ConstructL();
-
- /**
- * CQtS60MainAppUi.
- * C++ default constructor. This needs to be public due to
- * the way the framework constructs the AppUi
- */
- CQtS60MainAppUi();
-
- /**
- * ~CQtS60MainAppUi.
- * Virtual Destructor.
- */
- virtual ~CQtS60MainAppUi();
-
- protected:
- void RestoreMenuL(CCoeControl* aMenuWindow,TInt aMenuId,TMenuType aMenuType);
- void DynInitMenuBarL(TInt aResourceId, CEikMenuBar *aMenuBar);
- void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane);
-
- private: // Functions from base classes
-
- /**
- * From CEikAppUi, HandleCommandL.
- * Takes care of command handling.
- * @param aCommand Command to be handled.
- */
- void HandleCommandL( TInt aCommand );
-
- /**
- * From CAknAppUi, HandleResourceChangeL
- * Handles resource change events such as layout switches in global level.
- * @param aType event type.
- */
- void HandleResourceChangeL(TInt aType);
-
- /**
- * HandleStatusPaneSizeChange.
- * Called by the framework when the application status pane
- * size is changed.
- */
- void HandleStatusPaneSizeChange();
-
- /**
- * Static callback method for invoking Qt main.
- * Called asynchronously from ConstructL() - passes call to non static method.
- */
- static TInt OpenCMainStaticCallBack( TAny* aObject );
-
- /**
- * Callback method for invoking Qt main.
- * Called from static OpenCMainStaticCallBack.
- */
- void OpenCMainCallBack();
-
- protected:
- void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination);
-
-
- private: // Data
-
- /**
- * Async callback object to call Qt main
- * Owned by CQtS60MainAppUi
- */
- CAsyncCallBack* iAsyncCallBack;
-
- };
-
-#endif // __QtS60MainAPPUI_H__
-
-// End of File
diff --git a/src/s60main/qts60maindocument_p.h b/src/s60main/qts60maindocument_p.h
deleted file mode 100644
index 35d6d85..0000000
--- a/src/s60main/qts60maindocument_p.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Symbian application wrapper of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef __QTS60MAINDOCUMENT_H__
-#define __QTS60MAINDOCUMENT_H__
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-// INCLUDES
-#include <akndoc.h>
-
-// FORWARD DECLARATIONS
-class CQtS60MainAppUi;
-class CEikApplication;
-
-
-// CLASS DECLARATION
-
-/**
-* CQtS60MainDocument application class.
-* An instance of class CQtS60MainDocument is the Document part of the
-* AVKON application framework for the QtS60Main application.
-*/
-class CQtS60MainDocument : public CAknDocument
- {
- public: // Constructors and destructor
-
- /**
- * NewL.
- * Two-phased constructor.
- * Construct a CQtS60MainDocument for the AVKON application aApp
- * using two phase construction, and return a pointer
- * to the created object.
- * @param aApp Application creating this document.
- * @return A pointer to the created instance of CQtS60MainDocument.
- */
- static CQtS60MainDocument* NewL( CEikApplication& aApp );
-
- /**
- * NewLC.
- * Two-phased constructor.
- * Construct a CQtS60MainDocument for the AVKON application aApp
- * using two phase construction, and return a pointer
- * to the created object.
- * @param aApp Application creating this document.
- * @return A pointer to the created instance of CQtS60MainDocument.
- */
- static CQtS60MainDocument* NewLC( CEikApplication& aApp );
-
- /**
- * ~CQtS60MainDocument
- * Virtual Destructor.
- */
- virtual ~CQtS60MainDocument();
-
- public: // Functions from base classes
-
- /**
- * CreateAppUiL
- * From CEikDocument, CreateAppUiL.
- * Create a CQtS60MainAppUi object and return a pointer to it.
- * The object returned is owned by the Uikon framework.
- * @return Pointer to created instance of AppUi.
- */
- CEikAppUi* CreateAppUiL();
-
- private: // Constructors
-
- /**
- * ConstructL
- * 2nd phase constructor.
- */
- void ConstructL();
-
- /**
- * CQtS60MainDocument.
- * C++ default constructor.
- * @param aApp Application creating this document.
- */
- CQtS60MainDocument( CEikApplication& aApp );
-
- };
-
-#endif // __QTS60MAINDOCUMENT_H__
-
-// End of File
diff --git a/src/s60main/s60main.pro b/src/s60main/s60main.pro
index a4833af..cc3c547 100644
--- a/src/s60main/s60main.pro
+++ b/src/s60main/s60main.pro
@@ -14,13 +14,7 @@ symbian {
CONFIG -= jpeg
INCLUDEPATH += tmp $$QMAKE_INCDIR_QT/QtCore $$MW_LAYER_SYSTEMINCLUDE
SOURCES = qts60main.cpp \
- qts60mainapplication.cpp \
- qts60mainappui.cpp \
- qts60maindocument.cpp
-
- HEADERS = qts60mainapplication_p.h \
- qts60mainappui_p.h \
- qts60maindocument_p.h
+ qts60main_mcrt0.cpp
# This block serves the minimalistic resource file for S60 3.1 platforms.
# Note there is no way to ifdef S60 version in mmp file, that is why the resource
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index d467250..d85ecd2 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -791,7 +791,8 @@ static QScriptValue __setupPackage__(QScriptContext *ctx, QScriptEngine *eng)
} // namespace QScript
QScriptEnginePrivate::QScriptEnginePrivate()
- : registeredScriptValues(0), freeScriptValues(0), inEval(false)
+ : registeredScriptValues(0), freeScriptValues(0),
+ registeredScriptStrings(0), inEval(false)
{
qMetaTypeId<QScriptValue>();
@@ -839,6 +840,7 @@ QScriptEnginePrivate::~QScriptEnginePrivate()
while (!ownedAgents.isEmpty())
delete ownedAgents.takeFirst();
detachAllRegisteredScriptValues();
+ detachAllRegisteredScriptStrings();
qDeleteAll(m_qobjectData);
qDeleteAll(m_typeInfos);
JSC::JSLock lock(false);
@@ -1352,6 +1354,19 @@ void QScriptEnginePrivate::detachAllRegisteredScriptValues()
registeredScriptValues = 0;
}
+void QScriptEnginePrivate::detachAllRegisteredScriptStrings()
+{
+ QScriptStringPrivate *it;
+ QScriptStringPrivate *next;
+ for (it = registeredScriptStrings; it != 0; it = next) {
+ it->detachFromEngine();
+ next = it->next;
+ it->prev = 0;
+ it->next = 0;
+ }
+ registeredScriptStrings = 0;
+}
+
#ifdef QT_NO_QOBJECT
QScriptEngine::QScriptEngine()
@@ -3236,11 +3251,10 @@ QStringList QScriptEngine::importedExtensions() const
The \c Container type must provide a \c const_iterator class to enable the
contents of the container to be copied into the array.
- Additionally, the type of each element in the sequence should be suitable
- for conversion to a QScriptValue.
- See \l{QtScript Module#Conversion Between QtScript and C++ Types}
- {Conversion Between QtScript and C++ Types} for more information about the
- restrictions on types that can be used with QScriptValue.
+ Additionally, the type of each element in the sequence should be
+ suitable for conversion to a QScriptValue. See
+ \l{Conversion Between QtScript and C++ Types} for more information
+ about the restrictions on types that can be used with QScriptValue.
\sa qScriptValueFromValue()
*/
@@ -3257,11 +3271,11 @@ QStringList QScriptEngine::importedExtensions() const
as long as it provides a \c length property describing how many elements
it contains.
- Additionally, the type of each element in the sequence must be suitable
- for conversion to a C++ type from a QScriptValue.
- See \l{QtScript Module#Conversion Between QtScript and C++ Types}
- {Conversion Between QtScript and C++ Types} for more information about the
- restrictions on types that can be used with QScriptValue.
+ Additionally, the type of each element in the sequence must be
+ suitable for conversion to a C++ type from a QScriptValue. See
+ \l{Conversion Between QtScript and C++ Types} for more information
+ about the restrictions on types that can be used with
+ QScriptValue.
\sa qscriptvalue_cast()
*/
@@ -3622,9 +3636,11 @@ QScriptEngineAgent *QScriptEngine::agent() const
QScriptString QScriptEngine::toStringHandle(const QString &str)
{
Q_D(QScriptEngine);
- QScriptString ss;
- QScriptStringPrivate::init(ss, this, JSC::Identifier(d->currentFrame, str));
- return ss;
+ QScriptString result;
+ QScriptStringPrivate *p = new QScriptStringPrivate(d, JSC::Identifier(d->currentFrame, str), QScriptStringPrivate::HeapAllocated);
+ QScriptStringPrivate::init(result, p);
+ d->registerScriptString(p);
+ return result;
}
/*!
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index f06f717..826c2da 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -58,6 +58,7 @@
#include <QtCore/qhash.h>
#include <QtCore/qset.h>
#include "qscriptvalue_p.h"
+#include "qscriptstring_p.h"
#include "RefPtr.h"
#include "Structure.h"
@@ -217,6 +218,10 @@ public:
inline void unregisterScriptValue(QScriptValuePrivate *value);
void detachAllRegisteredScriptValues();
+ inline void registerScriptString(QScriptStringPrivate *value);
+ inline void unregisterScriptString(QScriptStringPrivate *value);
+ void detachAllRegisteredScriptStrings();
+
// private slots
void _q_objectDestroyed(QObject *);
#endif
@@ -241,6 +246,7 @@ public:
int agentLineNumber;
QScriptValuePrivate *registeredScriptValues;
QScriptValuePrivate *freeScriptValues;
+ QScriptStringPrivate *registeredScriptStrings;
QHash<int, QScriptTypeInfo*> m_typeInfos;
int processEventsInterval;
QScriptValue abortResult;
@@ -362,6 +368,29 @@ inline QScriptValue QScriptValuePrivate::property(const QString &name, int resol
return property(JSC::Identifier(exec, name), resolveMode);
}
+inline void QScriptEnginePrivate::registerScriptString(QScriptStringPrivate *value)
+{
+ Q_ASSERT(value->type == QScriptStringPrivate::HeapAllocated);
+ value->prev = 0;
+ value->next = registeredScriptStrings;
+ if (registeredScriptStrings)
+ registeredScriptStrings->prev = value;
+ registeredScriptStrings = value;
+}
+
+inline void QScriptEnginePrivate::unregisterScriptString(QScriptStringPrivate *value)
+{
+ Q_ASSERT(value->type == QScriptStringPrivate::HeapAllocated);
+ if (value->prev)
+ value->prev->next = value->next;
+ if (value->next)
+ value->next->prev = value->prev;
+ if (value == registeredScriptStrings)
+ registeredScriptStrings = value->next;
+ value->prev = 0;
+ value->next = 0;
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/script/api/qscriptstring.cpp b/src/script/api/qscriptstring.cpp
index 58a7c2b..94b69b9 100644
--- a/src/script/api/qscriptstring.cpp
+++ b/src/script/api/qscriptstring.cpp
@@ -39,10 +39,11 @@
**
****************************************************************************/
-#include "config.h"
+#include "config.h" // compile on Windows
#include "qscriptstring.h"
-
#include "qscriptstring_p.h"
+#include "qscriptengine.h"
+#include "qscriptengine_p.h"
QT_BEGIN_NAMESPACE
@@ -70,32 +71,6 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \internal
-*/
-QScriptStringPrivate::QScriptStringPrivate(QScriptEngine *e, const JSC::Identifier &id)
- : engine(e), identifier(id)
-{
- ref = 0;
-}
-
-/*!
- \internal
-*/
-QScriptStringPrivate::~QScriptStringPrivate()
-{
-}
-
-/*!
- \internal
-*/
-void QScriptStringPrivate::init(QScriptString &q, QScriptEngine *engine,
- const JSC::Identifier &value)
-{
- Q_ASSERT(!q.isValid());
- q.d_ptr = new QScriptStringPrivate(engine, value);
-}
-
-/*!
Constructs an invalid QScriptString.
*/
QScriptString::QScriptString()
@@ -109,6 +84,13 @@ QScriptString::QScriptString()
QScriptString::QScriptString(const QScriptString &other)
: d_ptr(other.d_ptr)
{
+ if (d_func() && (d_func()->type == QScriptStringPrivate::StackAllocated)) {
+ Q_ASSERT(d_func()->ref != 1);
+ d_ptr.detach();
+ d_func()->ref = 1;
+ d_func()->type = QScriptStringPrivate::HeapAllocated;
+ d_func()->engine->registerScriptString(d_func());
+ }
}
/*!
@@ -116,6 +98,19 @@ QScriptString::QScriptString(const QScriptString &other)
*/
QScriptString::~QScriptString()
{
+ Q_D(QScriptString);
+ if (d) {
+ switch (d->type) {
+ case QScriptStringPrivate::StackAllocated:
+ Q_ASSERT(d->ref == 1);
+ d->ref.ref(); // avoid deletion
+ break;
+ case QScriptStringPrivate::HeapAllocated:
+ if (d->engine && (d->ref == 1))
+ d->engine->unregisterScriptString(d);
+ break;
+ }
+ }
}
/*!
@@ -123,7 +118,18 @@ QScriptString::~QScriptString()
*/
QScriptString &QScriptString::operator=(const QScriptString &other)
{
+ if (d_func() && d_func()->engine && (d_func()->ref == 1) && (d_func()->type == QScriptStringPrivate::HeapAllocated)) {
+ // current d_ptr will be deleted at the assignment below, so unregister it first
+ d_func()->engine->unregisterScriptString(d_func());
+ }
d_ptr = other.d_ptr;
+ if (d_func() && (d_func()->type == QScriptStringPrivate::StackAllocated)) {
+ Q_ASSERT(d_func()->ref != 1);
+ d_ptr.detach();
+ d_func()->ref = 1;
+ d_func()->type = QScriptStringPrivate::HeapAllocated;
+ d_func()->engine->registerScriptString(d_func());
+ }
return *this;
}
@@ -147,7 +153,7 @@ bool QScriptString::operator==(const QScriptString &other) const
if (d == other.d_func())
return true;
if (!d || !other.d_func())
- return false;
+ return d == other.d_func();
if (d->engine != other.d_func()->engine)
return false;
if (!d->engine)
diff --git a/src/script/api/qscriptstring.h b/src/script/api/qscriptstring.h
index 30e6856..2808916 100644
--- a/src/script/api/qscriptstring.h
+++ b/src/script/api/qscriptstring.h
@@ -52,10 +52,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Script)
-class QScriptEngine;
class QScriptStringPrivate;
-struct QScriptStringPrivatePointerDeleter;
-
class Q_SCRIPT_EXPORT QScriptString
{
public:
diff --git a/src/script/api/qscriptstring_p.h b/src/script/api/qscriptstring_p.h
index 8f76648..05fed77 100644
--- a/src/script/api/qscriptstring_p.h
+++ b/src/script/api/qscriptstring_p.h
@@ -55,34 +55,58 @@
#include <QtCore/qobjectdefs.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qpointer.h>
-#include "qscriptengine.h"
-
#include "Identifier.h"
-
QT_BEGIN_NAMESPACE
-class QScriptString;
-class QScriptEngine;
+class QScriptEnginePrivate;
class QScriptStringPrivate
{
public:
- QScriptStringPrivate(QScriptEngine *engine, const JSC::Identifier &id);
- ~QScriptStringPrivate();
+ enum AllocationType {
+ StackAllocated,
+ HeapAllocated
+ };
- static void init(QScriptString &q, QScriptEngine *engine, const JSC::Identifier &id);
+ inline QScriptStringPrivate(QScriptEnginePrivate *engine, const JSC::Identifier &id,
+ AllocationType type);
+ inline ~QScriptStringPrivate();
+ static inline void init(QScriptString &q, QScriptStringPrivate *d);
+
+ inline void detachFromEngine();
QBasicAtomicInt ref;
-#ifndef QT_NO_QOBJECT
- QPointer<QScriptEngine> engine;
-#else
- void *engine;
-#endif
+ QScriptEnginePrivate *engine;
JSC::Identifier identifier;
+ AllocationType type;
+
+ // linked list of engine's script values
+ QScriptStringPrivate *prev;
+ QScriptStringPrivate *next;
};
+inline QScriptStringPrivate::QScriptStringPrivate(QScriptEnginePrivate *e, const JSC::Identifier &id,
+ AllocationType tp)
+ : engine(e), identifier(id), type(tp), prev(0), next(0)
+{
+ ref = 0;
+}
+
+inline QScriptStringPrivate::~QScriptStringPrivate()
+{
+}
+
+inline void QScriptStringPrivate::init(QScriptString &q, QScriptStringPrivate *d)
+{
+ q.d_ptr = d;
+}
+
+inline void QScriptStringPrivate::detachFromEngine()
+{
+ engine = 0;
+ identifier = JSC::Identifier();
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp
index c8633ab..5dea491 100644
--- a/src/script/bridge/qscriptclassobject.cpp
+++ b/src/script/bridge/qscriptclassobject.cpp
@@ -97,8 +97,9 @@ bool ClassObjectDelegate::getOwnPropertySlot(QScriptObject* object,
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
- QString name(propertyName.ustring());
- QScriptString scriptName = QScriptEnginePrivate::get(engine)->toStringHandle(name);
+ QScriptString scriptName;
+ QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
+ QScriptStringPrivate::init(scriptName, &scriptName_d);
uint id = 0;
QScriptClass::QueryFlags flags = m_scriptClass->queryProperty(
scriptObject, scriptName, QScriptClass::HandlesReadAccess, &id);
@@ -116,8 +117,9 @@ void ClassObjectDelegate::put(QScriptObject* object, JSC::ExecState *exec,
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
- QString name(propertyName.ustring());
- QScriptString scriptName = QScriptEnginePrivate::get(engine)->toStringHandle(name);
+ QScriptString scriptName;
+ QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
+ QScriptStringPrivate::init(scriptName, &scriptName_d);
uint id = 0;
QScriptClass::QueryFlags flags = m_scriptClass->queryProperty(
scriptObject, scriptName, QScriptClass::HandlesWriteAccess, &id);
@@ -135,8 +137,9 @@ bool ClassObjectDelegate::deleteProperty(QScriptObject* object, JSC::ExecState *
// ### avoid duplication of put()
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
- QString name(propertyName.ustring());
- QScriptString scriptName = QScriptEnginePrivate::get(engine)->toStringHandle(name);
+ QScriptString scriptName;
+ QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
+ QScriptStringPrivate::init(scriptName, &scriptName_d);
uint id = 0;
QScriptClass::QueryFlags flags = m_scriptClass->queryProperty(
scriptObject, scriptName, QScriptClass::HandlesWriteAccess, &id);
@@ -155,8 +158,9 @@ bool ClassObjectDelegate::getPropertyAttributes(const QScriptObject* object, JSC
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
- QString name(propertyName.ustring());
- QScriptString scriptName = QScriptEnginePrivate::get(engine)->toStringHandle(name);
+ QScriptString scriptName;
+ QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
+ QScriptStringPrivate::init(scriptName, &scriptName_d);
uint id = 0;
QScriptClass::QueryFlags flags = m_scriptClass->queryProperty(
scriptObject, scriptName, QScriptClass::HandlesReadAccess, &id);
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index 0592a89..bd5d161 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -1869,6 +1869,7 @@ JSC::JSValue QMetaObjectWrapperObject::execute(JSC::ExecState *exec,
QScriptContext *ctx = eng_p->contextForFrame(exec);
JSC::CallData callData;
JSC::CallType callType = data->ctor.getCallData(callData);
+ Q_UNUSED(callType);
Q_ASSERT_X(callType == JSC::CallTypeHost, Q_FUNC_INFO, "script constructors not supported");
if (data->ctor.isObject(&FunctionWithArgWrapper::info)) {
FunctionWithArgWrapper *wrapper = static_cast<FunctionWithArgWrapper*>(JSC::asObject(data->ctor));
diff --git a/src/script/parser/qscript.g b/src/script/parser/qscript.g
index bcf27da..c5902f6 100644
--- a/src/script/parser/qscript.g
+++ b/src/script/parser/qscript.g
@@ -37,9 +37,6 @@
--
-- $QT_END_LICENSE$
--
--- This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
--- WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
---
----------------------------------------------------------------------------
%parser QScriptGrammar
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index fa79460..097ecbf 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -1310,23 +1310,42 @@ QSqlResult *QMYSQLDriver::createResult() const
QStringList QMYSQLDriver::tables(QSql::TableType type) const
{
QStringList tl;
- if (!isOpen())
- return tl;
- if (!(type & QSql::Tables))
- return tl;
-
- MYSQL_RES* tableRes = mysql_list_tables(d->mysql, NULL);
- MYSQL_ROW row;
- int i = 0;
- while (tableRes) {
- mysql_data_seek(tableRes, i);
- row = mysql_fetch_row(tableRes);
- if (!row)
- break;
- tl.append(toUnicode(d->tc, row[0]));
- i++;
+#if MYSQL_VERSION_ID >= 40100
+ if( mysql_get_server_version(d->mysql) < 50000)
+ {
+#endif
+ if (!isOpen())
+ return tl;
+ if (!(type & QSql::Tables))
+ return tl;
+
+ MYSQL_RES* tableRes = mysql_list_tables(d->mysql, NULL);
+ MYSQL_ROW row;
+ int i = 0;
+ while (tableRes) {
+ mysql_data_seek(tableRes, i);
+ row = mysql_fetch_row(tableRes);
+ if (!row)
+ break;
+ tl.append(toUnicode(d->tc, row[0]));
+ i++;
+ }
+ mysql_free_result(tableRes);
+#if MYSQL_VERSION_ID >= 40100
+ } else {
+ QSqlQuery q(createResult());
+ if(type & QSql::Tables) {
+ q.exec(QLatin1String("select table_name from information_schema.tables where table_type = 'BASE TABLE'"));
+ while(q.next())
+ tl.append(q.value(0).toString());
+ }
+ if(type & QSql::Views) {
+ q.exec(QLatin1String("select table_name from information_schema.tables where table_type = 'VIEW'"));
+ while(q.next())
+ tl.append(q.value(0).toString());
+ }
}
- mysql_free_result(tableRes);
+#endif
return tl;
}
diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp
index 7dd2ea9..6437841 100644
--- a/src/sql/drivers/oci/qsql_oci.cpp
+++ b/src/sql/drivers/oci/qsql_oci.cpp
@@ -2220,6 +2220,22 @@ QStringList QOCIDriver::tables(QSql::TableType type) const
else
tl.append(t.value(1).toString());
}
+
+ // list all table synonyms as well
+ t.exec(QLatin1String("select owner, synonym_name from all_synonyms "
+ "where owner != 'MDSYS' "
+ "and owner != 'LBACSYS' "
+ "and owner != 'SYS' "
+ "and owner != 'SYSTEM' "
+ "and owner != 'WKSYS'"
+ "and owner != 'CTXSYS'"
+ "and owner != 'WMSYS'"));
+ while (t.next()) {
+ if (t.value(0).toString() != d->user)
+ tl.append(t.value(0).toString() + QLatin1String(".") + t.value(1).toString());
+ else
+ tl.append(t.value(1).toString());
+ }
}
if (type & QSql::Views) {
t.exec(QLatin1String("select owner, view_name from all_views "
@@ -2269,8 +2285,8 @@ QSqlRecord QOCIDriver::record(const QString& tablename) const
// eg. a sub-query on the sys.synonyms table
QString stmt(QLatin1String("select column_name, data_type, data_length, "
"data_precision, data_scale, nullable, data_default%1"
- "from all_tab_columns "
- "where table_name=%2"));
+ "from all_tab_columns a "
+ "where a.table_name=%2"));
if (d->serverVersion >= 9)
stmt = stmt.arg(QLatin1String(", char_length "));
else
@@ -2294,12 +2310,15 @@ QSqlRecord QOCIDriver::record(const QString& tablename) const
else
owner = owner.toUpper();
- tmpStmt += QLatin1String(" and owner='") + owner + QLatin1Char('\'');
+ tmpStmt += QLatin1String(" and a.owner='") + owner + QLatin1Char('\'');
t.setForwardOnly(true);
t.exec(tmpStmt);
if (!t.next()) { // try and see if the tablename is a synonym
- stmt= stmt.arg(QLatin1String("(select tname from sys.synonyms where sname='")
- + table + QLatin1String("' and creator=owner)"));
+ stmt = stmt + QLatin1String(" join all_synonyms b "
+ "on a.owner=b.table_owner and a.table_name=b.table_name "
+ "where b.owner='") + owner +
+ QLatin1String("' and b.synonym_name='") + table +
+ QLatin1Char('\'');
t.setForwardOnly(true);
t.exec(stmt);
if (t.next())
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 742d596..2692c96 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -323,12 +323,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
colSize *= 2; // a tiny bit faster, since it saves a SQLGetData() call
}
}
- char* buf = new char[colSize];
+ QVarLengthArray<char> buf(colSize);
while (true) {
r = SQLGetData(hStmt,
column+1,
unicode ? SQL_C_WCHAR : SQL_C_CHAR,
- (SQLPOINTER)buf,
+ (SQLPOINTER)buf.data(),
colSize,
&lengthIndicator);
if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
@@ -343,11 +343,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
// colSize-1: remove 0 termination when there is more data to fetch
int rSize = (r == SQL_SUCCESS_WITH_INFO) ? (unicode ? colSize-2 : colSize-1) : lengthIndicator;
if (unicode) {
- fieldVal += QString((QChar*) buf, rSize / 2);
+ fieldVal += QString((const QChar*) buf.constData(), rSize / 2);
} else {
- fieldVal += QString::fromAscii(buf, rSize);
+ fieldVal += QString::fromAscii(buf.constData(), rSize);
}
- if (lengthIndicator - fieldVal.size() <= 0) {
+ memset(buf.data(), 0, colSize);
+ if (lengthIndicator < colSize) {
// workaround for Drivermanagers that don't return SQL_NO_DATA
break;
}
@@ -359,7 +360,6 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
break;
}
}
- delete[] buf;
return fieldVal;
}
diff --git a/src/svg/qgraphicssvgitem.h b/src/svg/qgraphicssvgitem.h
index e8065da..d51095c 100644
--- a/src/svg/qgraphicssvgitem.h
+++ b/src/svg/qgraphicssvgitem.h
@@ -58,6 +58,7 @@ class QGraphicsSvgItemPrivate;
class Q_SVG_EXPORT QGraphicsSvgItem : public QObject, public QGraphicsItem
{
Q_OBJECT
+ Q_INTERFACES(QGraphicsItem)
public:
QGraphicsSvgItem(QGraphicsItem *parentItem=0);
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 371b845..e2c3d92 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -76,6 +76,77 @@ static const char *qt_inherit_text = "inherit";
double qstrtod(const char *s00, char const **se, bool *ok);
+// ======== duplicated from qcolor_p
+
+static inline int qsvg_h2i(char hex)
+{
+ if (hex >= '0' && hex <= '9')
+ return hex - '0';
+ if (hex >= 'a' && hex <= 'f')
+ return hex - 'a' + 10;
+ if (hex >= 'A' && hex <= 'F')
+ return hex - 'A' + 10;
+ return -1;
+}
+
+static inline int qsvg_hex2int(const char *s)
+{
+ return (qsvg_h2i(s[0]) << 4) | qsvg_h2i(s[1]);
+}
+
+static inline int qsvg_hex2int(char s)
+{
+ int h = qsvg_h2i(s);
+ return (h << 4) | h;
+}
+
+bool qsvg_get_hex_rgb(const char *name, QRgb *rgb)
+{
+ if(name[0] != '#')
+ return false;
+ name++;
+ int len = qstrlen(name);
+ int r, g, b;
+ if (len == 12) {
+ r = qsvg_hex2int(name);
+ g = qsvg_hex2int(name + 4);
+ b = qsvg_hex2int(name + 8);
+ } else if (len == 9) {
+ r = qsvg_hex2int(name);
+ g = qsvg_hex2int(name + 3);
+ b = qsvg_hex2int(name + 6);
+ } else if (len == 6) {
+ r = qsvg_hex2int(name);
+ g = qsvg_hex2int(name + 2);
+ b = qsvg_hex2int(name + 4);
+ } else if (len == 3) {
+ r = qsvg_hex2int(name[0]);
+ g = qsvg_hex2int(name[1]);
+ b = qsvg_hex2int(name[2]);
+ } else {
+ r = g = b = -1;
+ }
+ if ((uint)r > 255 || (uint)g > 255 || (uint)b > 255) {
+ *rgb = 0;
+ return false;
+ }
+ *rgb = qRgb(r, g ,b);
+ return true;
+}
+
+bool qsvg_get_hex_rgb(const QChar *str, int len, QRgb *rgb)
+{
+ if (len > 13)
+ return false;
+ char tmp[16];
+ for(int i = 0; i < len; ++i)
+ tmp[i] = str[i].toLatin1();
+ tmp[len] = 0;
+ return qsvg_get_hex_rgb(tmp, rgb);
+}
+
+// ======== end of qcolor_p duplicate
+
static bool parsePathDataFast(const QStringRef &data, QPainterPath &path);
static inline QString someId(const QXmlStreamAttributes &attributes)
@@ -126,7 +197,6 @@ struct QSvgAttributes
QSvgAttributes::QSvgAttributes(const QXmlStreamAttributes &xmlAttributes, QSvgHandler *handler)
{
- id = someId(xmlAttributes);
QStringRef style = xmlAttributes.value(QLatin1String("style"));
if (!style.isEmpty()) {
handler->parseCSStoXMLAttrs(style.toString(), &m_cssAttributes);
@@ -267,6 +337,11 @@ QSvgAttributes::QSvgAttributes(const QXmlStreamAttributes &xmlAttributes, QSvgHa
fontVariant = value;
break;
+ case 'i':
+ if (name == QLatin1String("id"))
+ id = value.toString();
+ break;
+
case 'o':
if (name == QLatin1String("opacity"))
opacity = value;
@@ -314,6 +389,11 @@ QSvgAttributes::QSvgAttributes(const QXmlStreamAttributes &xmlAttributes, QSvgHa
visibility = value;
break;
+ case 'x':
+ if (name == QLatin1String("xml:id") && id.isEmpty())
+ id = value.toString();
+ break;
+
default:
break;
}
@@ -321,9 +401,6 @@ QSvgAttributes::QSvgAttributes(const QXmlStreamAttributes &xmlAttributes, QSvgHa
}
-static inline QString someId(const QSvgAttributes &attributes)
-{ return attributes.id; }
-
static const char * QSvgStyleSelector_nodeString[] = {
"svg",
"g",
@@ -685,42 +762,95 @@ static QString idFromUrl(const QString &url)
return id;
}
+static inline QStringRef trimRef(const QStringRef &str)
+{
+ if (str.isEmpty())
+ return QStringRef();
+ const QChar *s = str.string()->constData() + str.position();
+ int end = str.length() - 1;
+ if (!s[0].isSpace() && !s[end].isSpace())
+ return str;
+
+ int start = 0;
+ while (start<=end && s[start].isSpace()) // skip white space from start
+ start++;
+ if (start <= end) { // only white space
+ while (s[end].isSpace()) // skip white space from end
+ end--;
+ }
+ int l = end - start + 1;
+ if (l <= 0)
+ return QStringRef();
+ return QStringRef(str.string(), str.position() + start, l);
+}
+
/**
* returns true when successfuly set the color. false signifies
* that the color should be inherited
*/
-static bool resolveColor(const QString &colorStr, QColor &color, QSvgHandler *handler)
-{
- QString colorStrTr = colorStr.trimmed();
- if (colorStr.startsWith(QLatin1String("rgb("))) {
- const QChar *s = colorStr.constData() + 4;
- QVector<qreal> 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 = colorStr.constData() + 4;
- compo = parsePercentageList(s);
- compo[0] *= (qreal)2.55;
- compo[1] *= (qreal)2.55;
- compo[2] *= (qreal)2.55;
- }
-
- color = QColor(int(compo[0]),
- int(compo[1]),
- int(compo[2]));
- return true;
- } else if (colorStr == QT_INHERIT) {
+static bool resolveColor(const QStringRef &colorStr, QColor &color, QSvgHandler *handler)
+{
+ QStringRef colorStrTr = trimRef(colorStr);
+ if (colorStrTr.isEmpty())
return false;
- } else if (colorStr == QLatin1String("currentColor")) {
- color = handler->currentColor();
- return true;
+
+ switch(colorStrTr.at(0).unicode()) {
+
+ case '#':
+ {
+ // #rrggbb is very very common, so let's tackle it here
+ // rather than falling back to QColor
+ QRgb rgb;
+ bool ok = qsvg_get_hex_rgb(colorStrTr.unicode(), colorStrTr.length(), &rgb);
+ if (ok)
+ color.setRgb(rgb);
+ return ok;
+ }
+ break;
+
+ case 'r':
+ {
+ // starts with "rgb("
+ if (colorStrTr == QLatin1String("rgb(")) {
+ const QChar *s = colorStrTr.constData() + 4;
+ QVector<qreal> 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;
+ compo = parsePercentageList(s);
+ compo[0] *= (qreal)2.55;
+ compo[1] *= (qreal)2.55;
+ compo[2] *= (qreal)2.55;
+ }
+
+ color = QColor(int(compo[0]),
+ int(compo[1]),
+ int(compo[2]));
+ return true;
+ }
+ }
+ break;
+
+ case 'c':
+ if (colorStrTr == QLatin1String("currentColor")) {
+ color = handler->currentColor();
+ return true;
+ }
+ break;
+ case 'i':
+ if (colorStrTr == QT_INHERIT)
+ return false;
+ break;
+ default:
+ break;
}
- color = QColor(colorStrTr);
+ color = QColor(colorStrTr.toString());
return color.isValid();
}
-static bool constructColor(const QString &colorStr, const QString &opacity,
+static bool constructColor(const QStringRef &colorStr, const QStringRef &opacity,
QColor &color, QSvgHandler *handler)
{
if (!resolveColor(colorStr, color, handler))
@@ -833,10 +963,8 @@ static void parseColor(QSvgNode *,
const QSvgAttributes &attributes,
QSvgHandler *handler)
{
- QString colorStr = attributes.color.toString();
- QString opacity = attributes.colorOpacity.toString();
QColor color;
- if (constructColor(colorStr, opacity, color, handler)) {
+ if (constructColor(attributes.color, attributes.colorOpacity, color, handler)) {
handler->pushColor(color);
}
}
@@ -891,24 +1019,28 @@ static void parseBrush(QSvgNode *node,
}
} else if (attributes.fill != QLatin1String("none")) {
QColor color;
- if (resolveColor(attributes.fill.toString(), color, handler))
+ if (resolveColor(attributes.fill, color, handler))
prop->setBrush(QBrush(color));
} else {
prop->setBrush(QBrush(Qt::NoBrush));
}
}
- node->appendStyleProperty(prop, someId(attributes));
+ node->appendStyleProperty(prop, attributes.id);
}
}
-static QMatrix parseTransformationMatrix(const QString &value)
+static QMatrix parseTransformationMatrix(const QStringRef &value)
{
+ if (value.isEmpty())
+ return QMatrix();
+
QMatrix matrix;
const QChar *str = value.constData();
+ const QChar *end = str + value.length();
- while (*str != QLatin1Char(0)) {
+ while (str < end) {
if (str->isSpace() || *str == QLatin1Char(',')) {
++str;
continue;
@@ -973,7 +1105,7 @@ static QMatrix parseTransformationMatrix(const QString &value)
}
- while (str->isSpace())
+ while (str < end && str->isSpace())
++str;
if (*str != QLatin1Char('('))
goto error;
@@ -1060,7 +1192,7 @@ static void parsePen(QSvgNode *node,
}
} else if (attributes.stroke != QLatin1String("none")) {
QColor color;
- if (resolveColor(attributes.stroke.toString(), color, handler))
+ if (resolveColor(attributes.stroke, color, handler))
prop->setStroke(QBrush(color));
} else {
prop->setStroke(QBrush(Qt::NoBrush));
@@ -1129,7 +1261,7 @@ static void parsePen(QSvgNode *node,
if (!attributes.strokeOpacity.isEmpty() && attributes.strokeOpacity != QT_INHERIT)
prop->setOpacity(qMin(qreal(1.0), qMax(qreal(0.0), toDouble(attributes.strokeOpacity))));
- node->appendStyleProperty(prop, someId(attributes));
+ node->appendStyleProperty(prop, attributes.id);
}
}
@@ -1203,7 +1335,7 @@ static void parseFont(QSvgNode *node,
fontStyle->setTextAnchor(Qt::AlignRight);
}
- node->appendStyleProperty(fontStyle, someId(attributes));
+ node->appendStyleProperty(fontStyle, attributes.id);
}
static void parseTransform(QSvgNode *node,
@@ -1212,13 +1344,10 @@ static void parseTransform(QSvgNode *node,
{
if (attributes.transform.isEmpty())
return;
- QString value = attributes.transform.toString().trimmed();
- if (value.isEmpty())
- return;
- QMatrix matrix = parseTransformationMatrix(value);
+ QMatrix matrix = parseTransformationMatrix(trimRef(attributes.transform));
if (!matrix.isIdentity()) {
- node->appendStyleProperty(new QSvgTransformStyle(QTransform(matrix)), someId(attributes));
+ node->appendStyleProperty(new QSvgTransformStyle(QTransform(matrix)), attributes.id);
}
}
@@ -1391,24 +1520,29 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
QChar pathElem = *str;
++str;
QChar endc = *end;
- *const_cast<QChar *>(end) = 0; // parseNumbersList requires 0-termination that QStringRef cannot guarantee
- QVector<qreal> arg = parseNumbersList(str);
+ *const_cast<QChar *>(end) = 0; // parseNumbersArray requires 0-termination that QStringRef cannot guarantee
+ QVarLengthArray<qreal, 8> arg;
+ parseNumbersArray(str, arg);
*const_cast<QChar *>(end) = endc;
if (pathElem == QLatin1Char('z') || pathElem == QLatin1Char('Z'))
arg.append(0);//dummy
- while (!arg.isEmpty()) {
+ const qreal *num = arg.constData();
+ int count = arg.count();
+ while (count > 0) {
qreal offsetX = x; // correction offsets
qreal offsetY = y; // for relative commands
switch (pathElem.unicode()) {
case 'm': {
- if (arg.count() < 2) {
- arg.pop_front();
+ if (count < 2) {
+ num++;
+ count--;
break;
}
- x = x0 = arg[0] + offsetX;
- y = y0 = arg[1] + offsetY;
+ x = x0 = num[0] + offsetX;
+ y = y0 = num[1] + offsetY;
+ num += 2;
+ count -= 2;
path.moveTo(x0, y0);
- arg.pop_front(); arg.pop_front();
// As per 1.2 spec 8.3.2 The "moveto" commands
// If a 'moveto' is followed by multiple pairs of coordinates without explicit commands,
@@ -1417,15 +1551,16 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
}
break;
case 'M': {
- if (arg.count() < 2) {
- arg.pop_front();
+ if (count < 2) {
+ num++;
+ count--;
break;
}
- x = x0 = arg[0];
- y = y0 = arg[1];
-
+ x = x0 = num[0];
+ y = y0 = num[1];
+ num += 2;
+ count -= 2;
path.moveTo(x0, y0);
- arg.pop_front(); arg.pop_front();
// As per 1.2 spec 8.3.2 The "moveto" commands
// If a 'moveto' is followed by multiple pairs of coordinates without explicit commands,
@@ -1437,96 +1572,104 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
case 'Z': {
x = x0;
y = y0;
+ count--; // skip dummy
+ num++;
path.closeSubpath();
- arg.pop_front();//pop dummy
}
break;
case 'l': {
- if (arg.count() < 2) {
- arg.pop_front();
+ if (count < 2) {
+ num++;
+ count--;
break;
}
- x = arg.front() + offsetX;
- arg.pop_front();
- y = arg.front() + offsetY;
- arg.pop_front();
+ x = x0 = num[0] + offsetX;
+ y = y0 = num[1] + offsetY;
+ num += 2;
+ count -= 2;
path.lineTo(x, y);
}
break;
case 'L': {
- if (arg.count() < 2) {
- arg.pop_front();
+ if (count < 2) {
+ num++;
+ count--;
break;
}
- x = arg.front(); arg.pop_front();
- y = arg.front(); arg.pop_front();
+ x = x0 = num[0];
+ y = y0 = num[1];
+ num += 2;
+ count -= 2;
path.lineTo(x, y);
}
break;
case 'h': {
- x = arg.front() + offsetX; arg.pop_front();
+ x = num[0] + offsetX;
+ num++;
+ count--;
path.lineTo(x, y);
}
break;
case 'H': {
- x = arg[0];
+ x = num[0];
+ num++;
+ count--;
path.lineTo(x, y);
- arg.pop_front();
}
break;
case 'v': {
- y = arg[0] + offsetY;
+ y = num[0] + offsetY;
+ num++;
+ count--;
path.lineTo(x, y);
- arg.pop_front();
}
break;
case 'V': {
- y = arg[0];
+ y = num[0];
+ num++;
+ count--;
path.lineTo(x, y);
- arg.pop_front();
}
break;
case 'c': {
- if (arg.count() < 6) {
- while (arg.count())
- arg.pop_front();
+ if (count < 6) {
+ num += count;
+ count = 0;
break;
}
- QPointF c1(arg[0]+offsetX, arg[1]+offsetY);
- QPointF c2(arg[2]+offsetX, arg[3]+offsetY);
- QPointF e(arg[4]+offsetX, arg[5]+offsetY);
+ QPointF c1(num[0] + offsetX, num[1] + offsetY);
+ QPointF c2(num[2] + offsetX, num[3] + offsetY);
+ QPointF e(num[4] + offsetX, num[5] + offsetY);
+ num += 6;
+ count -= 6;
path.cubicTo(c1, c2, e);
ctrlPt = c2;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
break;
}
case 'C': {
- if (arg.count() < 6) {
- while (arg.count())
- arg.pop_front();
+ if (count < 6) {
+ num += count;
+ count = 0;
break;
}
- QPointF c1(arg[0], arg[1]);
- QPointF c2(arg[2], arg[3]);
- QPointF e(arg[4], arg[5]);
+ QPointF c1(num[0], num[1]);
+ QPointF c2(num[2], num[3]);
+ QPointF e(num[4], num[5]);
+ num += 6;
+ count -= 6;
path.cubicTo(c1, c2, e);
ctrlPt = c2;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
break;
}
case 's': {
- if (arg.count() < 4) {
- while (arg.count())
- arg.pop_front();
+ if (count < 4) {
+ num += count;
+ count = 0;
break;
}
QPointF c1;
@@ -1535,20 +1678,20 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
c1 = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
else
c1 = QPointF(x, y);
- QPointF c2(arg[0]+offsetX, arg[1]+offsetY);
- QPointF e(arg[2]+offsetX, arg[3]+offsetY);
+ QPointF c2(num[0] + offsetX, num[1] + offsetY);
+ QPointF e(num[2] + offsetX, num[3] + offsetY);
+ num += 4;
+ count -= 4;
path.cubicTo(c1, c2, e);
ctrlPt = c2;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
break;
}
case 'S': {
- if (arg.count() < 4) {
- while (arg.count())
- arg.pop_front();
+ if (count < 4) {
+ num += count;
+ count = 0;
break;
}
QPointF c1;
@@ -1557,55 +1700,57 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
c1 = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
else
c1 = QPointF(x, y);
- QPointF c2(arg[0], arg[1]);
- QPointF e(arg[2], arg[3]);
+ QPointF c2(num[0], num[1]);
+ QPointF e(num[2], num[3]);
+ num += 4;
+ count -= 4;
path.cubicTo(c1, c2, e);
ctrlPt = c2;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
break;
}
case 'q': {
- if (arg.count() < 4) {
- while (arg.count())
- arg.pop_front();
+ if (count < 4) {
+ num += count;
+ count = 0;
break;
}
- QPointF c(arg[0]+offsetX, arg[1]+offsetY);
- QPointF e(arg[2]+offsetX, arg[3]+offsetY);
+ QPointF c(num[0] + offsetX, num[1] + offsetY);
+ QPointF e(num[2] + offsetX, num[3] + offsetY);
+ num += 4;
+ count -= 4;
path.quadTo(c, e);
ctrlPt = c;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
break;
}
case 'Q': {
- if (arg.count() < 4) {
- while (arg.count())
- arg.pop_front();
+ if (count < 4) {
+ num += count;
+ count = 0;
break;
}
- QPointF c(arg[0], arg[1]);
- QPointF e(arg[2], arg[3]);
+ QPointF c(num[0], num[1]);
+ QPointF e(num[2], num[3]);
+ num += 4;
+ count -= 4;
path.quadTo(c, e);
ctrlPt = c;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
break;
}
case 't': {
- if (arg.count() < 2) {
- while (arg.count())
- arg.pop_front();
+ if (count < 2) {
+ num += count;
+ count = 0;
break;
}
- QPointF e(arg[0]+offsetX, arg[1]+offsetY);
+ QPointF e(num[0] + offsetX, num[1] + offsetY);
+ num += 2;
+ count -= 2;
QPointF c;
if (lastMode == 'q' || lastMode == 'Q' ||
lastMode == 't' || lastMode == 'T')
@@ -1616,16 +1761,17 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
ctrlPt = c;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
break;
}
case 'T': {
- if (arg.count() < 2) {
- while (arg.count())
- arg.pop_front();
+ if (count < 2) {
+ num += count;
+ count = 0;
break;
}
- QPointF e(arg[0], arg[1]);
+ QPointF e(num[0], num[1]);
+ num += 2;
+ count -= 2;
QPointF c;
if (lastMode == 'q' || lastMode == 'Q' ||
lastMode == 't' || lastMode == 'T')
@@ -1636,22 +1782,22 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
ctrlPt = c;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
break;
}
case 'a': {
- if (arg.count() < 7) {
- while (arg.count())
- arg.pop_front();
+ if (count < 7) {
+ num += count;
+ count = 0;
break;
}
- qreal rx = arg[0];
- qreal ry = arg[1];
- qreal xAxisRotation = arg[2];
- qreal largeArcFlag = arg[3];
- qreal sweepFlag = arg[4];
- qreal ex = arg[5] + offsetX;
- qreal ey = arg[6] + offsetY;
+ qreal rx = (*num++);
+ qreal ry = (*num++);
+ qreal xAxisRotation = (*num++);
+ qreal largeArcFlag = (*num++);
+ qreal sweepFlag = (*num++);
+ qreal ex = (*num++) + offsetX;
+ qreal ey = (*num++) + offsetY;
+ count -= 7;
qreal curx = x;
qreal cury = y;
pathArc(path, rx, ry, xAxisRotation, int(largeArcFlag),
@@ -1659,36 +1805,29 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
x = ex;
y = ey;
-
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
- arg.pop_front();
}
break;
case 'A': {
- if (arg.count() < 7) {
- while (arg.count())
- arg.pop_front();
+ if (count < 7) {
+ num += count;
+ count = 0;
break;
}
- qreal rx = arg[0];
- qreal ry = arg[1];
- qreal xAxisRotation = arg[2];
- qreal largeArcFlag = arg[3];
- qreal sweepFlag = arg[4];
- qreal ex = arg[5];
- qreal ey = arg[6];
+ qreal rx = (*num++);
+ qreal ry = (*num++);
+ qreal xAxisRotation = (*num++);
+ qreal largeArcFlag = (*num++);
+ qreal sweepFlag = (*num++);
+ qreal ex = (*num++);
+ qreal ey = (*num++);
+ count -= 7;
qreal curx = x;
qreal cury = y;
pathArc(path, rx, ry, xAxisRotation, int(largeArcFlag),
int(sweepFlag), ex, ey, curx, cury);
+
x = ex;
y = ey;
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
- arg.pop_front();
}
break;
default:
@@ -1911,7 +2050,7 @@ static void parseOpacity(QSvgNode *node,
if (ok) {
QSvgOpacityStyle *opacity = new QSvgOpacityStyle(qBound(qreal(0.0), op, qreal(1.0)));
- node->appendStyleProperty(opacity, someId(attributes));
+ node->appendStyleProperty(opacity, attributes.id);
}
}
@@ -1983,7 +2122,7 @@ static void parseCompOp(QSvgNode *node,
if (!value.isEmpty()) {
QSvgCompOpStyle *compop = new QSvgCompOpStyle(svgToQtCompositionMode(value));
- node->appendStyleProperty(compop, someId(attributes));
+ node->appendStyleProperty(compop, attributes.id);
}
}
@@ -2113,8 +2252,8 @@ static bool parseAnimateColorNode(QSvgNode *parent,
QSvgHandler *handler)
{
QString typeStr = attributes.value(QLatin1String("type")).toString();
- QString fromStr = attributes.value(QLatin1String("from")).toString();
- QString toStr = attributes.value(QLatin1String("to")).toString();
+ QStringRef fromStr = attributes.value(QLatin1String("from"));
+ QStringRef toStr = attributes.value(QLatin1String("to"));
QString valuesStr = attributes.value(QLatin1String("values")).toString();
QString beginStr = attributes.value(QLatin1String("begin")).toString();
QString durStr = attributes.value(QLatin1String("dur")).toString();
@@ -2125,8 +2264,8 @@ static bool parseAnimateColorNode(QSvgNode *parent,
QList<QColor> colors;
if (valuesStr.isEmpty()) {
QColor startColor, endColor;
- constructColor(fromStr, QString(), startColor, handler);
- constructColor(toStr, QString(), endColor, handler);
+ resolveColor(fromStr, startColor, handler);
+ resolveColor(toStr, endColor, handler);
colors.append(startColor);
colors.append(endColor);
} else {
@@ -2134,7 +2273,8 @@ static bool parseAnimateColorNode(QSvgNode *parent,
QStringList::const_iterator itr;
for (itr = str.constBegin(); itr != str.constEnd(); ++itr) {
QColor color;
- constructColor(*itr, QString(), color, handler);
+ QString str = *itr;
+ resolveColor(QStringRef(&str), color, handler);
colors.append(color);
}
}
@@ -2583,7 +2723,7 @@ static void parseBaseGradient(QSvgNode *node,
QSvgHandler *handler)
{
QString link = attributes.value(QLatin1String("xlink:href")).toString();
- QString trans = attributes.value(QLatin1String("gradientTransform")).toString();
+ QStringRef trans = attributes.value(QLatin1String("gradientTransform"));
QString spread = attributes.value(QLatin1String("spreadMethod")).toString();
QString units = attributes.value(QLatin1String("gradientUnits")).toString();
@@ -2869,11 +3009,11 @@ static QSvgStyleProperty *createSolidColorNode(QSvgNode *parent,
QSvgHandler *handler)
{
Q_UNUSED(parent); Q_UNUSED(attributes);
- QString solidColorStr = attributes.value(QLatin1String("solid-color")).toString();
- QString solidOpacityStr = attributes.value(QLatin1String("solid-opacity")).toString();
+ QStringRef solidColorStr = attributes.value(QLatin1String("solid-color"));
+ QStringRef solidOpacityStr = attributes.value(QLatin1String("solid-opacity"));
if (solidOpacityStr.isEmpty())
- solidOpacityStr = attributes.value(QLatin1String("opacity")).toString();
+ solidOpacityStr = attributes.value(QLatin1String("opacity"));
QColor color;
if (!constructColor(solidColorStr, solidOpacityStr, color, handler))
@@ -2924,19 +3064,19 @@ static bool parseStopNode(QSvgStyleProperty *parent,
QSvgGradientStyle *style =
static_cast<QSvgGradientStyle*>(parent);
QString offsetStr = attrs.offset.toString();
- QString colorStr = attrs.stopColor.toString();
- QString opacityStr = attrs.stopOpacity.toString();
+ QStringRef colorStr = attrs.stopColor;
QColor color;
bool ok = true;
qreal offset = convertToNumber(offsetStr, handler, &ok);
if (!ok)
offset = 0.0;
+ QString black = QString::fromLatin1("#000000");
if (colorStr.isEmpty()) {
- colorStr = QLatin1String("#000000");
+ colorStr = QStringRef(&black);
}
- constructColor(colorStr, opacityStr, color, handler);
+ constructColor(colorStr, attrs.stopOpacity, color, handler);
QGradient *grad = style->qgradient();
diff --git a/src/tools/moc/util/generate.sh b/src/tools/moc/util/generate.sh
index 215b8cb..9673c71 100755
--- a/src/tools/moc/util/generate.sh
+++ b/src/tools/moc/util/generate.sh
@@ -1,4 +1,45 @@
#!/bin/sh
+#############################################################################
+##
+## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is the build configuration utility 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$
+##
+#############################################################################
+
qmake
make
cat licenseheader.txt > ../keywords.cpp
diff --git a/src/xmlpatterns/data/qatomicvalue.cpp b/src/xmlpatterns/data/qatomicvalue.cpp
index d8186e5..3aca100 100644
--- a/src/xmlpatterns/data/qatomicvalue.cpp
+++ b/src/xmlpatterns/data/qatomicvalue.cpp
@@ -172,13 +172,19 @@ Item AtomicValue::toXDM(const QVariant &value)
return Item(Double::fromValue(value.toDouble()));
default:
{
- Q_ASSERT_X(false,
- Q_FUNC_INFO,
- qPrintable(QString::fromLatin1(
- "QVariants of type %1 are not supported in "
- "Patternist, see the documentation")
+ if (value.userType() == qMetaTypeId<float>())
+ {
+ return Item(Float::fromValue(value.value<float>()));
+ }
+ else {
+ Q_ASSERT_X(false,
+ Q_FUNC_INFO,
+ qPrintable(QString::fromLatin1(
+ "QVariants of type %1 are not supported in "
+ "Patternist, see the documentation")
.arg(QLatin1String(value.typeName()))));
- return AtomicValue::Ptr();
+ return AtomicValue::Ptr();
+ }
}
}
}
diff --git a/src/xmlpatterns/environment/createReportContext.sh b/src/xmlpatterns/environment/createReportContext.sh
index dcbf9ea..7f01538 100755
--- a/src/xmlpatterns/environment/createReportContext.sh
+++ b/src/xmlpatterns/environment/createReportContext.sh
@@ -1,4 +1,45 @@
#!/bin/sh
+#############################################################################
+##
+## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is the build configuration utility 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$
+##
+#############################################################################
+
# Generate ReportContext.h by invoking createReportContext.xsl, which
# in turns performs a transformation on the specs, fetched from http://www.w3.org/.
diff --git a/src/xmlpatterns/parser/createParser.sh b/src/xmlpatterns/parser/createParser.sh
index 51453eea..8b2849a 100755
--- a/src/xmlpatterns/parser/createParser.sh
+++ b/src/xmlpatterns/parser/createParser.sh
@@ -1,4 +1,44 @@
#!/bin/bash
+#############################################################################
+##
+## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is the build configuration utility 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$
+##
+#############################################################################
files="qquerytransformparser_p.h qquerytransformparser.cpp"
diff --git a/src/xmlpatterns/parser/createTokenLookup.sh b/src/xmlpatterns/parser/createTokenLookup.sh
index f84ee72..8e90500 100755
--- a/src/xmlpatterns/parser/createTokenLookup.sh
+++ b/src/xmlpatterns/parser/createTokenLookup.sh
@@ -1,4 +1,45 @@
#!/bin/sh
+#############################################################################
+##
+## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is the build configuration utility 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$
+##
+#############################################################################
+
outFile="qtokenlookup.cpp"
license=`cat <<EOF
diff --git a/src/xmlpatterns/parser/createXSLTTokenLookup.sh b/src/xmlpatterns/parser/createXSLTTokenLookup.sh
index 3a60dc4..9db886d 100755
--- a/src/xmlpatterns/parser/createXSLTTokenLookup.sh
+++ b/src/xmlpatterns/parser/createXSLTTokenLookup.sh
@@ -1,3 +1,44 @@
#!/bin/sh
+#############################################################################
+##
+## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is the build configuration utility 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$
+##
+#############################################################################
+
xmllint --noout --schema ../qtokenautomaton/qtokenautomaton.xsd qxslttokenlookup.xml
java net.sf.saxon.Transform -xsl:../qtokenautomaton/qautomaton2cpp.xsl qxslttokenlookup.xml