summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2009-09-24 10:23:50 (GMT)
committerJanne Anttila <janne.anttila@digia.com>2009-09-24 10:23:50 (GMT)
commit135e02d11becc8ee434524756d85221244c185ee (patch)
treeb9acabb3424321fa3eb5f6390e0f87c3fdee91f7 /src/gui
parent39d0ded8f6e94df2a08876ee1cf00253ef2b7de3 (diff)
parentd57e2f4d01534f44dde629b71398783777fdad4e (diff)
downloadQt-135e02d11becc8ee434524756d85221244c185ee.zip
Qt-135e02d11becc8ee434524756d85221244c185ee.tar.gz
Qt-135e02d11becc8ee434524756d85221244c185ee.tar.bz2
Merge branch '4.6' of git@scm.dev.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/embedded/qscreenmulti_qws.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicslayout.cpp18
-rw-r--r--src/gui/graphicsview/qgraphicslayout.h1
-rw-r--r--src/gui/image/qpixmap.h6
-rw-r--r--src/gui/image/qpixmap_s60.cpp410
-rw-r--r--src/gui/image/qpixmap_s60_p.h21
-rw-r--r--src/gui/image/qpixmapdata.cpp5
-rw-r--r--src/gui/image/qpixmapdata_p.h15
-rw-r--r--src/gui/kernel/qapplication.h14
-rw-r--r--src/gui/kernel/qapplication_p.h5
-rw-r--r--src/gui/kernel/qapplication_s60.cpp123
-rw-r--r--src/gui/kernel/qsound_qws.cpp2
-rw-r--r--src/gui/kernel/qt_s60_p.h7
-rw-r--r--src/gui/kernel/qwidget.cpp2
-rw-r--r--src/gui/kernel/qwidget_p.h1
-rw-r--r--src/gui/kernel/qwidget_s60.cpp14
-rw-r--r--src/gui/s60framework/qs60mainapplication.cpp81
-rw-r--r--src/gui/s60framework/qs60mainapplication.h79
-rw-r--r--src/gui/s60framework/qs60mainapplication_p.h58
-rw-r--r--src/gui/s60framework/qs60mainappui.cpp181
-rw-r--r--src/gui/s60framework/qs60mainappui.h86
-rw-r--r--src/gui/s60framework/qs60mainappui_p.h130
-rw-r--r--src/gui/s60framework/qs60maindocument.cpp99
-rw-r--r--src/gui/s60framework/qs60maindocument.h80
-rw-r--r--src/gui/s60framework/qs60maindocument_p.h139
-rw-r--r--src/gui/s60framework/s60framework.pri5
-rw-r--r--src/gui/styles/gtksymbols.cpp3
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp22
-rw-r--r--src/gui/styles/qwindowsstyle.cpp2
-rw-r--r--src/gui/styles/qwindowsxpstyle.cpp11
-rw-r--r--src/gui/text/qtextcursor.cpp8
31 files changed, 924 insertions, 708 deletions
diff --git a/src/gui/embedded/qscreenmulti_qws.cpp b/src/gui/embedded/qscreenmulti_qws.cpp
index beeb6aa..3a23ca2 100644
--- a/src/gui/embedded/qscreenmulti_qws.cpp
+++ b/src/gui/embedded/qscreenmulti_qws.cpp
@@ -46,6 +46,7 @@
#include <qlist.h>
#include <qstringlist.h>
#include <qwidget.h>
+#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -230,6 +231,9 @@ bool QMultiScreen::connect(const QString &displaySpec)
QStringList specs = dSpec.split(QLatin1Char(' '), QString::SkipEmptyParts);
foreach (QString spec, specs) {
const int id = getDisplayId(spec);
+ if (spec.startsWith("vnc:", Qt::CaseInsensitive)) {
+ spec.append(":noDisablePainting");
+ }
const QPoint offset = filterDisplayOffset(spec);
QScreen *s = qt_get_screen(id, spec.toLatin1().constData());
s->setOffset(offset);
diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp
index 0e4df71..f9800bc 100644
--- a/src/gui/graphicsview/qgraphicslayout.cpp
+++ b/src/gui/graphicsview/qgraphicslayout.cpp
@@ -419,6 +419,24 @@ void QGraphicsLayout::widgetEvent(QEvent *e)
\sa itemAt(), count()
*/
+/*!
+ This function is a convenience function provided for custom layouts, and will go through
+ all items in the layout and reparent their graphics items to the closest QGraphicsWidget
+ ancestor of the layout.
+
+ If \a layoutItem is already in a different layout, it will be removed from that layout.
+
+ If custom layouts want special behaviour they can ignore to use this function, and implement
+ their own behaviour.
+
+ \sa graphicsItem()
+ */
+void QGraphicsLayout::addChildLayoutItem(QGraphicsLayoutItem *layoutItem)
+{
+ Q_D(QGraphicsLayout);
+ d->addChildLayoutItem(layoutItem);
+}
+
QT_END_NAMESPACE
#endif //QT_NO_GRAPHICSVIEW
diff --git a/src/gui/graphicsview/qgraphicslayout.h b/src/gui/graphicsview/qgraphicslayout.h
index e872980..e214a62 100644
--- a/src/gui/graphicsview/qgraphicslayout.h
+++ b/src/gui/graphicsview/qgraphicslayout.h
@@ -78,6 +78,7 @@ public:
protected:
QGraphicsLayout(QGraphicsLayoutPrivate &, QGraphicsLayoutItem *);
+ void addChildLayoutItem(QGraphicsLayoutItem *layoutItem);
private:
Q_DISABLE_COPY(QGraphicsLayout)
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index 2ed65ea..a891637 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -161,10 +161,8 @@ public:
#endif
#if defined(Q_OS_SYMBIAN)
- enum ConversionMode { CopyData, DuplicateHandle };
-
- CFbsBitmap *toSymbianCFbsBitmap(ConversionMode mode = DuplicateHandle) const;
- static QPixmap fromSymbianCFbsBitmap(CFbsBitmap *bitmap, ConversionMode mode = DuplicateHandle);
+ CFbsBitmap *toSymbianCFbsBitmap() const;
+ static QPixmap fromSymbianCFbsBitmap(CFbsBitmap *bitmap);
RSgImage* toSymbianRSgImage() const;
static QPixmap fromSymbianRSgImage(RSgImage *sgImage);
#endif
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 303e923..cab6116 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -297,231 +297,55 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h)
}
/*!
- \enum QPixmap::ConversionMode
-
- \bold{Symbian only:} This enum defines how the conversion between \c
- CFbsBitmap and QPixmap is performed.
-
- \warning This enum is only available on Symbian.
-
- \value CopyData Copied CFbsBitmap data.
-
- \value DuplicateHandle Duplicates CFbsBitmap handle. This also means
- that pixmap data will be explicitly shared.
-
- \sa fromSymbianCFbsBitmap(), toSymbianCFbsBitmap()
-*/
-
-
-/*!
- \fn CFbsBitmap *QPixmap::toSymbianCFbsBitmap(ConversionMode mode)
+ \fn CFbsBitmap *QPixmap::toSymbianCFbsBitmap()
\since 4.6
- Creates \c CFbsBitmap that is equivalent to the QPixmap, based on
- the given \a mode. If the creation then this function returns 0.
+ Creates a \c CFbsBitmap that is equivalent to the QPixmap. Internally this
+ function will try to duplicate the handle instead of copying the data,
+ however in scenarios where this is not possible the data will be copied.
+ If the creation fails or the pixmap is null, then this function returns 0.
It is the caller's responsibility to release the \c CFbsBitmap data
after use either by deleting the bitmap or calling \c Reset().
- \warning On S60 3.1 and S60 3.2 conversion mode will always be CopyData
- if QPixmap pixels have alpha values.
+ \warning On S60 3.1 and S60 3.2, semi-transparent pixmaps are always copied
+ and not duplicated.
\warning This function is only available on Symbian OS.
\sa fromSymbianCFbsBitmap()
*/
-CFbsBitmap *QPixmap::toSymbianCFbsBitmap(ConversionMode mode) const
+CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const
{
- QS60PixmapData *s60data = static_cast<QS60PixmapData *>(data.data());
-
- if (isNull() || !s60data->cfbsBitmap)
+ QPixmapData *data = pixmapData();
+ if (data->isNull())
return 0;
- bool convertToArgb32 = false;
-
- QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
- if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) {
- // Convert argb32_premultiplied to argb32 since Symbian 9.2 and Symbian 9.3 do
- // not support premultipied format.
-
- if (s60data->image.format() == QImage::Format_ARGB32_Premultiplied) {
- mode = CopyData;
- convertToArgb32 = true;
- }
- }
-
- CFbsBitmap *bitmap = 0;
-
- TDisplayMode displayMode = s60data->cfbsBitmap->DisplayMode();
-
- if(displayMode == EGray2) {
- //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid
- //So invert mono bitmaps so that masks work correctly.
- s60data->image.invertPixels();
- mode = CopyData;
- }
-
- if (mode == CopyData) {
- QImage source;
-
- if (convertToArgb32) {
- source = s60data->image.convertToFormat(QImage::Format_ARGB32);
- displayMode = EColor16MA;
- } else {
- source = s60data->image;
- }
-
- CFbsBitmap *newBitmap = createSymbianCFbsBitmap(TSize(source.width(), source.height()), displayMode);
- const uchar *sptr = source.bits();
- s60data->symbianBitmapDataAccess->beginDataAccess(newBitmap);
-
- uchar *dptr = (uchar*)newBitmap->DataAddress();
- Mem::Copy(dptr, sptr, source.numBytes());
-
- s60data->symbianBitmapDataAccess->endDataAccess(newBitmap);
-
- bitmap = newBitmap;
- } else {
-
- QT_TRAP_THROWING(bitmap = new (ELeave) CFbsBitmap);
-
- TInt err = bitmap->Duplicate(s60data->cfbsBitmap->Handle());
- if (err != KErrNone) {
- qWarning("Could not duplicate CFbsBitmap");
- delete bitmap;
- bitmap = 0;
- }
- }
-
- if(displayMode == EGray2) {
- // restore pixels
- s60data->image.invertPixels();
- }
-
- return bitmap;
+ return reinterpret_cast<CFbsBitmap*>(data->toNativeType(QPixmapData::FbsBitmap));
}
/*!
- \fn QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap, ConversionMode mode)
+ \fn QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap)
\since 4.6
- Creates a QPixmap from native \c CFbsBitmap \a bitmap. The conversion
- is based on the specified \a mode. Conversion mode is always QPixmap::CopyData
- if given \a bitmap does not have display mode of TDisplayMode::EGray2,
- \c TDisplayMode::EColor16MU or \c TDisplayMode::EColor16MAP.
-
+ Creates a QPixmap from a \c CFbsBitmap \a bitmap. Internally this function
+ will try to duplicate the bitmap handle instead of copying the data, however
+ in scenarios where this is not possible the data will be copied.
+ To be sure that QPixmap does not modify your original instance, you should
+ make a copy of your \c CFbsBitmap before calling this function.
If the CFbsBitmap is not valid this function will return a null QPixmap.
\warning This function is only available on Symbian OS.
\sa toSymbianCFbsBitmap(), {QPixmap#Pixmap Conversion}{Pixmap Conversion}
*/
-QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap, ConversionMode mode)
+QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap)
{
- if (bitmap) {
-
- bool deleteSourceBitmap = false;
-
-#ifdef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE
-
- // Rasterize extended bitmaps
-
- TUid extendedBitmapType = bitmap->ExtendedBitmapType();
- if (extendedBitmapType != KNullUid) {
- CFbsBitmap *rasterBitmap = createSymbianCFbsBitmap(bitmap->SizeInPixels(), EColor16MA);
-
- CFbsBitmapDevice *rasterBitmapDev = 0;
- QT_TRAP_THROWING(rasterBitmapDev = CFbsBitmapDevice::NewL(rasterBitmap));
-
- CFbsBitGc *rasterBitmapGc = 0;
- TInt err = rasterBitmapDev->CreateContext(rasterBitmapGc);
- if (err != KErrNone) {
- delete rasterBitmap;
- delete rasterBitmapDev;
- rasterBitmapDev = 0;
- return QPixmap();
- }
-
- rasterBitmapGc->BitBlt(TPoint( 0, 0), bitmap);
-
- bitmap = rasterBitmap;
-
- delete rasterBitmapDev;
- delete rasterBitmapGc;
-
- rasterBitmapDev = 0;
- rasterBitmapGc = 0;
-
- deleteSourceBitmap = true;
- }
-#endif
-
-
- deleteSourceBitmap = bitmap->IsCompressedInRAM();
- CFbsBitmap *sourceBitmap = uncompress(bitmap);
-
- TDisplayMode displayMode = sourceBitmap->DisplayMode();
- QImage::Format format = qt_TDisplayMode2Format(displayMode);
-
- QImage::Format opaqueFormat = QNativeImage::systemFormat();
- QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied;
-
- if (format != opaqueFormat && format != alphaFormat && format != QImage::Format_MonoLSB)
- mode = CopyData;
-
-
- QPixmapData::PixelType type = (format!=QImage::Format_MonoLSB)
- ? QPixmapData::PixmapType
- : QPixmapData::BitmapType;
-
- QS60PixmapData *pixmapData = 0;
-
- if (mode == CopyData) {
-
- TSize size = sourceBitmap->SizeInPixels();
-
- QSymbianBitmapDataAccess da;
- da.beginDataAccess(sourceBitmap);
- uchar *bytes = (uchar*)sourceBitmap->DataAddress();
- QImage img = QImage(bytes, size.iWidth, size.iHeight, format);
- da.endDataAccess(sourceBitmap);
-
- pixmapData = new QS60PixmapData(type);
- pixmapData->fromImage(img, Qt::AutoColor);
-
- if(deleteSourceBitmap)
- delete sourceBitmap;
-
- if(displayMode == EGray2) {
- //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid
- //So invert mono bitmaps so that masks work correctly.
- pixmapData->image.invertPixels();
- }
- } else {
- CFbsBitmap* duplicate = 0;
- QT_TRAP_THROWING(duplicate = new (ELeave) CFbsBitmap);
-
- TInt err = duplicate->Duplicate(sourceBitmap->Handle());
- if (err != KErrNone) {
- qWarning("Could not duplicate CFbsBitmap");
-
- if(deleteSourceBitmap)
- delete sourceBitmap;
-
- delete duplicate;
- return QPixmap();
- }
-
- pixmapData = new QS60PixmapData(type);
- pixmapData->fromSymbianBitmap(duplicate);
-
- if(deleteSourceBitmap)
- delete sourceBitmap;
- }
-
- return QPixmap(pixmapData);
- }
+ if (!bitmap)
+ return QPixmap();
- return QPixmap();
+ QPixmap pixmap;
+ pixmap.pixmapData()->fromNativeType(reinterpret_cast<void*>(bitmap), QPixmapData::FbsBitmap);
+ return pixmap;
}
QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
@@ -921,7 +745,7 @@ QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage)
return QPixmap();
QPixmap pixmap;
- pixmap.pixmapData()->fromRSgImage(sgImage);
+ pixmap.pixmapData()->fromNativeType(reinterpret_cast<void*>(sgImage), QPixmapData::SgImage);
return pixmap;
}
@@ -949,9 +773,193 @@ RSgImage *QPixmap::toSymbianRSgImage() const
if (isNull())
return 0;
- RSgImage *sgImage = pixmapData()->toRSgImage();
+ RSgImage *sgImage = reinterpret_cast<RSgImage*>(pixmapData()->toNativeType(QPixmapData::SgImage));
return sgImage;
}
+void* QS60PixmapData::toNativeType(NativeType type)
+{
+ if (type == QPixmapData::SgImage) {
+ return 0;
+ } else if (type == QPixmapData::FbsBitmap) {
+
+ if (isNull() || !cfbsBitmap)
+ return 0;
+
+ bool convertToArgb32 = false;
+ bool needsCopy = false;
+
+ QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
+ if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) {
+ // Convert argb32_premultiplied to argb32 since Symbian 9.2 and Symbian 9.3 do
+ // not support premultipied format.
+
+ if (image.format() == QImage::Format_ARGB32_Premultiplied) {
+ needsCopy = true;
+ convertToArgb32 = true;
+ }
+ }
+
+ CFbsBitmap *bitmap = 0;
+
+ TDisplayMode displayMode = cfbsBitmap->DisplayMode();
+
+ if(displayMode == EGray2) {
+ //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid
+ //So invert mono bitmaps so that masks work correctly.
+ image.invertPixels();
+ needsCopy = true;
+ }
+
+ if (needsCopy) {
+ QImage source;
+
+ if (convertToArgb32) {
+ source = image.convertToFormat(QImage::Format_ARGB32);
+ displayMode = EColor16MA;
+ } else {
+ source = image;
+ }
+
+ CFbsBitmap *newBitmap = createSymbianCFbsBitmap(TSize(source.width(), source.height()), displayMode);
+ const uchar *sptr = source.bits();
+ symbianBitmapDataAccess->beginDataAccess(newBitmap);
+
+ uchar *dptr = (uchar*)newBitmap->DataAddress();
+ Mem::Copy(dptr, sptr, source.numBytes());
+
+ symbianBitmapDataAccess->endDataAccess(newBitmap);
+
+ bitmap = newBitmap;
+ } else {
+
+ QT_TRAP_THROWING(bitmap = new (ELeave) CFbsBitmap);
+
+ TInt err = bitmap->Duplicate(cfbsBitmap->Handle());
+ if (err != KErrNone) {
+ qWarning("Could not duplicate CFbsBitmap");
+ delete bitmap;
+ bitmap = 0;
+ }
+ }
+
+ if(displayMode == EGray2) {
+ // restore pixels
+ image.invertPixels();
+ }
+
+ return reinterpret_cast<void*>(bitmap);
+
+ }
+
+ return 0;
+}
+
+void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType)
+{
+ if (nativeType == QPixmapData::SgImage) {
+ return;
+ } else if (nativeType == QPixmapData::FbsBitmap && pixmap) {
+
+ CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap*>(pixmap);
+
+ bool deleteSourceBitmap = false;
+ bool needsCopy = false;
+
+#ifdef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE
+
+ // Rasterize extended bitmaps
+
+ TUid extendedBitmapType = bitmap->ExtendedBitmapType();
+ if (extendedBitmapType != KNullUid) {
+ CFbsBitmap *rasterBitmap = createSymbianCFbsBitmap(bitmap->SizeInPixels(), EColor16MA);
+
+ CFbsBitmapDevice *rasterBitmapDev = 0;
+ QT_TRAP_THROWING(rasterBitmapDev = CFbsBitmapDevice::NewL(rasterBitmap));
+
+ CFbsBitGc *rasterBitmapGc = 0;
+ TInt err = rasterBitmapDev->CreateContext(rasterBitmapGc);
+ if (err != KErrNone) {
+ delete rasterBitmap;
+ delete rasterBitmapDev;
+ rasterBitmapDev = 0;
+ return;
+ }
+
+ rasterBitmapGc->BitBlt(TPoint( 0, 0), bitmap);
+
+ bitmap = rasterBitmap;
+
+ delete rasterBitmapDev;
+ delete rasterBitmapGc;
+
+ rasterBitmapDev = 0;
+ rasterBitmapGc = 0;
+
+ deleteSourceBitmap = true;
+ }
+#endif
+
+
+ deleteSourceBitmap = bitmap->IsCompressedInRAM();
+ CFbsBitmap *sourceBitmap = uncompress(bitmap);
+
+ TDisplayMode displayMode = sourceBitmap->DisplayMode();
+ QImage::Format format = qt_TDisplayMode2Format(displayMode);
+
+ QImage::Format opaqueFormat = QNativeImage::systemFormat();
+ QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied;
+
+ if (format != opaqueFormat && format != alphaFormat && format != QImage::Format_MonoLSB)
+ needsCopy = true;
+
+
+ type = (format != QImage::Format_MonoLSB)
+ ? QPixmapData::PixmapType
+ : QPixmapData::BitmapType;
+
+ if (needsCopy) {
+
+ TSize size = sourceBitmap->SizeInPixels();
+
+ QSymbianBitmapDataAccess da;
+ da.beginDataAccess(sourceBitmap);
+ uchar *bytes = (uchar*)sourceBitmap->DataAddress();
+ QImage img = QImage(bytes, size.iWidth, size.iHeight, format);
+ da.endDataAccess(sourceBitmap);
+
+ fromImage(img, Qt::AutoColor);
+
+ if(deleteSourceBitmap)
+ delete sourceBitmap;
+
+ if(displayMode == EGray2) {
+ //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid
+ //So invert mono bitmaps so that masks work correctly.
+ image.invertPixels();
+ }
+ } else {
+ CFbsBitmap* duplicate = 0;
+ QT_TRAP_THROWING(duplicate = new (ELeave) CFbsBitmap);
+
+ TInt err = duplicate->Duplicate(sourceBitmap->Handle());
+ if (err != KErrNone) {
+ qWarning("Could not duplicate CFbsBitmap");
+
+ if(deleteSourceBitmap)
+ delete sourceBitmap;
+
+ delete duplicate;
+ return;
+ }
+
+ fromSymbianBitmap(duplicate);
+
+ if(deleteSourceBitmap)
+ delete sourceBitmap;
+ }
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h
index 21f1bb3..4498c05 100644
--- a/src/gui/image/qpixmap_s60_p.h
+++ b/src/gui/image/qpixmap_s60_p.h
@@ -66,17 +66,17 @@ class QSymbianBitmapDataAccess;
class QSymbianFbsHeapLock
{
public:
-
+
enum LockAction {
Unlock
};
-
+
explicit QSymbianFbsHeapLock(LockAction a);
~QSymbianFbsHeapLock();
- void relock();
-
+ void relock();
+
private:
-
+
LockAction action;
bool wasLocked;
};
@@ -102,13 +102,16 @@ public:
void beginDataAccess();
void endDataAccess(bool readOnly=false) const;
+ void* toNativeType(NativeType type);
+ void fromNativeType(void* pixmap, NativeType type);
+
private:
- void release();
- void fromSymbianBitmap(CFbsBitmap* bitmap);
- bool initSymbianBitmapContext();
+ void release();
+ void fromSymbianBitmap(CFbsBitmap* bitmap);
+ bool initSymbianBitmapContext();
QSymbianBitmapDataAccess *symbianBitmapDataAccess;
-
+
CFbsBitmap *cfbsBitmap;
CFbsBitmapDevice *bitmapDevice;
CBitmapContext *bitmapContext;
diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp
index 65899a4..93fc2eb 100644
--- a/src/gui/image/qpixmapdata.cpp
+++ b/src/gui/image/qpixmapdata.cpp
@@ -224,14 +224,15 @@ QImage* QPixmapData::buffer()
}
#if defined(Q_OS_SYMBIAN)
-RSgImage* QPixmapData::toRSgImage()
+void* QPixmapData::toNativeType(NativeType /* type */)
{
return 0;
}
-void QPixmapData::fromRSgImage(RSgImage* rsgImage)
+void QPixmapData::fromNativeType(void* /* pixmap */, NativeType /* typre */)
{
return;
}
#endif
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h
index 5920a06..3e85236 100644
--- a/src/gui/image/qpixmapdata_p.h
+++ b/src/gui/image/qpixmapdata_p.h
@@ -56,10 +56,6 @@
#include <QtGui/qpixmap.h>
#include <QtCore/qatomic.h>
-#if defined(Q_OS_SYMBIAN)
-class RSgImage;
-#endif
-
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QPixmapData
@@ -70,6 +66,12 @@ public:
// Must match QPixmap::Type
PixmapType, BitmapType
};
+#if defined(Q_OS_SYMBIAN)
+ enum NativeType {
+ FbsBitmap,
+ SgImage
+ };
+#endif
enum ClassId { RasterClass, X11Class, MacClass, DirectFBClass,
OpenGLClass, OpenVGClass, CustomClass = 1024 };
@@ -114,8 +116,8 @@ public:
inline bool isNull() const { return is_null; }
#if defined(Q_OS_SYMBIAN)
- virtual RSgImage* toRSgImage();
- virtual void fromRSgImage(RSgImage* rsgImage);
+ virtual void* toNativeType(NativeType type);
+ virtual void fromNativeType(void* pixmap, NativeType type);
#endif
protected:
@@ -129,6 +131,7 @@ private:
friend class QPixmap;
friend class QGLContextPrivate;
friend class QX11PixmapData;
+ friend class QS60PixmapData;
friend class QGLTextureCache; //Needs to check the reference count
friend class QExplicitlySharedDataPointer<QPixmapData>;
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index 0562251..5f21a56 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -64,6 +64,9 @@ QT_BEGIN_HEADER
#if defined(Q_OS_SYMBIAN)
class TWsEvent;
#endif
+#if defined(Q_WS_S60)
+class CApaApplication;
+#endif
QT_BEGIN_NAMESPACE
@@ -114,6 +117,11 @@ class Q_GUI_EXPORT QApplication : public QCoreApplication
public:
enum Type { Tty, GuiClient, GuiServer };
+
+#ifdef Q_WS_S60
+ typedef CApaApplication * (*QS60MainApplicationFactory)();
+#endif
+
#ifndef qdoc
QApplication(int &argc, char **argv, int = QT_VERSION);
QApplication(int &argc, char **argv, bool GUIenabled, int = QT_VERSION);
@@ -122,6 +130,9 @@ public:
QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0, int = QT_VERSION);
QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0, int = QT_VERSION);
#endif
+#if defined(Q_WS_S60)
+ QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int = QT_VERSION);
+#endif
#endif
virtual ~QApplication();
@@ -357,6 +368,9 @@ public:
QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0);
QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0);
#endif
+#if defined(Q_WS_S60) || defined(qdoc)
+ QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv);
+#endif
#endif
private:
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 707caaa..aec21fd 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -576,6 +576,11 @@ public:
void _q_readRX71MultiTouchEvents();
#endif
+#if defined(Q_WS_S60)
+ int maxTouchPressure;
+ QList<QTouchEvent::TouchPoint> appAllTouchPoints;
+#endif
+
private:
#ifdef Q_WS_QWS
QMap<const QScreen*, QRect> maxWindowRects;
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index a5d07fd..27e8602 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -368,8 +368,81 @@ void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, cons
m_previousEventLongTap = true;
}
+#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
+void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent *event)
+{
+ QApplicationPrivate *d = QApplicationPrivate::instance();
+
+ QRect screenGeometry = qApp->desktop()->screenGeometry(qwidget);
+
+ while (d->appAllTouchPoints.count() <= event->PointerNumber())
+ d->appAllTouchPoints.append(QTouchEvent::TouchPoint(d->appAllTouchPoints.count()));
+
+ Qt::TouchPointStates allStates = 0;
+ for (int i = 0; i < d->appAllTouchPoints.count(); ++i) {
+ QTouchEvent::TouchPoint &touchPoint = d->appAllTouchPoints[i];
+
+ if (touchPoint.id() == event->PointerNumber()) {
+ Qt::TouchPointStates state;
+ switch (event->iType) {
+ case TPointerEvent::EButton1Down:
+ case TPointerEvent::EEnterHighPressure:
+ state = Qt::TouchPointPressed;
+ break;
+ case TPointerEvent::EButton1Up:
+ case TPointerEvent::EExitCloseProximity:
+ state = Qt::TouchPointReleased;
+ break;
+ case TPointerEvent::EDrag:
+ state = Qt::TouchPointMoved;
+ break;
+ default:
+ // how likely is this to happen?
+ state = Qt::TouchPointStationary;
+ break;
+ }
+ if (event->PointerNumber() == 0)
+ state |= Qt::TouchPointPrimary;
+ touchPoint.setState(state);
+
+ QPointF screenPos = QPointF(event->iPosition.iX, event->iPosition.iY);
+ touchPoint.setScreenPos(screenPos);
+ touchPoint.setNormalizedPos(QPointF(screenPos.x() / screenGeometry.width(),
+ screenPos.y() / screenGeometry.height()));
+
+ touchPoint.setPressure(event->Pressure() / qreal(d->maxTouchPressure));
+ } else if (touchPoint.state() != Qt::TouchPointReleased) {
+ // all other active touch points should be marked as stationary
+ touchPoint.setState(Qt::TouchPointStationary);
+ }
+
+ allStates |= touchPoint.state();
+ }
+
+ if ((allStates & Qt::TouchPointStateMask) == Qt::TouchPointReleased) {
+ // all touch points released
+ d->appAllTouchPoints.clear();
+ }
+
+ QApplicationPrivate::translateRawTouchEvent(qwidget,
+ QTouchEvent::TouchScreen,
+ d->appAllTouchPoints);
+}
+#endif
+
void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent)
{
+#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
+ if (pEvent.IsAdvancedPointerEvent()) {
+ const TAdvancedPointerEvent *advancedPointerEvent = pEvent.AdvancedPointerEvent();
+ translateAdvancedPointerEvent(advancedPointerEvent);
+ if (advancedPointerEvent->PointerNumber() != 0) {
+ // only send mouse events for the first touch point
+ return;
+ }
+ }
+#endif
+
m_longTapDetector->PointerEventL(pEvent);
QT_TRYCATCH_LEAVING(HandlePointerEvent(pEvent));
}
@@ -817,11 +890,50 @@ TTypeUid::Ptr QSymbianControl::MopSupplyObject(TTypeUid id)
return CCoeControl::MopSupplyObject(id);
}
+/*!
+ \typedef QApplication::QS60MainApplicationFactory
+
+ This is a typedef for a pointer to a function with the following
+ signature:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 47
+
+ \sa QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **)
+*/
+
+/*!
+ \since 4.6
+
+ Creates an application using the application factory given in
+ \a factory, and using \a argc command line arguments in \a argv.
+ \a factory can be leaving, but the error will be converted to a
+ standard exception.
+
+ This function is only available on S60.
+*/
+QApplication::QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv)
+ : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient))
+{
+ Q_D(QApplication);
+ S60->s60ApplicationFactory = factory;
+ d->construct();
+}
+
+QApplication::QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int _internal)
+ : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient))
+{
+ Q_D(QApplication);
+ S60->s60ApplicationFactory = factory;
+ d->construct();
+ QApplicationPrivate::app_compile_version = _internal;
+}
+
void qt_init(QApplicationPrivate * /* priv */, int)
{
if (!CCoeEnv::Static()) {
// The S60 framework has not been initalized. We need to do it.
- TApaApplicationFactory factory(NewApplication);
+ TApaApplicationFactory factory(S60->s60ApplicationFactory ?
+ S60->s60ApplicationFactory : newS60Application);
CApaCommandLine* commandLine = 0;
TInt err = CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine);
// After this construction, CEikonEnv will be available from CEikonEnv::Static().
@@ -1441,9 +1553,14 @@ TUint QApplicationPrivate::resolveS60ScanCode(TInt scanCode, TUint keysym)
}
}
-
void QApplicationPrivate::initializeMultitouch_sys()
-{ }
+{
+#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
+ if (HAL::Get(HALData::EPointer3DMaxPressure, maxTouchPressure) != KErrNone)
+ maxTouchPressure = KMaxTInt;
+#endif
+}
+
void QApplicationPrivate::cleanupMultitouch_sys()
{ }
diff --git a/src/gui/kernel/qsound_qws.cpp b/src/gui/kernel/qsound_qws.cpp
index 33a0922..8595faa 100644
--- a/src/gui/kernel/qsound_qws.cpp
+++ b/src/gui/kernel/qsound_qws.cpp
@@ -279,7 +279,7 @@ QAuBucketQWS::QAuBucketQWS( QAuServerQWS *server, QSound *sound, QObject* parent
sound->setObjectName( m_id.toString() );
- m_channel = new QCopChannel(QLatin1String("QPE/QSound/") + m_id ), this );
+ m_channel = new QCopChannel(QLatin1String("QPE/QSound/") + m_id, this );
connect( m_channel, SIGNAL(received(QString,QByteArray)),
this, SLOT(processMessage(QString,QByteArray)) );
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index aa39f9d..0d48634 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -61,6 +61,7 @@
#include "QtGui/qimage.h"
#include "QtGui/qevent.h"
#include "qpointer.h"
+#include "qapplication.h"
#include <w32std.h>
#include <coecntrl.h>
#include <eikenv.h>
@@ -77,7 +78,7 @@
QT_BEGIN_NAMESPACE
// Application internal HandleResourceChangeL events,
-// system evens seems to start with 0x10
+// system events seems to start with 0x10
const TInt KInternalStatusPaneChange = 0x50000000;
class QS60Data
@@ -107,6 +108,7 @@ public:
int mouseInteractionEnabled : 1;
int virtualMouseRequired : 1;
int qtOwnsS60Environment : 1;
+ QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type
static inline void updateScreenSize();
static inline RWsSession& wsSession();
static inline RWindowGroup& windowGroup();
@@ -167,6 +169,9 @@ private:
TKeyResponse sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent);
bool sendMouseEvent(QWidget *widget, QMouseEvent *mEvent);
void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation );
+#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
+ void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event);
+#endif
private:
QWidget *qwidget;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 6f5781c..53ef682 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -10397,7 +10397,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
break;
case Qt::WA_AcceptTouchEvents:
-#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
+#if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_WS_S60)
if (on)
d->registerTouchWindow();
#endif
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 5a9c48c..296c5b1 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -693,6 +693,7 @@ public:
static QWidget *keyboardGrabber;
void s60UpdateIsOpaque();
void reparentChildren();
+ void registerTouchWindow();
#endif
};
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 4fef020..6b5e9b7 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -299,6 +299,9 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
destroyw->ControlEnv()->AppUi()->RemoveFromStack(destroyw);
CBase::Delete(destroyw);
}
+
+ if (q->testAttribute(Qt::WA_AcceptTouchEvents))
+ registerTouchWindow();
}
@@ -800,6 +803,17 @@ void QWidgetPrivate::setMask_sys(const QRegion& /* region */)
}
+void QWidgetPrivate::registerTouchWindow()
+{
+#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
+ Q_Q(QWidget);
+ if (q->testAttribute(Qt::WA_WState_Created) && q->windowType() != Qt::Desktop) {
+ RWindow *rwindow = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow());
+ rwindow->EnableAdvancedPointers();
+ }
+#endif
+}
+
int QWidget::metric(PaintDeviceMetric m) const
{
Q_D(const QWidget);
diff --git a/src/gui/s60framework/qs60mainapplication.cpp b/src/gui/s60framework/qs60mainapplication.cpp
index f12ed1f..54fb3b1 100644
--- a/src/gui/s60framework/qs60mainapplication.cpp
+++ b/src/gui/s60framework/qs60mainapplication.cpp
@@ -41,53 +41,86 @@
// INCLUDE FILES
#include <exception>
-#include "qs60maindocument_p.h"
+#include "qs60maindocument.h"
#include "qs60mainapplication_p.h"
+#include "qs60mainapplication.h"
#include <bautils.h>
#include <coemain.h>
QT_BEGIN_NAMESPACE
/**
- * factory function to create the QtS60Main application class
+ * factory function to create the QS60Main application class
*/
-CApaApplication* NewApplication()
+CApaApplication *newS60Application()
{
return new QS60MainApplication;
}
-// ============================ MEMBER FUNCTIONS ===============================
+_LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main.rsc");
+/*!
+ * \class QS60MainApplication
+ * \obsolete
+ * \since 4.6
+ * \brief Helper class for S60 migration
+ *
+ * The QS60MainApplication provides a helper class for use in migrating from existing S60 based
+ * applications to Qt based applications. It is used in the exact same way as the
+ * \c CAknApplication class from Symbian, but internally provides extensions used by Qt.
+ *
+ * When modifying old S60 applications that rely on implementing functions in \c CAknApplication,
+ * the class should be modified to inherit from this class instead of \c CAknApplication. Then the
+ * application can choose to override only certain functions. To make Qt use the custom application
+ * objects, pass a factory function to
+ * QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **).
+ *
+ * For more information on \c CAknApplication, please see the S60 documentation.
+ *
+ * Unlike other Qt classes, QS60MainApplication behaves like an S60 class, and can throw Symbian
+ * leaves.
+ *
+ * \sa QS60MainDocument, QS60MainAppUi, QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **)
+ */
-_LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main.rsc");
+/*!
+ * \brief Contructs an instance of QS60MainApplication.
+ */
+QS60MainApplication::QS60MainApplication()
+{
+}
-// -----------------------------------------------------------------------------
-// QS60MainApplication::CreateDocumentL()
-// Creates CApaDocument object
-// -----------------------------------------------------------------------------
-//
-CApaDocument* QS60MainApplication::CreateDocumentL()
+/*!
+ * \brief Destroys the QS60MainApplication.
+ */
+QS60MainApplication::~QS60MainApplication()
+{
+}
+
+/*!
+ * \brief Creates an instance of QS60MainDocument.
+ *
+ * \sa QS60MainDocument
+ */
+CApaDocument *QS60MainApplication::CreateDocumentL()
{
// Create an QtS60Main document, and return a pointer to it
- return (static_cast<CApaDocument*>(QS60MainDocument::NewL(*this)));
+ return new (ELeave) QS60MainDocument(*this);
}
-// -----------------------------------------------------------------------------
-// QS60MainApplication::AppDllUid()
-// Returns application UID
-// -----------------------------------------------------------------------------
-//
+
+/*!
+ * \brief Returns the UID of the application.
+ */
TUid QS60MainApplication::AppDllUid() const
{
// Return the UID for the QtS60Main application
- return ProcessUid();
+ return RProcess().SecureId().operator TUid();
}
-// -----------------------------------------------------------------------------
-// QS60MainApplication::ResourceFileName()
-// Returns application resource filename
-// -----------------------------------------------------------------------------
-//
+/*!
+ * \brief Returns the resource file name.
+ */
TFileName QS60MainApplication::ResourceFileName() const
{
TFindFile finder(iCoeEnv->FsSession());
@@ -98,5 +131,3 @@ TFileName QS60MainApplication::ResourceFileName() const
}
QT_END_NAMESPACE
-
-// End of File
diff --git a/src/gui/s60framework/qs60mainapplication.h b/src/gui/s60framework/qs60mainapplication.h
new file mode 100644
index 0000000..457764c
--- /dev/null
+++ b/src/gui/s60framework/qs60mainapplication.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Symbian application wrapper of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QS60MAINAPPLICATION_H
+#define QS60MAINAPPLICATION_H
+
+#include <qglobal.h>
+
+#ifdef Q_WS_S60
+
+#include <aknapp.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class Q_GUI_EXPORT QS60MainApplication : public CAknApplication
+{
+public:
+ QS60MainApplication();
+ // The virtuals are for qdoc.
+ virtual ~QS60MainApplication();
+
+ virtual TUid AppDllUid() const;
+
+ virtual TFileName ResourceFileName() const;
+
+protected:
+
+ virtual CApaDocument *CreateDocumentL();
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // Q_WS_S60
+
+#endif // QS60MAINAPPLICATION_H
diff --git a/src/gui/s60framework/qs60mainapplication_p.h b/src/gui/s60framework/qs60mainapplication_p.h
index 40562da..863d872 100644
--- a/src/gui/s60framework/qs60mainapplication_p.h
+++ b/src/gui/s60framework/qs60mainapplication_p.h
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the Symbian application wrapper of the Qt Toolkit.
+** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -46,67 +46,21 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
+// This file is not part of the Qt API. It exists for the convenience
+// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
+// file may change from version to version without notice, or even be removed.
//
// We mean it.
//
-// INCLUDES
-#include <aknapp.h>
-
#include <qglobal.h>
-// CLASS DECLARATION
+#include <apparc.h>
QT_BEGIN_NAMESPACE
-CApaApplication* NewApplication();
-
-static TUid ProcessUid()
-{
- RProcess me;
- TSecureId securId = me.SecureId();
- me.Close();
- return securId.operator TUid();
-}
-
-/**
-* QS60MainApplication application class.
-* Provides factory to create concrete document object.
-* An instance of QS60MainApplication is the application part of the
-* AVKON application framework for the QtS60Main example application.
-*/
-class QS60MainApplication : public CAknApplication
-{
-public: // Functions from base classes
-
- /**
- * From CApaApplication, AppDllUid.
- * @return Application's UID (KUidQtS60MainApp).
- */
- TUid AppDllUid() const;
-
- /**
- * From CApaApplication, ResourceFileName
- * @return Application's resource filename (KUidQtS60MainApp).
- */
- TFileName ResourceFileName() const;
-
-protected: // Functions from base classes
-
- /**
- * From CApaApplication, CreateDocumentL.
- * Creates QS60MainDocument document object. The returned
- * pointer in not owned by the QS60MainApplication object.
- * @return A pointer to the created document object.
- */
- CApaDocument* CreateDocumentL();
-};
+CApaApplication *newS60Application();
QT_END_NAMESPACE
#endif // QS60MAINAPPLICATION_P_H
-
-// End of File
diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp
index 4f5227c..9e2333b 100644
--- a/src/gui/s60framework/qs60mainappui.cpp
+++ b/src/gui/s60framework/qs60mainappui.cpp
@@ -48,21 +48,42 @@
#include <s60main.rsg>
#include <avkon.rsg>
-#include "qs60mainappui_p.h"
+#include "qs60mainappui.h"
#include <QtGui/qapplication.h>
#include <QtGui/qmenu.h>
#include <QtGui/private/qt_s60_p.h>
QT_BEGIN_NAMESPACE
-// ============================ MEMBER FUNCTIONS ===============================
-
-
-// -----------------------------------------------------------------------------
-// QS60MainAppUi::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
+/*!
+ * \class QS60MainAppUi
+ * \obsolete
+ * \since 4.6
+ * \brief Helper class for S60 migration
+ *
+ * The QS60MainAppUi provides a helper class for use in migrating from existing S60 based
+ * applications to Qt based applications. It is used in the exact same way as the
+ * \c CAknAppUi class from Symbian, but internally provides extensions used by Qt.
+ *
+ * When modifying old S60 applications that rely on implementing functions in \c CAknAppUi,
+ * the class should be modified to inherit from this class instead of \c CAknAppUi. Then the
+ * application can choose to override only certain functions.
+ *
+ * For more information on \c CAknAppUi, please see the S60 documentation.
+ *
+ * Unlike other Qt classes, QS60MainAppUi behaves like an S60 class, and can throw Symbian
+ * leaves.
+ *
+ * \sa QS60MainDocument, QS60MainApplication
+ */
+
+/*!
+ * \brief Second phase Symbian constructor.
+ *
+ * Constructs all the elements of the class that can cause a leave to happen.
+ *
+ * If you override this function, you should call the base class implementation as well.
+ */
void QS60MainAppUi::ConstructL()
{
// Cone's heap and handle checks on app destruction are not suitable for Qt apps, as many
@@ -80,104 +101,142 @@ void QS60MainAppUi::ConstructL()
nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
}
-// -----------------------------------------------------------------------------
-// QS60MainAppUi::QS60MainAppUi()
-// C++ default constructor can NOT contain any code, that might leave.
-// -----------------------------------------------------------------------------
-//
+/*!
+ * \brief Contructs an instance of QS60MainAppUi.
+ */
QS60MainAppUi::QS60MainAppUi()
{
// No implementation required
}
-// -----------------------------------------------------------------------------
-// QS60MainAppUi::~QS60MainAppUi()
-// Destructor.
-// -----------------------------------------------------------------------------
-//
+/*!
+ * \brief Destroys the QS60MainAppUi.
+ */
QS60MainAppUi::~QS60MainAppUi()
{
}
-// -----------------------------------------------------------------------------
-// QS60MainAppUi::HandleCommandL()
-// Takes care of command handling.
-// -----------------------------------------------------------------------------
-//
-void QS60MainAppUi::HandleCommandL(TInt aCommand)
+/*!
+ * \brief Handles commands produced by the S60 framework.
+ *
+ * \a command holds the ID of the command to handle, and is S60 specific.
+ *
+ * If you override this function, you should call the base class implementation if you do not
+ * handle the command.
+ */
+void QS60MainAppUi::HandleCommandL(TInt command)
{
if (qApp)
- qApp->symbianHandleCommand(aCommand);
+ QT_TRYCATCH_LEAVING(qApp->symbianHandleCommand(command));
}
-// -----------------------------------------------------------------------------
-// QS60MainAppUi::HandleResourceChangeL()
-// Takes care of event handling.
-// -----------------------------------------------------------------------------
-//
-void QS60MainAppUi::HandleResourceChangeL(TInt aType)
+/*!
+ * \brief Handles a resource change in the S60 framework.
+ *
+ * Resource changes include layout switches. \a type holds the type of resource change that
+ * occurred.
+ *
+ * If you override this function, you should call the base class implementation if you do not
+ * handle the resource change.
+ */
+void QS60MainAppUi::HandleResourceChangeL(TInt type)
{
- CAknAppUi::HandleResourceChangeL(aType);
+ CAknAppUi::HandleResourceChangeL(type);
if (qApp)
- qApp->symbianResourceChange(aType);
+ QT_TRYCATCH_LEAVING(qApp->symbianResourceChange(type));
}
-void QS60MainAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl *control)
+/*!
+ * \brief Handles raw window server events.
+ *
+ * The event type and information is passed in \a event, while the receiving control is passed in
+ * \a destination.
+ *
+ * If you override this function, you should call the base class implementation if you do not
+ * handle the event.
+ */
+void QS60MainAppUi::HandleWsEventL(const TWsEvent& event, CCoeControl *destination)
{
int result = 0;
if (qApp)
QT_TRYCATCH_LEAVING(
- result = qApp->s60ProcessEvent(const_cast<TWsEvent*>(&aEvent))
+ result = qApp->s60ProcessEvent(const_cast<TWsEvent*>(&event))
);
if (result <= 0)
- CAknAppUi::HandleWsEventL(aEvent, control);
+ CAknAppUi::HandleWsEventL(event, destination);
}
-// -----------------------------------------------------------------------------
-// Called by the framework when the application status pane
-// size is changed. Passes the new client rectangle to the
-// AppView
-// -----------------------------------------------------------------------------
-//
+/*!
+ * \brief Handles changes to the status pane size.
+ *
+ * Called by the framework when the application status pane size is changed.
+ *
+ * If you override this function, you should call the base class implementation if you do not
+ * handle the size change.
+ */
void QS60MainAppUi::HandleStatusPaneSizeChange()
{
- HandleResourceChangeL(KInternalStatusPaneChange);
+ TRAP_IGNORE(HandleResourceChangeL(KInternalStatusPaneChange));
HandleStackedControlsResourceChange(KInternalStatusPaneChange);
}
-void QS60MainAppUi::DynInitMenuBarL(TInt, CEikMenuBar *)
+/*!
+ * \brief Dynamically initializes a menu bar.
+ *
+ * The resource associated with the menu is given in \a resourceId, and the actual menu bar is
+ * passed in \a menuBar.
+ *
+ * If you override this function, you should call the base class implementation as well.
+ */
+void QS60MainAppUi::DynInitMenuBarL(TInt /* resourceId */, CEikMenuBar * /* menuBar */)
{
}
-void QS60MainAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane)
+/*!
+ * \brief Dynamically initializes a menu pane.
+ *
+ * The resource associated with the menu is given in \a resourceId, and the actual menu pane is
+ * passed in \a menuPane.
+ *
+ * If you override this function, you should call the base class implementation as well.
+ */
+void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane)
{
- if (aResourceId == R_QT_WRAPPERAPP_MENU) {
- if (aMenuPane->NumberOfItemsInPane() <= 1)
- qt_symbian_show_toplevel(aMenuPane);
-
- } else if (aResourceId != R_AVKON_MENUPANE_FEP_DEFAULT && aResourceId != R_AVKON_MENUPANE_EDITTEXT_DEFAULT && aResourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT) {
- qt_symbian_show_submenu(aMenuPane, aResourceId);
+ if (resourceId == R_QT_WRAPPERAPP_MENU) {
+ if (menuPane->NumberOfItemsInPane() <= 1)
+ QT_TRYCATCH_LEAVING(qt_symbian_show_toplevel(menuPane));
+
+ } else if (resourceId != R_AVKON_MENUPANE_FEP_DEFAULT
+ && resourceId != R_AVKON_MENUPANE_EDITTEXT_DEFAULT
+ && resourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT) {
+ QT_TRYCATCH_LEAVING(qt_symbian_show_submenu(menuPane, resourceId));
}
}
-void QS60MainAppUi::RestoreMenuL(CCoeControl* aMenuWindow, TInt aMenuId, TMenuType aMenuType)
+/*!
+ * \brief Restores a menu window.
+ *
+ * The menu window to restore is given in \a menuWindow. The resource ID and type of menu is given
+ * in \a resourceId and \a menuType, respectively.
+ *
+ * If you override this function, you should call the base class implementation as well.
+ */
+void QS60MainAppUi::RestoreMenuL(CCoeControl* menuWindow, TInt resourceId, TMenuType menuType)
{
- if ((aMenuId == R_QT_WRAPPERAPP_MENUBAR) || (aMenuId == R_AVKON_MENUPANE_FEP_DEFAULT)) {
+ if ((resourceId == R_QT_WRAPPERAPP_MENUBAR) || (resourceId == R_AVKON_MENUPANE_FEP_DEFAULT)) {
TResourceReader reader;
- iCoeEnv->CreateResourceReaderLC(reader, aMenuId);
- aMenuWindow->ConstructFromResourceL(reader);
+ iCoeEnv->CreateResourceReaderLC(reader, resourceId);
+ menuWindow->ConstructFromResourceL(reader);
CleanupStack::PopAndDestroy();
}
- if (aMenuType == EMenuPane)
- DynInitMenuPaneL(aMenuId, (CEikMenuPane*)aMenuWindow);
+ if (menuType == EMenuPane)
+ DynInitMenuPaneL(resourceId, (CEikMenuPane*)menuWindow);
else
- DynInitMenuBarL(aMenuId, (CEikMenuBar*)aMenuWindow);
+ DynInitMenuBarL(resourceId, (CEikMenuBar*)menuWindow);
}
QT_END_NAMESPACE
-
-// End of File
diff --git a/src/gui/s60framework/qs60mainappui.h b/src/gui/s60framework/qs60mainappui.h
new file mode 100644
index 0000000..c2c6ef2
--- /dev/null
+++ b/src/gui/s60framework/qs60mainappui.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Symbian application wrapper of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QS60MAINAPPUI_H
+#define QS60MAINAPPUI_H
+
+#include <qglobal.h>
+
+#ifdef Q_WS_S60
+
+#include <aknappui.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class Q_GUI_EXPORT QS60MainAppUi : public CAknAppUi
+{
+public:
+ QS60MainAppUi();
+ // The virtuals are for qdoc.
+ virtual ~QS60MainAppUi();
+
+ virtual void ConstructL();
+
+ virtual void RestoreMenuL(CCoeControl* menuWindow,TInt resourceId,TMenuType menuType);
+ virtual void DynInitMenuBarL(TInt resourceId, CEikMenuBar *menuBar);
+ virtual void DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane);
+
+ virtual void HandleCommandL( TInt command );
+
+ virtual void HandleResourceChangeL(TInt type);
+
+ virtual void HandleStatusPaneSizeChange();
+
+protected:
+ virtual void HandleWsEventL(const TWsEvent& event, CCoeControl* destination);
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // Q_WS_S60
+
+#endif // QS60MAINAPPUI_H
diff --git a/src/gui/s60framework/qs60mainappui_p.h b/src/gui/s60framework/qs60mainappui_p.h
deleted file mode 100644
index 4b10833..0000000
--- a/src/gui/s60framework/qs60mainappui_p.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Symbian application wrapper of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QS60MAINAPPUI_P_H
-#define QS60MAINAPPUI_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-// INCLUDES
-#include <aknappui.h>
-
-#include <qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-/**
-* QS60MainAppUi application UI class.
-* Interacts with the user through the UI and request message processing
-* from the handler class
-*/
-class QS60MainAppUi : public CAknAppUi
-{
-public: // Constructors and destructor
-
- /**
- * ConstructL.
- * 2nd phase constructor.
- */
- void ConstructL();
-
- /**
- * QS60MainAppUi.
- * C++ default constructor. This needs to be public due to
- * the way the framework constructs the AppUi
- */
- QS60MainAppUi();
-
- /**
- * ~QS60MainAppUi.
- * Virtual Destructor.
- */
- virtual ~QS60MainAppUi();
-
-protected:
- void RestoreMenuL(CCoeControl* aMenuWindow,TInt aMenuId,TMenuType aMenuType);
- void DynInitMenuBarL(TInt aResourceId, CEikMenuBar *aMenuBar);
- void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane);
-
-private: // Functions from base classes
-
- /**
- * From CEikAppUi, HandleCommandL.
- * Takes care of command handling.
- * @param aCommand Command to be handled.
- */
- void HandleCommandL( TInt aCommand );
-
- /**
- * From CAknAppUi, HandleResourceChangeL
- * Handles resource change events such as layout switches in global level.
- * @param aType event type.
- */
- void HandleResourceChangeL(TInt aType);
-
- /**
- * HandleStatusPaneSizeChange.
- * Called by the framework when the application status pane
- * size is changed.
- */
- void HandleStatusPaneSizeChange();
-
-protected:
- void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination);
-};
-
-QT_END_NAMESPACE
-
-#endif // QS60MAINAPPUI_P_H
-
-// End of File
diff --git a/src/gui/s60framework/qs60maindocument.cpp b/src/gui/s60framework/qs60maindocument.cpp
index ba66e98..52595db 100644
--- a/src/gui/s60framework/qs60maindocument.cpp
+++ b/src/gui/s60framework/qs60maindocument.cpp
@@ -39,77 +39,60 @@
**
****************************************************************************/
-// INCLUDE FILES
+#include "qs60mainappui.h"
+#include "qs60maindocument.h"
+
#include <exception>
-#include "qs60mainappui_p.h"
-#include "qs60maindocument_p.h"
QT_BEGIN_NAMESPACE
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// QS60MainDocument::NewL()
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-QS60MainDocument* QS60MainDocument::NewL(CEikApplication& aApp)
-{
- QS60MainDocument* self = NewLC(aApp);
- CleanupStack::Pop(self);
- return self;
-}
-
-// -----------------------------------------------------------------------------
-// QS60MainDocument::NewLC()
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-QS60MainDocument* QS60MainDocument::NewLC(CEikApplication& aApp)
-{
- QS60MainDocument* self = new(ELeave) QS60MainDocument(aApp);
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
-}
-
-// -----------------------------------------------------------------------------
-// QS60MainDocument::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void QS60MainDocument::ConstructL()
-{
- // No implementation required
-}
+/*!
+ * \class QS60MainDocument
+ * \obsolete
+ * \since 4.6
+ * \brief Helper class for S60 migration
+ *
+ * The QS60MainDocument provides a helper class for use in migrating from existing S60 based
+ * applications to Qt based applications. It is used in the exact same way as the
+ * \c CAknDocument class from Symbian, but internally provides extensions used by Qt.
+ *
+ * When modifying old S60 applications that rely on implementing functions in \c CAknDocument,
+ * the class should be modified to inherit from this class instead of \c CAknDocument. Then the
+ * application can choose to override only certain functions.
+ *
+ * For more information on \c CAknDocument, please see the S60 documentation.
+ *
+ * Unlike other Qt classes, QS60MainDocument behaves like an S60 class, and can throw Symbian
+ * leaves.
+ *
+ * \sa QS60MainApplication, QS60MainAppUi
+ */
-// -----------------------------------------------------------------------------
-// QS60MainDocument::QS60MainDocument()
-// C++ default constructor can NOT contain any code, that might leave.
-// -----------------------------------------------------------------------------
-//
-QS60MainDocument::QS60MainDocument(CEikApplication& aApp)
- : CAknDocument(aApp)
+/*!
+ * \brief Constructs an instance of QS60MainDocument.
+ *
+ * \a mainApplication should contain a pointer to a QS60MainApplication instance.
+ */
+QS60MainDocument::QS60MainDocument(CEikApplication& mainApplication)
+ : CAknDocument(mainApplication)
{
// No implementation required
}
-// ---------------------------------------------------------------------------
-// QS60MainDocument::~QS60MainDocument()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
+/*!
+ * \brief Destroys the QS60MainDocument.
+ */
QS60MainDocument::~QS60MainDocument()
{
// No implementation required
}
-// ---------------------------------------------------------------------------
-// QS60MainDocument::CreateAppUiL()
-// Constructs CreateAppUi.
-// ---------------------------------------------------------------------------
-//
-CEikAppUi* QS60MainDocument::CreateAppUiL()
+/*!
+ * \brief Creates an instance of QS60MainAppUi.
+ *
+ * \sa QS60MainAppUi
+ */
+CEikAppUi *QS60MainDocument::CreateAppUiL()
{
// Create the application user interface, and return a pointer to it;
// the framework takes ownership of this object
@@ -117,5 +100,3 @@ CEikAppUi* QS60MainDocument::CreateAppUiL()
}
QT_END_NAMESPACE
-
-// End of File
diff --git a/src/gui/s60framework/qs60maindocument.h b/src/gui/s60framework/qs60maindocument.h
new file mode 100644
index 0000000..366d311
--- /dev/null
+++ b/src/gui/s60framework/qs60maindocument.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Symbian application wrapper of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QS60MAINDOCUMENT_H
+#define QS60MAINDOCUMENT_H
+
+#include <qglobal.h>
+
+#ifdef Q_WS_S60
+
+#include <akndoc.h>
+
+class CEikApplication;
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QS60MainAppUi;
+
+class Q_GUI_EXPORT QS60MainDocument : public CAknDocument
+{
+public:
+
+ QS60MainDocument(CEikApplication &mainApplication);
+ // The virtuals are for qdoc.
+ virtual ~QS60MainDocument();
+
+public:
+
+ virtual CEikAppUi *CreateAppUiL();
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // Q_WS_S60
+
+#endif // QS60MAINDOCUMENT_H
diff --git a/src/gui/s60framework/qs60maindocument_p.h b/src/gui/s60framework/qs60maindocument_p.h
deleted file mode 100644
index d7cee13..0000000
--- a/src/gui/s60framework/qs60maindocument_p.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Symbian application wrapper of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QS60MAINDOCUMENT_P_H
-#define QS60MAINDOCUMENT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-// INCLUDES
-#include <akndoc.h>
-
-#include <qglobal.h>
-
-class CEikApplication;
-
-QT_BEGIN_NAMESPACE
-
-// FORWARD DECLARATIONS
-class QS60MainAppUi;
-
-// CLASS DECLARATION
-
-/**
-* QS60MainDocument application class.
-* An instance of class QS60MainDocument is the Document part of the
-* AVKON application framework for the QtS60Main application.
-*/
-class QS60MainDocument : public CAknDocument
-{
-public: // Constructors and destructor
-
- /**
- * NewL.
- * Two-phased constructor.
- * Construct a QS60MainDocument for the AVKON application aApp
- * using two phase construction, and return a pointer
- * to the created object.
- * @param aApp Application creating this document.
- * @return A pointer to the created instance of QS60MainDocument.
- */
- static QS60MainDocument* NewL( CEikApplication& aApp );
-
- /**
- * NewLC.
- * Two-phased constructor.
- * Construct a QS60MainDocument for the AVKON application aApp
- * using two phase construction, and return a pointer
- * to the created object.
- * @param aApp Application creating this document.
- * @return A pointer to the created instance of QS60MainDocument.
- */
- static QS60MainDocument* NewLC( CEikApplication& aApp );
-
- /**
- * ~QS60MainDocument
- * Virtual Destructor.
- */
- virtual ~QS60MainDocument();
-
-public: // Functions from base classes
-
- /**
- * CreateAppUiL
- * From CEikDocument, CreateAppUiL.
- * Create a QS60MainAppUi object and return a pointer to it.
- * The object returned is owned by the Uikon framework.
- * @return Pointer to created instance of AppUi.
- */
- CEikAppUi* CreateAppUiL();
-
-private: // Constructors
-
- /**
- * ConstructL
- * 2nd phase constructor.
- */
- void ConstructL();
-
- /**
- * QS60MainDocument.
- * C++ default constructor.
- * @param aApp Application creating this document.
- */
- QS60MainDocument( CEikApplication& aApp );
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QS60MAINDOCUMENT_P_H
-
-// End of File
diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri
index f9a6d95..fea74fe 100644
--- a/src/gui/s60framework/s60framework.pri
+++ b/src/gui/s60framework/s60framework.pri
@@ -3,5 +3,6 @@ SOURCES += s60framework/qs60mainapplication.cpp \
s60framework/qs60maindocument.cpp
HEADERS += s60framework/qs60mainapplication_p.h \
- s60framework/qs60mainappui_p.h \
- s60framework/qs60maindocument_p.h
+ s60framework/qs60mainapplication.h \
+ s60framework/qs60mainappui.h \
+ s60framework/qs60maindocument.h
diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp
index 23d25bd..1cb0ca4 100644
--- a/src/gui/styles/gtksymbols.cpp
+++ b/src/gui/styles/gtksymbols.cpp
@@ -211,7 +211,8 @@ static QString classPath(GtkWidget *widget)
static void resolveGtk()
{
- QLibrary libgtk(QLS("gtk-x11-2.0"));
+ // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0
+ QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0);
QGtk::gtk_init = (Ptr_gtk_init)libgtk.resolve("gtk_init");
QGtk::gtk_window_new = (Ptr_gtk_window_new)libgtk.resolve("gtk_window_new");
QGtk::gtk_style_attach = (Ptr_gtk_style_attach)libgtk.resolve("gtk_style_attach");
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index e33b255..0f3a88b 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -1759,7 +1759,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QWidget *w, const QStyleOption *o
QStyle::SubControl subControl = knownPseudoElements[pseudoElement].subControl;
if (!(complex->activeSubControls & subControl))
- state = QStyle::State(state & (QStyle::State_Enabled | QStyle::State_Horizontal));
+ state &= (QStyle::State_Enabled | QStyle::State_Horizontal | QStyle::State_HasFocus);
}
switch (pseudoElement) {
@@ -3136,19 +3136,25 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
rule.drawRule(p, opt->rect);
- QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderGroove);
- if (!subRule.hasDrawable()) {
- baseStyle()->drawComplexControl(cc, slider, p, w);
- return;
+ QRenderRule grooveSubRule = renderRule(w, opt, PseudoElement_SliderGroove);
+ QRenderRule handleSubRule = renderRule(w, opt, PseudoElement_SliderHandle);
+ if (!grooveSubRule.hasDrawable()) {
+ QStyleOptionSlider slOpt(*slider);
+ bool handleHasRule = handleSubRule.hasDrawable();
+ // If the style specifies a different handler rule, draw the groove without the handler.
+ if (handleHasRule)
+ slOpt.subControls &= ~SC_SliderHandle;
+ baseStyle()->drawComplexControl(cc, &slOpt, p, w);
+ if (!handleHasRule)
+ return;
}
QRect gr = subControlRect(cc, opt, SC_SliderGroove, w);
if (slider->subControls & SC_SliderGroove) {
- subRule.drawRule(p, gr);
+ grooveSubRule.drawRule(p, gr);
}
if (slider->subControls & SC_SliderHandle) {
- QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderHandle);
QRect hr = subControlRect(cc, opt, SC_SliderHandle, w);
QRenderRule subRule1 = renderRule(w, opt, PseudoElement_SliderSubPage);
@@ -3169,7 +3175,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
subRule2.drawRule(p, r);
}
- subRule.drawRule(p, subRule.boxRect(hr, Margin));
+ handleSubRule.drawRule(p, grooveSubRule.boxRect(hr, Margin));
}
if (slider->subControls & SC_SliderTickmarks) {
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index 2ed9303..0f72440 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -3030,6 +3030,8 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
ar.adjust(2, 2, -2, -2);
if (opt->state & State_Enabled)
flags |= State_Enabled;
+ if (opt->state & State_HasFocus)
+ flags |= State_HasFocus;
if (sunkenArrow)
flags |= State_Sunken;
diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp
index 0dc1832..9c374d8 100644
--- a/src/gui/styles/qwindowsxpstyle.cpp
+++ b/src/gui/styles/qwindowsxpstyle.cpp
@@ -621,12 +621,21 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
QMatrix m = painter->matrix();
bool complexXForm = m.m11() != 1.0 || m.m22() != 1.0 || m.m12() != 0.0 || m.m21() != 0.0;
+ bool translucentToplevel = false;
+ QPaintDevice *pdev = painter->device();
+ if (pdev->devType() == QInternal::Widget) {
+ QWidget *win = ((QWidget *) pdev)->window();
+ translucentToplevel = win->testAttribute(Qt::WA_TranslucentBackground);
+ }
+
bool useFallback = painter->paintEngine()->getDC() == 0
|| painter->opacity() != 1.0
|| themeData.rotate
|| complexXForm
|| themeData.mirrorVertically
- || (themeData.mirrorHorizontally && pDrawThemeBackgroundEx == 0);
+ || (themeData.mirrorHorizontally && pDrawThemeBackgroundEx == 0)
+ || translucentToplevel;
+
if (!useFallback)
drawBackgroundDirectly(themeData);
else
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 8b85d2d..ce62834 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -92,8 +92,12 @@ QTextCursorPrivate::AdjustResult QTextCursorPrivate::adjustPosition(int position
{
QTextCursorPrivate::AdjustResult result = QTextCursorPrivate::CursorMoved;
// not(!) <= , so that inserting text adjusts the cursor correctly
- if (position < positionOfChange ||
- (position == positionOfChange && op == QTextUndoCommand::KeepCursor)) {
+ if (position < positionOfChange
+ || (position == positionOfChange
+ && (op == QTextUndoCommand::KeepCursor
+ || anchor < position)
+ )
+ ) {
result = CursorUnchanged;
} else {
if (charsAddedOrRemoved < 0 && position < positionOfChange - charsAddedOrRemoved)