From 76d46a2deedc69108cefce811e8dc6a65f9151e6 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Fri, 24 Apr 2009 16:13:56 +0200 Subject: Fix background painting. This is a reverted patch that has been rebased on to another branch and then caused conflicts so it might contain an error or two. Basically we need to store the background texture from the style into the palette so that it can be replaced by applications that don't want it. --- src/gui/kernel/qwidget.cpp | 12 +++++------- src/gui/styles/qs60style.cpp | 24 +----------------------- src/gui/styles/qs60style_symbian.cpp | 32 ++++++++++++++++++++------------ 3 files changed, 26 insertions(+), 42 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 7eaebbb..9015182 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -2038,19 +2038,17 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QPoin // Defined in qmacstyle_mac.cpp extern void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, const QBrush &brush); qt_mac_fill_background(painter, rgn, offset, brush); +#elif defined(Q_WS_S60) + // Defined in qs60style_symbian.cpp + extern void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, + const QPoint &offset, const QBrush &brush); + qt_s60_fill_background(painter, rgn, offset, brush); #else const QRegion translated = rgn.translated(offset); const QRect rect(translated.boundingRect()); painter->setClipRegion(translated); painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft()); #endif -#if defined(Q_WS_S60) && !defined(QT_NO_STYLE_S60) - } if (!brush.isOpaque()) { - // QS60Style knows it's background and does not store its texture in a palette - // Defined in qs60style.cpp - extern void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset); - qt_s60_fill_background(painter, rgn, offset); -#endif } else { const QVector &rects = rgn.rects(); for (int i = 0; i < rects.size(); ++i) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 58dcb98..65ce104 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -485,7 +485,7 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) const QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 2, 0)); // set these as transparent so that styled full screen theme background is visible widgetPalette.setColor(QPalette::AlternateBase, Qt::transparent); - widgetPalette.setColor(QPalette::Window, Qt::transparent); + widgetPalette.setColor(QPalette::Window, QS60StylePrivate::backgroundTexture()); widgetPalette.setColor(QPalette::Base, Qt::transparent); // set button and tooltipbase based on pixel colors QColor buttonColor = colorFromFrameGraphics(QS60StylePrivate::SF_ButtonNormal); @@ -530,17 +530,6 @@ void QS60Style::polish(QWidget *widget) Q_D(const QS60Style); QCommonStyle::polish(widget); - if (QAbstractScrollArea *scrollArea = qobject_cast(widget)){ - scrollArea->viewport()->setAutoFillBackground(false); - } - - if (false -#ifndef QT_NO_SCROLLBAR - || qobject_cast(widget) -#endif - ) { - widget->setAttribute(Qt::WA_OpaquePaintEvent, false); - } if (QS60StylePrivate::isSkinnableDialog(widget)) { widget->setAttribute(Qt::WA_StyledBackground); } else if (false @@ -565,17 +554,6 @@ void QS60Style::polish(QWidget *widget) void QS60Style::unpolish(QWidget *widget) { - if (QAbstractScrollArea *scrollArea = qobject_cast(widget)){ - scrollArea->viewport()->setAutoFillBackground(true); - } - - if (false -#ifndef QT_NO_SCROLLBAR - || qobject_cast(widget) -#endif - ) { - widget->setAttribute(Qt::WA_OpaquePaintEvent); - } if (QS60StylePrivate::isSkinnableDialog(widget)) { widget->setAttribute(Qt::WA_StyledBackground, false); } else if (false diff --git a/src/gui/styles/qs60style_symbian.cpp b/src/gui/styles/qs60style_symbian.cpp index a1e7800..083e3b9 100644 --- a/src/gui/styles/qs60style_symbian.cpp +++ b/src/gui/styles/qs60style_symbian.cpp @@ -372,21 +372,29 @@ bool QS60StylePrivate::isTouchSupported() return bool(AknLayoutUtils::PenEnabled()); } -void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset) +void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, + const QBrush &brush) { const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture()); - const QPaintDevice *target = painter->device(); - if (target->devType() == QInternal::Widget) { - const QWidget *widget = static_cast(target); - const CCoeControl *control = widget->effectiveWinId(); - const TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0); - const QRegion translated = rgn.translated(offset); - const QVector &rects = translated.rects(); - for (int i = 0; i < rects.size(); ++i) { - const QRect rect(rects.at(i)); - painter->drawPixmap(rect.topLeft(), backgroundTexture, - rect.translated(globalPos.iX, globalPos.iY)); + if (backgroundTexture.cacheKey() == brush.texture().cacheKey()) { + const QPaintDevice *target = painter->device(); + if (target->devType() == QInternal::Widget) { + const QWidget *widget = static_cast(target); + CCoeControl *control = widget->effectiveWinId(); + TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0); + const QRegion translated = rgn.translated(offset); + const QVector &rects = translated.rects(); + for (int i = 0; i < rects.size(); ++i) { + const QRect rect(rects.at(i)); + painter->drawPixmap(rect.topLeft(), backgroundTexture, + rect.translated(globalPos.iX, globalPos.iY)); + } } + } else { + const QRegion translated = rgn.translated(offset); + const QRect rect(translated.boundingRect()); + painter->setClipRegion(translated); + painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft()); } } -- cgit v0.12 From 20a0448cfe6e683e8bc66d3bd62a0981067602f9 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 1 Apr 2009 15:43:57 +0200 Subject: We previously had some hacks in this function to avoid creating a backing store with the ARGB32 format (which is slower to draw on), but we actually want this in some cases so let's do this properly and move the hacks somewhere else. --- src/gui/kernel/qt_s60_p.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 6261e4b..35755c3 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -227,12 +227,14 @@ static inline QImage::Format qt_TDisplayMode2Format(TDisplayMode mode) format = QImage::Format_RGB666; break; case EColor16MU: - case EColor16MA: format = QImage::Format_RGB32; break; + case EColor16MA: + format = QImage::Format_ARGB32; + break; #ifdef __S60_50__ case EColor16MAP: - format = QImage::Format_ARGB32; + format = QImage::Format_ARGB32_Premultiplied; break; #endif default: -- cgit v0.12 From c4e2008731cd7c9df922921c52294f84205fccb9 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 15 Apr 2009 14:12:20 +0200 Subject: Fixes: Add support for translucent windows in Symbian. Warning, this is completely untested! Details: This should (in theory) get translucent windows working but this hasn't been tested yet. The emulator environment seems to return only 16ColorMU display modes which implies the window is opague so Qt ignores the translucent flag. HW seems to create 16ColorMA windows, but it hasn't been tested there yet either (no time). --- src/gui/kernel/qapplication_s60.cpp | 4 +++- src/gui/kernel/qwidget.cpp | 6 ++++++ src/gui/kernel/qwidget.h | 1 + src/gui/kernel/qwidget_p.h | 4 ++++ src/gui/kernel/qwidget_s60.cpp | 34 ++++++++++++++++++++++++++++++++- src/gui/painting/qwindowsurface_s60.cpp | 11 ++++++++++- 6 files changed, 57 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index c7bbcdb..e1155ad 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -540,7 +540,9 @@ void QSymbianControl::Draw(const TRect& r) const if (engine->type() == QPaintEngine::Raster) { QS60WindowSurface *s60Surface = static_cast(qwidget->windowSurface()); CFbsBitmap *bitmap = s60Surface->symbianBitmap(); - SystemGc().BitBlt(r.iTl, bitmap, r); + CWindowGc &gc = SystemGc(); + gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); + gc.BitBlt(r.iTl, bitmap, r); } else { surface->flush(qwidget, QRegion(qt_TRect2QRect(r)), QPoint()); } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 9015182..f5deb96 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1991,6 +1991,9 @@ void QWidgetPrivate::setOpaque(bool opaque) #ifdef Q_WS_WIN winUpdateIsOpaque(); #endif +#ifdef Q_WS_S60 + s60UpdateIsOpaque(); +#endif } void QWidgetPrivate::updateIsTranslucent() @@ -2004,6 +2007,9 @@ void QWidgetPrivate::updateIsTranslucent() #ifdef Q_WS_WIN winUpdateIsOpaque(); #endif +#ifdef Q_WS_S60 + s60UpdateIsOpaque(); +#endif } /*! diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 8ecf758..2b584eb 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -746,6 +746,7 @@ private: #endif #ifdef Q_WS_S60 friend class QSymbianControl; + friend class QS60WindowSurface; #endif #ifdef Q_WS_X11 friend void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp); diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index ec64b6e..19f4b98 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -270,6 +270,10 @@ public: void applyMaxAndMinSizeConstraints(int &w, int &h); #endif +#ifdef Q_WS_S60 + void s60UpdateIsOpaque(); +#endif + void raise_sys(); void lower_sys(); void stackUnder_sys(QWidget *); diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index ec80a18..20325c2 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -202,8 +202,15 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO topExtra->rwindow->PointerFilter(EPointerFilterEnterExit | EPointerFilterMove | EPointerFilterDrag, 0); topExtra->rwindow->EnableVisibilityChangeEvents(); + + if (q->testAttribute(Qt::WA_TranslucentBackground)) { + RWindow *rwindow = static_cast(topExtra->rwindow); + TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA); + int erro = rwindow->SetTransparencyAlphaChannel(); + } } + id = (WId)control; setWinId(id); @@ -429,6 +436,29 @@ void QWidgetPrivate::setConstraints_sys() } + +void QWidgetPrivate::s60UpdateIsOpaque() +{ + Q_Q(QWidget); + + if (!q->testAttribute(Qt::WA_WState_Created) || !q->testAttribute(Qt::WA_TranslucentBackground)) + return; + + if ((data.window_flags & Qt::FramelessWindowHint) == 0) + return; + + if (!isOpaque) { + QTLWExtra *topExtra = topData(); + RWindow *rwindow = static_cast(topExtra->rwindow); + TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA); + int erro = rwindow->SetTransparencyAlphaChannel(); + } else { + QTLWExtra *topExtra = topData(); + RWindow *rwindow = static_cast(topExtra->rwindow); + rwindow->SetTransparentRegion(TRegionFix<1>()); + } +} + CFbsBitmap* qt_pixmapToNativeBitmapL(QPixmap pixmap, bool invert) { CFbsBitmap* fbsBitmap = new(ELeave)CFbsBitmap; @@ -576,7 +606,9 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r) */ void QWidgetPrivate::setWindowOpacity_sys(qreal level) { - + RWindow* rw = static_cast(topData()->rwindow); + if (rw) + rw->SetTransparencyFactor(TRgb::Gray256(255.0 * level)); } void QWidgetPrivate::updateFrameStrut() diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index b262cb2..d0c3e1c 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -12,7 +12,7 @@ #include // for Q_WS_WIN define (non-PCH) #include -#include +#include #include "qwindowsurface_s60_p.h" #include "qt_s60_p.h" @@ -143,6 +143,15 @@ void QS60WindowSurface::lockBitmapHeap() // Get some values for QImage creation TDisplayMode mode = bitmap->DisplayMode(); + QWidget *win = QS60WindowSurfacePrivate::lockedSurface->window(); + RWindowBase *rwin = win->winId()->DrawableWindow(); + TDisplayMode rwMode = rwin->DisplayMode(); + + mode = rwMode; + + if (mode == EColor16MA + && qt_widget_private(QS60WindowSurfacePrivate::lockedSurface->window())->isOpaque) + mode = EColor16MU; QImage::Format format = qt_TDisplayMode2Format( mode ); TSize bitmapSize = bitmap->SizeInPixels(); int bytesPerLine = CFbsBitmap::ScanLineLength( bitmapSize.iWidth, mode); -- cgit v0.12 From 6143217a8594c40d693e4ffceb914bc927f43b05 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Fri, 24 Apr 2009 11:58:44 +0200 Subject: More work on translucent windows. One step closer to semi-transparent windows, but not there yet. This gets the transparent contents into the window, but the previous contents are not cleared so it keeps drawing the backing store on top of itself each time a Draw() is done. SetBackgroundColor() indicates to WSERV that our window is semi-transparent. We also make sure not to use 'EDrawModeWriteAlpha' when the widget is non-opaque since this actually changes the alpha channel on the frame buffer (not the window) so the gives undesired results. It's a faster draw mode though so we should use it where we can. --- src/gui/kernel/qapplication_s60.cpp | 3 ++- src/gui/kernel/qwidget_s60.cpp | 6 ++++-- src/gui/painting/qwindowsurface_s60.cpp | 17 ++++++++--------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index e1155ad..06e47a7 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -541,7 +541,8 @@ void QSymbianControl::Draw(const TRect& r) const QS60WindowSurface *s60Surface = static_cast(qwidget->windowSurface()); CFbsBitmap *bitmap = s60Surface->symbianBitmap(); CWindowGc &gc = SystemGc(); - gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); + if (qwidget->d_func()->isOpaque) + gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); gc.BitBlt(r.iTl, bitmap, r); } else { surface->flush(qwidget, QRegion(qt_TRect2QRect(r)), QPoint()); diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 20325c2..f78b5be 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -206,7 +206,8 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO if (q->testAttribute(Qt::WA_TranslucentBackground)) { RWindow *rwindow = static_cast(topExtra->rwindow); TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA); - int erro = rwindow->SetTransparencyAlphaChannel(); + if (rwindow->SetTransparencyAlphaChannel() == KErrNone) + rwindow->SetBackgroundColor(~0); } } @@ -451,7 +452,8 @@ void QWidgetPrivate::s60UpdateIsOpaque() QTLWExtra *topExtra = topData(); RWindow *rwindow = static_cast(topExtra->rwindow); TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA); - int erro = rwindow->SetTransparencyAlphaChannel(); + if (rwindow->SetTransparencyAlphaChannel() == KErrNone) + rwindow->SetBackgroundColor(~0); } else { QTLWExtra *topExtra = topData(); RWindow *rwindow = static_cast(topExtra->rwindow); diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index d0c3e1c..50278ce 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -35,12 +35,17 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget) d_ptr->bytes = 0; d_ptr->bitmap = 0; - TSize size(0, 0); TDisplayMode mode = S60->screenDevice()->DisplayMode(); + bool isOpaque = qt_widget_private(widget)->isOpaque; + if (mode == EColor16MA && isOpaque) + mode = EColor16MU; // Faster since 16MU -> 16MA is typically accelerated + else if (mode == EColor16MU && !isOpaque) + mode = EColor16MA; // Try for transparency anyway - // We create empty CFbsBitmap here -> it will be resized in setGeometry + + // We create empty CFbsBitmap here -> it will be resized in setGeometry d_ptr->bitmap = new (ELeave) CFbsBitmap; - User::LeaveIfError( d_ptr->bitmap->Create( size, mode ) ); + User::LeaveIfError( d_ptr->bitmap->Create(TSize(0, 0), mode ) ); updatePaintDeviceOnBitmap(); @@ -143,12 +148,6 @@ void QS60WindowSurface::lockBitmapHeap() // Get some values for QImage creation TDisplayMode mode = bitmap->DisplayMode(); - QWidget *win = QS60WindowSurfacePrivate::lockedSurface->window(); - RWindowBase *rwin = win->winId()->DrawableWindow(); - TDisplayMode rwMode = rwin->DisplayMode(); - - mode = rwMode; - if (mode == EColor16MA && qt_widget_private(QS60WindowSurfacePrivate::lockedSurface->window())->isOpaque) mode = EColor16MU; -- cgit v0.12 From 4e3ba194fe2404de380fbe544f87773edd66f7b9 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Fri, 24 Apr 2009 14:22:37 +0200 Subject: Get transparency working by clearing the window surface. This is duplicated code from the raster paint engine's beginPaint() function. For translucent windows the previous contents must be cleared from the backing store before the new content is painted. This class should probably be re-written as a subclass of the raster version. The reason we cannot use that implementation directly is because we cannot use QNativeImage because it doesn't provide anywhere we can do locking. --- src/gui/painting/qwindowsurface_s60.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 50278ce..85190c2 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -15,6 +15,7 @@ #include #include "qwindowsurface_s60_p.h" #include "qt_s60_p.h" +#include "private/qdrawhelper_p.h" QT_BEGIN_NAMESPACE @@ -61,7 +62,7 @@ QS60WindowSurface::~QS60WindowSurface() delete d_ptr; } -void QS60WindowSurface::beginPaint(const QRegion &) +void QS60WindowSurface::beginPaint(const QRegion &rgn) { if(!d_ptr->bitmap) return; @@ -69,6 +70,26 @@ void QS60WindowSurface::beginPaint(const QRegion &) Q_ASSERT(!QS60WindowSurfacePrivate::lockedSurface); QS60WindowSurfacePrivate::lockedSurface = this; lockBitmapHeap(); + + if (!qt_widget_private(window())->isOpaque) { + QRgb *data = reinterpret_cast(d_ptr->device.bits()); + const int row_stride = d_ptr->device.bytesPerLine() / 4; + + const QVector rects = rgn.rects(); + for (QVector::const_iterator it = rects.begin(); it != rects.end(); ++it) { + const int x_start = it->x(); + const int width = it->width(); + + const int y_start = it->y(); + const int height = it->height(); + + QRgb *row = data + row_stride * y_start; + for (int y = 0; y < height; ++y) { + qt_memfill(row + x_start, 0U, width); + row += row_stride; + } + } + } } void QS60WindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &) -- cgit v0.12 From 74d5d7a7d6e5433343eab38887064fc15a7c1250 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Mon, 27 Apr 2009 11:28:43 +0200 Subject: Fix compilation of tst_qwidget with some compilers. Some compilers such as the Metroworks compiler do not like it when the two pointers have different types so cast them to be the same. --- tests/auto/qwidget/tst_qwidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index d493219..110a4e0 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -8790,8 +8790,8 @@ void tst_QWidget::toplevelLineEditFocus() #endif QTest::qWait(200); - QCOMPARE(QApplication::activeWindow(), &w); - QCOMPARE(QApplication::focusWidget(), &w); + QCOMPARE(QApplication::activeWindow(), (QWidget*)&w); + QCOMPARE(QApplication::focusWidget(), (QWidget*)&w); } QTEST_MAIN(tst_QWidget) -- cgit v0.12 From f546d1b79d64cfad35fc4b3e5cf5db7e513e1035 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Mon, 27 Apr 2009 12:38:05 +0200 Subject: Fix compilation of QS60Style after bad merge. The previous commit on this file broke compilation. It should have called setBrush() instead of setColor() to set the Window role of the palette to use a texture brush. --- src/gui/styles/qs60style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 65ce104..d7ed1e5 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -485,7 +485,7 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) const QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 2, 0)); // set these as transparent so that styled full screen theme background is visible widgetPalette.setColor(QPalette::AlternateBase, Qt::transparent); - widgetPalette.setColor(QPalette::Window, QS60StylePrivate::backgroundTexture()); + widgetPalette.setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture()); widgetPalette.setColor(QPalette::Base, Qt::transparent); // set button and tooltipbase based on pixel colors QColor buttonColor = colorFromFrameGraphics(QS60StylePrivate::SF_ButtonNormal); -- cgit v0.12 From e28cefa64b02b61e305581abdbb0469b6e484c40 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 29 Apr 2009 10:43:45 +0200 Subject: Make QPixmap::grabWindow() work for top level windows. Its not enough to mask with Qt::Desktop because this enum value also includes Qt::Window so masking would give us a non-zero result thus causing the 'if' case to resolve to true which is not what we want. --- src/gui/image/qpixmap_s60.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 6246592..625988a 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -27,7 +27,7 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h ) // Find out if this is one of our windows. QSymbianControl *sControl; sControl = winId->MopGetObject(sControl); - if (sControl && sControl->widget()->windowType() & Qt::Desktop) { + if (sControl && sControl->widget()->windowType() == Qt::Desktop) { // Grabbing desktop widget srcSize = screenSize; } else { -- cgit v0.12 From b9088019b62abc288d704800ed7d45df942a3cd6 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 29 Apr 2009 11:22:02 +0200 Subject: Fixes crash when setting geometry on an obscured window. Since Qt on Symbian now destroys the backing store when it gets hidden or obscured we need to be careful not to use functions like moveRect() when we don't have a backing store since this function is really a backing store optimization and therefore assumes one exists. --- src/gui/kernel/qwidget_s60.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index f78b5be..a477a09 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -99,7 +99,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) // disable it for this particular widget. if (inTopLevelResize) tlwExtra->inTopLevelResize = false; - if (!isResize) + if (!isResize && maybeBackingStore()) moveRect(QRect(oldPos, oldSize), x - oldPos.x(), y - oldPos.y()); else invalidateBuffer_resizeHelper(oldPos, oldSize); -- cgit v0.12 From c714ecaf368c9285c2faffb4d1368f7fa79944dd Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 29 Apr 2009 11:30:13 +0200 Subject: Undo implementation of setWindowOpacity_sys(). This function was implemented using API from Symbian that will be deprecated. It was never actually suitable anyway since this function cannot be called after the window has been shown and this needs to be a runtime decision for Qt. The solution is to use SetTransparencyAlphaChannel(), but that will come later. --- src/gui/kernel/qwidget_s60.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index a477a09..8fe88d8 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -606,11 +606,9 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r) TRANSPARENCY To a line in the wsini.ini file. */ -void QWidgetPrivate::setWindowOpacity_sys(qreal level) +void QWidgetPrivate::setWindowOpacity_sys(qreal) { - RWindow* rw = static_cast(topData()->rwindow); - if (rw) - rw->SetTransparencyFactor(TRgb::Gray256(255.0 * level)); + // ### TODO: Implement uniform window transparency } void QWidgetPrivate::updateFrameStrut() -- cgit v0.12 From 7e4e7f66ab5f799c4a4ac71141b322841d05153a Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 29 Apr 2009 13:45:44 +0300 Subject: Fixed tst_QSslSocket::sslErrors test for Symbian HW. --- tests/auto/qsslsocket/tst_qsslsocket.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index b62d629..8dfbedd 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -509,22 +509,28 @@ void tst_QSslSocket::sslErrors_data() QTest::addColumn("errors"); #if defined(Q_OS_SYMBIAN) - QTest::newRow("aspiriniks.troll.no") << QtNetworkSettings::serverName() << 443 + + QTest::newRow(QtNetworkSettings::serverName().toAscii() + " port443") << QtNetworkSettings::serverName() << 443 << (SslErrorList() << QSslError::SelfSignedCertificate -#if !defined(Q_CC_NOKIAX86) - << QSslError::CertificateNotYetValid -#endif //!defined(Q_CC_NOKIAX86) ); - QTest::newRow("aspiriniks.troll.no") << QtNetworkSettings::serverName() << 993 + QTest::newRow(QtNetworkSettings::serverName().toAscii() + " port993") << QtNetworkSettings::serverName() << 993 << (SslErrorList() << QSslError::HostNameMismatch - << QSslError::SelfSignedCertificate - -#if !defined(Q_CC_NOKIAX86) - << QSslError::CertificateNotYetValid -#endif //!defined(Q_CC_NOKIAX86) - ); + << QSslError::SelfSignedCertificate + ); + // TODO: Should we have QtNetworkSettings::serverName alias + // in order that we could test with different host name + +#else + QTest::newRow("imap.troll.no") << "imap.troll.no" << 993 + << (SslErrorList() + << QSslError::HostNameMismatch + << QSslError::SelfSignedCertificateInChain); + QTest::newRow("imap.trolltech.com") << "imap.trolltech.com" << 993 + << (SslErrorList() + << QSslError::SelfSignedCertificateInChain); + #endif //Q_OS_SYMBIAN } @@ -1039,7 +1045,7 @@ void tst_QSslSocket::wildcard() // returns the CNAME fluke.troll.no for this domain. The web server // responds with the wildcard, and QSslSocket should accept that as a // valid connection. This was broken in 4.3.0. - QSslSocketPtr socket = newSocket();; + QSslSocketPtr socket = newSocket(); socket->addCaCertificates(QLatin1String("certs/aspiriniks.ca.crt")); this->socket = socket; #ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND -- cgit v0.12 From 37beda2303649664c71c2cc32292d5b54547032b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Wed, 29 Apr 2009 15:43:28 +0300 Subject: S60Style: Styled QToolBar implementation. --- src/gui/styles/qs60style.cpp | 198 +++++++++++++++++++++++++++------ src/gui/styles/qs60style_p.h | 41 ++++++- src/gui/styles/qs60style_simulated.cpp | 8 +- src/gui/styles/qs60style_symbian.cpp | 52 ++++++++- 4 files changed, 258 insertions(+), 41 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 58dcb98..5747ceb 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -23,6 +23,9 @@ #include "qpushbutton.h" #include "qmenubar.h" #include "qtablewidget.h" +#include "qtoolbar.h" +#include "qtoolbutton.h" +#include "private/qtoolbarextension_p.h" #include "private/qcombobox_p.h" #include "private/qwidget_p.h" #include "qscrollbar.h" @@ -50,16 +53,16 @@ static const QByteArray propertyKeyCurrentlayout = "currentlayout"; #if defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** -{240,320,1,12,true,QLatin1String("QVGA Landscape Mirrored")}, -{240,320,1,12,false,QLatin1String("QVGA Landscape")}, -{320,240,1,12,true,QLatin1String("QVGA Portrait Mirrored")}, -{320,240,1,12,false,QLatin1String("QVGA Portrait")}, -{360,640,1,12,true,QLatin1String("NHD Landscape Mirrored")}, -{360,640,1,12,false,QLatin1String("NHD Landscape")}, -{640,360,1,12,true,QLatin1String("NHD Portrait Mirrored")}, -{640,360,1,12,false,QLatin1String("NHD Portrait")}, -{352,800,1,9,true,QLatin1String("E90 Landscape Mirrored")}, -{352,800,1,9,false,QLatin1String("E90 Landscape")} +{240,320,1,13,true,QLatin1String("QVGA Landscape Mirrored")}, +{240,320,1,13,false,QLatin1String("QVGA Landscape")}, +{320,240,1,13,true,QLatin1String("QVGA Portrait Mirrored")}, +{320,240,1,13,false,QLatin1String("QVGA Portrait")}, +{360,640,1,13,true,QLatin1String("NHD Landscape Mirrored")}, +{360,640,1,13,false,QLatin1String("NHD Landscape")}, +{640,360,1,13,true,QLatin1String("NHD Portrait Mirrored")}, +{640,360,1,13,false,QLatin1String("NHD Portrait")}, +{352,800,1,12,true,QLatin1String("E90 Landscape Mirrored")}, +{352,800,1,12,false,QLatin1String("E90 Landscape")} // *** End of generated data *** }; const int QS60StylePrivate::m_numberOfLayouts = @@ -67,16 +70,17 @@ 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,4,-909,0,0,-909,-909,-909,-909,-909,-909,37,21,51,27,51,4,4,5,3,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,5,-909,0,0,-909,-909,-909,-909,-909,-909,37,21,51,27,51,4,4,5,3,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,4,-909,0,0,-909,-909,-909,-909,-909,-909,37,21,65,27,65,4,4,5,3,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,5,-909,0,0,-909,-909,-909,-909,-909,-909,37,21,65,27,65,4,4,5,3,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,5,-909,0,0,-909,-909,-909,-909,-909,-909,87,27,77,35,77,5,5,6,3,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,7,-909,0,0,-909,-909,-909,-909,-909,-909,87,27,77,35,77,5,5,6,3,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,5,-909,0,0,-909,-909,-909,-909,-909,-909,87,27,98,35,98,5,5,6,3,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,7,-909,0,0,-909,-909,-909,-909,-909,-909,87,27,98,35,98,5,5,6,3,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,16,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,34,7,0,2,2,3,0,1,1,-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,16,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,34,7,0,3,2,2,0,1,1,-909,2,-909,-909,-909,-909,7,7,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,3,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,3,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,3,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,3,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,3,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,3,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,3,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,3,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} + // *** End of generated data *** }; @@ -95,7 +99,10 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme {SE_SettingsList, QS60StyleEnums::SP_QsnFrSetOptCenter}, {SE_TableItem, QS60StyleEnums::SP_QsnFrCaleCenter}, {SE_TableHeaderItem, QS60StyleEnums::SP_QsnFrCaleHeadingCenter}, - {SE_ToolTip, QS60StyleEnums::SP_QsnFrPopupPreviewCenter} + {SE_ToolTip, QS60StyleEnums::SP_QsnFrPopupPreviewCenter}, + {SE_ToolBar, QS60StyleEnums::SP_QsnFrPopupSubCenter}, + {SE_ToolBarButton, QS60StyleEnums::SP_QsnFrSctrlButtonCenter}, + {SE_ToolBarButtonPressed, QS60StyleEnums::SP_QsnFrSctrlButtonCenterPressed}, }; static const int frameElementsCount = int(sizeof(QS60StylePrivate::m_frameElementsData)/sizeof(QS60StylePrivate::m_frameElementsData[0])); @@ -302,6 +309,16 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, case SE_ToolTip: drawFrame(SF_ToolTip, painter, rect, flags | SF_PointNorth); break; + case SE_ToolBar: + drawFrame(SF_ToolBar, painter, rect, flags | SF_PointNorth); + break; + case SE_ToolBarButton: + drawFrame(SF_ToolBarButton, painter, rect, flags | SF_PointNorth); + break; + case SE_ToolBarButtonPressed: + drawFrame(SF_ToolBarButtonPressed, painter, rect, flags | SF_PointNorth); + break; + default: break; } @@ -831,15 +848,73 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast(option)) { const State bflags = toolBtn->state; const QRect button(subControlRect(control, toolBtn, SC_ToolButton, widget)); - QStyleOptionToolButton label = *toolBtn; + QStyleOptionToolButton toolButton = *toolBtn; if (sub&SC_ToolButton) { QStyleOption tool(0); tool.palette = toolBtn->palette; + + // Check if toolbutton is in toolbar. + QToolBar *toolBar = 0; + if (widget) + toolBar = qobject_cast(widget->parentWidget()); + if (bflags & (State_Sunken | State_On | State_Raised)) { tool.rect = button; tool.state = bflags; - drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); + + // todo: I'd like to move extension button next to where last button is + // however, the painter seems to want to clip the button rect even if I turn of the clipping. + if (toolBar && (qobject_cast(widget))){ + /*QList actionList = toolBar->actions(); + const int actionCount = actionList.count(); + const int toolbarWidth = toolBar->width(); + const int extButtonWidth = pixelMetric(PM_ToolBarExtensionExtent, option, widget); + const int toolBarButtonWidth = pixelMetric(PM_ToolBarIconSize, option, widget); + const int frame = pixelMetric(PM_ToolBarFrameWidth, option, widget); + const int margin = pixelMetric(PM_ToolBarItemMargin, option, widget); + const int border = frame + margin; + const int spacing = pixelMetric(PM_ToolBarItemSpacing, option, widget); + const int toolBarButtonArea = toolbarWidth - extButtonWidth - spacing - 2*border; + const int numberOfVisibleButtons = toolBarButtonArea / toolBarButtonWidth; + // new extension button place is after border and all the other visible buttons (with spacings) + const int newXForExtensionButton = numberOfVisibleButtons * toolBarButtonWidth + (numberOfVisibleButtons-1)*spacing + border; + painter->save(); + painter->setClipping(false); + tool.rect.translate(-newXForExtensionButton,0); + painter->restore();*/ + } + + if (toolBar){ + /*if (toolBar->orientation() == Qt::Vertical){ + // todo: I'd like to make all vertical buttons the same size, but again the painter + // prefers to use clipping for button rects, even though clipping has been set off. + painter->save(); + painter->setClipping(false); + + const int origWidth = tool.rect.width(); + const int newWidth = toolBar->width()-2*pixelMetric(PM_ToolBarFrameWidth, option, widget); + painter->translate(origWidth-newWidth,0); + tool.rect.translate(origWidth-tool.rect.width(),0); + tool.rect.setWidth(newWidth); + + if (option->state & QStyle::State_Sunken) + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBarButtonPressed, painter, tool.rect, flags); + else + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBarButton, painter, tool.rect, flags); + + }*/ + if (option->state & QStyle::State_Sunken) + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBarButtonPressed, painter, tool.rect, flags); + else + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBarButton, painter, tool.rect, flags); + /* + if (toolBar->orientation() == Qt::Vertical) + painter->restore(); + */ + } else { + drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); + } } } if (toolBtn->state & State_HasFocus) { @@ -867,15 +942,15 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom break; default: break; } - label.rect = button; - drawPrimitive(pe, &label, painter, widget); + toolButton.rect = button; + drawPrimitive(pe, &toolButton, painter, widget); } if (toolBtn->text.length()>0 || !toolBtn->icon.isNull()) { const int frameWidth = pixelMetric(PM_DefaultFrameWidth, option, widget); - label.rect = button.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth); - drawControl(CE_ToolButtonLabel, &label, painter, widget); + toolButton.rect = button.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth); + drawControl(CE_ToolButtonLabel, &toolButton, painter, widget); } } break; @@ -1556,6 +1631,50 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QCommonStyle::drawControl(element, header, painter, widget); } break; + +#ifndef QT_NO_TOOLBAR + case CE_ToolBar: + if (const QStyleOptionToolBar *toolBar = qstyleoption_cast(option)) { + const QToolBar *tbWidget = qobject_cast(widget); + + if (!tbWidget || (widget && qobject_cast(widget->parentWidget()))) + break; + + // Normally in S60 5.0+ there is no background for toolbar, but in some cases with versatile QToolBar, + // it looks a bit strange. So, lets fillRect with Button. + if (!QS60StylePrivate::isToolBarBackground()) { + QList actions = tbWidget->actions(); + bool justToolButtonsInToolBar = true; + for (int i = 0; i < actions.size(); ++i) { + QWidget *childWidget = tbWidget->widgetForAction(actions.at(i)); + const QToolButton *button = qobject_cast(childWidget); + if (!button){ + justToolButtonsInToolBar = false; + } + } + + // Draw frame background + // for vertical toolbars with text only and + // for toolbars with extension buttons and + // for toolbars with widgets in them. + if (!justToolButtonsInToolBar || + (tbWidget && + (tbWidget->orientation() == Qt::Vertical) && + (tbWidget->toolButtonStyle() == Qt::ToolButtonTextOnly))) { + painter->save(); + if (widget) + painter->setBrush(widget->palette().button()); + painter->setOpacity(0.3); + painter->fillRect(toolBar->rect, painter->brush()); + painter->restore(); + } + } else { + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBar, painter, toolBar->rect, flags); + } + } + break; +#endif //QT_NO_TOOLBAR + case CE_ShapedFrame: case CE_MenuVMargin: case CE_MenuHMargin: @@ -1592,9 +1711,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, case CE_ScrollBarFirst: case CE_ScrollBarLast: case CE_FocusFrame: -#ifndef QT_NO_TOOLBAR - case CE_ToolBar: -#endif //QT_NO_TOOLBAR #ifndef QT_NO_TOOLBOX case CE_ToolBoxTab: case CE_ToolBoxTabShape: @@ -1876,6 +1992,14 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti } break; +#ifndef QT_NO_TOOLBAR + case PE_IndicatorToolBarHandle: + // no toolbar handles in S60/AVKON UI + case PE_IndicatorToolBarSeparator: + // no separators in S60/AVKON UI + break; +#endif //QT_NO_TOOLBAR + case PE_PanelMenuBar: case PE_FrameMenu: break; //disable frame in menu @@ -1900,8 +2024,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti #endif //QT_NO_PROGRESSBAR #ifndef QT_NO_TOOLBAR case PE_PanelToolBar: - case PE_IndicatorToolBarHandle: - case PE_IndicatorToolBarSeparator: #endif //QT_NO_TOOLBAR #ifndef QT_NO_COLUMNVIEW case PE_IndicatorColumnViewArrow: @@ -2371,7 +2493,7 @@ QVariant QS60Style::styleProperty(const char *name) const } QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, - const QStyleOption * option, const QWidget * widget) const + const QStyleOption *option, const QWidget *widget) const { const int iconDimension = QS60StylePrivate::pixelMetric(QStyle::PM_ToolBarIconSize); const QRect iconSize = (!option) ? QRect(0,0,iconDimension,iconDimension) : option->rect; @@ -2437,6 +2559,16 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, case QStyle::SP_TrashIcon: part = QS60StyleEnums::SP_QgnNoteErased; break; + case QStyle::SP_ToolBarHorizontalExtensionButton: + part = QS60StyleEnums::SP_QgnIndiSubMenu; + if (QApplication::layoutDirection() == Qt::RightToLeft) + adjustedFlags |= QS60StylePrivate::SF_PointSouth; + break; + case QStyle::SP_ToolBarVerticalExtensionButton: + adjustedFlags |= QS60StylePrivate::SF_PointEast; + part = QS60StyleEnums::SP_QgnIndiSubMenu; + break; + default: return QCommonStyle::standardIconImplementation(standardIcon, option, widget); } diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index c11d89a..8839866 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -191,7 +191,34 @@ public: SP_QsnFrSetOptSideB, SP_QsnFrSetOptSideL, SP_QsnFrSetOptSideR, - SP_QsnFrSetOptCenter + SP_QsnFrSetOptCenter, + SP_QsnFrPopupSubCornerTl, // Toolbar background + SP_QsnFrPopupSubCornerTr, + SP_QsnFrPopupSubCornerBl, + SP_QsnFrPopupSubCornerBr, + SP_QsnFrPopupSubSideT, + SP_QsnFrPopupSubSideB, + SP_QsnFrPopupSubSideL, + SP_QsnFrPopupSubSideR, + SP_QsnFrPopupSubCenter, + SP_QsnFrSctrlButtonCornerTl, // Toolbar button + SP_QsnFrSctrlButtonCornerTr, + SP_QsnFrSctrlButtonCornerBl, + SP_QsnFrSctrlButtonCornerBr, + SP_QsnFrSctrlButtonSideT, + SP_QsnFrSctrlButtonSideB, + SP_QsnFrSctrlButtonSideL, + SP_QsnFrSctrlButtonSideR, + SP_QsnFrSctrlButtonCenter, + SP_QsnFrSctrlButtonCornerTlPressed, // Toolbar button, pressed + SP_QsnFrSctrlButtonCornerTrPressed, + SP_QsnFrSctrlButtonCornerBlPressed, + SP_QsnFrSctrlButtonCornerBrPressed, + SP_QsnFrSctrlButtonSideTPressed, + SP_QsnFrSctrlButtonSideBPressed, + SP_QsnFrSctrlButtonSideLPressed, + SP_QsnFrSctrlButtonSideRPressed, + SP_QsnFrSctrlButtonCenterPressed }; enum ColorLists { @@ -245,7 +272,10 @@ public: SE_SettingsList, SE_TableItem, SE_TableHeaderItem, - SE_ToolTip //own graphic available on 3.2+ releases + SE_ToolTip, //own graphic available on 3.2+ releases, + SE_ToolBar, + SE_ToolBarButton, + SE_ToolBarButtonPressed }; enum SkinFrameElements { @@ -257,7 +287,10 @@ public: SF_SettingsList, SF_TableItem, SF_TableHeaderItem, - SF_ToolTip + SF_ToolTip, + SF_ToolBar, + SF_ToolBarButton, + SF_ToolBarButtonPressed }; enum SkinElementFlag { @@ -305,6 +338,8 @@ public: static QPixmap backgroundTexture(); static bool isTouchSupported(); + static bool isToolBarBackground(); + // calculates average color based on button skin graphics (minus borders). QColor colorFromFrameGraphics(QS60StylePrivate::SkinFrameElements frame) const; void setThemePalette(QWidget *widget) const; diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index 68f0b70..17c1ebe 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -131,7 +131,7 @@ QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size, // The size of topLeft defines all other sizes const QSize cornerSize(partSize(topLeft)); // if frame is so small that corners would cover it completely, draw only center piece - const bool drawOnlyCenter = + const bool drawOnlyCenter = 2 * cornerSize.width() + 1 >= size.width() || 2 * cornerSize.height() + 1 >= size.height(); const int cornerWidth = cornerSize.width(); @@ -200,6 +200,12 @@ bool QS60StylePrivate::isTouchSupported() #endif } +bool QS60StylePrivate::isToolBarBackground() +{ + return true; +} + + QFont QS60StylePrivate::s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize) { QFont result; diff --git a/src/gui/styles/qs60style_symbian.cpp b/src/gui/styles/qs60style_symbian.cpp index a1e7800..353926e 100644 --- a/src/gui/styles/qs60style_symbian.cpp +++ b/src/gui/styles/qs60style_symbian.cpp @@ -201,8 +201,8 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* SP_QsnFrPopupSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_AllReleases, -1,-1,-1}, /* SP_QsnFrPopupCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_AllReleases, -1,-1,-1}, - - /* SP_QsnFrPopupPreviewCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_3_1, -1, EAknsMajorSkin, 0x19c5}, + // ToolTip graphics different in 3.1 vs. 3.2+. + /* SP_QsnFrPopupPreviewCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_3_1, -1, EAknsMajorSkin, 0x19c5}, /* KAknsIIDQsnFrPopupPreviewCornerTl */ /* SP_QsnFrPopupPreviewCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_3_1, -1, EAknsMajorSkin, 0x19c6}, /* SP_QsnFrPopupPreviewCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_3_1, -1, EAknsMajorSkin, 0x19c3}, /* SP_QsnFrPopupPreviewCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_3_1, -1, EAknsMajorSkin, 0x19c4}, @@ -221,6 +221,39 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* SP_QsnFrSetOptSideL */ {KAknsIIDQsnFrSetOptSideL, ENoDraw, ES60_AllReleases, -1,-1,-1}, /* SP_QsnFrSetOptSideR */ {KAknsIIDQsnFrSetOptSideR, ENoDraw, ES60_AllReleases, -1,-1,-1}, /* SP_QsnFrSetOptCenter */ {KAknsIIDQsnFrSetOptCenter, ENoDraw, ES60_AllReleases, -1,-1,-1}, + + // No toolbar frame for 5.0+ releases. + /* SP_QsnFrPopupSubCornerTl */ {KAknsIIDQsnFrPopupSubCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1,-1}, + /* SP_QsnFrPopupSubCornerTr */ {KAknsIIDQsnFrPopupSubCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1,-1}, + /* SP_QsnFrPopupSubCornerBl */ {KAknsIIDQsnFrPopupSubCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1,-1}, + /* SP_QsnFrPopupSubCornerBr */ {KAknsIIDQsnFrPopupSubCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1,-1}, + /* SP_QsnFrPopupSubSideT */ {KAknsIIDQsnFrPopupSubSideT, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1,-1}, + /* SP_QsnFrPopupSubSideB */ {KAknsIIDQsnFrPopupSubSideB, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1,-1}, + /* SP_QsnFrPopupSubSideL */ {KAknsIIDQsnFrPopupSubSideL, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1,-1}, + /* SP_QsnFrPopupSubSideR */ {KAknsIIDQsnFrPopupSubSideR, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1,-1}, + /* SP_QsnFrPopupSubCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1,-1}, + + // Toolbar graphics is different in 3.1/3.2 vs. 5.0 + /* SP_QsnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/ + /* SP_QsnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2302}, + /* SP_QsnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2303}, + /* SP_QsnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2304}, + /* SP_QsnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2305}, + /* SP_QsnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2306}, + /* SP_QsnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2307}, + /* SP_QsnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2308}, + /* SP_QsnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/ + + // No pressed state for toolbar button in 3.1/3.2. + /* SP_QsnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrSctrlButtonCornerTlPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2171}, /*KAknsIIDQsnFrButtonTbCornerTl*/ + /* SP_QsnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrSctrlButtonCornerTrPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2172}, + /* SP_QsnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrSctrlButtonCornerBlPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2173}, + /* SP_QsnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrSctrlButtonCornerBrPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2174}, + /* SP_QsnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrSctrlButtonSideTPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2175}, + /* SP_QsnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrSctrlButtonSideBPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2176}, + /* SP_QsnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrSctrlButtonSideLPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2177}, + /* SP_QsnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrSctrlButtonSideRPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2178}, + /* SP_QsnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrSctrlButtonCenterPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2179} }; QPixmap QS60StyleModeSpecifics::skinnedGraphics( @@ -372,6 +405,11 @@ bool QS60StylePrivate::isTouchSupported() return bool(AknLayoutUtils::PenEnabled()); } +bool QS60StylePrivate::isToolBarBackground() +{ + return (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2); +} + void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset) { const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture()); @@ -573,13 +611,19 @@ void QS60StyleModeSpecifics::frameIdAndCenterId(QS60StylePrivate::SkinFrameEleme switch(frameElement) { case QS60StylePrivate::SF_ToolTip: if (QSysInfo::s60Version()==QSysInfo::SV_S60_5_0 || QSysInfo::s60Version()==QSysInfo::SV_S60_3_2) { - centerId.Set(EAknsMajorSkin, 0x5300); - frameId.Set(EAknsMajorGeneric, 0x19c2); + centerId.Set(EAknsMajorGeneric, 0x19c2); + frameId.Set(EAknsMajorSkin, 0x5300); } else { centerId.Set(KAknsIIDQsnFrPopupCenter); frameId.iMinor = centerId.iMinor - 9; } break; + case QS60StylePrivate::SF_ToolBar: + if (QSysInfo::s60Version()==QSysInfo::SV_S60_3_1 || QSysInfo::s60Version()==QSysInfo::SV_S60_3_2) { + centerId.Set(KAknsIIDQsnFrPopupCenterSubmenu); + frameId.Set(KAknsIIDQsnFrPopupSub); + } + break; default: // center should be correct here frameId.iMinor = centerId.iMinor - 9; -- cgit v0.12 From d333404c72aa6c707cf389899999f2247454b824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Wed, 29 Apr 2009 15:46:12 +0300 Subject: S60Style: Use title font for GroupBox title. --- src/gui/styles/qs60style.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 5747ceb..20eaf16 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -986,6 +986,11 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) { const QColor textColor = groupBox->textColor; painter->save(); + + const QFont suggestedFont = d->s60Font( + QS60StyleEnums::FC_Title, painter->font().pointSizeF()); + painter->setFont(suggestedFont); + if (textColor.isValid()) painter->setPen(textColor); int alignment = int(groupBox->textAlignment); -- cgit v0.12 From 065cc545c985f31751edb1b80d577af8c964255f Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 29 Apr 2009 15:41:47 +0200 Subject: Some code cleanups after review. Change these lines of code to either make it more consistent or more readable after review. --- src/gui/kernel/qwidget_s60.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 8fe88d8..f424e93 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -203,11 +203,11 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO | EPointerFilterMove | EPointerFilterDrag, 0); topExtra->rwindow->EnableVisibilityChangeEvents(); - if (q->testAttribute(Qt::WA_TranslucentBackground)) { + if (!isOpaque) { RWindow *rwindow = static_cast(topExtra->rwindow); TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA); if (rwindow->SetTransparencyAlphaChannel() == KErrNone) - rwindow->SetBackgroundColor(~0); + rwindow->SetBackgroundColor(TRgb(255, 255, 255, 0)); } } @@ -453,7 +453,7 @@ void QWidgetPrivate::s60UpdateIsOpaque() RWindow *rwindow = static_cast(topExtra->rwindow); TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA); if (rwindow->SetTransparencyAlphaChannel() == KErrNone) - rwindow->SetBackgroundColor(~0); + rwindow->SetBackgroundColor(TRgb(255, 255, 255, 0)); } else { QTLWExtra *topExtra = topData(); RWindow *rwindow = static_cast(topExtra->rwindow); -- cgit v0.12 From 37c49413e8ba1880bce5989c1b2f1d0d9bb0e663 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 29 Apr 2009 18:18:10 +0300 Subject: Fixed temporary file rename problem in Symbian OS. In Symbian OS temp file rename will always go to fallback solution since close for temp file does not really close the handle. The fallback implements rename by copy and remove. But in symbian OS also the remove after copy failed since it was done through local 'in' object. However the file was still open in object doing the remove. The fix is to close the local 'in' object and use current 'this' object to remove the file. This object points to QTemporaryFile and it will make sure that temp file is first closed before trying to remove. --- src/corelib/io/qfile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index af10c31..01a236c 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -737,7 +737,8 @@ QFile::rename(const QString &newName) error = true; } if(!error) { - if (!in.remove()) { + in.close(); + if (!remove()) { d->setError(QFile::RenameError, tr("Cannot remove source file")); error = true; } -- cgit v0.12 From 969b9f644187f2a04ec6c3a09e6446538823026b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 30 Apr 2009 10:08:21 +0300 Subject: S60Style: buildbreak fix - missing lines from commit d333404c72aa6c707cf389899999f2247454b824 --- src/gui/styles/qs60style.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 20eaf16..a232c28 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -741,6 +741,9 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom { const QS60StylePrivate::SkinElementFlags flags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled; SubControls sub = option->subControls; + + Q_D(const QS60Style); + switch (control) { #ifndef QT_NO_SCROLLBAR case CC_ScrollBar: @@ -2203,12 +2206,12 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple QS60StylePrivate::pixelMetric(QStyle::PM_ButtonIconSize) + 2*buttonMargin; //todo: buttonMargin commented out as WAY too big in pixel metrics QSize buttonSize; - buttonSize.setHeight(qMax(8, spinbox->rect.height()/2 - frameThickness)); + buttonSize.setHeight(qMax(8, spinbox->rect.height() - frameThickness)); buttonSize.setWidth(buttonWidth); buttonSize = buttonSize.expandedTo(QApplication::globalStrut()); const int y = frameThickness + spinbox->rect.y(); - const int x = spinbox->rect.x() + spinbox->rect.width() - frameThickness - buttonSize.width(); + const int x = spinbox->rect.x() + spinbox->rect.width() - frameThickness - 2*buttonSize.width(); switch (scontrol) { case SC_SpinBoxUp: @@ -2219,7 +2222,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple case SC_SpinBoxDown: if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) return QRect(); - ret = QRect(x, y + buttonSize.height(), buttonWidth, buttonSize.height()); + ret = QRect(x+buttonSize.width(), y, buttonWidth, buttonSize.height()); break; case SC_SpinBoxEditField: if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) -- cgit v0.12 From 6b7b289ef47c4e8300a1f5a9ba86044b890a1014 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 30 Apr 2009 10:11:49 +0300 Subject: Fixed bug in QTemporaryFile::rename. The nativeInitFileName of file engine was not set in rename fallback case. Now it is set by calling: fileEngine()->setFileName This error was found with QNetworkDiskCache test case. --- src/corelib/io/qfile.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 01a236c..4a20c97 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -743,10 +743,12 @@ QFile::rename(const QString &newName) error = true; } } - if (error) + if (error) { out.remove(); - else + } else { + fileEngine()->setFileName(newName); setFileName(newName); + } return !error; } } -- cgit v0.12 From 5866a3ad648a0b8f2edda5b49c86fbdd6e4383b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 30 Apr 2009 10:16:24 +0300 Subject: S60Style: Layout spinbox so that up and down buttons are side-by-side, not on top of each other. --- src/gui/styles/qs60style.cpp | 79 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 66 insertions(+), 13 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index a232c28..f3213e9 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -741,9 +741,9 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom { const QS60StylePrivate::SkinElementFlags flags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled; SubControls sub = option->subControls; - + Q_D(const QS60Style); - + switch (control) { #ifndef QT_NO_SCROLLBAR case CC_ScrollBar: @@ -821,7 +821,7 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (sub & SC_ComboBoxArrow) { const int iconRectWidth = buttonOption.rect.width()>>1; - const int nudgeWidth =iconRectWidth>>1; + const int nudgeWidth = iconRectWidth>>1; // Draw the little arrow const QRect arrowRect(((buttonOption.rect.left()+buttonOption.rect.right())>>1) - nudgeWidth, @@ -962,10 +962,64 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom case CC_SpinBox: if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast(option)) { QStyleOptionSpinBox copy = *spinBox; + PrimitiveElement pe; + + /*if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) { + QRect r = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxFrame, widget); + qDrawWinPanel(painter, r, spinBox->palette, true); + }*/ + + if (spinBox->subControls & SC_SpinBoxUp) { + copy.subControls = SC_SpinBoxUp; + QPalette pal2 = spinBox->palette; + if (!(spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) { + pal2.setCurrentColorGroup(QPalette::Disabled); + copy.state &= ~State_Enabled; + } + + copy.palette = pal2; + + if (spinBox->activeSubControls == SC_SpinBoxUp && (spinBox->state & State_Sunken)) { + copy.state |= State_On; + copy.state |= State_Sunken; + } else { + copy.state |= State_Raised; + copy.state &= ~State_Sunken; + } + pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus + : PE_IndicatorSpinUp); + + copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget); + drawPrimitive(PE_PanelButtonBevel, ©, painter, widget); + copy.rect.adjust(1, 1, -1, -1); + drawPrimitive(pe, ©, painter, widget); + } + + if (spinBox->subControls & SC_SpinBoxDown) { + copy.subControls = SC_SpinBoxDown; + copy.state = spinBox->state; + QPalette pal2 = spinBox->palette; + if (!(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) { + pal2.setCurrentColorGroup(QPalette::Disabled); + copy.state &= ~State_Enabled; + } + copy.palette = pal2; - // Let the base class draw the wole thing except the qDrawWinPanel 'frame' with Windows95-look - copy.frame = false; - QCommonStyle::drawComplexControl(control, ©, painter, widget); + if (spinBox->activeSubControls == SC_SpinBoxDown && (spinBox->state & State_Sunken)) { + copy.state |= State_On; + copy.state |= State_Sunken; + } else { + copy.state |= State_Raised; + copy.state &= ~State_Sunken; + } + pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus + : PE_IndicatorSpinDown); + + copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget); + drawPrimitive(PE_PanelButtonBevel, ©, painter, widget); + copy.rect.adjust(1, 1, -1, -1); + drawPrimitive(pe, ©, painter, widget); + } } break; #endif //QT_NO_SPINBOX @@ -989,11 +1043,11 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) { const QColor textColor = groupBox->textColor; painter->save(); - + const QFont suggestedFont = d->s60Font( QS60StyleEnums::FC_Title, painter->font().pointSizeF()); painter->setFont(suggestedFont); - + if (textColor.isValid()) painter->setPen(textColor); int alignment = int(groupBox->textAlignment); @@ -1884,19 +1938,18 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti case PE_IndicatorSpinUp: case PE_IndicatorSpinMinus: case PE_IndicatorSpinPlus: - { if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast(option)) { QStyleOptionSpinBox optionSpinBox = *spinBox; - if (element==PE_IndicatorSpinDown || element==PE_IndicatorSpinUp) - optionSpinBox.rect.adjust(2,2,-2,-2); QCommonStyle::drawPrimitive(element, &optionSpinBox, painter, widget); - } else if (const QStyleOptionFrame *cmb = qstyleoption_cast(option)) { + } +#ifndef QT_NO_COMBOBOX + else if (const QStyleOptionFrame *cmb = qstyleoption_cast(option)) { // We want to draw down arrow here for comboboxes as well. QStyleOptionFrame comboBox = *cmb; comboBox.rect.adjust(0,2,0,-2); QCommonStyle::drawPrimitive(element, &comboBox, painter, widget); } - } +#endif //QT_NO_COMBOBOX break; #endif //QT_NO_SPINBOX case PE_FrameFocusRect: -- cgit v0.12 From 9b091d474a0584ea5aa271d466833cfb24e9a5da Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Thu, 30 Apr 2009 09:18:35 +0200 Subject: Small optimization when hiding windows. When a window is hidden, it will call releaseBuffer() on the backing store which in turn will resize the window surface to a null rect. In this case, there is no need to update the QImage with the data pointer since it will be updated on the subsequent beginPaint() when the image is resized to a valid size again. This also avoids doing unnecessary locking on the FBSERV heap which still involves a context switch on older versions of Symbian. --- src/gui/painting/qwindowsurface_s60.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 85190c2..2618ce2 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -144,12 +144,13 @@ void QS60WindowSurface::setGeometry(const QRect& rect) if (rect == geometry()) return; + QWindowSurface::setGeometry(rect); + TRect nativeRect(qt_QRect2TRect(rect)); User::LeaveIfError(d_ptr->bitmap->Resize(nativeRect.Size())); - updatePaintDeviceOnBitmap(); - - QWindowSurface::setGeometry(rect); + if (!rect.isNull()) + updatePaintDeviceOnBitmap(); } void QS60WindowSurface::lockBitmapHeap() -- cgit v0.12 From 4b1137345a0bbfedc348b020ad0ad6e5720eb6d1 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Thu, 30 Apr 2009 11:26:14 +0200 Subject: Avoid overwriting a user set palette. The polish(QWidget*) function is called the first time a widget is shown and therefore setting the widget's palette in this function will overwrite the user set palette if one is specified before show() is called. The solution is to break this into two parts, the first part sets the global palette in polish(QApplication*) and this is the part of the palette that is independent of widget. The second part involves adding the widget specific palettes using the QApplication:: setPalette() function that takes a classname and this is done in the polish(QWidget*) function. --- src/gui/styles/qs60style.cpp | 68 ++++++++++++++++++++++-------------- src/gui/styles/qs60style.h | 3 ++ src/gui/styles/qs60style_p.h | 2 +- src/gui/styles/qs60style_symbian.cpp | 10 +++--- 4 files changed, 50 insertions(+), 33 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index d7ed1e5..d197a92 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -462,7 +462,7 @@ int QS60StylePrivate::focusRectPenWidth() return pixelMetric(QS60Style::PM_DefaultFrameWidth); } -void QS60StylePrivate::setThemePalette(QWidget *widget) const +void QS60StylePrivate::setThemePalette(QApplication *app) const { QPalette widgetPalette = QPalette(Qt::white); @@ -498,31 +498,14 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) const QColor toolTipColor = colorFromFrameGraphics(QS60StylePrivate::SF_ToolTip); widgetPalette.setColor(QPalette::ToolTipBase, toolTipColor ); - // widget specific colors - if (QSlider *slider = qobject_cast(widget)){ - widgetPalette.setColor(QPalette::All, QPalette::WindowText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0)); - } else if (QPushButton *button = qobject_cast(widget)){ - widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - } else if (QHeaderView *table = qobject_cast(widget)){ - widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0)); - } else if (QMenuBar *menuBar = qobject_cast(widget)){ - widgetPalette.setColor(QPalette::All, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0)); - } else if (QTabBar *tabBar = qobject_cast(widget)){ - widgetPalette.setColor(QPalette::Active, QPalette::WindowText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0)); - } else if (QTableView *table = qobject_cast(widget)){ - widgetPalette.setColor(QPalette::All, QPalette::Text, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0)); - } + app->setPalette(widgetPalette); +} - if (widget) - widget->setPalette(widgetPalette); +void QS60Style::polish(QApplication *application) +{ + Q_D(const QS60Style); + originalPalette = application->palette(); + d->setThemePalette(application); } void QS60Style::polish(QWidget *widget) @@ -546,10 +529,41 @@ void QS60Style::polish(QWidget *widget) widget->setAttribute(Qt::WA_StyledBackground); } - if (widget){ - d->setThemePalette(widget); + QPalette widgetPalette = widget->palette(); + + // widget specific colors + if (QSlider *slider = qobject_cast(widget)){ + widgetPalette.setColor(QPalette::All, QPalette::WindowText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0)); + QApplication::setPalette(widgetPalette, "QSlider"); + } else if (QPushButton *button = qobject_cast(widget)){ + widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); + widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); + QApplication::setPalette(widgetPalette, "QPushButton"); + } else if (QHeaderView *table = qobject_cast(widget)){ + widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0)); + QApplication::setPalette(widgetPalette, "QHeaderView"); + } else if (QMenuBar *menuBar = qobject_cast(widget)){ + widgetPalette.setColor(QPalette::All, QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0)); + QApplication::setPalette(widgetPalette, "QMenuBar"); + } else if (QTabBar *tabBar = qobject_cast(widget)){ + widgetPalette.setColor(QPalette::Active, QPalette::WindowText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0)); + QApplication::setPalette(widgetPalette, "QTabBar"); + } else if (QTableView *table = qobject_cast(widget)){ + widgetPalette.setColor(QPalette::All, QPalette::Text, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0)); + QApplication::setPalette(widgetPalette, "QTableView"); } +} +void QS60Style::unpolish(QApplication *application) +{ + application->setPalette(originalPalette); } void QS60Style::unpolish(QWidget *widget) diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index 253eb61..945e182 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -45,6 +45,8 @@ public: QRect subElementRect(SubElement element, const QStyleOption *opt, const QWidget *widget = 0) const; void polish(QWidget *widget); void unpolish(QWidget *widget); + void polish(QApplication *application); + void unpolish(QApplication *application); void setStyleProperty(const char *name, const QVariant &value); QVariant styleProperty(const char *name) const; @@ -69,6 +71,7 @@ protected slots: private: Q_DISABLE_COPY(QS60Style) friend class QStyleFactory; + QPalette originalPalette; }; #endif // QT_NO_STYLE_S60 diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index c11d89a..88f0864 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -307,7 +307,7 @@ public: static bool isTouchSupported(); // calculates average color based on button skin graphics (minus borders). QColor colorFromFrameGraphics(QS60StylePrivate::SkinFrameElements frame) const; - void setThemePalette(QWidget *widget) const; + void setThemePalette(QApplication *application) const; static int focusRectPenWidth(); diff --git a/src/gui/styles/qs60style_symbian.cpp b/src/gui/styles/qs60style_symbian.cpp index 083e3b9..426f8d9 100644 --- a/src/gui/styles/qs60style_symbian.cpp +++ b/src/gui/styles/qs60style_symbian.cpp @@ -969,18 +969,18 @@ void QS60Style::handleDynamicLayoutVariantSwitch() d->setActiveLayout(); #endif // QT_S60STYLE_LAYOUTDATA_SIMULATED d->refreshUI(); + d->setThemePalette(qApp); foreach (QWidget *widget, QApplication::allWidgets()) - d->setThemePalette(widget); + widget->ensurePolished(); } void QS60Style::handleSkinChange() { Q_D(QS60Style); d->clearCaches(); - foreach (QWidget *topLevelWidget, QApplication::allWidgets()){ - d->setThemePalette(topLevelWidget); - topLevelWidget->update(); - } + d->setThemePalette(qApp); + foreach (QWidget *topLevelWidget, QApplication::allWidgets()) + topLevelWidget->ensurePolished(); } QT_END_NAMESPACE -- cgit v0.12 From b20ca123c521a1dae695045211c253c221ed604a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 30 Apr 2009 13:06:55 +0300 Subject: S60Style: Build break fix for 3.2SDK environment (it is lacking some skin IDs that are available in 3.2RnD environment). --- src/gui/styles/qs60style_symbian.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gui/styles/qs60style_symbian.cpp b/src/gui/styles/qs60style_symbian.cpp index 353926e..ab1deb0 100644 --- a/src/gui/styles/qs60style_symbian.cpp +++ b/src/gui/styles/qs60style_symbian.cpp @@ -245,15 +245,15 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* SP_QsnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/ // No pressed state for toolbar button in 3.1/3.2. - /* SP_QsnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrSctrlButtonCornerTlPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2171}, /*KAknsIIDQsnFrButtonTbCornerTl*/ - /* SP_QsnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrSctrlButtonCornerTrPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2172}, - /* SP_QsnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrSctrlButtonCornerBlPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2173}, - /* SP_QsnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrSctrlButtonCornerBrPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2174}, - /* SP_QsnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrSctrlButtonSideTPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2175}, - /* SP_QsnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrSctrlButtonSideBPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2176}, - /* SP_QsnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrSctrlButtonSideLPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2177}, - /* SP_QsnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrSctrlButtonSideRPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2178}, - /* SP_QsnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrSctrlButtonCenterPressed, ENoDraw, ES60_5_0, -1,EAknsMajorSkin,0x2179} + /* SP_QsnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2621}, /*KAknsIIDQsnFrSctrlButtonCornerTlPressed*/ + /* SP_QsnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2622}, + /* SP_QsnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2623}, + /* SP_QsnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2624}, + /* SP_QsnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2625}, + /* SP_QsnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2626}, + /* SP_QsnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2627}, + /* SP_QsnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2628}, + /* SP_QsnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_1 | ES60_3_2, -1,EAknsMajorSkin,0x2629} }; QPixmap QS60StyleModeSpecifics::skinnedGraphics( -- cgit v0.12 From 943519ba6684a700998cba94226389f2c509d065 Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 4 May 2009 09:13:28 +0200 Subject: Don't show Symbian plugin stubs in Git. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 58d0cc6..4c2ba32 100644 --- a/.gitignore +++ b/.gitignore @@ -185,6 +185,7 @@ bld.inf !s60main.rss *.pkg plugin_commonU.def +*.qtplugin *.sis *.sisx -- cgit v0.12 From 1a0fd473bcea62d1e471bb49ca06d931d0deb616 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 4 May 2009 14:43:52 +0300 Subject: Fix for thread termination in Symbian OS. Since Open C does not support all pthread funtions, thread termination in Symbian OS is implemented differently. Before this fix, QThread::Terminate just terminated the native thread. Because QThreadPrivate::finish was not called, the 'running', 'finished' etc flags were not set and thread termination related signals were not correctly emitted. In UNIX finish is called by pthread_cancel since thread cancelation points are set. In Symbian OS we need to call it manually since pthread_cancel is not supported. It was necessary to add a new parameter to QThreadPrivate::finish, which tells whether the native thread handle can be closed or not. This was required since 'symbian_thread_handle.Terminate' will not succeed if thread handle is closed. On the other hand we cannot first terminate the thread and then call QThreadPrivate::finish. Autotest: qthread and qprocess passes in HW (5800) and Emulator Review By: miikka.heikkinen@digia.com --- src/corelib/thread/qthread_p.h | 2 +- src/corelib/thread/qthread_unix.cpp | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index f07fad8..0bf773c 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -182,7 +182,7 @@ public: static void *start(void *arg); #if defined(Q_OS_SYMBIAN) - static void finish(void *arg, bool lockAnyway=true); + static void finish(void *arg, bool lockAnyway=true, bool closeNativeHandle=true); #else static void finish(void *); #endif diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index aad55bc..567c936 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -226,7 +226,7 @@ void *QThreadPrivate::start(void *arg) } #ifdef Q_OS_SYMBIAN -void QThreadPrivate::finish(void *arg, bool lockAnyway) +void QThreadPrivate::finish(void *arg, bool lockAnyway, bool closeNativeHandle) #else void QThreadPrivate::finish(void *arg) #endif @@ -258,7 +258,8 @@ void QThreadPrivate::finish(void *arg) d->thread_id = 0; #ifdef Q_OS_SYMBIAN - d->data->symbian_thread_handle.Close(); + if (closeNativeHandle) + d->data->symbian_thread_handle.Close(); #endif d->thread_done.wakeAll(); #ifdef Q_OS_SYMBIAN @@ -530,10 +531,11 @@ void QThread::terminate() d->terminatePending = true; return; } - - d->data->symbian_thread_handle.Terminate(KErrNone); - + d->terminated = true; + QThreadPrivate::finish(this, false, false); + d->data->symbian_thread_handle.Terminate(KErrNone); + d->data->symbian_thread_handle.Close(); #endif -- cgit v0.12 From 4d9acb8baf4af1fe203c937c9ee8d3c3714212f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Tue, 5 May 2009 09:36:39 +0300 Subject: S60Style: renamed pixelmetricsmapper files and relocated them all under one subfolder. --- util/s60pixelmetrics/bld.inf | 45 + util/s60pixelmetrics/inc/pixel_metrics.h | 216 ---- util/s60pixelmetrics/pixel_metrics.cpp | 1223 ++++++++++++++++++++ util/s60pixelmetrics/pixel_metrics.h | 216 ++++ .../pixelmetricsmapper/PMMapper.hrh | 73 -- .../pixelmetricsmapper/PMMapperApp.cpp | 1044 ----------------- .../pixelmetricsmapper/PMMapperApp.h | 198 ---- .../pixelmetricsmapper/PMMapperView.cpp | 375 ------ .../pixelmetricsmapper/PMMapperView.h | 228 ---- util/s60pixelmetrics/pixelmetricsmapper/bld.inf | 45 - .../pixelmetricsmapper/pm_mapper.mmp | 92 -- .../pixelmetricsmapper/pm_mapper.rss | 162 --- .../pixelmetricsmapper/pm_mapper_reg.rss | 57 - .../pixelmetricsmapper/pmmapper.pkg | 32 - util/s60pixelmetrics/pm_mapper.hrh | 73 ++ util/s60pixelmetrics/pm_mapper.mmp | 91 ++ util/s60pixelmetrics/pm_mapper.pkg | 32 + util/s60pixelmetrics/pm_mapper.rss | 162 +++ util/s60pixelmetrics/pm_mapper_reg.rss | 57 + util/s60pixelmetrics/pm_mapperapp.cpp | 1044 +++++++++++++++++ util/s60pixelmetrics/pm_mapperapp.h | 198 ++++ util/s60pixelmetrics/pm_mapperview.cpp | 375 ++++++ util/s60pixelmetrics/pm_mapperview.h | 228 ++++ util/s60pixelmetrics/src/pixel_metrics.cpp | 1217 ------------------- 24 files changed, 3744 insertions(+), 3739 deletions(-) create mode 100644 util/s60pixelmetrics/bld.inf delete mode 100644 util/s60pixelmetrics/inc/pixel_metrics.h create mode 100644 util/s60pixelmetrics/pixel_metrics.cpp create mode 100644 util/s60pixelmetrics/pixel_metrics.h delete mode 100644 util/s60pixelmetrics/pixelmetricsmapper/PMMapper.hrh delete mode 100644 util/s60pixelmetrics/pixelmetricsmapper/PMMapperApp.cpp delete mode 100644 util/s60pixelmetrics/pixelmetricsmapper/PMMapperApp.h delete mode 100644 util/s60pixelmetrics/pixelmetricsmapper/PMMapperView.cpp delete mode 100644 util/s60pixelmetrics/pixelmetricsmapper/PMMapperView.h delete mode 100644 util/s60pixelmetrics/pixelmetricsmapper/bld.inf delete mode 100644 util/s60pixelmetrics/pixelmetricsmapper/pm_mapper.mmp delete mode 100644 util/s60pixelmetrics/pixelmetricsmapper/pm_mapper.rss delete mode 100644 util/s60pixelmetrics/pixelmetricsmapper/pm_mapper_reg.rss delete mode 100644 util/s60pixelmetrics/pixelmetricsmapper/pmmapper.pkg create mode 100644 util/s60pixelmetrics/pm_mapper.hrh create mode 100644 util/s60pixelmetrics/pm_mapper.mmp create mode 100644 util/s60pixelmetrics/pm_mapper.pkg create mode 100644 util/s60pixelmetrics/pm_mapper.rss create mode 100644 util/s60pixelmetrics/pm_mapper_reg.rss create mode 100644 util/s60pixelmetrics/pm_mapperapp.cpp create mode 100644 util/s60pixelmetrics/pm_mapperapp.h create mode 100644 util/s60pixelmetrics/pm_mapperview.cpp create mode 100644 util/s60pixelmetrics/pm_mapperview.h delete mode 100644 util/s60pixelmetrics/src/pixel_metrics.cpp diff --git a/util/s60pixelmetrics/bld.inf b/util/s60pixelmetrics/bld.inf new file mode 100644 index 0000000..748e8810 --- /dev/null +++ b/util/s60pixelmetrics/bld.inf @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the utility applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +PRJ_MMPFILES +pm_mapper.mmp + +// End of File diff --git a/util/s60pixelmetrics/inc/pixel_metrics.h b/util/s60pixelmetrics/inc/pixel_metrics.h deleted file mode 100644 index 7235bda..0000000 --- a/util/s60pixelmetrics/inc/pixel_metrics.h +++ /dev/null @@ -1,216 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utility applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PIXELMETRICS_H -#define PIXELMETRICS_H - -#include -//#define S60_Rnd_Env - -#ifdef S60_Rnd_Env -#pragma message ("Building in supported environment") - -const TInt KUnknownBase = -5000; - -NONSHARABLE_CLASS( QStyle ) - { - public: - enum PixelMetric { - PM_ButtonMargin, - PM_ButtonDefaultIndicator, - PM_MenuButtonIndicator, - PM_ButtonShiftHorizontal, - PM_ButtonShiftVertical, - - PM_DefaultFrameWidth, - PM_SpinBoxFrameWidth, - PM_ComboBoxFrameWidth, - - PM_MaximumDragDistance, - - PM_ScrollBarExtent, - PM_ScrollBarSliderMin, - - PM_SliderThickness, // total slider thickness - PM_SliderControlThickness, // thickness of the business part - PM_SliderLength, // total length of slider - PM_SliderTickmarkOffset, // - PM_SliderSpaceAvailable, // available space for slider to move - - PM_DockWidgetSeparatorExtent, - PM_DockWidgetHandleExtent, - PM_DockWidgetFrameWidth, - - PM_TabBarTabOverlap, - PM_TabBarTabHSpace, - PM_TabBarTabVSpace, - PM_TabBarBaseHeight, - PM_TabBarBaseOverlap, - - PM_ProgressBarChunkWidth, - - PM_SplitterWidth, - PM_TitleBarHeight, - - PM_MenuScrollerHeight, - PM_MenuHMargin, - PM_MenuVMargin, - PM_MenuPanelWidth, - PM_MenuTearoffHeight, - PM_MenuDesktopFrameWidth, - - PM_MenuBarPanelWidth, - PM_MenuBarItemSpacing, - PM_MenuBarVMargin, - PM_MenuBarHMargin, - - PM_IndicatorWidth, - PM_IndicatorHeight, - PM_ExclusiveIndicatorWidth, - PM_ExclusiveIndicatorHeight, - PM_CheckListButtonSize, - PM_CheckListControllerSize, - - PM_DialogButtonsSeparator, - PM_DialogButtonsButtonWidth, - PM_DialogButtonsButtonHeight, - - PM_MdiSubWindowFrameWidth, - PM_MDIFrameWidth = PM_MdiSubWindowFrameWidth, //obsolete - PM_MdiSubWindowMinimizedWidth, - PM_MDIMinimizedWidth = PM_MdiSubWindowMinimizedWidth, //obsolete - - PM_HeaderMargin, - PM_HeaderMarkSize, - PM_HeaderGripMargin, - PM_TabBarTabShiftHorizontal, - PM_TabBarTabShiftVertical, - PM_TabBarScrollButtonWidth, - - PM_ToolBarFrameWidth, - PM_ToolBarHandleExtent, - PM_ToolBarItemSpacing, - PM_ToolBarItemMargin, - PM_ToolBarSeparatorExtent, - PM_ToolBarExtensionExtent, - - PM_SpinBoxSliderHeight, - - PM_DefaultTopLevelMargin, - PM_DefaultChildMargin, - PM_DefaultLayoutSpacing, - - PM_ToolBarIconSize, - PM_ListViewIconSize, - PM_IconViewIconSize, - PM_SmallIconSize, - PM_LargeIconSize, - - PM_FocusFrameVMargin, - PM_FocusFrameHMargin, - - PM_ToolTipLabelFrameWidth, - PM_CheckBoxLabelSpacing, - PM_TabBarIconSize, - PM_SizeGripSize, - PM_DockWidgetTitleMargin, - PM_MessageBoxIconSize, - PM_ButtonIconSize, - - PM_DockWidgetTitleBarButtonMargin, - - PM_RadioButtonLabelSpacing, - PM_LayoutLeftMargin, - PM_LayoutTopMargin, - PM_LayoutRightMargin, - PM_LayoutBottomMargin, - PM_LayoutHorizontalSpacing, - PM_LayoutVerticalSpacing, - PM_TabBar_ScrollButtonOverlap, - - PM_TextCursorWidth, - - PM_TabCloseIndicatorWidth, - PM_TabCloseIndicatorHeight, - - PM_ScrollView_ScrollBarSpacing, - PM_SubMenuOverlap, - - // do not add any values below/greater than this - PM_CustomBase = 0xf0000000, - - // The following are custom values needed to draw the S60Style according scalable UIs. - // Width of 9-part frame-corner - PM_Custom_FrameCornerWidth, - // Height of 9-part frame corner - PM_Custom_FrameCornerHeight, - // Bold line width - PM_Custom_BoldLineWidth, - // Thin line width - PM_Custom_ThinLineWidth - }; - - }; -#else -#pragma message ("Building in non-supported environment, this probably fails") -#endif - - -// Pixel metrics version information. -class TPixelMetricsVersion - { - public: - TInt majorVersion; - TInt minorVersion; - }; - -NONSHARABLE_CLASS(PixelMetrics) -{ - public: - static TPixelMetricsVersion Version(); - static TInt PixelMetricValue(QStyle::PixelMetric); - - private: - static TInt PixelMetricMenuValue( QStyle::PixelMetric menuValue, TRect mainPaneRect ); - static TInt PixelMetricTabValue( QStyle::PixelMetric tabValue, TRect appWindow, TBool landscape ); -}; - -#endif // PIXELMETRICS_H diff --git a/util/s60pixelmetrics/pixel_metrics.cpp b/util/s60pixelmetrics/pixel_metrics.cpp new file mode 100644 index 0000000..8925ebe --- /dev/null +++ b/util/s60pixelmetrics/pixel_metrics.cpp @@ -0,0 +1,1223 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the utility applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "pixel_metrics.h" + +#include +#include +#include +#include + +// Version number for dynamic calculations. These are to be exported to static data, +// 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; + +TPixelMetricsVersion PixelMetrics::Version() + { + TPixelMetricsVersion version; + version.majorVersion = KPMMajorVersion; + version.minorVersion = KPMMinorVersion; + return version; + } + +TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric) + { + TInt value = -909; + // Main pane + TRect mainPaneRect; + AknLayoutUtils::LayoutMetricsRect( + AknLayoutUtils::EMainPane, + mainPaneRect ); + // Screen + TRect screenRect; + AknLayoutUtils::LayoutMetricsRect( + AknLayoutUtils::EApplicationWindow, + screenRect ); + // Navi pane + TRect naviPaneRect; + AknLayoutUtils::LayoutMetricsRect( + AknLayoutUtils::ENaviPane, + naviPaneRect ); + + TAknLayoutRect appWindow; + appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); + + TInt variety = 0; + TBool landscape = EFalse; + if ( screenRect.iBr.iX > screenRect.iBr.iY ) + { + // in landscape another variety is used + landscape = ETrue; + } + switch (metric) + { + case QStyle::PM_DockWidgetHandleExtent: + // what's this??? Not in S60 + break; + case QStyle::PM_CheckListControllerSize: + case QStyle::PM_CheckListButtonSize: + { + // hierarchical menu - checkbox / radiobutton + // Area (width/height) of the checkbox/radio button in a Q3CheckListItem. + TAknLayoutRect listScrollPane; + listScrollPane.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_gen_pane(0)); + TAknLayoutRect listGenPane; + listGenPane.LayoutRect( listScrollPane.Rect(), AknLayoutScalable_Avkon::list_gen_pane(0)); + TAknLayoutRect listHierarchyPane; + listHierarchyPane.LayoutRect( listGenPane.Rect(), AknLayoutScalable_Avkon::list_single_graphic_hl_pane(0)); + + TAknLayoutRect listHierarchyControllerPane; + listHierarchyPane.LayoutRect( listHierarchyPane.Rect(), AknLayoutScalable_Avkon::list_single_graphic_hl_pane_g3(0)); + TAknLayoutRect listHierarchyPropertyPane; + listHierarchyPropertyPane.LayoutRect( listHierarchyPane.Rect(), AknLayoutScalable_Avkon::list_single_graphic_hl_pane_g2(0)); + + if (metric==QStyle::PM_CheckListControllerSize)value = Max( listHierarchyPane.Rect().Width(), listHierarchyPane.Rect().Width()); + else value = Max( listHierarchyPropertyPane.Rect().Width(), listHierarchyPropertyPane.Rect().Width()); + } + break; + case QStyle::PM_DialogButtonsSeparator: //Distance between buttons in a dialog buttons widget. + case QStyle::PM_DialogButtonsButtonWidth: // Minimum width of a button in a dialog buttons widget. + case QStyle::PM_DialogButtonsButtonHeight:// Minimum height of a button in a dialog buttons widget. + { + TAknLayoutRect appWindow; + appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); + variety = 0; + if ( landscape ) + { + variety = 2; + } + TAknLayoutRect areaBottomRect; + areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) ); + + TAknLayoutRect controlPaneRect; + controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() ); + TAknLayoutText controlPaneLSKText; + TAknLayoutText controlPaneRSKText; + TAknLayoutText controlPaneMSKText; + variety = 0; + if (AknLayoutUtils::MSKEnabled()) + { + variety = 3; + controlPaneMSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t3(variety)); //MSK text area + } + controlPaneLSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t1(variety)); //LSK text area + controlPaneRSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t2(variety)); //RSK text area + + /* + * + ================================================================================== + | A | LSK_rect | B | MSK_rect | C | RSK_rect | D | + ================================================================================== + where A is left padding (between control pane and LSK rect) + B is mid-left padding (between LSK and MSK rects) + C is mid-right padding (between MSK and RSK rects) + D is right padding (between RSK and control pane) + + ==> Since all these can be separate, lets take Max of {A..D} for PM value + */ + + TInt itemSpacingA = 0; + TInt itemSpacingB = 0; + TInt itemSpacingC = 0; + TInt itemSpacingMax = 0; + if ( !AknLayoutUtils::MSKEnabled() ) + { + itemSpacingA = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX; + itemSpacingB = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX; + if (!landscape) + { + // use mid-gap only in portrait + itemSpacingC = controlPaneRSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX; + } + itemSpacingMax = Max(itemSpacingA, Max( itemSpacingB, itemSpacingC)); + // no itemspacing4 if no MSK + } + else + { + TInt itemSpacingD = 0; + itemSpacingA = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX; + itemSpacingB = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX; + if ( !(AknLayoutUtils::PenEnabled() || landscape) ) // no MSK in touch, nor in landscape + { + itemSpacingC = controlPaneRSKText.TextRect().iTl.iX - controlPaneMSKText.TextRect().iBr.iX; + itemSpacingD = controlPaneMSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX; + } + itemSpacingMax = Max(itemSpacingA, Max( itemSpacingB, Max( itemSpacingC, itemSpacingD ))); + } + if (metric==QStyle::PM_DialogButtonsSeparator) value = itemSpacingMax; + else if (metric==QStyle::PM_DialogButtonsButtonWidth) + { + value = Max( controlPaneLSKText.TextRect().Width(), controlPaneRSKText.TextRect().Width()); + if (AknLayoutUtils::MSKEnabled()) + { + value = Max(value, controlPaneMSKText.TextRect().Width()); + } + } + else if (metric==QStyle::PM_DialogButtonsButtonHeight) + { + value = Max( controlPaneLSKText.TextRect().Height(), controlPaneRSKText.TextRect().Height()); + if (AknLayoutUtils::MSKEnabled()) + { + value = Max(value, controlPaneMSKText.TextRect().Height()); + } + } + } + break; + case QStyle::PM_DockWidgetTitleMargin: // not in S60, lets use the same margin as in button + case QStyle::PM_DockWidgetTitleBarButtonMargin: // not in S60, lets use the same margin as in button + case QStyle::PM_ButtonMargin: + { + TRect myRect(TSize( 80, 20)); // this arbitrary size - user can set it - button border does not seem to have any scalability in it + TAknLayoutRect buttonRect; + TAknLayoutRect buttonBordersRect; + TAknLayoutText buttonText; + + buttonRect.LayoutRect( myRect, AknLayoutScalable_Avkon::eswt_ctrl_button_pane()); + buttonBordersRect.LayoutRect( buttonRect.Rect(), AknLayoutScalable_Avkon::common_borders_pane_copy2(0)); //with text + buttonText.LayoutText( buttonRect.Rect(), AknLayoutScalable_Avkon::control_button_pane_t1() ); + + // Its better to use left-right margins, since font deployment can create funny top / bottom margins + TInt leftMargin = buttonText.TextRect().iTl.iX - buttonBordersRect.Rect().iTl.iX; + TInt rightMargin = buttonBordersRect.Rect().iBr.iX - buttonText.TextRect().iBr.iX; + value = (TInt) ((leftMargin+rightMargin)/2); + } + break; + case QStyle::PM_ButtonDefaultIndicator: + { + // no default button indicators in S60 + value = 0; + } + break; + case QStyle::PM_MdiSubWindowFrameWidth: + case QStyle::PM_ComboBoxFrameWidth: + case QStyle::PM_SpinBoxFrameWidth: + value = 0; + break; + case QStyle::PM_ToolBarFrameWidth: + case QStyle::PM_DefaultFrameWidth: + { + TAknLayoutRect highLightPaneRect; + TAknLayoutRect centerPaneRect; + TRect rectParent( mainPaneRect ); + highLightPaneRect.LayoutRect( rectParent, AknLayoutScalable_Avkon::toolbar_button_pane(0).LayoutLine()); + centerPaneRect.LayoutRect(rectParent, AknLayoutScalable_Avkon::toolbar_button_pane_g1().LayoutLine()); + + value = highLightPaneRect.Rect().iBr.iX - centerPaneRect.Rect().iBr.iX; + } + break; + case QStyle::PM_RadioButtonLabelSpacing: + { + /* + * + =================================================================================== + | A | iconLayoutRect |B| itemText | C | + =================================================================================== + mirrored: + =================================================================================== + | C | itemText |B| iconLayoutRect | A | + =================================================================================== + where A is left padding + B is gap between icon and text + C is right padding + */ + + TRect rectParent( mainPaneRect ); + TAknLayoutRect layoutRect; + layoutRect.LayoutRect( rectParent,AknLayoutScalable_Avkon::list_choice_list_pane(1).LayoutLine() ); // w/ scrollbar + TAknLayoutText itemText; + itemText.LayoutText( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1) ); + TAknLayoutRect iconLayoutRect; + iconLayoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_g1().LayoutLine() ); + + if ( !AknLayoutUtils::LayoutMirrored() ) + { + value = itemText.TextRect().iTl.iX - iconLayoutRect.Rect().iBr.iX; + } + else + { + value = iconLayoutRect.Rect().iTl.iX - itemText.TextRect().iBr.iX; + } + } + + break; + case QStyle::PM_CheckBoxLabelSpacing: + { + /* + * + =================================================================================== + | A | iconLayoutRect |B| itemText | C | + =================================================================================== + mirrored: + =================================================================================== + | C | itemText |B| iconLayoutRect | A | + =================================================================================== + where A is left padding + B is gap between icon and text + C is right padding + */ + + TRect rectParent( mainPaneRect ); + TAknLayoutRect layoutRect; + layoutRect.LayoutRect( rectParent, AknLayoutScalable_Avkon::listscroll_gen_pane(0).LayoutLine() ); + + TAknLayoutRect layoutRect2; + layoutRect2.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Avkon::list_gen_pane(0).LayoutLine() ); + TAknLayoutRect layoutRect3; + layoutRect3.LayoutRect( layoutRect2.Rect(), AknLayoutScalable_Avkon::list_single_graphic_pane(0).LayoutLine() ); + + TAknLayoutText itemText; + itemText.LayoutText( layoutRect3.Rect(), AknLayoutScalable_Avkon::list_single_graphic_pane_t1(0) ); + TAknLayoutRect iconLayoutRect; + iconLayoutRect.LayoutRect( layoutRect3.Rect(), AknLayoutScalable_Avkon::list_single_graphic_pane_g1(0).LayoutLine() ); + + if ( !AknLayoutUtils::LayoutMirrored() ) + { + value = itemText.TextRect().iTl.iX - iconLayoutRect.Rect().iBr.iX; + } + else + { + value = iconLayoutRect.Rect().iTl.iX - itemText.TextRect().iBr.iX; + } + } + break; + case QStyle::PM_ToolTipLabelFrameWidth: + { + /* + * + |===================================================================================| + | info popup note B | + | ============================================================================== | + | A | hintText | D| + | ============================================================================== | + | C | + |===================================================================================| + where A is left padding + B is top padding + C is bottom padding + D is right padding + we'll provide the average of top and bottom padding as PM_ToolTipLabelFrameWidth + */ + + // Set pop-up to contain only one line of text + TInt index = 0; + if ( landscape ) + { + // in landscape another variety is used + index += 5; + } + // Get parameter and table limits for popup preview text window + TAknLayoutScalableParameterLimits limits = + AknLayoutScalable_Avkon::popup_preview_text_window_ParamLimits(); + + TAknLayoutScalableTableLimits tableLimits = + AknLayoutScalable_Avkon::popup_preview_text_window_t_Limits(); + + TInt windowVariety = Min( Max( index, limits.FirstVariety() ), limits.LastVariety() ); + + TAknLayoutScalableParameterLimits tParamLimits = + AknLayoutScalable_Avkon:: popup_preview_text_window_t_ParamLimits( + tableLimits.FirstIndex() ); + + TInt lineVariety = Min( Max( index, tParamLimits.FirstVariety() ), tParamLimits.LastVariety() ); + + TAknWindowLineLayout lineLayout = AknLayoutScalable_Avkon::popup_preview_text_window(windowVariety).LayoutLine(); + + // rect for the whole info popup + TAknLayoutRect layoutRect; + layoutRect.LayoutRect(screenRect, lineLayout); + TRect rectPopupWindow = layoutRect.Rect(); + + TAknTextComponentLayout popupTextLayout = + AknLayoutScalable_Avkon::popup_preview_text_window_t( + tableLimits.FirstIndex(), lineVariety ); + + // rect for the whole the text inside the popup + TAknLayoutText layoutText; + layoutText.LayoutText( rectPopupWindow, popupTextLayout ); + + // Each margin has different value in S60 - let's take average of top & bottom + TInt topMargin = layoutText.TextRect().iTl.iY - layoutRect.Rect().iTl.iY; + TInt bottomMargin = layoutRect.Rect().iBr.iY - layoutText.TextRect().iBr.iY; + TInt averageMargin = (TInt)(topMargin+bottomMargin)/2; + value = averageMargin; + } + break; + case QStyle::PM_ListViewIconSize: + { + // todo: there are lots and lots of views with different sized icons - which one to use? + // todo: this is probably not a good default icon size, as this fetches A column icon size + // todo: preferably use settings item with graphic instead + TAknLayoutRect iconRect; + iconRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::list_double_graphic_pane_g1_cp2(0).LayoutLine()); + //icon areas are usually squares - lets take bigger of two dimensions + value = Max( iconRect.Rect().Width(), iconRect.Rect().Height() ); + } + break; + + case QStyle::PM_LargeIconSize: // lets use AS icon as a base for large icon + case QStyle::PM_IconViewIconSize: + { + // Lets assume that we'd take these from grid (3x4) layout + TAknLayoutRect appPaneRect; + TAknLayoutRect gridAppRect; + TAknLayoutRect cellAppRect; + TInt varietyGrid = 2; //Let's use the 3x4 grid as a base. + TInt varietyCell = 1; //Let's use the 3x4 grid as a base. + if ( landscape ) + { + varietyGrid = 3; + varietyCell = 2; + } + appPaneRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_app_pane(1).LayoutLine()); //3x4 grid + gridAppRect.LayoutRect( appPaneRect.Rect(), AknLayoutScalable_Avkon::grid_app_pane(varietyGrid).LayoutLine()); + cellAppRect.LayoutRect( gridAppRect.Rect(), AknLayoutScalable_Avkon::cell_app_pane(varietyCell, 0, 0).LayoutLine()); + TAknLayoutRect cellGraphRect; + TAknWindowComponentLayout appIcon = AknLayoutScalable_Avkon::cell_app_pane_g1(0); // no mark, no highlight + cellGraphRect.LayoutRect( gridAppRect.Rect(), appIcon); + //icon areas are usually squares - if not, lets take larger + value = Max( cellGraphRect.Rect().Width(), cellGraphRect.Rect().Height()); + } + break; + case QStyle::PM_TabBarIconSize: + { + TAknLayoutRect naviNaviRect; + naviNaviRect.LayoutRect( naviPaneRect, AknLayoutScalable_Avkon::navi_navi_tabs_pane().LayoutLine()); // two tabs + TAknLayoutRect tabRect; + tabRect.LayoutRect( naviNaviRect.Rect(), AknLayoutScalable_Avkon::navi_tabs_3_pane().LayoutLine()); //active tab on left + TAknLayoutRect activeTabRect; + activeTabRect.LayoutRect( tabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane(0).LayoutLine()); //active tab + TAknLayoutRect activeTabGraphicRect; + + activeTabGraphicRect.LayoutRect( activeTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane_g1().LayoutLine()); //active tab graphic + value = Min(activeTabGraphicRect.Rect().Width(), activeTabGraphicRect.Rect().Height()); + } + break; + case QStyle::PM_MessageBoxIconSize: + { + TAknLayoutRect noteRect; + noteRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_note_image_window(0).LayoutLine()); //note with image + TAknLayoutRect noteImageRect; + noteImageRect.LayoutRect( noteRect.Rect(), AknLayoutScalable_Avkon::popup_note_image_window_g2(2).LayoutLine()); //note with image + value = noteImageRect.Rect().Width(); + } + break; + case QStyle::PM_TextCursorWidth: + { + TAknLayoutRect miscGraphicsRect; + miscGraphicsRect.LayoutRect( screenRect, AknLayoutScalable_Avkon::misc_graphics()); + miscGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::misc_graphics()); + TAknLayoutRect textsGraphicsRect; + textsGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::texts_graphics()); + TAknLayoutRect cursorGraphicsRect; + cursorGraphicsRect.LayoutRect( textsGraphicsRect.Rect(), AknLayoutScalable_Avkon::cursor_graphics_pane()); + TAknLayoutRect cursorPrimaryRect; + cursorPrimaryRect.LayoutRect( cursorGraphicsRect.Rect(), AknLayoutScalable_Avkon::cursor_primary_pane()); + TAknLayoutRect cursorRect; + cursorRect.LayoutRect( cursorPrimaryRect.Rect(), AknLayoutScalable_Avkon::cursor_digital_pane_g1()); + value = cursorRect.Rect().Width(); + } + break; + case QStyle::PM_SliderLength: + { + TAknLayoutRect settingRect; + settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() ); + TAknLayoutRect settingContentRect; + settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() ); + TAknLayoutRect sliderRect; + sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() ); + TAknLayoutRect sliderSettingRect; + sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() ); + TAknLayoutRect sliderGraph2Rect; + sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() ); + value = sliderGraph2Rect.Rect().Width(); + } + break; + case QStyle::PM_SliderThickness: + { + TAknLayoutRect settingRect; + settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() ); + TAknLayoutRect settingContentRect; + settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() ); + TAknLayoutRect sliderRect; + sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() ); + TAknLayoutRect sliderSettingRect; + sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() ); + TAknLayoutRect sliderGraph2Rect; + sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() ); + value = (TInt)(sliderGraph2Rect.Rect().Height()*1.5); // add assumed tickmark height + } + break; + case QStyle::PM_SliderTickmarkOffset: + { + TAknLayoutRect settingRect; + settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() ); + TAknLayoutRect settingContentRect; + settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() ); + TAknLayoutRect sliderRect; + sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() ); + TAknLayoutRect sliderSettingRect; + sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() ); + TAknLayoutRect sliderGraph2Rect; + sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() ); + value = (TInt)(sliderGraph2Rect.Rect().Height()*0.5); // no tickmarks in S60, lets assume they are half the size of slider indicator + } + break; + case QStyle::PM_SliderControlThickness: + { + TAknLayoutRect settingRect; + settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() ); + TAknLayoutRect settingContentRect; + settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() ); + TAknLayoutRect sliderRect; + sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() ); + TAknLayoutRect sliderSettingRect; + sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() ); + TAknLayoutRect sliderGraph2Rect; + sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() ); + value = sliderGraph2Rect.Rect().Height(); + } + break; + case QStyle::PM_SliderSpaceAvailable: + { + TAknLayoutRect settingRect; + settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() ); + TAknLayoutRect settingContentRect; + settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() ); + TAknLayoutRect sliderRect; + sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() ); + TAknLayoutRect sliderSettingRect; + sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() ); + value = sliderSettingRect.Rect().Width(); + } + break; + case QStyle::PM_MenuBarItemSpacing: + { + TAknLayoutRect appWindow; + appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); + + variety = 0; + if ( landscape ) + { + variety = 2; + } + TAknLayoutRect areaBottomRect; + areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) ); + + TAknLayoutRect controlPaneRect; + controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() ); + TAknLayoutText controlPaneLSKText; + TAknLayoutText controlPaneRSKText; + TAknLayoutText controlPaneMSKText; + variety = 0; + if (AknLayoutUtils::MSKEnabled()) + { + variety = 3; + controlPaneMSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t3(variety)); //MSK text area + } + controlPaneLSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t1(variety)); //LSK text area + controlPaneRSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t2(variety)); //RSK text area + + /* + * + ================================================================================== + | A | LSK_rect | B | MSK_rect | C | RSK_rect | D | + ================================================================================== + where A is left padding (between control pane and LSK rect) + B is mid-left padding (between LSK and MSK rects) + C is mid-right padding (between MSK and RSK rects) + D is right padding (between RSK and control pane) + + ==> Since all these can be separate, lets take Max of {A..D} for PM value + */ + + TInt itemSpacing1 = 0; + TInt itemSpacing2 = 0; + TInt itemSpacing3 = 0; + TInt itemSpacing4 = 0; + TInt itemSpacingMax = 0; + if ( !AknLayoutUtils::MSKEnabled() ) + { + itemSpacing1 = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX; + itemSpacing2 = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX; + if ( !landscape ) + { + // use mid gap only in portrait + itemSpacing3 = controlPaneRSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX; + } + itemSpacingMax = Max(itemSpacing1, Max( itemSpacing2, itemSpacing3)); + // no itemspacing4 if no MSK + } + else + { + itemSpacing1 = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX; + itemSpacing2 = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX; + if ( !(AknLayoutUtils::PenEnabled() || landscape) ) // no MSK in touch, nor in landscape + { + itemSpacing3 = controlPaneRSKText.TextRect().iTl.iX - controlPaneMSKText.TextRect().iBr.iX; + itemSpacing4 = controlPaneMSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX; + } + itemSpacingMax = Max(itemSpacing1, Max( itemSpacing2, Max( itemSpacing3, itemSpacing4 ))); + } + value = itemSpacingMax; + } + break; + case QStyle::PM_MenuBarHMargin: + { + TAknLayoutRect appWindow; + appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); + + variety = 0; + if ( landscape ) + { + variety = 6; + } + TAknLayoutRect areaBottomRect; + areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) ); + + // variety 7 if thin status pane, 1 if no status pane, 3 if small status pane and with main pane, 4 otherwise (idle has bunch of own varieties) + TAknLayoutRect controlPaneRect; + controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() ); + value = areaBottomRect.Rect().Height() - controlPaneRect.Rect().Height(); + } + break; + case QStyle::PM_MenuBarVMargin: + { + TAknLayoutRect appWindow; + appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); + + variety = 0; + if ( landscape ) + { + variety = 6; + } + TAknLayoutText controlPaneLSKText; + TAknLayoutRect areaBottomRect; + areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) ); + // variety 7 if thin status pane, 1 if no status pane, 3 if small status pane and with main pane, 4 otherwise (idle has bunch of own varieties) + TAknLayoutRect controlPaneRect; + controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() ); + + variety = 0; + if (AknLayoutUtils::MSKEnabled()) + { + variety = 3; + } + controlPaneLSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t1(variety)); //LSK text area + + value = controlPaneRect.Rect().Height() - controlPaneLSKText.TextRect().Height(); + } + break; + case QStyle::PM_ToolBarItemSpacing: + { + TAknLayoutRect popupToolBarWindow; + variety = 4; + popupToolBarWindow.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_toolbar_window(variety) ); + TAknLayoutRect gridToolBarRect; + gridToolBarRect.LayoutRect( popupToolBarWindow.Rect(), AknLayoutScalable_Avkon::grid_toobar_pane() ); + TAknLayoutRect cellToolBarRect1; + TAknLayoutRect cellToolBarRect2; + cellToolBarRect1.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(0).LayoutLine() ); //first item + cellToolBarRect2.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(1).LayoutLine() ); //second item + value = cellToolBarRect1.Rect().iBr.iX - cellToolBarRect2.Rect().iTl.iX; + } + break; + case QStyle::PM_ToolBarItemMargin: + { + variety = 4; + TAknLayoutRect popupToolBarWindow; + popupToolBarWindow.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_toolbar_window(variety) ); + TAknLayoutRect gridToolBarRect; + gridToolBarRect.LayoutRect( popupToolBarWindow.Rect(), AknLayoutScalable_Avkon::grid_toobar_pane() ); + TAknLayoutRect cellToolBarRect1; + cellToolBarRect1.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(0).LayoutLine() ); //first item + value = gridToolBarRect.Rect().iTl.iX - cellToolBarRect1.Rect().iTl.iX; + } + break; + case QStyle::PM_LayoutLeftMargin: // there really isn't a default layoutting on s60, but lets use AppShell icon deployment as base + case QStyle::PM_LayoutRightMargin: + case QStyle::PM_LayoutTopMargin: + case QStyle::PM_LayoutBottomMargin: + case QStyle::PM_LayoutHorizontalSpacing: + case QStyle::PM_LayoutVerticalSpacing: + { + //since spacing and margins should be globally same, lets use same easy component as base - such as find popup + TAknLayoutRect popup_find_windowRect; + TAknLayoutRect bg_popup_window_pane_cp12Rect; + TAknLayoutRect find_popup_paneRect; + popup_find_windowRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_find_window(0).LayoutLine()); + bg_popup_window_pane_cp12Rect.LayoutRect( popup_find_windowRect.Rect(), AknLayoutScalable_Avkon::bg_popup_window_pane_cp12().LayoutLine()); + find_popup_paneRect.LayoutRect( bg_popup_window_pane_cp12Rect.Rect(), AknLayoutScalable_Avkon::find_popup_pane().LayoutLine()); + + const TBool mirrored = AknLayoutUtils::LayoutMirrored(); + if ((metric==QStyle::PM_LayoutVerticalSpacing && !mirrored) || metric==QStyle::PM_LayoutLeftMargin) + { + if (mirrored) + { + value = find_popup_paneRect.Rect().iTl.iX - bg_popup_window_pane_cp12Rect.Rect().iTl.iX; + } + else + { + value = find_popup_paneRect.Rect().iTl.iX - bg_popup_window_pane_cp12Rect.Rect().iTl.iX; + } + } + else if (metric==QStyle::PM_LayoutRightMargin || (metric==QStyle::PM_LayoutVerticalSpacing && mirrored)) + { + if (mirrored) + { + value = bg_popup_window_pane_cp12Rect.Rect().iBr.iX - find_popup_paneRect.Rect().iBr.iX; + } + else + { + value = bg_popup_window_pane_cp12Rect.Rect().iBr.iX - find_popup_paneRect.Rect().iBr.iX; + } + } + else if (metric==QStyle::PM_LayoutTopMargin || metric==QStyle::PM_LayoutHorizontalSpacing) + { + value = find_popup_paneRect.Rect().iTl.iY - bg_popup_window_pane_cp12Rect.Rect().iTl.iY; + } + else if (metric==QStyle::PM_LayoutBottomMargin) + { + value = bg_popup_window_pane_cp12Rect.Rect().iBr.iY - find_popup_paneRect.Rect().iBr.iY; + } + } + break; + case QStyle::PM_MaximumDragDistance: + { + value = -1; //disable - not in S60 + } + break; + case QStyle::PM_ScrollBarExtent: + { + TAknLayoutRect miscGraphicsRect; + miscGraphicsRect.LayoutRect( screenRect, AknLayoutScalable_Avkon::misc_graphics()); + miscGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::misc_graphics()); + TAknLayoutRect textsGraphicsRect; + textsGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::texts_graphics()); + TAknLayoutRect editorScrollRect; + editorScrollRect.LayoutRect( textsGraphicsRect.Rect(), AknLayoutScalable_Avkon::editor_scroll_pane()); + TAknLayoutRect scrollPaneRect; + scrollPaneRect.LayoutRect( editorScrollRect.Rect(), AknLayoutScalable_Avkon::scroll_pane_cp13()); + value = scrollPaneRect.Rect().Width(); // width of editor's scroll bar + } + break; + case QStyle::PM_ScrollBarSliderMin: + { + TAknLayoutRect listScrollPane; + listScrollPane.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_gen_pane(0)); + TAknLayoutRect scrollPane; + scrollPane.LayoutRect( listScrollPane.Rect(), AknLayoutScalable_Avkon::scroll_pane()); + TAknLayoutRect scrollHandlePane; + scrollHandlePane.LayoutRect( scrollPane.Rect(), AknLayoutScalable_Avkon::scroll_handle_pane()); + TAknLayoutRect aidMinSizePane; + aidMinSizePane.LayoutRect( scrollHandlePane.Rect(), AknLayoutScalable_Avkon::aid_size_min_handle()); // this gives min width size for horizontal scroll bar - same can be used for vertical height minimum + value = aidMinSizePane.Rect().Height(); + } + break; + case QStyle::PM_MenuBarPanelWidth: + { + TAknLayoutRect appWindow; + appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); + + variety = 0; + if ( landscape ) + { + variety = 2; + } + TAknLayoutRect areaBottomRect; + areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) ); + + // todo: prt: variety 7 if thin status pane, 1 if no status pane, 3 if small status pane and with main pane, 4 otherwise (idle has bunch of own varieties) + // todo: lsc: variety 6 if thin status pane + // todo: should stacon be considered? + TAknLayoutRect controlPaneRect; + controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() ); + value = areaBottomRect.Rect().Height() - controlPaneRect.Rect().Height(); //usually zero + } + break; + case QStyle::PM_ProgressBarChunkWidth: + { + // This is either deduced or skinned (for Java) in S60 + // Layout data does not know it. It would require parameters from the + // actual progress dialog to be able to calc this (max. value and increment) + // So we need to set up some values - lets take one tenth of progress dialog area: + TAknLayoutRect appWindow; + appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(variety) ); + if (landscape) + { + variety = 6; + } + TAknLayoutRect popupWaitWindowRect; + popupWaitWindowRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_note_wait_window(variety) ); + TAknLayoutRect waitbarPaneRect; + waitbarPaneRect.LayoutRect( popupWaitWindowRect.Rect(), AknLayoutScalable_Avkon::wait_bar_pane(0) ); + TAknLayoutRect waitAnimRect; + waitAnimRect.LayoutRect( waitbarPaneRect.Rect(), AknLayoutScalable_Avkon::wait_anim_pane() ); + value = (TInt) (waitAnimRect.Rect().Width() / 10); + } + break; + case QStyle::PM_TabBarTabOverlap: + case QStyle::PM_TabBarTabHSpace: + case QStyle::PM_TabBarTabVSpace: + case QStyle::PM_TabBarBaseHeight: + case QStyle::PM_TabBarBaseOverlap: + case QStyle::PM_TabBarScrollButtonWidth: + case QStyle::PM_TabBarTabShiftHorizontal: + case QStyle::PM_TabBarTabShiftVertical: + value = PixelMetricTabValue(metric, appWindow.Rect(), landscape); + break; + case QStyle::PM_MenuPanelWidth: + case QStyle::PM_MenuHMargin: + case QStyle::PM_MenuVMargin: + value = PixelMetricMenuValue(metric, mainPaneRect); + break; + case QStyle::PM_ButtonIconSize: + //lets use voice recorder icons as a base + //Unfortunately S60 graphics don't separate button bevel graphics from the actual icon. + //Se we have no means to query the margin from bevel border to "central icon" border. + //So, we need to make a estimate... + + const TInt varietyForButtons = !landscape ? 0 : 1; + + TAknLayoutRect vRMainRect; + vRMainRect.LayoutRect( mainPaneRect, AknLayoutScalable_Apps::main_vorec_pane() ); + + TAknLayoutRect vRButtonGridRect; + vRButtonGridRect.LayoutRect( vRMainRect.Rect(), AknLayoutScalable_Apps::grid_vorec_pane() ); + + TAknLayoutRect vRButtonCellRect; + vRButtonCellRect.LayoutRect( vRButtonGridRect.Rect(), AknLayoutScalable_Apps::cell_vorec_pane(0) ); + + TAknLayoutRect vRButtonCellGraphicsRect; + vRButtonCellGraphicsRect.LayoutRect( vRButtonCellRect.Rect(), AknLayoutScalable_Apps::cell_vorec_pane_g1() ); + + // 0.32 is the estimate how much the icon occupies of the button bevel area + value = vRButtonCellGraphicsRect.Rect().Width() * 0.32; + + break; + case QStyle::PM_SmallIconSize: + { + // lets use AI2 icon as a base + TAknLayoutRect idlePaneRect; + idlePaneRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::main_idle_act2_pane() ); + TAknLayoutRect idleDataRect; + idleDataRect.LayoutRect( idlePaneRect.Rect(), AknLayoutScalable_Avkon::popup_ai2_data_window(1) ); + TAknLayoutRect ai2GridRect; + ai2GridRect.LayoutRect( idleDataRect.Rect(), AknLayoutScalable_Avkon::grid_ai2_button_pane() ); + TAknLayoutRect ai2MpRect; + ai2MpRect.LayoutRect( ai2GridRect.Rect(), AknLayoutScalable_Avkon::ai2_mp_button_pane() ); + TAknLayoutRect ai2CellPaneRect; + ai2CellPaneRect.LayoutRect( ai2MpRect.Rect(), AknLayoutScalable_Avkon::cell_ai2_button_pane(1).LayoutLine() ); + TAknLayoutRect ai2CellButtonRect; + ai2CellButtonRect.LayoutRect( ai2CellPaneRect.Rect(), AknLayoutScalable_Avkon::cell_ai2_button_pane_g1()); + value = Min( ai2CellButtonRect.Rect().Width(), ai2CellButtonRect.Rect().Height()); + } + break; + case QStyle::PM_FocusFrameHMargin: + case QStyle::PM_FocusFrameVMargin: + { + TAknLayoutRect gridRect; + gridRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::grid_highlight_pane(0)); + TAknLayoutRect gridRectCenter; + gridRectCenter.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::cell_highlight_pane_g1()); + + // The difference of center piece from border tell the frame width. + if ( value == QStyle::PM_FocusFrameHMargin) + { + value = gridRect.Rect().iBr.iX - gridRectCenter.Rect().iBr.iX; + } + else + { + value = gridRect.Rect().iBr.iY - gridRectCenter.Rect().iBr.iY; + } + } + break; + case QStyle::PM_ToolBarIconSize: + { + TAknLayoutRect popupToolBarWindow; + variety = 4; + popupToolBarWindow.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_toolbar_window(variety) ); + TAknLayoutRect gridToolBarRect; + gridToolBarRect.LayoutRect( popupToolBarWindow.Rect(), AknLayoutScalable_Avkon::grid_toobar_pane() ); + TAknLayoutRect cellToolBarRect1; + TAknLayoutRect cellToolBarRect2; + cellToolBarRect1.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(0).LayoutLine() ); //first item + value = Min( cellToolBarRect1.Rect().Height(), cellToolBarRect1.Rect().Width() ); + } + break; + + case QStyle::PM_TitleBarHeight: // use titlepane height + { + TAknLayoutRect statusPaneRect; + TAknLayoutRect titlePane; + TAknLayoutRect areaTopRect; + if (landscape) + { + if ( AknLayoutUtils::PenEnabled() ) + { + // Top area - 0 is for classic landscape (used in touch landscape as well) + areaTopRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_top_pane(2) ); + // Status pane - 0 softkeys on right + statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_top_pane() ); + } + else + { + // Top area - 2 is for classic landscape. + areaTopRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(2) ); + // Stacon top pane (default ok) + statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_bottom_pane() ); + } + titlePane.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::title_pane_stacon(0) ); //softkeys on right + } + else + { + // Top area - 0 is for classic portrait + areaTopRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_top_pane(0) ); + // Status pane - 0 is for classic portrait + statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::status_pane(0) ); + titlePane.LayoutRect( statusPaneRect.Rect(), AknLayoutScalable_Avkon::title_pane(0) ); + } + value = titlePane.Rect().Height(); + } + break; + case QStyle::PM_IndicatorWidth: + case QStyle::PM_IndicatorHeight: + { + TRect rectParent( mainPaneRect ); + + TAknLayoutRect layoutRect; + layoutRect.LayoutRect( rectParent,AknLayoutScalable_Avkon::set_content_pane().LayoutLine() ); + TAknLayoutRect layoutRect2; + layoutRect2.LayoutRect( layoutRect.Rect(),AknLayoutScalable_Avkon::list_set_graphic_pane(0).LayoutLine() ); + + TAknLayoutRect iconLayoutRect; + iconLayoutRect.LayoutRect( layoutRect2.Rect(), AknLayoutScalable_Avkon::list_set_graphic_pane_g1(0).LayoutLine() ); + if (metric==QStyle::PM_IndicatorWidth) + { + value = iconLayoutRect.Rect().Width(); + } + else + { + value = iconLayoutRect.Rect().Height(); + } + } + break; + case QStyle::PM_ExclusiveIndicatorHeight: + case QStyle::PM_ExclusiveIndicatorWidth: + { + TRect rectParent( mainPaneRect ); + TAknLayoutRect layoutRect; + layoutRect.LayoutRect( rectParent,AknLayoutScalable_Avkon::list_choice_list_pane(1).LayoutLine() ); // w/ scrollbar + TAknLayoutText itemText; + itemText.LayoutText( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1) ); + TAknLayoutRect iconLayoutRect; + iconLayoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_g1().LayoutLine() ); + + if (metric==QStyle::PM_ExclusiveIndicatorHeight) + { + value = iconLayoutRect.Rect().Height(); + } + else + { + value = iconLayoutRect.Rect().Width(); + } + } + break; + + // These are obsolete. + case QStyle::PM_DefaultTopLevelMargin: + case QStyle::PM_DefaultChildMargin: + case QStyle::PM_DefaultLayoutSpacing: + break; + + case QStyle::PM_Custom_FrameCornerWidth: + { + TAknLayoutRect inputFocusRect; + inputFocusRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane(0)); + TAknLayoutRect inputFocusInnerRect; + inputFocusInnerRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane_g1()); + + value = inputFocusRect.Rect().iBr.iX - inputFocusInnerRect.Rect().iBr.iX; + value+= 2; //visually better value for generic cases + } + break; + case QStyle::PM_Custom_FrameCornerHeight: + { + TAknLayoutRect inputFocusRect; + inputFocusRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane(0)); + TAknLayoutRect inputFocusInnerRect; + inputFocusInnerRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane_g1()); + value = inputFocusRect.Rect().iBr.iY - inputFocusInnerRect.Rect().iBr.iY; + value+= 2; //visually better value for generic cases + } + break; + case QStyle::PM_Custom_BoldLineWidth: + value = 3; + break; + case QStyle::PM_Custom_ThinLineWidth: + value = 1; + break; + case QStyle::PM_ButtonShiftHorizontal: + case QStyle::PM_ButtonShiftVertical: + value = 0; + break; + + case QStyle::PM_ToolBarExtensionExtent: + value = PixelMetricTabValue(QStyle::PM_TabBarScrollButtonWidth, appWindow.Rect(), landscape); + break; + +// todo: re-check if these really are not available in s60 + case QStyle::PM_MenuDesktopFrameWidth: // not needed in S60 - dislocates Menu both horizontally and vertically + case QStyle::PM_HeaderMarkSize: // The size of the sort indicator in a header. Not in S60 + case QStyle::PM_SpinBoxSliderHeight: // The height of the optional spin box slider. Not in S60 + case QStyle::PM_HeaderMargin: // not in S60 + case QStyle::PM_MenuScrollerHeight: // not in S60 + case QStyle::PM_MenuTearoffHeight: // not in S60 + case QStyle::PM_DockWidgetFrameWidth: // not in S60 + 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??? + case QStyle::PM_TabBar_ScrollButtonOverlap: // not used in S60 - tab arrows are on left and right side of tab group - not together + case QStyle::PM_SizeGripSize: // use default + case QStyle::PM_TabCloseIndicatorWidth: + case QStyle::PM_TabCloseIndicatorHeight: + case QStyle::PM_ScrollView_ScrollBarSpacing: + case QStyle::PM_SubMenuOverlap: + default: + break; + } + return value; + } + +TInt PixelMetrics::PixelMetricTabValue(QStyle::PixelMetric tabMetric, TRect appWindow, TBool landscape) + { + TInt tabValue = 0; + // common ones + TAknLayoutRect mainAreaRect; + TAknLayoutRect rightIndicationRect; + TAknLayoutRect leftIndicationRect; + TAknLayoutRect activeTabRect; + TAknLayoutText activeTabTextRect; + TAknLayoutRect passiveTabRect; + TAknLayoutText passiveTabTextRect; + TAknLayoutRect tabsPaneRect; + if ( landscape ) + { + TAknLayoutRect statusPaneRect; + TAknLayoutRect areaTopRect; + if ( AknLayoutUtils::PenEnabled() ) + { + // Top area - 0 is for classic landscape (used in touch landscape as well) + areaTopRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::area_top_pane(2) ); + // Status pane - 0 softkeys on right + statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_top_pane() ); + } + else + { + // Top area - 2 is for classic landscape. + areaTopRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::area_bottom_pane(2) ); + // Stacon top pane (default ok) + statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_bottom_pane() ); + } + // main pane for landscape + mainAreaRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::main_pane(4) ); + + // navi pane + TAknLayoutRect naviPaneRect; + naviPaneRect.LayoutRect( statusPaneRect.Rect(), AknLayoutScalable_Avkon::navi_pane_stacon(0) ); // softkeys on right + // navi-navi pane + tabsPaneRect.LayoutRect( naviPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_stacon(0) ); // softkeys on right + // Passive tab item - lets use layout where active is on left side of passive + passiveTabRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane(0) ); + // Active tab item + activeTabRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane(0) ); + // Left indication + leftIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g1(0) ); + // Right indication + rightIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g2(0) ); + // active tab text rect + activeTabTextRect.LayoutText( activeTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane_t1(1) ); + // passive tab text rect + passiveTabTextRect.LayoutText( passiveTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane_t1(1) ); + } + else + { + // main pane for portait + mainAreaRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::main_pane(3) ); + // Top area - 0 is for classic portrait + TAknLayoutRect areaTopRect; + areaTopRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::area_top_pane(0) ); + // Status pane - 0 is for classic portrait + TAknLayoutRect statusPaneRect; + statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::status_pane(0) ); + + // Navi pane + TAknLayoutRect naviPaneRect; + naviPaneRect.LayoutRect( statusPaneRect.Rect(), AknLayoutScalable_Avkon::navi_pane(0) ); + // Navi-navi pane for tabs (0) + TAknLayoutRect navi2PaneRect; + navi2PaneRect.LayoutRect( naviPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane() ); + // Short tab pane + tabsPaneRect.LayoutRect( navi2PaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_tabs_pane() ); + // Tab pane for 2 items + TAknLayoutRect tab2PaneRect; + tab2PaneRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_tabs_3_pane() ); + // Passive tab item - lets use layout where active is on left side of passive + passiveTabRect.LayoutRect( tab2PaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane(0) ); + // Active tab item + activeTabRect.LayoutRect( tab2PaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane(0) ); + // Left indication + leftIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g1(0) ); + // Right indication + rightIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g2(0) ); + // active tab text rect + activeTabTextRect.LayoutText( activeTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane_t1(0) ); + // passive tab text rect + passiveTabTextRect.LayoutText( passiveTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane_t1(0) ); + } + + // active tab on left, passive on rightside + TInt tabOverlap = activeTabRect.Rect().iBr.iX - passiveTabRect.Rect().iTl.iX; + TInt tabHSpace = (TInt) ((activeTabTextRect.TextRect().iTl.iX - activeTabRect.Rect().iTl.iX + activeTabRect.Rect().iBr.iX - activeTabTextRect.TextRect().iBr.iX)/2); + TInt tabVSpace = (TInt) ((activeTabTextRect.TextRect().iTl.iY - activeTabRect.Rect().iTl.iY + activeTabRect.Rect().iBr.iY - activeTabTextRect.TextRect().iBr.iY)/2); + TInt tabBaseHeight = 0; + if ( landscape && !AknLayoutUtils::PenEnabled()) + { + // In landscape tab is below mainpane + tabBaseHeight = mainAreaRect.Rect().iBr.iY - tabsPaneRect.Rect().iTl.iY; + } + else + { + // In portrait (and in landscape touch) tab is above mainpane + tabBaseHeight = tabsPaneRect.Rect().iBr.iY - mainAreaRect.Rect().iTl.iY; + } + TInt tabBaseOverlap = 0; + if ( landscape && !AknLayoutUtils::PenEnabled()) + { + // In landscape tab is below mainpane + tabBaseOverlap = Max( 0, mainAreaRect.Rect().iBr.iY - tabsPaneRect.Rect().iTl.iY); + } + else + { + // In portrait tab is above mainpane + tabBaseOverlap = Max( 0, mainAreaRect.Rect().iTl.iY - tabsPaneRect.Rect().iBr.iY); + } + TInt tabButtonWidth = Max(leftIndicationRect.Rect().Width(), rightIndicationRect.Rect().Width()); + TInt tabVShift = Max( Abs(activeTabTextRect.TextRect().iBr.iY - passiveTabTextRect.TextRect().iBr.iY), Abs(activeTabTextRect.TextRect().iTl.iY - passiveTabTextRect.TextRect().iTl.iY) ); + TInt tabHShift = Max( Abs(activeTabTextRect.TextRect().iBr.iX - passiveTabTextRect.TextRect().iBr.iX), Abs(activeTabTextRect.TextRect().iTl.iX - passiveTabTextRect.TextRect().iTl.iX) ); + tabHShift -= (passiveTabRect.Rect().Width() - tabOverlap); // remove tab change and add overlapping area + + switch( tabMetric ) + { + case QStyle::PM_TabBarTabOverlap: + tabValue = tabOverlap; + break; + case QStyle::PM_TabBarTabHSpace: + tabValue = tabHSpace; + break; + case QStyle::PM_TabBarTabVSpace: + tabValue = tabVSpace; + break; + case QStyle::PM_TabBarBaseHeight: + tabValue = tabBaseHeight; + break; + case QStyle::PM_TabBarBaseOverlap: + tabValue = tabBaseOverlap; + break; + case QStyle::PM_TabBarScrollButtonWidth: + // Since in Qt the scroll indicator is shown within a button, we need to add button margins to this value + { + tabValue = tabButtonWidth + 2*PixelMetricValue(QStyle::PM_ButtonMargin); + } + break; + case QStyle::PM_TabBarTabShiftHorizontal: + tabValue = tabHShift; + break; + case QStyle::PM_TabBarTabShiftVertical: + tabValue = tabVShift; + break; + default: + break; + } + return tabValue; + } + +TInt PixelMetrics::PixelMetricMenuValue(QStyle::PixelMetric tabMetric, TRect mainPaneRect ) + { + TInt menuValue = 0; + TAknLayoutRect popupMenuRect; + popupMenuRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_menu_window(0) ); + TAknLayoutRect listScrollPaneRect; + listScrollPaneRect.LayoutRect( popupMenuRect.Rect(), AknLayoutScalable_Avkon::listscroll_menu_pane(0) ); + TAknLayoutRect listMenuPaneRect; + listMenuPaneRect.LayoutRect( listScrollPaneRect.Rect(), AknLayoutScalable_Avkon::list_menu_pane(0) ); + TAknLayoutRect listMenuRow1Rect; + listMenuRow1Rect.LayoutRect( listScrollPaneRect.Rect(), AknLayoutScalable_Avkon::list_single_pane_cp2(0)); + + switch (tabMetric) + { + case QStyle::PM_MenuPanelWidth: + menuValue = listMenuPaneRect.Rect().iTl.iX - listScrollPaneRect.Rect().iTl.iX; + if ( AknLayoutUtils::LayoutMirrored() ) + { + menuValue = listScrollPaneRect.Rect().iBr.iX - listMenuPaneRect.Rect().iBr.iX; + } + break; + case QStyle::PM_MenuHMargin: + menuValue = listMenuRow1Rect.Rect().iTl.iX - popupMenuRect.Rect().iTl.iX; + if ( AknLayoutUtils::LayoutMirrored() ) + { + menuValue = popupMenuRect.Rect().iBr.iX - listMenuRow1Rect.Rect().iBr.iX; + } + break; + case QStyle::PM_MenuVMargin: + menuValue = listMenuRow1Rect.Rect().iTl.iY - popupMenuRect.Rect().iTl.iY; + break; + default: + break; + } + return menuValue; + } diff --git a/util/s60pixelmetrics/pixel_metrics.h b/util/s60pixelmetrics/pixel_metrics.h new file mode 100644 index 0000000..692564c --- /dev/null +++ b/util/s60pixelmetrics/pixel_metrics.h @@ -0,0 +1,216 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the utility applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PIXELMETRICS_H +#define PIXELMETRICS_H + +#include +#define S60_Rnd_Env + +#ifdef S60_Rnd_Env +#pragma message ("Building in supported environment") + +const TInt KUnknownBase = -5000; + +NONSHARABLE_CLASS( QStyle ) + { + public: + enum PixelMetric { + PM_ButtonMargin, + PM_ButtonDefaultIndicator, + PM_MenuButtonIndicator, + PM_ButtonShiftHorizontal, + PM_ButtonShiftVertical, + + PM_DefaultFrameWidth, + PM_SpinBoxFrameWidth, + PM_ComboBoxFrameWidth, + + PM_MaximumDragDistance, + + PM_ScrollBarExtent, + PM_ScrollBarSliderMin, + + PM_SliderThickness, // total slider thickness + PM_SliderControlThickness, // thickness of the business part + PM_SliderLength, // total length of slider + PM_SliderTickmarkOffset, // + PM_SliderSpaceAvailable, // available space for slider to move + + PM_DockWidgetSeparatorExtent, + PM_DockWidgetHandleExtent, + PM_DockWidgetFrameWidth, + + PM_TabBarTabOverlap, + PM_TabBarTabHSpace, + PM_TabBarTabVSpace, + PM_TabBarBaseHeight, + PM_TabBarBaseOverlap, + + PM_ProgressBarChunkWidth, + + PM_SplitterWidth, + PM_TitleBarHeight, + + PM_MenuScrollerHeight, + PM_MenuHMargin, + PM_MenuVMargin, + PM_MenuPanelWidth, + PM_MenuTearoffHeight, + PM_MenuDesktopFrameWidth, + + PM_MenuBarPanelWidth, + PM_MenuBarItemSpacing, + PM_MenuBarVMargin, + PM_MenuBarHMargin, + + PM_IndicatorWidth, + PM_IndicatorHeight, + PM_ExclusiveIndicatorWidth, + PM_ExclusiveIndicatorHeight, + PM_CheckListButtonSize, + PM_CheckListControllerSize, + + PM_DialogButtonsSeparator, + PM_DialogButtonsButtonWidth, + PM_DialogButtonsButtonHeight, + + PM_MdiSubWindowFrameWidth, + PM_MDIFrameWidth = PM_MdiSubWindowFrameWidth, //obsolete + PM_MdiSubWindowMinimizedWidth, + PM_MDIMinimizedWidth = PM_MdiSubWindowMinimizedWidth, //obsolete + + PM_HeaderMargin, + PM_HeaderMarkSize, + PM_HeaderGripMargin, + PM_TabBarTabShiftHorizontal, + PM_TabBarTabShiftVertical, + PM_TabBarScrollButtonWidth, + + PM_ToolBarFrameWidth, + PM_ToolBarHandleExtent, + PM_ToolBarItemSpacing, + PM_ToolBarItemMargin, + PM_ToolBarSeparatorExtent, + PM_ToolBarExtensionExtent, + + PM_SpinBoxSliderHeight, + + PM_DefaultTopLevelMargin, + PM_DefaultChildMargin, + PM_DefaultLayoutSpacing, + + PM_ToolBarIconSize, + PM_ListViewIconSize, + PM_IconViewIconSize, + PM_SmallIconSize, + PM_LargeIconSize, + + PM_FocusFrameVMargin, + PM_FocusFrameHMargin, + + PM_ToolTipLabelFrameWidth, + PM_CheckBoxLabelSpacing, + PM_TabBarIconSize, + PM_SizeGripSize, + PM_DockWidgetTitleMargin, + PM_MessageBoxIconSize, + PM_ButtonIconSize, + + PM_DockWidgetTitleBarButtonMargin, + + PM_RadioButtonLabelSpacing, + PM_LayoutLeftMargin, + PM_LayoutTopMargin, + PM_LayoutRightMargin, + PM_LayoutBottomMargin, + PM_LayoutHorizontalSpacing, + PM_LayoutVerticalSpacing, + PM_TabBar_ScrollButtonOverlap, + + PM_TextCursorWidth, + + PM_TabCloseIndicatorWidth, + PM_TabCloseIndicatorHeight, + + PM_ScrollView_ScrollBarSpacing, + PM_SubMenuOverlap, + + // do not add any values below/greater than this + PM_CustomBase = 0xf0000000, + + // The following are custom values needed to draw the S60Style according scalable UIs. + // Width of 9-part frame-corner + PM_Custom_FrameCornerWidth, + // Height of 9-part frame corner + PM_Custom_FrameCornerHeight, + // Bold line width + PM_Custom_BoldLineWidth, + // Thin line width + PM_Custom_ThinLineWidth + }; + + }; +#else +#pragma message ("Building in non-supported environment, this probably fails") +#endif + + +// Pixel metrics version information. +class TPixelMetricsVersion + { + public: + TInt majorVersion; + TInt minorVersion; + }; + +NONSHARABLE_CLASS(PixelMetrics) +{ + public: + static TPixelMetricsVersion Version(); + static TInt PixelMetricValue(QStyle::PixelMetric); + + private: + static TInt PixelMetricMenuValue( QStyle::PixelMetric menuValue, TRect mainPaneRect ); + static TInt PixelMetricTabValue( QStyle::PixelMetric tabValue, TRect appWindow, TBool landscape ); +}; + +#endif // PIXELMETRICS_H diff --git a/util/s60pixelmetrics/pixelmetricsmapper/PMMapper.hrh b/util/s60pixelmetrics/pixelmetricsmapper/PMMapper.hrh deleted file mode 100644 index afd47db..0000000 --- a/util/s60pixelmetrics/pixelmetricsmapper/PMMapper.hrh +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utility applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PMMAPPER_HRH -#define PMMAPPER_HRH - -// DATA TYPES - -// View IDs. -enum - { - EPMMapperViewId = 1 // Base view. - }; - -// Menu items (commands) -enum - { - ECmdStartCalculations = 8500, - ECmdSwitchOrientation, - ECmdSwitchMirroring, - ECmdStatus, - ECmdSwitchOutput, - ECmdCreateHeaderFile, - ECmdSetAutoMode - }; - -enum - { - EWaitNote = 9000 - }; - -#endif // PMMAPPER_HRH - - -// End of File diff --git a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperApp.cpp b/util/s60pixelmetrics/pixelmetricsmapper/PMMapperApp.cpp deleted file mode 100644 index de0b753..0000000 --- a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperApp.cpp +++ /dev/null @@ -1,1044 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utility applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// INCLUDE FILES - -#include -#include -#include "pmmapper.hrh" -#include "pmmapperApp.h" -#include "pmmapperView.h" -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include -#include // KAknLayoutId - -#include -#include -#include "pixel_metrics.h" - -#include - -#include -#include - -typedef TBuf<2048> TMySmallBuffer; -typedef TBuf<8192> TMyBigBuffer; - -_LIT(KLayoutSourceFileAndPath, "\\private\\2002121f\\pm_layout.cpp"); -_LIT(KPixelMetricsDataFiles, "\\private\\2002121f\\*.txt"); -_LIT(KOpenBrace, "{"); -_LIT(KComma, ","); -_LIT(KColon, ":"); -_LIT(KTab, "\t"); -_LIT(KEndBraceWithCommaAndCRLF, "},\n"); -_LIT(KCRLF, "\n"); - -// Number of header lines in layout data. -const TInt KHeaderValues = 5; - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// C++ constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CPixelMetricsMapperAppUi::CPixelMetricsMapperAppUi() : iFileOutputOn(EFalse) - { - } - -// ----------------------------------------------------------------------------- -// Destructor. -// ----------------------------------------------------------------------------- -// -CPixelMetricsMapperAppUi::~CPixelMetricsMapperAppUi() - { - } - -// ----------------------------------------------------------------------------- -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CPixelMetricsMapperAppUi::ConstructL() - { - BaseConstructL(); - - CEikonEnv& eikEnv = *CEikonEnv::Static(); - - eikEnv.WsSession().ComputeMode( - RWsSession::EPriorityControlDisabled ); - RThread().SetProcessPriority( EPriorityHigh ); - - CPixelMetricsMapperView* view = new( ELeave ) CPixelMetricsMapperView; - CleanupStack::PushL( view ); - view->ConstructL(); - CleanupStack::Pop(); // view - AddViewL(view); // transfer ownership to CAknViewAppUi - iView = view; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TKeyResponse CPixelMetricsMapperAppUi::HandleKeyEventL( - const TKeyEvent& /*aKeyEvent*/, - TEventCode aType ) - { - return EKeyWasNotConsumed; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) - { - switch ( aCommand ) - { - case EAknSoftkeyExit: - case EEikCmdExit: - Exit(); - break; - case ECmdSwitchOutput: - iFileOutputOn = !iFileOutputOn; - break; - case ECmdStatus: - { - ClearL(); - - // layout - CRepository* repository = NULL; - TInt value = KErrNotFound; - TRAPD(ret, repository = CRepository::NewL(KCRUidAvkon)); - if (ret == KErrNone) - { - ret = repository->Get(KAknLayoutId, value); - } - delete repository; - ret= 0; - HBufC* buffer = HBufC::NewLC( 100 ); - TPtr bufferPtr = buffer->Des(); - bufferPtr.Append(_L("Layout: ")); - if (ret==KErrNone) - { - bufferPtr.AppendNum(value); - } - else - { - bufferPtr.Append(_L("(error) ")); - bufferPtr.AppendNum(ret); - } - TBool last = ETrue; - ShowL( *buffer, last ); - bufferPtr.Zero(); - - // Orientation - bufferPtr.Append(_L("Orientation: ")); - bufferPtr.AppendNum((TInt)iAvkonAppUi->Orientation()); - ShowL( *buffer, last ); - bufferPtr.Zero(); - - // Output - bufferPtr.Append(_L("Output: ")); - if (iFileOutputOn) bufferPtr.Append(_L("File")); - else bufferPtr.Append(_L("Screen")); - ShowL( *buffer, last ); - bufferPtr.Zero(); - - // Automode - bufferPtr.Append(_L("AutoMode: ")); - bufferPtr.AppendNum((TInt)iAutoMode); - ShowL( *buffer, last ); - bufferPtr.Zero(); - - CAknLayoutConfig::TScreenMode localAppScreenMode = CAknSgcClient::ScreenMode(); - TInt hashValue = localAppScreenMode.ScreenStyleHash(); - TPixelsTwipsAndRotation pixels = CAknSgcClient::PixelsAndRotation(); - TSize pixelSize = pixels.iPixelSize; - - bufferPtr.Append(_L("LayoutName: ")); - - if ( (pixelSize.iWidth == 320 || pixelSize.iWidth == 240 )&& - (pixelSize.iHeight == 320 || pixelSize.iHeight == 240 )) - { - if (hashValue==0x996F7AA7) - bufferPtr.Append(_L("QVGA2")); - else - bufferPtr.Append(_L("QVGA1")); - } - else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 360 )&& - (pixelSize.iHeight == 360 || pixelSize.iHeight == 640 )) - { - bufferPtr.Append(_L("nHD")); - } - else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 480 )&& - (pixelSize.iHeight == 480 || pixelSize.iHeight == 640 )) - { - bufferPtr.Append(_L("VGA")); - } - else if ((pixelSize.iWidth == 352 || pixelSize.iWidth == 800 )&& - (pixelSize.iHeight == 800 || pixelSize.iHeight == 352 )) - { - bufferPtr.Append(_L("E90")); - } - else if ((pixelSize.iWidth == 320 || pixelSize.iWidth == 480 || - pixelSize.iWidth == 240 || pixelSize.iWidth == 640 )&& - (pixelSize.iHeight == 320 || pixelSize.iHeight == 480 || - pixelSize.iHeight == 240 || pixelSize.iHeight == 640)) - { - bufferPtr.Append(_L("HVGA")); - } - else if ((pixelSize.iWidth == 480 || pixelSize.iWidth == 854 || - pixelSize.iWidth == 848 || pixelSize.iWidth == 800 )&& - (pixelSize.iHeight == 800 || pixelSize.iHeight == 480 || - pixelSize.iHeight == 848 || pixelSize.iHeight == 854)) - { - bufferPtr.Append(_L("WVGA")); - } - else - { - bufferPtr.Append(_L("Unknown")); - } - - ShowL( *buffer, last ); - bufferPtr.Zero(); - CleanupStack::PopAndDestroy( buffer ); - } - break; - case ECmdSwitchMirroring: - { - // set the shared data value - CRepository* repository = NULL; - TRAPD(ret, repository = CRepository::NewL(KCRUidAvkon)); - if (ret == KErrNone) - { - TInt value = KErrNotFound; - repository->Get(KAknLayoutId, value); - if ( value == EAknLayoutIdELAF) - { - value = EAknLayoutIdABRW; - } - else if (value ==EAknLayoutIdABRW) - { - value = EAknLayoutIdELAF; - } - ret = repository->Set(KAknLayoutId, value); - } - delete repository; - // now inform all open apps of the switch - TWsEvent event; - event.SetType(KEikDynamicLayoutVariantSwitch); - iEikonEnv->WsSession().SendEventToAllWindowGroups(event); - } - break; - case ECmdSwitchOrientation: - { - ClearL(); - #ifndef __SERIES60_31__ - if (!iAvkonAppUi->OrientationCanBeChanged()) - { - HBufC* buffer = HBufC::NewLC( 100 ); - TPtr bufferPtr = buffer->Des(); - bufferPtr.Append(_L("Orientation cannot be changed.")); - TBool last = EFalse; - ShowL( *buffer, last ); - bufferPtr.Zero(); - delete buffer; - } - #endif //__SERIES60_31__ - if ( iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationPortrait) - { - iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape); - } - else if (iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationLandscape) - { - iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationPortrait); - } - else - { - // unspecified - iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape); - /*User::After(100000); - HBufC* buffer = HBufC::NewLC( 100 ); - TPtr bufferPtr = buffer->Des(); - bufferPtr.Append(_L("Orientation unspecified.")); - TBool last = EFalse; - ShowL( *buffer, last ); - bufferPtr.Zero(); - delete buffer;*/ - } - break; - } - case ECmdStartCalculations: - { - ClearL(); - // Get known values - TInt index = 0; - TBool last = EFalse; - if (iFileOutputOn) - { - TRect screenRect; - AknLayoutUtils::LayoutMetricsRect( - AknLayoutUtils::EApplicationWindow, - screenRect ); - - // Add screen dimensions - TInt height = screenRect.Height(); - TInt width = screenRect.Width(); - TBuf16<32> tgt; - // HEIGTH - tgt.Append(_L("height: \t")); - tgt.AppendNum(height, EDecimal); // put max height into text file - ShowL( tgt, last ); - tgt.Zero(); - // WIDTH - tgt.Append(_L("width: \t")); - tgt.AppendNum(width, EDecimal); // put max width into text file - ShowL( tgt, last ); - tgt.Zero(); - // VERSION - TPixelMetricsVersion version = PixelMetrics::Version(); - tgt.Append(_L("major_version: \t")); - tgt.AppendNum(version.majorVersion, EDecimal); // put major version into text file - ShowL( tgt, last ); - tgt.Zero(); - tgt.Append(_L("minor_version: \t")); - tgt.AppendNum(version.minorVersion, EDecimal); // put minor version into text file - ShowL( tgt, last ); - tgt.Zero(); - // MIRRORED - TBool mirrored = AknLayoutUtils::LayoutMirrored(); - tgt.Append(_L("mirrored: \t")); - tgt.AppendNum(mirrored, EDecimal); // put mirrored state into text file - ShowL( tgt, last ); - tgt.Zero(); - } - - TInt myValue = KErrNotFound; - for (;;) - { - if (index==QStyle::PM_Custom_ThinLineWidth) - { - last = ETrue; - } - myValue = PixelMetrics::PixelMetricValue(static_cast(index)); - ShowSingleValueL( index, myValue, last ); - - if (last) break; - // if last before custom values, "jump" to custom base - if (index==QStyle::PM_SubMenuOverlap) index = QStyle::PM_CustomBase; - index++; - } - if (iAutoMode && !iMode) - { - HandleCommandL(ECmdSwitchMirroring); - iMode = ETrue; - } - } - break; - case ECmdCreateHeaderFile: - CreateHeaderFileL(); - break; - case ECmdSetAutoMode: - iAutoMode = !iAutoMode; - default: - break; - } - } -void CPixelMetricsMapperAppUi::DoAutoOperationL() - { - HandleCommandL(ECmdStartCalculations); - iMode = EFalse; - HandleCommandL(ECmdSwitchMirroring); - } - -TBool CPixelMetricsMapperAppUi::ReadyForAutoOp() const - { - return (iAutoMode && iMode); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CPixelMetricsMapperAppUi::ShowL( const TDesC& aText, TBool& aLast, const TBool& aFileOutput ) - { - _LIT( KTestPrefix, "\t" ); - - HBufC* buffer = HBufC::NewLC( aText.Length() + KTestPrefix().Length() ); - TPtr ptr = buffer->Des(); - ptr.Append( KTestPrefix ); - ptr.Append( aText ); - iView->ShowL( *buffer, aLast, aFileOutput ); - CleanupStack::PopAndDestroy( buffer ); - } - -void CPixelMetricsMapperAppUi::ShowSingleValueL(TInt& aPixelMetric, TInt& aValue, TBool& aLast ) - { - HBufC* buffer = HBufC::NewLC( 100 ); - TPtr bufferPtr = buffer->Des(); - - switch (aPixelMetric) - { - case QStyle::PM_DockWidgetTitleMargin: - bufferPtr.Append(_L("DockTitleMargin: ")); - break; - case QStyle::PM_DockWidgetTitleBarButtonMargin: - bufferPtr.Append(_L("DockTitleBtnMargin: ")); - break; - case QStyle::PM_ButtonMargin: - bufferPtr.Append(_L("ButtonMargin: ")); - break; - case QStyle::PM_ButtonDefaultIndicator: - bufferPtr.Append(_L("ButtonDefaultIndicator: ")); - break; - case QStyle::PM_MdiSubWindowFrameWidth: - bufferPtr.Append(_L("MdiSubWndFrameW: ")); - break; - case QStyle::PM_ComboBoxFrameWidth: - bufferPtr.Append(_L("ComboBoxFrameWidth: ")); - break; - case QStyle::PM_SpinBoxFrameWidth: - bufferPtr.Append(_L("SpinBoxFrameWidth: ")); - break; - case QStyle::PM_DefaultFrameWidth: - bufferPtr.Append(_L("DefaultFrameWidth: ")); - break; - case QStyle::PM_RadioButtonLabelSpacing: - bufferPtr.Append(_L("RadioButtonLabelSpc: ")); - break; - case QStyle::PM_CheckBoxLabelSpacing: - bufferPtr.Append(_L("CheckBoxLabelSpacing: ")); - break; - case QStyle::PM_ToolTipLabelFrameWidth: - bufferPtr.Append(_L("ToolTipLabelFrameW: ")); - break; - case QStyle::PM_ListViewIconSize: - bufferPtr.Append(_L("ListViewIconSize: ")); - break; - case QStyle::PM_LargeIconSize: - bufferPtr.Append(_L("LargeIconSize: ")); - break; - case QStyle::PM_IconViewIconSize: - bufferPtr.Append(_L("IconViewIconSize: ")); - break; - case QStyle::PM_TabBarIconSize: - bufferPtr.Append(_L("TabBarIconSize: ")); - break; - case QStyle::PM_MessageBoxIconSize: - bufferPtr.Append(_L("MessageBoxIconSize: ")); - break; - case QStyle::PM_ButtonIconSize: - bufferPtr.Append(_L("ButtonIconSize: ")); - break; - case QStyle::PM_TextCursorWidth: - bufferPtr.Append(_L("TextCursorWidth: ")); - break; - case QStyle::PM_SliderLength: - bufferPtr.Append(_L("SliderLength: ")); - break; - case QStyle::PM_SliderThickness: - bufferPtr.Append(_L("SliderThickness: ")); - break; - case QStyle::PM_SliderTickmarkOffset: - bufferPtr.Append(_L("SliderTickmarkOffset: ")); - break; - case QStyle::PM_SliderControlThickness: - bufferPtr.Append(_L("SliderCntrlThickness: ")); - break; - case QStyle::PM_SliderSpaceAvailable: - bufferPtr.Append(_L("SliderSpaceAvailable: ")); - break; - case QStyle::PM_MenuBarItemSpacing: - bufferPtr.Append(_L("MenuBarItemSpacing: ")); - break; - case QStyle::PM_MenuBarHMargin: - bufferPtr.Append(_L("MenuBarHMargin: ")); - break; - case QStyle::PM_MenuBarVMargin: - bufferPtr.Append(_L("MenuBarVMargin: ")); - break; - case QStyle::PM_ToolBarItemSpacing: - bufferPtr.Append(_L("ToolBarItemSpacing: ")); - break; - case QStyle::PM_ToolBarFrameWidth: - bufferPtr.Append(_L("ToolBarFrameWidth: ")); - break; - case QStyle::PM_ToolBarItemMargin: - bufferPtr.Append(_L("ToolBarItemMargin: ")); - break; - case QStyle::PM_LayoutLeftMargin: - bufferPtr.Append(_L("LayoutLeftMargin: ")); - break; - case QStyle::PM_LayoutRightMargin: - bufferPtr.Append(_L("LayoutRightMargin: ")); - break; - case QStyle::PM_LayoutTopMargin: - bufferPtr.Append(_L("LayoutTopMargin: ")); - break; - case QStyle::PM_LayoutBottomMargin: - bufferPtr.Append(_L("LayoutBottomMargin: ")); - break; - case QStyle::PM_LayoutHorizontalSpacing: - bufferPtr.Append(_L("LayoutHSpacing: ")); - break; - case QStyle::PM_LayoutVerticalSpacing: - bufferPtr.Append(_L("LayoutVSpacing: ")); - break; - case QStyle::PM_MaximumDragDistance: - bufferPtr.Append(_L("MaxDragDistance: ")); - break; - case QStyle::PM_ScrollBarExtent: - bufferPtr.Append(_L("ScrollBarExtent: ")); - break; - case QStyle::PM_ScrollBarSliderMin: - bufferPtr.Append(_L("ScrollBarSliderMin: ")); - break; - case QStyle::PM_MenuBarPanelWidth: - bufferPtr.Append(_L("MenuBarPanelWidth: ")); - break; - case QStyle::PM_ProgressBarChunkWidth: - bufferPtr.Append(_L("ProgBarChunkWidth: ")); - break; - case QStyle::PM_TabBarTabOverlap: - bufferPtr.Append(_L("TabBarTabOverlap: ")); - break; - case QStyle::PM_TabBarTabHSpace: - bufferPtr.Append(_L("TabBarTabHSpace: ")); - break; - case QStyle::PM_TabBarTabVSpace: - bufferPtr.Append(_L("TabBarTabVSpace: ")); - break; - case QStyle::PM_TabBarBaseHeight: - bufferPtr.Append(_L("TabBarBaseHeight: ")); - break; - case QStyle::PM_TabBarBaseOverlap: - bufferPtr.Append(_L("TabBarBaseOverlap: ")); - break; - case QStyle::PM_TabBarScrollButtonWidth: - bufferPtr.Append(_L("TabBarScrollBtnWidth: ")); - break; - case QStyle::PM_TabBarTabShiftHorizontal: - bufferPtr.Append(_L("TabBarTabShiftH: ")); - break; - case QStyle::PM_TabBarTabShiftVertical: - bufferPtr.Append(_L("TabBarTabShiftV: ")); - break; - case QStyle::PM_MenuPanelWidth: - bufferPtr.Append(_L("MenuPanelWidth: ")); - break; - case QStyle::PM_MenuHMargin: - bufferPtr.Append(_L("MenuHMargin: ")); - break; - case QStyle::PM_MenuVMargin: - bufferPtr.Append(_L("MenuVMargin: ")); - break; - case QStyle::PM_MenuDesktopFrameWidth: - bufferPtr.Append(_L("MenuFrameWidth: ")); - break; - case QStyle::PM_SmallIconSize: - bufferPtr.Append(_L("SmallIconSize: ")); - break; - case QStyle::PM_FocusFrameHMargin: - bufferPtr.Append(_L("FocusFrameHMargin: ")); - break; - case QStyle::PM_FocusFrameVMargin: - bufferPtr.Append(_L("FocusFrameVMargin: ")); - break; - case QStyle::PM_ToolBarIconSize: - bufferPtr.Append(_L("ToolBarIconSize: ")); - break; - case QStyle::PM_TitleBarHeight: // use titlepane height - bufferPtr.Append(_L("TitleBarHeight: ")); - break; - case QStyle::PM_IndicatorWidth: - bufferPtr.Append(_L("IndicatorWidth: ")); - break; - case QStyle::PM_IndicatorHeight: - bufferPtr.Append(_L("IndicatorHeight: ")); - break; - case QStyle::PM_ExclusiveIndicatorHeight: - bufferPtr.Append(_L("ExclusiveIndHeight: ")); - break; - case QStyle::PM_ExclusiveIndicatorWidth: - bufferPtr.Append(_L("ExclusiveIndWidth: ")); - break; - case QStyle::PM_HeaderMargin: // not in S60 - bufferPtr.Append(_L("HeaderMargin: ")); - break; - case QStyle::PM_MenuScrollerHeight: // not in S60 - bufferPtr.Append(_L("MenuScrollerHeight: ")); - break; - case QStyle::PM_MenuTearoffHeight: // not in S60 - bufferPtr.Append(_L("MenuTearoffHeight: ")); - break; - case QStyle::PM_DockWidgetFrameWidth: // not in S60 - bufferPtr.Append(_L("DockFrameWidth: ")); - break; - case QStyle::PM_DockWidgetSeparatorExtent: // not in S60 - bufferPtr.Append(_L("DockSepExtent: ")); - break; - case QStyle::PM_MdiSubWindowMinimizedWidth: //no such thing in S60 - bufferPtr.Append(_L("MdiSubWndMinWidth: ")); - break; - case QStyle::PM_HeaderGripMargin: // not in S60 - bufferPtr.Append(_L("HeaderGripMargin: ")); - break; - case QStyle::PM_SplitterWidth: // not in S60 - bufferPtr.Append(_L("SplitterWidth: ")); - break; - case QStyle::PM_ToolBarExtensionExtent: // not in S60 - bufferPtr.Append(_L("ToolBarExtExtent: ")); - break; - case QStyle::PM_ToolBarSeparatorExtent: // not in S60 - bufferPtr.Append(_L("ToolBarSepExtent: ")); - break; - case QStyle::PM_ToolBarHandleExtent: // not in s60 - bufferPtr.Append(_L("ToolBarHandleExtent: ")); - break; - case QStyle::PM_MenuButtonIndicator: // none??? - bufferPtr.Append(_L("MenuButtonIndicator: ")); - break; - case QStyle::PM_ButtonShiftHorizontal: //none in 3.x - bufferPtr.Append(_L("ButtonShiftHorizontal: ")); - break; - case QStyle::PM_ButtonShiftVertical: // none in 3.x - bufferPtr.Append(_L("ButtonShiftVertical: ")); - break; - case QStyle::PM_TabBar_ScrollButtonOverlap: // not used in S60 - tab arrows are on left and right side of tab group - not together - bufferPtr.Append(_L("TabScrollBtnOverlap: ")); - break; - case QStyle::PM_SizeGripSize: // use default - bufferPtr.Append(_L("SizeGripSize: ")); - break; - case QStyle::PM_DockWidgetHandleExtent: - bufferPtr.Append(_L("DockWdgtHandleExt: ")); - break; - case QStyle::PM_CheckListButtonSize: - bufferPtr.Append(_L("CheckListButtonSize: ")); - break; - case QStyle::PM_CheckListControllerSize: - bufferPtr.Append(_L("CheckListCntlerSize: ")); - break; - case QStyle::PM_DialogButtonsSeparator: - bufferPtr.Append(_L("DialogBtnSeparator: ")); - break; - case QStyle::PM_DialogButtonsButtonWidth: - bufferPtr.Append(_L("DialogBtnWidth: ")); - break; - case QStyle::PM_DialogButtonsButtonHeight: - bufferPtr.Append(_L("DialogBtnHeight: ")); - break; - case QStyle::PM_HeaderMarkSize: - bufferPtr.Append(_L("HeaderMarkSize: ")); - break; - case QStyle::PM_SpinBoxSliderHeight: - bufferPtr.Append(_L("SpinBoxSliderHeight: ")); - break; - case QStyle::PM_DefaultTopLevelMargin: - bufferPtr.Append(_L("DefaultTopLvlMrg: ")); - break; - case QStyle::PM_DefaultChildMargin: - bufferPtr.Append(_L("DefaultChildMrg: ")); - break; - case QStyle::PM_DefaultLayoutSpacing: - bufferPtr.Append(_L("DefaultlayoutSpc: ")); - break; - case QStyle::PM_TabCloseIndicatorWidth: - bufferPtr.Append(_L("TabCloseIndWidth: ")); - break; - case QStyle::PM_TabCloseIndicatorHeight: - bufferPtr.Append(_L("TabCloseIndHeight: ")); - break; - case QStyle::PM_ScrollView_ScrollBarSpacing: - bufferPtr.Append(_L("ScrollViewBarSpc: ")); - break; - case QStyle::PM_SubMenuOverlap: - bufferPtr.Append(_L("SubMenuOverlap: ")); - break; - case QStyle::PM_Custom_FrameCornerHeight: - bufferPtr.Append(_L("C_FrCornerHeight: ")); - break; - case QStyle::PM_Custom_FrameCornerWidth: - bufferPtr.Append(_L("C_FrCornerWidth: ")); - break; - case QStyle::PM_Custom_ThinLineWidth: - bufferPtr.Append(_L("C_ThinLineWidth: ")); - break; - case QStyle::PM_Custom_BoldLineWidth: - bufferPtr.Append(_L("C_BoldLineWidth: ")); - break; - default: - bufferPtr.Append(_L("Default: ")); - break; - } - - if (iFileOutputOn) - { - bufferPtr.Append('\t'); - } - bufferPtr.AppendNum(aValue); - bufferPtr.Append(_L(" ")); - ShowL( *buffer, aLast, iFileOutputOn ); - CleanupStack::PopAndDestroy( buffer ); - } - -void CPixelMetricsMapperAppUi::ClearL() - { - iView->ClearL(); - } - -void CPixelMetricsMapperAppUi::CreateHeaderFileL() const - { - // Open/create resulting file. - RFile file; - HBufC* layoutFile = HBufC::NewLC( KMaxFileName ); - *layoutFile = KLayoutSourceFileAndPath; - TFileName fileName = *layoutFile; - CleanupStack::PopAndDestroy(layoutFile); - RFs& fs = CEikonEnv::Static()->FsSession(); - TInt error = file.Open(fs,fileName, EFileWrite|EFileShareAny|EFileStreamText ); - if (error==KErrNotFound) - { - file.Create(fs,fileName, EFileWrite|EFileShareAny|EFileStreamText); - } - CleanupClosePushL( file ); - file.SetSize( 0 ); - - // Make all writes as from textfile. - TFileText textFile; - textFile.Set( file ); - textFile.Seek( ESeekStart ); - - // Take all layout files from private folder. - CDir* dirList; - User::LeaveIfError(fs.GetDir( - KPixelMetricsDataFiles, - KEntryAttMaskSupported, - ESortByName, - dirList)); - - TMySmallBuffer bufferLayoutHdr; - TMyBigBuffer bufferPMData; - TInt fileCount = dirList->Count(); - for (TInt i=0;i height) - { - layoutName.Append(_L("Landscape")); - } - else - { - layoutName.Append(_L("Portrait")); - } - if (mirroring) - { - layoutName.Append(_L(" Mirrored")); - } - return layoutName; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -CEikAppUi* CPixelMetricsMapperDocument::CreateAppUiL() - { - return( new ( ELeave ) CPixelMetricsMapperAppUi ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CPixelMetricsMapperDocument::ConstructL() - { - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TUid CPixelMetricsMapperApplication::AppDllUid() const - { - return KUidPMMapperApplication; - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -CApaDocument* CPixelMetricsMapperApplication::CreateDocumentL() - { - CPixelMetricsMapperDocument* document = - new( ELeave ) CPixelMetricsMapperDocument( *this ); - CleanupStack::PushL( document ); - document->ConstructL(); - CleanupStack::Pop(); - return( document ); - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= -// --------------------------------------------------------- -// NewApplication implements -// -// Creates an instance of application. -// -// Returns: an instance of CVtUiApp -// --------------------------------------------------------- -// -LOCAL_C CApaApplication* NewApplication() - { - return new CPixelMetricsMapperApplication; - } - -// --------------------------------------------------------- -// E32Main implements -// -// It is called when executable is started. -// -// Returns: error code. -// --------------------------------------------------------- -// -GLDEF_C TInt E32Main() - { - return EikStart::RunApplication( NewApplication ); - } - -// End of File diff --git a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperApp.h b/util/s60pixelmetrics/pixelmetricsmapper/PMMapperApp.h deleted file mode 100644 index 02d297e..0000000 --- a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperApp.h +++ /dev/null @@ -1,198 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utility applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PMMAPPERAPP_H -#define PMMAPPERAPP_H - -// INCLUDES -#include -#include -#include -#include - -// CONSTANTS -const TUid KUidPMMapperApplication = { 0x2002121F }; - - -// FORWARD DECLARATIONS -class CPixelMetricsMapperView; -class MAknsSkinInstance; - -// CLASS DECLARATION -/** -* CPixelMetricsMapperDocument -*/ -class CPixelMetricsMapperDocument : public CEikDocument - { - public: // Constructors and destructor - - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); - - /** - * Constructor. - */ - CPixelMetricsMapperDocument( CEikApplication& aApp ) - : CEikDocument( aApp ) {} - - /** - * Destructor. - */ - ~CPixelMetricsMapperDocument(){} - - public: // Functions from base classes - - /** - * From CEikDocument. - */ - CFileStore* OpenFileL( - TBool /*aDoOpen*/, - const TDesC& /*aFilename*/, - RFs& /*aFs*/ ) - { - return NULL; - } - - private: // Functions from base classes - - /** - * From CEikDocument. - */ - CEikAppUi* CreateAppUiL(); - }; - -/** -* CPixelMetricsMapperAppUi -*/ -class CPixelMetricsMapperAppUi : public CAknViewAppUi - { - public: // Constructors and destructor - - /** - * Constructor. - */ - CPixelMetricsMapperAppUi(); - - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - ~CPixelMetricsMapperAppUi(); - - public: - void DoAutoOperationL(); - - TBool ReadyForAutoOp() const; - - - private: // Functions from base classes - - /** - * From CEikAppUi. - */ - void HandleCommandL(TInt aCommand); - - /** - * From CEikAppUi. - */ - virtual TKeyResponse HandleKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType ); - - private: - - /** - * Shows text given. - */ - void ShowL( const TDesC& aText, TBool& aLast, const TBool& aFileOutput = EFalse ); - void ShowSingleValueL(TInt& aPixelMetric, TInt& aValue, TBool& aLast); - void ClearL(); - void CreateHeaderFileL() const; - - TFileName CreateLayoutNameL(TFileText& aFileHandle) const; - - private: // Data - - // Test view. - CPixelMetricsMapperView* iView; - - CEikDialog* iDialog; - - TBool iFileOutputOn; - - CFbsBitmap* icon; - CFbsBitmap* iconMask; - - TBool iAutoMode; - TBool iMode; - - }; - - -/** -* CPixelMetricsMapperApplication -*/ -class CPixelMetricsMapperApplication : public CEikApplication - { - private: // Functions from base classes - - /** - * From CApaApplication. - */ - CApaDocument* CreateDocumentL(); - - /** - * From CApaApplication. - */ - TUid AppDllUid() const; - }; - - -#endif // PMMAPPERAPP_H - - -// End of File diff --git a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperView.cpp b/util/s60pixelmetrics/pixelmetricsmapper/PMMapperView.cpp deleted file mode 100644 index 9d5d668..0000000 --- a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperView.cpp +++ /dev/null @@ -1,375 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utility applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// INCLUDE FILES - -#include -#include -#include -#include - -#include "pmmapper.hrh" -#include -#include "pmmapperView.h" -#include "pmmapperApp.h" - -#include -#include -#include - -// ----------------------------------------------------------------------------- -// C++ constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CPixelMetricsMapperViewContainer::CPixelMetricsMapperViewContainer(): iCount( 1 ) - { - } - - -// ----------------------------------------------------------------------------- -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CPixelMetricsMapperViewContainer::ConstructL( const TRect& aRect ) - { - CreateWindowL(); - SetCanDrawOutsideRect(); - - iTexts = new( ELeave ) CDesCArrayFlat( 10 ); - iTexts->AppendL( _L( "\tStarted." ) ); - - iListbox = new( ELeave ) CAknSingleStyleListBox; - iListbox->SetContainerWindowL( *this ); - iListbox->ConstructL( this, EAknListBoxViewerFlags ); - - iListbox->Model()->SetItemTextArray( iTexts ); - iListbox->SetRect( TRect( aRect.Size() ) ); - - iListbox->CreateScrollBarFrameL( ETrue ); - iListbox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOn, - CEikScrollBarFrame::EOn ); - - SetRect( aRect ); - iListbox->ActivateL(); - ActivateL(); - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CPixelMetricsMapperViewContainer::ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput ) - { - MDesCArray* itemList = iListbox->Model()->ItemTextArray(); - CDesCArray* itemArray = ( CDesCArray* ) itemList; - - itemArray->AppendL( aString ); - - iListbox->HandleItemAdditionL(); - iListbox->SetCurrentItemIndex( iCount ); - iCount++; - if ( aLast ) - { - if (aFileOutput) - { - RFile file; - RFs& fs = CEikonEnv::Static()->FsSession(); - TFileName fileName =_L("Layout_"); - - TRect screenRect; - AknLayoutUtils::LayoutMetricsRect( - AknLayoutUtils::EApplicationWindow, - screenRect ); - - // Add screen dimensions - TInt height = screenRect.Height(); - TInt width = screenRect.Width(); - fileName.AppendNum(height); - fileName.Append('_'); - fileName.AppendNum(width); - - if (AknLayoutUtils::LayoutMirrored()) - fileName.Append(_L("_mirrored")); - fileName.Append(_L(".txt")); - - TInt err=file.Open(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny); - if (err==KErrNotFound) // file does not exist - create it - err=file.Create(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny); - else - file.SetSize(0); //sweep the file - TFileText textFile; - textFile.Set(file); - err = textFile.Seek(ESeekStart); - if (err) User::InfoPrint(_L("File corrupted")); - - // Finally loop through all the entries: - TInt idx = 0; - for(;idx!=itemList->MdcaCount();idx++) - { - err = textFile.Write(itemList->MdcaPoint(idx)); - if (err) User::InfoPrint(_L("File corrupted")); - } - file.Close(); - } - DrawNow(); - } - } - -void CPixelMetricsMapperViewContainer::ClearL() - { - MDesCArray* itemList = iListbox->Model()->ItemTextArray(); - CDesCArray* itemArray = ( CDesCArray* ) itemList; - - itemArray->Reset(); - - iListbox->HandleItemAdditionL(); - iCount = 0; - DrawNow(); - } - - -// ----------------------------------------------------------------------------- -// Destructor. -// ----------------------------------------------------------------------------- -// -CPixelMetricsMapperViewContainer::~CPixelMetricsMapperViewContainer() - { - delete iListbox; - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CPixelMetricsMapperViewContainer::SizeChanged() - { - CCoeControl::SizeChanged(); - if ( iListbox ) - { - iListbox->SetRect( Rect() ); - } - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TInt CPixelMetricsMapperViewContainer::CountComponentControls() const - { - return 1; - } - - -// ----------------------------------------------------------------------------- -// CTestAppViewContainer::ComponentControl -// -// -// ----------------------------------------------------------------------------- -// -CCoeControl* CPixelMetricsMapperViewContainer::ComponentControl( - TInt /*aIndex*/ ) const - { - return iListbox; - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CPixelMetricsMapperViewContainer::Draw( const TRect& /*aRect*/ ) const - { - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CPixelMetricsMapperViewContainer::HandleControlEventL( - CCoeControl* /*aControl*/, - TCoeEvent /*aEventType*/ ) - { - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TKeyResponse CPixelMetricsMapperViewContainer::OfferKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - if (aKeyEvent.iCode == EKeyUpArrow || - aKeyEvent.iCode == EKeyDownArrow ) - { - return iListbox->OfferKeyEventL( aKeyEvent, aType ); - } - return EKeyWasNotConsumed; - } - -void CPixelMetricsMapperViewContainer::HandleResourceChange(TInt aType) - { - CCoeControl::HandleResourceChange( aType ); - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect( - AknLayoutUtils::EMainPane, - mainPaneRect ); - SetRect( mainPaneRect ); - - CPixelMetricsMapperAppUi* myApp = static_cast (ControlEnv()->AppUi()); - if (myApp->ReadyForAutoOp()) - myApp->DoAutoOperationL(); - } - if (iListbox) iListbox->HandleResourceChange(aType); - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CPixelMetricsMapperView::ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput ) - { - iView->ShowL( aString, aLast, aFileOutput ); - } - -void CPixelMetricsMapperView::ClearL() - { - iView->ClearL(); - } - - -// ----------------------------------------------------------------------------- -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CPixelMetricsMapperView::ConstructL() - { - BaseConstructL( R_PMMAPPER_VIEW ); - } - - -// ----------------------------------------------------------------------------- -// Destructor. -// ----------------------------------------------------------------------------- -// -CPixelMetricsMapperView::~CPixelMetricsMapperView() - { - if ( iView ) - { - AppUi()->RemoveFromViewStack( *this, iView ); - } - delete iView; - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TUid CPixelMetricsMapperView::Id() const - { - return TUid::Uid( EPMMapperViewId ); - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CPixelMetricsMapperView::HandleCommandL( TInt aCommand ) - { - AppUi()->HandleCommandL( aCommand ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CPixelMetricsMapperView::HandleStatusPaneSizeChange() - { - if ( iView ) - { - TRect cr = ClientRect(); - iView->SetRect( cr ); - } - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CPixelMetricsMapperView::DoActivateL( - const TVwsViewId& /*aPrevViewId*/, - TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/ ) - { - iView = new( ELeave ) CPixelMetricsMapperViewContainer; - - TRect cr = ClientRect(); - iView->ConstructL( cr ); - AppUi()->AddToViewStackL( *this, iView ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CPixelMetricsMapperView::DoDeactivate() - { - if (iView) - { - AppUi()->RemoveFromViewStack( *this, iView ); - } - delete iView; - iView = NULL; - } - -// End of File diff --git a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperView.h b/util/s60pixelmetrics/pixelmetricsmapper/PMMapperView.h deleted file mode 100644 index e9eb42e..0000000 --- a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperView.h +++ /dev/null @@ -1,228 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utility applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PMMAPPERVIEW_H -#define PMMAPPERVIEW_H - - -// INCLUDES -#include -#include - -// CONSTANTS -// FORWARD DECLARATIONS -class CAknSingleStyleListBox; -class CAknSettingStyleListBox; - -// CLASS DECLARATION - -/** -* CPixelMetricsMapperViewContainer -* -*/ -class CPixelMetricsMapperViewContainer -: public CCoeControl, - public MCoeControlObserver - { - public: // Constructors and destructor - - /** - * C++ constructor. - */ - CPixelMetricsMapperViewContainer(); - - /** - * Symbian 2nd phase constructor. - * - * @param aRect Rectangle. - */ - void ConstructL( const TRect& aRect ); - - /** - * Destructor. - */ - ~CPixelMetricsMapperViewContainer(); - - - public: // New functions - - /** - * Show the given string. - * - * @param aString The string to be shown. - */ - void ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput = EFalse ); - - void ClearL(); - - - public: // Functions from base classes - - /** - * From CCoeControl. - */ - TKeyResponse OfferKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType ); - - - void HandleResourceChange(TInt aType); - - - private: // Functions from base classes - - /** - * From CCoeControl. - */ - void SizeChanged(); - - /** - * From CCoeControl. - */ - TInt CountComponentControls() const; - - /** - * From CCoeControl. - */ - CCoeControl* ComponentControl( TInt aIndex ) const; - - /** - * From CCoeControl. - */ - void Draw( const TRect& aRect ) const; - - - private: // Functions from base classes - - /** - * From MCoeControlObserver. - */ - void HandleControlEventL( - CCoeControl* aControl, - TCoeEvent aEventType ); - - - private: // Data - - // Texts. - CDesCArray* iTexts; - - // Count. - TInt iCount; - - // Listbox. - CAknSingleStyleListBox* iListbox; - - }; - - - -/** -* CPixelMetricsMapperView -* -* -* @since 1.0 -*/ -class CPixelMetricsMapperView : public CAknView - { - public: // Constructors and destructor - - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - ~CPixelMetricsMapperView(); - - - public: // Functions from base classes - - /** - * From CAknView. - */ - TUid Id() const; - - /** - * From CAknView. - */ - void HandleCommandL( TInt aCommand ); - - /** - * From CAknView. - */ - void HandleStatusPaneSizeChange(); - - /** - * From CAknView. - */ - void ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput =EFalse ); - void ClearL(); - - - private: // from CAknView - - /** - * From CAknView. - */ - void DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * From CAknView. - */ - void DoDeactivate(); - - - private: // Data - - // The view container. - CPixelMetricsMapperViewContainer* iView; - - }; - -#endif // PMMAPPERVIEW_H - -// End of File diff --git a/util/s60pixelmetrics/pixelmetricsmapper/bld.inf b/util/s60pixelmetrics/pixelmetricsmapper/bld.inf deleted file mode 100644 index 748e8810..0000000 --- a/util/s60pixelmetrics/pixelmetricsmapper/bld.inf +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utility applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -PRJ_MMPFILES -pm_mapper.mmp - -// End of File diff --git a/util/s60pixelmetrics/pixelmetricsmapper/pm_mapper.mmp b/util/s60pixelmetrics/pixelmetricsmapper/pm_mapper.mmp deleted file mode 100644 index fe55fc9..0000000 --- a/util/s60pixelmetrics/pixelmetricsmapper/pm_mapper.mmp +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utility applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -TARGET pm_mapper.exe -TARGETTYPE exe -UID 0x100039CE 0x2002121F - -CAPABILITY CAP_APPLICATION -VENDORID VID_DEFAULT - -SOURCEPATH . -SOURCE pmmapperview.cpp -SOURCE pmmapperapp.cpp -SOURCE ..\src\pixel_metrics.cpp - -START RESOURCE pm_mapper.rss -HEADER -TARGETPATH APP_RESOURCE_DIR -END - -START RESOURCE pm_mapper_reg.rss -TARGETPATH \private\10003a3f\apps -END - -APP_LAYER_SYSTEMINCLUDE -USERINCLUDE . -USERINCLUDE ..\inc - -LIBRARY eikcoctl.lib -LIBRARY avkon.lib -LIBRARY euser.lib -LIBRARY apparc.lib -LIBRARY cone.lib -LIBRARY eikcore.lib -LIBRARY bafl.lib -LIBRARY eikctl.lib -LIBRARY apgrfx.lib -LIBRARY aknnotify.lib -LIBRARY ws32.lib -LIBRARY commonengine.lib -LIBRARY fbscli.lib -LIBRARY eikdlg.lib -LIBRARY aknskins.lib -LIBRARY gdi.lib -LIBRARY CentralRepository.lib -LIBRARY efsrv.lib -LIBRARY cdlengine.lib -LIBRARY AknLayout2.lib -LIBRARY AknLayout2Scalable.lib - -// End of File diff --git a/util/s60pixelmetrics/pixelmetricsmapper/pm_mapper.rss b/util/s60pixelmetrics/pixelmetricsmapper/pm_mapper.rss deleted file mode 100644 index 60c15a8..0000000 --- a/util/s60pixelmetrics/pixelmetricsmapper/pm_mapper.rss +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utility applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -// RESOURCE IDENTIFIER -NAME TATR - - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "pmmapper.hrh" - - -// RESOURCE DEFINITIONS - -// ----------------------------------------------------------------------------- -// -// RSS_SIGNATURE -// -// -// ----------------------------------------------------------------------------- -// -RESOURCE RSS_SIGNATURE { } - - -// ----------------------------------------------------------------------------- -// -// TBUF -// -// -// ----------------------------------------------------------------------------- -// -RESOURCE TBUF { buf = "pm_mapper"; } - - -// ----------------------------------------------------------------------------- -// -// EIK_APP_INFO -// -// -// ----------------------------------------------------------------------------- -// -RESOURCE EIK_APP_INFO - { - } - -// ----------------------------------------------------------------------------- -// -// r_pmmapper_localisable_app_info -// Captions for this application. -// -// ----------------------------------------------------------------------------- -// -RESOURCE LOCALISABLE_APP_INFO r_pmmapper_localisable_app_info - { - short_caption = "pm_mapper"; - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = "PixelMetricsMapper"; - }; - } - -// ----------------------------------------------------------------------------- -// -// r_pmmapper_view -// -// -// ----------------------------------------------------------------------------- -// -RESOURCE AVKON_VIEW r_pmmapper_view - { - menubar = r_pmmapper_view_menu; - cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; - } - - -// ----------------------------------------------------------------------------- -// -// r_pmmapper_view_menu -// -// -// ----------------------------------------------------------------------------- -// -RESOURCE MENU_BAR r_pmmapper_view_menu - { - titles= - { - MENU_TITLE { txt = "A"; menu_pane = r_pmmapper_system_menu; } - }; - } - -// ----------------------------------------------------------------------------- -// -// r_pmmapper_system_menu -// -// -// ----------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_pmmapper_system_menu - { - items = - { - MENU_ITEM { command = ECmdStartCalculations; txt = "Start calculations"; }, - MENU_ITEM { command = ECmdSwitchOrientation; txt = "Switch orientation"; }, - MENU_ITEM { command = ECmdSwitchMirroring; txt = "Switch mirroring";}, - MENU_ITEM { command = ECmdStatus; txt = "Status"; }, - MENU_ITEM { command = ECmdSwitchOutput; txt = "Switch output (file/screen)"; }, - MENU_ITEM { command = ECmdCreateHeaderFile; txt = "Create header file"; }, - MENU_ITEM { command = ECmdSetAutoMode; txt = "Switch autoMode";} - }; - } - - -// End of File diff --git a/util/s60pixelmetrics/pixelmetricsmapper/pm_mapper_reg.rss b/util/s60pixelmetrics/pixelmetricsmapper/pm_mapper_reg.rss deleted file mode 100644 index d21a2c8..0000000 --- a/util/s60pixelmetrics/pixelmetricsmapper/pm_mapper_reg.rss +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utility applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -UID2 KUidAppRegistrationResourceFile -UID3 0x2002121F // application UID - -RESOURCE APP_REGISTRATION_INFO - { - app_file = "pm_mapper"; - localisable_resource_file = - APP_RESOURCE_DIR"\\pm_mapper"; - localisable_resource_id = R_PMMAPPER_LOCALISABLE_APP_INFO; - } - -// End of File diff --git a/util/s60pixelmetrics/pixelmetricsmapper/pmmapper.pkg b/util/s60pixelmetrics/pixelmetricsmapper/pmmapper.pkg deleted file mode 100644 index 1f2e38f..0000000 --- a/util/s60pixelmetrics/pixelmetricsmapper/pmmapper.pkg +++ /dev/null @@ -1,32 +0,0 @@ -; ============================================================================== -; Name : PMMapper.pkg -; Part of : Pixel Metrics Mapper -; Description : Package file for pixel metrics mapper -; SIS creation. -; Version : -; -; Copyright (c) 2009 Nokia Corporation. -; This material, including documentation and any related -; computer programs, is protected by copyright controlled by -; Nokia Corporation. All rights are reserved. Copying, -; including reproducing, storing, adapting or translating, any -; or all of this material requires the prior written consent of -; Nokia Corporation. This material also contains confidential -; information which may not be disclosed to others without the -; prior written consent of Nokia Corporation. -; ============================================================================== - - -;Header -#{"PMMapper"},(0x2002121F),1,0,0 - -;Localised Vendor name -%{"Nokia Test EN"} - -;Unique Vendor name -:"Vendor" - -;Files to install -"\Epoc32\release\armv5\urel\pm_mapper.exe" -"!:\sys\bin\pm_mapper.exe" -"\epoc32\data\z\private\10003a3f\apps\pm_mapper_reg.rsc" -"!:\private\10003a3f\import\apps\pm_mapper_reg.rsc" -"\epoc32\data\Z\Resource\Apps\pm_mapper.RSC" -"!:\resource\apps\pm_mapper.rsc" diff --git a/util/s60pixelmetrics/pm_mapper.hrh b/util/s60pixelmetrics/pm_mapper.hrh new file mode 100644 index 0000000..afd47db --- /dev/null +++ b/util/s60pixelmetrics/pm_mapper.hrh @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the utility applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PMMAPPER_HRH +#define PMMAPPER_HRH + +// DATA TYPES + +// View IDs. +enum + { + EPMMapperViewId = 1 // Base view. + }; + +// Menu items (commands) +enum + { + ECmdStartCalculations = 8500, + ECmdSwitchOrientation, + ECmdSwitchMirroring, + ECmdStatus, + ECmdSwitchOutput, + ECmdCreateHeaderFile, + ECmdSetAutoMode + }; + +enum + { + EWaitNote = 9000 + }; + +#endif // PMMAPPER_HRH + + +// End of File diff --git a/util/s60pixelmetrics/pm_mapper.mmp b/util/s60pixelmetrics/pm_mapper.mmp new file mode 100644 index 0000000..a277404 --- /dev/null +++ b/util/s60pixelmetrics/pm_mapper.mmp @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the utility applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +TARGET pm_mapper.exe +TARGETTYPE exe +UID 0x100039CE 0x2002121F + +CAPABILITY CAP_APPLICATION +VENDORID VID_DEFAULT + +SOURCEPATH . +SOURCE pm_mapperview.cpp +SOURCE pm_mapperapp.cpp +SOURCE pixel_metrics.cpp + +START RESOURCE pm_mapper.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +END + +START RESOURCE pm_mapper_reg.rss +TARGETPATH \private\10003a3f\apps +END + +APP_LAYER_SYSTEMINCLUDE +USERINCLUDE . + +LIBRARY eikcoctl.lib +LIBRARY avkon.lib +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY bafl.lib +LIBRARY eikctl.lib +LIBRARY apgrfx.lib +LIBRARY aknnotify.lib +LIBRARY ws32.lib +LIBRARY commonengine.lib +LIBRARY fbscli.lib +LIBRARY eikdlg.lib +LIBRARY aknskins.lib +LIBRARY gdi.lib +LIBRARY CentralRepository.lib +LIBRARY efsrv.lib +LIBRARY cdlengine.lib +LIBRARY AknLayout2.lib +LIBRARY AknLayout2Scalable.lib + +// End of File diff --git a/util/s60pixelmetrics/pm_mapper.pkg b/util/s60pixelmetrics/pm_mapper.pkg new file mode 100644 index 0000000..1f2e38f --- /dev/null +++ b/util/s60pixelmetrics/pm_mapper.pkg @@ -0,0 +1,32 @@ +; ============================================================================== +; Name : PMMapper.pkg +; Part of : Pixel Metrics Mapper +; Description : Package file for pixel metrics mapper +; SIS creation. +; Version : +; +; Copyright (c) 2009 Nokia Corporation. +; This material, including documentation and any related +; computer programs, is protected by copyright controlled by +; Nokia Corporation. All rights are reserved. Copying, +; including reproducing, storing, adapting or translating, any +; or all of this material requires the prior written consent of +; Nokia Corporation. This material also contains confidential +; information which may not be disclosed to others without the +; prior written consent of Nokia Corporation. +; ============================================================================== + + +;Header +#{"PMMapper"},(0x2002121F),1,0,0 + +;Localised Vendor name +%{"Nokia Test EN"} + +;Unique Vendor name +:"Vendor" + +;Files to install +"\Epoc32\release\armv5\urel\pm_mapper.exe" -"!:\sys\bin\pm_mapper.exe" +"\epoc32\data\z\private\10003a3f\apps\pm_mapper_reg.rsc" -"!:\private\10003a3f\import\apps\pm_mapper_reg.rsc" +"\epoc32\data\Z\Resource\Apps\pm_mapper.RSC" -"!:\resource\apps\pm_mapper.rsc" diff --git a/util/s60pixelmetrics/pm_mapper.rss b/util/s60pixelmetrics/pm_mapper.rss new file mode 100644 index 0000000..8543271 --- /dev/null +++ b/util/s60pixelmetrics/pm_mapper.rss @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the utility applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +// RESOURCE IDENTIFIER +NAME TATR + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pm_mapper.hrh" + + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RSS_SIGNATURE +// +// +// ----------------------------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE { } + + +// ----------------------------------------------------------------------------- +// +// TBUF +// +// +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF { buf = "pm_mapper"; } + + +// ----------------------------------------------------------------------------- +// +// EIK_APP_INFO +// +// +// ----------------------------------------------------------------------------- +// +RESOURCE EIK_APP_INFO + { + } + +// ----------------------------------------------------------------------------- +// +// r_pmmapper_localisable_app_info +// Captions for this application. +// +// ----------------------------------------------------------------------------- +// +RESOURCE LOCALISABLE_APP_INFO r_pmmapper_localisable_app_info + { + short_caption = "pm_mapper"; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = "PixelMetricsMapper"; + }; + } + +// ----------------------------------------------------------------------------- +// +// r_pmmapper_view +// +// +// ----------------------------------------------------------------------------- +// +RESOURCE AVKON_VIEW r_pmmapper_view + { + menubar = r_pmmapper_view_menu; + cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; + } + + +// ----------------------------------------------------------------------------- +// +// r_pmmapper_view_menu +// +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_BAR r_pmmapper_view_menu + { + titles= + { + MENU_TITLE { txt = "A"; menu_pane = r_pmmapper_system_menu; } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_pmmapper_system_menu +// +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_pmmapper_system_menu + { + items = + { + MENU_ITEM { command = ECmdStartCalculations; txt = "Start calculations"; }, + MENU_ITEM { command = ECmdSwitchOrientation; txt = "Switch orientation"; }, + MENU_ITEM { command = ECmdSwitchMirroring; txt = "Switch mirroring";}, + MENU_ITEM { command = ECmdStatus; txt = "Status"; }, + MENU_ITEM { command = ECmdSwitchOutput; txt = "Switch output (file/screen)"; }, + MENU_ITEM { command = ECmdCreateHeaderFile; txt = "Create header file"; }, + MENU_ITEM { command = ECmdSetAutoMode; txt = "Switch autoMode";} + }; + } + + +// End of File diff --git a/util/s60pixelmetrics/pm_mapper_reg.rss b/util/s60pixelmetrics/pm_mapper_reg.rss new file mode 100644 index 0000000..d21a2c8 --- /dev/null +++ b/util/s60pixelmetrics/pm_mapper_reg.rss @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the utility applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0x2002121F // application UID + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "pm_mapper"; + localisable_resource_file = + APP_RESOURCE_DIR"\\pm_mapper"; + localisable_resource_id = R_PMMAPPER_LOCALISABLE_APP_INFO; + } + +// End of File diff --git a/util/s60pixelmetrics/pm_mapperapp.cpp b/util/s60pixelmetrics/pm_mapperapp.cpp new file mode 100644 index 0000000..e699019 --- /dev/null +++ b/util/s60pixelmetrics/pm_mapperapp.cpp @@ -0,0 +1,1044 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the utility applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// INCLUDE FILES + +#include +#include +#include "pm_mapper.hrh" +#include "pm_mapperapp.h" +#include "pm_mapperview.h" +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include // KAknLayoutId + +#include +#include +#include "pixel_metrics.h" + +#include + +#include +#include + +typedef TBuf<2048> TMySmallBuffer; +typedef TBuf<8192> TMyBigBuffer; + +_LIT(KLayoutSourceFileAndPath, "\\private\\2002121f\\pm_layout.cpp"); +_LIT(KPixelMetricsDataFiles, "\\private\\2002121f\\*.txt"); +_LIT(KOpenBrace, "{"); +_LIT(KComma, ","); +_LIT(KColon, ":"); +_LIT(KTab, "\t"); +_LIT(KEndBraceWithCommaAndCRLF, "},\n"); +_LIT(KCRLF, "\n"); + +// Number of header lines in layout data. +const TInt KHeaderValues = 5; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// C++ constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CPixelMetricsMapperAppUi::CPixelMetricsMapperAppUi() : iFileOutputOn(EFalse) + { + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +// +CPixelMetricsMapperAppUi::~CPixelMetricsMapperAppUi() + { + } + +// ----------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CPixelMetricsMapperAppUi::ConstructL() + { + BaseConstructL(); + + CEikonEnv& eikEnv = *CEikonEnv::Static(); + + eikEnv.WsSession().ComputeMode( + RWsSession::EPriorityControlDisabled ); + RThread().SetProcessPriority( EPriorityHigh ); + + CPixelMetricsMapperView* view = new( ELeave ) CPixelMetricsMapperView; + CleanupStack::PushL( view ); + view->ConstructL(); + CleanupStack::Pop(); // view + AddViewL(view); // transfer ownership to CAknViewAppUi + iView = view; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TKeyResponse CPixelMetricsMapperAppUi::HandleKeyEventL( + const TKeyEvent& /*aKeyEvent*/, + TEventCode aType ) + { + return EKeyWasNotConsumed; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) + { + switch ( aCommand ) + { + case EAknSoftkeyExit: + case EEikCmdExit: + Exit(); + break; + case ECmdSwitchOutput: + iFileOutputOn = !iFileOutputOn; + break; + case ECmdStatus: + { + ClearL(); + + // layout + CRepository* repository = NULL; + TInt value = KErrNotFound; + TRAPD(ret, repository = CRepository::NewL(KCRUidAvkon)); + if (ret == KErrNone) + { + ret = repository->Get(KAknLayoutId, value); + } + delete repository; + ret= 0; + HBufC* buffer = HBufC::NewLC( 100 ); + TPtr bufferPtr = buffer->Des(); + bufferPtr.Append(_L("Layout: ")); + if (ret==KErrNone) + { + bufferPtr.AppendNum(value); + } + else + { + bufferPtr.Append(_L("(error) ")); + bufferPtr.AppendNum(ret); + } + TBool last = ETrue; + ShowL( *buffer, last ); + bufferPtr.Zero(); + + // Orientation + bufferPtr.Append(_L("Orientation: ")); + bufferPtr.AppendNum((TInt)iAvkonAppUi->Orientation()); + ShowL( *buffer, last ); + bufferPtr.Zero(); + + // Output + bufferPtr.Append(_L("Output: ")); + if (iFileOutputOn) bufferPtr.Append(_L("File")); + else bufferPtr.Append(_L("Screen")); + ShowL( *buffer, last ); + bufferPtr.Zero(); + + // Automode + bufferPtr.Append(_L("AutoMode: ")); + bufferPtr.AppendNum((TInt)iAutoMode); + ShowL( *buffer, last ); + bufferPtr.Zero(); + + CAknLayoutConfig::TScreenMode localAppScreenMode = CAknSgcClient::ScreenMode(); + TInt hashValue = localAppScreenMode.ScreenStyleHash(); + TPixelsTwipsAndRotation pixels = CAknSgcClient::PixelsAndRotation(); + TSize pixelSize = pixels.iPixelSize; + + bufferPtr.Append(_L("LayoutName: ")); + + if ( (pixelSize.iWidth == 320 || pixelSize.iWidth == 240 )&& + (pixelSize.iHeight == 320 || pixelSize.iHeight == 240 )) + { + if (hashValue==0x996F7AA7) + bufferPtr.Append(_L("QVGA2")); + else + bufferPtr.Append(_L("QVGA1")); + } + else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 360 )&& + (pixelSize.iHeight == 360 || pixelSize.iHeight == 640 )) + { + bufferPtr.Append(_L("nHD")); + } + else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 480 )&& + (pixelSize.iHeight == 480 || pixelSize.iHeight == 640 )) + { + bufferPtr.Append(_L("VGA")); + } + else if ((pixelSize.iWidth == 352 || pixelSize.iWidth == 800 )&& + (pixelSize.iHeight == 800 || pixelSize.iHeight == 352 )) + { + bufferPtr.Append(_L("E90")); + } + else if ((pixelSize.iWidth == 320 || pixelSize.iWidth == 480 || + pixelSize.iWidth == 240 || pixelSize.iWidth == 640 )&& + (pixelSize.iHeight == 320 || pixelSize.iHeight == 480 || + pixelSize.iHeight == 240 || pixelSize.iHeight == 640)) + { + bufferPtr.Append(_L("HVGA")); + } + else if ((pixelSize.iWidth == 480 || pixelSize.iWidth == 854 || + pixelSize.iWidth == 848 || pixelSize.iWidth == 800 )&& + (pixelSize.iHeight == 800 || pixelSize.iHeight == 480 || + pixelSize.iHeight == 848 || pixelSize.iHeight == 854)) + { + bufferPtr.Append(_L("WVGA")); + } + else + { + bufferPtr.Append(_L("Unknown")); + } + + ShowL( *buffer, last ); + bufferPtr.Zero(); + CleanupStack::PopAndDestroy( buffer ); + } + break; + case ECmdSwitchMirroring: + { + // set the shared data value + CRepository* repository = NULL; + TRAPD(ret, repository = CRepository::NewL(KCRUidAvkon)); + if (ret == KErrNone) + { + TInt value = KErrNotFound; + repository->Get(KAknLayoutId, value); + if ( value == EAknLayoutIdELAF) + { + value = EAknLayoutIdABRW; + } + else if (value ==EAknLayoutIdABRW) + { + value = EAknLayoutIdELAF; + } + ret = repository->Set(KAknLayoutId, value); + } + delete repository; + // now inform all open apps of the switch + TWsEvent event; + event.SetType(KEikDynamicLayoutVariantSwitch); + iEikonEnv->WsSession().SendEventToAllWindowGroups(event); + } + break; + case ECmdSwitchOrientation: + { + ClearL(); + #ifndef __SERIES60_31__ + if (!iAvkonAppUi->OrientationCanBeChanged()) + { + HBufC* buffer = HBufC::NewLC( 100 ); + TPtr bufferPtr = buffer->Des(); + bufferPtr.Append(_L("Orientation cannot be changed.")); + TBool last = EFalse; + ShowL( *buffer, last ); + bufferPtr.Zero(); + delete buffer; + } + #endif //__SERIES60_31__ + if ( iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationPortrait) + { + iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape); + } + else if (iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationLandscape) + { + iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationPortrait); + } + else + { + // unspecified + iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape); + /*User::After(100000); + HBufC* buffer = HBufC::NewLC( 100 ); + TPtr bufferPtr = buffer->Des(); + bufferPtr.Append(_L("Orientation unspecified.")); + TBool last = EFalse; + ShowL( *buffer, last ); + bufferPtr.Zero(); + delete buffer;*/ + } + break; + } + case ECmdStartCalculations: + { + ClearL(); + // Get known values + TInt index = 0; + TBool last = EFalse; + if (iFileOutputOn) + { + TRect screenRect; + AknLayoutUtils::LayoutMetricsRect( + AknLayoutUtils::EApplicationWindow, + screenRect ); + + // Add screen dimensions + TInt height = screenRect.Height(); + TInt width = screenRect.Width(); + TBuf16<32> tgt; + // HEIGTH + tgt.Append(_L("height: \t")); + tgt.AppendNum(height, EDecimal); // put max height into text file + ShowL( tgt, last ); + tgt.Zero(); + // WIDTH + tgt.Append(_L("width: \t")); + tgt.AppendNum(width, EDecimal); // put max width into text file + ShowL( tgt, last ); + tgt.Zero(); + // VERSION + TPixelMetricsVersion version = PixelMetrics::Version(); + tgt.Append(_L("major_version: \t")); + tgt.AppendNum(version.majorVersion, EDecimal); // put major version into text file + ShowL( tgt, last ); + tgt.Zero(); + tgt.Append(_L("minor_version: \t")); + tgt.AppendNum(version.minorVersion, EDecimal); // put minor version into text file + ShowL( tgt, last ); + tgt.Zero(); + // MIRRORED + TBool mirrored = AknLayoutUtils::LayoutMirrored(); + tgt.Append(_L("mirrored: \t")); + tgt.AppendNum(mirrored, EDecimal); // put mirrored state into text file + ShowL( tgt, last ); + tgt.Zero(); + } + + TInt myValue = KErrNotFound; + for (;;) + { + if (index==QStyle::PM_Custom_ThinLineWidth) + { + last = ETrue; + } + myValue = PixelMetrics::PixelMetricValue(static_cast(index)); + ShowSingleValueL( index, myValue, last ); + + if (last) break; + // if last before custom values, "jump" to custom base + if (index==QStyle::PM_SubMenuOverlap) index = QStyle::PM_CustomBase; + index++; + } + if (iAutoMode && !iMode) + { + HandleCommandL(ECmdSwitchMirroring); + iMode = ETrue; + } + } + break; + case ECmdCreateHeaderFile: + CreateHeaderFileL(); + break; + case ECmdSetAutoMode: + iAutoMode = !iAutoMode; + default: + break; + } + } +void CPixelMetricsMapperAppUi::DoAutoOperationL() + { + HandleCommandL(ECmdStartCalculations); + iMode = EFalse; + HandleCommandL(ECmdSwitchMirroring); + } + +TBool CPixelMetricsMapperAppUi::ReadyForAutoOp() const + { + return (iAutoMode && iMode); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CPixelMetricsMapperAppUi::ShowL( const TDesC& aText, TBool& aLast, const TBool& aFileOutput ) + { + _LIT( KTestPrefix, "\t" ); + + HBufC* buffer = HBufC::NewLC( aText.Length() + KTestPrefix().Length() ); + TPtr ptr = buffer->Des(); + ptr.Append( KTestPrefix ); + ptr.Append( aText ); + iView->ShowL( *buffer, aLast, aFileOutput ); + CleanupStack::PopAndDestroy( buffer ); + } + +void CPixelMetricsMapperAppUi::ShowSingleValueL(TInt& aPixelMetric, TInt& aValue, TBool& aLast ) + { + HBufC* buffer = HBufC::NewLC( 100 ); + TPtr bufferPtr = buffer->Des(); + + switch (aPixelMetric) + { + case QStyle::PM_DockWidgetTitleMargin: + bufferPtr.Append(_L("DockTitleMargin: ")); + break; + case QStyle::PM_DockWidgetTitleBarButtonMargin: + bufferPtr.Append(_L("DockTitleBtnMargin: ")); + break; + case QStyle::PM_ButtonMargin: + bufferPtr.Append(_L("ButtonMargin: ")); + break; + case QStyle::PM_ButtonDefaultIndicator: + bufferPtr.Append(_L("ButtonDefaultIndicator: ")); + break; + case QStyle::PM_MdiSubWindowFrameWidth: + bufferPtr.Append(_L("MdiSubWndFrameW: ")); + break; + case QStyle::PM_ComboBoxFrameWidth: + bufferPtr.Append(_L("ComboBoxFrameWidth: ")); + break; + case QStyle::PM_SpinBoxFrameWidth: + bufferPtr.Append(_L("SpinBoxFrameWidth: ")); + break; + case QStyle::PM_DefaultFrameWidth: + bufferPtr.Append(_L("DefaultFrameWidth: ")); + break; + case QStyle::PM_RadioButtonLabelSpacing: + bufferPtr.Append(_L("RadioButtonLabelSpc: ")); + break; + case QStyle::PM_CheckBoxLabelSpacing: + bufferPtr.Append(_L("CheckBoxLabelSpacing: ")); + break; + case QStyle::PM_ToolTipLabelFrameWidth: + bufferPtr.Append(_L("ToolTipLabelFrameW: ")); + break; + case QStyle::PM_ListViewIconSize: + bufferPtr.Append(_L("ListViewIconSize: ")); + break; + case QStyle::PM_LargeIconSize: + bufferPtr.Append(_L("LargeIconSize: ")); + break; + case QStyle::PM_IconViewIconSize: + bufferPtr.Append(_L("IconViewIconSize: ")); + break; + case QStyle::PM_TabBarIconSize: + bufferPtr.Append(_L("TabBarIconSize: ")); + break; + case QStyle::PM_MessageBoxIconSize: + bufferPtr.Append(_L("MessageBoxIconSize: ")); + break; + case QStyle::PM_ButtonIconSize: + bufferPtr.Append(_L("ButtonIconSize: ")); + break; + case QStyle::PM_TextCursorWidth: + bufferPtr.Append(_L("TextCursorWidth: ")); + break; + case QStyle::PM_SliderLength: + bufferPtr.Append(_L("SliderLength: ")); + break; + case QStyle::PM_SliderThickness: + bufferPtr.Append(_L("SliderThickness: ")); + break; + case QStyle::PM_SliderTickmarkOffset: + bufferPtr.Append(_L("SliderTickmarkOffset: ")); + break; + case QStyle::PM_SliderControlThickness: + bufferPtr.Append(_L("SliderCntrlThickness: ")); + break; + case QStyle::PM_SliderSpaceAvailable: + bufferPtr.Append(_L("SliderSpaceAvailable: ")); + break; + case QStyle::PM_MenuBarItemSpacing: + bufferPtr.Append(_L("MenuBarItemSpacing: ")); + break; + case QStyle::PM_MenuBarHMargin: + bufferPtr.Append(_L("MenuBarHMargin: ")); + break; + case QStyle::PM_MenuBarVMargin: + bufferPtr.Append(_L("MenuBarVMargin: ")); + break; + case QStyle::PM_ToolBarItemSpacing: + bufferPtr.Append(_L("ToolBarItemSpacing: ")); + break; + case QStyle::PM_ToolBarFrameWidth: + bufferPtr.Append(_L("ToolBarFrameWidth: ")); + break; + case QStyle::PM_ToolBarItemMargin: + bufferPtr.Append(_L("ToolBarItemMargin: ")); + break; + case QStyle::PM_LayoutLeftMargin: + bufferPtr.Append(_L("LayoutLeftMargin: ")); + break; + case QStyle::PM_LayoutRightMargin: + bufferPtr.Append(_L("LayoutRightMargin: ")); + break; + case QStyle::PM_LayoutTopMargin: + bufferPtr.Append(_L("LayoutTopMargin: ")); + break; + case QStyle::PM_LayoutBottomMargin: + bufferPtr.Append(_L("LayoutBottomMargin: ")); + break; + case QStyle::PM_LayoutHorizontalSpacing: + bufferPtr.Append(_L("LayoutHSpacing: ")); + break; + case QStyle::PM_LayoutVerticalSpacing: + bufferPtr.Append(_L("LayoutVSpacing: ")); + break; + case QStyle::PM_MaximumDragDistance: + bufferPtr.Append(_L("MaxDragDistance: ")); + break; + case QStyle::PM_ScrollBarExtent: + bufferPtr.Append(_L("ScrollBarExtent: ")); + break; + case QStyle::PM_ScrollBarSliderMin: + bufferPtr.Append(_L("ScrollBarSliderMin: ")); + break; + case QStyle::PM_MenuBarPanelWidth: + bufferPtr.Append(_L("MenuBarPanelWidth: ")); + break; + case QStyle::PM_ProgressBarChunkWidth: + bufferPtr.Append(_L("ProgBarChunkWidth: ")); + break; + case QStyle::PM_TabBarTabOverlap: + bufferPtr.Append(_L("TabBarTabOverlap: ")); + break; + case QStyle::PM_TabBarTabHSpace: + bufferPtr.Append(_L("TabBarTabHSpace: ")); + break; + case QStyle::PM_TabBarTabVSpace: + bufferPtr.Append(_L("TabBarTabVSpace: ")); + break; + case QStyle::PM_TabBarBaseHeight: + bufferPtr.Append(_L("TabBarBaseHeight: ")); + break; + case QStyle::PM_TabBarBaseOverlap: + bufferPtr.Append(_L("TabBarBaseOverlap: ")); + break; + case QStyle::PM_TabBarScrollButtonWidth: + bufferPtr.Append(_L("TabBarScrollBtnWidth: ")); + break; + case QStyle::PM_TabBarTabShiftHorizontal: + bufferPtr.Append(_L("TabBarTabShiftH: ")); + break; + case QStyle::PM_TabBarTabShiftVertical: + bufferPtr.Append(_L("TabBarTabShiftV: ")); + break; + case QStyle::PM_MenuPanelWidth: + bufferPtr.Append(_L("MenuPanelWidth: ")); + break; + case QStyle::PM_MenuHMargin: + bufferPtr.Append(_L("MenuHMargin: ")); + break; + case QStyle::PM_MenuVMargin: + bufferPtr.Append(_L("MenuVMargin: ")); + break; + case QStyle::PM_MenuDesktopFrameWidth: + bufferPtr.Append(_L("MenuFrameWidth: ")); + break; + case QStyle::PM_SmallIconSize: + bufferPtr.Append(_L("SmallIconSize: ")); + break; + case QStyle::PM_FocusFrameHMargin: + bufferPtr.Append(_L("FocusFrameHMargin: ")); + break; + case QStyle::PM_FocusFrameVMargin: + bufferPtr.Append(_L("FocusFrameVMargin: ")); + break; + case QStyle::PM_ToolBarIconSize: + bufferPtr.Append(_L("ToolBarIconSize: ")); + break; + case QStyle::PM_TitleBarHeight: // use titlepane height + bufferPtr.Append(_L("TitleBarHeight: ")); + break; + case QStyle::PM_IndicatorWidth: + bufferPtr.Append(_L("IndicatorWidth: ")); + break; + case QStyle::PM_IndicatorHeight: + bufferPtr.Append(_L("IndicatorHeight: ")); + break; + case QStyle::PM_ExclusiveIndicatorHeight: + bufferPtr.Append(_L("ExclusiveIndHeight: ")); + break; + case QStyle::PM_ExclusiveIndicatorWidth: + bufferPtr.Append(_L("ExclusiveIndWidth: ")); + break; + case QStyle::PM_HeaderMargin: // not in S60 + bufferPtr.Append(_L("HeaderMargin: ")); + break; + case QStyle::PM_MenuScrollerHeight: // not in S60 + bufferPtr.Append(_L("MenuScrollerHeight: ")); + break; + case QStyle::PM_MenuTearoffHeight: // not in S60 + bufferPtr.Append(_L("MenuTearoffHeight: ")); + break; + case QStyle::PM_DockWidgetFrameWidth: // not in S60 + bufferPtr.Append(_L("DockFrameWidth: ")); + break; + case QStyle::PM_DockWidgetSeparatorExtent: // not in S60 + bufferPtr.Append(_L("DockSepExtent: ")); + break; + case QStyle::PM_MdiSubWindowMinimizedWidth: //no such thing in S60 + bufferPtr.Append(_L("MdiSubWndMinWidth: ")); + break; + case QStyle::PM_HeaderGripMargin: // not in S60 + bufferPtr.Append(_L("HeaderGripMargin: ")); + break; + case QStyle::PM_SplitterWidth: // not in S60 + bufferPtr.Append(_L("SplitterWidth: ")); + break; + case QStyle::PM_ToolBarExtensionExtent: // not in S60 + bufferPtr.Append(_L("ToolBarExtExtent: ")); + break; + case QStyle::PM_ToolBarSeparatorExtent: // not in S60 + bufferPtr.Append(_L("ToolBarSepExtent: ")); + break; + case QStyle::PM_ToolBarHandleExtent: // not in s60 + bufferPtr.Append(_L("ToolBarHandleExtent: ")); + break; + case QStyle::PM_MenuButtonIndicator: // none??? + bufferPtr.Append(_L("MenuButtonIndicator: ")); + break; + case QStyle::PM_ButtonShiftHorizontal: //none in 3.x + bufferPtr.Append(_L("ButtonShiftHorizontal: ")); + break; + case QStyle::PM_ButtonShiftVertical: // none in 3.x + bufferPtr.Append(_L("ButtonShiftVertical: ")); + break; + case QStyle::PM_TabBar_ScrollButtonOverlap: // not used in S60 - tab arrows are on left and right side of tab group - not together + bufferPtr.Append(_L("TabScrollBtnOverlap: ")); + break; + case QStyle::PM_SizeGripSize: // use default + bufferPtr.Append(_L("SizeGripSize: ")); + break; + case QStyle::PM_DockWidgetHandleExtent: + bufferPtr.Append(_L("DockWdgtHandleExt: ")); + break; + case QStyle::PM_CheckListButtonSize: + bufferPtr.Append(_L("CheckListButtonSize: ")); + break; + case QStyle::PM_CheckListControllerSize: + bufferPtr.Append(_L("CheckListCntlerSize: ")); + break; + case QStyle::PM_DialogButtonsSeparator: + bufferPtr.Append(_L("DialogBtnSeparator: ")); + break; + case QStyle::PM_DialogButtonsButtonWidth: + bufferPtr.Append(_L("DialogBtnWidth: ")); + break; + case QStyle::PM_DialogButtonsButtonHeight: + bufferPtr.Append(_L("DialogBtnHeight: ")); + break; + case QStyle::PM_HeaderMarkSize: + bufferPtr.Append(_L("HeaderMarkSize: ")); + break; + case QStyle::PM_SpinBoxSliderHeight: + bufferPtr.Append(_L("SpinBoxSliderHeight: ")); + break; + case QStyle::PM_DefaultTopLevelMargin: + bufferPtr.Append(_L("DefaultTopLvlMrg: ")); + break; + case QStyle::PM_DefaultChildMargin: + bufferPtr.Append(_L("DefaultChildMrg: ")); + break; + case QStyle::PM_DefaultLayoutSpacing: + bufferPtr.Append(_L("DefaultlayoutSpc: ")); + break; + case QStyle::PM_TabCloseIndicatorWidth: + bufferPtr.Append(_L("TabCloseIndWidth: ")); + break; + case QStyle::PM_TabCloseIndicatorHeight: + bufferPtr.Append(_L("TabCloseIndHeight: ")); + break; + case QStyle::PM_ScrollView_ScrollBarSpacing: + bufferPtr.Append(_L("ScrollViewBarSpc: ")); + break; + case QStyle::PM_SubMenuOverlap: + bufferPtr.Append(_L("SubMenuOverlap: ")); + break; + case QStyle::PM_Custom_FrameCornerHeight: + bufferPtr.Append(_L("C_FrCornerHeight: ")); + break; + case QStyle::PM_Custom_FrameCornerWidth: + bufferPtr.Append(_L("C_FrCornerWidth: ")); + break; + case QStyle::PM_Custom_ThinLineWidth: + bufferPtr.Append(_L("C_ThinLineWidth: ")); + break; + case QStyle::PM_Custom_BoldLineWidth: + bufferPtr.Append(_L("C_BoldLineWidth: ")); + break; + default: + bufferPtr.Append(_L("Default: ")); + break; + } + + if (iFileOutputOn) + { + bufferPtr.Append('\t'); + } + bufferPtr.AppendNum(aValue); + bufferPtr.Append(_L(" ")); + ShowL( *buffer, aLast, iFileOutputOn ); + CleanupStack::PopAndDestroy( buffer ); + } + +void CPixelMetricsMapperAppUi::ClearL() + { + iView->ClearL(); + } + +void CPixelMetricsMapperAppUi::CreateHeaderFileL() const + { + // Open/create resulting file. + RFile file; + HBufC* layoutFile = HBufC::NewLC( KMaxFileName ); + *layoutFile = KLayoutSourceFileAndPath; + TFileName fileName = *layoutFile; + CleanupStack::PopAndDestroy(layoutFile); + RFs& fs = CEikonEnv::Static()->FsSession(); + TInt error = file.Open(fs,fileName, EFileWrite|EFileShareAny|EFileStreamText ); + if (error==KErrNotFound) + { + file.Create(fs,fileName, EFileWrite|EFileShareAny|EFileStreamText); + } + CleanupClosePushL( file ); + file.SetSize( 0 ); + + // Make all writes as from textfile. + TFileText textFile; + textFile.Set( file ); + textFile.Seek( ESeekStart ); + + // Take all layout files from private folder. + CDir* dirList; + User::LeaveIfError(fs.GetDir( + KPixelMetricsDataFiles, + KEntryAttMaskSupported, + ESortByName, + dirList)); + + TMySmallBuffer bufferLayoutHdr; + TMyBigBuffer bufferPMData; + TInt fileCount = dirList->Count(); + for (TInt i=0;i height) + { + layoutName.Append(_L("Landscape")); + } + else + { + layoutName.Append(_L("Portrait")); + } + if (mirroring) + { + layoutName.Append(_L(" Mirrored")); + } + return layoutName; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CEikAppUi* CPixelMetricsMapperDocument::CreateAppUiL() + { + return( new ( ELeave ) CPixelMetricsMapperAppUi ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CPixelMetricsMapperDocument::ConstructL() + { + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TUid CPixelMetricsMapperApplication::AppDllUid() const + { + return KUidPMMapperApplication; + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CApaDocument* CPixelMetricsMapperApplication::CreateDocumentL() + { + CPixelMetricsMapperDocument* document = + new( ELeave ) CPixelMetricsMapperDocument( *this ); + CleanupStack::PushL( document ); + document->ConstructL(); + CleanupStack::Pop(); + return( document ); + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// --------------------------------------------------------- +// NewApplication implements +// +// Creates an instance of application. +// +// Returns: an instance of CVtUiApp +// --------------------------------------------------------- +// +LOCAL_C CApaApplication* NewApplication() + { + return new CPixelMetricsMapperApplication; + } + +// --------------------------------------------------------- +// E32Main implements +// +// It is called when executable is started. +// +// Returns: error code. +// --------------------------------------------------------- +// +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication( NewApplication ); + } + +// End of File diff --git a/util/s60pixelmetrics/pm_mapperapp.h b/util/s60pixelmetrics/pm_mapperapp.h new file mode 100644 index 0000000..02d297e --- /dev/null +++ b/util/s60pixelmetrics/pm_mapperapp.h @@ -0,0 +1,198 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the utility applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PMMAPPERAPP_H +#define PMMAPPERAPP_H + +// INCLUDES +#include +#include +#include +#include + +// CONSTANTS +const TUid KUidPMMapperApplication = { 0x2002121F }; + + +// FORWARD DECLARATIONS +class CPixelMetricsMapperView; +class MAknsSkinInstance; + +// CLASS DECLARATION +/** +* CPixelMetricsMapperDocument +*/ +class CPixelMetricsMapperDocument : public CEikDocument + { + public: // Constructors and destructor + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + /** + * Constructor. + */ + CPixelMetricsMapperDocument( CEikApplication& aApp ) + : CEikDocument( aApp ) {} + + /** + * Destructor. + */ + ~CPixelMetricsMapperDocument(){} + + public: // Functions from base classes + + /** + * From CEikDocument. + */ + CFileStore* OpenFileL( + TBool /*aDoOpen*/, + const TDesC& /*aFilename*/, + RFs& /*aFs*/ ) + { + return NULL; + } + + private: // Functions from base classes + + /** + * From CEikDocument. + */ + CEikAppUi* CreateAppUiL(); + }; + +/** +* CPixelMetricsMapperAppUi +*/ +class CPixelMetricsMapperAppUi : public CAknViewAppUi + { + public: // Constructors and destructor + + /** + * Constructor. + */ + CPixelMetricsMapperAppUi(); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + /** + * Destructor. + */ + ~CPixelMetricsMapperAppUi(); + + public: + void DoAutoOperationL(); + + TBool ReadyForAutoOp() const; + + + private: // Functions from base classes + + /** + * From CEikAppUi. + */ + void HandleCommandL(TInt aCommand); + + /** + * From CEikAppUi. + */ + virtual TKeyResponse HandleKeyEventL( + const TKeyEvent& aKeyEvent, + TEventCode aType ); + + private: + + /** + * Shows text given. + */ + void ShowL( const TDesC& aText, TBool& aLast, const TBool& aFileOutput = EFalse ); + void ShowSingleValueL(TInt& aPixelMetric, TInt& aValue, TBool& aLast); + void ClearL(); + void CreateHeaderFileL() const; + + TFileName CreateLayoutNameL(TFileText& aFileHandle) const; + + private: // Data + + // Test view. + CPixelMetricsMapperView* iView; + + CEikDialog* iDialog; + + TBool iFileOutputOn; + + CFbsBitmap* icon; + CFbsBitmap* iconMask; + + TBool iAutoMode; + TBool iMode; + + }; + + +/** +* CPixelMetricsMapperApplication +*/ +class CPixelMetricsMapperApplication : public CEikApplication + { + private: // Functions from base classes + + /** + * From CApaApplication. + */ + CApaDocument* CreateDocumentL(); + + /** + * From CApaApplication. + */ + TUid AppDllUid() const; + }; + + +#endif // PMMAPPERAPP_H + + +// End of File diff --git a/util/s60pixelmetrics/pm_mapperview.cpp b/util/s60pixelmetrics/pm_mapperview.cpp new file mode 100644 index 0000000..f7ab2ac --- /dev/null +++ b/util/s60pixelmetrics/pm_mapperview.cpp @@ -0,0 +1,375 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the utility applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// INCLUDE FILES + +#include +#include +#include +#include + +#include "pm_mapper.hrh" +#include +#include "pm_mapperView.h" +#include "pm_mapperApp.h" + +#include +#include +#include + +// ----------------------------------------------------------------------------- +// C++ constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CPixelMetricsMapperViewContainer::CPixelMetricsMapperViewContainer(): iCount( 1 ) + { + } + + +// ----------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CPixelMetricsMapperViewContainer::ConstructL( const TRect& aRect ) + { + CreateWindowL(); + SetCanDrawOutsideRect(); + + iTexts = new( ELeave ) CDesCArrayFlat( 10 ); + iTexts->AppendL( _L( "\tStarted." ) ); + + iListbox = new( ELeave ) CAknSingleStyleListBox; + iListbox->SetContainerWindowL( *this ); + iListbox->ConstructL( this, EAknListBoxViewerFlags ); + + iListbox->Model()->SetItemTextArray( iTexts ); + iListbox->SetRect( TRect( aRect.Size() ) ); + + iListbox->CreateScrollBarFrameL( ETrue ); + iListbox->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOn, + CEikScrollBarFrame::EOn ); + + SetRect( aRect ); + iListbox->ActivateL(); + ActivateL(); + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CPixelMetricsMapperViewContainer::ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput ) + { + MDesCArray* itemList = iListbox->Model()->ItemTextArray(); + CDesCArray* itemArray = ( CDesCArray* ) itemList; + + itemArray->AppendL( aString ); + + iListbox->HandleItemAdditionL(); + iListbox->SetCurrentItemIndex( iCount ); + iCount++; + if ( aLast ) + { + if (aFileOutput) + { + RFile file; + RFs& fs = CEikonEnv::Static()->FsSession(); + TFileName fileName =_L("Layout_"); + + TRect screenRect; + AknLayoutUtils::LayoutMetricsRect( + AknLayoutUtils::EApplicationWindow, + screenRect ); + + // Add screen dimensions + TInt height = screenRect.Height(); + TInt width = screenRect.Width(); + fileName.AppendNum(height); + fileName.Append('_'); + fileName.AppendNum(width); + + if (AknLayoutUtils::LayoutMirrored()) + fileName.Append(_L("_mirrored")); + fileName.Append(_L(".txt")); + + TInt err=file.Open(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny); + if (err==KErrNotFound) // file does not exist - create it + err=file.Create(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny); + else + file.SetSize(0); //sweep the file + TFileText textFile; + textFile.Set(file); + err = textFile.Seek(ESeekStart); + if (err) User::InfoPrint(_L("File corrupted")); + + // Finally loop through all the entries: + TInt idx = 0; + for(;idx!=itemList->MdcaCount();idx++) + { + err = textFile.Write(itemList->MdcaPoint(idx)); + if (err) User::InfoPrint(_L("File corrupted")); + } + file.Close(); + } + DrawNow(); + } + } + +void CPixelMetricsMapperViewContainer::ClearL() + { + MDesCArray* itemList = iListbox->Model()->ItemTextArray(); + CDesCArray* itemArray = ( CDesCArray* ) itemList; + + itemArray->Reset(); + + iListbox->HandleItemAdditionL(); + iCount = 0; + DrawNow(); + } + + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +// +CPixelMetricsMapperViewContainer::~CPixelMetricsMapperViewContainer() + { + delete iListbox; + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CPixelMetricsMapperViewContainer::SizeChanged() + { + CCoeControl::SizeChanged(); + if ( iListbox ) + { + iListbox->SetRect( Rect() ); + } + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TInt CPixelMetricsMapperViewContainer::CountComponentControls() const + { + return 1; + } + + +// ----------------------------------------------------------------------------- +// CTestAppViewContainer::ComponentControl +// +// +// ----------------------------------------------------------------------------- +// +CCoeControl* CPixelMetricsMapperViewContainer::ComponentControl( + TInt /*aIndex*/ ) const + { + return iListbox; + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CPixelMetricsMapperViewContainer::Draw( const TRect& /*aRect*/ ) const + { + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CPixelMetricsMapperViewContainer::HandleControlEventL( + CCoeControl* /*aControl*/, + TCoeEvent /*aEventType*/ ) + { + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TKeyResponse CPixelMetricsMapperViewContainer::OfferKeyEventL( + const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + if (aKeyEvent.iCode == EKeyUpArrow || + aKeyEvent.iCode == EKeyDownArrow ) + { + return iListbox->OfferKeyEventL( aKeyEvent, aType ); + } + return EKeyWasNotConsumed; + } + +void CPixelMetricsMapperViewContainer::HandleResourceChange(TInt aType) + { + CCoeControl::HandleResourceChange( aType ); + if ( aType == KEikDynamicLayoutVariantSwitch ) + { + TRect mainPaneRect; + AknLayoutUtils::LayoutMetricsRect( + AknLayoutUtils::EMainPane, + mainPaneRect ); + SetRect( mainPaneRect ); + + CPixelMetricsMapperAppUi* myApp = static_cast (ControlEnv()->AppUi()); + if (myApp->ReadyForAutoOp()) + myApp->DoAutoOperationL(); + } + if (iListbox) iListbox->HandleResourceChange(aType); + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CPixelMetricsMapperView::ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput ) + { + iView->ShowL( aString, aLast, aFileOutput ); + } + +void CPixelMetricsMapperView::ClearL() + { + iView->ClearL(); + } + + +// ----------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CPixelMetricsMapperView::ConstructL() + { + BaseConstructL( R_PMMAPPER_VIEW ); + } + + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +// +CPixelMetricsMapperView::~CPixelMetricsMapperView() + { + if ( iView ) + { + AppUi()->RemoveFromViewStack( *this, iView ); + } + delete iView; + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TUid CPixelMetricsMapperView::Id() const + { + return TUid::Uid( EPMMapperViewId ); + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CPixelMetricsMapperView::HandleCommandL( TInt aCommand ) + { + AppUi()->HandleCommandL( aCommand ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CPixelMetricsMapperView::HandleStatusPaneSizeChange() + { + if ( iView ) + { + TRect cr = ClientRect(); + iView->SetRect( cr ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CPixelMetricsMapperView::DoActivateL( + const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/ ) + { + iView = new( ELeave ) CPixelMetricsMapperViewContainer; + + TRect cr = ClientRect(); + iView->ConstructL( cr ); + AppUi()->AddToViewStackL( *this, iView ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CPixelMetricsMapperView::DoDeactivate() + { + if (iView) + { + AppUi()->RemoveFromViewStack( *this, iView ); + } + delete iView; + iView = NULL; + } + +// End of File diff --git a/util/s60pixelmetrics/pm_mapperview.h b/util/s60pixelmetrics/pm_mapperview.h new file mode 100644 index 0000000..e9eb42e --- /dev/null +++ b/util/s60pixelmetrics/pm_mapperview.h @@ -0,0 +1,228 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the utility applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PMMAPPERVIEW_H +#define PMMAPPERVIEW_H + + +// INCLUDES +#include +#include + +// CONSTANTS +// FORWARD DECLARATIONS +class CAknSingleStyleListBox; +class CAknSettingStyleListBox; + +// CLASS DECLARATION + +/** +* CPixelMetricsMapperViewContainer +* +*/ +class CPixelMetricsMapperViewContainer +: public CCoeControl, + public MCoeControlObserver + { + public: // Constructors and destructor + + /** + * C++ constructor. + */ + CPixelMetricsMapperViewContainer(); + + /** + * Symbian 2nd phase constructor. + * + * @param aRect Rectangle. + */ + void ConstructL( const TRect& aRect ); + + /** + * Destructor. + */ + ~CPixelMetricsMapperViewContainer(); + + + public: // New functions + + /** + * Show the given string. + * + * @param aString The string to be shown. + */ + void ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput = EFalse ); + + void ClearL(); + + + public: // Functions from base classes + + /** + * From CCoeControl. + */ + TKeyResponse OfferKeyEventL( + const TKeyEvent& aKeyEvent, + TEventCode aType ); + + + void HandleResourceChange(TInt aType); + + + private: // Functions from base classes + + /** + * From CCoeControl. + */ + void SizeChanged(); + + /** + * From CCoeControl. + */ + TInt CountComponentControls() const; + + /** + * From CCoeControl. + */ + CCoeControl* ComponentControl( TInt aIndex ) const; + + /** + * From CCoeControl. + */ + void Draw( const TRect& aRect ) const; + + + private: // Functions from base classes + + /** + * From MCoeControlObserver. + */ + void HandleControlEventL( + CCoeControl* aControl, + TCoeEvent aEventType ); + + + private: // Data + + // Texts. + CDesCArray* iTexts; + + // Count. + TInt iCount; + + // Listbox. + CAknSingleStyleListBox* iListbox; + + }; + + + +/** +* CPixelMetricsMapperView +* +* +* @since 1.0 +*/ +class CPixelMetricsMapperView : public CAknView + { + public: // Constructors and destructor + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + /** + * Destructor. + */ + ~CPixelMetricsMapperView(); + + + public: // Functions from base classes + + /** + * From CAknView. + */ + TUid Id() const; + + /** + * From CAknView. + */ + void HandleCommandL( TInt aCommand ); + + /** + * From CAknView. + */ + void HandleStatusPaneSizeChange(); + + /** + * From CAknView. + */ + void ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput =EFalse ); + void ClearL(); + + + private: // from CAknView + + /** + * From CAknView. + */ + void DoActivateL( + const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ); + + /** + * From CAknView. + */ + void DoDeactivate(); + + + private: // Data + + // The view container. + CPixelMetricsMapperViewContainer* iView; + + }; + +#endif // PMMAPPERVIEW_H + +// End of File diff --git a/util/s60pixelmetrics/src/pixel_metrics.cpp b/util/s60pixelmetrics/src/pixel_metrics.cpp deleted file mode 100644 index f71a266..0000000 --- a/util/s60pixelmetrics/src/pixel_metrics.cpp +++ /dev/null @@ -1,1217 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utility applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "pixel_metrics.h" - -#include -#include -#include -#include - -// Version number for dynamic calculations. These are to be exported to static data, -// 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 = 13; - -TPixelMetricsVersion PixelMetrics::Version() - { - TPixelMetricsVersion version; - version.majorVersion = KPMMajorVersion; - version.minorVersion = KPMMinorVersion; - return version; - } - -TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric) - { - TInt value = -909; - // Main pane - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect( - AknLayoutUtils::EMainPane, - mainPaneRect ); - // Screen - TRect screenRect; - AknLayoutUtils::LayoutMetricsRect( - AknLayoutUtils::EApplicationWindow, - screenRect ); - // Navi pane - TRect naviPaneRect; - AknLayoutUtils::LayoutMetricsRect( - AknLayoutUtils::ENaviPane, - naviPaneRect ); - - TAknLayoutRect appWindow; - appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); - - TInt variety = 0; - TBool landscape = EFalse; - if ( screenRect.iBr.iX > screenRect.iBr.iY ) - { - // in landscape another variety is used - landscape = ETrue; - } - switch (metric) - { - case QStyle::PM_DockWidgetHandleExtent: - // what's this??? Not in S60 - break; - case QStyle::PM_CheckListControllerSize: - case QStyle::PM_CheckListButtonSize: - { - // hierarchical menu - checkbox / radiobutton - // Area (width/height) of the checkbox/radio button in a Q3CheckListItem. - TAknLayoutRect listScrollPane; - listScrollPane.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_gen_pane(0)); - TAknLayoutRect listGenPane; - listGenPane.LayoutRect( listScrollPane.Rect(), AknLayoutScalable_Avkon::list_gen_pane(0)); - TAknLayoutRect listHierarchyPane; - listHierarchyPane.LayoutRect( listGenPane.Rect(), AknLayoutScalable_Avkon::list_single_graphic_hl_pane(0)); - - TAknLayoutRect listHierarchyControllerPane; - listHierarchyPane.LayoutRect( listHierarchyPane.Rect(), AknLayoutScalable_Avkon::list_single_graphic_hl_pane_g3(0)); - TAknLayoutRect listHierarchyPropertyPane; - listHierarchyPropertyPane.LayoutRect( listHierarchyPane.Rect(), AknLayoutScalable_Avkon::list_single_graphic_hl_pane_g2(0)); - - if (metric==QStyle::PM_CheckListControllerSize)value = Max( listHierarchyPane.Rect().Width(), listHierarchyPane.Rect().Width()); - else value = Max( listHierarchyPropertyPane.Rect().Width(), listHierarchyPropertyPane.Rect().Width()); - } - break; - case QStyle::PM_DialogButtonsSeparator: //Distance between buttons in a dialog buttons widget. - case QStyle::PM_DialogButtonsButtonWidth: // Minimum width of a button in a dialog buttons widget. - case QStyle::PM_DialogButtonsButtonHeight:// Minimum height of a button in a dialog buttons widget. - { - TAknLayoutRect appWindow; - appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); - variety = 0; - if ( landscape ) - { - variety = 2; - } - TAknLayoutRect areaBottomRect; - areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) ); - - TAknLayoutRect controlPaneRect; - controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() ); - TAknLayoutText controlPaneLSKText; - TAknLayoutText controlPaneRSKText; - TAknLayoutText controlPaneMSKText; - variety = 0; - if (AknLayoutUtils::MSKEnabled()) - { - variety = 3; - controlPaneMSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t3(variety)); //MSK text area - } - controlPaneLSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t1(variety)); //LSK text area - controlPaneRSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t2(variety)); //RSK text area - - /* - * - ================================================================================== - | A | LSK_rect | B | MSK_rect | C | RSK_rect | D | - ================================================================================== - where A is left padding (between control pane and LSK rect) - B is mid-left padding (between LSK and MSK rects) - C is mid-right padding (between MSK and RSK rects) - D is right padding (between RSK and control pane) - - ==> Since all these can be separate, lets take Max of {A..D} for PM value - */ - - TInt itemSpacingA = 0; - TInt itemSpacingB = 0; - TInt itemSpacingC = 0; - TInt itemSpacingMax = 0; - if ( !AknLayoutUtils::MSKEnabled() ) - { - itemSpacingA = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX; - itemSpacingB = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX; - if (!landscape) - { - // use mid-gap only in portrait - itemSpacingC = controlPaneRSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX; - } - itemSpacingMax = Max(itemSpacingA, Max( itemSpacingB, itemSpacingC)); - // no itemspacing4 if no MSK - } - else - { - TInt itemSpacingD = 0; - itemSpacingA = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX; - itemSpacingB = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX; - if ( !(AknLayoutUtils::PenEnabled() || landscape) ) // no MSK in touch, nor in landscape - { - itemSpacingC = controlPaneRSKText.TextRect().iTl.iX - controlPaneMSKText.TextRect().iBr.iX; - itemSpacingD = controlPaneMSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX; - } - itemSpacingMax = Max(itemSpacingA, Max( itemSpacingB, Max( itemSpacingC, itemSpacingD ))); - } - if (metric==QStyle::PM_DialogButtonsSeparator) value = itemSpacingMax; - else if (metric==QStyle::PM_DialogButtonsButtonWidth) - { - value = Max( controlPaneLSKText.TextRect().Width(), controlPaneRSKText.TextRect().Width()); - if (AknLayoutUtils::MSKEnabled()) - { - value = Max(value, controlPaneMSKText.TextRect().Width()); - } - } - else if (metric==QStyle::PM_DialogButtonsButtonHeight) - { - value = Max( controlPaneLSKText.TextRect().Height(), controlPaneRSKText.TextRect().Height()); - if (AknLayoutUtils::MSKEnabled()) - { - value = Max(value, controlPaneMSKText.TextRect().Height()); - } - } - } - break; - case QStyle::PM_DockWidgetTitleMargin: // not in S60, lets use the same margin as in button - case QStyle::PM_DockWidgetTitleBarButtonMargin: // not in S60, lets use the same margin as in button - case QStyle::PM_ButtonMargin: - { - TRect myRect(TSize( 80, 20)); // this arbitrary size - user can set it - button border does not seem to have any scalability in it - TAknLayoutRect buttonRect; - TAknLayoutRect buttonBordersRect; - TAknLayoutText buttonText; - - buttonRect.LayoutRect( myRect, AknLayoutScalable_Avkon::eswt_ctrl_button_pane()); - buttonBordersRect.LayoutRect( buttonRect.Rect(), AknLayoutScalable_Avkon::common_borders_pane_copy2(0)); //with text - buttonText.LayoutText( buttonRect.Rect(), AknLayoutScalable_Avkon::control_button_pane_t1() ); - - // Its better to use left-right margins, since font deployment can create funny top / bottom margins - TInt leftMargin = buttonText.TextRect().iTl.iX - buttonBordersRect.Rect().iTl.iX; - TInt rightMargin = buttonBordersRect.Rect().iBr.iX - buttonText.TextRect().iBr.iX; - value = (TInt) ((leftMargin+rightMargin)/2); - } - break; - case QStyle::PM_ButtonDefaultIndicator: - { - // no default button indicators in S60 - value = 0; - } - break; - case QStyle::PM_MdiSubWindowFrameWidth: - case QStyle::PM_ComboBoxFrameWidth: - case QStyle::PM_SpinBoxFrameWidth: - value = 0; - break; - case QStyle::PM_ToolBarFrameWidth: - case QStyle::PM_DefaultFrameWidth: - { - TAknLayoutRect highLightPaneRect; - TAknLayoutRect centerPaneRect; - TRect rectParent( mainPaneRect ); - highLightPaneRect.LayoutRect( rectParent, AknLayoutScalable_Avkon::toolbar_button_pane(0).LayoutLine()); - centerPaneRect.LayoutRect(rectParent, AknLayoutScalable_Avkon::toolbar_button_pane_g1().LayoutLine()); - - value = highLightPaneRect.Rect().iBr.iX - centerPaneRect.Rect().iBr.iX; - } - break; - case QStyle::PM_RadioButtonLabelSpacing: - { - /* - * - =================================================================================== - | A | iconLayoutRect |B| itemText | C | - =================================================================================== - mirrored: - =================================================================================== - | C | itemText |B| iconLayoutRect | A | - =================================================================================== - where A is left padding - B is gap between icon and text - C is right padding - */ - - TRect rectParent( mainPaneRect ); - TAknLayoutRect layoutRect; - layoutRect.LayoutRect( rectParent,AknLayoutScalable_Avkon::list_choice_list_pane(1).LayoutLine() ); // w/ scrollbar - TAknLayoutText itemText; - itemText.LayoutText( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1) ); - TAknLayoutRect iconLayoutRect; - iconLayoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_g1().LayoutLine() ); - - if ( !AknLayoutUtils::LayoutMirrored() ) - { - value = itemText.TextRect().iTl.iX - iconLayoutRect.Rect().iBr.iX; - } - else - { - value = iconLayoutRect.Rect().iTl.iX - itemText.TextRect().iBr.iX; - } - } - - break; - case QStyle::PM_CheckBoxLabelSpacing: - { - /* - * - =================================================================================== - | A | iconLayoutRect |B| itemText | C | - =================================================================================== - mirrored: - =================================================================================== - | C | itemText |B| iconLayoutRect | A | - =================================================================================== - where A is left padding - B is gap between icon and text - C is right padding - */ - TRect rectParent( mainPaneRect ); - TAknLayoutRect layoutRect; - layoutRect.LayoutRect( rectParent,AknLayoutScalable_Avkon::list_set_graphic_pane(0).LayoutLine() ); - TAknLayoutRect layoutRect2; - TAknLayoutRect layoutRect3; - layoutRect2.LayoutRect( layoutRect.Rect(),AknLayoutScalable_Avkon::set_content_pane().LayoutLine() ); - - TAknLayoutText itemText; - itemText.LayoutText( layoutRect2.Rect(), AknLayoutScalable_Avkon::list_set_graphic_pane_t1(0) ); - TAknLayoutRect iconLayoutRect; - iconLayoutRect.LayoutRect( layoutRect2.Rect(), AknLayoutScalable_Avkon::list_set_graphic_pane_g1(0).LayoutLine() ); - if ( !AknLayoutUtils::LayoutMirrored() ) - { - value = itemText.TextRect().iTl.iX - iconLayoutRect.Rect().iBr.iX; - } - else - { - value = iconLayoutRect.Rect().iTl.iX - itemText.TextRect().iBr.iX; - } - } - break; - case QStyle::PM_ToolTipLabelFrameWidth: - { - /* - * - |===================================================================================| - | info popup note B | - | ============================================================================== | - | A | hintText | D| - | ============================================================================== | - | C | - |===================================================================================| - where A is left padding - B is top padding - C is bottom padding - D is right padding - we'll provide the average of top and bottom padding as PM_ToolTipLabelFrameWidth - */ - - // Set pop-up to contain only one line of text - TInt index = 0; - if ( landscape ) - { - // in landscape another variety is used - index += 5; - } - // Get parameter and table limits for popup preview text window - TAknLayoutScalableParameterLimits limits = - AknLayoutScalable_Avkon::popup_preview_text_window_ParamLimits(); - - TAknLayoutScalableTableLimits tableLimits = - AknLayoutScalable_Avkon::popup_preview_text_window_t_Limits(); - - TInt windowVariety = Min( Max( index, limits.FirstVariety() ), limits.LastVariety() ); - - TAknLayoutScalableParameterLimits tParamLimits = - AknLayoutScalable_Avkon:: popup_preview_text_window_t_ParamLimits( - tableLimits.FirstIndex() ); - - TInt lineVariety = Min( Max( index, tParamLimits.FirstVariety() ), tParamLimits.LastVariety() ); - - TAknWindowLineLayout lineLayout = AknLayoutScalable_Avkon::popup_preview_text_window(windowVariety).LayoutLine(); - - // rect for the whole info popup - TAknLayoutRect layoutRect; - layoutRect.LayoutRect(screenRect, lineLayout); - TRect rectPopupWindow = layoutRect.Rect(); - - TAknTextComponentLayout popupTextLayout = - AknLayoutScalable_Avkon::popup_preview_text_window_t( - tableLimits.FirstIndex(), lineVariety ); - - // rect for the whole the text inside the popup - TAknLayoutText layoutText; - layoutText.LayoutText( rectPopupWindow, popupTextLayout ); - - // Each margin has different value in S60 - let's take average of top & bottom - TInt topMargin = layoutText.TextRect().iTl.iY - layoutRect.Rect().iTl.iY; - TInt bottomMargin = layoutRect.Rect().iBr.iY - layoutText.TextRect().iBr.iY; - TInt averageMargin = (TInt)(topMargin+bottomMargin)/2; - value = averageMargin; - } - break; - case QStyle::PM_ListViewIconSize: - { - // todo: there are lots and lots of views with different sized icons - which one to use? - // todo: this is probably not a good default icon size, as this fetches A column icon size - // todo: preferably use settings item with graphic instead - TAknLayoutRect iconRect; - iconRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::list_double_graphic_pane_g1_cp2(0).LayoutLine()); - //icon areas are usually squares - lets take bigger of two dimensions - value = Max( iconRect.Rect().Width(), iconRect.Rect().Height() ); - } - break; - - case QStyle::PM_LargeIconSize: // lets use AS icon as a base for large icon - case QStyle::PM_IconViewIconSize: - { - // Lets assume that we'd take these from grid (3x4) layout - TAknLayoutRect appPaneRect; - TAknLayoutRect gridAppRect; - TAknLayoutRect cellAppRect; - TInt varietyGrid = 2; //Let's use the 3x4 grid as a base. - TInt varietyCell = 1; //Let's use the 3x4 grid as a base. - if ( landscape ) - { - varietyGrid = 3; - varietyCell = 2; - } - appPaneRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_app_pane(1).LayoutLine()); //3x4 grid - gridAppRect.LayoutRect( appPaneRect.Rect(), AknLayoutScalable_Avkon::grid_app_pane(varietyGrid).LayoutLine()); - cellAppRect.LayoutRect( gridAppRect.Rect(), AknLayoutScalable_Avkon::cell_app_pane(varietyCell, 0, 0).LayoutLine()); - TAknLayoutRect cellGraphRect; - TAknWindowComponentLayout appIcon = AknLayoutScalable_Avkon::cell_app_pane_g1(0); // no mark, no highlight - cellGraphRect.LayoutRect( gridAppRect.Rect(), appIcon); - //icon areas are usually squares - if not, lets take larger - value = Max( cellGraphRect.Rect().Width(), cellGraphRect.Rect().Height()); - } - break; - case QStyle::PM_TabBarIconSize: - { - TAknLayoutRect naviNaviRect; - naviNaviRect.LayoutRect( naviPaneRect, AknLayoutScalable_Avkon::navi_navi_tabs_pane().LayoutLine()); // two tabs - TAknLayoutRect tabRect; - tabRect.LayoutRect( naviNaviRect.Rect(), AknLayoutScalable_Avkon::navi_tabs_3_pane().LayoutLine()); //active tab on left - TAknLayoutRect activeTabRect; - activeTabRect.LayoutRect( tabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane(0).LayoutLine()); //active tab - TAknLayoutRect activeTabGraphicRect; - - activeTabGraphicRect.LayoutRect( activeTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane_g1().LayoutLine()); //active tab graphic - value = Min(activeTabGraphicRect.Rect().Width(), activeTabGraphicRect.Rect().Height()); - } - break; - case QStyle::PM_MessageBoxIconSize: - { - TAknLayoutRect noteRect; - noteRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_note_image_window(0).LayoutLine()); //note with image - TAknLayoutRect noteImageRect; - noteImageRect.LayoutRect( noteRect.Rect(), AknLayoutScalable_Avkon::popup_note_image_window_g2(2).LayoutLine()); //note with image - value = noteImageRect.Rect().Width(); - } - break; - case QStyle::PM_TextCursorWidth: - { - TAknLayoutRect miscGraphicsRect; - miscGraphicsRect.LayoutRect( screenRect, AknLayoutScalable_Avkon::misc_graphics()); - miscGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::misc_graphics()); - TAknLayoutRect textsGraphicsRect; - textsGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::texts_graphics()); - TAknLayoutRect cursorGraphicsRect; - cursorGraphicsRect.LayoutRect( textsGraphicsRect.Rect(), AknLayoutScalable_Avkon::cursor_graphics_pane()); - TAknLayoutRect cursorPrimaryRect; - cursorPrimaryRect.LayoutRect( cursorGraphicsRect.Rect(), AknLayoutScalable_Avkon::cursor_primary_pane()); - TAknLayoutRect cursorRect; - cursorRect.LayoutRect( cursorPrimaryRect.Rect(), AknLayoutScalable_Avkon::cursor_digital_pane_g1()); - value = cursorRect.Rect().Width(); - } - break; - case QStyle::PM_SliderLength: - { - TAknLayoutRect settingRect; - settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() ); - TAknLayoutRect settingContentRect; - settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() ); - TAknLayoutRect sliderRect; - sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() ); - TAknLayoutRect sliderSettingRect; - sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() ); - TAknLayoutRect sliderGraph2Rect; - sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() ); - value = sliderGraph2Rect.Rect().Width(); - } - break; - case QStyle::PM_SliderThickness: - { - TAknLayoutRect settingRect; - settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() ); - TAknLayoutRect settingContentRect; - settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() ); - TAknLayoutRect sliderRect; - sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() ); - TAknLayoutRect sliderSettingRect; - sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() ); - TAknLayoutRect sliderGraph2Rect; - sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() ); - value = (TInt)(sliderGraph2Rect.Rect().Height()*1.5); // add assumed tickmark height - } - break; - case QStyle::PM_SliderTickmarkOffset: - { - TAknLayoutRect settingRect; - settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() ); - TAknLayoutRect settingContentRect; - settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() ); - TAknLayoutRect sliderRect; - sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() ); - TAknLayoutRect sliderSettingRect; - sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() ); - TAknLayoutRect sliderGraph2Rect; - sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() ); - value = (TInt)(sliderGraph2Rect.Rect().Height()*0.5); // no tickmarks in S60, lets assume they are half the size of slider indicator - } - break; - case QStyle::PM_SliderControlThickness: - { - TAknLayoutRect settingRect; - settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() ); - TAknLayoutRect settingContentRect; - settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() ); - TAknLayoutRect sliderRect; - sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() ); - TAknLayoutRect sliderSettingRect; - sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() ); - TAknLayoutRect sliderGraph2Rect; - sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() ); - value = sliderGraph2Rect.Rect().Height(); - } - break; - case QStyle::PM_SliderSpaceAvailable: - { - TAknLayoutRect settingRect; - settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() ); - TAknLayoutRect settingContentRect; - settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() ); - TAknLayoutRect sliderRect; - sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() ); - TAknLayoutRect sliderSettingRect; - sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() ); - value = sliderSettingRect.Rect().Width(); - } - break; - case QStyle::PM_MenuBarItemSpacing: - { - TAknLayoutRect appWindow; - appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); - - variety = 0; - if ( landscape ) - { - variety = 2; - } - TAknLayoutRect areaBottomRect; - areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) ); - - TAknLayoutRect controlPaneRect; - controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() ); - TAknLayoutText controlPaneLSKText; - TAknLayoutText controlPaneRSKText; - TAknLayoutText controlPaneMSKText; - variety = 0; - if (AknLayoutUtils::MSKEnabled()) - { - variety = 3; - controlPaneMSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t3(variety)); //MSK text area - } - controlPaneLSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t1(variety)); //LSK text area - controlPaneRSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t2(variety)); //RSK text area - - /* - * - ================================================================================== - | A | LSK_rect | B | MSK_rect | C | RSK_rect | D | - ================================================================================== - where A is left padding (between control pane and LSK rect) - B is mid-left padding (between LSK and MSK rects) - C is mid-right padding (between MSK and RSK rects) - D is right padding (between RSK and control pane) - - ==> Since all these can be separate, lets take Max of {A..D} for PM value - */ - - TInt itemSpacing1 = 0; - TInt itemSpacing2 = 0; - TInt itemSpacing3 = 0; - TInt itemSpacing4 = 0; - TInt itemSpacingMax = 0; - if ( !AknLayoutUtils::MSKEnabled() ) - { - itemSpacing1 = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX; - itemSpacing2 = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX; - if ( !landscape ) - { - // use mid gap only in portrait - itemSpacing3 = controlPaneRSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX; - } - itemSpacingMax = Max(itemSpacing1, Max( itemSpacing2, itemSpacing3)); - // no itemspacing4 if no MSK - } - else - { - itemSpacing1 = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX; - itemSpacing2 = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX; - if ( !(AknLayoutUtils::PenEnabled() || landscape) ) // no MSK in touch, nor in landscape - { - itemSpacing3 = controlPaneRSKText.TextRect().iTl.iX - controlPaneMSKText.TextRect().iBr.iX; - itemSpacing4 = controlPaneMSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX; - } - itemSpacingMax = Max(itemSpacing1, Max( itemSpacing2, Max( itemSpacing3, itemSpacing4 ))); - } - value = itemSpacingMax; - } - break; - case QStyle::PM_MenuBarHMargin: - { - TAknLayoutRect appWindow; - appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); - - variety = 0; - if ( landscape ) - { - variety = 6; - } - TAknLayoutRect areaBottomRect; - areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) ); - - // variety 7 if thin status pane, 1 if no status pane, 3 if small status pane and with main pane, 4 otherwise (idle has bunch of own varieties) - TAknLayoutRect controlPaneRect; - controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() ); - value = areaBottomRect.Rect().Height() - controlPaneRect.Rect().Height(); - } - break; - case QStyle::PM_MenuBarVMargin: - { - TAknLayoutRect appWindow; - appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); - - variety = 0; - if ( landscape ) - { - variety = 6; - } - TAknLayoutText controlPaneLSKText; - TAknLayoutRect areaBottomRect; - areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) ); - // variety 7 if thin status pane, 1 if no status pane, 3 if small status pane and with main pane, 4 otherwise (idle has bunch of own varieties) - TAknLayoutRect controlPaneRect; - controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() ); - - variety = 0; - if (AknLayoutUtils::MSKEnabled()) - { - variety = 3; - } - controlPaneLSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t1(variety)); //LSK text area - - value = controlPaneRect.Rect().Height() - controlPaneLSKText.TextRect().Height(); - } - break; - case QStyle::PM_ToolBarItemSpacing: - { - TAknLayoutRect popupToolBarWindow; - variety = 4; - popupToolBarWindow.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_toolbar_window(variety) ); - TAknLayoutRect gridToolBarRect; - gridToolBarRect.LayoutRect( popupToolBarWindow.Rect(), AknLayoutScalable_Avkon::grid_toobar_pane() ); - TAknLayoutRect cellToolBarRect1; - TAknLayoutRect cellToolBarRect2; - cellToolBarRect1.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(0).LayoutLine() ); //first item - cellToolBarRect2.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(1).LayoutLine() ); //second item - value = cellToolBarRect1.Rect().iBr.iX - cellToolBarRect2.Rect().iTl.iX; - } - break; - case QStyle::PM_ToolBarItemMargin: - { - variety = 4; - TAknLayoutRect popupToolBarWindow; - popupToolBarWindow.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_toolbar_window(variety) ); - TAknLayoutRect gridToolBarRect; - gridToolBarRect.LayoutRect( popupToolBarWindow.Rect(), AknLayoutScalable_Avkon::grid_toobar_pane() ); - TAknLayoutRect cellToolBarRect1; - cellToolBarRect1.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(0).LayoutLine() ); //first item - value = gridToolBarRect.Rect().iTl.iX - cellToolBarRect1.Rect().iTl.iX; - } - break; - case QStyle::PM_LayoutLeftMargin: // there really isn't a default layoutting on s60, but lets use AppShell icon deployment as base - case QStyle::PM_LayoutRightMargin: - case QStyle::PM_LayoutTopMargin: - case QStyle::PM_LayoutBottomMargin: - case QStyle::PM_LayoutHorizontalSpacing: - case QStyle::PM_LayoutVerticalSpacing: - { - //since spacing and margins should be globally same, lets use same easy component as base - such as find popup - TAknLayoutRect popup_find_windowRect; - TAknLayoutRect bg_popup_window_pane_cp12Rect; - TAknLayoutRect find_popup_paneRect; - popup_find_windowRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_find_window(0).LayoutLine()); - bg_popup_window_pane_cp12Rect.LayoutRect( popup_find_windowRect.Rect(), AknLayoutScalable_Avkon::bg_popup_window_pane_cp12().LayoutLine()); - find_popup_paneRect.LayoutRect( bg_popup_window_pane_cp12Rect.Rect(), AknLayoutScalable_Avkon::find_popup_pane().LayoutLine()); - - const TBool mirrored = AknLayoutUtils::LayoutMirrored(); - if ((metric==QStyle::PM_LayoutVerticalSpacing && !mirrored) || metric==QStyle::PM_LayoutLeftMargin) - { - if (mirrored) - { - value = find_popup_paneRect.Rect().iTl.iX - bg_popup_window_pane_cp12Rect.Rect().iTl.iX; - } - else - { - value = find_popup_paneRect.Rect().iTl.iX - bg_popup_window_pane_cp12Rect.Rect().iTl.iX; - } - } - else if (metric==QStyle::PM_LayoutRightMargin || (metric==QStyle::PM_LayoutVerticalSpacing && mirrored)) - { - if (mirrored) - { - value = bg_popup_window_pane_cp12Rect.Rect().iBr.iX - find_popup_paneRect.Rect().iBr.iX; - } - else - { - value = bg_popup_window_pane_cp12Rect.Rect().iBr.iX - find_popup_paneRect.Rect().iBr.iX; - } - } - else if (metric==QStyle::PM_LayoutTopMargin || metric==QStyle::PM_LayoutHorizontalSpacing) - { - value = find_popup_paneRect.Rect().iTl.iY - bg_popup_window_pane_cp12Rect.Rect().iTl.iY; - } - else if (metric==QStyle::PM_LayoutBottomMargin) - { - value = bg_popup_window_pane_cp12Rect.Rect().iBr.iY - find_popup_paneRect.Rect().iBr.iY; - } - } - break; - case QStyle::PM_MaximumDragDistance: - { - value = -1; //disable - not in S60 - } - break; - case QStyle::PM_ScrollBarExtent: - { - TAknLayoutRect miscGraphicsRect; - miscGraphicsRect.LayoutRect( screenRect, AknLayoutScalable_Avkon::misc_graphics()); - miscGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::misc_graphics()); - TAknLayoutRect textsGraphicsRect; - textsGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::texts_graphics()); - TAknLayoutRect editorScrollRect; - editorScrollRect.LayoutRect( textsGraphicsRect.Rect(), AknLayoutScalable_Avkon::editor_scroll_pane()); - TAknLayoutRect scrollPaneRect; - scrollPaneRect.LayoutRect( editorScrollRect.Rect(), AknLayoutScalable_Avkon::scroll_pane_cp13()); - value = scrollPaneRect.Rect().Width(); // width of editor's scroll bar - } - break; - case QStyle::PM_ScrollBarSliderMin: - { - TAknLayoutRect listScrollPane; - listScrollPane.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_gen_pane(0)); - TAknLayoutRect scrollPane; - scrollPane.LayoutRect( listScrollPane.Rect(), AknLayoutScalable_Avkon::scroll_pane()); - TAknLayoutRect scrollHandlePane; - scrollHandlePane.LayoutRect( scrollPane.Rect(), AknLayoutScalable_Avkon::scroll_handle_pane()); - TAknLayoutRect aidMinSizePane; - aidMinSizePane.LayoutRect( scrollHandlePane.Rect(), AknLayoutScalable_Avkon::aid_size_min_handle()); // this gives min width size for horizontal scroll bar - same can be used for vertical height minimum - value = aidMinSizePane.Rect().Height(); - } - break; - case QStyle::PM_MenuBarPanelWidth: - { - TAknLayoutRect appWindow; - appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) ); - - variety = 0; - if ( landscape ) - { - variety = 2; - } - TAknLayoutRect areaBottomRect; - areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) ); - - // todo: prt: variety 7 if thin status pane, 1 if no status pane, 3 if small status pane and with main pane, 4 otherwise (idle has bunch of own varieties) - // todo: lsc: variety 6 if thin status pane - // todo: should stacon be considered? - TAknLayoutRect controlPaneRect; - controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() ); - value = areaBottomRect.Rect().Height() - controlPaneRect.Rect().Height(); //usually zero - } - break; - case QStyle::PM_ProgressBarChunkWidth: - { - // This is either deduced or skinned (for Java) in S60 - // Layout data does not know it. It would require parameters from the - // actual progress dialog to be able to calc this (max. value and increment) - // So we need to set up some values - lets take one tenth of progress dialog area: - TAknLayoutRect appWindow; - appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(variety) ); - if (landscape) - { - variety = 6; - } - TAknLayoutRect popupWaitWindowRect; - popupWaitWindowRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_note_wait_window(variety) ); - TAknLayoutRect waitbarPaneRect; - waitbarPaneRect.LayoutRect( popupWaitWindowRect.Rect(), AknLayoutScalable_Avkon::wait_bar_pane(0) ); - TAknLayoutRect waitAnimRect; - waitAnimRect.LayoutRect( waitbarPaneRect.Rect(), AknLayoutScalable_Avkon::wait_anim_pane() ); - value = (TInt) (waitAnimRect.Rect().Width() / 10); - } - break; - case QStyle::PM_TabBarTabOverlap: - case QStyle::PM_TabBarTabHSpace: - case QStyle::PM_TabBarTabVSpace: - case QStyle::PM_TabBarBaseHeight: - case QStyle::PM_TabBarBaseOverlap: - case QStyle::PM_TabBarScrollButtonWidth: - case QStyle::PM_TabBarTabShiftHorizontal: - case QStyle::PM_TabBarTabShiftVertical: - value = PixelMetricTabValue(metric, appWindow.Rect(), landscape); - break; - case QStyle::PM_MenuPanelWidth: - case QStyle::PM_MenuHMargin: - case QStyle::PM_MenuVMargin: - value = PixelMetricMenuValue(metric, mainPaneRect); - break; - case QStyle::PM_ButtonIconSize: - //lets use voice recorder icons as a base - //Unfortunately S60 graphics don't separate button bevel graphics from the actual icon. - //Se we have no means to query the margin from bevel border to "central icon" border. - //So, we need to make a estimate... - - const TInt varietyForButtons = !landscape ? 0 : 1; - - TAknLayoutRect vRMainRect; - vRMainRect.LayoutRect( mainPaneRect, AknLayoutScalable_Apps::main_vorec_pane() ); - - TAknLayoutRect vRButtonGridRect; - vRButtonGridRect.LayoutRect( vRMainRect.Rect(), AknLayoutScalable_Apps::grid_vorec_pane() ); - - TAknLayoutRect vRButtonCellRect; - vRButtonCellRect.LayoutRect( vRButtonGridRect.Rect(), AknLayoutScalable_Apps::cell_vorec_pane(0) ); - - TAknLayoutRect vRButtonCellGraphicsRect; - vRButtonCellGraphicsRect.LayoutRect( vRButtonCellRect.Rect(), AknLayoutScalable_Apps::cell_vorec_pane_g1() ); - - // 0.32 is the estimate how much the icon occupies of the button bevel area - value = vRButtonCellGraphicsRect.Rect().Width() * 0.32; - - break; - case QStyle::PM_SmallIconSize: - { - // lets use AI2 icon as a base - TAknLayoutRect idlePaneRect; - idlePaneRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::main_idle_act2_pane() ); - TAknLayoutRect idleDataRect; - idleDataRect.LayoutRect( idlePaneRect.Rect(), AknLayoutScalable_Avkon::popup_ai2_data_window(1) ); - TAknLayoutRect ai2GridRect; - ai2GridRect.LayoutRect( idleDataRect.Rect(), AknLayoutScalable_Avkon::grid_ai2_button_pane() ); - TAknLayoutRect ai2MpRect; - ai2MpRect.LayoutRect( ai2GridRect.Rect(), AknLayoutScalable_Avkon::ai2_mp_button_pane() ); - TAknLayoutRect ai2CellPaneRect; - ai2CellPaneRect.LayoutRect( ai2MpRect.Rect(), AknLayoutScalable_Avkon::cell_ai2_button_pane(1).LayoutLine() ); - TAknLayoutRect ai2CellButtonRect; - ai2CellButtonRect.LayoutRect( ai2CellPaneRect.Rect(), AknLayoutScalable_Avkon::cell_ai2_button_pane_g1()); - value = Min( ai2CellButtonRect.Rect().Width(), ai2CellButtonRect.Rect().Height()); - } - break; - case QStyle::PM_FocusFrameHMargin: - case QStyle::PM_FocusFrameVMargin: - { - TAknLayoutRect gridRect; - gridRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::grid_highlight_pane(0)); - TAknLayoutRect gridRectCenter; - gridRectCenter.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::cell_highlight_pane_g1()); - - // The difference of center piece from border tell the frame width. - if ( value == QStyle::PM_FocusFrameHMargin) - { - value = gridRect.Rect().iBr.iX - gridRectCenter.Rect().iBr.iX; - } - else - { - value = gridRect.Rect().iBr.iY - gridRectCenter.Rect().iBr.iY; - } - } - break; - case QStyle::PM_ToolBarIconSize: - { - TAknLayoutRect popupToolBarWindow; - variety = 4; - popupToolBarWindow.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_toolbar_window(variety) ); - TAknLayoutRect gridToolBarRect; - gridToolBarRect.LayoutRect( popupToolBarWindow.Rect(), AknLayoutScalable_Avkon::grid_toobar_pane() ); - TAknLayoutRect cellToolBarRect1; - TAknLayoutRect cellToolBarRect2; - cellToolBarRect1.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(0).LayoutLine() ); //first item - value = Min( cellToolBarRect1.Rect().Height(), cellToolBarRect1.Rect().Width() ); - } - break; - - case QStyle::PM_TitleBarHeight: // use titlepane height - { - TAknLayoutRect statusPaneRect; - TAknLayoutRect titlePane; - TAknLayoutRect areaTopRect; - if (landscape) - { - if ( AknLayoutUtils::PenEnabled() ) - { - // Top area - 0 is for classic landscape (used in touch landscape as well) - areaTopRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_top_pane(2) ); - // Status pane - 0 softkeys on right - statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_top_pane() ); - } - else - { - // Top area - 2 is for classic landscape. - areaTopRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(2) ); - // Stacon top pane (default ok) - statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_bottom_pane() ); - } - titlePane.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::title_pane_stacon(0) ); //softkeys on right - } - else - { - // Top area - 0 is for classic portrait - areaTopRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_top_pane(0) ); - // Status pane - 0 is for classic portrait - statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::status_pane(0) ); - titlePane.LayoutRect( statusPaneRect.Rect(), AknLayoutScalable_Avkon::title_pane(0) ); - } - value = titlePane.Rect().Height(); - } - break; - case QStyle::PM_IndicatorWidth: - case QStyle::PM_IndicatorHeight: - { - TRect rectParent( mainPaneRect ); - - TAknLayoutRect layoutRect; - layoutRect.LayoutRect( rectParent,AknLayoutScalable_Avkon::set_content_pane().LayoutLine() ); - TAknLayoutRect layoutRect2; - layoutRect2.LayoutRect( layoutRect.Rect(),AknLayoutScalable_Avkon::list_set_graphic_pane(0).LayoutLine() ); - - TAknLayoutRect iconLayoutRect; - iconLayoutRect.LayoutRect( layoutRect2.Rect(), AknLayoutScalable_Avkon::list_set_graphic_pane_g1(0).LayoutLine() ); - if (metric==QStyle::PM_IndicatorWidth) - { - value = iconLayoutRect.Rect().Width(); - } - else - { - value = iconLayoutRect.Rect().Height(); - } - } - break; - case QStyle::PM_ExclusiveIndicatorHeight: - case QStyle::PM_ExclusiveIndicatorWidth: - { - TRect rectParent( mainPaneRect ); - TAknLayoutRect layoutRect; - layoutRect.LayoutRect( rectParent,AknLayoutScalable_Avkon::list_choice_list_pane(1).LayoutLine() ); // w/ scrollbar - TAknLayoutText itemText; - itemText.LayoutText( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1) ); - TAknLayoutRect iconLayoutRect; - iconLayoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_g1().LayoutLine() ); - - if (metric==QStyle::PM_ExclusiveIndicatorHeight) - { - value = iconLayoutRect.Rect().Height(); - } - else - { - value = iconLayoutRect.Rect().Width(); - } - } - break; - - // These are obsolete. - case QStyle::PM_DefaultTopLevelMargin: - case QStyle::PM_DefaultChildMargin: - case QStyle::PM_DefaultLayoutSpacing: - break; - - case QStyle::PM_Custom_FrameCornerWidth: - { - TAknLayoutRect inputFocusRect; - inputFocusRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane(0)); - TAknLayoutRect inputFocusInnerRect; - inputFocusInnerRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane_g1()); - - value = inputFocusRect.Rect().iBr.iX - inputFocusInnerRect.Rect().iBr.iX; - } - break; - case QStyle::PM_Custom_FrameCornerHeight: - { - TAknLayoutRect inputFocusRect; - inputFocusRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane(0)); - TAknLayoutRect inputFocusInnerRect; - inputFocusInnerRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane_g1()); - value = inputFocusRect.Rect().iBr.iY - inputFocusInnerRect.Rect().iBr.iY; - } - break; - case QStyle::PM_Custom_BoldLineWidth: - value = 3; - break; - case QStyle::PM_Custom_ThinLineWidth: - value = 1; - break; - case QStyle::PM_ButtonShiftHorizontal: - case QStyle::PM_ButtonShiftVertical: - value = 0; - break; - - case QStyle::PM_ToolBarExtensionExtent: - value = PixelMetricTabValue(QStyle::PM_TabBarScrollButtonWidth, appWindow.Rect(), landscape); - break; - -// todo: re-check if these really are not available in s60 - case QStyle::PM_MenuDesktopFrameWidth: // not needed in S60 - dislocates Menu both horizontally and vertically - case QStyle::PM_HeaderMarkSize: // The size of the sort indicator in a header. Not in S60 - case QStyle::PM_SpinBoxSliderHeight: // The height of the optional spin box slider. Not in S60 - case QStyle::PM_HeaderMargin: // not in S60 - case QStyle::PM_MenuScrollerHeight: // not in S60 - case QStyle::PM_MenuTearoffHeight: // not in S60 - case QStyle::PM_DockWidgetFrameWidth: // not in S60 - 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??? - case QStyle::PM_TabBar_ScrollButtonOverlap: // not used in S60 - tab arrows are on left and right side of tab group - not together - case QStyle::PM_SizeGripSize: // use default - case QStyle::PM_TabCloseIndicatorWidth: - case QStyle::PM_TabCloseIndicatorHeight: - case QStyle::PM_ScrollView_ScrollBarSpacing: - case QStyle::PM_SubMenuOverlap: - default: - break; - } - return value; - } - -TInt PixelMetrics::PixelMetricTabValue(QStyle::PixelMetric tabMetric, TRect appWindow, TBool landscape) - { - TInt tabValue = 0; - // common ones - TAknLayoutRect mainAreaRect; - TAknLayoutRect rightIndicationRect; - TAknLayoutRect leftIndicationRect; - TAknLayoutRect activeTabRect; - TAknLayoutText activeTabTextRect; - TAknLayoutRect passiveTabRect; - TAknLayoutText passiveTabTextRect; - TAknLayoutRect tabsPaneRect; - if ( landscape ) - { - TAknLayoutRect statusPaneRect; - TAknLayoutRect areaTopRect; - if ( AknLayoutUtils::PenEnabled() ) - { - // Top area - 0 is for classic landscape (used in touch landscape as well) - areaTopRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::area_top_pane(2) ); - // Status pane - 0 softkeys on right - statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_top_pane() ); - } - else - { - // Top area - 2 is for classic landscape. - areaTopRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::area_bottom_pane(2) ); - // Stacon top pane (default ok) - statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_bottom_pane() ); - } - // main pane for landscape - mainAreaRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::main_pane(4) ); - - // navi pane - TAknLayoutRect naviPaneRect; - naviPaneRect.LayoutRect( statusPaneRect.Rect(), AknLayoutScalable_Avkon::navi_pane_stacon(0) ); // softkeys on right - // navi-navi pane - tabsPaneRect.LayoutRect( naviPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_stacon(0) ); // softkeys on right - // Passive tab item - lets use layout where active is on left side of passive - passiveTabRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane(0) ); - // Active tab item - activeTabRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane(0) ); - // Left indication - leftIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g1(0) ); - // Right indication - rightIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g2(0) ); - // active tab text rect - activeTabTextRect.LayoutText( activeTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane_t1(1) ); - // passive tab text rect - passiveTabTextRect.LayoutText( passiveTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane_t1(1) ); - } - else - { - // main pane for portait - mainAreaRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::main_pane(3) ); - // Top area - 0 is for classic portrait - TAknLayoutRect areaTopRect; - areaTopRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::area_top_pane(0) ); - // Status pane - 0 is for classic portrait - TAknLayoutRect statusPaneRect; - statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::status_pane(0) ); - - // Navi pane - TAknLayoutRect naviPaneRect; - naviPaneRect.LayoutRect( statusPaneRect.Rect(), AknLayoutScalable_Avkon::navi_pane(0) ); - // Navi-navi pane for tabs (0) - TAknLayoutRect navi2PaneRect; - navi2PaneRect.LayoutRect( naviPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane() ); - // Short tab pane - tabsPaneRect.LayoutRect( navi2PaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_tabs_pane() ); - // Tab pane for 2 items - TAknLayoutRect tab2PaneRect; - tab2PaneRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_tabs_3_pane() ); - // Passive tab item - lets use layout where active is on left side of passive - passiveTabRect.LayoutRect( tab2PaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane(0) ); - // Active tab item - activeTabRect.LayoutRect( tab2PaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane(0) ); - // Left indication - leftIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g1(0) ); - // Right indication - rightIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g2(0) ); - // active tab text rect - activeTabTextRect.LayoutText( activeTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane_t1(0) ); - // passive tab text rect - passiveTabTextRect.LayoutText( passiveTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane_t1(0) ); - } - - // active tab on left, passive on rightside - TInt tabOverlap = activeTabRect.Rect().iBr.iX - passiveTabRect.Rect().iTl.iX; - TInt tabHSpace = (TInt) ((activeTabTextRect.TextRect().iTl.iX - activeTabRect.Rect().iTl.iX + activeTabRect.Rect().iBr.iX - activeTabTextRect.TextRect().iBr.iX)/2); - TInt tabVSpace = (TInt) ((activeTabTextRect.TextRect().iTl.iY - activeTabRect.Rect().iTl.iY + activeTabRect.Rect().iBr.iY - activeTabTextRect.TextRect().iBr.iY)/2); - TInt tabBaseHeight = 0; - if ( landscape && !AknLayoutUtils::PenEnabled()) - { - // In landscape tab is below mainpane - tabBaseHeight = mainAreaRect.Rect().iBr.iY - tabsPaneRect.Rect().iTl.iY; - } - else - { - // In portrait (and in landscape touch) tab is above mainpane - tabBaseHeight = tabsPaneRect.Rect().iBr.iY - mainAreaRect.Rect().iTl.iY; - } - TInt tabBaseOverlap = 0; - if ( landscape && !AknLayoutUtils::PenEnabled()) - { - // In landscape tab is below mainpane - tabBaseOverlap = Max( 0, mainAreaRect.Rect().iBr.iY - tabsPaneRect.Rect().iTl.iY); - } - else - { - // In portrait tab is above mainpane - tabBaseOverlap = Max( 0, mainAreaRect.Rect().iTl.iY - tabsPaneRect.Rect().iBr.iY); - } - TInt tabButtonWidth = Max(leftIndicationRect.Rect().Width(), rightIndicationRect.Rect().Width()); - TInt tabVShift = Max( Abs(activeTabTextRect.TextRect().iBr.iY - passiveTabTextRect.TextRect().iBr.iY), Abs(activeTabTextRect.TextRect().iTl.iY - passiveTabTextRect.TextRect().iTl.iY) ); - TInt tabHShift = Max( Abs(activeTabTextRect.TextRect().iBr.iX - passiveTabTextRect.TextRect().iBr.iX), Abs(activeTabTextRect.TextRect().iTl.iX - passiveTabTextRect.TextRect().iTl.iX) ); - tabHShift -= (passiveTabRect.Rect().Width() - tabOverlap); // remove tab change and add overlapping area - - switch( tabMetric ) - { - case QStyle::PM_TabBarTabOverlap: - tabValue = tabOverlap; - break; - case QStyle::PM_TabBarTabHSpace: - tabValue = tabHSpace; - break; - case QStyle::PM_TabBarTabVSpace: - tabValue = tabVSpace; - break; - case QStyle::PM_TabBarBaseHeight: - tabValue = tabBaseHeight; - break; - case QStyle::PM_TabBarBaseOverlap: - tabValue = tabBaseOverlap; - break; - case QStyle::PM_TabBarScrollButtonWidth: - // Since in Qt the scroll indicator is shown within a button, we need to add button margins to this value - { - tabValue = tabButtonWidth + 2*PixelMetricValue(QStyle::PM_ButtonMargin); - } - break; - case QStyle::PM_TabBarTabShiftHorizontal: - tabValue = tabHShift; - break; - case QStyle::PM_TabBarTabShiftVertical: - tabValue = tabVShift; - break; - default: - break; - } - return tabValue; - } - -TInt PixelMetrics::PixelMetricMenuValue(QStyle::PixelMetric tabMetric, TRect mainPaneRect ) - { - TInt menuValue = 0; - TAknLayoutRect popupMenuRect; - popupMenuRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_menu_window(0) ); - TAknLayoutRect listScrollPaneRect; - listScrollPaneRect.LayoutRect( popupMenuRect.Rect(), AknLayoutScalable_Avkon::listscroll_menu_pane(0) ); - TAknLayoutRect listMenuPaneRect; - listMenuPaneRect.LayoutRect( listScrollPaneRect.Rect(), AknLayoutScalable_Avkon::list_menu_pane(0) ); - TAknLayoutRect listMenuRow1Rect; - listMenuRow1Rect.LayoutRect( listScrollPaneRect.Rect(), AknLayoutScalable_Avkon::list_single_pane_cp2(0)); - - switch (tabMetric) - { - case QStyle::PM_MenuPanelWidth: - menuValue = listMenuPaneRect.Rect().iTl.iX - listScrollPaneRect.Rect().iTl.iX; - if ( AknLayoutUtils::LayoutMirrored() ) - { - menuValue = listScrollPaneRect.Rect().iBr.iX - listMenuPaneRect.Rect().iBr.iX; - } - break; - case QStyle::PM_MenuHMargin: - menuValue = listMenuRow1Rect.Rect().iTl.iX - popupMenuRect.Rect().iTl.iX; - if ( AknLayoutUtils::LayoutMirrored() ) - { - menuValue = popupMenuRect.Rect().iBr.iX - listMenuRow1Rect.Rect().iBr.iX; - } - break; - case QStyle::PM_MenuVMargin: - menuValue = listMenuRow1Rect.Rect().iTl.iY - popupMenuRect.Rect().iTl.iY; - break; - default: - break; - } - return menuValue; - } -- cgit v0.12 From 8c04fc6843e17995885139a89a4e465696c0c104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Tue, 5 May 2009 11:10:31 +0300 Subject: S60Style: latest pixel metrics included. --- src/gui/styles/qs60style.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index d88b9ee..fb76b09 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -53,14 +53,14 @@ static const QByteArray propertyKeyCurrentlayout = "currentlayout"; #if defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** -{240,320,1,13,true,QLatin1String("QVGA Landscape Mirrored")}, -{240,320,1,13,false,QLatin1String("QVGA Landscape")}, -{320,240,1,13,true,QLatin1String("QVGA Portrait Mirrored")}, -{320,240,1,13,false,QLatin1String("QVGA Portrait")}, -{360,640,1,13,true,QLatin1String("NHD Landscape Mirrored")}, -{360,640,1,13,false,QLatin1String("NHD Landscape")}, -{640,360,1,13,true,QLatin1String("NHD Portrait Mirrored")}, -{640,360,1,13,false,QLatin1String("NHD Portrait")}, +{240,320,1,14,true,QLatin1String("QVGA Landscape Mirrored")}, +{240,320,1,14,false,QLatin1String("QVGA Landscape")}, +{320,240,1,14,true,QLatin1String("QVGA Portrait Mirrored")}, +{320,240,1,14,false,QLatin1String("QVGA Portrait")}, +{360,640,1,14,true,QLatin1String("NHD Landscape Mirrored")}, +{360,640,1,14,false,QLatin1String("NHD Landscape")}, +{640,360,1,14,true,QLatin1String("NHD Portrait Mirrored")}, +{640,360,1,14,false,QLatin1String("NHD Portrait")}, {352,800,1,12,true,QLatin1String("E90 Landscape Mirrored")}, {352,800,1,12,false,QLatin1String("E90 Landscape")} // *** End of generated data *** @@ -70,14 +70,14 @@ 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,3,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,3,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,3,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,3,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,3,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,3,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,3,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,3,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,2,-909,-909,-909,-909,7,7,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,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} -- cgit v0.12 From f8a84a253aae0ba880ac5b25eddddbde5033fb48 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 5 May 2009 11:25:23 +0300 Subject: Hacked select to listen also expectfds in Symbain OS for given sockets. This change was needed since plain readfs/writefds select call to Open C sometimes jammed. By adding expectfds to select call, the select seems not to hang anymore but returns. This workaround should be removed once Open C performs accorinding to POSIX standard. --- src/network/socket/qnativesocketengine_unix.cpp | 47 ++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 5584c6a..0e0980c 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -885,17 +885,38 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; +#ifdef Q_OS_SYMBIAN + fd_set fdexec; + FD_ZERO(&fdexec); + FD_SET(socketDescriptor, &fdexec); +#endif + QTime timer; timer.start(); int retval; do { if (selectForRead) - //retval = ::select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv); +#ifndef Q_OS_SYMBIAN retval = qt_socket_select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv); +#else + retval = qt_socket_select(socketDescriptor + 1, &fds, 0, &fdexec, timeout < 0 ? 0 : &tv); +#endif else - //retval = ::select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv); +#ifndef Q_OS_SYMBIAN retval = qt_socket_select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv); +#else + retval = qt_socket_select(socketDescriptor + 1, 0, &fds, &fdexec, timeout < 0 ? 0 : &tv); +#endif + + +#ifdef Q_OS_SYMBIAN + bool selectForExec = FD_ISSET(socketDescriptor, &fdexec); + if(selectForExec) { + qWarning("nativeSelect (selectForRead %d, retVal %d) Unexpected expectfds ready in fd %d", + selectForRead, retval, socketDescriptor); + } +#endif if (retval != -1 || errno != EINTR) { break; @@ -930,6 +951,12 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c FD_ZERO(&fdwrite); if (checkWrite) FD_SET(socketDescriptor, &fdwrite); + +#ifdef Q_OS_SYMBIAN + fd_set fdexec; + FD_ZERO(&fdexec); + FD_SET(socketDescriptor, &fdexec); +#endif struct timeval tv; tv.tv_sec = timeout / 1000; @@ -940,10 +967,20 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c int ret; do { - +#ifndef Q_OS_SYMBIAN ret = qt_socket_select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv); - //ret = ::select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv); - +#else + ret = qt_socket_select(socketDescriptor + 1, &fdread, &fdwrite, &fdexec, timeout < 0 ? 0 : &tv); + bool selectForExec = FD_ISSET(socketDescriptor, &fdexec); + if(selectForExec) { + qWarning("nativeSelect (checkRead %d, checkWrite %d, ret %d): Unexpected expectfds ready in fd %d", + checkRead, checkWrite, ret, socketDescriptor); + if(checkRead) + FD_SET(socketDescriptor, &fdread); + if(checkWrite) + FD_SET(socketDescriptor, &fdwrite); + } +#endif if (ret != -1 || errno != EINTR) { break; } -- cgit v0.12 From bf1b80a7359a39040a30e17a6f4608e2e3b443ce Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 5 May 2009 11:30:15 +0300 Subject: Enabled disconnectWhileConnectingNoEventLoop test case for Symbian OS. Had to increase also test case timeouts to make it pass in Symbian OS. --- tests/auto/qtcpsocket/tst_qtcpsocket.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index 2e039bf..da3f19a 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -944,7 +944,7 @@ public: : server(0), ok(false), quit(false) { } - ~ReceiverThread() { wait(); delete server; } + ~ReceiverThread() { /*delete server;*/ terminate(); wait(); } bool listen() { @@ -969,7 +969,11 @@ protected: QTcpSocket *socket = server->nextPendingConnection(); while (!quit) { +#ifndef Q_OS_SYMBIAN if (socket->waitForDisconnected(500)) +#else + if (socket->waitForDisconnected(1000)) +#endif break; if (socket->error() != QAbstractSocket::SocketTimeoutError) return; @@ -992,8 +996,6 @@ void tst_QTcpSocket::disconnectWhileConnectingNoEventLoop_data() void tst_QTcpSocket::disconnectWhileConnectingNoEventLoop() { - QSKIP("Check this", SkipAll); - QFETCH(QByteArray, data); ReceiverThread thread; @@ -1019,7 +1021,11 @@ void tst_QTcpSocket::disconnectWhileConnectingNoEventLoop() socket->disconnectFromHost(); } +#ifndef Q_OS_SYMBIAN QVERIFY2(socket->waitForDisconnected(10000), "Network timeout"); +#else + QVERIFY2(socket->waitForDisconnected(20000), "Network timeout"); +#endif QVERIFY(socket->state() == QAbstractSocket::UnconnectedState); if (!closeDirectly) { QCOMPARE(int(socket->openMode()), int(QIODevice::ReadWrite)); -- cgit v0.12