diff options
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 13 | ||||
-rw-r--r-- | src/gui/dialogs/qmessagebox.cpp | 14 | ||||
-rw-r--r-- | src/gui/styles/qs60style.cpp | 42 | ||||
-rw-r--r-- | src/gui/styles/qs60style.h | 3 | ||||
-rw-r--r-- | src/gui/styles/qs60style_p.h | 6 | ||||
-rw-r--r-- | src/gui/styles/qs60style_s60.cpp | 16 | ||||
-rw-r--r-- | util/s60pixelmetrics/pixel_metrics.cpp | 11 | ||||
-rw-r--r-- | util/s60pixelmetrics/pixel_metrics.h | 4 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapperapp.cpp | 9 |
9 files changed, 82 insertions, 36 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 191be6c..ca44264 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -50,6 +50,13 @@ QT_BEGIN_NAMESPACE +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS +// when the system UI is Qt based, priority drop is not needed as CPU starved processes will not be killed. +#undef QT_SYMBIAN_PRIORITY_DROP +#else +#define QT_SYMBIAN_PRIORITY_DROP +#endif + #define WAKE_UP_PRIORITY CActive::EPriorityStandard #define TIMER_PRIORITY CActive::EPriorityHigh #define NULLTIMER_PRIORITY CActive::EPriorityLow @@ -697,6 +704,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla bool handledSymbianEvent = false; m_interrupt = false; +#ifdef QT_SYMBIAN_PRIORITY_DROP /* * This QTime variable is used to measure the time it takes to finish * the event loop. If we take too long in the loop, other processes @@ -714,6 +722,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla } timeState = FirstRun; TProcessPriority priority; +#endif while (1) { if (block) { @@ -727,10 +736,12 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla CActiveScheduler::Current()->WaitForAnyRequest(); } +#ifdef QT_SYMBIAN_PRIORITY_DROP if (timeState == SubsequentRun) { time.start(); timeState = TimeStarted; } +#endif TInt error; handledSymbianEvent = CActiveScheduler::RunIfReady(error, KMinTInt); @@ -747,6 +758,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla break; } block = false; +#ifdef QT_SYMBIAN_PRIORITY_DROP if (timeState == TimeStarted && time.elapsed() > 100) { priority = m_processHandle.Priority(); m_processHandle.SetPriority(EPriorityBackground); @@ -759,6 +771,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla } if (timeState == FirstRun) timeState = SubsequentRun; +#endif }; emit awake(); diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index bd2df9c..ccc925c 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -65,6 +65,10 @@ #include <QtGui/qfontmetrics.h> #include <QtGui/qclipboard.h> +#ifndef QT_NO_STYLE_S60 +#include <qs60style.h> +#endif + #ifdef Q_WS_WINCE extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp extern bool qt_wince_is_smartphone();//defined in qguifunctions_wince.cpp @@ -353,6 +357,16 @@ void QMessageBoxPrivate::updateSize() int height = (layout->hasHeightForWidth()) ? layout->totalHeightForWidth(width) : layout->totalMinimumSize().height(); + +#ifndef QT_NO_STYLE_S60 + QS60Style *s60Style = 0; + s60Style = qobject_cast<QS60Style *>(QApplication::style()); + + //use custom pixel metric to deduce the minimum height of the messagebox + if (s60Style) + height = qMax(height, s60Style->pixelMetric((QStyle::PixelMetric)PM_MessageBoxHeight)); +#endif + q->setFixedSize(width, height); QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest); } diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index af37e6e..65191a4 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -50,6 +50,7 @@ #include "qcalendarwidget.h" #include "qdial.h" #include "qdialog.h" +#include "qmessagebox.h" #include "qgroupbox.h" #include "qheaderview.h" #include "qlist.h" @@ -91,10 +92,10 @@ static const qreal goldenRatio = 1.618; const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** -{240,320,1,16,"QVGA Landscape"}, -{320,240,1,16,"QVGA Portrait"}, -{360,640,1,16,"NHD Landscape"}, -{640,360,1,16,"NHD Portrait"}, +{240,320,1,17,"QVGA Landscape"}, +{320,240,1,17,"QVGA Portrait"}, +{360,640,1,17,"NHD Landscape"}, +{640,360,1,17,"NHD Portrait"}, {352,800,1,12,"E90 Landscape"} // *** End of generated data *** }; @@ -103,11 +104,11 @@ const int QS60StylePrivate::m_numberOfLayouts = const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** -{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,0,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,4,4,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,0,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,3,3,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,0,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,13,13,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,0,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,12,12,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,0,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,0,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,4,4,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, 106}, +{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,0,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,3,3,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, 106}, +{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,0,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,13,13,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, 135}, +{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,0,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,12,12,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, 135}, +{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,0,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, 106} // *** End of generated data *** }; @@ -126,7 +127,7 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme {SE_ButtonPressed, QS60StyleEnums::SP_QsnFrButtonTbCenterPressed}, {SE_FrameLineEdit, QS60StyleEnums::SP_QsnFrInputCenter}, {SE_ListHighlight, QS60StyleEnums::SP_QsnFrListCenter}, - {SE_OptionsMenu, QS60StyleEnums::SP_QsnFrPopupCenter}, + {SE_PopupBackground, QS60StyleEnums::SP_QsnFrPopupCenter}, {SE_SettingsList, QS60StyleEnums::SP_QsnFrSetOptCenter}, {SE_TableItem, QS60StyleEnums::SP_QsnFrCaleCenter}, {SE_TableHeaderItem, QS60StyleEnums::SP_QsnFrCaleHeadingCenter}, @@ -249,8 +250,8 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, case SE_ListHighlight: drawFrame(SF_ListHighlight, painter, rect, flags | SF_PointNorth); break; - case SE_OptionsMenu: - drawFrame(SF_OptionsMenu, painter, rect, flags | SF_PointNorth); + case SE_PopupBackground: + drawFrame(SF_PopupBackground, painter, rect, flags | SF_PointNorth); break; case SE_SettingsList: drawFrame(SF_SettingsList, painter, rect, flags | SF_PointNorth); @@ -636,6 +637,8 @@ void QS60StylePrivate::setFont(QWidget *widget) const fontCategory = QS60StyleEnums::FC_Secondary; } else if (qobject_cast<QGroupBox *>(widget)){ fontCategory = QS60StyleEnums::FC_Title; + } else if (qobject_cast<QMessageBox *>(widget)){ + fontCategory = QS60StyleEnums::FC_Primary; } if (fontCategory != QS60StyleEnums::FC_Undefined) { const bool resolveFontSize = widget->testAttribute(Qt::WA_SetFont) @@ -2215,7 +2218,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget) && option->palette.window().texture().cacheKey() == QS60StylePrivate::m_themePalette->window().texture().cacheKey()) - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_OptionsMenu, painter, option->rect, flags); + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PopupBackground, painter, option->rect, flags); else commonStyleDraws = true; } @@ -2386,13 +2389,6 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const if (metricValue == KNotFound) metricValue = QCommonStyle::pixelMetric(metric, option, widget); - if (metric == PM_SubMenuOverlap && widget) { - const QMenu *menu = qobject_cast<const QMenu *>(widget); - if (menu && menu->activeAction() && menu->activeAction()->menu()) { - const int menuWidth = menu->activeAction()->menu()->sizeHint().width(); - metricValue = -menuWidth; - } - } //if layout direction is mirrored, switch left and right border margins if (option && option->direction == Qt::RightToLeft) { if (metric == PM_LayoutLeftMargin) @@ -2400,6 +2396,12 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const else if (metric == PM_LayoutRightMargin) metricValue = QS60StylePrivate::pixelMetric(PM_LayoutLeftMargin); } + + if (widget && (metric == PM_LayoutTopMargin)) + if (widget->windowType() == Qt::Dialog) + //double the top layout margin for dialogs, it is very close to real value + //without having to define custom pixel metric + metricValue *= 2; return metricValue; } diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index af17843..c878538 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -58,7 +58,8 @@ enum { PM_FrameCornerWidth = QStyle::PM_CustomBase + 1, PM_FrameCornerHeight, PM_BoldLineWidth, - PM_ThinLineWidth + PM_ThinLineWidth, + PM_MessageBoxHeight }; class QS60StylePrivate; diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 8bb2f7b..6ce4960 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE const int MAX_NON_CUSTOM_PIXELMETRICS = 92; -const int CUSTOMVALUESCOUNT = 4; +const int CUSTOMVALUESCOUNT = 5; const int MAX_PIXELMETRICS = MAX_NON_CUSTOM_PIXELMETRICS + CUSTOMVALUESCOUNT; @@ -411,7 +411,7 @@ public: SE_TabBarTabWestActive, SE_TabBarTabWestInactive, SE_ListHighlight, - SE_OptionsMenu, + SE_PopupBackground, SE_SettingsList, SE_TableItem, SE_TableHeaderItem, @@ -432,7 +432,7 @@ public: SF_ButtonPressed, SF_FrameLineEdit, SF_ListHighlight, - SF_OptionsMenu, + SF_PopupBackground, SF_SettingsList, SF_TableItem, SF_TableHeaderItem, diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 75ed0c7..1138d20 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -983,16 +983,20 @@ TRect QS60StyleModeSpecifics::innerRectFromElement(QS60StylePrivate::SkinFrameEl switch(frameElement) { case QS60StylePrivate::SF_PanelBackground: // panel should have slightly slimmer border to enable thin line of background graphics between closest component - widthShrink = widthShrink-2; - heightShrink = heightShrink-2; + widthShrink = widthShrink - 2; + heightShrink = heightShrink - 2; break; case QS60StylePrivate::SF_ToolTip: - widthShrink = widthShrink>>1; - heightShrink = heightShrink>>1; + widthShrink = widthShrink >> 1; + heightShrink = heightShrink >> 1; break; case QS60StylePrivate::SF_ListHighlight: - widthShrink = widthShrink-2; - heightShrink = heightShrink-2; + widthShrink = widthShrink - 2; + heightShrink = heightShrink - 2; + break; + case QS60StylePrivate::SF_PopupBackground: + widthShrink = widthShrink + 5; + heightShrink = heightShrink + 5; break; default: break; diff --git a/util/s60pixelmetrics/pixel_metrics.cpp b/util/s60pixelmetrics/pixel_metrics.cpp index beb785e..814e185 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 = 16; +const TInt KPMMinorVersion = 17; TPixelMetricsVersion PixelMetrics::Version() { @@ -869,7 +869,7 @@ TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric) // The difference of center piece from border tell the frame width. if ( value == QStyle::PM_FocusFrameHMargin) { - //use topleft for horizontal as S60 uses different values for right and left borders + //use topleft for horizontal as S60 uses different values for right and left borders value = listSinglePaneText.TextRect().iTl.iX - highlightRect.Rect().iTl.iX; } else @@ -1003,6 +1003,13 @@ TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric) case QStyle::PM_Custom_ThinLineWidth: value = 1; break; + case QStyle::PM_Custom_MessageBoxHeight: + { + TAknLayoutRect popupRect; + popupRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::popup_window_general(0)); + value = popupRect.Rect().Height(); + } + break; case QStyle::PM_ButtonShiftHorizontal: case QStyle::PM_ButtonShiftVertical: value = 0; diff --git a/util/s60pixelmetrics/pixel_metrics.h b/util/s60pixelmetrics/pixel_metrics.h index 3536c0e..4b0f57e 100644 --- a/util/s60pixelmetrics/pixel_metrics.h +++ b/util/s60pixelmetrics/pixel_metrics.h @@ -185,7 +185,9 @@ NONSHARABLE_CLASS( QStyle ) // Bold line width PM_Custom_BoldLineWidth, // Thin line width - PM_Custom_ThinLineWidth + PM_Custom_ThinLineWidth, + // Height of a popup info messagebox + PM_Custom_MessageBoxHeight }; }; diff --git a/util/s60pixelmetrics/pm_mapperapp.cpp b/util/s60pixelmetrics/pm_mapperapp.cpp index acc6137..a88499d 100644 --- a/util/s60pixelmetrics/pm_mapperapp.cpp +++ b/util/s60pixelmetrics/pm_mapperapp.cpp @@ -155,7 +155,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) Exit(); break; case ECmdSwitchOutput: - { + { HBufC* buffer = HBufC::NewLC( 100 ); TPtr bufferPtr = buffer->Des(); TBool last = ETrue; @@ -166,7 +166,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) else bufferPtr.Append(_L("screen.")); ShowL( *buffer, last ); - } + } break; case ECmdStatus: { @@ -323,7 +323,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) TInt myValue = KErrNotFound; for (;;) { - if (index==QStyle::PM_Custom_ThinLineWidth) + if (index==QStyle::PM_Custom_MessageBoxHeight) { last = ETrue; } @@ -656,6 +656,9 @@ void CPixelMetricsMapperAppUi::ShowSingleValueL(TInt& aPixelMetric, TInt& aValue case QStyle::PM_Custom_BoldLineWidth: bufferPtr.Append(_L("C_BoldLineWidth: ")); break; + case QStyle::PM_Custom_MessageBoxHeight: + bufferPtr.Append(_L("C_MsgBoxHeight: ")); + break; default: bufferPtr.Append(_L("Default: ")); break; |