diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2009-05-05 11:16:50 (GMT) |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2009-05-05 11:16:50 (GMT) |
commit | e4b70508f33a94f32527934b2564eaf7e0677e5e (patch) | |
tree | 2f9ff8ba3009e9232549f7887afb587b1f349c23 | |
parent | d6634f369db51abb60d94fd5a4b0e78f06f77f5c (diff) | |
parent | 33098f7d362172b148032f4b1b41ade271049d9a (diff) | |
download | Qt-e4b70508f33a94f32527934b2564eaf7e0677e5e.zip Qt-e4b70508f33a94f32527934b2564eaf7e0677e5e.tar.gz Qt-e4b70508f33a94f32527934b2564eaf7e0677e5e.tar.bz2 |
Merge branch 'master' of git@scm.dev.troll.no:qt/qt-s60-public
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | src/corelib/io/qfile.cpp | 9 | ||||
-rw-r--r-- | src/corelib/thread/qthread_p.h | 2 | ||||
-rw-r--r-- | src/corelib/thread/qthread_unix.cpp | 12 | ||||
-rw-r--r-- | src/gui/image/qpixmap_s60.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qt_s60_p.h | 6 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 18 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_p.h | 4 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_s60.cpp | 38 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_s60.cpp | 46 | ||||
-rw-r--r-- | src/gui/styles/qs60style.cpp | 375 | ||||
-rw-r--r-- | src/gui/styles/qs60style.h | 3 | ||||
-rw-r--r-- | src/gui/styles/qs60style_p.h | 43 | ||||
-rw-r--r-- | src/gui/styles/qs60style_simulated.cpp | 8 | ||||
-rw-r--r-- | src/gui/styles/qs60style_symbian.cpp | 94 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine_unix.cpp | 47 | ||||
-rw-r--r-- | tests/auto/qsslsocket/tst_qsslsocket.cpp | 30 | ||||
-rw-r--r-- | tests/auto/qtcpsocket/tst_qtcpsocket.cpp | 12 | ||||
-rw-r--r-- | tests/auto/qwidget/tst_qwidget.cpp | 4 | ||||
-rw-r--r-- | util/s60pixelmetrics/bld.inf (renamed from util/s60pixelmetrics/pixelmetricsmapper/bld.inf) | 0 | ||||
-rw-r--r-- | util/s60pixelmetrics/pixel_metrics.cpp (renamed from util/s60pixelmetrics/src/pixel_metrics.cpp) | 16 | ||||
-rw-r--r-- | util/s60pixelmetrics/pixel_metrics.h (renamed from util/s60pixelmetrics/inc/pixel_metrics.h) | 2 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapper.hrh (renamed from util/s60pixelmetrics/pixelmetricsmapper/PMMapper.hrh) | 0 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapper.mmp (renamed from util/s60pixelmetrics/pixelmetricsmapper/pm_mapper.mmp) | 7 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapper.pkg (renamed from util/s60pixelmetrics/pixelmetricsmapper/pmmapper.pkg) | 0 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapper.rss (renamed from util/s60pixelmetrics/pixelmetricsmapper/pm_mapper.rss) | 2 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapper_reg.rss (renamed from util/s60pixelmetrics/pixelmetricsmapper/pm_mapper_reg.rss) | 0 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapperapp.cpp (renamed from util/s60pixelmetrics/pixelmetricsmapper/PMMapperApp.cpp) | 30 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapperapp.h (renamed from util/s60pixelmetrics/pixelmetricsmapper/PMMapperApp.h) | 0 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapperview.cpp (renamed from util/s60pixelmetrics/pixelmetricsmapper/PMMapperView.cpp) | 6 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapperview.h (renamed from util/s60pixelmetrics/pixelmetricsmapper/PMMapperView.h) | 0 |
33 files changed, 620 insertions, 203 deletions
@@ -185,6 +185,7 @@ bld.inf !s60main.rss *.pkg plugin_commonU.def +*.qtplugin *.sis *.sisx diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index af10c31..4a20c97 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -737,15 +737,18 @@ 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; } } - if (error) + if (error) { out.remove(); - else + } else { + fileEngine()->setFileName(newName); setFileName(newName); + } return !error; } } 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 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 { diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index c7bbcdb..06e47a7 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -540,7 +540,10 @@ void QSymbianControl::Draw(const TRect& r) const if (engine->type() == QPaintEngine::Raster) { QS60WindowSurface *s60Surface = static_cast<QS60WindowSurface *>(qwidget->windowSurface()); CFbsBitmap *bitmap = s60Surface->symbianBitmap(); - SystemGc().BitBlt(r.iTl, bitmap, r); + CWindowGc &gc = SystemGc(); + 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/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: diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 7eaebbb..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 } /*! @@ -2038,19 +2044,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<QRect> &rects = rgn.rects(); for (int i = 0; i < rects.size(); ++i) 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..f424e93 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); @@ -202,8 +202,16 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO topExtra->rwindow->PointerFilter(EPointerFilterEnterExit | EPointerFilterMove | EPointerFilterDrag, 0); topExtra->rwindow->EnableVisibilityChangeEvents(); + + if (!isOpaque) { + RWindow *rwindow = static_cast<RWindow*>(topExtra->rwindow); + TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA); + if (rwindow->SetTransparencyAlphaChannel() == KErrNone) + rwindow->SetBackgroundColor(TRgb(255, 255, 255, 0)); + } } + id = (WId)control; setWinId(id); @@ -429,6 +437,30 @@ 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<RWindow*>(topExtra->rwindow); + TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA); + if (rwindow->SetTransparencyAlphaChannel() == KErrNone) + rwindow->SetBackgroundColor(TRgb(255, 255, 255, 0)); + } else { + QTLWExtra *topExtra = topData(); + RWindow *rwindow = static_cast<RWindow*>(topExtra->rwindow); + rwindow->SetTransparentRegion(TRegionFix<1>()); + } +} + CFbsBitmap* qt_pixmapToNativeBitmapL(QPixmap pixmap, bool invert) { CFbsBitmap* fbsBitmap = new(ELeave)CFbsBitmap; @@ -574,9 +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) { - + // ### TODO: Implement uniform window transparency } void QWidgetPrivate::updateFrameStrut() diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index b262cb2..2618ce2 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -12,9 +12,10 @@ #include <qglobal.h> // for Q_WS_WIN define (non-PCH) #include <QtGui/qpaintdevice.h> -#include <QtGui/qwidget.h> +#include <private/qwidget_p.h> #include "qwindowsurface_s60_p.h" #include "qt_s60_p.h" +#include "private/qdrawhelper_p.h" QT_BEGIN_NAMESPACE @@ -35,12 +36,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(); @@ -56,7 +62,7 @@ QS60WindowSurface::~QS60WindowSurface() delete d_ptr; } -void QS60WindowSurface::beginPaint(const QRegion &) +void QS60WindowSurface::beginPaint(const QRegion &rgn) { if(!d_ptr->bitmap) return; @@ -64,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<QRgb *>(d_ptr->device.bits()); + const int row_stride = d_ptr->device.bytesPerLine() / 4; + + const QVector<QRect> rects = rgn.rects(); + for (QVector<QRect>::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 &) @@ -118,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() @@ -143,6 +170,9 @@ void QS60WindowSurface::lockBitmapHeap() // Get some values for QImage creation TDisplayMode mode = bitmap->DisplayMode(); + 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); diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 58dcb98..fb76b09 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,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 *** }; 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,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} + // *** 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; } @@ -462,7 +479,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); @@ -485,7 +502,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.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); @@ -498,31 +515,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<QSlider *>(widget)){ - widgetPalette.setColor(QPalette::All, QPalette::WindowText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0)); - } else if (QPushButton *button = qobject_cast<QPushButton *>(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<QHeaderView *>(widget)){ - widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0)); - } else if (QMenuBar *menuBar = qobject_cast<QMenuBar *>(widget)){ - widgetPalette.setColor(QPalette::All, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0)); - } else if (QTabBar *tabBar = qobject_cast<QTabBar *>(widget)){ - widgetPalette.setColor(QPalette::Active, QPalette::WindowText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0)); - } else if (QTableView *table = qobject_cast<QTableView *>(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) @@ -530,17 +530,6 @@ void QS60Style::polish(QWidget *widget) Q_D(const QS60Style); QCommonStyle::polish(widget); - if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(widget)){ - scrollArea->viewport()->setAutoFillBackground(false); - } - - if (false -#ifndef QT_NO_SCROLLBAR - || qobject_cast<QScrollBar *>(widget) -#endif - ) { - widget->setAttribute(Qt::WA_OpaquePaintEvent, false); - } if (QS60StylePrivate::isSkinnableDialog(widget)) { widget->setAttribute(Qt::WA_StyledBackground); } else if (false @@ -557,25 +546,45 @@ 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<QSlider *>(widget)){ + widgetPalette.setColor(QPalette::All, QPalette::WindowText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0)); + QApplication::setPalette(widgetPalette, "QSlider"); + } else if (QPushButton *button = qobject_cast<QPushButton *>(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<QHeaderView *>(widget)){ + widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0)); + QApplication::setPalette(widgetPalette, "QHeaderView"); + } else if (QMenuBar *menuBar = qobject_cast<QMenuBar *>(widget)){ + widgetPalette.setColor(QPalette::All, QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0)); + QApplication::setPalette(widgetPalette, "QMenuBar"); + } else if (QTabBar *tabBar = qobject_cast<QTabBar *>(widget)){ + widgetPalette.setColor(QPalette::Active, QPalette::WindowText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0)); + QApplication::setPalette(widgetPalette, "QTabBar"); + } else if (QTableView *table = qobject_cast<QTableView *>(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) { - if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(widget)){ - scrollArea->viewport()->setAutoFillBackground(true); - } - - if (false -#ifndef QT_NO_SCROLLBAR - || qobject_cast<QScrollBar *>(widget) -#endif - ) { - widget->setAttribute(Qt::WA_OpaquePaintEvent); - } if (QS60StylePrivate::isSkinnableDialog(widget)) { widget->setAttribute(Qt::WA_StyledBackground, false); } else if (false @@ -724,6 +733,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: @@ -801,7 +813,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, @@ -831,15 +843,73 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast<const QStyleOptionToolButton *>(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<QToolBar *>(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<const QToolBarExtension *>(widget))){ + /*QList<QAction *> 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 +937,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; @@ -884,10 +954,64 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom case CC_SpinBox: if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(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; + + 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); - // Let the base class draw the wole thing except the qDrawWinPanel 'frame' with Windows95-look - copy.frame = false; - QCommonStyle::drawComplexControl(control, ©, painter, widget); + 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 @@ -911,6 +1035,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); @@ -1556,6 +1685,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<const QStyleOptionToolBar *>(option)) { + const QToolBar *tbWidget = qobject_cast<const QToolBar *>(widget); + + if (!tbWidget || (widget && qobject_cast<QToolBar *>(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<QAction *> 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<const QToolButton *>(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 +1765,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: @@ -1760,19 +1930,18 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti case PE_IndicatorSpinUp: case PE_IndicatorSpinMinus: case PE_IndicatorSpinPlus: - { if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(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<const QStyleOptionFrame *>(option)) { + } +#ifndef QT_NO_COMBOBOX + else if (const QStyleOptionFrame *cmb = qstyleoption_cast<const QStyleOptionFrame *>(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: @@ -1876,6 +2045,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 +2077,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: @@ -2076,12 +2251,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: @@ -2092,7 +2267,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) @@ -2371,7 +2546,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 +2612,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.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..5afe702 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,9 +338,11 @@ 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; + void setThemePalette(QApplication *application) const; static int focusRectPenWidth(); 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..154cf29 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 */ {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( @@ -372,21 +405,34 @@ bool QS60StylePrivate::isTouchSupported() return bool(AknLayoutUtils::PenEnabled()); } -void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset) +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 QBrush &brush) { const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture()); - const QPaintDevice *target = painter->device(); - if (target->devType() == QInternal::Widget) { - const QWidget *widget = static_cast<const QWidget *>(target); - const CCoeControl *control = widget->effectiveWinId(); - const TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0); - const QRegion translated = rgn.translated(offset); - const QVector<QRect> &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<const QWidget *>(target); + CCoeControl *control = widget->effectiveWinId(); + TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0); + const QRegion translated = rgn.translated(offset); + const QVector<QRect> &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()); } } @@ -573,13 +619,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; @@ -961,18 +1013,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 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; } 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<SslErrorList>("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 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)); 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) diff --git a/util/s60pixelmetrics/pixelmetricsmapper/bld.inf b/util/s60pixelmetrics/bld.inf index 748e8810..748e8810 100644 --- a/util/s60pixelmetrics/pixelmetricsmapper/bld.inf +++ b/util/s60pixelmetrics/bld.inf diff --git a/util/s60pixelmetrics/src/pixel_metrics.cpp b/util/s60pixelmetrics/pixel_metrics.cpp index f71a266..8925ebe 100644 --- a/util/s60pixelmetrics/src/pixel_metrics.cpp +++ b/util/s60pixelmetrics/pixel_metrics.cpp @@ -50,7 +50,7 @@ // so that we can keep dynamic and static values inline. // Please adjust version data if correcting dynamic PM calculations. const TInt KPMMajorVersion = 1; -const TInt KPMMinorVersion = 13; +const TInt KPMMinorVersion = 14; TPixelMetricsVersion PixelMetrics::Version() { @@ -295,17 +295,21 @@ TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric) 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() ); + 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; - layoutRect2.LayoutRect( layoutRect.Rect(),AknLayoutScalable_Avkon::set_content_pane().LayoutLine() ); + layoutRect3.LayoutRect( layoutRect2.Rect(), AknLayoutScalable_Avkon::list_single_graphic_pane(0).LayoutLine() ); TAknLayoutText itemText; - itemText.LayoutText( layoutRect2.Rect(), AknLayoutScalable_Avkon::list_set_graphic_pane_t1(0) ); + itemText.LayoutText( layoutRect3.Rect(), AknLayoutScalable_Avkon::list_single_graphic_pane_t1(0) ); TAknLayoutRect iconLayoutRect; - iconLayoutRect.LayoutRect( layoutRect2.Rect(), AknLayoutScalable_Avkon::list_set_graphic_pane_g1(0).LayoutLine() ); + 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; @@ -973,6 +977,7 @@ TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric) 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: @@ -982,6 +987,7 @@ TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric) 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: diff --git a/util/s60pixelmetrics/inc/pixel_metrics.h b/util/s60pixelmetrics/pixel_metrics.h index 7235bda..692564c 100644 --- a/util/s60pixelmetrics/inc/pixel_metrics.h +++ b/util/s60pixelmetrics/pixel_metrics.h @@ -43,7 +43,7 @@ #define PIXELMETRICS_H #include <e32base.h> -//#define S60_Rnd_Env +#define S60_Rnd_Env #ifdef S60_Rnd_Env #pragma message ("Building in supported environment") diff --git a/util/s60pixelmetrics/pixelmetricsmapper/PMMapper.hrh b/util/s60pixelmetrics/pm_mapper.hrh index afd47db..afd47db 100644 --- a/util/s60pixelmetrics/pixelmetricsmapper/PMMapper.hrh +++ b/util/s60pixelmetrics/pm_mapper.hrh diff --git a/util/s60pixelmetrics/pixelmetricsmapper/pm_mapper.mmp b/util/s60pixelmetrics/pm_mapper.mmp index fe55fc9..a277404 100644 --- a/util/s60pixelmetrics/pixelmetricsmapper/pm_mapper.mmp +++ b/util/s60pixelmetrics/pm_mapper.mmp @@ -50,9 +50,9 @@ CAPABILITY CAP_APPLICATION VENDORID VID_DEFAULT SOURCEPATH . -SOURCE pmmapperview.cpp -SOURCE pmmapperapp.cpp -SOURCE ..\src\pixel_metrics.cpp +SOURCE pm_mapperview.cpp +SOURCE pm_mapperapp.cpp +SOURCE pixel_metrics.cpp START RESOURCE pm_mapper.rss HEADER @@ -65,7 +65,6 @@ END APP_LAYER_SYSTEMINCLUDE USERINCLUDE . -USERINCLUDE ..\inc LIBRARY eikcoctl.lib LIBRARY avkon.lib diff --git a/util/s60pixelmetrics/pixelmetricsmapper/pmmapper.pkg b/util/s60pixelmetrics/pm_mapper.pkg index 1f2e38f..1f2e38f 100644 --- a/util/s60pixelmetrics/pixelmetricsmapper/pmmapper.pkg +++ b/util/s60pixelmetrics/pm_mapper.pkg diff --git a/util/s60pixelmetrics/pixelmetricsmapper/pm_mapper.rss b/util/s60pixelmetrics/pm_mapper.rss index 60c15a8..8543271 100644 --- a/util/s60pixelmetrics/pixelmetricsmapper/pm_mapper.rss +++ b/util/s60pixelmetrics/pm_mapper.rss @@ -55,7 +55,7 @@ NAME TATR #include <data_caging_paths_strings.hrh> #include <appinfo.rh> -#include "pmmapper.hrh" +#include "pm_mapper.hrh" // RESOURCE DEFINITIONS diff --git a/util/s60pixelmetrics/pixelmetricsmapper/pm_mapper_reg.rss b/util/s60pixelmetrics/pm_mapper_reg.rss index d21a2c8..d21a2c8 100644 --- a/util/s60pixelmetrics/pixelmetricsmapper/pm_mapper_reg.rss +++ b/util/s60pixelmetrics/pm_mapper_reg.rss diff --git a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperApp.cpp b/util/s60pixelmetrics/pm_mapperapp.cpp index de0b753..e699019 100644 --- a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperApp.cpp +++ b/util/s60pixelmetrics/pm_mapperapp.cpp @@ -43,9 +43,9 @@ #include <avkon.rsg> #include <avkon.hrh> -#include "pmmapper.hrh" -#include "pmmapperApp.h" -#include "pmmapperView.h" +#include "pm_mapper.hrh" +#include "pm_mapperapp.h" +#include "pm_mapperview.h" #include <pm_mapper.rsg> #include <BldVariant.hrh> @@ -290,7 +290,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) case ECmdSwitchOrientation: { ClearL(); - #ifndef __SERIES60_31__ + #ifndef __SERIES60_31__ if (!iAvkonAppUi->OrientationCanBeChanged()) { HBufC* buffer = HBufC::NewLC( 100 ); @@ -301,7 +301,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) bufferPtr.Zero(); delete buffer; } - #endif //__SERIES60_31__ + #endif //__SERIES60_31__ if ( iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationPortrait) { iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape); @@ -402,16 +402,16 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) } } void CPixelMetricsMapperAppUi::DoAutoOperationL() - { - HandleCommandL(ECmdStartCalculations); - iMode = EFalse; - HandleCommandL(ECmdSwitchMirroring); - } + { + HandleCommandL(ECmdStartCalculations); + iMode = EFalse; + HandleCommandL(ECmdSwitchMirroring); + } TBool CPixelMetricsMapperAppUi::ReadyForAutoOp() const - { - return (iAutoMode && iMode); - } + { + return (iAutoMode && iMode); + } // ----------------------------------------------------------------------------- // @@ -853,9 +853,9 @@ void CPixelMetricsMapperAppUi::CreateHeaderFileL() const else { if (nextValue == -909) - bufferPMData.Append(_L("ECommonStyleValue")); + bufferPMData.Append(_L("ECommonStyleValue")); else - bufferPMData.AppendNum(nextValue); + bufferPMData.AppendNum(nextValue); } oneline.Zero(); loop++; diff --git a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperApp.h b/util/s60pixelmetrics/pm_mapperapp.h index 02d297e..02d297e 100644 --- a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperApp.h +++ b/util/s60pixelmetrics/pm_mapperapp.h diff --git a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperView.cpp b/util/s60pixelmetrics/pm_mapperview.cpp index 9d5d668..f7ab2ac 100644 --- a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperView.cpp +++ b/util/s60pixelmetrics/pm_mapperview.cpp @@ -46,10 +46,10 @@ #include <aknviewappui.h> #include <aknconsts.h> -#include "pmmapper.hrh" +#include "pm_mapper.hrh" #include <pm_mapper.rsg> -#include "pmmapperView.h" -#include "pmmapperApp.h" +#include "pm_mapperView.h" +#include "pm_mapperApp.h" #include <aknlists.h> #include <avkon.hrh> diff --git a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperView.h b/util/s60pixelmetrics/pm_mapperview.h index e9eb42e..e9eb42e 100644 --- a/util/s60pixelmetrics/pixelmetricsmapper/PMMapperView.h +++ b/util/s60pixelmetrics/pm_mapperview.h |