From a12d41076919a133e63de63dff5c1a131a0564e4 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 7 Apr 2011 10:37:31 +0300 Subject: Have the backing store destroyed also in special Symbian scenarios. The backing store tracker's registerWidget and unregisterWidget functions are called when EPartiallyVisible and ENotVisible events come from WSERV. However if an application sends its window group to background right after caling show() and before entering the event loop, there is a chance that all the application will receive is an ENotVisible event, leading to calling unregisterWidget() without a previous registerWidget(). In this case the backing store was not destroyed and the application was consuming GPU memory even while it was staying in background. This patch makes unregisterWidget() not to check the widget's presence in the m_widgets set, instead the condition for deleting the backing store is solely an empty set. Task-number: QTBUG-18493 Reviewed-by: Gareth Stockwell --- src/gui/kernel/qwidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 0a73481..be615a4 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -234,7 +234,8 @@ void QWidgetBackingStoreTracker::registerWidget(QWidget *w) */ void QWidgetBackingStoreTracker::unregisterWidget(QWidget *w) { - if (m_widgets.remove(w) && m_widgets.isEmpty()) { + m_widgets.remove(w); + if (m_widgets.isEmpty()) { delete m_ptr; m_ptr = 0; } -- cgit v0.12 From c2383fa6a8070bf5bec4a444ae7d486874f35ab2 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 6 Apr 2011 17:20:33 +0300 Subject: Do not unnecessarily draw application twice in landscape Fullscreen with softkeys dialogs would draw twice when orientation was changed to landscape, causing flicker. This happened because status pane change event and layout change event both caused redraw with different client area size. Added a check to avoid handling client area change on account of status pane change, if status pane is not visible and there was no change in its visibility. Task-number: QTBUG-18496 Reviewed-by: Sami Merila --- src/gui/kernel/qapplication_s60.cpp | 9 ++++++++- src/gui/kernel/qt_s60_p.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 21b50b6..a8680b9 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -459,6 +459,7 @@ QSymbianControl::QSymbianControl(QWidget *w) , m_ignoreFocusChanged(0) , m_symbianPopupIsOpen(0) , m_inExternalScreenOverride(false) + , m_lastStatusPaneVisibility(0) { } @@ -1427,7 +1428,13 @@ void QSymbianControl::HandleResourceChange(int resourceType) } break; case KInternalStatusPaneChange: - handleClientAreaChange(); + // When status pane is not visible, only handle client area change if status pane was + // previously visible, as size changes to hidden status pane should not affect + // client area. + if (S60->statusPane() && (S60->statusPane()->IsVisible() || m_lastStatusPaneVisibility)) { + m_lastStatusPaneVisibility = S60->statusPane()->IsVisible(); + handleClientAreaChange(); + } if (IsFocused() && IsVisible()) { qwidget->d_func()->setWindowIcon_sys(true); qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index ee0b862..c48bf63 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -295,6 +295,7 @@ private: #endif bool m_inExternalScreenOverride : 1; + bool m_lastStatusPaneVisibility : 1; }; inline QS60Data::QS60Data() -- cgit v0.12 From 99eb6c6c2048ce4d96348c54a79986c779fdf656 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 7 Apr 2011 13:52:42 +0200 Subject: Support QMAKE_LFLAGS.ARMCC and QMAKE_LFLAGS.GCCE in makefile build system Reviewed-by: axis --- mkspecs/common/symbian/symbian.conf | 3 ++- mkspecs/features/symbian/symbian_building.prf | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index e35786b..f955e3c 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -57,7 +57,8 @@ QMAKE_INCDIR = QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS] QMAKE_LFLAGS = -QMAKE_LFLAGS.ARMCC = +QMAKE_LFLAGS.ARMCC = +QMAKE_LFLAGS.GCCE = QMAKE_LFLAGS_EXCEPTIONS_ON = QMAKE_LFLAGS_EXCEPTIONS_OFF = QMAKE_LFLAGS_RELEASE = diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index 28046b4..8c75707 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -1,6 +1,7 @@ symbian-armcc { QMAKE_CFLAGS += $$QMAKE_CFLAGS.ARMCC QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS.ARMCC + QMAKE_LFLAGS += $$QMAKE_LFLAGS.ARMCC # This is to prevent inclusion of the shipped RVCT headers, which are often in the # environment variable RVCTxxINC by default. -J prevents the searching of that location, # but needs a path, so just specify somewhere guaranteed not to contain header files. @@ -9,6 +10,7 @@ symbian-armcc { } else:symbian-gcce { QMAKE_CFLAGS += $$QMAKE_CFLAGS.GCCE QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS.GCCE + QMAKE_LFLAGS += $$QMAKE_LFLAGS.GCCE } # We need a target name without the INFIX'ed part, since flags are not infixed. -- cgit v0.12 From 2eae397d7c4e549f7c77f0bc7e22f0d9390c7ec3 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 7 Apr 2011 13:53:44 +0200 Subject: Correct some parameters for the makefile build sytem, armcc and gcce Reviewed-by: axis --- mkspecs/symbian-armcc/qmake.conf | 6 +++--- mkspecs/symbian-gcce/qmake.conf | 7 +++---- src/gui/gui.pro | 8 +++----- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/mkspecs/symbian-armcc/qmake.conf b/mkspecs/symbian-armcc/qmake.conf index 77a1966..2de3218 100644 --- a/mkspecs/symbian-armcc/qmake.conf +++ b/mkspecs/symbian-armcc/qmake.conf @@ -12,7 +12,7 @@ QMAKE_RVCT_LINKSTYLE = 1 #QMAKE_qtmain_CXXFLAGS = --arm #QMAKE_QtCore_CXXFLAGS = -QMAKE_QtGui_LFLAGS = "--rw-base 0x800000" +#QMAKE_QtGui_LFLAGS = "--rw-base 0x800000" #QMAKE_QtDBus_CXXFLAGS = #QMAKE_QtDeclarative_CXXFLAGS = #QMAKE_QtMultimedia_CXXFLAGS = @@ -27,9 +27,9 @@ QMAKE_QtGui_LFLAGS = "--rw-base 0x800000" #QMAKE_QtTest_CXXFLAGS = #QMAKE_QtXmlPatterns_CXXFLAGS = #QMAKE_QtXml_CXXFLAGS = -QMAKE_QtWebKit_CXXFLAGS = --arm +#QMAKE_QtWebKit_CXXFLAGS = --arm # Move RW-section base address to start from 0xE00000 instead of the toolchain default 0x400000. -QMAKE_QtWebKit_LFLAGS = --rw-base 0xE00000 +#QMAKE_QtWebKit_LFLAGS = --rw-base 0xE00000 QMAKE_CFLAGS += --dllimport_runtime --diag_suppress 186,611,654,1300 --thumb --fpu softvfp --cpu 5T --enum_is_int -Ono_known_library --fpmode ieee_no_fenv --no_vfe --apcs /inter QMAKE_CXXFLAGS += $$QMAKE_CFLAGS diff --git a/mkspecs/symbian-gcce/qmake.conf b/mkspecs/symbian-gcce/qmake.conf index 62a079b..38042e9 100644 --- a/mkspecs/symbian-gcce/qmake.conf +++ b/mkspecs/symbian-gcce/qmake.conf @@ -19,7 +19,7 @@ QMAKE_AR = arm-none-symbianelf-ar cqs QMAKE_qtmain_CXXFLAGS = -mthumb QMAKE_QtCore_CXXFLAGS = -mthumb -QMAKE_QtGui_LFLAGS = -Ttext 0x8000 -Tdata 0xE00000 +#QMAKE_QtGui_LFLAGS = -Ttext 0x8000 -Tdata 0xE00000 QMAKE_QtDBus_CXXFLAGS = -mthumb QMAKE_QtDeclarative_CXXFLAGS = -mthumb QMAKE_QtMultimedia_CXXFLAGS = -mthumb @@ -34,8 +34,7 @@ QMAKE_QtSvg_CXXFLAGS = -mthumb QMAKE_QtTest_CXXFLAGS = -mthumb QMAKE_QtXmlPatterns_CXXFLAGS = -mthumb QMAKE_QtXml_CXXFLAGS = -mthumb -#TODO fails with; arm-none-symbianelf-ld: section .data loaded at [00e00000,00e05973] overlaps section .text loaded at [00008000,00fe748b] -QMAKE_QtWebKit_LFLAGS = -Ttext 0x8000 -Tdata 0xE00000 +#QMAKE_QtWebKit_LFLAGS = -Ttext 0x8000 -Tdata 0xE00000 # never use -fPIC, gcce-linker doesn't like it. # g++ conf above adds it if the host platform is 64 bit, so we remove it again @@ -58,7 +57,7 @@ QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB gcceExtraFlags = --include=$${EPOCROOT}epoc32/include/gcce/gcce.h -march=armv5t -mapcs -mthumb-interwork -nostdinc -c -msoft-float -T script QMAKE_CFLAGS += $${gcceExtraFlags} -QMAKE_CXXFLAGS += $${gcceExtraFlags} -x c++ -fexceptions -fno-unit-at-a-time -fvisibility-inlines-hidden +QMAKE_CXXFLAGS += $${gcceExtraFlags} -x c++ -fexceptions -fno-unit-at-a-time -fvisibility-inlines-hidden -Os #If we are not going to link to Qt or qtmain.lib, we need to include this at least once. isEmpty(QT):contains(TEMPLATE, app) { QMAKE_CXXFLAGS += --include=$${EPOCROOT}epoc32/include/stdapis/staticlibinit_gcce.h diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 4d51fa8..cf492d6 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -55,11 +55,9 @@ DEFINES += Q_INTERNAL_QAPP_SRC symbian { TARGET.UID3=0x2001B2DD - symbian-abld|symbian-sbsv2 { - # ro-section in gui can exceed default allocated space, so move rw-section a little further - QMAKE_LFLAGS.ARMCC += --rw-base 0x800000 - QMAKE_LFLAGS.GCCE += -Tdata 0xC00000 - } + # ro-section in gui can exceed default allocated space, so move rw-section a little further + QMAKE_LFLAGS.ARMCC += --rw-base 0x800000 + QMAKE_LFLAGS.GCCE += -Tdata 0x800000 } neon:*-g++* { -- cgit v0.12 From 3a8006907634e5d4c02822d5ce14d558dee8b930 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 7 Apr 2011 13:54:26 +0200 Subject: Add the rules for gcce in do_not_build_as_thumb.prf Reviewed-by: axis --- mkspecs/features/symbian/do_not_build_as_thumb.prf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mkspecs/features/symbian/do_not_build_as_thumb.prf b/mkspecs/features/symbian/do_not_build_as_thumb.prf index 0f1fd9f..91a63c2 100644 --- a/mkspecs/features/symbian/do_not_build_as_thumb.prf +++ b/mkspecs/features/symbian/do_not_build_as_thumb.prf @@ -5,4 +5,9 @@ symbian-abld|symbian-sbsv2 { QMAKE_CFLAGS += --arm QMAKE_CXXFLAGS -= --thumb QMAKE_CXXFLAGS += --arm +} else:symbian-gcce { + QMAKE_CFLAGS -= --thumb + QMAKE_CFLAGS += -marm -mthumb-interwork -mapcs + QMAKE_CXXFLAGS -= --thumb + QMAKE_CXXFLAGS += -marm -mthumb-interwork -mapcs } -- cgit v0.12 From a29a5862b32e36735f7014c8fc9083823bd3fbaa Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 7 Apr 2011 13:58:46 +0200 Subject: Enable webkit build for the makefile build system with gcce Task-number: QTBUG-18484 Task-number: WEBKIT-57841 Reviewed-by: axis Reviewed-by: Janne Koskinen --- src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h | 2 +- src/3rdparty/webkit/WebCore/WebCore.pro | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h index f8bace4..9349b48 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h @@ -190,7 +190,7 @@ inline float deg2turn(float d) { return d / 360.0f; } inline float rad2grad(float r) { return r * 200.0f / piFloat; } inline float grad2rad(float g) { return g * piFloat / 200.0f; } -#if !COMPILER(MSVC) && !COMPILER(RVCT) && !OS(ANDROID) && !COMPILER(WINSCW) +#if !COMPILER(MSVC) && !OS(ANDROID) && !OS(SYMBIAN) using std::isfinite; using std::isinf; using std::isnan; diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 37d216d..c70a168 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -37,15 +37,14 @@ symbian: { # Need to guarantee that these come before system includes of /epoc32/include MMP_RULES += "USERINCLUDE rendering" MMP_RULES += "USERINCLUDE platform/text" - symbian-abld|symbian-sbsv2 { - # RO text (code) section in qtwebkit.dll exceeds allocated space for gcce udeb target. - # Move RW-section base address to start from 0xE00000 instead of the toolchain default 0x400000. - QMAKE_LFLAGS.ARMCC += --rw-base 0xE00000 - MMP_RULES += ALWAYS_BUILD_AS_ARM - } else { - QMAKE_CFLAGS -= --thumb - QMAKE_CXXFLAGS -= --thumb - } + + # RO text (code) section in qtwebkit.dll exceeds allocated space for gcce udeb target. + # Move RW-section base address to start from 0xE00000 instead of the toolchain default 0x400000. + QMAKE_LFLAGS.ARMCC += --rw-base 0xE00000 + QMAKE_LFLAGS.GCCE += -Tdata 0x1000000 + + CONFIG += do_not_build_as_thumb + CONFIG(release, debug|release): QMAKE_CXXFLAGS.ARMCC += -OTime -O3 } -- cgit v0.12 From 8e14e026cfba15cb6e07044922532fbb0bed767c Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 7 Apr 2011 14:00:48 +0200 Subject: Enable webkit for symbian-gcce in configure Reviewed-by: axis --- configure | 1 - 1 file changed, 1 deletion(-) diff --git a/configure b/configure index 62eb009..4c8ac11 100755 --- a/configure +++ b/configure @@ -7120,7 +7120,6 @@ EOF canBuildQtConcurrent="no" ;; symbian-gcce) - canBuildWebKit="no" canBuildQtConcurrent="no" ;; symbian-armcc) -- cgit v0.12 From e81ef9c4744a759783af03ddb01508386b5f33cd Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 7 Apr 2011 15:43:06 +0300 Subject: Labels are not visible in dialogs with all themes QS60Style uses different theme background for dialogs. However, labels use just one color irregardless of background texture. Therefore, in certain themes, this might produce an issue, where foreground color (label) is not visible from background. To fix this, set the label color to correct theme color when label is contained within a dialog. Task-number: QT-4559 Reviewed-by: Tomi Vihria --- src/gui/styles/qs60style.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 05243a7..879d2e8 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -683,6 +683,13 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) if (header->viewport()) header->viewport()->setPalette(widgetPalette); QApplication::setPalette(widgetPalette, "QHeaderView"); + } else if (qobject_cast(widget)) { + if (widget->window() && widget->window()->windowType() == Qt::Dialog) { + QPalette widgetPalette = widget->palette(); + widgetPalette.setColor(QPalette::WindowText, + s60Color(QS60StyleEnums::CL_QsnTextColors, 19, 0)); + widget->setPalette(widgetPalette); + } } } -- cgit v0.12 From 63064c275481d0e694838e90dead784b53dc10aa Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 7 Apr 2011 15:50:07 +0300 Subject: Labels are not visible in dialogs with all themes (part2) Added include to the previous fix to prevent compilation issue. Task-number: QT-4559 Reviewed-by: Tomi Vihria --- src/gui/styles/qs60style.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 879d2e8..4b76985 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -72,6 +72,7 @@ #include "qcheckbox.h" #include "qdesktopwidget.h" #include "qprogressbar.h" +#include "qlabel.h" #include "private/qtoolbarextension_p.h" #include "private/qcombobox_p.h" -- cgit v0.12 From a41345b6a6f2ed6e8c1a3442aba8259bb87f9fed Mon Sep 17 00:00:00 2001 From: Ruth Sadler Date: Thu, 7 Apr 2011 14:34:18 +0100 Subject: Check the validity of qt_desktopWidget before dereferencing Task-number: QTMOBILITY-1494 Reviewed-by: Gareth Stockwell --- src/gui/kernel/qapplication_s60.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index a8680b9..f80b657 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1448,8 +1448,10 @@ void QSymbianControl::HandleResourceChange(int resourceType) { handleClientAreaChange(); // Send resize event to trigger desktopwidget workAreaResized signal - QResizeEvent e(qt_desktopWidget->size(), qt_desktopWidget->size()); - QApplication::sendEvent(qt_desktopWidget, &e); + if (qt_desktopWidget) { + QResizeEvent e(qt_desktopWidget->size(), qt_desktopWidget->size()); + QApplication::sendEvent(qt_desktopWidget, &e); + } break; } #endif -- cgit v0.12 From 2213f812acb023f7f52d930c30c0ea7a170629bf Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 8 Apr 2011 10:07:16 +0300 Subject: GraphicsView is not reset if focusItem is not set when keyboard closes When splitview closes (i.e. keyboard is dismissed), application's graphicsview containing the input widget (focus item) is reset back to original graphicsview transformation. As a fix, resetTransform is always called, when rootItem is found from graphicsView. Task-number: QT-4858 Reviewed-by: Guoqing Zhang --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 3b5290c..868565d 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -410,12 +410,14 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget) windowToMove->setUpdatesEnabled(false); if (!alwaysResize) { - if (gv->scene() && gv->scene()->focusItem()) { - // Check if the widget contains cursorPositionChanged signal and disconnect from it. - QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged())); - int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1)); - if (index != -1) - disconnect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); + if (gv->scene()) { + if (gv->scene()->focusItem()) { + // Check if the widget contains cursorPositionChanged signal and disconnect from it. + QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged())); + int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1)); + if (index != -1) + disconnect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); + } QGraphicsItem *rootItem = 0; foreach (QGraphicsItem *item, gv->scene()->items()) { -- cgit v0.12 From 57d886821ceae5adc989efee81b9c78508cac925 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 8 Apr 2011 11:20:35 +0300 Subject: Make QS60Style to support new Tab graphics in new Symbian releases In SR.11 there is a new theme graphics (with separate ID) for TabWidget tab shapes. Also, shapes are no longer set overlapped, but are side-by-side without any gaps. Earlier releases still use the existing graphics with overlapping. Task-number: QT-4762 Reviewed-by: Miikka Heikkinen --- src/gui/styles/qs60style.cpp | 30 ++++++++++++++++++++---------- src/gui/styles/qs60style_s60.cpp | 33 ++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 21 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 4b76985..585986d 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1550,8 +1550,10 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, skinElement==QS60StylePrivate::SE_TabBarTabWestActive) { const int borderThickness = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); - const int tabOverlap = - QS60StylePrivate::pixelMetric(PM_TabBarTabOverlap) - borderThickness; + int tabOverlap = pixelMetric(PM_TabBarTabOverlap); + if (tabOverlap > borderThickness) + tabOverlap -= borderThickness; + const bool usesScrollButtons = (widget) ? (qobject_cast(widget))->usesScrollButtons() : false; const int roomForScrollButton = @@ -1590,9 +1592,11 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QStyleOptionTabV3 optionTab = *tab; QRect tr = optionTab.rect; const bool directionMirrored = (optionTab.direction == Qt::RightToLeft); - const int borderThickness = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); - const int tabOverlap = - QS60StylePrivate::pixelMetric(PM_TabBarTabOverlap) - borderThickness; + const int borderThickness = + QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); + int tabOverlap = pixelMetric(PM_TabBarTabOverlap); + if (tabOverlap > borderThickness) + tabOverlap -= borderThickness; const bool usesScrollButtons = (widget) ? (qobject_cast(widget))->usesScrollButtons() : false; const int roomForScrollButton = @@ -2541,6 +2545,11 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const //without having to define custom pixel metric metricValue *= 2; +#if defined(Q_WS_S60) + if (metric == PM_TabBarTabOverlap && (QSysInfo::s60Version() > QSysInfo::SV_S60_5_2)) + metricValue = 0; +#endif + return metricValue; } @@ -3015,10 +3024,11 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con ret = QCommonStyle::subElementRect(element, opt, widget); if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast(opt)) { - const int tabOverlapNoBorder = - QS60StylePrivate::pixelMetric(PM_TabBarTabOverlap); - const int tabOverlap = - tabOverlapNoBorder - QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); + const int borderThickness = + QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); + int tabOverlap = pixelMetric(PM_TabBarTabOverlap); + if (tabOverlap > borderThickness) + tabOverlap -= borderThickness; const QTabWidget *tab = qobject_cast(widget); int gain = (tab) ? tabOverlap * tab->count() : 0; switch (twf->shape) { @@ -3036,7 +3046,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con if ((ret.right() + gain) > widget->rect().right()) gain = widget->rect().right() - ret.right(); ret.adjust(0, 0, gain, 0); - } + } } break; } diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 6a7158c..dc64872 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -89,17 +89,25 @@ enum TSupportRelease { ES60_5_0 = 0x0004, ES60_5_1 = 0x0008, ES60_5_2 = 0x0010, + ES60_5_3 = 0x0020, ES60_3_X = ES60_3_1 | ES60_3_2, // Releases before Symbian Foundation ES60_PreSF = ES60_3_1 | ES60_3_2 | ES60_5_0, + // Releases before the S60 5.2 + ES60_Pre52 = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1, + // Releases before S60 5.3 + ES60_Pre53 = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2, // Add all new releases here - ES60_All = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 + ES60_All = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 | ES60_5_3 }; typedef struct { - const TAknsItemID &skinID; - TDrawType drawType; - int supportInfo; + const TAknsItemID &skinID; // Determines default theme graphics ID. + TDrawType drawType; // Determines which native drawing routine is used to draw this item. + int supportInfo; // Defines the S60 versions that use the default graphics. + // These two, define new graphics that are used in releases other than partMapEntry.supportInfo defined releases. + // In general, these are given in numeric form to allow style compilation in earlier + // native releases that do not contain the new graphics. int newMajorSkinId; int newMinorSkinId; } partMapEntry; @@ -188,12 +196,14 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawGulIcon, ES60_All, -1,-1}, /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawGulIcon, ES60_All, -1,-1}, /* SP_QgnGrafScrollArrowUp */ {KAknsIIDQgnGrafScrollArrowUp, EDrawGulIcon, ES60_All, -1,-1}, - /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_All, -1,-1}, + + // In S60 5.3 there is a new tab graphic + /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_Pre53, EAknsMajorSkin, 0x2219}, //KAknsIIDQtgFrTabActiveNormalL + /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_Pre53, EAknsMajorSkin, 0x221b}, //KAknsIIDQtgFrTabActiveNormalC + /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_Pre53, EAknsMajorSkin, 0x221a}, //KAknsIIDQtgFrTabActiveNormalR + /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_Pre53, EAknsMajorSkin, 0x2221}, //KAknsIIDQtgFrTabPassiveNormalL + /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_Pre53, EAknsMajorSkin, 0x2223}, //KAknsIIDQtgFrTabPassiveNormalC + /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_Pre53, EAknsMajorSkin, 0x2222}, //KAknsIIDQtgFrTabPassiveNormalR // In 3.1 there is no slider groove. /* SP_QgnGrafNsliderEndLeft */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19cf /* KAknsIIDQgnGrafNsliderEndLeft */}, @@ -1140,7 +1150,8 @@ bool QS60StyleModeSpecifics::checkSupport(const int supportedRelease) (currentRelease == QSysInfo::SV_S60_3_2 && supportedRelease & ES60_3_2) || (currentRelease == QSysInfo::SV_S60_5_0 && supportedRelease & ES60_5_0) || (currentRelease == QSysInfo::SV_S60_5_1 && supportedRelease & ES60_5_1) || - (currentRelease == QSysInfo::SV_S60_5_2 && supportedRelease & ES60_5_2)); + (currentRelease == QSysInfo::SV_S60_5_2 && supportedRelease & ES60_5_2) || + (currentRelease == QSysInfo::SV_S60_5_3 && supportedRelease & ES60_5_3) ); } TAknsItemID QS60StyleModeSpecifics::partSpecificThemeId(int part) -- cgit v0.12 From a84b6c258841492dde22a8370e6b40b28bc4f078 Mon Sep 17 00:00:00 2001 From: Guoqing Zhang Date: Fri, 8 Apr 2011 11:45:31 +0300 Subject: Add focus frame support in stylesheet Task-number: QTBUG-16027 Reviewed-by: Sami Merila --- src/gui/styles/qstylesheetstyle.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index a4e7c38..6a0bf5e 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3339,6 +3339,11 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q } break; + case CE_FocusFrame: + if (rule.hasBorder()) + rule.drawBorder(p, opt->rect); + return; + case CE_PushButton: if (const QStyleOptionButton *btn = qstyleoption_cast(opt)) { if (rule.hasDrawable() || rule.hasBox() || rule.hasPosition() || rule.hasPalette() || -- cgit v0.12 From de9dd35dd8dc7502fcb4bd94ec1bbf2ff2435a68 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 8 Apr 2011 15:03:50 +0200 Subject: Add the auto detection for OpenVG in configure Task-number: QTBUG-18647 Reviewed-by: axis --- configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 4c8ac11..36402e5 100755 --- a/configure +++ b/configure @@ -641,10 +641,10 @@ CFG_XRANDR=runtime CFG_XRENDER=auto CFG_MITSHM=auto CFG_OPENGL=auto -CFG_OPENVG=no +CFG_OPENVG=auto CFG_OPENVG_LC_INCLUDES=no -CFG_OPENVG_SHIVA=no -CFG_OPENVG_ON_OPENGL=no +CFG_OPENVG_SHIVA=auto +CFG_OPENVG_ON_OPENGL=auto CFG_EGL=no CFG_EGL_GLES_INCLUDES=no CFG_SSE=auto -- cgit v0.12 From 0f7a4790bb0e3435a02f8751a29dc06c1f88d8d5 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Mon, 11 Apr 2011 13:48:35 +0300 Subject: tst_QStyle::drawItemPixmap test case fails on Symbian^3 The autotest assumes that created QPixmap are exactly same irregardless how the pixmaps were created. However, there is no guarantee that pixmaps that look the same (i.e. in this case green rectangles) are "same". QPixmap is platform dependent and might have e.g. optimized format in some of the platforms. Task-number: QT-4805 Reviewed-by: Jani Hautakangas --- tests/auto/qstyle/tst_qstyle.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/auto/qstyle/tst_qstyle.cpp b/tests/auto/qstyle/tst_qstyle.cpp index ad5d7ff..5c319f0 100644 --- a/tests/auto/qstyle/tst_qstyle.cpp +++ b/tests/auto/qstyle/tst_qstyle.cpp @@ -272,6 +272,18 @@ void tst_QStyle::drawItemPixmap() QPixmap p(QString(SRCDIR) + "/task_25863.png", "PNG"); QPixmap actualPix = QPixmap::grabWidget(testWidget); + +#ifdef Q_OS_SYMBIAN + // QPixmap cannot be assumed to be exactly same, unless it is created from exactly same content. + // In Symbian, pixmap format might get "optimized" depending on how QPixmap is created. + // Therefore, force the content to specific format and compare QImages. + // Then re-create the QPixmaps and compare those. + QImage i1 = p.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied); + p = QPixmap::fromImage(i1); + QImage i2 = actualPix.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied); + actualPix = QPixmap::fromImage(i2); + QVERIFY(i1 == i2); +#endif QVERIFY(pixmapsAreEqual(&actualPix,&p)); testWidget->hide(); } -- cgit v0.12 From e2ac68f3437ab6e9e865c7c9ad1c52b293f61910 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 23 Mar 2011 20:05:49 +0100 Subject: fix detection of relative location information an empty line number does not indicate relative loc info - it may be the result of -no-ui-lines. instead, an empty file name does indicate it - no file name at all makes no sense, so this means a previous messages has set it already. and we need this additional detection, as the entire ts file may have no line number info to base the decision on at all. --- tools/linguist/shared/ts.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/linguist/shared/ts.cpp b/tools/linguist/shared/ts.cpp index 85be5c6..4523bc5 100644 --- a/tools/linguist/shared/ts.cpp +++ b/tools/linguist/shared/ts.cpp @@ -264,6 +264,7 @@ bool TSReader::read(Translator &translator) //qDebug() << "TS " << attributes(); QHash currentLine; QString currentFile; + bool maybeRelative = false, maybeAbsolute = false; QXmlStreamAttributes atts = attributes(); //QString version = atts.value(strversion).toString(); @@ -342,10 +343,12 @@ bool TSReader::read(Translator &translator) msg.setTranslatorComment(readContents()); } else if (elementStarts(strlocation)) { // + maybeAbsolute = true; QXmlStreamAttributes atts = attributes(); QString fileName = atts.value(strfilename).toString(); if (fileName.isEmpty()) { fileName = currentMsgFile; + maybeRelative = true; } else { if (refs.isEmpty()) currentFile = fileName; @@ -353,7 +356,6 @@ bool TSReader::read(Translator &translator) } const QString lin = atts.value(strline).toString(); if (lin.isEmpty()) { - translator.setLocationsType(Translator::RelativeLocations); refs.append(TranslatorMessage::Reference(fileName, -1)); } else { bool bOK; @@ -361,9 +363,7 @@ bool TSReader::read(Translator &translator) if (bOK) { if (lin.startsWith(QLatin1Char('+')) || lin.startsWith(QLatin1Char('-'))) { lineNo = (currentLine[fileName] += lineNo); - translator.setLocationsType(Translator::RelativeLocations); - } else { - translator.setLocationsType(Translator::AbsoluteLocations); + maybeRelative = true; } refs.append(TranslatorMessage::Reference(fileName, lineNo)); } @@ -422,6 +422,9 @@ bool TSReader::read(Translator &translator) } else { handleError(); } + translator.setLocationsType(maybeRelative ? Translator::RelativeLocations : + maybeAbsolute ? Translator::AbsoluteLocations : + Translator::NoLocations); } // } else { handleError(); @@ -727,7 +730,6 @@ bool saveTS(const Translator &translator, QIODevice &dev, ConversionData &cd, in bool loadTS(Translator &translator, QIODevice &dev, ConversionData &cd) { - translator.setLocationsType(Translator::NoLocations); TSReader reader(dev, cd); return reader.read(translator); } -- cgit v0.12 From 3bc0d853a09ae55c158946a99284a47b0b30a3b4 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 12 Apr 2011 11:36:37 +1000 Subject: Fix regression in wigglytext.qml This change re-adds the code removed in 8e9c28eaa4d7a3372b9a9a21a984701b62f96456 (which caused this regression), while keeping the new code as well (to specially handle the case of registration in componentCompleted()). Change-Id: I707e3d2ead9ea25079f79cd5e5886d1dc1c69d1b Task-number: QTBUG-18362 Reviewed-by: Aaron Kennedy --- src/declarative/qml/qdeclarativecomponent.cpp | 17 +++++++++++++++ src/declarative/qml/qdeclarativecomponent_p.h | 1 + .../data/delayedRegistration.qml | 25 ++++++++++++++++++++++ .../tst_qdeclarativebehaviors.cpp | 18 ++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativebehaviors/data/delayedRegistration.qml diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index fc393d1..ac683a7 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -880,6 +880,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentCon state->bindValues = enginePriv->bindValues; state->parserStatus = enginePriv->parserStatus; + state->finalizedParserStatus = enginePriv->finalizedParserStatus; state->componentAttached = enginePriv->componentAttached; if (state->componentAttached) state->componentAttached->prev = &state->componentAttached; @@ -887,6 +888,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentCon enginePriv->componentAttached = 0; enginePriv->bindValues.clear(); enginePriv->parserStatus.clear(); + enginePriv->finalizedParserStatus.clear(); state->completePending = true; enginePriv->inProgressCreations++; } @@ -917,6 +919,7 @@ void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeEnginePrivate *engi state->bindValues = enginePriv->bindValues; state->parserStatus = enginePriv->parserStatus; + state->finalizedParserStatus = enginePriv->finalizedParserStatus; state->componentAttached = enginePriv->componentAttached; if (state->componentAttached) state->componentAttached->prev = &state->componentAttached; @@ -924,6 +927,7 @@ void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeEnginePrivate *engi enginePriv->componentAttached = 0; enginePriv->bindValues.clear(); enginePriv->parserStatus.clear(); + enginePriv->finalizedParserStatus.clear(); state->completePending = true; enginePriv->inProgressCreations++; } @@ -961,6 +965,18 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri QDeclarativeEnginePrivate::clear(ps); } + for (int ii = 0; ii < state->finalizedParserStatus.count(); ++ii) { + QPair, int> status = state->finalizedParserStatus.at(ii); + QObject *obj = status.first; + if (obj) { + void *args[] = { 0 }; + QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, + status.second, args); + } + } + + //componentComplete() can register additional finalization objects + //that are then never handled. Handle them manually here. if (1 == enginePriv->inProgressCreations) { for (int ii = 0; ii < enginePriv->finalizedParserStatus.count(); ++ii) { QPair, int> status = enginePriv->finalizedParserStatus.at(ii); @@ -986,6 +1002,7 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri state->bindValues.clear(); state->parserStatus.clear(); + state->finalizedParserStatus.clear(); state->completePending = false; enginePriv->inProgressCreations--; diff --git a/src/declarative/qml/qdeclarativecomponent_p.h b/src/declarative/qml/qdeclarativecomponent_p.h index 020c5e0..f8bec2b 100644 --- a/src/declarative/qml/qdeclarativecomponent_p.h +++ b/src/declarative/qml/qdeclarativecomponent_p.h @@ -101,6 +101,7 @@ public: ConstructionState() : componentAttached(0), completePending(false) {} QList > bindValues; QList > parserStatus; + QList, int> > finalizedParserStatus; QDeclarativeComponentAttached *componentAttached; QList errors; bool completePending; diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/delayedRegistration.qml b/tests/auto/declarative/qdeclarativebehaviors/data/delayedRegistration.qml new file mode 100644 index 0000000..aa384c3 --- /dev/null +++ b/tests/auto/declarative/qdeclarativebehaviors/data/delayedRegistration.qml @@ -0,0 +1,25 @@ +import QtQuick 1.0 + +Rectangle { + id: container + + width: 400; height: 400; + property Item myItem + + function doCreate() { + myItem = myComponent.createObject(container) + myItem.x = 100 + } + + Component { + id: myComponent + Rectangle { + width: 100 + height: 100 + color: "green" + Behavior on x { NumberAnimation { duration: 500 } } + } + } + + Component.onCompleted: doCreate() +} diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index 80ba907..4536d9e 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -81,6 +81,7 @@ private slots: void groupedPropertyCrash(); void runningTrue(); void sameValue(); + void delayedRegistration(); }; void tst_qdeclarativebehaviors::simpleBehavior() @@ -412,6 +413,23 @@ void tst_qdeclarativebehaviors::sameValue() QTRY_VERIFY(target->x() != qreal(0) && target->x() != qreal(100)); } +//QTBUG-18362 +void tst_qdeclarativebehaviors::delayedRegistration() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/delayedRegistration.qml"); + QDeclarativeRectangle *rect = qobject_cast(c.create()); + QVERIFY(rect != 0); + + QDeclarativeItem *innerRect = rect->property("myItem").value(); + QVERIFY(innerRect != 0); + + QCOMPARE(innerRect->property("x").toInt(), int(0)); + + QTRY_COMPARE(innerRect->property("x").toInt(), int(100)); +} + QTEST_MAIN(tst_qdeclarativebehaviors) #include "tst_qdeclarativebehaviors.moc" -- cgit v0.12 From ddae2b67a8eab5e6b298ce516234f4bf7c0367c1 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 12 Apr 2011 14:51:19 +1000 Subject: Ensure view is positioned correctly when orientation changes. Change-Id: I7fbedff965ae8c89dcbb96ba5dcee85c07aa29b1 Task-number: QTBUG-17065 Reviewed-by: Bea Lam --- .../graphicsitems/qdeclarativelistview.cpp | 2 + .../qdeclarativelistview/data/orientchange.qml | 7 ++++ .../tst_qdeclarativelistview.cpp | 47 ++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativelistview/data/orientchange.qml diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index f176916..4da45d1 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -2119,9 +2119,11 @@ void QDeclarativeListView::setOrientation(QDeclarativeListView::Orientation orie if (d->orient == QDeclarativeListView::Vertical) { setContentWidth(-1); setFlickableDirection(VerticalFlick); + setContentX(0); } else { setContentHeight(-1); setFlickableDirection(HorizontalFlick); + setContentY(0); } d->regenerate(); emit orientationChanged(); diff --git a/tests/auto/declarative/qdeclarativelistview/data/orientchange.qml b/tests/auto/declarative/qdeclarativelistview/data/orientchange.qml new file mode 100644 index 0000000..c7aa0cd --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/orientchange.qml @@ -0,0 +1,7 @@ +import QtQuick 1.0 + +ListView { + width: 240; height: 320 + delegate: Rectangle { objectName: "wrapper"; width: 80; height: 80 } + model: 100 +} diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 2267a89..ec60e8a 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -119,6 +119,7 @@ private slots: void testQtQuick11Attributes_data(); void rightToLeft(); void test_mirroring(); + void orientationChange(); private: template void items(); @@ -2583,6 +2584,52 @@ void tst_QDeclarativeListView::test_mirroring() delete canvasB; } +void tst_QDeclarativeListView::orientationChange() +{ + QDeclarativeView *canvas = createView(); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/orientchange.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = qobject_cast(canvas->rootObject()); + QVERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QVERIFY(contentItem != 0); + + listview->positionViewAtIndex(50, QDeclarativeListView::Beginning); + + // Confirm items positioned correctly + for (int i = 50; i < 54; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + QVERIFY(item); + QCOMPARE(item->y(), i*80.0); + } + + listview->setOrientation(QDeclarativeListView::Horizontal); + QCOMPARE(listview->contentY(), 0.); + + // Confirm items positioned correctly + for (int i = 0; i < 3; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + QVERIFY(item); + QCOMPARE(item->x(), i*80.0); + } + + listview->positionViewAtIndex(50, QDeclarativeListView::Beginning); + listview->setOrientation(QDeclarativeListView::Vertical); + QCOMPARE(listview->contentX(), 0.); + // + // Confirm items positioned correctly + for (int i = 0; i < 4; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + QVERIFY(item); + QCOMPARE(item->y(), i*80.0); + } + + delete canvas; +} + void tst_QDeclarativeListView::qListModelInterface_items() { items(); -- cgit v0.12 From c17150344510fc5fe239e39e6659bd16579586e8 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 12 Apr 2011 15:09:48 +1000 Subject: ListView has wrong keyPressEvent behaviour when vertical Regression intorduced by RTL changes. Change-Id: I272d07cd21d04f3e534aa183b1b10fcc8d062b79 Task-number: QTBUG-18581 Reviewed-by: Bea Lam --- src/declarative/graphicsitems/qdeclarativelistview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 4da45d1..cb751f6 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -2770,7 +2770,7 @@ void QDeclarativeListView::keyPressEvent(QKeyEvent *event) return; if (d->model && d->model->count() && d->interactive) { - if ((!d->isRightToLeft() && event->key() == Qt::Key_Left) + if ((d->orient == QDeclarativeListView::Horizontal && !d->isRightToLeft() && event->key() == Qt::Key_Left) || (d->orient == QDeclarativeListView::Horizontal && d->isRightToLeft() && event->key() == Qt::Key_Right) || (d->orient == QDeclarativeListView::Vertical && event->key() == Qt::Key_Up)) { if (currentIndex() > 0 || (d->wrap && !event->isAutoRepeat())) { @@ -2781,7 +2781,7 @@ void QDeclarativeListView::keyPressEvent(QKeyEvent *event) event->accept(); return; } - } else if ((!d->isRightToLeft() && event->key() == Qt::Key_Right) + } else if ((d->orient == QDeclarativeListView::Horizontal && !d->isRightToLeft() && event->key() == Qt::Key_Right) || (d->orient == QDeclarativeListView::Horizontal && d->isRightToLeft() && event->key() == Qt::Key_Left) || (d->orient == QDeclarativeListView::Vertical && event->key() == Qt::Key_Down)) { if (currentIndex() < d->model->count() - 1 || (d->wrap && !event->isAutoRepeat())) { -- cgit v0.12 From cd19ab9f306f777b495cceabaf57a6eeaf86a82a Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Tue, 12 Apr 2011 09:32:06 +0300 Subject: Two QListView autotests do not pass on Symbian^3 releases tst_QListView::taskQTBUG_2678_spacingAndWrappedText() fails because: QS60Style adds to the itemview item content size margins and empty space, which shouldn't be part of the content size. As a fix, remove these. taskQTBUG_435_deselectOnViewportClick() fails because: Sending a click to a selected itemview item, when it should be sent to below that specific one. It was using hardcoded (center + 20) and autotest assumed that this would be outside of first item. In S60 with touch support, the itemview items are rather tall (49 pixels). As a fix, autotest now uses calculated value, which ensures that click is sent to outside first item. Task-number: QT-4810 Reviewed-by: Tomi Vihria --- src/gui/styles/qs60style.cpp | 2 -- tests/auto/qlistview/tst_qlistview.cpp | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 585986d..91ac45e 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2664,8 +2664,6 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, } } sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); - //native items have small empty areas at the beginning and end of menu item - sz.setWidth(sz.width() + 2 * pixelMetric(PM_MenuHMargin) + 2 * QS60StylePrivate::pixelMetric(PM_FrameCornerWidth)); if (QS60StylePrivate::isTouchSupported()) { //Make itemview easier to use in touch devices sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin)); diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index b6e69a0..ee03386 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -1893,7 +1893,8 @@ void tst_QListView::taskQTBUG_435_deselectOnViewportClick() QCOMPARE(view.selectionModel()->selectedIndexes().count(), model.rowCount()); - QPoint p = view.visualRect(model.index(model.rowCount() - 1)).center() + QPoint(0, 20); + const QRect itemRect = view.visualRect(model.index(model.rowCount() - 1)); + QPoint p = view.visualRect(model.index(model.rowCount() - 1)).center() + QPoint(0, itemRect.height()); //first the left button QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, p); QVERIFY(!view.selectionModel()->hasSelection()); -- cgit v0.12 From 80083187af81316d436483e5fc39cfddccc821cc Mon Sep 17 00:00:00 2001 From: Guoqing Zhang Date: Tue, 12 Apr 2011 10:59:43 +0300 Subject: Add focus frame support in style sheet Task-number: QTBUG-16207 Reviewed-by: Sami Merila --- src/gui/styles/qstylesheetstyle.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 6a0bf5e..369a0f0 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3340,9 +3340,11 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q break; case CE_FocusFrame: - if (rule.hasBorder()) + if (!rule.hasNativeBorder()) { rule.drawBorder(p, opt->rect); - return; + return; + } + break; case CE_PushButton: if (const QStyleOptionButton *btn = qstyleoption_cast(opt)) { -- cgit v0.12 From 7e032238ef7a91f4a9c1337b5e06204fadbc6f55 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 12 Apr 2011 11:04:41 +0200 Subject: Revert "Have the backing store destroyed also in special Symbian scenarios." This reverts commit a12d41076919a133e63de63dff5c1a131a0564e4. --- src/gui/kernel/qwidget.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index be615a4..0a73481 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -234,8 +234,7 @@ void QWidgetBackingStoreTracker::registerWidget(QWidget *w) */ void QWidgetBackingStoreTracker::unregisterWidget(QWidget *w) { - m_widgets.remove(w); - if (m_widgets.isEmpty()) { + if (m_widgets.remove(w) && m_widgets.isEmpty()) { delete m_ptr; m_ptr = 0; } -- cgit v0.12 From 8b9c94c95ef5dd9620dc35c4ab20cd109369636f Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Tue, 12 Apr 2011 12:13:21 +0300 Subject: QS60Style: itemview item with checkbox and text is drawn incorrectly QS60Style deduces incorrectly when itemview only contains checkbox. This is minor, yet highly annoying bug that prevents highlighted itemview item from showing its content with themes that have opaque itemview item highlight (highlight covers the text that is underneath). As a fix, check itemview item text and icon content before declaring it as "checkbox only". Task-number: QTBUG-18694 Reviewed-by: Tomi Vihria --- src/gui/styles/qs60style.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 91ac45e..f146075 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -3132,7 +3132,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con } break; case SE_ItemViewItemCheckIndicator: - if (const QStyleOptionViewItemV2 *vopt = qstyleoption_cast(opt)) { + if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast(opt)) { const QAbstractItemView *listItem = qobject_cast(widget); const bool singleSelection = listItem && @@ -3140,7 +3140,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con listItem->selectionMode() == QAbstractItemView::NoSelection); const bool checkBoxOnly = (vopt->features & QStyleOptionViewItemV2::HasCheckIndicator) && listItem && - singleSelection; + singleSelection && vopt->text.isEmpty() && vopt->icon.isNull(); // Selection check mark rect. const int indicatorWidth = QS60StylePrivate::pixelMetric(PM_IndicatorWidth); -- cgit v0.12 From 7f8773a209567fb9c962602b8b1f4ec70e38ea51 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 22 Mar 2011 20:08:22 +0100 Subject: prefix TEMPLATE_PREFIX to TEMPLATE even if it is "default-constructed" that way prf files don't have to check both the prefix and the actual template to identify visual studio mode. Reviewed-by: mariusSO --- qmake/project.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index e985401..16200f1 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -3028,17 +3028,17 @@ QStringList &QMakeProject::values(const QString &_var, QMap Date: Tue, 22 Mar 2011 20:20:18 +0100 Subject: clean up visual studio identification code TEMPLATE is (now) reliably prefixed with "vc" when a vs generator is used. Reviewed-by: mariusSO --- mkspecs/features/incredibuild_xge.prf | 2 +- mkspecs/features/moc.prf | 8 ++++---- mkspecs/features/win32/embed_manifest_dll.prf | 2 +- mkspecs/features/win32/embed_manifest_exe.prf | 2 +- mkspecs/features/win32/qaxserver.prf | 10 ++-------- mkspecs/wince50standard-armv4i-msvc2005/default_post.prf | 2 +- mkspecs/wince50standard-mipsii-msvc2005/default_post.prf | 2 +- mkspecs/wince50standard-x86-msvc2005/default_post.prf | 2 +- mkspecs/wincewm50pocket-msvc2005/default_post.prf | 2 +- mkspecs/wincewm50smart-msvc2005/default_post.prf | 2 +- mkspecs/wincewm60professional-msvc2005/default_post.prf | 2 +- mkspecs/wincewm60standard-msvc2005/default_post.prf | 2 +- 12 files changed, 16 insertions(+), 22 deletions(-) diff --git a/mkspecs/features/incredibuild_xge.prf b/mkspecs/features/incredibuild_xge.prf index a81a0cc..97ccc44 100644 --- a/mkspecs/features/incredibuild_xge.prf +++ b/mkspecs/features/incredibuild_xge.prf @@ -1,4 +1,4 @@ -contains(TEMPLATE, "vc.*")|contains(TEMPLATE_PREFIX, "vc") { +contains(TEMPLATE, "vc.*") { EOC = $$escape_expand(\\n\\t) # The VCPROJ generator will replace the \r\h with the coded \r\n: diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf index 89e9b40..d0b36e4 100644 --- a/mkspecs/features/moc.prf +++ b/mkspecs/features/moc.prf @@ -16,7 +16,7 @@ win32:count($$list($$INCLUDEPATH), 40, >) { EOC = $$escape_expand(\\n\\t) - if(contains(TEMPLATE, "vc.*")|contains(TEMPLATE_PREFIX, "vc")) { + contains(TEMPLATE, "vc.*") { # the VCPROJ generator will replace the \r\h with the coded \r\n: # No other generator understands the \h if(win32-msvc2*|wince*msvc*): EOC = $$escape_expand(\\r\\h) @@ -42,7 +42,7 @@ win32:count($$list($$INCLUDEPATH), 40, >) { defineReplace(mocCmdBase) { !isEmpty(WIN_INCLUDETEMP) { RET = - if(contains(TEMPLATE, "vc.*")|contains(TEMPLATE_PREFIX, "vc")) { + contains(TEMPLATE, "vc.*") { RET += $$mocinclude.commands } RET += $$QMAKE_MOC $(DEFINES) @$$WIN_INCLUDETEMP $$join(QMAKE_COMPILER_DEFINES, " -D", -D) @@ -59,7 +59,7 @@ moc_header.output = $$MOC_DIR/$${QMAKE_H_MOD_MOC}${QMAKE_FILE_BASE}$${first(QMAK moc_header.input = HEADERS moc_header.variable_out = SOURCES moc_header.name = MOC ${QMAKE_FILE_IN} -if(!contains(TEMPLATE, "vc.*"):!contains(TEMPLATE_PREFIX, "vc")) { +!contains(TEMPLATE, "vc.*") { !isEmpty(INCLUDETEMP):moc_header.depends += $$INCLUDETEMP } silent:moc_header.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_header.commands @@ -73,7 +73,7 @@ moc_source.commands = ${QMAKE_FUNC_mocCmdBase} ${QMAKE_FILE_IN} -o ${QMAKE_FILE_ moc_source.output = $$MOC_DIR/$${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}$${QMAKE_EXT_CPP_MOC} moc_source.input = SOURCES OBJECTIVE_SOURCES moc_source.name = MOC ${QMAKE_FILE_IN} -if(!contains(TEMPLATE, "vc.*"):!contains(TEMPLATE_PREFIX, "vc")) { +!contains(TEMPLATE, "vc.*") { !isEmpty(INCLUDETEMP):moc_source.depends += $$INCLUDETEMP } silent:moc_source.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_source.commands diff --git a/mkspecs/features/win32/embed_manifest_dll.prf b/mkspecs/features/win32/embed_manifest_dll.prf index 69c9d1d..5545a62 100644 --- a/mkspecs/features/win32/embed_manifest_dll.prf +++ b/mkspecs/features/win32/embed_manifest_dll.prf @@ -1,4 +1,4 @@ -!if(plugin:no_plugin_manifest):if(win32-msvc2005*|win32-msvc2008*|win32-msvc2010*):!static:!equals(TEMPLATE_PREFIX, "vc"):equals(TEMPLATE, "lib") { +!if(plugin:no_plugin_manifest):if(win32-msvc2005*|win32-msvc2008*|win32-msvc2010*):!static:equals(TEMPLATE, "lib") { MANIFEST_DIR = $$OBJECTS_DIR isEmpty(MANIFEST_DIR):MANIFEST_DIR = . NOPATH_TARGET = $$TARGET diff --git a/mkspecs/features/win32/embed_manifest_exe.prf b/mkspecs/features/win32/embed_manifest_exe.prf index 44aadfa..c6d012e 100644 --- a/mkspecs/features/win32/embed_manifest_exe.prf +++ b/mkspecs/features/win32/embed_manifest_exe.prf @@ -1,4 +1,4 @@ -if(win32-msvc2005*|win32-msvc2008*|win32-msvc2010*):!equals(TEMPLATE_PREFIX, "vc"):equals(TEMPLATE, "app") { +if(win32-msvc2005*|win32-msvc2008*|win32-msvc2010*):equals(TEMPLATE, "app") { MANIFEST_DIR = $$OBJECTS_DIR isEmpty(MANIFEST_DIR):MANIFEST_DIR = . NOPATH_TARGET = $$TARGET diff --git a/mkspecs/features/win32/qaxserver.prf b/mkspecs/features/win32/qaxserver.prf index 2899976..a6c0869 100644 --- a/mkspecs/features/win32/qaxserver.prf +++ b/mkspecs/features/win32/qaxserver.prf @@ -8,12 +8,7 @@ isEmpty(ACTIVEQT_VERSION):ACTIVEQT_VERSION = 1.0 DEFINES += QAXSERVER -ACTIVEQT_IDE = makefile -equals(TEMPLATE_PREFIX, "vc"):ACTIVEQT_IDE = VisualStudio -equals(TEMPLATE, "vcapp"):ACTIVEQT_IDE = VisualStudio -equals(TEMPLATE, "vclib"):ACTIVEQT_IDE = VisualStudio - -equals(ACTIVEQT_IDE, "VisualStudio") { +contains(TEMPLATE, "vc.*") { ACTIVEQT_IDC = $${QMAKE_IDC} ### Qt5: remove me qtPrepareTool(ACTIVEQT_IDC, idc) ACTIVEQT_IDL = $${QMAKE_IDL} @@ -27,8 +22,7 @@ equals(ACTIVEQT_IDE, "VisualStudio") { } ACTIVEQT_TLBOUT = "$(TargetDir)/$${TARGET}.tlb" GENERATED += $${OBJECTS_DIR}/$${TARGET}.idl $${ACTIVEQT_TLBOUT} -} -equals(ACTIVEQT_IDE, "makefile") { +} else { ACTIVEQT_IDC = -$(IDC) ACTIVEQT_IDL = -$(IDL) ACTIVEQT_NEWLINE = $$escape_expand(\\n\\t) diff --git a/mkspecs/wince50standard-armv4i-msvc2005/default_post.prf b/mkspecs/wince50standard-armv4i-msvc2005/default_post.prf index 3dab72a..900d758 100644 --- a/mkspecs/wince50standard-armv4i-msvc2005/default_post.prf +++ b/mkspecs/wince50standard-armv4i-msvc2005/default_post.prf @@ -1,6 +1,6 @@ # Visual Studio has some definitions set internally. # Thus we do not need to redefine these. -if(equals(TEMPLATE_PREFIX, "vc") | equals(TEMPLATE, "vc*")) { +equals(TEMPLATE, "vc.*") { DEFINES -= _M_ARM QMAKE_CXXFLAGS += -fp:precise } diff --git a/mkspecs/wince50standard-mipsii-msvc2005/default_post.prf b/mkspecs/wince50standard-mipsii-msvc2005/default_post.prf index d3e49ab..4dbcf35 100644 --- a/mkspecs/wince50standard-mipsii-msvc2005/default_post.prf +++ b/mkspecs/wince50standard-mipsii-msvc2005/default_post.prf @@ -1,6 +1,6 @@ # Visual Studio has some definitions set internally. # Thus we do not need to redefine these. -if(equals(TEMPLATE_PREFIX, "vc") | equals(TEMPLATE, "vc*")) { +contains(TEMPLATE, "vc.*") { DEFINES -= _M_MRX000=3000 QMAKE_CXXFLAGS += -fp:precise } diff --git a/mkspecs/wince50standard-x86-msvc2005/default_post.prf b/mkspecs/wince50standard-x86-msvc2005/default_post.prf index 6790c60..2436efb 100644 --- a/mkspecs/wince50standard-x86-msvc2005/default_post.prf +++ b/mkspecs/wince50standard-x86-msvc2005/default_post.prf @@ -1,6 +1,6 @@ # Visual Studio has some definitions set internally. # Thus we do not need to redefine these. -if(equals(TEMPLATE_PREFIX, "vc") | equals(TEMPLATE, "vc*")) { +equals(TEMPLATE, "vc.*") { QMAKE_CXXFLAGS += -fp:precise } diff --git a/mkspecs/wincewm50pocket-msvc2005/default_post.prf b/mkspecs/wincewm50pocket-msvc2005/default_post.prf index 3dab72a..84ea15e 100644 --- a/mkspecs/wincewm50pocket-msvc2005/default_post.prf +++ b/mkspecs/wincewm50pocket-msvc2005/default_post.prf @@ -1,6 +1,6 @@ # Visual Studio has some definitions set internally. # Thus we do not need to redefine these. -if(equals(TEMPLATE_PREFIX, "vc") | equals(TEMPLATE, "vc*")) { +contains(TEMPLATE, "vc.*") { DEFINES -= _M_ARM QMAKE_CXXFLAGS += -fp:precise } diff --git a/mkspecs/wincewm50smart-msvc2005/default_post.prf b/mkspecs/wincewm50smart-msvc2005/default_post.prf index 3dab72a..84ea15e 100644 --- a/mkspecs/wincewm50smart-msvc2005/default_post.prf +++ b/mkspecs/wincewm50smart-msvc2005/default_post.prf @@ -1,6 +1,6 @@ # Visual Studio has some definitions set internally. # Thus we do not need to redefine these. -if(equals(TEMPLATE_PREFIX, "vc") | equals(TEMPLATE, "vc*")) { +contains(TEMPLATE, "vc.*") { DEFINES -= _M_ARM QMAKE_CXXFLAGS += -fp:precise } diff --git a/mkspecs/wincewm60professional-msvc2005/default_post.prf b/mkspecs/wincewm60professional-msvc2005/default_post.prf index 3dab72a..84ea15e 100644 --- a/mkspecs/wincewm60professional-msvc2005/default_post.prf +++ b/mkspecs/wincewm60professional-msvc2005/default_post.prf @@ -1,6 +1,6 @@ # Visual Studio has some definitions set internally. # Thus we do not need to redefine these. -if(equals(TEMPLATE_PREFIX, "vc") | equals(TEMPLATE, "vc*")) { +contains(TEMPLATE, "vc.*") { DEFINES -= _M_ARM QMAKE_CXXFLAGS += -fp:precise } diff --git a/mkspecs/wincewm60standard-msvc2005/default_post.prf b/mkspecs/wincewm60standard-msvc2005/default_post.prf index 3dab72a..84ea15e 100644 --- a/mkspecs/wincewm60standard-msvc2005/default_post.prf +++ b/mkspecs/wincewm60standard-msvc2005/default_post.prf @@ -1,6 +1,6 @@ # Visual Studio has some definitions set internally. # Thus we do not need to redefine these. -if(equals(TEMPLATE_PREFIX, "vc") | equals(TEMPLATE, "vc*")) { +contains(TEMPLATE, "vc.*") { DEFINES -= _M_ARM QMAKE_CXXFLAGS += -fp:precise } -- cgit v0.12 From 3838388e8143ac5f5e1f3688f9ba31190fd9bbd3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 23 Mar 2011 12:31:48 +0100 Subject: useful location reporting for errors from QMAKE_SUBSTITUTES Reviewed-by: mariusSO --- qmake/generators/makefile.cpp | 2 +- qmake/project.cpp | 14 ++++++++++++++ qmake/project.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index c13f38e..f9eba22 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -545,7 +545,7 @@ MakefileGenerator::init() else state.pop(); } else if(state.isEmpty() || state.top() == IN_CONDITION) { - contents += project->expand(line).join(QString(Option::field_sep)); + contents += project->expand(line, in.fileName(), count); } } if(out.exists() && out.open(QFile::ReadOnly)) { diff --git a/qmake/project.cpp b/qmake/project.cpp index 16200f1..d4f21be 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -2773,6 +2773,20 @@ QMakeProject::expand(const QString &str) return QStringList(); } +QString +QMakeProject::expand(const QString &str, const QString &file, int line) +{ + bool ok; + parser_info pi = parser; + parser.file = file; + parser.line_no = line; + parser.from_file = false; + QMap tmp = vars; + const QStringList ret = doVariableReplaceExpand(str, tmp, &ok); + parser = pi; + return ok ? ret.join(QString(Option::field_sep)) : QString(); +} + QStringList QMakeProject::expand(const QString &func, const QList &args) { diff --git a/qmake/project.h b/qmake/project.h index 09aa45e..0e6131d 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -144,6 +144,7 @@ public: QMap &place); QStringList expand(const QString &v); + QString expand(const QString &v, const QString &file, int line); QStringList expand(const QString &func, const QList &args); bool test(const QString &v); bool test(const QString &func, const QList &args); -- cgit v0.12 From ec834adf0ce004cb2919766dc12b31963d320f56 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 23 Mar 2011 12:57:49 +0100 Subject: make uic3-generated moc files depend on mocinclude.tmp Task-number: QTBUG-16951 Reviewed-by: mariusSO --- mkspecs/features/uic.prf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkspecs/features/uic.prf b/mkspecs/features/uic.prf index 0a18b47..74a2683 100644 --- a/mkspecs/features/uic.prf +++ b/mkspecs/features/uic.prf @@ -77,6 +77,7 @@ uic3 { uic3_moc.input = UIC3_HEADERS uic3_moc.variable_out = GENERATED_SOURCES uic3_moc.name = $$moc_header.name + !contains(TEMPLATE, "vc.*"):!isEmpty(INCLUDETEMP):uic3_moc.depends += $$INCLUDETEMP QMAKE_EXTRA_COMPILERS += uic3_moc } -- cgit v0.12 From 3aa39b0164ce4bb9e551feb0417990e5679c5209 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 23 Mar 2011 17:07:36 +0100 Subject: create a pwd string with a trailing slash only on demand Reviewed-by: mariusSO --- qmake/generators/makefile.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index f9eba22..f5b7295 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -2825,9 +2825,6 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q return cacheVal; //do the fixin' - QString pwd = qmake_getpwd(); - if (!pwd.endsWith('/')) - pwd += '/'; QString orig_file = ret; if(ret.startsWith(QLatin1Char('~'))) { if(ret.startsWith(QLatin1String("~/"))) @@ -2836,12 +2833,16 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q warn_msg(WarnLogic, "Unable to expand ~ in %s", ret.toLatin1().constData()); } if(fix == FileFixifyAbsolute || (fix == FileFixifyDefault && project->isActiveConfig("no_fixpath"))) { - if(fix == FileFixifyAbsolute && QDir::isRelativePath(ret)) //already absolute + if(fix == FileFixifyAbsolute && QDir::isRelativePath(ret)) { //already absolute + QString pwd = qmake_getpwd(); + if (!pwd.endsWith(QLatin1Char('/'))) + pwd += QLatin1Char('/'); ret.prepend(pwd); + } ret = Option::fixPathToTargetOS(ret, false, canon); } else { //fix it.. QString out_dir = QDir(Option::output_dir).absoluteFilePath(out_d); - QString in_dir = QDir(pwd).absoluteFilePath(in_d); + QString in_dir = QDir(qmake_getpwd()).absoluteFilePath(in_d); { QFileInfo in_fi(fileInfo(in_dir)); if(in_fi.exists()) @@ -2907,7 +2908,7 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q ret = "."; debug_msg(3, "Fixed[%d,%d] %s :: to :: %s [%s::%s] [%s::%s]", fix, canon, orig_file.toLatin1().constData(), ret.toLatin1().constData(), in_d.toLatin1().constData(), out_d.toLatin1().constData(), - pwd.toLatin1().constData(), Option::output_dir.toLatin1().constData()); + qmake_getpwd().toLatin1().constData(), Option::output_dir.toLatin1().constData()); cache->insert(cacheKey, ret); return ret; } -- cgit v0.12 From 11604357fccb59f7aba8165ea7ca8846eb820858 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 24 Mar 2011 12:58:15 +0100 Subject: stop fixifying after first success somewhat unlikely that this had much real-world effects ... except eating yet more cpu. Reviewed-by: mariusSO --- qmake/generators/makefile.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index f5b7295..9c22ca4 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -2896,6 +2896,7 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q //prepend for(int o = 0; o < i; o++) dot_prefix += ".." + Option::dir_sep; + break; } } ret.prepend(dot_prefix); -- cgit v0.12 From af93be4d81d1e50b0c9f015f8432033cc737b22d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 29 Mar 2011 10:22:10 +0200 Subject: simplify: the input and output dirs are already normalized Reviewed-by: mariusSO --- qmake/generators/makefile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 9c22ca4..7033a04 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -782,7 +782,7 @@ MakefileGenerator::init() } { //get the output_dir into the pwd - if(fileFixify(Option::output_dir) != fileFixify(qmake_getpwd())) + if(Option::output_dir != qmake_getpwd()) project->values("INCLUDEPATH").append(fileFixify(Option::output_dir, Option::output_dir, Option::output_dir)); -- cgit v0.12 From 2fe0805d4eb821d2aa11ea868ebb3ff32a108475 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 29 Mar 2011 10:24:15 +0200 Subject: simplify: fileFixify for all same paths is always "." this must have been the most arcane way to generate a single dot ever Reviewed-by: mariusSO --- qmake/generators/makefile.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 7033a04..1bfbdba 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -783,9 +783,7 @@ MakefileGenerator::init() { //get the output_dir into the pwd if(Option::output_dir != qmake_getpwd()) - project->values("INCLUDEPATH").append(fileFixify(Option::output_dir, - Option::output_dir, - Option::output_dir)); + project->values("INCLUDEPATH").append("."); } //fix up the target deps -- cgit v0.12 From c74f29f28f2bfee8335820a67598d16e850e9444 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 29 Mar 2011 10:28:27 +0200 Subject: simplify: absolute fixification ignores the base dir arguments Reviewed-by: mariusSO --- qmake/generators/makefile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 1bfbdba..8159804 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -2460,7 +2460,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QListprofile.isEmpty()) { QString out = subtarget->makefile; - QString in = fileFixify(in_directory + subtarget->profile, out_directory, QString(), FileFixifyAbsolute); + QString in = fileFixify(in_directory + subtarget->profile, FileFixifyAbsolute); if(out.startsWith(in_directory)) out = out.mid(in_directory.length()); t << mkfile << ": " << "\n\t"; -- cgit v0.12 From 9df9d83085ff6164d83c35d51df539858ae398e4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 29 Mar 2011 10:28:51 +0200 Subject: fix paths of vpath-resolved files Task-number: QTBUG-8169 Reviewed-by: mariusSO --- qmake/generators/makefile.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 8159804..7eccc2e 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -364,7 +364,7 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v dir = regex.left(regex.lastIndexOf(Option::dir_sep) + 1); real_dir = dir; if(!(flags & VPATH_NoFixify)) - real_dir = fileFixify(real_dir, qmake_getpwd(), Option::output_dir); + real_dir = fileFixify(real_dir, qmake_getpwd(), Option::output_dir) + '/'; regex.remove(0, dir.length()); } if(real_dir.isEmpty() || exists(real_dir)) { @@ -383,16 +383,15 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v for(int i = (int)files.count()-1; i >= 0; i--) { if(files[i] == "." || files[i] == "..") continue; - a = dir + files[i]; + a = real_dir + files[i]; if(!(flags & VPATH_NoFixify)) a = fileFixify(a); l.insert(val_it, a); } } } else { - debug_msg(1, "%s:%d Cannot match %s%c%s, as %s does not exist.", + debug_msg(1, "%s:%d Cannot match %s%s, as %s does not exist.", __FILE__, __LINE__, real_dir.toLatin1().constData(), - QDir::separator().toLatin1(), regex.toLatin1().constData(), real_dir.toLatin1().constData()); if(flags & VPATH_RemoveMissingFiles) remove_file = true; -- cgit v0.12 From 430b743946178c3f05208434331b8017159612b1 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 29 Mar 2011 10:33:45 +0200 Subject: dist target: fixify OBJECTS_DIR against output dir the thing is terminally broken anyway, but whatever Reviewed-by: mariusSO --- qmake/generators/unix/unixmake2.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index c660855..c0c0aaa 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -787,7 +787,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) ddir = project->first("QMAKE_DISTDIR"); QString ddir_c = escapeFilePath(fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : - project->first("OBJECTS_DIR")) + ddir)); + project->first("OBJECTS_DIR")) + ddir, + Option::output_dir, Option::output_dir)); t << "dist: " << "\n\t" << mkdir_p_asstring(ddir_c) << "\n\t" << "$(COPY_FILE) --parents $(SOURCES) $(DIST) " << ddir_c << Option::dir_sep << " && "; -- cgit v0.12 From 26dd9a45c3b1e92c356ee7f80f728e2ddca0c1d8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 29 Mar 2011 13:56:23 +0200 Subject: fix fixifying of QMAKE_SUBSTITUTES use the correct bases. notably, don't expect the input file in the output dir. Reviewed-by: mariusSO --- qmake/generators/makefile.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 7eccc2e..d096eb4 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -483,19 +483,22 @@ MakefileGenerator::init() subs.at(i).toLatin1().constData()); continue; } - inn = tinn.first(); - outn = toutn.first(); + inn = fileFixify(tinn.first(), qmake_getpwd()); + outn = fileFixify(toutn.first(), qmake_getpwd(), Option::output_dir); } else { - inn = subs.at(i); + inn = fileFixify(subs.at(i), qmake_getpwd()); + if (!QFile::exists(inn)) { + // random insanity for backwards compat: .in file specified with absolute out dir + inn = fileFixify(subs.at(i)); + } if(!inn.endsWith(".in")) { warn_msg(WarnLogic, "Substitute '%s' does not end with '.in'", inn.toLatin1().constData()); continue; } - outn = inn.left(inn.length()-3); + outn = fileFixify(inn.left(inn.length()-3), qmake_getpwd(), Option::output_dir); } - QFile in(fileFixify(inn)); - QFile out(fileFixify(outn, qmake_getpwd(), Option::output_dir)); + QFile in(inn); if(in.open(QFile::ReadOnly)) { QString contents; QStack state; @@ -547,6 +550,7 @@ MakefileGenerator::init() contents += project->expand(line, in.fileName(), count); } } + QFile out(outn); if(out.exists() && out.open(QFile::ReadOnly)) { QString old = QString::fromUtf8(out.readAll()); if(contents == old) { -- cgit v0.12 From 8b11ebf392d832725185de08c2438d6b8771890b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 29 Mar 2011 14:42:35 +0200 Subject: fixify target source against build tree that's where one would expect a target, after all. affects only extra targets explicitly requesting fixification, i.e., nothing. Reviewed-by: mariusSO --- qmake/generators/makefile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index d096eb4..3c5948f 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1747,7 +1747,7 @@ MakefileGenerator::writeExtraTargets(QTextStream &t) deps += " " + escapeDependencyPath(dep); } if(project->values((*it) + ".CONFIG").indexOf("fix_target") != -1) - targ = fileFixify(targ); + targ = fileFixify(targ, Option::output_dir, Option::output_dir); if(project->isEmpty("QMAKE_NOFORCE") && project->values((*it) + ".CONFIG").indexOf("phony") != -1) deps += QString(" ") + "FORCE"; -- cgit v0.12 From a5be47714e5a0075fe9d0ea4a7925136a48e3974 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 29 Mar 2011 11:54:38 +0200 Subject: run depend_command in build dir in VS generators as well followup to b139e7e96e5c47b412c4f0bbc4ae11d5cca99e61 Reviewed-by: mariusSO --- qmake/generators/win32/msbuild_objectmodel.cpp | 5 ++++- qmake/generators/win32/msvc_objectmodel.cpp | 5 ++++- qmake/generators/win32/msvc_vcproj.cpp | 6 +++++- qmake/generators/win32/msvc_vcxproj.cpp | 6 +++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index bd94178..01f730a 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -2438,6 +2438,9 @@ bool VCXFilter::addExtraCompiler(const VCXFilterFile &info) char buff[256]; QString dep_cmd = Project->replaceExtraCompilerVariables(tmp_dep_cmd, Option::fixPathToLocalOS(inFile, true, false), out); if(Project->canExecute(dep_cmd)) { + dep_cmd.prepend(QLatin1String("cd ") + + Project->escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + + QLatin1String(" && ")); if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { QString indeps; while(!feof(proc)) { @@ -2452,7 +2455,7 @@ bool VCXFilter::addExtraCompiler(const VCXFilterFile &info) for (int i = 0; i < extradeps.count(); ++i) { QString dd = extradeps.at(i).simplified(); if (!dd.isEmpty()) - deps += Project->fileFixify(dd); + deps += Project->fileFixify(dd, QString(), Option::output_dir); } } } diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 87c8943..0a24a01 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2218,6 +2218,9 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) Option::fixPathToLocalOS(inFile, true, false), out); if(Project->canExecute(dep_cmd)) { + dep_cmd.prepend(QLatin1String("cd ") + + Project->escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + + QLatin1String(" && ")); if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { QString indeps; while(!feof(proc)) { @@ -2232,7 +2235,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) for (int i = 0; i < extradeps.count(); ++i) { QString dd = extradeps.at(i).simplified(); if (!dd.isEmpty()) - deps += Project->fileFixify(dd); + deps += Project->fileFixify(dd, QString(), Option::output_dir); } } } diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 364eca0..10934a5 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1302,6 +1302,9 @@ void VcprojGenerator::initResourceFiles() dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false); if(canExecute(dep_cmd)) { + dep_cmd.prepend(QLatin1String("cd ") + + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + + QLatin1String(" && ")); if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { QString indeps; while(!feof(proc)) { @@ -1312,7 +1315,8 @@ void VcprojGenerator::initResourceFiles() } QT_PCLOSE(proc); if(!indeps.isEmpty()) - deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' ')); + deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' '), + QString(), Option::output_dir); } } } diff --git a/qmake/generators/win32/msvc_vcxproj.cpp b/qmake/generators/win32/msvc_vcxproj.cpp index 2b628a5..e2464ec 100644 --- a/qmake/generators/win32/msvc_vcxproj.cpp +++ b/qmake/generators/win32/msvc_vcxproj.cpp @@ -654,6 +654,9 @@ void VcxprojGenerator::initResourceFiles() dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false); if(canExecute(dep_cmd)) { + dep_cmd.prepend(QLatin1String("cd ") + + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + + QLatin1String(" && ")); if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { QString indeps; while(!feof(proc)) { @@ -664,7 +667,8 @@ void VcxprojGenerator::initResourceFiles() } QT_PCLOSE(proc); if(!indeps.isEmpty()) - deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' ')); + deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' '), + QString(), Option::output_dir); } } } -- cgit v0.12 From 8caba032245dfa310a77c22c1e55137c54e59f4f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 29 Mar 2011 17:10:35 +0200 Subject: make collection of SUBDIRS in solution generator less bizarre de-duplicate code, and on the way don't try to re-resolve project variables of subprojects against the contents of the top level project. Reviewed-by: mariusSO --- qmake/generators/win32/msvc_vcproj.cpp | 42 +++++++++++++++++----------------- qmake/generators/win32/msvc_vcproj.h | 1 + 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 10934a5..5005190 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -352,6 +352,25 @@ QUuid VcprojGenerator::increaseUUID(const QUuid &id) return result; } +QStringList VcprojGenerator::collectSubDirs(QMakeProject *proj) +{ + QStringList subdirs; + QStringList tmp_proj_subdirs = proj->variables()["SUBDIRS"]; + for(int x = 0; x < tmp_proj_subdirs.size(); ++x) { + QString tmpdir = tmp_proj_subdirs.at(x); + if(!proj->isEmpty(tmpdir + ".file")) { + if(!proj->isEmpty(tmpdir + ".subdir")) + warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s", + tmpdir.toLatin1().constData()); + tmpdir = proj->first(tmpdir + ".file"); + } else if(!proj->isEmpty(tmpdir + ".subdir")) { + tmpdir = proj->first(tmpdir + ".subdir"); + } + subdirs += tmpdir; + } + return subdirs; +} + void VcprojGenerator::writeSubDirs(QTextStream &t) { // Check if all requirements are fulfilled @@ -386,7 +405,6 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QHash solution_depends; QList solution_cleanup; - QStringList subdirs = project->values("SUBDIRS"); QString oldpwd = qmake_getpwd(); // Make sure that all temp projects are configured @@ -395,16 +413,9 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QStringList old_after_vars = Option::after_user_vars; Option::after_user_vars.append("CONFIG+=release"); + QStringList subdirs = collectSubDirs(project); for(int i = 0; i < subdirs.size(); ++i) { QString tmp = subdirs.at(i); - if(!project->isEmpty(tmp + ".file")) { - if(!project->isEmpty(tmp + ".subdir")) - warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s", - tmp.toLatin1().constData()); - tmp = project->first(tmp + ".file"); - } else if(!project->isEmpty(tmp + ".subdir")) { - tmp = project->first(tmp + ".subdir"); - } QFileInfo fi(fileInfo(Option::fixPathToLocalOS(tmp, true))); if(fi.exists()) { if(fi.isDir()) { @@ -428,19 +439,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) continue; } if(tmp_proj.first("TEMPLATE") == "vcsubdirs") { - QStringList tmp_proj_subdirs = tmp_proj.variables()["SUBDIRS"]; - for(int x = 0; x < tmp_proj_subdirs.size(); ++x) { - QString tmpdir = tmp_proj_subdirs.at(x); - if(!tmp_proj.isEmpty(tmpdir + ".file")) { - if(!tmp_proj.isEmpty(tmpdir + ".subdir")) - warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s", - tmpdir.toLatin1().constData()); - tmpdir = tmp_proj.first(tmpdir + ".file"); - } else if(!tmp_proj.isEmpty(tmpdir + ".subdir")) { - tmpdir = tmp_proj.first(tmpdir + ".subdir"); - } + foreach(const QString &tmpdir, collectSubDirs(&tmp_proj)) subdirs += fileFixify(tmpdir); - } } else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") { // Initialize a 'fake' project to get the correct variables // and to be able to extract all the dependencies diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index 8e55211..d66c029 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -130,6 +130,7 @@ protected: QList mergedProjects; private: + QStringList collectSubDirs(QMakeProject *proj); QUuid increaseUUID(const QUuid &id); friend class VCFilter; }; -- cgit v0.12 From e22e36bc61b4af7c0a9113617df5a35ed315dede Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 29 Mar 2011 20:17:18 +0200 Subject: look for makespec in the build dir first it's more natural to look into the build dir before the source dir, and it's what the qmake-generated makefiles mean when re-invoking qmake. specifically, this works around the problem that relative paths with excess ".."s pointing below the root are happily ignored and thus truly bizarre makespec paths may be constructed by the qmake re-invocations if the source dir is less nested than the build dir. Task-number: QTBUG-9817 Reviewed-by: mariusSO --- qmake/project.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index d4f21be..177ab2f 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1345,10 +1345,10 @@ QMakeProject::read(uchar cmd) } if(QDir::isRelativePath(qmakespec)) { - if (QFile::exists(qmakespec+"/qmake.conf")) { - Option::mkfile::qmakespec = QFileInfo(Option::mkfile::qmakespec).absoluteFilePath(); - } else if (QFile::exists(Option::output_dir+"/"+qmakespec+"/qmake.conf")) { + if (QFile::exists(Option::output_dir+"/"+qmakespec+"/qmake.conf")) { qmakespec = Option::mkfile::qmakespec = QFileInfo(Option::output_dir+"/"+qmakespec).absoluteFilePath(); + } else if (QFile::exists(qmakespec+"/qmake.conf")) { + Option::mkfile::qmakespec = QFileInfo(Option::mkfile::qmakespec).absoluteFilePath(); } else { bool found_mkspec = false; for(QStringList::ConstIterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) { -- cgit v0.12 From 565e8679374e71df9f72074dd3c71c929aeeafc8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 12 Apr 2011 12:35:41 +0200 Subject: Use FixNativeOrientation on Symbian when the application wants it. Applications can request the usage of RWindow::FixNativeOrientation() by setting the new Qt::WA_SymbianNoSystemRotation attribute for their fullscreen top-level widget (which in practice will either be a graphics or declarative view). This will fix the underlying EGL window surface and the QWidget dimensions to the dimension of the native orientation of the device (typically portrait). The default auto-rotation can be left enabled, however it will be up to the application to rotate the drawing. Global notifications, VKB, etc. will still appear in the proper orientation. Another benefit is improved performance in the non-native orientation. Task-number: QTBUG-17742 Reviewed-by: Jason Barron Reviewed-by: Jani Hautakangas --- src/corelib/global/qnamespace.h | 2 + src/corelib/global/qnamespace.qdoc | 1 + src/gui/kernel/qapplication_s60.cpp | 159 ++++++++++++++++++++++++++---------- src/gui/kernel/qt_s60_p.h | 15 ++-- src/gui/kernel/qwidget_s60.cpp | 2 + 5 files changed, 132 insertions(+), 47 deletions(-) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 4d70744..15cc809 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -526,6 +526,8 @@ public: WA_X11DoNotAcceptFocus = 132, + WA_SymbianNoSystemRotation = 133, + // Add new attributes before this line WA_AttributeCount }; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 22ad83b..f03fb25 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1244,6 +1244,7 @@ \omitvalue WA_SetWindowModality \omitvalue WA_WState_WindowOpacitySet \omitvalue WA_WState_AcceptedTouchBeginEvent + \omitvalue WA_SymbianNoSystemRotation */ /*! \typedef Qt::HANDLE diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index f80b657..d37845d 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -546,11 +546,52 @@ void QSymbianControl::setWidget(QWidget *w) { qwidget = w; } + +QPoint QSymbianControl::translatePointForFixedNativeOrientation(const TPoint &pointerEventPos) const +{ + QPoint pos(pointerEventPos.iX, pointerEventPos.iY); + if (qwidget->d_func()->fixNativeOrientationCalled) { + QSize wsize = qwidget->size(); + TSize size = Size(); + if (size.iWidth == wsize.height() && size.iHeight == wsize.width()) { + qreal x = pos.x(); + qreal y = pos.y(); + pos.setX(size.iHeight - y); + pos.setY(x); + } + } + return pos; +} + +TRect QSymbianControl::translateRectForFixedNativeOrientation(const TRect &controlRect) const +{ + TRect rect = controlRect; + if (qwidget->d_func()->fixNativeOrientationCalled) { + QPoint a = translatePointForFixedNativeOrientation(rect.iTl); + QPoint b = translatePointForFixedNativeOrientation(rect.iBr); + if (a.x() < b.x()) { + rect.iTl.iX = a.x(); + rect.iBr.iX = b.x(); + } else { + rect.iTl.iX = b.x(); + rect.iBr.iX = a.x(); + } + if (a.y() < b.y()) { + rect.iTl.iY = a.y(); + rect.iBr.iY = b.y(); + } else { + rect.iTl.iY = b.y(); + rect.iBr.iY = a.y(); + } + } + return rect; +} + void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation ) { QWidget *alienWidget; - QPoint widgetPos = QPoint(aPenEventLocation.iX, aPenEventLocation.iY); - QPoint globalPos = QPoint(aPenEventScreenLocation.iX,aPenEventScreenLocation.iY); + QPoint widgetPos = translatePointForFixedNativeOrientation(aPenEventLocation); + QPoint globalPos = translatePointForFixedNativeOrientation(aPenEventScreenLocation); alienWidget = qwidget->childAt(widgetPos); if (!alienWidget) alienWidget = qwidget; @@ -565,7 +606,7 @@ void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, cons void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent *event) { QApplicationPrivate *d = QApplicationPrivate::instance(); - QPointF screenPos = qwidget->mapToGlobal(QPoint(event->iPosition.iX, event->iPosition.iY)); + QPointF screenPos = qwidget->mapToGlobal(translatePointForFixedNativeOrientation(event->iPosition)); qreal pressure; if(d->pressureSupported && event->Pressure() > 0) //workaround for misconfigured HAL @@ -666,7 +707,7 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent) mapS60MouseEventTypeToQt(&type, &button, &pEvent); Qt::KeyboardModifiers modifiers = mapToQtModifiers(pEvent.iModifiers); - QPoint widgetPos = QPoint(pEvent.iPosition.iX, pEvent.iPosition.iY); + QPoint widgetPos = translatePointForFixedNativeOrientation(pEvent.iPosition); TPoint controlScreenPos = PositionRelativeToScreen(); QPoint globalPos = QPoint(controlScreenPos.iX, controlScreenPos.iY) + widgetPos; S60->lastCursorPos = globalPos; @@ -1132,6 +1173,9 @@ void QSymbianControl::Draw(const TRect& controlRect) const Q_ASSERT(window); QTLWExtra *topExtra = window->d_func()->maybeTopData(); Q_ASSERT(topExtra); + + TRect wcontrolRect = translateRectForFixedNativeOrientation(controlRect); + if (!topExtra->inExpose) { topExtra->inExpose = true; if (!qwidget->isWindow()) { @@ -1142,7 +1186,7 @@ void QSymbianControl::Draw(const TRect& controlRect) const gc.SetBrushColor(TRgb(0, 0, 0, 0)); gc.Clear(controlRect); } - QRect exposeRect = qt_TRect2QRect(controlRect); + QRect exposeRect = qt_TRect2QRect(wcontrolRect); qwidget->d_func()->syncBackingStore(exposeRect); topExtra->inExpose = false; } @@ -1155,7 +1199,7 @@ void QSymbianControl::Draw(const TRect& controlRect) const const bool sendNativePaintEvents = qwidget->d_func()->extraData()->receiveNativePaintEvents; if (sendNativePaintEvents) { - const QRect r = qt_TRect2QRect(controlRect); + const QRect r = qt_TRect2QRect(wcontrolRect); QMetaObject::invokeMethod(qwidget, "beginNativePaintEvent", Qt::DirectConnection, Q_ARG(QRect, r)); } @@ -1210,7 +1254,7 @@ void QSymbianControl::Draw(const TRect& controlRect) const } if (sendNativePaintEvents) { - const QRect r = qt_TRect2QRect(controlRect); + const QRect r = qt_TRect2QRect(wcontrolRect); // The draw ops aren't actually sent to WSERV until the graphics // context is deactivated, which happens in the function calling // this one. We therefore delay the delivery of endNativePaintEvent, @@ -1223,14 +1267,45 @@ void QSymbianControl::Draw(const TRect& controlRect) const } } +void QSymbianControl::qwidgetResize_helper(const QSize &newSize) +{ + QRect cr = qwidget->geometry(); + QSize oldSize(cr.size()); + cr.setSize(newSize); + qwidget->data->crect = cr; + if (qwidget->isVisible()) { + QTLWExtra *tlwExtra = qwidget->d_func()->maybeTopData(); + bool slowResize = qgetenv("QT_SLOW_TOPLEVEL_RESIZE").toInt(); + if (!slowResize && tlwExtra) + tlwExtra->inTopLevelResize = true; + QResizeEvent e(newSize, oldSize); + qt_sendSpontaneousEvent(qwidget, &e); + if (!qwidget->testAttribute(Qt::WA_StaticContents)) + qwidget->d_func()->syncBackingStore(); + if (!slowResize && tlwExtra) + tlwExtra->inTopLevelResize = false; + } else { + if (!qwidget->testAttribute(Qt::WA_PendingResizeEvent)) { + QResizeEvent *e = new QResizeEvent(newSize, oldSize); + QApplication::postEvent(qwidget, e); + } + } +} + void QSymbianControl::SizeChanged() { CCoeControl::SizeChanged(); + // When FixNativeOrientation had been called, the RWindow/CCoeControl size + // and the surface/QWidget size have nothing to do with each other. + if (qwidget->d_func()->fixNativeOrientationCalled) + return; + QSize oldSize = qwidget->size(); QSize newSize(Size().iWidth, Size().iHeight); if (oldSize != newSize) { + // Enforce the proper size for fullscreen widgets on the secondary screen. const bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen; const int screenNumber = S60->screenNumberForWidget(qwidget); if (!m_inExternalScreenOverride && isFullscreen && screenNumber > 0) { @@ -1243,26 +1318,8 @@ void QSymbianControl::SizeChanged() return; } } - QRect cr = qwidget->geometry(); - cr.setSize(newSize); - qwidget->data->crect = cr; - if (qwidget->isVisible()) { - QTLWExtra *tlwExtra = qwidget->d_func()->maybeTopData(); - bool slowResize = qgetenv("QT_SLOW_TOPLEVEL_RESIZE").toInt(); - if (!slowResize && tlwExtra) - tlwExtra->inTopLevelResize = true; - QResizeEvent e(newSize, oldSize); - qt_sendSpontaneousEvent(qwidget, &e); - if (!qwidget->testAttribute(Qt::WA_StaticContents)) - qwidget->d_func()->syncBackingStore(); - if (!slowResize && tlwExtra) - tlwExtra->inTopLevelResize = false; - } else { - if (!qwidget->testAttribute(Qt::WA_PendingResizeEvent)) { - QResizeEvent *e = new QResizeEvent(newSize, oldSize); - QApplication::postEvent(qwidget, e); - } - } + + qwidgetResize_helper(newSize); } m_inExternalScreenOverride = false; @@ -1513,29 +1570,49 @@ bool QSymbianControl::isControlActive() void QSymbianControl::ensureFixNativeOrientation() { #if defined(Q_SYMBIAN_SUPPORTS_FIXNATIVEORIENTATION) - // Call FixNativeOrientation() for fullscreen QDeclarativeViews that - // have a locked orientation matching the native orientation of the device. - // This avoids unnecessary window rotation on wserv level. - if (!qwidget->isWindow() || qwidget->windowType() == Qt::Desktop - || !qwidget->inherits("QDeclarativeView") - || S60->screenNumberForWidget(qwidget) > 0) + if (!qwidget->isWindow() || qwidget->windowType() == Qt::Desktop) + return; + if (S60->screenNumberForWidget(qwidget) > 0) return; - const bool isFullScreen = qwidget->windowState().testFlag(Qt::WindowFullScreen); const bool isFixed = qwidget->d_func()->fixNativeOrientationCalled; - const bool matchesNative = qwidget->testAttribute( - S60->nativeOrientationIsPortrait ? Qt::WA_LockPortraitOrientation - : Qt::WA_LockLandscapeOrientation); - if (isFullScreen && matchesNative) { - if (!isFixed) { - Window().FixNativeOrientation(); - qwidget->d_func()->fixNativeOrientationCalled = true; + const bool isFixEnabled = qwidget->testAttribute(Qt::WA_SymbianNoSystemRotation); + const bool isFullScreen = qwidget->windowState().testFlag(Qt::WindowFullScreen); + if (isFullScreen && isFixEnabled) { + const bool surfaceBasedGs = + QApplicationPrivate::graphics_system_name == QLatin1String("openvg") + || QApplicationPrivate::graphics_system_name == QLatin1String("opengl"); + if (!surfaceBasedGs) + qwidget->setAttribute(Qt::WA_SymbianNoSystemRotation, false); + if (!isFixed && surfaceBasedGs) { + if (Window().FixNativeOrientation() == KErrNone) { + qwidget->d_func()->fixNativeOrientationCalled = true; + // The EGL window surface is now fixed to the native orientation + // of the device, no matter what size we pass when creating it. + // Enforce the same size for the QWidget too. For the underlying + // CCoeControl and RWindow it is up to the system to resize them + // when the standard auto-rotation mechanism is in use, we must not + // change that behavior by forcing any size for those. In practice + // this means that the QWidget and the underlying native control + // dimensions will be out of sync when FixNativeOrientation was + // called and the device is turned to the non-native (typically + // landscape) orientation. The pointer event handling and certain + // functions like Draw() will need to compensate for this. + QSize newSize(S60->nativeScreenWidthInPixels, S60->nativeScreenHeightInPixels); + if (qwidget->size() != newSize) + qwidgetResize_helper(newSize); + } else { + qwidget->setAttribute(Qt::WA_SymbianNoSystemRotation, false); + } } } else if (isFixed) { + qwidget->setAttribute(Qt::WA_SymbianNoSystemRotation, false); qwidget->d_func()->fixNativeOrientationCalled = false; qwidget->hide(); qwidget->d_func()->create_sys(0, false, true); qwidget->show(); } +#else + qwidget->setAttribute(Qt::WA_SymbianNoSystemRotation, false); #endif } diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index c48bf63..e24405c 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -191,7 +191,8 @@ public: int screenWidthInTwipsForScreen[qt_symbian_max_screens]; int screenHeightInTwipsForScreen[qt_symbian_max_screens]; - bool nativeOrientationIsPortrait; + int nativeScreenWidthInPixels; + int nativeScreenHeightInPixels; }; Q_AUTOTEST_EXPORT QS60Data* qGlobalS60Data(); @@ -237,6 +238,8 @@ public: bool isControlActive(); void ensureFixNativeOrientation(); + QPoint translatePointForFixedNativeOrientation(const TPoint &pointerEventPos) const; + TRect translateRectForFixedNativeOrientation(const TRect &controlRect) const; #ifdef Q_WS_S60 void FadeBehindPopup(bool fade){ popupFader.FadeBehindPopup( this, this, fade); } @@ -256,6 +259,9 @@ protected: void PositionChanged(); void FocusChanged(TDrawNow aDrawNow); +protected: + void qwidgetResize_helper(const QSize &newSize); + private: void HandlePointerEvent(const TPointerEvent& aPointerEvent); TKeyResponse OfferKeyEvent(const TKeyEvent& aKeyEvent,TEventCode aType); @@ -363,18 +369,15 @@ inline void QS60Data::updateScreenSize() // Look for a screen mode with rotation 0 // in order to decide what the native orientation is. - int nativeScreenWidthInPixels = 0; - int nativeScreenHeightInPixels = 0; for (mode = 0; mode < screenModeCount; ++mode) { TPixelsAndRotation sizeAndRotation; dev->GetScreenModeSizeAndRotation(mode, sizeAndRotation); if (sizeAndRotation.iRotation == CFbsBitGc::EGraphicsOrientationNormal) { - nativeScreenWidthInPixels = sizeAndRotation.iPixelSize.iWidth; - nativeScreenHeightInPixels = sizeAndRotation.iPixelSize.iHeight; + S60->nativeScreenWidthInPixels = sizeAndRotation.iPixelSize.iWidth; + S60->nativeScreenHeightInPixels = sizeAndRotation.iPixelSize.iHeight; break; } } - S60->nativeOrientationIsPortrait = nativeScreenWidthInPixels <= nativeScreenHeightInPixels; } inline RWsSession& QS60Data::wsSession() diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 10bb98b..d55e1ad 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -838,6 +838,8 @@ void QWidgetPrivate::s60UpdateIsOpaque() // recreate backing store to get translucent surface (raster surface). extra->topextra->backingStore.create(q); extra->topextra->backingStore.registerWidget(q); + // FixNativeOrientation() will not work without an EGL surface. + q->setAttribute(Qt::WA_SymbianNoSystemRotation, false); } } } else if (extra->topextra->nativeWindowTransparencyEnabled) { -- cgit v0.12 From 60475e93890550f4fb67367980249a21b9346747 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 12 Apr 2011 14:27:15 +0200 Subject: Have the backing store destroyed also in special Symbian scenarios. The backing store tracker's registerWidget and unregisterWidget functions are called when EPartiallyVisible and ENotVisible events come from WSERV. However if an application sends its window group to background right after caling show() and before entering the event loop, there is a chance that all the application will receive is an ENotVisible event, leading to calling unregisterWidget() without a previous registerWidget(). In this case the backing store was not destroyed and the application was consuming GPU memory even while it was staying in background. This patch ensures registerWidget() is called always before unregisterWidget() in the Symbian-specific event handler for ENotVisible, and replaces the previous patch, a12d41076919a133e63de63dff5c1a131a0564e4, which caused regression in autotests. Task-number: QTBUG-18493 Reviewed-by: Gareth Stockwell --- src/gui/kernel/qapplication_s60.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index d37845d..f73eb02 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -215,6 +215,12 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible) widget->repaint(); } } else { + // In certain special scenarios we may get an ENotVisible event + // without a previous EPartiallyVisible. The backingstore must + // still be destroyed, hence the registerWidget() call below. + if (backingStore.data() && widget->internalWinId() + && qt_widget_private(widget)->maybeBackingStore() == backingStore.data()) + backingStore.registerWidget(widget); backingStore.unregisterWidget(widget); // In order to ensure that any resources used by the window surface // are immediately freed, we flush the WSERV command buffer. -- cgit v0.12 From c7833b8f5ecc7a47e35bdf9fbb528e1869979ef5 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Thu, 7 Apr 2011 16:21:27 +1000 Subject: Fix TextEdit cursorRectangle property. Translate the cursor rectangle from control coordinates to painting coordinates rather than the other way around, ensure the cursor delegate is also translated, and update the cursor rectangle, cursor delegate and micro focus when the preedit cursor changes position. Change-Id: Iac7a87f7fb965d5f56d059d8f4b97feef8b47789 Task-number: QTBUG-18515 QT-4827 Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativetextedit.cpp | 15 ++++++--------- src/gui/text/qtextcontrol.cpp | 3 +++ .../qdeclarativetextedit/data/cursorTest.qml | 1 + .../tst_qdeclarativetextedit.cpp | 21 ++++++++++++++++++++- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 2cb1c94..af2c8f3 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -582,6 +582,7 @@ void QDeclarativeTextEdit::setVAlign(QDeclarativeTextEdit::VAlignment alignment) d->vAlign = alignment; d->updateDefaultTextOption(); updateSize(); + moveCursorDelegate(); emit verticalAlignmentChanged(d->vAlign); } @@ -870,8 +871,6 @@ void QDeclarativeTextEdit::setCursorDelegate(QDeclarativeComponent* c) Q_D(QDeclarativeTextEdit); if(d->cursorComponent){ if(d->cursor){ - disconnect(d->control, SIGNAL(cursorPositionChanged()), - this, SLOT(moveCursorDelegate())); d->control->setCursorWidth(-1); dirtyCache(cursorRectangle()); delete d->cursor; @@ -897,8 +896,6 @@ void QDeclarativeTextEdit::loadCursorDelegate() return; d->cursor = qobject_cast(d->cursorComponent->create(qmlContext(this))); if(d->cursor){ - connect(d->control, SIGNAL(cursorPositionChanged()), - this, SLOT(moveCursorDelegate())); d->control->setCursorWidth(0); dirtyCache(cursorRectangle()); QDeclarative_setParent_noEvent(d->cursor, this); @@ -1173,7 +1170,7 @@ Qt::TextInteractionFlags QDeclarativeTextEdit::textInteractionFlags() const QRect QDeclarativeTextEdit::cursorRectangle() const { Q_D(const QDeclarativeTextEdit); - return d->control->cursorRect().toRect().translated(0,-d->yoff); + return d->control->cursorRect().toRect().translated(0,d->yoff); } @@ -1558,7 +1555,7 @@ void QDeclarativeTextEditPrivate::init() QObject::connect(control, SIGNAL(selectionChanged()), q, SLOT(updateSelectionMarkers())); QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(updateSelectionMarkers())); QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged())); - QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorRectangleChanged())); + QObject::connect(control, SIGNAL(microFocusChanged()), q, SLOT(moveCursorDelegate())); QObject::connect(control, SIGNAL(linkActivated(QString)), q, SIGNAL(linkActivated(QString))); #ifndef QT_NO_CLIPBOARD QObject::connect(q, SIGNAL(readOnlyChanged(bool)), q, SLOT(q_canPasteChanged())); @@ -1583,16 +1580,17 @@ void QDeclarativeTextEdit::q_textChanged() d->updateDefaultTextOption(); updateSize(); updateTotalLines(); - updateMicroFocus(); emit textChanged(d->text); } void QDeclarativeTextEdit::moveCursorDelegate() { Q_D(QDeclarativeTextEdit); + updateMicroFocus(); + emit cursorRectangleChanged(); if(!d->cursor) return; - QRectF cursorRect = d->control->cursorRect(); + QRectF cursorRect = cursorRectangle(); d->cursor->setX(cursorRect.x()); d->cursor->setY(cursorRect.y()); } @@ -1625,7 +1623,6 @@ void QDeclarativeTextEdit::updateSelectionMarkers() d->lastSelectionEnd = d->control->textCursor().selectionEnd(); emit selectionEndChanged(); } - updateMicroFocus(); } QRectF QDeclarativeTextEdit::boundingRect() const diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 1a81394..bee4d95 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1950,6 +1950,7 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) if (isGettingInput) layout->setPreeditArea(cursor.position() - block.position(), e->preeditString()); QList overrides; + const int oldPreeditCursor = preeditCursor; preeditCursor = e->preeditString().length(); hideCursor = false; for (int i = 0; i < e->attributes().size(); ++i) { @@ -1970,6 +1971,8 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) } layout->setAdditionalFormats(overrides); cursor.endEditBlock(); + if (oldPreeditCursor != preeditCursor) + emit q->microFocusChanged(); } QVariant QTextControl::inputMethodQuery(Qt::InputMethodQuery property) const diff --git a/tests/auto/declarative/qdeclarativetextedit/data/cursorTest.qml b/tests/auto/declarative/qdeclarativetextedit/data/cursorTest.qml index c7c21fc..f7fb3e7 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/cursorTest.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/cursorTest.qml @@ -2,6 +2,7 @@ import QtQuick 1.0 Rectangle { width: 300; height: 300; color: "white" TextEdit { text: "Hello world!"; id: textEditObject; objectName: "textEditObject" + anchors.fill: parent resources: [ Component { id:cursor; Item { id:cursorInstance; objectName: "cursorInstance" } } ] cursorDelegate: cursor } diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 8f1be6f..574d2d5 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -1539,6 +1539,19 @@ void tst_qdeclarativetextedit::cursorDelegate() textEditObject->setCursorPosition(0); QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x())); QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y())); + QVERIFY(textEditObject->cursorRectangle().y() >= 0); + QVERIFY(textEditObject->cursorRectangle().y() < textEditObject->cursorRectangle().height()); + textEditObject->setVAlign(QDeclarativeTextEdit::AlignVCenter); + QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x())); + QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y())); + QVERIFY(textEditObject->cursorRectangle().y() > (textEditObject->height() / 2) - textEditObject->cursorRectangle().height()); + QVERIFY(textEditObject->cursorRectangle().y() < (textEditObject->height() / 2) + textEditObject->cursorRectangle().height()); + textEditObject->setVAlign(QDeclarativeTextEdit::AlignBottom); + QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x())); + QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y())); + QVERIFY(textEditObject->cursorRectangle().y() > textEditObject->height() - (textEditObject->cursorRectangle().height() * 2)); + QVERIFY(textEditObject->cursorRectangle().y() < textEditObject->height()); + //Test Delegate gets deleted textEditObject->setCursorDelegate(0); QVERIFY(!textEditObject->findChild("cursorInstance")); @@ -2227,6 +2240,8 @@ void tst_qdeclarativetextedit::preeditMicroFocus() QTest::qWaitForWindowShown(&view); QTRY_COMPARE(QApplication::activeWindow(), static_cast(&view)); + QSignalSpy cursorRectangleSpy(&edit, SIGNAL(cursorRectangleChanged())); + QRect currentRect; QRect previousRect = edit.inputMethodQuery(Qt::ImMicroFocus).toRect(); @@ -2237,8 +2252,9 @@ void tst_qdeclarativetextedit::preeditMicroFocus() currentRect = edit.inputMethodQuery(Qt::ImMicroFocus).toRect(); QCOMPARE(currentRect, previousRect); #if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) - QCOMPARE(ic.updateReceived, true); + QCOMPARE(ic.updateReceived, false); // The cursor position hasn't changed. #endif + QCOMPARE(cursorRectangleSpy.count(), 0); // Verify that the micro focus rect moves to the left as the cursor position // is incremented. @@ -2250,6 +2266,8 @@ void tst_qdeclarativetextedit::preeditMicroFocus() #if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) QCOMPARE(ic.updateReceived, true); #endif + QVERIFY(cursorRectangleSpy.count() > 0); + cursorRectangleSpy.clear(); previousRect = currentRect; } @@ -2263,6 +2281,7 @@ void tst_qdeclarativetextedit::preeditMicroFocus() #if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) QCOMPARE(ic.updateReceived, true); #endif + QVERIFY(cursorRectangleSpy.count() > 0); } void tst_qdeclarativetextedit::inputContextMouseHandler() -- cgit v0.12 From 1840a4383fd19bc64ef6d81c09c3f54aeb52d777 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Wed, 13 Apr 2011 11:34:46 +0300 Subject: Predictive Text causing app to crash after repeated edit attempts Splitview changes cause application to crash, since the cancellation of FEP transaction is not notified to the native side. This leads the native side and Qt to be not in sync. Task-number: QT-4879 Reviewed-by: Guoqing Zhang --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 868565d..8574f2c 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -231,7 +231,7 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) // It ignores the mouse event, so we need to commit and send a selection event (which will get triggered // after the commit) if (!m_preeditString.isEmpty()) { - commitCurrentString(false); + commitCurrentString(true); int pos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); -- cgit v0.12 From cc526edbff1cc413532f7ab1b6c088adae76744d Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Wed, 13 Apr 2011 11:38:13 +0300 Subject: Fix to 'QImage convertToFormat doesn't work correctly' OpenVG paint engine tries to use vgWritePixels shortcut whenever possible to optimize rendering performance. The check 'canVgWritePixels' failed to map formats correctly and resulted to incorrect return value. Task-number: QTBUG-18682 Reviewed-by: Jason Barron --- src/openvg/qpaintengine_vg.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 570adfd..ebdfa5f 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -1024,9 +1024,11 @@ static VGImage toVGImage switch (img.format()) { case QImage::Format_Mono: img = image.convertToFormat(QImage::Format_MonoLSB, flags); + img.invertPixels(); format = VG_BW_1; break; case QImage::Format_MonoLSB: + img.invertPixels(); format = VG_BW_1; break; case QImage::Format_RGB32: @@ -3189,6 +3191,19 @@ void qt_vg_drawVGImageStencil bool QVGPaintEngine::canVgWritePixels(const QImage &image) const { Q_D(const QVGPaintEngine); + + // qt_vg_image_to_vg_format returns VG_sARGB_8888 as + // fallback case if no matching VG format is found. + // If given image format is not Format_ARGB32 and returned + // format is VG_sARGB_8888, it means that no match was + // found. In that case vgWritePixels cannot be used. + // Also 1-bit formats cannot be used directly either. + if ((image.format() != QImage::Format_ARGB32 + && qt_vg_image_to_vg_format(image.format()) == VG_sARGB_8888) + || image.depth() == 1) { + return false; + } + // vgWritePixels ignores masking, blending and xforms so we can only use it if // ALL of the following conditions are true: // - It is a simple translate, or a scale of -1 on the y-axis (inverted) -- cgit v0.12 From 52187b084491641ef80536c743c2261af8bfe11c Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 13 Apr 2011 16:34:06 +1000 Subject: Moving contentY by large values in List/GridView is slow We needed to create/destroy every delegate between the current position and the new position. Now we estimate element at the new position and just create the elements from that item. Change-Id: I9da1354cbadb4e44fafc1a0bee619d058d1e06a2 Task-number: QTBUG-14974 Reviewed-by: Bea Lam --- .../graphicsitems/qdeclarativegridview.cpp | 20 ++++++++ .../graphicsitems/qdeclarativelistview.cpp | 22 +++++++++ .../tst_qdeclarativegridview.cpp | 51 ++++++++++++++++++++ .../tst_qdeclarativelistview.cpp | 56 ++++++++++++++++++++++ 4 files changed, 149 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 3ec29c1..21bfc59 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -584,6 +584,26 @@ void QDeclarativeGridViewPrivate::refill(qreal from, qreal to, bool doBuffer) --i; modelIndex = visibleItems.at(i)->index + 1; } + + if (visibleItems.count() && (fillFrom > rowPos + rowSize()*2 + || fillTo < rowPosAt(visibleIndex) - rowSize())) { + // We've jumped more than a page. Estimate which items are now + // visible and fill from there. + int count = (fillFrom - (rowPos + rowSize())) / (rowSize()) * columns; + for (int i = 0; i < visibleItems.count(); ++i) + releaseItem(visibleItems.at(i)); + visibleItems.clear(); + modelIndex += count; + if (modelIndex >= model->count()) + modelIndex = model->count() - 1; + else if (modelIndex < 0) + modelIndex = 0; + modelIndex = modelIndex / columns * columns; + visibleIndex = modelIndex; + colPos = colPosAt(visibleIndex); + rowPos = rowPosAt(visibleIndex); + } + int colNum = colPos / colSize(); FxGridItem *item = 0; diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index cb751f6..7c01293 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -744,6 +744,28 @@ void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer) if (visibleItems.at(i)->index != -1) modelIndex = visibleItems.at(i)->index + 1; } + + if (visibleItems.count() && (fillFrom > itemEnd+averageSize+spacing + || fillTo < visiblePos - averageSize - spacing)) { + // We've jumped more than a page. Estimate which items are now + // visible and fill from there. + int count = (fillFrom - itemEnd) / (averageSize + spacing); + for (int i = 0; i < visibleItems.count(); ++i) + releaseItem(visibleItems.at(i)); + visibleItems.clear(); + modelIndex += count; + if (modelIndex >= model->count()) { + count -= modelIndex - model->count() + 1; + modelIndex = model->count() - 1; + } else if (modelIndex < 0) { + count -= modelIndex; + modelIndex = 0; + } + visibleIndex = modelIndex; + visiblePos = itemEnd + count * (averageSize + spacing) + 1; + itemEnd = visiblePos-1; + } + bool changed = false; FxListItem *item = 0; qreal pos = itemEnd + 1; diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index c183934..c8e7817 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -97,6 +97,7 @@ private slots: void onRemove_data(); void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); + void contentPosJump(); private: QDeclarativeView *createView(); @@ -2077,6 +2078,56 @@ void tst_QDeclarativeGridView::testQtQuick11Attributes_data() << ""; } +void tst_QDeclarativeGridView::contentPosJump() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 100; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testRightToLeft", QVariant(false)); + ctxt->setContextProperty("testTopToBottom", QVariant(false)); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem(canvas->rootObject(), "grid"); + QVERIFY(gridview != 0); + + QDeclarativeItem *contentItem = gridview->contentItem(); + QVERIFY(contentItem != 0); + + // Test jumping more than a page of items. + gridview->setContentY(500); + + // Confirm items positioned correctly + int itemCount = findItems(contentItem, "wrapper").count(); + for (int i = 24; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + gridview->setContentY(-100); + itemCount = findItems(contentItem, "wrapper").count(); + QVERIFY(itemCount < 15); + // Confirm items positioned correctly + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + delete canvas; +} + QDeclarativeView *tst_QDeclarativeGridView::createView() { QDeclarativeView *canvas = new QDeclarativeView(0); diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index ec60e8a..0c96587 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -120,6 +120,7 @@ private slots: void rightToLeft(); void test_mirroring(); void orientationChange(); + void contentPosJump(); private: template void items(); @@ -2630,6 +2631,61 @@ void tst_QDeclarativeListView::orientationChange() delete canvas; } +void tst_QDeclarativeListView::contentPosJump() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 50; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem(canvas->rootObject(), "list"); + QTRY_VERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + // Confirm items positioned correctly + int itemCount = findItems(contentItem, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_VERIFY(item->y() == i*20); + } + + // Test jumping more than a page of items. + listview->setContentY(500); + itemCount = findItems(contentItem, "wrapper").count(); + for (int i = 25; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_VERIFY(item->y() == i*20); + } + + listview->setContentY(-100); + itemCount = findItems(contentItem, "wrapper").count(); + QVERIFY(itemCount < 20); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_VERIFY(item->y() == i*20); + } + + delete canvas; +} + void tst_QDeclarativeListView::qListModelInterface_items() { items(); -- cgit v0.12 From f6505f9f2eb4c594d3a249655879117e2a136468 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 14 Apr 2011 11:06:39 +1000 Subject: Add pincharea.qmlproject file for PinchArea example. Change-Id: I9d3129be4d03904805e53489c1117104e08ce860 --- .../touchinteraction/pincharea/pincharea.qmlproject | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 examples/declarative/touchinteraction/pincharea/pincharea.qmlproject diff --git a/examples/declarative/touchinteraction/pincharea/pincharea.qmlproject b/examples/declarative/touchinteraction/pincharea/pincharea.qmlproject new file mode 100644 index 0000000..e526217 --- /dev/null +++ b/examples/declarative/touchinteraction/pincharea/pincharea.qmlproject @@ -0,0 +1,18 @@ +/* File generated by QtCreator */ + +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} -- cgit v0.12 From 013aa31cea9f82b53b988d910c42c5590b32c1cc Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 14 Apr 2011 13:03:31 +1000 Subject: Fix uninitialized variable. Change-Id: Ieebfc72cf9b31c9d2522487ed7cd860f060ef0be Task-number: QTBUG-15877 --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 21bfc59..af2b804 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -2250,7 +2250,7 @@ qreal QDeclarativeGridView::maxXExtent() const qreal extent; qreal highlightStart; qreal highlightEnd; - qreal lastItemPosition; + qreal lastItemPosition = 0; if (d->isRightToLeftTopToBottom()){ highlightStart = d->highlightRangeStartValid ? d->highlightRangeEnd : d->size(); highlightEnd = d->highlightRangeEndValid ? d->highlightRangeStart : d->size(); -- cgit v0.12 From eac733e658422af2ceefea294023d89fc6512143 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 14 Apr 2011 14:54:35 +1000 Subject: Fix so concurrent jobs produce the correct model results Concurrent jobs sometimes modified another job's results as results were stored in member variables and modified without locks. This change removes the use of member variables for the current job, and uses QAtomicInt for the incremented job ids. (Regression from 4df66da8f9e5a9f3c981c6c60254899146dd1cc0) Task-number: QTBUG-18266 Change-Id: Ia6783e9d17603e0ff5ccd40d8cc992bdc2d3f0e9 Reviewed-by: Charles Yin --- src/declarative/util/qdeclarativexmllistmodel.cpp | 67 ++++++++++------------- 1 file changed, 28 insertions(+), 39 deletions(-) diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index c79baa4..a61ac06 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -144,6 +144,7 @@ struct XmlQueryJob QList roleQueryErrorId; // the ptr to send back if there is an error QStringList keyRoleQueries; QStringList keyRoleResultsCache; + QString prefix; }; class QDeclarativeXmlQuery : public QObject @@ -172,6 +173,12 @@ public: } int doQuery(QString query, QString namespaces, QByteArray data, QList* roleObjects, QStringList keyRoleResultsCache) { + { + QMutexLocker m1(&m_mutex); + m_queryIds.ref(); + if (m_queryIds <= 0) + m_queryIds = 1; + } XmlQueryJob job; job.queryId = m_queryIds; @@ -194,9 +201,6 @@ public: { QMutexLocker ml(&m_mutex); m_jobs.insert(m_queryIds, job); - m_queryIds++; - if (m_queryIds <= 0) - m_queryIds = 1; } QMetaObject::invokeMethod(this, "processQuery", Qt::QueuedConnection, Q_ARG(int, job.queryId)); @@ -214,20 +218,15 @@ private slots: job = m_jobs.value(queryId); } - QDeclarativeXmlQueryResult r; - doQueryJob(&job); - doSubQueryJob(&job); - r.queryId = job.queryId; - r.size = m_size; - r.data = m_modelData; - r.inserted = m_insertedItemRanges; - r.removed = m_removedItemRanges; - r.keyRoleResultsCache = job.keyRoleResultsCache; + QDeclarativeXmlQueryResult result; + result.queryId = job.queryId; + doQueryJob(&job, &result); + doSubQueryJob(&job, &result); { QMutexLocker ml(&m_mutex); if (m_jobs.contains(queryId)) { - emit queryCompleted(r); + emit queryCompleted(result); m_jobs.remove(queryId); } } @@ -241,8 +240,8 @@ protected: private: - void doQueryJob(XmlQueryJob* job); - void doSubQueryJob(XmlQueryJob* job); + void doQueryJob(XmlQueryJob *job, QDeclarativeXmlQueryResult *currentResult); + void doSubQueryJob(XmlQueryJob *job, QDeclarativeXmlQueryResult *currentResult); void getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const; void addIndexToRangeList(QList *ranges, int index) const; @@ -250,17 +249,12 @@ private: QMutex m_mutex; QThread m_thread; QMap m_jobs; - int m_queryIds; - QString m_prefix; - int m_size; - QList > m_modelData; - QList m_insertedItemRanges; - QList m_removedItemRanges; + QAtomicInt m_queryIds; }; Q_GLOBAL_STATIC(QDeclarativeXmlQuery, globalXmlQuery) -void QDeclarativeXmlQuery::doQueryJob(XmlQueryJob* currentJob) +void QDeclarativeXmlQuery::doQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult) { Q_ASSERT(currentJob->queryId != -1); @@ -295,10 +289,8 @@ void QDeclarativeXmlQuery::doQueryJob(XmlQueryJob* currentJob) } currentJob->data = xml; - m_prefix = namespaces + prefix + QLatin1Char('/'); - m_size = 0; - if (count > 0) - m_size = count; + currentJob->prefix = namespaces + prefix + QLatin1Char('/'); + currentResult->size = (count > 0 ? count : 0); } void QDeclarativeXmlQuery::getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const @@ -306,9 +298,9 @@ void QDeclarativeXmlQuery::getValuesOfKeyRoles(const XmlQueryJob& currentJob, QS const QStringList &keysQueries = currentJob.keyRoleQueries; QString keysQuery; if (keysQueries.count() == 1) - keysQuery = m_prefix + keysQueries[0]; + keysQuery = currentJob.prefix + keysQueries[0]; else if (keysQueries.count() > 1) - keysQuery = m_prefix + QLatin1String("concat(") + keysQueries.join(QLatin1String(",")) + QLatin1String(")"); + keysQuery = currentJob.prefix + QLatin1String("concat(") + keysQueries.join(QLatin1String(",")) + QLatin1String(")"); if (!keysQuery.isEmpty()) { query->setQuery(keysQuery); @@ -331,10 +323,9 @@ void QDeclarativeXmlQuery::addIndexToRangeList(QList * ranges->append(qMakePair(index, 1)); } -void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob* currentJob) +void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult) { Q_ASSERT(currentJob->queryId != -1); - m_modelData.clear(); QBuffer b(¤tJob->data); b.open(QIODevice::ReadOnly); @@ -347,16 +338,14 @@ void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob* currentJob) // See if any values of key roles have been inserted or removed. - m_insertedItemRanges.clear(); - m_removedItemRanges.clear(); if (currentJob->keyRoleResultsCache.isEmpty()) { - m_insertedItemRanges << qMakePair(0, m_size); + currentResult->inserted << qMakePair(0, currentResult->size); } else { if (keyRoleResults != currentJob->keyRoleResultsCache) { QStringList temp; for (int i=0; ikeyRoleResultsCache.count(); i++) { if (!keyRoleResults.contains(currentJob->keyRoleResultsCache[i])) - addIndexToRangeList(&m_removedItemRanges, i); + addIndexToRangeList(¤tResult->removed, i); else temp << currentJob->keyRoleResultsCache[i]; } @@ -364,12 +353,12 @@ void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob* currentJob) for (int i=0; iinserted, i); } } } } - currentJob->keyRoleResultsCache = keyRoleResults; + currentResult->keyRoleResultsCache = keyRoleResults; // Get the new values for each role. //### we might be able to condense even further (query for everything in one go) @@ -377,7 +366,7 @@ void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob* currentJob) for (int i = 0; i < queries.size(); ++i) { QList resultList; if (!queries[i].isEmpty()) { - subquery.setQuery(m_prefix + QLatin1String("(let $v := string(") + queries[i] + QLatin1String(") return if ($v) then ") + queries[i] + QLatin1String(" else \"\")")); + subquery.setQuery(currentJob->prefix + QLatin1String("(let $v := string(") + queries[i] + QLatin1String(") return if ($v) then ") + queries[i] + QLatin1String(" else \"\")")); if (subquery.isValid()) { QXmlResultItems resultItems; subquery.evaluateTo(&resultItems); @@ -391,9 +380,9 @@ void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob* currentJob) } } //### should warn here if things have gone wrong. - while (resultList.count() < m_size) + while (resultList.count() < currentResult->size) resultList << QVariant(); - m_modelData << resultList; + currentResult->data << resultList; b.seek(0); } -- cgit v0.12 From d176e39de8fcde92a92866e7b0db5904c90a1e82 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 14 Apr 2011 09:05:53 +0200 Subject: Do not use SetSurfaceTransparency() on raster. When raster graphics system is forced and the HW was capable enough, we still tried to use SetSurfaceTransparency() on the RWindow to enable semi-transparency, which is wrong as it only works for windows that have a separate surface. Reviewed-by: Jani Hautakangas --- src/gui/kernel/qapplication_s60.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index f73eb02..6e70fc2 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1855,6 +1855,8 @@ void qt_init(QApplicationPrivate * /* priv */, int) } else { QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false; } + if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) + QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false; #else QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false; #endif -- cgit v0.12 From a5898f33f215ff2ac333be61306a47ca162b2104 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 14 Apr 2011 09:13:42 +0200 Subject: Trigger fullscreen transition effects properly on app exit. Avkon calls BeginFullScreen() and EndFullScreen() to trigger the fullscreen system transition effects for application exit, however the calls are made too late for Qt apps because the widgets are already destroyed. Instead, the effects are triggered explicitly from Qt, before closing the widgets, or from aboutToQuit, whichever comes first. Task-number: QT-4718 Reviewed-by: Jani Hautakangas --- mkspecs/common/symbian/symbian.conf | 2 +- src/gui/kernel/qapplication.cpp | 17 ++++++++++++- src/gui/kernel/qapplication_s60.cpp | 7 +++-- src/gui/kernel/qt_s60_p.h | 51 +++++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 4 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index f955e3c..8e04099 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -84,7 +84,7 @@ QMAKE_LIBS_OPENGL_ES2_QT = $$QMAKE_LIBS_OPENGL_ES2 $$QMAKE_LIBS_CFBSBITMAP -lcon QMAKE_LIBS_OPENVG = $$QMAKE_LIBS_CFBSBITMAP -llibOpenVG QMAKE_LIBS_THREAD = -llibpthread QMAKE_LIBS_COMPAT = -QMAKE_LIBS_S60 = -lavkon -leikcoctl +QMAKE_LIBS_S60 = -lavkon -leikcoctl -lgfxtrans exists($${EPOCROOT}epoc32/include/platform/sgresource/sgimage.h) { QMAKE_LIBS_OPENVG += -lsgresource diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 59aec91..f906bbf 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -128,6 +128,10 @@ extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp //#define ALIEN_DEBUG +#if defined(Q_OS_SYMBIAN) +#include "qt_s60_p.h" +#endif + static void initResources() { #if defined(Q_WS_WINCE) @@ -2432,6 +2436,11 @@ bool QApplication::event(QEvent *e) { Q_D(QApplication); if(e->type() == QEvent::Close) { +#if defined(Q_OS_SYMBIAN) + // In order to have proper application-exit effects on Symbian, certain + // native APIs have to be called _before_ closing/destroying the widgets. + bool effectStarted = qt_beginFullScreenEffect(); +#endif QCloseEvent *ce = static_cast(e); ce->accept(); closeAllWindows(); @@ -2445,8 +2454,14 @@ bool QApplication::event(QEvent *e) break; } } - if(ce->isAccepted()) + if (ce->isAccepted()) { return true; + } else { +#if defined(Q_OS_SYMBIAN) + if (effectStarted) + qt_abortFullScreenEffect(); +#endif + } } else if(e->type() == QEvent::LanguageChange) { #ifndef QT_NO_TRANSLATION setLayoutDirection(qt_detectRTLLanguage()?Qt::RightToLeft:Qt::LeftToRight); diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 6e70fc2..6620efd 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1828,9 +1828,7 @@ void qt_init(QApplicationPrivate * /* priv */, int) systemFont.setFamily(systemFont.defaultFamily()); QApplicationPrivate::setSystemFont(systemFont); -#ifdef Q_SYMBIAN_TRANSITION_EFFECTS QObject::connect(qApp, SIGNAL(aboutToQuit()), qApp, SLOT(_q_aboutToQuit())); -#endif #ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE QApplicationPrivate::instance()->useTranslucentEGLSurfaces = true; @@ -1921,6 +1919,9 @@ void qt_cleanup() S60->setButtonGroupContainer(0); #endif + // Call EndFullScreen() to prevent confusing the system effect state machine. + qt_endFullScreenEffect(); + if (S60->qtOwnsS60Environment) { // Restore the S60 framework trap handler. See qt_init(). User::SetTrapHandler(S60->s60InstalledTrapHandler); @@ -2659,6 +2660,8 @@ void QApplication::restoreOverrideCursor() void QApplicationPrivate::_q_aboutToQuit() { + qt_beginFullScreenEffect(); + #ifdef Q_SYMBIAN_TRANSITION_EFFECTS // Send the shutdown tfx command S60->wsSession().SendEffectCommand(ETfxCmdAppShutDown); diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index e24405c..da44016 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -77,6 +77,8 @@ #include // CAknContextPane #include // CEikStatusPane #include // MAknFadedComponent and TAknPopupFader +#include // BeginFullScreen +#include // BeginFullScreen #endif QT_BEGIN_NAMESPACE @@ -85,6 +87,9 @@ QT_BEGIN_NAMESPACE // system events seems to start with 0x10 const TInt KInternalStatusPaneChange = 0x50000000; +// For BeginFullScreen(). +const TUint KQtAppExitFlag = 0x400; + static const int qt_symbian_max_screens = 4; //this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2 @@ -193,6 +198,9 @@ public: int nativeScreenWidthInPixels; int nativeScreenHeightInPixels; + + int beginFullScreenCalled : 1; + int endFullScreenCalled : 1; }; Q_AUTOTEST_EXPORT QS60Data* qGlobalS60Data(); @@ -334,6 +342,8 @@ inline QS60Data::QS60Data() #ifdef Q_OS_SYMBIAN ,s60InstalledTrapHandler(0) #endif + ,beginFullScreenCalled(0), + endFullScreenCalled(0) { } @@ -565,6 +575,47 @@ void qt_symbian_set_cursor_visible(bool visible); bool qt_symbian_is_cursor_visible(); #endif +static inline bool qt_beginFullScreenEffect() +{ +#ifdef Q_WS_S60 + // Only for post-S^3. On earlier versions the system transition effects + // may not be able to capture the non-Avkon content, leading to confusing + // looking effects, so just skip the whole thing. + if (S60->beginFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2) + return false; + S60->beginFullScreenCalled = true; + // For Avkon apps the app-exit effect is triggered from CAknAppUi::PrepareToExit(). + // That is good for Avkon apps, but in case of Qt the RWindows are destroyed earlier. + // Therefore we call BeginFullScreen() ourselves. + GfxTransEffect::BeginFullScreen(AknTransEffect::EApplicationExit, + TRect(0, 0, 0, 0), + AknTransEffect::EParameterType, + AknTransEffect::GfxTransParam(S60->uid, + AknTransEffect::TParameter::EAvkonCheck | KQtAppExitFlag)); + return true; +#endif +} + +static inline void qt_abortFullScreenEffect() +{ +#ifdef Q_WS_S60 + if (!S60->beginFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2) + return; + GfxTransEffect::AbortFullScreen(); + S60->beginFullScreenCalled = S60->endFullScreenCalled = false; +#endif +} + +static inline void qt_endFullScreenEffect() +{ +#ifdef Q_WS_S60 + if (S60->endFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2) + return; + S60->endFullScreenCalled = true; + GfxTransEffect::EndFullScreen(); +#endif +} + QT_END_NAMESPACE #endif // QT_S60_P_H -- cgit v0.12 From c156280a637abd6acb3894723a9e21ba2abc8fb8 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 14 Apr 2011 12:01:01 +0300 Subject: Splitview: opening a context menu should not re-position of focusItem When splitview is open and user long taps an text input item, a context menu is opened. This leads to some drawing operations on splitview implementation, even though these should be skipped. The focusItem might even be re-positioned into incorrect position due to the failure. As a fix, check if the focusItem is already positioned correctly and avoid doing anything when it already is. Task-number: QTBUG-18738 Reviewed-by: Guoqing Zhang --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 8574f2c..b64ce0c 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -538,11 +538,11 @@ void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget) if (alwaysResize) { windowToMove->setUpdatesEnabled(false); - if (!moveWithinVisibleArea) + if (!moveWithinVisibleArea) { m_splitViewResizeBy = widget->height(); - - windowTop = widget->geometry().top(); - widget->resize(widget->width(), splitViewRect.height() - windowTop); + windowTop = widget->geometry().top(); + widget->resize(widget->width(), splitViewRect.height() - windowTop); + } if (gv->scene()) { const QRectF microFocusRect = gv->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF(); -- cgit v0.12 From f4dedf1a4d7e530c715f99327da175cec67d66e4 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 14 Apr 2011 13:00:29 +0300 Subject: QGraphicsView with vertical scrollbar flickers when splitview opens Do windowstate change to fullscreen inside updateEnabled(false) - updateEnabled(true) guard block to avoid flickering of screen area, when keyboard opens in splitview. In worst case, screen is drawn three times: - resize the content area to fit into splitview - change windowstate to fullscreen - ensure visibility of the focusitem by scrolling the view Now, all these happen inside one "update". Task-number: QTBUG-18737 Reviewed-by: Guoqing Zhang --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index b64ce0c..e4b965b 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -531,13 +531,15 @@ void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget) // and greatly reduces event passing in orientation switch cases, // as the statuspane size is not changing. + if (alwaysResize) + windowToMove->setUpdatesEnabled(false); + if (!(windowToMove->windowState() & Qt::WindowFullScreen)) { windowToMove->setWindowState( (windowToMove->windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen)) | Qt::WindowFullScreen); } if (alwaysResize) { - windowToMove->setUpdatesEnabled(false); if (!moveWithinVisibleArea) { m_splitViewResizeBy = widget->height(); windowTop = widget->geometry().top(); @@ -548,11 +550,13 @@ void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget) const QRectF microFocusRect = gv->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF(); gv->ensureVisible(microFocusRect); } - windowToMove->setUpdatesEnabled(true); } else { translateInputWidget(); } + if (alwaysResize) + windowToMove->setUpdatesEnabled(true); + widget->setAttribute(Qt::WA_Resized, userResize); //not a user resize } -- cgit v0.12 From 8a37a69c961092aae7dd7f55f30a15b3fae1b7cc Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 14 Apr 2011 13:22:36 +0300 Subject: Splitview flag should also be updated to inputcontext Currently splitview support is defined in exported global private method. There is no guarantee that input context is created, or updated when the API is called. This is problematic, since the client need to find a correct place and time when to call the API. As a change, update existing input context when the API is called. Also, take into account the splitview flag when updating input context. This ensures that client can enforce the flag use correctly. Task-number: QTBUG-18715 Reviewed-by: Guoqing Zhang --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index e4b965b..c11d5e8 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -77,6 +77,15 @@ QT_BEGIN_NAMESPACE Q_GUI_EXPORT void qt_s60_setPartialScreenInputMode(bool enable) { S60->partial_keyboard = enable; + + QInputContext *ic = 0; + if (QApplication::focusWidget()) { + ic = QApplication::focusWidget()->inputContext(); + } else if (qApp && qApp->inputContext()) { + ic = qApp->inputContext(); + } + if (ic) + ic->update(); } QCoeFepInputContext::QCoeFepInputContext(QObject *parent) @@ -580,6 +589,19 @@ void QCoeFepInputContext::updateHints(bool mustUpdateInputCapabilities) QWidget *w = focusWidget(); if (w) { Qt::InputMethodHints hints = w->inputMethodHints(); + + // Since splitview support works like an input method hint, yet it is private flag, + // we need to update its state separately. + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) { + TInt currentFlags = m_fepState->Flags(); + if (S60->partial_keyboard) + currentFlags |= QT_EAknEditorFlagEnablePartialScreen; + else + currentFlags &= ~QT_EAknEditorFlagEnablePartialScreen; + if (currentFlags != m_fepState->Flags()) + m_fepState->SetFlags(currentFlags); + } + if (hints != m_lastImHints) { m_lastImHints = hints; applyHints(hints); -- cgit v0.12 From ddd633f2f4234aae353cd0239974a3a997abc71e Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 14 Apr 2011 14:08:23 +0200 Subject: QDeclarativeDebug: Don't crash when connection is closed Protocol might still be in the process of processing messages when disconnect() is called (e.g. due to an invalid package). Therefore delay it's deletion until the next event loop runs. Reviewed-by: Christiaan Janssen Task-number: QTBUG-18771 --- src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp b/src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp index 69c1ef5..7db0db3 100644 --- a/src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp +++ b/src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp @@ -97,7 +97,8 @@ void QTcpServerConnection::send(const QByteArray &message) { Q_D(QTcpServerConnection); - if (!isConnected()) + if (!isConnected() + || !d->protocol || !d->socket) return; QPacket pack; @@ -111,9 +112,10 @@ void QTcpServerConnection::disconnect() { Q_D(QTcpServerConnection); - delete d->protocol; + // protocol might still be processing packages at this point + d->protocol->deleteLater(); d->protocol = 0; - delete d->socket; + d->socket->deleteLater(); d->socket = 0; } @@ -143,6 +145,9 @@ void QTcpServerConnection::listen() void QTcpServerConnection::readyRead() { Q_D(QTcpServerConnection); + if (!d->protocol) + return; + QPacket packet = d->protocol->read(); QByteArray content = packet.data(); -- cgit v0.12 From 9ed28d039da0f3745ca84203efa92203f31e97e7 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 30 Mar 2011 14:52:21 +0200 Subject: QmlDebug: Rename 'tcpserver' library to 'qmldbg_tcp' Make the name less ambiguous, especially on Symbian were all .dlls end up in sys\bin. Reviewed-by: Pawel Polanski --- src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro | 18 +++ .../qmltooling/qmldbg_tcp/qtcpserverconnection.cpp | 178 +++++++++++++++++++++ .../qmltooling/qmldbg_tcp/qtcpserverconnection.h | 84 ++++++++++ src/plugins/qmltooling/qmltooling.pro | 3 +- .../qmltooling/tcpserver/qtcpserverconnection.cpp | 178 --------------------- .../qmltooling/tcpserver/qtcpserverconnection.h | 84 ---------- src/plugins/qmltooling/tcpserver/tcpserver.pro | 18 --- tools/qml/qml.pro | 2 +- 8 files changed, 282 insertions(+), 283 deletions(-) create mode 100644 src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro create mode 100644 src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp create mode 100644 src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h delete mode 100644 src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp delete mode 100644 src/plugins/qmltooling/tcpserver/qtcpserverconnection.h delete mode 100644 src/plugins/qmltooling/tcpserver/tcpserver.pro diff --git a/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro b/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro new file mode 100644 index 0000000..e8ab962 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro @@ -0,0 +1,18 @@ +TARGET = qmldbg_tcp +QT += declarative network + +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/qmltooling +QTDIR_build:REQUIRES += "contains(QT_CONFIG, declarative)" + +SOURCES += \ + qtcpserverconnection.cpp + +HEADERS += \ + qtcpserverconnection.h + +target.path += $$[QT_INSTALL_PLUGINS]/qmltooling +INSTALLS += target + +symbian:TARGET.UID3=0x20031E90 diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp new file mode 100644 index 0000000..7db0db3 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp @@ -0,0 +1,178 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtcpserverconnection.h" + +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +class QTcpServerConnectionPrivate { +public: + QTcpServerConnectionPrivate(); + + int port; + QTcpSocket *socket; + QPacketProtocol *protocol; + QTcpServer *tcpServer; + + QDeclarativeDebugServer *debugServer; +}; + +QTcpServerConnectionPrivate::QTcpServerConnectionPrivate() : + port(0), + socket(0), + protocol(0), + tcpServer(0), + debugServer(0) +{ +} + +QTcpServerConnection::QTcpServerConnection() : + d_ptr(new QTcpServerConnectionPrivate) +{ + +} + +QTcpServerConnection::~QTcpServerConnection() +{ + delete d_ptr; +} + +void QTcpServerConnection::setServer(QDeclarativeDebugServer *server) +{ + Q_D(QTcpServerConnection); + d->debugServer = server; +} + +bool QTcpServerConnection::isConnected() const +{ + Q_D(const QTcpServerConnection); + return d->socket && d->socket->state() == QTcpSocket::ConnectedState; +} + +void QTcpServerConnection::send(const QByteArray &message) +{ + Q_D(QTcpServerConnection); + + if (!isConnected() + || !d->protocol || !d->socket) + return; + + QPacket pack; + pack.writeRawData(message.data(), message.length()); + + d->protocol->send(pack); + d->socket->flush(); +} + +void QTcpServerConnection::disconnect() +{ + Q_D(QTcpServerConnection); + + // protocol might still be processing packages at this point + d->protocol->deleteLater(); + d->protocol = 0; + d->socket->deleteLater(); + d->socket = 0; +} + +void QTcpServerConnection::setPort(int port, bool block) +{ + Q_D(QTcpServerConnection); + d->port = port; + + listen(); + if (block) + d->tcpServer->waitForNewConnection(-1); +} + +void QTcpServerConnection::listen() +{ + Q_D(QTcpServerConnection); + + d->tcpServer = new QTcpServer(this); + QObject::connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection())); + if (d->tcpServer->listen(QHostAddress::Any, d->port)) + qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", d->port); + else + qWarning("QDeclarativeDebugServer: Unable to listen on port %d", d->port); +} + + +void QTcpServerConnection::readyRead() +{ + Q_D(QTcpServerConnection); + if (!d->protocol) + return; + + QPacket packet = d->protocol->read(); + + QByteArray content = packet.data(); + d->debugServer->receiveMessage(content); +} + +void QTcpServerConnection::newConnection() +{ + Q_D(QTcpServerConnection); + + if (d->socket) { + qWarning("QDeclarativeDebugServer: Another client is already connected"); + QTcpSocket *faultyConnection = d->tcpServer->nextPendingConnection(); + delete faultyConnection; + return; + } + + d->socket = d->tcpServer->nextPendingConnection(); + d->socket->setParent(this); + d->protocol = new QPacketProtocol(d->socket, this); + QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); +} + + +Q_EXPORT_PLUGIN2(tcpserver, QTcpServerConnection) + +QT_END_NAMESPACE + diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h new file mode 100644 index 0000000..a6e17e6 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCPSERVERCONNECTION_H +#define QTCPSERVERCONNECTION_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QDeclarativeDebugServer; +class QTcpServerConnectionPrivate; +class QTcpServerConnection : public QObject, public QDeclarativeDebugServerConnection +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QTcpServerConnection) + Q_DISABLE_COPY(QTcpServerConnection) + Q_INTERFACES(QDeclarativeDebugServerConnection) + + +public: + QTcpServerConnection(); + ~QTcpServerConnection(); + + void setServer(QDeclarativeDebugServer *server); + void setPort(int port, bool bock); + + bool isConnected() const; + void send(const QByteArray &message); + void disconnect(); + + void listen(); + void waitForConnection(); + +private Q_SLOTS: + void readyRead(); + void newConnection(); + +private: + QTcpServerConnectionPrivate *d_ptr; +}; + +QT_END_NAMESPACE + +#endif // QTCPSERVERCONNECTION_H diff --git a/src/plugins/qmltooling/qmltooling.pro b/src/plugins/qmltooling/qmltooling.pro index 01cf1a9..2442dc0 100644 --- a/src/plugins/qmltooling/qmltooling.pro +++ b/src/plugins/qmltooling/qmltooling.pro @@ -1,4 +1,3 @@ TEMPLATE = subdirs -SUBDIRS = tcpserver - +SUBDIRS = qmldbg_tcp diff --git a/src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp b/src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp deleted file mode 100644 index 7db0db3..0000000 --- a/src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtcpserverconnection.h" - -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -class QTcpServerConnectionPrivate { -public: - QTcpServerConnectionPrivate(); - - int port; - QTcpSocket *socket; - QPacketProtocol *protocol; - QTcpServer *tcpServer; - - QDeclarativeDebugServer *debugServer; -}; - -QTcpServerConnectionPrivate::QTcpServerConnectionPrivate() : - port(0), - socket(0), - protocol(0), - tcpServer(0), - debugServer(0) -{ -} - -QTcpServerConnection::QTcpServerConnection() : - d_ptr(new QTcpServerConnectionPrivate) -{ - -} - -QTcpServerConnection::~QTcpServerConnection() -{ - delete d_ptr; -} - -void QTcpServerConnection::setServer(QDeclarativeDebugServer *server) -{ - Q_D(QTcpServerConnection); - d->debugServer = server; -} - -bool QTcpServerConnection::isConnected() const -{ - Q_D(const QTcpServerConnection); - return d->socket && d->socket->state() == QTcpSocket::ConnectedState; -} - -void QTcpServerConnection::send(const QByteArray &message) -{ - Q_D(QTcpServerConnection); - - if (!isConnected() - || !d->protocol || !d->socket) - return; - - QPacket pack; - pack.writeRawData(message.data(), message.length()); - - d->protocol->send(pack); - d->socket->flush(); -} - -void QTcpServerConnection::disconnect() -{ - Q_D(QTcpServerConnection); - - // protocol might still be processing packages at this point - d->protocol->deleteLater(); - d->protocol = 0; - d->socket->deleteLater(); - d->socket = 0; -} - -void QTcpServerConnection::setPort(int port, bool block) -{ - Q_D(QTcpServerConnection); - d->port = port; - - listen(); - if (block) - d->tcpServer->waitForNewConnection(-1); -} - -void QTcpServerConnection::listen() -{ - Q_D(QTcpServerConnection); - - d->tcpServer = new QTcpServer(this); - QObject::connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection())); - if (d->tcpServer->listen(QHostAddress::Any, d->port)) - qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", d->port); - else - qWarning("QDeclarativeDebugServer: Unable to listen on port %d", d->port); -} - - -void QTcpServerConnection::readyRead() -{ - Q_D(QTcpServerConnection); - if (!d->protocol) - return; - - QPacket packet = d->protocol->read(); - - QByteArray content = packet.data(); - d->debugServer->receiveMessage(content); -} - -void QTcpServerConnection::newConnection() -{ - Q_D(QTcpServerConnection); - - if (d->socket) { - qWarning("QDeclarativeDebugServer: Another client is already connected"); - QTcpSocket *faultyConnection = d->tcpServer->nextPendingConnection(); - delete faultyConnection; - return; - } - - d->socket = d->tcpServer->nextPendingConnection(); - d->socket->setParent(this); - d->protocol = new QPacketProtocol(d->socket, this); - QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); -} - - -Q_EXPORT_PLUGIN2(tcpserver, QTcpServerConnection) - -QT_END_NAMESPACE - diff --git a/src/plugins/qmltooling/tcpserver/qtcpserverconnection.h b/src/plugins/qmltooling/tcpserver/qtcpserverconnection.h deleted file mode 100644 index a6e17e6..0000000 --- a/src/plugins/qmltooling/tcpserver/qtcpserverconnection.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTCPSERVERCONNECTION_H -#define QTCPSERVERCONNECTION_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class QDeclarativeDebugServer; -class QTcpServerConnectionPrivate; -class QTcpServerConnection : public QObject, public QDeclarativeDebugServerConnection -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QTcpServerConnection) - Q_DISABLE_COPY(QTcpServerConnection) - Q_INTERFACES(QDeclarativeDebugServerConnection) - - -public: - QTcpServerConnection(); - ~QTcpServerConnection(); - - void setServer(QDeclarativeDebugServer *server); - void setPort(int port, bool bock); - - bool isConnected() const; - void send(const QByteArray &message); - void disconnect(); - - void listen(); - void waitForConnection(); - -private Q_SLOTS: - void readyRead(); - void newConnection(); - -private: - QTcpServerConnectionPrivate *d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QTCPSERVERCONNECTION_H diff --git a/src/plugins/qmltooling/tcpserver/tcpserver.pro b/src/plugins/qmltooling/tcpserver/tcpserver.pro deleted file mode 100644 index f4f2666..0000000 --- a/src/plugins/qmltooling/tcpserver/tcpserver.pro +++ /dev/null @@ -1,18 +0,0 @@ -TARGET = tcpserver -QT += declarative network - -include(../../qpluginbase.pri) - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/qmltooling -QTDIR_build:REQUIRES += "contains(QT_CONFIG, declarative)" - -SOURCES += \ - qtcpserverconnection.cpp - -HEADERS += \ - qtcpserverconnection.h - -target.path += $$[QT_INSTALL_PLUGINS]/qmltooling -INSTALLS += target - -symbian:TARGET.UID3=0x20031E90 \ No newline at end of file diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index b1d56ea..bdc4b10 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -39,7 +39,7 @@ symbian { TARGET.CAPABILITY = NetworkServices ReadUserData # Deploy plugin for remote debugging - qmldebuggingplugin.sources = $$QT_BUILD_TREE/plugins/qmltooling/tcpserver$${QT_LIBINFIX}.dll + qmldebuggingplugin.sources = $$QT_BUILD_TREE/plugins/qmltooling/qmldbgtcp$${QT_LIBINFIX}.dll qmldebuggingplugin.path = c:$$QT_PLUGINS_BASE_DIR/qmltooling DEPLOYMENT += qmldebuggingplugin } -- cgit v0.12 From ead56475cc6ecd7a6e7e17d63f0e22cf930bcae4 Mon Sep 17 00:00:00 2001 From: Tom Sutcliffe Date: Wed, 23 Mar 2011 16:53:48 +0000 Subject: Adding plugin qmltooling/qmlostplugin for QML debugging over OST (USB) on Symbian. Task-number: QTBUG-18764 Reviewed-by: kkoehne --- .../debugger/qdeclarativedebugserver.cpp | 18 +- src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro | 21 +++ src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp | 143 +++++++++++++++ src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h | 81 +++++++++ src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp | 180 +++++++++++++++++++ src/plugins/qmltooling/qmldbg_ost/qostdevice.h | 75 ++++++++ src/plugins/qmltooling/qmldbg_ost/usbostcomm.h | 191 +++++++++++++++++++++ src/plugins/qmltooling/qmltooling.pro | 1 + tools/qml/qml.pro | 2 +- 9 files changed, 706 insertions(+), 6 deletions(-) create mode 100644 src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro create mode 100644 src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp create mode 100644 src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h create mode 100644 src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp create mode 100644 src/plugins/qmltooling/qmldbg_ost/qostdevice.h create mode 100644 src/plugins/qmltooling/qmldbg_ost/usbostcomm.h diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp index 14e7187..18258f5 100644 --- a/src/declarative/debugger/qdeclarativedebugserver.cpp +++ b/src/declarative/debugger/qdeclarativedebugserver.cpp @@ -91,7 +91,7 @@ public: QStringList clientPlugins; bool gotHello; - static QDeclarativeDebugServerConnection *loadConnectionPlugin(); + static QDeclarativeDebugServerConnection *loadConnectionPlugin(const QString &pluginName); }; QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() : @@ -113,7 +113,8 @@ void QDeclarativeDebugServerPrivate::advertisePlugins() connection->send(message); } -QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectionPlugin() +QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectionPlugin( + const QString &pluginName) { QStringList pluginCandidates; const QStringList paths = QCoreApplication::libraryPaths(); @@ -122,7 +123,8 @@ QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectio if (dir.exists()) { QStringList plugins(dir.entryList(QDir::Files)); foreach (const QString &pluginPath, plugins) { - pluginCandidates << dir.absoluteFilePath(pluginPath); + if (QFileInfo(pluginPath).fileName().contains(pluginName)) + pluginCandidates << dir.absoluteFilePath(pluginPath); } } } @@ -166,7 +168,7 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance() bool block = false; bool ok = false; - // format: qmljsdebugger=port:3768[,block] + // format: qmljsdebugger=port:3768[,block] OR qmljsdebugger=ost[,block] if (!appD->qmljsDebugArgumentsString().isEmpty()) { if (!QDeclarativeEnginePrivate::qml_debugging_enabled) { const QString message = @@ -177,17 +179,23 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance() return 0; } + QString pluginName; if (appD->qmljsDebugArgumentsString().indexOf(QLatin1String("port:")) == 0) { int separatorIndex = appD->qmljsDebugArgumentsString().indexOf(QLatin1Char(',')); port = appD->qmljsDebugArgumentsString().mid(5, separatorIndex - 5).toInt(&ok); + pluginName = QLatin1String("qmldbg_tcp"); + } else if (appD->qmljsDebugArgumentsString().contains("ost")) { + pluginName = QLatin1String("qmldbg_ost"); + ok = true; } + block = appD->qmljsDebugArgumentsString().contains(QLatin1String("block")); if (ok) { server = new QDeclarativeDebugServer(); QDeclarativeDebugServerConnection *connection - = QDeclarativeDebugServerPrivate::loadConnectionPlugin(); + = QDeclarativeDebugServerPrivate::loadConnectionPlugin(pluginName); if (connection) { server->d_func()->connection = connection; diff --git a/src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro b/src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro new file mode 100644 index 0000000..2748889 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro @@ -0,0 +1,21 @@ +TARGET = qmldbg_ost +QT += declarative network + +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/qmltooling +QTDIR_build:REQUIRES += "contains(QT_CONFIG, declarative)" + +SOURCES += \ + qmlostplugin.cpp \ + qostdevice.cpp + +HEADERS += \ + qmlostplugin.h \ + qostdevice.h \ + usbostcomm.h + +target.path += $$[QT_INSTALL_PLUGINS]/qmltooling +INSTALLS += target + +symbian:TARGET.UID3=0x20031E92 diff --git a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp new file mode 100644 index 0000000..e0d7664 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** 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$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmlostplugin.h" +#include "qostdevice.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +static const TInt KQmlOstProtocolId = 0x94; + +class QmlOstPluginPrivate { +public: + QmlOstPluginPrivate(); + + QOstDevice *ost; + QPacketProtocol *protocol; + QDeclarativeDebugServer *debugServer; +}; + +QmlOstPluginPrivate::QmlOstPluginPrivate() : + ost(0), + protocol(0), + debugServer(0) +{ +} + +QmlOstPlugin::QmlOstPlugin() : + d_ptr(new QmlOstPluginPrivate) +{ +} + +QmlOstPlugin::~QmlOstPlugin() +{ + delete d_ptr; +} + +void QmlOstPlugin::setServer(QDeclarativeDebugServer *server) +{ + Q_D(QmlOstPlugin); + d->debugServer = server; +} + +bool QmlOstPlugin::isConnected() const +{ + Q_D(const QmlOstPlugin); + return d->ost && d->ost->isOpen(); +} + +void QmlOstPlugin::send(const QByteArray &message) +{ + Q_D(QmlOstPlugin); + + if (!isConnected()) + return; + + QPacket pack; + pack.writeRawData(message.data(), message.length()); + + d->protocol->send(pack); + //d->socket->flush(); +} + +void QmlOstPlugin::disconnect() +{ + Q_D(QmlOstPlugin); + + delete d->protocol; + d->protocol = 0; +} + +void QmlOstPlugin::setPort(int port, bool block) +{ + Q_UNUSED(port); + Q_UNUSED(block); + + Q_D(QmlOstPlugin); + + d->ost = new QOstDevice(this); + bool ok = d->ost->open(KQmlOstProtocolId); + if (!ok) { + if (d->ost->errorString().length()) + qDebug("Error from QOstDevice: %s", qPrintable(d->ost->errorString())); + qWarning("QDeclarativeDebugServer: Unable to listen on OST"); // This message is part of the signalling - do not change the format! + return; + } + d->protocol = new QPacketProtocol(d->ost, this); + QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); + qWarning("QDeclarativeDebugServer: Waiting for connection via OST"); // This message is part of the signalling - do not change the format! +} + +void QmlOstPlugin::readyRead() +{ + Q_D(QmlOstPlugin); + QPacket packet = d->protocol->read(); + + QByteArray content = packet.data(); + d->debugServer->receiveMessage(content); +} + +Q_EXPORT_PLUGIN2(qmlostplugin, QmlOstPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h new file mode 100644 index 0000000..1e18444 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLOSTPLUGIN_H +#define QMLOSTPLUGIN_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QDeclarativeDebugServer; +class QmlOstPluginPrivate; + +class QmlOstPlugin : public QObject, public QDeclarativeDebugServerConnection +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QmlOstPlugin) + Q_DISABLE_COPY(QmlOstPlugin) + Q_INTERFACES(QDeclarativeDebugServerConnection) + + +public: + QmlOstPlugin(); + ~QmlOstPlugin(); + + void setServer(QDeclarativeDebugServer *server); + void setPort(int port, bool bock); + + bool isConnected() const; + void send(const QByteArray &message); + void disconnect(); + +private Q_SLOTS: + void readyRead(); + +private: + QmlOstPluginPrivate *d_ptr; +}; + +QT_END_NAMESPACE + +#endif // QMLOSTPLUGIN_H diff --git a/src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp b/src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp new file mode 100644 index 0000000..3c5515f --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp @@ -0,0 +1,180 @@ +/**************************************************************************** +** +** 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$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qostdevice.h" +#include + +#include "usbostcomm.h" + +class QOstDevicePrivate : public CActive +{ + QOstDevice* q_ptr; + Q_DECLARE_PUBLIC(QOstDevice) + +public: + QOstDevicePrivate() : CActive(CActive::EPriorityStandard) { + CActiveScheduler::Add(this); + } + ~QOstDevicePrivate() { + Cancel(); + } + +private: + void RunL(); + void DoCancel(); + +private: + RUsbOstComm ost; + TBuf8<4096> readBuf; + QByteArray dataBuf; +}; + +QOstDevice::QOstDevice(QObject *parent) : + QIODevice(parent), d_ptr(new QOstDevicePrivate) +{ + d_ptr->q_ptr = this; +} + +QOstDevice::~QOstDevice() +{ + close(); + delete d_ptr; +} + +bool QOstDevice::open(int ostProtocolId) +{ + if (isOpen()) + return false; + + Q_D(QOstDevice); + TInt err = d->ost.Connect(); + if (!err) err = d->ost.Open(); + const TVersion KRequiredVersion(1,1,0); + TVersion version = d->ost.Version(); + if (version.iMajor < KRequiredVersion.iMajor || + (version.iMajor == KRequiredVersion.iMajor && version.iMinor < KRequiredVersion.iMinor)) { + setErrorString("CODA version too old. At least version 4.0.18 (without TRK) is required."); + return false; + } + + if (!err) err = d->ost.RegisterProtocolID((TOstProtIds)ostProtocolId, EFalse); + if (!err) { + d->ost.ReadMessage(d->iStatus, d->readBuf); + d->SetActive(); + return QIODevice::open(ReadWrite | Unbuffered); + } + return false; +} + +void QOstDevicePrivate::RunL() +{ + Q_Q(QOstDevice); + //qDebug("QOstDevice received %d bytes q=%x", readBuf.Size(), q); + if (iStatus == KErrNone) { + QByteArray data = QByteArray::fromRawData((const char*)readBuf.Ptr(), readBuf.Size()); + dataBuf.append(data); + + readBuf.Zero(); + ost.ReadMessage(iStatus, readBuf); + SetActive(); + + emit q->readyRead(); + } else { + q->setErrorString(QString("Error %1 from RUsbOstComm::ReadMessage()").arg(iStatus.Int())); + } + //qDebug("-QOstDevicePrivate RunL"); +} + +void QOstDevicePrivate::DoCancel() +{ + ost.ReadCancel(); +} + +void QOstDevice::close() +{ + Q_D(QOstDevice); + QIODevice::close(); + d->Cancel(); + // RDbgTrcComm::Close isn't safe to call when not open, sigh + if (d->ost.Handle()) { + d->ost.Close(); + } +} + +qint64 QOstDevice::readData(char *data, qint64 maxSize) +{ + Q_D(QOstDevice); + if (d->dataBuf.length() == 0 && !d->IsActive()) + return -1; + qint64 available = qMin(maxSize, (qint64)d->dataBuf.length()); + memcpy(data, d->dataBuf.constData(), available); + d->dataBuf.remove(0, available); + return available; +} + +static const TInt KMaxOstPacketLen = 4096; + +qint64 QOstDevice::writeData(const char *data, qint64 maxSize) +{ + Q_D(QOstDevice); + TPtrC8 ptr((const TUint8*)data, (TInt)maxSize); + while (ptr.Length()) { + TPtrC8 fragment = ptr.Left(qMin(ptr.Length(), KMaxOstPacketLen)); + //qDebug("QOstDevice writing %d bytes", fragment.Length()); + TRequestStatus stat; + d->ost.WriteMessage(stat, fragment); + User::WaitForRequest(stat); + if (stat.Int() != KErrNone) { + setErrorString(QString("Error %1 from RUsbOstComm::WriteMessage()").arg(stat.Int())); + return -1; + } + ptr.Set(ptr.Mid(fragment.Length())); + } + emit bytesWritten(maxSize); //TODO does it matter this is emitted synchronously? + //qDebug("QOstDevice wrote %d bytes", ptr.Size()); + return maxSize; +} + +qint64 QOstDevice::bytesAvailable() const +{ + Q_D(const QOstDevice); + return d->dataBuf.length(); +} diff --git a/src/plugins/qmltooling/qmldbg_ost/qostdevice.h b/src/plugins/qmltooling/qmldbg_ost/qostdevice.h new file mode 100644 index 0000000..26bdc15 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_ost/qostdevice.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** 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$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOSTDEVICE_H +#define QOSTDEVICE_H + +#include + +QT_BEGIN_NAMESPACE + +class QOstDevicePrivate; + +class QOstDevice : public QIODevice +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QOstDevice) + Q_DISABLE_COPY(QOstDevice) + +public: + explicit QOstDevice(QObject *parent=0); + ~QOstDevice(); + + bool open(int ostProtocolId); + void close(); + +protected: + qint64 readData(char *data, qint64 maxSize); + qint64 writeData(const char *data, qint64 maxSize); + qint64 bytesAvailable() const; + +private: + QOstDevicePrivate* d_ptr; +}; + +QT_END_NAMESPACE + +#endif // QOSTDEVICE_H diff --git a/src/plugins/qmltooling/qmldbg_ost/usbostcomm.h b/src/plugins/qmltooling/qmldbg_ost/usbostcomm.h new file mode 100644 index 0000000..5f29e71 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_ost/usbostcomm.h @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** 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$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef USBHOSTCOMM_H +#define USBHOSTCOMM_H + +// Based on the official usbostrouter header, modified to remove dependancy on +// the client DLL + +#include + +typedef int TOstProtIds; + +class RUsbOstComm : public RSessionBase +{ +public: + RUsbOstComm(); + TInt Connect(); + TInt Disconnect(); + TInt Open(); + TInt Close(); + TInt RegisterProtocolID(TOstProtIds aId, TBool aNeedHeader); + void ReadMessage(TRequestStatus& aStatus, TDes8& aDes); + TInt ReadCancel(); + void WriteMessage(TRequestStatus& aStatus, const TDesC8& aDes, TBool aHasHeader=EFalse); + TVersion Version() const; + +private: + enum TUsbOstCmdCode + { + EUsbOstCmdCodeFirst, + EUsbOstCmdConnect, + EUsbOstCmdDisconnect, + EUsbOstCmdCodeGetAcmConfig, + EUsbOstCmdCodeSetAcmConfig, + EUsbOstCmdCodeOpen, + EUsbOstCmdCodeClose, + EUsbOstCmdCodeRegisterId, + EUsbOstCmdCodeRegisterIds, + EUsbOstCmdCodeUnRegisterId, + EUsbOstCmdCodeUnRegisterIds, + EUsbOstCmdCodeReadMsg, + EUsbOstCmdCodeReadCancel, + EUsbOstCmdCodeWriteMsg, + EUsbOstCmdCodeWriteCancel, + EUsbOstCmdCodeLast + }; +}; + +RUsbOstComm::RUsbOstComm() +{ +} + +TInt RUsbOstComm::Connect() +{ + _LIT(KUsbOstServerName, "!UsbOstRouter"); + _LIT(KUsbOstServerImageName, "usbostrouter"); + const TUid KUsbOstServerUid = { 0x200170BE }; + TInt startupAttempts = 2; + for(;;) { + TInt ret = CreateSession(KUsbOstServerName, TVersion(1,0,0)); + if (ret != KErrNotFound && ret != KErrServerTerminated) { + return ret; + } + + if (startupAttempts-- == 0) { + return ret; + } + + RProcess server; + ret = server.Create(KUsbOstServerImageName, KNullDesC, KUsbOstServerUid); + if (ret != KErrNone) + return ret; + + TRequestStatus serverDiedRequestStatus; + server.Rendezvous(serverDiedRequestStatus); + + if (serverDiedRequestStatus != KRequestPending) { + // Abort startup + server.Kill(KErrNone); + } else { + // Logon OK - start the server + server.Resume(); + } + User::WaitForRequest(serverDiedRequestStatus); + ret = (server.ExitType() == EExitPanic) ? KErrGeneral : serverDiedRequestStatus.Int(); + server.Close(); + + if (ret != KErrNone && ret != KErrAlreadyExists) { + return ret; + } + } +} + +TInt RUsbOstComm::Disconnect() +{ + return SendReceive(EUsbOstCmdDisconnect); +} + +TInt RUsbOstComm::Open() +{ + return SendReceive(EUsbOstCmdCodeOpen); +} + +TInt RUsbOstComm::Close() +{ + TInt err = SendReceive(EUsbOstCmdCodeClose); + RHandleBase::Close(); + return err; +} + +TInt RUsbOstComm::RegisterProtocolID(const TOstProtIds aId, TBool aNeedHeader) +{ + TIpcArgs args(aId, aNeedHeader); + return SendReceive(EUsbOstCmdCodeRegisterId, args); +} + +void RUsbOstComm::ReadMessage(TRequestStatus& aStatus, TDes8& aDes) +{ + TIpcArgs args(aDes.MaxLength(), &aDes); + SendReceive(EUsbOstCmdCodeReadMsg, args, aStatus); +} + +TInt RUsbOstComm::ReadCancel() +{ + return SendReceive(EUsbOstCmdCodeReadCancel); +} + +void RUsbOstComm::WriteMessage(TRequestStatus& aStatus, const TDesC8& aDes, TBool aHasHeader) +{ + TIpcArgs args(aHasHeader, aDes.Length(), &aDes); + SendReceive(EUsbOstCmdCodeWriteMsg, args, aStatus); +} + +typedef TVersion (*TVersionFunction)(const RUsbOstComm*); +const TInt KVersionOrdinal = 17; + +TVersion RUsbOstComm::Version() const +{ + // This function has to go to the DLL, unfortunately + TVersion result; // Return 0.0.0 on any error + RLibrary lib; + TInt err = lib.Load(_L("usbostcomm")); + if (err) return result; + + TLibraryFunction fn = lib.Lookup(KVersionOrdinal); + if (fn) + result = ((TVersionFunction)fn)(this); + lib.Close(); + return result; +} + +#endif //USBHOSTCOMM_H diff --git a/src/plugins/qmltooling/qmltooling.pro b/src/plugins/qmltooling/qmltooling.pro index 2442dc0..9b3346f 100644 --- a/src/plugins/qmltooling/qmltooling.pro +++ b/src/plugins/qmltooling/qmltooling.pro @@ -1,3 +1,4 @@ TEMPLATE = subdirs SUBDIRS = qmldbg_tcp +symbian:SUBDIRS += qmldbg_ost diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index bdc4b10..84ebba8 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -39,7 +39,7 @@ symbian { TARGET.CAPABILITY = NetworkServices ReadUserData # Deploy plugin for remote debugging - qmldebuggingplugin.sources = $$QT_BUILD_TREE/plugins/qmltooling/qmldbgtcp$${QT_LIBINFIX}.dll + qmldebuggingplugin.sources = $$QT_BUILD_TREE/plugins/qmltooling/qmldbg_tcp$${QT_LIBINFIX}.dll $$QT_BUILD_TREE/plugins/qmltooling/qmldbg_ost$${QT_LIBINFIX}.dll qmldebuggingplugin.path = c:$$QT_PLUGINS_BASE_DIR/qmltooling DEPLOYMENT += qmldebuggingplugin } -- cgit v0.12 From b4b85257ccff6ba21bcbcbd46a9f7f09884abe79 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 15 Apr 2011 11:48:06 +1000 Subject: Resolve unqualified attached properties correctly When resolving unqualified attached properties, we should use the scope object, not the context object. Otherwise they will always resolve to the root object of the context, regardless of where they are written. In this example, QtObject { id: root QtObject { id: me property int a: AttachedObject.x } } the attached object should be loaded on the "me" object, not the "root" object. Change-Id: I386f886f62df7b8020c3ff703cdfc891d5739713 Reviewed-by: Martin Jones --- .../qml/qdeclarativecontextscriptclass.cpp | 16 ++++++++-------- .../data/attachedProperty.2.qml | 22 ++++++++++++++++++++++ .../declarative/qdeclarativeecmascript/testtypes.h | 5 +++-- .../tst_qdeclarativeecmascript.cpp | 10 ++++++++++ 4 files changed, 43 insertions(+), 10 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/attachedProperty.2.qml diff --git a/src/declarative/qml/qdeclarativecontextscriptclass.cpp b/src/declarative/qml/qdeclarativecontextscriptclass.cpp index bb4ece4..3abd787 100644 --- a/src/declarative/qml/qdeclarativecontextscriptclass.cpp +++ b/src/declarative/qml/qdeclarativecontextscriptclass.cpp @@ -227,6 +227,7 @@ QDeclarativeContextScriptClass::queryProperty(QDeclarativeContextData *bindConte if (data) { lastData = data; lastContext = bindContext; + lastScopeObject = scopeObject; return QScriptClass::HandlesReadAccess; } } @@ -268,17 +269,12 @@ QDeclarativeContextScriptClass::property(Object *object, const Identifier &name) QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); - if (lastScopeObject) { - - return ep->objectClass->property(lastScopeObject, name); - - } else if (lastData) { + if (lastData) { if (lastData->type) { - return Value(scriptEngine, ep->typeNameClass->newObject(bindContext->contextObject, lastData->type)); + return Value(scriptEngine, ep->typeNameClass->newObject(lastScopeObject, lastData->type)); } else if (lastData->typeNamespace) { - return Value(scriptEngine, ep->typeNameClass->newObject(bindContext->contextObject, - lastData->typeNamespace)); + return Value(scriptEngine, ep->typeNameClass->newObject(lastScopeObject, lastData->typeNamespace)); } else { int index = lastData->importedScriptIndex; if (index < bindContext->importedScripts.count()) { @@ -288,6 +284,10 @@ QDeclarativeContextScriptClass::property(Object *object, const Identifier &name) } } + } else if (lastScopeObject) { + + return ep->objectClass->property(lastScopeObject, name); + } else if (lastPropertyIndex != -1) { QScriptValue rv; diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/attachedProperty.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/attachedProperty.2.qml new file mode 100644 index 0000000..a7184c9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/attachedProperty.2.qml @@ -0,0 +1,22 @@ +import Qt.test 1.0 +import Qt.test 1.0 as Namespace + +MyQmlObject { + property alias a: me.a + property alias b: me.a + property alias c: me.a + property alias d: me.a + + property MyQmlObject obj + obj: MyQmlObject { + MyQmlObject.value2: 13 + + id: me + property int a: MyQmlObject.value2 * 2 + property int b: Namespace.MyQmlObject.value2 * 2 + property int c: me.Namespace.MyQmlObject.value * 2 + property int d: me.Namespace.MyQmlObject.value * 2 + } +} + + diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 94cec3f..ad38d27 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -60,17 +60,18 @@ class MyQmlAttachedObject : public QObject { Q_OBJECT Q_PROPERTY(int value READ value CONSTANT) - Q_PROPERTY(int value2 READ value2 WRITE setValue2) + Q_PROPERTY(int value2 READ value2 WRITE setValue2 NOTIFY value2Changed) public: MyQmlAttachedObject(QObject *parent) : QObject(parent), m_value2(0) {} int value() const { return 19; } int value2() const { return m_value2; } - void setValue2(int v) { m_value2 = v; } + void setValue2(int v) { if (m_value2 == v) return; m_value2 = v; emit value2Changed(); } void emitMySignal() { emit mySignal(); } signals: + void value2Changed(); void mySignal(); private: diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 7876671..1ec12fe 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -650,6 +650,16 @@ void tst_qdeclarativeecmascript::attachedProperties() } { + QDeclarativeComponent component(&engine, TEST_FILE("attachedProperty.2.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("a").toInt(), 26); + QCOMPARE(object->property("b").toInt(), 26); + QCOMPARE(object->property("c").toInt(), 26); + QCOMPARE(object->property("d").toInt(), 26); + } + + { QDeclarativeComponent component(&engine, TEST_FILE("writeAttachedProperty.qml")); QObject *object = component.create(); QVERIFY(object != 0); -- cgit v0.12 From 7bc3dfc5214c6a31259d366be8e20c48195b0a50 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 15 Apr 2011 16:29:11 +1000 Subject: Fixed autotest after b4b85257ccff6ba21bcbcbd46a9f7f09884abe79 Change-Id: I7371d5c2f76254e6746d5a86874a045fc6aec32d --- tests/auto/declarative/qdeclarativeanimations/data/attached.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativeanimations/data/attached.qml b/tests/auto/declarative/qdeclarativeanimations/data/attached.qml index 5da4a69..c5d5535 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/attached.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/attached.qml @@ -17,7 +17,7 @@ Rectangle { transitions: Transition { PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true } - ScriptAction { script: console.log(ListView.delayRemove ? "on" : "off") } + ScriptAction { script: console.log(wrapper.ListView.delayRemove ? "on" : "off") } } Component.onCompleted: { -- cgit v0.12 From 81044282befaa5af7247804c7875df83c89c6459 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 15 Apr 2011 08:33:28 +0200 Subject: QmlDebug: Fix license headers in new ost plugin Reviewed-by: Trust-me --- src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp | 26 +++++++++++----------- src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h | 26 +++++++++++----------- src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp | 26 +++++++++++----------- src/plugins/qmltooling/qmldbg_ost/qostdevice.h | 26 +++++++++++----------- src/plugins/qmltooling/qmldbg_ost/usbostcomm.h | 26 +++++++++++----------- 5 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp index e0d7664..1c91c34 100644 --- a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp +++ b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp @@ -7,11 +7,11 @@ ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 @@ -25,16 +25,16 @@ ** 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. -** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h index 1e18444..eee6ee1 100644 --- a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h +++ b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h @@ -7,11 +7,11 @@ ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 @@ -25,16 +25,16 @@ ** 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. -** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp b/src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp index 3c5515f..21b0169 100644 --- a/src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp +++ b/src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp @@ -7,11 +7,11 @@ ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 @@ -25,16 +25,16 @@ ** 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. -** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/qmltooling/qmldbg_ost/qostdevice.h b/src/plugins/qmltooling/qmldbg_ost/qostdevice.h index 26bdc15..ba1f443 100644 --- a/src/plugins/qmltooling/qmldbg_ost/qostdevice.h +++ b/src/plugins/qmltooling/qmldbg_ost/qostdevice.h @@ -7,11 +7,11 @@ ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 @@ -25,16 +25,16 @@ ** 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. -** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/qmltooling/qmldbg_ost/usbostcomm.h b/src/plugins/qmltooling/qmldbg_ost/usbostcomm.h index 5f29e71..48ff7bf 100644 --- a/src/plugins/qmltooling/qmldbg_ost/usbostcomm.h +++ b/src/plugins/qmltooling/qmldbg_ost/usbostcomm.h @@ -7,11 +7,11 @@ ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 @@ -25,16 +25,16 @@ ** 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. -** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ -- cgit v0.12 From 9672bec709bb8ee3d35dcd889b218708e4804c55 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 15 Apr 2011 09:05:31 +0200 Subject: Make EGL surface transparency working on Symbian. When the hardware is capable enough, setting WA_TranslucentBackground will not lead to falling back to raster, but will continue using OpenVG or OpenGL based rendering. However this needs an alpha channel which was not requested previously. This patch corrects it. Task-number: QT-4729 Reviewed-by: Jani Hautakangas --- src/gui/egl/qegl_symbian.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gui/egl/qegl_symbian.cpp b/src/gui/egl/qegl_symbian.cpp index 6533d11..fabf9d1 100644 --- a/src/gui/egl/qegl_symbian.cpp +++ b/src/gui/egl/qegl_symbian.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include "qegl_p.h" #include "qeglcontext_p.h" @@ -73,10 +74,14 @@ void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev) return; int devType = dev->devType(); - if (devType == QInternal::Image) + if (devType == QInternal::Image) { setPixelFormat(static_cast(dev)->format()); - else - setPixelFormat(QImage::Format_RGB32); + } else { + QImage::Format format = QImage::Format_RGB32; + if (QApplicationPrivate::instance() && QApplicationPrivate::instance()->useTranslucentEGLSurfaces) + format = QImage::Format_ARGB32_Premultiplied; + setPixelFormat(format); + } } -- cgit v0.12 From dc65a73fa38d1f85b75e9d4ad71ebdbc1c7d85f5 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 15 Apr 2011 14:51:34 +0200 Subject: Build fix for transition effect support on S60 5.0. Task-number: QT-4718 Reviewed-by: TRUSTME --- src/gui/kernel/kernel.pri | 2 ++ src/gui/kernel/qt_s60_p.h | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index f9c84c1..467eb9b 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -111,6 +111,8 @@ win32 { } symbian { + exists($${EPOCROOT}epoc32/include/platform/mw/akntranseffect.h): DEFINES += QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H + SOURCES += \ kernel/qapplication_s60.cpp \ kernel/qeventdispatcher_s60.cpp \ diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index da44016..8aba53a 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -78,8 +78,10 @@ #include // CEikStatusPane #include // MAknFadedComponent and TAknPopupFader #include // BeginFullScreen +#ifdef QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H #include // BeginFullScreen #endif +#endif QT_BEGIN_NAMESPACE @@ -577,7 +579,7 @@ bool qt_symbian_is_cursor_visible(); static inline bool qt_beginFullScreenEffect() { -#ifdef Q_WS_S60 +#if defined(Q_WS_S60) && defined(QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H) // Only for post-S^3. On earlier versions the system transition effects // may not be able to capture the non-Avkon content, leading to confusing // looking effects, so just skip the whole thing. @@ -593,12 +595,14 @@ static inline bool qt_beginFullScreenEffect() AknTransEffect::GfxTransParam(S60->uid, AknTransEffect::TParameter::EAvkonCheck | KQtAppExitFlag)); return true; +#else + return false; #endif } static inline void qt_abortFullScreenEffect() { -#ifdef Q_WS_S60 +#if defined(Q_WS_S60) && defined(QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H) if (!S60->beginFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2) return; GfxTransEffect::AbortFullScreen(); @@ -608,7 +612,7 @@ static inline void qt_abortFullScreenEffect() static inline void qt_endFullScreenEffect() { -#ifdef Q_WS_S60 +#if defined(Q_WS_S60) && defined(QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H) if (S60->endFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2) return; S60->endFullScreenCalled = true; -- cgit v0.12 From cec6c3ad52f6b4cdf04b70340ff7d15ebd8c7d26 Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Fri, 15 Apr 2011 16:48:27 +0200 Subject: QDesktopServices::openUrl() doesn't handle URL encodings correctly I think this is a problem with the USE_SCHEMEHANDLER version of handleUrl() in qt/src/gui/util/qdesktopservices_s60.cpp. It calls url.toString() which removes percent encoding. I think url.toEncoded() should be used instead. Task-number: QTBUG-18772 Reviewed-by: joao --- src/gui/util/qdesktopservices_s60.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index 96860df..8caeb74 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -314,7 +314,7 @@ static bool handleUrl(const QUrl &url) if (!url.isValid()) return false; - QString urlString(url.toString()); + QString urlString(url.toEncoded()); TPtrC urlPtr(qt_QString2TPtrC(urlString)); TRAPD( err, handleUrlL(urlPtr)); return err ? false : true; -- cgit v0.12 From fb0d4ad8f585befb58f77f8d4eaf58944448b8a7 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 18 Apr 2011 10:54:53 +0300 Subject: Add new QSysInfo::symbianVersion() enums Add new enums for future Symbian platforms and fix the docs of existing ones. Task-number: QT-4593 Reviewed-by: Sami Merila --- mkspecs/common/symbian/symbian.conf | 49 ++++++++++++++++++++----------------- src/corelib/global/qglobal.cpp | 25 +++++++++++++------ src/corelib/global/qglobal.h | 9 ++++--- 3 files changed, 50 insertions(+), 33 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 8e04099..0288ada 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -164,34 +164,39 @@ exists($${EPOCROOT}epoc32/tools/qt/mkspecs/features/environment.prf) { # Try to detect SDK version if it wasn't set by environment.prf isEmpty(SYMBIAN_VERSION)|isEmpty(S60_VERSION) { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.3.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.3.sis) { - isEmpty(SYMBIAN_VERSION): SYMBIAN_VERSION = Symbian3 - isEmpty(S60_VERSION): S60_VERSION = 5.3 + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.4.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.4.sis) { + isEmpty(SYMBIAN_VERSION): SYMBIAN_VERSION = 5.4 + isEmpty(S60_VERSION): S60_VERSION = 5.4 } else { - # The Symbian^3 PDK does not necessarily contain the required sis files. - # However, libstdcppv5 first appeared in Symbian^3 (S60 5.2), so check for that too. - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/release/armv5/lib/libstdcppv5.dso) { - isEmpty(SYMBIAN_VERSION): SYMBIAN_VERSION = Symbian3 - isEmpty(S60_VERSION): S60_VERSION = 5.2 + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.3.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.3.sis) { + isEmpty(SYMBIAN_VERSION): SYMBIAN_VERSION = 5.3 + isEmpty(S60_VERSION): S60_VERSION = 5.3 } else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.1.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.1.sis) { - isEmpty(SYMBIAN_VERSION): SYMBIAN_VERSION = Symbian2 - isEmpty(S60_VERSION): S60_VERSION = 5.1 + # The Symbian^3 PDK does not necessarily contain the required sis files. + # However, libstdcppv5 first appeared in Symbian^3 (S60 5.2), so check for that too. + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/release/armv5/lib/libstdcppv5.dso) { + isEmpty(SYMBIAN_VERSION): SYMBIAN_VERSION = Symbian3 + isEmpty(S60_VERSION): S60_VERSION = 5.2 } else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.0.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.0.sis) { - isEmpty(SYMBIAN_VERSION): SYMBIAN_VERSION = 9.4 - isEmpty(S60_VERSION): S60_VERSION = 5.0 + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.1.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.1.sis) { + isEmpty(SYMBIAN_VERSION): SYMBIAN_VERSION = Symbian2 + isEmpty(S60_VERSION): S60_VERSION = 5.1 } else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v3.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v3.2.sis) { - isEmpty(SYMBIAN_VERSION): SYMBIAN_VERSION = 9.3 - isEmpty(S60_VERSION): S60_VERSION = 3.2 + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.0.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.0.sis) { + isEmpty(SYMBIAN_VERSION): SYMBIAN_VERSION = 9.4 + isEmpty(S60_VERSION): S60_VERSION = 5.0 } else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v3.1.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v3.1.sis) { - isEmpty(SYMBIAN_VERSION): SYMBIAN_VERSION = 9.2 - isEmpty(S60_VERSION): S60_VERSION = 3.1 + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v3.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v3.2.sis) { + isEmpty(SYMBIAN_VERSION): SYMBIAN_VERSION = 9.3 + isEmpty(S60_VERSION): S60_VERSION = 3.2 } else { - isEmpty(SYMBIAN_VERSION): SYMBIAN_VERSION = Unknown - isEmpty(S60_VERSION): S60_VERSION = Unknown + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v3.1.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v3.1.sis) { + isEmpty(SYMBIAN_VERSION): SYMBIAN_VERSION = 9.2 + isEmpty(S60_VERSION): S60_VERSION = 3.1 + } else { + isEmpty(SYMBIAN_VERSION): SYMBIAN_VERSION = Unknown + isEmpty(S60_VERSION): S60_VERSION = Unknown + } } } } diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 35719b1..2cfd9cc 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1197,10 +1197,12 @@ bool qSharedBuild() \value SV_9_2 Symbian OS v9.2 \value SV_9_3 Symbian OS v9.3 \value SV_9_4 Symbian OS v9.4 - \value SV_SF_1 Symbian^1 + \value SV_SF_1 S60 5th Edition (Symbian^1) \value SV_SF_2 Symbian^2 - \value SV_SF_3 Symbian^3 + \value SV_SF_3 Symbian^3 or Symbian Anna \value SV_SF_4 \e{This enum value is deprecated.} + \value SV_API_5_3 Symbian/S60 API version 5.3 release + \value SV_API_5_4 Symbian/S60 API version 5.4 release \value SV_Unknown An unknown and currently unsupported platform \sa S60Version, WinVersion, MacVersion @@ -1217,9 +1219,10 @@ bool qSharedBuild() \value SV_S60_3_1 S60 3rd Edition Feature Pack 1 \value SV_S60_3_2 S60 3rd Edition Feature Pack 2 \value SV_S60_5_0 S60 5th Edition - \value SV_S60_5_1 S60 5th Edition Feature Pack 1 - \value SV_S60_5_2 Symbian^3 - \value SV_S60_5_3 To be determined - FIXME + \value SV_S60_5_1 \e{This enum value is deprecated.} + \value SV_S60_5_2 Symbian^3 and Symbian Anna + \value SV_S60_5_3 Symbian/S60 API version 5.3 release + \value SV_S60_5_4 Symbian/S60 API version 5.4 release \value SV_S60_Unknown An unknown and currently unsupported platform \omitvalue SV_S60_None @@ -1852,9 +1855,12 @@ static void symbianInitVersions() } else if (minor == 2) { cachedS60Version = QSysInfo::SV_S60_5_2; cachedSymbianVersion = QSysInfo::SV_SF_3; - } else if (minor >= 3) { + } else if (minor == 3) { cachedS60Version = QSysInfo::SV_S60_5_3; - cachedSymbianVersion = QSysInfo::SV_SF_3; + cachedSymbianVersion = QSysInfo::SV_API_5_3; + } else if (minor >= 4) { + cachedS60Version = QSysInfo::SV_S60_5_4; + cachedSymbianVersion = QSysInfo::SV_API_5_4; } } } @@ -1880,7 +1886,10 @@ static void symbianInitVersions() cachedSymbianVersion = QSysInfo::SV_SF_3; # elif defined(S60_VERSION_5_3) cachedS60Version = QSysInfo::SV_S60_5_3; - cachedSymbianVersion = QSysInfo::SV_SF_3; + cachedSymbianVersion = QSysInfo::SV_API_5_3; +# elif defined(S60_VERSION_5_4) + cachedS60Version = QSysInfo::SV_S60_5_4; + cachedSymbianVersion = QSysInfo::SV_API_5_4; # endif } # endif diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 7768b46..e5109e6 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1524,7 +1524,9 @@ public: SV_SF_1 = SV_9_4, SV_SF_2 = 40, SV_SF_3 = 50, - SV_SF_4 = 60 // Deprecated + SV_SF_4 = 60, // Deprecated + SV_API_5_3 = 70, + SV_API_5_4 = 80 }; static SymbianVersion symbianVersion(); enum S60Version { @@ -1533,9 +1535,10 @@ public: SV_S60_3_1 = SV_9_2, SV_S60_3_2 = SV_9_3, SV_S60_5_0 = SV_9_4, - SV_S60_5_1 = SV_SF_2, + SV_S60_5_1 = SV_SF_2, // Deprecated SV_S60_5_2 = SV_SF_3, - SV_S60_5_3 = 70 + SV_S60_5_3 = SV_API_5_3, + SV_S60_5_4 = SV_API_5_4 }; static S60Version s60Version(); #endif -- cgit v0.12