summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-07-13 15:56:21 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-07-13 15:56:21 (GMT)
commit41370bc3d87afbb5485d1246dc4bcd8ab6498aa8 (patch)
tree75f87410e58fcaca1f2d239ddc21609bfc1c5211 /src
parenteef8caf294b45c8748cc7c74ddda82bec2869ecf (diff)
parentc3b6b687e340d4d0c65789c3ac80dbaf2eb513b5 (diff)
downloadQt-41370bc3d87afbb5485d1246dc4bcd8ab6498aa8.zip
Qt-41370bc3d87afbb5485d1246dc4bcd8ab6498aa8.tar.gz
Qt-41370bc3d87afbb5485d1246dc4bcd8ab6498aa8.tar.bz2
Merge remote-tracking branch 'mainline/4.8'
Diffstat (limited to 'src')
-rw-r--r--src/corelib/codecs/qtextcodec_symbian.cpp4
-rw-r--r--src/corelib/global/qglobal.h63
-rw-r--r--src/corelib/global/qnamespace.h1
-rw-r--r--src/corelib/global/qnamespace.qdoc25
-rw-r--r--src/corelib/io/qfile.cpp2
-rw-r--r--src/corelib/io/qprocess.cpp11
-rw-r--r--src/corelib/tools/qline.cpp5
-rw-r--r--src/corelib/tools/qlist.cpp2
-rw-r--r--src/corelib/tools/qlocale.qdoc1
-rw-r--r--src/corelib/tools/qpoint.cpp9
-rw-r--r--src/corelib/tools/qscopedpointer.h4
-rw-r--r--src/corelib/tools/qset.qdoc1
-rw-r--r--src/corelib/tools/qstring.cpp3
-rw-r--r--src/corelib/tools/qstringlist.h2
-rw-r--r--src/corelib/xml/qxmlstream.cpp5
-rw-r--r--src/dbus/dbus.pro9
-rw-r--r--src/dbus/qdbusconnection.cpp52
-rw-r--r--src/dbus/qdbusconnection.h16
-rw-r--r--src/dbus/qdbusconnection_p.h13
-rw-r--r--src/dbus/qdbusintegrator.cpp18
-rw-r--r--src/dbus/qdbusinternalfilters.cpp8
-rw-r--r--src/dbus/qdbusvirtualobject.cpp (renamed from src/plugins/platforms/openvglite/qgraphicssystem_vglite.h)78
-rw-r--r--src/dbus/qdbusvirtualobject.h81
-rw-r--r--src/declarative/debugger/qjsdebuggeragent.cpp42
-rw-r--r--src/declarative/debugger/qjsdebuggeragent_p.h12
-rw-r--r--src/declarative/debugger/qjsdebugservice.cpp53
-rw-r--r--src/declarative/debugger/qjsdebugservice_p.h24
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp140
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable_p_p.h15
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp99
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp135
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativerepeater.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp10
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp8
-rw-r--r--src/gui/accessible/qaccessible2.cpp112
-rw-r--r--src/gui/dialogs/qerrormessage.cpp16
-rw-r--r--src/gui/dialogs/qmessagebox.cpp18
-rw-r--r--src/gui/graphicsview/qgraphicsgridlayout.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicslayout.cpp2
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_p.h1
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp75
-rw-r--r--src/gui/itemviews/qabstractproxymodel.cpp9
-rw-r--r--src/gui/kernel/qapplication.cpp4
-rw-r--r--src/gui/kernel/qgenericplugin_qpa.cpp1
-rw-r--r--src/gui/kernel/qgenericpluginfactory_qpa.cpp1
-rw-r--r--src/gui/kernel/qkeymapper_p.h2
-rw-r--r--src/gui/kernel/qkeymapper_s60.cpp195
-rw-r--r--src/gui/kernel/qkeysequence.cpp4
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformwindowformat_qpa.cpp8
-rw-r--r--src/gui/kernel/qsizepolicy.qdoc2
-rw-r--r--src/gui/kernel/qwidget_qpa.cpp6
-rw-r--r--src/gui/painting/qbezier_p.h36
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp2
-rw-r--r--src/gui/painting/qpainter.cpp14
-rw-r--r--src/gui/painting/qprinterinfo.cpp4
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp6
-rw-r--r--src/gui/s60framework/qs60keycapture.cpp308
-rw-r--r--src/gui/s60framework/qs60keycapture_p.h (renamed from src/plugins/platforms/openvglite/qwindowsurface_vglite.h)75
-rw-r--r--src/gui/s60framework/qs60mainappui.cpp17
-rw-r--r--src/gui/s60framework/s60framework.pri21
-rw-r--r--src/gui/styles/qmacstyle_mac.mm34
-rw-r--r--src/gui/styles/qs60style.cpp364
-rw-r--r--src/gui/styles/qs60style.h88
-rw-r--r--src/gui/styles/qs60style_p.h108
-rw-r--r--src/gui/styles/qs60style_s60.cpp104
-rw-r--r--src/gui/text/qfontdatabase.cpp91
-rw-r--r--src/gui/text/qfontdatabase_mac.cpp6
-rw-r--r--src/gui/text/qfontdatabase_qpa.cpp2
-rw-r--r--src/gui/text/qfontdatabase_s60.cpp2
-rw-r--r--src/gui/text/qfontdatabase_win.cpp8
-rw-r--r--src/gui/text/qfontdatabase_x11.cpp14
-rw-r--r--src/gui/text/qfontengine_coretext.mm27
-rw-r--r--src/gui/text/qfontengine_coretext_p.h3
-rw-r--r--src/gui/text/qfontenginedirectwrite.cpp146
-rw-r--r--src/gui/text/qfontenginedirectwrite_p.h6
-rw-r--r--src/gui/text/qfontmetrics.cpp3
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.cpp2
-rw-r--r--src/gui/text/qtextcursor.cpp1
-rw-r--r--src/gui/text/qtextdocument.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp35
-rw-r--r--src/gui/text/qtextengine_p.h4
-rw-r--r--src/gui/text/qtextlayout.cpp24
-rw-r--r--src/gui/widgets/qabstractspinbox.cpp2
-rw-r--r--src/gui/widgets/qcheckbox.cpp1
-rw-r--r--src/gui/widgets/qlineedit.cpp4
-rw-r--r--src/gui/widgets/qradiobutton.cpp1
-rw-r--r--src/gui/widgets/qtabwidget.cpp1
-rw-r--r--src/gui/widgets/qtextedit.cpp2
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp7
-rw-r--r--src/network/access/qhttpnetworkreply.cpp12
-rw-r--r--src/network/access/qhttpnetworkreply_p.h1
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp2
-rw-r--r--src/network/bearer/qnetworkconfigmanager.cpp1
-rw-r--r--src/network/kernel/qhostinfo.cpp1
-rw-r--r--src/network/kernel/qnetworkproxy.cpp8
-rw-r--r--src/network/socket/qsymbiansocketengine.cpp1
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp2
-rw-r--r--src/opengl/qgl.cpp1
-rw-r--r--src/opengl/qgl_qpa.cpp6
-rw-r--r--src/opengl/qgl_symbian.cpp109
-rw-r--r--src/opengl/qpixmapdata_gl_p.h15
-rw-r--r--src/opengl/qpixmapdata_symbiangl.cpp632
-rw-r--r--src/opengl/qwindowsurface_gl.cpp64
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.cpp40
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp79
-rw-r--r--src/plugins/bearer/symbian/symbianengine.h18
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp8
-rw-r--r--src/plugins/platforms/openvglite/openvglite.pro12
-rw-r--r--src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp193
-rw-r--r--src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp131
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/abstracttool.cpp (renamed from src/plugins/platforms/openvglite/main.cpp)33
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/abstracttool.h85
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp611
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h178
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp17
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.h (renamed from src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool_p.h)25
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp11
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.h (renamed from src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter_p.h)12
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp45
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.h (renamed from src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool_p.h)29
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.h (renamed from src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem_p.h)10
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.h (renamed from src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator_p.h)12
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp11
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.h (renamed from src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator_p.h)10
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.h (renamed from src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle_p.h)10
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp35
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.h (renamed from src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool_p.h)26
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.h (renamed from src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator_p.h)10
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.h (renamed from src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar_p.h)12
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp10
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.h (renamed from src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem_p.h)10
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.h (renamed from src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox_p.h)10
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp16
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.h (renamed from src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool_p.h)18
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp7
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h10
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp755
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.h100
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h126
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p_p.h152
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro36
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants.h (renamed from src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants_p.h)17
-rw-r--r--src/s60installs/bwins/QtGuiu.def18
-rwxr-xr-xsrc/s60installs/s60installs.pro12
159 files changed, 4148 insertions, 2745 deletions
diff --git a/src/corelib/codecs/qtextcodec_symbian.cpp b/src/corelib/codecs/qtextcodec_symbian.cpp
index c8a7357..504a7c8 100644
--- a/src/corelib/codecs/qtextcodec_symbian.cpp
+++ b/src/corelib/codecs/qtextcodec_symbian.cpp
@@ -119,11 +119,13 @@ static const QSymbianCodecInitData codecsData[] = {
{ /*271082504*/ 271082504, 0, "portuguese_locking_gsm7ext\0" },
{ /*271082505*/ 271082505, 0, "portuguese_locking_single\0" },
{ /*271082506*/ 271082506, 0, "spanish_gsm7_single\0" },
+ { /*271082762*/ 271082762, 0, "hkscs_2004\0" },
{ /*271085624*/ 271085624, 114, "GB18030\0" },
{ /*536929574*/ 536929574, 38, "EUC-KR\0" },
{ /*536936703*/ 536936703, 0, "CP949\0" },
{ /*536936705*/ 536936705, 37, "ISO-2022-KR\0csISO2022KR\0" },
- { /*536941517*/ 536941517, 36, "KS_C_5601-1987\0iso-ir-149\0KS_C_5601-1989\0KSC_5601\0Korean\0csKSC56011987\0" }
+ { /*536941517*/ 536941517, 36, "KS_C_5601-1987\0iso-ir-149\0KS_C_5601-1989\0KSC_5601\0Korean\0csKSC56011987\0" },
+ { /*537124345*/ 537124345, 119, "KZ-1048\0" }
};
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 1f5f537..9c7f1c6 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -536,6 +536,11 @@ namespace QT_NAMESPACE {}
# define Q_COMPILER_LAMBDA
# define Q_COMPILER_UNICODE_STRINGS
# endif
+# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
+ /* C++0x features supported in GCC 4.6: */
+# define Q_COMPILER_CONSTEXPR
+# endif
+
# endif
/* IBM compiler versions are a bit messy. There are actually two products:
@@ -1135,6 +1140,12 @@ redefine to built-in booleans to make autotests work properly */
# define QT_FASTCALL
#endif
+#ifdef Q_COMPILER_CONSTEXPR
+# define Q_DECL_CONSTEXPR constexpr
+#else
+# define Q_DECL_CONSTEXPR
+#endif
+
//defines the type for the WNDPROC on windows
//the alignment needs to be forced for sse2 to not crash with mingw
#if defined(Q_WS_WIN)
@@ -1166,25 +1177,25 @@ typedef double qreal;
*/
template <typename T>
-inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
+Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
-inline int qRound(qreal d)
+Q_DECL_CONSTEXPR inline int qRound(qreal d)
{ return d >= qreal(0.0) ? int(d + qreal(0.5)) : int(d - int(d-1) + qreal(0.5)) + int(d-1); }
#if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN)
-inline qint64 qRound64(double d)
+Q_DECL_CONSTEXPR inline qint64 qRound64(double d)
{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qreal(qint64(d-1)) + 0.5) + qint64(d-1); }
#else
-inline qint64 qRound64(qreal d)
+Q_DECL_CONSTEXPR inline qint64 qRound64(qreal d)
{ return d >= qreal(0.0) ? qint64(d + qreal(0.5)) : qint64(d - qreal(qint64(d-1)) + qreal(0.5)) + qint64(d-1); }
#endif
template <typename T>
-inline const T &qMin(const T &a, const T &b) { if (a < b) return a; return b; }
+Q_DECL_CONSTEXPR inline const T &qMin(const T &a, const T &b) { return (a < b) ? a : b; }
template <typename T>
-inline const T &qMax(const T &a, const T &b) { if (a < b) return b; return a; }
+Q_DECL_CONSTEXPR inline const T &qMax(const T &a, const T &b) { return (a < b) ? b : a; }
template <typename T>
-inline const T &qBound(const T &min, const T &val, const T &max)
+Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max)
{ return qMax(min, qMin(max, val)); }
#ifdef QT3_SUPPORT
@@ -1978,12 +1989,12 @@ inline bool operator!=(QBool b1, bool b2) { return !b1 != !b2; }
inline bool operator!=(bool b1, QBool b2) { return !b1 != !b2; }
inline bool operator!=(QBool b1, QBool b2) { return !b1 != !b2; }
-static inline bool qFuzzyCompare(double p1, double p2)
+Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2)
{
return (qAbs(p1 - p2) <= 0.000000000001 * qMin(qAbs(p1), qAbs(p2)));
}
-static inline bool qFuzzyCompare(float p1, float p2)
+Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2)
{
return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2)));
}
@@ -1991,7 +2002,7 @@ static inline bool qFuzzyCompare(float p1, float p2)
/*!
\internal
*/
-static inline bool qFuzzyIsNull(double d)
+Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d)
{
return qAbs(d) <= 0.000000000001;
}
@@ -1999,7 +2010,7 @@ static inline bool qFuzzyIsNull(double d)
/*!
\internal
*/
-static inline bool qFuzzyIsNull(float f)
+Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f)
{
return qAbs(f) <= 0.00001f;
}
@@ -2267,9 +2278,9 @@ class QFlags
int i;
public:
typedef Enum enum_type;
- inline QFlags(const QFlags &f) : i(f.i) {}
- inline QFlags(Enum f) : i(f) {}
- inline QFlags(Zero = 0) : i(0) {}
+ Q_DECL_CONSTEXPR inline QFlags(const QFlags &f) : i(f.i) {}
+ Q_DECL_CONSTEXPR inline QFlags(Enum f) : i(f) {}
+ Q_DECL_CONSTEXPR inline QFlags(Zero = 0) : i(0) {}
inline QFlags(QFlag f) : i(f) {}
inline QFlags &operator=(const QFlags &f) { i = f.i; return *this; }
@@ -2280,18 +2291,18 @@ public:
inline QFlags &operator^=(QFlags f) { i ^= f.i; return *this; }
inline QFlags &operator^=(Enum f) { i ^= f; return *this; }
- inline operator int() const { return i; }
+ Q_DECL_CONSTEXPR inline operator int() const { return i; }
- inline QFlags operator|(QFlags f) const { QFlags g; g.i = i | f.i; return g; }
- inline QFlags operator|(Enum f) const { QFlags g; g.i = i | f; return g; }
- inline QFlags operator^(QFlags f) const { QFlags g; g.i = i ^ f.i; return g; }
- inline QFlags operator^(Enum f) const { QFlags g; g.i = i ^ f; return g; }
- inline QFlags operator&(int mask) const { QFlags g; g.i = i & mask; return g; }
- inline QFlags operator&(uint mask) const { QFlags g; g.i = i & mask; return g; }
- inline QFlags operator&(Enum f) const { QFlags g; g.i = i & f; return g; }
- inline QFlags operator~() const { QFlags g; g.i = ~i; return g; }
+ Q_DECL_CONSTEXPR inline QFlags operator|(QFlags f) const { return QFlags(Enum(i | f.i)); }
+ Q_DECL_CONSTEXPR inline QFlags operator|(Enum f) const { return QFlags(Enum(i | f)); }
+ Q_DECL_CONSTEXPR inline QFlags operator^(QFlags f) const { return QFlags(Enum(i ^ f.i)); }
+ Q_DECL_CONSTEXPR inline QFlags operator^(Enum f) const { return QFlags(Enum(i ^ f)); }
+ Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const { return QFlags(Enum(i & mask)); }
+ Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const { return QFlags(Enum(i & mask)); }
+ Q_DECL_CONSTEXPR inline QFlags operator&(Enum f) const { return QFlags(Enum(i & f)); }
+ Q_DECL_CONSTEXPR inline QFlags operator~() const { return QFlags(Enum(~i)); }
- inline bool operator!() const { return !i; }
+ Q_DECL_CONSTEXPR inline bool operator!() const { return !i; }
inline bool testFlag(Enum f) const { return (i & f) == f && (f != 0 || i == int(f) ); }
};
@@ -2304,9 +2315,9 @@ inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) \
{ return QIncompatibleFlag(int(f1) | f2); }
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \
-inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \
+Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \
{ return QFlags<Flags::enum_type>(f1) | f2; } \
-inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) \
+Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) \
{ return f2 | f1; } Q_DECLARE_INCOMPATIBLE_FLAGS(Flags)
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 99479d0..e247533 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -546,6 +546,7 @@ public:
AA_S60DontConstructApplicationPanes = 8,
AA_S60DisablePartialScreenInputMode = 9,
AA_X11InitThreads = 10,
+ AA_CaptureMultimediaKeys = 11,
// Add new attributes before this line
AA_AttributeCount
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 9f59c6e..dc92866 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -156,17 +156,30 @@
whole lifetime. This attribute must be set before QApplication is
constructed.
- \omitvalue AA_S60DisablePartialScreenInputMode By default in Symbian^3,
- a separate editing window is opened on top of an application. This is exactly
- like editing on previous versions of Symbian behave. When this attribute
- is true, a virtual keyboard window is shown on top of application and it
- is ensured that the focused text widget is visible. This is only supported in
- Symbian^3. (internal)
+ \value AA_S60DisablePartialScreenInputMode By default in Symbian^3, a separate
+ editing window is opened on top of an application. This is exactly like
+ editing on previous versions of Symbian behave. When this attribute is false,
+ a non-fullscreen virtual keyboard window is shown on top of application and
+ it is ensured that the focused text input widget is visible.
+ The auto-translation of input widget is only supported for applications
+ based on QGraphicsView, but the non-fullscreen virtual keyboard will
+ work for any kind of application (i.e. QWidgets-based). By default this
+ attribute is true. This attribute must be set after QApplication is
+ constructed. This is only supported in Symbian^3 and later Symbian releases.
\value AA_X11InitThreads Calls XInitThreads() as part of the QApplication
construction in order to make Xlib calls thread-safe. This
attribute must be set before QApplication is constructed.
+ \value AA_CaptureMultimediaKeys Enables application to receive multimedia key events
+ (play, next, previous etc). This includes also external sources such as headsets.
+ Application can not use Remote Control framework on Symbian if this attribute is
+ set. On Symbian, multimedia key event routing may vary between different devices.
+ For example, application on background may receive multimedia key events only if
+ it has active audio stream i.e. it is playing music or video. This attribute must
+ be set before QApplication is constructed. This attribute is only supported in Symbian
+ platform.
+
\omitvalue AA_AttributeCount
*/
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index 66edf58..929b2f9 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -358,6 +358,7 @@ QFilePrivate::setError(QFile::FileError err, int errNum)
/*!
\enum QFile::FileHandleFlag
+ \since 4.8
This enum is used when opening a file to specify additional
options which only apply to files and not to a generic
@@ -1657,6 +1658,7 @@ bool QFile::atEnd() const
/*!
\fn bool QFile::seek(qint64 pos)
+ \since 4.8
For random-access devices, this function sets the current position
to \a pos, returning true on success, or false if an error occurred.
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 4b689c5..e900663 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1683,13 +1683,10 @@ QProcessEnvironment QProcess::processEnvironment() const
bool QProcess::waitForStarted(int msecs)
{
Q_D(QProcess);
- if (d->processState == QProcess::Starting) {
- if (!d->waitForStarted(msecs))
- return false;
- setProcessState(QProcess::Running);
- emit started();
- }
- return d->processState == QProcess::Running;
+ if (d->processState == QProcess::Running)
+ return true;
+
+ return d->waitForStarted(msecs);
}
/*! \reimp
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp
index af3b7d5..0f67652 100644
--- a/src/corelib/tools/qline.cpp
+++ b/src/corelib/tools/qline.cpp
@@ -564,8 +564,9 @@ qreal QLineF::length() const
Returns the angle of the line in degrees.
- Positive values for the angles mean counter-clockwise while negative values
- mean the clockwise direction. Zero degrees is at the 3 o'clock position.
+ The return value will be in the range of values from 0.0 up to but not
+ including 360.0. The angles are measured counter-clockwise from a point
+ on the x-axis to the right of the origin (x > 0).
\sa setAngle()
*/
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index 36a9c60..e68ddd5 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -237,7 +237,7 @@ void **QListData::append(int n)
if (b - n >= 2 * d->alloc / 3) {
// we have enough space. Just not at the end -> move it.
e -= b;
- ::memcpy(d->array, d->array + b, e * sizeof(void *));
+ ::memmove(d->array, d->array + b, e * sizeof(void *));
d->begin = 0;
} else {
realloc(grow(d->alloc + n));
diff --git a/src/corelib/tools/qlocale.qdoc b/src/corelib/tools/qlocale.qdoc
index fd139c3..5d4f305 100644
--- a/src/corelib/tools/qlocale.qdoc
+++ b/src/corelib/tools/qlocale.qdoc
@@ -608,6 +608,7 @@
/*!
\enum QLocale::Script
+ \since 4.8
This enumerated type is used to specify a script.
diff --git a/src/corelib/tools/qpoint.cpp b/src/corelib/tools/qpoint.cpp
index bd32fe7..ae6ed71 100644
--- a/src/corelib/tools/qpoint.cpp
+++ b/src/corelib/tools/qpoint.cpp
@@ -188,6 +188,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn QPoint &QPoint::operator*=(float factor)
+ \since 4.8
Multiplies this point's coordinates by the given \a factor, and
returns a reference to this point.
@@ -200,6 +201,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn QPoint &QPoint::operator*=(double factor)
+ \since 4.8
Multiplies this point's coordinates by the given \a factor, and
returns a reference to this point. For example:
@@ -214,6 +216,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn QPoint &QPoint::operator*=(int factor)
+ \since 4.8
Multiplies this point's coordinates by the given \a factor, and
returns a reference to this point.
@@ -259,6 +262,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn const QPoint operator*(const QPoint &point, float factor)
\relates QPoint
+ \since 4.8
Returns a copy of the given \a point multiplied by the given \a factor.
@@ -271,6 +275,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn const QPoint operator*(const QPoint &point, double factor)
\relates QPoint
+ \since 4.8
Returns a copy of the given \a point multiplied by the given \a factor.
@@ -283,6 +288,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn const QPoint operator*(const QPoint &point, int factor)
\relates QPoint
+ \since 4.8
Returns a copy of the given \a point multiplied by the given \a factor.
@@ -293,6 +299,7 @@ QT_BEGIN_NAMESPACE
\fn const QPoint operator*(float factor, const QPoint &point)
\overload
\relates QPoint
+ \since 4.8
Returns a copy of the given \a point multiplied by the given \a factor.
*/
@@ -301,6 +308,7 @@ QT_BEGIN_NAMESPACE
\fn const QPoint operator*(double factor, const QPoint &point)
\overload
\relates QPoint
+ \since 4.8
Returns a copy of the given \a point multiplied by the given \a factor.
*/
@@ -309,6 +317,7 @@ QT_BEGIN_NAMESPACE
\fn const QPoint operator*(int factor, const QPoint &point)
\overload
\relates QPoint
+ \since 4.8
Returns a copy of the given \a point multiplied by the given \a factor.
*/
diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h
index b15bcac..a24f62e 100644
--- a/src/corelib/tools/qscopedpointer.h
+++ b/src/corelib/tools/qscopedpointer.h
@@ -208,8 +208,10 @@ template <typename T, typename Cleanup = QScopedPointerArrayDeleter<T> >
class QScopedArrayPointer : public QScopedPointer<T, Cleanup>
{
public:
+ inline QScopedArrayPointer() : QScopedPointer<T, Cleanup>(0) {}
+
template <typename D>
- explicit inline QScopedArrayPointer(D *p = 0, typename QtPrivate::QScopedArrayEnsureSameType<T,D>::Type = 0)
+ explicit inline QScopedArrayPointer(D *p, typename QtPrivate::QScopedArrayEnsureSameType<T,D>::Type = 0)
: QScopedPointer<T, Cleanup>(p)
{
}
diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc
index f562c68..31129e0 100644
--- a/src/corelib/tools/qset.qdoc
+++ b/src/corelib/tools/qset.qdoc
@@ -124,6 +124,7 @@
/*!
\fn void QSet::swap(QSet<T> &other)
+ \since 4.8
Swaps set \a other with this set. This operation is very fast and
never fails.
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index ee45cfd..791bfff 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -839,18 +839,21 @@ int QString::grow(int size)
/*!
\typedef QString::const_reference
+ \since 4.8
The QString::const_reference typedef provides an STL-style
const reference for QString.
*/
/*!
\typedef QString::reference
+ \since 4.8
The QString::const_reference typedef provides an STL-style
reference for QString.
*/
/*!
\typedef QString::value_type
+ \since 4.8
The QString::const_reference typedef provides an STL-style
value type for QString.
diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h
index 2159512..f4689b4 100644
--- a/src/corelib/tools/qstringlist.h
+++ b/src/corelib/tools/qstringlist.h
@@ -71,7 +71,7 @@ public:
inline QStringList(const QStringList &l) : QList<QString>(l) { }
inline QStringList(const QList<QString> &l) : QList<QString>(l) { }
#ifdef Q_COMPILER_INITIALIZER_LISTS
- inline QStringList(std::initializer_list<QString> args) : QList(args) { }
+ inline QStringList(std::initializer_list<QString> args) : QList<QString>(args) { }
#endif
inline void sort();
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index caaffd3..9682688 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -3381,7 +3381,10 @@ int QXmlStreamWriter::autoFormattingIndent() const
}
/*!
- Returns \c true if the stream failed to write to the underlying device.
+ \since 4.8
+
+ Returns true if the stream failed to write to the underlying device;
+ otherwise returns false.
The error status is never reset. Writes happening after the error
occurred are ignored, even if the error condition is cleared.
diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro
index 08c9ea1..d21b380 100644
--- a/src/dbus/dbus.pro
+++ b/src/dbus/dbus.pro
@@ -44,7 +44,8 @@ PUB_HEADERS = qdbusargument.h \
qdbusmetatype.h \
qdbuspendingcall.h \
qdbuspendingreply.h \
- qdbuscontext.h
+ qdbuscontext.h \
+ qdbusvirtualobject.h
HEADERS += $$PUB_HEADERS \
qdbusconnection_p.h \
qdbusmessage_p.h \
@@ -60,7 +61,8 @@ HEADERS += $$PUB_HEADERS \
qdbuspendingcall_p.h \
qdbus_symbols_p.h \
qdbusservicewatcher.h \
- qdbusunixfiledescriptor.h
+ qdbusunixfiledescriptor.h \
+ qdbusvirtualobject.h
SOURCES += qdbusconnection.cpp \
qdbusconnectioninterface.cpp \
qdbuserror.cpp \
@@ -87,4 +89,5 @@ SOURCES += qdbusconnection.cpp \
qdbuspendingreply.cpp \
qdbus_symbols.cpp \
qdbusservicewatcher.cpp \
- qdbusunixfiledescriptor.cpp
+ qdbusunixfiledescriptor.cpp \
+ qdbusvirtualobject.cpp
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index 0b4133c..e524103 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -222,6 +222,18 @@ void QDBusConnectionManager::setConnection(const QString &name, QDBusConnectionP
*/
/*!
+ \internal
+ \since 4.8
+ \enum QDBusConnection::VirtualObjectRegisterOption
+ Specifies the options for registering virtual objects with the connection. The possible values are:
+
+ \value SingleNode register a virtual object to handle one path only
+ \value SubPath register a virtual object so that it handles all sub paths
+
+ \sa registerVirtualObject(), QDBusVirtualObject
+*/
+
+/*!
\enum QDBusConnection::UnregisterMode
The mode for unregistering an object path:
@@ -801,9 +813,21 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis
// this node exists
// consider it free if there's no object here and the user is not trying to
// replace the object sub-tree
- if ((options & ExportChildObjects && !node->children.isEmpty()) || node->obj)
+ if (node->obj)
return false;
+ if (options & QDBusConnectionPrivate::VirtualObject) {
+ // technically the check for children needs to go even deeper
+ if (options & SubPath) {
+ foreach (const QDBusConnectionPrivate::ObjectTreeNode &child, node->children) {
+ if (child.obj)
+ return false;
+ }
+ }
+ } else {
+ if ((options & ExportChildObjects && !node->children.isEmpty()))
+ return false;
+ }
// we can add the object here
node->obj = object;
node->flags = options;
@@ -813,6 +837,13 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis
return true;
}
+ // if a virtual object occupies this path, return false
+ if (node->obj && (node->flags & QDBusConnectionPrivate::VirtualObject) && (node->flags & QDBusConnection::SubPath)) {
+ qDebug("Cannot register object at %s because QDBusVirtualObject handles all sub-paths.",
+ qPrintable(path));
+ return false;
+ }
+
// find the position where we'd insert the node
QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it =
qLowerBound(node->children.begin(), node->children.end(), pathComponents.at(i));
@@ -841,6 +872,21 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis
}
/*!
+ \internal
+ \since 4.8
+ Registers a QDBusTreeNode for a path. It can handle a path including all child paths, thus
+ handling multiple DBus nodes.
+
+ To unregister a QDBusTreeNode use the unregisterObject() function with its path.
+*/
+bool QDBusConnection::registerVirtualObject(const QString &path, QDBusVirtualObject *treeNode,
+ VirtualObjectRegisterOption options)
+{
+ int opts = options | QDBusConnectionPrivate::VirtualObject;
+ return registerObject(path, (QObject*) treeNode, (RegisterOptions) opts);
+}
+
+/*!
Unregisters an object that was registered with the registerObject() at the object path given by
\a path and, if \a mode is QDBusConnection::UnregisterTree, all of its sub-objects too.
@@ -905,6 +951,8 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const
while (node) {
if (pathComponents.count() == i)
return node->obj;
+ if ((node->flags & QDBusConnectionPrivate::VirtualObject) && (node->flags & QDBusConnection::SubPath))
+ return node->obj;
QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it =
qLowerBound(node->children.constBegin(), node->children.constEnd(), pathComponents.at(i));
@@ -917,6 +965,8 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const
return 0;
}
+
+
/*!
Returns a QDBusConnectionInterface object that represents the
D-Bus server interface on this connection.
diff --git a/src/dbus/qdbusconnection.h b/src/dbus/qdbusconnection.h
index 4bdd055..8b126af 100644
--- a/src/dbus/qdbusconnection.h
+++ b/src/dbus/qdbusconnection.h
@@ -69,6 +69,7 @@ class QDBusError;
class QDBusMessage;
class QDBusPendingCall;
class QDBusConnectionInterface;
+class QDBusVirtualObject;
class QObject;
class QDBusConnectionPrivate;
@@ -104,8 +105,8 @@ public:
// Qt 4.2 had a misspelling here
ExportAllSignal = ExportAllSignals,
#endif
-
ExportChildObjects = 0x1000
+ // Reserved = 0xff000000
};
enum UnregisterMode {
UnregisterNode,
@@ -113,6 +114,15 @@ public:
};
Q_DECLARE_FLAGS(RegisterOptions, RegisterOption)
+ enum VirtualObjectRegisterOption {
+ SingleNode = 0x0,
+ SubPath = 0x1
+ // Reserved = 0xff000000
+ };
+#ifndef Q_QDOC
+ Q_DECLARE_FLAGS(VirtualObjectRegisterOptions, VirtualObjectRegisterOption)
+#endif
+
enum ConnectionCapability {
UnixFileDescriptorPassing = 0x0001
};
@@ -163,6 +173,9 @@ public:
void unregisterObject(const QString &path, UnregisterMode mode = UnregisterNode);
QObject *objectRegisteredAt(const QString &path) const;
+ bool registerVirtualObject(const QString &path, QDBusVirtualObject *object,
+ VirtualObjectRegisterOption options = SingleNode);
+
bool registerService(const QString &serviceName);
bool unregisterService(const QString &serviceName);
@@ -192,6 +205,7 @@ private:
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusConnection::RegisterOptions)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusConnection::VirtualObjectRegisterOptions)
QT_END_NAMESPACE
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index 12bcb21..d481cf1 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -129,6 +129,11 @@ public:
QByteArray matchRule;
};
+ enum TreeNodeType {
+ Object = 0x0,
+ VirtualObject = 0x01000000
+ };
+
struct ObjectTreeNode
{
typedef QVector<ObjectTreeNode> DataList;
@@ -143,8 +148,12 @@ public:
{ return QStringRef(&name) < other; }
QString name;
- QObject* obj;
+ union {
+ QObject *obj;
+ QDBusVirtualObject *treeNode;
+ };
int flags;
+
DataList children;
};
@@ -333,7 +342,7 @@ extern bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name);
extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo);
// in qdbusinternalfilters.cpp
-extern QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node);
+extern QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node, const QString &path);
extern QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node,
const QDBusMessage &msg);
extern QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node,
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index f3f3d0b..2cde07e 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -57,6 +57,7 @@
#include "qdbusabstractadaptor.h"
#include "qdbusabstractadaptor_p.h"
#include "qdbusutil_p.h"
+#include "qdbusvirtualobject.h"
#include "qdbusmessage_p.h"
#include "qdbuscontext_p.h"
#include "qdbuspendingcall_p.h"
@@ -442,7 +443,11 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root,
// walk the object tree
const QDBusConnectionPrivate::ObjectTreeNode *node = root;
- while (start < length && node && !(node->flags & QDBusConnection::ExportChildObjects)) {
+ while (start < length && node) {
+ if (node->flags & QDBusConnection::ExportChildObjects)
+ break;
+ if ((node->flags & QDBusConnectionPrivate::VirtualObject) && (node->flags & QDBusConnection::SubPath))
+ break;
int end = fullpath.indexOf(QLatin1Char('/'), start);
end = (end == -1 ? length : end);
QStringRef pathComponent(&fullpath, start, end - start);
@@ -1328,7 +1333,7 @@ bool QDBusConnectionPrivate::activateInternalFilters(const ObjectTreeNode &node,
if (interface.isEmpty() || interface == QLatin1String(DBUS_INTERFACE_INTROSPECTABLE)) {
if (msg.member() == QLatin1String("Introspect") && msg.signature().isEmpty()) {
//qDebug() << "QDBusConnectionPrivate::activateInternalFilters introspect" << msg.d_ptr->msg;
- QDBusMessage reply = msg.createReply(qDBusIntrospectObject(node));
+ QDBusMessage reply = msg.createReply(qDBusIntrospectObject(node, msg.path()));
send(reply);
return true;
}
@@ -1375,6 +1380,15 @@ void QDBusConnectionPrivate::activateObject(ObjectTreeNode &node, const QDBusMes
// object may be null
+ if (node.flags & QDBusConnectionPrivate::VirtualObject) {
+ if (node.treeNode->handleMessage(msg, q(this))) {
+ return;
+ } else {
+ if (activateInternalFilters(node, msg))
+ return;
+ }
+ }
+
if (pathStartPos != msg.path().length()) {
node.flags &= ~QDBusConnection::ExportAllSignals;
node.obj = findChildObject(&node, msg.path(), pathStartPos);
diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp
index 2b142a7..b874a64 100644
--- a/src/dbus/qdbusinternalfilters.cpp
+++ b/src/dbus/qdbusinternalfilters.cpp
@@ -56,6 +56,7 @@
#include "qdbusmetatype_p.h"
#include "qdbusmessage_p.h"
#include "qdbusutil_p.h"
+#include "qdbusvirtualobject.h"
#ifndef QT_NO_DBUS
@@ -108,7 +109,7 @@ static QString generateSubObjectXml(QObject *object)
// declared as extern in qdbusconnection_p.h
-QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node)
+QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node, const QString &path)
{
// object may be null
@@ -155,6 +156,11 @@ QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node
}
}
+ // is it a virtual node that handles introspection itself?
+ if (node.flags & QDBusConnectionPrivate::VirtualObject) {
+ xml_data += node.treeNode->introspect(path);
+ }
+
xml_data += QLatin1String( propertiesInterfaceXml );
}
diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h b/src/dbus/qdbusvirtualobject.cpp
index 41b1d28..992ccbf 100644
--- a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h
+++ b/src/dbus/qdbusvirtualobject.cpp
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the plugins of the Qt Toolkit.
+** This file is part of the QtDBus module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -39,55 +39,59 @@
**
****************************************************************************/
-#ifndef QGRAPHICSSYSTEM_VGLITE_H
-#define QGRAPHICSSYSTEM_VGLITE_H
+#include "qdbusvirtualobject.h"
-#include <QtGui/private/qgraphicssystem_p.h>
-#include <QtGui/private/qegl_p.h>
-#include <QtGui/qimage.h>
+#ifndef QT_NO_DBUS
QT_BEGIN_NAMESPACE
-class QVGLiteWindowSurface;
+QDBusVirtualObject::QDBusVirtualObject(QObject *parent) :
+ QObject(parent)
+{
+}
-class QVGLiteGraphicsSystem : public QGraphicsSystem,
- public QGraphicsSystemScreen
+QDBusVirtualObject::~QDBusVirtualObject()
{
-public:
- QVGLiteGraphicsSystem();
- ~QVGLiteGraphicsSystem();
+}
- QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
- QWindowSurface *createWindowSurface(QWidget *widget) const;
- QList<QGraphicsSystemScreen *> screens() const { return mScreens; }
+QT_END_NAMESPACE
- QRect geometry() const { return QRect(0, 0, w, h); }
- int depth() const { return d; }
- QImage::Format format() const { return screenFormat; }
- QSize physicalSize() const { return QSize(physWidth, physHeight); }
-private:
- friend class QVGLiteWindowSurface;
+/*!
+ \internal
+ \class QDBusVirtualObject
+ \inmodule QtDBus
+ \since 4.8
- int w;
- int h;
- int d;
+ \brief The QDBusVirtualObject class is used to handle several DBus paths with one class.
+*/
- int dw;
- int dh;
+/*!
+ \internal
+ \fn bool QDBusVirtualObject::handleMessage(const QDBusMessage &message, const QDBusConnection &connection) = 0
- int physWidth;
- int physHeight;
+ This function needs to handle all messages to the path of the
+ virtual object, when the SubPath option is specified.
+ The service, path, interface and methos are all part of the message.
+ Must return true when the message is handled, otherwise false (will generate dbus error message).
+*/
- mutable QVGLiteWindowSurface *surface;
- QEglContext *context;
- EGLSurface rootWindow;
- QImage::Format screenFormat;
- bool preservedSwap;
- QList<QGraphicsSystemScreen *> mScreens;
-};
+/*!
+ \internal
+ \fn QString QDBusVirtualObject::introspect(const QString &path) const
-QT_END_NAMESPACE
+ This function needs to handle the introspection of the
+ virtual object. It must return xml of the form:
+
+ \code
+<interface name="com.trolltech.QtDBus.MyObject" >
+ <property access="readwrite" type="i" name="prop1" />
+</interface>
+ \endcode
+
+ If you pass the SubPath option, this introspection has to include all child nodes.
+ Otherwise QDBus handles the introspection of the child nodes.
+*/
-#endif
+#endif // QT_NO_DBUS
diff --git a/src/dbus/qdbusvirtualobject.h b/src/dbus/qdbusvirtualobject.h
new file mode 100644
index 0000000..be323de
--- /dev/null
+++ b/src/dbus/qdbusvirtualobject.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDBus module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDBUSTREENODE_H
+#define QDBUSTREENODE_H
+
+#include <QtDBus/qdbusmacros.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qobject.h>
+
+#ifndef QT_NO_DBUS
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(DBus)
+
+class QDBusMessage;
+class QDBusConnection;
+
+class QDBusVirtualObjectPrivate;
+class Q_DBUS_EXPORT QDBusVirtualObject : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QDBusVirtualObject(QObject *parent = 0);
+ virtual ~QDBusVirtualObject();
+
+ virtual QString introspect(const QString &path) const = 0;
+ virtual bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) = 0;
+
+private:
+ Q_DECLARE_PRIVATE(QDBusVirtualObject)
+ Q_DISABLE_COPY(QDBusVirtualObject)
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QT_NO_DBUS
+#endif
diff --git a/src/declarative/debugger/qjsdebuggeragent.cpp b/src/declarative/debugger/qjsdebuggeragent.cpp
index dff637b..683032b 100644
--- a/src/declarative/debugger/qjsdebuggeragent.cpp
+++ b/src/declarative/debugger/qjsdebuggeragent.cpp
@@ -41,6 +41,7 @@
#include "private/qjsdebuggeragent_p.h"
#include "private/qdeclarativedebughelper_p.h"
+#include "private/qjsdebugservice_p.h"
#include <QtCore/qdatetime.h>
#include <QtCore/qcoreapplication.h>
@@ -56,7 +57,7 @@ class QJSDebuggerAgentPrivate
{
public:
QJSDebuggerAgentPrivate(QJSDebuggerAgent *q)
- : q(q), state(NoState), isInitialized(false)
+ : q(q), state(NoState), isInitialized(false), coverageEnabled(false)
{}
void continueExec();
@@ -80,6 +81,7 @@ public:
QStringList watchExpressions;
QSet<qint64> knownObjectIds;
bool isInitialized;
+ bool coverageEnabled;
};
namespace {
@@ -261,6 +263,12 @@ bool QJSDebuggerAgent::isInitialized() const
return d->isInitialized;
}
+void QJSDebuggerAgent::setCoverageEnabled(bool enabled)
+{
+ d->isInitialized = true;
+ d->coverageEnabled = enabled;
+}
+
void QJSDebuggerAgent::setBreakpoints(const JSAgentBreakpoints &breakpoints)
{
d->breakpoints = breakpoints;
@@ -417,10 +425,16 @@ void QJSDebuggerAgent::setProperty(qint64 objectId,
\reimp
*/
void QJSDebuggerAgent::scriptLoad(qint64 id, const QString &program,
- const QString &fileName, int)
+ const QString &fileName, int baseLineNumber)
{
- Q_UNUSED(program);
d->filenames.insert(id, fileName);
+
+ if (d->coverageEnabled) {
+ JSAgentCoverageData rd = {"COVERAGE", QJSDebugService::instance()->m_timer.elapsed(), (int)CoverageScriptLoad,
+ id, program, fileName, baseLineNumber,
+ 0, 0, QString()};
+ QJSDebugService::instance()->processMessage(rd);
+ }
}
/*!
@@ -450,8 +464,14 @@ void QJSDebuggerAgent::contextPop()
*/
void QJSDebuggerAgent::functionEntry(qint64 scriptId)
{
- Q_UNUSED(scriptId);
d->stepDepth++;
+
+ if (d->coverageEnabled) {
+ JSAgentCoverageData rd = {"COVERAGE", QJSDebugService::instance()->m_timer.elapsed(), (int)CoverageFuncEntry,
+ scriptId, QString(), QString(), 0, 0, 0, QString()};
+ QJSDebugService::instance()->processMessage(rd);
+ QJSDebugService::instance()->m_timer.restart();
+ }
}
/*!
@@ -459,9 +479,13 @@ void QJSDebuggerAgent::functionEntry(qint64 scriptId)
*/
void QJSDebuggerAgent::functionExit(qint64 scriptId, const QScriptValue &returnValue)
{
- Q_UNUSED(scriptId);
- Q_UNUSED(returnValue);
d->stepDepth--;
+
+ if (d->coverageEnabled) {
+ JSAgentCoverageData rd = {"COVERAGE", QJSDebugService::instance()->m_timer.elapsed(), (int)CoverageFuncExit,
+ scriptId, QString(), QString(), 0, 0, 0, returnValue.toString()};
+ QJSDebugService::instance()->processMessage(rd);
+ }
}
/*!
@@ -470,6 +494,12 @@ void QJSDebuggerAgent::functionExit(qint64 scriptId, const QScriptValue &returnV
void QJSDebuggerAgent::positionChange(qint64 scriptId, int lineNumber, int columnNumber)
{
d->positionChange(scriptId, lineNumber, columnNumber);
+
+ if (d->coverageEnabled) {
+ JSAgentCoverageData rd = {"COVERAGE", QJSDebugService::instance()->m_timer.elapsed(), (int)CoveragePosChange,
+ scriptId, QString(), QString(), 0, lineNumber, columnNumber, QString()};
+ QJSDebugService::instance()->processMessage(rd);
+ }
}
void QJSDebuggerAgentPrivate::positionChange(qint64 scriptId, int lineNumber, int columnNumber)
diff --git a/src/declarative/debugger/qjsdebuggeragent_p.h b/src/declarative/debugger/qjsdebuggeragent_p.h
index 4b27fc8..e999080 100644
--- a/src/declarative/debugger/qjsdebuggeragent_p.h
+++ b/src/declarative/debugger/qjsdebuggeragent_p.h
@@ -78,6 +78,17 @@ enum JSDebuggerState
StoppedState
};
+enum JSCoverageMessage {
+ CoverageLocation,
+ CoverageScriptLoad,
+ CoveragePosChange,
+ CoverageFuncEntry,
+ CoverageFuncExit,
+ CoverageComplete,
+
+ CoverageMaximumMessage
+};
+
struct JSAgentWatchData
{
QByteArray exp;
@@ -165,6 +176,7 @@ public:
void stepInto();
void stepOut();
void continueExecution();
+ void setCoverageEnabled(bool enabled);
JSAgentWatchData executeExpression(const QString &expr);
QList<JSAgentWatchData> expandObjectById(quint64 objectId);
diff --git a/src/declarative/debugger/qjsdebugservice.cpp b/src/declarative/debugger/qjsdebugservice.cpp
index ad84f65..03d1f76 100644
--- a/src/declarative/debugger/qjsdebugservice.cpp
+++ b/src/declarative/debugger/qjsdebugservice.cpp
@@ -49,10 +49,22 @@
Q_GLOBAL_STATIC(QJSDebugService, serviceInstance)
+// convert to a QByteArray that can be sent to the debug client
+QByteArray JSAgentCoverageData::toByteArray() const
+{
+ QByteArray data;
+ //### using QDataStream is relatively expensive
+ QDataStream ds(&data, QIODevice::WriteOnly);
+ ds << prefix << time << messageType << scriptId << program << fileName << baseLineNumber
+ << lineNumber << columnNumber << returnValue;
+ return data;
+}
+
QJSDebugService::QJSDebugService(QObject *parent)
: QDeclarativeDebugService(QLatin1String("JSDebugger"), parent)
- , m_agent(0)
+ , m_agent(0), m_deferredSend(true)
{
+ m_timer.start();
}
QJSDebugService::~QJSDebugService()
@@ -186,6 +198,13 @@ void QJSDebugService::messageReceived(const QByteArray &message)
QDataStream rs(&reply, QIODevice::WriteOnly);
rs << QByteArray("PONG") << ping;
sendMessage(reply);
+ } else if (command == "COVERAGE") {
+ bool enabled;
+ ds >> enabled;
+ m_agent->setCoverageEnabled(enabled);
+ if (!enabled) {
+ sendMessages();
+ }
} else {
qDebug() << Q_FUNC_INFO << "Unknown command" << command;
}
@@ -206,3 +225,35 @@ void QJSDebugService::executionStopped(bool becauseOfException,
<< becauseOfException << exception;
sendMessage(reply);
}
+
+/*
+ Either send the message directly, or queue up
+ a list of messages to send later (via sendMessages)
+*/
+void QJSDebugService::processMessage(const JSAgentCoverageData &message)
+{
+ if (m_deferredSend)
+ m_data.append(message);
+ else
+ sendMessage(message.toByteArray());
+}
+
+/*
+ Send the messages queued up by processMessage
+*/
+void QJSDebugService::sendMessages()
+{
+ if (m_deferredSend) {
+ //### this is a suboptimal way to send batched messages
+ for (int i = 0; i < m_data.count(); ++i)
+ sendMessage(m_data.at(i).toByteArray());
+ m_data.clear();
+
+ //indicate completion
+ QByteArray data;
+ QDataStream ds(&data, QIODevice::WriteOnly);
+ ds << QByteArray("COVERAGE") << (qint64)-1 << (int)CoverageComplete;
+ sendMessage(data);
+ }
+}
+
diff --git a/src/declarative/debugger/qjsdebugservice_p.h b/src/declarative/debugger/qjsdebugservice_p.h
index 7e7642e..4f99043 100644
--- a/src/declarative/debugger/qjsdebugservice_p.h
+++ b/src/declarative/debugger/qjsdebugservice_p.h
@@ -54,6 +54,7 @@
//
#include <QtCore/QPointer>
+#include <QElapsedTimer>
#include "private/qdeclarativedebugservice_p.h"
@@ -66,6 +67,23 @@ QT_MODULE(Declarative)
class QDeclarativeEngine;
class QJSDebuggerAgent;
+struct JSAgentCoverageData
+{
+ QByteArray prefix;
+ qint64 time;
+ int messageType;
+
+ qint64 scriptId;
+ QString program;
+ QString fileName;
+ int baseLineNumber;
+ int lineNumber;
+ int columnNumber;
+ QString returnValue;
+
+ QByteArray toByteArray() const;
+};
+
class QJSDebugService : public QDeclarativeDebugService
{
Q_OBJECT
@@ -78,6 +96,9 @@ public:
void addEngine(QDeclarativeEngine *);
void removeEngine(QDeclarativeEngine *);
+ void processMessage(const JSAgentCoverageData &message);
+
+ QElapsedTimer m_timer;
protected:
void statusChanged(Status status);
@@ -88,8 +109,11 @@ private Q_SLOTS:
const QString &exception);
private:
+ void sendMessages();
QList<QDeclarativeEngine *> m_engines;
QPointer<QJSDebuggerAgent> m_agent;
+ bool m_deferredSend;
+ QList<JSAgentCoverageData> m_data;
};
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
index 8787a5e..b1ebec8 100644
--- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
@@ -114,7 +114,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlproperty bool AnimatedImage::cache
- \since Quick 1.1
+ \since QtQuick 1.1
Specifies whether the image should be cached. The default value is
true. Setting \a cache to false is useful when dealing with large images,
@@ -123,7 +123,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlproperty bool AnimatedImage::mirror
- \since Quick 1.1
+ \since QtQuick 1.1
This property holds whether the image should be horizontally inverted
(effectively displaying a mirrored image).
diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
index 9c274e9..4b4efb6 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
@@ -215,7 +215,7 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage()
/*!
\qmlproperty bool BorderImage::cache
- \since Quick 1.1
+ \since QtQuick 1.1
Specifies whether the image should be cached. The default value is
true. Setting \a cache to false is useful when dealing with large images,
@@ -224,7 +224,7 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage()
/*!
\qmlproperty bool BorderImage::mirror
- \since Quick 1.1
+ \since QtQuick 1.1
This property holds whether the image should be horizontally inverted
(effectively displaying a mirrored image).
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index 13bb8ef..fd2dc45 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -168,9 +168,7 @@ QDeclarativeFlickablePrivate::QDeclarativeFlickablePrivate()
: contentItem(new QDeclarativeItem)
, hData(this, &QDeclarativeFlickablePrivate::setRoundedViewportX)
, vData(this, &QDeclarativeFlickablePrivate::setRoundedViewportY)
- , flickingHorizontally(false), flickingVertically(false)
, hMoved(false), vMoved(false)
- , movingHorizontally(false), movingVertically(false)
, stealMouse(false), pressed(false), interactive(true), calcVelocity(false)
, deceleration(QML_FLICK_DEFAULTDECELERATION)
, maxVelocity(QML_FLICK_DEFAULTMAXVELOCITY), reportedVelocitySmoothing(100)
@@ -294,18 +292,18 @@ void QDeclarativeFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal
else
timeline.accel(data.move, v, deceleration, maxDistance);
timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this));
- if (!flickingHorizontally && q->xflick()) {
- flickingHorizontally = true;
+ if (!hData.flicking && q->xflick()) {
+ hData.flicking = true;
emit q->flickingChanged();
emit q->flickingHorizontallyChanged();
- if (!flickingVertically)
+ if (!vData.flicking)
emit q->flickStarted();
}
- if (!flickingVertically && q->yflick()) {
- flickingVertically = true;
+ if (!vData.flicking && q->yflick()) {
+ vData.flicking = true;
emit q->flickingChanged();
emit q->flickingVerticallyChanged();
- if (!flickingHorizontally)
+ if (!hData.flicking)
emit q->flickStarted();
}
} else {
@@ -614,11 +612,11 @@ void QDeclarativeFlickable::setInteractive(bool interactive)
Q_D(QDeclarativeFlickable);
if (interactive != d->interactive) {
d->interactive = interactive;
- if (!interactive && (d->flickingHorizontally || d->flickingVertically)) {
+ if (!interactive && (d->hData.flicking || d->vData.flicking)) {
d->timeline.clear();
d->vTime = d->timeline.time();
- d->flickingHorizontally = false;
- d->flickingVertically = false;
+ d->hData.flicking = false;
+ d->vData.flicking = false;
emit flickingChanged();
emit flickingHorizontallyChanged();
emit flickingVerticallyChanged();
@@ -771,8 +769,8 @@ void QDeclarativeFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEven
pressPos = event->pos();
hData.pressPos = hData.move.value();
vData.pressPos = vData.move.value();
- flickingHorizontally = false;
- flickingVertically = false;
+ hData.flicking = false;
+ vData.flicking = false;
QDeclarativeItemPrivate::start(pressTime);
QDeclarativeItemPrivate::start(velocityTime);
}
@@ -897,31 +895,33 @@ void QDeclarativeFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEv
return;
// if we drag then pause before release we should not cause a flick.
- if (QDeclarativeItemPrivate::elapsed(lastPosTime) < 100) {
- vData.updateVelocity();
- hData.updateVelocity();
- } else {
- hData.velocity = 0.0;
- vData.velocity = 0.0;
- }
+ qint64 elapsed = QDeclarativeItemPrivate::elapsed(lastPosTime);
+ vData.updateVelocity();
+ hData.updateVelocity();
vTime = timeline.time();
- qreal velocity = vData.velocity;
+ qreal velocity = elapsed < 100 ? vData.velocity : 0;
if (vData.atBeginning || vData.atEnd)
velocity /= 2;
- if (qAbs(velocity) > MinimumFlickVelocity && qAbs(event->pos().y() - pressPos.y()) > FlickThreshold)
+ if (q->yflick() && qAbs(velocity) > MinimumFlickVelocity && qAbs(event->pos().y() - pressPos.y()) > FlickThreshold) {
+ velocityTimeline.reset(vData.smoothVelocity);
+ vData.smoothVelocity.setValue(-velocity);
flickY(velocity);
- else
+ } else {
fixupY();
+ }
- velocity = hData.velocity;
+ velocity = elapsed < 100 ? hData.velocity : 0;
if (hData.atBeginning || hData.atEnd)
velocity /= 2;
- if (qAbs(velocity) > MinimumFlickVelocity && qAbs(event->pos().x() - pressPos.x()) > FlickThreshold)
+ if (q->xflick() && qAbs(velocity) > MinimumFlickVelocity && qAbs(event->pos().x() - pressPos.x()) > FlickThreshold) {
+ velocityTimeline.reset(hData.smoothVelocity);
+ hData.smoothVelocity.setValue(-velocity);
flickX(velocity);
- else
+ } else {
fixupX();
+ }
if (!timeline.isActive())
q->movementEnding();
@@ -978,9 +978,9 @@ void QDeclarativeFlickable::wheelEvent(QGraphicsSceneWheelEvent *event)
valid = true;
}
if (valid) {
- d->flickingVertically = false;
+ d->vData.flicking = false;
d->flickY(d->vData.velocity);
- if (d->flickingVertically) {
+ if (d->vData.flicking) {
d->vMoved = true;
movementStarting();
}
@@ -996,9 +996,9 @@ void QDeclarativeFlickable::wheelEvent(QGraphicsSceneWheelEvent *event)
valid = true;
}
if (valid) {
- d->flickingHorizontally = false;
+ d->hData.flicking = false;
d->flickX(d->hData.velocity);
- if (d->flickingHorizontally) {
+ if (d->hData.flicking) {
d->hMoved = true;
movementStarting();
}
@@ -1121,19 +1121,25 @@ void QDeclarativeFlickable::viewportMoved()
qreal prevX = d->lastFlickablePosition.x();
qreal prevY = d->lastFlickablePosition.y();
- d->velocityTimeline.clear();
if (d->pressed || d->calcVelocity) {
int elapsed = QDeclarativeItemPrivate::restart(d->velocityTime);
if (elapsed > 0) {
qreal horizontalVelocity = (prevX - d->hData.move.value()) * 1000 / elapsed;
+ if (qAbs(horizontalVelocity) > 0) {
+ d->velocityTimeline.reset(d->hData.smoothVelocity);
+ d->velocityTimeline.move(d->hData.smoothVelocity, horizontalVelocity, d->reportedVelocitySmoothing);
+ d->velocityTimeline.move(d->hData.smoothVelocity, 0, d->reportedVelocitySmoothing);
+ }
qreal verticalVelocity = (prevY - d->vData.move.value()) * 1000 / elapsed;
- d->velocityTimeline.move(d->hData.smoothVelocity, horizontalVelocity, d->reportedVelocitySmoothing);
- d->velocityTimeline.move(d->hData.smoothVelocity, 0, d->reportedVelocitySmoothing);
- d->velocityTimeline.move(d->vData.smoothVelocity, verticalVelocity, d->reportedVelocitySmoothing);
- d->velocityTimeline.move(d->vData.smoothVelocity, 0, d->reportedVelocitySmoothing);
+ if (qAbs(verticalVelocity) > 0) {
+ d->velocityTimeline.reset(d->vData.smoothVelocity);
+ d->velocityTimeline.move(d->vData.smoothVelocity, verticalVelocity, d->reportedVelocitySmoothing);
+ d->velocityTimeline.move(d->vData.smoothVelocity, 0, d->reportedVelocitySmoothing);
+ }
}
} else {
if (d->timeline.time() > d->vTime) {
+ d->velocityTimeline.clear();
qreal horizontalVelocity = (prevX - d->hData.move.value()) * 1000 / (d->timeline.time() - d->vTime);
qreal verticalVelocity = (prevY - d->vData.move.value()) * 1000 / (d->timeline.time() - d->vTime);
d->hData.smoothVelocity.setValue(horizontalVelocity);
@@ -1141,7 +1147,7 @@ void QDeclarativeFlickable::viewportMoved()
}
}
- if (!d->vData.inOvershoot && !d->vData.fixingUp && d->flickingVertically
+ if (!d->vData.inOvershoot && !d->vData.fixingUp && d->vData.flicking
&& (d->vData.move.value() > minYExtent() || d->vData.move.value() < maxYExtent())
&& qAbs(d->vData.smoothVelocity.value()) > 100) {
// Increase deceleration if we've passed a bound
@@ -1151,7 +1157,7 @@ void QDeclarativeFlickable::viewportMoved()
d->timeline.accel(d->vData.move, -d->vData.smoothVelocity.value(), d->deceleration*QML_FLICK_OVERSHOOTFRICTION, maxDistance);
d->timeline.callback(QDeclarativeTimeLineCallback(&d->vData.move, d->fixupY_callback, d));
}
- if (!d->hData.inOvershoot && !d->hData.fixingUp && d->flickingHorizontally
+ if (!d->hData.inOvershoot && !d->hData.fixingUp && d->hData.flicking
&& (d->hData.move.value() > minXExtent() || d->hData.move.value() < maxXExtent())
&& qAbs(d->hData.smoothVelocity.value()) > 100) {
// Increase deceleration if we've passed a bound
@@ -1183,7 +1189,7 @@ void QDeclarativeFlickable::geometryChanged(const QRectF &newGeometry,
emit contentWidthChanged();
}
// Make sure that we're entirely in view.
- if (!d->pressed && !d->movingHorizontally && !d->movingVertically) {
+ if (!d->pressed && !d->hData.moving && !d->vData.moving) {
d->fixupMode = QDeclarativeFlickablePrivate::Immediate;
d->fixupX();
}
@@ -1196,7 +1202,7 @@ void QDeclarativeFlickable::geometryChanged(const QRectF &newGeometry,
emit contentHeightChanged();
}
// Make sure that we're entirely in view.
- if (!d->pressed && !d->movingHorizontally && !d->movingVertically) {
+ if (!d->pressed && !d->hData.moving && !d->vData.moving) {
d->fixupMode = QDeclarativeFlickablePrivate::Immediate;
d->fixupY();
}
@@ -1351,7 +1357,7 @@ void QDeclarativeFlickable::setContentWidth(qreal w)
else
d->contentItem->setWidth(w);
// Make sure that we're entirely in view.
- if (!d->pressed && !d->movingHorizontally && !d->movingVertically) {
+ if (!d->pressed && !d->hData.moving && !d->vData.moving) {
d->fixupMode = QDeclarativeFlickablePrivate::Immediate;
d->fixupX();
} else if (!d->pressed && d->hData.fixingUp) {
@@ -1379,7 +1385,7 @@ void QDeclarativeFlickable::setContentHeight(qreal h)
else
d->contentItem->setHeight(h);
// Make sure that we're entirely in view.
- if (!d->pressed && !d->movingHorizontally && !d->movingVertically) {
+ if (!d->pressed && !d->hData.moving && !d->vData.moving) {
d->fixupMode = QDeclarativeFlickablePrivate::Immediate;
d->fixupY();
} else if (!d->pressed && d->vData.fixingUp) {
@@ -1393,7 +1399,7 @@ void QDeclarativeFlickable::setContentHeight(qreal h)
/*!
\qmlmethod Flickable::resizeContent(real width, real height, QPointF center)
\preliminary
- \since Quick 1.1
+ \since QtQuick 1.1
Resizes the content to \a width x \a height about \a center.
@@ -1433,7 +1439,7 @@ void QDeclarativeFlickable::resizeContent(qreal w, qreal h, QPointF center)
/*!
\qmlmethod Flickable::returnToBounds()
\preliminary
- \since Quick 1.1
+ \since QtQuick 1.1
Ensures the content is within legal bounds.
@@ -1635,7 +1641,7 @@ void QDeclarativeFlickable::setFlickDeceleration(qreal deceleration)
bool QDeclarativeFlickable::isFlicking() const
{
Q_D(const QDeclarativeFlickable);
- return d->flickingHorizontally || d->flickingVertically;
+ return d->hData.flicking || d->vData.flicking;
}
/*!
@@ -1649,13 +1655,13 @@ bool QDeclarativeFlickable::isFlicking() const
bool QDeclarativeFlickable::isFlickingHorizontally() const
{
Q_D(const QDeclarativeFlickable);
- return d->flickingHorizontally;
+ return d->hData.flicking;
}
bool QDeclarativeFlickable::isFlickingVertically() const
{
Q_D(const QDeclarativeFlickable);
- return d->flickingVertically;
+ return d->vData.flicking;
}
/*!
@@ -1691,7 +1697,7 @@ void QDeclarativeFlickable::setPressDelay(int delay)
bool QDeclarativeFlickable::isMoving() const
{
Q_D(const QDeclarativeFlickable);
- return d->movingHorizontally || d->movingVertically;
+ return d->hData.moving || d->vData.moving;
}
/*!
@@ -1706,30 +1712,30 @@ bool QDeclarativeFlickable::isMoving() const
bool QDeclarativeFlickable::isMovingHorizontally() const
{
Q_D(const QDeclarativeFlickable);
- return d->movingHorizontally;
+ return d->hData.moving;
}
bool QDeclarativeFlickable::isMovingVertically() const
{
Q_D(const QDeclarativeFlickable);
- return d->movingVertically;
+ return d->vData.moving;
}
void QDeclarativeFlickable::movementStarting()
{
Q_D(QDeclarativeFlickable);
- if (d->hMoved && !d->movingHorizontally) {
- d->movingHorizontally = true;
+ if (d->hMoved && !d->hData.moving) {
+ d->hData.moving = true;
emit movingChanged();
emit movingHorizontallyChanged();
- if (!d->movingVertically)
+ if (!d->vData.moving)
emit movementStarted();
}
- else if (d->vMoved && !d->movingVertically) {
- d->movingVertically = true;
+ else if (d->vMoved && !d->vData.moving) {
+ d->vData.moving = true;
emit movingChanged();
emit movingVerticallyChanged();
- if (!d->movingHorizontally)
+ if (!d->hData.moving)
emit movementStarted();
}
}
@@ -1746,20 +1752,20 @@ void QDeclarativeFlickable::movementEnding()
void QDeclarativeFlickable::movementXEnding()
{
Q_D(QDeclarativeFlickable);
- if (d->flickingHorizontally) {
- d->flickingHorizontally = false;
+ if (d->hData.flicking) {
+ d->hData.flicking = false;
emit flickingChanged();
emit flickingHorizontallyChanged();
- if (!d->flickingVertically)
+ if (!d->vData.flicking)
emit flickEnded();
}
if (!d->pressed && !d->stealMouse) {
- if (d->movingHorizontally) {
- d->movingHorizontally = false;
+ if (d->hData.moving) {
+ d->hData.moving = false;
d->hMoved = false;
emit movingChanged();
emit movingHorizontallyChanged();
- if (!d->movingVertically)
+ if (!d->vData.moving)
emit movementEnded();
}
}
@@ -1769,20 +1775,20 @@ void QDeclarativeFlickable::movementXEnding()
void QDeclarativeFlickable::movementYEnding()
{
Q_D(QDeclarativeFlickable);
- if (d->flickingVertically) {
- d->flickingVertically = false;
+ if (d->vData.flicking) {
+ d->vData.flicking = false;
emit flickingChanged();
emit flickingVerticallyChanged();
- if (!d->flickingHorizontally)
+ if (!d->hData.flicking)
emit flickEnded();
}
if (!d->pressed && !d->stealMouse) {
- if (d->movingVertically) {
- d->movingVertically = false;
+ if (d->vData.moving) {
+ d->vData.moving = false;
d->vMoved = false;
emit movingChanged();
emit movingVerticallyChanged();
- if (!d->movingHorizontally)
+ if (!d->hData.moving)
emit movementEnded();
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
index 46b2104..d73a907 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
@@ -63,11 +63,16 @@
#include <qdeclarativeanimation_p_p.h>
#include <qdatetime.h>
+#include "qplatformdefs.h"
QT_BEGIN_NAMESPACE
// Really slow flicks can be annoying.
-const qreal MinimumFlickVelocity = 75.0;
+#ifndef QML_FLICK_MINVELOCITY
+#define QML_FLICK_MINVELOCITY 175
+#endif
+
+const qreal MinimumFlickVelocity = QML_FLICK_MINVELOCITY;
class QDeclarativeFlickableVisibleArea;
class QDeclarativeFlickablePrivate : public QDeclarativeItemPrivate, public QDeclarativeItemChangeListener
@@ -94,7 +99,7 @@ public:
struct AxisData {
AxisData(QDeclarativeFlickablePrivate *fp, void (QDeclarativeFlickablePrivate::*func)(qreal))
: move(fp, func), viewSize(-1), smoothVelocity(fp), atEnd(false), atBeginning(true)
- , fixingUp(false), inOvershoot(false)
+ , fixingUp(false), inOvershoot(false), moving(false), flicking(false)
{}
void reset() {
@@ -121,6 +126,8 @@ public:
bool atBeginning : 1;
bool fixingUp : 1;
bool inOvershoot : 1;
+ bool moving : 1;
+ bool flicking : 1;
};
void flickX(qreal velocity);
@@ -152,12 +159,8 @@ public:
AxisData vData;
QDeclarativeTimeLine timeline;
- bool flickingHorizontally : 1;
- bool flickingVertically : 1;
bool hMoved : 1;
bool vMoved : 1;
- bool movingHorizontally : 1;
- bool movingVertically : 1;
bool stealMouse : 1;
bool pressed : 1;
bool interactive : 1;
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index a0264f7..e53472d 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -52,9 +52,13 @@
#include <qmath.h>
#include <math.h>
+#include "qplatformdefs.h"
QT_BEGIN_NAMESPACE
+#ifndef QML_FLICK_SNAPONETHRESHOLD
+#define QML_FLICK_SNAPONETHRESHOLD 30
+#endif
//----------------------------------------------------------------------------
@@ -344,9 +348,12 @@ public:
Q_Q(const QDeclarativeGridView);
qreal snapPos = 0;
if (!visibleItems.isEmpty()) {
+ qreal highlightStart = isRightToLeftTopToBottom() && highlightRangeStartValid ? size()-highlightRangeEnd : highlightRangeStart;
+ pos += highlightStart;
pos += rowSize()/2;
snapPos = visibleItems.first()->rowPos() - visibleIndex / columns * rowSize();
snapPos = pos - fmodf(pos - snapPos, qreal(rowSize()));
+ snapPos -= highlightStart;
qreal maxExtent;
qreal minExtent;
if (isRightToLeftTopToBottom()) {
@@ -874,7 +881,7 @@ void QDeclarativeGridViewPrivate::updateHighlight()
{
if ((!currentItem && highlight) || (currentItem && !highlight))
createHighlight();
- if (currentItem && autoHighlight && highlight && !movingHorizontally && !movingVertically) {
+ if (currentItem && autoHighlight && highlight && !hData.moving && !vData.moving) {
// auto-update highlight
highlightXAnimator->to = currentItem->item->x();
highlightYAnimator->to = currentItem->item->y();
@@ -1061,6 +1068,18 @@ void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
if (snapMode != QDeclarativeGridView::NoSnap) {
qreal tempPosition = isRightToLeftTopToBottom() ? -position()-size() : position();
+ if (snapMode == QDeclarativeGridView::SnapOneRow && moveReason == Mouse) {
+ // if we've been dragged < rowSize()/2 then bias towards the next row
+ qreal dist = data.move.value() - (data.pressPos - data.dragStartOffset);
+ qreal bias = 0;
+ if (data.velocity > 0 && dist > QML_FLICK_SNAPONETHRESHOLD && dist < rowSize()/2)
+ bias = rowSize()/2;
+ else if (data.velocity < 0 && dist < -QML_FLICK_SNAPONETHRESHOLD && dist > -rowSize()/2)
+ bias = -rowSize()/2;
+ if (isRightToLeftTopToBottom())
+ bias = -bias;
+ tempPosition -= bias;
+ }
FxGridItem *topItem = snapItemAt(tempPosition+highlightStart);
FxGridItem *bottomItem = snapItemAt(tempPosition+highlightEnd);
qreal pos;
@@ -1082,25 +1101,13 @@ void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
}
} else if (bottomItem) {
if (isRightToLeftTopToBottom())
- pos = qMax(qMin(-bottomItem->rowPos() + highlightStart - size(), -maxExtent), -minExtent);
+ pos = qMax(qMin(-bottomItem->rowPos() + highlightEnd - size(), -maxExtent), -minExtent);
else
- pos = qMax(qMin(bottomItem->rowPos() - highlightStart, -maxExtent), -minExtent);
+ pos = qMax(qMin(bottomItem->rowPos() - highlightEnd, -maxExtent), -minExtent);
} else {
QDeclarativeFlickablePrivate::fixup(data, minExtent, maxExtent);
return;
}
- if (currentItem && haveHighlightRange && highlightRange == QDeclarativeGridView::StrictlyEnforceRange) {
- updateHighlight();
- qreal currPos = currentItem->rowPos();
- if (isRightToLeftTopToBottom())
- pos = -pos-size(); // Transform Pos if required
- if (pos < currPos + rowSize() - highlightEnd)
- pos = currPos + rowSize() - highlightEnd;
- if (pos > currPos - highlightStart)
- pos = currPos - highlightStart;
- if (isRightToLeftTopToBottom())
- pos = -pos-size(); // Untransform
- }
qreal dist = qAbs(data.move + pos);
if (dist > 0) {
timeline.reset(data.move);
@@ -1157,9 +1164,14 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
if (velocity > 0) {
if (data.move.value() < minExtent) {
if (snapMode == QDeclarativeGridView::SnapOneRow) {
- if (FxGridItem *item = firstVisibleItem()) {
- maxDistance = qAbs(item->rowPos() + dataValue);
- }
+ // if we've been dragged < averageSize/2 then bias towards the next item
+ qreal dist = data.move.value() - (data.pressPos - data.dragStartOffset);
+ qreal bias = dist < rowSize()/2 ? rowSize()/2 : 0;
+ if (isRightToLeftTopToBottom())
+ bias = -bias;
+ data.flickTarget = -snapPosAt(-dataValue - bias);
+ maxDistance = qAbs(data.flickTarget - data.move.value());
+ velocity = maxVelocity;
} else {
maxDistance = qAbs(minExtent - data.move.value());
}
@@ -1169,8 +1181,14 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
} else {
if (data.move.value() > maxExtent) {
if (snapMode == QDeclarativeGridView::SnapOneRow) {
- qreal pos = snapPosAt(-dataValue) + (isRightToLeftTopToBottom() ? 0 : rowSize());
- maxDistance = qAbs(pos + dataValue);
+ // if we've been dragged < averageSize/2 then bias towards the next item
+ qreal dist = data.move.value() - (data.pressPos - data.dragStartOffset);
+ qreal bias = -dist < rowSize()/2 ? rowSize()/2 : 0;
+ if (isRightToLeftTopToBottom())
+ bias = -bias;
+ data.flickTarget = -snapPosAt(-dataValue + bias);
+ maxDistance = qAbs(data.flickTarget - data.move.value());
+ velocity = -maxVelocity;
} else {
maxDistance = qAbs(maxExtent - data.move.value());
}
@@ -1180,7 +1198,6 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
}
bool overShoot = boundsBehavior == QDeclarativeFlickable::DragAndOvershootBounds;
- qreal highlightStart = isRightToLeftTopToBottom() && highlightRangeStartValid ? size()-highlightRangeEnd : highlightRangeStart;
if (maxDistance > 0 || overShoot) {
// This mode requires the grid to stop exactly on a row boundary.
@@ -1200,9 +1217,20 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
dist = qMin(dist, maxDistance);
if (v > 0)
dist = -dist;
- qreal distTemp = isRightToLeftTopToBottom() ? -dist : dist;
- data.flickTarget = -snapPosAt(-(dataValue - highlightStart) + distTemp) + highlightStart;
+ if (snapMode != QDeclarativeGridView::SnapOneRow) {
+ qreal distTemp = isRightToLeftTopToBottom() ? -dist : dist;
+ data.flickTarget = -snapPosAt(-dataValue + distTemp);
+ }
data.flickTarget = isRightToLeftTopToBottom() ? -data.flickTarget+size() : data.flickTarget;
+ if (overShoot) {
+ if (data.flickTarget >= minExtent) {
+ overshootDist = overShootDistance(vSize);
+ data.flickTarget += overshootDist;
+ } else if (data.flickTarget <= maxExtent) {
+ overshootDist = overShootDistance(vSize);
+ data.flickTarget -= overshootDist;
+ }
+ }
qreal adjDist = -data.flickTarget + data.move.value();
if (qAbs(adjDist) > qAbs(dist)) {
// Prevent painfully slow flicking - adjust velocity to suit flickDeceleration
@@ -1223,14 +1251,14 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
timeline.reset(data.move);
timeline.accel(data.move, v, accel, maxDistance + overshootDist);
timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this));
- if (!flickingHorizontally && q->xflick()) {
- flickingHorizontally = true;
+ if (!hData.flicking && q->xflick()) {
+ hData.flicking = true;
emit q->flickingChanged();
emit q->flickingHorizontallyChanged();
emit q->flickStarted();
}
- if (!flickingVertically && q->yflick()) {
- flickingVertically = true;
+ if (!vData.flicking && q->yflick()) {
+ vData.flicking = true;
emit q->flickingChanged();
emit q->flickingVerticallyChanged();
emit q->flickStarted();
@@ -1554,6 +1582,8 @@ void QDeclarativeGridView::setCurrentIndex(int index)
if (index == d->currentIndex)
return;
if (isComponentComplete() && d->isValid()) {
+ if (d->layoutScheduled)
+ d->layout();
d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
d->updateCurrent(index);
} else {
@@ -2098,7 +2128,8 @@ bool QDeclarativeGridView::event(QEvent *event)
{
Q_D(QDeclarativeGridView);
if (event->type() == QEvent::User) {
- d->layout();
+ if (d->layoutScheduled)
+ d->layout();
return true;
}
@@ -2112,7 +2143,7 @@ void QDeclarativeGridView::viewportMoved()
if (!d->itemCount)
return;
d->lazyRelease = true;
- if (d->flickingHorizontally || d->flickingVertically) {
+ if (d->hData.flicking || d->vData.flicking) {
if (yflick()) {
if (d->vData.velocity > 0)
d->bufferMode = QDeclarativeGridViewPrivate::BufferBefore;
@@ -2128,7 +2159,7 @@ void QDeclarativeGridView::viewportMoved()
}
}
refill();
- if (d->flickingHorizontally || d->flickingVertically || d->movingHorizontally || d->movingVertically)
+ if (d->hData.flicking || d->vData.flicking || d->hData.moving || d->vData.moving)
d->moveReason = QDeclarativeGridViewPrivate::Mouse;
if (d->moveReason != QDeclarativeGridViewPrivate::SetIndex) {
if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange && d->highlight) {
@@ -2587,7 +2618,7 @@ void QDeclarativeGridView::positionViewAtIndex(int index, int mode)
/*!
\qmlmethod GridView::positionViewAtBeginning()
\qmlmethod GridView::positionViewAtEnd()
- \since Quick 1.1
+ \since QtQuick 1.1
Positions the view at the beginning or end, taking into account any header or footer.
@@ -2874,7 +2905,6 @@ void QDeclarativeGridView::itemsRemoved(int modelIndex, int count)
d->itemCount -= count;
bool currentRemoved = d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count;
bool removedVisible = false;
-
// Remove the items from the visible list, skipping anything already marked for removal
QList<FxGridItem*>::Iterator it = d->visibleItems.begin();
while (it != d->visibleItems.end()) {
@@ -2908,6 +2938,11 @@ void QDeclarativeGridView::itemsRemoved(int modelIndex, int count)
}
}
+ // If we removed items before visible items a layout may be
+ // required to ensure item 0 is in the first column.
+ if (!removedVisible && modelIndex < d->visibleIndex)
+ d->scheduleLayout();
+
// fix current
if (d->currentIndex >= modelIndex + count) {
d->currentIndex -= count;
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index e6bb798..9b9d680 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -473,7 +473,7 @@ QRectF QDeclarativeImage::boundingRect() const
/*!
\qmlproperty bool Image::cache
- \since Quick 1.1
+ \since QtQuick 1.1
Specifies whether the image should be cached. The default value is
true. Setting \a cache to false is useful when dealing with large images,
@@ -482,7 +482,7 @@ QRectF QDeclarativeImage::boundingRect() const
/*!
\qmlproperty bool Image::mirror
- \since Quick 1.1
+ \since QtQuick 1.1
This property holds whether the image should be horizontally inverted
(effectively displaying a mirrored image).
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 805ca4d..d36d163 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -3480,7 +3480,7 @@ qreal QDeclarativeItem::implicitHeight() const
/*!
\qmlproperty real Item::implicitWidth
\qmlproperty real Item::implicitHeight
- \since Quick 1.1
+ \since QtQuick 1.1
Defines the natural width or height of the Item if no \l width or \l height is specified.
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 7a5e433..f0fc96b 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -53,9 +53,14 @@
#include <qlistmodelinterface_p.h>
#include <qmath.h>
#include <QKeyEvent>
+#include "qplatformdefs.h"
QT_BEGIN_NAMESPACE
+#ifndef QML_FLICK_SNAPONETHRESHOLD
+#define QML_FLICK_SNAPONETHRESHOLD 30
+#endif
+
void QDeclarativeViewSection::setProperty(const QString &property)
{
if (property != m_property) {
@@ -234,21 +239,6 @@ public:
return visibleItems.count() ? visibleItems.first() : 0;
}
- FxListItem *nextVisibleItem() const {
- const qreal pos = isRightToLeft() ? -position()-size() : position();
- bool foundFirst = false;
- for (int i = 0; i < visibleItems.count(); ++i) {
- FxListItem *item = visibleItems.at(i);
- if (item->index != -1) {
- if (foundFirst)
- return item;
- else if (item->position() < pos && item->endPosition() > pos)
- foundFirst = true;
- }
- }
- return 0;
- }
-
// Returns the item before modelIndex, if created.
// May return an item marked for removal.
FxListItem *itemBefore(int modelIndex) const {
@@ -1009,7 +999,7 @@ void QDeclarativeListViewPrivate::updateHighlight()
{
if ((!currentItem && highlight) || (currentItem && !highlight))
createHighlight();
- if (currentItem && autoHighlight && highlight && !movingHorizontally && !movingVertically) {
+ if (currentItem && autoHighlight && highlight && !hData.moving && !vData.moving) {
// auto-update highlight
highlightPosAnimator->to = isRightToLeft()
? -currentItem->itemPosition()-currentItem->itemSize()
@@ -1320,29 +1310,20 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
highlightEnd = highlightRangeEnd;
}
- if (currentItem && haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange
- && moveReason != QDeclarativeListViewPrivate::SetIndex) {
- updateHighlight();
- qreal pos = currentItem->itemPosition();
- if (viewPos < pos + currentItem->itemSize() - highlightEnd)
- viewPos = pos + currentItem->itemSize() - highlightEnd;
- if (viewPos > pos - highlightStart)
- viewPos = pos - highlightStart;
- if (isRightToLeft())
- viewPos = -viewPos-size();
-
- timeline.reset(data.move);
- if (viewPos != position()) {
- if (fixupMode != Immediate) {
- timeline.move(data.move, -viewPos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2);
- data.fixingUp = true;
- } else {
- timeline.set(data.move, -viewPos);
- }
- }
- vTime = timeline.time();
- } else if (snapMode != QDeclarativeListView::NoSnap && moveReason != QDeclarativeListViewPrivate::SetIndex) {
+ if (snapMode != QDeclarativeListView::NoSnap && moveReason != QDeclarativeListViewPrivate::SetIndex) {
qreal tempPosition = isRightToLeft() ? -position()-size() : position();
+ if (snapMode == QDeclarativeListView::SnapOneItem && moveReason == Mouse) {
+ // if we've been dragged < averageSize/2 then bias towards the next item
+ qreal dist = data.move.value() - (data.pressPos - data.dragStartOffset);
+ qreal bias = 0;
+ if (data.velocity > 0 && dist > QML_FLICK_SNAPONETHRESHOLD && dist < averageSize/2)
+ bias = averageSize/2;
+ else if (data.velocity < 0 && dist < -QML_FLICK_SNAPONETHRESHOLD && dist > -averageSize/2)
+ bias = -averageSize/2;
+ if (isRightToLeft())
+ bias = -bias;
+ tempPosition -= bias;
+ }
FxListItem *topItem = snapItemAt(tempPosition+highlightStart);
FxListItem *bottomItem = snapItemAt(tempPosition+highlightEnd);
qreal pos;
@@ -1358,9 +1339,9 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
}
} else if (bottomItem && isInBounds) {
if (isRightToLeft())
- pos = qMax(qMin(-bottomItem->position() + highlightStart - size(), -maxExtent), -minExtent);
+ pos = qMax(qMin(-bottomItem->position() + highlightEnd - size(), -maxExtent), -minExtent);
else
- pos = qMax(qMin(bottomItem->position() - highlightStart, -maxExtent), -minExtent);
+ pos = qMax(qMin(bottomItem->position() - highlightEnd, -maxExtent), -minExtent);
} else {
QDeclarativeFlickablePrivate::fixup(data, minExtent, maxExtent);
return;
@@ -1377,6 +1358,27 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
}
vTime = timeline.time();
}
+ } else if (currentItem && haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange
+ && moveReason != QDeclarativeListViewPrivate::SetIndex) {
+ updateHighlight();
+ qreal pos = currentItem->itemPosition();
+ if (viewPos < pos + currentItem->itemSize() - highlightEnd)
+ viewPos = pos + currentItem->itemSize() - highlightEnd;
+ if (viewPos > pos - highlightStart)
+ viewPos = pos - highlightStart;
+ if (isRightToLeft())
+ viewPos = -viewPos-size();
+
+ timeline.reset(data.move);
+ if (viewPos != position()) {
+ if (fixupMode != Immediate) {
+ timeline.move(data.move, -viewPos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2);
+ data.fixingUp = true;
+ } else {
+ timeline.set(data.move, -viewPos);
+ }
+ }
+ vTime = timeline.time();
} else {
QDeclarativeFlickablePrivate::fixup(data, minExtent, maxExtent);
}
@@ -1398,12 +1400,19 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
}
qreal maxDistance = 0;
qreal dataValue = isRightToLeft() ? -data.move.value()+size() : data.move.value();
+ qreal highlightStart = isRightToLeft() && highlightRangeStartValid ? size()-highlightRangeEnd : highlightRangeStart;
// -ve velocity means list is moving up/left
if (velocity > 0) {
if (data.move.value() < minExtent) {
- if (snapMode == QDeclarativeListView::SnapOneItem) {
- if (FxListItem *item = isRightToLeft() ? nextVisibleItem() : firstVisibleItem())
- maxDistance = qAbs(item->position() + dataValue);
+ if (snapMode == QDeclarativeListView::SnapOneItem && !hData.flicking && !vData.flicking) {
+ // if we've been dragged < averageSize/2 then bias towards the next item
+ qreal dist = data.move.value() - (data.pressPos - data.dragStartOffset);
+ qreal bias = dist < averageSize/2 ? averageSize/2 : 0;
+ if (isRightToLeft())
+ bias = -bias;
+ data.flickTarget = -snapPosAt(-(dataValue - highlightStart) - bias) + highlightStart;
+ maxDistance = qAbs(data.flickTarget - data.move.value());
+ velocity = maxVelocity;
} else {
maxDistance = qAbs(minExtent - data.move.value());
}
@@ -1412,9 +1421,15 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
data.flickTarget = minExtent;
} else {
if (data.move.value() > maxExtent) {
- if (snapMode == QDeclarativeListView::SnapOneItem) {
- if (FxListItem *item = isRightToLeft() ? firstVisibleItem() : nextVisibleItem())
- maxDistance = qAbs(item->position() + dataValue);
+ if (snapMode == QDeclarativeListView::SnapOneItem && !hData.flicking && !vData.flicking) {
+ // if we've been dragged < averageSize/2 then bias towards the next item
+ qreal dist = data.move.value() - (data.pressPos - data.dragStartOffset);
+ qreal bias = -dist < averageSize/2 ? averageSize/2 : 0;
+ if (isRightToLeft())
+ bias = -bias;
+ data.flickTarget = -snapPosAt(-(dataValue - highlightStart) + bias) + highlightStart;
+ maxDistance = qAbs(data.flickTarget - data.move.value());
+ velocity = -maxVelocity;
} else {
maxDistance = qAbs(maxExtent - data.move.value());
}
@@ -1424,7 +1439,6 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
}
bool overShoot = boundsBehavior == QDeclarativeFlickable::DragAndOvershootBounds;
- qreal highlightStart = isRightToLeft() && highlightRangeStartValid ? size()-highlightRangeEnd : highlightRangeStart;
if (maxDistance > 0 || overShoot) {
// These modes require the list to stop exactly on an item boundary.
@@ -1438,7 +1452,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
else
v = maxVelocity;
}
- if (!flickingHorizontally && !flickingVertically) {
+ if (!hData.flicking && !vData.flicking) {
// the initial flick - estimate boundary
qreal accel = deceleration;
qreal v2 = v * v;
@@ -1450,8 +1464,10 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
if (v > 0)
dist = -dist;
if ((maxDistance > 0.0 && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeListView::SnapOneItem) {
- qreal distTemp = isRightToLeft() ? -dist : dist;
- data.flickTarget = -snapPosAt(-(dataValue - highlightStart) + distTemp) + highlightStart;
+ if (snapMode != QDeclarativeListView::SnapOneItem) {
+ qreal distTemp = isRightToLeft() ? -dist : dist;
+ data.flickTarget = -snapPosAt(-(dataValue - highlightStart) + distTemp) + highlightStart;
+ }
data.flickTarget = isRightToLeft() ? -data.flickTarget+size() : data.flickTarget;
if (overShoot) {
if (data.flickTarget >= minExtent) {
@@ -1489,14 +1505,14 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
timeline.reset(data.move);
timeline.accel(data.move, v, accel, maxDistance + overshootDist);
timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this));
- if (!flickingHorizontally && q->xflick()) {
- flickingHorizontally = true;
+ if (!hData.flicking && q->xflick()) {
+ hData.flicking = true;
emit q->flickingChanged();
emit q->flickingHorizontallyChanged();
emit q->flickStarted();
}
- if (!flickingVertically && q->yflick()) {
- flickingVertically = true;
+ if (!vData.flicking && q->yflick()) {
+ vData.flicking = true;
emit q->flickingChanged();
emit q->flickingVerticallyChanged();
emit q->flickStarted();
@@ -1872,6 +1888,8 @@ void QDeclarativeListView::setCurrentIndex(int index)
if (index == d->currentIndex)
return;
if (isComponentComplete() && d->isValid()) {
+ if (d->layoutScheduled)
+ d->layout();
d->moveReason = QDeclarativeListViewPrivate::SetIndex;
d->updateCurrent(index);
} else if (d->currentIndex != index) {
@@ -2557,7 +2575,8 @@ bool QDeclarativeListView::event(QEvent *event)
{
Q_D(QDeclarativeListView);
if (event->type() == QEvent::User) {
- d->layout();
+ if (d->layoutScheduled)
+ d->layout();
return true;
}
@@ -2576,7 +2595,7 @@ void QDeclarativeListView::viewportMoved()
d->inViewportMoved = true;
d->lazyRelease = true;
refill();
- if (d->flickingHorizontally || d->flickingVertically || d->movingHorizontally || d->movingVertically)
+ if (d->hData.flicking || d->vData.flicking || d->hData.moving || d->vData.moving)
d->moveReason = QDeclarativeListViewPrivate::Mouse;
if (d->moveReason != QDeclarativeListViewPrivate::SetIndex) {
if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange && d->highlight) {
@@ -2610,7 +2629,7 @@ void QDeclarativeListView::viewportMoved()
}
}
- if ((d->flickingHorizontally || d->flickingVertically) && d->correctFlick && !d->inFlickCorrection) {
+ if ((d->hData.flicking || d->vData.flicking) && d->correctFlick && !d->inFlickCorrection) {
d->inFlickCorrection = true;
// Near an end and it seems that the extent has changed?
// Recalculate the flick so that we don't end up in an odd position.
@@ -3009,7 +3028,7 @@ void QDeclarativeListView::positionViewAtIndex(int index, int mode)
/*!
\qmlmethod ListView::positionViewAtBeginning()
\qmlmethod ListView::positionViewAtEnd()
- \since Quick 1.1
+ \since QtQuick 1.1
Positions the view at the beginning or end, taking into account any header or footer.
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index 18f008a..0e06a4c 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -419,7 +419,7 @@ void QDeclarativeMouseArea::setEnabled(bool a)
/*!
\qmlproperty bool MouseArea::preventStealing
- \since Quick 1.1
+ \since QtQuick 1.1
This property holds whether the mouse events may be stolen from this
MouseArea.
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
index f3d1a68..483cad4 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
@@ -584,7 +584,7 @@ QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent)
/*!
\qmlproperty enumeration Row::layoutDirection
- \since Quick 1.1
+ \since QtQuick 1.1
This property holds the layoutDirection of the row.
@@ -878,7 +878,7 @@ void QDeclarativeGrid::setFlow(Flow flow)
/*!
\qmlproperty enumeration Grid::layoutDirection
- \since Quick 1.1
+ \since QtQuick 1.1
This property holds the layout direction of the layout.
@@ -1236,7 +1236,7 @@ void QDeclarativeFlow::setFlow(Flow flow)
/*!
\qmlproperty enumeration Flow::layoutDirection
- \since Quick 1.1
+ \since QtQuick 1.1
This property holds the layout direction of the layout.
diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp
index 813c255..e881b96 100644
--- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp
@@ -128,7 +128,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate()
/*!
\qmlsignal Repeater::onItemAdded(int index, Item item)
- \since Quick 1.1
+ \since QtQuick 1.1
This handler is called when an item is added to the repeater. The \a index
parameter holds the index at which the item has been inserted within the
@@ -137,7 +137,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate()
/*!
\qmlsignal Repeater::onItemRemoved(int index, Item item)
- \since Quick 1.1
+ \since QtQuick 1.1
This handler is called when an item is removed from the repeater. The \a index
parameter holds the index at which the item was removed from the repeater,
@@ -306,7 +306,7 @@ int QDeclarativeRepeater::count() const
/*!
\qmlmethod Item Repeater::itemAt(index)
- \since Quick 1.1
+ \since QtQuick 1.1
Returns the \l Item that has been created at the given \a index, or \c null
if no item exists at \a index.
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 54ff406..20e4eef 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -1190,7 +1190,7 @@ void QDeclarativeText::setWrapMode(WrapMode mode)
/*!
\qmlproperty int Text::lineCount
- \since Quick 1.1
+ \since QtQuick 1.1
Returns the number of lines visible in the text item.
@@ -1206,7 +1206,7 @@ int QDeclarativeText::lineCount() const
/*!
\qmlproperty bool Text::truncated
- \since Quick 1.1
+ \since QtQuick 1.1
Returns true if the text has been truncated due to \l maximumLineCount
or \l elide.
@@ -1223,7 +1223,7 @@ bool QDeclarativeText::truncated() const
/*!
\qmlproperty int Text::maximumLineCount
- \since Quick 1.1
+ \since QtQuick 1.1
Set this property to limit the number of lines that the text item will show.
If elide is set to Text.ElideRight, the text will be elided appropriately.
@@ -1457,7 +1457,7 @@ qreal QDeclarativeText::paintedHeight() const
/*!
\qmlproperty real Text::lineHeight
- \since Quick 1.1
+ \since QtQuick 1.1
Sets the line height for the text.
The value can be in pixels or a multiplier depending on lineHeightMode.
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 20b2e76..ca7e948 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -107,7 +107,7 @@ TextEdit {
/*!
\qmlsignal TextEdit::onLinkActivated(string link)
- \since Quick 1.1
+ \since QtQuick 1.1
This handler is called when the user clicks on a link embedded in the text.
The link must be in rich text or HTML format and the
@@ -615,7 +615,7 @@ void QDeclarativeTextEdit::setWrapMode(WrapMode mode)
/*!
\qmlproperty int TextEdit::lineCount
- \since Quick 1.1
+ \since QtQuick 1.1
Returns the total number of lines in the textEdit item.
*/
@@ -709,7 +709,7 @@ void QDeclarativeTextEdit::moveCursorSelection(int pos)
/*!
\qmlmethod void TextEdit::moveCursorSelection(int position, SelectionMode mode = TextEdit.SelectCharacters)
- \since Quick 1.1
+ \since QtQuick 1.1
Moves the cursor to \a position and updates the selection according to the optional \a mode
parameter. (To only move the cursor, set the \l cursorPosition property.)
@@ -1074,7 +1074,7 @@ void QDeclarativeTextEdit::setSelectByMouse(bool on)
/*!
\qmlproperty enum TextEdit::mouseSelectionMode
- \since Quick 1.1
+ \since QtQuick 1.1
Specifies how text should be selected using a mouse.
@@ -1220,7 +1220,7 @@ void QDeclarativeTextEditPrivate::focusChanged(bool hasFocus)
/*!
\qmlmethod void TextEdit::deselect()
- \since Quick 1.1
+ \since QtQuick 1.1
Removes active text selection.
*/
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index d2897eb..7014571 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -1014,7 +1014,7 @@ int QDeclarativeTextInput::positionAt(int x) const
/*!
\qmlmethod int TextInput::positionAt(int x, CursorPosition position = CursorBetweenCharacters)
- \since Quick 1.1
+ \since QtQuick 1.1
This function returns the character position at
x pixels from the left of the textInput. Position 0 is before the
@@ -1402,7 +1402,7 @@ QVariant QDeclarativeTextInput::inputMethodQuery(Qt::InputMethodQuery property)
/*!
\qmlmethod void TextInput::deselect()
- \since Quick 1.1
+ \since QtQuick 1.1
Removes active text selection.
*/
@@ -1574,7 +1574,7 @@ void QDeclarativeTextInput::setSelectByMouse(bool on)
/*!
\qmlproperty enum TextInput::mouseSelectionMode
- \since Quick 1.1
+ \since QtQuick 1.1
Specifies how text should be selected using a mouse.
@@ -1622,7 +1622,7 @@ void QDeclarativeTextInput::moveCursorSelection(int position)
/*!
\qmlmethod void TextInput::moveCursorSelection(int position, SelectionMode mode = TextInput.SelectCharacters)
- \since Quick 1.1
+ \since QtQuick 1.1
Moves the cursor to \a position and updates the selection according to the optional \a mode
parameter. (To only move the cursor, set the \l cursorPosition property.)
diff --git a/src/gui/accessible/qaccessible2.cpp b/src/gui/accessible/qaccessible2.cpp
index 35b24f6..078ff13 100644
--- a/src/gui/accessible/qaccessible2.cpp
+++ b/src/gui/accessible/qaccessible2.cpp
@@ -42,6 +42,7 @@
#include "qaccessible2.h"
#include "qapplication.h"
#include "qclipboard.h"
+#include "qtextboundaryfinder.h"
#ifndef QT_NO_ACCESSIBILITY
@@ -132,6 +133,117 @@ QT_BEGIN_NAMESPACE
\link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
*/
+
+/*!
+ \internal
+*/
+QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset, const QString& text)
+{
+ QTextBoundaryFinder::BoundaryType type;
+ switch (boundaryType) {
+ case QAccessible2::CharBoundary:
+ type = QTextBoundaryFinder::Grapheme;
+ break;
+ case QAccessible2::WordBoundary:
+ type = QTextBoundaryFinder::Word;
+ break;
+ case QAccessible2::SentenceBoundary:
+ type = QTextBoundaryFinder::Sentence;
+ break;
+ default:
+ // in any other case return the whole line
+ *startOffset = 0;
+ *endOffset = text.length();
+ return text;
+ }
+
+ QTextBoundaryFinder boundary(type, text);
+ boundary.setPosition(offset);
+
+ if (!boundary.isAtBoundary()) {
+ boundary.toPreviousBoundary();
+ }
+ boundary.toPreviousBoundary();
+ *startOffset = boundary.position();
+ boundary.toNextBoundary();
+ *endOffset = boundary.position();
+
+ return text.mid(*startOffset, *endOffset - *startOffset);
+}
+
+/*!
+ \internal
+*/
+QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset, const QString& text)
+{
+ QTextBoundaryFinder::BoundaryType type;
+ switch (boundaryType) {
+ case QAccessible2::CharBoundary:
+ type = QTextBoundaryFinder::Grapheme;
+ break;
+ case QAccessible2::WordBoundary:
+ type = QTextBoundaryFinder::Word;
+ break;
+ case QAccessible2::SentenceBoundary:
+ type = QTextBoundaryFinder::Sentence;
+ break;
+ default:
+ // in any other case return the whole line
+ *startOffset = 0;
+ *endOffset = text.length();
+ return text;
+ }
+
+ QTextBoundaryFinder boundary(type, text);
+ boundary.setPosition(offset);
+
+ boundary.toNextBoundary();
+ *startOffset = boundary.position();
+ boundary.toNextBoundary();
+ *endOffset = boundary.position();
+
+ return text.mid(*startOffset, *endOffset - *startOffset);
+}
+
+/*!
+ \internal
+*/
+QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset, const QString& text)
+{
+ QTextBoundaryFinder::BoundaryType type;
+ switch (boundaryType) {
+ case QAccessible2::CharBoundary:
+ type = QTextBoundaryFinder::Grapheme;
+ break;
+ case QAccessible2::WordBoundary:
+ type = QTextBoundaryFinder::Word;
+ break;
+ case QAccessible2::SentenceBoundary:
+ type = QTextBoundaryFinder::Sentence;
+ break;
+ default:
+ // in any other case return the whole line
+ *startOffset = 0;
+ *endOffset = text.length();
+ return text;
+ }
+
+ QTextBoundaryFinder boundary(type, text);
+ boundary.setPosition(offset);
+
+ if (!boundary.isAtBoundary()) {
+ boundary.toPreviousBoundary();
+ }
+ *startOffset = boundary.position();
+ boundary.toNextBoundary();
+ *endOffset = boundary.position();
+
+ return text.mid(*startOffset, *endOffset - *startOffset);
+}
+
QAccessibleSimpleEditableTextInterface::QAccessibleSimpleEditableTextInterface(
QAccessibleInterface *accessibleInterface)
: iface(accessibleInterface)
diff --git a/src/gui/dialogs/qerrormessage.cpp b/src/gui/dialogs/qerrormessage.cpp
index 890e6ca..0a6580a 100644
--- a/src/gui/dialogs/qerrormessage.cpp
+++ b/src/gui/dialogs/qerrormessage.cpp
@@ -249,12 +249,20 @@ QErrorMessage::QErrorMessage(QWidget * parent)
d->icon->setPixmap(QMessageBox::standardIcon(QMessageBox::Information));
d->icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
#endif
- grid->addWidget(d->icon, 0, 0, Qt::AlignTop);
+#ifdef Q_WS_S60
+ //In Symbian, messagebox icons are in LtR UIs on right. Thus, layout needs to switch icon and text columns.
+ const int preferredIconColumn = (QApplication::layoutDirection() == Qt::LeftToRight) ? 1 : 0;
+ const int preferredTextColumn = (QApplication::layoutDirection() == Qt::LeftToRight) ? 0 : 1;
+#else
+ const int preferredIconColumn = 0;
+ const int preferredTextColumn = 1;
+#endif
+ grid->addWidget(d->icon, 0, preferredIconColumn, Qt::AlignTop);
d->errors = new QErrorMessageTextView(this);
- grid->addWidget(d->errors, 0, 1);
+ grid->addWidget(d->errors, 0, preferredTextColumn);
d->again = new QCheckBox(this);
d->again->setChecked(true);
- grid->addWidget(d->again, 1, 1, Qt::AlignTop);
+ grid->addWidget(d->again, 1, preferredTextColumn, Qt::AlignTop);
d->ok = new QPushButton(this);
#ifdef QT_SOFTKEYS_ENABLED
d->okAction = new QAction(d->ok);
@@ -270,7 +278,7 @@ QErrorMessage::QErrorMessage(QWidget * parent)
connect(d->ok, SIGNAL(clicked()), this, SLOT(accept()));
d->ok->setFocus();
grid->addWidget(d->ok, 2, 0, 1, 2, Qt::AlignCenter);
- grid->setColumnStretch(1, 42);
+ grid->setColumnStretch(preferredTextColumn, 42);
grid->setRowStretch(0, 42);
d->retranslateStrings();
}
diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp
index 90ca080..a2f086b 100644
--- a/src/gui/dialogs/qmessagebox.cpp
+++ b/src/gui/dialogs/qmessagebox.cpp
@@ -259,8 +259,15 @@ void QMessageBoxPrivate::init(const QString &title, const QString &text)
QGridLayout *grid = new QGridLayout;
#ifndef Q_WS_MAC
- grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop);
- grid->addWidget(label, 0, 1, 1, 1);
+#ifdef Q_WS_S60
+ const int preferredIconColumn = (QApplication::layoutDirection() == Qt::LeftToRight) ? 1 : 0;
+ const int preferredTextColumn = (QApplication::layoutDirection() == Qt::LeftToRight) ? 0 : 1;
+#else
+ const int preferredIconColumn = 0;
+ const int preferredTextColumn = 1;
+#endif
+ grid->addWidget(iconLabel, 0, preferredIconColumn, 2, 1, Qt::AlignTop);
+ grid->addWidget(label, 0, preferredTextColumn, 1, 1);
// -- leave space for information label --
grid->addWidget(buttonBox, 2, 0, 1, 2);
#else
@@ -2500,7 +2507,12 @@ void QMessageBox::setInformativeText(const QString &text)
label->hide();
QTextBrowser *textBrowser = new QTextBrowser(this);
textBrowser->setOpenExternalLinks(true);
- grid->addWidget(textBrowser, 1, 1, 1, 1);
+#if defined(Q_OS_SYMBIAN)
+ const int preferredTextColumn = (QApplication::layoutDirection() == Qt::LeftToRight) ? 0 : 1;
+#else
+ const int preferredTextColumn = 1;
+#endif
+ grid->addWidget(textBrowser, 1, preferredTextColumn, 1, 1);
d->textBrowser = textBrowser;
#else
grid->addWidget(label, 1, 1, 1, 1);
diff --git a/src/gui/graphicsview/qgraphicsgridlayout.cpp b/src/gui/graphicsview/qgraphicsgridlayout.cpp
index 2fbfc5d..fb4bd32 100644
--- a/src/gui/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsgridlayout.cpp
@@ -600,6 +600,8 @@ void QGraphicsGridLayout::removeAt(int index)
}
/*!
+ \since 4.8
+
Removes the layout item \a item without destroying it.
Ownership of the item is transferred to the caller.
diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp
index 6fbe849..d01c3af 100644
--- a/src/gui/graphicsview/qgraphicslayout.cpp
+++ b/src/gui/graphicsview/qgraphicslayout.cpp
@@ -466,7 +466,6 @@ void QGraphicsLayout::addChildLayoutItem(QGraphicsLayoutItem *layoutItem)
static bool g_instantInvalidatePropagation = false;
/*!
- \internal
\since 4.8
\sa instantInvalidatePropagation()
@@ -496,7 +495,6 @@ void QGraphicsLayout::setInstantInvalidatePropagation(bool enable)
}
/*!
- \internal
\since 4.8
\sa setInstantInvalidatePropagation()
diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h
index 5d3d8d9..9857015 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_p.h
+++ b/src/gui/inputmethod/qcoefepinputcontext_p.h
@@ -108,6 +108,7 @@ private:
bool needsInputPanel();
void commitTemporaryPreeditString();
bool isWidgetVisible(QWidget *widget, int offset = 0);
+ bool isPartialKeyboardSupported();
private Q_SLOTS:
void ensureInputCapabilitiesChanged();
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index f8d7e28..5ddd53f 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -54,6 +54,7 @@
#include <fepitfr.h>
#include <hal.h>
+#include <e32property.h>
#include <limits.h>
// You only find these enumerations on SDK 5 onwards, so we need to provide our own
@@ -72,12 +73,18 @@
// EAknEditorFlagEnablePartialScreen is only valid from Sym^3 onwards.
#define QT_EAknEditorFlagEnablePartialScreen 0x200000
+// Properties to detect VKB status from AknFepInternalPSKeys.h
+#define QT_EPSUidAknFep 0x100056de
+#define QT_EAknFepTouchInputActive 0x00000004
+
QT_BEGIN_NAMESPACE
Q_GUI_EXPORT void qt_s60_setPartialScreenInputMode(bool enable)
{
S60->partial_keyboard = enable;
+ QApplication::setAttribute(Qt::AA_S60DisablePartialScreenInputMode, !S60->partial_keyboard);
+
QInputContext *ic = 0;
if (QApplication::focusWidget()) {
ic = QApplication::focusWidget()->inputContext();
@@ -111,7 +118,7 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
m_fepState->SetObjectProvider(this);
int defaultFlags = EAknEditorFlagDefault;
if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) {
- if (S60->partial_keyboard) {
+ if (isPartialKeyboardSupported()) {
defaultFlags |= QT_EAknEditorFlagEnablePartialScreen;
}
defaultFlags |= QT_EAknEditorFlagSelectionVisible;
@@ -312,28 +319,46 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
return false;
if (event->type() == QEvent::RequestSoftwareInputPanel) {
- // Notify S60 that we want the virtual keyboard to show up.
- QSymbianControl *sControl;
- sControl = focusWidget()->effectiveWinId()->MopGetObject(sControl);
- Q_ASSERT(sControl);
-
- // The FEP UI temporarily steals focus when it shows up the first time, causing
- // all sorts of weird effects on the focused widgets. Since it will immediately give
- // back focus to us, we temporarily disable focus handling until the job's done.
- if (sControl) {
- sControl->setIgnoreFocusChanged(true);
+ // Only request virtual keyboard if it is not yet active or if this is the first time
+ // panel is requested for this application.
+ static bool firstTime = true;
+ int vkbActive = 0;
+
+ if (firstTime) {
+ // Sometimes the global QT_EAknFepTouchInputActive value can be left incorrect at
+ // application exit if the application is exited when input panel is active.
+ // Therefore we always want to open the panel the first time application requests it.
+ firstTime = false;
+ } else {
+ const TUid KPSUidAknFep = {QT_EPSUidAknFep};
+ // No need to check for return value, as vkbActive stays zero in that case
+ RProperty::Get(KPSUidAknFep, QT_EAknFepTouchInputActive, vkbActive);
}
- ensureInputCapabilitiesChanged();
- m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::QT_EAknActivatePenInputRequest);
+ if (!vkbActive) {
+ // Notify S60 that we want the virtual keyboard to show up.
+ QSymbianControl *sControl;
+ sControl = focusWidget()->effectiveWinId()->MopGetObject(sControl);
+ Q_ASSERT(sControl);
+
+ // The FEP UI temporarily steals focus when it shows up the first time, causing
+ // all sorts of weird effects on the focused widgets. Since it will immediately give
+ // back focus to us, we temporarily disable focus handling until the job's done.
+ if (sControl) {
+ sControl->setIgnoreFocusChanged(true);
+ }
+
+ ensureInputCapabilitiesChanged();
+ m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::QT_EAknActivatePenInputRequest);
- if (sControl) {
- sControl->setIgnoreFocusChanged(false);
+ if (sControl) {
+ sControl->setIgnoreFocusChanged(false);
+ }
+ //If m_pointerHandler has already been set, it means that fep inline editing is in progress.
+ //When this is happening, do not filter out pointer events.
+ if (!m_pointerHandler)
+ return true;
}
- //If m_pointerHandler has already been set, it means that fep inline editing is in progress.
- //When this is happening, do not filter out pointer events.
- if (!m_pointerHandler)
- return true;
}
return false;
@@ -402,7 +427,8 @@ void QCoeFepInputContext::mouseHandler(int x, QMouseEvent *event)
//If splitview is open and T9 word is tapped, pass the pointer event to pointer handler.
//This will open the "suggested words" list. Pass pointer position always as zero, to make
//full word replacement in case user makes a selection.
- if (S60->partial_keyboard && S60->partialKeyboardOpen
+ if (isPartialKeyboardSupported()
+ && S60->partialKeyboardOpen
&& m_pointerHandler
&& !(currentHints & Qt::ImhNoPredictiveText)
&& (x > 0 && x < m_preeditString.length())) {
@@ -516,6 +542,11 @@ bool QCoeFepInputContext::isWidgetVisible(QWidget *widget, int offset)
return visible;
}
+bool QCoeFepInputContext::isPartialKeyboardSupported()
+{
+ return (S60->partial_keyboard || !QApplication::testAttribute(Qt::AA_S60DisablePartialScreenInputMode));
+}
+
// Ensure that the input widget is visible in the splitview rect.
void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget)
@@ -627,7 +658,7 @@ void QCoeFepInputContext::updateHints(bool mustUpdateInputCapabilities)
// we need to update its state separately.
if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) {
TInt currentFlags = m_fepState->Flags();
- if (S60->partial_keyboard)
+ if (isPartialKeyboardSupported())
currentFlags |= QT_EAknEditorFlagEnablePartialScreen;
else
currentFlags &= ~QT_EAknEditorFlagEnablePartialScreen;
@@ -744,7 +775,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints)
flags = 0;
if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) {
- if (S60->partial_keyboard)
+ if (isPartialKeyboardSupported())
flags |= QT_EAknEditorFlagEnablePartialScreen;
flags |= QT_EAknEditorFlagSelectionVisible;
}
diff --git a/src/gui/itemviews/qabstractproxymodel.cpp b/src/gui/itemviews/qabstractproxymodel.cpp
index 48c84ac..f00b7ee 100644
--- a/src/gui/itemviews/qabstractproxymodel.cpp
+++ b/src/gui/itemviews/qabstractproxymodel.cpp
@@ -298,6 +298,7 @@ bool QAbstractProxyModel::setHeaderData(int section, Qt::Orientation orientation
/*!
\reimp
+ \since 4.8
*/
QModelIndex QAbstractProxyModel::buddy(const QModelIndex &index) const
{
@@ -307,6 +308,7 @@ QModelIndex QAbstractProxyModel::buddy(const QModelIndex &index) const
/*!
\reimp
+ \since 4.8
*/
bool QAbstractProxyModel::canFetchMore(const QModelIndex &parent) const
{
@@ -316,6 +318,7 @@ bool QAbstractProxyModel::canFetchMore(const QModelIndex &parent) const
/*!
\reimp
+ \since 4.8
*/
void QAbstractProxyModel::fetchMore(const QModelIndex &parent)
{
@@ -325,6 +328,7 @@ void QAbstractProxyModel::fetchMore(const QModelIndex &parent)
/*!
\reimp
+ \since 4.8
*/
void QAbstractProxyModel::sort(int column, Qt::SortOrder order)
{
@@ -334,6 +338,7 @@ void QAbstractProxyModel::sort(int column, Qt::SortOrder order)
/*!
\reimp
+ \since 4.8
*/
QSize QAbstractProxyModel::span(const QModelIndex &index) const
{
@@ -343,6 +348,7 @@ QSize QAbstractProxyModel::span(const QModelIndex &index) const
/*!
\reimp
+ \since 4.8
*/
bool QAbstractProxyModel::hasChildren(const QModelIndex &parent) const
{
@@ -352,6 +358,7 @@ bool QAbstractProxyModel::hasChildren(const QModelIndex &parent) const
/*!
\reimp
+ \since 4.8
*/
QMimeData* QAbstractProxyModel::mimeData(const QModelIndexList &indexes) const
{
@@ -364,6 +371,7 @@ QMimeData* QAbstractProxyModel::mimeData(const QModelIndexList &indexes) const
/*!
\reimp
+ \since 4.8
*/
QStringList QAbstractProxyModel::mimeTypes() const
{
@@ -373,6 +381,7 @@ QStringList QAbstractProxyModel::mimeTypes() const
/*!
\reimp
+ \since 4.8
*/
Qt::DropActions QAbstractProxyModel::supportedDropActions() const
{
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 361ec6d..cd13894 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -1019,6 +1019,10 @@ void QApplicationPrivate::initialize()
QApplicationPrivate::wheel_scroll_lines = 3;
#endif
+#ifdef Q_WS_S60
+ q->setAttribute(Qt::AA_S60DisablePartialScreenInputMode);
+#endif
+
if (qt_is_gui_used)
initializeMultitouch();
}
diff --git a/src/gui/kernel/qgenericplugin_qpa.cpp b/src/gui/kernel/qgenericplugin_qpa.cpp
index e7b65b7..dae512d 100644
--- a/src/gui/kernel/qgenericplugin_qpa.cpp
+++ b/src/gui/kernel/qgenericplugin_qpa.cpp
@@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
\class QGenericPlugin
\ingroup plugins
\ingroup qpa
+ \since 4.8
\brief The QGenericPlugin class is an abstract base class for
window-system related plugins in Qt QPA.
diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.cpp b/src/gui/kernel/qgenericpluginfactory_qpa.cpp
index fb6a0d8..86e146a 100644
--- a/src/gui/kernel/qgenericpluginfactory_qpa.cpp
+++ b/src/gui/kernel/qgenericpluginfactory_qpa.cpp
@@ -61,6 +61,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
/*!
\class QGenericPluginFactory
\ingroup qpa
+ \since 4.8
\brief The QGenericPluginFactory class creates window-system
related plugin drivers in Qt QPA.
diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h
index 2607c2a..1d624f9 100644
--- a/src/gui/kernel/qkeymapper_p.h
+++ b/src/gui/kernel/qkeymapper_p.h
@@ -213,6 +213,8 @@ public:
int mapS60ScanCodesToQt(TUint s60key);
int mapQtToS60Key(int qtKey);
int mapQtToS60ScanCodes(int qtKey);
+ int mapS60RemConIdToS60Key(int s60RemConId);
+ int mapS60RemConIdToS60ScanCodes(int s60RemConId);
void updateInputLanguage();
#endif
};
diff --git a/src/gui/kernel/qkeymapper_s60.cpp b/src/gui/kernel/qkeymapper_s60.cpp
index 1113b77..2a7083e 100644
--- a/src/gui/kernel/qkeymapper_s60.cpp
+++ b/src/gui/kernel/qkeymapper_s60.cpp
@@ -87,97 +87,104 @@ QString QKeyMapperPrivate::translateKeyEvent(int keySym, Qt::KeyboardModifiers /
}
#include <e32keys.h>
+#include <remconcoreapi.h>
struct KeyMapping{
TKeyCode s60KeyCode;
TStdScanCode s60ScanCode;
+ TRemConCoreApiOperationId s60RemConId;
Qt::Key qtKey;
};
using namespace Qt;
+// key mapping table in the format of
+// {S60 key code, S60 scan code, S60 RemCon operation Id, Qt key code}
static const KeyMapping keyMapping[] = {
- {EKeyBackspace, EStdKeyBackspace, Key_Backspace},
- {EKeyTab, EStdKeyTab, Key_Tab},
- {EKeyEnter, EStdKeyEnter, Key_Enter},
- {EKeyEscape, EStdKeyEscape, Key_Escape},
- {EKeySpace, EStdKeySpace, Key_Space},
- {EKeyDelete, EStdKeyDelete, Key_Delete},
- {EKeyPrintScreen, EStdKeyPrintScreen, Key_SysReq},
- {EKeyPause, EStdKeyPause, Key_Pause},
- {EKeyHome, EStdKeyHome, Key_Home},
- {EKeyEnd, EStdKeyEnd, Key_End},
- {EKeyPageUp, EStdKeyPageUp, Key_PageUp},
- {EKeyPageDown, EStdKeyPageDown, Key_PageDown},
- {EKeyInsert, EStdKeyInsert, Key_Insert},
- {EKeyLeftArrow, EStdKeyLeftArrow, Key_Left},
- {EKeyRightArrow, EStdKeyRightArrow, Key_Right},
- {EKeyUpArrow, EStdKeyUpArrow, Key_Up},
- {EKeyDownArrow, EStdKeyDownArrow, Key_Down},
- {EKeyLeftShift, EStdKeyLeftShift, Key_Shift},
- {EKeyRightShift, EStdKeyRightShift, Key_Shift},
- {EKeyLeftAlt, EStdKeyLeftAlt, Key_Alt},
- {EKeyRightAlt, EStdKeyRightAlt, Key_AltGr},
- {EKeyLeftCtrl, EStdKeyLeftCtrl, Key_Control},
- {EKeyRightCtrl, EStdKeyRightCtrl, Key_Control},
- {EKeyLeftFunc, EStdKeyLeftFunc, Key_Super_L},
- {EKeyRightFunc, EStdKeyRightFunc, Key_Super_R},
- {EKeyCapsLock, EStdKeyCapsLock, Key_CapsLock},
- {EKeyNumLock, EStdKeyNumLock, Key_NumLock},
- {EKeyScrollLock, EStdKeyScrollLock, Key_ScrollLock},
- {EKeyF1, EStdKeyF1, Key_F1},
- {EKeyF2, EStdKeyF2, Key_F2},
- {EKeyF3, EStdKeyF3, Key_F3},
- {EKeyF4, EStdKeyF4, Key_F4},
- {EKeyF5, EStdKeyF5, Key_F5},
- {EKeyF6, EStdKeyF6, Key_F6},
- {EKeyF7, EStdKeyF7, Key_F7},
- {EKeyF8, EStdKeyF8, Key_F8},
- {EKeyF9, EStdKeyF9, Key_F9},
- {EKeyF10, EStdKeyF10, Key_F10},
- {EKeyF11, EStdKeyF11, Key_F11},
- {EKeyF12, EStdKeyF12, Key_F12},
- {EKeyF13, EStdKeyF13, Key_F13},
- {EKeyF14, EStdKeyF14, Key_F14},
- {EKeyF15, EStdKeyF15, Key_F15},
- {EKeyF16, EStdKeyF16, Key_F16},
- {EKeyF17, EStdKeyF17, Key_F17},
- {EKeyF18, EStdKeyF18, Key_F18},
- {EKeyF19, EStdKeyF19, Key_F19},
- {EKeyF20, EStdKeyF20, Key_F20},
- {EKeyF21, EStdKeyF21, Key_F21},
- {EKeyF22, EStdKeyF22, Key_F22},
- {EKeyF23, EStdKeyF23, Key_F23},
- {EKeyF24, EStdKeyF24, Key_F24},
- {EKeyOff, EStdKeyOff, Key_PowerOff},
-// {EKeyMenu, EStdKeyMenu, Key_Menu}, // Menu is EKeyApplication0
- {EKeyHelp, EStdKeyHelp, Key_Help},
- {EKeyDial, EStdKeyDial, Key_Call},
- {EKeyIncVolume, EStdKeyIncVolume, Key_VolumeUp},
- {EKeyDecVolume, EStdKeyDecVolume, Key_VolumeDown},
- {EKeyDevice0, EStdKeyDevice0, Key_Context1}, // Found by manual testing.
- {EKeyDevice1, EStdKeyDevice1, Key_Context2}, // Found by manual testing.
- {EKeyDevice3, EStdKeyDevice3, Key_Select},
- {EKeyDevice7, EStdKeyDevice7, Key_Camera},
- {EKeyApplication0, EStdKeyApplication0, Key_Menu}, // Found by manual testing.
- {EKeyApplication1, EStdKeyApplication1, Key_Launch1}, // Found by manual testing.
- {EKeyApplication2, EStdKeyApplication2, Key_MediaPlay}, // Found by manual testing.
- {EKeyApplication3, EStdKeyApplication3, Key_MediaStop}, // Found by manual testing.
- {EKeyApplication4, EStdKeyApplication4, Key_MediaNext}, // Found by manual testing.
- {EKeyApplication5, EStdKeyApplication5, Key_MediaPrevious}, // Found by manual testing.
- {EKeyApplication6, EStdKeyApplication6, Key_Launch6},
- {EKeyApplication7, EStdKeyApplication7, Key_Launch7},
- {EKeyApplication8, EStdKeyApplication8, Key_Launch8},
- {EKeyApplication9, EStdKeyApplication9, Key_Launch9},
- {EKeyApplicationA, EStdKeyApplicationA, Key_LaunchA},
- {EKeyApplicationB, EStdKeyApplicationB, Key_LaunchB},
- {EKeyApplicationC, EStdKeyApplicationC, Key_LaunchC},
- {EKeyApplicationD, EStdKeyApplicationD, Key_LaunchD},
- {EKeyApplicationE, EStdKeyApplicationE, Key_LaunchE},
- {EKeyApplicationF, EStdKeyApplicationF, Key_LaunchF},
- {EKeyApplication19, EStdKeyApplication19, Key_CameraFocus},
- {EKeyYes, EStdKeyYes, Key_Yes},
- {EKeyNo, EStdKeyNo, Key_No},
- {TKeyCode(0), TStdScanCode(0), Qt::Key(0)}
+ {EKeyBackspace, EStdKeyBackspace, ENop, Key_Backspace},
+ {EKeyTab, EStdKeyTab, ENop, Key_Tab},
+ {EKeyEnter, EStdKeyEnter, ERemConCoreApiEnter, Key_Enter},
+ {EKeyEscape, EStdKeyEscape, ENop, Key_Escape},
+ {EKeySpace, EStdKeySpace, ENop, Key_Space},
+ {EKeyDelete, EStdKeyDelete, ENop, Key_Delete},
+ {EKeyPrintScreen, EStdKeyPrintScreen, ENop, Key_SysReq},
+ {EKeyPause, EStdKeyPause, ENop, Key_Pause},
+ {EKeyHome, EStdKeyHome, ENop, Key_Home},
+ {EKeyEnd, EStdKeyEnd, ENop, Key_End},
+ {EKeyPageUp, EStdKeyPageUp, ERemConCoreApiPageUp, Key_PageUp},
+ {EKeyPageDown, EStdKeyPageDown, ERemConCoreApiPageDown, Key_PageDown},
+ {EKeyInsert, EStdKeyInsert, ENop, Key_Insert},
+ {EKeyLeftArrow, EStdKeyLeftArrow, ERemConCoreApiLeft, Key_Left},
+ {EKeyRightArrow, EStdKeyRightArrow, ERemConCoreApiRight, Key_Right},
+ {EKeyUpArrow, EStdKeyUpArrow, ERemConCoreApiUp, Key_Up},
+ {EKeyDownArrow, EStdKeyDownArrow, ERemConCoreApiDown, Key_Down},
+ {EKeyLeftShift, EStdKeyLeftShift, ENop, Key_Shift},
+ {EKeyRightShift, EStdKeyRightShift, ENop, Key_Shift},
+ {EKeyLeftAlt, EStdKeyLeftAlt, ENop, Key_Alt},
+ {EKeyRightAlt, EStdKeyRightAlt, ENop, Key_AltGr},
+ {EKeyLeftCtrl, EStdKeyLeftCtrl, ENop, Key_Control},
+ {EKeyRightCtrl, EStdKeyRightCtrl, ENop, Key_Control},
+ {EKeyLeftFunc, EStdKeyLeftFunc, ENop, Key_Super_L},
+ {EKeyRightFunc, EStdKeyRightFunc, ENop, Key_Super_R},
+ {EKeyCapsLock, EStdKeyCapsLock, ENop, Key_CapsLock},
+ {EKeyNumLock, EStdKeyNumLock, ENop, Key_NumLock},
+ {EKeyScrollLock, EStdKeyScrollLock, ENop, Key_ScrollLock},
+ {EKeyF1, EStdKeyF1, ERemConCoreApiF1, Key_F1},
+ {EKeyF2, EStdKeyF2, ERemConCoreApiF2, Key_F2},
+ {EKeyF3, EStdKeyF3, ERemConCoreApiF3, Key_F3},
+ {EKeyF4, EStdKeyF4, ERemConCoreApiF4, Key_F4},
+ {EKeyF5, EStdKeyF5, ERemConCoreApiF5, Key_F5},
+ {EKeyF6, EStdKeyF6, ENop, Key_F6},
+ {EKeyF7, EStdKeyF7, ENop, Key_F7},
+ {EKeyF8, EStdKeyF8, ENop, Key_F8},
+ {EKeyF9, EStdKeyF9, ENop, Key_F9},
+ {EKeyF10, EStdKeyF10, ENop, Key_F10},
+ {EKeyF11, EStdKeyF11, ENop, Key_F11},
+ {EKeyF12, EStdKeyF12, ENop, Key_F12},
+ {EKeyF13, EStdKeyF13, ENop, Key_F13},
+ {EKeyF14, EStdKeyF14, ENop, Key_F14},
+ {EKeyF15, EStdKeyF15, ENop, Key_F15},
+ {EKeyF16, EStdKeyF16, ENop, Key_F16},
+ {EKeyF17, EStdKeyF17, ENop, Key_F17},
+ {EKeyF18, EStdKeyF18, ENop, Key_F18},
+ {EKeyF19, EStdKeyF19, ENop, Key_F19},
+ {EKeyF20, EStdKeyF20, ENop, Key_F20},
+ {EKeyF21, EStdKeyF21, ENop, Key_F21},
+ {EKeyF22, EStdKeyF22, ENop, Key_F22},
+ {EKeyF23, EStdKeyF23, ENop, Key_F23},
+ {EKeyF24, EStdKeyF24, ENop, Key_F24},
+ {EKeyOff, EStdKeyOff, ENop, Key_PowerOff},
+// {EKeyMenu, EStdKeyMenu, ENop, Key_Menu}, // Menu is EKeyApplication0
+ {EKeyHelp, EStdKeyHelp, ERemConCoreApiHelp, Key_Help},
+ {EKeyDial, EStdKeyDial, ENop, Key_Call},
+ {EKeyIncVolume, EStdKeyIncVolume, ERemConCoreApiVolumeUp, Key_VolumeUp},
+ {EKeyDecVolume, EStdKeyDecVolume, ERemConCoreApiVolumeDown, Key_VolumeDown},
+ {EKeyDevice0, EStdKeyDevice0, ENop, Key_Context1}, // Found by manual testing.
+ {EKeyDevice1, EStdKeyDevice1, ENop, Key_Context2}, // Found by manual testing.
+ {EKeyDevice3, EStdKeyDevice3, ERemConCoreApiSelect, Key_Select},
+ {EKeyDevice7, EStdKeyDevice7, ENop, Key_Camera},
+ {EKeyApplication0, EStdKeyApplication0, ENop, Key_Menu}, // Found by manual testing.
+ {EKeyApplication1, EStdKeyApplication1, ENop, Key_Launch1}, // Found by manual testing.
+ {EKeyApplication2, EStdKeyApplication2, ERemConCoreApiPlay, Key_MediaPlay}, // Found by manual testing.
+ {EKeyApplication3, EStdKeyApplication3, ERemConCoreApiStop, Key_MediaStop}, // Found by manual testing.
+ {EKeyApplication4, EStdKeyApplication4, ERemConCoreApiForward, Key_MediaNext}, // Found by manual testing.
+ {EKeyApplication5, EStdKeyApplication5, ERemConCoreApiBackward, Key_MediaPrevious}, // Found by manual testing.
+ {EKeyApplication6, EStdKeyApplication6, ENop, Key_Launch6},
+ {EKeyApplication7, EStdKeyApplication7, ENop, Key_Launch7},
+ {EKeyApplication8, EStdKeyApplication8, ENop, Key_Launch8},
+ {EKeyApplication9, EStdKeyApplication9, ENop, Key_Launch9},
+ {EKeyApplicationA, EStdKeyApplicationA, ENop, Key_LaunchA},
+ {EKeyApplicationB, EStdKeyApplicationB, ENop, Key_LaunchB},
+ {EKeyApplicationC, EStdKeyApplicationC, ENop, Key_LaunchC},
+ {EKeyApplicationD, EStdKeyApplicationD, ENop, Key_LaunchD},
+ {EKeyApplicationE, EStdKeyApplicationE, ENop, Key_LaunchE},
+ {EKeyApplicationF, EStdKeyApplicationF, ENop, Key_LaunchF},
+ {EKeyApplication19, EStdKeyApplication19, ENop, Key_CameraFocus},
+ {EKeyYes, EStdKeyYes, ENop, Key_Yes},
+ {EKeyNo, EStdKeyNo, ENop, Key_No},
+ {EKeyDevice20, EStdKeyDevice20, ERemConCoreApiPausePlayFunction, Key_MediaTogglePlayPause},
+ {EKeyDevice21, EStdKeyDevice21, ERemConCoreApiRewind, Key_AudioRewind},
+ {EKeyDevice22, EStdKeyDevice22, ERemConCoreApiFastForward, Key_AudioForward},
+ {TKeyCode(0), TStdScanCode(0), ENop, Qt::Key(0)}
};
int QKeyMapperPrivate::mapS60KeyToQt(TUint s60key)
@@ -228,6 +235,30 @@ int QKeyMapperPrivate::mapQtToS60ScanCodes(int qtKey)
return res;
}
+int QKeyMapperPrivate::mapS60RemConIdToS60Key(int s60RemConId)
+{
+ int res = KErrUnknown;
+ for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) {
+ if (keyMapping[i].s60RemConId == s60RemConId) {
+ res = keyMapping[i].s60KeyCode;
+ break;
+ }
+ }
+ return res;
+}
+
+int QKeyMapperPrivate::mapS60RemConIdToS60ScanCodes(int s60RemConId)
+{
+ int res = KErrUnknown;
+ for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) {
+ if (keyMapping[i].s60RemConId == s60RemConId) {
+ res = keyMapping[i].s60ScanCode;
+ break;
+ }
+ }
+ return res;
+}
+
void QKeyMapperPrivate::updateInputLanguage()
{
#ifdef Q_WS_S60
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 117b72f..5fc72d4 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -933,7 +933,7 @@ QKeySequence::QKeySequence(const QString &key)
}
/*!
- \since 4.x
+ \since 4.7
Creates a key sequence from the \a key string based on \a format.
*/
QKeySequence::QKeySequence(const QString &key, QKeySequence::SequenceFormat format)
@@ -1130,7 +1130,7 @@ int QKeySequence::assign(const QString &ks)
/*!
\fn int QKeySequence::assign(const QString &keys, QKeySequence::SequenceFormat format)
- \since 4.x
+ \since 4.7
Adds the given \a keys to the key sequence (based on \a format).
\a keys may contain up to four key codes, provided they are
diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp
index 0695486..0426226 100644
--- a/src/gui/kernel/qplatformcursor_qpa.cpp
+++ b/src/gui/kernel/qplatformcursor_qpa.cpp
@@ -53,6 +53,7 @@ QList <QWeakPointer<QPlatformCursor> > QPlatformCursorPrivate::instances;
/*!
\class QPlatformCursor
+ \since 4.8
\brief The QPlatformCursor class provides information about
pointer device events (movement, buttons), and requests to change
@@ -105,6 +106,7 @@ QPlatformCursor::QPlatformCursor(QPlatformScreen *scr )
/*!
\class QPlatformCursorImage
+ \since 4.8
\brief The QPlatformCursorImage class provides a set of graphics
intended to be used as cursors.
diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp
index 482ae68..4ab8dfd 100644
--- a/src/gui/kernel/qplatformwindowformat_qpa.cpp
+++ b/src/gui/kernel/qplatformwindowformat_qpa.cpp
@@ -101,11 +101,11 @@ public:
/*!
\class QPlatformWindowFormat
+ \ingroup painting
+ \since 4.8
\brief The QPlatformWindowFormat class specifies the display format of an OpenGL
rendering context and if possible attributes of the corresponding QPlatformWindow.
- \ingroup painting
-
QWidget has a setter and getter function for QPlatformWindowFormat. These functions can be used
by the application programmer to signal what kind of format he wants to the window and glcontext
should have. However, it is not always possible to fulfill these requirements. The application
@@ -937,6 +937,8 @@ void QPlatformWindowFormat::setDefaultFormat(const QPlatformWindowFormat &f)
/*!
+ \since 4.8
+
Returns true if all the options of the two QPlatformWindowFormat objects
\a a and \a b are equal; otherwise returns false.
@@ -960,6 +962,8 @@ bool operator==(const QPlatformWindowFormat& a, const QPlatformWindowFormat& b)
/*!
+ \since 4.8
+
Returns false if all the options of the two QPlatformWindowFormat objects
\a a and \a b are equal; otherwise returns true.
diff --git a/src/gui/kernel/qsizepolicy.qdoc b/src/gui/kernel/qsizepolicy.qdoc
index 593560e..7002ed3 100644
--- a/src/gui/kernel/qsizepolicy.qdoc
+++ b/src/gui/kernel/qsizepolicy.qdoc
@@ -263,6 +263,7 @@
/*!
\fn void QSizePolicy::setWidthForHeight(bool dependent)
+ \since 4.8
Sets the flag determining whether the widget's width
depends on its height, to \a dependent.
@@ -276,6 +277,7 @@
/*!
\fn bool QSizePolicy::hasWidthForHeight() const
+ \since 4.8
Returns true if the widget's width depends on its
height; otherwise returns false.
diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp
index 56c3010..224f574 100644
--- a/src/gui/kernel/qwidget_qpa.cpp
+++ b/src/gui/kernel/qwidget_qpa.cpp
@@ -690,6 +690,7 @@ int QWidget::metric(PaintDeviceMetric m) const
/*!
\preliminary
+ \since 4.8
Sets the window to be the platform \a window specified.
@@ -710,6 +711,7 @@ void QWidget::setPlatformWindow(QPlatformWindow *window)
/*!
\preliminary
+ \since 4.8
Returns the QPlatformWindow this widget will be drawn into.
*/
@@ -724,6 +726,8 @@ QPlatformWindow *QWidget::platformWindow() const
}
/*!
+ \since 4.8
+
Sets the platform window format for the widget to the \a format specified.
*/
void QWidget::setPlatformWindowFormat(const QPlatformWindowFormat &format)
@@ -743,6 +747,8 @@ void QWidget::setPlatformWindowFormat(const QPlatformWindowFormat &format)
}
/*!
+ \since 4.8
+
Returns the platform window format for the widget.
*/
QPlatformWindowFormat QWidget::platformWindowFormat() const
diff --git a/src/gui/painting/qbezier_p.h b/src/gui/painting/qbezier_p.h
index 399dd89..f1f7eb1 100644
--- a/src/gui/painting/qbezier_p.h
+++ b/src/gui/painting/qbezier_p.h
@@ -162,27 +162,27 @@ inline void QBezier::coefficients(qreal t, qreal &a, qreal &b, qreal &c, qreal &
inline QPointF QBezier::pointAt(qreal t) const
{
-#if 1
- qreal a, b, c, d;
- coefficients(t, a, b, c, d);
- return QPointF(a*x1 + b*x2 + c*x3 + d*x4, a*y1 + b*y2 + c*y3 + d*y4);
-#else
// numerically more stable:
+ qreal x, y;
+
qreal m_t = 1. - t;
- qreal a = x1*m_t + x2*t;
- qreal b = x2*m_t + x3*t;
- qreal c = x3*m_t + x4*t;
- a = a*m_t + b*t;
- b = b*m_t + c*t;
- qreal x = a*m_t + b*t;
- qreal a = y1*m_t + y2*t;
- qreal b = y2*m_t + y3*t;
- qreal c = y3*m_t + y4*t;
- a = a*m_t + b*t;
- b = b*m_t + c*t;
- qreal y = a*m_t + b*t;
+ {
+ qreal a = x1*m_t + x2*t;
+ qreal b = x2*m_t + x3*t;
+ qreal c = x3*m_t + x4*t;
+ a = a*m_t + b*t;
+ b = b*m_t + c*t;
+ x = a*m_t + b*t;
+ }
+ {
+ qreal a = y1*m_t + y2*t;
+ qreal b = y2*m_t + y3*t;
+ qreal c = y3*m_t + y4*t;
+ a = a*m_t + b*t;
+ b = b*m_t + c*t;
+ y = a*m_t + b*t;
+ }
return QPointF(x, y);
-#endif
}
inline QPointF QBezier::normalVector(qreal t) const
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index 994986b..147d2ec 100644
--- a/src/gui/painting/qpaintengine_x11.cpp
+++ b/src/gui/painting/qpaintengine_x11.cpp
@@ -1611,6 +1611,8 @@ void QX11PaintEnginePrivate::fillPolygon_dev(const QPointF *polygonPoints, int p
&& (fill.style() != Qt::NoBrush)
&& ((has_fill_texture && fill.texture().hasAlpha()) || antialias || !solid_fill || has_alpha_pen != has_alpha_brush))
{
+ tessellator->tessellate((QPointF *)clippedPoints, clippedCount,
+ mode == QPaintEngine::WindingMode);
if (tessellator->size > 0) {
XRenderPictureAttributes attrs;
attrs.poly_edge = antialias ? PolyEdgeSmooth : PolyEdgeSharp;
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 435e12a..9bd9733 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -6646,6 +6646,10 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti)
qreal x = p.x();
qreal y = p.y();
+ bool rtl = ti.flags & QTextItem::RightToLeft;
+ if (rtl)
+ x += ti.width.toReal();
+
int start = 0;
int end, i;
for (end = 0; end < ti.glyphs.numGlyphs; ++end) {
@@ -6662,14 +6666,19 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti)
ti2.width += ti.glyphs.effectiveAdvance(i);
}
+ if (rtl)
+ x -= ti2.width.toReal();
+
d->engine->drawTextItem(QPointF(x, y), ti2);
+ if (!rtl)
+ x += ti2.width.toReal();
+
// reset the high byte for all glyphs and advance to the next sub-string
const int hi = which << 24;
for (i = start; i < end; ++i) {
glyphs.glyphs[i] = hi | glyphs.glyphs[i];
}
- x += ti2.width.toReal();
// change engine
start = end;
@@ -6684,6 +6693,9 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti)
ti2.width += ti.glyphs.effectiveAdvance(i);
}
+ if (rtl)
+ x -= ti2.width.toReal();
+
if (d->extended)
d->extended->drawTextItem(QPointF(x, y), ti2);
else
diff --git a/src/gui/painting/qprinterinfo.cpp b/src/gui/painting/qprinterinfo.cpp
index a7ddc85..c00a1cc 100644
--- a/src/gui/painting/qprinterinfo.cpp
+++ b/src/gui/painting/qprinterinfo.cpp
@@ -79,6 +79,8 @@ QPrinterInfo::QPrinterInfo()
}
/*!
+ \since 4.8
+
Constructs a copy of \a other.
*/
QPrinterInfo::QPrinterInfo(const QPrinterInfo &other)
@@ -117,6 +119,8 @@ QPrinterInfo::~QPrinterInfo()
}
/*!
+ \since 4.8
+
Sets the QPrinterInfo object to be equal to \a other.
*/
QPrinterInfo &QPrinterInfo::operator=(const QPrinterInfo &other)
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index fdba9c9..3973abd 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -198,7 +198,7 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
Coord c = { 0, 0, // will be filled in later
glyph_width,
glyph_height, // texture coords
- metrics.x.round().truncate(),
+ metrics.x.truncate(),
-metrics.y.truncate() }; // baseline for horizontal scripts
listItemCoordinates.insert(key, c);
@@ -367,9 +367,7 @@ void QImageTextureGlyphCache::createTextureData(int width, int height)
int QImageTextureGlyphCache::glyphMargin() const
{
-#if (defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA))
- return 1;
-#elif defined(Q_WS_X11)
+#if (defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) || defined(Q_WS_X11)
return 0;
#else
return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0;
diff --git a/src/gui/s60framework/qs60keycapture.cpp b/src/gui/s60framework/qs60keycapture.cpp
new file mode 100644
index 0000000..415c3e1
--- /dev/null
+++ b/src/gui/s60framework/qs60keycapture.cpp
@@ -0,0 +1,308 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Symbian application wrapper of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <remconinterfaceselector.h>
+#include <remconcoreapitarget.h>
+#include <coemain.h>
+#include "qkeymapper_p.h"
+#include "qs60keycapture_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*
+ * Helper class for sending key handling responses to RemCon.
+*/
+class CResponseHandler : public CActive
+{
+public:
+ static CResponseHandler *NewL(CRemConCoreApiTarget &remConCoreApiTarget);
+ virtual ~CResponseHandler();
+ void CompleteAnyKey(TRemConCoreApiOperationId operationId);
+
+private:
+ CResponseHandler(CRemConCoreApiTarget &remConCoreApiTarget);
+
+ void RunL();
+ void DoCancel();
+
+private:
+ RArray<TRemConCoreApiOperationId> iResponseArray;
+ CRemConCoreApiTarget &iRemConCoreApiTarget;
+};
+
+CResponseHandler::CResponseHandler(CRemConCoreApiTarget &remConCoreApiTarget)
+ : CActive(CActive::EPriorityStandard),
+ iRemConCoreApiTarget(remConCoreApiTarget)
+{
+ CActiveScheduler::Add(this);
+}
+
+CResponseHandler *CResponseHandler::NewL(CRemConCoreApiTarget &remConCoreApiTarget)
+{
+ CResponseHandler *self =
+ new (ELeave) CResponseHandler(remConCoreApiTarget);
+ return self;
+}
+
+CResponseHandler::~CResponseHandler()
+{
+ Cancel();
+ iResponseArray.Close();
+}
+
+void CResponseHandler::CompleteAnyKey(TRemConCoreApiOperationId operationId)
+{
+ if (!IsActive()) {
+ TInt error = KErrNone;
+ iRemConCoreApiTarget.SendResponse(iStatus, operationId, error);
+ SetActive();
+ } else {
+ // already active. Append to array and complete later.
+ iResponseArray.Append(operationId);
+ }
+}
+
+void CResponseHandler::DoCancel()
+{
+ iRemConCoreApiTarget.Cancel();
+}
+
+void CResponseHandler::RunL()
+{
+ // if any existing -> Send response
+ if (iResponseArray.Count()) {
+ CompleteAnyKey(iResponseArray[0]);
+ // Remove already completed key
+ iResponseArray.Remove(0);
+ iResponseArray.Compress();
+ }
+}
+
+
+/*
+ * QS60KeyCapture provides media key handling using services from RemCon.
+ */
+QS60KeyCapture::QS60KeyCapture(CCoeEnv *env, QObject *parent):
+ QObject(parent), coeEnv(env), selector(0), target(0), handler(0)
+{
+ initRemCon();
+
+ TTimeIntervalMicroSeconds32 initialTime;
+ TTimeIntervalMicroSeconds32 time;
+ coeEnv->WsSession().GetKeyboardRepeatRate(initialTime, time);
+ initialRepeatTime = (initialTime.Int() / 1000); // msecs
+ repeatTime = (time.Int() / 1000); // msecs
+
+ int clickTimeout = initialRepeatTime + repeatTime;
+
+ volumeUpClickTimer.setSingleShot(true);
+ volumeDownClickTimer.setSingleShot(true);
+ repeatTimer.setSingleShot(true);
+
+ volumeUpClickTimer.setInterval(clickTimeout);
+ volumeDownClickTimer.setInterval(clickTimeout);
+ repeatTimer.setInterval(initialRepeatTime);
+
+ connect(&volumeUpClickTimer, SIGNAL(timeout()), this, SLOT(volumeUpClickTimerExpired()));
+ connect(&volumeDownClickTimer, SIGNAL(timeout()), this, SLOT(volumeDownClickTimerExpired()));
+ connect(&repeatTimer, SIGNAL(timeout()), this, SLOT(repeatTimerExpired()));
+}
+
+/*
+ * Initializes RemCon connection for receiving key events
+ */
+void QS60KeyCapture::initRemCon()
+{
+ try {
+ QT_TRAP_THROWING(
+ selector = CRemConInterfaceSelector::NewL();
+ target = CRemConCoreApiTarget::NewL(*selector, *this);
+ handler = CResponseHandler::NewL(*target);
+ selector->OpenTargetL());
+ } catch (const std::exception &e) {
+ delete handler;
+ delete selector;
+ selector = 0;
+ target = 0;
+ handler = 0;
+ }
+}
+
+QS60KeyCapture::~QS60KeyCapture()
+{
+ delete handler;
+ delete selector;
+}
+
+void QS60KeyCapture::MrccatoCommand(TRemConCoreApiOperationId operationId,
+ TRemConCoreApiButtonAction buttonAction)
+{
+ if (!target)
+ return;
+
+ switch (operationId) {
+ // Volume up/down keys auto repeat if user hold the key long enough
+ case ERemConCoreApiVolumeUp:
+ case ERemConCoreApiVolumeDown:
+ {
+ // Side key events are sent using following scheme:
+ // - ButtonClick is sent first
+ // - if nothing happens before repeat timer expires, no further events are generated
+ // - if user holds the button longer, ButtonPress is sent and
+ // when button is finally released ButtonRelease is sent.
+
+ QTimer &timer = (operationId == ERemConCoreApiVolumeUp) ? volumeUpClickTimer : volumeDownClickTimer;
+
+ switch (buttonAction) {
+ case ERemConCoreApiButtonPress:
+ if (timer.isActive()) {
+ timer.stop();
+ // force repeat event
+ repeatKeyEvent = mapToKeyEvent(operationId);
+ repeatTimerExpired();
+ } else {
+ sendKey(operationId, QEvent::KeyPress);
+ repeatTimer.start(initialRepeatTime);
+ }
+ break;
+ case ERemConCoreApiButtonRelease:
+ timer.stop();
+ sendKey(operationId, QEvent::KeyRelease);
+ repeatTimer.stop();
+ break;
+ case ERemConCoreApiButtonClick:
+ if (timer.isActive()) {
+ timer.stop();
+ sendKey(operationId, QEvent::KeyRelease);
+ }
+ sendKey(operationId, QEvent::KeyPress);
+ timer.start();
+ repeatTimer.stop();
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ default:
+ switch (buttonAction) {
+ case ERemConCoreApiButtonPress:
+ sendKey(operationId, QEvent::KeyPress);
+ repeatTimer.start(initialRepeatTime);
+ break;
+ case ERemConCoreApiButtonRelease:
+ sendKey(operationId, QEvent::KeyRelease);
+ repeatTimer.stop();
+ break;
+ case ERemConCoreApiButtonClick:
+ sendKey(operationId, QEvent::KeyPress);
+ sendKey(operationId, QEvent::KeyRelease);
+ repeatTimer.stop();
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+
+ if (handler)
+ handler->CompleteAnyKey(operationId);
+}
+
+/*
+ * Sends volume up KeyRelease event
+ */
+void QS60KeyCapture::volumeUpClickTimerExpired()
+{
+ sendKey(ERemConCoreApiVolumeUp, QEvent::KeyRelease);
+}
+
+/*
+ * Sends volume down KeyRelease event
+ */
+void QS60KeyCapture::volumeDownClickTimerExpired()
+{
+ sendKey(ERemConCoreApiVolumeDown, QEvent::KeyRelease);
+}
+
+/*
+ * Repeats last key event
+ */
+void QS60KeyCapture::repeatTimerExpired()
+{
+ // set auto repeat flag on
+ repeatKeyEvent.iRepeats = 1;
+ coeEnv->SimulateKeyEventL(repeatKeyEvent, EEventKey);
+ repeatTimer.start(repeatTime);
+}
+
+/*
+ * Maps RemCon operation id to key event (includes key code and scan codes)
+ */
+TKeyEvent QS60KeyCapture::mapToKeyEvent(TRemConCoreApiOperationId operationId)
+{
+ TKeyEvent keyEvent;
+ keyEvent.iModifiers = 0;
+ keyEvent.iRepeats = 0;
+ keyEvent.iCode = qt_keymapper_private()->mapS60RemConIdToS60Key(operationId);
+ keyEvent.iScanCode = qt_keymapper_private()->mapS60RemConIdToS60ScanCodes(operationId);
+ return keyEvent;
+}
+
+/*
+ * Delivers key events to the application.
+ * RemCon operations are converted to simulated key events
+ */
+void QS60KeyCapture::sendKey(TRemConCoreApiOperationId operationId, QEvent::Type type)
+{
+ TKeyEvent keyEvent = mapToKeyEvent(operationId);
+
+ if (type == QEvent::KeyPress) {
+ coeEnv->SimulateKeyEventL(keyEvent, EEventKeyDown);
+ coeEnv->SimulateKeyEventL(keyEvent, EEventKey);
+ // save the key press event for repeats
+ repeatKeyEvent = keyEvent;
+ } else {
+ coeEnv->SimulateKeyEventL(keyEvent, EEventKeyUp);
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/openvglite/qwindowsurface_vglite.h b/src/gui/s60framework/qs60keycapture_p.h
index b6e22d8..a50fad7 100644
--- a/src/plugins/platforms/openvglite/qwindowsurface_vglite.h
+++ b/src/gui/s60framework/qs60keycapture_p.h
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the plugins of the Qt Toolkit.
+** This file is part of the Symbian application wrapper of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QWINDOWSURFACE_VGLITE_H
-#define QWINDOWSURFACE_VGLITE_H
+#ifndef QS60KEYCAPTURE_P_H
+#define QS60KEYCAPTURE_P_H
//
// W A R N I N G
@@ -53,39 +53,64 @@
// We mean it.
//
-#include <QtGui/private/qwindowsurface_p.h>
-#include <QtGui/private/qegl_p.h>
+#include <QtCore/qglobal.h>
-QT_BEGIN_NAMESPACE
+#ifdef Q_OS_SYMBIAN
+
+#include <QObject>
+#include <QEvent>
+#include <QTimer>
+#include <remconcoreapitargetobserver.h>
+#include <w32std.h>
-class QVGLiteGraphicsSystem;
-class QVGPaintEngine;
+class CRemConInterfaceSelector;
+class CRemConCoreApiTarget;
+class CResponseHandler;
+class CCoeEnv;
-class Q_OPENVG_EXPORT QVGLiteWindowSurface : public QWindowSurface, public QPaintDevice
+QT_BEGIN_NAMESPACE
+
+class QS60KeyCapture: public QObject,
+ public MRemConCoreApiTargetObserver
{
+ Q_OBJECT
public:
- QVGLiteWindowSurface(QVGLiteGraphicsSystem *gs, QWidget *window);
- ~QVGLiteWindowSurface();
-
- QPaintDevice *paintDevice();
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
- void setGeometry(const QRect &rect);
- bool scroll(const QRegion &area, int dx, int dy);
+ QS60KeyCapture(CCoeEnv *env, QObject *parent = 0);
+ ~QS60KeyCapture();
- void beginPaint(const QRegion &region);
- void endPaint(const QRegion &region);
+ void MrccatoCommand(TRemConCoreApiOperationId operationId,
+ TRemConCoreApiButtonAction buttonAct);
- QPaintEngine *paintEngine() const;
+private slots:
+ void volumeUpClickTimerExpired();
+ void volumeDownClickTimerExpired();
+ void repeatTimerExpired();
-protected:
- int metric(PaintDeviceMetric metric) const;
+private:
+ void sendKey(TRemConCoreApiOperationId operationId, QEvent::Type type);
+ TKeyEvent mapToKeyEvent(TRemConCoreApiOperationId operationId);
+ void initRemCon();
private:
- QVGLiteGraphicsSystem *graphicsSystem;
- bool isPaintingActive;
- mutable QVGPaintEngine *engine;
+ QS60KeyCapture();
+ Q_DISABLE_COPY(QS60KeyCapture)
+
+ CCoeEnv *coeEnv;
+
+ CRemConInterfaceSelector *selector;
+ CRemConCoreApiTarget *target;
+ CResponseHandler *handler;
+
+ QTimer volumeUpClickTimer;
+ QTimer volumeDownClickTimer;
+
+ TKeyEvent repeatKeyEvent;
+ int initialRepeatTime; // time before first repeat key event
+ int repeatTime; // time between subsequent repeat key events
+ QTimer repeatTimer;
};
QT_END_NAMESPACE
-#endif // QWINDOWSURFACE_VGLITE_H
+#endif // Q_OS_SYMBIAN
+#endif // QS60KEYCAPTURE_P_H
diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp
index ec97f7b..bd3017c 100644
--- a/src/gui/s60framework/qs60mainappui.cpp
+++ b/src/gui/s60framework/qs60mainappui.cpp
@@ -59,6 +59,7 @@
#include <private/qmenu_p.h>
#include <private/qt_s60_p.h>
#include <qdebug.h>
+#include "qs60keycapture_p.h"
//Animated wallpapers in Qt applications are not supported.
const TInt KAknDisableAnimationBackground = 0x02000000;
@@ -66,6 +67,20 @@ const TInt KAknSingleClickCompatible = 0x01000000;
QT_BEGIN_NAMESPACE
+static QS60KeyCapture *qt_S60KeyCapture = 0;
+
+static void installS60KeyCapture(CCoeEnv *env)
+{
+ if (QApplication::testAttribute(Qt::AA_CaptureMultimediaKeys))
+ qt_S60KeyCapture = new QS60KeyCapture(env);
+}
+
+static void removeS60KeyCapture()
+{
+ delete qt_S60KeyCapture;
+ qt_S60KeyCapture = 0;
+}
+
/*!
\class QS60MainAppUi
\since 4.6
@@ -127,6 +142,7 @@ void QS60MainAppUi::ConstructL()
}
#endif
BaseConstructL(flags);
+ installS60KeyCapture(iCoeEnv);
}
/*!
@@ -142,6 +158,7 @@ QS60MainAppUi::QS60MainAppUi()
*/
QS60MainAppUi::~QS60MainAppUi()
{
+ removeS60KeyCapture();
}
/*!
diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri
index 19525b7..e30d2c0 100644
--- a/src/gui/s60framework/s60framework.pri
+++ b/src/gui/s60framework/s60framework.pri
@@ -1,10 +1,13 @@
SOURCES += s60framework/qs60mainapplication.cpp \
- s60framework/qs60mainappui.cpp \
- s60framework/qs60maindocument.cpp
-
-HEADERS += s60framework/qs60mainapplication_p.h \
- s60framework/qs60mainapplication.h \
- s60framework/qs60mainappui.h \
- s60framework/qs60maindocument.h
-
-!isEmpty(QT_LIBINFIX): DEFINES += QT_LIBINFIX_UNQUOTED=$$QT_LIBINFIX \ No newline at end of file
+ s60framework/qs60mainappui.cpp \
+ s60framework/qs60maindocument.cpp \
+ s60framework/qs60keycapture.cpp
+HEADERS += qs60keycapture_p.h \
+ s60framework/qs60mainapplication_p.h \
+ s60framework/qs60mainapplication.h \
+ s60framework/qs60mainappui.h \
+ s60framework/qs60maindocument.h \
+ s60framework/qs60keycapture_p.h
+LIBS += -lremconcoreapi \
+ -lremconinterfacebase
+!isEmpty(QT_LIBINFIX):DEFINES += QT_LIBINFIX_UNQUOTED=$$QT_LIBINFIX
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 40c28f6..8436856 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -1195,15 +1195,15 @@ QRect QMacStylePrivate::comboboxEditBounds(const QRect &outerBounds, const HIThe
QRect ret = outerBounds;
switch (bdi.kind){
case kThemeComboBox:
- ret.adjust(5, 8, -21, -4);
+ ret.adjust(5, 8, -22, -4);
break;
case kThemeComboBoxSmall:
- ret.adjust(4, 5, -18, 0);
- ret.setHeight(16);
+ ret.adjust(4, 6, -20, 0);
+ ret.setHeight(14);
break;
case kThemeComboBoxMini:
- ret.adjust(4, 5, -16, 0);
- ret.setHeight(13);
+ ret.adjust(4, 5, -18, -1);
+ ret.setHeight(12);
break;
case kThemePopupButton:
ret.adjust(10, 3, -23, -3);
@@ -3681,9 +3681,27 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
proxy()->drawItemText(p, nr, alignment, np, tab->state & State_Enabled,
tab->text, QPalette::WindowText);
p->restore();
- }
+ QCommonStyle::drawControl(ce, &myTab, p, w);
+ } else if (qMacVersion() >= QSysInfo::MV_10_7 && (tab->state & State_Selected)) {
+ p->save();
+ rotateTabPainter(p, myTab.shape, myTab.rect);
- QCommonStyle::drawControl(ce, &myTab, p, w);
+ QPalette np = tab->palette;
+ np.setColor(QPalette::WindowText, QColor(0, 0, 0, 75));
+ QRect nr = subElementRect(SE_TabBarTabText, opt, w);
+ nr.moveTop(-1);
+ int alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextHideMnemonic;
+ proxy()->drawItemText(p, nr, alignment, np, tab->state & State_Enabled,
+ tab->text, QPalette::WindowText);
+
+ np.setColor(QPalette::WindowText, QColor(255, 255, 255, 255));
+ nr.moveTop(-2);
+ proxy()->drawItemText(p, nr, alignment, np, tab->state & State_Enabled,
+ tab->text, QPalette::WindowText);
+ p->restore();
+ } else {
+ QCommonStyle::drawControl(ce, &myTab, p, w);
+ }
} else {
p->save();
CGContextSetShouldAntialias(cg, true);
@@ -4707,7 +4725,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
HIThemeFrameDrawInfo fdi;
fdi.version = qt_mac_hitheme_version;
- fdi.state = tds;
+ fdi.state = ((sb->state & State_ReadOnly) || !(sb->state & State_Enabled)) ? kThemeStateInactive : kThemeStateActive;
fdi.kind = kHIThemeFrameTextFieldSquare;
fdi.isFocused = false;
HIRect hirect = qt_hirectForQRect(lineeditRect);
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index b0ea0d1..e9f7a86 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -141,6 +141,7 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme
{SE_Editor, QS60StyleEnums::SP_QsnFrInputCenter},
{SE_TableItemPressed, QS60StyleEnums::SP_QsnFrGridCenterPressed},
{SE_ListItemPressed, QS60StyleEnums::SP_QsnFrListCenterPressed},
+ {SE_DialogBackground, QS60StyleEnums::SP_QsnFrPopupCenter},
};
static const int frameElementsCount =
@@ -263,6 +264,9 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter,
case SE_PopupBackground:
drawFrame(SF_PopupBackground, painter, rect, flags | SF_PointNorth);
break;
+ case SE_DialogBackground:
+ drawFrame(SF_DialogBackground, painter, rect, flags | SF_PointNorth);
+ break;
case SE_SettingsList:
drawFrame(SF_SettingsList, painter, rect, flags | SF_PointNorth);
break;
@@ -497,8 +501,10 @@ bool QS60StylePrivate::equalToThemePalette(qint64 cacheKey, QPalette::ColorRole
{
if (!m_themePalette)
return false;
- if (cacheKey == m_themePalette->brush(role).texture().cacheKey())
+ if ((m_placeHolderTexture && (cacheKey == m_placeHolderTexture->cacheKey()))
+ || (cacheKey == m_themePalette->brush(role).texture().cacheKey()))
return true;
+
return false;
}
@@ -2261,10 +2267,14 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget)
&& QS60StylePrivate::equalToThemePalette(option->palette.window().texture().cacheKey(), QPalette::Window)) {
const bool comboMenu = qobject_cast<const QComboBoxListView *>(widget);
+ const bool menu = qobject_cast<const QMenu *>(widget);
// Add margin area to the background, to avoid background being cut for first and last item.
const int verticalMenuAdjustment = comboMenu ? QS60StylePrivate::pixelMetric(PM_MenuVMargin) : 0;
const QRect adjustedMenuRect = option->rect.adjusted(0, -verticalMenuAdjustment, 0, verticalMenuAdjustment);
- QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PopupBackground, painter, adjustedMenuRect, flags);
+ if (comboMenu || menu)
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PopupBackground, painter, adjustedMenuRect, flags);
+ else
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_DialogBackground, painter, adjustedMenuRect, flags);
} else {
commonStyleDraws = true;
}
@@ -3345,6 +3355,12 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon,
QS60StylePrivate::SF_StateEnabled :
QS60StylePrivate::SF_StateDisabled;
+ int metric = PM_ToolBarIconSize;
+#if defined(Q_WS_S60)
+ //Support version specific standard icons only with Symbian/S60 platform.
+ QSysInfo::S60Version versionSupport = QSysInfo::SV_S60_Unknown;
+#endif
+
switch(standardIcon) {
case SP_MessageBoxWarning:
// By default, S60 messagebox icons have 4:3 ratio. Value is from S60 LAF documentation.
@@ -3415,11 +3431,353 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon,
adjustedFlags |= QS60StylePrivate::SF_PointEast;
part = QS60StyleEnums::SP_QgnIndiSubmenu;
break;
+ case SP_TitleBarMenuButton:
+#if defined(Q_WS_S60)
+ versionSupport = QSysInfo::SV_S60_5_3;
+#endif
+ metric = PM_SmallIconSize;
+ part = QS60StyleEnums::SP_QtgToolBarOptions;
+ break;
+ case SP_DirHomeIcon:
+ metric = PM_SmallIconSize;
+ part = QS60StyleEnums::SP_QgnIndiBrowserTbHome;
+ break;
+ case SP_BrowserReload:
+ metric = PM_SmallIconSize;
+ part = QS60StyleEnums::SP_QgnIndiBrowserTbReload;
+ break;
+ case SP_BrowserStop:
+ metric = PM_SmallIconSize;
+ part = QS60StyleEnums::SP_QgnIndiBrowserTbStop;
+ break;
+#if defined(Q_WS_S60)
+ case SP_MediaPlay:
+ versionSupport = QSysInfo::SV_S60_5_3;
+ metric = PM_SmallIconSize;
+ part = QS60StyleEnums::SP_QtgToolBarPlay;
+ break;
+ case SP_MediaStop:
+ versionSupport = QSysInfo::SV_S60_5_3;
+ metric = PM_SmallIconSize;
+ part = QS60StyleEnums::SP_QtgToolBarStop;
+ break;
+ case SP_MediaPause:
+ versionSupport = QSysInfo::SV_S60_5_3;
+ metric = PM_SmallIconSize;
+ part = QS60StyleEnums::SP_QtgToolBarPause;
+ break;
+ case SP_MediaSkipForward:
+ versionSupport = QSysInfo::SV_S60_5_3;
+ metric = PM_SmallIconSize;
+ part = QS60StyleEnums::SP_QtgToolBarNext;
+ break;
+ case SP_MediaSkipBackward:
+ versionSupport = QSysInfo::SV_S60_5_3;
+ metric = PM_SmallIconSize;
+ part = QS60StyleEnums::SP_QtgToolBarPrevious;
+ break;
+ case SP_MediaSeekForward:
+ versionSupport = QSysInfo::SV_S60_5_3;
+ metric = PM_SmallIconSize;
+ part = QS60StyleEnums::SP_QtgToolBarForward;
+ break;
+ case SP_MediaSeekBackward:
+ versionSupport = QSysInfo::SV_S60_5_3;
+ metric = PM_SmallIconSize;
+ part = QS60StyleEnums::SP_QtgToolBarRewind;
+ break;
+#endif
+// Custom icons
+ case SP_CustomToolBarAdd:
+ part = QS60StyleEnums::SP_QtgToolBarAdd;
+ break;
+ case SP_CustomToolBarAddDetail:
+ part = QS60StyleEnums::SP_QtgToolBarAddDetail;
+ break;
+ case SP_CustomToolBarAgain:
+ part = QS60StyleEnums::SP_QtgToolBarAgain;
+ break;
+ case SP_CustomToolBarAgenda:
+ part = QS60StyleEnums::SP_QtgToolBarAgenda;
+ break;
+ case SP_CustomToolBarAudioOff:
+ part = QS60StyleEnums::SP_QtgToolBarAudioOff;
+ break;
+ case SP_CustomToolBarAudioOn:
+ part = QS60StyleEnums::SP_QtgToolBarAudioOn;
+ break;
+ case SP_CustomToolBarBack:
+ part = QS60StyleEnums::SP_QtgToolBarBack;
+ break;
+ case SP_CustomToolBarBluetoothOff:
+ part = QS60StyleEnums::SP_QtgToolBarBluetoothOff;
+ break;
+ case SP_CustomToolBarBluetoothOn:
+ part = QS60StyleEnums::SP_QtgToolBarBluetoothOn;
+ break;
+ case SP_CustomToolBarCancel:
+ part = QS60StyleEnums::SP_QtgToolBarCancel;
+ break;
+ case SP_CustomToolBarDelete:
+ part = QS60StyleEnums::SP_QtgToolBarDelete;
+ break;
+ case SP_CustomToolBarDone:
+ part = QS60StyleEnums::SP_QtgToolBarDone;
+ break;
+ case SP_CustomToolBarEdit:
+ part = QS60StyleEnums::SP_QtgToolBarEdit;
+ break;
+ case SP_CustomToolBarEmailSend:
+ part = QS60StyleEnums::SP_QtgToolBarEmailSend;
+ break;
+ case SP_CustomToolBarEmergencyCall:
+ part = QS60StyleEnums::SP_QtgToolBarEmergencyCall;
+ break;
+ case SP_CustomToolBarFavouriteAdd:
+ part = QS60StyleEnums::SP_QtgToolBarFavouriteAdd;
+ break;
+ case SP_CustomToolBarFavouriteRemove:
+ part = QS60StyleEnums::SP_QtgToolBarFavouriteRemove;
+ break;
+ case SP_CustomToolBarFavourites:
+ part = QS60StyleEnums::SP_QtgToolBarFavourites;
+ break;
+ case SP_CustomToolBarGo:
+ part = QS60StyleEnums::SP_QtgToolBarGo;
+ break;
+ case SP_CustomToolBarHome:
+ part = QS60StyleEnums::SP_QtgToolBarHome;
+ break;
+ case SP_CustomToolBarList:
+ part = QS60StyleEnums::SP_QtgToolBarList;
+ break;
+ case SP_CustomToolBarLock:
+ part = QS60StyleEnums::SP_QtgToolBarLock;
+ break;
+ case SP_CustomToolBarLogs:
+ part = QS60StyleEnums::SP_QtgToolBarLogs;
+ break;
+ case SP_CustomToolBarMenu:
+ part = QS60StyleEnums::SP_QtgToolBarMenu;
+ break;
+ case SP_CustomToolBarNewContact:
+ part = QS60StyleEnums::SP_QtgToolBarNewContact;
+ break;
+ case SP_CustomToolBarNewGroup:
+ part = QS60StyleEnums::SP_QtgToolBarNewGroup;
+ break;
+ case SP_CustomToolBarNowPlay:
+ part = QS60StyleEnums::SP_QtgToolBarNowPlay;
+ break;
+ case SP_CustomToolBarOptions:
+ part = QS60StyleEnums::SP_QtgToolBarOptions;
+ break;
+ case SP_CustomToolBarOther:
+ part = QS60StyleEnums::SP_QtgToolBarOther;
+ break;
+ case SP_CustomToolBarOvi:
+ part = QS60StyleEnums::SP_QtgToolBarOvi;
+ break;
+ case SP_CustomToolBarRead:
+ part = QS60StyleEnums::SP_QtgToolBarRead;
+ break;
+ case SP_CustomToolBarRefresh:
+ part = QS60StyleEnums::SP_QtgToolBarRefresh;
+ break;
+ case SP_CustomToolBarRemoveDetail:
+ part = QS60StyleEnums::SP_QtgToolBarRemoveDetail;
+ break;
+ case SP_CustomToolBarRepeat:
+ part = QS60StyleEnums::SP_QtgToolBarRepeat;
+ break;
+ case SP_CustomToolBarRepeatOff:
+ part = QS60StyleEnums::SP_QtgToolBarRepeatOff;
+ break;
+ case SP_CustomToolBarRepeatOne:
+ part = QS60StyleEnums::SP_QtgToolBarRepeatOne;
+ break;
+ case SP_CustomToolBarSearch:
+ part = QS60StyleEnums::SP_QtgToolBarSearch;
+ break;
+ case SP_CustomToolBarSelfTimer:
+ part = QS60StyleEnums::SP_QtgToolBarSelfTimer;
+ break;
+ case SP_CustomToolBarSend:
+ part = QS60StyleEnums::SP_QtgToolBarSend;
+ break;
+ case SP_CustomToolBarShare:
+ part = QS60StyleEnums::SP_QtgToolBarShare;
+ break;
+ case SP_CustomToolBarShift:
+ part = QS60StyleEnums::SP_QtgToolBarShift;
+ break;
+ case SP_CustomToolBarShuffle:
+ part = QS60StyleEnums::SP_QtgToolBarShuffle;
+ break;
+ case SP_CustomToolBarShuffleOff:
+ part = QS60StyleEnums::SP_QtgToolBarShuffleOff;
+ break;
+ case SP_CustomToolBarSignalOff:
+ part = QS60StyleEnums::SP_QtgToolBarSignalOff;
+ break;
+ case SP_CustomToolBarSignalOn:
+ part = QS60StyleEnums::SP_QtgToolBarSignalOn;
+ break;
+ case SP_CustomToolBarSync:
+ part = QS60StyleEnums::SP_QtgToolBarSync;
+ break;
+ case SP_CustomToolBarUnlock:
+ part = QS60StyleEnums::SP_QtgToolBarUnlock;
+ break;
+ case SP_CustomToolBarUnmark:
+ part = QS60StyleEnums::SP_QtgToolBarUnmark;
+ break;
+ case SP_CustomToolBarView:
+ part = QS60StyleEnums::SP_QtgToolBarView;
+ break;
+ case SP_CustomToolBarWlanOff:
+ part = QS60StyleEnums::SP_QtgToolBarWlanOff;
+ break;
+ case SP_CustomToolBarWlanOn:
+ part = QS60StyleEnums::SP_QtgToolBarWlanOn;
+ break;
+#if defined(Q_WS_S60)
+ case SP_CustomCameraCaptureButton:
+ versionSupport = QSysInfo::SV_S60_5_2;
+ part = QS60StyleEnums::SP_QtgGrafCameraButtonCaptureNormal;
+ break;
+ case SP_CustomCameraCaptureButtonPressed:
+ versionSupport = QSysInfo::SV_S60_5_2;
+ part = QS60StyleEnums::SP_QtgGrafCameraButtonCapturePressed;
+ break;
+ case SP_CustomCameraPauseButton:
+ versionSupport = QSysInfo::SV_S60_5_2;
+ part = QS60StyleEnums::SP_QtgGrafCameraButtonPauseNormal;
+ break;
+ case SP_CustomCameraPauseButtonPressed:
+ versionSupport = QSysInfo::SV_S60_5_2;
+ part = QS60StyleEnums::SP_QtgGrafCameraButtonPausePressed;
+ break;
+ case SP_CustomCameraPlayButton:
+ versionSupport = QSysInfo::SV_S60_5_2;
+ part = QS60StyleEnums::SP_QtgGrafCameraButtonPlayNormal;
+ break;
+ case SP_CustomCameraPlayButtonPressed:
+ versionSupport = QSysInfo::SV_S60_5_2;
+ part = QS60StyleEnums::SP_QtgGrafCameraButtonPlayPressed;
+ break;
+ case SP_CustomCameraRecButton:
+ versionSupport = QSysInfo::SV_S60_5_2;
+ part = QS60StyleEnums::SP_QtgGrafCameraButtonRecNormal;
+ break;
+ case SP_CustomCameraRecButtonPressed:
+ versionSupport = QSysInfo::SV_S60_5_2;
+ part = QS60StyleEnums::SP_QtgGrafCameraButtonRecPressed;
+ break;
+ case SP_CustomCameraStopButton:
+ versionSupport = QSysInfo::SV_S60_5_2;
+ part = QS60StyleEnums::SP_QtgGrafCameraButtonStopNormal;
+ break;
+ case SP_CustomCameraStopButtonPressed:
+ versionSupport = QSysInfo::SV_S60_5_2;
+ part = QS60StyleEnums::SP_QtgGrafCameraButtonStopPressed;
+ break;
+#endif
+ case SP_CustomTabAll:
+ part = QS60StyleEnums::SP_QtgTabAll;
+ break;
+ case SP_CustomTabArtist:
+ part = QS60StyleEnums::SP_QtgTabArtist;
+ break;
+ case SP_CustomTabFavourite:
+ part = QS60StyleEnums::SP_QtgTabFavourite;
+ break;
+ case SP_CustomTabGenre:
+ part = QS60StyleEnums::SP_QtgTabGenre;
+ break;
+ case SP_CustomTabLanguage:
+ part = QS60StyleEnums::SP_QtgTabLanguage;
+ break;
+ case SP_CustomTabMusicAlbum:
+ part = QS60StyleEnums::SP_QtgTabMusicAlbum;
+ break;
+ case SP_CustomTabPhotosAlbum:
+ part = QS60StyleEnums::SP_QtgTabPhotosAlbum;
+ break;
+ case SP_CustomTabPhotosAll:
+ part = QS60StyleEnums::SP_QtgTabPhotosAll;
+ break;
+ case SP_CustomTabPlaylist:
+ part = QS60StyleEnums::SP_QtgTabPlaylist;
+ break;
+ case SP_CustomTabServices:
+ part = QS60StyleEnums::SP_QtgTabServices;
+ break;
+ case SP_CustomTabSongs:
+ part = QS60StyleEnums::SP_QtgTabSongs;
+ break;
+ case SP_CustomTabVideos:
+ part = QS60StyleEnums::SP_QtgTabVideos;
+ break;
+ case SP_CustomToolBarEditDisabled:
+ part = QS60StyleEnums::SP_QtgToolBarEditDisabled;
+ break;
+ case SP_CustomToolBarImageTools:
+ part = QS60StyleEnums::SP_QtgToolBarImageTools;
+ break;
+ case SP_CustomToolBarNextFrame:
+ part = QS60StyleEnums::SP_QtgToolBarNextFrame;
+ break;
+ case SP_CustomToolBarPreviousFrame:
+ part = QS60StyleEnums::SP_QtgToolBarPreviousFrame;
+ break;
+ case SP_CustomToolBarRedoDisabled:
+ part = QS60StyleEnums::SP_QtgToolBarRedoDisabled;
+ break;
+ case SP_CustomToolBarRedo:
+ part = QS60StyleEnums::SP_QtgToolBarRedo;
+ break;
+ case SP_CustomToolBarRemoveDisabled:
+ part = QS60StyleEnums::SP_QtgToolBarRemoveDisabled;
+ break;
+ case SP_CustomToolBarSearchDisabled:
+ part = QS60StyleEnums::SP_QtgToolBarSearchDisabled;
+ break;
+ case SP_CustomToolBarSelectContent:
+ part = QS60StyleEnums::SP_QtgToolBarSelectContent;
+ break;
+ case SP_CustomToolBarSendDimmed:
+ part = QS60StyleEnums::SP_QtgToolBarSendDimmed;
+ break;
+ case SP_CustomToolBarTools:
+ part = QS60StyleEnums::SP_QtgToolBarTools;
+ break;
+ case SP_CustomToolBarTrim:
+ part = QS60StyleEnums::SP_QtgToolBarTrim;
+ break;
default:
return QCommonStyle::standardIconImplementation(standardIcon, option, widget);
}
+
+#if defined(Q_WS_S60)
+ //If new custom standardIcon is missing version information, assume S60 5.3.
+ if (standardIcon & QStyle::SP_CustomBase) {
+ if (versionSupport == QSysInfo::SV_Unknown)
+ versionSupport = QSysInfo::SV_S60_5_3;
+ metric = PM_SmallIconSize;
+ }
+
+ // Toolbar icons are only available from SV_S60_5_3 onwards. Use common style for earlier releases.
+ if ((versionSupport != QSysInfo::SV_Unknown) && QSysInfo::s60Version() < versionSupport) {
+ return QCommonStyle::standardIconImplementation(standardIcon, option, widget);
+ }
+#else
+ if (standardIcon >= SP_CustomToolBarAdd)
+ metric = PM_SmallIconSize;
+#endif
+
const QS60StylePrivate::SkinElementFlags flags = adjustedFlags;
- const int iconDimension = QS60StylePrivate::pixelMetric(PM_ToolBarIconSize);
+ const int iconDimension = QS60StylePrivate::pixelMetric(metric);
const QRect iconSize = (!option) ?
QRect(0, 0, iconDimension * iconWidthMultiplier, iconDimension * iconHeightMultiplier) : option->rect;
const QPixmap cachedPixMap(QS60StylePrivate::cachedPart(part, iconSize.size(), 0, flags));
diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h
index 8ec5eb9..0e76cf2 100644
--- a/src/gui/styles/qs60style.h
+++ b/src/gui/styles/qs60style.h
@@ -62,6 +62,94 @@ enum {
PM_CbaIconHeight
};
+enum {
+ SP_CustomToolBarAdd = QStyle::SP_CustomBase + 1,
+ SP_CustomToolBarAddDetail,
+ SP_CustomToolBarAgain,
+ SP_CustomToolBarAgenda,
+ SP_CustomToolBarAudioOff,
+ SP_CustomToolBarAudioOn,
+ SP_CustomToolBarBack,
+ SP_CustomToolBarBluetoothOff,
+ SP_CustomToolBarBluetoothOn,
+ SP_CustomToolBarCancel,
+ SP_CustomToolBarDelete,
+ SP_CustomToolBarDone,
+ SP_CustomToolBarEdit,
+ SP_CustomToolBarEditDisabled,
+ SP_CustomToolBarEmailSend,
+ SP_CustomToolBarEmergencyCall,
+ SP_CustomToolBarFavouriteAdd,
+ SP_CustomToolBarFavouriteRemove,
+ SP_CustomToolBarFavourites,
+ SP_CustomToolBarGo,
+ SP_CustomToolBarHome,
+ SP_CustomToolBarImageTools,
+ SP_CustomToolBarList,
+ SP_CustomToolBarLock,
+ SP_CustomToolBarLogs,
+ SP_CustomToolBarMenu,
+ SP_CustomToolBarNewContact,
+ SP_CustomToolBarNewGroup,
+ SP_CustomToolBarNextFrame,
+ SP_CustomToolBarNowPlay,
+ SP_CustomToolBarOptions,
+ SP_CustomToolBarOther,
+ SP_CustomToolBarOvi,
+ SP_CustomToolBarPreviousFrame,
+ SP_CustomToolBarRead,
+ SP_CustomToolBarRedoDisabled,
+ SP_CustomToolBarRedo,
+ SP_CustomToolBarRefresh,
+ SP_CustomToolBarRemoveDetail,
+ SP_CustomToolBarRemoveDisabled,
+ SP_CustomToolBarRepeat,
+ SP_CustomToolBarRepeatOff,
+ SP_CustomToolBarRepeatOne,
+ SP_CustomToolBarSearch,
+ SP_CustomToolBarSearchDisabled,
+ SP_CustomToolBarSelectContent,
+ SP_CustomToolBarSelfTimer,
+ SP_CustomToolBarSend,
+ SP_CustomToolBarSendDimmed,
+ SP_CustomToolBarShare,
+ SP_CustomToolBarShift,
+ SP_CustomToolBarShuffle,
+ SP_CustomToolBarShuffleOff,
+ SP_CustomToolBarSignalOff,
+ SP_CustomToolBarSignalOn,
+ SP_CustomToolBarSync,
+ SP_CustomToolBarTools,
+ SP_CustomToolBarTrim,
+ SP_CustomToolBarUnlock,
+ SP_CustomToolBarUnmark,
+ SP_CustomToolBarView,
+ SP_CustomToolBarWlanOff,
+ SP_CustomToolBarWlanOn,
+ SP_CustomCameraCaptureButton,
+ SP_CustomCameraCaptureButtonPressed,
+ SP_CustomCameraPauseButton,
+ SP_CustomCameraPauseButtonPressed,
+ SP_CustomCameraPlayButton,
+ SP_CustomCameraPlayButtonPressed,
+ SP_CustomCameraRecButton,
+ SP_CustomCameraRecButtonPressed,
+ SP_CustomCameraStopButton,
+ SP_CustomCameraStopButtonPressed,
+ SP_CustomTabAll,
+ SP_CustomTabArtist,
+ SP_CustomTabFavourite,
+ SP_CustomTabGenre,
+ SP_CustomTabLanguage,
+ SP_CustomTabMusicAlbum,
+ SP_CustomTabPhotosAlbum,
+ SP_CustomTabPhotosAll,
+ SP_CustomTabPlaylist,
+ SP_CustomTabServices,
+ SP_CustomTabSongs,
+ SP_CustomTabVideos
+};
+
class QS60StylePrivate;
class Q_GUI_EXPORT QS60Style : public QCommonStyle
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index 62c4b00..2fa8c7f 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -142,11 +142,11 @@ public:
SP_QgnGrafNsliderMiddle,
SP_QgnIndiCheckboxOff,
SP_QgnIndiCheckboxOn,
- SP_QgnIndiHlColSuper, // Available in S60 release 3.2 and later.
- SP_QgnIndiHlExpSuper, // Available in S60 release 3.2 and later.
- SP_QgnIndiHlLineBranch, // Available in S60 release 3.2 and later.
- SP_QgnIndiHlLineEnd, // Available in S60 release 3.2 and later.
- SP_QgnIndiHlLineStraight, // Available in S60 release 3.2 and later.
+ SP_QgnIndiHlColSuper,
+ SP_QgnIndiHlExpSuper,
+ SP_QgnIndiHlLineBranch,
+ SP_QgnIndiHlLineEnd,
+ SP_QgnIndiHlLineStraight,
SP_QgnIndiMarkedAdd,
SP_QgnIndiNaviArrowLeft,
SP_QgnIndiNaviArrowRight,
@@ -311,6 +311,102 @@ public:
SP_QsnFrListSideLPressed,
SP_QsnFrListSideRPressed,
SP_QsnFrListCenterPressed,
+ SP_QtgToolBarAdd,
+ SP_QtgToolBarAddDetail,
+ SP_QtgToolBarAgain,
+ SP_QtgToolBarAgenda,
+ SP_QtgToolBarAudioOff,
+ SP_QtgToolBarAudioOn,
+ SP_QtgToolBarBack,
+ SP_QtgToolBarBluetoothOff,
+ SP_QtgToolBarBluetoothOn,
+ SP_QtgToolBarCancel,
+ SP_QtgToolBarDelete,
+ SP_QtgToolBarDetails,
+ SP_QtgToolBarDone,
+ SP_QtgToolBarEdit,
+ SP_QtgToolBarEditDisabled,
+ SP_QtgToolBarEmailSend,
+ SP_QtgToolBarEmergencyCall,
+ SP_QtgToolBarFavouriteAdd,
+ SP_QtgToolBarFavouriteRemove,
+ SP_QtgToolBarFavourites,
+ SP_QtgToolBarForward,
+ SP_QtgToolBarGo,
+ SP_QtgToolBarHome,
+ SP_QtgToolBarImageTools,
+ SP_QtgToolBarList,
+ SP_QtgToolBarLock,
+ SP_QtgToolBarLogs,
+ SP_QtgToolBarMenu,
+ SP_QtgToolBarNewContact,
+ SP_QtgToolBarNewGroup,
+ SP_QtgToolBarNext,
+ SP_QtgToolBarNextFrame,
+ SP_QtgToolBarNowPlay,
+ SP_QtgToolBarOptions,
+ SP_QtgToolBarOther,
+ SP_QtgToolBarOvi,
+ SP_QtgToolBarPause,
+ SP_QtgToolBarPlay,
+ SP_QtgToolBarPrevious,
+ SP_QtgToolBarPreviousFrame,
+ SP_QtgToolBarRead,
+ SP_QtgToolBarRedo,
+ SP_QtgToolBarRedoDisabled,
+ SP_QtgToolBarRefresh,
+ SP_QtgToolBarRemoveDetail,
+ SP_QtgToolBarRemoveDisabled,
+ SP_QtgToolBarRepeat,
+ SP_QtgToolBarRepeatOff,
+ SP_QtgToolBarRepeatOne,
+ SP_QtgToolBarRewind,
+ SP_QtgToolBarSearch,
+ SP_QtgToolBarSearchDisabled,
+ SP_QtgToolBarSelectContent,
+ SP_QtgToolBarSelfTimer,
+ SP_QtgToolBarSend,
+ SP_QtgToolBarSendDimmed,
+ SP_QtgToolBarShare,
+ SP_QtgToolBarShift,
+ SP_QtgToolBarShuffle,
+ SP_QtgToolBarShuffleOff,
+ SP_QtgToolBarSignalOff,
+ SP_QtgToolBarSignalOn,
+ SP_QtgToolBarStop,
+ SP_QtgToolBarSync,
+ SP_QtgToolBarTools,
+ SP_QtgToolBarTrim,
+ SP_QtgToolBarUnlock,
+ SP_QtgToolBarUnmark,
+ SP_QtgToolBarView,
+ SP_QtgToolBarWlanOff,
+ SP_QtgToolBarWlanOn,
+ SP_QtgGrafCameraButtonCaptureNormal,
+ SP_QtgGrafCameraButtonCapturePressed,
+ SP_QtgGrafCameraButtonPauseNormal,
+ SP_QtgGrafCameraButtonPausePressed,
+ SP_QtgGrafCameraButtonPlayNormal,
+ SP_QtgGrafCameraButtonPlayPressed,
+ SP_QtgGrafCameraButtonRecNormal,
+ SP_QtgGrafCameraButtonRecPressed,
+ SP_QtgGrafCameraButtonStopNormal,
+ SP_QtgGrafCameraButtonStopPressed,
+ SP_QtgTabAll,
+ SP_QtgTabArtist,
+ SP_QtgTabFavourite,
+ SP_QtgTabGenre,
+ SP_QtgTabLanguage,
+ SP_QtgTabMusicAlbum,
+ SP_QtgTabPhotosAlbum,
+ SP_QtgTabPhotosAll,
+ SP_QtgTabPlaylist,
+ SP_QtgTabServices,
+ SP_QtgTabSongs,
+ SP_QtgTabVideos,
+ SP_QgnIndiBrowserTbReload,
+ SP_QgnIndiBrowserTbHome,
+ SP_QgnIndiBrowserTbStop,
};
enum ColorLists {
@@ -445,6 +541,7 @@ public:
SE_DropArea,
SE_TableItemPressed,
SE_ListItemPressed,
+ SE_DialogBackground,
};
enum SkinFrameElements {
@@ -464,6 +561,7 @@ public:
SF_ButtonInactive,
SF_TableItemPressed,
SF_ListItemPressed,
+ SF_DialogBackground,
};
enum SkinElementFlag {
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index 14fdbd3..913352a 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -413,6 +413,106 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = {
/* SP_QsnFrListSideLPressed */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2691},
/* SP_QsnFrListSideRPressed */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2692},
/* SP_QsnFrListCenterPressed */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2693},
+
+ /* SP_QtgToolBarAdd */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x27c0}, //KAknsIIDQtgToolbarAdd
+ /* SP_QtgToolBarAddDetail */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2778}, //KAknsIIDQtgToolbarAddDetail
+ /* SP_QtgToolbarAgain */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x271a}, //KAknsIIDQtgToolbarAgain
+ /* SP_QtgToolBarAgenda */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x281a}, //KAknsIIDQtgToolbarAgenda
+ /* SP_QtgToolBarAudioOff */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2751}, //KAknsIIDQtgToolbarAudioOff
+ /* SP_QtgToolBarAudioOn */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2752}, //KAknsIIDQtgToolbarAudioOn
+ /* SP_CustomToolBarBack */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x271b}, //KAknsIIDQtgToolbarBack
+ /* SP_QtgToolBarBluetoothOff */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2753}, //KAknsIIDQtgToolbarBluetoothOff
+ /* SP_QtgToolBarBluetoothOn */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2754}, //KAknsIIDQtgToolbarBluetoothOn
+ /* SP_QtgToolBarCancel */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2895}, //KAknsIIDQtgToolbarCancel
+ /* SP_QtgToolBarDelete */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2755}, //KAknsIIDQtgToolbarDelete
+ /* SP_QtgToolBarDetails */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x271e}, //KAknsIIDQtgToolbarDetails
+ /* SP_QtgToolBarDone */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x271f}, //KAknsIIDQtgToolbarDone
+ /* SP_QtgToolBarEdit */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2720}, //KAknsIIDQtgToolbarEdit
+ /* SP_QtgToolBarEditDisabled */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2946}, //KAknsIIDQtgToolbarEditDisabled
+ /* SP_QtgToolBarEmailSend */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x292f}, //KAknsIIDQtgToolbarEmailSend
+ /* SP_QtgToolBarEmergencyCall */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2721}, //KAknsIIDQtgToolbarEmergencyCall
+ /* SP_QtgToolBarFavouriteAdd */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x28ed}, //KAknsIIDQtgToolbarFavouriteAdd
+ /* SP_QtgToolBarFavouriteRemove */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x28ee}, //KAknsIIDQtgToolbarFavouriteRemove
+ /* SP_QtgToolBarFavourites */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x28b8}, //KAknsIIDQtgToolbarFavourites
+ /* SP_QtgToolBarForward */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x281b}, //KAknsIIDQtgToolbarForward
+ /* SP_QtgToolBarGo */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2930}, //KAknsIIDQtgToolbarGo
+ /* SP_QtgToolBarHome */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2722}, //KAknsIIDQtgToolbarHome
+ /* SP_QtgToolBarImageTools */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2947}, //KAknsIIDQtgToolbarImageTools
+ /* SP_QtgToolBarList */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x28b9}, //KAknsIIDQtgToolbarList
+ /* SP_QtgToolBarLock */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2723}, //KAknsIIDQtgToolbarLock
+ /* SP_QtgToolBarLogs */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x281c}, //KAknsIIDQtgToolbarLogs
+ /* SP_QtgToolBarMenu */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2724}, //KAknsIIDQtgToolbarMenu
+ /* SP_QtgToolBarNewContact */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2779}, //KAknsIIDQtgToolbarNewContact
+ /* SP_QtgToolBarNewGroup */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x277a}, //KAknsIIDQtgToolbarNewGroup
+ /* SP_QtgToolBarNext */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x281d}, //KAknsIIDQtgToolbarNext
+ /* SP_QtgToolBarNextFrame */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2981}, //KAknsIIDQtgToolbarNextFrame
+ /* SP_QtgToolBarNowPlay */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x28ef}, //KAknsIIDQtgToolbarNowplay
+ /* SP_QtgToolBarOptions */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2725}, //KAknsIIDQtgToolbarOptions
+ /* SP_QtgToolBarOther */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2726}, //KAknsIIDQtgToolbarOther
+ /* SP_QtgToolBarOvi */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2931}, //KAknsIIDQtgToolbarOvi
+ /* SP_QtgToolBarPause */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2727}, //KAknsIIDQtgToolbarPause
+ /* SP_QtgToolBarPlay */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2728}, //KAknsIIDQtgToolbarPlay
+ /* SP_QtgToolBarPrevious */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x281e}, //KAknsIIDQtgToolbarPrevious
+ /* SP_QtgToolBarPreviousFrame */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2982}, //KAknsIIDQtgToolbarPreviousFrame
+ /* SP_QtgToolBarRead */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2729}, //KAknsIIDQtgToolbarRead
+ /* SP_QtgToolBarRedo */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2948}, //KAknsIIDQtgToolbarRedo
+ /* SP_QtgToolBarRedoDisabled */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2949}, //KAknsIIDQtgToolbarRedoDisabled
+ /* SP_QtgToolBarRefresh */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2932}, //KAknsIIDQtgToolbarRefresh
+ /* SP_QtgToolBarRemoveDetail */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x277b}, //KAknsIIDQtgToolbarRemoveDetail
+ /* SP_QtgToolBarRemoveDisabled */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x294a}, //KAknsIIDQtgToolbarRemoveDisabled
+ /* SP_QtgToolBarRepeat */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x281f}, //KAknsIIDQtgToolbarRepeat
+ /* SP_QtgToolBarRepeatOff */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2820}, //KAknsIIDQtgToolbarRepeatOff
+ /* SP_QtgToolBarRepeatOne */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2821}, //KAknsIIDQtgToolbarRepeatOne
+ /* SP_QtgToolBarRewind */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2822}, //KAknsIIDQtgToolbarRewind
+ /* SP_QtgToolBarSearch */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x272a}, //KAknsIIDQtgToolbarSearch
+ /* SP_QtgToolBarSearchDisabled */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x294b}, //KAknsIIDQtgToolbarSearchDisabled
+ /* SP_QtgToolBarSelectContent */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x294c}, //KAknsIIDQtgToolbarSelectContent
+ /* SP_QtgToolBarSelfTimer */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2756}, //KAknsIIDQtgToolbarSelfTimer
+ /* SP_QtgToolBarSend */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x272b}, //KAknsIIDQtgToolbarSend
+ /* SP_QtgToolBarSendDimmed */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x29b0}, //KAknsIIDQtgToolbarSendDimmed
+ /* SP_QtgToolBarShare */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2823}, //KAknsIIDQtgToolbarShare
+ /* SP_QtgToolBarShift */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x272c}, //KAknsIIDQtgToolbarShift
+ /* SP_QtgToolBarShuffle */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2824}, //KAknsIIDQtgToolbarShuffle
+ /* SP_QtgToolBarShuffleOff */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2825}, //KAknsIIDQtgToolbarShuffleOff
+ /* SP_QtgToolBarSignalOff */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2757}, //KAknsIIDQtgToolbarSignalOff
+ /* SP_QtgToolBarSignalOn */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2758}, //KAknsIIDQtgToolbarSignalOn
+ /* SP_QtgToolBarStop */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x272d}, //KAknsIIDQtgToolbarStop
+ /* SP_QtgToolBarSync */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2894}, //KAknsIIDQtgToolbarSync
+ /* SP_QtgToolBarTools */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2983}, //KAknsIIDQtgToolbarTools
+ /* SP_QtgToolBarTrim */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2954}, //KAknsIIDQtgToolbarTrim
+ /* SP_QtgToolBarUnlock */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x272e}, //KAknsIIDQtgToolbarUnlock
+ /* SP_QtgToolBarUnmark */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x272f}, //KAknsIIDQtgToolbarUnmark
+ /* SP_QtgToolBarView */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2730}, //KAknsIIDQtgToolbarView
+ /* SP_QtgToolBarWlanOff */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2759}, //KAknsIIDQtgToolbarWlanOff
+ /* SP_QtgToolBarWlanOn */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x275a}, //KAknsIIDQtgToolbarWlanOn
+
+ /* SP_QtgGrafCameraButtonCaptureNormal */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x2743}, //KAknsIIDQtgGrafCameraButtonCaptureNormal (already in 9.2)
+ /* SP_QtgGrafCameraButtonCapturePressed */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x2744}, //KAknsIIDQtgGrafCameraButtonCapturePressed
+ /* SP_QtgGrafCameraButtonPauseNormal */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x2745}, //KAknsIIDQtgGrafCameraButtonPauseNormal
+ /* SP_QtgGrafCameraButtonPausePressed */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x2746}, //KAknsIIDQtgGrafCameraButtonPausePressed
+ /* SP_QtgGrafCameraButtonPlayNormal */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x2747}, //KAknsIIDQtgGrafCameraButtonPlayNormal
+ /* SP_QtgGrafCameraButtonPlayPressed */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x2748}, //KAknsIIDQtgGrafCameraButtonPlayPressed
+ /* SP_QtgGrafCameraButtonRecNormal */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x2749}, //KAknsIIDQtgGrafCameraButtonRecNormal
+ /* SP_QtgGrafCameraButtonRecPressed */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x274a}, //KAknsIIDQtgGrafCameraButtonRecPressed
+ /* SP_QtgGrafCameraButtonStopNormal */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x274b}, //KAknsIIDQtgGrafCameraButtonStopNormal
+ /* SP_QtgGrafCameraButtonStopPressed */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x274c}, //KAknsIIDQtgGrafCameraButtonStopPressed
+
+ /* SP_QtgTabAll */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2851}, //KAknsIIDQtgTabAll
+ /* SP_QtgTabArtist */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x288f}, //KAknsIIDQtgTabArtist
+ /* SP_QtgTabFavourite */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x28eb}, //KAknsIIDQtgTabFavourite
+ /* SP_QtgTabGenre */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2890}, //KAknsIIDQtgTabGenre
+ /* SP_QtgTabLanguage */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x28ec}, //KAknsIIDQtgTabLanguage
+ /* SP_QtgTabMusicAlbum */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2891}, //KAknsIIDQtgTabMusicAlbum
+ /* SP_QtgTabPhotosAlbum */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2818}, //KAknsIIDQtgTabPhotosAlbum
+ /* SP_QtgTabPhotosAll */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2819}, //KAknsIIDQtgTabPhotosAll
+ /* SP_QtgTabPlaylist */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2892}, //KAknsIIDQtgTabPlaylist
+ /* SP_QtgTabServices */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x274f}, //KAknsIIDQtgTabServices
+ /* SP_QtgTabSongs */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2893}, //KAknsIIDQtgTabSongs
+ /* SP_QtgTabVideos */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2750}, //KAknsIIDQtgTabVideos
+
+ /* SP_QgnIndiBrowserTbReload */ {KAknsIIDQgnIndiBrowserTbReload, EDrawIcon, ES60_All, -1, -1},
+ /* SP_QgnIndiBrowserTbHome */ {KAknsIIDQgnIndiBrowserTbHome, EDrawIcon, ES60_All, -1, -1},
+ /* SP_QgnIndiBrowserTbStop */ {KAknsIIDQgnIndiBrowserTbStop, EDrawIcon, ES60_All, -1, -1},
};
QPixmap QS60StyleModeSpecifics::skinnedGraphics(
@@ -1060,6 +1160,10 @@ void QS60StyleModeSpecifics::frameIdAndCenterId(QS60StylePrivate::SkinFrameEleme
centerId.Set(KAknsIIDQsnFrPopupCenterSubmenu);
frameId.Set(KAknsIIDQsnFrPopupSub);
break;
+ case QS60StylePrivate::SF_DialogBackground:
+ centerId.Set(KAknsIIDQsnFrPopupCenter);
+ frameId.Set(KAknsIIDQsnFrPopup);
+ break;
case QS60StylePrivate::SF_SettingsList:
// Starting from S60_5_3, the root theme has been changed so that KAknsIIDQsnFrSetOpt is empty.
// Set the theme ID to None, to avoid theme server trying to draw the empty frame.
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 98186df..3762f39 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -218,16 +218,14 @@ struct QtFontStyle
Key(const QString &styleString);
Key() : style(QFont::StyleNormal),
weight(QFont::Normal), stretch(0) { }
- Key(const Key &o) : style(o.style),
- weight(o.weight), stretch(o.stretch) { }
+ Key(const Key &o) : style(o.style), weight(o.weight), stretch(o.stretch) { }
uint style : 2;
signed int weight : 8;
signed int stretch : 12;
bool operator==(const Key & other) {
- return (style == other.style &&
- weight == other.weight &&
- (stretch == 0 || other.stretch == 0 || stretch == other.stretch));
+ return (style == other.style && weight == other.weight &&
+ (stretch == 0 || other.stretch == 0 || stretch == other.stretch));
}
bool operator!=(const Key &other) {
return !operator==(other);
@@ -279,6 +277,7 @@ struct QtFontStyle
bool smoothScalable : 1;
signed int count : 30;
QtFontSize *pixelSizes;
+ QString styleName;
#ifdef Q_WS_X11
const char *weightName;
@@ -353,13 +352,20 @@ struct QtFontFoundry
int count;
QtFontStyle **styles;
- QtFontStyle *style(const QtFontStyle::Key &, bool = false);
+ QtFontStyle *style(const QtFontStyle::Key &, const QString & = QString(), bool = false);
};
-QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, bool create)
+QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, const QString &styleName, bool create)
{
int pos = 0;
if (count) {
+ // if styleName for searching first if possible
+ if (!styleName.isEmpty()) {
+ for (; pos < count; pos++) {
+ if (styles[pos]->styleName == styleName)
+ return styles[pos];
+ }
+ }
int low = 0;
int high = count;
pos = count / 2;
@@ -386,6 +392,7 @@ QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, bool create)
}
QtFontStyle *style = new QtFontStyle(key);
+ style->styleName = styleName;
memmove(styles + pos + 1, styles + pos, (count-pos)*sizeof(QtFontStyle *));
styles[pos] = style;
count++;
@@ -814,7 +821,7 @@ void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundr
}
QtFontFoundry *foundry = f->foundry(QString::fromLatin1(foundryname), true);
- QtFontStyle *style = foundry->style(styleKey, true);
+ QtFontStyle *style = foundry->style(styleKey, QString(), true);
style->smoothScalable = (pixelSize == 0);
style->antialiased = antialiased;
QtFontSize *size = style->pixelSize(pixelSize?pixelSize:SMOOTH_SCALABLE, true);
@@ -1131,7 +1138,8 @@ QString QFontDatabase::resolveFontFamilyAlias(const QString &family)
#endif
QT_END_INCLUDE_NAMESPACE
-static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey)
+static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey,
+ const QString &styleName = QString())
{
int best = 0;
int dist = 0xffff;
@@ -1139,6 +1147,12 @@ static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &st
for ( int i = 0; i < foundry->count; i++ ) {
QtFontStyle *style = foundry->styles[i];
+ if (!styleName.isEmpty() && styleName == style->styleName) {
+ dist = 0;
+ best = i;
+ break;
+ }
+
int d = qAbs( styleKey.weight - style->key.weight );
if ( styleKey.stretch != 0 && style->key.stretch != 0 ) {
@@ -1532,7 +1546,8 @@ static QString styleStringHelper(int weight, QFont::Style style)
*/
QString QFontDatabase::styleString(const QFont &font)
{
- return styleStringHelper(font.weight(), font.style());
+ return font.styleName().isEmpty() ? styleStringHelper(font.weight(), font.style())
+ : font.styleName();
}
/*!
@@ -1542,7 +1557,8 @@ QString QFontDatabase::styleString(const QFont &font)
*/
QString QFontDatabase::styleString(const QFontInfo &fontInfo)
{
- return styleStringHelper(fontInfo.weight(), fontInfo.style());
+ return fontInfo.styleName().isEmpty() ? styleStringHelper(fontInfo.weight(), fontInfo.style())
+ : fontInfo.styleName();
}
@@ -1788,13 +1804,17 @@ QStringList QFontDatabase::styles(const QString &family) const
for (int k = 0; k < foundry->count; k++) {
QtFontStyle::Key ke(foundry->styles[k]->key);
ke.stretch = 0;
- allStyles.style(ke, true);
+ allStyles.style(ke, foundry->styles[k]->styleName, true);
}
}
}
- for (int i = 0; i < allStyles.count; i++)
- l.append(styleStringHelper(allStyles.styles[i]->key.weight, (QFont::Style)allStyles.styles[i]->key.style));
+ for (int i = 0; i < allStyles.count; i++) {
+ l.append(allStyles.styles[i]->styleName.isEmpty() ?
+ styleStringHelper(allStyles.styles[i]->key.weight,
+ (QFont::Style)allStyles.styles[i]->key.style) :
+ allStyles.styles[i]->styleName);
+ }
return l;
}
@@ -1852,7 +1872,9 @@ bool QFontDatabase::isBitmapScalable(const QString &family,
QtFontFoundry *foundry = f->foundries[j];
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
for (int k = 0; k < foundry->count; k++)
- if ((style.isEmpty() || foundry->styles[k]->key == styleKey)
+ if ((style.isEmpty() ||
+ foundry->styles[k]->styleName == style ||
+ foundry->styles[k]->key == styleKey)
&& foundry->styles[k]->bitmapScalable && !foundry->styles[k]->smoothScalable) {
bitmapScalable = true;
goto end;
@@ -1891,7 +1913,9 @@ bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &sty
QtFontFoundry *foundry = f->foundries[j];
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
for (int k = 0; k < foundry->count; k++)
- if ((style.isEmpty() || foundry->styles[k]->key == styleKey) && foundry->styles[k]->smoothScalable) {
+ if ((style.isEmpty() ||
+ foundry->styles[k]->styleName == style ||
+ foundry->styles[k]->key == styleKey) && foundry->styles[k]->smoothScalable) {
smoothScalable = true;
goto end;
}
@@ -1924,12 +1948,12 @@ bool QFontDatabase::isScalable(const QString &family,
\sa smoothSizes(), standardSizes()
*/
QList<int> QFontDatabase::pointSizes(const QString &family,
- const QString &style)
+ const QString &styleName)
{
#if defined(Q_WS_WIN)
// windows and macosx are always smoothly scalable
Q_UNUSED(family);
- Q_UNUSED(style);
+ Q_UNUSED(styleName);
return standardSizes();
#else
bool smoothScalable = false;
@@ -1940,7 +1964,7 @@ QList<int> QFontDatabase::pointSizes(const QString &family,
QT_PREPEND_NAMESPACE(load)(familyName);
- QtFontStyle::Key styleKey(style);
+ QtFontStyle::Key styleKey(styleName);
QList<int> sizes;
@@ -1957,7 +1981,7 @@ QList<int> QFontDatabase::pointSizes(const QString &family,
for (int j = 0; j < fam->count; j++) {
QtFontFoundry *foundry = fam->foundries[j];
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
- QtFontStyle *style = foundry->style(styleKey);
+ QtFontStyle *style = foundry->style(styleKey, styleName);
if (!style) continue;
if (style->smoothScalable) {
@@ -2008,17 +2032,20 @@ QFont QFontDatabase::font(const QString &family, const QString &style,
QtFontFoundry *foundry = f->foundries[j];
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
for (int k = 0; k < foundry->count; k++)
- allStyles.style(foundry->styles[k]->key, true);
+ allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
}
}
QtFontStyle::Key styleKey(style);
- QtFontStyle *s = bestStyle(&allStyles, styleKey);
+ QtFontStyle *s = bestStyle(&allStyles, styleKey, style);
if (!s) // no styles found?
return QApplication::font();
+
QFont fnt(family, pointSize, s->key.weight);
fnt.setStyle((QFont::Style)s->key.style);
+ if (!s->styleName.isEmpty())
+ fnt.setStyleName(s->styleName);
return fnt;
}
@@ -2032,11 +2059,11 @@ QFont QFontDatabase::font(const QString &family, const QString &style,
\sa pointSizes(), standardSizes()
*/
QList<int> QFontDatabase::smoothSizes(const QString &family,
- const QString &style)
+ const QString &styleName)
{
#ifdef Q_WS_WIN
Q_UNUSED(family);
- Q_UNUSED(style);
+ Q_UNUSED(styleName);
return QFontDatabase::standardSizes();
#else
bool smoothScalable = false;
@@ -2047,7 +2074,7 @@ QList<int> QFontDatabase::smoothSizes(const QString &family,
QT_PREPEND_NAMESPACE(load)(familyName);
- QtFontStyle::Key styleKey(style);
+ QtFontStyle::Key styleKey(styleName);
QList<int> sizes;
@@ -2064,7 +2091,7 @@ QList<int> QFontDatabase::smoothSizes(const QString &family,
for (int j = 0; j < fam->count; j++) {
QtFontFoundry *foundry = fam->foundries[j];
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
- QtFontStyle *style = foundry->style(styleKey);
+ QtFontStyle *style = foundry->style(styleKey, styleName);
if (!style) continue;
if (style->smoothScalable) {
@@ -2131,12 +2158,12 @@ bool QFontDatabase::italic(const QString &family, const QString &style) const
QtFontFoundry *foundry = f->foundries[j];
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
for (int k = 0; k < foundry->count; k++)
- allStyles.style(foundry->styles[k]->key, true);
+ allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
}
}
QtFontStyle::Key styleKey(style);
- QtFontStyle *s = allStyles.style(styleKey);
+ QtFontStyle *s = allStyles.style(styleKey, style);
return s && s->key.style == QFont::StyleItalic;
}
@@ -2166,12 +2193,12 @@ bool QFontDatabase::bold(const QString &family,
if (foundryName.isEmpty() ||
foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
for (int k = 0; k < foundry->count; k++)
- allStyles.style(foundry->styles[k]->key, true);
+ allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
}
}
QtFontStyle::Key styleKey(style);
- QtFontStyle *s = allStyles.style(styleKey);
+ QtFontStyle *s = allStyles.style(styleKey, style);
return s && s->key.weight >= QFont::Bold;
}
@@ -2202,12 +2229,12 @@ int QFontDatabase::weight(const QString &family,
if (foundryName.isEmpty() ||
foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
for (int k = 0; k < foundry->count; k++)
- allStyles.style(foundry->styles[k]->key, true);
+ allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
}
}
QtFontStyle::Key styleKey(style);
- QtFontStyle *s = allStyles.style(styleKey);
+ QtFontStyle *s = allStyles.style(styleKey, style);
return s ? s->key.weight : -1;
}
diff --git a/src/gui/text/qfontdatabase_mac.cpp b/src/gui/text/qfontdatabase_mac.cpp
index 60cf586..fc8247d 100644
--- a/src/gui/text/qfontdatabase_mac.cpp
+++ b/src/gui/text/qfontdatabase_mac.cpp
@@ -106,12 +106,14 @@ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
CTFontDescriptorRef font = (CTFontDescriptorRef)CFArrayGetValueAtIndex(fonts, i);
QCFString family_name = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute);
+ QCFString style_name = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontStyleNameAttribute);
QtFontFamily *family = db->family(family_name, true);
for(int ws = 1; ws < QFontDatabase::WritingSystemsCount; ++ws)
family->writingSystems[ws] = QtFontFamily::Supported;
QtFontFoundry *foundry = family->foundry(foundry_name, true);
QtFontStyle::Key styleKey;
+ QString styleName = style_name;
if(QCFType<CFDictionaryRef> styles = (CFDictionaryRef)CTFontDescriptorCopyAttribute(font, kCTFontTraitsAttribute)) {
if(CFNumberRef weight = (CFNumberRef)CFDictionaryGetValue(styles, kCTFontWeightTrait)) {
Q_ASSERT(CFNumberIsFloatType(weight));
@@ -132,7 +134,7 @@ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
}
}
- QtFontStyle *style = foundry->style(styleKey, true);
+ QtFontStyle *style = foundry->style(styleKey, styleName, true);
style->smoothScalable = true;
if(QCFType<CFNumberRef> size = (CFNumberRef)CTFontDescriptorCopyAttribute(font, kCTFontSizeAttribute)) {
//qDebug() << "WHEE";
@@ -205,7 +207,7 @@ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
QtFontFamily *family = db->family(familyName, true);
QtFontFoundry *foundry = family->foundry(QString(), true);
- QtFontStyle *style = foundry->style(styleKey, true);
+ QtFontStyle *style = foundry->style(styleKey, QString(), true);
style->pixelSize(0, true);
style->smoothScalable = true;
diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp
index fd5c6b4..6b6f4f1 100644
--- a/src/gui/text/qfontdatabase_qpa.cpp
+++ b/src/gui/text/qfontdatabase_qpa.cpp
@@ -73,7 +73,7 @@ Q_GUI_EXPORT void qt_registerFont(const QString &familyName, const QString &fou
}
QtFontFoundry *foundry = f->foundry(foundryname, true);
- QtFontStyle *fontStyle = foundry->style(styleKey, true);
+ QtFontStyle *fontStyle = foundry->style(styleKey, QString(), true);
fontStyle->smoothScalable = scalable;
fontStyle->antialiased = antialiased;
QtFontSize *size = fontStyle->pixelSize(pixelSize?pixelSize:SMOOTH_SCALABLE, true);
diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp
index 980b5de..2f4d055 100644
--- a/src/gui/text/qfontdatabase_s60.cpp
+++ b/src/gui/text/qfontdatabase_s60.cpp
@@ -508,7 +508,7 @@ static bool registerScreenDeviceFont(int screenDeviceFontIndex,
QtFontFamily *family = privateDb()->family(familyName, true);
family->fixedPitch = faceAttrib.IsMonoWidth();
QtFontFoundry *foundry = family->foundry(QString(), true);
- QtFontStyle *style = foundry->style(styleKey, true);
+ QtFontStyle *style = foundry->style(styleKey, QString(), true);
style->smoothScalable = typefaceSupport.iIsScalable;
style->pixelSize(0, true);
diff --git a/src/gui/text/qfontdatabase_win.cpp b/src/gui/text/qfontdatabase_win.cpp
index 20f945a..788eb30 100644
--- a/src/gui/text/qfontdatabase_win.cpp
+++ b/src/gui/text/qfontdatabase_win.cpp
@@ -284,7 +284,7 @@ void addFontToDatabase(QString familyName, const QString &scriptName,
family->english_name = getEnglishName(familyName);
QtFontFoundry *foundry = family->foundry(foundryName, true);
- QtFontStyle *style = foundry->style(styleKey, true);
+ QtFontStyle *style = foundry->style(styleKey, QString(), true);
style->smoothScalable = scalable;
style->pixelSize( size, TRUE);
@@ -292,14 +292,14 @@ void addFontToDatabase(QString familyName, const QString &scriptName,
if (styleKey.weight <= QFont::DemiBold) {
QtFontStyle::Key key(styleKey);
key.weight = QFont::Bold;
- QtFontStyle *style = foundry->style(key, true);
+ QtFontStyle *style = foundry->style(key, QString(), true);
style->smoothScalable = scalable;
style->pixelSize( size, TRUE);
}
if (styleKey.style != QFont::StyleItalic) {
QtFontStyle::Key key(styleKey);
key.style = QFont::StyleItalic;
- QtFontStyle *style = foundry->style(key, true);
+ QtFontStyle *style = foundry->style(key, QString(), true);
style->smoothScalable = scalable;
style->pixelSize( size, TRUE);
}
@@ -307,7 +307,7 @@ void addFontToDatabase(QString familyName, const QString &scriptName,
QtFontStyle::Key key(styleKey);
key.weight = QFont::Bold;
key.style = QFont::StyleItalic;
- QtFontStyle *style = foundry->style(key, true);
+ QtFontStyle *style = foundry->style(key, QString(), true);
style->smoothScalable = scalable;
style->pixelSize( size, TRUE);
}
diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp
index 958daa2..922a97f 100644
--- a/src/gui/text/qfontdatabase_x11.cpp
+++ b/src/gui/text/qfontdatabase_x11.cpp
@@ -680,7 +680,7 @@ static void loadXlfds(const char *reqFamily, int encoding_id)
family->fontFileIndex = -1;
family->symbol_checked = true;
QtFontFoundry *foundry = family->foundry(QLatin1String(foundryName), true);
- QtFontStyle *style = foundry->style(styleKey, true);
+ QtFontStyle *style = foundry->style(styleKey, QString(), true);
delete [] style->weightName;
style->weightName = qstrdup(tokens[Weight]);
@@ -1034,13 +1034,14 @@ static void loadFontConfig()
FcChar8 *file_value;
int index_value;
FcChar8 *foundry_value;
+ FcChar8 *style_value;
FcBool scalable;
{
FcObjectSet *os = FcObjectSetCreate();
FcPattern *pattern = FcPatternCreate();
const char *properties [] = {
- FC_FAMILY, FC_WEIGHT, FC_SLANT,
+ FC_FAMILY, FC_STYLE, FC_WEIGHT, FC_SLANT,
FC_SPACING, FC_FILE, FC_INDEX,
FC_LANG, FC_CHARSET, FC_FOUNDRY, FC_SCALABLE, FC_PIXEL_SIZE, FC_WEIGHT,
FC_WIDTH,
@@ -1085,6 +1086,8 @@ static void loadFontConfig()
scalable = FcTrue;
if (FcPatternGetString(fonts->fonts[i], FC_FOUNDRY, 0, &foundry_value) != FcResultMatch)
foundry_value = 0;
+ if (FcPatternGetString(fonts->fonts[i], FC_STYLE, 0, &style_value) != FcResultMatch)
+ style_value = 0;
QtFontFamily *family = db->family(familyName, true);
FcLangSet *langset = 0;
@@ -1142,6 +1145,7 @@ static void loadFontConfig()
family->fontFileIndex = index_value;
QtFontStyle::Key styleKey;
+ QString styleName = style_value ? QString::fromUtf8((const char *) style_value) : QString();
styleKey.style = (slant_value == FC_SLANT_ITALIC)
? QFont::StyleItalic
: ((slant_value == FC_SLANT_OBLIQUE)
@@ -1156,7 +1160,7 @@ static void loadFontConfig()
QtFontFoundry *foundry
= family->foundry(foundry_value ? QString::fromUtf8((const char *)foundry_value) : QString(), true);
- QtFontStyle *style = foundry->style(styleKey, true);
+ QtFontStyle *style = foundry->style(styleKey, styleName, true);
if (spacing_value < FC_MONO)
family->fixedPitch = false;
@@ -1208,7 +1212,7 @@ static void loadFontConfig()
for (int i = 0; i < 4; ++i) {
styleKey.style = (i%2) ? QFont::StyleNormal : QFont::StyleItalic;
styleKey.weight = (i > 1) ? QFont::Bold : QFont::Normal;
- QtFontStyle *style = foundry->style(styleKey, true);
+ QtFontStyle *style = foundry->style(styleKey, QString(), true);
style->smoothScalable = true;
QtFontSize *size = style->pixelSize(SMOOTH_SCALABLE, true);
QtFontEncoding *enc = size->encodingID(-1, 0, 0, 0, 0, true);
@@ -1356,7 +1360,7 @@ static void initializeDb()
if (equiv) continue;
// let's fake one...
- equiv = foundry->style(key, true);
+ equiv = foundry->style(key, QString(), true);
equiv->smoothScalable = true;
QtFontSize *equiv_size = equiv->pixelSize(SMOOTH_SCALABLE, true);
diff --git a/src/gui/text/qfontengine_coretext.mm b/src/gui/text/qfontengine_coretext.mm
index 64b8682..64d4a24 100644
--- a/src/gui/text/qfontengine_coretext.mm
+++ b/src/gui/text/qfontengine_coretext.mm
@@ -492,17 +492,6 @@ void QCoreTextFontEngine::init()
avgCharWidth = QFixed::fromReal(width * fontDef.pixelSize / emSize);
} else
avgCharWidth = QFontEngine::averageCharWidth();
-
- ctMaxCharWidth = ctMinLeftBearing = ctMinRightBearing = 0;
- QByteArray hheaTable = getSfntTable(MAKE_TAG('h', 'h', 'e', 'a'));
- if (hheaTable.size() >= 16) {
- quint16 width = qFromBigEndian<quint16>(reinterpret_cast<const uchar *>(hheaTable.constData() + 10));
- ctMaxCharWidth = width * fontDef.pixelSize / emSize;
- qint16 bearing = qFromBigEndian<qint16>(reinterpret_cast<const uchar *>(hheaTable.constData() + 12));
- ctMinLeftBearing = bearing * fontDef.pixelSize / emSize;
- bearing = qFromBigEndian<qint16>(reinterpret_cast<const uchar *>(hheaTable.constData() + 14));
- ctMinRightBearing = bearing * fontDef.pixelSize / emSize;
- }
}
bool QCoreTextFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs,
@@ -599,20 +588,17 @@ QFixed QCoreTextFontEngine::averageCharWidth() const
qreal QCoreTextFontEngine::maxCharWidth() const
{
- return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? qRound(ctMaxCharWidth) : ctMaxCharWidth;
+ return 0;
}
qreal QCoreTextFontEngine::minLeftBearing() const
{
- return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? qRound(ctMinLeftBearing) : ctMinLeftBearing;
+ return 0;
}
qreal QCoreTextFontEngine::minRightBearing() const
{
- return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? qRound(ctMinRightBearing) : ctMinLeftBearing;
+ return 0;
}
void QCoreTextFontEngine::draw(CGContextRef ctx, qreal x, qreal y, const QTextItemInt &ti, int paintDeviceHeight)
@@ -732,8 +718,9 @@ void QCoreTextFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *position
QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition, int margin, bool aa)
{
+ Q_UNUSED(margin);
const glyph_metrics_t br = boundingBox(glyph);
- QImage im(qRound(br.width) + margin * 2, qRound(br.height) + margin * 2, QImage::Format_RGB32);
+ QImage im(qRound(br.width) + 2, qRound(br.height) + 2, QImage::Format_RGB32);
im.fill(0);
CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
@@ -764,8 +751,8 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
CGContextSetFont(ctx, cgFont);
- qreal pos_x = -br.x.toReal() + subPixelPosition.toReal() + margin;
- qreal pos_y = im.height() + br.y.toReal() - margin;
+ qreal pos_x = -br.x.truncate() + subPixelPosition.toReal();
+ qreal pos_y = im.height() + br.y.toReal();
CGContextSetTextPosition(ctx, pos_x, pos_y);
CGSize advance;
diff --git a/src/gui/text/qfontengine_coretext_p.h b/src/gui/text/qfontengine_coretext_p.h
index 3ca8a0a..efe8295 100644
--- a/src/gui/text/qfontengine_coretext_p.h
+++ b/src/gui/text/qfontengine_coretext_p.h
@@ -103,9 +103,6 @@ private:
int synthesisFlags;
CGAffineTransform transform;
QFixed avgCharWidth;
- qreal ctMaxCharWidth;
- qreal ctMinLeftBearing;
- qreal ctMinRightBearing;
friend class QCoreTextFontEngineMulti;
};
diff --git a/src/gui/text/qfontenginedirectwrite.cpp b/src/gui/text/qfontenginedirectwrite.cpp
index 890cad9..d693273 100644
--- a/src/gui/text/qfontenginedirectwrite.cpp
+++ b/src/gui/text/qfontenginedirectwrite.cpp
@@ -390,6 +390,60 @@ glyph_metrics_t QFontEngineDirectWrite::boundingBox(const QGlyphLayout &glyphs)
return glyph_metrics_t(0, -m_ascent, w - lastRightBearing(glyphs), m_ascent + m_descent, w, 0);
}
+glyph_metrics_t QFontEngineDirectWrite::alphaMapBoundingBox(glyph_t glyph, QFixed subPixelPosition,
+ const QTransform &matrix,
+ GlyphFormat /*format*/)
+{
+ glyph_metrics_t bbox = QFontEngine::boundingBox(glyph, matrix); // To get transformed advance
+
+ UINT16 glyphIndex = glyph;
+ FLOAT glyphAdvance = 0;
+
+ DWRITE_GLYPH_OFFSET glyphOffset;
+ glyphOffset.advanceOffset = 0;
+ glyphOffset.ascenderOffset = 0;
+
+ DWRITE_GLYPH_RUN glyphRun;
+ glyphRun.fontFace = m_directWriteFontFace;
+ glyphRun.fontEmSize = fontDef.pixelSize;
+ glyphRun.glyphCount = 1;
+ glyphRun.glyphIndices = &glyphIndex;
+ glyphRun.glyphAdvances = &glyphAdvance;
+ glyphRun.isSideways = false;
+ glyphRun.bidiLevel = 0;
+ glyphRun.glyphOffsets = &glyphOffset;
+
+ DWRITE_MATRIX transform;
+ transform.dx = subPixelPosition.toReal();
+ transform.dy = 0;
+ transform.m11 = matrix.m11();
+ transform.m12 = matrix.m12();
+ transform.m21 = matrix.m21();
+ transform.m22 = matrix.m22();
+
+ IDWriteGlyphRunAnalysis *glyphAnalysis = NULL;
+ HRESULT hr = m_directWriteFactory->CreateGlyphRunAnalysis(
+ &glyphRun,
+ 1.0f,
+ &transform,
+ DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC,
+ DWRITE_MEASURING_MODE_NATURAL,
+ 0.0, 0.0,
+ &glyphAnalysis
+ );
+
+ if (SUCCEEDED(hr)) {
+ RECT rect;
+ glyphAnalysis->GetAlphaTextureBounds(DWRITE_TEXTURE_CLEARTYPE_3x1, &rect);
+ glyphAnalysis->Release();
+
+ return glyph_metrics_t(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
+ bbox.xoff, bbox.yoff);
+ } else {
+ return glyph_metrics_t();
+ }
+}
+
glyph_metrics_t QFontEngineDirectWrite::boundingBox(glyph_t g)
{
if (m_directWriteFontFace == 0)
@@ -459,9 +513,10 @@ qreal QFontEngineDirectWrite::maxCharWidth() const
extern uint qt_pow_gamma[256];
-QImage QFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition)
+QImage QFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition,
+ const QTransform &xform)
{
- QImage im = imageForGlyph(glyph, subPixelPosition, 0, QTransform());
+ QImage im = imageForGlyph(glyph, subPixelPosition, 0, xform);
QImage indexed(im.width(), im.height(), QImage::Format_Indexed8);
QVector<QRgb> colors(256);
@@ -492,12 +547,8 @@ QImage QFontEngineDirectWrite::imageForGlyph(glyph_t t,
int margin,
const QTransform &xform)
{
- glyph_metrics_t metrics = QFontEngine::boundingBox(t, xform);
- int width = (metrics.width + margin * 2 + 4).ceil().toInt() ;
- int height = (metrics.height + margin * 2 + 4).ceil().toInt();
-
UINT16 glyphIndex = t;
- FLOAT glyphAdvance = metrics.xoff.toReal();
+ FLOAT glyphAdvance = 0;
DWRITE_GLYPH_OFFSET glyphOffset;
glyphOffset.advanceOffset = 0;
@@ -513,12 +564,9 @@ QImage QFontEngineDirectWrite::imageForGlyph(glyph_t t,
glyphRun.bidiLevel = 0;
glyphRun.glyphOffsets = &glyphOffset;
- QFixed x = margin - metrics.x.round() + subPixelPosition;
- QFixed y = margin - metrics.y.floor();
-
DWRITE_MATRIX transform;
- transform.dx = x.toReal();
- transform.dy = y.toReal();
+ transform.dx = subPixelPosition.toReal();
+ transform.dy = 0;
transform.m11 = xform.m11();
transform.m12 = xform.m12();
transform.m21 = xform.m21();
@@ -537,48 +585,54 @@ QImage QFontEngineDirectWrite::imageForGlyph(glyph_t t,
if (SUCCEEDED(hr)) {
RECT rect;
- rect.left = 0;
- rect.top = 0;
- rect.right = width;
- rect.bottom = height;
-
- int size = width * height * 3;
- BYTE *alphaValues = new BYTE[size];
- qMemSet(alphaValues, size, 0);
-
- hr = glyphAnalysis->CreateAlphaTexture(DWRITE_TEXTURE_CLEARTYPE_3x1,
- &rect,
- alphaValues,
- size);
-
- if (SUCCEEDED(hr)) {
- QImage img(width, height, QImage::Format_RGB32);
- img.fill(0xffffffff);
+ glyphAnalysis->GetAlphaTextureBounds(DWRITE_TEXTURE_CLEARTYPE_3x1, &rect);
- for (int y=0; y<height; ++y) {
- uint *dest = reinterpret_cast<uint *>(img.scanLine(y));
- BYTE *src = alphaValues + width * 3 * y;
+ rect.left -= margin;
+ rect.top -= margin;
+ rect.right += margin;
+ rect.bottom += margin;
- for (int x=0; x<width; ++x) {
- dest[x] = *(src) << 16
- | *(src + 1) << 8
- | *(src + 2);
+ int width = rect.right - rect.left;
+ int height = rect.bottom - rect.top;
- src += 3;
+ int size = width * height * 3;
+ if (size > 0) {
+ BYTE *alphaValues = new BYTE[size];
+ qMemSet(alphaValues, size, 0);
+
+ hr = glyphAnalysis->CreateAlphaTexture(DWRITE_TEXTURE_CLEARTYPE_3x1,
+ &rect,
+ alphaValues,
+ size);
+
+ if (SUCCEEDED(hr)) {
+ QImage img(width, height, QImage::Format_RGB32);
+ img.fill(0xffffffff);
+
+ for (int y=0; y<height; ++y) {
+ uint *dest = reinterpret_cast<uint *>(img.scanLine(y));
+ BYTE *src = alphaValues + width * 3 * y;
+
+ for (int x=0; x<width; ++x) {
+ dest[x] = *(src) << 16
+ | *(src + 1) << 8
+ | *(src + 2);
+
+ src += 3;
+ }
}
- }
- delete[] alphaValues;
- glyphAnalysis->Release();
+ delete[] alphaValues;
+ glyphAnalysis->Release();
- return img;
- } else {
- delete[] alphaValues;
- glyphAnalysis->Release();
+ return img;
+ } else {
+ delete[] alphaValues;
+ glyphAnalysis->Release();
- qErrnoWarning("QFontEngineDirectWrite::imageForGlyph: CreateAlphaTexture failed");
+ qErrnoWarning("QFontEngineDirectWrite::imageForGlyph: CreateAlphaTexture failed");
+ }
}
-
} else {
qErrnoWarning("QFontEngineDirectWrite::imageForGlyph: CreateGlyphRunAnalysis failed");
}
diff --git a/src/gui/text/qfontenginedirectwrite_p.h b/src/gui/text/qfontenginedirectwrite_p.h
index d0086fc..edf1e6a 100644
--- a/src/gui/text/qfontenginedirectwrite_p.h
+++ b/src/gui/text/qfontenginedirectwrite_p.h
@@ -86,6 +86,10 @@ public:
glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
glyph_metrics_t boundingBox(glyph_t g);
+ glyph_metrics_t alphaMapBoundingBox(glyph_t glyph,
+ QFixed subPixelPosition,
+ const QTransform &matrix,
+ GlyphFormat format);
QFixed ascent() const;
QFixed descent() const;
@@ -97,7 +101,7 @@ public:
bool supportsSubPixelPositions() const;
- QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition);
+ QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, int margin,
const QTransform &xform);
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 9e1646f..f3d4107 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -442,6 +442,8 @@ bool QFontMetrics::inFont(QChar ch) const
}
/*!
+ \since 4.8
+
Returns true if the character encoded in UCS-4/UTF-32 is a valid
character in the font; otherwise returns false.
*/
@@ -1330,6 +1332,7 @@ bool QFontMetricsF::inFont(QChar ch) const
/*!
\fn bool QFontMetricsF::inFontUcs4(uint ch) const
+ \since 4.8
Returns true if the character given by \a ch, encoded in UCS-4/UTF-32,
is a valid character in the font; otherwise returns false.
diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp
index 7e829db..d1d1f94 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.cpp
+++ b/src/gui/text/qplatformfontdatabase_qpa.cpp
@@ -203,6 +203,7 @@ bool QSupportedWritingSystems::supported(QFontDatabase::WritingSystem writingSys
\brief The QSupportedWritingSystems class is used when registering fonts with the internal Qt
fontdatabase
\ingroup painting
+ \since 4.8
Its to provide an easy to use interface for indicating what writing systems a specific font
supports.
@@ -322,6 +323,7 @@ QString QPlatformFontDatabase::fontDir() const
\class QPlatformFontDatabase
\brief The QPlatformFontDatabase class makes it possible to customize how fonts
are discovered and how they are rendered
+ \since 4.8
\ingroup painting
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 8bbe86c..7e7ca6c 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -2569,6 +2569,7 @@ QTextDocument *QTextCursor::document() const
/*!
\enum Qt::CursorMoveStyle
+ \since 4.8
This enum describes the movement style available to text cursors. The options
are:
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 0abafb8..143dc1a 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -2710,7 +2710,7 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
html += QLatin1Char('>');
if (block.begin().atEnd())
- html += "<br />";
+ html += QLatin1String("<br />");
QTextBlock::Iterator it = block.begin();
if (fragmentMarkers && !it.atEnd() && block == doc->begin())
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 8ddf3eb..c900918 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -3051,6 +3051,22 @@ QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFo
: justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format),
num_chars(0), chars(0), logClusters(0), f(0), fontEngine(0)
{
+ f = font;
+ fontEngine = f->d->engineForScript(si.analysis.script);
+ Q_ASSERT(fontEngine);
+
+ initWithScriptItem(si);
+}
+
+QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format)
+ : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format),
+ num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe)
+{
+}
+
+// Fix up flags and underlineStyle with given info
+void QTextItemInt::initWithScriptItem(const QScriptItem &si)
+{
// explicitly initialize flags so that initFontAttributes can be called
// multiple times on the same TextItem
flags = 0;
@@ -3058,13 +3074,10 @@ QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFo
flags |= QTextItem::RightToLeft;
ascent = si.ascent;
descent = si.descent;
- f = font;
- fontEngine = f->d->engineForScript(si.analysis.script);
- Q_ASSERT(fontEngine);
- if (format.hasProperty(QTextFormat::TextUnderlineStyle)) {
- underlineStyle = format.underlineStyle();
- } else if (format.boolProperty(QTextFormat::FontUnderline)
+ if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) {
+ underlineStyle = charFormat.underlineStyle();
+ } else if (charFormat.boolProperty(QTextFormat::FontUnderline)
|| f->d->underline) {
underlineStyle = QTextCharFormat::SingleUnderline;
}
@@ -3073,18 +3086,12 @@ QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFo
if (underlineStyle == QTextCharFormat::SingleUnderline)
flags |= QTextItem::Underline;
- if (f->d->overline || format.fontOverline())
+ if (f->d->overline || charFormat.fontOverline())
flags |= QTextItem::Overline;
- if (f->d->strikeOut || format.fontStrikeOut())
+ if (f->d->strikeOut || charFormat.fontStrikeOut())
flags |= QTextItem::StrikeOut;
}
-QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe)
- : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline),
- num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe)
-{
-}
-
QTextItemInt QTextItemInt::midItem(QFontEngine *fontEngine, int firstGlyphIndex, int numGlyphs) const
{
QTextItemInt ti = *this;
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index 055974a..b1bd0c3 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -312,11 +312,13 @@ public:
logClusters(0), f(0), fontEngine(0)
{}
QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFormat &format = QTextCharFormat());
- QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars, int numChars, QFontEngine *fe);
+ QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars, int numChars, QFontEngine *fe,
+ const QTextCharFormat &format = QTextCharFormat());
/// copy the structure items, adjusting the glyphs arrays to the right subarrays.
/// the width of the returned QTextItemInt is not adjusted, for speed reasons
QTextItemInt midItem(QFontEngine *fontEngine, int firstGlyphIndex, int numGlyphs) const;
+ void initWithScriptItem(const QScriptItem &si);
QFixed descent;
QFixed ascent;
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index c1bc846..3f0b9e8 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -579,6 +579,8 @@ bool QTextLayout::cacheEnabled() const
}
/*!
+ \since 4.8
+
Set the cursor movement style. If the QTextLayout is backed by
a document, you can ignore this and use the option in QTextDocument,
this option is for widgets like QLineEdit or custom widgets without
@@ -592,6 +594,8 @@ void QTextLayout::setCursorMoveStyle(Qt::CursorMoveStyle style)
}
/*!
+ \since 4.8
+
The cursor movement style of this QTextLayout. The default is
Qt::LogicalMoveStyle.
@@ -725,9 +729,11 @@ int QTextLayout::previousCursorPosition(int oldPos, CursorMode mode) const
}
/*!
+ \since 4.8
+
Returns the cursor position to the right of \a oldPos, next to it.
- It's dependent on the visual position of characters, after bi-directional
- reordering.
+ The position is dependent on the visual position of characters, after
+ bi-directional reordering.
\sa leftCursorPosition(), nextCursorPosition()
*/
@@ -739,9 +745,11 @@ int QTextLayout::rightCursorPosition(int oldPos) const
}
/*!
+ \since 4.8
+
Returns the cursor position to the left of \a oldPos, next to it.
- It's dependent on the visual position of characters, after bi-directional
- reordering.
+ The position is dependent on the visual position of characters, after
+ bi-directional reordering.
\sa rightCursorPosition(), previousCursorPosition()
*/
@@ -2381,13 +2389,13 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR
unsigned short *logClusters = eng->logClusters(&si);
QGlyphLayout glyphs = eng->shapedGlyphs(&si);
- QTextItemInt gf(si, &f, format);
- gf.glyphs = glyphs.mid(iterator.glyphsStart, iterator.glyphsEnd - iterator.glyphsStart);
- gf.chars = eng->layoutData->string.unicode() + iterator.itemStart;
+ QTextItemInt gf(glyphs.mid(iterator.glyphsStart, iterator.glyphsEnd - iterator.glyphsStart),
+ &f, eng->layoutData->string.unicode() + iterator.itemStart,
+ iterator.itemEnd - iterator.itemStart, eng->fontEngine(si), format);
gf.logClusters = logClusters + iterator.itemStart - si.position;
- gf.num_chars = iterator.itemEnd - iterator.itemStart;
gf.width = iterator.itemWidth;
gf.justified = line.justified;
+ gf.initWithScriptItem(si);
Q_ASSERT(gf.fontEngine);
diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp
index 4372ae3..7a985a1 100644
--- a/src/gui/widgets/qabstractspinbox.cpp
+++ b/src/gui/widgets/qabstractspinbox.cpp
@@ -1655,6 +1655,8 @@ void QAbstractSpinBox::initStyleOption(QStyleOptionSpinBox *option) const
: (QAbstractSpinBox::StepDownEnabled|QAbstractSpinBox::StepUpEnabled);
option->frame = d->frame;
+ if (d->readOnly)
+ option->state |= QStyle::State_ReadOnly;
}
/*!
diff --git a/src/gui/widgets/qcheckbox.cpp b/src/gui/widgets/qcheckbox.cpp
index 9904a15..2210488 100644
--- a/src/gui/widgets/qcheckbox.cpp
+++ b/src/gui/widgets/qcheckbox.cpp
@@ -303,6 +303,7 @@ QSize QCheckBox::sizeHint() const
/*!
\reimp
+ \since 4.8
*/
QSize QCheckBox::minimumSizeHint() const
{
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 2d63f63..7d35766 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1128,6 +1128,8 @@ void QLineEdit::setDragEnabled(bool b)
*/
/*!
+ \since 4.8
+
Returns the movement style for the cursor in the line edit.
*/
Qt::CursorMoveStyle QLineEdit::cursorMoveStyle() const
@@ -1137,6 +1139,8 @@ Qt::CursorMoveStyle QLineEdit::cursorMoveStyle() const
}
/*!
+ \since 4.8
+
Sets the movement style for the cursor in the line edit to the given
\a style.
*/
diff --git a/src/gui/widgets/qradiobutton.cpp b/src/gui/widgets/qradiobutton.cpp
index eeef40e..9ce4eba 100644
--- a/src/gui/widgets/qradiobutton.cpp
+++ b/src/gui/widgets/qradiobutton.cpp
@@ -206,6 +206,7 @@ QSize QRadioButton::sizeHint() const
/*!
\reimp
+ \since 4.8
*/
QSize QRadioButton::minimumSizeHint() const
{
diff --git a/src/gui/widgets/qtabwidget.cpp b/src/gui/widgets/qtabwidget.cpp
index c6551e5..78dda23 100644
--- a/src/gui/widgets/qtabwidget.cpp
+++ b/src/gui/widgets/qtabwidget.cpp
@@ -885,6 +885,7 @@ QSize QTabWidget::minimumSizeHint() const
/*!
\reimp
+ \since 4.8
*/
int QTabWidget::heightForWidth(int width) const
{
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp
index 2670089..61d4fed 100644
--- a/src/gui/widgets/qtextedit.cpp
+++ b/src/gui/widgets/qtextedit.cpp
@@ -2472,6 +2472,8 @@ bool QTextEdit::find(const QString &exp, QTextDocument::FindFlags options)
and the text edit will try to guess the right format.
Use setHtml() or setPlainText() directly to avoid text edit's guessing.
+
+ \sa toPlainText(), toHtml()
*/
void QTextEdit::setText(const QString &text)
{
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 7c644ad..9b2a6e8 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -649,8 +649,11 @@ bool QHttpNetworkConnectionChannel::expand(bool dataComplete)
int ret = Z_OK;
if (content.size())
ret = reply->d_func()->gunzipBodyPartially(content, inflated);
- int retCheck = (dataComplete) ? Z_STREAM_END : Z_OK;
- if (ret >= retCheck) {
+ if (ret >= Z_OK) {
+ if (dataComplete && ret == Z_OK && !reply->d_func()->streamEnd) {
+ reply->d_func()->gunzipBodyPartiallyEnd();
+ reply->d_func()->streamEnd = true;
+ }
if (inflated.size()) {
reply->d_func()->totalProgress += inflated.size();
reply->d_func()->appendUncompressedReplyData(inflated);
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index 00653b6..1a02200 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -461,15 +461,21 @@ int QHttpNetworkReplyPrivate::gunzipBodyPartially(QByteArray &compressed, QByteA
}
have = sizeof(out) - inflateStrm.avail_out;
inflated.append(QByteArray((const char *)out, have));
- } while (inflateStrm.avail_out == 0);
+ } while (inflateStrm.avail_out == 0 && inflateStrm.avail_in > 0);
// clean up and return
if (ret <= Z_ERRNO || ret == Z_STREAM_END) {
- inflateEnd(&inflateStrm);
- initInflate = false;
+ gunzipBodyPartiallyEnd();
}
streamEnd = (ret == Z_STREAM_END);
return ret;
}
+
+void QHttpNetworkReplyPrivate::gunzipBodyPartiallyEnd()
+{
+ inflateEnd(&inflateStrm);
+ initInflate = false;
+}
+
#endif
qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket)
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index 583a256..de6c0d2 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -207,6 +207,7 @@ public:
#ifndef QT_NO_COMPRESS
bool gzipCheckHeader(QByteArray &content, int &pos);
int gunzipBodyPartially(QByteArray &compressed, QByteArray &inflated);
+ void gunzipBodyPartiallyEnd();
#endif
void removeAutoDecompressHeader();
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 8e301a1..58eb0d8 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -1030,7 +1030,7 @@ bool QNetworkReplyImplPrivate::migrateBackend()
return true;
// Backend does not support resuming download.
- if (!backend->canResume())
+ if (backend && !backend->canResume())
return false;
state = QNetworkReplyImplPrivate::Reconnecting;
diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp
index fdb36e8..8065025 100644
--- a/src/network/bearer/qnetworkconfigmanager.cpp
+++ b/src/network/bearer/qnetworkconfigmanager.cpp
@@ -126,6 +126,7 @@ QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate()
/*!
\fn void QNetworkConfigurationManager::configurationRemoved(const QNetworkConfiguration &config)
+ \since 4.8
This signal is emitted when a configuration is about to be removed from the system. The removed
configuration, specified by \a config, is invalid but retains name and identifier.
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index df7766e..d42c259 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -527,6 +527,7 @@ void QHostInfoRunnable::run()
iterator.remove();
hostInfo.setLookupId(postponed->id);
postponed->resultEmitter.emitResultsReady(hostInfo);
+ delete postponed;
}
}
}
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index 4f9836e..6d4df44 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -916,6 +916,8 @@ QNetworkProxyQuery::QNetworkProxyQuery(quint16 bindPort, const QString &protocol
#ifndef QT_NO_BEARERMANAGEMENT
/*!
+ \since 4.8
+
Constructs a QNetworkProxyQuery with the URL \a requestUrl and
sets the query type to \a queryType. The specified \a networkConfiguration
is used to resolve the proxy settings.
@@ -931,6 +933,8 @@ QNetworkProxyQuery::QNetworkProxyQuery(const QNetworkConfiguration &networkConfi
}
/*!
+ \since 4.8
+
Constructs a QNetworkProxyQuery of type \a queryType and sets the
protocol tag to be \a protocolTag. This constructor is suitable
for QNetworkProxyQuery::TcpSocket queries, because it sets the
@@ -953,6 +957,8 @@ QNetworkProxyQuery::QNetworkProxyQuery(const QNetworkConfiguration &networkConfi
}
/*!
+ \since 4.8
+
Constructs a QNetworkProxyQuery of type \a queryType and sets the
protocol tag to be \a protocolTag. This constructor is suitable
for QNetworkProxyQuery::TcpSocket queries because it sets the
@@ -1197,6 +1203,8 @@ QNetworkConfiguration QNetworkProxyQuery::networkConfiguration() const
}
/*!
+ \since 4.8
+
Sets the network configuration component of this QNetworkProxyQuery
object to be \a networkConfiguration. The network configuration can
be used to return different proxy settings based on the network in
diff --git a/src/network/socket/qsymbiansocketengine.cpp b/src/network/socket/qsymbiansocketengine.cpp
index 0aa5a5a..966af88 100644
--- a/src/network/socket/qsymbiansocketengine.cpp
+++ b/src/network/socket/qsymbiansocketengine.cpp
@@ -264,6 +264,7 @@ QSymbianSocketEnginePrivate::QSymbianSocketEnginePrivate() :
QSymbianSocketEnginePrivate::~QSymbianSocketEnginePrivate()
{
+ selectTimer.Close();
}
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 52450b6..5d2221f 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1696,6 +1696,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
}
int numGlyphs = vertexCoordinates->vertexCount() / 4;
+ if (numGlyphs == 0)
+ return;
if (elementIndices.size() < numGlyphs*6) {
Q_ASSERT(elementIndices.size() % 6 == 0);
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 9520b2b..cedccaa 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -6102,6 +6102,7 @@ void QGLTexture::freeTexture()
}
id = 0;
+ boundPixmap = 0;
boundKey = 0;
}
#endif
diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp
index 9ba8b75..518c860 100644
--- a/src/opengl/qgl_qpa.cpp
+++ b/src/opengl/qgl_qpa.cpp
@@ -53,6 +53,8 @@
QT_BEGIN_NAMESPACE
/*!
+ \since 4.8
+
Returns an OpenGL format for the platform window format specified by \a format.
*/
QGLFormat QGLFormat::fromPlatformWindowFormat(const QPlatformWindowFormat &format)
@@ -87,6 +89,8 @@ QGLFormat QGLFormat::fromPlatformWindowFormat(const QPlatformWindowFormat &forma
}
/*!
+ \since 4.8
+
Returns a platform window format for the OpenGL format specified by \a format.
*/
QPlatformWindowFormat QGLFormat::toPlatformWindowFormat(const QGLFormat &format)
@@ -387,6 +391,8 @@ QGLContext::QGLContext(QPlatformGLContext *platformContext)
}
/*!
+ \since 4.8
+
Returns a OpenGL context for the platform-specific OpenGL context given by
\a platformContext.
*/
diff --git a/src/opengl/qgl_symbian.cpp b/src/opengl/qgl_symbian.cpp
index 21671a6..b8e5c22 100644
--- a/src/opengl/qgl_symbian.cpp
+++ b/src/opengl/qgl_symbian.cpp
@@ -40,7 +40,6 @@
****************************************************************************/
#include "qgl.h"
-#include <fbs.h>
#include <private/qt_s60_p.h>
#include <private/qpixmap_raster_symbian_p.h>
#include <private/qimagepixmapcleanuphooks_p.h>
@@ -55,7 +54,7 @@
#include "qpixmapdata_gl_p.h"
#include "qgltexturepool_p.h"
#include "qcolormap.h"
-#include <QDebug>
+
QT_BEGIN_NAMESPACE
@@ -73,7 +72,7 @@ QT_BEGIN_NAMESPACE
#endif
#endif
-extern int qt_gl_pixmap_serial;
+Q_OPENGL_EXPORT extern QGLWidget* qt_gl_share_widget();
/*
QGLTemporaryContext implementation
@@ -266,6 +265,11 @@ void QGLWidget::resizeEvent(QResizeEvent *)
if (!isValid())
return;
+ // Shared widget can ignore resize events which
+ // may happen due to orientation change
+ if (this == qt_gl_share_widget())
+ return;
+
if (QGLContext::currentContext())
doneCurrent();
@@ -378,103 +382,4 @@ void QGLWidgetPrivate::recreateEglSurface()
eglSurfaceWindowId = currentId;
}
-static inline bool knownGoodFormat(QImage::Format format)
-{
- switch (format) {
- case QImage::Format_RGB16: // EColor64K
- case QImage::Format_RGB32: // EColor16MU
- case QImage::Format_ARGB32_Premultiplied: // EColor16MAP
- return true;
- default:
- return false;
- }
-}
-
-void QGLPixmapData::fromNativeType(void* pixmap, NativeType type)
-{
- if (type == QPixmapData::FbsBitmap) {
- CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap *>(pixmap);
- QSize size(bitmap->SizeInPixels().iWidth, bitmap->SizeInPixels().iHeight);
- if (size.width() == w && size.height() == h)
- setSerialNumber(++qt_gl_pixmap_serial);
- resize(size.width(), size.height());
- m_source = QVolatileImage(bitmap);
- if (pixelType() == BitmapType) {
- m_source.ensureFormat(QImage::Format_MonoLSB);
- } else if (!knownGoodFormat(m_source.format())) {
- m_source.beginDataAccess();
- QImage::Format format = idealFormat(m_source.imageRef(), Qt::AutoColor);
- m_source.endDataAccess(true);
- m_source.ensureFormat(format);
- }
- m_hasAlpha = m_source.hasAlphaChannel();
- m_hasFillColor = false;
- m_dirty = true;
-
- } else if (type == QPixmapData::VolatileImage && pixmap) {
- // Support QS60Style in more efficient skin graphics retrieval.
- QVolatileImage *img = static_cast<QVolatileImage *>(pixmap);
- if (img->width() == w && img->height() == h)
- setSerialNumber(++qt_gl_pixmap_serial);
- resize(img->width(), img->height());
- m_source = *img;
- m_hasAlpha = m_source.hasAlphaChannel();
- m_hasFillColor = false;
- m_dirty = true;
- } else if (type == QPixmapData::NativeImageHandleProvider && pixmap) {
- destroyTexture();
- nativeImageHandleProvider = static_cast<QNativeImageHandleProvider *>(pixmap);
- // Cannot defer the retrieval, we need at least the size right away.
- createFromNativeImageHandleProvider();
- }
-}
-
-void* QGLPixmapData::toNativeType(NativeType type)
-{
- if (type == QPixmapData::FbsBitmap) {
- if (m_source.isNull())
- m_source = QVolatileImage(w, h, QImage::Format_ARGB32_Premultiplied);
- return m_source.duplicateNativeImage();
- }
- return 0;
-}
-
-bool QGLPixmapData::initFromNativeImageHandle(void *handle, const QString &type)
-{
- if (type == QLatin1String("RSgImage")) {
- fromNativeType(handle, QPixmapData::SgImage);
- return true;
- } else if (type == QLatin1String("CFbsBitmap")) {
- fromNativeType(handle, QPixmapData::FbsBitmap);
- return true;
- }
- return false;
-}
-
-void QGLPixmapData::createFromNativeImageHandleProvider()
-{
- void *handle = 0;
- QString type;
- nativeImageHandleProvider->get(&handle, &type);
- if (handle) {
- if (initFromNativeImageHandle(handle, type)) {
- nativeImageHandle = handle;
- nativeImageType = type;
- } else {
- qWarning("QGLPixmapData: Unknown native image type '%s'", qPrintable(type));
- }
- } else {
- qWarning("QGLPixmapData: Native handle is null");
- }
-}
-
-void QGLPixmapData::releaseNativeImageHandle()
-{
- if (nativeImageHandleProvider && nativeImageHandle) {
- nativeImageHandleProvider->release(nativeImageHandle, nativeImageType);
- nativeImageHandle = 0;
- nativeImageType = QString();
- }
-}
-
QT_END_NAMESPACE
diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h
index bf1a303..3d22ad1 100644
--- a/src/opengl/qpixmapdata_gl_p.h
+++ b/src/opengl/qpixmapdata_gl_p.h
@@ -61,6 +61,9 @@
#ifdef Q_OS_SYMBIAN
#include "private/qvolatileimage_p.h"
+#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE
+# include <sgresource/sgimage.h>
+#endif
#endif
QT_BEGIN_NAMESPACE
@@ -72,8 +75,7 @@ class QGLPixmapData;
#ifdef Q_OS_SYMBIAN
class QNativeImageHandleProvider;
-#endif
-
+#else
class QGLFramebufferObjectPool
{
public:
@@ -102,7 +104,7 @@ public:
private:
QGLPixmapData *data;
};
-
+#endif
class Q_OPENGL_EXPORT QGLPixmapData : public QPixmapData
{
@@ -194,6 +196,9 @@ private:
mutable QNativeImageHandleProvider *nativeImageHandleProvider;
void *nativeImageHandle;
QString nativeImageType;
+#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE
+ RSgImage *m_sgImage;
+#endif
#else
mutable QImage m_source;
#endif
@@ -208,9 +213,9 @@ private:
mutable bool m_hasFillColor;
mutable bool m_hasAlpha;
-
+#ifndef Q_OS_SYMBIAN
mutable QGLPixmapGLPaintDevice m_glDevice;
-
+#endif
friend class QGLPixmapGLPaintDevice;
friend class QMeeGoPixmapData;
friend class QMeeGoLivePixmapData;
diff --git a/src/opengl/qpixmapdata_symbiangl.cpp b/src/opengl/qpixmapdata_symbiangl.cpp
index ab8a9e8..78e5ee7 100644
--- a/src/opengl/qpixmapdata_symbiangl.cpp
+++ b/src/opengl/qpixmapdata_symbiangl.cpp
@@ -59,181 +59,66 @@
#include <qimagereader.h>
#include <qbuffer.h>
+#include <fbs.h>
+
#include "qgltexturepool_p.h"
QT_BEGIN_NAMESPACE
Q_OPENGL_EXPORT extern QGLWidget* qt_gl_share_widget();
-static inline int areaDiff(const QSize &size, const QGLFramebufferObject *fbo)
-{
- return qAbs(size.width() * size.height() - fbo->width() * fbo->height());
-}
-
-extern int qt_next_power_of_two(int v);
-
-static inline QSize maybeRoundToNextPowerOfTwo(const QSize &sz)
-{
-#ifdef QT_OPENGL_ES_2
- QSize rounded(qt_next_power_of_two(sz.width()), qt_next_power_of_two(sz.height()));
- if (rounded.width() * rounded.height() < 1.20 * sz.width() * sz.height())
- return rounded;
-#endif
- return sz;
-}
-
-
-QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize, const QGLFramebufferObjectFormat &requestFormat, bool strictSize)
+class QGLSgImageTextureCleanup
{
- QGLFramebufferObject *chosen = 0;
- QGLFramebufferObject *candidate = 0;
- for (int i = 0; !chosen && i < m_fbos.size(); ++i) {
- QGLFramebufferObject *fbo = m_fbos.at(i);
+public:
+ QGLSgImageTextureCleanup(const QGLContext *context = 0) {}
- if (strictSize) {
- if (fbo->size() == requestSize && fbo->format() == requestFormat) {
- chosen = fbo;
- break;
- } else {
- continue;
- }
- }
-
- if (fbo->format() == requestFormat) {
- // choose the fbo with a matching format and the closest size
- if (!candidate || areaDiff(requestSize, candidate) > areaDiff(requestSize, fbo))
- candidate = fbo;
- }
-
- if (candidate) {
- m_fbos.removeOne(candidate);
-
- const QSize fboSize = candidate->size();
- QSize sz = fboSize;
-
- if (sz.width() < requestSize.width())
- sz.setWidth(qMax(requestSize.width(), qRound(sz.width() * 1.5)));
- if (sz.height() < requestSize.height())
- sz.setHeight(qMax(requestSize.height(), qRound(sz.height() * 1.5)));
-
- // wasting too much space?
- if (sz.width() * sz.height() > requestSize.width() * requestSize.height() * 4)
- sz = requestSize;
-
- if (sz != fboSize) {
- delete candidate;
- candidate = new QGLFramebufferObject(maybeRoundToNextPowerOfTwo(sz), requestFormat);
- }
-
- chosen = candidate;
+ ~QGLSgImageTextureCleanup()
+ {
+ QList<qint64> keys = m_cache.keys();
+ while(keys.size() > 0) {
+ QGLPixmapData *data = m_cache.take(keys.takeAt(0));
+ if (data)
+ data->destroyTexture();
}
}
- if (!chosen) {
- if (strictSize)
- chosen = new QGLFramebufferObject(requestSize, requestFormat);
- else
- chosen = new QGLFramebufferObject(maybeRoundToNextPowerOfTwo(requestSize), requestFormat);
- }
+ static QGLSgImageTextureCleanup *cleanupForContext(const QGLContext *context);
- if (!chosen->isValid()) {
- delete chosen;
- chosen = 0;
+ void insert(quint64 key, QGLPixmapData *data)
+ {
+ m_cache.insert(key, data);
}
- return chosen;
-}
+ void remove(quint64 key)
+ {
+ m_cache.take(key);
+ }
-void QGLFramebufferObjectPool::release(QGLFramebufferObject *fbo)
-{
- if (fbo)
- m_fbos << fbo;
-}
+private:
+ QCache<qint64, QGLPixmapData> m_cache;
+};
-QPaintEngine* QGLPixmapGLPaintDevice::paintEngine() const
+#if QT_VERSION >= 0x040800
+Q_GLOBAL_STATIC(QGLContextGroupResource<QGLSgImageTextureCleanup>, qt_sgimage_texture_cleanup)
+#else
+static void qt_sgimage_texture_cleanup_free(void *data)
{
- return data->paintEngine();
+ delete reinterpret_cast<QGLSgImageTextureCleanup *>(data);
}
+Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_sgimage_texture_cleanup, (qt_sgimage_texture_cleanup_free))
+#endif
-void QGLPixmapGLPaintDevice::beginPaint()
+QGLSgImageTextureCleanup *QGLSgImageTextureCleanup::cleanupForContext(const QGLContext *context)
{
- if (!data->isValid())
- return;
-
- // QGLPaintDevice::beginPaint will store the current binding and replace
- // it with m_thisFBO:
- m_thisFBO = data->m_renderFbo->handle();
- QGLPaintDevice::beginPaint();
-
- Q_ASSERT(data->paintEngine()->type() == QPaintEngine::OpenGL2);
-
- // QPixmap::fill() is deferred until now, where we actually need to do the fill:
- if (data->needsFill()) {
- const QColor &c = data->fillColor();
- float alpha = c.alphaF();
- glDisable(GL_SCISSOR_TEST);
- glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha);
- glClear(GL_COLOR_BUFFER_BIT);
+ QGLSgImageTextureCleanup *p = reinterpret_cast<QGLSgImageTextureCleanup *>(qt_sgimage_texture_cleanup()->value(context));
+#if QT_VERSION < 0x040800
+ if (!p) {
+ QGLShareContextScope scope(context);
+ qt_sgimage_texture_cleanup()->insert(context, p = new QGLSgImageTextureCleanup);
}
- else if (!data->isUninitialized()) {
- // If the pixmap (GL Texture) has valid content (it has been
- // uploaded from an image or rendered into before), we need to
- // copy it from the texture to the render FBO.
-
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_SCISSOR_TEST);
- glDisable(GL_BLEND);
-
-#if !defined(QT_OPENGL_ES_2)
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0, data->width(), data->height(), 0, -999999, 999999);
#endif
-
- glViewport(0, 0, data->width(), data->height());
-
- // Pass false to bind so it doesn't copy the FBO into the texture!
- context()->drawTexture(QRect(0, 0, data->width(), data->height()), data->bind(false));
- }
-}
-
-void QGLPixmapGLPaintDevice::endPaint()
-{
- if (!data->isValid())
- return;
-
- data->copyBackFromRenderFbo(false);
-
- // Base's endPaint will restore the previous FBO binding
- QGLPaintDevice::endPaint();
-
- qgl_fbo_pool()->release(data->m_renderFbo);
- data->m_renderFbo = 0;
-}
-
-QGLContext* QGLPixmapGLPaintDevice::context() const
-{
- data->ensureCreated();
- return data->m_ctx;
-}
-
-QSize QGLPixmapGLPaintDevice::size() const
-{
- return data->size();
-}
-
-bool QGLPixmapGLPaintDevice::alphaRequested() const
-{
- return data->m_hasAlpha;
-}
-
-void QGLPixmapGLPaintDevice::setPixmapData(QGLPixmapData* d)
-{
- data = d;
+ return p;
}
int qt_gl_pixmap_serial = 0;
@@ -245,16 +130,28 @@ QGLPixmapData::QGLPixmapData(PixelType type)
, m_ctx(0)
, nativeImageHandleProvider(0)
, nativeImageHandle(0)
+#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE
+ , m_sgImage(0)
+#endif
, m_dirty(false)
, m_hasFillColor(false)
, m_hasAlpha(false)
{
setSerialNumber(++qt_gl_pixmap_serial);
- m_glDevice.setPixmapData(this);
}
QGLPixmapData::~QGLPixmapData()
{
+ if (m_sgImage) {
+ if (m_texture.id) {
+ QGLSgImageTextureCleanup::cleanupForContext(m_ctx)->remove(m_texture.id);
+ destroyTexture();
+ }
+
+ m_sgImage->Close();
+ delete m_sgImage;
+ m_sgImage = 0;
+ }
delete m_engine;
}
@@ -276,6 +173,16 @@ bool QGLPixmapData::isValidContext(const QGLContext *ctx) const
// That's why if source pixels are valid we return false
// to simulate raster pixmaps. Only QPixmaps created from
// SgImage will enable usage of QGLPixmapData.
+#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE
+ if (m_sgImage) {
+ // SgImage texture
+ if (ctx == m_ctx)
+ return true;
+
+ const QGLContext *share_ctx = qt_gl_share_widget()->context();
+ return ctx == share_ctx || QGLContext::areSharing(ctx, share_ctx);
+ }
+#endif
return false;
}
@@ -314,72 +221,45 @@ void QGLPixmapData::ensureCreated() const
QGLShareContextScope ctx(qt_gl_share_widget()->context());
m_ctx = ctx;
- const GLenum internal_format = m_hasAlpha ? GL_RGBA : GL_RGB;
-#ifdef QT_OPENGL_ES_2
- const GLenum external_format = internal_format;
-#else
- const GLenum external_format = qt_gl_preferredTextureFormat();
-#endif
- const GLenum target = GL_TEXTURE_2D;
-
- GLenum type = GL_UNSIGNED_BYTE;
- // Avoid conversion when pixmap is created from CFbsBitmap of EColor64K.
- if (!m_source.isNull() && m_source.format() == QImage::Format_RGB16)
- type = GL_UNSIGNED_SHORT_5_6_5;
-
- if (!m_texture.id) {
- m_texture.id = QGLTexturePool::instance()->createTexture(
- target,
- 0, internal_format,
- w, h,
- external_format,
- type,
- &m_texture);
- if (!m_texture.id) {
- m_texture.failedToAlloc = true;
- return;
- }
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE
+ if (m_sgImage) {
+ qt_resolve_eglimage_gl_extensions(ctx); // ensure initialized
- m_texture.inTexturePool = true;
- } else if (m_texture.inTexturePool) {
- glBindTexture(target, m_texture.id);
- QGLTexturePool::instance()->useTexture(&m_texture);
- }
+ bool textureIsBound = false;
+ GLuint newTextureId;
- if (!m_source.isNull() && m_texture.id) {
- if (external_format == GL_RGB) {
- m_source.beginDataAccess();
- QImage tx;
- if (type == GL_UNSIGNED_BYTE)
- tx = m_source.imageRef().convertToFormat(QImage::Format_RGB888).mirrored(false, true);
- else if (type == GL_UNSIGNED_SHORT_5_6_5)
- tx = m_source.imageRef().mirrored(false, true);
- m_source.endDataAccess(true);
+ EGLint imgAttr[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE };
+ EGLImageKHR image = QEgl::eglCreateImageKHR(QEgl::display()
+ , EGL_NO_CONTEXT
+ , EGL_NATIVE_PIXMAP_KHR
+ , (EGLClientBuffer)m_sgImage
+ , imgAttr);
- glBindTexture(target, m_texture.id);
- if (!tx.isNull())
- glTexSubImage2D(target, 0, 0, 0, w, h, external_format,
- type, tx.constBits());
- else
- qWarning("QGLPixmapData: Failed to create GL_RGB image of size %dx%d", w, h);
- } else {
- // do byte swizzling ARGB -> RGBA
- m_source.beginDataAccess();
- const QImage tx = ctx->d_func()->convertToGLFormat(m_source.imageRef(), true, external_format);
- m_source.endDataAccess(true);
- glBindTexture(target, m_texture.id);
- if (!tx.isNull())
- glTexSubImage2D(target, 0, 0, 0, w, h, external_format,
- type, tx.constBits());
- else
- qWarning("QGLPixmapData: Failed to create GL_RGBA image of size %dx%d", w, h);
+ glGenTextures(1, &newTextureId);
+ glBindTexture( GL_TEXTURE_2D, newTextureId);
+
+ if (image != EGL_NO_IMAGE_KHR) {
+ glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
+ GLint err = glGetError();
+ if (err == GL_NO_ERROR)
+ textureIsBound = true;
+
+ QEgl::eglDestroyImageKHR(QEgl::display(), image);
}
- if (useFramebufferObjects())
- m_source = QVolatileImage();
+ if (textureIsBound) {
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ m_texture.id = newTextureId;
+ m_texture.boundPixmap = const_cast<QGLPixmapData*>(this);
+ QGLSgImageTextureCleanup::cleanupForContext(m_ctx)->insert(m_texture.id, const_cast<QGLPixmapData*>(this));
+ } else {
+ qWarning("QGLPixmapData: Failed to create texture from a SgImage image of size %dx%d", w, h);
+ glDeleteTextures(1, &newTextureId);
+ }
}
+#endif
}
@@ -539,42 +419,7 @@ bool QGLPixmapData::scroll(int dx, int dy, const QRect &rect)
void QGLPixmapData::copy(const QPixmapData *data, const QRect &rect)
{
- if (data->classId() != QPixmapData::OpenGLClass || !static_cast<const QGLPixmapData *>(data)->useFramebufferObjects()) {
- QPixmapData::copy(data, rect);
- return;
- }
-
- const QGLPixmapData *other = static_cast<const QGLPixmapData *>(data);
- if (other->m_renderFbo) {
- QGLShareContextScope ctx(qt_gl_share_widget()->context());
-
- resize(rect.width(), rect.height());
- m_hasAlpha = other->m_hasAlpha;
- ensureCreated();
-
- if (!ctx->d_ptr->fbo)
- glGenFramebuffers(1, &ctx->d_ptr->fbo);
-
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, ctx->d_ptr->fbo);
- glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D, m_texture.id, 0);
-
- if (!other->m_renderFbo->isBound())
- glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, other->m_renderFbo->handle());
-
- glDisable(GL_SCISSOR_TEST);
- if (ctx->d_ptr->active_engine && ctx->d_ptr->active_engine->type() == QPaintEngine::OpenGL2)
- static_cast<QGL2PaintEngineEx *>(ctx->d_ptr->active_engine)->invalidateState();
-
- glBlitFramebufferEXT(rect.x(), rect.y(), rect.x() + rect.width(), rect.y() + rect.height(),
- 0, 0, w, h,
- GL_COLOR_BUFFER_BIT,
- GL_NEAREST);
-
- glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo);
- } else {
- QPixmapData::copy(data, rect);
- }
+ QPixmapData::copy(data, rect);
}
void QGLPixmapData::fill(const QColor &color)
@@ -591,11 +436,6 @@ void QGLPixmapData::fill(const QColor &color)
m_hasAlpha = color.alpha() != 255;
}
- if (useFramebufferObjects()) {
- m_source = QVolatileImage();
- m_hasFillColor = true;
- m_fillColor = color;
- } else {
forceToImage();
if (m_source.depth() == 32) {
@@ -606,7 +446,6 @@ void QGLPixmapData::fill(const QColor &color)
m_source.fill(1);
else
m_source.fill(0);
- }
}
}
@@ -646,9 +485,7 @@ QImage QGLPixmapData::toImage() const
if (!isValid())
return QImage();
- if (m_renderFbo) {
- copyBackFromRenderFbo(true);
- } else if (!m_source.isNull()) {
+ if (!m_source.isNull()) {
// QVolatileImage::toImage() will make a copy always so no check
// for active painting is needed.
QImage img = m_source.toImage();
@@ -669,58 +506,9 @@ QImage QGLPixmapData::toImage() const
return qt_gl_read_texture(QSize(w, h), true, true);
}
-struct TextureBuffer
-{
- QGLFramebufferObject *fbo;
- QGL2PaintEngineEx *engine;
-};
-
-Q_GLOBAL_STATIC(QGLFramebufferObjectPool, _qgl_fbo_pool)
-QGLFramebufferObjectPool* qgl_fbo_pool()
-{
- return _qgl_fbo_pool();
-}
-
void QGLPixmapData::copyBackFromRenderFbo(bool keepCurrentFboBound) const
{
- if (!isValid())
- return;
-
- m_hasFillColor = false;
-
- const QGLContext *share_ctx = qt_gl_share_widget()->context();
- QGLShareContextScope ctx(share_ctx);
-
- ensureCreated();
-
- if (!ctx->d_ptr->fbo)
- glGenFramebuffers(1, &ctx->d_ptr->fbo);
-
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, ctx->d_ptr->fbo);
- glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D, m_texture.id, 0);
-
- const int x0 = 0;
- const int x1 = w;
- const int y0 = 0;
- const int y1 = h;
-
- if (!m_renderFbo->isBound())
- glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, m_renderFbo->handle());
-
- glDisable(GL_SCISSOR_TEST);
-
- glBlitFramebufferEXT(x0, y0, x1, y1,
- x0, y0, x1, y1,
- GL_COLOR_BUFFER_BIT,
- GL_NEAREST);
-
- if (keepCurrentFboBound) {
- glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo);
- } else {
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, m_renderFbo->handle());
- ctx->d_ptr->current_fbo = m_renderFbo->handle();
- }
+ // We don't use FBOs on Symbian
}
bool QGLPixmapData::useFramebufferObjects() const
@@ -734,32 +522,6 @@ QPaintEngine* QGLPixmapData::paintEngine() const
if (!isValid())
return 0;
- if (m_renderFbo)
- return m_engine;
-
- if (useFramebufferObjects()) {
- extern QGLWidget* qt_gl_share_widget();
-
- if (!QGLContext::currentContext())
- qt_gl_share_widget()->makeCurrent();
- QGLShareContextScope ctx(qt_gl_share_widget()->context());
-
- QGLFramebufferObjectFormat format;
- format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
- format.setSamples(4);
- format.setInternalTextureFormat(GLenum(m_hasAlpha ? GL_RGBA : GL_RGB));
-
- m_renderFbo = qgl_fbo_pool()->acquire(size(), format);
-
- if (m_renderFbo) {
- if (!m_engine)
- m_engine = new QGL2PaintEngineEx;
- return m_engine;
- }
-
- qWarning() << "Failed to create pixmap texture buffer of size " << size() << ", falling back to raster paint engine";
- }
-
// If the application wants to paint into the QPixmap, we first
// force it to QImage format and then paint into that.
// This is simpler than juggling multiple GL contexts.
@@ -774,25 +536,16 @@ QPaintEngine* QGLPixmapData::paintEngine() const
extern QRgb qt_gl_convertToGLFormat(QRgb src_pixel, GLenum texture_format);
-// If copyBack is true, bind will copy the contents of the render
-// FBO to the texture (which is not bound to the texture, as it's
-// a multisample FBO).
GLuint QGLPixmapData::bind(bool copyBack) const
{
- if (m_renderFbo && copyBack) {
- copyBackFromRenderFbo(true);
- } else {
- ensureCreated();
- }
+ ensureCreated();
GLuint id = m_texture.id;
glBindTexture(GL_TEXTURE_2D, id);
if (m_hasFillColor) {
- if (!useFramebufferObjects()) {
m_source = QVolatileImage(w, h, QImage::Format_ARGB32_Premultiplied);
m_source.fill(PREMUL(m_fillColor.rgba()));
- }
m_hasFillColor = false;
@@ -861,7 +614,21 @@ void QGLPixmapData::forceToImage()
void QGLPixmapData::destroyTexture()
{
- // Destroy SgImage texture
+ if (m_texture.id) {
+ QGLWidget *shareWidget = qt_gl_share_widget();
+ if (shareWidget) {
+ m_texture.options |= QGLContext::MemoryManagedBindOption;
+ m_texture.freeTexture();
+ m_texture.options &= ~QGLContext::MemoryManagedBindOption;
+ } else if(QGLContext::currentContext()) {
+ glDeleteTextures(1, &m_texture.id);
+ m_texture.id = 0;
+ m_texture.boundPixmap = 0;
+ m_texture.boundKey = 0;
+ }
+ m_ctx = 0;
+ m_dirty = true;
+ }
}
void QGLPixmapData::detachTextureFromPool()
@@ -886,7 +653,180 @@ void QGLPixmapData::reclaimTexture()
QGLPaintDevice *QGLPixmapData::glDevice() const
{
- return &m_glDevice;
+ return 0;
+}
+
+static inline bool knownGoodFormat(QImage::Format format)
+{
+ switch (format) {
+ case QImage::Format_RGB16: // EColor64K
+ case QImage::Format_RGB32: // EColor16MU
+ case QImage::Format_ARGB32_Premultiplied: // EColor16MAP
+ return true;
+ default:
+ return false;
+ }
+}
+
+static inline int symbianPixeFormatBitsPerPixel(TUidPixelFormat pixelFormat)
+{
+ switch (pixelFormat) {
+ case EUidPixelFormatP_1:
+ case EUidPixelFormatL_1:
+ return 1;
+ case EUidPixelFormatP_2:
+ case EUidPixelFormatL_2:
+ return 2;
+ case EUidPixelFormatP_4:
+ case EUidPixelFormatL_4:
+ return 4;
+ case EUidPixelFormatRGB_332:
+ case EUidPixelFormatA_8:
+ case EUidPixelFormatBGR_332:
+ case EUidPixelFormatP_8:
+ case EUidPixelFormatL_8:
+ return 8;
+ case EUidPixelFormatRGB_565:
+ case EUidPixelFormatBGR_565:
+ case EUidPixelFormatARGB_1555:
+ case EUidPixelFormatXRGB_1555:
+ case EUidPixelFormatARGB_4444:
+ case EUidPixelFormatARGB_8332:
+ case EUidPixelFormatBGRX_5551:
+ case EUidPixelFormatBGRA_5551:
+ case EUidPixelFormatBGRA_4444:
+ case EUidPixelFormatBGRX_4444:
+ case EUidPixelFormatAP_88:
+ case EUidPixelFormatXRGB_4444:
+ case EUidPixelFormatXBGR_4444:
+ return 16;
+ case EUidPixelFormatBGR_888:
+ case EUidPixelFormatRGB_888:
+ return 24;
+ case EUidPixelFormatXRGB_8888:
+ case EUidPixelFormatBGRX_8888:
+ case EUidPixelFormatXBGR_8888:
+ case EUidPixelFormatBGRA_8888:
+ case EUidPixelFormatARGB_8888:
+ case EUidPixelFormatABGR_8888:
+ case EUidPixelFormatARGB_8888_PRE:
+ case EUidPixelFormatABGR_8888_PRE:
+ case EUidPixelFormatBGRA_8888_PRE:
+ case EUidPixelFormatARGB_2101010:
+ case EUidPixelFormatABGR_2101010:
+ return 32;
+ default:
+ return 32;
+ };
+}
+
+void QGLPixmapData::fromNativeType(void* pixmap, NativeType type)
+{
+ if (type == QPixmapData::SgImage && pixmap) {
+#if defined(QT_SYMBIAN_SUPPORTS_SGIMAGE) && !defined(QT_NO_EGL)
+ RSgImage *sgImage = reinterpret_cast<RSgImage*>(pixmap);
+
+ m_sgImage = new RSgImage;
+ m_sgImage->Open(sgImage->Id());
+
+ TSgImageInfo info;
+ sgImage->GetInfo(info);
+
+ w = info.iSizeInPixels.iWidth;
+ h = info.iSizeInPixels.iHeight;
+ d = symbianPixeFormatBitsPerPixel((TUidPixelFormat)info.iPixelFormat);
+
+ m_source = QVolatileImage();
+ m_hasAlpha = true;
+ m_hasFillColor = false;
+ m_dirty = true;
+ is_null = (w <= 0 || h <= 0);
+#endif
+ } else if (type == QPixmapData::FbsBitmap && pixmap) {
+ CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap *>(pixmap);
+ QSize size(bitmap->SizeInPixels().iWidth, bitmap->SizeInPixels().iHeight);
+ if (size.width() == w && size.height() == h)
+ setSerialNumber(++qt_gl_pixmap_serial);
+ resize(size.width(), size.height());
+ m_source = QVolatileImage(bitmap);
+ if (pixelType() == BitmapType) {
+ m_source.ensureFormat(QImage::Format_MonoLSB);
+ } else if (!knownGoodFormat(m_source.format())) {
+ m_source.beginDataAccess();
+ QImage::Format format = idealFormat(m_source.imageRef(), Qt::AutoColor);
+ m_source.endDataAccess(true);
+ m_source.ensureFormat(format);
+ }
+ m_hasAlpha = m_source.hasAlphaChannel();
+ m_hasFillColor = false;
+ m_dirty = true;
+ d = m_source.depth();
+ } else if (type == QPixmapData::VolatileImage && pixmap) {
+ // Support QS60Style in more efficient skin graphics retrieval.
+ QVolatileImage *img = static_cast<QVolatileImage *>(pixmap);
+ if (img->width() == w && img->height() == h)
+ setSerialNumber(++qt_gl_pixmap_serial);
+ resize(img->width(), img->height());
+ m_source = *img;
+ m_hasAlpha = m_source.hasAlphaChannel();
+ m_hasFillColor = false;
+ m_dirty = true;
+ d = m_source.depth();
+ } else if (type == QPixmapData::NativeImageHandleProvider && pixmap) {
+ destroyTexture();
+ nativeImageHandleProvider = static_cast<QNativeImageHandleProvider *>(pixmap);
+ // Cannot defer the retrieval, we need at least the size right away.
+ createFromNativeImageHandleProvider();
+ }
+}
+
+void* QGLPixmapData::toNativeType(NativeType type)
+{
+ if (type == QPixmapData::FbsBitmap) {
+ if (m_source.isNull())
+ m_source = QVolatileImage(w, h, QImage::Format_ARGB32_Premultiplied);
+ return m_source.duplicateNativeImage();
+ }
+
+ return 0;
+}
+
+bool QGLPixmapData::initFromNativeImageHandle(void *handle, const QString &type)
+{
+ if (type == QLatin1String("RSgImage")) {
+ fromNativeType(handle, QPixmapData::SgImage);
+ return true;
+ } else if (type == QLatin1String("CFbsBitmap")) {
+ fromNativeType(handle, QPixmapData::FbsBitmap);
+ return true;
+ }
+ return false;
+}
+
+void QGLPixmapData::createFromNativeImageHandleProvider()
+{
+ void *handle = 0;
+ QString type;
+ nativeImageHandleProvider->get(&handle, &type);
+ if (handle) {
+ if (initFromNativeImageHandle(handle, type)) {
+ nativeImageHandle = handle;
+ nativeImageType = type;
+ } else {
+ qWarning("QGLPixmapData: Unknown native image type '%s'", qPrintable(type));
+ }
+ } else {
+ qWarning("QGLPixmapData: Native handle is null");
+ }
+}
+
+void QGLPixmapData::releaseNativeImageHandle()
+{
+ if (nativeImageHandleProvider && nativeImageHandle) {
+ nativeImageHandleProvider->release(nativeImageHandle, nativeImageType);
+ nativeImageHandle = 0;
+ nativeImageType = QString();
+ }
}
QT_END_NAMESPACE
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 9ad7f6a..d93efb4 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -184,7 +184,7 @@ QGLGraphicsSystem::QGLGraphicsSystem(bool useX11GL)
class QGLGlobalShareWidget
{
public:
- QGLGlobalShareWidget() : refCount(0), widget(0), initializing(false) {
+ QGLGlobalShareWidget() : widget(0), initializing(false) {
created = true;
}
@@ -227,8 +227,6 @@ public:
static bool cleanedUp;
static bool created;
- int refCount;
-
private:
QGLWidget *widget;
bool initializing;
@@ -369,15 +367,11 @@ QGLWindowSurface::~QGLWindowSurface()
if (QGLGlobalShareWidget::cleanedUp)
return;
- --(_qt_gl_share_widget()->refCount);
-
#ifdef Q_OS_SYMBIAN
- if (_qt_gl_share_widget()->refCount <= 0) {
- // Destroy the context if necessary.
- if (!qt_gl_share_widget()->context()->isSharing())
- qt_destroy_gl_share_widget();
- }
-#endif // QGL_USE_TEXTURE_POOL
+ // Destroy the context if necessary.
+ if (!qt_gl_share_widget()->context()->isSharing())
+ qt_destroy_gl_share_widget();
+#endif
}
void QGLWindowSurface::deleted(QObject *object)
@@ -427,9 +421,6 @@ void QGLWindowSurface::hijackWindow(QWidget *widget)
ctx->create(qt_gl_share_context());
- if (widget != qt_gl_share_widget())
- ++(_qt_gl_share_widget()->refCount);
-
#ifndef QT_NO_EGL
static bool checkedForNOKSwapRegion = false;
static bool haveNOKSwapRegion = false;
@@ -745,6 +736,7 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &
glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, 0);
} else {
+#ifndef Q_OS_SYMBIAN // We don't have FBO pool on Symbian
// can't do sub-region blits with multisample FBOs
QGLFramebufferObject *temp = qgl_fbo_pool()->acquire(d_ptr->fbo->size(), QGLFramebufferObjectFormat());
@@ -767,6 +759,7 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &
glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, 0);
qgl_fbo_pool()->release(temp);
+#endif // Q_OS_SYMBIAN
}
ctx->d_ptr->current_fbo = 0;
@@ -856,18 +849,43 @@ void QGLWindowSurface::updateGeometry() {
if (wd->extraData() && wd->extraData()->glContext) {
#ifdef Q_OS_SYMBIAN // Symbian needs to recreate the context when native window size changes
if (d_ptr->size != geometry().size()) {
- if (window() != qt_gl_share_widget())
- --(_qt_gl_share_widget()->refCount);
+ QGLContext *ctx = reinterpret_cast<QGLContext *>(wd->extraData()->glContext);
+
+ if (ctx == QGLContext::currentContext())
+ ctx->doneCurrent();
+
+ ctx->d_func()->destroyEglSurfaceForDevice();
+
+ // Delete other contexts (shouldn't happen too often, if at all)
+ while (d_ptr->contexts.size()) {
+ QGLContext **ctxPtrPtr = d_ptr->contexts.takeFirst();
+ if ((*ctxPtrPtr) != ctx)
+ delete *ctxPtrPtr;
+ }
+ union { QGLContext **ctxPtrPtr; void **voidPtrPtr; };
+ voidPtrPtr = &wd->extraData()->glContext;
+ d_ptr->contexts << ctxPtrPtr;
+
+ ctx->d_func()->eglSurface = ctx->d_func()->eglContext->createSurface(window());
+
+ // Swap behaviour has been checked already in previous hijackWindow call.
+ // Reset swap behaviour based on that flag.
+ if (d_ptr->destructive_swap_buffers) {
+ eglSurfaceAttrib(QEgl::display(), ctx->d_func()->eglSurfaceForDevice(),
+ EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED);
+
+ if (eglGetError() != EGL_SUCCESS)
+ qWarning("QGLWindowSurface::updateGeometry() - could not re-enable destroyed swap behaviour");
+ } else {
+ eglSurfaceAttrib(QEgl::display(), ctx->d_func()->eglSurfaceForDevice(),
+ EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
- delete wd->extraData()->glContext;
- wd->extraData()->glContext = 0;
- d_ptr->ctx = 0;
+ if (eglGetError() != EGL_SUCCESS)
+ qWarning("QGLWindowSurface::updateGeometry() - could not re-enable preserved swap behaviour");
+ }
}
- else
#endif
- {
- hijack = false; // we already have gl context for widget
- }
+ hijack = false; // we already have gl context for widget
}
if (hijack)
diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp
index ad56cbd..36e786f 100644
--- a/src/plugins/accessible/widgets/simplewidgets.cpp
+++ b/src/plugins/accessible/widgets/simplewidgets.cpp
@@ -68,6 +68,13 @@ extern QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
QString Q_GUI_EXPORT qt_accHotKey(const QString &text);
+QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset, const QString& text);
+QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset, const QString& text);
+QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset, const QString& text);
+
/*!
\class QAccessibleButton
\brief The QAccessibleButton class implements the QAccessibleInterface for button type widgets.
@@ -815,25 +822,34 @@ QString QAccessibleLineEdit::text(int startOffset, int endOffset)
return lineEdit()->text().mid(startOffset, endOffset - startOffset);
}
-QString QAccessibleLineEdit::textBeforeOffset (int /*offset*/, BoundaryType /*boundaryType*/,
- int * /*startOffset*/, int * /*endOffset*/)
+QString QAccessibleLineEdit::textBeforeOffset(int offset, BoundaryType boundaryType,
+ int *startOffset, int *endOffset)
{
- // TODO
- return QString();
+ if (lineEdit()->echoMode() != QLineEdit::Normal) {
+ *startOffset = *endOffset = -1;
+ return QString();
+ }
+ return qTextBeforeOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
}
-QString QAccessibleLineEdit::textAfterOffset(int /*offset*/, BoundaryType /*boundaryType*/,
- int * /*startOffset*/, int * /*endOffset*/)
+QString QAccessibleLineEdit::textAfterOffset(int offset, BoundaryType boundaryType,
+ int *startOffset, int *endOffset)
{
- // TODO
- return QString();
+ if (lineEdit()->echoMode() != QLineEdit::Normal) {
+ *startOffset = *endOffset = -1;
+ return QString();
+ }
+ return qTextAfterOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
}
-QString QAccessibleLineEdit::textAtOffset(int /*offset*/, BoundaryType /*boundaryType*/,
- int * /*startOffset*/, int * /*endOffset*/)
+QString QAccessibleLineEdit::textAtOffset(int offset, BoundaryType boundaryType,
+ int *startOffset, int *endOffset)
{
- // TODO
- return QString();
+ if (lineEdit()->echoMode() != QLineEdit::Normal) {
+ *startOffset = *endOffset = -1;
+ return QString();
+ }
+ return qTextAtOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
}
void QAccessibleLineEdit::removeSelection(int selectionIndex)
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index 04edbb7..fc2791a 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -104,15 +104,7 @@ void SymbianEngine::initialize()
return;
}
- TRAP(error, {
- iConnectionMonitor.ConnectL();
- CleanupClosePushL(iConnectionMonitor);
-#ifdef SNAP_FUNCTIONALITY_AVAILABLE
- User::LeaveIfError(iConnectionMonitor.SetUintAttribute(EBearerIdAll, 0, KBearerGroupThreshold, 1));
-#endif
- iConnectionMonitor.NotifyEventL(*this);
- CleanupStack::Pop();
- });
+ TRAP(error, StartConnectionMonitorNotifyL());
if (error != KErrNone) {
iInitOk = false;
return;
@@ -148,6 +140,17 @@ void SymbianEngine::initialize()
startCommsDatabaseNotifications();
}
+void SymbianEngine::StartConnectionMonitorNotifyL()
+{
+ iConnectionMonitor.ConnectL();
+ CleanupClosePushL(iConnectionMonitor);
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
+ User::LeaveIfError(iConnectionMonitor.SetUintAttribute(EBearerIdAll, 0, KBearerGroupThreshold, 1));
+#endif
+ iConnectionMonitor.NotifyEventL(*this);
+ CleanupStack::Pop();
+}
+
SymbianEngine::~SymbianEngine()
{
Cancel();
@@ -255,7 +258,7 @@ void SymbianEngine::updateConfigurationsL()
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
// S60 version is >= Series60 3rd Edition Feature Pack 2
TInt error = KErrNone;
-
+
// Loop through all IAPs
RArray<TUint32> connectionMethods; // IAPs
CleanupClosePushL(connectionMethods);
@@ -289,7 +292,7 @@ void SymbianEngine::updateConfigurationsL()
CleanupStack::PopAndDestroy(&connectionMethod);
}
CleanupStack::PopAndDestroy(&connectionMethods);
-
+
// Loop through all SNAPs
RArray<TUint32> destinations;
CleanupClosePushL(destinations);
@@ -459,7 +462,7 @@ void SymbianEngine::updateConfigurationsL()
break;
}
}
- }
+ }
}
foreach (const QString &oldIface, knownSnapConfigs) {
@@ -489,13 +492,13 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL(
SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate;
TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId);
QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId));
-
+
HBufC *pName = connectionMethod.GetStringAttributeL(CMManager::ECmName);
CleanupStack::PushL(pName);
QT_TRYCATCH_LEAVING(cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()));
CleanupStack::PopAndDestroy(pName);
pName = NULL;
-
+
TUint32 bearerId = connectionMethod.GetIntAttributeL(CMManager::ECmCommsDBBearerType);
switch (bearerId) {
case KCommDbBearerCSD:
@@ -520,7 +523,7 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL(
cpPriv->bearerType = QNetworkConfiguration::BearerUnknown;
break;
}
-
+
TInt error = KErrNone;
TUint32 bearerType = connectionMethod.GetIntAttributeL(CMManager::ECmBearerType);
switch (bearerType) {
@@ -544,13 +547,13 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL(
CleanupStack::PopAndDestroy(pName);
pName = NULL;
}
-
+
cpPriv->state = QNetworkConfiguration::Defined;
TBool isConnected = connectionMethod.GetBoolAttributeL(CMManager::ECmConnected);
if (isConnected) {
cpPriv->state = QNetworkConfiguration::Active;
}
-
+
cpPriv->isValid = true;
cpPriv->id = ident;
cpPriv->numericId = iapId;
@@ -566,7 +569,7 @@ bool SymbianEngine::readNetworkConfigurationValuesFromCommsDb(
{
TRAPD(error, readNetworkConfigurationValuesFromCommsDbL(aApId,apNetworkConfiguration));
if (error != KErrNone) {
- return false;
+ return false;
}
return true;
}
@@ -574,22 +577,22 @@ bool SymbianEngine::readNetworkConfigurationValuesFromCommsDb(
void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL(
TUint32 aApId, SymbianNetworkConfigurationPrivate *apNetworkConfiguration)
{
- CApDataHandler* pDataHandler = CApDataHandler::NewLC(*ipCommsDB);
- CApAccessPointItem* pAPItem = CApAccessPointItem::NewLC();
+ CApDataHandler* pDataHandler = CApDataHandler::NewLC(*ipCommsDB);
+ CApAccessPointItem* pAPItem = CApAccessPointItem::NewLC();
TBuf<KCommsDbSvrMaxColumnNameLength> name;
-
+
CApUtils* pApUtils = CApUtils::NewLC(*ipCommsDB);
TUint32 apId = pApUtils->WapIdFromIapIdL(aApId);
-
+
pDataHandler->AccessPointDataL(apId,*pAPItem);
pAPItem->ReadTextL(EApIapName, name);
if (name.Compare(_L("Easy WLAN")) == 0) {
// "Easy WLAN" won't be accepted to the Configurations list
User::Leave(KErrNotFound);
}
-
+
QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(aApId));
-
+
QT_TRYCATCH_LEAVING(apNetworkConfiguration->name = QString::fromUtf16(name.Ptr(),name.Length()));
apNetworkConfiguration->isValid = true;
apNetworkConfiguration->id = ident;
@@ -600,7 +603,7 @@ void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL(
apNetworkConfiguration->purpose = QNetworkConfiguration::UnknownPurpose;
apNetworkConfiguration->roamingSupported = false;
switch (pAPItem->BearerTypeL()) {
- case EApBearerTypeCSD:
+ case EApBearerTypeCSD:
apNetworkConfiguration->bearerType = QNetworkConfiguration::Bearer2G;
break;
case EApBearerTypeGPRS:
@@ -625,7 +628,7 @@ void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL(
apNetworkConfiguration->bearerType = QNetworkConfiguration::BearerUnknown;
break;
}
-
+
CleanupStack::PopAndDestroy(pApUtils);
CleanupStack::PopAndDestroy(pAPItem);
CleanupStack::PopAndDestroy(pDataHandler);
@@ -664,7 +667,7 @@ QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfigurationL()
ptr = accessPointConfigurations.value(iface);
}
#endif
-
+
if (ptr) {
QMutexLocker configLocker(&ptr->mutex);
if (ptr->isValid)
@@ -684,7 +687,7 @@ void SymbianEngine::updateActiveAccessPoints()
TUint connectionCount;
iConnectionMonitor.GetConnectionCount(connectionCount, status);
User::WaitForRequest(status);
-
+
// Go through all connections and set state of related IAPs to Active.
// Status needs to be checked carefully, because ConnMon lists also e.g.
// WLAN connections that are being currently tried --> we don't want to
@@ -763,7 +766,7 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn
iUpdateGoingOn = false;
if (scanSuccessful) {
QList<QString> unavailableConfigs = accessPointConfigurations.keys();
-
+
// Set state of returned IAPs to Discovered
// if state is not already Active
for(TUint i=0; i<iapInfo.iCount; i++) {
@@ -780,7 +783,7 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn
}
}
}
-
+
// Make sure that state of rest of the IAPs won't be Active
foreach (const QString &iface, unavailableConfigs) {
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface);
@@ -792,7 +795,7 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn
}
updateStatesToSnaps();
-
+
if (!iFirstUpdate) {
startCommsDatabaseNotifications();
mutex.unlock();
@@ -844,7 +847,7 @@ void SymbianEngine::updateStatesToSnaps()
} else {
changeConfigurationStateTo(ptr, QNetworkConfiguration::Defined);
}
- }
+ }
}
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
@@ -1062,7 +1065,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
if (connectionStatus == KConfigDaemonStartingRegistration) {
TUint connectionId = realEvent->ConnectionId();
TUint subConnectionCount = 0;
- TUint apId;
+ TUint apId;
TRequestStatus status;
iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status);
User::WaitForRequest(status);
@@ -1088,7 +1091,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
// Connection has been successfully opened
TUint connectionId = realEvent->ConnectionId();
TUint subConnectionCount = 0;
- TUint apId;
+ TUint apId;
TRequestStatus status;
iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status);
User::WaitForRequest(status);
@@ -1144,7 +1147,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
connectionId, QNetworkSession::Disconnected);
);
}
-
+
bool online = false;
foreach (const QString &iface, accessPointConfigurations.keys()) {
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface);
@@ -1160,7 +1163,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
}
}
}
- break;
+ break;
case EConnMonIapAvailabilityChange:
{
@@ -1174,7 +1177,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
if (ptr) {
- // Configuration is either Discovered or Active
+ // Configuration is either Discovered or Active
QT_TRYCATCH_LEAVING(changeConfigurationStateAtMinTo(ptr, QNetworkConfiguration::Discovered));
unDiscoveredConfigs.removeOne(ident);
}
@@ -1360,7 +1363,7 @@ AccessPointsAvailabilityScanner::AccessPointsAvailabilityScanner(SymbianEngine&
RConnectionMonitor& connectionMonitor)
: CActive(CActive::EPriorityHigh), iOwner(owner), iConnectionMonitor(connectionMonitor)
{
- CActiveScheduler::Add(this);
+ CActiveScheduler::Add(this);
}
AccessPointsAvailabilityScanner::~AccessPointsAvailabilityScanner()
diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h
index 3b3a78a..a205c97 100644
--- a/src/plugins/bearer/symbian/symbianengine.h
+++ b/src/plugins/bearer/symbian/symbianengine.h
@@ -145,10 +145,10 @@ public:
Q_SIGNALS:
void onlineStateChanged(bool isOnline);
-
+
void configurationStateChanged(quint32 accessPointId, quint32 connMonId,
QNetworkSession::State newState);
-
+
public Q_SLOTS:
void updateConfigurations();
void delayedConfigurationUpdate();
@@ -169,8 +169,8 @@ private:
TUint32 aApId, SymbianNetworkConfigurationPrivate *apNetworkConfiguration);
void readNetworkConfigurationValuesFromCommsDbL(
TUint32 aApId, SymbianNetworkConfigurationPrivate *apNetworkConfiguration);
-#endif
-
+#endif
+
void updateConfigurationsL();
void updateActiveAccessPoints();
void updateAvailableAccessPoints();
@@ -184,11 +184,13 @@ private:
void startMonitoringIAPData(TUint32 aIapId);
QNetworkConfigurationPrivatePointer dataByConnectionId(TUint aConnectionId);
+ void StartConnectionMonitorNotifyL();
+
protected:
// From CActive
void RunL();
void DoCancel();
-
+
private:
// MConnectionMonitorObserver
void EventL(const CConnMonEventBase& aEvent);
@@ -198,7 +200,7 @@ private:
#endif
private: // Data
- bool iFirstUpdate;
+ bool iFirstUpdate;
CCommsDatabase* ipCommsDB;
RConnectionMonitor iConnectionMonitor;
@@ -225,11 +227,11 @@ class AccessPointsAvailabilityScanner : public CActive
{
public:
AccessPointsAvailabilityScanner(SymbianEngine& owner,
- RConnectionMonitor& connectionMonitor);
+ RConnectionMonitor& connectionMonitor);
~AccessPointsAvailabilityScanner();
void StartScanning();
-
+
protected: // From CActive
void RunL();
void DoCancel();
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
index 3423d2c..94efc2f 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
@@ -174,6 +174,14 @@ bool QMeeGoGraphicsSystemSwitchHandler::eventFilter(QObject *object, QEvent *eve
QMeeGoGraphicsSystem::switchToMeeGo();
}
}
+ } else if (event->type() == QEvent::Show
+ && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch) {
+ if (visibleWidgets() > 0)
+ QMeeGoGraphicsSystem::switchToMeeGo();
+ } else if (event->type() == QEvent::Hide
+ && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch) {
+ if (visibleWidgets() == 0)
+ QMeeGoGraphicsSystem::switchToRaster();
}
// resume processing of event
diff --git a/src/plugins/platforms/openvglite/openvglite.pro b/src/plugins/platforms/openvglite/openvglite.pro
deleted file mode 100644
index 9d7860a..0000000
--- a/src/plugins/platforms/openvglite/openvglite.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET = qvglitegraphicssystem
-include(../../qpluginbase.pri)
-
-QT += openvg
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems
-
-SOURCES = main.cpp qgraphicssystem_vglite.cpp qwindowsurface_vglite.cpp
-HEADERS = qgraphicssystem_vglite.h qwindowsurface_vglite.h
-
-target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems
-INSTALLS += target
diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp
deleted file mode 100644
index 203896f..0000000
--- a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgraphicssystem_vglite.h"
-#include "qwindowsurface_vglite.h"
-#include <QtOpenVG/private/qpixmapdata_vg_p.h>
-#include <QtGui/private/qegl_p.h>
-#include <QtCore/qdebug.h>
-#ifdef OPENVG_USBHP_INIT
-extern "C" {
-#include <linuxusbhp.h>
-};
-#endif
-
-QT_BEGIN_NAMESPACE
-
-QVGLiteGraphicsSystem::QVGLiteGraphicsSystem()
- : w(0), h(0), d(0), dw(0), dh(0), physWidth(0), physHeight(0),
- surface(0), context(0), rootWindow(0),
- screenFormat(QImage::Format_RGB16), preservedSwap(false)
-{
-#ifdef OPENVG_USBHP_INIT
- initLibrary();
-#endif
-
- // The graphics system is also the screen definition.
- mScreens.append(this);
-
- QString displaySpec = QString::fromLatin1(qgetenv("QWS_DISPLAY"));
- QStringList displayArgs = displaySpec.split(QLatin1Char(':'));
-
- // Initialize EGL and create the global EGL context.
- context = qt_vg_create_context(0);
- if (!context) {
- qFatal("QVGLiteGraphicsSystem: could not initialize EGL");
- return;
- }
-
- // Get the root window handle to use. Default to zero.
- QRegExp winidRx(QLatin1String("winid=?(\\d+)"));
- int winidIdx = displayArgs.indexOf(winidRx);
- int handle = 0;
- if (winidIdx >= 0) {
- winidRx.exactMatch(displayArgs.at(winidIdx));
- handle = winidRx.cap(1).toInt();
- }
-
- // Create a full-screen window based on the native handle.
- // If the context is premultiplied, the window should be too.
- QEglProperties props;
-#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
- EGLint surfaceType = 0;
- if (context->configAttrib(EGL_SURFACE_TYPE, &surfaceType) &&
- (surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT) != 0)
- props.setValue(EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE);
-#endif
- rootWindow = eglCreateWindowSurface
- (context->display(), context->config(),
- (EGLNativeWindowType)handle, props.properties());
- if (rootWindow == EGL_NO_SURFACE) {
- delete context;
- context = 0;
- qFatal("QVGLiteGraphicsSystem: could not create full-screen window");
- return;
- }
-
- // Try to turn on preserved swap behaviour on the root window.
- // This will allow us to optimize compositing to focus on just
- // the screen region that has changed. Otherwise we must
- // re-composite the entire screen every frame.
-#if !defined(QVG_NO_PRESERVED_SWAP)
- eglGetError(); // Clear error state first.
- eglSurfaceAttrib(context->display(), rootWindow,
- EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
- preservedSwap = (eglGetError() == EGL_SUCCESS);
-#else
- preservedSwap = false;
-#endif
-
- // Fetch the root window properties.
- eglQuerySurface(context->display(), rootWindow, EGL_WIDTH, &w);
- eglQuerySurface(context->display(), rootWindow, EGL_HEIGHT, &h);
- screenFormat = qt_vg_config_to_image_format(context);
- switch (screenFormat) {
- case QImage::Format_ARGB32_Premultiplied:
- case QImage::Format_ARGB32:
- case QImage::Format_RGB32:
- default:
- d = 32;
- break;
- case QImage::Format_RGB16:
- case QImage::Format_ARGB4444_Premultiplied:
- d = 16;
- break;
- }
- dw = w;
- dh = h;
- qDebug("screen size: %dx%dx%d", w, h, d);
-
- // Handle display physical size spec. From qscreenlinuxfb_qws.cpp.
- QRegExp mmWidthRx(QLatin1String("mmWidth=?(\\d+)"));
- int dimIdxW = displayArgs.indexOf(mmWidthRx);
- QRegExp mmHeightRx(QLatin1String("mmHeight=?(\\d+)"));
- int dimIdxH = displayArgs.indexOf(mmHeightRx);
- if (dimIdxW >= 0) {
- mmWidthRx.exactMatch(displayArgs.at(dimIdxW));
- physWidth = mmWidthRx.cap(1).toInt();
- if (dimIdxH < 0)
- physHeight = dh*physWidth/dw;
- }
- if (dimIdxH >= 0) {
- mmHeightRx.exactMatch(displayArgs.at(dimIdxH));
- physHeight = mmHeightRx.cap(1).toInt();
- if (dimIdxW < 0)
- physWidth = dw*physHeight/dh;
- }
- if (dimIdxW < 0 && dimIdxH < 0) {
- const int dpi = 72;
- physWidth = qRound(dw * 25.4 / dpi);
- physHeight = qRound(dh * 25.4 / dpi);
- }
-}
-
-QVGLiteGraphicsSystem::~QVGLiteGraphicsSystem()
-{
-}
-
-QPixmapData *QVGLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
-{
-#if !defined(QVGLite_NO_SINGLE_CONTEXT) && !defined(QVGLite_NO_PIXMAP_DATA)
- // Pixmaps can use QVGLitePixmapData; bitmaps must use raster.
- if (type == QPixmapData::PixmapType)
- return new QVGPixmapData(type);
- else
- return new QRasterPixmapData(type);
-#else
- return new QRasterPixmapData(type);
-#endif
-}
-
-QWindowSurface *QVGLiteGraphicsSystem::createWindowSurface(QWidget *widget) const
-{
- if (widget->windowType() == Qt::Desktop)
- return 0; // Don't create an explicit window surface for the destkop.
- if (surface) {
- qWarning() << "QVGLiteGraphicsSystem: only one window surface "
- "is supported at a time";
- return 0;
- }
- surface = new QVGLiteWindowSurface
- (const_cast<QVGLiteGraphicsSystem *>(this), widget);
- return surface;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp b/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp
deleted file mode 100644
index dad23c1..0000000
--- a/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwindowsurface_vglite.h"
-#include "qgraphicssystem_vglite.h"
-#include <QtOpenVG/qvg.h>
-#include <QtOpenVG/private/qvg_p.h>
-#include <QtOpenVG/private/qpaintengine_vg_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QVGLiteWindowSurface::QVGLiteWindowSurface
- (QVGLiteGraphicsSystem *gs, QWidget *window)
- : QWindowSurface(window), graphicsSystem(gs),
- isPaintingActive(false), engine(0)
-{
-}
-
-QVGLiteWindowSurface::~QVGLiteWindowSurface()
-{
- graphicsSystem->surface = 0;
- if (engine)
- qt_vg_destroy_paint_engine(engine);
-}
-
-QPaintDevice *QVGLiteWindowSurface::paintDevice()
-{
- qt_vg_make_current(graphicsSystem->context, graphicsSystem->rootWindow);
- isPaintingActive = true;
- // TODO: clear the parts of the back buffer that are not
- // covered by the window surface to black.
- return this;
-}
-
-void QVGLiteWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
-{
- Q_UNUSED(widget);
- Q_UNUSED(region);
- Q_UNUSED(offset);
- QEglContext *context = graphicsSystem->context;
- if (context) {
- if (!isPaintingActive)
- qt_vg_make_current(context, graphicsSystem->rootWindow);
- context->swapBuffers();
- qt_vg_done_current(context);
- context->setSurface(EGL_NO_SURFACE);
- isPaintingActive = false;
- }
-}
-
-void QVGLiteWindowSurface::setGeometry(const QRect &rect)
-{
- QWindowSurface::setGeometry(rect);
-}
-
-bool QVGLiteWindowSurface::scroll(const QRegion &area, int dx, int dy)
-{
- return QWindowSurface::scroll(area, dx, dy);
-}
-
-void QVGLiteWindowSurface::beginPaint(const QRegion &region)
-{
- Q_UNUSED(region);
-}
-
-void QVGLiteWindowSurface::endPaint(const QRegion &region)
-{
- Q_UNUSED(region);
-}
-
-QPaintEngine *QVGLiteWindowSurface::paintEngine() const
-{
- if (!engine)
- engine = qt_vg_create_paint_engine();
- return engine;
-}
-
-// We need to get access to QWidget::metric() from QVGLiteWindowSurface::metric,
-// but it is not a friend of QWidget. To get around this, we create a
-// fake QX11PaintEngine class, which is a friend.
-class QX11PaintEngine
-{
-public:
- static int metric(const QWidget *widget, QPaintDevice::PaintDeviceMetric met)
- {
- return widget->metric(met);
- }
-};
-
-int QVGLiteWindowSurface::metric(PaintDeviceMetric met) const
-{
- return QX11PaintEngine::metric(window(), met);
-}
diff --git a/src/plugins/platforms/openvglite/main.cpp b/src/plugins/qmltooling/qmldbg_inspector/abstracttool.cpp
index 19220a6..39ced2a 100644
--- a/src/plugins/platforms/openvglite/main.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/abstracttool.cpp
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the plugins of the Qt Toolkit.
+** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -39,33 +39,16 @@
**
****************************************************************************/
-#include <private/qgraphicssystemplugin_p.h>
-#include "qgraphicssystem_vglite.h"
+#include "abstracttool.h"
-QT_BEGIN_NAMESPACE
+#include "abstractviewinspector.h"
-class QVGGraphicsSystemPlugin : public QGraphicsSystemPlugin
-{
-public:
- QStringList keys() const;
- QGraphicsSystem *create(const QString&);
-};
-
-QStringList QVGGraphicsSystemPlugin::keys() const
-{
- QStringList list;
- list << "OpenVG";
- return list;
-}
+namespace QmlJSDebugger {
-QGraphicsSystem* QVGGraphicsSystemPlugin::create(const QString& system)
+AbstractTool::AbstractTool(AbstractViewInspector *inspector) :
+ QObject(inspector),
+ m_inspector(inspector)
{
- if (system.toLower() == "openvg")
- return new QVGLiteGraphicsSystem;
-
- return 0;
}
-Q_EXPORT_PLUGIN2(openvg, QVGGraphicsSystemPlugin)
-
-QT_END_NAMESPACE
+} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/abstracttool.h b/src/plugins/qmltooling/qmldbg_inspector/abstracttool.h
new file mode 100644
index 0000000..0a216bf
--- /dev/null
+++ b/src/plugins/qmltooling/qmldbg_inspector/abstracttool.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ABSTRACTTOOL_H
+#define ABSTRACTTOOL_H
+
+#include <QtCore/QObject>
+
+QT_BEGIN_NAMESPACE
+class QMouseEvent;
+class QKeyEvent;
+class QWheelEvent;
+QT_END_NAMESPACE
+
+namespace QmlJSDebugger {
+
+class AbstractViewInspector;
+
+class AbstractTool : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit AbstractTool(AbstractViewInspector *inspector);
+
+ AbstractViewInspector *inspector() const { return m_inspector; }
+
+ virtual void leaveEvent(QEvent *event) = 0;
+
+ virtual void mousePressEvent(QMouseEvent *event) = 0;
+ virtual void mouseMoveEvent(QMouseEvent *event) = 0;
+ virtual void mouseReleaseEvent(QMouseEvent *event) = 0;
+ virtual void mouseDoubleClickEvent(QMouseEvent *event) = 0;
+
+ virtual void hoverMoveEvent(QMouseEvent *event) = 0;
+ virtual void wheelEvent(QWheelEvent *event) = 0;
+
+ virtual void keyPressEvent(QKeyEvent *event) = 0;
+ virtual void keyReleaseEvent(QKeyEvent *keyEvent) = 0;
+
+private:
+ AbstractViewInspector *m_inspector;
+};
+
+} // namespace QmlJSDebugger
+
+#endif // ABSTRACTTOOL_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp
new file mode 100644
index 0000000..3323d54
--- /dev/null
+++ b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp
@@ -0,0 +1,611 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "abstractviewinspector.h"
+
+#include "abstracttool.h"
+#include "editor/qmltoolbar.h"
+#include "qdeclarativeinspectorprotocol.h"
+
+#include <QtDeclarative/QDeclarativeEngine>
+#include <QtDeclarative/QDeclarativeComponent>
+#include <QtDeclarative/private/qdeclarativedebughelper_p.h>
+#include "QtDeclarative/private/qdeclarativeinspectorservice_p.h"
+
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QMouseEvent>
+#include <QtCore/QSettings>
+
+static inline void initEditorResource() { Q_INIT_RESOURCE(editor); }
+
+namespace QmlJSDebugger {
+
+const char * const KEY_TOOLBOX_GEOMETRY = "toolBox/geometry";
+
+
+class ToolBox : public QWidget
+{
+ Q_OBJECT
+
+public:
+ ToolBox(QWidget *parent = 0);
+ ~ToolBox();
+
+ QmlToolBar *toolBar() const { return m_toolBar; }
+
+private:
+ QSettings m_settings;
+ QmlToolBar *m_toolBar;
+};
+
+ToolBox::ToolBox(QWidget *parent)
+ : QWidget(parent, Qt::Tool)
+ , m_settings(QLatin1String("Nokia"), QLatin1String("QmlInspector"), this)
+ , m_toolBar(new QmlToolBar)
+{
+ setWindowFlags((windowFlags() & ~Qt::WindowCloseButtonHint) | Qt::CustomizeWindowHint);
+ setWindowTitle(tr("Qt Quick Toolbox"));
+
+ QVBoxLayout *verticalLayout = new QVBoxLayout;
+ verticalLayout->setMargin(0);
+ verticalLayout->addWidget(m_toolBar);
+ setLayout(verticalLayout);
+
+ restoreGeometry(m_settings.value(QLatin1String(KEY_TOOLBOX_GEOMETRY)).toByteArray());
+}
+
+ToolBox::~ToolBox()
+{
+ m_settings.setValue(QLatin1String(KEY_TOOLBOX_GEOMETRY), saveGeometry());
+}
+
+
+AbstractViewInspector::AbstractViewInspector(QObject *parent) :
+ QObject(parent),
+ m_toolBox(0),
+ m_currentTool(0),
+ m_showAppOnTop(false),
+ m_designModeBehavior(false),
+ m_animationPaused(false),
+ m_slowDownFactor(1.0),
+ m_debugService(0)
+{
+ initEditorResource();
+
+ m_debugService = QDeclarativeInspectorService::instance();
+ connect(m_debugService, SIGNAL(gotMessage(QByteArray)),
+ this, SLOT(handleMessage(QByteArray)));
+}
+
+void AbstractViewInspector::createQmlObject(const QString &qml, QObject *parent,
+ const QStringList &importList,
+ const QString &filename)
+{
+ if (!parent)
+ return;
+
+ QString imports;
+ foreach (const QString &s, importList) {
+ imports += s;
+ imports += QLatin1Char('\n');
+ }
+
+ QDeclarativeContext *parentContext = declarativeEngine()->contextForObject(parent);
+ QDeclarativeComponent component(declarativeEngine());
+ QByteArray constructedQml = QString(imports + qml).toLatin1();
+
+ component.setData(constructedQml, QUrl::fromLocalFile(filename));
+ QObject *newObject = component.create(parentContext);
+ if (newObject)
+ reparentQmlObject(newObject, parent);
+}
+
+void AbstractViewInspector::clearComponentCache()
+{
+ declarativeEngine()->clearComponentCache();
+}
+
+void AbstractViewInspector::setDesignModeBehavior(bool value)
+{
+ if (m_designModeBehavior == value)
+ return;
+
+ m_designModeBehavior = value;
+ emit designModeBehaviorChanged(value);
+ sendDesignModeBehavior(value);
+}
+
+void AbstractViewInspector::setAnimationSpeed(qreal slowDownFactor)
+{
+ Q_ASSERT(slowDownFactor > 0);
+ if (m_slowDownFactor == slowDownFactor)
+ return;
+
+ animationSpeedChangeRequested(slowDownFactor);
+ sendAnimationSpeed(slowDownFactor);
+}
+
+void AbstractViewInspector::setAnimationPaused(bool paused)
+{
+ if (m_animationPaused == paused)
+ return;
+
+ animationPausedChangeRequested(paused);
+ sendAnimationPaused(paused);
+}
+
+void AbstractViewInspector::animationSpeedChangeRequested(qreal factor)
+{
+ if (m_slowDownFactor != factor) {
+ m_slowDownFactor = factor;
+ emit animationSpeedChanged(factor);
+ }
+
+ const float effectiveFactor = m_animationPaused ? 0 : factor;
+ QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor);
+}
+
+void AbstractViewInspector::animationPausedChangeRequested(bool paused)
+{
+ if (m_animationPaused != paused) {
+ m_animationPaused = paused;
+ emit animationPausedChanged(paused);
+ }
+
+ const float effectiveFactor = paused ? 0 : m_slowDownFactor;
+ QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor);
+}
+
+void AbstractViewInspector::setShowAppOnTop(bool appOnTop)
+{
+ if (viewWidget()) {
+ QWidget *window = viewWidget()->window();
+ Qt::WindowFlags flags = window->windowFlags();
+ if (appOnTop)
+ flags |= Qt::WindowStaysOnTopHint;
+ else
+ flags &= ~Qt::WindowStaysOnTopHint;
+
+ window->setWindowFlags(flags);
+ window->show();
+ }
+
+ m_showAppOnTop = appOnTop;
+ sendShowAppOnTop(appOnTop);
+
+ emit showAppOnTopChanged(appOnTop);
+}
+
+void AbstractViewInspector::setToolBoxVisible(bool visible)
+{
+#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR)
+ if (!m_toolBox && visible)
+ createToolBox();
+ if (m_toolBox)
+ m_toolBox->setVisible(visible);
+#else
+ Q_UNUSED(visible)
+#endif
+}
+
+void AbstractViewInspector::createToolBox()
+{
+ m_toolBox = new ToolBox(viewWidget());
+
+ QmlToolBar *toolBar = m_toolBox->toolBar();
+
+ QObject::connect(this, SIGNAL(selectedColorChanged(QColor)),
+ toolBar, SLOT(setColorBoxColor(QColor)));
+
+ QObject::connect(this, SIGNAL(designModeBehaviorChanged(bool)),
+ toolBar, SLOT(setDesignModeBehavior(bool)));
+
+ QObject::connect(toolBar, SIGNAL(designModeBehaviorChanged(bool)),
+ this, SLOT(setDesignModeBehavior(bool)));
+ QObject::connect(toolBar, SIGNAL(animationSpeedChanged(qreal)), this, SLOT(setAnimationSpeed(qreal)));
+ QObject::connect(toolBar, SIGNAL(animationPausedChanged(bool)), this, SLOT(setAnimationPaused(bool)));
+ QObject::connect(toolBar, SIGNAL(colorPickerSelected()), this, SLOT(changeToColorPickerTool()));
+ QObject::connect(toolBar, SIGNAL(zoomToolSelected()), this, SLOT(changeToZoomTool()));
+ QObject::connect(toolBar, SIGNAL(selectToolSelected()), this, SLOT(changeToSingleSelectTool()));
+ QObject::connect(toolBar, SIGNAL(marqueeSelectToolSelected()),
+ this, SLOT(changeToMarqueeSelectTool()));
+
+ QObject::connect(toolBar, SIGNAL(applyChangesFromQmlFileSelected()),
+ this, SLOT(applyChangesFromClient()));
+
+ QObject::connect(this, SIGNAL(animationSpeedChanged(qreal)), toolBar, SLOT(setAnimationSpeed(qreal)));
+ QObject::connect(this, SIGNAL(animationPausedChanged(bool)), toolBar, SLOT(setAnimationPaused(bool)));
+
+ QObject::connect(this, SIGNAL(selectToolActivated()), toolBar, SLOT(activateSelectTool()));
+
+ // disabled features
+ //connect(d->m_toolBar, SIGNAL(applyChangesToQmlFileSelected()), SLOT(applyChangesToClient()));
+ //connect(q, SIGNAL(resizeToolActivated()), d->m_toolBar, SLOT(activateSelectTool()));
+ //connect(q, SIGNAL(moveToolActivated()), d->m_toolBar, SLOT(activateSelectTool()));
+
+ QObject::connect(this, SIGNAL(colorPickerActivated()), toolBar, SLOT(activateColorPicker()));
+ QObject::connect(this, SIGNAL(zoomToolActivated()), toolBar, SLOT(activateZoom()));
+ QObject::connect(this, SIGNAL(marqueeSelectToolActivated()),
+ toolBar, SLOT(activateMarqueeSelectTool()));
+}
+
+void AbstractViewInspector::changeToColorPickerTool()
+{
+ changeTool(InspectorProtocol::ColorPickerTool);
+}
+
+void AbstractViewInspector::changeToZoomTool()
+{
+ changeTool(InspectorProtocol::ZoomTool);
+}
+
+void AbstractViewInspector::changeToSingleSelectTool()
+{
+ changeTool(InspectorProtocol::SelectTool);
+}
+
+void AbstractViewInspector::changeToMarqueeSelectTool()
+{
+ changeTool(InspectorProtocol::SelectMarqueeTool);
+}
+
+bool AbstractViewInspector::eventFilter(QObject *obj, QEvent *event)
+{
+ if (!designModeBehavior())
+ return QObject::eventFilter(obj, event);
+
+ switch (event->type()) {
+ case QEvent::Leave:
+ if (leaveEvent(event))
+ return true;
+ break;
+ case QEvent::MouseButtonPress:
+ if (mousePressEvent(static_cast<QMouseEvent*>(event)))
+ return true;
+ break;
+ case QEvent::MouseMove:
+ if (mouseMoveEvent(static_cast<QMouseEvent*>(event)))
+ return true;
+ break;
+ case QEvent::MouseButtonRelease:
+ if (mouseReleaseEvent(static_cast<QMouseEvent*>(event)))
+ return true;
+ break;
+ case QEvent::KeyPress:
+ if (keyPressEvent(static_cast<QKeyEvent*>(event)))
+ return true;
+ break;
+ case QEvent::KeyRelease:
+ if (keyReleaseEvent(static_cast<QKeyEvent*>(event)))
+ return true;
+ break;
+ case QEvent::MouseButtonDblClick:
+ if (mouseDoubleClickEvent(static_cast<QMouseEvent*>(event)))
+ return true;
+ break;
+ case QEvent::Wheel:
+ if (wheelEvent(static_cast<QWheelEvent*>(event)))
+ return true;
+ break;
+ default:
+ break;
+ }
+
+ return QObject::eventFilter(obj, event);
+}
+
+bool AbstractViewInspector::leaveEvent(QEvent *event)
+{
+ m_currentTool->leaveEvent(event);
+ return true;
+}
+
+bool AbstractViewInspector::mousePressEvent(QMouseEvent *event)
+{
+ m_currentTool->mousePressEvent(event);
+ return true;
+}
+
+bool AbstractViewInspector::mouseMoveEvent(QMouseEvent *event)
+{
+ if (event->buttons()) {
+ m_currentTool->mouseMoveEvent(event);
+ } else {
+ m_currentTool->hoverMoveEvent(event);
+ }
+ return true;
+}
+
+bool AbstractViewInspector::mouseReleaseEvent(QMouseEvent *event)
+{
+ m_currentTool->mouseReleaseEvent(event);
+ return true;
+}
+
+bool AbstractViewInspector::keyPressEvent(QKeyEvent *event)
+{
+ m_currentTool->keyPressEvent(event);
+ return true;
+}
+
+bool AbstractViewInspector::keyReleaseEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_V:
+ changeTool(InspectorProtocol::SelectTool);
+ break;
+// disabled because multiselection does not do anything useful without design mode
+// case Qt::Key_M:
+// changeTool(InspectorProtocol::SelectMarqueeTool);
+// break;
+ case Qt::Key_I:
+ changeTool(InspectorProtocol::ColorPickerTool);
+ break;
+ case Qt::Key_Z:
+ changeTool(InspectorProtocol::ZoomTool);
+ break;
+ case Qt::Key_Space:
+ setAnimationPaused(!animationPaused());
+ break;
+ default:
+ break;
+ }
+
+ m_currentTool->keyReleaseEvent(event);
+ return true;
+}
+
+bool AbstractViewInspector::mouseDoubleClickEvent(QMouseEvent *event)
+{
+ m_currentTool->mouseDoubleClickEvent(event);
+ return true;
+}
+
+bool AbstractViewInspector::wheelEvent(QWheelEvent *event)
+{
+ m_currentTool->wheelEvent(event);
+ return true;
+}
+
+void AbstractViewInspector::handleMessage(const QByteArray &message)
+{
+ QDataStream ds(message);
+
+ InspectorProtocol::Message type;
+ ds >> type;
+
+ switch (type) {
+ case InspectorProtocol::SetCurrentObjects: {
+ int itemCount = 0;
+ ds >> itemCount;
+
+ QList<QObject*> selectedObjects;
+ for (int i = 0; i < itemCount; ++i) {
+ int debugId = -1;
+ ds >> debugId;
+ if (QObject *obj = QDeclarativeDebugService::objectForId(debugId))
+ selectedObjects << obj;
+ }
+
+ changeCurrentObjects(selectedObjects);
+ break;
+ }
+ case InspectorProtocol::Reload: {
+ reloadView();
+ break;
+ }
+ case InspectorProtocol::SetAnimationSpeed: {
+ qreal speed;
+ ds >> speed;
+ animationSpeedChangeRequested(speed);
+ break;
+ }
+ case InspectorProtocol::SetAnimationPaused: {
+ bool paused;
+ ds >> paused;
+ animationPausedChangeRequested(paused);
+ break;
+ }
+ case InspectorProtocol::ChangeTool: {
+ InspectorProtocol::Tool tool;
+ ds >> tool;
+ changeTool(tool);
+ break;
+ }
+ case InspectorProtocol::SetDesignMode: {
+ bool inDesignMode;
+ ds >> inDesignMode;
+ setDesignModeBehavior(inDesignMode);
+ break;
+ }
+ case InspectorProtocol::ShowAppOnTop: {
+ bool showOnTop;
+ ds >> showOnTop;
+ setShowAppOnTop(showOnTop);
+ break;
+ }
+ case InspectorProtocol::CreateObject: {
+ QString qml;
+ int parentId;
+ QString filename;
+ QStringList imports;
+ ds >> qml >> parentId >> imports >> filename;
+ createQmlObject(qml, QDeclarativeDebugService::objectForId(parentId),
+ imports, filename);
+ break;
+ }
+ case InspectorProtocol::DestroyObject: {
+ int debugId;
+ ds >> debugId;
+ if (QObject *obj = QDeclarativeDebugService::objectForId(debugId))
+ obj->deleteLater();
+ break;
+ }
+ case InspectorProtocol::MoveObject: {
+ int debugId, newParent;
+ ds >> debugId >> newParent;
+ reparentQmlObject(QDeclarativeDebugService::objectForId(debugId),
+ QDeclarativeDebugService::objectForId(newParent));
+ break;
+ }
+ case InspectorProtocol::ObjectIdList: {
+ int itemCount;
+ ds >> itemCount;
+ m_stringIdForObjectId.clear();
+ for (int i = 0; i < itemCount; ++i) {
+ int itemDebugId;
+ QString itemIdString;
+ ds >> itemDebugId
+ >> itemIdString;
+
+ m_stringIdForObjectId.insert(itemDebugId, itemIdString);
+ }
+ break;
+ }
+ case InspectorProtocol::ClearComponentCache: {
+ clearComponentCache();
+ break;
+ }
+ default:
+ qWarning() << "Warning: Not handling message:" << type;
+ }
+}
+
+void AbstractViewInspector::sendDesignModeBehavior(bool inDesignMode)
+{
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+
+ ds << InspectorProtocol::SetDesignMode
+ << inDesignMode;
+
+ m_debugService->sendMessage(message);
+}
+
+void AbstractViewInspector::sendCurrentObjects(const QList<QObject*> &objects)
+{
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+
+ ds << InspectorProtocol::CurrentObjectsChanged
+ << objects.length();
+
+ foreach (QObject *object, objects) {
+ int id = QDeclarativeDebugService::idForObject(object);
+ ds << id;
+ }
+
+ m_debugService->sendMessage(message);
+}
+
+void AbstractViewInspector::sendCurrentTool(Constants::DesignTool toolId)
+{
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+
+ ds << InspectorProtocol::ToolChanged
+ << toolId;
+
+ m_debugService->sendMessage(message);
+}
+
+void AbstractViewInspector::sendAnimationSpeed(qreal slowDownFactor)
+{
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+
+ ds << InspectorProtocol::AnimationSpeedChanged
+ << slowDownFactor;
+
+ m_debugService->sendMessage(message);
+}
+
+void AbstractViewInspector::sendAnimationPaused(bool paused)
+{
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+
+ ds << InspectorProtocol::AnimationPausedChanged
+ << paused;
+
+ m_debugService->sendMessage(message);
+}
+
+void AbstractViewInspector::sendReloaded()
+{
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+
+ ds << InspectorProtocol::Reloaded;
+
+ m_debugService->sendMessage(message);
+}
+
+void AbstractViewInspector::sendShowAppOnTop(bool showAppOnTop)
+{
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+
+ ds << InspectorProtocol::ShowAppOnTop << showAppOnTop;
+
+ m_debugService->sendMessage(message);
+}
+
+void AbstractViewInspector::sendColorChanged(const QColor &color)
+{
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+
+ ds << InspectorProtocol::ColorChanged
+ << color;
+
+ m_debugService->sendMessage(message);
+}
+
+QString AbstractViewInspector::idStringForObject(QObject *obj) const
+{
+ const int id = QDeclarativeDebugService::idForObject(obj);
+ return m_stringIdForObjectId.value(id);
+}
+
+} // namespace QmlJSDebugger
+
+#include "abstractviewinspector.moc"
diff --git a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h
new file mode 100644
index 0000000..7202bcc
--- /dev/null
+++ b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h
@@ -0,0 +1,178 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ABSTRACTVIEWINSPECTOR_H
+#define ABSTRACTVIEWINSPECTOR_H
+
+#include <QtCore/QHash>
+#include <QtCore/QObject>
+#include <QtCore/QStringList>
+#include <QtGui/QColor>
+
+#include "qdeclarativeinspectorprotocol.h"
+#include "qmlinspectorconstants.h"
+
+QT_BEGIN_NAMESPACE
+class QDeclarativeEngine;
+class QDeclarativeInspectorService;
+class QKeyEvent;
+class QMouseEvent;
+class QWheelEvent;
+QT_END_NAMESPACE
+
+namespace QmlJSDebugger {
+
+class AbstractTool;
+class ToolBox;
+
+/*
+ * The common code between QSGView and QDeclarativeView inspectors lives here,
+ */
+class AbstractViewInspector : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit AbstractViewInspector(QObject *parent = 0);
+
+ virtual void changeCurrentObjects(const QList<QObject*> &objects) = 0;
+
+ virtual void reloadView() = 0;
+
+ void createQmlObject(const QString &qml, QObject *parent,
+ const QStringList &importList,
+ const QString &filename = QString());
+
+ virtual void reparentQmlObject(QObject *object, QObject *newParent) = 0;
+
+ virtual void changeTool(InspectorProtocol::Tool tool) = 0;
+
+ void clearComponentCache();
+
+ virtual QWidget *viewWidget() const = 0;
+ virtual QDeclarativeEngine *declarativeEngine() const = 0;
+
+
+ bool showAppOnTop() const { return m_showAppOnTop; }
+ bool designModeBehavior() const { return m_designModeBehavior; }
+
+ bool animationPaused() const { return m_animationPaused; }
+ qreal slowDownFactor() const { return m_slowDownFactor; }
+
+ void sendCurrentObjects(const QList<QObject*> &);
+ void sendAnimationSpeed(qreal slowDownFactor);
+ void sendAnimationPaused(bool paused);
+ void sendCurrentTool(Constants::DesignTool toolId);
+ void sendReloaded();
+ void sendShowAppOnTop(bool showAppOnTop);
+
+ QString idStringForObject(QObject *obj) const;
+
+public slots:
+ void sendDesignModeBehavior(bool inDesignMode);
+ void sendColorChanged(const QColor &color);
+
+ void changeToColorPickerTool();
+ void changeToZoomTool();
+ void changeToSingleSelectTool();
+ void changeToMarqueeSelectTool();
+
+ virtual void setDesignModeBehavior(bool value);
+
+ void setShowAppOnTop(bool appOnTop);
+
+ void setAnimationSpeed(qreal factor);
+ void setAnimationPaused(bool paused);
+
+signals:
+ void designModeBehaviorChanged(bool inDesignMode);
+ void showAppOnTopChanged(bool showAppOnTop);
+ void reloadRequested();
+ void marqueeSelectToolActivated();
+ void selectToolActivated();
+ void zoomToolActivated();
+ void colorPickerActivated();
+ void selectedColorChanged(const QColor &color);
+
+ void animationSpeedChanged(qreal factor);
+ void animationPausedChanged(bool paused);
+
+protected:
+ bool eventFilter(QObject *, QEvent *);
+
+ virtual bool leaveEvent(QEvent *);
+ virtual bool mousePressEvent(QMouseEvent *event);
+ virtual bool mouseMoveEvent(QMouseEvent *event);
+ virtual bool mouseReleaseEvent(QMouseEvent *event);
+ virtual bool keyPressEvent(QKeyEvent *event);
+ virtual bool keyReleaseEvent(QKeyEvent *keyEvent);
+ virtual bool mouseDoubleClickEvent(QMouseEvent *event);
+ virtual bool wheelEvent(QWheelEvent *event);
+
+ AbstractTool *currentTool() const { return m_currentTool; }
+ void setCurrentTool(AbstractTool *tool) { m_currentTool = tool; }
+
+private slots:
+ void handleMessage(const QByteArray &message);
+
+private:
+ void animationSpeedChangeRequested(qreal factor);
+ void animationPausedChangeRequested(bool paused);
+
+ void setToolBoxVisible(bool visible);
+ void createToolBox();
+
+ ToolBox *m_toolBox;
+ AbstractTool *m_currentTool;
+
+ bool m_showAppOnTop;
+ bool m_designModeBehavior;
+
+ bool m_animationPaused;
+ qreal m_slowDownFactor;
+
+ QHash<int, QString> m_stringIdForObjectId;
+ QDeclarativeInspectorService *m_debugService;
+};
+
+} // namespace QmlJSDebugger
+
+#endif // ABSTRACTVIEWINSPECTOR_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp
index 36e6ba0..dce147c 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#include "abstractliveedittool_p.h"
-#include "../qdeclarativeviewinspector_p_p.h"
+#include "abstractliveedittool.h"
+#include "../qdeclarativeviewinspector_p.h"
#include <QDeclarativeEngine>
@@ -48,10 +48,10 @@
#include <QGraphicsItem>
#include <QDeclarativeItem>
-QT_BEGIN_NAMESPACE
+namespace QmlJSDebugger {
AbstractLiveEditTool::AbstractLiveEditTool(QDeclarativeViewInspector *editorView)
- : QObject(editorView), m_inspector(editorView)
+ : AbstractTool(editorView)
{
}
@@ -62,12 +62,12 @@ AbstractLiveEditTool::~AbstractLiveEditTool()
QDeclarativeViewInspector *AbstractLiveEditTool::inspector() const
{
- return m_inspector;
+ return static_cast<QDeclarativeViewInspector*>(AbstractTool::inspector());
}
QDeclarativeView *AbstractLiveEditTool::view() const
{
- return m_inspector->declarativeView();
+ return inspector()->declarativeView();
}
QGraphicsScene* AbstractLiveEditTool::scene() const
@@ -175,7 +175,7 @@ QString AbstractLiveEditTool::titleForItem(QGraphicsItem *item)
QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(gfxObject);
if (declarativeItem) {
- objectStringId = m_inspector->idStringForObject(declarativeItem);
+ objectStringId = inspector()->idStringForObject(declarativeItem);
}
if (!objectStringId.isEmpty()) {
@@ -192,4 +192,5 @@ QString AbstractLiveEditTool::titleForItem(QGraphicsItem *item)
return constructedName;
}
-QT_END_NAMESPACE
+
+} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.h
index 17eb6ea..04b5f4e 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool_p.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.h
@@ -43,7 +43,7 @@
#define ABSTRACTLIVEEDITTOOL_H
#include <QtCore/QList>
-#include <QtCore/QObject>
+#include "../abstracttool.h"
QT_BEGIN_NAMESPACE
class QMouseEvent;
@@ -56,15 +56,11 @@ class QWheelEvent;
class QDeclarativeView;
QT_END_NAMESPACE
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
+namespace QmlJSDebugger {
class QDeclarativeViewInspector;
-class AbstractLiveEditTool : public QObject
+class AbstractLiveEditTool : public AbstractTool
{
Q_OBJECT
public:
@@ -72,16 +68,8 @@ public:
virtual ~AbstractLiveEditTool();
- virtual void mousePressEvent(QMouseEvent *event) = 0;
- virtual void mouseMoveEvent(QMouseEvent *event) = 0;
- virtual void mouseReleaseEvent(QMouseEvent *event) = 0;
- virtual void mouseDoubleClickEvent(QMouseEvent *event) = 0;
+ void leaveEvent(QEvent *) {}
- virtual void hoverMoveEvent(QMouseEvent *event) = 0;
- virtual void wheelEvent(QWheelEvent *event) = 0;
-
- virtual void keyPressEvent(QKeyEvent *event) = 0;
- virtual void keyReleaseEvent(QKeyEvent *keyEvent) = 0;
virtual void itemsAboutToRemoved(const QList<QGraphicsItem*> &itemList) = 0;
virtual void clear() = 0;
@@ -108,12 +96,9 @@ protected:
QGraphicsScene *scene() const;
private:
- QDeclarativeViewInspector *m_inspector;
QList<QGraphicsItem*> m_itemList;
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
+}
#endif // ABSTRACTLIVEEDITTOOL_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp
index 3f95005..da9f442 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#include "boundingrecthighlighter_p.h"
+#include "boundingrecthighlighter.h"
-#include "../qdeclarativeviewinspector_p.h"
-#include "../qmlinspectorconstants_p.h"
+#include "../qdeclarativeviewinspector.h"
+#include "../qmlinspectorconstants.h"
#include <QtGui/QGraphicsPolygonItem>
@@ -50,7 +50,7 @@
#include <QtCore/QObject>
#include <QtCore/QDebug>
-QT_BEGIN_NAMESPACE
+namespace QmlJSDebugger {
BoundingBox::BoundingBox(QGraphicsObject *itemToHighlight, QGraphicsItem *parentItem,
QObject *parent)
@@ -236,4 +236,5 @@ void BoundingRectHighlighter::refresh()
highlightAll();
}
-QT_END_NAMESPACE
+
+} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.h
index e2928f7..81883ee 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter_p.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.h
@@ -42,7 +42,7 @@
#ifndef BOUNDINGRECTHIGHLIGHTER_H
#define BOUNDINGRECTHIGHLIGHTER_H
-#include "livelayeritem_p.h"
+#include "livelayeritem.h"
#include <QtCore/QObject>
#include <QtCore/QWeakPointer>
@@ -53,11 +53,7 @@ QT_FORWARD_DECLARE_CLASS(QWidget)
QT_FORWARD_DECLARE_CLASS(QStyleOptionGraphicsItem)
QT_FORWARD_DECLARE_CLASS(QTimer)
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
+namespace QmlJSDebugger {
class QDeclarativeViewInspector;
class BoundingBox;
@@ -114,8 +110,6 @@ public:
int type() const;
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
+} // namespace QmlJSDebugger
#endif // BOUNDINGRECTHIGHLIGHTER_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp
index bdae3d8..72e1380 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp
@@ -39,9 +39,9 @@
**
****************************************************************************/
-#include "colorpickertool_p.h"
+#include "colorpickertool.h"
-#include "../qdeclarativeviewinspector_p.h"
+#include "../qdeclarativeviewinspector.h"
#include <QtGui/QMouseEvent>
#include <QtGui/QKeyEvent>
@@ -51,7 +51,7 @@
#include <QtGui/QApplication>
#include <QtGui/QPalette>
-QT_BEGIN_NAMESPACE
+namespace QmlJSDebugger {
ColorPickerTool::ColorPickerTool(QDeclarativeViewInspector *view) :
AbstractLiveEditTool(view)
@@ -61,56 +61,23 @@ ColorPickerTool::ColorPickerTool(QDeclarativeViewInspector *view) :
ColorPickerTool::~ColorPickerTool()
{
-
}
-void ColorPickerTool::mousePressEvent(QMouseEvent * /*event*/)
-{
-}
-
-void ColorPickerTool::mouseMoveEvent(QMouseEvent *event)
+void ColorPickerTool::mousePressEvent(QMouseEvent *event)
{
pickColor(event->pos());
}
-void ColorPickerTool::mouseReleaseEvent(QMouseEvent *event)
+void ColorPickerTool::mouseMoveEvent(QMouseEvent *event)
{
pickColor(event->pos());
}
-void ColorPickerTool::mouseDoubleClickEvent(QMouseEvent * /*event*/)
-{
-}
-
-
-void ColorPickerTool::hoverMoveEvent(QMouseEvent * /*event*/)
-{
-}
-
-void ColorPickerTool::keyPressEvent(QKeyEvent * /*event*/)
-{
-}
-
-void ColorPickerTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/)
-{
-}
-void ColorPickerTool::wheelEvent(QWheelEvent * /*event*/)
-{
-}
-
-void ColorPickerTool::itemsAboutToRemoved(const QList<QGraphicsItem*> &/*itemList*/)
-{
-}
-
void ColorPickerTool::clear()
{
view()->setCursor(Qt::CrossCursor);
}
-void ColorPickerTool::selectedItemsChanged(const QList<QGraphicsItem*> &/*itemList*/)
-{
-}
-
void ColorPickerTool::pickColor(const QPoint &pos)
{
QRgb fillColor = view()->backgroundBrush().color().rgb();
@@ -128,4 +95,4 @@ void ColorPickerTool::pickColor(const QPoint &pos)
emit selectedColorChanged(m_selectedColor);
}
-QT_END_NAMESPACE
+} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.h
index 580c175..a28ffea 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool_p.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.h
@@ -42,17 +42,13 @@
#ifndef COLORPICKERTOOL_H
#define COLORPICKERTOOL_H
-#include "abstractliveedittool_p.h"
+#include "abstractliveedittool.h"
#include <QtGui/QColor>
QT_FORWARD_DECLARE_CLASS(QPoint)
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
+namespace QmlJSDebugger {
class ColorPickerTool : public AbstractLiveEditTool
{
@@ -64,17 +60,17 @@ public:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mouseDoubleClickEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *) {}
+ void mouseDoubleClickEvent(QMouseEvent *) {}
- void hoverMoveEvent(QMouseEvent *event);
+ void hoverMoveEvent(QMouseEvent *) {}
- void keyPressEvent(QKeyEvent *event);
- void keyReleaseEvent(QKeyEvent *keyEvent);
+ void keyPressEvent(QKeyEvent *) {}
+ void keyReleaseEvent(QKeyEvent *) {}
- void wheelEvent(QWheelEvent *event);
+ void wheelEvent(QWheelEvent *) {}
- void itemsAboutToRemoved(const QList<QGraphicsItem*> &itemList);
+ void itemsAboutToRemoved(const QList<QGraphicsItem*> &) {}
void clear();
@@ -82,8 +78,7 @@ signals:
void selectedColorChanged(const QColor &color);
protected:
-
- void selectedItemsChanged(const QList<QGraphicsItem*> &itemList);
+ void selectedItemsChanged(const QList<QGraphicsItem*> &) {}
private:
void pickColor(const QPoint &pos);
@@ -92,8 +87,6 @@ private:
QColor m_selectedColor;
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
+} // namespace QmlJSDebugger
#endif // COLORPICKERTOOL_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp
index c28893e..fb7118f 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp
@@ -39,13 +39,13 @@
**
****************************************************************************/
-#include "livelayeritem_p.h"
+#include "livelayeritem.h"
-#include "../qmlinspectorconstants_p.h"
+#include "../qmlinspectorconstants.h"
#include <QGraphicsScene>
-QT_BEGIN_NAMESPACE
+namespace QmlJSDebugger {
LiveLayerItem::LiveLayerItem(QGraphicsScene* scene)
: QGraphicsObject()
@@ -89,4 +89,4 @@ QList<QGraphicsItem*> LiveLayerItem::findAllChildItems(const QGraphicsItem *item
return itemList;
}
-QT_END_NAMESPACE
+} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.h
index da622e1..4dccc0b 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem_p.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.h
@@ -44,11 +44,7 @@
#include <QtGui/QGraphicsObject>
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
+namespace QmlJSDebugger {
class LiveLayerItem : public QGraphicsObject
{
@@ -66,8 +62,6 @@ protected:
QList<QGraphicsItem*> findAllChildItems(const QGraphicsItem *item) const;
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
+}
#endif // LIVELAYERITEM_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp
index d32847d..b08682a 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp
@@ -39,15 +39,15 @@
**
****************************************************************************/
-#include "liverubberbandselectionmanipulator_p.h"
+#include "liverubberbandselectionmanipulator.h"
-#include "../qdeclarativeviewinspector_p_p.h"
+#include "../qdeclarativeviewinspector_p.h"
#include <QtGui/QGraphicsItem>
#include <QtCore/QDebug>
-QT_BEGIN_NAMESPACE
+namespace QmlJSDebugger {
LiveRubberBandSelectionManipulator::LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem,
QDeclarativeViewInspector *editorView)
@@ -162,4 +162,4 @@ bool LiveRubberBandSelectionManipulator::isActive() const
return m_isActive;
}
-QT_END_NAMESPACE
+} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.h
index 9abcb2b..aa15a34 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator_p.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.h
@@ -42,17 +42,13 @@
#ifndef RUBBERBANDSELECTIONMANIPULATOR_H
#define RUBBERBANDSELECTIONMANIPULATOR_H
-#include "liveselectionrectangle_p.h"
+#include "liveselectionrectangle.h"
#include <QtCore/QPointF>
QT_FORWARD_DECLARE_CLASS(QGraphicsItem)
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
+namespace QmlJSDebugger {
class QDeclarativeViewInspector;
@@ -95,8 +91,6 @@ private:
bool m_isActive;
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
+}
#endif // RUBBERBANDSELECTIONMANIPULATOR_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp
index 4450fc5..c57bc0e 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp
@@ -39,17 +39,17 @@
**
****************************************************************************/
-#include "liveselectionindicator_p.h"
+#include "liveselectionindicator.h"
-#include "../qdeclarativeviewinspector_p_p.h"
-#include "../qmlinspectorconstants_p.h"
+#include "../qdeclarativeviewinspector_p.h"
+#include "../qmlinspectorconstants.h"
#include <QtGui/QGraphicsRectItem>
#include <QtGui/QGraphicsObject>
#include <QtGui/QGraphicsScene>
#include <QtGui/QPen>
-QT_BEGIN_NAMESPACE
+namespace QmlJSDebugger {
LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector,
QGraphicsObject *layerItem)
@@ -114,4 +114,5 @@ void LiveSelectionIndicator::setItems(const QList<QWeakPointer<QGraphicsObject>
}
}
-QT_END_NAMESPACE
+} //namespace QmlJSDebugger
+
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.h
index fa6eb30..7b8cc12 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator_p.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.h
@@ -52,11 +52,7 @@ class QGraphicsItem;
class QPolygonF;
QT_END_NAMESPACE
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
+namespace QmlJSDebugger {
class QDeclarativeViewInspector;
@@ -79,8 +75,6 @@ private:
QDeclarativeViewInspector *m_view;
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
+}
#endif // LIVESELECTIONINDICATOR_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp
index 267079a..4e14458 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp
@@ -39,9 +39,9 @@
**
****************************************************************************/
-#include "liveselectionrectangle_p.h"
+#include "liveselectionrectangle.h"
-#include "../qmlinspectorconstants_p.h"
+#include "../qmlinspectorconstants.h"
#include <QtGui/QPen>
#include <QtGui/QGraphicsRectItem>
@@ -52,7 +52,7 @@
#include <cmath>
-QT_BEGIN_NAMESPACE
+namespace QmlJSDebugger {
class SelectionRectShape : public QGraphicsRectItem
{
@@ -110,4 +110,4 @@ void LiveSelectionRectangle::setRect(const QPointF &firstPoint,
m_controlShape->setRect(rect);
}
-QT_END_NAMESPACE
+}
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.h
index 5da9fb8..730cca5 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle_p.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.h
@@ -49,11 +49,7 @@ QT_FORWARD_DECLARE_CLASS(QGraphicsRectItem)
QT_FORWARD_DECLARE_CLASS(QPointF)
QT_FORWARD_DECLARE_CLASS(QRectF)
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
+namespace QmlJSDebugger {
class LiveSelectionRectangle
{
@@ -76,8 +72,6 @@ private:
QWeakPointer<QGraphicsObject> m_layerItem;
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
+} // namespace QmlJSDebugger
#endif // LIVESELECTIONRECTANGLE_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp
index c55cba3..6085d81 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#include "liveselectiontool_p.h"
-#include "livelayeritem_p.h"
+#include "liveselectiontool.h"
+#include "livelayeritem.h"
-#include "../qdeclarativeviewinspector_p_p.h"
+#include "../qdeclarativeviewinspector_p.h"
#include <QtGui/QApplication>
#include <QtGui/QWheelEvent>
@@ -57,7 +57,7 @@
#include <QtCore/QDebug>
-QT_BEGIN_NAMESPACE
+namespace QmlJSDebugger {
LiveSelectionTool::LiveSelectionTool(QDeclarativeViewInspector *editorView) :
AbstractLiveEditTool(editorView),
@@ -132,7 +132,7 @@ void LiveSelectionTool::mousePressEvent(QMouseEvent *event)
}
}
-void LiveSelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint globalPos)
+void LiveSelectionTool::createContextMenu(const QList<QGraphicsItem*> &itemList, QPoint globalPos)
{
QMenu contextMenu;
connect(&contextMenu, SIGNAL(hovered(QAction*)),
@@ -143,7 +143,6 @@ void LiveSelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint
contextMenu.addAction(tr("Items"));
contextMenu.addSeparator();
int shortcutKey = Qt::Key_1;
- bool addKeySequence = true;
int i = 0;
foreach (QGraphicsItem * const item, itemList) {
@@ -158,12 +157,11 @@ void LiveSelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint
}
elementAction->setData(i);
- if (addKeySequence)
- elementAction->setShortcut(QKeySequence(shortcutKey));
- shortcutKey++;
- if (shortcutKey > Qt::Key_9)
- addKeySequence = false;
+ if (shortcutKey <= Qt::Key_9) {
+ elementAction->setShortcut(QKeySequence(shortcutKey));
+ shortcutKey++;
+ }
++i;
}
@@ -305,10 +303,6 @@ void LiveSelectionTool::mouseReleaseEvent(QMouseEvent *event)
}
}
-void LiveSelectionTool::mouseDoubleClickEvent(QMouseEvent * /*event*/)
-{
-}
-
void LiveSelectionTool::keyPressEvent(QKeyEvent *event)
{
switch (event->key()) {
@@ -323,11 +317,6 @@ void LiveSelectionTool::keyPressEvent(QKeyEvent *event)
}
}
-void LiveSelectionTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/)
-{
-
-}
-
void LiveSelectionTool::wheelEvent(QWheelEvent *event)
{
if (event->orientation() == Qt::Horizontal || m_rubberbandSelectionMode)
@@ -372,10 +361,6 @@ void LiveSelectionTool::setSelectOnlyContentItems(bool selectOnlyContentItems)
m_selectOnlyContentItems = selectOnlyContentItems;
}
-void LiveSelectionTool::itemsAboutToRemoved(const QList<QGraphicsItem*> &/*itemList*/)
-{
-}
-
void LiveSelectionTool::clear()
{
view()->setCursor(Qt::ArrowCursor);
@@ -435,4 +420,4 @@ void LiveSelectionTool::selectUnderPoint(QMouseEvent *event)
m_singleSelectionManipulator.end(event->pos());
}
-QT_END_NAMESPACE
+} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.h
index 7562f3e..2c281cd 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool_p.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.h
@@ -42,10 +42,10 @@
#ifndef LIVESELECTIONTOOL_H
#define LIVESELECTIONTOOL_H
-#include "abstractliveedittool_p.h"
-#include "liverubberbandselectionmanipulator_p.h"
-#include "livesingleselectionmanipulator_p.h"
-#include "liveselectionindicator_p.h"
+#include "abstractliveedittool.h"
+#include "liverubberbandselectionmanipulator.h"
+#include "livesingleselectionmanipulator.h"
+#include "liveselectionindicator.h"
#include <QtCore/QList>
#include <QtCore/QTime>
@@ -55,11 +55,7 @@ QT_FORWARD_DECLARE_CLASS(QMouseEvent)
QT_FORWARD_DECLARE_CLASS(QKeyEvent)
QT_FORWARD_DECLARE_CLASS(QAction)
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
+namespace QmlJSDebugger {
class LiveSelectionTool : public AbstractLiveEditTool
{
@@ -72,13 +68,13 @@ public:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
- void mouseDoubleClickEvent(QMouseEvent *event);
+ void mouseDoubleClickEvent(QMouseEvent *) {}
void hoverMoveEvent(QMouseEvent *event);
void keyPressEvent(QKeyEvent *event);
- void keyReleaseEvent(QKeyEvent *keyEvent);
+ void keyReleaseEvent(QKeyEvent *) {}
void wheelEvent(QWheelEvent *event);
- void itemsAboutToRemoved(const QList<QGraphicsItem*> &itemList);
+ void itemsAboutToRemoved(const QList<QGraphicsItem*> &) {}
// QVariant itemChange(const QList<QGraphicsItem*> &itemList,
// QGraphicsItem::GraphicsItemChange change,
// const QVariant &value );
@@ -101,7 +97,7 @@ private slots:
void repaintBoundingRects();
private:
- void createContextMenu(QList<QGraphicsItem*> itemList, QPoint globalPos);
+ void createContextMenu(const QList<QGraphicsItem*> &itemList, QPoint globalPos);
LiveSingleSelectionManipulator::SelectionType getSelectionType(Qt::KeyboardModifiers modifiers);
bool alreadySelected(const QList<QGraphicsItem*> &itemList) const;
@@ -119,8 +115,6 @@ private:
QList<QGraphicsItem*> m_contextMenuItemList;
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
+} // namespace QmlJSDebugger
#endif // LIVESELECTIONTOOL_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp
index ee9843b..34c1469 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp
@@ -39,13 +39,13 @@
**
****************************************************************************/
-#include "livesingleselectionmanipulator_p.h"
+#include "livesingleselectionmanipulator.h"
-#include "../qdeclarativeviewinspector_p_p.h"
+#include "../qdeclarativeviewinspector_p.h"
#include <QtDebug>
-QT_BEGIN_NAMESPACE
+namespace QmlJSDebugger {
LiveSingleSelectionManipulator::LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView)
: m_editorView(editorView),
@@ -148,4 +148,4 @@ QPointF LiveSingleSelectionManipulator::beginPoint() const
return m_beginPoint;
}
-QT_END_NAMESPACE
+} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.h
index 40b5fc0..ac65711 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator_p.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.h
@@ -47,11 +47,7 @@
QT_FORWARD_DECLARE_CLASS(QGraphicsItem)
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
+namespace QmlJSDebugger {
class QDeclarativeViewInspector;
@@ -88,8 +84,6 @@ private:
bool m_isActive;
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
+} // namespace QmlJSDebugger
#endif // LIVESINGLESELECTIONMANIPULATOR_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp
index 0a72674..4e0e375 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#include "qmltoolbar_p.h"
-#include "toolbarcolorbox_p.h"
+#include "qmltoolbar.h"
+#include "toolbarcolorbox.h"
#include <QtGui/QLabel>
#include <QtGui/QIcon>
@@ -49,7 +49,7 @@
#include <QtCore/QDebug>
-QT_BEGIN_NAMESPACE
+namespace QmlJSDebugger {
QmlToolBar::QmlToolBar(QWidget *parent)
: QToolBar(parent)
@@ -325,4 +325,4 @@ void QmlToolBar::activateToQml()
emit applyChangesToQmlFileSelected();
}
-QT_END_NAMESPACE
+} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.h
index 0401804..2abf166 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar_p.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.h
@@ -45,15 +45,11 @@
#include <QtGui/QToolBar>
#include <QtGui/QIcon>
-#include "../qmlinspectorconstants_p.h"
+#include "../qmlinspectorconstants.h"
QT_FORWARD_DECLARE_CLASS(QActionGroup)
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
+namespace QmlJSDebugger {
class ToolBarColorBox;
@@ -131,8 +127,6 @@ private:
Ui *ui;
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
+}
#endif // QMLTOOLBAR_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp
index 2ed3179..5d99886 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp
@@ -39,14 +39,14 @@
**
****************************************************************************/
-#include "subcomponentmasklayeritem_p.h"
+#include "subcomponentmasklayeritem.h"
-#include "../qmlinspectorconstants_p.h"
-#include "../qdeclarativeviewinspector_p.h"
+#include "../qmlinspectorconstants.h"
+#include "../qdeclarativeviewinspector.h"
#include <QtGui/QPolygonF>
-QT_BEGIN_NAMESPACE
+namespace QmlJSDebugger {
SubcomponentMaskLayerItem::SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector,
QGraphicsItem *parentItem) :
@@ -127,4 +127,4 @@ QGraphicsItem *SubcomponentMaskLayerItem::currentItem() const
return m_currentItem;
}
-QT_END_NAMESPACE
+} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.h
index 07ce881..e41d70a 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem_p.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.h
@@ -44,11 +44,7 @@
#include <QtGui/QGraphicsPolygonItem>
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
+namespace QmlJSDebugger {
class QDeclarativeViewInspector;
@@ -70,8 +66,6 @@ private:
QRectF m_itemPolyRect;
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
+} // namespace QmlJSDebugger
#endif // SUBCOMPONENTMASKLAYERITEM_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp
index 154ddf2..0914662 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp
@@ -39,9 +39,9 @@
**
****************************************************************************/
-#include "toolbarcolorbox_p.h"
+#include "toolbarcolorbox.h"
-#include "../qmlinspectorconstants_p.h"
+#include "../qmlinspectorconstants.h"
#include <QtGui/QPixmap>
#include <QtGui/QPainter>
@@ -56,7 +56,7 @@
#include <QtCore/QMimeData>
#include <QtCore/QDebug>
-QT_BEGIN_NAMESPACE
+namespace QmlJSDebugger {
ToolBarColorBox::ToolBarColorBox(QWidget *parent) :
QLabel(parent)
@@ -131,4 +131,4 @@ void ToolBarColorBox::copyColorToClipboard()
clipboard->setText(m_color.name());
}
-QT_END_NAMESPACE
+} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.h
index c3e064c..8ef75a4 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox_p.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.h
@@ -49,11 +49,7 @@
QT_FORWARD_DECLARE_CLASS(QContextMenuEvent)
QT_FORWARD_DECLARE_CLASS(QAction)
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
+namespace QmlJSDebugger {
class ToolBarColorBox : public QLabel
{
@@ -80,8 +76,6 @@ private:
QColor m_color;
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
+} // namespace QmlJSDebugger
#endif // TOOLBARCOLORBOX_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp
index 969c9d5..c8ade82 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp
@@ -39,9 +39,9 @@
**
****************************************************************************/
-#include "zoomtool_p.h"
+#include "zoomtool.h"
-#include "../qdeclarativeviewinspector_p_p.h"
+#include "../qdeclarativeviewinspector_p.h"
#include <QtGui/QMouseEvent>
#include <QtGui/QWheelEvent>
@@ -52,7 +52,7 @@
#include <QtCore/QRectF>
#include <QtCore/QDebug>
-QT_BEGIN_NAMESPACE
+namespace QmlJSDebugger {
ZoomTool::ZoomTool(QDeclarativeViewInspector *view) :
AbstractLiveEditTool(view),
@@ -242,19 +242,11 @@ void ZoomTool::keyReleaseEvent(QKeyEvent *event)
}
-void ZoomTool::itemsAboutToRemoved(const QList<QGraphicsItem*> &/*itemList*/)
-{
-}
-
void ZoomTool::clear()
{
view()->setCursor(Qt::ArrowCursor);
}
-void ZoomTool::selectedItemsChanged(const QList<QGraphicsItem*> &/*itemList*/)
-{
-}
-
void ZoomTool::scaleView(const QPointF &centerPos)
{
@@ -333,4 +325,4 @@ qreal ZoomTool::nextZoomScale(ZoomDirection direction) const
return 1.0f;
}
-QT_END_NAMESPACE
+} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.h
index 14fa4d5..de93559 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool_p.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.h
@@ -42,16 +42,12 @@
#ifndef ZOOMTOOL_H
#define ZOOMTOOL_H
-#include "abstractliveedittool_p.h"
-#include "liverubberbandselectionmanipulator_p.h"
+#include "abstractliveedittool.h"
+#include "liverubberbandselectionmanipulator.h"
QT_FORWARD_DECLARE_CLASS(QAction)
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
+namespace QmlJSDebugger {
class ZoomTool : public AbstractLiveEditTool
{
@@ -77,12 +73,12 @@ public:
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *keyEvent);
- void itemsAboutToRemoved(const QList<QGraphicsItem*> &itemList);
+ void itemsAboutToRemoved(const QList<QGraphicsItem*> &) {}
void clear();
protected:
- void selectedItemsChanged(const QList<QGraphicsItem*> &itemList);
+ void selectedItemsChanged(const QList<QGraphicsItem*> &) {}
private slots:
void zoomTo100();
@@ -106,8 +102,6 @@ private:
qreal m_currentScale;
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
+} // namespace QmlJSDebugger
#endif // ZOOMTOOL_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp
index a266eb9..932f911 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp
@@ -46,7 +46,7 @@
#include <QtCore/qplugin.h>
#include <QtDeclarative/private/qdeclarativeinspectorservice_p.h>
-QT_BEGIN_NAMESPACE
+namespace QmlJSDebugger {
QDeclarativeInspectorPlugin::QDeclarativeInspectorPlugin() :
m_inspector(0)
@@ -75,7 +75,6 @@ void QDeclarativeInspectorPlugin::deactivate()
delete m_inspector;
}
-Q_EXPORT_PLUGIN2(declarativeinspector, QDeclarativeInspectorPlugin)
-
-QT_END_NAMESPACE
+} // namespace QmlJSDebugger
+Q_EXPORT_PLUGIN2(declarativeinspector, QmlJSDebugger::QDeclarativeInspectorPlugin)
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h
index 3e28643..5429253 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h
@@ -45,9 +45,9 @@
#include <QtCore/QPointer>
#include <QtDeclarative/private/qdeclarativeinspectorinterface_p.h>
-QT_BEGIN_NAMESPACE
+namespace QmlJSDebugger {
-class QDeclarativeViewInspector;
+class AbstractViewInspector;
class QDeclarativeInspectorPlugin : public QObject, public QDeclarativeInspectorInterface
{
@@ -63,9 +63,9 @@ public:
void deactivate();
private:
- QPointer<QDeclarativeViewInspector> m_inspector;
+ QPointer<AbstractViewInspector> m_inspector;
};
-QT_END_NAMESPACE
+} // namespace QmlJSDebugger
#endif // QDECLARATIVEINSPECTORPLUGIN_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h
index 2878bc1..082abeb 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h
@@ -47,11 +47,7 @@
#include <QtCore/QMetaEnum>
#include <QtCore/QObject>
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
+namespace QmlJSDebugger {
class InspectorProtocol : public QObject
{
@@ -136,8 +132,6 @@ inline QDebug operator<< (QDebug dbg, InspectorProtocol::Tool tool)
return dbg;
}
-QT_END_NAMESPACE
-
-QT_END_HEADER
+} // namespace QmlJSDebugger
#endif // QDECLARATIVEINSPECTORPROTOCOL_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp
index 19bfdaa..3351df9 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp
@@ -39,84 +39,24 @@
**
****************************************************************************/
-#include "QtDeclarative/private/qdeclarativeinspectorservice_p.h"
-#include "QtDeclarative/private/qdeclarativedebughelper_p.h"
-
+#include "qdeclarativeviewinspector.h"
#include "qdeclarativeviewinspector_p.h"
-#include "qdeclarativeviewinspector_p_p.h"
-#include "qdeclarativeinspectorprotocol.h"
-#include "editor/liveselectiontool_p.h"
-#include "editor/zoomtool_p.h"
-#include "editor/colorpickertool_p.h"
-#include "editor/livelayeritem_p.h"
-#include "editor/boundingrecthighlighter_p.h"
-#include "editor/qmltoolbar_p.h"
+#include "editor/liveselectiontool.h"
+#include "editor/zoomtool.h"
+#include "editor/colorpickertool.h"
+#include "editor/livelayeritem.h"
+#include "editor/boundingrecthighlighter.h"
#include <QtDeclarative/QDeclarativeItem>
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QtDeclarative/QDeclarativeContext>
-#include <QtDeclarative/QDeclarativeExpression>
#include <QtGui/QWidget>
-#include <QtGui/QVBoxLayout>
#include <QtGui/QMouseEvent>
#include <QtGui/QGraphicsObject>
-#include <QtGui/QApplication>
-#include <QtCore/QSettings>
-
-static inline void initEditorResource() { Q_INIT_RESOURCE(editor); }
-
-QT_BEGIN_NAMESPACE
-
-const char * const KEY_TOOLBOX_GEOMETRY = "toolBox/geometry";
-
-const int SceneChangeUpdateInterval = 5000;
-
-
-class ToolBox : public QWidget
-{
- Q_OBJECT
-
-public:
- ToolBox(QWidget *parent = 0);
- ~ToolBox();
-
- QmlToolBar *toolBar() const { return m_toolBar; }
-
-private:
- QSettings m_settings;
- QmlToolBar *m_toolBar;
-};
-
-ToolBox::ToolBox(QWidget *parent)
- : QWidget(parent, Qt::Tool)
- , m_settings(QLatin1String("Nokia"), QLatin1String("QmlInspector"), this)
- , m_toolBar(new QmlToolBar)
-{
- setWindowFlags((windowFlags() & ~Qt::WindowCloseButtonHint) | Qt::CustomizeWindowHint);
- setWindowTitle(tr("Qt Quick Toolbox"));
-
- QVBoxLayout *verticalLayout = new QVBoxLayout;
- verticalLayout->setMargin(0);
- verticalLayout->addWidget(m_toolBar);
- setLayout(verticalLayout);
-
- restoreGeometry(m_settings.value(QLatin1String(KEY_TOOLBOX_GEOMETRY)).toByteArray());
-}
-
-ToolBox::~ToolBox()
-{
- m_settings.setValue(QLatin1String(KEY_TOOLBOX_GEOMETRY), saveGeometry());
-}
+namespace QmlJSDebugger {
QDeclarativeViewInspectorPrivate::QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *q) :
- q(q),
- designModeBehavior(false),
- showAppOnTop(false),
- animationPaused(false),
- slowDownFactor(1.0f),
- toolBox(0)
+ q(q)
{
}
@@ -126,28 +66,22 @@ QDeclarativeViewInspectorPrivate::~QDeclarativeViewInspectorPrivate()
QDeclarativeViewInspector::QDeclarativeViewInspector(QDeclarativeView *view,
QObject *parent) :
- QObject(parent),
+ AbstractViewInspector(parent),
data(new QDeclarativeViewInspectorPrivate(this))
{
- initEditorResource();
-
data->view = view;
data->manipulatorLayer = new LiveLayerItem(view->scene());
data->selectionTool = new LiveSelectionTool(this);
data->zoomTool = new ZoomTool(this);
data->colorPickerTool = new ColorPickerTool(this);
data->boundingRectHighlighter = new BoundingRectHighlighter(this);
- data->currentTool = data->selectionTool;
+ setCurrentTool(data->selectionTool);
// to capture ChildRemoved event when viewport changes
data->view->installEventFilter(this);
data->setViewport(data->view->viewport());
- data->debugService = QDeclarativeInspectorService::instance();
- connect(data->debugService, SIGNAL(gotMessage(QByteArray)),
- this, SLOT(handleMessage(QByteArray)));
-
connect(data->view, SIGNAL(statusChanged(QDeclarativeView::Status)),
data.data(), SLOT(_q_onStatusChanged(QDeclarativeView::Status)));
@@ -156,29 +90,62 @@ QDeclarativeViewInspector::QDeclarativeViewInspector(QDeclarativeView *view,
connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)),
this, SLOT(sendColorChanged(QColor)));
- data->_q_changeToSingleSelectTool();
+ changeTool(InspectorProtocol::SelectTool);
}
QDeclarativeViewInspector::~QDeclarativeViewInspector()
{
}
-void QDeclarativeViewInspectorPrivate::_q_setToolBoxVisible(bool visible)
+void QDeclarativeViewInspector::changeCurrentObjects(const QList<QObject*> &objects)
{
-#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR)
- if (!toolBox && visible)
- createToolBox();
- if (toolBox)
- toolBox->setVisible(visible);
-#else
- Q_UNUSED(visible)
-#endif
+ QList<QGraphicsItem*> items;
+ QList<QGraphicsObject*> gfxObjects;
+ foreach (QObject *obj, objects) {
+ if (QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(obj)) {
+ items << declarativeItem;
+ gfxObjects << declarativeItem;
+ }
+ }
+ if (designModeBehavior()) {
+ data->setSelectedItemsForTools(items);
+ data->clearHighlight();
+ data->highlight(gfxObjects);
+ }
}
-void QDeclarativeViewInspectorPrivate::_q_reloadView()
+void QDeclarativeViewInspector::reloadView()
{
- clearHighlight();
- emit q->reloadRequested();
+ data->clearHighlight();
+ emit reloadRequested();
+}
+
+void QDeclarativeViewInspector::changeTool(InspectorProtocol::Tool tool)
+{
+ switch (tool) {
+ case InspectorProtocol::ColorPickerTool:
+ data->changeToColorPickerTool();
+ break;
+ case InspectorProtocol::SelectMarqueeTool:
+ data->changeToMarqueeSelectTool();
+ break;
+ case InspectorProtocol::SelectTool:
+ data->changeToSingleSelectTool();
+ break;
+ case InspectorProtocol::ZoomTool:
+ data->changeToZoomTool();
+ break;
+ }
+}
+
+AbstractLiveEditTool *QDeclarativeViewInspector::currentTool() const
+{
+ return static_cast<AbstractLiveEditTool*>(AbstractViewInspector::currentTool());
+}
+
+QDeclarativeEngine *QDeclarativeViewInspector::declarativeEngine() const
+{
+ return data->view->engine();
}
void QDeclarativeViewInspectorPrivate::setViewport(QWidget *widget)
@@ -215,174 +182,28 @@ bool QDeclarativeViewInspector::eventFilter(QObject *obj, QEvent *event)
return QObject::eventFilter(obj, event);
}
- // Event from viewport
- switch (event->type()) {
- case QEvent::Leave: {
- if (leaveEvent(event))
- return true;
- break;
- }
- case QEvent::MouseButtonPress: {
- if (mousePressEvent(static_cast<QMouseEvent*>(event)))
- return true;
- break;
- }
- case QEvent::MouseMove: {
- if (mouseMoveEvent(static_cast<QMouseEvent*>(event)))
- return true;
- break;
- }
- case QEvent::MouseButtonRelease: {
- if (mouseReleaseEvent(static_cast<QMouseEvent*>(event)))
- return true;
- break;
- }
- case QEvent::KeyPress: {
- if (keyPressEvent(static_cast<QKeyEvent*>(event)))
- return true;
- break;
- }
- case QEvent::KeyRelease: {
- if (keyReleaseEvent(static_cast<QKeyEvent*>(event)))
- return true;
- break;
- }
- case QEvent::MouseButtonDblClick: {
- if (mouseDoubleClickEvent(static_cast<QMouseEvent*>(event)))
- return true;
- break;
- }
- case QEvent::Wheel: {
- if (wheelEvent(static_cast<QWheelEvent*>(event)))
- return true;
- break;
- }
- default: {
- break;
- }
- } //switch
-
- // standard event processing
- return QObject::eventFilter(obj, event);
+ return AbstractViewInspector::eventFilter(obj, event);
}
-bool QDeclarativeViewInspector::leaveEvent(QEvent * /*event*/)
+bool QDeclarativeViewInspector::leaveEvent(QEvent *event)
{
- if (!data->designModeBehavior)
- return false;
data->clearHighlight();
- return true;
-}
-
-bool QDeclarativeViewInspector::mousePressEvent(QMouseEvent *event)
-{
- if (!data->designModeBehavior)
- return false;
- data->cursorPos = event->pos();
- data->currentTool->mousePressEvent(event);
- return true;
+ return AbstractViewInspector::leaveEvent(event);
}
bool QDeclarativeViewInspector::mouseMoveEvent(QMouseEvent *event)
{
- if (!data->designModeBehavior) {
- data->clearEditorItems();
- return false;
- }
- data->cursorPos = event->pos();
-
QList<QGraphicsItem*> selItems = data->selectableItems(event->pos());
if (!selItems.isEmpty()) {
- declarativeView()->setToolTip(data->currentTool->titleForItem(selItems.first()));
+ declarativeView()->setToolTip(currentTool()->titleForItem(selItems.first()));
} else {
declarativeView()->setToolTip(QString());
}
- if (event->buttons()) {
- data->currentTool->mouseMoveEvent(event);
- } else {
- data->currentTool->hoverMoveEvent(event);
- }
- return true;
-}
-
-bool QDeclarativeViewInspector::mouseReleaseEvent(QMouseEvent *event)
-{
- if (!data->designModeBehavior)
- return false;
-
- data->cursorPos = event->pos();
- data->currentTool->mouseReleaseEvent(event);
- return true;
-}
-
-bool QDeclarativeViewInspector::keyPressEvent(QKeyEvent *event)
-{
- if (!data->designModeBehavior)
- return false;
-
- data->currentTool->keyPressEvent(event);
- return true;
-}
-
-bool QDeclarativeViewInspector::keyReleaseEvent(QKeyEvent *event)
-{
- if (!data->designModeBehavior)
- return false;
-
- switch (event->key()) {
- case Qt::Key_V:
- data->_q_changeToSingleSelectTool();
- break;
-// disabled because multiselection does not do anything useful without design mode
-// case Qt::Key_M:
-// data->_q_changeToMarqueeSelectTool();
-// break;
- case Qt::Key_I:
- data->_q_changeToColorPickerTool();
- break;
- case Qt::Key_Z:
- data->_q_changeToZoomTool();
- break;
- case Qt::Key_Space:
- setAnimationPaused(!data->animationPaused);
- break;
- default:
- break;
- }
- data->currentTool->keyReleaseEvent(event);
- return true;
+ return AbstractViewInspector::mouseMoveEvent(event);
}
-void QDeclarativeViewInspectorPrivate::_q_createQmlObject(const QString &qml, QObject *parent,
- const QStringList &importList,
- const QString &filename)
-{
- if (!parent)
- return;
-
- QString imports;
- foreach (const QString &s, importList) {
- imports += s;
- imports += QLatin1Char('\n');
- }
-
- QDeclarativeContext *parentContext = view->engine()->contextForObject(parent);
- QDeclarativeComponent component(view->engine(), q);
- QByteArray constructedQml = QString(imports + qml).toLatin1();
-
- component.setData(constructedQml, QUrl::fromLocalFile(filename));
- QObject *newObject = component.create(parentContext);
- if (newObject) {
- newObject->setParent(parent);
- QDeclarativeItem *parentItem = qobject_cast<QDeclarativeItem*>(parent);
- QDeclarativeItem *newItem = qobject_cast<QDeclarativeItem*>(newObject);
- if (parentItem && newItem)
- newItem->setParentItem(parentItem);
- }
-}
-
-void QDeclarativeViewInspectorPrivate::_q_reparentQmlObject(QObject *object, QObject *newParent)
+void QDeclarativeViewInspector::reparentQmlObject(QObject *object, QObject *newParent)
{
if (!newParent)
return;
@@ -394,11 +215,6 @@ void QDeclarativeViewInspectorPrivate::_q_reparentQmlObject(QObject *object, QOb
item->setParentItem(newParentItem);
}
-void QDeclarativeViewInspectorPrivate::_q_clearComponentCache()
-{
- view->engine()->clearComponentCache();
-}
-
void QDeclarativeViewInspectorPrivate::_q_removeFromSelection(QObject *obj)
{
QList<QGraphicsItem*> items = selectedItems();
@@ -407,80 +223,6 @@ void QDeclarativeViewInspectorPrivate::_q_removeFromSelection(QObject *obj)
setSelectedItems(items);
}
-bool QDeclarativeViewInspector::mouseDoubleClickEvent(QMouseEvent * /*event*/)
-{
- if (!data->designModeBehavior)
- return false;
-
- return true;
-}
-
-bool QDeclarativeViewInspector::wheelEvent(QWheelEvent *event)
-{
- if (!data->designModeBehavior)
- return false;
- data->currentTool->wheelEvent(event);
- return true;
-}
-
-void QDeclarativeViewInspector::setDesignModeBehavior(bool value)
-{
- emit designModeBehaviorChanged(value);
-
- if (data->toolBox)
- data->toolBox->toolBar()->setDesignModeBehavior(value);
- sendDesignModeBehavior(value);
-
- data->designModeBehavior = value;
-
- if (!data->designModeBehavior)
- data->clearEditorItems();
-}
-
-bool QDeclarativeViewInspector::designModeBehavior()
-{
- return data->designModeBehavior;
-}
-
-bool QDeclarativeViewInspector::showAppOnTop() const
-{
- return data->showAppOnTop;
-}
-
-void QDeclarativeViewInspector::setShowAppOnTop(bool appOnTop)
-{
- if (data->view) {
- QWidget *window = data->view->window();
- Qt::WindowFlags flags = window->windowFlags();
- if (appOnTop)
- flags |= Qt::WindowStaysOnTopHint;
- else
- flags &= ~Qt::WindowStaysOnTopHint;
-
- window->setWindowFlags(flags);
- window->show();
- }
-
- data->showAppOnTop = appOnTop;
- sendShowAppOnTop(appOnTop);
-
- emit showAppOnTopChanged(appOnTop);
-}
-
-void QDeclarativeViewInspectorPrivate::changeTool(Constants::DesignTool tool,
- Constants::ToolFlags /*flags*/)
-{
- switch (tool) {
- case Constants::SelectionToolMode:
- _q_changeToSingleSelectTool();
- break;
- case Constants::NoTool:
- default:
- currentTool = 0;
- break;
- }
-}
-
void QDeclarativeViewInspectorPrivate::setSelectedItemsForTools(const QList<QGraphicsItem *> &items)
{
foreach (const QWeakPointer<QGraphicsObject> &obj, currentSelection) {
@@ -503,7 +245,7 @@ void QDeclarativeViewInspectorPrivate::setSelectedItemsForTools(const QList<QGra
}
}
- currentTool->updateSelectedItems();
+ q->currentTool()->updateSelectedItems();
}
void QDeclarativeViewInspectorPrivate::setSelectedItems(const QList<QGraphicsItem *> &items)
@@ -542,7 +284,7 @@ QList<QGraphicsItem *> QDeclarativeViewInspector::selectedItems() const
return data->selectedItems();
}
-QDeclarativeView *QDeclarativeViewInspector::declarativeView()
+QDeclarativeView *QDeclarativeViewInspector::declarativeView() const
{
return data->view;
}
@@ -591,9 +333,8 @@ QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::selectableItems(
return filterForSelection(itemlist);
}
-void QDeclarativeViewInspectorPrivate::_q_changeToSingleSelectTool()
+void QDeclarativeViewInspectorPrivate::changeToSingleSelectTool()
{
- currentToolMode = Constants::SelectionToolMode;
selectionTool->setRubberbandSelectionMode(false);
changeToSelectTool();
@@ -604,97 +345,55 @@ void QDeclarativeViewInspectorPrivate::_q_changeToSingleSelectTool()
void QDeclarativeViewInspectorPrivate::changeToSelectTool()
{
- if (currentTool == selectionTool)
+ if (q->currentTool() == selectionTool)
return;
- currentTool->clear();
- currentTool = selectionTool;
- currentTool->clear();
- currentTool->updateSelectedItems();
+ q->currentTool()->clear();
+ q->setCurrentTool(selectionTool);
+ q->currentTool()->clear();
+ q->currentTool()->updateSelectedItems();
}
-void QDeclarativeViewInspectorPrivate::_q_changeToMarqueeSelectTool()
+void QDeclarativeViewInspectorPrivate::changeToMarqueeSelectTool()
{
changeToSelectTool();
- currentToolMode = Constants::MarqueeSelectionToolMode;
selectionTool->setRubberbandSelectionMode(true);
emit q->marqueeSelectToolActivated();
q->sendCurrentTool(Constants::MarqueeSelectionToolMode);
}
-void QDeclarativeViewInspectorPrivate::_q_changeToZoomTool()
+void QDeclarativeViewInspectorPrivate::changeToZoomTool()
{
- currentToolMode = Constants::ZoomMode;
- currentTool->clear();
- currentTool = zoomTool;
- currentTool->clear();
+ q->currentTool()->clear();
+ q->setCurrentTool(zoomTool);
+ q->currentTool()->clear();
emit q->zoomToolActivated();
q->sendCurrentTool(Constants::ZoomMode);
}
-void QDeclarativeViewInspectorPrivate::_q_changeToColorPickerTool()
+void QDeclarativeViewInspectorPrivate::changeToColorPickerTool()
{
- if (currentTool == colorPickerTool)
+ if (q->currentTool() == colorPickerTool)
return;
- currentToolMode = Constants::ColorPickerMode;
- currentTool->clear();
- currentTool = colorPickerTool;
- currentTool->clear();
+ q->currentTool()->clear();
+ q->setCurrentTool(colorPickerTool);
+ q->currentTool()->clear();
emit q->colorPickerActivated();
q->sendCurrentTool(Constants::ColorPickerMode);
}
-void QDeclarativeViewInspector::setAnimationSpeed(qreal slowDownFactor)
-{
- Q_ASSERT(slowDownFactor > 0);
- if (data->slowDownFactor == slowDownFactor)
- return;
-
- animationSpeedChangeRequested(slowDownFactor);
- sendAnimationSpeed(slowDownFactor);
-}
-
-void QDeclarativeViewInspector::setAnimationPaused(bool paused)
-{
- if (data->animationPaused == paused)
- return;
-
- animationPausedChangeRequested(paused);
- sendAnimationPaused(paused);
-}
-
-void QDeclarativeViewInspector::animationSpeedChangeRequested(qreal factor)
-{
- if (data->slowDownFactor != factor) {
- data->slowDownFactor = factor;
- emit animationSpeedChanged(factor);
- }
-
- const float effectiveFactor = data->animationPaused ? 0 : factor;
- QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor);
-}
-
-void QDeclarativeViewInspector::animationPausedChangeRequested(bool paused)
-{
- if (data->animationPaused != paused) {
- data->animationPaused = paused;
- emit animationPausedChanged(paused);
- }
- const float effectiveFactor = paused ? 0 : data->slowDownFactor;
- QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor);
-}
-
-
-void QDeclarativeViewInspectorPrivate::_q_applyChangesFromClient()
+static bool isEditorItem(QGraphicsItem *item)
{
+ return (item->type() == Constants::EditorItemType
+ || item->type() == Constants::ResizeHandleItemType
+ || item->data(Constants::EditorItemDataKey).toBool());
}
-
QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::filterForSelection(
QList<QGraphicsItem*> &itemlist) const
{
@@ -706,36 +405,12 @@ QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::filterForSelection(
return itemlist;
}
-bool QDeclarativeViewInspectorPrivate::isEditorItem(QGraphicsItem *item) const
-{
- return (item->type() == Constants::EditorItemType
- || item->type() == Constants::ResizeHandleItemType
- || item->data(Constants::EditorItemDataKey).toBool());
-}
-
void QDeclarativeViewInspectorPrivate::_q_onStatusChanged(QDeclarativeView::Status status)
{
if (status == QDeclarativeView::Ready)
q->sendReloaded();
}
-void QDeclarativeViewInspectorPrivate::_q_onCurrentObjectsChanged(QList<QObject*> objects)
-{
- QList<QGraphicsItem*> items;
- QList<QGraphicsObject*> gfxObjects;
- foreach (QObject *obj, objects) {
- if (QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(obj)) {
- items << declarativeItem;
- gfxObjects << declarativeItem;
- }
- }
- if (designModeBehavior) {
- setSelectedItemsForTools(items);
- clearHighlight();
- highlight(gfxObjects);
- }
-}
-
// adjusts bounding boxes on edges of screen to be visible
QRectF QDeclarativeViewInspector::adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace)
{
@@ -758,264 +433,4 @@ QRectF QDeclarativeViewInspector::adjustToScreenBoundaries(const QRectF &boundin
return boundingRect;
}
-void QDeclarativeViewInspectorPrivate::createToolBox()
-{
- toolBox = new ToolBox(q->declarativeView());
-
- QmlToolBar *toolBar = toolBox->toolBar();
-
- QObject::connect(q, SIGNAL(selectedColorChanged(QColor)),
- toolBar, SLOT(setColorBoxColor(QColor)));
-
- QObject::connect(q, SIGNAL(designModeBehaviorChanged(bool)),
- toolBar, SLOT(setDesignModeBehavior(bool)));
-
- QObject::connect(toolBar, SIGNAL(designModeBehaviorChanged(bool)),
- q, SLOT(setDesignModeBehavior(bool)));
- QObject::connect(toolBar, SIGNAL(animationSpeedChanged(qreal)), q, SLOT(setAnimationSpeed(qreal)));
- QObject::connect(toolBar, SIGNAL(animationPausedChanged(bool)), q, SLOT(setAnimationPaused(bool)));
- QObject::connect(toolBar, SIGNAL(colorPickerSelected()), this, SLOT(_q_changeToColorPickerTool()));
- QObject::connect(toolBar, SIGNAL(zoomToolSelected()), this, SLOT(_q_changeToZoomTool()));
- QObject::connect(toolBar, SIGNAL(selectToolSelected()), this, SLOT(_q_changeToSingleSelectTool()));
- QObject::connect(toolBar, SIGNAL(marqueeSelectToolSelected()),
- this, SLOT(_q_changeToMarqueeSelectTool()));
-
- QObject::connect(toolBar, SIGNAL(applyChangesFromQmlFileSelected()),
- this, SLOT(_q_applyChangesFromClient()));
-
- QObject::connect(q, SIGNAL(animationSpeedChanged(qreal)), toolBar, SLOT(setAnimationSpeed(qreal)));
- QObject::connect(q, SIGNAL(animationPausedChanged(bool)), toolBar, SLOT(setAnimationPaused(bool)));
-
- QObject::connect(q, SIGNAL(selectToolActivated()), toolBar, SLOT(activateSelectTool()));
-
- // disabled features
- //connect(d->m_toolBar, SIGNAL(applyChangesToQmlFileSelected()), SLOT(applyChangesToClient()));
- //connect(q, SIGNAL(resizeToolActivated()), d->m_toolBar, SLOT(activateSelectTool()));
- //connect(q, SIGNAL(moveToolActivated()), d->m_toolBar, SLOT(activateSelectTool()));
-
- QObject::connect(q, SIGNAL(colorPickerActivated()), toolBar, SLOT(activateColorPicker()));
- QObject::connect(q, SIGNAL(zoomToolActivated()), toolBar, SLOT(activateZoom()));
- QObject::connect(q, SIGNAL(marqueeSelectToolActivated()),
- toolBar, SLOT(activateMarqueeSelectTool()));
-}
-
-void QDeclarativeViewInspector::handleMessage(const QByteArray &message)
-{
- QDataStream ds(message);
-
- InspectorProtocol::Message type;
- ds >> type;
-
- switch (type) {
- case InspectorProtocol::SetCurrentObjects: {
- int itemCount = 0;
- ds >> itemCount;
-
- QList<QObject*> selectedObjects;
- for (int i = 0; i < itemCount; ++i) {
- int debugId = -1;
- ds >> debugId;
- if (QObject *obj = QDeclarativeDebugService::objectForId(debugId))
- selectedObjects << obj;
- }
-
- data->_q_onCurrentObjectsChanged(selectedObjects);
- break;
- }
- case InspectorProtocol::Reload: {
- data->_q_reloadView();
- break;
- }
- case InspectorProtocol::SetAnimationSpeed: {
- qreal speed;
- ds >> speed;
- animationSpeedChangeRequested(speed);
- break;
- }
- case InspectorProtocol::SetAnimationPaused: {
- bool paused;
- ds >> paused;
- animationPausedChangeRequested(paused);
- break;
- }
- case InspectorProtocol::ChangeTool: {
- InspectorProtocol::Tool tool;
- ds >> tool;
- switch (tool) {
- case InspectorProtocol::ColorPickerTool:
- data->_q_changeToColorPickerTool();
- break;
- case InspectorProtocol::SelectTool:
- data->_q_changeToSingleSelectTool();
- break;
- case InspectorProtocol::SelectMarqueeTool:
- data->_q_changeToMarqueeSelectTool();
- break;
- case InspectorProtocol::ZoomTool:
- data->_q_changeToZoomTool();
- break;
- default:
- qWarning() << "Warning: Unhandled tool:" << tool;
- }
- break;
- }
- case InspectorProtocol::SetDesignMode: {
- bool inDesignMode;
- ds >> inDesignMode;
- setDesignModeBehavior(inDesignMode);
- break;
- }
- case InspectorProtocol::ShowAppOnTop: {
- bool showOnTop;
- ds >> showOnTop;
- setShowAppOnTop(showOnTop);
- break;
- }
- case InspectorProtocol::CreateObject: {
- QString qml;
- int parentId;
- QString filename;
- QStringList imports;
- ds >> qml >> parentId >> imports >> filename;
- data->_q_createQmlObject(qml, QDeclarativeDebugService::objectForId(parentId),
- imports, filename);
- break;
- }
- case InspectorProtocol::DestroyObject: {
- int debugId;
- ds >> debugId;
- if (QObject* obj = QDeclarativeDebugService::objectForId(debugId))
- obj->deleteLater();
- break;
- }
- case InspectorProtocol::MoveObject: {
- int debugId, newParent;
- ds >> debugId >> newParent;
- data->_q_reparentQmlObject(QDeclarativeDebugService::objectForId(debugId),
- QDeclarativeDebugService::objectForId(newParent));
- break;
- }
- case InspectorProtocol::ObjectIdList: {
- int itemCount;
- ds >> itemCount;
- data->stringIdForObjectId.clear();
- for (int i = 0; i < itemCount; ++i) {
- int itemDebugId;
- QString itemIdString;
- ds >> itemDebugId
- >> itemIdString;
-
- data->stringIdForObjectId.insert(itemDebugId, itemIdString);
- }
- break;
- }
- case InspectorProtocol::ClearComponentCache: {
- data->_q_clearComponentCache();
- break;
- }
- default:
- qWarning() << "Warning: Not handling message:" << type;
- }
-}
-
-void QDeclarativeViewInspector::sendDesignModeBehavior(bool inDesignMode)
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::SetDesignMode
- << inDesignMode;
-
- data->debugService->sendMessage(message);
-}
-
-void QDeclarativeViewInspector::sendCurrentObjects(const QList<QObject*> &objects)
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::CurrentObjectsChanged
- << objects.length();
-
- foreach (QObject *object, objects) {
- int id = QDeclarativeDebugService::idForObject(object);
- ds << id;
- }
-
- data->debugService->sendMessage(message);
-}
-
-void QDeclarativeViewInspector::sendCurrentTool(Constants::DesignTool toolId)
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::ToolChanged
- << toolId;
-
- data->debugService->sendMessage(message);
-}
-
-void QDeclarativeViewInspector::sendAnimationSpeed(qreal slowDownFactor)
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::AnimationSpeedChanged
- << slowDownFactor;
-
- data->debugService->sendMessage(message);
-}
-
-void QDeclarativeViewInspector::sendAnimationPaused(bool paused)
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::AnimationPausedChanged
- << paused;
-
- data->debugService->sendMessage(message);
-}
-
-void QDeclarativeViewInspector::sendReloaded()
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::Reloaded;
-
- data->debugService->sendMessage(message);
-}
-
-void QDeclarativeViewInspector::sendShowAppOnTop(bool showAppOnTop)
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::ShowAppOnTop << showAppOnTop;
-
- data->debugService->sendMessage(message);
-}
-
-void QDeclarativeViewInspector::sendColorChanged(const QColor &color)
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::ColorChanged
- << color;
-
- data->debugService->sendMessage(message);
-}
-
-QString QDeclarativeViewInspector::idStringForObject(QObject *obj) const
-{
- int id = QDeclarativeDebugService::idForObject(obj);
- QString idString = data->stringIdForObjectId.value(id, QString());
- return idString;
-}
-
-QT_END_NAMESPACE
-
-#include "qdeclarativeviewinspector.moc"
+} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.h
new file mode 100644
index 0000000..c77cd2c
--- /dev/null
+++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDECLARATIVEVIEWINSPECTOR_H
+#define QDECLARATIVEVIEWINSPECTOR_H
+
+#include <private/qdeclarativeglobal_p.h>
+
+#include "qmlinspectorconstants.h"
+#include "abstractviewinspector.h"
+
+#include <QtCore/QScopedPointer>
+#include <QtDeclarative/QDeclarativeView>
+
+namespace QmlJSDebugger {
+
+class AbstractLiveEditTool;
+class QDeclarativeViewInspectorPrivate;
+
+class QDeclarativeViewInspector : public AbstractViewInspector
+{
+ Q_OBJECT
+
+public:
+ explicit QDeclarativeViewInspector(QDeclarativeView *view, QObject *parent = 0);
+ ~QDeclarativeViewInspector();
+
+ // AbstractViewInspector
+ void changeCurrentObjects(const QList<QObject*> &objects);
+ void reloadView();
+ void reparentQmlObject(QObject *object, QObject *newParent);
+ void changeTool(InspectorProtocol::Tool tool);
+ QWidget *viewWidget() const { return declarativeView(); }
+ QDeclarativeEngine *declarativeEngine() const;
+
+ void setSelectedItems(QList<QGraphicsItem *> items);
+ QList<QGraphicsItem *> selectedItems() const;
+
+ QDeclarativeView *declarativeView() const;
+
+ QRectF adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace);
+
+protected:
+ bool eventFilter(QObject *obj, QEvent *event);
+
+ bool leaveEvent(QEvent *);
+ bool mouseMoveEvent(QMouseEvent *event);
+
+ AbstractLiveEditTool *currentTool() const;
+
+private:
+ Q_DISABLE_COPY(QDeclarativeViewInspector)
+
+ inline QDeclarativeViewInspectorPrivate *d_func() { return data.data(); }
+ QScopedPointer<QDeclarativeViewInspectorPrivate> data;
+ friend class QDeclarativeViewInspectorPrivate;
+ friend class AbstractLiveEditTool;
+};
+
+} // namespace QmlJSDebugger
+
+#endif // QDECLARATIVEVIEWINSPECTOR_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h
index 4efa093..bfa857c 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h
@@ -42,106 +42,76 @@
#ifndef QDECLARATIVEVIEWINSPECTOR_P_H
#define QDECLARATIVEVIEWINSPECTOR_P_H
-#include <private/qdeclarativeglobal_p.h>
-#include "qmlinspectorconstants_p.h"
+#include "qdeclarativeviewinspector.h"
-#include <QtCore/QScopedPointer>
-#include <QtDeclarative/QDeclarativeView>
+#include <QtCore/QWeakPointer>
+#include <QtCore/QPointF>
-QT_FORWARD_DECLARE_CLASS(QDeclarativeItem)
-QT_FORWARD_DECLARE_CLASS(QMouseEvent)
-QT_FORWARD_DECLARE_CLASS(QToolBar)
+#include "QtDeclarative/private/qdeclarativeinspectorservice_p.h"
-QT_BEGIN_HEADER
+namespace QmlJSDebugger {
-QT_BEGIN_NAMESPACE
+class QDeclarativeViewInspector;
+class LiveSelectionTool;
+class ZoomTool;
+class ColorPickerTool;
+class LiveLayerItem;
+class BoundingRectHighlighter;
+class AbstractLiveEditTool;
-QT_MODULE(Declarative)
-
-class QDeclarativeViewInspectorPrivate;
-
-class QDeclarativeViewInspector : public QObject
+class QDeclarativeViewInspectorPrivate : public QObject
{
Q_OBJECT
-
public:
- explicit QDeclarativeViewInspector(QDeclarativeView *view, QObject *parent = 0);
- ~QDeclarativeViewInspector();
-
- void setSelectedItems(QList<QGraphicsItem *> items);
- QList<QGraphicsItem *> selectedItems() const;
-
- QDeclarativeView *declarativeView();
-
- QRectF adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace);
+ QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *);
+ ~QDeclarativeViewInspectorPrivate();
- bool showAppOnTop() const;
+ QDeclarativeView *view;
+ QDeclarativeViewInspector *q;
+ QWeakPointer<QWidget> viewport;
- void sendDesignModeBehavior(bool inDesignMode);
- void sendCurrentObjects(const QList<QObject*> &);
- void sendAnimationSpeed(qreal slowDownFactor);
- void sendAnimationPaused(bool paused);
- void sendCurrentTool(Constants::DesignTool toolId);
- void sendReloaded();
- void sendShowAppOnTop(bool showAppOnTop);
+ QList<QWeakPointer<QGraphicsObject> > currentSelection;
- QString idStringForObject(QObject *obj) const;
+ LiveSelectionTool *selectionTool;
+ ZoomTool *zoomTool;
+ ColorPickerTool *colorPickerTool;
+ LiveLayerItem *manipulatorLayer;
-public Q_SLOTS:
- void sendColorChanged(const QColor &color);
+ BoundingRectHighlighter *boundingRectHighlighter;
- void setDesignModeBehavior(bool value);
- bool designModeBehavior();
+ void setViewport(QWidget *widget);
- void setShowAppOnTop(bool appOnTop);
+ void clearEditorItems();
+ void changeToSelectTool();
+ QList<QGraphicsItem*> filterForSelection(QList<QGraphicsItem*> &itemlist) const;
- void setAnimationSpeed(qreal factor);
- void setAnimationPaused(bool paused);
+ QList<QGraphicsItem*> selectableItems(const QPoint &pos) const;
+ QList<QGraphicsItem*> selectableItems(const QPointF &scenePos) const;
+ QList<QGraphicsItem*> selectableItems(const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const;
-Q_SIGNALS:
- void designModeBehaviorChanged(bool inDesignMode);
- void showAppOnTopChanged(bool showAppOnTop);
- void reloadRequested();
- void marqueeSelectToolActivated();
- void selectToolActivated();
- void zoomToolActivated();
- void colorPickerActivated();
- void selectedColorChanged(const QColor &color);
-
- void animationSpeedChanged(qreal factor);
- void animationPausedChanged(bool paused);
-
-protected:
- bool eventFilter(QObject *obj, QEvent *event);
-
- bool leaveEvent(QEvent *);
- bool mousePressEvent(QMouseEvent *event);
- bool mouseMoveEvent(QMouseEvent *event);
- bool mouseReleaseEvent(QMouseEvent *event);
- bool keyPressEvent(QKeyEvent *event);
- bool keyReleaseEvent(QKeyEvent *keyEvent);
- bool mouseDoubleClickEvent(QMouseEvent *event);
- bool wheelEvent(QWheelEvent *event);
+ void setSelectedItemsForTools(const QList<QGraphicsItem *> &items);
+ void setSelectedItems(const QList<QGraphicsItem *> &items);
+ QList<QGraphicsItem *> selectedItems() const;
- void setSelectedItemsForTools(QList<QGraphicsItem *> items);
+ void clearHighlight();
+ void highlight(const QList<QGraphicsObject *> &item);
+ inline void highlight(QGraphicsObject *item)
+ { highlight(QList<QGraphicsObject*>() << item); }
-private slots:
- void handleMessage(const QByteArray &message);
+ void changeToSingleSelectTool();
+ void changeToMarqueeSelectTool();
+ void changeToZoomTool();
+ void changeToColorPickerTool();
- void animationSpeedChangeRequested(qreal factor);
- void animationPausedChangeRequested(bool paused);
+public slots:
+ void _q_onStatusChanged(QDeclarativeView::Status status);
-private:
- Q_DISABLE_COPY(QDeclarativeViewInspector)
+ void _q_removeFromSelection(QObject *);
- inline QDeclarativeViewInspectorPrivate *d_func() { return data.data(); }
- QScopedPointer<QDeclarativeViewInspectorPrivate> data;
- friend class QDeclarativeViewInspectorPrivate;
- friend class AbstractLiveEditTool;
+public:
+ static QDeclarativeViewInspectorPrivate *get(QDeclarativeViewInspector *v) { return v->d_func(); }
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
+} // namespace QmlJSDebugger
#endif // QDECLARATIVEVIEWINSPECTOR_P_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p_p.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p_p.h
deleted file mode 100644
index 11cbe0f..0000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p_p.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVEVIEWINSPECTOR_P_P_H
-#define QDECLARATIVEVIEWINSPECTOR_P_P_H
-
-#include "qdeclarativeviewinspector_p.h"
-
-#include <QtCore/QWeakPointer>
-#include <QtCore/QPointF>
-
-#include "QtDeclarative/private/qdeclarativeinspectorservice_p.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QDeclarativeViewInspector;
-class LiveSelectionTool;
-class ZoomTool;
-class ColorPickerTool;
-class LiveLayerItem;
-class BoundingRectHighlighter;
-class ToolBox;
-class AbstractLiveEditTool;
-
-class QDeclarativeViewInspectorPrivate : public QObject
-{
- Q_OBJECT
-public:
- QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *);
- ~QDeclarativeViewInspectorPrivate();
-
- QDeclarativeView *view;
- QDeclarativeViewInspector *q;
- QDeclarativeInspectorService *debugService;
- QWeakPointer<QWidget> viewport;
- QHash<int, QString> stringIdForObjectId;
-
- QPointF cursorPos;
- QList<QWeakPointer<QGraphicsObject> > currentSelection;
-
- Constants::DesignTool currentToolMode;
- AbstractLiveEditTool *currentTool;
-
- LiveSelectionTool *selectionTool;
- ZoomTool *zoomTool;
- ColorPickerTool *colorPickerTool;
- LiveLayerItem *manipulatorLayer;
-
- BoundingRectHighlighter *boundingRectHighlighter;
-
- bool designModeBehavior;
- bool showAppOnTop;
-
- bool animationPaused;
- qreal slowDownFactor;
-
- ToolBox *toolBox;
-
- void setViewport(QWidget *widget);
-
- void clearEditorItems();
- void createToolBox();
- void changeToSelectTool();
- QList<QGraphicsItem*> filterForSelection(QList<QGraphicsItem*> &itemlist) const;
-
- QList<QGraphicsItem*> selectableItems(const QPoint &pos) const;
- QList<QGraphicsItem*> selectableItems(const QPointF &scenePos) const;
- QList<QGraphicsItem*> selectableItems(const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const;
-
- void setSelectedItemsForTools(const QList<QGraphicsItem *> &items);
- void setSelectedItems(const QList<QGraphicsItem *> &items);
- QList<QGraphicsItem *> selectedItems() const;
-
- void changeTool(Constants::DesignTool tool,
- Constants::ToolFlags flags = Constants::NoToolFlags);
-
- void clearHighlight();
- void highlight(const QList<QGraphicsObject *> &item);
- inline void highlight(QGraphicsObject *item)
- { highlight(QList<QGraphicsObject*>() << item); }
-
- bool isEditorItem(QGraphicsItem *item) const;
-
-public slots:
- void _q_setToolBoxVisible(bool visible);
-
- void _q_reloadView();
- void _q_onStatusChanged(QDeclarativeView::Status status);
- void _q_onCurrentObjectsChanged(QList<QObject*> objects);
- void _q_applyChangesFromClient();
- void _q_createQmlObject(const QString &qml, QObject *parent,
- const QStringList &imports, const QString &filename = QString());
- void _q_reparentQmlObject(QObject *, QObject *);
-
- void _q_changeToSingleSelectTool();
- void _q_changeToMarqueeSelectTool();
- void _q_changeToZoomTool();
- void _q_changeToColorPickerTool();
- void _q_clearComponentCache();
- void _q_removeFromSelection(QObject *);
-
-public:
- static QDeclarativeViewInspectorPrivate *get(QDeclarativeViewInspector *v) { return v->d_func(); }
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QDECLARATIVEVIEWINSPECTOR_P_P_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro b/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro
index f8d7ee8..0116441 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro
+++ b/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro
@@ -7,6 +7,7 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/qmltooling
QTDIR_build:REQUIRES += "contains(QT_CONFIG, declarative)"
SOURCES += \
+ abstractviewinspector.cpp \
qdeclarativeinspectorplugin.cpp \
qdeclarativeviewinspector.cpp \
editor/abstractliveedittool.cpp \
@@ -21,27 +22,30 @@ SOURCES += \
editor/zoomtool.cpp \
editor/colorpickertool.cpp \
editor/qmltoolbar.cpp \
- editor/toolbarcolorbox.cpp
+ editor/toolbarcolorbox.cpp \
+ abstracttool.cpp
HEADERS += \
+ abstractviewinspector.h \
qdeclarativeinspectorplugin.h \
qdeclarativeinspectorprotocol.h \
+ qdeclarativeviewinspector.h \
qdeclarativeviewinspector_p.h \
- qdeclarativeviewinspector_p_p.h \
- qmlinspectorconstants_p.h \
- editor/abstractliveedittool_p.h \
- editor/liveselectiontool_p.h \
- editor/livelayeritem_p.h \
- editor/livesingleselectionmanipulator_p.h \
- editor/liverubberbandselectionmanipulator_p.h \
- editor/liveselectionrectangle_p.h \
- editor/liveselectionindicator_p.h \
- editor/boundingrecthighlighter_p.h \
- editor/subcomponentmasklayeritem_p.h \
- editor/zoomtool_p.h \
- editor/colorpickertool_p.h \
- editor/qmltoolbar_p.h \
- editor/toolbarcolorbox_p.h
+ qmlinspectorconstants.h \
+ editor/abstractliveedittool.h \
+ editor/liveselectiontool.h \
+ editor/livelayeritem.h \
+ editor/livesingleselectionmanipulator.h \
+ editor/liverubberbandselectionmanipulator.h \
+ editor/liveselectionrectangle.h \
+ editor/liveselectionindicator.h \
+ editor/boundingrecthighlighter.h \
+ editor/subcomponentmasklayeritem.h \
+ editor/zoomtool.h \
+ editor/colorpickertool.h \
+ editor/qmltoolbar.h \
+ editor/toolbarcolorbox.h \
+ abstracttool.h
RESOURCES += editor/editor.qrc
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants_p.h b/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants.h
index 40ec325..5335222 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants_p.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants.h
@@ -44,12 +44,7 @@
#include <QtDeclarative/private/qdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
+namespace QmlJSDebugger {
namespace Constants {
enum DesignTool {
@@ -62,11 +57,6 @@ enum DesignTool {
ZoomMode = 6
};
-enum ToolFlags {
- NoToolFlags = 0,
- UseCursorPos = 1
-};
-
static const int DragStartTime = 50;
static const int DragStartDistance = 20;
@@ -82,9 +72,6 @@ enum GraphicsItemTypes {
} // namespace Constants
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
+} // namespace QmlJSDebugger
#endif // QMLINSPECTORCONSTANTS_H
diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def
index 318f16f..d4b39e4 100644
--- a/src/s60installs/bwins/QtGuiu.def
+++ b/src/s60installs/bwins/QtGuiu.def
@@ -5029,7 +5029,6 @@ EXPORTS
?hasSelection@QTextCursor@@QBE_NXZ @ 5028 NONAME ; bool QTextCursor::hasSelection(void) const
?hasStaticContents@QWindowSurface@@IBE_NXZ @ 5029 NONAME ; bool QWindowSurface::hasStaticContents(void) const
?hasStaticContentsSupport@QWindowSurface@@QBE_NXZ @ 5030 NONAME ABSENT ; bool QWindowSurface::hasStaticContentsSupport(void) const
- ?hasStaticContentsSupport@QWindowSurface@@UBE_NXZ @ 5030 NONAME ABSENT ; bool QWindowSurface::hasStaticContentsSupport(void) const
?hasThemeIcon@QIcon@@SA_NABVQString@@@Z @ 5031 NONAME ; bool QIcon::hasThemeIcon(class QString const &)
?hasTracking@QAbstractSlider@@QBE_NXZ @ 5032 NONAME ; bool QAbstractSlider::hasTracking(void) const
?hasTranslateOnlySceneTransform@QGraphicsItemPrivate@@QAE_NXZ @ 5033 NONAME ; bool QGraphicsItemPrivate::hasTranslateOnlySceneTransform(void)
@@ -12855,7 +12854,6 @@ EXPORTS
?updateMicroFocus@QGraphicsItem@@IAEXXZ @ 12853 NONAME ; void QGraphicsItem::updateMicroFocus(void)
?populate@QTextureGlyphCache@@QAEXPAVQFontEngine@@HPBIPBUQFixedPoint@@@Z @ 12854 NONAME ABSENT ; void QTextureGlyphCache::populate(class QFontEngine *, int, unsigned int const *, struct QFixedPoint const *)
?hasPartialUpdateSupport@QWindowSurface@@QBE_NXZ @ 12855 NONAME ABSENT ; bool QWindowSurface::hasPartialUpdateSupport(void) const
- ?hasPartialUpdateSupport@QWindowSurface@@UBE_NXZ @ 12855 NONAME ABSENT ; bool QWindowSurface::hasPartialUpdateSupport(void) const
?scroll@QRuntimePixmapData@@UAE_NHHABVQRect@@@Z @ 12856 NONAME ; bool QRuntimePixmapData::scroll(int, int, class QRect const &)
?qt_draw_glyphs@@YAXPAVQPainter@@PBIPBVQPointF@@H@Z @ 12857 NONAME ABSENT ; void qt_draw_glyphs(class QPainter *, unsigned int const *, class QPointF const *, int)
?nativeDisplay@QEgl@@YAHXZ @ 12858 NONAME ; int QEgl::nativeDisplay(void)
@@ -14036,11 +14034,11 @@ EXPORTS
?releaseAllGpuResources@QSymbianGraphicsSystemEx@@UAEXXZ @ 14033 NONAME ; void QSymbianGraphicsSystemEx::releaseAllGpuResources(void)
?cursorMoveStyle@QLineControl@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 14034 NONAME ; enum Qt::CursorMoveStyle QLineControl::cursorMoveStyle(void) const
?hasBCM2727@QSymbianGraphicsSystemEx@@UAE_NXZ @ 14035 NONAME ABSENT ; bool QSymbianGraphicsSystemEx::hasBCM2727(void)
- ??0QSymbianGraphicsSystemEx@@QAE@XZ @ 14038 NONAME ABSENT ; QSymbianGraphicsSystemEx::QSymbianGraphicsSystemEx(void)
- ?hasBCM2727@QSymbianGraphicsSystemEx@@SA_NXZ @ 14039 NONAME ; bool QSymbianGraphicsSystemEx::hasBCM2727(void)
- ?getClusterLength@QTextEngine@@AAEHPAGPBUHB_CharAttributes@@HHHPAH@Z @ 14040 NONAME ; int QTextEngine::getClusterLength(unsigned short *, struct HB_CharAttributes const *, int, int, int, int *)
- ?positionInLigature@QTextEngine@@QAEHPBUQScriptItem@@HUQFixed@@1H_N@Z @ 14041 NONAME ; int QTextEngine::positionInLigature(struct QScriptItem const *, int, struct QFixed, struct QFixed, int, bool)
- ?supportsTransformations@QPaintEngineEx@@UBE_NMABVQTransform@@@Z @ 14042 NONAME ; bool QPaintEngineEx::supportsTransformations(float, class QTransform const &) const
- ?drawStaticTextItem@QPaintEngineEx@@UAEXPAVQStaticTextItem@@@Z @ 14043 NONAME ; void QPaintEngineEx::drawStaticTextItem(class QStaticTextItem *)
- ?constImageRef@QVolatileImage@@QBEABVQImage@@XZ @ 14044 NONAME ; class QImage const & QVolatileImage::constImageRef(void) const
- ?toVolatileImage@QPixmapData@@UBE?AVQVolatileImage@@XZ @ 14045 NONAME ; class QVolatileImage QPixmapData::toVolatileImage(void) const
+ ??0QSymbianGraphicsSystemEx@@QAE@XZ @ 14036 NONAME ABSENT ; QSymbianGraphicsSystemEx::QSymbianGraphicsSystemEx(void)
+ ?hasBCM2727@QSymbianGraphicsSystemEx@@SA_NXZ @ 14037 NONAME ; bool QSymbianGraphicsSystemEx::hasBCM2727(void)
+ ?getClusterLength@QTextEngine@@AAEHPAGPBUHB_CharAttributes@@HHHPAH@Z @ 14038 NONAME ; int QTextEngine::getClusterLength(unsigned short *, struct HB_CharAttributes const *, int, int, int, int *)
+ ?positionInLigature@QTextEngine@@QAEHPBUQScriptItem@@HUQFixed@@1H_N@Z @ 14039 NONAME ; int QTextEngine::positionInLigature(struct QScriptItem const *, int, struct QFixed, struct QFixed, int, bool)
+ ?supportsTransformations@QPaintEngineEx@@UBE_NMABVQTransform@@@Z @ 14040 NONAME ; bool QPaintEngineEx::supportsTransformations(float, class QTransform const &) const
+ ?drawStaticTextItem@QPaintEngineEx@@UAEXPAVQStaticTextItem@@@Z @ 14041 NONAME ; void QPaintEngineEx::drawStaticTextItem(class QStaticTextItem *)
+ ?constImageRef@QVolatileImage@@QBEABVQImage@@XZ @ 14042 NONAME ; class QImage const & QVolatileImage::constImageRef(void) const
+ ?toVolatileImage@QPixmapData@@UBE?AVQVolatileImage@@XZ @ 14043 NONAME ; class QVolatileImage QPixmapData::toVolatileImage(void) const
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index d96b46a..0164141 100755
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -137,19 +137,23 @@ symbian: {
folderlistmodelImport.sources = $$QT_BUILD_TREE/imports/Qt/labs/folderlistmodel/qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll
gesturesImport.sources = $$QT_BUILD_TREE/imports/Qt/labs/gestures/qmlgesturesplugin$${QT_LIBINFIX}.dll
particlesImport.sources = $$QT_BUILD_TREE/imports/Qt/labs/particles/qmlparticlesplugin$${QT_LIBINFIX}.dll
- shadersImport.sources = $$QT_BUILD_TREE/imports/Qt/labs/shaders/qmlshadersplugin$${QT_LIBINFIX}.dll
folderlistmodelImport.sources += $$QT_SOURCE_TREE/src/imports/folderlistmodel/qmldir
gesturesImport.sources += $$QT_SOURCE_TREE/src/imports/gestures/qmldir
particlesImport.sources += $$QT_SOURCE_TREE/src/imports/particles/qmldir
- shadersImport.sources += $$QT_SOURCE_TREE/src/imports/shaders/qmldir
folderlistmodelImport.path = c:$$QT_IMPORTS_BASE_DIR/Qt/labs/folderlistmodel
gesturesImport.path = c:$$QT_IMPORTS_BASE_DIR/Qt/labs/gestures
particlesImport.path = c:$$QT_IMPORTS_BASE_DIR/Qt/labs/particles
- shadersImport.path = c:$$QT_IMPORTS_BASE_DIR/Qt/labs/shaders
- DEPLOYMENT += folderlistmodelImport gesturesImport particlesImport shadersImport
+ DEPLOYMENT += folderlistmodelImport gesturesImport particlesImport
+
+ contains(QT_CONFIG, opengl) {
+ shadersImport.sources = $$QT_BUILD_TREE/imports/Qt/labs/shaders/qmlshadersplugin$${QT_LIBINFIX}.dll \
+ $$QT_SOURCE_TREE/src/imports/shaders/qmldir
+ shadersImport.path = c:$$QT_IMPORTS_BASE_DIR/Qt/labs/shaders
+ DEPLOYMENT += shadersImport
+ }
}
graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems