diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/accessible/widgets/qaccessiblewidgets.cpp | 113 | ||||
-rw-r--r-- | src/plugins/accessible/widgets/rangecontrols.cpp | 2 | ||||
-rw-r--r-- | src/plugins/accessible/widgets/simplewidgets.cpp | 13 | ||||
-rw-r--r-- | src/plugins/bearer/icd/qicdengine.cpp | 1 | ||||
-rw-r--r-- | src/plugins/bearer/icd/qnetworksession_impl.cpp | 6 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 439 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h | 1 | ||||
-rw-r--r-- | src/plugins/phonon/mmf/mmf.pro | 6 | ||||
-rw-r--r-- | src/plugins/platforms/glxconvenience/glxconvenience.pri | 8 | ||||
-rw-r--r-- | src/plugins/platforms/glxconvenience/qglxconvenience.cpp | 30 | ||||
-rw-r--r-- | src/plugins/platforms/minimal/qminimalintegration.cpp | 4 | ||||
-rw-r--r-- | src/plugins/platforms/minimal/qminimalintegration.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp | 9 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp | 4 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylandclipboard.cpp | 115 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylandclipboard.h | 17 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddisplay.cpp | 50 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddisplay.h | 17 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylandwindow.cpp | 11 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/wayland.pro | 2 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/wayland_sha1.txt | 3 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp | 92 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h | 70 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri | 16 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 11 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.h | 6 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindowsurface.cpp | 22 | ||||
-rw-r--r-- | src/plugins/platforms/xlib/qxlibclipboard.cpp | 8 | ||||
-rw-r--r-- | src/plugins/platforms/xlib/qxlibclipboard.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/xlib/qxlibintegration.cpp | 2 | ||||
-rw-r--r-- | src/plugins/platforms/xlib/qxlibscreen.cpp | 2 | ||||
-rw-r--r-- | src/plugins/platforms/xlib/qxlibstatic.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/xlib/qxlibwindow.cpp | 38 | ||||
-rw-r--r-- | src/plugins/platforms/xlib/qxlibwindow.h | 8 | ||||
-rw-r--r-- | src/plugins/platforms/xlib/qxlibwindowsurface.cpp | 27 | ||||
-rw-r--r-- | src/plugins/plugins.pro | 1 | ||||
-rw-r--r-- | src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool.cpp | 364 | ||||
-rw-r--r-- | src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool_p.h | 131 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp (renamed from src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool.cpp) | 23 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool_p.h (renamed from src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool_p.h) | 10 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp (renamed from src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter.cpp) | 75 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter_p.h (renamed from src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter_p.h) | 13 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp (renamed from src/plugins/qmltooling/declarativeobserver/editor/colorpickertool.cpp) | 4 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool_p.h (renamed from src/plugins/qmltooling/declarativeobserver/editor/colorpickertool_p.h) | 2 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/editor.qrc (renamed from src/plugins/qmltooling/declarativeobserver/editor/editor.qrc) | 4 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-24.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/color-picker-24.png) | bin | 3440 -> 3440 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-hicontrast.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/color-picker-hicontrast.png) | bin | 3192 -> 3192 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/color-picker.png) | bin | 3173 -> 3173 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml-24.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/from-qml-24.png) | bin | 3395 -> 3395 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/from-qml.png) | bin | 3205 -> 3205 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode-24.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/observermode-24.png) | bin | 1283 -> 1283 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/observermode.png) | bin | 3539 -> 3539 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/pause-24.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/pause-24.png) | bin | 3307 -> 3307 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/pause.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/pause.png) | bin | 3097 -> 3097 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/play-24.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/play-24.png) | bin | 3655 -> 3655 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/play.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/play.png) | bin | 3363 -> 3363 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/reload.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/reload.png) | bin | 3418 -> 3418 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/resize_handle.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/resize_handle.png) | bin | 160 -> 160 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/select-24.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/select-24.png) | bin | 3510 -> 3510 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee-24.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/select-marquee-24.png) | bin | 2891 -> 2891 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/select-marquee.png) | bin | 2871 -> 2871 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/select.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/select.png) | bin | 3308 -> 3308 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml-24.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/to-qml-24.png) | bin | 3407 -> 3407 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/to-qml.png) | bin | 3227 -> 3227 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom-24.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/zoom-24.png) | bin | 3566 -> 3566 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom.png (renamed from src/plugins/qmltooling/declarativeobserver/editor/images/zoom.png) | bin | 3347 -> 3347 bytes | |||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp (renamed from src/plugins/qmltooling/declarativeobserver/editor/livelayeritem.cpp) | 2 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem_p.h (renamed from src/plugins/qmltooling/declarativeobserver/editor/livelayeritem_p.h) | 0 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp (renamed from src/plugins/qmltooling/declarativeobserver/editor/liverubberbandselectionmanipulator.cpp) | 16 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator_p.h (renamed from src/plugins/qmltooling/declarativeobserver/editor/liverubberbandselectionmanipulator_p.h) | 6 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp (renamed from src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator.cpp) | 8 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator_p.h (renamed from src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator_p.h) | 6 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp (renamed from src/plugins/qmltooling/declarativeobserver/editor/liveselectionrectangle.cpp) | 2 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle_p.h (renamed from src/plugins/qmltooling/declarativeobserver/editor/liveselectionrectangle_p.h) | 0 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp (renamed from src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool.cpp) | 48 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool_p.h (renamed from src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool_p.h) | 2 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp (renamed from src/plugins/qmltooling/declarativeobserver/editor/livesingleselectionmanipulator.cpp) | 12 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator_p.h (renamed from src/plugins/qmltooling/declarativeobserver/editor/livesingleselectionmanipulator_p.h) | 6 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp (renamed from src/plugins/qmltooling/declarativeobserver/editor/qmltoolbar.cpp) | 4 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar_p.h (renamed from src/plugins/qmltooling/declarativeobserver/editor/qmltoolbar_p.h) | 2 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp (renamed from src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem.cpp) | 12 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem_p.h (renamed from src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem_p.h) | 6 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp (renamed from src/plugins/qmltooling/declarativeobserver/editor/toolbarcolorbox.cpp) | 2 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox_p.h (renamed from src/plugins/qmltooling/declarativeobserver/editor/toolbarcolorbox_p.h) | 0 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp (renamed from src/plugins/qmltooling/declarativeobserver/editor/zoomtool.cpp) | 6 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool_p.h (renamed from src/plugins/qmltooling/declarativeobserver/editor/zoomtool_p.h) | 2 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp (renamed from src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverplugin.cpp) | 26 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h (renamed from src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverplugin.h) | 22 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h (renamed from src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverprotocol.h) | 30 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp (renamed from src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp) | 363 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h (renamed from src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h) | 31 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p_p.h (renamed from src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h) | 44 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro (renamed from src/plugins/qmltooling/declarativeobserver/declarativeobserver.pro) | 18 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants_p.h (renamed from src/plugins/qmltooling/declarativeobserver/qmlobserverconstants_p.h) | 6 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmltooling.pro | 2 | ||||
-rw-r--r-- | src/plugins/s60/3_1/3_1.pro | 9 | ||||
-rw-r--r-- | src/plugins/s60/3_2/3_2.pro | 23 | ||||
-rw-r--r-- | src/plugins/s60/5_0/5_0.pro | 23 | ||||
-rw-r--r-- | src/plugins/s60/bwins/qts60pluginu.def | 8 | ||||
-rw-r--r-- | src/plugins/s60/eabi/qts60pluginu.def | 8 | ||||
-rw-r--r-- | src/plugins/s60/s60.pro | 11 | ||||
-rw-r--r-- | src/plugins/s60/s60pluginbase.pri | 23 | ||||
-rw-r--r-- | src/plugins/s60/src/qcoreapplication_3_1.cpp | 48 | ||||
-rw-r--r-- | src/plugins/s60/src/qcoreapplication_3_2.cpp | 48 | ||||
-rw-r--r-- | src/plugins/s60/src/qdesktopservices_3_1.cpp | 49 | ||||
-rw-r--r-- | src/plugins/s60/src/qdesktopservices_3_2.cpp | 80 | ||||
-rw-r--r-- | src/plugins/s60/src/qlocale_3_1.cpp | 148 | ||||
-rw-r--r-- | src/plugins/s60/src/qlocale_3_2.cpp | 66 |
108 files changed, 1214 insertions, 1799 deletions
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index 34f5be9..c62624b 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -1316,11 +1316,112 @@ void QAccessibleTextEdit::addSelection(int startOffset, int endOffset) QString QAccessibleTextEdit::attributes(int offset, int *startOffset, int *endOffset) { - // TODO - wait for a definition of attributes - Q_UNUSED(offset); - Q_UNUSED(startOffset); - Q_UNUSED(endOffset); - return QString(); + /* The list of attributes can be found at: + http://linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2/textattributes + */ + + if (offset >= characterCount()) { + *startOffset = -1; + *endOffset = -1; + return QString(); + } + + QMap<QString, QString> attrs; + + QTextCursor cursor = textEdit()->textCursor(); + + //cursor.charFormat returns the format of the previous character + cursor.setPosition(offset + 1); + QTextCharFormat charFormat = cursor.charFormat(); + + cursor.setPosition(offset); + QTextBlockFormat blockFormat = cursor.blockFormat(); + + QTextCharFormat charFormatComp; + QTextBlockFormat blockFormatComp; + + *startOffset = offset; + cursor.setPosition(*startOffset); + while (*startOffset > 0) { + charFormatComp = cursor.charFormat(); + cursor.setPosition(*startOffset - 1); + blockFormatComp = cursor.blockFormat(); + if ((charFormat == charFormatComp) && (blockFormat == blockFormatComp)) + (*startOffset)--; + else + break; + } + + int limit = characterCount() + 1; + *endOffset = offset + 1; + cursor.setPosition(*endOffset); + while (*endOffset < limit) { + blockFormatComp = cursor.blockFormat(); + cursor.setPosition(*endOffset + 1); + charFormatComp = cursor.charFormat(); + if ((charFormat == charFormatComp) && (cursor.blockFormat() == blockFormatComp)) + (*endOffset)++; + else + break; + } + + QString family = charFormat.fontFamily(); + if (!family.isEmpty()) { + family = family.replace('\\',"\\\\"); + family = family.replace(':',"\\:"); + family = family.replace(',',"\\,"); + family = family.replace('=',"\\="); + family = family.replace(';',"\\;"); + family = family.replace('\"',"\\\""); + attrs["font-family"] = '"'+family+'"'; + } + + int fontSize = int(charFormat.fontPointSize()); + if (fontSize) + attrs["font-size"] = QString::number(fontSize).append("pt"); + + //Different weight values are not handled + attrs["font-weight"] = (charFormat.fontWeight() > QFont::Normal) ? "bold" : "normal"; + + QFont::Style style = charFormat.font().style(); + attrs["font-style"] = (style == QFont::StyleItalic) ? "italic" : ((style == QFont::StyleOblique) ? "oblique": "normal"); + + attrs["text-underline-style"] = charFormat.font().underline() ? "solid" : "none"; + + QTextCharFormat::VerticalAlignment alignment = charFormat.verticalAlignment(); + attrs["text-position"] = (alignment == QTextCharFormat::AlignSubScript) ? "sub" : ((alignment == QTextCharFormat::AlignSuperScript) ? "super" : "baseline" ); + + QBrush background = charFormat.background(); + if (background.style() == Qt::SolidPattern) { + attrs["background-color"] = QString("rgb(%1,%2,%3)").arg(background.color().red()).arg(background.color().green()).arg(background.color().blue()); + } + + QBrush foreground = charFormat.foreground(); + if (foreground.style() == Qt::SolidPattern) { + attrs["color"] = QString("rgb(%1,%2,%3)").arg(foreground.color().red()).arg(foreground.color().green()).arg(foreground.color().blue()); + } + + switch (blockFormat.alignment() & (Qt::AlignLeft | Qt::AlignRight | Qt::AlignHCenter | Qt::AlignJustify)) { + case Qt::AlignLeft: + attrs["text-align"] = "left"; + break; + case Qt::AlignRight: + attrs["text-align"] = "right"; + break; + case Qt::AlignHCenter: + attrs["text-align"] = "center"; + break; + case Qt::AlignJustify: + attrs["text-align"] = "left"; + break; + } + + QString result; + foreach (const QString &attributeName, attrs.keys()) { + result.append(attributeName).append(':').append(attrs[attributeName]).append(';'); + } + + return result; } int QAccessibleTextEdit::cursorPosition() @@ -1435,9 +1536,9 @@ QString QAccessibleTextEdit::textAtOffset(int offset, BoundaryType boundaryType, if (offset >= characterCount()) return QString(); + cursor.setPosition(offset); switch (boundaryType) { case CharBoundary: - cursor.setPosition(offset); *startOffset = cursor.position(); cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); *endOffset = cursor.position(); diff --git a/src/plugins/accessible/widgets/rangecontrols.cpp b/src/plugins/accessible/widgets/rangecontrols.cpp index 8868d53..485983e 100644 --- a/src/plugins/accessible/widgets/rangecontrols.cpp +++ b/src/plugins/accessible/widgets/rangecontrols.cpp @@ -212,7 +212,7 @@ QVariant QAccessibleAbstractSpinBox::currentValue() void QAccessibleAbstractSpinBox::setCurrentValue(const QVariant &value) { - abstractSpinBox()->setProperty("setValue", value); + abstractSpinBox()->setProperty("value", value); } QVariant QAccessibleAbstractSpinBox::maximumValue() diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index 1b10a7b..ad56cbd 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -703,7 +703,14 @@ void QAccessibleLineEdit::setText(Text t, int control, const QString &text) QAccessibleWidgetEx::setText(t, control, text); return; } - lineEdit()->setText(text); + + QString newText = text; + if (lineEdit()->validator()) { + int pos = 0; + if (lineEdit()->validator()->validate(newText, pos) != QValidator::Acceptable) + return; + } + lineEdit()->setText(newText); } /*! \reimp */ @@ -801,6 +808,10 @@ QString QAccessibleLineEdit::text(int startOffset, int endOffset) { if (startOffset > endOffset) return QString(); + + if (lineEdit()->echoMode() != QLineEdit::Normal) + return QString(); + return lineEdit()->text().mid(startOffset, endOffset - startOffset); } diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index c793e52..79be2ce 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -929,6 +929,7 @@ void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg) configLocker.unlock(); locker.unlock(); + emit iapStateChanged(iapid, icd_connection_state); emit configurationChanged(ptr); locker.relock(); diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index f08d8bf..a99c0a7 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -183,6 +183,12 @@ void QNetworkSessionPrivateImpl::updateState(QNetworkSession::State newState) icdConfig->mutex.lock(); icdConfig->state = QNetworkConfiguration::Defined; icdConfig->mutex.unlock(); + + // Reset the state of the default configuration to Discovered + icdConfig = toIcdConfig(privateConfiguration(publicConfig)); + icdConfig->mutex.lock(); + icdConfig->state = QNetworkConfiguration::Discovered; + icdConfig->mutex.unlock(); } else { if (!activeConfig.isValid()) { // Active configuration (IAP) was removed from system diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 18861cf..d90c8ca 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -63,27 +63,26 @@ class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate { public: enum TransformationTypeFlags { - Matrix_NegativeScale = 0x100, + Matrix_NegativeScaleX = 0x100, + Matrix_NegativeScaleY = 0x200, Matrix_RectsUnsupported = (QTransform::TxRotate|QTransform::TxShear|QTransform::TxProject), - Matrix_BlitsUnsupported = (Matrix_NegativeScale|Matrix_RectsUnsupported) +#if (Q_DIRECTFB_VERSION >= 0x010403) + Matrix_BlitsUnsupported = (Matrix_RectsUnsupported) +#else + Matrix_BlitsUnsupported = (Matrix_RectsUnsupported|Matrix_NegativeScaleX|Matrix_NegativeScaleY) +#endif }; inline static uint getTransformationType(const QTransform &transform) { int ret = transform.type(); - if (qMin(transform.m11(), transform.m22()) < 0) { - ret |= QDirectFBPaintEnginePrivate::Matrix_NegativeScale; - } + if (transform.m11() < 0) + ret |= QDirectFBPaintEnginePrivate::Matrix_NegativeScaleX; + if (transform.m22() < 0) + ret |= QDirectFBPaintEnginePrivate::Matrix_NegativeScaleY; return ret; } - enum CompositionModeStatus { - PorterDuff_None = 0x0, - PorterDuff_Supported = 0x1, - PorterDuff_PremultiplyColors = 0x2, - PorterDuff_AlwaysBlend = 0x4 - }; - enum ClipType { ClipUnset, NoClip, @@ -95,25 +94,24 @@ public: QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p); ~QDirectFBPaintEnginePrivate(); - inline void setTransform(const QTransform &transforma); - inline void setPen(const QPen &pen); - inline void setCompositionMode(QPainter::CompositionMode mode); - inline void setRenderHints(QPainter::RenderHints hints); + void setBrush(const QBrush &brush); + void setCompositionMode(QPainter::CompositionMode mode); + void setPen(const QPen &pen); + void setTransform(const QTransform &transforma); + void setRenderHints(QPainter::RenderHints hints); - inline void setDFBColor(const QColor &color); + bool prepareForDraw(const QColor &color); - inline void lock(); - inline void unlock(); + void lock(); + void unlock(); static inline void unlock(QDirectFBPaintDevice *device); - inline bool isSimpleBrush(const QBrush &brush) const; - void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos, const QTransform &pixmapTransform); void blit(const QRectF &dest, IDirectFBSurface *surface, const QRectF &src); - inline bool supportsStretchBlit() const; + bool supportsStretchBlit() const; - inline void updateClip(); + void updateClip(); virtual void systemStateChanged(); static IDirectFBSurface *getSurface(const QImage &img, bool *release); @@ -131,7 +129,8 @@ public: IDirectFBSurface *surface; bool antialiased; - bool simplePen; + bool supportedBrush; + bool supportedPen; uint transformationType; // this is QTransform::type() + Matrix_NegativeScale if qMin(transform.m11(), transform.m22()) < 0 @@ -141,13 +140,13 @@ public: ClipType clipType; QDirectFBPaintDevice *dfbDevice; - uint compositionModeStatus; + bool supportedComposition; bool isPremultiplied; bool inClip; QRect currentClip; - QDirectFBPaintEngine *q; + QDirectFBPaintEngine *engine; }; class SurfaceCache @@ -183,14 +182,27 @@ static QCache<qint64, CachedImage> imageCache(4*1024*1024); // 4 MB #define VOID_ARG() static_cast<bool>(false) enum PaintOperation { - DRAW_RECTS = 0x0001, DRAW_LINES = 0x0002, DRAW_IMAGE = 0x0004, - DRAW_PIXMAP = 0x0008, DRAW_TILED_PIXMAP = 0x0010, STROKE_PATH = 0x0020, - DRAW_PATH = 0x0040, DRAW_POINTS = 0x0080, DRAW_ELLIPSE = 0x0100, - DRAW_POLYGON = 0x0200, DRAW_TEXT = 0x0400, FILL_PATH = 0x0800, - FILL_RECT = 0x1000, DRAW_COLORSPANS = 0x2000, DRAW_ROUNDED_RECT = 0x4000, - DRAW_STATICTEXT = 0x8000, ALL = 0xffff + DRAW_RECTS = 0x0001, + DRAW_LINES = 0x0002, + DRAW_IMAGE = 0x0004, + DRAW_PIXMAP = 0x0008, + DRAW_TILED_PIXMAP = 0x0010, + STROKE_PATH = 0x0020, + DRAW_PATH = 0x0040, + DRAW_POINTS = 0x0080, + DRAW_ELLIPSE = 0x0100, + DRAW_POLYGON = 0x0200, + DRAW_TEXT = 0x0400, + FILL_PATH = 0x0800, + FILL_RECT = 0x1000, + DRAW_COLORSPANS = 0x2000, + DRAW_ROUNDED_RECT = 0x4000, + DRAW_STATICTEXT = 0x8000, + ALL = 0xffff }; +//#define QT_DIRECTFB_WARN_ON_RASTERFALLBACKS ALL + enum { RasterWarn = 1, RasterDisable = 2 }; static inline uint rasterFallbacksMask(PaintOperation op) { @@ -268,8 +280,7 @@ static inline uint rasterFallbacksMask(PaintOperation op) template <typename device, typename T1, typename T2, typename T3> static void rasterFallbackWarn(const char *msg, const char *func, const device *dev, - uint transformationType, bool simplePen, - uint clipType, uint compositionModeStatus, + QDirectFBPaintEnginePrivate *priv, const char *nameOne, const T1 &one, const char *nameTwo, const T2 &two, const char *nameThree, const T3 &three); @@ -283,20 +294,14 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * rasterFallbackWarn("Falling back to raster engine for", \ __FUNCTION__, \ state()->painter->device(), \ - d_func()->transformationType, \ - d_func()->simplePen, \ - d_func()->clipType, \ - d_func()->compositionModeStatus, \ + d_func(), \ #one, one, #two, two, #three, three); \ break; \ case RasterDisable|RasterWarn: \ rasterFallbackWarn("Disabled raster engine operation", \ __FUNCTION__, \ state()->painter->device(), \ - d_func()->transformationType, \ - d_func()->simplePen, \ - d_func()->clipType, \ - d_func()->compositionModeStatus, \ + d_func(), \ #one, one, #two, two, #three, three); \ case RasterDisable: \ return; \ @@ -304,6 +309,8 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * } template <class T> +static inline void drawPoints(const T *points, int n, const QTransform &transform, IDirectFBSurface *surface); +template <class T> static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface); template <class T> static inline void fillRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface); @@ -400,6 +407,14 @@ void QDirectFBPaintEngine::clipEnabledChanged() d->updateClip(); } +void QDirectFBPaintEngine::brushChanged() +{ + Q_D(QDirectFBPaintEngine); + d->setBrush(state()->brush); + + QRasterPaintEngine::brushChanged(); +} + void QDirectFBPaintEngine::penChanged() { Q_D(QDirectFBPaintEngine); @@ -494,23 +509,21 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount) return; if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) - || !d->simplePen + || !d->supportedPen || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !d->isSimpleBrush(brush) - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { + || !d->supportedBrush + || !d->supportedComposition) { RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); return; } - if (brush.style() != Qt::NoBrush) { - d->setDFBColor(brush.color()); + if (brush.style() != Qt::NoBrush && d->prepareForDraw(brush.color())) { CLIPPED_PAINT(QT_PREPEND_NAMESPACE(fillRects<QRect>)(rects, rectCount, state()->matrix, d->surface)); } - if (pen.style() != Qt::NoPen) { - d->setDFBColor(pen.color()); + if (pen.style() != Qt::NoPen && d->prepareForDraw(pen.color())) { CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects<QRect>)(rects, rectCount, state()->matrix, d->surface)); } } @@ -524,23 +537,21 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount) return; if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) - || !d->simplePen + || !d->supportedPen || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !d->isSimpleBrush(brush) - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { + || !d->supportedBrush + || !d->supportedComposition) { RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); return; } - if (brush.style() != Qt::NoBrush) { - d->setDFBColor(brush.color()); + if (brush.style() != Qt::NoBrush && d->prepareForDraw(brush.color())) { CLIPPED_PAINT(fillRects<QRectF>(rects, rectCount, state()->matrix, d->surface)); } - if (pen.style() != Qt::NoPen) { - d->setDFBColor(pen.color()); + if (pen.style() != Qt::NoPen && d->prepareForDraw(pen.color())) { CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects<QRectF>)(rects, rectCount, state()->matrix, d->surface)); } } @@ -550,17 +561,16 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount) Q_D(QDirectFBPaintEngine); const QPen &pen = state()->pen; - if (!d->simplePen + if (!d->supportedPen || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { + || !d->supportedComposition) { RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawLines(lines, lineCount); return; } - if (pen.style() != Qt::NoPen) { - d->setDFBColor(pen.color()); + if (pen.style() != Qt::NoPen && d->prepareForDraw(pen.color())) { CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines<QLine>)(lines, lineCount, state()->matrix, d->surface)); } } @@ -570,17 +580,16 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount) Q_D(QDirectFBPaintEngine); const QPen &pen = state()->pen; - if (!d->simplePen + if (!d->supportedPen || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { + || !d->supportedComposition) { RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawLines(lines, lineCount); return; } - if (pen.style() != Qt::NoPen) { - d->setDFBColor(pen.color()); + if (pen.style() != Qt::NoPen && d->prepareForDraw(pen.color())) { CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines<QLineF>)(lines, lineCount, state()->matrix, d->surface)); } } @@ -610,7 +619,7 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image, */ #if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported) + if (!d->supportedComposition || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) || (!d->supportsStretchBlit() && state()->matrix.mapRect(r).size() != sr.size()) @@ -664,7 +673,7 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, QPixmapData *data = pixmap.pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data); - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported) + if (!d->supportedComposition || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) || (!d->supportsStretchBlit() && state()->matrix.mapRect(r).size() != sr.size())) { @@ -701,7 +710,7 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r, RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset); d->lock(); QRasterPaintEngine::drawTiledPixmap(r, pixmap, offset); - } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported) + } else if (!d->supportedComposition || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) || (!d->supportsStretchBlit() && state()->matrix.isScaling())) { @@ -740,18 +749,40 @@ void QDirectFBPaintEngine::drawPath(const QPainterPath &path) void QDirectFBPaintEngine::drawPoints(const QPointF *points, int pointCount) { - RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG()); Q_D(QDirectFBPaintEngine); - d->lock(); - QRasterPaintEngine::drawPoints(points, pointCount); + + const QPen &pen = state()->pen; + if (!d->supportedPen + || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip + || !d->supportedComposition) { + RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG()); + d->lock(); + QRasterPaintEngine::drawPoints(points, pointCount); + return; + } + + if (pen.style() != Qt::NoPen && d->prepareForDraw(pen.color())) { + CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawPoints<QPointF>)(points, pointCount, state()->matrix, d->surface)); + } } void QDirectFBPaintEngine::drawPoints(const QPoint *points, int pointCount) { - RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG()); Q_D(QDirectFBPaintEngine); - d->lock(); - QRasterPaintEngine::drawPoints(points, pointCount); + + const QPen &pen = state()->pen; + if (!d->supportedPen + || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip + || !d->supportedComposition) { + RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG()); + d->lock(); + QRasterPaintEngine::drawPoints(points, pointCount); + return; + } + + if (pen.style() != Qt::NoPen && d->prepareForDraw(pen.color())) { + CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawPoints<QPoint>)(points, pointCount, state()->matrix, d->surface)); + } } void QDirectFBPaintEngine::drawEllipse(const QRectF &rect) @@ -793,6 +824,29 @@ void QDirectFBPaintEngine::fill(const QVectorPath &path, const QBrush &brush) { if (brush.style() == Qt::NoBrush) return; + + const QPainterPath::ElementType *elements = path.elements(); + const qreal *points = path.points(); + + if (path.elementCount() == 5) { + if (elements[0] == QPainterPath::MoveToElement + && elements[1] == QPainterPath::LineToElement + && elements[2] == QPainterPath::LineToElement + && elements[3] == QPainterPath::LineToElement + && elements[4] == QPainterPath::LineToElement) { + + if (points[1] == points[3] + && points[2] == points[4] + && points[5] == points[7] + && points[6] == points[0]) { + QRectF rect( points[0], points[1], points[4], points[5] ); + + fillRect( rect, brush ); + return; + } + } + } + RASTERFALLBACK(FILL_PATH, path, brush, VOID_ARG()); Q_D(QDirectFBPaintEngine); d->lock(); @@ -828,12 +882,13 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) return; if (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { + || !d->supportedComposition) { break; } - d->setDFBColor(color); - const QRect r = state()->matrix.mapRect(rect).toRect(); - CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height())); + if (d->prepareForDraw(color)) { + const QRect r = state()->matrix.mapRect(rect).toRect(); + CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height())); + } return; } case Qt::TexturePattern: { @@ -842,7 +897,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) QTransform transform(stateTransform); transform.translate(brushOrigin.x(), brushOrigin.y()); transform = brush.transform() * transform; - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported) + if (!d->supportedComposition || (QDirectFBPaintEnginePrivate::getTransformationType(transform) & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) || (!d->supportsStretchBlit() && transform.isScaling())) { break; @@ -870,12 +925,11 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color) Q_D(QDirectFBPaintEngine); if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { + || !d->supportedComposition) { RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG()); d->lock(); QRasterPaintEngine::fillRect(rect, color); - } else { - d->setDFBColor(color); + } else if (d->prepareForDraw(color)) { const QRect r = state()->matrix.mapRect(rect).toRect(); CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height())); } @@ -909,12 +963,11 @@ void QDirectFBPaintEngine::initImageCache(int size) // ---- QDirectFBPaintEnginePrivate ---- - QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p) - : surface(0), antialiased(false), simplePen(false), + : surface(0), antialiased(false), supportedBrush(false), supportedPen(false), transformationType(0), opacity(255), clipType(ClipUnset), dfbDevice(0), - compositionModeStatus(0), isPremultiplied(false), inClip(false), q(p) + supportedComposition(false), isPremultiplied(false), inClip(false), engine(p) { fb = QDirectFBScreen::instance()->dfb(); surfaceCache = new SurfaceCache; @@ -925,11 +978,6 @@ QDirectFBPaintEnginePrivate::~QDirectFBPaintEnginePrivate() delete surfaceCache; } -bool QDirectFBPaintEnginePrivate::isSimpleBrush(const QBrush &brush) const -{ - return (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased); -} - void QDirectFBPaintEnginePrivate::lock() { // We will potentially get a new pointer to the buffer after a @@ -961,25 +1009,9 @@ void QDirectFBPaintEnginePrivate::unlock(QDirectFBPaintDevice *device) #endif } -void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform) +void QDirectFBPaintEnginePrivate::setBrush(const QBrush &brush) { - transformationType = getTransformationType(transform); - setPen(q->state()->pen); -} - -void QDirectFBPaintEnginePrivate::setPen(const QPen &pen) -{ - if (pen.style() == Qt::NoPen) { - simplePen = true; - } else if (pen.style() == Qt::SolidLine - && !antialiased - && pen.brush().style() == Qt::SolidPattern - && pen.widthF() <= 1.0 - && (transformationType < QTransform::TxScale || pen.isCosmetic())) { - simplePen = true; - } else { - simplePen = false; - } + supportedBrush = (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased); } void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode mode) @@ -989,23 +1021,19 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m static const bool forceRasterFallBack = qgetenv("QT_DIRECTFB_FORCE_RASTER").toInt() > 0; if (forceRasterFallBack) { - compositionModeStatus = PorterDuff_None; + supportedComposition = false; return; } - compositionModeStatus = PorterDuff_Supported|PorterDuff_PremultiplyColors|PorterDuff_AlwaysBlend; + supportedComposition = true; switch (mode) { case QPainter::CompositionMode_Clear: surface->SetPorterDuff(surface, DSPD_CLEAR); break; case QPainter::CompositionMode_Source: surface->SetPorterDuff(surface, DSPD_SRC); - compositionModeStatus &= ~PorterDuff_AlwaysBlend; - if (!isPremultiplied) - compositionModeStatus &= ~PorterDuff_PremultiplyColors; break; case QPainter::CompositionMode_SourceOver: - compositionModeStatus &= ~PorterDuff_AlwaysBlend; surface->SetPorterDuff(surface, DSPD_SRC_OVER); break; case QPainter::CompositionMode_DestinationOver: @@ -1013,8 +1041,6 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m break; case QPainter::CompositionMode_SourceIn: surface->SetPorterDuff(surface, DSPD_SRC_IN); - if (!isPremultiplied) - compositionModeStatus &= ~PorterDuff_PremultiplyColors; break; case QPainter::CompositionMode_DestinationIn: surface->SetPorterDuff(surface, DSPD_DST_IN); @@ -1044,32 +1070,69 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m break; #endif default: - compositionModeStatus = PorterDuff_None; + supportedComposition = false; break; } } +void QDirectFBPaintEnginePrivate::setPen(const QPen &pen) +{ + if (pen.style() == Qt::NoPen) { + supportedPen = true; + } else if (pen.style() == Qt::SolidLine + && !antialiased + && pen.brush().style() == Qt::SolidPattern + && pen.widthF() <= 1.0 + && (transformationType < QTransform::TxScale || pen.isCosmetic())) { + supportedPen = true; + } else { + supportedPen = false; + } +} + +void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform) +{ + transformationType = getTransformationType(transform); + setPen(engine->state()->pen); +} + void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints) { const bool old = antialiased; antialiased = bool(hints & QPainter::Antialiasing); if (old != antialiased) { - setPen(q->state()->pen); + setPen(engine->state()->pen); } } void QDirectFBPaintEnginePrivate::prepareForBlit(uint flags) { DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX; - if (flags & Premultiplied) - blittingFlags |= DSBLIT_SRC_PREMULTIPLY; + +#if (Q_DIRECTFB_VERSION >= 0x010403) + if (transformationType & Matrix_NegativeScaleX) + blittingFlags |= DSBLIT_FLIP_HORIZONTAL; + + if (transformationType & Matrix_NegativeScaleY) + blittingFlags |= DSBLIT_FLIP_VERTICAL; +#endif + if (flags & HasAlpha) blittingFlags |= DSBLIT_BLEND_ALPHACHANNEL; + if (opacity != 255) { blittingFlags |= DSBLIT_BLEND_COLORALPHA; surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); } + if (flags & Premultiplied) { + if (blittingFlags & DSBLIT_BLEND_COLORALPHA) + blittingFlags |= DSBLIT_SRC_PREMULTCOLOR; + } else { + if (blittingFlags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) + blittingFlags |= DSBLIT_SRC_PREMULTIPLY; + } + surface->SetBlittingFlags(surface, blittingFlags); } @@ -1080,14 +1143,14 @@ static inline uint ALPHA_MUL(uint x, uint a) return t; } -void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) +bool QDirectFBPaintEnginePrivate::prepareForDraw(const QColor &color) { Q_ASSERT(surface); - Q_ASSERT(compositionModeStatus & PorterDuff_Supported); + Q_ASSERT(supportedComposition); const quint8 alpha = (opacity == 255 ? color.alpha() : ALPHA_MUL(color.alpha(), opacity)); QColor col; - if (compositionModeStatus & PorterDuff_PremultiplyColors) { + if (isPremultiplied) { col = QColor(ALPHA_MUL(color.red(), alpha), ALPHA_MUL(color.green(), alpha), ALPHA_MUL(color.blue(), alpha), @@ -1096,7 +1159,28 @@ void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) col = QColor(color.red(), color.green(), color.blue(), alpha); } surface->SetColor(surface, col.red(), col.green(), col.blue(), col.alpha()); - surface->SetDrawingFlags(surface, alpha == 255 && !(compositionModeStatus & PorterDuff_AlwaysBlend) ? DSDRAW_NOFX : DSDRAW_BLEND); + + bool blend = false; + + switch (engine->state()->composition_mode) { + case QPainter::CompositionMode_Clear: + case QPainter::CompositionMode_Source: + break; + case QPainter::CompositionMode_SourceOver: + if (alpha == 0) + return false; + + if (alpha != 255) + blend = true; + break; + default: + blend = true; + break; + } + + surface->SetDrawingFlags(surface, blend ? DSDRAW_BLEND : DSDRAW_NOFX); + + return true; } IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, bool *release) @@ -1137,7 +1221,7 @@ IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, boo void QDirectFBPaintEnginePrivate::blit(const QRectF &dest, IDirectFBSurface *s, const QRectF &src) { const QRect sr = src.toRect(); - const QRect dr = q->state()->matrix.mapRect(dest).toRect(); + const QRect dr = engine->state()->matrix.mapRect(dest).toRect(); if (dr.isEmpty()) return; const DFBRectangle sRect = { sr.x(), sr.y(), sr.width(), sr.height() }; @@ -1167,10 +1251,10 @@ static inline qreal fixCoord(qreal rect_pos, qreal pixmapSize, qreal offset) void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &off, const QTransform &pixmapTransform) { - const QTransform &transform = q->state()->matrix; + const QTransform &transform = engine->state()->matrix; Q_ASSERT(!(getTransformationType(transform) & Matrix_BlitsUnsupported) && !(getTransformationType(pixmapTransform) & Matrix_BlitsUnsupported)); - const QRect destinationRect = transform.mapRect(dest).toRect().normalized(); + const QRect destinationRect = dest.toRect(); QRect newClip = destinationRect; if (!currentClip.isEmpty()) newClip &= currentClip; @@ -1186,7 +1270,7 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix }; surface->SetClip(surface, &clip); - QPointF offset = pixmapTransform.inverted().map(off); + QPointF offset = off; Q_ASSERT(transform.type() <= QTransform::TxScale); QPixmapData *data = pixmap.pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); @@ -1293,7 +1377,12 @@ void QDirectFBPaintEnginePrivate::updateClip() bool QDirectFBPaintEnginePrivate::supportsStretchBlit() const { #ifdef QT_DIRECTFB_STRETCHBLIT - return !(q->state()->renderHints & QPainter::SmoothPixmapTransform); + DFBGraphicsDeviceDescription desc; + + fb->GetDeviceDescription(fb, &desc); + + return !(engine->state()->renderHints & QPainter::SmoothPixmapTransform) + || (desc.acceleration_mask & DFXL_STRETCHBLIT); #else return false; #endif @@ -1334,10 +1423,32 @@ void SurfaceCache::clear() } -static inline QRect mapRect(const QTransform &transform, const QRect &rect) { return transform.mapRect(rect); } -static inline QRect mapRect(const QTransform &transform, const QRectF &rect) { return transform.mapRect(rect).toRect(); } +static inline QRect map(const QTransform &transform, const QRect &rect) { return transform.mapRect(rect); } +static inline QRect map(const QTransform &transform, const QRectF &rect) { return transform.mapRect(rect).toRect(); } static inline QLine map(const QTransform &transform, const QLine &line) { return transform.map(line); } static inline QLine map(const QTransform &transform, const QLineF &line) { return transform.map(line).toLine(); } +static inline QPoint map(const QTransform &transform, const QPoint &point) { return transform.map(point); } +static inline QPoint map(const QTransform &transform, const QPointF &point) { return transform.map(point).toPoint(); } + +template <class T> +static inline void drawPoints(const T *points, int n, const QTransform &transform, IDirectFBSurface *surface) +{ + if (n == 1) { + const QPoint p = map(transform, points[0]); + surface->FillRectangle(surface, p.x(), p.y(), 1, 1); + } else { + QVarLengthArray<DFBRectangle, 32> rectArray(n); + for (int i=0; i<n; ++i) { + const QPoint p = map(transform, points[i]); + rectArray[i].x = p.x(); + rectArray[i].y = p.y(); + rectArray[i].w = 1; + rectArray[i].h = 1; + } + surface->FillRectangles(surface, rectArray.constData(), n); + } +} + template <class T> static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface) { @@ -1361,12 +1472,12 @@ template <class T> static inline void fillRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface) { if (n == 1) { - const QRect r = mapRect(transform, rects[0]); + const QRect r = map(transform, rects[0]); surface->FillRectangle(surface, r.x(), r.y(), r.width(), r.height()); } else { QVarLengthArray<DFBRectangle, 32> rectArray(n); for (int i=0; i<n; ++i) { - const QRect r = mapRect(transform, rects[i]); + const QRect r = map(transform, rects[i]); rectArray[i].x = r.x(); rectArray[i].y = r.y(); rectArray[i].w = r.width(); @@ -1380,7 +1491,7 @@ template <class T> static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface) { for (int i=0; i<n; ++i) { - const QRect r = mapRect(transform, rects[i]); + const QRect r = map(transform, rects[i]); surface->DrawRectangle(surface, r.x(), r.y(), r.width(), r.height()); } } @@ -1389,14 +1500,18 @@ template <typename T> inline const T *ptr(const T &t) { return &t; } template <> inline const bool* ptr<bool>(const bool &) { return 0; } template <typename device, typename T1, typename T2, typename T3> static void rasterFallbackWarn(const char *msg, const char *func, const device *dev, - uint transformationType, bool simplePen, - uint clipType, uint compositionModeStatus, + QDirectFBPaintEnginePrivate *priv, const char *nameOne, const T1 &one, const char *nameTwo, const T2 &two, const char *nameThree, const T3 &three) { QString out; QDebug dbg(&out); + + + dbg << "***"; + + dbg << msg << (QByteArray(func) + "()") << "painting on"; if (dev->devType() == QInternal::Widget) { dbg << static_cast<const QWidget*>(dev); @@ -1404,10 +1519,55 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * dbg << dev << "of type" << dev->devType(); } - dbg << QString::fromLatin1("transformationType 0x%1").arg(transformationType, 3, 16, QLatin1Char('0')) - << "simplePen" << simplePen - << "clipType" << clipType - << "compositionModeStatus" << compositionModeStatus; + dbg << "\n\t"; + + + dbg << ((priv->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) ? "*" : "") << QString::fromLatin1("transformationType 0x%1").arg(priv->transformationType, 3, 16, QLatin1Char('0')); + + dbg << priv->engine->state()->matrix; + + dbg << "\n\t"; + + + + dbg << (priv->supportedBrush ? "" : "*") << "supportedBrush" << priv->supportedBrush; + + dbg << priv->engine->state()->brush; + + dbg << "\n\t"; + + const QGradient *gradient = priv->engine->state()->brush.gradient(); + if (gradient) { + const QGradientStops &stops = gradient->stops(); + + dbg << "gradient: " << *gradient; + dbg << "stops: " << stops.count(); + dbg << "\n\t"; + + for (int i=0; i<stops.count(); i++) { + dbg << stops[i].first << stops[i].second; + } + dbg << "\n\t"; + } + + + dbg << (priv->supportedPen ? "" : "*") << "supportedPen" << priv->supportedPen; + + dbg << priv->engine->state()->pen; + + dbg << "\n\t"; + + + + dbg << (priv->clipType == QDirectFBPaintEnginePrivate::ComplexClip ? "*" : "") << "clipType" << priv->clipType; + + dbg << "\n\t"; + + + dbg << (priv->supportedComposition ? "" : "*") << "supportedComposition" << priv->supportedComposition; + + dbg << "\n\t"; + const T1 *t1 = ptr(one); const T2 *t2 = ptr(two); @@ -1428,3 +1588,4 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * QT_END_NAMESPACE #endif // QT_NO_QWS_DIRECTFB + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h index a3217d0..b71671d 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h @@ -97,6 +97,7 @@ public: virtual void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode); virtual void clipEnabledChanged(); + virtual void brushChanged(); virtual void penChanged(); virtual void opacityChanged(); virtual void compositionModeChanged(); diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index 7c7c1d7..a84c5ac 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -103,7 +103,11 @@ symbian { exists($${EPOCROOT}epoc32/include/mw/downloadmgrclient.h) { HEADERS += $$PHONON_MMF_DIR/download.h SOURCES += $$PHONON_MMF_DIR/download.cpp - LIBS += -lDownloadMgr + contains(CONFIG, is_using_gnupoc) { + LIBS += -ldownloadmgr + } else { + LIBS += -lDownloadMgr + } DEFINES += PHONON_MMF_PROGRESSIVE_DOWNLOAD } } diff --git a/src/plugins/platforms/glxconvenience/glxconvenience.pri b/src/plugins/platforms/glxconvenience/glxconvenience.pri index d6c9922..b4d43a3 100644 --- a/src/plugins/platforms/glxconvenience/glxconvenience.pri +++ b/src/plugins/platforms/glxconvenience/glxconvenience.pri @@ -5,3 +5,11 @@ HEADERS += \ SOURCES += \ $$PWD/qglxconvenience.cpp + +CONFIG += xrender + +xrender { + LIBS += -lXrender +} else { + DEFINES += QT_NO_XRENDER +} diff --git a/src/plugins/platforms/glxconvenience/qglxconvenience.cpp b/src/plugins/platforms/glxconvenience/qglxconvenience.cpp index c776f5b..34633d9 100644 --- a/src/plugins/platforms/glxconvenience/qglxconvenience.cpp +++ b/src/plugins/platforms/glxconvenience/qglxconvenience.cpp @@ -43,6 +43,10 @@ #include <QtCore/QVector> +#ifndef QT_NO_XRENDER +#include <X11/extensions/Xrender.h> +#endif + enum { XFocusOut = FocusOut, XFocusIn = FocusIn, @@ -84,14 +88,15 @@ QVector<int> qglx_buildSpec(const QPlatformWindowFormat &format, int drawableBit spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 1 : format.alphaBufferSize(); } - spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); - spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); - spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + if (format.accum()) { + spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); - if (format.alpha()) { - spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + if (format.alpha()) { + spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + } } - } else { spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_COLOR_INDEX_BIT; //I'm really not sure if this works.... spec[i++] = GLX_BUFFER_SIZE; spec[i++] = 8; @@ -136,8 +141,17 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , const QPlatformWindow if (reducedFormat.alpha()) { int alphaSize; glXGetFBConfigAttrib(display,configs[i],GLX_ALPHA_SIZE,&alphaSize); - if (alphaSize > 0) - break; + if (alphaSize > 0) { + XVisualInfo *visual = glXGetVisualFromFBConfig(display, chosenConfig); +#if !defined(QT_NO_XRENDER) + XRenderPictFormat *pictFormat = XRenderFindVisualFormat(display, visual->visual); + if (pictFormat->direct.alphaMask > 0) + break; +#else + if (visual->depth == 32) + break; +#endif + } } else { break; // Just choose the first in the list if there's no alpha requested } diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index 50c3626..b9ab528 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -50,8 +50,8 @@ QMinimalIntegration::QMinimalIntegration() QMinimalScreen *mPrimaryScreen = new QMinimalScreen(); mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320); - mPrimaryScreen->mDepth = 16; - mPrimaryScreen->mFormat = QImage::Format_RGB16; + mPrimaryScreen->mDepth = 32; + mPrimaryScreen->mFormat = QImage::Format_ARGB32_Premultiplied; mScreens.append(mPrimaryScreen); } diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h index df4a9da..d1fcc42 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.h +++ b/src/plugins/platforms/minimal/qminimalintegration.h @@ -51,7 +51,7 @@ class QMinimalScreen : public QPlatformScreen { public: QMinimalScreen() - : mDepth(16), mFormat(QImage::Format_RGB16) {} + : mDepth(32), mFormat(QImage::Format_ARGB32_Premultiplied) {} QRect geometry() const { return mGeometry; } int depth() const { return mDepth; } diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp index 72ad5a8..0f27501 100644 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp +++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp @@ -115,8 +115,15 @@ void *QWaylandGLContext::getProcAddress(const QString &string) void QWaylandGLContext::setEglSurface(EGLSurface surface) { - doneCurrent(); + bool wasCurrent = false; + if (QPlatformGLContext::currentContext() == this) { + wasCurrent = true; + doneCurrent(); + } mSurface = surface; + if (wasCurrent) { + makeCurrent(); + } } EGLConfig QWaylandGLContext::eglConfig() const diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp index e53381e..dff6ffa 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp @@ -132,10 +132,12 @@ void QWaylandXCompositeGLXContext::geometryChanged() Colormap cmap = XCreateColormap(mGlxIntegration->xDisplay(),mGlxIntegration->rootWindow(),visualInfo->visual,AllocNone); XSetWindowAttributes a; + a.background_pixel = WhitePixel(mGlxIntegration->xDisplay(), mGlxIntegration->screen()); + a.border_pixel = BlackPixel(mGlxIntegration->xDisplay(), mGlxIntegration->screen()); a.colormap = cmap; mXWindow = XCreateWindow(mGlxIntegration->xDisplay(), mGlxIntegration->rootWindow(),0, 0, size.width(), size.height(), 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); + CWBackPixel|CWBorderPixel|CWColormap, &a); XCompositeRedirectWindow(mGlxIntegration->xDisplay(), mXWindow, CompositeRedirectManual); XMapWindow(mGlxIntegration->xDisplay(), mXWindow); diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index f2e6ccf..b7f6ae5 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -48,16 +48,54 @@ #include <QtCore/QStringList> #include <QtCore/QFile> #include <QtCore/QtDebug> +#include <QtGui/private/qdnd_p.h> static QWaylandClipboard *clipboard; +class QWaylandMimeData : public QInternalMimeData +{ +public: + void clearAll(); + void setFormats(const QStringList &formatList); + bool hasFormat_sys(const QString &mimeType) const; + QStringList formats_sys() const; + QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const; +private: + QStringList mFormatList; +}; + +void QWaylandMimeData::clearAll() +{ + clear(); + mFormatList.clear(); +} + +void QWaylandMimeData::setFormats(const QStringList &formatList) +{ + mFormatList = formatList; +} + +bool QWaylandMimeData::hasFormat_sys(const QString &mimeType) const +{ + return formats().contains(mimeType); +} + +QStringList QWaylandMimeData::formats_sys() const +{ + return mFormatList; +} + +QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const +{ + return clipboard->retrieveData(mimeType, type); +} + class QWaylandSelection { public: QWaylandSelection(QWaylandDisplay *display, QMimeData *data); ~QWaylandSelection(); -private: static uint32_t getTime(); static void send(void *data, struct wl_selection *selection, const char *mime_type, int fd); static void cancelled(void *data, struct wl_selection *selection); @@ -125,7 +163,7 @@ void QWaylandSelection::cancelled(void *data, struct wl_selection *selection) } QWaylandClipboard::QWaylandClipboard(QWaylandDisplay *display) - : mDisplay(display), mSelection(0), mMimeDataIn(0), mOffer(0) + : mDisplay(display), mMimeDataIn(0), mOffer(0) { clipboard = this; } @@ -157,32 +195,39 @@ void QWaylandClipboard::forceRoundtrip(struct wl_display *display) wl_display_iterate(display, WL_DISPLAY_READABLE); } -const QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) const +QVariant QWaylandClipboard::retrieveData(const QString &mimeType, QVariant::Type type) const +{ + Q_UNUSED(type); + if (mOfferedMimeTypes.isEmpty() || !mOffer) + return QVariant(); + int pipefd[2]; + if (pipe(pipefd) == -1) { + qWarning("QWaylandClipboard: pipe() failed"); + return QVariant(); + } + QByteArray mimeTypeBa = mimeType.toLatin1(); + wl_selection_offer_receive(mOffer, mimeTypeBa.constData(), pipefd[1]); + QByteArray content; + forceRoundtrip(mDisplay->wl_display()); + char buf[256]; + int n; + close(pipefd[1]); + while ((n = read(pipefd[0], &buf, sizeof buf)) > 0) + content.append(buf, n); + close(pipefd[0]); + return content; +} + +QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) { Q_ASSERT(mode == QClipboard::Clipboard); + if (!mSelections.isEmpty()) + return mSelections.last()->mMimeData; if (!mMimeDataIn) - mMimeDataIn = new QMimeData; - mMimeDataIn->clear(); - if (!mOfferedMimeTypes.isEmpty() && mOffer) { - foreach (const QString &mimeType, mOfferedMimeTypes) { - int pipefd[2]; - if (pipe(pipefd) == -1) { - qWarning("QWaylandClipboard::mimedata: pipe() failed"); - break; - } - QByteArray mimeTypeBa = mimeType.toLatin1(); - wl_selection_offer_receive(mOffer, mimeTypeBa.constData(), pipefd[1]); - QByteArray content; - forceRoundtrip(mDisplay->wl_display()); - char buf[256]; - int n; - close(pipefd[1]); - while ((n = read(pipefd[0], &buf, sizeof buf)) > 0) - content.append(buf, n); - close(pipefd[0]); - mMimeDataIn->setData(mimeType, content); - } - } + mMimeDataIn = new QWaylandMimeData; + mMimeDataIn->clearAll(); + if (!mOfferedMimeTypes.isEmpty() && mOffer) + mMimeDataIn->setFormats(mOfferedMimeTypes); return mMimeDataIn; } @@ -192,7 +237,7 @@ void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) if (!mDisplay->inputDevices().isEmpty()) { if (!data) data = new QMimeData; - mSelection = new QWaylandSelection(mDisplay, data); + mSelections.append(new QWaylandSelection(mDisplay, data)); } else { qWarning("QWaylandClipboard::setMimeData: No input devices"); } @@ -222,21 +267,27 @@ void QWaylandClipboard::offer(void *data, struct wl_selection_offer *selection_offer, const char *type) { + Q_UNUSED(data); Q_UNUSED(selection_offer); - QWaylandClipboard *self = static_cast<QWaylandClipboard *>(data); - self->mOfferedMimeTypes.append(QString::fromLatin1(type)); + clipboard->mOfferedMimeTypes.append(QString::fromLatin1(type)); } void QWaylandClipboard::keyboardFocus(void *data, struct wl_selection_offer *selection_offer, wl_input_device *input_device) { - QWaylandClipboard *self = static_cast<QWaylandClipboard *>(data); + Q_UNUSED(data); if (!input_device) { wl_selection_offer_destroy(selection_offer); - self->mOffer = 0; + clipboard->mOffer = 0; return; } - self->mOffer = selection_offer; - self->emitChanged(QClipboard::Clipboard); + clipboard->mOffer = selection_offer; + if (clipboard->mSelections.isEmpty()) + QMetaObject::invokeMethod(&clipboard->mEmitter, "emitChanged", Qt::QueuedConnection); +} + +void QWaylandClipboardSignalEmitter::emitChanged() +{ + clipboard->emitChanged(QClipboard::Clipboard); } diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.h b/src/plugins/platforms/wayland/qwaylandclipboard.h index dc51854..f45fb8d 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard.h @@ -44,18 +44,27 @@ #include <QtGui/QPlatformClipboard> #include <QtCore/QStringList> +#include <QtCore/QVariant> class QWaylandDisplay; class QWaylandSelection; +class QWaylandMimeData; struct wl_selection_offer; +class QWaylandClipboardSignalEmitter : public QObject +{ + Q_OBJECT +public slots: + void emitChanged(); +}; + class QWaylandClipboard : public QPlatformClipboard { public: QWaylandClipboard(QWaylandDisplay *display); ~QWaylandClipboard(); - const QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) const; + QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard); void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); bool supportsMode(QClipboard::Mode mode) const; @@ -63,6 +72,8 @@ public: void createSelectionOffer(uint32_t id); + QVariant retrieveData(const QString &mimeType, QVariant::Type type) const; + private: static void offer(void *data, struct wl_selection_offer *selection_offer, @@ -76,11 +87,11 @@ private: static void forceRoundtrip(struct wl_display *display); QWaylandDisplay *mDisplay; - QWaylandSelection *mSelection; - mutable QMimeData *mMimeDataIn; + QWaylandMimeData *mMimeDataIn; QList<QWaylandSelection *> mSelections; QStringList mOfferedMimeTypes; struct wl_selection_offer *mOffer; + QWaylandClipboardSignalEmitter mEmitter; }; #endif // QWAYLANDCLIPBOARD_H diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 14a8dcf..83516e9 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -51,6 +51,10 @@ #include "gl_integration/qwaylandglintegration.h" #endif +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT +#include "windowmanager_integration/qwaylandwindowmanagerintegration.h" +#endif + #include <QtCore/QAbstractEventDispatcher> #include <QtGui/QApplication> #include <QtGui/private/qapplication_p.h> @@ -77,17 +81,17 @@ struct wl_buffer *QWaylandDisplay::createShmBuffer(int fd, struct wl_visual *QWaylandDisplay::rgbVisual() { - return wl_display_get_rgb_visual(mDisplay); + return rgb_visual; } struct wl_visual *QWaylandDisplay::argbVisual() { - return wl_display_get_argb_visual(mDisplay); + return argb_visual; } struct wl_visual *QWaylandDisplay::argbPremultipliedVisual() { - return wl_display_get_premultiplied_argb_visual(mDisplay); + return premultiplied_argb_visual; } #ifdef QT_WAYLAND_GL_SUPPORT @@ -97,6 +101,13 @@ QWaylandGLIntegration * QWaylandDisplay::eglIntegration() } #endif +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT +QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() +{ + return mWindowManagerIntegration; +} +#endif + void QWaylandDisplay::shellHandleConfigure(void *data, struct wl_shell *shell, uint32_t time, uint32_t edges, struct wl_surface *surface, @@ -116,6 +127,7 @@ const struct wl_shell_listener QWaylandDisplay::shellListener = { }; QWaylandDisplay::QWaylandDisplay(void) + : argb_visual(0), premultiplied_argb_visual(0), rgb_visual(0) { mDisplay = wl_display_connect(NULL); if (mDisplay == NULL) { @@ -128,6 +140,11 @@ QWaylandDisplay::QWaylandDisplay(void) #ifdef QT_WAYLAND_GL_SUPPORT mEglIntegration = QWaylandGLIntegration::createGLIntegration(this); #endif + +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT + mWindowManagerIntegration = QWaylandWindowManagerIntegration::createIntegration(this); +#endif + blockingReadEvents(); qRegisterMetaType<uint32_t>("uint32_t"); @@ -228,6 +245,11 @@ const struct wl_output_listener QWaylandDisplay::outputListener = { QWaylandDisplay::outputHandleGeometry }; +const struct wl_compositor_listener QWaylandDisplay::compositorListener = { + QWaylandDisplay::handleVisual, +}; + + void QWaylandDisplay::waitForScreens() { flushRequests(); @@ -256,6 +278,8 @@ void QWaylandDisplay::displayHandleGlobal(uint32_t id, wl_output_add_listener(output, &outputListener, this); } else if (interface == "wl_compositor") { mCompositor = wl_compositor_create(mDisplay, id, 1); + wl_compositor_add_listener(mCompositor, + &compositorListener, this); } else if (interface == "wl_shm") { mShm = wl_shm_create(mDisplay, id, 1); } else if (interface == "wl_shell"){ @@ -271,3 +295,23 @@ void QWaylandDisplay::displayHandleGlobal(uint32_t id, clipboard->createSelectionOffer(id); } } + +void QWaylandDisplay::handleVisual(void *data, + struct wl_compositor *compositor, + uint32_t id, uint32_t token) +{ + QWaylandDisplay *self = static_cast<QWaylandDisplay *>(data); + + switch (token) { + case WL_COMPOSITOR_VISUAL_ARGB32: + self->argb_visual = wl_visual_create(self->mDisplay, id, 1); + break; + case WL_COMPOSITOR_VISUAL_PREMULTIPLIED_ARGB32: + self->premultiplied_argb_visual = + wl_visual_create(self->mDisplay, id, 1); + break; + case WL_COMPOSITOR_VISUAL_XRGB32: + self->rgb_visual = wl_visual_create(self->mDisplay, id, 1); + break; + } +} diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index 7cb2df1..765be62 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -55,6 +55,8 @@ class QWaylandBuffer; class QPlatformScreen; class QWaylandScreen; class QWaylandGLIntegration; +class QWaylandWindowManagerIntegration; + class QWaylandDisplay : public QObject { Q_OBJECT @@ -74,6 +76,11 @@ public: #ifdef QT_WAYLAND_GL_SUPPORT QWaylandGLIntegration *eglIntegration(); #endif + +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT + QWaylandWindowManagerIntegration *windowManagerIntegration(); +#endif + void setCursor(QWaylandBuffer *buffer, int32_t x, int32_t y); void syncCallback(wl_display_sync_func_t func, void *data); @@ -109,7 +116,10 @@ private: uint32_t mSocketMask; + struct wl_visual *argb_visual, *premultiplied_argb_visual, *rgb_visual; + static const struct wl_output_listener outputListener; + static const struct wl_compositor_listener compositorListener; static int sourceUpdate(uint32_t mask, void *data); static void displayHandleGlobal(struct wl_display *display, uint32_t id, @@ -120,10 +130,17 @@ private: int32_t x, int32_t y, int32_t width, int32_t height); + static void handleVisual(void *data, + struct wl_compositor *compositor, + uint32_t id, uint32_t token); #ifdef QT_WAYLAND_GL_SUPPORT QWaylandGLIntegration *mEglIntegration; #endif +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT + QWaylandWindowManagerIntegration *mWindowManagerIntegration; +#endif + static void shellHandleConfigure(void *data, struct wl_shell *shell, uint32_t time, uint32_t edges, struct wl_surface *surface, diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 734591f..333a953 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -46,6 +46,11 @@ #include "qwaylandinputdevice.h" #include "qwaylandscreen.h" +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT +#include "windowmanager_integration/qwaylandwindowmanagerintegration.h" +#endif + +#include <QCoreApplication> #include <QtGui/QWidget> #include <QtGui/QWindowSystemInterface> @@ -60,6 +65,11 @@ QWaylandWindow::QWaylandWindow(QWidget *window) static WId id = 1; mWindowId = id++; +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT + mDisplay->windowManagerIntegration()->mapClientToProcess(qApp->applicationPid()); + mDisplay->windowManagerIntegration()->authenticateWithToken(); +#endif + mSurface = mDisplay->createSurface(this); } @@ -120,7 +130,6 @@ void QWaylandWindow::attach(QWaylandBuffer *buffer) } } - void QWaylandWindow::damage(const QRegion ®ion) { //We have to do sync stuff before calling damage, or we might diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index 76f8be5..dca72fd 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -40,8 +40,10 @@ QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_WAYLAND INCLUDEPATH += $$PWD include ($$PWD/gl_integration/gl_integration.pri) +include ($$PWD/windowmanager_integration/windowmanager_integration.pri) include (../fontdatabases/genericunix/genericunix.pri) target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target + diff --git a/src/plugins/platforms/wayland/wayland_sha1.txt b/src/plugins/platforms/wayland/wayland_sha1.txt new file mode 100644 index 0000000..d262437 --- /dev/null +++ b/src/plugins/platforms/wayland/wayland_sha1.txt @@ -0,0 +1,3 @@ +This version of the Qt Wayland plugin is checked against the following sha1 +from the Wayland repository: +eff7fc0d99be2e51eaa351785030c8d374ac71de diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp new file mode 100644 index 0000000..e4a6218 --- /dev/null +++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandwindowmanagerintegration.h" +#include "qwaylandwindowmanager-client-protocol.h" + +#include <stdint.h> + +QWaylandWindowManagerIntegration *QWaylandWindowManagerIntegration::createIntegration(QWaylandDisplay *waylandDisplay) +{ + return new QWaylandWindowManagerIntegration(waylandDisplay); +} + +QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay) + : mWaylandDisplay(waylandDisplay) + , mWaylandWindowManager(0) +{ + wl_display_add_global_listener(mWaylandDisplay->wl_display(), + QWaylandWindowManagerIntegration::wlHandleListenerGlobal, + this); +} + +QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration() +{ + +} + +struct wl_windowmanager *QWaylandWindowManagerIntegration::windowManager() const +{ + return mWaylandWindowManager; +} + +void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(wl_display *display, uint32_t id, const char *interface, uint32_t version, void *data) +{ + if (strcmp(interface, "wl_windowmanager") == 0) { + QWaylandWindowManagerIntegration *integration = static_cast<QWaylandWindowManagerIntegration *>(data); + integration->mWaylandWindowManager = wl_windowmanager_create(display, id); + } +} + +void QWaylandWindowManagerIntegration::mapClientToProcess(long long processId) +{ + if (mWaylandWindowManager) + wl_windowmanager_map_client_to_process(mWaylandWindowManager, (uint32_t) processId); +} + +void QWaylandWindowManagerIntegration::authenticateWithToken(const QByteArray &token) +{ + QByteArray authToken = token; + if (authToken.isEmpty()) + authToken = qgetenv("WL_AUTHENTICATION_TOKEN"); + if (mWaylandWindowManager) + wl_windowmanager_authenticate_with_token(mWaylandWindowManager, authToken.constData()); +} diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h new file mode 100644 index 0000000..a79f205 --- /dev/null +++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDWINDOWMANAGERINTEGRATION_H +#define QWAYLANDWINDOWMANAGERINTEGRATION_H + +#include <QObject> +#include "wayland-client.h" +#include "qwaylanddisplay.h" + +class QWaylandWindowManagerIntegration +{ +public: + explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay); + virtual ~QWaylandWindowManagerIntegration(); + static QWaylandWindowManagerIntegration *createIntegration(QWaylandDisplay *waylandDisplay); + struct wl_windowmanager *windowManager() const; + + void mapSurfaceToProcess(struct wl_surface *surface, long long processId); + void mapClientToProcess(long long processId); + void authenticateWithToken(const QByteArray &token = QByteArray()); + +private: + static void wlHandleListenerGlobal(wl_display *display, uint32_t id, + const char *interface, uint32_t version, void *data); + +private: + QWaylandDisplay *mWaylandDisplay; + struct wl_windowmanager *mWaylandWindowManager; +}; + +#endif // QWAYLANDWINDOWMANAGERINTEGRATION_H diff --git a/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri b/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri new file mode 100644 index 0000000..664389a --- /dev/null +++ b/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri @@ -0,0 +1,16 @@ +DEFINES += QT_WAYLAND_WINDOWMANAGER_SUPPORT + +contains(DEFINES, QT_WAYLAND_WINDOWMANAGER_SUPPORT) { + + HEADERS += \ + $$PWD/qwaylandwindowmanagerintegration.h + + SOURCES += \ + $$PWD/qwaylandwindowmanagerintegration.cpp + + INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/wayland + HEADERS += \ + $$QT_SOURCE_TREE/src/3rdparty/wayland/qwaylandwindowmanager-client-protocol.h + SOURCES += \ + $$QT_SOURCE_TREE/src/3rdparty/wayland/wayland-windowmanager-protocol.c +} diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index c687e4c..0a02c7e 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -113,7 +113,8 @@ QXcbWindow::QXcbWindow(QWidget *tlw) #if defined(XCB_USE_GLX) || defined(XCB_USE_EGL) if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) + && QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL) + || tlw->platformWindowFormat().alpha()) { #if defined(XCB_USE_GLX) XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen),m_screen->screenNumber(), tlw->platformWindowFormat()); @@ -131,13 +132,17 @@ QXcbWindow::QXcbWindow(QWidget *tlw) visualInfo = XGetVisualInfo(DISPLAY_FROM_XCB(this), VisualIDMask, &visualInfoTemplate, &matchingCount); #endif //XCB_USE_GLX if (visualInfo) { + m_depth = visualInfo->depth; + m_format = (m_depth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(this), m_screen->root(), visualInfo->visual, AllocNone); XSetWindowAttributes a; + a.background_pixel = WhitePixel(DISPLAY_FROM_XCB(this), m_screen->screenNumber()); + a.border_pixel = BlackPixel(DISPLAY_FROM_XCB(this), m_screen->screenNumber()); a.colormap = cmap; m_window = XCreateWindow(DISPLAY_FROM_XCB(this), m_screen->root(), tlw->x(), tlw->y(), tlw->width(), tlw->height(), 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); + CWBackPixel|CWBorderPixel|CWColormap, &a); printf("created GL window: %d\n", m_window); } else { @@ -147,6 +152,8 @@ QXcbWindow::QXcbWindow(QWidget *tlw) #endif //defined(XCB_USE_GLX) || defined(XCB_USE_EGL) { m_window = xcb_generate_id(xcb_connection()); + m_depth = m_screen->screen()->root_depth; + m_format = (m_depth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; Q_XCB_CALL(xcb_create_window(xcb_connection(), XCB_COPY_FROM_PARENT, // depth -- same as root diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 3f4d2d2..69d0bc2 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -44,6 +44,7 @@ #include <QtGui/QPlatformWindow> #include <QtGui/QPlatformWindowFormat> +#include <QtGui/QImage> #include <xcb/xcb.h> #include <xcb/sync.h> @@ -74,6 +75,8 @@ public: QPlatformGLContext *glContext() const; xcb_window_t window() const { return m_window; } + uint depth() const { return m_depth; } + QImage::Format format() const { return m_format; } void handleExposeEvent(const xcb_expose_event_t *event); void handleClientMessageEvent(const xcb_client_message_event_t *event); @@ -99,6 +102,9 @@ private: xcb_window_t m_window; QPlatformGLContext *m_context; + uint m_depth; + QImage::Format m_format; + xcb_sync_int64_t m_syncValue; xcb_sync_counter_t m_syncCounter; diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp index 827a899..4fcd207 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp @@ -54,11 +54,12 @@ #include <stdio.h> #include <qdebug.h> +#include <qpainter.h> class QXcbShmImage : public QXcbObject { public: - QXcbShmImage(QXcbScreen *connection, const QSize &size); + QXcbShmImage(QXcbScreen *connection, const QSize &size, uint depth, QImage::Format format); ~QXcbShmImage() { destroy(); } QImage *image() { return &m_qimage; } @@ -81,7 +82,7 @@ private: QRegion m_dirty; }; -QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size) +QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QImage::Format format) : QXcbObject(screen->connection()) , m_gc(0) , m_gc_window(0) @@ -91,7 +92,7 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size) size.width(), size.height(), XCB_IMAGE_FORMAT_Z_PIXMAP, - screen->depth(), + depth, 0, ~0, 0); @@ -111,7 +112,7 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size) if (shmctl(m_shm_info.shmid, IPC_RMID, 0) == -1) qWarning() << "QXcbWindowSurface: Error while marking the shared memory segment to be destroyed"; - m_qimage = QImage( (uchar*) m_xcb_image->data, m_xcb_image->width, m_xcb_image->height, m_xcb_image->stride, screen->format()); + m_qimage = QImage( (uchar*) m_xcb_image->data, m_xcb_image->width, m_xcb_image->height, m_xcb_image->stride, format); } void QXcbShmImage::destroy() @@ -189,6 +190,16 @@ QPaintDevice *QXcbWindowSurface::paintDevice() void QXcbWindowSurface::beginPaint(const QRegion ®ion) { m_image->preparePaint(region); + + if (m_image->image()->hasAlphaChannel()) { + QPainter p(m_image->image()); + p.setCompositionMode(QPainter::CompositionMode_Source); + const QVector<QRect> rects = region.rects(); + const QColor blank = Qt::transparent; + for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { + p.fillRect(*it, blank); + } + } } void QXcbWindowSurface::endPaint(const QRegion &) @@ -232,9 +243,10 @@ void QXcbWindowSurface::resize(const QSize &size) QWindowSurface::resize(size); QXcbScreen *screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWidget(window())); + QXcbWindow* win = static_cast<QXcbWindow *>(window()->platformWindow()); delete m_image; - m_image = new QXcbShmImage(screen, size); + m_image = new QXcbShmImage(screen, size, win->depth(), win->format()); Q_XCB_NOOP(connection()); m_syncingResize = true; diff --git a/src/plugins/platforms/xlib/qxlibclipboard.cpp b/src/plugins/platforms/xlib/qxlibclipboard.cpp index dbe81e0..2c1d91b 100644 --- a/src/plugins/platforms/xlib/qxlibclipboard.cpp +++ b/src/plugins/platforms/xlib/qxlibclipboard.cpp @@ -161,12 +161,11 @@ QXlibClipboard::QXlibClipboard(QXlibScreen *screen) { } -const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const +QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) { if (mode == QClipboard::Clipboard) { if (!m_xClipboard) { - QXlibClipboard *that = const_cast<QXlibClipboard *>(this); - that->m_xClipboard = new QXlibClipboardMime(mode,that); + m_xClipboard = new QXlibClipboardMime(mode, this); } Window clipboardOwner = XGetSelectionOwner(screen()->display()->nativeDisplay(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); if (clipboardOwner == owner()) { @@ -176,8 +175,7 @@ const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const } } else if (mode == QClipboard::Selection) { if (!m_xSelection) { - QXlibClipboard *that = const_cast<QXlibClipboard *>(this); - that->m_xSelection = new QXlibClipboardMime(mode,that); + m_xSelection = new QXlibClipboardMime(mode, this); } Window clipboardOwner = XGetSelectionOwner(screen()->display()->nativeDisplay(),XA_PRIMARY); if (clipboardOwner == owner()) { diff --git a/src/plugins/platforms/xlib/qxlibclipboard.h b/src/plugins/platforms/xlib/qxlibclipboard.h index 5d78a7f..8fdc18b 100644 --- a/src/plugins/platforms/xlib/qxlibclipboard.h +++ b/src/plugins/platforms/xlib/qxlibclipboard.h @@ -51,7 +51,7 @@ class QXlibClipboard : public QPlatformClipboard public: QXlibClipboard(QXlibScreen *screen); - const QMimeData *mimeData(QClipboard::Mode mode) const; + QMimeData *mimeData(QClipboard::Mode mode); void setMimeData(QMimeData *data, QClipboard::Mode mode); bool supportsMode(QClipboard::Mode mode) const; diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp index 90ef066..02104d9 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -150,7 +150,7 @@ bool QXlibIntegration::hasOpenGL() const { #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) - QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); + QXlibScreen *screen = static_cast<QXlibScreen *>(mScreens.at(0)); return glXQueryExtension(screen->display()->nativeDisplay(), 0, 0) != 0; #else static bool eglHasbeenInitialized = false; diff --git a/src/plugins/platforms/xlib/qxlibscreen.cpp b/src/plugins/platforms/xlib/qxlibscreen.cpp index 8f21ec3..b069985 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.cpp +++ b/src/plugins/platforms/xlib/qxlibscreen.cpp @@ -41,6 +41,8 @@ #include "qxlibscreen.h" +#include <X11/extensions/Xfixes.h> + #include "qxlibcursor.h" #include "qxlibwindow.h" #include "qxlibkeyboard.h" diff --git a/src/plugins/platforms/xlib/qxlibstatic.h b/src/plugins/platforms/xlib/qxlibstatic.h index b46b28d..9caa2fa 100644 --- a/src/plugins/platforms/xlib/qxlibstatic.h +++ b/src/plugins/platforms/xlib/qxlibstatic.h @@ -136,6 +136,7 @@ typedef char *XPointer; #endif #ifndef QT_NO_XFIXES +#include <X11/extensions/Xfixes.h> typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *); typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *); typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name); diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp index 1666b1c..823fae9 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.cpp +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -47,14 +47,6 @@ #include "qxlibstatic.h" #include "qxlibdisplay.h" -#include <QtGui/QWindowSystemInterface> -#include <QSocketNotifier> -#include <QApplication> -#include <QDebug> - -#include <QtGui/private/qwindowsurface_p.h> -#include <QtGui/private/qapplication_p.h> - #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) #include "qglxintegration.h" @@ -66,6 +58,15 @@ #endif //QT_OPENGL_ES_2 #endif //QT_NO_OPENGL + +#include <QtGui/QWindowSystemInterface> +#include <QSocketNotifier> +#include <QApplication> +#include <QDebug> + +#include <QtGui/private/qwindowsurface_p.h> +#include <QtGui/private/qapplication_p.h> + //#define MYX11_DEBUG QT_BEGIN_NAMESPACE @@ -80,9 +81,10 @@ QXlibWindow::QXlibWindow(QWidget *window) int w = window->width(); int h = window->height(); - if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL) ) { #if !defined(QT_NO_OPENGL) + if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL + && QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL) + || window->platformWindowFormat().alpha()) { #if !defined(QT_OPENGL_ES_2) XVisualInfo *visualInfo = qglx_findVisualInfo(mScreen->display()->nativeDisplay(),mScreen->xScreenNumber(),window->platformWindowFormat()); #else @@ -101,18 +103,28 @@ QXlibWindow::QXlibWindow(QWidget *window) visualInfo = XGetVisualInfo(mScreen->display()->nativeDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount); #endif //!defined(QT_OPENGL_ES_2) if (visualInfo) { - Colormap cmap = XCreateColormap(mScreen->display()->nativeDisplay(),mScreen->rootWindow(),visualInfo->visual,AllocNone); + mDepth = visualInfo->depth; + mFormat = (mDepth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; + mVisual = visualInfo->visual; + Colormap cmap = XCreateColormap(mScreen->display()->nativeDisplay(), mScreen->rootWindow(), visualInfo->visual, AllocNone); XSetWindowAttributes a; + a.background_pixel = WhitePixel(mScreen->display()->nativeDisplay(), mScreen->xScreenNumber()); + a.border_pixel = BlackPixel(mScreen->display()->nativeDisplay(), mScreen->xScreenNumber()); a.colormap = cmap; x_window = XCreateWindow(mScreen->display()->nativeDisplay(), mScreen->rootWindow(),x, y, w, h, 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); + CWBackPixel|CWBorderPixel|CWColormap, &a); } else { qFatal("no window!"); } + } else #endif //!defined(QT_NO_OPENGL) - } else { + { + mDepth = mScreen->depth(); + mFormat = (mDepth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; + mVisual = mScreen->defaultVisual(); + x_window = XCreateSimpleWindow(mScreen->display()->nativeDisplay(), mScreen->rootWindow(), x, y, w, h, 0 /*border_width*/, mScreen->blackPixel(), mScreen->whitePixel()); diff --git a/src/plugins/platforms/xlib/qxlibwindow.h b/src/plugins/platforms/xlib/qxlibwindow.h index adc2f85..da29efb 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.h +++ b/src/plugins/platforms/xlib/qxlibwindow.h @@ -122,6 +122,10 @@ public: Window xWindow() const; GC graphicsContext() const; + inline uint depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + Visual* visual() const { return mVisual; } + protected: QVector<Atom> getNetWmState() const; void setMWMHints(const QXlibMWMHints &mwmhints); @@ -135,6 +139,10 @@ private: Window x_window; GC gc; + uint mDepth; + QImage::Format mFormat; + Visual* mVisual; + GC createGC(); QPlatformGLContext *mGLContext; diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp index add21ac..e0c272d 100644 --- a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp +++ b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp @@ -49,6 +49,8 @@ #include "qxlibscreen.h" #include "qxlibdisplay.h" +#include "qpainter.h" + # include <sys/ipc.h> # include <sys/shm.h> # include <X11/extensions/XShm.h> @@ -80,20 +82,19 @@ void QXlibShmImageInfo::destroy() void QXlibWindowSurface::resizeShmImage(int width, int height) { + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); + QXlibWindow *win = static_cast<QXlibWindow*>(window()->platformWindow()); #ifdef DONT_USE_MIT_SHM - shm_img = QImage(width, height, QImage::Format_RGB32); + shm_img = QImage(width, height, win->format()); #else - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); if (image_info) image_info->destroy(); else image_info = new QXlibShmImageInfo(screen->display()->nativeDisplay()); - Visual *visual = screen->defaultVisual(); - - XImage *image = XShmCreateImage (screen->display()->nativeDisplay(), visual, 24, ZPixmap, 0, + XImage *image = XShmCreateImage (screen->display()->nativeDisplay(), win->visual(), win->depth(), ZPixmap, 0, &image_info->shminfo, width, height); @@ -109,7 +110,7 @@ void QXlibWindowSurface::resizeShmImage(int width, int height) Q_ASSERT(shm_attach_status == True); - shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); + shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, win->format() ); #endif painted = false; } @@ -160,11 +161,11 @@ void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPo #ifdef DONT_USE_MIT_SHM // just convert the image every time... if (!shm_img.isNull()) { - Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); + QXlibWindow *win = static_cast<QXlibWindow*>(window()->platformWindow()); QImage image = shm_img; //img.convertToFormat( - XImage *xi = XCreateImage(screen->display(), visual, 24, ZPixmap, + XImage *xi = XCreateImage(screen->display(), win->visual(), win->depth(), ZPixmap, 0, (char *) image.scanLine(0), image.width(), image.height(), 32, image.bytesPerLine()); @@ -214,6 +215,16 @@ void QXlibWindowSurface::beginPaint(const QRegion ®ion) { Q_UNUSED(region); resizeBuffer(size()); + + if (shm_img.hasAlphaChannel()) { + QPainter p(&shm_img); + p.setCompositionMode(QPainter::CompositionMode_Source); + const QVector<QRect> rects = region.rects(); + const QColor blank = Qt::transparent; + for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { + p.fillRect(*it, blank); + } + } } void QXlibWindowSurface::endPaint(const QRegion ®ion) diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 2d0c201..94ce675 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -11,7 +11,6 @@ unix:!symbian { embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers !win32:!embedded:!mac:!symbian:!contains(QT_CONFIG, no-gui):SUBDIRS *= inputmethods !symbian:!contains(QT_CONFIG, no-gui):SUBDIRS += accessible -symbian:SUBDIRS += s60 contains(QT_CONFIG, phonon): SUBDIRS *= phonon qpa:SUBDIRS += platforms contains(QT_CONFIG, declarative): SUBDIRS *= qmltooling diff --git a/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool.cpp b/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool.cpp deleted file mode 100644 index c3790e4..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool.cpp +++ /dev/null @@ -1,364 +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$ -** -****************************************************************************/ - -#include "subcomponenteditortool_p.h" -#include "subcomponentmasklayeritem_p.h" -#include "livelayeritem_p.h" - -#include "../qdeclarativeviewobserver_p_p.h" - -#include <QtGui/QGraphicsItem> -#include <QtGui/QGraphicsObject> -#include <QtGui/QMouseEvent> -#include <QtGui/QKeyEvent> - -#include <QtCore/QTimer> -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -const qreal MaxOpacity = 0.5f; - -SubcomponentEditorTool::SubcomponentEditorTool(QDeclarativeViewObserver *view) - : AbstractLiveEditTool(view), - m_animIncrement(0.05f), - m_animTimer(new QTimer(this)) -{ - QDeclarativeViewObserverPrivate *observerPrivate = - QDeclarativeViewObserverPrivate::get(view); - m_mask = new SubcomponentMaskLayerItem(view, observerPrivate->manipulatorLayer); - connect(m_animTimer, SIGNAL(timeout()), SLOT(animate())); - m_animTimer->setInterval(20); -} - -SubcomponentEditorTool::~SubcomponentEditorTool() -{ - -} - -void SubcomponentEditorTool::mousePressEvent(QMouseEvent * /*event*/) -{ - -} - -void SubcomponentEditorTool::mouseMoveEvent(QMouseEvent * /*event*/) -{ - -} - -bool SubcomponentEditorTool::containsCursor(const QPoint &mousePos) const -{ - if (!m_currentContext.size()) - return false; - - QPointF scenePos = view()->mapToScene(mousePos); - QRectF itemRect = m_currentContext.top()->boundingRect() - | m_currentContext.top()->childrenBoundingRect(); - QRectF polyRect = m_currentContext.top()->mapToScene(itemRect).boundingRect(); - - return polyRect.contains(scenePos); -} - -void SubcomponentEditorTool::mouseReleaseEvent(QMouseEvent * /*event*/) -{ - -} - -void SubcomponentEditorTool::mouseDoubleClickEvent(QMouseEvent *event) -{ - if (event->buttons() & Qt::LeftButton - && !containsCursor(event->pos()) - && m_currentContext.size() > 1) - { - aboutToPopContext(); - } -} - -void SubcomponentEditorTool::hoverMoveEvent(QMouseEvent *event) -{ - if (!containsCursor(event->pos()) && m_currentContext.size() > 1) { - QDeclarativeViewObserverPrivate::get(observer())->clearHighlight(); - } -} - -void SubcomponentEditorTool::wheelEvent(QWheelEvent * /*event*/) -{ - -} - -void SubcomponentEditorTool::keyPressEvent(QKeyEvent * /*event*/) -{ - -} - -void SubcomponentEditorTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/) -{ - -} - -void SubcomponentEditorTool::itemsAboutToRemoved(const QList<QGraphicsItem*> &/*itemList*/) -{ - -} - -void SubcomponentEditorTool::animate() -{ - if (m_animIncrement > 0) { - if (m_mask->opacity() + m_animIncrement < MaxOpacity) { - m_mask->setOpacity(m_mask->opacity() + m_animIncrement); - } else { - m_animTimer->stop(); - m_mask->setOpacity(MaxOpacity); - } - } else { - if (m_mask->opacity() + m_animIncrement > 0) { - m_mask->setOpacity(m_mask->opacity() + m_animIncrement); - } else { - m_animTimer->stop(); - m_mask->setOpacity(0); - popContext(); - emit contextPathChanged(m_path); - } - } - -} - -void SubcomponentEditorTool::clear() -{ - m_currentContext.clear(); - m_mask->setCurrentItem(0); - m_animTimer->stop(); - m_mask->hide(); - m_path.clear(); - - emit contextPathChanged(m_path); - emit cleared(); -} - -void SubcomponentEditorTool::selectedItemsChanged(const QList<QGraphicsItem*> &/*itemList*/) -{ - -} - -void SubcomponentEditorTool::setCurrentItem(QGraphicsItem* contextItem) -{ - if (!contextItem) - return; - - QGraphicsObject *gfxObject = contextItem->toGraphicsObject(); - if (!gfxObject) - return; - - //QString parentClassName = gfxObject->metaObject()->className(); - //if (parentClassName.contains(QRegExp("_QMLTYPE_\\d+"))) - - bool containsSelectableItems = false; - foreach (QGraphicsItem *item, gfxObject->childItems()) { - if (item->type() == Constants::EditorItemType - || item->type() == Constants::ResizeHandleItemType) - { - continue; - } - containsSelectableItems = true; - break; - } - - if (containsSelectableItems) { - m_mask->setCurrentItem(gfxObject); - m_mask->setOpacity(0); - m_mask->show(); - m_animIncrement = 0.05f; - m_animTimer->start(); - - QDeclarativeViewObserverPrivate::get(observer())->clearHighlight(); - observer()->setSelectedItems(QList<QGraphicsItem*>()); - - pushContext(gfxObject); - } -} - -QGraphicsItem *SubcomponentEditorTool::firstChildOfContext(QGraphicsItem *item) const -{ - if (!item) - return 0; - - if (isDirectChildOfContext(item)) - return item; - - QGraphicsItem *parent = item->parentItem(); - while (parent) { - if (isDirectChildOfContext(parent)) - return parent; - parent = parent->parentItem(); - } - - return 0; -} - -bool SubcomponentEditorTool::isChildOfContext(QGraphicsItem *item) const -{ - return (firstChildOfContext(item) != 0); -} - -bool SubcomponentEditorTool::isDirectChildOfContext(QGraphicsItem *item) const -{ - return (item->parentItem() == m_currentContext.top()); -} - -bool SubcomponentEditorTool::itemIsChildOfQmlSubComponent(QGraphicsItem *item) const -{ - if (item->parentItem() && item->parentItem() != m_currentContext.top()) { - QGraphicsObject *parent = item->parentItem()->toGraphicsObject(); - QString parentClassName = QLatin1String(parent->metaObject()->className()); - - if (parentClassName.contains(QRegExp(QLatin1String("_QMLTYPE_\\d+")))) { - return true; - } else { - return itemIsChildOfQmlSubComponent(parent); - } - } - - return false; -} - -void SubcomponentEditorTool::pushContext(QGraphicsObject *contextItem) -{ - connect(contextItem, SIGNAL(destroyed(QObject*)), this, SLOT(contextDestroyed(QObject*))); - connect(contextItem, SIGNAL(xChanged()), this, SLOT(resizeMask())); - connect(contextItem, SIGNAL(yChanged()), this, SLOT(resizeMask())); - connect(contextItem, SIGNAL(widthChanged()), this, SLOT(resizeMask())); - connect(contextItem, SIGNAL(heightChanged()), this, SLOT(resizeMask())); - connect(contextItem, SIGNAL(rotationChanged()), this, SLOT(resizeMask())); - - m_currentContext.push(contextItem); - QString title = titleForItem(contextItem); - emit contextPushed(title); - - m_path << title; - emit contextPathChanged(m_path); -} - -void SubcomponentEditorTool::aboutToPopContext() -{ - if (m_currentContext.size() > 2) { - popContext(); - emit contextPathChanged(m_path); - } else { - m_animIncrement = -0.05f; - m_animTimer->start(); - } -} - -QGraphicsObject *SubcomponentEditorTool::popContext() -{ - QGraphicsObject *popped = m_currentContext.pop(); - m_path.removeLast(); - - emit contextPopped(); - - disconnect(popped, SIGNAL(xChanged()), this, SLOT(resizeMask())); - disconnect(popped, SIGNAL(yChanged()), this, SLOT(resizeMask())); - disconnect(popped, SIGNAL(scaleChanged()), this, SLOT(resizeMask())); - disconnect(popped, SIGNAL(widthChanged()), this, SLOT(resizeMask())); - disconnect(popped, SIGNAL(heightChanged()), this, SLOT(resizeMask())); - - if (m_currentContext.size() > 1) { - QGraphicsObject *item = m_currentContext.top(); - m_mask->setCurrentItem(item); - m_mask->setOpacity(MaxOpacity); - m_mask->setVisible(true); - } else { - m_mask->setVisible(false); - } - - return popped; -} - -void SubcomponentEditorTool::resizeMask() -{ - QGraphicsObject *item = m_currentContext.top(); - m_mask->setCurrentItem(item); -} - -QGraphicsObject *SubcomponentEditorTool::currentRootItem() const -{ - return m_currentContext.top(); -} - -void SubcomponentEditorTool::contextDestroyed(QObject *contextToDestroy) -{ - disconnect(contextToDestroy, SIGNAL(destroyed(QObject*)), - this, SLOT(contextDestroyed(QObject*))); - - // pop out the whole context - it might not be safe anymore. - while (m_currentContext.size() > 1) { - m_currentContext.pop(); - m_path.removeLast(); - emit contextPopped(); - } - m_mask->setVisible(false); - - emit contextPathChanged(m_path); -} - -QGraphicsObject *SubcomponentEditorTool::setContext(int contextIndex) -{ - Q_ASSERT(contextIndex >= 0); - - // sometimes we have to delete the context while user was still clicking around, - // so just bail out. - if (contextIndex >= m_currentContext.size() -1) - return 0; - - while (m_currentContext.size() - 1 > contextIndex) { - popContext(); - } - emit contextPathChanged(m_path); - - return m_currentContext.top(); -} - -int SubcomponentEditorTool::contextIndex() const -{ - return m_currentContext.size() - 1; -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool_p.h b/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool_p.h deleted file mode 100644 index 29b2956..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool_p.h +++ /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 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 SUBCOMPONENTEDITORTOOL_H -#define SUBCOMPONENTEDITORTOOL_H - -#include "abstractliveedittool_p.h" - -#include <QtCore/QStack> -#include <QtCore/QStringList> - -QT_FORWARD_DECLARE_CLASS(QGraphicsObject) -QT_FORWARD_DECLARE_CLASS(QPoint) -QT_FORWARD_DECLARE_CLASS(QTimer) - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class SubcomponentMaskLayerItem; - -class SubcomponentEditorTool : public AbstractLiveEditTool -{ - Q_OBJECT - -public: - SubcomponentEditorTool(QDeclarativeViewObserver *view); - ~SubcomponentEditorTool(); - - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - - void hoverMoveEvent(QMouseEvent *event); - void wheelEvent(QWheelEvent *event); - - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *keyEvent); - void itemsAboutToRemoved(const QList<QGraphicsItem*> &itemList); - - void clear(); - - bool containsCursor(const QPoint &mousePos) const; - bool itemIsChildOfQmlSubComponent(QGraphicsItem *item) const; - - bool isChildOfContext(QGraphicsItem *item) const; - bool isDirectChildOfContext(QGraphicsItem *item) const; - QGraphicsItem *firstChildOfContext(QGraphicsItem *item) const; - - void setCurrentItem(QGraphicsItem *contextObject); - - void pushContext(QGraphicsObject *contextItem); - - QGraphicsObject *currentRootItem() const; - QGraphicsObject *setContext(int contextIndex); - int contextIndex() const; - -signals: - void exitContextRequested(); - void cleared(); - void contextPushed(const QString &contextTitle); - void contextPopped(); - void contextPathChanged(const QStringList &path); - -protected: - void selectedItemsChanged(const QList<QGraphicsItem*> &itemList); - -private slots: - void animate(); - void contextDestroyed(QObject *context); - void resizeMask(); - -private: - QGraphicsObject *popContext(); - void aboutToPopContext(); - -private: - QStack<QGraphicsObject *> m_currentContext; - QStringList m_path; - - qreal m_animIncrement; - SubcomponentMaskLayerItem *m_mask; - QTimer *m_animTimer; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // SUBCOMPONENTEDITORTOOL_H diff --git a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp index c2ea17c..36e6ba0 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "abstractliveedittool_p.h" -#include "../qdeclarativeviewobserver_p_p.h" +#include "../qdeclarativeviewinspector_p_p.h" #include <QDeclarativeEngine> @@ -50,8 +50,8 @@ QT_BEGIN_NAMESPACE -AbstractLiveEditTool::AbstractLiveEditTool(QDeclarativeViewObserver *editorView) - : QObject(editorView), m_observer(editorView) +AbstractLiveEditTool::AbstractLiveEditTool(QDeclarativeViewInspector *editorView) + : QObject(editorView), m_inspector(editorView) { } @@ -60,14 +60,14 @@ AbstractLiveEditTool::~AbstractLiveEditTool() { } -QDeclarativeViewObserver *AbstractLiveEditTool::observer() const +QDeclarativeViewInspector *AbstractLiveEditTool::inspector() const { - return m_observer; + return m_inspector; } QDeclarativeView *AbstractLiveEditTool::view() const { - return m_observer->declarativeView(); + return m_inspector->declarativeView(); } QGraphicsScene* AbstractLiveEditTool::scene() const @@ -82,12 +82,7 @@ void AbstractLiveEditTool::updateSelectedItems() QList<QGraphicsItem*> AbstractLiveEditTool::items() const { - return observer()->selectedItems(); -} - -void AbstractLiveEditTool::enterContext(QGraphicsItem *itemToEnter) -{ - observer()->data->enterContext(itemToEnter); + return inspector()->selectedItems(); } bool AbstractLiveEditTool::topItemIsMovable(const QList<QGraphicsItem*> & itemList) @@ -104,7 +99,7 @@ bool AbstractLiveEditTool::topItemIsMovable(const QList<QGraphicsItem*> & itemLi bool AbstractLiveEditTool::topSelectedItemIsMovable(const QList<QGraphicsItem*> &itemList) { - QList<QGraphicsItem*> selectedItems = observer()->selectedItems(); + QList<QGraphicsItem*> selectedItems = inspector()->selectedItems(); foreach (QGraphicsItem *item, itemList) { QDeclarativeItem *declarativeItem = toQDeclarativeItem(item); @@ -180,7 +175,7 @@ QString AbstractLiveEditTool::titleForItem(QGraphicsItem *item) QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(gfxObject); if (declarativeItem) { - objectStringId = m_observer->idStringForObject(declarativeItem); + objectStringId = m_inspector->idStringForObject(declarativeItem); } if (!objectStringId.isEmpty()) { diff --git a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool_p.h index 7d46db6..17eb6ea 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool_p.h @@ -62,13 +62,13 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QDeclarativeViewObserver; +class QDeclarativeViewInspector; class AbstractLiveEditTool : public QObject { Q_OBJECT public: - AbstractLiveEditTool(QDeclarativeViewObserver *observer); + AbstractLiveEditTool(QDeclarativeViewInspector *inspector); virtual ~AbstractLiveEditTool(); @@ -89,8 +89,6 @@ public: void updateSelectedItems(); QList<QGraphicsItem*> items() const; - void enterContext(QGraphicsItem *itemToEnter); - bool topItemIsMovable(const QList<QGraphicsItem*> &itemList); bool topItemIsResizeHandle(const QList<QGraphicsItem*> &itemList); bool topSelectedItemIsMovable(const QList<QGraphicsItem*> &itemList); @@ -105,12 +103,12 @@ public: protected: virtual void selectedItemsChanged(const QList<QGraphicsItem*> &objectList) = 0; - QDeclarativeViewObserver *observer() const; + QDeclarativeViewInspector *inspector() const; QDeclarativeView *view() const; QGraphicsScene *scene() const; private: - QDeclarativeViewObserver *m_observer; + QDeclarativeViewInspector *m_inspector; QList<QGraphicsItem*> m_itemList; }; diff --git a/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp index 068f6de..3f95005 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp @@ -41,8 +41,8 @@ #include "boundingrecthighlighter_p.h" -#include "../qdeclarativeviewobserver_p.h" -#include "../qmlobserverconstants_p.h" +#include "../qdeclarativeviewinspector_p.h" +#include "../qmlinspectorconstants_p.h" #include <QtGui/QGraphicsPolygonItem> @@ -52,10 +52,6 @@ QT_BEGIN_NAMESPACE -const qreal AnimDelta = 0.025f; -const int AnimInterval = 30; -const int AnimFrames = 10; - BoundingBox::BoundingBox(QGraphicsObject *itemToHighlight, QGraphicsItem *parentItem, QObject *parent) : QObject(parent), @@ -91,14 +87,10 @@ int BoundingBoxPolygonItem::type() const return Constants::EditorItemType; } -BoundingRectHighlighter::BoundingRectHighlighter(QDeclarativeViewObserver *view) : +BoundingRectHighlighter::BoundingRectHighlighter(QDeclarativeViewInspector *view) : LiveLayerItem(view->declarativeView()->scene()), - m_view(view), - m_animFrame(0) + m_view(view) { - m_animTimer = new QTimer(this); - m_animTimer->setInterval(AnimInterval); - connect(m_animTimer, SIGNAL(timeout()), SLOT(animTimeout())); } BoundingRectHighlighter::~BoundingRectHighlighter() @@ -106,37 +98,17 @@ BoundingRectHighlighter::~BoundingRectHighlighter() } -void BoundingRectHighlighter::animTimeout() -{ - ++m_animFrame; - if (m_animFrame == AnimFrames) { - m_animTimer->stop(); - } - - qreal alpha = m_animFrame / float(AnimFrames); - - foreach (BoundingBox *box, m_boxes) { - box->highlightPolygonEdge->setOpacity(alpha); - } -} - void BoundingRectHighlighter::clear() { - if (m_boxes.length()) { - m_animTimer->stop(); - - foreach (BoundingBox *box, m_boxes) { - freeBoundingBox(box); - } - } + foreach (BoundingBox *box, m_boxes) + freeBoundingBox(box); } BoundingBox *BoundingRectHighlighter::boxFor(QGraphicsObject *item) const { foreach (BoundingBox *box, m_boxes) { - if (box->highlightedObject.data() == item) { + if (box->highlightedObject.data() == item) return box; - } } return 0; } @@ -146,15 +118,11 @@ void BoundingRectHighlighter::highlight(QList<QGraphicsObject*> items) if (items.isEmpty()) return; - bool animate = false; - QList<BoundingBox *> newBoxes; foreach (QGraphicsObject *itemToHighlight, items) { BoundingBox *box = boxFor(itemToHighlight); - if (!box) { + if (!box) box = createBoundingBox(itemToHighlight); - animate = true; - } newBoxes << box; } @@ -165,7 +133,7 @@ void BoundingRectHighlighter::highlight(QList<QGraphicsObject*> items) m_boxes << newBoxes; } - highlightAll(animate); + highlightAll(); } void BoundingRectHighlighter::highlight(QGraphicsObject* itemToHighlight) @@ -173,17 +141,14 @@ void BoundingRectHighlighter::highlight(QGraphicsObject* itemToHighlight) if (!itemToHighlight) return; - bool animate = false; - BoundingBox *box = boxFor(itemToHighlight); if (!box) { box = createBoundingBox(itemToHighlight); m_boxes << box; - animate = true; qSort(m_boxes); } - highlightAll(animate); + highlightAll(); } BoundingBox *BoundingRectHighlighter::createBoundingBox(QGraphicsObject *itemToHighlight) @@ -244,7 +209,7 @@ void BoundingRectHighlighter::itemDestroyed(QObject *obj) } } -void BoundingRectHighlighter::highlightAll(bool animate) +void BoundingRectHighlighter::highlightAll() { foreach (BoundingBox *box, m_boxes) { if (box && box->highlightedObject.isNull()) { @@ -253,32 +218,22 @@ void BoundingRectHighlighter::highlightAll(bool animate) return; } QGraphicsObject *item = box->highlightedObject.data(); - QRectF itemAndChildRect = item->boundingRect() | item->childrenBoundingRect(); - QPolygonF boundingRectInSceneSpace(item->mapToScene(itemAndChildRect)); - QPolygonF boundingRectInLayerItemSpace = mapFromScene(boundingRectInSceneSpace); - QRectF bboxRect - = m_view->adjustToScreenBoundaries(boundingRectInLayerItemSpace.boundingRect()); + QRectF boundingRectInSceneSpace(item->mapToScene(item->boundingRect()).boundingRect()); + QRectF boundingRectInLayerItemSpace = mapRectFromScene(boundingRectInSceneSpace); + QRectF bboxRect = m_view->adjustToScreenBoundaries(boundingRectInLayerItemSpace); QRectF edgeRect = bboxRect; edgeRect.adjust(-1, -1, 1, 1); box->highlightPolygon->setPolygon(QPolygonF(bboxRect)); box->highlightPolygonEdge->setPolygon(QPolygonF(edgeRect)); - - if (animate) - box->highlightPolygonEdge->setOpacity(0); - } - - if (animate) { - m_animFrame = 0; - m_animTimer->start(); } } void BoundingRectHighlighter::refresh() { if (!m_boxes.isEmpty()) - highlightAll(true); + highlightAll(); } QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter_p.h index ab7e595..e2928f7 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter_p.h @@ -59,14 +59,14 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QDeclarativeViewObserver; +class QDeclarativeViewInspector; class BoundingBox; class BoundingRectHighlighter : public LiveLayerItem { Q_OBJECT public: - explicit BoundingRectHighlighter(QDeclarativeViewObserver *view); + explicit BoundingRectHighlighter(QDeclarativeViewInspector *view); ~BoundingRectHighlighter(); void clear(); void highlight(QList<QGraphicsObject*> items); @@ -74,12 +74,11 @@ public: private slots: void refresh(); - void animTimeout(); void itemDestroyed(QObject *); private: BoundingBox *boxFor(QGraphicsObject *item) const; - void highlightAll(bool animate); + void highlightAll(); BoundingBox *createBoundingBox(QGraphicsObject *itemToHighlight); void removeBoundingBox(BoundingBox *box); void freeBoundingBox(BoundingBox *box); @@ -87,13 +86,9 @@ private: private: Q_DISABLE_COPY(BoundingRectHighlighter) - QDeclarativeViewObserver *m_view; + QDeclarativeViewInspector *m_view; QList<BoundingBox* > m_boxes; QList<BoundingBox* > m_freeBoxes; - QTimer *m_animTimer; - qreal m_animScale; - int m_animFrame; - }; class BoundingBox : public QObject diff --git a/src/plugins/qmltooling/declarativeobserver/editor/colorpickertool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp index 50d724e..bdae3d8 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/colorpickertool.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp @@ -41,7 +41,7 @@ #include "colorpickertool_p.h" -#include "../qdeclarativeviewobserver_p.h" +#include "../qdeclarativeviewinspector_p.h" #include <QtGui/QMouseEvent> #include <QtGui/QKeyEvent> @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE -ColorPickerTool::ColorPickerTool(QDeclarativeViewObserver *view) : +ColorPickerTool::ColorPickerTool(QDeclarativeViewInspector *view) : AbstractLiveEditTool(view) { m_selectedColor.setRgb(0,0,0); diff --git a/src/plugins/qmltooling/declarativeobserver/editor/colorpickertool_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool_p.h index b955eee..580c175 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/colorpickertool_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool_p.h @@ -58,7 +58,7 @@ class ColorPickerTool : public AbstractLiveEditTool { Q_OBJECT public: - explicit ColorPickerTool(QDeclarativeViewObserver *view); + explicit ColorPickerTool(QDeclarativeViewInspector *view); virtual ~ColorPickerTool(); diff --git a/src/plugins/qmltooling/declarativeobserver/editor/editor.qrc b/src/plugins/qmltooling/qmldbg_inspector/editor/editor.qrc index 77744d5..fb2393c 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/editor.qrc +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/editor.qrc @@ -18,7 +18,7 @@ <file>images/zoom-24.png</file> <file>images/select-24.png</file> <file>images/select-marquee-24.png</file> - <file>images/observermode.png</file> - <file>images/observermode-24.png</file> + <file>images/inspectormode.png</file> + <file>images/inspectormode-24.png</file> </qresource> </RCC> diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/color-picker-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-24.png Binary files differindex cff4721..cff4721 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/color-picker-24.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-24.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/color-picker-hicontrast.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-hicontrast.png Binary files differindex b953d08..b953d08 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/color-picker-hicontrast.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-hicontrast.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/color-picker.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker.png Binary files differindex 026c31b..026c31b 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/color-picker.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/from-qml-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml-24.png Binary files differindex 0ad21f3..0ad21f3 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/from-qml-24.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml-24.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/from-qml.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml.png Binary files differindex 666382c..666382c 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/from-qml.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/observermode-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode-24.png Binary files differindex 5e74d86..5e74d86 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/observermode-24.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode-24.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/observermode.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode.png Binary files differindex daed21c..daed21c 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/observermode.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/pause-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause-24.png Binary files differindex d9a2f6f..d9a2f6f 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/pause-24.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause-24.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/pause.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause.png Binary files differindex 114d89b..114d89b 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/pause.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/play-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/play-24.png Binary files differindex e2b9fbc..e2b9fbc 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/play-24.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/play-24.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/play.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/play.png Binary files differindex 011598a..011598a 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/play.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/play.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/reload.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/reload.png Binary files differindex 7042bec..7042bec 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/reload.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/reload.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/resize_handle.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/resize_handle.png Binary files differindex 2934f25..2934f25 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/resize_handle.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/resize_handle.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/select-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-24.png Binary files differindex 5388a9d..5388a9d 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/select-24.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-24.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/select-marquee-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee-24.png Binary files differindex 0111dda..0111dda 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/select-marquee-24.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee-24.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/select-marquee.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee.png Binary files differindex 92fe40d..92fe40d 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/select-marquee.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/select.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select.png Binary files differindex 6722855..6722855 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/select.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/to-qml-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml-24.png Binary files differindex b72450d..b72450d 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/to-qml-24.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml-24.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/to-qml.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml.png Binary files differindex 2ab951f..2ab951f 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/to-qml.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/zoom-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom-24.png Binary files differindex 0346200..0346200 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/zoom-24.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom-24.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/zoom.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom.png Binary files differindex 17f0da6..17f0da6 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/images/zoom.png +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom.png diff --git a/src/plugins/qmltooling/declarativeobserver/editor/livelayeritem.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp index 73cc5a0..c28893e 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/livelayeritem.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp @@ -41,7 +41,7 @@ #include "livelayeritem_p.h" -#include "../qmlobserverconstants_p.h" +#include "../qmlinspectorconstants_p.h" #include <QGraphicsScene> diff --git a/src/plugins/qmltooling/declarativeobserver/editor/livelayeritem_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem_p.h index da622e1..da622e1 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/livelayeritem_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem_p.h diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liverubberbandselectionmanipulator.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp index 18341de..d32847d 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/liverubberbandselectionmanipulator.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp @@ -41,7 +41,7 @@ #include "liverubberbandselectionmanipulator_p.h" -#include "../qdeclarativeviewobserver_p_p.h" +#include "../qdeclarativeviewinspector_p_p.h" #include <QtGui/QGraphicsItem> @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE LiveRubberBandSelectionManipulator::LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem, - QDeclarativeViewObserver *editorView) + QDeclarativeViewInspector *editorView) : m_selectionRectangleElement(layerItem), m_editorView(editorView), m_beginFormEditorItem(0), @@ -83,9 +83,9 @@ void LiveRubberBandSelectionManipulator::begin(const QPointF &beginPoint) m_selectionRectangleElement.setRect(m_beginPoint, m_beginPoint); m_selectionRectangleElement.show(); m_isActive = true; - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(m_editorView); - m_beginFormEditorItem = topFormEditorItem(observerPrivate->selectableItems(beginPoint)); + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(m_editorView); + m_beginFormEditorItem = topFormEditorItem(inspectorPrivate->selectableItems(beginPoint)); m_oldSelectionList = m_editorView->selectedItems(); } @@ -103,10 +103,10 @@ void LiveRubberBandSelectionManipulator::end() void LiveRubberBandSelectionManipulator::select(SelectionType selectionType) { - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(m_editorView); + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(m_editorView); QList<QGraphicsItem*> itemList - = observerPrivate->selectableItems(m_selectionRectangleElement.rect(), + = inspectorPrivate->selectableItems(m_selectionRectangleElement.rect(), Qt::IntersectsItemShape); QList<QGraphicsItem*> newSelectionList; diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liverubberbandselectionmanipulator_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator_p.h index a71caa2..9abcb2b 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/liverubberbandselectionmanipulator_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator_p.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QDeclarativeViewObserver; +class QDeclarativeViewInspector; class LiveRubberBandSelectionManipulator { @@ -66,7 +66,7 @@ public: }; LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem, - QDeclarativeViewObserver *editorView); + QDeclarativeViewInspector *editorView); void setItems(const QList<QGraphicsItem*> &itemList); @@ -90,7 +90,7 @@ private: QList<QGraphicsItem*> m_oldSelectionList; LiveSelectionRectangle m_selectionRectangleElement; QPointF m_beginPoint; - QDeclarativeViewObserver *m_editorView; + QDeclarativeViewInspector *m_editorView; QGraphicsItem *m_beginFormEditorItem; bool m_isActive; }; diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp index 2752957..4450fc5 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp @@ -41,8 +41,8 @@ #include "liveselectionindicator_p.h" -#include "../qdeclarativeviewobserver_p_p.h" -#include "../qmlobserverconstants_p.h" +#include "../qdeclarativeviewinspector_p_p.h" +#include "../qmlinspectorconstants_p.h" #include <QtGui/QGraphicsRectItem> #include <QtGui/QGraphicsObject> @@ -51,10 +51,10 @@ QT_BEGIN_NAMESPACE -LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewObserver *viewObserver, +LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector, QGraphicsObject *layerItem) : m_layerItem(layerItem) - , m_view(viewObserver) + , m_view(viewInspector) { } diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator_p.h index efd2c5f..fa6eb30 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator_p.h @@ -58,12 +58,12 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QDeclarativeViewObserver; +class QDeclarativeViewInspector; class LiveSelectionIndicator { public: - LiveSelectionIndicator(QDeclarativeViewObserver *viewObserver, QGraphicsObject *layerItem); + LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector, QGraphicsObject *layerItem); ~LiveSelectionIndicator(); void show(); @@ -76,7 +76,7 @@ public: private: QHash<QGraphicsItem*, QGraphicsRectItem *> m_indicatorShapeHash; QWeakPointer<QGraphicsObject> m_layerItem; - QDeclarativeViewObserver *m_view; + QDeclarativeViewInspector *m_view; }; QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionrectangle.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp index 6da1d6f..267079a 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionrectangle.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp @@ -41,7 +41,7 @@ #include "liveselectionrectangle_p.h" -#include "../qmlobserverconstants_p.h" +#include "../qmlinspectorconstants_p.h" #include <QtGui/QPen> #include <QtGui/QGraphicsRectItem> diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionrectangle_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle_p.h index 5da9fb8..5da9fb8 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionrectangle_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle_p.h diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp index 62b6e01..c55cba3 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp @@ -42,7 +42,7 @@ #include "liveselectiontool_p.h" #include "livelayeritem_p.h" -#include "../qdeclarativeviewobserver_p_p.h" +#include "../qdeclarativeviewinspector_p_p.h" #include <QtGui/QApplication> #include <QtGui/QWheelEvent> @@ -59,14 +59,14 @@ QT_BEGIN_NAMESPACE -LiveSelectionTool::LiveSelectionTool(QDeclarativeViewObserver *editorView) : +LiveSelectionTool::LiveSelectionTool(QDeclarativeViewInspector *editorView) : AbstractLiveEditTool(editorView), m_rubberbandSelectionMode(false), m_rubberbandSelectionManipulator( - QDeclarativeViewObserverPrivate::get(editorView)->manipulatorLayer, editorView), + QDeclarativeViewInspectorPrivate::get(editorView)->manipulatorLayer, editorView), m_singleSelectionManipulator(editorView), m_selectionIndicator(editorView, - QDeclarativeViewObserverPrivate::get(editorView)->manipulatorLayer), + QDeclarativeViewInspectorPrivate::get(editorView)->manipulatorLayer), //m_resizeIndicator(editorView->manipulatorLayer()), m_selectOnlyContentItems(true) { @@ -97,9 +97,9 @@ LiveSingleSelectionManipulator::SelectionType LiveSelectionTool::getSelectionTyp bool LiveSelectionTool::alreadySelected(const QList<QGraphicsItem*> &itemList) const { - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(observer()); - const QList<QGraphicsItem*> selectedItems = observerPrivate->selectedItems(); + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(inspector()); + const QList<QGraphicsItem*> selectedItems = inspectorPrivate->selectedItems(); if (selectedItems.isEmpty()) return false; @@ -113,9 +113,9 @@ bool LiveSelectionTool::alreadySelected(const QList<QGraphicsItem*> &itemList) c void LiveSelectionTool::mousePressEvent(QMouseEvent *event) { - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(observer()); - QList<QGraphicsItem*> itemList = observerPrivate->selectableItems(event->pos()); + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(inspector()); + QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(event->pos()); LiveSingleSelectionManipulator::SelectionType selectionType = getSelectionType(event->modifiers()); if (event->buttons() & Qt::LeftButton) { @@ -134,9 +134,6 @@ void LiveSelectionTool::mousePressEvent(QMouseEvent *event) void LiveSelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint globalPos) { - if (!QDeclarativeViewObserverPrivate::get(observer())->mouseInsideContextItem()) - return; - QMenu contextMenu; connect(&contextMenu, SIGNAL(hovered(QAction*)), this, SLOT(contextMenuElementHovered(QAction*))); @@ -154,7 +151,7 @@ void LiveSelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint QAction *elementAction = contextMenu.addAction(itemTitle, this, SLOT(contextMenuElementSelected())); - if (observer()->selectedItems().contains(item)) { + if (inspector()->selectedItems().contains(item)) { QFont boldFont = elementAction->font(); boldFont.setBold(true); elementAction->setFont(boldFont); @@ -192,7 +189,6 @@ void LiveSelectionTool::contextMenuElementSelected() QList<QGraphicsItem*>() << item, false); m_singleSelectionManipulator.end(updatePt); - enterContext(item); } } @@ -201,7 +197,7 @@ void LiveSelectionTool::contextMenuElementHovered(QAction *action) int itemListIndex = action->data().toInt(); if (itemListIndex >= 0 && itemListIndex < m_contextMenuItemList.length()) { QGraphicsObject *item = m_contextMenuItemList.at(itemListIndex)->toGraphicsObject(); - QDeclarativeViewObserverPrivate::get(observer())->highlight(item); + QDeclarativeViewInspectorPrivate::get(inspector())->highlight(item); } } @@ -254,19 +250,19 @@ void LiveSelectionTool::hoverMoveEvent(QMouseEvent * event) // if (topSelectedItemIsMovable(itemList)) // view()->changeTool(Constants::MoveToolMode); // } - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(observer()); + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(inspector()); - QList<QGraphicsItem*> selectableItemList = observerPrivate->selectableItems(event->pos()); + QList<QGraphicsItem*> selectableItemList = inspectorPrivate->selectableItems(event->pos()); if (!selectableItemList.isEmpty()) { QGraphicsObject *item = selectableItemList.first()->toGraphicsObject(); if (item) - QDeclarativeViewObserverPrivate::get(observer())->highlight(item); + QDeclarativeViewInspectorPrivate::get(inspector())->highlight(item); return; } - QDeclarativeViewObserverPrivate::get(observer())->clearHighlight(); + QDeclarativeViewInspectorPrivate::get(inspector())->clearHighlight(); } void LiveSelectionTool::mouseReleaseEvent(QMouseEvent *event) @@ -337,16 +333,16 @@ void LiveSelectionTool::wheelEvent(QWheelEvent *event) if (event->orientation() == Qt::Horizontal || m_rubberbandSelectionMode) return; - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(observer()); - QList<QGraphicsItem*> itemList = observerPrivate->selectableItems(event->pos()); + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(inspector()); + QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(event->pos()); if (itemList.isEmpty()) return; int selectedIdx = 0; - if (!observer()->selectedItems().isEmpty()) { - selectedIdx = itemList.indexOf(observer()->selectedItems().first()); + if (!inspector()->selectedItems().isEmpty()) { + selectedIdx = itemList.indexOf(inspector()->selectedItems().first()); if (selectedIdx >= 0) { if (event->delta() > 0) { selectedIdx++; diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool_p.h index 4ecf9f6..7562f3e 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool_p.h @@ -66,7 +66,7 @@ class LiveSelectionTool : public AbstractLiveEditTool Q_OBJECT public: - LiveSelectionTool(QDeclarativeViewObserver* editorView); + LiveSelectionTool(QDeclarativeViewInspector* editorView); ~LiveSelectionTool(); void mousePressEvent(QMouseEvent *event); diff --git a/src/plugins/qmltooling/declarativeobserver/editor/livesingleselectionmanipulator.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp index 1ffd7a9..ee9843b 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/livesingleselectionmanipulator.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp @@ -41,13 +41,13 @@ #include "livesingleselectionmanipulator_p.h" -#include "../qdeclarativeviewobserver_p_p.h" +#include "../qdeclarativeviewinspector_p_p.h" #include <QtDebug> QT_BEGIN_NAMESPACE -LiveSingleSelectionManipulator::LiveSingleSelectionManipulator(QDeclarativeViewObserver *editorView) +LiveSingleSelectionManipulator::LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView) : m_editorView(editorView), m_isActive(false) { @@ -58,7 +58,7 @@ void LiveSingleSelectionManipulator::begin(const QPointF &beginPoint) { m_beginPoint = beginPoint; m_isActive = true; - m_oldSelectionList = QDeclarativeViewObserverPrivate::get(m_editorView)->selectedItems(); + m_oldSelectionList = QDeclarativeViewInspectorPrivate::get(m_editorView)->selectedItems(); } void LiveSingleSelectionManipulator::update(const QPointF &/*updatePoint*/) @@ -131,9 +131,9 @@ void LiveSingleSelectionManipulator::select(SelectionType selectionType, void LiveSingleSelectionManipulator::select(SelectionType selectionType, bool selectOnlyContentItems) { - QDeclarativeViewObserverPrivate *observerPrivate = - QDeclarativeViewObserverPrivate::get(m_editorView); - QList<QGraphicsItem*> itemList = observerPrivate->selectableItems(m_beginPoint); + QDeclarativeViewInspectorPrivate *inspectorPrivate = + QDeclarativeViewInspectorPrivate::get(m_editorView); + QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(m_beginPoint); select(selectionType, itemList, selectOnlyContentItems); } diff --git a/src/plugins/qmltooling/declarativeobserver/editor/livesingleselectionmanipulator_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator_p.h index ea0406b..40b5fc0 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/livesingleselectionmanipulator_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator_p.h @@ -53,12 +53,12 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QDeclarativeViewObserver; +class QDeclarativeViewInspector; class LiveSingleSelectionManipulator { public: - LiveSingleSelectionManipulator(QDeclarativeViewObserver *editorView); + LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView); enum SelectionType { ReplaceSelection, @@ -84,7 +84,7 @@ public: private: QList<QGraphicsItem*> m_oldSelectionList; QPointF m_beginPoint; - QDeclarativeViewObserver *m_editorView; + QDeclarativeViewInspector *m_editorView; bool m_isActive; }; diff --git a/src/plugins/qmltooling/declarativeobserver/editor/qmltoolbar.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp index 9ad5b24..0a72674 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/qmltoolbar.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp @@ -61,8 +61,8 @@ QmlToolBar::QmlToolBar(QWidget *parent) ui->playIcon = QIcon(QLatin1String(":/qml/images/play-24.png")); ui->pauseIcon = QIcon(QLatin1String(":/qml/images/pause-24.png")); - ui->designmode = new QAction(QIcon(QLatin1String(":/qml/images/observermode-24.png")), - tr("Observer Mode"), this); + ui->designmode = new QAction(QIcon(QLatin1String(":/qml/images/inspectormode-24.png")), + tr("Inspector Mode"), this); ui->play = new QAction(ui->pauseIcon, tr("Play/Pause Animations"), this); ui->select = new QAction(QIcon(QLatin1String(":/qml/images/select-24.png")), tr("Select"), this); ui->selectMarquee = new QAction(QIcon(QLatin1String(":/qml/images/select-marquee-24.png")), diff --git a/src/plugins/qmltooling/declarativeobserver/editor/qmltoolbar_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar_p.h index a3da1f7..0401804 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/qmltoolbar_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar_p.h @@ -45,7 +45,7 @@ #include <QtGui/QToolBar> #include <QtGui/QIcon> -#include "../qmlobserverconstants_p.h" +#include "../qmlinspectorconstants_p.h" QT_FORWARD_DECLARE_CLASS(QActionGroup) diff --git a/src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp index 27e2079..2ed3179 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp @@ -41,17 +41,17 @@ #include "subcomponentmasklayeritem_p.h" -#include "../qmlobserverconstants_p.h" -#include "../qdeclarativeviewobserver_p.h" +#include "../qmlinspectorconstants_p.h" +#include "../qdeclarativeviewinspector_p.h" #include <QtGui/QPolygonF> QT_BEGIN_NAMESPACE -SubcomponentMaskLayerItem::SubcomponentMaskLayerItem(QDeclarativeViewObserver *observer, +SubcomponentMaskLayerItem::SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector, QGraphicsItem *parentItem) : QGraphicsPolygonItem(parentItem), - m_observer(observer), + m_inspector(inspector), m_currentItem(0), m_borderRect(new QGraphicsRectItem(this)) { @@ -102,8 +102,8 @@ void SubcomponentMaskLayerItem::setCurrentItem(QGraphicsItem *item) if (!m_currentItem) return; - QRect viewRect = m_observer->declarativeView()->rect(); - viewRect = m_observer->declarativeView()->mapToScene(viewRect).boundingRect().toRect(); + QRect viewRect = m_inspector->declarativeView()->rect(); + viewRect = m_inspector->declarativeView()->mapToScene(viewRect).boundingRect().toRect(); QRectF itemRect = item->boundingRect() | item->childrenBoundingRect(); itemRect = item->mapRectToScene(itemRect); diff --git a/src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem_p.h index 7a77253..07ce881 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem_p.h @@ -50,12 +50,12 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QDeclarativeViewObserver; +class QDeclarativeViewInspector; class SubcomponentMaskLayerItem : public QGraphicsPolygonItem { public: - explicit SubcomponentMaskLayerItem(QDeclarativeViewObserver *observer, + explicit SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector, QGraphicsItem *parentItem = 0); int type() const; void setCurrentItem(QGraphicsItem *item); @@ -64,7 +64,7 @@ public: QRectF itemRect() const; private: - QDeclarativeViewObserver *m_observer; + QDeclarativeViewInspector *m_inspector; QGraphicsItem *m_currentItem; QGraphicsRectItem *m_borderRect; QRectF m_itemPolyRect; diff --git a/src/plugins/qmltooling/declarativeobserver/editor/toolbarcolorbox.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp index d3a5a37..154ddf2 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/toolbarcolorbox.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp @@ -41,7 +41,7 @@ #include "toolbarcolorbox_p.h" -#include "../qmlobserverconstants_p.h" +#include "../qmlinspectorconstants_p.h" #include <QtGui/QPixmap> #include <QtGui/QPainter> diff --git a/src/plugins/qmltooling/declarativeobserver/editor/toolbarcolorbox_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox_p.h index c3e064c..c3e064c 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/toolbarcolorbox_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox_p.h diff --git a/src/plugins/qmltooling/declarativeobserver/editor/zoomtool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp index 68d67cc..969c9d5 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/zoomtool.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp @@ -41,7 +41,7 @@ #include "zoomtool_p.h" -#include "../qdeclarativeviewobserver_p_p.h" +#include "../qdeclarativeviewinspector_p_p.h" #include <QtGui/QMouseEvent> #include <QtGui/QWheelEvent> @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE -ZoomTool::ZoomTool(QDeclarativeViewObserver *view) : +ZoomTool::ZoomTool(QDeclarativeViewInspector *view) : AbstractLiveEditTool(view), m_rubberbandManipulator(), m_smoothZoomMultiplier(0.05f), @@ -67,7 +67,7 @@ ZoomTool::ZoomTool(QDeclarativeViewObserver *view) : m_zoomOutAction->setShortcut(QKeySequence(Qt::Key_Minus)); - LiveLayerItem *layerItem = QDeclarativeViewObserverPrivate::get(view)->manipulatorLayer; + LiveLayerItem *layerItem = QDeclarativeViewInspectorPrivate::get(view)->manipulatorLayer; QGraphicsObject *layerObject = reinterpret_cast<QGraphicsObject *>(layerItem); m_rubberbandManipulator = new LiveRubberBandSelectionManipulator(layerObject, view); diff --git a/src/plugins/qmltooling/declarativeobserver/editor/zoomtool_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool_p.h index ef5c2e6..14fa4d5 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/zoomtool_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool_p.h @@ -63,7 +63,7 @@ public: ZoomOut }; - explicit ZoomTool(QDeclarativeViewObserver *view); + explicit ZoomTool(QDeclarativeViewInspector *view); virtual ~ZoomTool(); diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverplugin.cpp b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp index a00bc6f..a266eb9 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverplugin.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp @@ -39,43 +39,43 @@ ** ****************************************************************************/ -#include "qdeclarativeobserverplugin.h" +#include "qdeclarativeinspectorplugin.h" -#include "qdeclarativeviewobserver_p.h" +#include "qdeclarativeviewinspector_p.h" #include <QtCore/qplugin.h> -#include <QtDeclarative/private/qdeclarativeobserverservice_p.h> +#include <QtDeclarative/private/qdeclarativeinspectorservice_p.h> QT_BEGIN_NAMESPACE -QDeclarativeObserverPlugin::QDeclarativeObserverPlugin() : - m_observer(0) +QDeclarativeInspectorPlugin::QDeclarativeInspectorPlugin() : + m_inspector(0) { } -QDeclarativeObserverPlugin::~QDeclarativeObserverPlugin() +QDeclarativeInspectorPlugin::~QDeclarativeInspectorPlugin() { - delete m_observer; + delete m_inspector; } -void QDeclarativeObserverPlugin::activate() +void QDeclarativeInspectorPlugin::activate() { - QDeclarativeObserverService *service = QDeclarativeObserverService::instance(); + QDeclarativeInspectorService *service = QDeclarativeInspectorService::instance(); QList<QDeclarativeView*> views = service->views(); if (views.isEmpty()) return; // TODO: Support multiple views QDeclarativeView *view = service->views().at(0); - m_observer = new QDeclarativeViewObserver(view, view); + m_inspector = new QDeclarativeViewInspector(view, view); } -void QDeclarativeObserverPlugin::deactivate() +void QDeclarativeInspectorPlugin::deactivate() { - delete m_observer; + delete m_inspector; } -Q_EXPORT_PLUGIN2(declarativeobserver, QDeclarativeObserverPlugin) +Q_EXPORT_PLUGIN2(declarativeinspector, QDeclarativeInspectorPlugin) QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverplugin.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h index 7bc7626..3e28643 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverplugin.h +++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h @@ -39,33 +39,33 @@ ** ****************************************************************************/ -#ifndef QDECLARATIVEOBSERVERPLUGIN_H -#define QDECLARATIVEOBSERVERPLUGIN_H +#ifndef QDECLARATIVEINSPECTORPLUGIN_H +#define QDECLARATIVEINSPECTORPLUGIN_H #include <QtCore/QPointer> -#include <QtDeclarative/private/qdeclarativeobserverinterface_p.h> +#include <QtDeclarative/private/qdeclarativeinspectorinterface_p.h> QT_BEGIN_NAMESPACE -class QDeclarativeViewObserver; +class QDeclarativeViewInspector; -class QDeclarativeObserverPlugin : public QObject, public QDeclarativeObserverInterface +class QDeclarativeInspectorPlugin : public QObject, public QDeclarativeInspectorInterface { Q_OBJECT - Q_DISABLE_COPY(QDeclarativeObserverPlugin) - Q_INTERFACES(QDeclarativeObserverInterface) + Q_DISABLE_COPY(QDeclarativeInspectorPlugin) + Q_INTERFACES(QDeclarativeInspectorInterface) public: - QDeclarativeObserverPlugin(); - ~QDeclarativeObserverPlugin(); + QDeclarativeInspectorPlugin(); + ~QDeclarativeInspectorPlugin(); void activate(); void deactivate(); private: - QPointer<QDeclarativeViewObserver> m_observer; + QPointer<QDeclarativeViewInspector> m_inspector; }; QT_END_NAMESPACE -#endif // QDECLARATIVEOBSERVERPLUGIN_H +#endif // QDECLARATIVEINSPECTORPLUGIN_H diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverprotocol.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h index 836163e..2878bc1 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverprotocol.h +++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QDECLARATIVEOBSERVERPROTOCOL_H -#define QDECLARATIVEOBSERVERPROTOCOL_H +#ifndef QDECLARATIVEINSPECTORPROTOCOL_H +#define QDECLARATIVEINSPECTORPROTOCOL_H #include <QtCore/QDebug> #include <QtCore/QMetaType> @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class ObserverProtocol : public QObject +class InspectorProtocol : public QObject { Q_OBJECT Q_ENUMS(Message Tool) @@ -65,7 +65,6 @@ public: ChangeTool = 1, ClearComponentCache = 2, ColorChanged = 3, - ContextPathUpdated = 4, CreateObject = 5, CurrentObjectsChanged = 6, DestroyObject = 7, @@ -75,7 +74,6 @@ public: Reloaded = 11, SetAnimationSpeed = 12, SetAnimationPaused = 18, - SetContextPathIdx = 13, SetCurrentObjects = 14, SetDesignMode = 15, ShowAppOnTop = 16, @@ -100,41 +98,41 @@ public: } }; -inline QDataStream & operator<< (QDataStream &stream, ObserverProtocol::Message message) +inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Message message) { return stream << static_cast<quint32>(message); } -inline QDataStream & operator>> (QDataStream &stream, ObserverProtocol::Message &message) +inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Message &message) { quint32 i; stream >> i; - message = static_cast<ObserverProtocol::Message>(i); + message = static_cast<InspectorProtocol::Message>(i); return stream; } -inline QDebug operator<< (QDebug dbg, ObserverProtocol::Message message) +inline QDebug operator<< (QDebug dbg, InspectorProtocol::Message message) { - dbg << ObserverProtocol::toString(message); + dbg << InspectorProtocol::toString(message); return dbg; } -inline QDataStream & operator<< (QDataStream &stream, ObserverProtocol::Tool tool) +inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Tool tool) { return stream << static_cast<quint32>(tool); } -inline QDataStream & operator>> (QDataStream &stream, ObserverProtocol::Tool &tool) +inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Tool &tool) { quint32 i; stream >> i; - tool = static_cast<ObserverProtocol::Tool>(i); + tool = static_cast<InspectorProtocol::Tool>(i); return stream; } -inline QDebug operator<< (QDebug dbg, ObserverProtocol::Tool tool) +inline QDebug operator<< (QDebug dbg, InspectorProtocol::Tool tool) { - dbg << ObserverProtocol::toString(tool); + dbg << InspectorProtocol::toString(tool); return dbg; } @@ -142,4 +140,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // QDECLARATIVEOBSERVERPROTOCOL_H +#endif // QDECLARATIVEINSPECTORPROTOCOL_H diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp index 5d2ab09..19bfdaa 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp @@ -39,19 +39,18 @@ ** ****************************************************************************/ -#include "QtDeclarative/private/qdeclarativeobserverservice_p.h" +#include "QtDeclarative/private/qdeclarativeinspectorservice_p.h" #include "QtDeclarative/private/qdeclarativedebughelper_p.h" -#include "qdeclarativeviewobserver_p.h" -#include "qdeclarativeviewobserver_p_p.h" -#include "qdeclarativeobserverprotocol.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/subcomponenteditortool_p.h" #include "editor/qmltoolbar_p.h" #include <QtDeclarative/QDeclarativeItem> @@ -91,7 +90,7 @@ private: ToolBox::ToolBox(QWidget *parent) : QWidget(parent, Qt::Tool) - , m_settings(QLatin1String("Nokia"), QLatin1String("QmlObserver"), this) + , m_settings(QLatin1String("Nokia"), QLatin1String("QmlInspector"), this) , m_toolBar(new QmlToolBar) { setWindowFlags((windowFlags() & ~Qt::WindowCloseButtonHint) | Qt::CustomizeWindowHint); @@ -111,7 +110,7 @@ ToolBox::~ToolBox() } -QDeclarativeViewObserverPrivate::QDeclarativeViewObserverPrivate(QDeclarativeViewObserver *q) : +QDeclarativeViewInspectorPrivate::QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *q) : q(q), designModeBehavior(false), showAppOnTop(false), @@ -121,14 +120,14 @@ QDeclarativeViewObserverPrivate::QDeclarativeViewObserverPrivate(QDeclarativeVie { } -QDeclarativeViewObserverPrivate::~QDeclarativeViewObserverPrivate() +QDeclarativeViewInspectorPrivate::~QDeclarativeViewInspectorPrivate() { } -QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, +QDeclarativeViewInspector::QDeclarativeViewInspector(QDeclarativeView *view, QObject *parent) : QObject(parent), - data(new QDeclarativeViewObserverPrivate(this)) + data(new QDeclarativeViewInspectorPrivate(this)) { initEditorResource(); @@ -138,7 +137,6 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, data->zoomTool = new ZoomTool(this); data->colorPickerTool = new ColorPickerTool(this); data->boundingRectHighlighter = new BoundingRectHighlighter(this); - data->subcomponentEditorTool = new SubcomponentEditorTool(this); data->currentTool = data->selectionTool; // to capture ChildRemoved event when viewport changes @@ -146,7 +144,7 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, data->setViewport(data->view->viewport()); - data->debugService = QDeclarativeObserverService::instance(); + data->debugService = QDeclarativeInspectorService::instance(); connect(data->debugService, SIGNAL(gotMessage(QByteArray)), this, SLOT(handleMessage(QByteArray))); @@ -158,31 +156,14 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)), this, SLOT(sendColorChanged(QColor))); - connect(data->subcomponentEditorTool, SIGNAL(cleared()), SIGNAL(inspectorContextCleared())); - connect(data->subcomponentEditorTool, SIGNAL(contextPushed(QString)), - SIGNAL(inspectorContextPushed(QString))); - connect(data->subcomponentEditorTool, SIGNAL(contextPopped()), - SIGNAL(inspectorContextPopped())); - connect(data->subcomponentEditorTool, SIGNAL(contextPathChanged(QStringList)), - this, SLOT(sendContextPathUpdated(QStringList))); - data->_q_changeToSingleSelectTool(); } -QDeclarativeViewObserver::~QDeclarativeViewObserver() -{ -} - -void QDeclarativeViewObserver::setObserverContext(int contextIndex) +QDeclarativeViewInspector::~QDeclarativeViewInspector() { - if (data->subcomponentEditorTool->contextIndex() != contextIndex) { - QGraphicsObject *object = data->subcomponentEditorTool->setContext(contextIndex); - if (object) - setSelectedItems(QList<QGraphicsItem*>() << object); - } } -void QDeclarativeViewObserverPrivate::_q_setToolBoxVisible(bool visible) +void QDeclarativeViewInspectorPrivate::_q_setToolBoxVisible(bool visible) { #if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR) if (!toolBox && visible) @@ -194,14 +175,13 @@ void QDeclarativeViewObserverPrivate::_q_setToolBoxVisible(bool visible) #endif } -void QDeclarativeViewObserverPrivate::_q_reloadView() +void QDeclarativeViewInspectorPrivate::_q_reloadView() { - subcomponentEditorTool->clear(); clearHighlight(); emit q->reloadRequested(); } -void QDeclarativeViewObserverPrivate::setViewport(QWidget *widget) +void QDeclarativeViewInspectorPrivate::setViewport(QWidget *widget) { if (viewport.data() == widget) return; @@ -217,13 +197,13 @@ void QDeclarativeViewObserverPrivate::setViewport(QWidget *widget) } } -void QDeclarativeViewObserverPrivate::clearEditorItems() +void QDeclarativeViewInspectorPrivate::clearEditorItems() { clearHighlight(); setSelectedItems(QList<QGraphicsItem*>()); } -bool QDeclarativeViewObserver::eventFilter(QObject *obj, QEvent *event) +bool QDeclarativeViewInspector::eventFilter(QObject *obj, QEvent *event) { if (obj == data->view) { // Event from view @@ -286,7 +266,7 @@ bool QDeclarativeViewObserver::eventFilter(QObject *obj, QEvent *event) return QObject::eventFilter(obj, event); } -bool QDeclarativeViewObserver::leaveEvent(QEvent * /*event*/) +bool QDeclarativeViewInspector::leaveEvent(QEvent * /*event*/) { if (!data->designModeBehavior) return false; @@ -294,7 +274,7 @@ bool QDeclarativeViewObserver::leaveEvent(QEvent * /*event*/) return true; } -bool QDeclarativeViewObserver::mousePressEvent(QMouseEvent *event) +bool QDeclarativeViewInspector::mousePressEvent(QMouseEvent *event) { if (!data->designModeBehavior) return false; @@ -303,7 +283,7 @@ bool QDeclarativeViewObserver::mousePressEvent(QMouseEvent *event) return true; } -bool QDeclarativeViewObserver::mouseMoveEvent(QMouseEvent *event) +bool QDeclarativeViewInspector::mouseMoveEvent(QMouseEvent *event) { if (!data->designModeBehavior) { data->clearEditorItems(); @@ -318,27 +298,24 @@ bool QDeclarativeViewObserver::mouseMoveEvent(QMouseEvent *event) declarativeView()->setToolTip(QString()); } if (event->buttons()) { - data->subcomponentEditorTool->mouseMoveEvent(event); data->currentTool->mouseMoveEvent(event); } else { - data->subcomponentEditorTool->hoverMoveEvent(event); data->currentTool->hoverMoveEvent(event); } return true; } -bool QDeclarativeViewObserver::mouseReleaseEvent(QMouseEvent *event) +bool QDeclarativeViewInspector::mouseReleaseEvent(QMouseEvent *event) { if (!data->designModeBehavior) return false; - data->subcomponentEditorTool->mouseReleaseEvent(event); data->cursorPos = event->pos(); data->currentTool->mouseReleaseEvent(event); return true; } -bool QDeclarativeViewObserver::keyPressEvent(QKeyEvent *event) +bool QDeclarativeViewInspector::keyPressEvent(QKeyEvent *event) { if (!data->designModeBehavior) return false; @@ -347,7 +324,7 @@ bool QDeclarativeViewObserver::keyPressEvent(QKeyEvent *event) return true; } -bool QDeclarativeViewObserver::keyReleaseEvent(QKeyEvent *event) +bool QDeclarativeViewInspector::keyReleaseEvent(QKeyEvent *event) { if (!data->designModeBehavior) return false; @@ -366,11 +343,6 @@ bool QDeclarativeViewObserver::keyReleaseEvent(QKeyEvent *event) case Qt::Key_Z: data->_q_changeToZoomTool(); break; - case Qt::Key_Enter: - case Qt::Key_Return: - if (!data->selectedItems().isEmpty()) - data->subcomponentEditorTool->setCurrentItem(data->selectedItems().first()); - break; case Qt::Key_Space: setAnimationPaused(!data->animationPaused); break; @@ -382,7 +354,7 @@ bool QDeclarativeViewObserver::keyReleaseEvent(QKeyEvent *event) return true; } -void QDeclarativeViewObserverPrivate::_q_createQmlObject(const QString &qml, QObject *parent, +void QDeclarativeViewInspectorPrivate::_q_createQmlObject(const QString &qml, QObject *parent, const QStringList &importList, const QString &filename) { @@ -410,7 +382,7 @@ void QDeclarativeViewObserverPrivate::_q_createQmlObject(const QString &qml, QOb } } -void QDeclarativeViewObserverPrivate::_q_reparentQmlObject(QObject *object, QObject *newParent) +void QDeclarativeViewInspectorPrivate::_q_reparentQmlObject(QObject *object, QObject *newParent) { if (!newParent) return; @@ -422,12 +394,12 @@ void QDeclarativeViewObserverPrivate::_q_reparentQmlObject(QObject *object, QObj item->setParentItem(newParentItem); } -void QDeclarativeViewObserverPrivate::_q_clearComponentCache() +void QDeclarativeViewInspectorPrivate::_q_clearComponentCache() { view->engine()->clearComponentCache(); } -void QDeclarativeViewObserverPrivate::_q_removeFromSelection(QObject *obj) +void QDeclarativeViewInspectorPrivate::_q_removeFromSelection(QObject *obj) { QList<QGraphicsItem*> items = selectedItems(); if (QGraphicsItem *item = qobject_cast<QGraphicsObject*>(obj)) @@ -435,45 +407,15 @@ void QDeclarativeViewObserverPrivate::_q_removeFromSelection(QObject *obj) setSelectedItems(items); } -QGraphicsItem *QDeclarativeViewObserverPrivate::currentRootItem() const -{ - return subcomponentEditorTool->currentRootItem(); -} - -bool QDeclarativeViewObserver::mouseDoubleClickEvent(QMouseEvent *event) +bool QDeclarativeViewInspector::mouseDoubleClickEvent(QMouseEvent * /*event*/) { if (!data->designModeBehavior) return false; - if (data->currentToolMode != Constants::SelectionToolMode - && data->currentToolMode != Constants::MarqueeSelectionToolMode) - return true; - - QGraphicsItem *itemToEnter = 0; - QList<QGraphicsItem*> itemList = data->view->items(event->pos()); - data->filterForSelection(itemList); - - if (data->selectedItems().isEmpty() && !itemList.isEmpty()) { - itemToEnter = itemList.first(); - } else if (!data->selectedItems().isEmpty() && !itemList.isEmpty()) { - itemToEnter = itemList.first(); - } - - if (itemToEnter) - itemToEnter = data->subcomponentEditorTool->firstChildOfContext(itemToEnter); - - data->subcomponentEditorTool->setCurrentItem(itemToEnter); - data->subcomponentEditorTool->mouseDoubleClickEvent(event); - - if ((event->buttons() & Qt::LeftButton) && itemToEnter) { - if (QGraphicsObject *objectToEnter = itemToEnter->toGraphicsObject()) - setSelectedItems(QList<QGraphicsItem*>() << objectToEnter); - } - return true; } -bool QDeclarativeViewObserver::wheelEvent(QWheelEvent *event) +bool QDeclarativeViewInspector::wheelEvent(QWheelEvent *event) { if (!data->designModeBehavior) return false; @@ -481,17 +423,7 @@ bool QDeclarativeViewObserver::wheelEvent(QWheelEvent *event) return true; } -void QDeclarativeViewObserverPrivate::enterContext(QGraphicsItem *itemToEnter) -{ - QGraphicsItem *itemUnderCurrentContext = itemToEnter; - if (itemUnderCurrentContext) - itemUnderCurrentContext = subcomponentEditorTool->firstChildOfContext(itemToEnter); - - if (itemUnderCurrentContext) - subcomponentEditorTool->setCurrentItem(itemToEnter); -} - -void QDeclarativeViewObserver::setDesignModeBehavior(bool value) +void QDeclarativeViewInspector::setDesignModeBehavior(bool value) { emit designModeBehaviorChanged(value); @@ -500,30 +432,22 @@ void QDeclarativeViewObserver::setDesignModeBehavior(bool value) sendDesignModeBehavior(value); data->designModeBehavior = value; - if (data->subcomponentEditorTool) { - data->subcomponentEditorTool->clear(); - data->clearHighlight(); - data->setSelectedItems(QList<QGraphicsItem*>()); - - if (data->view->rootObject()) - data->subcomponentEditorTool->pushContext(data->view->rootObject()); - } if (!data->designModeBehavior) data->clearEditorItems(); } -bool QDeclarativeViewObserver::designModeBehavior() +bool QDeclarativeViewInspector::designModeBehavior() { return data->designModeBehavior; } -bool QDeclarativeViewObserver::showAppOnTop() const +bool QDeclarativeViewInspector::showAppOnTop() const { return data->showAppOnTop; } -void QDeclarativeViewObserver::setShowAppOnTop(bool appOnTop) +void QDeclarativeViewInspector::setShowAppOnTop(bool appOnTop) { if (data->view) { QWidget *window = data->view->window(); @@ -543,7 +467,7 @@ void QDeclarativeViewObserver::setShowAppOnTop(bool appOnTop) emit showAppOnTopChanged(appOnTop); } -void QDeclarativeViewObserverPrivate::changeTool(Constants::DesignTool tool, +void QDeclarativeViewInspectorPrivate::changeTool(Constants::DesignTool tool, Constants::ToolFlags /*flags*/) { switch (tool) { @@ -557,7 +481,7 @@ void QDeclarativeViewObserverPrivate::changeTool(Constants::DesignTool tool, } } -void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(const QList<QGraphicsItem *> &items) +void QDeclarativeViewInspectorPrivate::setSelectedItemsForTools(const QList<QGraphicsItem *> &items) { foreach (const QWeakPointer<QGraphicsObject> &obj, currentSelection) { if (QGraphicsItem *item = obj.data()) { @@ -570,8 +494,8 @@ void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(const QList<QGrap } foreach (QGraphicsItem *item, items) { - if (item) { - if (QGraphicsObject *obj = item->toGraphicsObject()) { + if (QGraphicsObject *obj = item->toGraphicsObject()) { + if (!currentSelection.contains(obj)) { QObject::connect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(_q_removeFromSelection(QObject*))); currentSelection.append(obj); @@ -582,7 +506,7 @@ void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(const QList<QGrap currentTool->updateSelectedItems(); } -void QDeclarativeViewObserverPrivate::setSelectedItems(const QList<QGraphicsItem *> &items) +void QDeclarativeViewInspectorPrivate::setSelectedItems(const QList<QGraphicsItem *> &items) { QList<QWeakPointer<QGraphicsObject> > oldList = currentSelection; setSelectedItemsForTools(items); @@ -597,7 +521,7 @@ void QDeclarativeViewObserverPrivate::setSelectedItems(const QList<QGraphicsItem } } -QList<QGraphicsItem *> QDeclarativeViewObserverPrivate::selectedItems() const +QList<QGraphicsItem *> QDeclarativeViewInspectorPrivate::selectedItems() const { QList<QGraphicsItem *> selection; foreach (const QWeakPointer<QGraphicsObject> &selectedObject, currentSelection) { @@ -608,33 +532,27 @@ QList<QGraphicsItem *> QDeclarativeViewObserverPrivate::selectedItems() const return selection; } -void QDeclarativeViewObserver::setSelectedItems(QList<QGraphicsItem *> items) +void QDeclarativeViewInspector::setSelectedItems(QList<QGraphicsItem *> items) { data->setSelectedItems(items); } -QList<QGraphicsItem *> QDeclarativeViewObserver::selectedItems() const +QList<QGraphicsItem *> QDeclarativeViewInspector::selectedItems() const { return data->selectedItems(); } -QDeclarativeView *QDeclarativeViewObserver::declarativeView() +QDeclarativeView *QDeclarativeViewInspector::declarativeView() { return data->view; } -void QDeclarativeViewObserverPrivate::clearHighlight() +void QDeclarativeViewInspectorPrivate::clearHighlight() { boundingRectHighlighter->clear(); } -void QDeclarativeViewObserverPrivate::highlight(QGraphicsObject * item, ContextFlags flags) -{ - highlight(QList<QGraphicsObject*>() << item, flags); -} - -void QDeclarativeViewObserverPrivate::highlight(const QList<QGraphicsObject *> &items, - ContextFlags flags) +void QDeclarativeViewInspectorPrivate::highlight(const QList<QGraphicsObject *> &items) { if (items.isEmpty()) return; @@ -642,8 +560,6 @@ void QDeclarativeViewObserverPrivate::highlight(const QList<QGraphicsObject *> & QList<QGraphicsObject*> objectList; foreach (QGraphicsItem *item, items) { QGraphicsItem *child = item; - if (flags & ContextSensitive) - child = subcomponentEditorTool->firstChildOfContext(item); if (child) { QGraphicsObject *childObject = child->toGraphicsObject(); @@ -655,33 +571,27 @@ void QDeclarativeViewObserverPrivate::highlight(const QList<QGraphicsObject *> & boundingRectHighlighter->highlight(objectList); } -bool QDeclarativeViewObserverPrivate::mouseInsideContextItem() const -{ - return subcomponentEditorTool->containsCursor(cursorPos.toPoint()); -} - -QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::selectableItems( +QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::selectableItems( const QPointF &scenePos) const { QList<QGraphicsItem*> itemlist = view->scene()->items(scenePos); - return filterForCurrentContext(itemlist); + return filterForSelection(itemlist); } -QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::selectableItems(const QPoint &pos) const +QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::selectableItems(const QPoint &pos) const { QList<QGraphicsItem*> itemlist = view->items(pos); - return filterForCurrentContext(itemlist); + return filterForSelection(itemlist); } -QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::selectableItems( +QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::selectableItems( const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const { QList<QGraphicsItem*> itemlist = view->scene()->items(sceneRect, selectionMode); - - return filterForCurrentContext(itemlist); + return filterForSelection(itemlist); } -void QDeclarativeViewObserverPrivate::_q_changeToSingleSelectTool() +void QDeclarativeViewInspectorPrivate::_q_changeToSingleSelectTool() { currentToolMode = Constants::SelectionToolMode; selectionTool->setRubberbandSelectionMode(false); @@ -692,7 +602,7 @@ void QDeclarativeViewObserverPrivate::_q_changeToSingleSelectTool() q->sendCurrentTool(Constants::SelectionToolMode); } -void QDeclarativeViewObserverPrivate::changeToSelectTool() +void QDeclarativeViewInspectorPrivate::changeToSelectTool() { if (currentTool == selectionTool) return; @@ -703,7 +613,7 @@ void QDeclarativeViewObserverPrivate::changeToSelectTool() currentTool->updateSelectedItems(); } -void QDeclarativeViewObserverPrivate::_q_changeToMarqueeSelectTool() +void QDeclarativeViewInspectorPrivate::_q_changeToMarqueeSelectTool() { changeToSelectTool(); currentToolMode = Constants::MarqueeSelectionToolMode; @@ -713,7 +623,7 @@ void QDeclarativeViewObserverPrivate::_q_changeToMarqueeSelectTool() q->sendCurrentTool(Constants::MarqueeSelectionToolMode); } -void QDeclarativeViewObserverPrivate::_q_changeToZoomTool() +void QDeclarativeViewInspectorPrivate::_q_changeToZoomTool() { currentToolMode = Constants::ZoomMode; currentTool->clear(); @@ -724,7 +634,7 @@ void QDeclarativeViewObserverPrivate::_q_changeToZoomTool() q->sendCurrentTool(Constants::ZoomMode); } -void QDeclarativeViewObserverPrivate::_q_changeToColorPickerTool() +void QDeclarativeViewInspectorPrivate::_q_changeToColorPickerTool() { if (currentTool == colorPickerTool) return; @@ -738,12 +648,7 @@ void QDeclarativeViewObserverPrivate::_q_changeToColorPickerTool() q->sendCurrentTool(Constants::ColorPickerMode); } -void QDeclarativeViewObserverPrivate::_q_changeContextPathIndex(int index) -{ - subcomponentEditorTool->setContext(index); -} - -void QDeclarativeViewObserver::setAnimationSpeed(qreal slowDownFactor) +void QDeclarativeViewInspector::setAnimationSpeed(qreal slowDownFactor) { Q_ASSERT(slowDownFactor > 0); if (data->slowDownFactor == slowDownFactor) @@ -753,7 +658,7 @@ void QDeclarativeViewObserver::setAnimationSpeed(qreal slowDownFactor) sendAnimationSpeed(slowDownFactor); } -void QDeclarativeViewObserver::setAnimationPaused(bool paused) +void QDeclarativeViewInspector::setAnimationPaused(bool paused) { if (data->animationPaused == paused) return; @@ -762,7 +667,7 @@ void QDeclarativeViewObserver::setAnimationPaused(bool paused) sendAnimationPaused(paused); } -void QDeclarativeViewObserver::animationSpeedChangeRequested(qreal factor) +void QDeclarativeViewInspector::animationSpeedChangeRequested(qreal factor) { if (data->slowDownFactor != factor) { data->slowDownFactor = factor; @@ -773,7 +678,7 @@ void QDeclarativeViewObserver::animationSpeedChangeRequested(qreal factor) QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor); } -void QDeclarativeViewObserver::animationPausedChangeRequested(bool paused) +void QDeclarativeViewInspector::animationPausedChangeRequested(bool paused) { if (data->animationPaused != paused) { data->animationPaused = paused; @@ -785,87 +690,54 @@ void QDeclarativeViewObserver::animationPausedChangeRequested(bool paused) } -void QDeclarativeViewObserverPrivate::_q_applyChangesFromClient() +void QDeclarativeViewInspectorPrivate::_q_applyChangesFromClient() { } -QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::filterForSelection( +QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::filterForSelection( QList<QGraphicsItem*> &itemlist) const { foreach (QGraphicsItem *item, itemlist) { - if (isEditorItem(item) || !subcomponentEditorTool->isChildOfContext(item)) + if (isEditorItem(item)) itemlist.removeOne(item); } return itemlist; } -QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::filterForCurrentContext( - QList<QGraphicsItem*> &itemlist) const -{ - foreach (QGraphicsItem *item, itemlist) { - - if (isEditorItem(item) || !subcomponentEditorTool->isDirectChildOfContext(item)) { - - // if we're a child, but not directly, replace with the parent that is directly in context. - if (QGraphicsItem *contextParent = subcomponentEditorTool->firstChildOfContext(item)) { - if (contextParent != item) { - if (itemlist.contains(contextParent)) { - itemlist.removeOne(item); - } else { - itemlist.replace(itemlist.indexOf(item), contextParent); - } - } - } else { - itemlist.removeOne(item); - } - } - } - - return itemlist; -} - -bool QDeclarativeViewObserverPrivate::isEditorItem(QGraphicsItem *item) const +bool QDeclarativeViewInspectorPrivate::isEditorItem(QGraphicsItem *item) const { return (item->type() == Constants::EditorItemType || item->type() == Constants::ResizeHandleItemType || item->data(Constants::EditorItemDataKey).toBool()); } -void QDeclarativeViewObserverPrivate::_q_onStatusChanged(QDeclarativeView::Status status) +void QDeclarativeViewInspectorPrivate::_q_onStatusChanged(QDeclarativeView::Status status) { - if (status == QDeclarativeView::Ready) { - if (view->rootObject()) { - if (subcomponentEditorTool->contextIndex() != -1) - subcomponentEditorTool->clear(); - subcomponentEditorTool->pushContext(view->rootObject()); - } + if (status == QDeclarativeView::Ready) q->sendReloaded(); - } } -void QDeclarativeViewObserverPrivate::_q_onCurrentObjectsChanged(QList<QObject*> objects) +void QDeclarativeViewInspectorPrivate::_q_onCurrentObjectsChanged(QList<QObject*> objects) { QList<QGraphicsItem*> items; QList<QGraphicsObject*> gfxObjects; foreach (QObject *obj, objects) { - QDeclarativeItem* declarativeItem = qobject_cast<QDeclarativeItem*>(obj); - if (declarativeItem) { + if (QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(obj)) { items << declarativeItem; - if (QGraphicsObject *gfxObj = declarativeItem->toGraphicsObject()) - gfxObjects << gfxObj; + gfxObjects << declarativeItem; } } if (designModeBehavior) { setSelectedItemsForTools(items); clearHighlight(); - highlight(gfxObjects, QDeclarativeViewObserverPrivate::IgnoreContext); + highlight(gfxObjects); } } // adjusts bounding boxes on edges of screen to be visible -QRectF QDeclarativeViewObserver::adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace) +QRectF QDeclarativeViewInspector::adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace) { int marginFromEdge = 1; QRectF boundingRect(boundingRectInSceneSpace); @@ -886,7 +758,7 @@ QRectF QDeclarativeViewObserver::adjustToScreenBoundaries(const QRectF &bounding return boundingRect; } -void QDeclarativeViewObserverPrivate::createToolBox() +void QDeclarativeViewInspectorPrivate::createToolBox() { toolBox = new ToolBox(q->declarativeView()); @@ -927,15 +799,15 @@ void QDeclarativeViewObserverPrivate::createToolBox() toolBar, SLOT(activateMarqueeSelectTool())); } -void QDeclarativeViewObserver::handleMessage(const QByteArray &message) +void QDeclarativeViewInspector::handleMessage(const QByteArray &message) { QDataStream ds(message); - ObserverProtocol::Message type; + InspectorProtocol::Message type; ds >> type; switch (type) { - case ObserverProtocol::SetCurrentObjects: { + case InspectorProtocol::SetCurrentObjects: { int itemCount = 0; ds >> itemCount; @@ -943,45 +815,43 @@ void QDeclarativeViewObserver::handleMessage(const QByteArray &message) for (int i = 0; i < itemCount; ++i) { int debugId = -1; ds >> debugId; - QObject *obj = QDeclarativeDebugService::objectForId(debugId); - - if (obj) + if (QObject *obj = QDeclarativeDebugService::objectForId(debugId)) selectedObjects << obj; } data->_q_onCurrentObjectsChanged(selectedObjects); break; } - case ObserverProtocol::Reload: { + case InspectorProtocol::Reload: { data->_q_reloadView(); break; } - case ObserverProtocol::SetAnimationSpeed: { + case InspectorProtocol::SetAnimationSpeed: { qreal speed; ds >> speed; animationSpeedChangeRequested(speed); break; } - case ObserverProtocol::SetAnimationPaused: { + case InspectorProtocol::SetAnimationPaused: { bool paused; ds >> paused; animationPausedChangeRequested(paused); break; } - case ObserverProtocol::ChangeTool: { - ObserverProtocol::Tool tool; + case InspectorProtocol::ChangeTool: { + InspectorProtocol::Tool tool; ds >> tool; switch (tool) { - case ObserverProtocol::ColorPickerTool: + case InspectorProtocol::ColorPickerTool: data->_q_changeToColorPickerTool(); break; - case ObserverProtocol::SelectTool: + case InspectorProtocol::SelectTool: data->_q_changeToSingleSelectTool(); break; - case ObserverProtocol::SelectMarqueeTool: + case InspectorProtocol::SelectMarqueeTool: data->_q_changeToMarqueeSelectTool(); break; - case ObserverProtocol::ZoomTool: + case InspectorProtocol::ZoomTool: data->_q_changeToZoomTool(); break; default: @@ -989,19 +859,19 @@ void QDeclarativeViewObserver::handleMessage(const QByteArray &message) } break; } - case ObserverProtocol::SetDesignMode: { + case InspectorProtocol::SetDesignMode: { bool inDesignMode; ds >> inDesignMode; setDesignModeBehavior(inDesignMode); break; } - case ObserverProtocol::ShowAppOnTop: { + case InspectorProtocol::ShowAppOnTop: { bool showOnTop; ds >> showOnTop; setShowAppOnTop(showOnTop); break; } - case ObserverProtocol::CreateObject: { + case InspectorProtocol::CreateObject: { QString qml; int parentId; QString filename; @@ -1011,21 +881,21 @@ void QDeclarativeViewObserver::handleMessage(const QByteArray &message) imports, filename); break; } - case ObserverProtocol::DestroyObject: { + case InspectorProtocol::DestroyObject: { int debugId; ds >> debugId; if (QObject* obj = QDeclarativeDebugService::objectForId(debugId)) obj->deleteLater(); break; } - case ObserverProtocol::MoveObject: { + case InspectorProtocol::MoveObject: { int debugId, newParent; ds >> debugId >> newParent; data->_q_reparentQmlObject(QDeclarativeDebugService::objectForId(debugId), QDeclarativeDebugService::objectForId(newParent)); break; } - case ObserverProtocol::ObjectIdList: { + case InspectorProtocol::ObjectIdList: { int itemCount; ds >> itemCount; data->stringIdForObjectId.clear(); @@ -1039,13 +909,7 @@ void QDeclarativeViewObserver::handleMessage(const QByteArray &message) } break; } - case ObserverProtocol::SetContextPathIdx: { - int contextPathIndex; - ds >> contextPathIndex; - data->_q_changeContextPathIndex(contextPathIndex); - break; - } - case ObserverProtocol::ClearComponentCache: { + case InspectorProtocol::ClearComponentCache: { data->_q_clearComponentCache(); break; } @@ -1054,23 +918,23 @@ void QDeclarativeViewObserver::handleMessage(const QByteArray &message) } } -void QDeclarativeViewObserver::sendDesignModeBehavior(bool inDesignMode) +void QDeclarativeViewInspector::sendDesignModeBehavior(bool inDesignMode) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::SetDesignMode + ds << InspectorProtocol::SetDesignMode << inDesignMode; data->debugService->sendMessage(message); } -void QDeclarativeViewObserver::sendCurrentObjects(const QList<QObject*> &objects) +void QDeclarativeViewInspector::sendCurrentObjects(const QList<QObject*> &objects) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::CurrentObjectsChanged + ds << InspectorProtocol::CurrentObjectsChanged << objects.length(); foreach (QObject *object, objects) { @@ -1081,82 +945,71 @@ void QDeclarativeViewObserver::sendCurrentObjects(const QList<QObject*> &objects data->debugService->sendMessage(message); } -void QDeclarativeViewObserver::sendCurrentTool(Constants::DesignTool toolId) +void QDeclarativeViewInspector::sendCurrentTool(Constants::DesignTool toolId) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::ToolChanged + ds << InspectorProtocol::ToolChanged << toolId; data->debugService->sendMessage(message); } -void QDeclarativeViewObserver::sendAnimationSpeed(qreal slowDownFactor) +void QDeclarativeViewInspector::sendAnimationSpeed(qreal slowDownFactor) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::AnimationSpeedChanged + ds << InspectorProtocol::AnimationSpeedChanged << slowDownFactor; data->debugService->sendMessage(message); } -void QDeclarativeViewObserver::sendAnimationPaused(bool paused) +void QDeclarativeViewInspector::sendAnimationPaused(bool paused) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::AnimationPausedChanged + ds << InspectorProtocol::AnimationPausedChanged << paused; data->debugService->sendMessage(message); } -void QDeclarativeViewObserver::sendReloaded() +void QDeclarativeViewInspector::sendReloaded() { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::Reloaded; + ds << InspectorProtocol::Reloaded; data->debugService->sendMessage(message); } -void QDeclarativeViewObserver::sendShowAppOnTop(bool showAppOnTop) +void QDeclarativeViewInspector::sendShowAppOnTop(bool showAppOnTop) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::ShowAppOnTop << showAppOnTop; + ds << InspectorProtocol::ShowAppOnTop << showAppOnTop; data->debugService->sendMessage(message); } -void QDeclarativeViewObserver::sendColorChanged(const QColor &color) +void QDeclarativeViewInspector::sendColorChanged(const QColor &color) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::ColorChanged + ds << InspectorProtocol::ColorChanged << color; data->debugService->sendMessage(message); } -void QDeclarativeViewObserver::sendContextPathUpdated(const QStringList &contextPath) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << ObserverProtocol::ContextPathUpdated - << contextPath; - - data->debugService->sendMessage(message); -} - -QString QDeclarativeViewObserver::idStringForObject(QObject *obj) const +QString QDeclarativeViewInspector::idStringForObject(QObject *obj) const { int id = QDeclarativeDebugService::idForObject(obj); QString idString = data->stringIdForObjectId.value(id, QString()); @@ -1165,4 +1018,4 @@ QString QDeclarativeViewObserver::idStringForObject(QObject *obj) const QT_END_NAMESPACE -#include "qdeclarativeviewobserver.moc" +#include "qdeclarativeviewinspector.moc" diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h index 86d0d95..4efa093 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#ifndef QDECLARATIVEVIEWOBSERVER_P_H -#define QDECLARATIVEVIEWOBSERVER_P_H +#ifndef QDECLARATIVEVIEWINSPECTOR_P_H +#define QDECLARATIVEVIEWINSPECTOR_P_H #include <private/qdeclarativeglobal_p.h> -#include "qmlobserverconstants_p.h" +#include "qmlinspectorconstants_p.h" #include <QtCore/QScopedPointer> #include <QtDeclarative/QDeclarativeView> @@ -58,15 +58,15 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QDeclarativeViewObserverPrivate; +class QDeclarativeViewInspectorPrivate; -class QDeclarativeViewObserver : public QObject +class QDeclarativeViewInspector : public QObject { Q_OBJECT public: - explicit QDeclarativeViewObserver(QDeclarativeView *view, QObject *parent = 0); - ~QDeclarativeViewObserver(); + explicit QDeclarativeViewInspector(QDeclarativeView *view, QObject *parent = 0); + ~QDeclarativeViewInspector(); void setSelectedItems(QList<QGraphicsItem *> items); QList<QGraphicsItem *> selectedItems() const; @@ -89,7 +89,6 @@ public: public Q_SLOTS: void sendColorChanged(const QColor &color); - void sendContextPathUpdated(const QStringList &contextPath); void setDesignModeBehavior(bool value); bool designModeBehavior(); @@ -99,8 +98,6 @@ public Q_SLOTS: void setAnimationSpeed(qreal factor); void setAnimationPaused(bool paused); - void setObserverContext(int contextIndex); - Q_SIGNALS: void designModeBehaviorChanged(bool inDesignMode); void showAppOnTopChanged(bool showAppOnTop); @@ -114,10 +111,6 @@ Q_SIGNALS: void animationSpeedChanged(qreal factor); void animationPausedChanged(bool paused); - void inspectorContextCleared(); - void inspectorContextPushed(const QString &contextTitle); - void inspectorContextPopped(); - protected: bool eventFilter(QObject *obj, QEvent *event); @@ -139,11 +132,11 @@ private slots: void animationPausedChangeRequested(bool paused); private: - Q_DISABLE_COPY(QDeclarativeViewObserver) + Q_DISABLE_COPY(QDeclarativeViewInspector) - inline QDeclarativeViewObserverPrivate *d_func() { return data.data(); } - QScopedPointer<QDeclarativeViewObserverPrivate> data; - friend class QDeclarativeViewObserverPrivate; + inline QDeclarativeViewInspectorPrivate *d_func() { return data.data(); } + QScopedPointer<QDeclarativeViewInspectorPrivate> data; + friend class QDeclarativeViewInspectorPrivate; friend class AbstractLiveEditTool; }; @@ -151,4 +144,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // QDECLARATIVEVIEWOBSERVER_P_H +#endif // QDECLARATIVEVIEWINSPECTOR_P_H diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p_p.h index 8809591..11cbe0f 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p_p.h @@ -39,15 +39,15 @@ ** ****************************************************************************/ -#ifndef QDECLARATIVEVIEWOBSERVER_P_P_H -#define QDECLARATIVEVIEWOBSERVER_P_P_H +#ifndef QDECLARATIVEVIEWINSPECTOR_P_P_H +#define QDECLARATIVEVIEWINSPECTOR_P_P_H -#include "qdeclarativeviewobserver_p.h" +#include "qdeclarativeviewinspector_p.h" #include <QtCore/QWeakPointer> #include <QtCore/QPointF> -#include "QtDeclarative/private/qdeclarativeobserverservice_p.h" +#include "QtDeclarative/private/qdeclarativeinspectorservice_p.h" QT_BEGIN_HEADER @@ -55,31 +55,25 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QDeclarativeViewObserver; +class QDeclarativeViewInspector; class LiveSelectionTool; class ZoomTool; class ColorPickerTool; class LiveLayerItem; class BoundingRectHighlighter; -class SubcomponentEditorTool; class ToolBox; class AbstractLiveEditTool; -class QDeclarativeViewObserverPrivate : public QObject +class QDeclarativeViewInspectorPrivate : public QObject { Q_OBJECT public: - enum ContextFlags { - IgnoreContext, - ContextSensitive - }; - - QDeclarativeViewObserverPrivate(QDeclarativeViewObserver *); - ~QDeclarativeViewObserverPrivate(); + QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *); + ~QDeclarativeViewInspectorPrivate(); QDeclarativeView *view; - QDeclarativeViewObserver *q; - QDeclarativeObserverService *debugService; + QDeclarativeViewInspector *q; + QDeclarativeInspectorService *debugService; QWeakPointer<QWidget> viewport; QHash<int, QString> stringIdForObjectId; @@ -92,7 +86,6 @@ public: LiveSelectionTool *selectionTool; ZoomTool *zoomTool; ColorPickerTool *colorPickerTool; - SubcomponentEditorTool *subcomponentEditorTool; LiveLayerItem *manipulatorLayer; BoundingRectHighlighter *boundingRectHighlighter; @@ -110,7 +103,6 @@ public: void clearEditorItems(); void createToolBox(); void changeToSelectTool(); - QList<QGraphicsItem*> filterForCurrentContext(QList<QGraphicsItem*> &itemlist) const; QList<QGraphicsItem*> filterForSelection(QList<QGraphicsItem*> &itemlist) const; QList<QGraphicsItem*> selectableItems(const QPoint &pos) const; @@ -125,17 +117,12 @@ public: Constants::ToolFlags flags = Constants::NoToolFlags); void clearHighlight(); - void highlight(const QList<QGraphicsObject *> &item, - ContextFlags flags = ContextSensitive); - void highlight(QGraphicsObject *item, ContextFlags flags = ContextSensitive); + void highlight(const QList<QGraphicsObject *> &item); + inline void highlight(QGraphicsObject *item) + { highlight(QList<QGraphicsObject*>() << item); } - bool mouseInsideContextItem() const; bool isEditorItem(QGraphicsItem *item) const; - QGraphicsItem *currentRootItem() const; - - void enterContext(QGraphicsItem *itemToEnter); - public slots: void _q_setToolBoxVisible(bool visible); @@ -151,16 +138,15 @@ public slots: void _q_changeToMarqueeSelectTool(); void _q_changeToZoomTool(); void _q_changeToColorPickerTool(); - void _q_changeContextPathIndex(int index); void _q_clearComponentCache(); void _q_removeFromSelection(QObject *); public: - static QDeclarativeViewObserverPrivate *get(QDeclarativeViewObserver *v) { return v->d_func(); } + static QDeclarativeViewInspectorPrivate *get(QDeclarativeViewInspector *v) { return v->d_func(); } }; QT_END_NAMESPACE QT_END_HEADER -#endif // QDECLARATIVEVIEWOBSERVER_P_P_H +#endif // QDECLARATIVEVIEWINSPECTOR_P_P_H diff --git a/src/plugins/qmltooling/declarativeobserver/declarativeobserver.pro b/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro index bccabcb..f8d7ee8 100644 --- a/src/plugins/qmltooling/declarativeobserver/declarativeobserver.pro +++ b/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro @@ -1,4 +1,4 @@ -TARGET = declarativeobserver +TARGET = qmldbg_inspector QT += declarative include(../../qpluginbase.pri) @@ -7,8 +7,8 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/qmltooling QTDIR_build:REQUIRES += "contains(QT_CONFIG, declarative)" SOURCES += \ - qdeclarativeobserverplugin.cpp \ - qdeclarativeviewobserver.cpp \ + qdeclarativeinspectorplugin.cpp \ + qdeclarativeviewinspector.cpp \ editor/abstractliveedittool.cpp \ editor/liveselectiontool.cpp \ editor/livelayeritem.cpp \ @@ -17,7 +17,6 @@ SOURCES += \ editor/liveselectionrectangle.cpp \ editor/liveselectionindicator.cpp \ editor/boundingrecthighlighter.cpp \ - editor/subcomponenteditortool.cpp \ editor/subcomponentmasklayeritem.cpp \ editor/zoomtool.cpp \ editor/colorpickertool.cpp \ @@ -25,11 +24,11 @@ SOURCES += \ editor/toolbarcolorbox.cpp HEADERS += \ - qdeclarativeobserverplugin.h \ - qdeclarativeobserverprotocol.h \ - qdeclarativeviewobserver_p.h \ - qdeclarativeviewobserver_p_p.h \ - qmlobserverconstants_p.h \ + qdeclarativeinspectorplugin.h \ + qdeclarativeinspectorprotocol.h \ + qdeclarativeviewinspector_p.h \ + qdeclarativeviewinspector_p_p.h \ + qmlinspectorconstants_p.h \ editor/abstractliveedittool_p.h \ editor/liveselectiontool_p.h \ editor/livelayeritem_p.h \ @@ -38,7 +37,6 @@ HEADERS += \ editor/liveselectionrectangle_p.h \ editor/liveselectionindicator_p.h \ editor/boundingrecthighlighter_p.h \ - editor/subcomponenteditortool_p.h \ editor/subcomponentmasklayeritem_p.h \ editor/zoomtool_p.h \ editor/colorpickertool_p.h \ diff --git a/src/plugins/qmltooling/declarativeobserver/qmlobserverconstants_p.h b/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants_p.h index 6d0a263..40ec325 100644 --- a/src/plugins/qmltooling/declarativeobserver/qmlobserverconstants_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QMLOBSERVERCONSTANTS_H -#define QMLOBSERVERCONSTANTS_H +#ifndef QMLINSPECTORCONSTANTS_H +#define QMLINSPECTORCONSTANTS_H #include <QtDeclarative/private/qdeclarativeglobal_p.h> @@ -87,4 +87,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // QMLOBSERVERCONSTANTS_H +#endif // QMLINSPECTORCONSTANTS_H diff --git a/src/plugins/qmltooling/qmltooling.pro b/src/plugins/qmltooling/qmltooling.pro index 0d60eb1..8220109 100644 --- a/src/plugins/qmltooling/qmltooling.pro +++ b/src/plugins/qmltooling/qmltooling.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = qmldbg_tcp declarativeobserver +SUBDIRS = qmldbg_tcp qmldbg_inspector symbian:SUBDIRS += qmldbg_ost diff --git a/src/plugins/s60/3_1/3_1.pro b/src/plugins/s60/3_1/3_1.pro deleted file mode 100644 index 9437f3d..0000000 --- a/src/plugins/s60/3_1/3_1.pro +++ /dev/null @@ -1,9 +0,0 @@ -include(../s60pluginbase.pri) - -TARGET = qts60plugin_3_1$${QT_LIBINFIX} - -SOURCES += ../src/qlocale_3_1.cpp \ - ../src/qdesktopservices_3_1.cpp \ - ../src/qcoreapplication_3_1.cpp - -TARGET.UID3=0x2001E620 diff --git a/src/plugins/s60/3_2/3_2.pro b/src/plugins/s60/3_2/3_2.pro deleted file mode 100644 index b104c05..0000000 --- a/src/plugins/s60/3_2/3_2.pro +++ /dev/null @@ -1,23 +0,0 @@ -include(../s60pluginbase.pri) - -TARGET = qts60plugin_3_2$${QT_LIBINFIX} - -contains(S60_VERSION, 3.1) { - SOURCES += ../src/qlocale_3_1.cpp \ - ../src/qdesktopservices_3_1.cpp \ - ../src/qcoreapplication_3_1.cpp -} else { - SOURCES += ../src/qlocale_3_2.cpp \ - ../src/qdesktopservices_3_2.cpp \ - ../src/qcoreapplication_3_2.cpp - contains(CONFIG, is_using_gnupoc) { - LIBS += -ldirectorylocalizer - } else { - LIBS += -lDirectoryLocalizer - } - LIBS += -lefsrv - LIBS += -lnumberconversion - INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE -} - -TARGET.UID3=0x2001E621 diff --git a/src/plugins/s60/5_0/5_0.pro b/src/plugins/s60/5_0/5_0.pro deleted file mode 100644 index b037215..0000000 --- a/src/plugins/s60/5_0/5_0.pro +++ /dev/null @@ -1,23 +0,0 @@ -include(../s60pluginbase.pri) - -TARGET = qts60plugin_5_0$${QT_LIBINFIX} - -contains(S60_VERSION, 3.1) { - SOURCES += ../src/qlocale_3_1.cpp \ - ../src/qdesktopservices_3_1.cpp \ - ../src/qcoreapplication_3_1.cpp -} else { - SOURCES += ../src/qlocale_3_2.cpp \ - ../src/qdesktopservices_3_2.cpp \ - ../src/qcoreapplication_3_2.cpp - contains(CONFIG, is_using_gnupoc) { - LIBS += -ldirectorylocalizer - } else { - LIBS += -lDirectoryLocalizer - } - LIBS += -lefsrv - LIBS += -lnumberconversion - INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE -} - -TARGET.UID3=0x2001E622 diff --git a/src/plugins/s60/bwins/qts60pluginu.def b/src/plugins/s60/bwins/qts60pluginu.def deleted file mode 100644 index b4110a9..0000000 --- a/src/plugins/s60/bwins/qts60pluginu.def +++ /dev/null @@ -1,8 +0,0 @@ -EXPORTS - ?defaultFormatL@@YAXAAVTTime@@AAVTDes16@@ABVTDesC16@@ABVTLocale@@@Z @ 1 NONAME ; void defaultFormatL(class TTime &, class TDes16 &, class TDesC16 const &, class TLocale const &) - ?defaultGetTimeFormatSpec@@YA?AVTPtrC16@@AAVTExtendedLocale@@@Z @ 2 NONAME ; class TPtrC16 defaultGetTimeFormatSpec(class TExtendedLocale &) - ?defaultGetLongDateFormatSpec@@YA?AVTPtrC16@@AAVTExtendedLocale@@@Z @ 3 NONAME ; class TPtrC16 defaultGetLongDateFormatSpec(class TExtendedLocale &) - ?defaultGetShortDateFormatSpec@@YA?AVTPtrC16@@AAVTExtendedLocale@@@Z @ 4 NONAME ; class TPtrC16 defaultGetShortDateFormatSpec(class TExtendedLocale &) - ?localizedDirectoryName@@YA?AVQString@@AAV1@@Z @ 5 NONAME ; class QString localizedDirectoryName(class QString &) - ?systemDrive@@YA?AW4TDriveNumber@@AAVRFs@@@Z @ 6 NONAME ; enum TDriveNumber systemDrive(class RFs &) - diff --git a/src/plugins/s60/eabi/qts60pluginu.def b/src/plugins/s60/eabi/qts60pluginu.def deleted file mode 100644 index df7895c..0000000 --- a/src/plugins/s60/eabi/qts60pluginu.def +++ /dev/null @@ -1,8 +0,0 @@ -EXPORTS - _Z14defaultFormatLR5TTimeR6TDes16RK7TDesC16RK7TLocale @ 1 NONAME - _Z24defaultGetTimeFormatSpecR15TExtendedLocale @ 2 NONAME - _Z28defaultGetLongDateFormatSpecR15TExtendedLocale @ 3 NONAME - _Z29defaultGetShortDateFormatSpecR15TExtendedLocale @ 4 NONAME - _Z22localizedDirectoryNameR7QString @ 5 NONAME - _Z11systemDriveR3RFs @ 6 NONAME - diff --git a/src/plugins/s60/s60.pro b/src/plugins/s60/s60.pro deleted file mode 100644 index c999fff..0000000 --- a/src/plugins/s60/s60.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = subdirs - - -symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - SUBDIRS += 3_1 3_2 - } - - # 5.0 is used also for Symbian3 and later - SUBDIRS += 5_0 -}
\ No newline at end of file diff --git a/src/plugins/s60/s60pluginbase.pri b/src/plugins/s60/s60pluginbase.pri deleted file mode 100644 index 4e15102..0000000 --- a/src/plugins/s60/s60pluginbase.pri +++ /dev/null @@ -1,23 +0,0 @@ -# Note: These version based 'plugins' are not an actual Qt plugins, -# they are just regular runtime loaded libraries -include(../qpluginbase.pri) - -CONFIG -= plugin - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/s60 - -MMP_RULES += NOEXPORTLIBRARY - -symbian-abld|symbian-sbsv2 { - defBlock = \ - "$${LITERAL_HASH}ifdef WINSCW" \ - "DEFFILE ../bwins/qts60plugin.def" \ - "$${LITERAL_HASH}else" \ - "DEFFILE ../eabi/qts60plugin.def" \ - "$${LITERAL_HASH}endif" -} else { - CONFIG *= def_files - DEF_FILE = ../eabi/qts60pluginu.def -} - -MMP_RULES += defBlock
\ No newline at end of file diff --git a/src/plugins/s60/src/qcoreapplication_3_1.cpp b/src/plugins/s60/src/qcoreapplication_3_1.cpp deleted file mode 100644 index 6f2e86a..0000000 --- a/src/plugins/s60/src/qcoreapplication_3_1.cpp +++ /dev/null @@ -1,48 +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 <qglobal.h> -#include <f32file.h> - -EXPORT_C TDriveNumber systemDrive(RFs&) -{ - return EDriveC; -} diff --git a/src/plugins/s60/src/qcoreapplication_3_2.cpp b/src/plugins/s60/src/qcoreapplication_3_2.cpp deleted file mode 100644 index 117248c..0000000 --- a/src/plugins/s60/src/qcoreapplication_3_2.cpp +++ /dev/null @@ -1,48 +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 <qglobal.h> -#include <f32file.h> - -EXPORT_C TDriveNumber systemDrive(RFs& fs) -{ - return fs.GetSystemDrive(); -} diff --git a/src/plugins/s60/src/qdesktopservices_3_1.cpp b/src/plugins/s60/src/qdesktopservices_3_1.cpp deleted file mode 100644 index 4b04733..0000000 --- a/src/plugins/s60/src/qdesktopservices_3_1.cpp +++ /dev/null @@ -1,49 +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 <qglobal.h> -#include <qstring.h> - -EXPORT_C QString localizedDirectoryName(QString&) -{ - qWarning("QDesktopServices::displayName() not implemented for this platform version"); - return QString(); -} diff --git a/src/plugins/s60/src/qdesktopservices_3_2.cpp b/src/plugins/s60/src/qdesktopservices_3_2.cpp deleted file mode 100644 index e91ab6b..0000000 --- a/src/plugins/s60/src/qdesktopservices_3_2.cpp +++ /dev/null @@ -1,80 +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 <private/qcore_symbian_p.h> -#include <qstring.h> -#include <qdir.h> - -#ifdef Q_WS_S60 -#include <e32base.h> // CBase -> Required by cdirectorylocalizer.h -#include <CDirectoryLocalizer.h> // CDirectoryLocalizer - -EXPORT_C QString localizedDirectoryName(QString& rawPath) -{ - QString ret; - std::exception dummy; // voodoo fix for "Undefined symbol typeinfo for std::exception" in armv5 build - - TRAPD(err, - QT_TRYCATCH_LEAVING( - CDirectoryLocalizer* localizer = CDirectoryLocalizer::NewL(); - CleanupStack::PushL(localizer); - localizer->SetFullPath(qt_QString2TPtrC(QDir::toNativeSeparators(rawPath))); - if(localizer->IsLocalized()){ - TPtrC locName(localizer->LocalizedName()); - ret = qt_TDesC2QString(locName); - } - CleanupStack::PopAndDestroy(localizer); - ) - ) - - if (err != KErrNone) - ret = QString(); - - return ret; -} -#else - -EXPORT_C QString localizedDirectoryName(QString& /* rawPath */) -{ - qWarning("QDesktopServices::displayName() not implemented for this platform version"); - return QString(); -} -#endif diff --git a/src/plugins/s60/src/qlocale_3_1.cpp b/src/plugins/s60/src/qlocale_3_1.cpp deleted file mode 100644 index 5b97777..0000000 --- a/src/plugins/s60/src/qlocale_3_1.cpp +++ /dev/null @@ -1,148 +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 <e32std.h> -#include <e32const.h> -#include <e32debug.h> - -_LIT(KYear, "%Y"); -_LIT(KMonth, "%M"); -_LIT(KDay, "%D"); -_LIT(KLocaleIndependent, "%F"); -static TBuf<10> dateFormat; -static TBuf<10> timeFormat; - -static void initialiseDateFormat() -{ - if(dateFormat.Length()) - return; - - TLocale locale; - - //Separator 1 is used between 1st and 2nd components of the date - //Separator 2 is used between 2nd and 3rd components of the date - //Usually they are the same, but they are allowed to be different - TChar s1 = locale.DateSeparator(1); - TChar s2 = locale.DateSeparator(2); - dateFormat=KLocaleIndependent; - switch(locale.DateFormat()) { - case EDateAmerican: - dateFormat.Append(KMonth); - dateFormat.Append(s1); - dateFormat.Append(KDay); - dateFormat.Append(s2); - dateFormat.Append(KYear); - break; - case EDateEuropean: - dateFormat.Append(KDay); - dateFormat.Append(s1); - dateFormat.Append(KMonth); - dateFormat.Append(s2); - dateFormat.Append(KYear); - break; - case EDateJapanese: - default: //it's closest to ISO format - dateFormat.Append(KYear); - dateFormat.Append(s1); - dateFormat.Append(KMonth); - dateFormat.Append(s2); - dateFormat.Append(KDay); - break; - } -#ifdef _DEBUG - RDebug::Print(_L("Date Format \"%S\""), &dateFormat); -#endif -} - -static void initialiseTimeFormat() -{ - if(timeFormat.Length()) - return; - - TLocale locale; - //Separator 1 is used between 1st and 2nd components of the time - //Separator 2 is used between 2nd and 3rd components of the time - //Usually they are the same, but they are allowed to be different - TChar s1 = locale.TimeSeparator(1); - TChar s2 = locale.TimeSeparator(2); - switch(locale.TimeFormat()) { - case ETime12: - timeFormat.Append(_L("%I")); - break; - case ETime24: - default: - timeFormat.Append(_L("%H")); - break; - } - timeFormat.Append(s1); - timeFormat.Append(_L("%T")); - timeFormat.Append(s2); - timeFormat.Append(_L("%S")); - -#ifdef _DEBUG - RDebug::Print(_L("Time Format \"%S\""), &timeFormat); -#endif -} - -EXPORT_C void defaultFormatL(TTime& time, TDes& des, const TDesC& fmt, const TLocale&) -{ - //S60 3.1 does not support format for a specific locale, so use default locale - time.FormatL(des, fmt); -} - -//S60 3.1 doesn't support extended locale date&time formats, so use default locale -EXPORT_C TPtrC defaultGetTimeFormatSpec(TExtendedLocale&) -{ - initialiseTimeFormat(); - return TPtrC(timeFormat); -} - -EXPORT_C TPtrC defaultGetLongDateFormatSpec(TExtendedLocale&) -{ - initialiseDateFormat(); - return TPtrC(dateFormat); -} - -EXPORT_C TPtrC defaultGetShortDateFormatSpec(TExtendedLocale&) -{ - initialiseDateFormat(); - return TPtrC(dateFormat); -} diff --git a/src/plugins/s60/src/qlocale_3_2.cpp b/src/plugins/s60/src/qlocale_3_2.cpp deleted file mode 100644 index 5d24eec..0000000 --- a/src/plugins/s60/src/qlocale_3_2.cpp +++ /dev/null @@ -1,66 +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 <exception> -#include <e32std.h> -#include <e32base.h> -#include <numberconversion.h> - -EXPORT_C TPtrC defaultGetLongDateFormatSpec(TExtendedLocale& locale) -{ - return locale.GetLongDateFormatSpec(); -} - -EXPORT_C TPtrC defaultGetShortDateFormatSpec(TExtendedLocale& locale) -{ - return locale.GetShortDateFormatSpec(); -} - -EXPORT_C TPtrC defaultGetTimeFormatSpec(TExtendedLocale& locale) -{ - return locale.GetTimeFormatSpec(); -} - -EXPORT_C void defaultFormatL(TTime& time, TDes& des, const TDesC& format, const TLocale& locale) -{ - time.FormatL(des, format, locale); - NumberConversion::ConvertDigits(des, locale.DigitType()); -} |