diff options
author | aavit <qt-info@nokia.com> | 2011-06-27 13:43:22 (GMT) |
---|---|---|
committer | aavit <qt-info@nokia.com> | 2011-06-27 13:43:22 (GMT) |
commit | 4e25c4e1e2f648bcda55b2dca0857ff3e73245bf (patch) | |
tree | a6a5e21ac53271215d015480204849590e044ecc /src/gui | |
parent | 514941c71b69ab967bdd18ae758f953de05f5480 (diff) | |
parent | c7fbfa24ede337a7e38d4436a927368d8d461621 (diff) | |
download | Qt-4e25c4e1e2f648bcda55b2dca0857ff3e73245bf.zip Qt-4e25c4e1e2f648bcda55b2dca0857ff3e73245bf.tar.gz Qt-4e25c4e1e2f648bcda55b2dca0857ff3e73245bf.tar.bz2 |
Merge remote-tracking branch 'qt-mainline/4.8'
Diffstat (limited to 'src/gui')
37 files changed, 329 insertions, 199 deletions
diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index 885ce77..fb52274 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -553,9 +553,6 @@ void QFileDialogPrivate::QNSOpenSavePanelDelegate_filterSelected(int menuIndex) emit q_func()->filterSelected(nameFilters.at(menuIndex)); } -extern OSErr qt_mac_create_fsref(const QString &, FSRef *); // qglobal.cpp -extern void qt_mac_to_pascal_string(QString s, Str255 str, TextEncoding encoding=0, int len=-1); // qglobal.cpp - void QFileDialogPrivate::setDirectory_sys(const QString &directory) { #ifndef QT_MAC_USE_COCOA diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 72738c9..17b7da3 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -77,8 +77,8 @@ else:mac { SOURCES += image/qpixmap_mac.cpp } else:symbian { - HEADERS += image/qpixmap_s60_p.h - SOURCES += image/qpixmap_s60.cpp + HEADERS += image/qpixmap_raster_symbian_p.h + SOURCES += image/qpixmap_raster_symbian.cpp } !symbian|contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2) { diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 14322dc..a3378de 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -62,7 +62,11 @@ #include <qhash.h> +#if defined(Q_OS_SYMBIAN) +#include <private/qpaintengine_raster_symbian_p.h> +#else #include <private/qpaintengine_raster_p.h> +#endif #include <private/qimage_p.h> #include <private/qfont_p.h> @@ -5779,7 +5783,11 @@ QPaintEngine *QImage::paintEngine() const return 0; if (!d->paintEngine) { +#ifdef Q_OS_SYMBIAN + d->paintEngine = new QSymbianRasterPaintEngine(const_cast<QImage *>(this)); +#else d->paintEngine = new QRasterPaintEngine(const_cast<QImage *>(this)); +#endif } return d->paintEngine; diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index 76c23c8..4668913 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -271,7 +271,7 @@ private: friend class QPixmapData; friend class QX11PixmapData; friend class QMacPixmapData; - friend class QS60PixmapData; + friend class QSymbianRasterPixmapData; friend class QBitmap; friend class QPaintDevice; friend class QPainter; diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_raster_symbian.cpp index ac29f5d..ae2682b 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_raster_symbian.cpp @@ -45,13 +45,13 @@ #include <private/qapplication_p.h> #include <private/qgraphicssystem_p.h> #include <private/qt_s60_p.h> -#include <private/qpaintengine_s60_p.h> #include <private/qfont_p.h> +#include <private/qpaintengine_raster_symbian_p.h> #include "qpixmap.h" #include "qpixmap_raster_p.h" #include <qwidget.h> -#include "qpixmap_s60_p.h" +#include "qpixmap_raster_symbian_p.h" #include "qnativeimage_p.h" #include "qbitmap.h" #include "qimage.h" @@ -65,10 +65,10 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; static bool cleanup_function_registered = false; -static QS60PixmapData *firstPixmap = 0; +static QSymbianRasterPixmapData *firstPixmap = 0; // static -void QS60PixmapData::qt_symbian_register_pixmap(QS60PixmapData *pd) +void QSymbianRasterPixmapData::qt_symbian_register_pixmap(QSymbianRasterPixmapData *pd) { if (!cleanup_function_registered) { qAddPostRoutine(qt_symbian_release_pixmaps); @@ -83,7 +83,7 @@ void QS60PixmapData::qt_symbian_register_pixmap(QS60PixmapData *pd) } // static -void QS60PixmapData::qt_symbian_unregister_pixmap(QS60PixmapData *pd) +void QSymbianRasterPixmapData::qt_symbian_unregister_pixmap(QSymbianRasterPixmapData *pd) { if (pd->next) pd->next->prev = pd->prev; @@ -94,10 +94,10 @@ void QS60PixmapData::qt_symbian_unregister_pixmap(QS60PixmapData *pd) } // static -void QS60PixmapData::qt_symbian_release_pixmaps() +void QSymbianRasterPixmapData::qt_symbian_release_pixmaps() { - // Scan all QS60PixmapData objects in the system and destroy them. - QS60PixmapData *pd = firstPixmap; + // Scan all QSymbianRasterPixmapData objects in the system and destroy them. + QSymbianRasterPixmapData *pd = firstPixmap; while (pd != 0) { pd->release(); pd = pd->next; @@ -393,7 +393,7 @@ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap) return pixmap; } -QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type), +QSymbianRasterPixmapData::QSymbianRasterPixmapData(PixelType type) : QRasterPixmapData(type), symbianBitmapDataAccess(new QSymbianBitmapDataAccess), cfbsBitmap(0), pengine(0), @@ -405,14 +405,14 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type), qt_symbian_register_pixmap(this); } -QS60PixmapData::~QS60PixmapData() +QSymbianRasterPixmapData::~QSymbianRasterPixmapData() { release(); delete symbianBitmapDataAccess; qt_symbian_unregister_pixmap(this); } -void QS60PixmapData::resize(int width, int height) +void QSymbianRasterPixmapData::resize(int width, int height) { if (width <= 0 || height <= 0) { w = width; @@ -446,7 +446,7 @@ void QS60PixmapData::resize(int width, int height) } } -void QS60PixmapData::release() +void QSymbianRasterPixmapData::release() { if (cfbsBitmap) { QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); @@ -464,7 +464,7 @@ void QS60PixmapData::release() /*! * Takes ownership of bitmap. Used by window surface */ -void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat) +void QSymbianRasterPixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat) { Q_ASSERT(bitmap); @@ -496,9 +496,9 @@ void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat) } } -QImage QS60PixmapData::toImage(const QRect &r) const +QImage QSymbianRasterPixmapData::toImage(const QRect &r) const { - QS60PixmapData *that = const_cast<QS60PixmapData*>(this); + QSymbianRasterPixmapData *that = const_cast<QSymbianRasterPixmapData*>(this); that->beginDataAccess(); QImage copy = that->image.copy(r); that->endDataAccess(); @@ -506,7 +506,7 @@ QImage QS60PixmapData::toImage(const QRect &r) const return copy; } -void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags) +void QSymbianRasterPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags) { release(); @@ -588,13 +588,13 @@ void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags } } -void QS60PixmapData::copy(const QPixmapData *data, const QRect &rect) +void QSymbianRasterPixmapData::copy(const QPixmapData *data, const QRect &rect) { - const QS60PixmapData *s60Data = static_cast<const QS60PixmapData*>(data); + const QSymbianRasterPixmapData *s60Data = static_cast<const QSymbianRasterPixmapData*>(data); fromImage(s60Data->toImage(rect), Qt::AutoColor | Qt::OrderedAlphaDither); } -bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect) +bool QSymbianRasterPixmapData::scroll(int dx, int dy, const QRect &rect) { beginDataAccess(); bool res = QRasterPixmapData::scroll(dx, dy, rect); @@ -602,7 +602,10 @@ bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect) return res; } -int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const +Q_GUI_EXPORT int qt_defaultDpiX(); +Q_GUI_EXPORT int qt_defaultDpiY(); + +int QSymbianRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const { if (!cfbsBitmap) return 0; @@ -633,7 +636,7 @@ int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const } -void QS60PixmapData::fill(const QColor &color) +void QSymbianRasterPixmapData::fill(const QColor &color) { if (color.alpha() != 255) { QImage im(width(), height(), QImage::Format_ARGB32_Premultiplied); @@ -647,7 +650,7 @@ void QS60PixmapData::fill(const QColor &color) } } -void QS60PixmapData::setMask(const QBitmap &mask) +void QSymbianRasterPixmapData::setMask(const QBitmap &mask) { if (mask.size().isEmpty()) { if (image.depth() != 1) { @@ -678,7 +681,7 @@ void QS60PixmapData::setMask(const QBitmap &mask) } } -void QS60PixmapData::setAlphaChannel(const QPixmap &alphaChannel) +void QSymbianRasterPixmapData::setAlphaChannel(const QPixmap &alphaChannel) { QImage img(toImage()); img.setAlphaChannel(alphaChannel.toImage()); @@ -686,21 +689,21 @@ void QS60PixmapData::setAlphaChannel(const QPixmap &alphaChannel) fromImage(img, Qt::OrderedDither | Qt::OrderedAlphaDither); } -QImage QS60PixmapData::toImage() const +QImage QSymbianRasterPixmapData::toImage() const { return toImage(QRect()); } -QPaintEngine* QS60PixmapData::paintEngine() const +QPaintEngine* QSymbianRasterPixmapData::paintEngine() const { if (!pengine) { - QS60PixmapData *that = const_cast<QS60PixmapData*>(this); - that->pengine = new QS60PaintEngine(&that->image, that); + QSymbianRasterPixmapData *that = const_cast<QSymbianRasterPixmapData*>(this); + that->pengine = new QSymbianRasterPaintEngine(&that->image, that); } return pengine; } -void QS60PixmapData::beginDataAccess() +void QSymbianRasterPixmapData::beginDataAccess() { if(!cfbsBitmap) return; @@ -740,12 +743,12 @@ void QS60PixmapData::beginDataAccess() is_null = (w <= 0 || h <= 0); if (pengine) { - QS60PaintEngine *engine = static_cast<QS60PaintEngine *>(pengine); + QSymbianRasterPaintEngine *engine = static_cast<QSymbianRasterPaintEngine *>(pengine); engine->prepare(&image); } } -void QS60PixmapData::endDataAccess(bool readOnly) const +void QSymbianRasterPixmapData::endDataAccess(bool readOnly) const { Q_UNUSED(readOnly); @@ -812,7 +815,7 @@ RSgImage *QPixmap::toSymbianRSgImage() const return sgImage; } -void* QS60PixmapData::toNativeType(NativeType type) +void* QSymbianRasterPixmapData::toNativeType(NativeType type) { if (type == QPixmapData::SgImage) { return 0; @@ -895,7 +898,7 @@ void* QS60PixmapData::toNativeType(NativeType type) return 0; } -void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType) +void QSymbianRasterPixmapData::fromNativeType(void* pixmap, NativeType nativeType) { if (nativeType == QPixmapData::SgImage) { return; @@ -1005,7 +1008,7 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType) } } -void QS60PixmapData::convertToDisplayMode(int mode) +void QSymbianRasterPixmapData::convertToDisplayMode(int mode) { const TDisplayMode displayMode = static_cast<TDisplayMode>(mode); if (!cfbsBitmap || cfbsBitmap->DisplayMode() == displayMode) @@ -1032,9 +1035,9 @@ void QS60PixmapData::convertToDisplayMode(int mode) UPDATE_BUFFER(); } -QPixmapData *QS60PixmapData::createCompatiblePixmapData() const +QPixmapData *QSymbianRasterPixmapData::createCompatiblePixmapData() const { - return new QS60PixmapData(pixelType()); + return new QSymbianRasterPixmapData(pixelType()); } QT_END_NAMESPACE diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_raster_symbian_p.h index e481549..7f4e53a 100644 --- a/src/gui/image/qpixmap_s60_p.h +++ b/src/gui/image/qpixmap_raster_symbian_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QPIXMAPDATA_S60_P_H -#define QPIXMAPDATA_S60_P_H +#ifndef QPIXMAP_RASTER_SYMBIAN_P_H +#define QPIXMAP_RASTER_SYMBIAN_P_H // // W A R N I N G @@ -81,11 +81,11 @@ private: bool wasLocked; }; -class QS60PixmapData : public QRasterPixmapData +class QSymbianRasterPixmapData : public QRasterPixmapData { public: - QS60PixmapData(PixelType type); - ~QS60PixmapData(); + QSymbianRasterPixmapData(PixelType type); + ~QSymbianRasterPixmapData(); QPixmapData *createCompatiblePixmapData() const; @@ -122,20 +122,19 @@ private: bool formatLocked; - QS60PixmapData *next; - QS60PixmapData *prev; + QSymbianRasterPixmapData *next; + QSymbianRasterPixmapData *prev; - static void qt_symbian_register_pixmap(QS60PixmapData *pd); - static void qt_symbian_unregister_pixmap(QS60PixmapData *pd); + static void qt_symbian_register_pixmap(QSymbianRasterPixmapData *pd); + static void qt_symbian_unregister_pixmap(QSymbianRasterPixmapData *pd); static void qt_symbian_release_pixmaps(); friend class QPixmap; friend class QS60WindowSurface; - friend class QS60PaintEngine; + friend class QSymbianRasterPaintEngine; friend class QS60Data; }; QT_END_NAMESPACE -#endif // QPIXMAPDATA_S60_P_H - +#endif // QPIXMAP_RASTER_SYMBIAN_P_H diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index c46429c..934dbb8 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -276,6 +276,11 @@ QImage* QPixmapData::buffer() } #if defined(Q_OS_SYMBIAN) +QVolatileImage QPixmapData::toVolatileImage() const +{ + return QVolatileImage(); +} + void* QPixmapData::toNativeType(NativeType /* type */) { return 0; diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index f07843d..960eb8f 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -139,7 +139,7 @@ public: } #if defined(Q_OS_SYMBIAN) - virtual QVolatileImage toVolatileImage() const { return QVolatileImage(); } + virtual QVolatileImage toVolatileImage() const; virtual void* toNativeType(NativeType type); virtual void fromNativeType(void* pixmap, NativeType type); #endif @@ -159,7 +159,7 @@ protected: private: friend class QPixmap; friend class QX11PixmapData; - friend class QS60PixmapData; + friend class QSymbianRasterPixmapData; friend class QImagePixmapCleanupHooks; // Needs to set is_cached friend class QGLTextureCache; //Needs to check the reference count friend class QExplicitlySharedDataPointer<QPixmapData>; diff --git a/src/gui/image/qpixmapdatafactory.cpp b/src/gui/image/qpixmapdatafactory.cpp index f7c79880..ebe89e4 100644 --- a/src/gui/image/qpixmapdatafactory.cpp +++ b/src/gui/image/qpixmapdatafactory.cpp @@ -57,7 +57,7 @@ # include <private/qpixmap_raster_p.h> #endif #ifdef Q_OS_SYMBIAN -# include <private/qpixmap_s60_p.h> +# include <private/qpixmap_raster_symbian_p.h> #endif #include "private/qapplication_p.h" @@ -88,7 +88,7 @@ QPixmapData* QSimplePixmapDataFactory::create(QPixmapData::PixelType type) #elif defined(Q_WS_QPA) return new QRasterPixmapData(type); #elif defined(Q_OS_SYMBIAN) - return new QS60PixmapData(type); + return new QSymbianRasterPixmapData(type); #else #error QSimplePixmapDataFactory::create() not implemented #endif diff --git a/src/gui/image/qvolatileimage.cpp b/src/gui/image/qvolatileimage.cpp index b8612b1..9734c82 100644 --- a/src/gui/image/qvolatileimage.cpp +++ b/src/gui/image/qvolatileimage.cpp @@ -200,6 +200,16 @@ QImage &QVolatileImage::imageRef() // non-const, in order to cause a detach return d->image; } +/*! + Non-detaching version, for read-only access only. + Must be guarded by begin/endDataAccess(). + */ +const QImage &QVolatileImage::constImageRef() const +{ + const_cast<QVolatileImageData *>(d.data())->ensureImage(); + return d->image; +} + void *QVolatileImage::duplicateNativeImage() const { return d->duplicateNativeImage(); @@ -289,12 +299,14 @@ bool QVolatileImagePaintEngine::end() void QVolatileImagePaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) { #ifdef Q_OS_SYMBIAN - void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); - if (nativeData) { - QVolatileImage *img = static_cast<QVolatileImage *>(nativeData); - img->beginDataAccess(); - QRasterPaintEngine::drawImage(p, img->imageRef()); - img->endDataAccess(true); + QVolatileImage img = pm.pixmapData()->toVolatileImage(); + if (!img.isNull()) { + img.beginDataAccess(); + // imageRef() would detach and since we received the QVolatileImage from + // toVolatileImage() by value, it would cause a copy which would ruin + // our goal. So use constImageRef() instead. + QRasterPaintEngine::drawImage(p, img.constImageRef()); + img.endDataAccess(true); } else { QRasterPaintEngine::drawPixmap(p, pm); } @@ -306,12 +318,11 @@ void QVolatileImagePaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) void QVolatileImagePaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) { #ifdef Q_OS_SYMBIAN - void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); - if (nativeData) { - QVolatileImage *img = static_cast<QVolatileImage *>(nativeData); - img->beginDataAccess(); - QRasterPaintEngine::drawImage(r, img->imageRef(), sr); - img->endDataAccess(true); + QVolatileImage img = pm.pixmapData()->toVolatileImage(); + if (!img.isNull()) { + img.beginDataAccess(); + QRasterPaintEngine::drawImage(r, img.constImageRef(), sr); + img.endDataAccess(true); } else { QRasterPaintEngine::drawPixmap(r, pm, sr); } diff --git a/src/gui/image/qvolatileimage_p.h b/src/gui/image/qvolatileimage_p.h index 97d6ea6..bed2e91 100644 --- a/src/gui/image/qvolatileimage_p.h +++ b/src/gui/image/qvolatileimage_p.h @@ -87,6 +87,7 @@ public: bool ensureFormat(QImage::Format format); QImage toImage() const; QImage &imageRef(); + const QImage &constImageRef() const; QPaintEngine *paintEngine(); void setAlphaChannel(const QPixmap &alphaChannel); void fill(uint pixelValue); diff --git a/src/gui/image/qvolatileimagedata_symbian.cpp b/src/gui/image/qvolatileimagedata_symbian.cpp index 6984722..c20c417 100644 --- a/src/gui/image/qvolatileimagedata_symbian.cpp +++ b/src/gui/image/qvolatileimagedata_symbian.cpp @@ -53,8 +53,11 @@ static CFbsBitmap *rasterizeBitmap(CFbsBitmap *bitmap, TDisplayMode newMode) return 0; } QScopedPointer<CFbsBitmap> newBitmap(new CFbsBitmap); - if (newBitmap->Create(bitmap->SizeInPixels(), newMode) != KErrNone) { - qWarning("QVolatileImage: Failed to create new bitmap"); + const TSize size = bitmap->SizeInPixels(); + TInt err = newBitmap->Create(size, newMode); + if (err != KErrNone) { + qWarning("QVolatileImage: Failed to create new bitmap (w %d h %d dispmode %d err %d)", + size.iWidth, size.iHeight, newMode, err); return 0; } CFbsBitmapDevice *bitmapDevice = 0; @@ -97,6 +100,7 @@ static inline TDisplayMode format2TDisplayMode(QImage::Format format) mode = Q_SYMBIAN_ECOLOR16MAP; break; default: + qWarning("QVolatileImage: Unknown image format %d", format); mode = ENone; break; } @@ -109,8 +113,9 @@ static CFbsBitmap *imageToBitmap(const QImage &image) return 0; } CFbsBitmap *bitmap = new CFbsBitmap; - if (bitmap->Create(TSize(image.width(), image.height()), - format2TDisplayMode(image.format())) == KErrNone) { + TInt err = bitmap->Create(TSize(image.width(), image.height()), + format2TDisplayMode(image.format())); + if (err == KErrNone) { bitmap->BeginDataAccess(); uchar *dptr = reinterpret_cast<uchar *>(bitmap->DataAddress()); int bmpLineLen = bitmap->DataStride(); @@ -128,7 +133,8 @@ static CFbsBitmap *imageToBitmap(const QImage &image) } bitmap->EndDataAccess(); } else { - qWarning("QVolatileImage: Failed to create source bitmap"); + qWarning("QVolatileImage: Failed to create source bitmap (w %d h %d fmt %d err %d)", + image.width(), image.height(), image.format(), err); delete bitmap; bitmap = 0; } @@ -155,8 +161,9 @@ static CFbsBitmap *convertData(const QVolatileImageData &source, QImage::Format static CFbsBitmap *duplicateBitmap(const CFbsBitmap &sourceBitmap) { CFbsBitmap *bitmap = new CFbsBitmap; - if (bitmap->Duplicate(sourceBitmap.Handle()) != KErrNone) { - qWarning("QVolatileImage: Failed to duplicate source bitmap"); + TInt err = bitmap->Duplicate(sourceBitmap.Handle()); + if (err != KErrNone) { + qWarning("QVolatileImage: Failed to duplicate source bitmap (%d)", err); delete bitmap; bitmap = 0; } @@ -166,8 +173,10 @@ static CFbsBitmap *duplicateBitmap(const CFbsBitmap &sourceBitmap) static CFbsBitmap *createBitmap(int w, int h, QImage::Format format) { CFbsBitmap *bitmap = new CFbsBitmap; - if (bitmap->Create(TSize(w, h), format2TDisplayMode(format)) != KErrNone) { - qWarning("QVolatileImage: Failed to create source bitmap %d,%d (%d)", w, h, format); + TInt err = bitmap->Create(TSize(w, h), format2TDisplayMode(format)); + if (err != KErrNone) { + qWarning("QVolatileImage: Failed to create source bitmap (w %d h %d fmt %d err %d)", + w, h, format, err); delete bitmap; bitmap = 0; } diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index d603540..f8d7e28 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -366,7 +366,8 @@ bool QCoeFepInputContext::symbianFilterEvent(QWidget *keyWidget, const QSymbianE } if (event->type() == QSymbianEvent::ResourceChangeEvent - && event->resourceChangeType() == KEikMessageFadeAllWindows) { + && (event->resourceChangeType() == KEikMessageFadeAllWindows + || event->resourceChangeType() == KEikDynamicLayoutVariantSwitch)) { reset(); } @@ -467,7 +468,10 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget) } } else { if (m_splitViewResizeBy) - gv->resize(gv->rect().width(), m_splitViewResizeBy); + if (m_splitViewPreviousWindowStates & Qt::WindowFullScreen) + gv->resize(gv->rect().width(), qApp->desktop()->height()); + else + gv->resize(gv->rect().width(), m_splitViewResizeBy); } // Resizing might have led to widget losing its original windowstate. // Restore previous window state. @@ -699,11 +703,6 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) } else if (anynumbermodes) { flags |= EAknEditorNumericInputMode; - if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 - && ((hints & ImhFormattedNumbersOnly) || (hints & ImhDialableCharactersOnly))) { - //workaround - the * key does not launch the symbols menu, making it impossible to use these modes unless text mode is enabled. - flags |= EAknEditorTextInputMode; - } } else if (anytextmodes) { flags |= EAknEditorTextInputMode; @@ -784,8 +783,6 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_EMAIL_ADDR_SPECIAL_CHARACTER_TABLE_DIALOG); } else if (needsCharMap) { m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG); - } else if ((hints & ImhFormattedNumbersOnly) || (hints & ImhDialableCharactersOnly)) { - m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG); } else { m_fepState->SetSpecialCharacterTableResourceId(0); } @@ -896,19 +893,40 @@ void QCoeFepInputContext::translateInputWidget() m_transformation = (rootItem->transform().isTranslating()) ? QRectF(0,0, gv->width(), rootItem->transform().dy()) : QRectF(); - // Do nothing if the cursor is visible in the splitview area. - if (splitViewRect.contains(cursorP.boundingRect())) + // Adjust cursor bounding rect to be lower, so that view translates if the cursor gets near + // the splitview border. + QRect cursorRect = cursorP.boundingRect().adjusted(0, cursor.height(), 0, cursor.height()); + if (splitViewRect.contains(cursorRect)) return; - // New Y position should be ideally at the center of the splitview area. - // If that would expose unpainted canvas, limit the tranformation to the visible scene bottom. - - const qreal maxY = gv->sceneRect().bottom() - splitViewRect.bottom() + m_transformation.height(); - qreal dy = -(qMin(maxY, (cursor.bottom() - vkbRect.top() / 2))); - - // Do not allow transform above screen top. - if (m_transformation.height() + dy > 0) + // New Y position should be ideally just above the keyboard. + // If that would expose unpainted canvas, limit the tranformation to the visible scene rect or + // to the focus item's shape/clip path. + + const QPainterPath path = gv->scene()->focusItem()->isClipped() ? + gv->scene()->focusItem()->clipPath() : gv->scene()->focusItem()->shape(); + const qreal itemHeight = path.boundingRect().height(); + + // Limit the maximum translation so that underlaying window content is not exposed. + qreal maxY = gv->sceneRect().bottom() - splitViewRect.bottom(); + maxY = m_transformation.height() ? (qMin(itemHeight, maxY) + m_transformation.height()) : maxY; + if (maxY < 0) + maxY = 0; + + // Translation should happen row-by-row, but initially it needs to ensure that cursor is visible. + const qreal translation = m_transformation.height() ? + cursor.height() : (cursorRect.bottom() - vkbRect.top()); + const qreal dy = -(qMin(maxY, translation)); + + // Do not allow transform above screen top, nor beyond scenerect + if (m_transformation.height() + dy > 0 || gv->sceneRect().bottom() + m_transformation.height() < 0) { + // If we already have some transformation, remove it. + if (m_transformation.height() < 0 || gv->sceneRect().bottom() + m_transformation.height() < 0) { + rootItem->resetTransform(); + translateInputWidget(); + } return; + } rootItem->setTransform(QTransform::fromTranslate(0, dy), true); } diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index 343b68f..c5ff799 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -218,7 +218,6 @@ extern OSWindowRef qt_mac_window_for(const QWidget*); //qwidget_mac.cpp extern QWidget *qt_mac_find_window(OSWindowRef); //qwidget_mac.cpp extern void qt_mac_set_cursor(const QCursor *); //qcursor_mac.cpp extern bool qt_mac_is_macsheet(const QWidget *); //qwidget_mac.cpp -extern QString qt_mac_from_pascal_string(const Str255); //qglobal.cpp extern void qt_mac_command_set_enabled(MenuRef, UInt32, bool); //qmenu_mac.cpp extern bool qt_sendSpontaneousEvent(QObject *obj, QEvent *event); // qapplication.cpp extern void qt_mac_update_cursor(); // qcursor_mac.mm diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 086cfec..5ac9803 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -134,7 +134,7 @@ void QS60Data::setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, boo s->MakeVisible(statusPaneVisible); } if (buttonGroupVisibilityChanged || statusPaneVisibilityChanged) { - const QSize size = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect()).size(); + const QSize size = qt_TRect2QRect(S60->clientRect()).size(); const QSize oldSize; // note that QDesktopWidget::resizeEvent ignores the QResizeEvent contents QResizeEvent event(size, oldSize); QApplication::instance()->sendEvent(QApplication::desktop(), &event); @@ -231,6 +231,28 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible) } } +TRect QS60Data::clientRect() +{ + TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); + if (S60->partialKeyboardOpen) { + // Adjust client rect when splitview is open, since for some curious reason + // native side insists that clientRect starts from (0,0) even though status + // pane might be visible. + TRect statusPaneRect; + TRect mainRect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainRect); + int clientAreaHeight = mainRect.Height(); + CEikStatusPane *const s = S60->statusPane(); + if (s && s->IsVisible()) + r.Move(0, statusPaneRect.Height()); + else + clientAreaHeight += statusPaneRect.Height(); + r.SetHeight(clientAreaHeight); + } + return r; +} + bool qt_nograb() // application no-grab option { #if defined(QT_DEBUG) @@ -908,6 +930,15 @@ TKeyResponse QSymbianControl::sendSymbianKeyEvent(const TKeyEvent &keyEvent, QEv } Qt::KeyboardModifiers mods = mapToQtModifiers(keyEvent.iModifiers); + + TInt code = keyEvent.iCode; + + if (mods == Qt::ControlModifier) { + //only support ctrl+a .. ctrl+z, 0x40 is the key value before Qt::Key_A + if (code > 0 && code < 27) + keyCode = 0x40 + code; + } + QKeyEventEx qKeyEvent(type, keyCode, mods, qt_keymapper_private()->translateKeyEvent(keyCode, mods), (keyEvent.iRepeats != 0), 1, keyEvent.iScanCode, s60Keysym, keyEvent.iModifiers); QWidget *widget; @@ -1435,7 +1466,9 @@ void QSymbianControl::handleClientAreaChange() if (qwidget->isFullScreen() && !cbaVisibilityHint) { SetExtentToWholeScreen(); } else if (qwidget->isMaximized() || (qwidget->isFullScreen() && cbaVisibilityHint)) { - TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); + // Note that if there is S60->splitViewLastWidget, it means the resizing is done + // by input context handling and we can use just default ClientRect. + TRect r = (!S60->splitViewLastWidget) ? S60->clientRect() : static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); SetExtent(r.iTl, r.Size()); } else if (!qwidget->isMinimized()) { // Normal geometry if (!qwidget->testAttribute(Qt::WA_Resized)) { @@ -1443,7 +1476,7 @@ void QSymbianControl::handleClientAreaChange() qwidget->setAttribute(Qt::WA_Resized, false); //not a user resize } if (!qwidget->testAttribute(Qt::WA_Moved) && qwidget->windowType() != Qt::Dialog) { - TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); + TRect r = S60->clientRect(); SetPosition(r.iTl); qwidget->setAttribute(Qt::WA_Moved, false); // not really an explicit position } @@ -1489,13 +1522,14 @@ void QSymbianControl::HandleResourceChange(int resourceType) if (!ic) { ic = qobject_cast<QCoeFepInputContext *>(qApp->inputContext()); } - if (ic && isSplitViewWidget(widget)) { + if (ic) { if (resourceType == KSplitViewCloseEvent) { S60->partialKeyboardOpen = false; ic->resetSplitViewWidget(); } else { S60->partialKeyboardOpen = true; - ic->ensureFocusWidgetVisible(widget); + if (isSplitViewWidget(widget)) + ic->ensureFocusWidgetVisible(widget); } } } @@ -1508,7 +1542,8 @@ void QSymbianControl::HandleResourceChange(int resourceType) // client area. if (S60->statusPane() && (S60->statusPane()->IsVisible() || m_lastStatusPaneVisibility)) { m_lastStatusPaneVisibility = S60->statusPane()->IsVisible(); - handleClientAreaChange(); + if (S60->handleStatusPaneResizeNotifications) + handleClientAreaChange(); } if (IsFocused() && IsVisible()) { qwidget->d_func()->setWindowIcon_sys(true); @@ -1912,7 +1947,7 @@ void qt_cleanup() qt_S60Beep = 0; } QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles - QPixmapCache::clear(); // Has to happen now, since QS60PixmapData has FBS handles + QPixmapCache::clear(); // Has to happen now, since QSymbianRasterPixmapData has FBS handles #ifdef QT_NO_FREETYPE qt_cleanup_symbianFontDatabase(); diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp index 156c970..86d8f3f 100644 --- a/src/gui/kernel/qdesktopwidget_s60.cpp +++ b/src/gui/kernel/qdesktopwidget_s60.cpp @@ -161,7 +161,7 @@ void QDesktopWidgetPrivate::init(QDesktopWidget *that) (*rects)[i] = r; QRect wr; if (i == 0) - wr = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect()); + wr = qt_TRect2QRect(S60->clientRect()); else wr = rects->at(i); (*workrects)[i].setRect(wr.x(), wr.y(), wr.width(), wr.height()); diff --git a/src/gui/kernel/qmime_mac.cpp b/src/gui/kernel/qmime_mac.cpp index a1df34e..8b47d8e 100644 --- a/src/gui/kernel/qmime_mac.cpp +++ b/src/gui/kernel/qmime_mac.cpp @@ -119,10 +119,6 @@ const QStringList& qEnabledDraggedTypes() *****************************************************************************/ //#define DEBUG_MIME_MAPS -//functions -extern QString qt_mac_from_pascal_string(const Str255); //qglobal.cpp -extern void qt_mac_from_pascal_string(QString, Str255, TextEncoding encoding=0, int len=-1); //qglobal.cpp - ScrapFlavorType qt_mac_mime_type = 'CUTE'; CFStringRef qt_mac_mime_typeUTI = CFSTR("com.pasteboard.trolltech.marker"); diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index acdb0e5..b5d0101 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -53,6 +53,10 @@ #include <eiksoftkeyimage.h> #include <eikcmbut.h> +#ifndef QT_NO_STYLE_S60 +#include <qs60style.h> +#endif + #ifndef QT_NO_SOFTKEYMANAGER QT_BEGIN_NAMESPACE @@ -220,26 +224,42 @@ bool QSoftKeyManagerPrivateS60::isOrientationLandscape() QSize QSoftKeyManagerPrivateS60::cbaIconSize(CEikButtonGroupContainer *cba, int position) { - int index = position; index += isOrientationLandscape() ? 0 : 1; if(cachedCbaIconSize[index].isNull()) { - // Only way I figured out to get CBA icon size without RnD SDK, was - // to set some dummy icon to CBA first and then ask CBA button CCoeControl::Size() - // The returned value is cached to avoid unnecessary icon setting every time. - const bool left = (position == LSK_POSITION); - if(position == LSK_POSITION || position == RSK_POSITION) { - CEikImage* tmpImage = NULL; - QT_TRAP_THROWING(tmpImage = new (ELeave) CEikImage); - EikSoftkeyImage::SetImage(cba, *tmpImage, left); // Takes myimage ownership - int command = S60_COMMAND_START + position; - setNativeSoftkey(*cba, position, command, KNullDesC()); - cachedCbaIconSize[index] = qt_TSize2QSize(cba->ControlOrNull(command)->Size()); - EikSoftkeyImage::SetLabel(cba, left); - - if(cachedCbaIconSize[index] == QSize(138,72)) { - // Hack for S60 5.0 (5800) landscape orientation, which return wrong icon size - cachedCbaIconSize[index] = QSize(60,60); + if (QSysInfo::s60Version() >= QSysInfo::SV_S60_5_3) { + // S60 5.3 and later have fixed icon size on softkeys, while the button + // itself is bigger, so the automatic check doesn't work. + // Use custom pixel metrics to deduce the CBA icon size + int iconHeight = 30; + int iconWidth = 30; +#ifndef QT_NO_STYLE_S60 + QS60Style *s60Style = 0; + s60Style = qobject_cast<QS60Style *>(QApplication::style()); + if (s60Style) { + iconWidth = s60Style->pixelMetric((QStyle::PixelMetric)PM_CbaIconWidth); + iconHeight = s60Style->pixelMetric((QStyle::PixelMetric)PM_CbaIconHeight); + } +#endif + cachedCbaIconSize[index] = QSize(iconWidth, iconHeight); + } else { + // Only way I figured out to get CBA icon size without RnD SDK, was + // to set some dummy icon to CBA first and then ask CBA button CCoeControl::Size() + // The returned value is cached to avoid unnecessary icon setting every time. + const bool left = (position == LSK_POSITION); + if (position == LSK_POSITION || position == RSK_POSITION) { + CEikImage* tmpImage = NULL; + QT_TRAP_THROWING(tmpImage = new (ELeave) CEikImage); + EikSoftkeyImage::SetImage(cba, *tmpImage, left); // Takes tmpImage ownership + int command = S60_COMMAND_START + position; + setNativeSoftkey(*cba, position, command, KNullDesC()); + cachedCbaIconSize[index] = qt_TSize2QSize(cba->ControlOrNull(command)->Size()); + EikSoftkeyImage::SetLabel(cba, left); + + if (cachedCbaIconSize[index] == QSize(138,72)) { + // Hack for S60 5.0 landscape orientation, which return wrong icon size + cachedCbaIconSize[index] = QSize(60,60); + } } } } diff --git a/src/gui/kernel/qt_mac.cpp b/src/gui/kernel/qt_mac.cpp index 339bc82..69f0034 100644 --- a/src/gui/kernel/qt_mac.cpp +++ b/src/gui/kernel/qt_mac.cpp @@ -61,7 +61,6 @@ QFont qfontForThemeFont(ThemeFontID themeID) SInt16 f_size; Style f_style; GetThemeFont(themeID, Script, f_name, &f_size, &f_style); - extern QString qt_mac_from_pascal_string(const Str255); //qglobal.cpp return QFont(qt_mac_from_pascal_string(f_name), f_size, (f_style & ::bold) ? QFont::Bold : QFont::Normal, (bool)(f_style & ::italic)); diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 67eb07b..c429b04 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -161,6 +161,7 @@ public: int partial_keyboard : 1; int partial_keyboardAutoTranslation : 1; int partialKeyboardOpen : 1; + int handleStatusPaneResizeNotifications : 1; QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type QPointer<QWidget> splitViewLastWidget; @@ -198,6 +199,7 @@ public: static bool setRecursiveDecorationsVisibility(QWidget *window, Qt::WindowStates newState); #endif static void controlVisibilityChanged(CCoeControl *control, bool visible); + static TRect clientRect(); #ifdef Q_OS_SYMBIAN TTrapHandler *s60InstalledTrapHandler; @@ -353,6 +355,7 @@ inline QS60Data::QS60Data() partial_keyboard(0), partial_keyboardAutoTranslation(1), partialKeyboardOpen(0), + handleStatusPaneResizeNotifications(1), s60ApplicationFactory(0) #ifdef Q_OS_SYMBIAN ,s60InstalledTrapHandler(0) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 5672686..d6aaa3f 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -359,7 +359,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de if (popup) flags |= Qt::WindowStaysOnTopHint; // a popup stays on top - TRect clientRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); + TRect clientRect = S60->clientRect(); int sw = clientRect.Width(); int sh = clientRect.Height(); @@ -538,8 +538,6 @@ void QWidgetPrivate::show_sys() QT_TRAP_THROWING( factory->CreateResourceIndependentFurnitureL(ui); - TRect boundingRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); - CEikButtonGroupContainer *cba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal,ui,R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); if (isFullscreen && !cbaRequested) @@ -592,11 +590,13 @@ void QWidgetPrivate::show_sys() // Fill client area if maximized OR // Put window below status pane unless the window has an explicit position. if (!isFullscreen) { + // Use QS60Data::clientRect to take into account that native keyboard + // might affect ClientRect() return value. if (q->windowState() & Qt::WindowMaximized) { - TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); + TRect r = S60->clientRect(); id->SetExtent(r.iTl, r.Size()); } else if (!q->testAttribute(Qt::WA_Moved) && q->windowType() != Qt::Dialog) { - id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl); + id->SetPosition(S60->clientRect().iTl); } } @@ -1267,7 +1267,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) // normal mode after showing the status pane, the geometry would overlap so we should // move it if it never had an explicit position. if (!wasMoved && S60->statusPane() && decorationsVisible) { - TPoint tl = static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl; + TPoint tl = S60->clientRect().iTl; normalGeometry.setTopLeft(QPoint(tl.iX, tl.iY)); } #endif diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index d5ae364..27b1bf2 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -198,12 +198,12 @@ qpa { symbian { SOURCES += \ - painting/qpaintengine_s60.cpp \ + painting/qpaintengine_raster_symbian.cpp \ painting/qregion_s60.cpp \ painting/qcolormap_s60.cpp HEADERS += \ - painting/qpaintengine_s60_p.h + painting/qpaintengine_raster_symbian_p.h } x11|embedded|qpa { diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index d4a8015..04e45d2 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -54,7 +54,7 @@ # include <QtGui/private/qapplication_p.h> #endif #ifdef Q_OS_SYMBIAN -# include <private/qpixmap_s60_p.h> +# include <private/qpixmap_raster_symbian_p.h> # include <private/qgraphicssystemex_symbian_p.h> #else # include <private/qgraphicssystemex_p.h> @@ -80,7 +80,7 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ #elif defined(Q_WS_QPA) return QApplicationPrivate::platformIntegration()->createPixmapData(type); #elif defined(Q_OS_SYMBIAN) - return new QS60PixmapData(type); + return new QSymbianRasterPixmapData(type); #elif !defined(Q_WS_QWS) #error QGraphicsSystem::createDefaultPixmapData() not implemented #endif diff --git a/src/gui/painting/qgraphicssystem_raster.cpp b/src/gui/painting/qgraphicssystem_raster.cpp index 0edbe9f..addfff7 100644 --- a/src/gui/painting/qgraphicssystem_raster.cpp +++ b/src/gui/painting/qgraphicssystem_raster.cpp @@ -42,7 +42,7 @@ #include "qgraphicssystem_raster_p.h" #ifdef Q_OS_SYMBIAN -#include "private/qpixmap_s60_p.h" +#include "private/qpixmap_raster_symbian_p.h" #include "private/qwindowsurface_s60_p.h" #else #include "private/qpixmap_raster_p.h" @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QPixmapData *QRasterGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const { #ifdef Q_OS_SYMBIAN - return new QS60PixmapData(type); + return new QSymbianRasterPixmapData(type); #else return new QRasterPixmapData(type); #endif diff --git a/src/gui/painting/qpaintengine_s60.cpp b/src/gui/painting/qpaintengine_raster_symbian.cpp index 091e2e6..3b27077 100644 --- a/src/gui/painting/qpaintengine_s60.cpp +++ b/src/gui/painting/qpaintengine_raster_symbian.cpp @@ -38,29 +38,30 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include <private/qpaintengine_s60_p.h> -#include <private/qpixmap_s60_p.h> + +#include <private/qpaintengine_raster_symbian_p.h> +#include <private/qpixmap_raster_symbian_p.h> #include <private/qt_s60_p.h> #include <private/qvolatileimage_p.h> QT_BEGIN_NAMESPACE -class QS60PaintEnginePrivate : public QRasterPaintEnginePrivate +class QSymbianRasterPaintEnginePrivate : public QRasterPaintEnginePrivate { public: - QS60PaintEnginePrivate() {} + QSymbianRasterPaintEnginePrivate() {} }; -QS60PaintEngine::QS60PaintEngine(QPaintDevice *device, QS60PixmapData *data) - : QRasterPaintEngine(*(new QS60PaintEnginePrivate), device), pixmapData(data) +QSymbianRasterPaintEngine::QSymbianRasterPaintEngine(QPaintDevice *device, QSymbianRasterPixmapData *data) + : QRasterPaintEngine(*(new QSymbianRasterPaintEnginePrivate), device), pixmapData(data) { } -bool QS60PaintEngine::begin(QPaintDevice *device) +bool QSymbianRasterPaintEngine::begin(QPaintDevice *device) { - Q_D(QS60PaintEngine); + Q_D(QSymbianRasterPaintEngine); - if (pixmapData->classId() == QPixmapData::RasterClass) { + if (pixmapData && pixmapData->classId() == QPixmapData::RasterClass) { pixmapData->beginDataAccess(); bool ret = QRasterPaintEngine::begin(device); // Make sure QPaintEngine::paintDevice() returns the proper device. @@ -69,13 +70,12 @@ bool QS60PaintEngine::begin(QPaintDevice *device) d->pdev = device; return ret; } - return QRasterPaintEngine::begin(device); } -bool QS60PaintEngine::end() +bool QSymbianRasterPaintEngine::end() { - if (pixmapData->classId() == QPixmapData::RasterClass) { + if (pixmapData && pixmapData->classId() == QPixmapData::RasterClass) { bool ret = QRasterPaintEngine::end(); pixmapData->endDataAccess(); return ret; @@ -83,50 +83,51 @@ bool QS60PaintEngine::end() return QRasterPaintEngine::end(); } -void QS60PaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) +void QSymbianRasterPaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) { if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { - QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); + QSymbianRasterPixmapData *srcData = static_cast<QSymbianRasterPixmapData *>(pm.pixmapData()); srcData->beginDataAccess(); QRasterPaintEngine::drawPixmap(p, pm); srcData->endDataAccess(); } else { - void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); - if (nativeData) { - QVolatileImage *img = static_cast<QVolatileImage *>(nativeData); - img->beginDataAccess(); - QRasterPaintEngine::drawImage(p, img->imageRef()); - img->endDataAccess(true); + QVolatileImage img = pm.pixmapData()->toVolatileImage(); + if (!img.isNull()) { + img.beginDataAccess(); + // imageRef() would detach and since we received the QVolatileImage + // from toVolatileImage() by value, it would cause a copy which + // would ruin our goal. So use constImageRef() instead. + QRasterPaintEngine::drawImage(p, img.constImageRef()); + img.endDataAccess(true); } else { QRasterPaintEngine::drawPixmap(p, pm); } } } -void QS60PaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) +void QSymbianRasterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) { if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { - QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); + QSymbianRasterPixmapData *srcData = static_cast<QSymbianRasterPixmapData *>(pm.pixmapData()); srcData->beginDataAccess(); QRasterPaintEngine::drawPixmap(r, pm, sr); srcData->endDataAccess(); } else { - void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); - if (nativeData) { - QVolatileImage *img = static_cast<QVolatileImage *>(nativeData); - img->beginDataAccess(); - QRasterPaintEngine::drawImage(r, img->imageRef(), sr); - img->endDataAccess(true); + QVolatileImage img = pm.pixmapData()->toVolatileImage(); + if (!img.isNull()) { + img.beginDataAccess(); + QRasterPaintEngine::drawImage(r, img.constImageRef(), sr); + img.endDataAccess(true); } else { QRasterPaintEngine::drawPixmap(r, pm, sr); } } } -void QS60PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) +void QSymbianRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) { if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { - QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); + QSymbianRasterPixmapData *srcData = static_cast<QSymbianRasterPixmapData *>(pm.pixmapData()); srcData->beginDataAccess(); QRasterPaintEngine::drawTiledPixmap(r, pm, sr); srcData->endDataAccess(); @@ -135,7 +136,8 @@ void QS60PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const } } -void QS60PaintEngine::prepare(QImage *image) +// used by QSymbianRasterPixmapData::beginDataAccess() +void QSymbianRasterPaintEngine::prepare(QImage *image) { QRasterBuffer *buffer = d_func()->rasterBuffer.data(); if (buffer) diff --git a/src/gui/painting/qpaintengine_s60_p.h b/src/gui/painting/qpaintengine_raster_symbian_p.h index 2a3b443..cb51ecb 100644 --- a/src/gui/painting/qpaintengine_s60_p.h +++ b/src/gui/painting/qpaintengine_raster_symbian_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QPAINTENGINE_S60_P_H -#define QPAINTENGINE_S60_P_H +#ifndef QPAINTENGINE_RASTER_SYMBIAN_P_H +#define QPAINTENGINE_RASTER_SYMBIAN_P_H // // W A R N I N G @@ -57,15 +57,15 @@ QT_BEGIN_NAMESPACE -class QS60PaintEnginePrivate; -class QS60PixmapData; +class QSymbianRasterPaintEnginePrivate; +class QSymbianRasterPixmapData; -class QS60PaintEngine : public QRasterPaintEngine +class QSymbianRasterPaintEngine : public QRasterPaintEngine { - Q_DECLARE_PRIVATE(QS60PaintEngine) + Q_DECLARE_PRIVATE(QSymbianRasterPaintEngine) public: - QS60PaintEngine(QPaintDevice *device, QS60PixmapData* data); + QSymbianRasterPaintEngine(QPaintDevice *device, QSymbianRasterPixmapData *data = 0); bool begin(QPaintDevice *device); bool end(); @@ -76,9 +76,9 @@ public: void prepare(QImage* image); private: - QS60PixmapData *pixmapData; + QSymbianRasterPixmapData *pixmapData; }; QT_END_NAMESPACE -#endif // QPAINTENGINE_S60_P_H +#endif // QPAINTENGINE_RASTER_SYMBIAN_P_H diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 8801d75..d1ac926 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -44,7 +44,7 @@ #include <QtGui/qpaintdevice.h> #include <private/qwidget_p.h> #include <private/qwindowsurface_s60_p.h> -#include <private/qpixmap_s60_p.h> +#include <private/qpixmap_raster_symbian_p.h> #include <private/qt_s60_p.h> #include <private/qapplication_p.h> #include <private/qdrawhelper_p.h> @@ -92,7 +92,7 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget) Q_CHECK_PTR(bitmap); qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) ); - QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType); + QSymbianRasterPixmapData *data = new QSymbianRasterPixmapData(QPixmapData::PixmapType); if (data) { data->fromSymbianBitmap(bitmap, true); d_ptr->device = QPixmap(data); @@ -131,7 +131,7 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn) QWidgetPrivate *windowPrivate = qt_widget_private(window()); if (!windowPrivate->isOpaque || blitWriteAlpha(windowPrivate)) { - QS60PixmapData *pixmapData = static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data()); + QSymbianRasterPixmapData *pixmapData = static_cast<QSymbianRasterPixmapData *>(d_ptr->device.data_ptr().data()); TDisplayMode mode = displayMode(false); if (pixmapData->cfbsBitmap->DisplayMode() != mode) @@ -169,7 +169,7 @@ QImage* QS60WindowSurface::buffer(const QWidget *widget) return 0; const QPoint off = offset(widget); - QImage *img = &(static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data())->image); + QImage *img = &(static_cast<QSymbianRasterPixmapData *>(d_ptr->device.data_ptr().data())->image); QRect rect(off, widget->size()); rect &= QRect(QPoint(), img->size()); @@ -217,7 +217,7 @@ bool QS60WindowSurface::scroll(const QRegion &area, int dx, int dy) if (d_ptr->device.isNull()) return false; - QS60PixmapData *data = static_cast<QS60PixmapData*>(d_ptr->device.data_ptr().data()); + QSymbianRasterPixmapData *data = static_cast<QSymbianRasterPixmapData*>(d_ptr->device.data_ptr().data()); data->scroll(dx, dy, rect); return true; @@ -233,7 +233,7 @@ void QS60WindowSurface::setGeometry(const QRect& rect) if (rect == geometry()) return; - QS60PixmapData *data = static_cast<QS60PixmapData*>(d_ptr->device.data_ptr().data()); + QSymbianRasterPixmapData *data = static_cast<QSymbianRasterPixmapData*>(d_ptr->device.data_ptr().data()); data->resize(rect.width(), rect.height()); QWindowSurface::setGeometry(rect); @@ -246,7 +246,7 @@ QWindowSurface::WindowSurfaceFeatures QS60WindowSurface::features() const CFbsBitmap* QS60WindowSurface::symbianBitmap() const { - QS60PixmapData *data = static_cast<QS60PixmapData*>(d_ptr->device.data_ptr().data()); + QSymbianRasterPixmapData *data = static_cast<QSymbianRasterPixmapData*>(d_ptr->device.data_ptr().data()); return data->cfbsBitmap; } diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index bfd1825..ec97f7b 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -316,7 +316,21 @@ TRect QS60MainAppUi::ApplicationRect() const */ void QS60MainAppUi::HandleScreenDeviceChangedL() { + // This function triggers AppUi relayout which also generates + // HandleStatusPaneSizeChange(). We don't want to handle + // status pane resizes at this point because it causes + // Qt window resize and thus EGL surface resize in the middle of + // incomplete layout process causing unnecessary overhead. + // To prevent status pane resize handling while layout is still + // in progress, we guard relayouting with handleStatusPaneResizeNotifications + // flag. QSymbianControl checks this flag before doing Qt window + // resize due to status pane change. + // Eventually when layout is ready, Symbian framework calls + // HandleResourceChangeL(KEikDynamicLayoutVariantSwitch) which triggers + // resize to Qt window and to its EGL surface. + S60->handleStatusPaneResizeNotifications = false; QS60MainAppUiBase::HandleScreenDeviceChangedL(); + S60->handleStatusPaneResizeNotifications = true; } /*! diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index e5171d8..ad0e151 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -5292,7 +5292,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti pixmap = QIcon::fromTheme(QLatin1String("media-seek-backward")).pixmap(16); break; case SP_MediaSkipForward: - pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16); + pixmap = QIcon::fromTheme(QLatin1String("media-skip-forward")).pixmap(16); break; case SP_MediaSkipBackward: pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16); diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 219b963..b0ea0d1 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -101,9 +101,12 @@ const int QS60StylePrivate::m_numberOfLayouts = const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** -{7,0,-909,0,0,2,0,5,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,11,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, -{7,0,-909,0,0,2,0,5,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,13,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, -{9,0,-909,0,0,2,0,5,-1,34,99,76,51,51,25,352,-909,-909,-909,29,25,7,0,0,43,34,42,76,7,7,2,-909,-909,0,9,14,0,23,39,30,30,37,37,9,391,40,0,-909,-909,-909,-909,0,0,29,2,-909,0,0,-909,29,-909,-909,-909,-909,115,37,96,48,96,19,19,9,1,25,-909,9,101,24,9,0,7,7,7,16,7,7,-909,3,-909,-909,-909,-909,9,9,3,1,184} +{5,0,-909,0,0,2,0,2,-1,7,12,22,15,15,7,198,-909,-909,-909,20,13,2,0,0,21,7,18,30,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1,106,30,30}, +{5,0,-909,0,0,1,0,2,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,28,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1,106,30,30}, +{7,0,-909,0,0,2,0,5,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,11,0,0,32,25,72,44,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,3,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135,30,30}, +{7,0,-909,0,0,2,0,5,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,13,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,3,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135,30,30}, +{7,0,-909,0,0,2,0,2,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106,30,30}, +{9,0,-909,0,0,2,0,5,-1,30,99,76,51,51,25,352,-909,-909,-909,29,25,7,0,0,43,34,42,76,7,7,2,-909,-909,0,9,14,0,23,39,30,30,37,37,9,391,40,0,-909,-909,-909,-909,0,0,29,2,-909,0,0,-909,29,-909,-909,-909,-909,115,37,96,48,96,2,2,9,1,25,-909,9,101,24,9,0,7,7,7,16,7,7,-909,3,-909,-909,-909,-909,9,9,3,1,184,30,30} // *** End of generated data *** }; diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index 6993bf4..8ec5eb9 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -57,7 +57,9 @@ enum { PM_FrameCornerHeight, PM_BoldLineWidth, PM_ThinLineWidth, - PM_MessageBoxHeight + PM_MessageBoxHeight, + PM_CbaIconWidth, + PM_CbaIconHeight }; class QS60StylePrivate; diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 1cf069b..62c4b00 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE const int MAX_NON_CUSTOM_PIXELMETRICS = 92; -const int CUSTOMVALUESCOUNT = 5; +const int CUSTOMVALUESCOUNT = 7; const int MAX_PIXELMETRICS = MAX_NON_CUSTOM_PIXELMETRICS + CUSTOMVALUESCOUNT; diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 58d70a4..2d2710c 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -45,7 +45,7 @@ #include "qstyleoption.h" #include "qstyle.h" #include "private/qt_s60_p.h" -#include "private/qpixmap_s60_p.h" +#include "private/qpixmap_raster_symbian_p.h" #include "private/qcore_symbian_p.h" #include "private/qvolatileimage_p.h" #include "qapplication.h" @@ -1059,6 +1059,14 @@ void QS60StyleModeSpecifics::frameIdAndCenterId(QS60StylePrivate::SkinFrameEleme centerId.Set(KAknsIIDQsnFrPopupCenterSubmenu); frameId.Set(KAknsIIDQsnFrPopupSub); break; + case QS60StylePrivate::SF_SettingsList: + // Starting from S60_5_3, the root theme has been changed so that KAknsIIDQsnFrSetOpt is empty. + // Set the theme ID to None, to avoid theme server trying to draw the empty frame. + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_2) { + centerId.Set(KAknsIIDNone); + frameId.Set(KAknsIIDNone); + } + break; case QS60StylePrivate::SF_PanelBackground: // remove center piece for panel graphics, so that only border is drawn centerId.Set(KAknsIIDNone); diff --git a/src/gui/text/qfont_s60.cpp b/src/gui/text/qfont_s60.cpp index e0f4bad..0fc8a97 100644 --- a/src/gui/text/qfont_s60.cpp +++ b/src/gui/text/qfont_s60.cpp @@ -42,7 +42,7 @@ #include "qfont.h" #include "qfont_p.h" #include <private/qt_s60_p.h> -#include <private/qpixmap_s60_p.h> +#include <private/qpixmap_raster_symbian_p.h> #include "qmutex.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/text/qfontdatabase_mac.cpp b/src/gui/text/qfontdatabase_mac.cpp index 724dbf6..60cf586 100644 --- a/src/gui/text/qfontdatabase_mac.cpp +++ b/src/gui/text/qfontdatabase_mac.cpp @@ -388,7 +388,6 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) if(fnt->data.isEmpty()) { #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) { - extern OSErr qt_mac_create_fsref(const QString &, FSRef *); // qglobal.cpp FSRef ref; if(qt_mac_create_fsref(fnt->fileName, &ref) != noErr) return; @@ -398,7 +397,6 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) #endif { #ifndef Q_WS_MAC64 - extern Q_CORE_EXPORT OSErr qt_mac_create_fsspec(const QString &, FSSpec *); // global.cpp FSSpec spec; if(qt_mac_create_fsspec(fnt->fileName, &spec) != noErr) return; diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index eea075f..980b5de 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -47,7 +47,7 @@ #include "qdesktopservices.h" #include "qtemporaryfile.h" #include "qtextcodec.h" -#include <private/qpixmap_s60_p.h> +#include <private/qpixmap_raster_symbian_p.h> #include <private/qt_s60_p.h> #include "qendian.h" #include <private/qcore_symbian_p.h> diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 2bcee01..b0824cb 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -46,7 +46,7 @@ #include <private/qapplication_p.h> #include "qimage.h" #include <private/qt_s60_p.h> -#include <private/qpixmap_s60_p.h> +#include <private/qpixmap_raster_symbian_p.h> #include <e32base.h> #include <e32std.h> |