From f5398e1adc5203b3aa56d50ee3a9bd936531a119 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 27 Oct 2009 10:51:30 +0200 Subject: Switched setWindowIcon_sys to use QPixmpa::toSymbianCFbsBitmap in S60. There were TODOs in code to remove the temporary solution for creating native CFbsBitmap out of QPixmap. Now when QPixmpa has native backed and it provides toSymbianCFbsBitmap, it it preferred to use toSymbianCFbsBitmap since in best case it can only duplicate the bitmap handle instead of copying the data. Task-number: QTBUG-4948 Reviewed-by: Jani Hautakangas --- src/gui/kernel/qwidget_s60.cpp | 72 +++--------------------------------------- 1 file changed, 4 insertions(+), 68 deletions(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index cb615fe..a6d8ed7 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -716,62 +716,6 @@ void QWidgetPrivate::s60UpdateIsOpaque() window->SetTransparentRegion(TRegionFix<1>()); } -CFbsBitmap* qt_pixmapToNativeBitmap(QPixmap pixmap, bool invert) -{ - CFbsBitmap* fbsBitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new - TSize size(pixmap.size().width(), pixmap.size().height()); - TDisplayMode mode(EColor16MU); - - bool isNull = pixmap.isNull(); - int depth = pixmap.depth(); - - // TODO: dummy assumptions from bit amounts for each color - // Will fix later on when native pixmap is implemented - switch(pixmap.depth()) { - case 1: - mode = EGray2; - break; - case 4: - mode = EColor16; - break; - case 8: - mode = EColor256; - break; - case 12: - mode = EColor4K; - break; - case 16: - mode = EColor64K; - break; - case 24: - mode = EColor16M; - break; - case 32: - case EColor16MU: - break; - default: - qFatal("Unsupported pixmap depth"); - break; - } - - qt_symbian_throwIfError(fbsBitmap->Create(size, mode)); - fbsBitmap->LockHeap(); - QImage image = pixmap.toImage(); - - if (invert) - image.invertPixels(); - - int height = pixmap.size().height(); - for(int i=0;iSetScanLine( scanline, i ); - } - - fbsBitmap->UnlockHeap(); - return fbsBitmap; -} - void QWidgetPrivate::setWindowIcon_sys(bool forceReset) { #ifdef Q_WS_S60 @@ -800,12 +744,8 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) mask.fill(Qt::color1); } - // Convert to CFbsBitmp - // TODO: When QPixmap is adapted to use native CFbsBitmap, - // it could be set directly to context pane - CFbsBitmap* nBitmap = qt_pixmapToNativeBitmap(pm, false); - CFbsBitmap* nMask = qt_pixmapToNativeBitmap(mask, true); - + CFbsBitmap* nBitmap = pm.toSymbianCFbsBitmap(); + CFbsBitmap* nMask = mask.toSymbianCFbsBitmap(); contextPane->SetPicture(nBitmap,nMask); } else { // Icon set to null -> set context pane picture to default @@ -836,12 +776,8 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) mask.fill(Qt::color1); } - // Convert to CFbsBitmp - // TODO: When QPixmap is adapted to use native CFbsBitmap, - // it could be set directly to context pane - CFbsBitmap* nBitmap = qt_pixmapToNativeBitmap(pm, false); - CFbsBitmap* nMask = qt_pixmapToNativeBitmap(mask, true); - + CFbsBitmap* nBitmap = pm.toSymbianCFbsBitmap(); + CFbsBitmap* nMask = mask.toSymbianCFbsBitmap(); titlePane->SetSmallPicture( nBitmap, nMask, ETrue ); } else { // Icon set to null -> set context pane picture to default -- cgit v0.12 From a36ee30a9753c766be1017550df581ab941b87e3 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 27 Oct 2009 11:30:25 +0200 Subject: Temporary fix for FEP crash with input masked QLineEdits QLineEdits with input masks report the cursor position relative to displayed text via inputMethodQuery(), but the text returned is the actual text of the control, which can differ from displayed text, causing mismatch between FEP display and control display. To properly fix this we would need to know the displayText of QLineEdits instead of just the text, which on itself should be a trivial change. The difficulties start when we need to commit the changes back to the QLineEdit, which would have to be somehow able to handle displayText, too. Task made to fix this properly: QTBUG-5050 Task-number: QTBUG-4892 Reviewed-by: axis --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index c4d17ff..3f21bc3 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -561,8 +561,28 @@ void QCoeFepInputContext::GetCursorSelectionForFep(TCursorSelection& aCursorSele int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt() + m_preeditString.size(); int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt() + m_preeditString.size(); - aCursorSelection.iAnchorPos = anchor; - aCursorSelection.iCursorPos = cursor; + QString text = w->inputMethodQuery(Qt::ImSurroundingText).value(); + int combinedSize = text.size() + m_preeditString.size(); + if (combinedSize < anchor || combinedSize < cursor) { + // ### TODO! FIXME! QTBUG-5050 + // This is a hack to prevent crashing in 4.6 with QLineEdits that use input masks. + // The root problem is that cursor position is relative to displayed text instead of the + // actual text we get. + // + // To properly fix this we would need to know the displayText of QLineEdits instead + // of just the text, which on itself should be a trivial change. The difficulties start + // when we need to commit the changes back to the QLineEdit, which would have to be somehow + // able to handle displayText, too. + // + // Until properly fixed, the cursor and anchor positions will not reflect correct positions + // for masked QLineEdits, unless all the masked positions are filled in order so that + // cursor position relative to the displayed text matches position relative to actual text. + aCursorSelection.iAnchorPos = combinedSize; + aCursorSelection.iCursorPos = combinedSize; + } else { + aCursorSelection.iAnchorPos = anchor; + aCursorSelection.iCursorPos = cursor; + } } void QCoeFepInputContext::GetEditorContentForFep(TDes& aEditorContent, TInt aDocumentPosition, -- cgit v0.12 From 890fbc5c6a271d345ec5a47501c4ae716a96fe44 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Tue, 27 Oct 2009 10:58:28 +0100 Subject: Compile on Symbian winscw. Patch by Martin Jones. Malformed in codepaster so was manually applied. Builds with public 5th SDK. The compiler workaround was documented. Reviewed-by: Frans Englich --- src/xmlpatterns/schema/qxsdstatemachine.cpp | 64 -------------------------- src/xmlpatterns/schema/qxsdstatemachine_p.h | 69 +++++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 67 deletions(-) diff --git a/src/xmlpatterns/schema/qxsdstatemachine.cpp b/src/xmlpatterns/schema/qxsdstatemachine.cpp index 85bc752..8a43411 100644 --- a/src/xmlpatterns/schema/qxsdstatemachine.cpp +++ b/src/xmlpatterns/schema/qxsdstatemachine.cpp @@ -335,64 +335,6 @@ typename XsdStateMachine::StateId XsdStateMachine -QSet::StateId> XsdStateMachine::epsilonClosure(const QSet &input) const -{ - // every state can reach itself by epsilon transition, so include the input states - // in the result as well - QSet result = input; - - // add the input states to the list of to be processed states - QList workStates = input.toList(); - while (!workStates.isEmpty()) { // while there are states to be processed left... - - // dequeue one state from list - const StateId state = workStates.takeFirst(); - - // get the list of states that can be reached by the epsilon transition - // from the current 'state' - const QVector targetStates = m_epsilonTransitions.value(state); - for (int i = 0; i < targetStates.count(); ++i) { - // if we have this target state not in our result set yet... - if (!result.contains(targetStates.at(i))) { - // ... add it to the result set - result.insert(targetStates.at(i)); - - // add the target state to the list of to be processed states as well, - // as we want to have the epsilon transitions not only for the first - // level of following states - workStates.append(targetStates.at(i)); - } - } - } - - return result; -} - -template -QSet::StateId> XsdStateMachine::move(const QSet &states, TransitionType input) const -{ - QSet result; - - QSetIterator it(states); - while (it.hasNext()) { // iterate over all given states - const StateId state = it.next(); - - // get the transition table for the current state - const QHash > transitions = m_transitions.value(state); - - // get the target states for the given input - const QVector targetStates = transitions.value(input); - - // add all target states to the result - for (int i = 0; i < targetStates.size(); ++i) - result.insert(targetStates.at(i)); - } - - return result; -} - template XsdStateMachine XsdStateMachine::toDFA() const { @@ -469,9 +411,3 @@ QHash::StateId, typename XsdStateMachin { return m_states; } - -template -QHash::StateId, QHash::StateId> > > XsdStateMachine::transitions() const -{ - return m_transitions; -} diff --git a/src/xmlpatterns/schema/qxsdstatemachine_p.h b/src/xmlpatterns/schema/qxsdstatemachine_p.h index e671499..294eb50 100644 --- a/src/xmlpatterns/schema/qxsdstatemachine_p.h +++ b/src/xmlpatterns/schema/qxsdstatemachine_p.h @@ -204,8 +204,14 @@ namespace QPatternist /** * Returns the information of all transitions of the state machine. + * + * The implementation is inlined in order to workaround a compiler + * bug on Symbian/winscw. */ - QHash > > transitions() const; + QHash > > transitions() const + { + return m_transitions; + } private: /** @@ -217,14 +223,71 @@ namespace QPatternist /** * Returns the set of all states that can be reached from the set of @p input states * by the epsilon transition. + * + * The implementation is inlined in order to workaround a compiler + * bug on Symbian/winscw. */ - QSet epsilonClosure(const QSet &input) const; + QSet epsilonClosure(const QSet &input) const + { + // every state can reach itself by epsilon transition, so include the input states + // in the result as well + QSet result = input; + + // add the input states to the list of to be processed states + QList workStates = input.toList(); + while (!workStates.isEmpty()) { // while there are states to be processed left... + + // dequeue one state from list + const StateId state = workStates.takeFirst(); + + // get the list of states that can be reached by the epsilon transition + // from the current 'state' + const QVector targetStates = m_epsilonTransitions.value(state); + for (int i = 0; i < targetStates.count(); ++i) { + // if we have this target state not in our result set yet... + if (!result.contains(targetStates.at(i))) { + // ... add it to the result set + result.insert(targetStates.at(i)); + + // add the target state to the list of to be processed states as well, + // as we want to have the epsilon transitions not only for the first + // level of following states + workStates.append(targetStates.at(i)); + } + } + } + + return result; + } /** * Returns the set of all states that can be reached from the set of given @p states * by the given @p input. + * + * The implementation is inlined in order to workaround a compiler + * bug on Symbian/winscw. */ - QSet move(const QSet &states, TransitionType input) const; + QSet move(const QSet &states, TransitionType input) const + { + QSet result; + + QSetIterator it(states); + while (it.hasNext()) { // iterate over all given states + const StateId state = it.next(); + + // get the transition table for the current state + const QHash > transitions = m_transitions.value(state); + + // get the target states for the given input + const QVector targetStates = transitions.value(input); + + // add all target states to the result + for (int i = 0; i < targetStates.size(); ++i) + result.insert(targetStates.at(i)); + } + + return result; + } NamePool::Ptr m_namePool; QHash m_states; -- cgit v0.12 From b9a48dd97e14b36a17590c4008ab5e94c1a734b8 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Tue, 27 Oct 2009 11:32:27 +0100 Subject: Enable webkit and xmlpatterns by default on Symbian. Suggested by Lars, OK'd by Jason, Kristian and Shane. --- configure.exe | Bin 2170880 -> 1169408 bytes tools/configure/configureapp.cpp | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.exe b/configure.exe index dabf10c..f433888 100755 Binary files a/configure.exe and b/configure.exe differ diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index f57f3a8..adf7a1a 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1448,10 +1448,10 @@ void Configure::applySpecSpecifics() dictionary[ "IWMMXT" ] = "no"; dictionary[ "CE_CRT" ] = "no"; dictionary[ "DIRECT3D" ] = "no"; - dictionary[ "WEBKIT" ] = "no"; + dictionary[ "WEBKIT" ] = "yes"; dictionary[ "ASSISTANT_WEBKIT" ] = "no"; dictionary[ "PHONON" ] = "yes"; - dictionary[ "XMLPATTERNS" ] = "no"; + dictionary[ "XMLPATTERNS" ] = "yes"; dictionary[ "QT_GLIB" ] = "no"; dictionary[ "S60" ] = "yes"; // iconv makes makes apps start and run ridiculously slowly in symbian emulator (HW not tested) -- cgit v0.12 From c17e8c19212d68a6bc2e9492b5ffacdf8c251090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Tue, 27 Oct 2009 12:51:33 +0200 Subject: Use PM_SplitterWidth in QS60Style Updated pixel metrics values from latest S60 layouts. Also, updated pixel metrics harvester to collect pixel metric for QSplitter. Task-number: QT-686 Reviewed-by: Shane Kearns --- src/gui/styles/qs60style.cpp | 39 +++++++++++++++++----------------- util/s60pixelmetrics/pixel_metrics.cpp | 6 +++--- util/s60pixelmetrics/pm_mapper.mmp | 2 +- util/s60pixelmetrics/pm_mapperapp.cpp | 2 +- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 8d59d14..8ef0dd3 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -91,14 +91,14 @@ static const qreal goldenRatio = 1.618; const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** -{240,320,1,14,true,"QVGA Landscape Mirrored"}, -{240,320,1,14,false,"QVGA Landscape"}, -{320,240,1,14,true,"QVGA Portrait Mirrored"}, -{320,240,1,14,false,"QVGA Portrait"}, -{360,640,1,14,true,"NHD Landscape Mirrored"}, -{360,640,1,14,false,"NHD Landscape"}, -{640,360,1,14,true,"NHD Portrait Mirrored"}, -{640,360,1,14,false,"NHD Portrait"}, +{240,320,1,15,true,"QVGA Landscape Mirrored"}, +{240,320,1,15,false,"QVGA Landscape"}, +{320,240,1,15,true,"QVGA Portrait Mirrored"}, +{320,240,1,15,false,"QVGA Portrait"}, +{360,640,1,15,true,"NHD Landscape Mirrored"}, +{360,640,1,15,false,"NHD Landscape"}, +{640,360,1,15,true,"NHD Portrait Mirrored"}, +{640,360,1,15,false,"NHD Portrait"}, {352,800,1,12,true,"E90 Landscape Mirrored"}, {352,800,1,12,false,"E90 Landscape"} // *** End of generated data *** @@ -108,16 +108,16 @@ const int QS60StylePrivate::m_numberOfLayouts = const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** -{5,0,-909,0,0,1,0,0,-1,8,15,22,15,15,7,198,-909,-909,-909,19,15,2,0,0,21,-909,21,-909,4,4,1,-909,-909,0,2,0,0,13,23,17,17,21,21,2,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,51,27,51,4,4,5,10,15,-909,5,58,12,5,0,7,4,4,9,4,4,-909,1,-909,-909,-909,-909,4,4,3,1}, -{5,0,-909,0,0,1,0,0,-1,8,15,22,15,15,7,198,-909,-909,-909,19,15,2,0,0,21,-909,21,-909,4,4,1,-909,-909,0,2,0,0,13,23,17,17,21,21,2,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,51,27,51,4,4,5,10,15,-909,5,58,12,5,0,4,4,7,9,4,4,-909,1,-909,-909,-909,-909,4,4,3,1}, -{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,-909,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,7,4,4,9,4,4,-909,1,-909,-909,-909,-909,4,4,3,1}, -{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,-909,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,1,-909,-909,-909,-909,4,4,3,1}, -{7,0,-909,0,0,2,0,0,-1,20,53,28,19,19,9,258,-909,-909,-909,29,19,26,0,0,32,-909,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,8,5,5,12,5,5,-909,2,-909,-909,-909,-909,7,7,3,1}, -{7,0,-909,0,0,2,0,0,-1,20,53,28,19,19,9,258,-909,-909,-909,29,19,26,0,0,32,-909,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,2,-909,-909,-909,-909,7,7,3,1}, -{7,0,-909,0,0,2,0,0,-1,20,52,28,19,19,9,258,-909,-909,-909,29,19,6,0,0,32,-909,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,98,35,98,5,5,6,8,19,-909,7,74,22,7,0,8,5,5,12,5,5,-909,2,-909,-909,-909,-909,7,7,3,1}, -{7,0,-909,0,0,2,0,0,-1,20,52,28,19,19,9,258,-909,-909,-909,29,19,6,0,0,32,-909,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,98,35,98,5,5,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,2,-909,-909,-909,-909,7,7,3,1}, -{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,-909,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,5,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,8,6,5,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1}, -{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,-909,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1} +{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,3,3,4,9,13,-909,5,51,11,5,0,6,3,3,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1}, +{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,3,3,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1}, +{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,7,4,4,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1}, +{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1}, +{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,8,5,5,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, +{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, +{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,5,5,6,8,19,-909,7,74,22,7,0,8,5,5,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, +{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,5,5,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, +{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,5,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,8,6,5,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1}, +{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1} // *** End of generated data *** }; @@ -526,6 +526,7 @@ void QS60StylePrivate::drawPart(QS60StyleEnums::SkinParts skinPart, #else true; #endif + const QPixmap skinPartPixMap((doCache ? cachedPart : part)(skinPart, rect.size(), flags)); if (!skinPartPixMap.isNull()) painter->drawPixmap(rect.topLeft(), skinPartPixMap); @@ -2190,7 +2191,7 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const if (metricValue == KNotFound) metricValue = QCommonStyle::pixelMetric(metric, option, widget); - if (metric == PM_SubMenuOverlap && widget){ + if (metric == PM_SubMenuOverlap && widget) { const QMenu *menu = qobject_cast(widget); if (menu && menu->activeAction() && menu->activeAction()->menu()) { const int menuWidth = menu->activeAction()->menu()->sizeHint().width(); diff --git a/util/s60pixelmetrics/pixel_metrics.cpp b/util/s60pixelmetrics/pixel_metrics.cpp index 939a718..9507c67 100644 --- a/util/s60pixelmetrics/pixel_metrics.cpp +++ b/util/s60pixelmetrics/pixel_metrics.cpp @@ -50,7 +50,7 @@ // so that we can keep dynamic and static values inline. // Please adjust version data if correcting dynamic PM calculations. const TInt KPMMajorVersion = 1; -const TInt KPMMinorVersion = 14; +const TInt KPMMinorVersion = 15; TPixelMetricsVersion PixelMetrics::Version() { @@ -726,6 +726,7 @@ TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric) value = -1; //disable - not in S60 } break; + case QStyle::PM_SplitterWidth: case QStyle::PM_ScrollBarExtent: { TAknLayoutRect miscGraphicsRect; @@ -1000,7 +1001,7 @@ TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric) case QStyle::PM_ButtonShiftVertical: value = 0; break; - + case QStyle::PM_ToolBarExtensionExtent: value = PixelMetricTabValue(QStyle::PM_TabBarScrollButtonWidth, appWindow.Rect(), landscape); break; @@ -1016,7 +1017,6 @@ TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric) case QStyle::PM_DockWidgetSeparatorExtent: // not in S60 case QStyle::PM_MdiSubWindowMinimizedWidth: //no such thing in S60 case QStyle::PM_HeaderGripMargin: // not in S60 - case QStyle::PM_SplitterWidth: // not in S60 case QStyle::PM_ToolBarSeparatorExtent: // not in S60 case QStyle::PM_ToolBarHandleExtent: // not in s60 case QStyle::PM_MenuButtonIndicator: // none??? diff --git a/util/s60pixelmetrics/pm_mapper.mmp b/util/s60pixelmetrics/pm_mapper.mmp index 7777a3d..a2e2571 100644 --- a/util/s60pixelmetrics/pm_mapper.mmp +++ b/util/s60pixelmetrics/pm_mapper.mmp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include +#include TARGET pm_mapper.exe TARGETTYPE exe diff --git a/util/s60pixelmetrics/pm_mapperapp.cpp b/util/s60pixelmetrics/pm_mapperapp.cpp index e24ed29..de6af0d 100644 --- a/util/s60pixelmetrics/pm_mapperapp.cpp +++ b/util/s60pixelmetrics/pm_mapperapp.cpp @@ -138,7 +138,7 @@ void CPixelMetricsMapperAppUi::ConstructL() // TKeyResponse CPixelMetricsMapperAppUi::HandleKeyEventL( const TKeyEvent& /*aKeyEvent*/, - TEventCode aType ) + TEventCode /*aType*/ ) { return EKeyWasNotConsumed; } -- cgit v0.12 From 40d7920da5762addbbef36ebc049c32409b575cf Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 27 Oct 2009 14:21:53 +0200 Subject: Cleanup softkeymanager keyedactions hash when QAction is being deleted. Reviewed-by: TrustMe --- src/gui/kernel/qsoftkeymanager.cpp | 9 ++++++++- src/gui/kernel/qsoftkeymanager_p.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 75c321e..a5e8eff 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -139,11 +139,18 @@ QAction *QSoftKeyManager::createKeyedAction(StandardSoftKey standardKey, Qt::Key QScopedPointer action(createAction(standardKey, actionWidget)); connect(action.data(), SIGNAL(triggered()), QSoftKeyManager::instance(), SLOT(sendKeyEvent())); - + connect(action.data(), SIGNAL(destroyed(QObject*)), QSoftKeyManager::instance(), SLOT(cleanupHash(QObject*))); QSoftKeyManager::instance()->d_func()->keyedActions.insert(action.data(), key); return action.take(); } +void QSoftKeyManager::cleanupHash(QObject* obj) +{ + Q_D(QSoftKeyManager); + QAction *action = qobject_cast(obj); + d->keyedActions.remove(action); +} + void QSoftKeyManager::sendKeyEvent() { Q_D(QSoftKeyManager); diff --git a/src/gui/kernel/qsoftkeymanager_p.h b/src/gui/kernel/qsoftkeymanager_p.h index b455445..81218cf 100644 --- a/src/gui/kernel/qsoftkeymanager_p.h +++ b/src/gui/kernel/qsoftkeymanager_p.h @@ -96,6 +96,7 @@ protected: Q_DISABLE_COPY(QSoftKeyManager) private Q_SLOTS: + void cleanupHash(QObject* obj); void sendKeyEvent(); }; -- cgit v0.12 From 8dd9e9b5f3e794ecdb70a3b43c4a2e17a8d139a8 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 27 Oct 2009 14:33:29 +0200 Subject: Fixed 'illegal empty declaration' warning from XmlPatters. The following warning was reported by MWCCSYM2 (Symbian emulator compiler): \src\xmlpatterns\api\qxmlquery.h:77: warning: illegal empty declaration Reviewed-by: TrustMe --- src/xmlpatterns/api/qxmlquery.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xmlpatterns/api/qxmlquery.h b/src/xmlpatterns/api/qxmlquery.h index abfddc0..37e4fe1 100644 --- a/src/xmlpatterns/api/qxmlquery.h +++ b/src/xmlpatterns/api/qxmlquery.h @@ -74,7 +74,7 @@ namespace QPatternist class XsdSchemaParser; class XsdValidatingInstanceReader; class VariableLoader; -}; +} class Q_XMLPATTERNS_EXPORT QXmlQuery { -- cgit v0.12 From 5bc69a86b75c1e25e0859ee27714e54878193e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Tue, 27 Oct 2009 15:20:56 +0200 Subject: Draw QSplitter in QS60Style Previously QS60Style did not draw CE_Splitter control at all. With this change, the style draws it when user presses the splitter down to make a drag. Since native side does not have splitter at all, we are drawing splitter rect as partially transparent rounded rect with QPalette::Light (which has been picked from active theme). Task-number: QT-686 Reviewed-by: Shane Kearns --- src/gui/styles/qs60style.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 8ef0dd3..580f949 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1890,6 +1890,17 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, painter->restore(); } break; + case CE_Splitter: + if (option->state & State_Sunken && option->state & State_Enabled) { + painter->save(); + painter->setOpacity(0.5); + painter->setBrush(d->themePalette()->light()); + painter->setRenderHint(QPainter::Antialiasing); + const qreal roundRectRadius = 4 * goldenRatio; + painter->drawRoundedRect(option->rect, roundRectRadius, roundRectRadius); + painter->restore(); + } + break; default: QCommonStyle::drawControl(element, option, painter, widget); } -- cgit v0.12 From cc21bffbb23212dfd6b18309aba762ae1538ae42 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Tue, 27 Oct 2009 16:03:05 +0100 Subject: Build fix for QtXmlPatterns' examples on Symbian This is the same workaround as Janne did for QtWebkit. Reviewed-by: Janne Koskinen --- mkspecs/features/qt_functions.prf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 3f84f42..1be6d9b 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -54,6 +54,10 @@ defineTest(qtAddLibrary) { # Needed for #include because relative inclusion problem in toolchain INCLUDEPATH *= $$QMAKE_INCDIR_QT/QtXmlPatterns } + isEqual(LIB_NAME, QtXmlPatterns) { + # Needed for #include because relative inclusion problem in toolchain + INCLUDEPATH *= $$QMAKE_INCDIR_QT/QtNetwork + } } isEmpty(LINKAGE) { if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { -- cgit v0.12 From 40ad4bf9bbfef57e63a51a619cf8817a28a3edd2 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 27 Oct 2009 16:41:10 +0100 Subject: Update def files after Gesture API and Text Engine changes Reviewed-by: Trust Me --- src/s60installs/bwins/QtGuiu.def | 8 +++++++- src/s60installs/eabi/QtGuiu.def | 32 ++++++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 4305346..56ba18f 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -5488,7 +5488,7 @@ EXPORTS ?currentIndex@QDataWidgetMapper@@QBEHXZ @ 5487 NONAME ; int QDataWidgetMapper::currentIndex(void) const ?setFont@QApplication@@SAXABVQFont@@PBD@Z @ 5488 NONAME ; void QApplication::setFont(class QFont const &, char const *) ?resized@QDesktopWidget@@IAEXH@Z @ 5489 NONAME ; void QDesktopWidget::resized(int) - ?fontEngine@QTextEngine@@QBEPAVQFontEngine@@ABUQScriptItem@@PAUQFixed@@1@Z @ 5490 NONAME ; class QFontEngine * QTextEngine::fontEngine(struct QScriptItem const &, struct QFixed *, struct QFixed *) const + ?fontEngine@QTextEngine@@QBEPAVQFontEngine@@ABUQScriptItem@@PAUQFixed@@1@Z @ 5490 NONAME ABSENT ; class QFontEngine * QTextEngine::fontEngine(struct QScriptItem const &, struct QFixed *, struct QFixed *) const ??BQVector2D@@QBE?AVQVariant@@XZ @ 5491 NONAME ; QVector2D::operator class QVariant(void) const ?qt_metacall@QTreeWidget@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 5492 NONAME ; int QTreeWidget::qt_metacall(enum QMetaObject::Call, int, void * *) ?setSelectable@QStandardItem@@QAEX_N@Z @ 5493 NONAME ; void QStandardItem::setSelectable(bool) @@ -12542,4 +12542,10 @@ EXPORTS ??0QSplitter@@QAE@PAVQWidget@@@Z @ 12541 NONAME ; QSplitter::QSplitter(class QWidget *) ?DocumentLengthForFep@QCoeFepInputContext@@UBEHXZ @ 12542 NONAME ; int QCoeFepInputContext::DocumentLengthForFep(void) const ??0QShowEvent@@QAE@XZ @ 12543 NONAME ; QShowEvent::QShowEvent(void) + ?fontEngine@QTextEngine@@QBEPAVQFontEngine@@ABUQScriptItem@@PAUQFixed@@11@Z @ 12544 NONAME ; class QFontEngine * QTextEngine::fontEngine(struct QScriptItem const &, struct QFixed *, struct QFixed *, struct QFixed *) const + ?leading@QTextLine@@QBEMXZ @ 12545 NONAME ; float QTextLine::leading(void) const + ?leadingIncluded@QTextLine@@QBE_NXZ @ 12546 NONAME ; bool QTextLine::leadingIncluded(void) const + ?projectedRotate@QMatrix4x4@@AAEAAV1@MMMM@Z @ 12547 NONAME ; class QMatrix4x4 & QMatrix4x4::projectedRotate(float, float, float, float) + ?setLeadingIncluded@QTextLine@@QAEX_N@Z @ 12548 NONAME ; void QTextLine::setLeadingIncluded(bool) + ?toTransform@QMatrix4x4@@QBE?AVQTransform@@XZ @ 12549 NONAME ; class QTransform QMatrix4x4::toTransform(void) const diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index ae69475..2d1c42f 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -1051,12 +1051,12 @@ EXPORTS _ZN11QPaintEventD2Ev @ 1050 NONAME _ZN11QPanGesture11qt_metacallEN11QMetaObject4CallEiPPv @ 1051 NONAME _ZN11QPanGesture11qt_metacastEPKc @ 1052 NONAME - _ZN11QPanGesture13setLastOffsetERK6QSizeF @ 1053 NONAME - _ZN11QPanGesture14setTotalOffsetERK6QSizeF @ 1054 NONAME + _ZN11QPanGesture13setLastOffsetERK6QSizeF @ 1053 NONAME ABSENT + _ZN11QPanGesture14setTotalOffsetERK6QSizeF @ 1054 NONAME ABSENT _ZN11QPanGesture15setAccelerationEf @ 1055 NONAME _ZN11QPanGesture16staticMetaObjectE @ 1056 NONAME DATA 16 _ZN11QPanGesture19getStaticMetaObjectEv @ 1057 NONAME - _ZN11QPanGesture9setOffsetERK6QSizeF @ 1058 NONAME + _ZN11QPanGesture9setOffsetERK6QSizeF @ 1058 NONAME ABSENT _ZN11QPanGestureC1EP7QObject @ 1059 NONAME _ZN11QPanGestureC2EP7QObject @ 1060 NONAME _ZN11QPixmapData12toNativeTypeENS_10NativeTypeE @ 1061 NONAME @@ -6366,7 +6366,7 @@ EXPORTS _ZN8QGesture11qt_metacallEN11QMetaObject4CallEiPPv @ 6365 NONAME _ZN8QGesture11qt_metacastEPKc @ 6366 NONAME _ZN8QGesture12unsetHotSpotEv @ 6367 NONAME - _ZN8QGesture15setTargetObjectEP7QObject @ 6368 NONAME + _ZN8QGesture15setTargetObjectEP7QObject @ 6368 NONAME ABSENT _ZN8QGesture16staticMetaObjectE @ 6369 NONAME DATA 16 _ZN8QGesture19getStaticMetaObjectEv @ 6370 NONAME _ZN8QGestureC1EN2Qt11GestureTypeEP7QObject @ 6371 NONAME ABSENT @@ -7888,7 +7888,7 @@ EXPORTS _ZNK11QTextCursorneERKS_ @ 7887 NONAME _ZNK11QTextEngine10attributesEv @ 7888 NONAME _ZNK11QTextEngine10elidedTextEN2Qt13TextElideModeERK6QFixedi @ 7889 NONAME - _ZNK11QTextEngine10fontEngineERK11QScriptItemP6QFixedS4_ @ 7890 NONAME + _ZNK11QTextEngine10fontEngineERK11QScriptItemP6QFixedS4_ @ 7890 NONAME ABSENT _ZNK11QTextEngine11boundingBoxEii @ 7891 NONAME _ZNK11QTextEngine11formatIndexEPK11QScriptItem @ 7892 NONAME _ZNK11QTextEngine11setBoundaryEi @ 7893 NONAME @@ -10163,7 +10163,7 @@ EXPORTS _ZNK8QGesture10hasHotSpotEv @ 10162 NONAME _ZNK8QGesture10metaObjectEv @ 10163 NONAME _ZNK8QGesture11gestureTypeEv @ 10164 NONAME - _ZNK8QGesture12targetObjectEv @ 10165 NONAME + _ZNK8QGesture12targetObjectEv @ 10165 NONAME ABSENT _ZNK8QGesture5stateEv @ 10166 NONAME _ZNK8QGesture7hotSpotEv @ 10167 NONAME _ZNK8QMdiArea10backgroundEv @ 10168 NONAME @@ -11615,4 +11615,24 @@ EXPORTS _Zls6QDebugRKN12QStyleOption10OptionTypeE @ 11614 NONAME _ZNK14QDesktopWidget14screenGeometryEPK7QWidget @ 11615 NONAME _ZNK14QDesktopWidget17availableGeometryEPK7QWidget @ 11616 NONAME + _ZN11QPanGesture13setLastOffsetERK7QPointF @ 11617 NONAME + _ZN11QPanGesture14setTotalOffsetERK7QPointF @ 11618 NONAME + _ZN11QPanGesture9setOffsetERK7QPointF @ 11619 NONAME + _ZN13QGestureEvent6d_funcEv @ 11620 NONAME + _ZN13QGestureEvent9setWidgetEP7QWidget @ 11621 NONAME + _ZN13QGestureEventD0Ev @ 11622 NONAME + _ZN13QGestureEventD1Ev @ 11623 NONAME + _ZN13QGestureEventD2Ev @ 11624 NONAME + _ZN14QWidgetPrivate36invalidateGraphicsEffectsRecursivelyEv @ 11625 NONAME + _ZN20QGraphicsItemPrivate36invalidateGraphicsEffectsRecursivelyEv @ 11626 NONAME + _ZNK13QGestureEvent10mapToSceneERK7QPointF @ 11627 NONAME + _ZNK13QGestureEvent6d_funcEv @ 11628 NONAME + _ZNK13QGestureEvent6widgetEv @ 11629 NONAME + _Zls6QDebugP15QGraphicsObject @ 11630 NONAME + _ZN10QMatrix4x415projectedRotateEffff @ 11631 NONAME + _ZN9QTextLine18setLeadingIncludedEb @ 11632 NONAME + _ZNK10QMatrix4x411toTransformEv @ 11633 NONAME + _ZNK11QTextEngine10fontEngineERK11QScriptItemP6QFixedS4_S4_ @ 11634 NONAME + _ZNK9QTextLine15leadingIncludedEv @ 11635 NONAME + _ZNK9QTextLine7leadingEv @ 11636 NONAME -- cgit v0.12 From f80dca1e0f035807e5e6a984aec1768519f4d467 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 27 Oct 2009 16:42:31 +0100 Subject: Fix tst_QBoxLayout::setGeometry failure on S60 3.x The S60 style posts a LayoutRequest event when a widget is shown, so that it can draw the focus rectangle around the widget that has keyboard focus. Although lay2->setGeometry was working correctly, processEvents() caused the outer layout to be re-laid out (which expands the inner layout and QDial to fill the available space). The processEvents() call is not necessary for the test case, so it can be removed. Reviewed-by: Jan-Arve --- tests/auto/qboxlayout/tst_qboxlayout.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/qboxlayout/tst_qboxlayout.cpp b/tests/auto/qboxlayout/tst_qboxlayout.cpp index 7ff444b..8887288 100644 --- a/tests/auto/qboxlayout/tst_qboxlayout.cpp +++ b/tests/auto/qboxlayout/tst_qboxlayout.cpp @@ -211,7 +211,6 @@ void tst_QBoxLayout::setGeometry() QRect newGeom(0, 0, 70, 70); lay2->setGeometry(newGeom); - QApplication::processEvents(); QVERIFY2(newGeom.contains(dial->geometry()), "dial->geometry() should be smaller and within newGeom"); } -- cgit v0.12 From 6bc9ef388590b4bfb281d2e1510dc7c3d1837349 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 28 Oct 2009 08:52:30 +0100 Subject: Fix to 8e0fbc2caa3edefb78d6667721235b783bc1a850 This version of the fix will set the def file only if defblock is enabled in qbase.pri. That means that def files don't get turned on for webkit but not for the whole project (avoids build failures in the continuous integration system when other teams change the exported symbols) Reviewed-by: Jason Barron --- src/3rdparty/webkit/WebCore/WebCore.pro | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index a835fc7..d633a7a 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -3376,3 +3376,18 @@ CONFIG(QTDIR_build):isEqual(QT_MAJOR_VERSION, 4):greaterThan(QT_MINOR_VERSION, 4 plugins/win/PaintHooks.asm } } + +# Temporary workaround to pick up the DEF file from the same place as all the others +symbian { + shared { + contains(MMP_RULES, defBlock) { + MMP_RULES -= defBlock + + MMP_RULES += "$${LITERAL_HASH}ifdef WINSCW" \ + "DEFFILE ../../../s60installs/bwins/$${TARGET}.def" \ + "$${LITERAL_HASH}elif defined EABI" \ + "DEFFILE ../../../s60installs/eabi/$${TARGET}.def" \ + "$${LITERAL_HASH}endif" + } + } +} -- cgit v0.12 From 1631a4b79f0f2d2b8b8075cd6ebbebe3bafbdb2b Mon Sep 17 00:00:00 2001 From: Liang QI Date: Wed, 28 Oct 2009 08:52:43 +0100 Subject: Enable QtXmlPatterns module in qt package and assign an UID for it. Enable QtXmlPatterns module in qt package and assign an UID for it. RevBy: Miikka Heikkinen RevBy: Jason Barron --- src/s60installs/s60installs.pro | 4 ++++ src/xmlpatterns/xmlpatterns.pro | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 7233e8a..154d666 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -97,6 +97,10 @@ symbian: { qtlibraries.sources += QtScript.dll } + contains(QT_CONFIG, xmlpatterns): { + qtlibraries.sources += QtXmlPatterns.dll + } + contains(QT_CONFIG, webkit): { qtlibraries.sources += QtWebKit.dll } diff --git a/src/xmlpatterns/xmlpatterns.pro b/src/xmlpatterns/xmlpatterns.pro index bb8e452..1df497d 100644 --- a/src/xmlpatterns/xmlpatterns.pro +++ b/src/xmlpatterns/xmlpatterns.pro @@ -34,3 +34,5 @@ wince*: { QMAKE_CXXFLAGS_RELEASE ~= s/-O1/-Os -Oy -Ob2/ } } + +symbian:TARGET.UID3=0x2001E62B -- cgit v0.12 From cabbff076f40eeeb56beb53220a40f124a2e0215 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 28 Oct 2009 09:15:40 +0100 Subject: Change deployment of SQLite to check for stub SIS file This is less wrong than searching for a file name on specific drives. Correct solution is to use an embedded SIS file dependency, for that we need to get a symbian-signed sis file from the symbian OS team. Reviewed-by: Miikka Heikkinen --- src/s60installs/s60installs.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 7233e8a..f553598 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -35,8 +35,8 @@ symbian: { qtlibraries.pkg_postrules += qts60plugindeployment sqlitedeployment = \ - "; EXISTS statement does not resolve !. Lets check the most common drives" \ - "IF NOT EXISTS(\"c:\\sys\\bin\\sqlite3.dll\") AND NOT EXISTS(\"e:\\sys\\bin\\sqlite3.dll\") AND NOT EXISTS(\"z:\\sys\\bin\\sqlite3.dll\")" \ + "; Deploy sqlite onto phone that does not have it (this should be replaced with embedded sis file when available) + "IF NOT package(0x2002533b) " \ "\"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/sqlite3.dll\" - \"!:\\sys\\bin\\sqlite3.dll\"" \ "ENDIF" qtlibraries.pkg_postrules += sqlitedeployment -- cgit v0.12 From c5671bcc033e6e519fe8f88b64c108e8d52371fe Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 28 Oct 2009 09:26:43 +0100 Subject: Bad line ending in cabbff076f40eeeb56beb53220a40f124a2e0215 Reviewed-by: TrustMe --- src/s60installs/s60installs.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index d8f164f..022a072 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -35,7 +35,7 @@ symbian: { qtlibraries.pkg_postrules += qts60plugindeployment sqlitedeployment = \ - "; Deploy sqlite onto phone that does not have it (this should be replaced with embedded sis file when available) + "; Deploy sqlite onto phone that does not have it (this should be replaced with embedded sis file when available)" \ "IF NOT package(0x2002533b) " \ "\"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/sqlite3.dll\" - \"!:\\sys\\bin\\sqlite3.dll\"" \ "ENDIF" -- cgit v0.12 From 680de3b4bf3c62b2df83797f8cee5789c121bf00 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Wed, 28 Oct 2009 11:13:08 +0200 Subject: Fix EColor16M conversion in QPixmap::fromSymbianCFbsBitmap() EColor16M is in BGR format so after conversion to QImage RGB values needs to be swapped. Reviewed-by: jbarron --- src/gui/image/qpixmap_s60.cpp | 15 +++++++++------ tests/auto/qpixmap/tst_qpixmap.cpp | 2 ++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 666d608..c56e9b7 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -935,18 +935,21 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType) da.beginDataAccess(sourceBitmap); uchar *bytes = (uchar*)sourceBitmap->DataAddress(); QImage img = QImage(bytes, size.iWidth, size.iHeight, format); + img = img.copy(); da.endDataAccess(sourceBitmap); - fromImage(img, Qt::AutoColor); - - if(deleteSourceBitmap) - delete sourceBitmap; - if(displayMode == EGray2) { //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid //So invert mono bitmaps so that masks work correctly. - image.invertPixels(); + img.invertPixels(); + } else if(displayMode == EColor16M) { + img = img.rgbSwapped(); // EColor16M is BGR } + + fromImage(img, Qt::AutoColor); + + if(deleteSourceBitmap) + delete sourceBitmap; } else { CFbsBitmap* duplicate = 0; QT_TRAP_THROWING(duplicate = new (ELeave) CFbsBitmap); diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 53b6230..8e02c74 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -1134,6 +1134,8 @@ void tst_QPixmap::fromSymbianCFbsBitmap_data() QTest::newRow("EColor4K big") << EColor4K << largeWidth << largeHeight << QColor(Qt::red); QTest::newRow("EColor64K small") << EColor64K << smallWidth << smallHeight << QColor(Qt::green); QTest::newRow("EColor64K big") << EColor64K << largeWidth << largeHeight << QColor(Qt::green); + QTest::newRow("EColor16M small") << EColor16M << smallWidth << smallHeight << QColor(Qt::yellow); + QTest::newRow("EColor16M big") << EColor16M << largeWidth << largeHeight << QColor(Qt::yellow); QTest::newRow("EColor16MU small") << EColor16MU << smallWidth << smallHeight << QColor(Qt::red); QTest::newRow("EColor16MU big") << EColor16MU << largeWidth << largeHeight << QColor(Qt::red); QTest::newRow("EColor16MA small opaque") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0); -- cgit v0.12 From 8007617f784fcad76661efbb2ce9ee7393946e02 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 28 Oct 2009 15:32:33 +0200 Subject: Increased block size for file IO in Symbian. Each read requires costly IPC call to Symbian file server, so reading and writing large files has lot of unnecessary overhead when using 4k block size. Increased the block size to 16k, which is what QIODevice will request at maximum. This speeds up reading large files up to 10%. Also included are some unnecessary whitespace removals. Task-number: QT-2347 Reviewed-by: axis --- src/corelib/io/qfsfileengine.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index fb096a7..b69a5e5 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -76,6 +76,16 @@ QT_BEGIN_NAMESPACE # endif #endif +#ifdef Q_OS_SYMBIAN + // Using default 4k block in symbian is highly inefficient due to + // the fact that each file operation requires slow IPC calls, so + // use somewhat larger block size. +# define FDFH_BLOCK_SIZE 16384 +#else + // Read/write in blocks of 4k to avoid platform limitations (Windows + // commonly bails out if you read or write too large blocks at once). +# define FDFH_BLOCK_SIZE 4096 +#endif /*! \class QFSFileEngine \brief The QFSFileEngine class implements Qt's default file engine. @@ -160,11 +170,11 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) if ( #ifdef Q_OS_SYMBIAN // Symbian doesn't support directory symlinks, so do not check for link unless we - // are handling the last path element. This not only slightly improves performance, + // are handling the last path element. This not only slightly improves performance, // but also saves us from lot of unnecessary platform security check failures // when dealing with files under *:/private directories. separatorPos == -1 && -#endif +#endif !nonSymlinks.contains(prefix)) { fi.setFile(prefix); if (fi.isSymLink()) { @@ -628,14 +638,12 @@ qint64 QFSFileEnginePrivate::readFdFh(char *data, qint64 len) qint64 read = 0; int retry = 0; - // Read in blocks of 4k to avoid platform limitations (Windows - // commonly bails out if you read or write too large blocks at once). qint64 bytesToRead; do { if (retry == 1) retry = 2; - bytesToRead = qMin(4096, len - read); + bytesToRead = qMin(FDFH_BLOCK_SIZE, len - read); do { readBytes = fread(data + read, 1, size_t(bytesToRead), fh); } while (readBytes == 0 && !feof(fh) && errno == EINTR); @@ -666,10 +674,8 @@ qint64 QFSFileEnginePrivate::readFdFh(char *data, qint64 len) qint64 read = 0; errno = 0; - // Read in blocks of 4k to avoid platform limitations (Windows - // commonly bails out if you read or write too large blocks at once). do { - qint64 bytesToRead = qMin(4096, len - read); + qint64 bytesToRead = qMin(FDFH_BLOCK_SIZE, len - read); do { result = QT_READ(fd, data + read, int(bytesToRead)); } while (result == -1 && errno == EINTR); @@ -770,9 +776,7 @@ qint64 QFSFileEnginePrivate::writeFdFh(const char *data, qint64 len) qint64 written = 0; do { - // Write blocks of 4k to avoid platform limitations (Windows commonly - // bails out if you read or write too large blocks at once). - qint64 bytesToWrite = qMin(4096, len - written); + qint64 bytesToWrite = qMin(FDFH_BLOCK_SIZE, len - written); if (fh) { do { // Buffered stdlib mode. @@ -903,7 +907,7 @@ bool QFSFileEngine::supportsExtension(Extension extension) const /*! \fn QString QFSFileEngine::currentPath(const QString &fileName) For Unix, returns the current working directory for the file engine. - + For Windows, returns the canonicalized form of the current path used by the file engine for the drive specified by \a fileName. On Windows, each drive has its own current directory, so a different -- cgit v0.12 From f360555f3c7ded3c729ce972fbd65f035876b1b4 Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 28 Oct 2009 16:09:45 +0100 Subject: Fixed crash/drawing artifacts on rotation change on Symbian. On every beginDataAccess on the pixmap data, we checked the value of the pointer to the bits and only updated the image if the pointer had changed. However, we didn't take into account that the pointer could be the same, even though the dimensions were different, since malloc() could return the same memory area. This would lead to painting into an image that had the wrong dimensions, which again led to either crashes or image shearing. Fixed by checking the dimensions before deciding to update the image. Task: QTBUG-4815 RevBy: Jason Barron --- src/gui/image/qpixmap_s60.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index c56e9b7..7086341 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -684,9 +684,10 @@ void QS60PixmapData::beginDataAccess() uchar* newBytes = (uchar*)cfbsBitmap->DataAddress(); - if (newBytes == bytes) - return; + TSize size = cfbsBitmap->SizeInPixels(); + if (newBytes == bytes && image.width() == size.iWidth && image.height() == size.iHeight) + return; bytes = newBytes; TDisplayMode mode = cfbsBitmap->DisplayMode(); @@ -695,8 +696,6 @@ void QS60PixmapData::beginDataAccess() if (format == QImage::Format_ARGB32) format = QImage::Format_ARGB32_Premultiplied; // pixel data is actually in premultiplied format - TSize size = cfbsBitmap->SizeInPixels(); - QVector savedColorTable; if (!image.isNull()) savedColorTable = image.colorTable(); -- cgit v0.12 From f736d889bca3ce5d33b1e5499ad8714952c67906 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 29 Oct 2009 11:20:31 +0100 Subject: Fix QDateTime on S60 3.1 S60 3.1 plugin returned empty strings for the unsupported APIs Since these APIs are needed for the most common use case of converting a QDateTime to a QString using the local format, I have implemented an emulation of the missing APIs using older APIs that are supported. Updated the autotest so it does some sanity checking on the result of local date/time conversion - it would pass instead of fail if the string was garbage before. Reviewed-by: Aleksandar Sasha Babic --- src/plugins/s60/src/qlocale_3_1.cpp | 96 ++++++++++++++++++++++++++++++++-- tests/auto/qdatetime/tst_qdatetime.cpp | 7 +++ 2 files changed, 98 insertions(+), 5 deletions(-) diff --git a/src/plugins/s60/src/qlocale_3_1.cpp b/src/plugins/s60/src/qlocale_3_1.cpp index 0afd10a..beeee7f 100644 --- a/src/plugins/s60/src/qlocale_3_1.cpp +++ b/src/plugins/s60/src/qlocale_3_1.cpp @@ -40,23 +40,109 @@ ****************************************************************************/ #include +#include +#include -EXPORT_C void defaultFormatL(TTime&, TDes& des, const TDesC&, const TLocale&) +_LIT(KYear, "%Y"); +_LIT(KMonth, "%M"); +_LIT(KDay, "%D"); +_LIT(KLocaleIndependent, "%F"); +static TBuf<10> dateFormat; +static TBuf<10> timeFormat; + +static void initialiseDateFormat() +{ + if(dateFormat.Length()) + return; + + TLocale locale; + + //Separator 1 is used between 1st and 2nd components of the date + //Separator 2 is used between 2nd and 3rd components of the date + //Usually they are the same, but they are allowed to be different + TChar s1 = locale.DateSeparator(1); + TChar s2 = locale.DateSeparator(2); + dateFormat=KLocaleIndependent; + switch(locale.DateFormat()) { + case EDateAmerican: + dateFormat.Append(KMonth); + dateFormat.Append(s1); + dateFormat.Append(KDay); + dateFormat.Append(s2); + dateFormat.Append(KYear); + break; + case EDateEuropean: + dateFormat.Append(KDay); + dateFormat.Append(s1); + dateFormat.Append(KMonth); + dateFormat.Append(s2); + dateFormat.Append(KYear); + break; + case EDateJapanese: + default: //it's closest to ISO format + dateFormat.Append(KYear); + dateFormat.Append(s1); + dateFormat.Append(KMonth); + dateFormat.Append(s2); + dateFormat.Append(KDay); + break; + } +#ifdef _DEBUG + RDebug::Print(_L("Date Format \"%S\""), &dateFormat); +#endif +} + +static void initialiseTimeFormat() +{ + if(timeFormat.Length()) + return; + + TLocale locale; + //Separator 1 is used between 1st and 2nd components of the time + //Separator 2 is used between 2nd and 3rd components of the time + //Usually they are the same, but they are allowed to be different + TChar s1 = locale.TimeSeparator(1); + TChar s2 = locale.TimeSeparator(2); + switch(locale.TimeFormat()) { + case ETime12: + timeFormat.Append(_L("%I")); + break; + case ETime24: + default: + timeFormat.Append(_L("%H")); + break; + } + timeFormat.Append(s1); + timeFormat.Append(_L("%T")); + timeFormat.Append(s2); + timeFormat.Append(_L("%S")); + +#ifdef _DEBUG + RDebug::Print(_L("Time Format \"%S\""), &timeFormat); +#endif +} + +EXPORT_C void defaultFormatL(TTime& time, TDes& des, const TDesC& fmt, const TLocale&) { - des.Zero(); + //S60 3.1 does not support format for a specific locale, so use default locale + time.FormatL(des, fmt); } +//S60 3.1 doesn't support extended locale date&time formats, so use default locale EXPORT_C TPtrC defaultGetTimeFormatSpec(TExtendedLocale&) { - return TPtrC(KNullDesC); + initialiseTimeFormat(); + return TPtrC(timeFormat); } EXPORT_C TPtrC defaultGetLongDateFormatSpec(TExtendedLocale&) { - return TPtrC(KNullDesC); + initialiseDateFormat(); + return TPtrC(dateFormat); } EXPORT_C TPtrC defaultGetShortDateFormatSpec(TExtendedLocale&) { - return TPtrC(KNullDesC); + initialiseDateFormat(); + return TPtrC(dateFormat); } diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index 8fb0c91..c53780e 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -447,7 +447,14 @@ void tst_QDateTime::toString_enumformat() QCOMPARE(str2, QString("1995-05-20T12:34:56")); QString str3 = dt1.toString(Qt::LocalDate); + qDebug() << str3; QVERIFY(!str3.isEmpty()); + //check for date/time components in any order + QVERIFY(str3.contains("1995")); + //day and month may be in numeric or word form + QVERIFY(str3.contains("12")); + QVERIFY(str3.contains("34")); + QVERIFY(str3.contains("56")); } void tst_QDateTime::addDays() -- cgit v0.12 From d38ebd566f3a73f280903929d4ac49d255be3aed Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 29 Oct 2009 13:22:49 +0200 Subject: Removed mentions about certain flags being temporary for Symbian In configure app, some QT_NO_* flags were indicated to be temporary and should be removed once Qt for Symbian is out, but it looks like at least some of them will be there for longer haul, so removed mentions of temporary nature of these flags. Task-number: QTBUG-4744 Reviewed-by: Janne Anttila --- tools/configure/configureapp.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index adf7a1a..25a02f3 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2780,17 +2780,6 @@ QString Configure::addDefine(QString def) } #if !defined(EVAL) -// ### This should be removed once Qt for S60 is out. -static void applyTemporarySymbianFlags(QStringList &qconfigList) -{ - qconfigList += "QT_NO_CONCURRENT"; - qconfigList += "QT_NO_QFUTURE"; - // This is removed because it uses UNIX signals which are not implemented yet - qconfigList += "QT_NO_CRASHHANDLER"; - qconfigList += "QT_NO_PRINTER"; - qconfigList += "QT_NO_SYSTEMTRAYICON"; -} - void Configure::generateConfigfiles() { QDir(buildPath).mkpath("src/corelib/global"); @@ -2913,9 +2902,14 @@ void Configure::generateConfigfiles() if (dictionary["GRAPHICS_SYSTEM"] == "openvg") qconfigList += "QT_GRAPHICSSYSTEM_OPENVG"; if (dictionary["GRAPHICS_SYSTEM"] == "opengl") qconfigList += "QT_GRAPHICSSYSTEM_OPENGL"; if (dictionary["GRAPHICS_SYSTEM"] == "raster") qconfigList += "QT_GRAPHICSSYSTEM_RASTER"; - // ### This block should be removed once Qt for S60 is out. + if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) { - applyTemporarySymbianFlags(qconfigList); + // These features are not ported to Symbian (yet) + qconfigList += "QT_NO_CONCURRENT"; + qconfigList += "QT_NO_QFUTURE"; + qconfigList += "QT_NO_CRASHHANDLER"; + qconfigList += "QT_NO_PRINTER"; + qconfigList += "QT_NO_SYSTEMTRAYICON"; } qconfigList.sort(); -- cgit v0.12 From 76095a14bc84305c69b3eaf8f3953dc683ebe370 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 29 Oct 2009 15:45:17 +0200 Subject: Fix for softkey visibility when dialog launched from fullscreen widget. Softkeys should be always the topmost window in order to be visible. For example when QMessageBox is launched from fullscreen window, we need to make sure that softkey is located on top of window tree. Task-number: QTBUG-4953 Reviewed-by: Jason Barron --- src/gui/kernel/qsoftkeymanager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index a5e8eff..a5a2201 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -207,6 +207,7 @@ bool QSoftKeyManager::event(QEvent *e) void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList &softkeys) { CEikButtonGroupContainer* nativeContainer = S60->buttonGroupContainer(); + nativeContainer->DrawableWindow()->SetOrdinalPosition(0); nativeContainer->DrawableWindow()->SetPointerCapturePriority(1); //keep softkeys available in modal dialog QT_TRAP_THROWING(nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS)); -- cgit v0.12 From 198b974587ba9751a2bdc73464c05c164d49f10c Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 29 Oct 2009 16:28:45 +0200 Subject: Fixed: Variable res goes out of scope but is accessed later via pointer In qdatetime UTC conversion functions, variable res was declared in incorrect scope and went out of scope too soon in Symbian. Reviewed-by: Janne Koskinen --- src/corelib/tools/qdatetime.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 54465bb..db6435e 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -1855,7 +1855,7 @@ QTime QTime::currentTime() t = localtime(<ime); #endif Q_CHECK_PTR(t); - + ct.mds = MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + 1000 * t->tm_sec + tv.tv_usec / 1000; #else @@ -3725,11 +3725,11 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time) TTimeIntervalSeconds tTimeIntervalSecsSince1Jan1970UTC(secsSince1Jan1970UTC); TTime epochTTime; TInt err = epochTTime.Set(KUnixEpoch); + tm res; if(err == KErrNone) { TTime utcTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC; utcTTime = utcTTime + utcOffset; TDateTime utcDateTime = utcTTime.DateTime(); - tm res; res.tm_sec = utcDateTime.Second(); res.tm_min = utcDateTime.Minute(); res.tm_hour = utcDateTime.Hour(); @@ -3816,11 +3816,11 @@ static void localToUtc(QDate &date, QTime &time, int isdst) TTimeIntervalSeconds tTimeIntervalSecsSince1Jan1970UTC(secsSince1Jan1970UTC); TTime epochTTime; TInt err = epochTTime.Set(KUnixEpoch); + tm res; if(err == KErrNone) { TTime utcTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC; utcTTime = utcTTime + utcOffset; TDateTime utcDateTime = utcTTime.DateTime(); - tm res; res.tm_sec = utcDateTime.Second(); res.tm_min = utcDateTime.Minute(); res.tm_hour = utcDateTime.Hour(); -- cgit v0.12 From da9880eaed0d09338717db1a73db01e6b0ab080d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 29 Oct 2009 17:41:52 +0200 Subject: QS60Style does not mix well with the stylesheets QS60Style basically ignores user set / stylesheet set palettes. Now, tested with: * QLineEdit * QPushButton * QSpinBox * QComboBox * QAbstractScrollArea * QCheckBox * QRadioButton * QGroupBox * QFrame * QTreeView * QTableView * QHeaderView * QProgressBar * QScrollBar * QSplitter * QSlider * QTabWidget * QToolButton * QToolBar and fixed QS60Style so that it obeys externally set palettes. Task-number: QTBUG-4820 Reviewed-by: Janne Koskinen --- src/gui/styles/qs60style.cpp | 199 +++++++++++++++++++-------------- src/gui/styles/qs60style_p.h | 6 +- src/gui/styles/qs60style_s60.cpp | 61 ++++------ src/gui/styles/qs60style_simulated.cpp | 4 +- 4 files changed, 146 insertions(+), 124 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 580f949..b87f3a8 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -66,7 +66,6 @@ #include "qtextedit.h" #include "qtoolbar.h" #include "qtoolbutton.h" -#include "qtreeview.h" #include "qfocusframe.h" #include "private/qtoolbarextension_p.h" @@ -527,7 +526,7 @@ void QS60StylePrivate::drawPart(QS60StyleEnums::SkinParts skinPart, true; #endif - const QPixmap skinPartPixMap((doCache ? cachedPart : part)(skinPart, rect.size(), flags)); + const QPixmap skinPartPixMap((doCache ? cachedPart : part)(skinPart, rect.size(), painter, flags)); if (!skinPartPixMap.isNull()) painter->drawPixmap(rect.topLeft(), skinPartPixMap); } @@ -594,14 +593,14 @@ void QS60StylePrivate::drawRow(QS60StyleEnums::SkinParts start, } QPixmap QS60StylePrivate::cachedPart(QS60StyleEnums::SkinParts part, - const QSize &size, SkinElementFlags flags) + const QSize &size, QPainter *painter, SkinElementFlags flags) { QPixmap result; const QString cacheKey = QString::fromLatin1("S60Style: SkinParts=%1 QSize=%2|%3 SkinPartFlags=%4") .arg((int)part).arg(size.width()).arg(size.height()).arg((int)flags); if (!QPixmapCache::find(cacheKey, result)) { - result = QS60StylePrivate::part(part, size, flags); + result = QS60StylePrivate::part(part, size, painter, flags); QPixmapCache::insert(cacheKey, result); } return result; @@ -1316,13 +1315,13 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, painter->setClipRect(voptAdj.rect); const bool isSelected = (vopt->state & QStyle::State_Selected); - bool isVisible = false; + bool isScrollBarVisible = false; int scrollBarWidth = 0; QList scrollBars = qFindChildren(widget); for (int i = 0; i < scrollBars.size(); ++i) { QScrollBar *scrollBar = scrollBars.at(i); if (scrollBar && scrollBar->orientation() == Qt::Vertical) { - isVisible = scrollBar->isVisible(); + isScrollBarVisible = scrollBar->isVisible(); scrollBarWidth = scrollBar->size().width(); break; } @@ -1330,7 +1329,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, int rightValue = widget ? widget->contentsRect().right() : 0; - if (isVisible) + if (isScrollBarVisible) rightValue -= scrollBarWidth; if (voptAdj.rect.right() > rightValue) @@ -1338,40 +1337,40 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &voptAdj, widget); QRect textRect = subElementRect(SE_ItemViewItemText, &voptAdj, widget); + const QAbstractItemView *itemView = qobject_cast(widget); // draw themed background for table unless background brush has been defined. if (vopt->backgroundBrush == Qt::NoBrush) { - const QStyleOptionViewItemV4 *tableOption = qstyleoption_cast(option); - const QTableView *table = qobject_cast(widget); - if (table && tableOption) { - const QModelIndex index = tableOption->index; + if (itemView) { + const QModelIndex index = vopt->index; //todo: Draw cell background only once - for the first cell. QStyleOptionViewItemV4 voptAdj2 = voptAdj; - const QModelIndex indexFirst = table->model()->index(0,0); - const QModelIndex indexLast = table->model()->index( - table->model()->rowCount()-1,table->model()->columnCount()-1); - if (table->viewport()) - voptAdj2.rect = QRect( table->visualRect(indexFirst).topLeft(), - table->visualRect(indexLast).bottomRight()).intersect(table->viewport()->rect()); - drawPrimitive(PE_PanelItemViewItem, &voptAdj2, painter, widget); + const QModelIndex indexFirst = itemView->model()->index(0,0); + const QModelIndex indexLast = itemView->model()->index( + itemView->model()->rowCount()-1,itemView->model()->columnCount()-1); + if (itemView->viewport()) + voptAdj2.rect = QRect( itemView->visualRect(indexFirst).topLeft(), + itemView->visualRect(indexLast).bottomRight()).intersect(itemView->viewport()->rect()); + drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget); } - } else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, option, painter, widget);} + } else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);} // draw the focus rect if (isSelected) { QRect highlightRect = option->rect.adjusted(1,1,-1,-1); - const QAbstractItemView *view = qobject_cast(widget); - if (view && view->selectionBehavior() != QAbstractItemView::SelectItems) { + QAbstractItemView::SelectionBehavior selectionBehavior = + itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems; + if (selectionBehavior != QAbstractItemView::SelectItems) { // set highlight rect so that it is continuous from cell to cell, yet sligthly // smaller than cell rect int xBeginning = 0, yBeginning = 0, xEnd = 0, yEnd = 0; - if (view->selectionBehavior() == QAbstractItemView::SelectRows) { + if (selectionBehavior == QAbstractItemView::SelectRows) { yBeginning = 1; yEnd = -1; if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning) xBeginning = 1; else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End) xEnd = -1; - } else if (view->selectionBehavior() == QAbstractItemView::SelectColumns) { + } else if (selectionBehavior == QAbstractItemView::SelectColumns) { xBeginning = 1; xEnd = -1; if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning) yBeginning = 1; @@ -1380,7 +1379,9 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } highlightRect = option->rect.adjusted(xBeginning, yBeginning, xEnd, yEnd); } - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, highlightRect, flags); + if (vopt->showDecorationSelected && + (vopt->palette.highlight().color() == d->themePalette()->highlight().color())) + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, highlightRect, flags); } // draw the icon @@ -1389,48 +1390,44 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, voptAdj.icon.paint(painter, iconRect, voptAdj.decorationAlignment, mode, state); // Draw selection check mark. Show check mark only in multi selection modes. - if (const QListView *listView = (qobject_cast(widget))) { + if (itemView) { const bool singleSelection = - listView && - (listView->selectionMode() == QAbstractItemView::SingleSelection || - listView->selectionMode() == QAbstractItemView::NoSelection); + (itemView->selectionMode() == QAbstractItemView::SingleSelection || + itemView->selectionMode() == QAbstractItemView::NoSelection); const QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget); + + QStyleOptionViewItemV4 checkMarkOption(voptAdj); + // Draw selection mark. if (voptAdj.state & QStyle::State_Selected && !singleSelection) { - QStyleOptionViewItemV4 option(voptAdj); - option.rect = selectionRect; - // Draw selection mark. - drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, painter, widget); + checkMarkOption.rect = selectionRect; + drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget); if ( textRect.right() > selectionRect.left() ) textRect.setRight(selectionRect.left()); } else if (singleSelection && - voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) { - // draw the check mark - if (selectionRect.isValid()) { - QStyleOptionViewItemV4 option(*vopt); - option.rect = selectionRect; - option.state = option.state & ~QStyle::State_HasFocus; - - switch (vopt->checkState) { - case Qt::Unchecked: - option.state |= QStyle::State_Off; - break; - case Qt::PartiallyChecked: - option.state |= QStyle::State_NoChange; - break; - case Qt::Checked: - option.state |= QStyle::State_On; - break; - } - drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, painter, widget); + voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator && + selectionRect.isValid()) { + checkMarkOption.rect = selectionRect; + checkMarkOption.state = checkMarkOption.state & ~QStyle::State_HasFocus; + + switch (vopt->checkState) { + case Qt::Unchecked: + checkMarkOption.state |= QStyle::State_Off; + break; + case Qt::PartiallyChecked: + checkMarkOption.state |= QStyle::State_NoChange; + break; + case Qt::Checked: + checkMarkOption.state |= QStyle::State_On; + break; } + drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget); } } // draw the text if (!voptAdj.text.isEmpty()) { - const QStyleOptionViewItemV4 *tableOption = qstyleoption_cast(option); if (isSelected) { - if (qobject_cast(widget) && tableOption) + if (qobject_cast(widget)) voptAdj.palette.setColor( QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 11, 0)); else @@ -1723,8 +1720,11 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, // direction is set to north (and south when in RightToLeft) const QS60StylePrivate::SkinElementFlag arrowDirection = (arrowOptions.direction == Qt::LeftToRight) ? QS60StylePrivate::SF_PointNorth : QS60StylePrivate::SF_PointSouth; + painter->save(); + painter->setPen(option->palette.windowText().color()); QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnIndiSubMenu, painter, arrowOptions.rect, (flags | QS60StylePrivate::SF_ColorSkinned | arrowDirection)); + painter->restore(); } //draw text @@ -1831,8 +1831,12 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, break; #endif //QT_NO_TOOLBAR case CE_ShapedFrame: - if (qobject_cast(widget)) { - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_Editor, painter, option->rect, flags); + if (const QTextEdit *textEdit = qobject_cast(widget)) { + const QStyleOptionFrame *frame = qstyleoption_cast(option); + if (frame->palette.base().color()==Qt::transparent) + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_Editor, painter, option->rect, flags); + else + QCommonStyle::drawControl(element, option, painter, widget); } else if (qobject_cast(widget)) { QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableItem, painter, option->rect, flags); } else if (const QHeaderView *header = qobject_cast(widget)) { @@ -1897,7 +1901,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, painter->setBrush(d->themePalette()->light()); painter->setRenderHint(QPainter::Antialiasing); const qreal roundRectRadius = 4 * goldenRatio; - painter->drawRoundedRect(option->rect, roundRectRadius, roundRectRadius); + painter->drawRoundedRect(option->rect, roundRectRadius, roundRectRadius); painter->restore(); } break; @@ -1911,6 +1915,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, */ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { + Q_D(const QS60Style); const QS60StylePrivate::SkinElementFlags flags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled; switch (element) { #ifndef QT_NO_LINEEDIT @@ -1920,19 +1925,27 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti if (widget && qobject_cast(widget->parentWidget())) break; #endif - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_FrameLineEdit, - painter, option->rect, flags); + QBrush editBrush = option->palette.brush(QPalette::Base); + if (editBrush.color() == Qt::transparent) + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_FrameLineEdit, + painter, option->rect, flags); + else + QCommonStyle::drawPrimitive(element, option, painter, widget); } break; #endif // QT_NO_LINEEDIT case PE_IndicatorCheckBox: { - const QRect indicatorRect = option->rect; // Draw checkbox indicator as color skinned graphics. const QS60StyleEnums::SkinParts skinPart = (option->state & QStyle::State_On) ? QS60StyleEnums::SP_QgnIndiCheckboxOn : QS60StyleEnums::SP_QgnIndiCheckboxOff; - QS60StylePrivate::drawSkinPart(skinPart, painter, indicatorRect, - (flags | QS60StylePrivate::SF_ColorSkinned)); + painter->save(); + QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnIconColors, 13, option); + QColor buttonTextColor = option->palette.buttonText().color(); + if (themeColor != buttonTextColor) + painter->setPen(buttonTextColor); + QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, flags | QS60StylePrivate::SF_ColorSkinned ); + painter->restore(); } break; case PE_IndicatorViewItemCheck: @@ -1972,21 +1985,33 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti const int newY = (buttonRect.bottomRight().y() - option->rect.bottomRight().y()) >> 1 ; buttonRect.adjust(0,-newY,0,-newY); + painter->save(); + QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnIconColors, 13, option); + QColor buttonTextColor = option->palette.buttonText().color(); + if (themeColor != buttonTextColor) + painter->setPen(buttonTextColor); + // Draw radiobutton indicator as color skinned graphics. QS60StyleEnums::SkinParts skinPart = (option->state & QStyle::State_On) ? QS60StyleEnums::SP_QgnIndiRadiobuttOn : QS60StyleEnums::SP_QgnIndiRadiobuttOff; QS60StylePrivate::drawSkinPart(skinPart, painter, buttonRect, (flags | QS60StylePrivate::SF_ColorSkinned)); + painter->restore(); } break; case PE_PanelButtonCommand: case PE_PanelButtonTool: case PE_PanelButtonBevel: case PE_FrameButtonBevel: { - const bool isPressed = option->state & QStyle::State_Sunken; - const QS60StylePrivate::SkinElements skinElement = - isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal; - QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); + QBrush editBrush = option->palette.brush(QPalette::Base); + if (editBrush.color() == Qt::transparent) { + const bool isPressed = option->state & QStyle::State_Sunken; + const QS60StylePrivate::SkinElements skinElement = + isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal; + QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); + } else { + QCommonStyle::drawPrimitive(element, option, painter, widget); + } } break; #ifndef QT_NO_TOOLBUTTON @@ -2013,21 +2038,29 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti case PE_IndicatorSpinUp: if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast(option)) { QStyleOptionSpinBox optionSpinBox = *spinBox; - const QS60StyleEnums::SkinParts part = (element == PE_IndicatorSpinUp) ? - QS60StyleEnums::SP_QgnGrafScrollArrowUp : - QS60StyleEnums::SP_QgnGrafScrollArrowDown; - const int adjustment = qMin(optionSpinBox.rect.width(), optionSpinBox.rect.height())/6; - optionSpinBox.rect.translate(0, (element == PE_IndicatorSpinDown) ? adjustment : -adjustment ); - QS60StylePrivate::drawSkinPart(part, painter, optionSpinBox.rect,flags); + if (optionSpinBox.palette.base().color()==Qt::transparent) { + const QS60StyleEnums::SkinParts part = (element == PE_IndicatorSpinUp) ? + QS60StyleEnums::SP_QgnGrafScrollArrowUp : + QS60StyleEnums::SP_QgnGrafScrollArrowDown; + const int adjustment = qMin(optionSpinBox.rect.width(), optionSpinBox.rect.height())/6; + optionSpinBox.rect.translate(0, (element == PE_IndicatorSpinDown) ? adjustment : -adjustment ); + QS60StylePrivate::drawSkinPart(part, painter, optionSpinBox.rect,flags); + } else { + QCommonStyle::drawPrimitive(element, &optionSpinBox, painter, widget); + } } #ifndef QT_NO_COMBOBOX else if (const QStyleOptionFrame *cmb = qstyleoption_cast(option)) { - // We want to draw down arrow here for comboboxes as well. - const QS60StyleEnums::SkinParts part = QS60StyleEnums::SP_QgnGrafScrollArrowDown; - QStyleOptionFrame comboBox = *cmb; - const int adjustment = qMin(comboBox.rect.width(), comboBox.rect.height())/6; - comboBox.rect.translate(0, (element == PE_IndicatorSpinDown) ? adjustment : -adjustment ); - QS60StylePrivate::drawSkinPart(part, painter, comboBox.rect,flags); + if (cmb->palette.base().color()==Qt::transparent) { + // We want to draw down arrow here for comboboxes as well. + const QS60StyleEnums::SkinParts part = QS60StyleEnums::SP_QgnGrafScrollArrowDown; + QStyleOptionFrame comboBox = *cmb; + const int adjustment = qMin(comboBox.rect.width(), comboBox.rect.height())/6; + comboBox.rect.translate(0, (element == PE_IndicatorSpinDown) ? adjustment : -adjustment ); + QS60StylePrivate::drawSkinPart(part, painter, comboBox.rect,flags); + } else { + QCommonStyle::drawPrimitive(element, cmb, painter, widget); + } } #endif //QT_NO_COMBOBOX break; @@ -2057,8 +2090,12 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti || qobject_cast (widget) #endif //QT_NO_MENU ) { - QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_OptionsMenu; - QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); + if (option->palette.base().color()==Qt::transparent) { + QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_OptionsMenu; + QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); + } else { + QCommonStyle::drawPrimitive(element, option, painter, widget); + } } break; case PE_FrameWindow: @@ -2145,7 +2182,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti drawSkinPart = true; } - if ( drawSkinPart ) + if (drawSkinPart) QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, flags); if (option->state & State_Children) { @@ -2890,7 +2927,7 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, return QCommonStyle::standardIconImplementation(standardIcon, option, widget); } const QS60StylePrivate::SkinElementFlags flags = adjustedFlags; - const QPixmap cachedPixMap(QS60StylePrivate::cachedPart(part, iconSize.size(), flags)); + const QPixmap cachedPixMap(QS60StylePrivate::cachedPart(part, iconSize.size(), 0, flags)); return cachedPixMap.isNull() ? QCommonStyle::standardIconImplementation(standardIcon, option, widget) : QIcon(cachedPixMap); } diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 8e53eee..54af757 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -372,7 +372,7 @@ public: SF_StateEnabled = 0x0010, // Enabled = the default SF_StateDisabled = 0x0020, - SF_ColorSkinned = 0x0040, + SF_ColorSkinned = 0x0040, // pixmap is colored with foreground pen color }; enum CacheClearReason { @@ -472,7 +472,7 @@ private: const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); static QPixmap cachedPart(QS60StyleEnums::SkinParts part, const QSize &size, - SkinElementFlags flags = KDefaultSkinElementFlags); + QPainter *painter, SkinElementFlags flags = KDefaultSkinElementFlags); static QPixmap cachedFrame(SkinFrameElements frame, const QSize &size, SkinElementFlags flags = KDefaultSkinElementFlags); @@ -489,7 +489,7 @@ private: static QSize partSize(QS60StyleEnums::SkinParts part, SkinElementFlags flags = KDefaultSkinElementFlags); static QPixmap part(QS60StyleEnums::SkinParts part, const QSize &size, - SkinElementFlags flags = KDefaultSkinElementFlags); + QPainter *painter, SkinElementFlags flags = KDefaultSkinElementFlags); static QFont s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize); diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 9765066..678844c 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -99,7 +99,7 @@ public: const QSize &size, QS60StylePrivate::SkinElementFlags flags); static QPixmap skinnedGraphics(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags); static QPixmap colorSkinnedGraphics(const QS60StyleEnums::SkinParts &stylepart, - const QSize &size, QS60StylePrivate::SkinElementFlags flags); + const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags); static QColor colorValue(const TAknsItemID &colorGroup, int colorIndex); static QPixmap fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, QImage::Format format); static bool disabledPartGraphic(QS60StyleEnums::SkinParts &part); @@ -112,14 +112,12 @@ private: const QSize &size, QS60StylePrivate::SkinElementFlags flags); static QPixmap createSkinnedGraphicsLX(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags); static QPixmap colorSkinnedGraphicsLX(const QS60StyleEnums::SkinParts &stylepart, - const QSize &size, QS60StylePrivate::SkinElementFlags flags); + const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags); static void frameIdAndCenterId(QS60StylePrivate::SkinFrameElements frameElement, TAknsItemID &frameId, TAknsItemID ¢erId); static TRect innerRectFromElement(QS60StylePrivate::SkinFrameElements frameElement, const TRect &outerRect); static void checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBitmap); static void checkAndUnCompressBitmap(CFbsBitmap*& aOriginalBitmap); static void unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap* aTrgBitmap, CFbsBitmap* aSrcBitmap); - static void colorGroupAndIndex(QS60StyleEnums::SkinParts skinID, - TAknsItemID &colorGroup, int &colorIndex); static void fallbackInfo(const QS60StyleEnums::SkinParts &stylepart, TDes& fallbackFileName, TInt& fallbackIndex); static bool checkSupport(const int supportedRelease); static TAknsItemID checkAndUpdateReleaseSpecificGraphics(int part); @@ -361,11 +359,11 @@ QPixmap QS60StyleModeSpecifics::skinnedGraphics( } QPixmap QS60StyleModeSpecifics::colorSkinnedGraphics( - const QS60StyleEnums::SkinParts &stylepart, - const QSize &size, QS60StylePrivate::SkinElementFlags flags) + const QS60StyleEnums::SkinParts &stylepart, const QSize &size, QPainter *painter, + QS60StylePrivate::SkinElementFlags flags) { QPixmap colorGraphics; - TRAPD(error, QT_TRYCATCH_LEAVING(colorGraphics = colorSkinnedGraphicsLX(stylepart, size, flags))); + TRAPD(error, QT_TRYCATCH_LEAVING(colorGraphics = colorSkinnedGraphicsLX(stylepart, size, painter, flags))); return error ? QPixmap() : colorGraphics; } @@ -525,7 +523,7 @@ void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &style QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX( const QS60StyleEnums::SkinParts &stylepart, - const QSize &size, QS60StylePrivate::SkinElementFlags flags) + const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags) { // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts. const int stylepartIndex = (int)stylepart; @@ -537,8 +535,13 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX( fallbackInfo(stylepart, fileNamePtr, fallbackGraphicID); TAknsItemID colorGroup = KAknsIIDQsnIconColors; - int colorIndex = 0; - colorGroupAndIndex(stylepart, colorGroup, colorIndex); + TRgb defaultColor = KRgbBlack; + int colorIndex = -1; //set a bogus value to color index to ensure that painter color is used + //to color the icon + if (painter) { + QRgb widgetColor = painter->pen().color().rgb(); + defaultColor = TRgb(qRed(widgetColor), qGreen(widgetColor), qBlue(widgetColor)); + } const bool rotatedBy90or270 = (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest)); @@ -550,7 +553,7 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX( fallbackGraphicID == KErrNotFound?KErrNotFound:fallbackGraphicID+1; //masks are auto-generated as next in mif files MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); AknsUtils::CreateColorIconLC( - skinInstance, skinId, colorGroup, colorIndex, icon, iconMask, fileNamePtr, fallbackGraphicID , fallbackGraphicsMaskID, KRgbBlack); + skinInstance, skinId, colorGroup, colorIndex, icon, iconMask, fileNamePtr, fallbackGraphicID , fallbackGraphicsMaskID, defaultColor); User::LeaveIfError(AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved)); User::LeaveIfError(AknIconUtils::SetSize(iconMask, targetSize, EAspectRatioNotPreserved)); QPixmap result = fromFbsBitmap(icon, iconMask, flags, qt_TDisplayMode2Format(icon->DisplayMode())); @@ -652,8 +655,8 @@ QPoint qt_s60_fill_background_offset(const QWidget *targetWidget) } QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX( - QS60StyleEnums::SkinParts part, - const QSize &size, QS60StylePrivate::SkinElementFlags flags) + QS60StyleEnums::SkinParts part, const QSize &size, + QS60StylePrivate::SkinElementFlags flags) { // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts. if (!size.isValid()) @@ -700,13 +703,13 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX( CleanupStack::PushL(background); User::LeaveIfError(background->Create(targetSize, EColor16MA)); - CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(background); + CFbsBitmapDevice *dev = CFbsBitmapDevice::NewL(background); CleanupStack::PushL(dev); - CFbsBitGc* gc = NULL; + CFbsBitGc *gc = NULL; User::LeaveIfError(dev->CreateContext(gc)); CleanupStack::PushL(gc); - CAknsBasicBackgroundControlContext* bgContext = CAknsBasicBackgroundControlContext::NewL( + CAknsBasicBackgroundControlContext *bgContext = CAknsBasicBackgroundControlContext::NewL( skinId, targetSize, EFalse); @@ -1145,12 +1148,12 @@ QPixmap QS60StyleModeSpecifics::generateMissingThemeGraphic(QS60StyleEnums::Skin } QPixmap QS60StylePrivate::part(QS60StyleEnums::SkinParts part, - const QSize &size, SkinElementFlags flags) + const QSize &size, QPainter *painter, SkinElementFlags flags) { QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); QPixmap result = (flags & SF_ColorSkinned)? - QS60StyleModeSpecifics::colorSkinnedGraphics(part, size, flags) + QS60StyleModeSpecifics::colorSkinnedGraphics(part, size, painter, flags) : QS60StyleModeSpecifics::skinnedGraphics(part, size, flags); lock.relock(); @@ -1189,7 +1192,7 @@ QPixmap QS60StylePrivate::backgroundTexture() { if (!m_background) { QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, - QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), SkinElementFlags()); + QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), 0, SkinElementFlags()); m_background = new QPixmap(background); } return *m_background; @@ -1343,26 +1346,6 @@ QSize QS60StylePrivate::screenSize() return QSize(screenSize.iWidth, screenSize.iHeight); } -void QS60StyleModeSpecifics::colorGroupAndIndex( - QS60StyleEnums::SkinParts skinID, TAknsItemID &colorGroup, int &colorIndex) -{ - switch(skinID) { - case QS60StyleEnums::SP_QgnIndiSubMenu: - colorGroup = KAknsIIDQsnIconColors; - colorIndex = EAknsCIQsnIconColorsCG1; - break; - case QS60StyleEnums::SP_QgnIndiRadiobuttOff: - case QS60StyleEnums::SP_QgnIndiRadiobuttOn: - case QS60StyleEnums::SP_QgnIndiCheckboxOff: - case QS60StyleEnums::SP_QgnIndiCheckboxOn: - colorGroup = KAknsIIDQsnIconColors; - colorIndex = EAknsCIQsnIconColorsCG14; - break; - default: - break; - } -} - QS60Style::QS60Style() : QCommonStyle(*new QS60StylePrivate) { diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index 8a2616d..14f0424 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -189,8 +189,10 @@ QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list, } QPixmap QS60StylePrivate::part(QS60StyleEnums::SkinParts part, const QSize &size, - QS60StylePrivate::SkinElementFlags flags) + QPainter *painter, QS60StylePrivate::SkinElementFlags flags) { + Q_UNUSED(painter); + const QString partKey = QS60Style::partKeys().at(part); const QPicture partPicture = QS60StyleModeSpecifics::m_partPictures.value(partKey); QSize partSize(partPicture.boundingRect().size()); -- cgit v0.12