summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2011-10-18 08:38:05 +0200
committerQt by Nokia <qt-info@nokia.com>2011-10-19 08:52:05 +0200
commitae30d71413595b3cb0550e047132ea07510d35a3 (patch)
tree02be6adbab70a8121512c64ab4afd45f2075099d /src
parent3c2aea92cf7794c05895141dfb2db8e206ce36b5 (diff)
Widgets: Remove Symbian-specific code.
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Change-Id: Ieee43d6650f5b1968fc7d77e618096701ffef941 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/dialogs/dialogs.pri11
-rw-r--r--src/widgets/dialogs/qcolordialog_symbian.cpp107
-rw-r--r--src/widgets/dialogs/qfiledialog_symbian.cpp199
-rw-r--r--src/widgets/kernel/kernel.pri30
-rw-r--r--src/widgets/kernel/symbian.pri7
-rw-r--r--src/widgets/platforms/s60/qapplication_s60.cpp2715
-rw-r--r--src/widgets/platforms/s60/qclipboard_s60.cpp331
-rw-r--r--src/widgets/platforms/s60/qcoefepinputcontext_p.h176
-rw-r--r--src/widgets/platforms/s60/qcoefepinputcontext_s60.cpp1200
-rw-r--r--src/widgets/platforms/s60/qcolormap_s60.cpp107
-rw-r--r--src/widgets/platforms/s60/qcursor_s60.cpp533
-rw-r--r--src/widgets/platforms/s60/qdesktopwidget_s60.cpp316
-rw-r--r--src/widgets/platforms/s60/qdnd_s60.cpp359
-rw-r--r--src/widgets/platforms/s60/qeventdispatcher_s60.cpp196
-rw-r--r--src/widgets/platforms/s60/qeventdispatcher_s60_p.h127
-rw-r--r--src/widgets/platforms/s60/qfont_s60.cpp136
-rw-r--r--src/widgets/platforms/s60/qfontdatabase_s60.cpp1099
-rw-r--r--src/widgets/platforms/s60/qfontengine_s60.cpp566
-rw-r--r--src/widgets/platforms/s60/qfontengine_s60_p.h167
-rw-r--r--src/widgets/platforms/s60/qkeymapper_s60.cpp258
-rw-r--r--src/widgets/platforms/s60/qpaintengine_s60.cpp145
-rw-r--r--src/widgets/platforms/s60/qpaintengine_s60_p.h84
-rw-r--r--src/widgets/platforms/s60/qpixmap_s60.cpp1040
-rw-r--r--src/widgets/platforms/s60/qpixmap_s60_p.h141
-rw-r--r--src/widgets/platforms/s60/qregion_s60.cpp52
-rw-r--r--src/widgets/platforms/s60/qsoftkeymanager_s60.cpp440
-rw-r--r--src/widgets/platforms/s60/qsoftkeymanager_s60_p.h113
-rw-r--r--src/widgets/platforms/s60/qsound_s60.cpp224
-rw-r--r--src/widgets/platforms/s60/qt_s60_p.h651
-rw-r--r--src/widgets/platforms/s60/qwidget_s60.cpp1464
-rw-r--r--src/widgets/s60framework/qs60mainapplication.cpp167
-rw-r--r--src/widgets/s60framework/qs60mainapplication.h93
-rw-r--r--src/widgets/s60framework/qs60mainapplication_p.h66
-rw-r--r--src/widgets/s60framework/qs60mainappui.cpp432
-rw-r--r--src/widgets/s60framework/qs60mainappui.h152
-rw-r--r--src/widgets/s60framework/qs60maindocument.cpp140
-rw-r--r--src/widgets/s60framework/qs60maindocument.h92
-rw-r--r--src/widgets/s60framework/s60framework.pri10
-rw-r--r--src/widgets/s60framework/s60main.rss85
-rw-r--r--src/widgets/styles/images/defaults60theme.blobbin74127 -> 0 bytes
-rw-r--r--src/widgets/styles/qs60style.cpp3619
-rw-r--r--src/widgets/styles/qs60style.h118
-rw-r--r--src/widgets/styles/qs60style_p.h638
-rw-r--r--src/widgets/styles/qs60style_s60.cpp1591
-rw-r--r--src/widgets/styles/qs60style_simulated.cpp457
-rw-r--r--src/widgets/styles/qs60style_stub.cpp131
-rw-r--r--src/widgets/styles/qstyle_s60.qrc137
-rw-r--r--src/widgets/styles/qstyle_s60_simulated.qrc6
-rw-r--r--src/widgets/styles/styles.pri27
-rw-r--r--src/widgets/symbian/images/blank.pngbin91 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/busy12.pngbin253 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/busy3.pngbin251 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/busy6.pngbin253 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/busy9.pngbin255 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/closehand.pngbin190 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/cross.pngbin145 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/forbidden.pngbin256 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/handpoint.pngbin230 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/ibeam.pngbin176 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/openhand.pngbin201 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/pointer.pngbin222 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/sizeall.pngbin188 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/sizebdiag.pngbin192 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/sizefdiag.pngbin197 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/sizehor.pngbin175 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/sizever.pngbin171 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/splith.pngbin206 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/splitv.pngbin205 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/uparrow.pngbin157 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/wait1.pngbin219 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/wait10.pngbin220 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/wait11.pngbin220 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/wait12.pngbin213 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/wait2.pngbin219 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/wait3.pngbin210 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/wait4.pngbin215 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/wait5.pngbin217 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/wait6.pngbin213 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/wait7.pngbin215 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/wait8.pngbin217 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/wait9.pngbin209 -> 0 bytes
-rw-r--r--src/widgets/symbian/images/whatsthis.pngbin254 -> 0 bytes
-rw-r--r--src/widgets/symbian/qsymbianevent.cpp177
-rw-r--r--src/widgets/symbian/qsymbianevent.h108
-rw-r--r--src/widgets/symbian/symbianresources.qrc37
-rw-r--r--src/widgets/util/util.pri16
-rw-r--r--src/widgets/widgets.pro13
-rw-r--r--src/widgets/widgets/qmenu_symbian.cpp464
-rw-r--r--src/widgets/widgets/widgets.pri4
89 files changed, 2 insertions, 21772 deletions
diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri
index 41d81b8afc..fbff8c742c 100644
--- a/src/widgets/dialogs/dialogs.pri
+++ b/src/widgets/dialogs/dialogs.pri
@@ -52,7 +52,7 @@ win32 {
!win32-borland:!wince*: LIBS += -lshell32 # the filedialog needs this library
}
-wince*|symbian: FORMS += dialogs/qfiledialog_embedded.ui
+wince*: FORMS += dialogs/qfiledialog_embedded.ui
else: FORMS += dialogs/qfiledialog.ui
INCLUDEPATH += $$PWD
@@ -70,13 +70,4 @@ SOURCES += \
dialogs/qfileinfogatherer.cpp \
dialogs/qwizard.cpp \
-symbian:contains(QT_CONFIG, s60) {
- LIBS += -lCommonDialogs
- SOURCES += dialogs/qfiledialog_symbian.cpp \
- dialogs/qcolordialog_symbian.cpp
-}
-
RESOURCES += dialogs/qmessagebox.qrc
-
-# Compensate for lack of platform defines in Symbian3
-symbian: DEFINES += SYMBIAN_VERSION_$$upper($$replace(SYMBIAN_VERSION,\\.,_))
diff --git a/src/widgets/dialogs/qcolordialog_symbian.cpp b/src/widgets/dialogs/qcolordialog_symbian.cpp
deleted file mode 100644
index eab35f5ac8..0000000000
--- a/src/widgets/dialogs/qcolordialog_symbian.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcolordialog_p.h"
-
-#ifndef QT_NO_COLORDIALOG
-
-
-#include "qcolor.h"
-#include "private/qguiplatformplugin_p.h"
-
-#ifdef Q_WS_S60
-#include <AknColourSelectionGrid.h>
-#endif
-
-#include "private/qt_s60_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QColor launchSymbianColorDialog(QColor initial)
-{
- QColor currentColor = QColor::Invalid;
-#ifdef Q_WS_S60
- QT_TRAP_THROWING(
- CArrayFixFlat<TRgb>* array = new( ELeave ) CArrayFixFlat<TRgb>(17);
- CleanupStack::PushL(array);
- array->AppendL(KRgbBlack);
- array->AppendL(KRgbDarkGray);
- array->AppendL(KRgbDarkRed);
- array->AppendL(KRgbDarkGreen);
- array->AppendL(KRgbDarkYellow);
- array->AppendL(KRgbDarkBlue);
- array->AppendL(KRgbDarkMagenta);
- array->AppendL(KRgbDarkCyan);
- array->AppendL(KRgbRed);
- array->AppendL(KRgbGreen);
- array->AppendL(KRgbYellow);
- array->AppendL(KRgbBlue);
- array->AppendL(KRgbMagenta);
- array->AppendL(KRgbCyan);
- array->AppendL(KRgbGray);
- array->AppendL(KRgbWhite);
-
- TRgb initialColour(initial.red(), initial.green(), initial.blue(), initial.alpha());
-
- TBool noneChosen = EFalse; // If true shows the default colour button
- CAknColourSelectionGrid* colourSelectionGrid =
- CAknColourSelectionGrid::NewL(array, EFalse, noneChosen, initialColour);
- CleanupStack::PushL(colourSelectionGrid);
-
- if (colourSelectionGrid->ExecuteLD()) {
- currentColor.setRgb(initialColour.Red(), initialColour.Green(),
- initialColour.Blue(), initialColour.Alpha());
- }
- CleanupStack::Pop(colourSelectionGrid);
- CleanupStack::PopAndDestroy(array);
- );
-#endif
- return currentColor;
-}
-
-QColor qtSymbianGetColor(const QColor &initial)
-{
- return launchSymbianColorDialog(initial);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_COLORDIALOG
diff --git a/src/widgets/dialogs/qfiledialog_symbian.cpp b/src/widgets/dialogs/qfiledialog_symbian.cpp
deleted file mode 100644
index a4a7a228ba..0000000000
--- a/src/widgets/dialogs/qfiledialog_symbian.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qfiledialog.h"
-
-#ifndef QT_NO_FILEDIALOG
-
-#include <private/qfiledialog_p.h>
-#if defined(Q_WS_S60) && defined(SYMBIAN_VERSION_SYMBIAN3)
-#include <driveinfo.h>
-#include <AknCommonDialogsDynMem.h>
-#include <CAknMemorySelectionDialogMultiDrive.h>
-#include <MAknFileFilter.h>
-#endif
-#include "private/qcore_symbian_p.h"
-
-QT_BEGIN_NAMESPACE
-
-extern QStringList qt_make_filter_list(const QString &filter); // defined in qfiledialog.cpp
-extern QStringList qt_clean_filter_list(const QString &filter); // defined in qfiledialog.cpp
-
-enum DialogMode { DialogOpen, DialogSave, DialogFolder };
-#if defined(Q_WS_S60) && defined(SYMBIAN_VERSION_SYMBIAN3)
-class CExtensionFilter : public MAknFileFilter
-{
-public:
- void setFilter(const QString filter)
- {
- QStringList unparsedFiltersList = qt_make_filter_list(filter);
- QStringList filterList;
- filterRxList.clear();
-
- foreach (QString unparsedFilter, unparsedFiltersList) {
- filterList << qt_clean_filter_list(unparsedFilter);
- }
- foreach (QString currentFilter, filterList) {
- QRegExp filterRx(currentFilter, Qt::CaseInsensitive, QRegExp::Wildcard);
- filterRxList << filterRx;
- }
- }
-
- TBool Accept(const TDesC &/*aDriveAndPath*/, const TEntry &aEntry) const
- {
- //If no filter for files, all can be accepted
- if (filterRxList.isEmpty())
- return ETrue;
-
- if (aEntry.IsDir())
- return ETrue;
-
- foreach (QRegExp rx, filterRxList) {
- QString fileName = qt_TDesC2QString(aEntry.iName);
- if (rx.exactMatch(fileName))
- return ETrue;
- }
-
- return EFalse;
- }
-
-private:
- QList<QRegExp> filterRxList;
-};
-#endif
-
-static QString launchSymbianDialog(const QString dialogCaption, const QString startDirectory,
- const QString filter, DialogMode dialogMode)
-{
- QString selection;
-#if defined(Q_WS_S60) && defined(SYMBIAN_VERSION_SYMBIAN3)
- TFileName startFolder;
- if (!startDirectory.isEmpty()) {
- QString dir = QDir::toNativeSeparators(QFileDialogPrivate::workingDirectory(startDirectory));
- startFolder = qt_QString2TPtrC(dir);
- }
- TInt types = AknCommonDialogsDynMem::EMemoryTypeMMCExternal|
- AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage|
- AknCommonDialogsDynMem::EMemoryTypePhone;
-
- TPtrC titlePtr(qt_QString2TPtrC(dialogCaption));
- TFileName target;
- bool select = false;
- int tryCount = 2;
- while (tryCount--) {
- TInt err(KErrNone);
- TRAP(err,
- if (dialogMode == DialogOpen) {
- CExtensionFilter* extensionFilter = new (ELeave) CExtensionFilter;
- CleanupStack::PushL(extensionFilter);
- extensionFilter->setFilter(filter);
- select = AknCommonDialogsDynMem::RunSelectDlgLD(types, target,
- startFolder, 0, 0, titlePtr, extensionFilter);
- CleanupStack::Pop(extensionFilter);
- } else if (dialogMode == DialogSave) {
- QString defaultFileName = QFileDialogPrivate::initialSelection(startDirectory);
- target = qt_QString2TPtrC(defaultFileName);
- select = AknCommonDialogsDynMem::RunSaveDlgLD(types, target,
- startFolder, 0, 0, titlePtr);
- } else if (dialogMode == DialogFolder) {
- select = AknCommonDialogsDynMem::RunFolderSelectDlgLD(types, target, startFolder,
- 0, 0, titlePtr, NULL, NULL);
- }
- );
-
- if (err == KErrNone) {
- tryCount = 0;
- } else {
- // Symbian native file dialog doesn't allow accessing files outside C:/Data
- // It will always leave in that case, so default into QDir::rootPath() in error cases.
- QString dir = QDir::toNativeSeparators(QDir::rootPath());
- startFolder = qt_QString2TPtrC(dir);
- }
- }
- if (select) {
- QFileInfo fi(qt_TDesC2QString(target));
- selection = fi.absoluteFilePath();
- }
-#endif
- return selection;
-}
-
-QString qtSymbianGetOpenFileName(const QString &caption,
- const QString &dir,
- const QString &filter)
-{
- return launchSymbianDialog(caption, dir, filter, DialogOpen);
-}
-
-QStringList qtSymbianGetOpenFileNames(const QString &caption,
- const QString &dir,
- const QString &filter)
-{
- QString fileName;
- fileName.append(launchSymbianDialog(caption, dir, filter, DialogOpen));
- QStringList fileList;
- fileList << fileName;
-
- return fileList;
-}
-
-QString qtSymbianGetSaveFileName(const QString &caption,
- const QString &dir)
-{
- return launchSymbianDialog(caption, dir, QString(), DialogSave);
-}
-
-QString qtSymbianGetExistingDirectory(const QString &caption,
- const QString &dir)
-{
- QString folderCaption;
- if (!caption.isEmpty()) {
- folderCaption.append(caption);
- } else {
- // Title for folder selection dialog is mandatory
- folderCaption.append(QFileDialog::tr("Find Directory"));
- }
- return launchSymbianDialog(folderCaption, dir, QString(), DialogFolder);
-}
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri
index 4f0129add0..c59a0463e0 100644
--- a/src/widgets/kernel/kernel.pri
+++ b/src/widgets/kernel/kernel.pri
@@ -97,36 +97,6 @@ win32:!qpa {
!contains(DEFINES, QT_NO_DIRECTDRAW):LIBS += ddraw.lib
}
-symbian {
- exists($${EPOCROOT}epoc32/include/platform/mw/akntranseffect.h): DEFINES += QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H
-
- SOURCES += \
- kernel/qapplication_s60.cpp \
- kernel/qeventdispatcher_s60.cpp \
- kernel/qwidget_s60.cpp \
- kernel/qcursor_s60.cpp \
- kernel/qdesktopwidget_s60.cpp \
- kernel/qkeymapper_s60.cpp\
- kernel/qclipboard_s60.cpp\
- kernel/qdnd_s60.cpp \
- kernel/qsound_s60.cpp
-
- HEADERS += \
- kernel/qt_s60_p.h \
- kernel/qeventdispatcher_s60_p.h
-
- LIBS += -lbafl -lestor
-
- INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
- INCLUDEPATH += ../3rdparty/s60
-
- contains(QT_CONFIG, s60) {
- SOURCES += kernel/qsoftkeymanager_s60.cpp
- HEADERS += kernel/qsoftkeymanager_s60_p.h
- }
-}
-
-
unix:x11 {
INCLUDEPATH += ../3rdparty/xorg
HEADERS += \
diff --git a/src/widgets/kernel/symbian.pri b/src/widgets/kernel/symbian.pri
deleted file mode 100644
index 69422dd02e..0000000000
--- a/src/widgets/kernel/symbian.pri
+++ /dev/null
@@ -1,7 +0,0 @@
-symbian {
- contains(QT_CONFIG, s60): LIBS+= $$QMAKE_LIBS_S60
- RESOURCES += symbian/symbianresources.qrc
-
- HEADERS += symbian/qsymbianevent.h
- SOURCES += symbian/qsymbianevent.cpp
-}
diff --git a/src/widgets/platforms/s60/qapplication_s60.cpp b/src/widgets/platforms/s60/qapplication_s60.cpp
deleted file mode 100644
index 69d321dd65..0000000000
--- a/src/widgets/platforms/s60/qapplication_s60.cpp
+++ /dev/null
@@ -1,2715 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qapplication_p.h"
-#include "qsessionmanager.h"
-#include "qevent.h"
-#include "qsymbianevent.h"
-#include "qeventdispatcher_s60_p.h"
-#include "qwidget.h"
-#include "qdesktopwidget.h"
-#include "private/qbackingstore_p.h"
-#include "qt_s60_p.h"
-#include "private/qevent_p.h"
-#include "qstring.h"
-#include "qdebug.h"
-#include "qimage.h"
-#include "qcombobox.h"
-#include "private/qkeymapper_p.h"
-#include "private/qfont_p.h"
-#ifndef QT_NO_STYLE_S60
-#include "private/qs60style_p.h"
-#endif
-#include "private/qwindowsurface_s60_p.h"
-#include "qpaintengine.h"
-#include "private/qmenubar_p.h"
-#include "private/qsoftkeymanager_p.h"
-#ifdef QT_GRAPHICSSYSTEM_RUNTIME
-#include "private/qgraphicssystem_runtime_p.h"
-#endif
-
-#include "apgwgnam.h" // For CApaWindowGroupName
-#include <mdaaudiotoneplayer.h> // For CMdaAudioToneUtility
-
-#if defined(Q_OS_SYMBIAN)
-# include <private/qs60mainapplication_p.h>
-# include <centralrepository.h>
-# include "qs60mainappui.h"
-# include "qinputcontext.h"
-#endif
-
-#if defined(Q_WS_S60)
-# if !defined(QT_NO_IM)
-# include <private/qcoefepinputcontext_p.h>
-# endif
-#endif
-
-#include "private/qstylesheetstyle_p.h"
-
-#include <hal.h>
-#include <hal_data.h>
-
-#ifdef Q_SYMBIAN_TRANSITION_EFFECTS
-#include <graphics/wstfxconst.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-// Goom Events through Window Server
-static const int KGoomMemoryLowEvent = 0x10282DBF;
-static const int KGoomMemoryGoodEvent = 0x20026790;
-// Split view open/close events from AVKON
-static const int KSplitViewOpenEvent = 0x2001E2C0;
-static const int KSplitViewCloseEvent = 0x2001E2C1;
-
-#if defined(QT_DEBUG)
-static bool appNoGrab = false; // Grabbing enabled
-#endif
-static bool app_do_modal = false; // modal mode
-Q_GLOBAL_STATIC(QS60Data, qt_s60Data);
-
-extern bool qt_sendSpontaneousEvent(QObject*,QEvent*);
-extern QWidgetList *qt_modal_stack; // stack of modal widgets
-extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp
-
-QWidget *qt_button_down = 0; // widget got last button-down
-
-QSymbianControl *QSymbianControl::lastFocusedControl = 0;
-
-QS60Data* qGlobalS60Data()
-{
- return qt_s60Data();
-}
-
-#ifdef Q_WS_S60
-void QS60Data::setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, bool buttonGroupVisible)
-{
- bool buttonGroupVisibilityChanged = false;
- if (CEikButtonGroupContainer *const b = buttonGroupContainer()) {
- buttonGroupVisibilityChanged = (b->IsVisible() != buttonGroupVisible);
- b->MakeVisible(buttonGroupVisible);
- }
- bool statusPaneVisibilityChanged = false;
- if (CEikStatusPane *const s = statusPane()) {
- statusPaneVisibilityChanged = (s->IsVisible() != statusPaneVisible);
- s->MakeVisible(statusPaneVisible);
- }
- if (buttonGroupVisibilityChanged || statusPaneVisibilityChanged) {
- const QSize size = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect()).size();
- const QSize oldSize; // note that QDesktopWidget::resizeEvent ignores the QResizeEvent contents
- QResizeEvent event(size, oldSize);
- QApplication::instance()->sendEvent(QApplication::desktop(), &event);
- }
- if (buttonGroupVisibilityChanged && !statusPaneVisibilityChanged && QApplication::activeWindow())
- // Ensure that control rectangle is updated
- static_cast<QSymbianControl *>(QApplication::activeWindow()->winId())->handleClientAreaChange();
-}
-
-bool QS60Data::setRecursiveDecorationsVisibility(QWidget *window, Qt::WindowStates newState)
-{
- // Show statusbar:
- // Topmost parent: Show unless fullscreen/minimized.
- // Child windows: Follow topmost parent, unless fullscreen, in which case do not show statusbar
- // Show CBA:
- // Topmost parent: Show unless fullscreen/minimized.
- // Exception: Show if fullscreen with Qt::WindowSoftkeysVisibleHint.
- // Child windows:
- // Minimized: Unclear if there is an use case for having focused minimized window at all.
- // Always follow topmost parent just to be safe.
- // Maximized and normal: follow topmost parent.
- // Exception: If topmost parent is not showing CBA, show CBA if any softkey actions are
- // defined.
- // Fullscreen: Show only if Qt::WindowSoftkeysVisibleHint set.
-
- Qt::WindowStates comparisonState = newState;
- QWidget *parentWindow = window->parentWidget();
- if (parentWindow) {
- while (parentWindow->parentWidget())
- parentWindow = parentWindow->parentWidget();
- comparisonState = parentWindow->windowState();
- } else {
- parentWindow = window;
- }
-
- bool decorationsVisible = !(comparisonState & (Qt::WindowFullScreen | Qt::WindowMinimized));
- const bool parentIsFullscreen = comparisonState & Qt::WindowFullScreen;
- const bool parentCbaVisibilityHint = parentWindow->windowFlags() & Qt::WindowSoftkeysVisibleHint;
- bool buttonGroupVisibility = (decorationsVisible || (parentIsFullscreen && parentCbaVisibilityHint));
-
- // Do extra checking for child windows
- if (window->parentWidget()) {
- if (newState & Qt::WindowFullScreen) {
- decorationsVisible = false;
- if (window->windowFlags() & Qt::WindowSoftkeysVisibleHint)
- buttonGroupVisibility = true;
- else
- buttonGroupVisibility = false;
- } else if (!(newState & Qt::WindowMinimized) && !buttonGroupVisibility) {
- for (int i = 0; i < window->actions().size(); ++i) {
- if (window->actions().at(i)->softKeyRole() != QAction::NoSoftKey) {
- buttonGroupVisibility = true;
- break;
- }
- }
- }
- }
-
- S60->setStatusPaneAndButtonGroupVisibility(decorationsVisible, buttonGroupVisibility);
-
- return decorationsVisible;
-}
-#endif
-
-void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible)
-{
- if (QWidgetPrivate::mapper && QWidgetPrivate::mapper->contains(control)) {
- QWidget *const widget = QWidgetPrivate::mapper->value(control);
- QWidget *const window = widget->window();
- if (QTLWExtra *topData = qt_widget_private(window)->maybeTopData()) {
- QWidgetBackingStoreTracker &backingStore = topData->backingStore;
- if (visible) {
- if (backingStore.data()) {
- backingStore.registerWidget(widget);
- } else {
- backingStore.create(window);
- backingStore.registerWidget(widget);
- qt_widget_private(widget)->invalidateBuffer(widget->rect());
- widget->repaint();
- }
- } else {
- // In certain special scenarios we may get an ENotVisible event
- // without a previous EPartiallyVisible. The backingstore must
- // still be destroyed, hence the registerWidget() call below.
- if (backingStore.data() && widget->internalWinId()
- && qt_widget_private(widget)->maybeBackingStore() == backingStore.data())
- backingStore.registerWidget(widget);
- backingStore.unregisterWidget(widget);
- // In order to ensure that any resources used by the window surface
- // are immediately freed, we flush the WSERV command buffer.
- S60->wsSession().Flush();
- }
- }
- }
-}
-
-bool qt_nograb() // application no-grab option
-{
-#if defined(QT_DEBUG)
- return appNoGrab;
-#else
- return false;
-#endif
-}
-
-// Modified from http://www3.symbian.com/faq.nsf/0/0F1464EE96E737E780256D5E00503DD1?OpenDocument
-class QS60Beep : public CBase, public MMdaAudioToneObserver
-{
-public:
- static QS60Beep* NewL(TInt aFrequency, TTimeIntervalMicroSeconds iDuration);
- void Play();
- ~QS60Beep();
-private:
- void ConstructL(TInt aFrequency, TTimeIntervalMicroSeconds iDuration);
- void MatoPrepareComplete(TInt aError);
- void MatoPlayComplete(TInt aError);
-private:
- typedef enum
- {
- EBeepNotPrepared,
- EBeepPrepared,
- EBeepPlaying
- } TBeepState;
-private:
- CMdaAudioToneUtility* iToneUtil;
- TBeepState iState;
- TInt iFrequency;
- TTimeIntervalMicroSeconds iDuration;
-};
-
-static QS60Beep* qt_S60Beep = 0;
-
-QS60Beep::~QS60Beep()
-{
- if (iToneUtil) {
- switch (iState) {
- case EBeepPlaying:
- iToneUtil->CancelPlay();
- break;
- case EBeepNotPrepared:
- iToneUtil->CancelPrepare();
- break;
- }
- }
- delete iToneUtil;
-}
-
-QS60Beep* QS60Beep::NewL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration)
-{
- QS60Beep* self = new (ELeave) QS60Beep();
- CleanupStack::PushL(self);
- self->ConstructL(aFrequency, aDuration);
- CleanupStack::Pop();
- return self;
-}
-
-void QS60Beep::ConstructL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration)
-{
- iToneUtil = CMdaAudioToneUtility::NewL(*this);
- iState = EBeepNotPrepared;
- iFrequency = aFrequency;
- iDuration = aDuration;
- iToneUtil->PrepareToPlayTone(iFrequency, iDuration);
-}
-
-void QS60Beep::Play()
-{
- if (iState == EBeepPlaying) {
- iToneUtil->CancelPlay();
- iState = EBeepPrepared;
- }
-
- iToneUtil->Play();
- iState = EBeepPlaying;
-}
-
-void QS60Beep::MatoPrepareComplete(TInt aError)
-{
- if (aError == KErrNone) {
- iState = EBeepPrepared;
- Play();
- }
-}
-
-void QS60Beep::MatoPlayComplete(TInt aError)
-{
- Q_UNUSED(aError);
- iState = EBeepPrepared;
-}
-
-
-static Qt::KeyboardModifiers mapToQtModifiers(TUint s60Modifiers)
-{
- Qt::KeyboardModifiers result = Qt::NoModifier;
-
- if (s60Modifiers & EModifierKeypad)
- result |= Qt::KeypadModifier;
- if (s60Modifiers & EModifierShift || s60Modifiers & EModifierLeftShift
- || s60Modifiers & EModifierRightShift)
- result |= Qt::ShiftModifier;
- if (s60Modifiers & EModifierCtrl || s60Modifiers & EModifierLeftCtrl
- || s60Modifiers & EModifierRightCtrl)
- result |= Qt::ControlModifier;
- if (s60Modifiers & EModifierAlt || s60Modifiers & EModifierLeftAlt
- || s60Modifiers & EModifierRightAlt)
- result |= Qt::AltModifier;
-
- return result;
-}
-
-static void mapS60MouseEventTypeToQt(QEvent::Type *type, Qt::MouseButton *button, const TPointerEvent *pEvent)
-{
- switch (pEvent->iType) {
- case TPointerEvent::EButton1Down:
- *type = QEvent::MouseButtonPress;
- *button = Qt::LeftButton;
- break;
- case TPointerEvent::EButton1Up:
- *type = QEvent::MouseButtonRelease;
- *button = Qt::LeftButton;
- break;
- case TPointerEvent::EButton2Down:
- *type = QEvent::MouseButtonPress;
- *button = Qt::MidButton;
- break;
- case TPointerEvent::EButton2Up:
- *type = QEvent::MouseButtonRelease;
- *button = Qt::MidButton;
- break;
- case TPointerEvent::EButton3Down:
- *type = QEvent::MouseButtonPress;
- *button = Qt::RightButton;
- break;
- case TPointerEvent::EButton3Up:
- *type = QEvent::MouseButtonRelease;
- *button = Qt::RightButton;
- break;
- case TPointerEvent::EDrag:
- *type = QEvent::MouseMove;
- *button = Qt::NoButton;
- break;
- case TPointerEvent::EMove:
- // Qt makes no distinction between move and drag
- *type = QEvent::MouseMove;
- *button = Qt::NoButton;
- break;
- default:
- *type = QEvent::None;
- *button = Qt::NoButton;
- break;
- }
- if (pEvent->iModifiers & EModifierDoubleClick){
- *type = QEvent::MouseButtonDblClick;
- }
-
- if (*type == QEvent::MouseButtonPress || *type == QEvent::MouseButtonDblClick)
- QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons | (*button);
- else if (*type == QEvent::MouseButtonRelease)
- QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons &(~(*button));
-
- QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons & Qt::MouseButtonMask;
-}
-
-//### Can be replaced with CAknLongTapDetector if animation is required.
-//NOTE: if CAknLongTapDetector is used make sure it gets variated out of 3.1 and 3.2,.
-//also MLongTapObserver needs to be changed to MAknLongTapDetectorCallBack if CAknLongTapDetector is used.
-class QLongTapTimer : public CTimer
-{
-public:
- static QLongTapTimer* NewL(QAbstractLongTapObserver *observer);
- QLongTapTimer(QAbstractLongTapObserver *observer);
- void ConstructL();
-public:
- void PointerEventL(const TPointerEvent &event);
- void RunL();
-protected:
-private:
- QAbstractLongTapObserver *m_observer;
- TPointerEvent m_event;
- QPoint m_pressedCoordinates;
- int m_dragDistance;
-};
-
-QLongTapTimer* QLongTapTimer::NewL(QAbstractLongTapObserver *observer)
-{
- QLongTapTimer* self = new QLongTapTimer(observer);
- self->ConstructL();
- return self;
-}
-void QLongTapTimer::ConstructL()
-{
- CTimer::ConstructL();
-}
-
-QLongTapTimer::QLongTapTimer(QAbstractLongTapObserver *observer):CTimer(CActive::EPriorityHigh)
-{
- m_observer = observer;
- m_dragDistance = qApp->startDragDistance();
- CActiveScheduler::Add(this);
-}
-
-void QLongTapTimer::PointerEventL(const TPointerEvent& event)
-{
- if ( event.iType == TPointerEvent::EDrag || event.iType == TPointerEvent::EButtonRepeat)
- {
- QPoint diff(QPoint(event.iPosition.iX,event.iPosition.iY) - m_pressedCoordinates);
- if (diff.manhattanLength() < m_dragDistance)
- return;
- }
- Cancel();
- m_event = event;
- if (event.iType == TPointerEvent::EButton1Down)
- {
- m_pressedCoordinates = QPoint(event.iPosition.iX,event.iPosition.iY);
- // must be same as KLongTapDelay in aknlongtapdetector.h
- After(800000);
- }
-}
-void QLongTapTimer::RunL()
-{
- if (m_observer)
- m_observer->HandleLongTapEventL(m_event.iPosition, m_event.iParentPosition);
-}
-
-QSymbianControl::QSymbianControl(QWidget *w)
- : CCoeControl()
- , qwidget(w)
- , m_longTapDetector(0)
- , m_ignoreFocusChanged(0)
- , m_symbianPopupIsOpen(0)
- , m_inExternalScreenOverride(false)
- , m_lastStatusPaneVisibility(0)
-{
-}
-
-void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop)
-{
- if (!desktop)
- {
- if (isWindowOwning || !qwidget->parentWidget()
- || qwidget->parentWidget()->windowType() == Qt::Desktop) {
- RWindowGroup &wg(S60->windowGroup(qwidget));
- CreateWindowL(wg);
- } else {
- /**
- * TODO: in order to avoid creating windows for all ancestors of
- * this widget up to the root window, the parameter passed to
- * CreateWindowL should be
- * qwidget->parentWidget()->effectiveWinId(). However, if we do
- * this, then we need to take care of re-parenting when a window
- * is created for a widget between this one and the root window.
- */
- CreateWindowL(qwidget->parentWidget()->winId());
- }
-
- // Necessary in order to be able to track the activation status of
- // the control's window
- qwidget->d_func()->createExtra();
-
- SetFocusing(true);
- m_longTapDetector = QLongTapTimer::NewL(this);
- m_doubleClickTimer.invalidate();
-
- DrawableWindow()->SetPointerGrab(ETrue);
- }
-
-#ifdef Q_SYMBIAN_TRANSITION_EFFECTS
- if (OwnsWindow()) {
- TTfxWindowPurpose windowPurpose(ETfxPurposeNone);
- switch (qwidget->windowType()) {
- case Qt::Dialog:
- windowPurpose = ETfxPurposeDialogWindow;
- break;
- case Qt::Popup:
- windowPurpose = ETfxPurposePopupWindow;
- break;
- case Qt::Tool:
- windowPurpose = ETfxPurposeToolWindow;
- break;
- case Qt::ToolTip:
- windowPurpose = ETfxPurposeToolTipWindow;
- break;
- case Qt::SplashScreen:
- windowPurpose = ETfxPurposeSplashScreenWindow;
- break;
- default:
- windowPurpose = (isWindowOwning || !qwidget->parentWidget() || qwidget->parentWidget()->windowType() == Qt::Desktop)
- ? ETfxPurposeWindow : ETfxPurposeChildWindow;
- break;
- }
- Window().SetPurpose(windowPurpose);
- }
-#endif
-}
-
-QSymbianControl::~QSymbianControl()
-{
- // Ensure backing store is deleted before the top-level
- // window is destroyed
- qt_widget_private(qwidget)->topData()->backingStore.destroy();
-
- if (S60->curWin == this)
- S60->curWin = 0;
- if (!QApplicationPrivate::is_app_closing) {
- QT_TRY {
- setFocusSafely(false);
- } QT_CATCH(const std::exception&) {
- // ignore exceptions, nothing can be done
- }
- }
- S60->appUi()->RemoveFromStack(this);
- delete m_longTapDetector;
-}
-
-void QSymbianControl::setWidget(QWidget *w)
-{
- qwidget = w;
-}
-
-QPoint QSymbianControl::translatePointForFixedNativeOrientation(const TPoint &pointerEventPos) const
-{
- QPoint pos(pointerEventPos.iX, pointerEventPos.iY);
- if (qwidget->d_func()->fixNativeOrientationCalled) {
- QSize wsize = qwidget->size();
- TSize size = Size();
- if (size.iWidth == wsize.height() && size.iHeight == wsize.width()) {
- qreal x = pos.x();
- qreal y = pos.y();
- pos.setX(size.iHeight - y);
- pos.setY(x);
- }
- }
- return pos;
-}
-
-TRect QSymbianControl::translateRectForFixedNativeOrientation(const TRect &controlRect) const
-{
- TRect rect = controlRect;
- if (qwidget->d_func()->fixNativeOrientationCalled) {
- QPoint a = translatePointForFixedNativeOrientation(rect.iTl);
- QPoint b = translatePointForFixedNativeOrientation(rect.iBr);
- if (a.x() < b.x()) {
- rect.iTl.iX = a.x();
- rect.iBr.iX = b.x();
- } else {
- rect.iTl.iX = b.x();
- rect.iBr.iX = a.x();
- }
- if (a.y() < b.y()) {
- rect.iTl.iY = a.y();
- rect.iBr.iY = b.y();
- } else {
- rect.iTl.iY = b.y();
- rect.iBr.iY = a.y();
- }
- }
- return rect;
-}
-
-void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation )
-{
- QWidget *alienWidget;
- QPoint widgetPos = translatePointForFixedNativeOrientation(aPenEventLocation);
- QPoint globalPos = translatePointForFixedNativeOrientation(aPenEventScreenLocation);
- alienWidget = qwidget->childAt(widgetPos);
- if (!alienWidget)
- alienWidget = qwidget;
-
-#if !defined(QT_NO_CONTEXTMENU)
- QContextMenuEvent contextMenuEvent(QContextMenuEvent::Mouse, widgetPos, globalPos, Qt::NoModifier);
- qt_sendSpontaneousEvent(alienWidget, &contextMenuEvent);
-#endif
-}
-
-#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
-void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent *event)
-{
- QApplicationPrivate *d = QApplicationPrivate::instance();
- QPointF screenPos = qwidget->mapToGlobal(translatePointForFixedNativeOrientation(event->iPosition));
- qreal pressure;
- if(d->pressureSupported
- && event->Pressure() > 0) //workaround for misconfigured HAL
- pressure = event->Pressure() / qreal(d->maxTouchPressure);
- else
- pressure = qreal(1.0);
- processTouchEvent(event->PointerNumber(), event->iType, screenPos, pressure);
-}
-#endif
-
-void QSymbianControl::processTouchEvent(int pointerNumber, TPointerEvent::TType type, QPointF screenPos, qreal pressure)
-{
- QRect screenGeometry = qApp->desktop()->screenGeometry(qwidget);
-
- QApplicationPrivate *d = QApplicationPrivate::instance();
-
- QList<QTouchEvent::TouchPoint> points = d->appAllTouchPoints;
- while (points.count() <= pointerNumber)
- points.append(QTouchEvent::TouchPoint(points.count()));
-
- Qt::TouchPointStates allStates = 0;
- for (int i = 0; i < points.count(); ++i) {
- QTouchEvent::TouchPoint &touchPoint = points[i];
-
- if (touchPoint.id() == pointerNumber) {
- Qt::TouchPointStates state;
- switch (type) {
- case TPointerEvent::EButton1Down:
-#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
- case TPointerEvent::EEnterHighPressure:
-#endif
- state = Qt::TouchPointPressed;
- break;
- case TPointerEvent::EButton1Up:
-#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
- case TPointerEvent::EExitCloseProximity:
-#endif
- state = Qt::TouchPointReleased;
- break;
- case TPointerEvent::EDrag:
- state = Qt::TouchPointMoved;
- break;
- default:
- // how likely is this to happen?
- state = Qt::TouchPointStationary;
- break;
- }
- if (pointerNumber == 0)
- state |= Qt::TouchPointPrimary;
- touchPoint.setState(state);
-
- touchPoint.setScreenPos(screenPos);
- touchPoint.setNormalizedPos(QPointF(screenPos.x() / screenGeometry.width(),
- screenPos.y() / screenGeometry.height()));
-
- touchPoint.setPressure(pressure);
- } 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();
- } else {
- d->appAllTouchPoints = points;
- }
-
- QApplicationPrivate::translateRawTouchEvent(qwidget,
- QTouchEvent::TouchScreen,
- points);
-}
-
-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));
-}
-
-void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent)
-{
- QMouseEvent::Type type;
- Qt::MouseButton button;
- mapS60MouseEventTypeToQt(&type, &button, &pEvent);
- Qt::KeyboardModifiers modifiers = mapToQtModifiers(pEvent.iModifiers);
-
- QPoint widgetPos = translatePointForFixedNativeOrientation(pEvent.iPosition);
- TPoint controlScreenPos = PositionRelativeToScreen();
- QPoint globalPos = QPoint(controlScreenPos.iX, controlScreenPos.iY) + widgetPos;
- S60->lastCursorPos = globalPos;
- S60->lastPointerEventPos = widgetPos;
-
- QWidget *mouseGrabber = QWidget::mouseGrabber();
-
- QWidget *popupWidget = qApp->activePopupWidget();
- QWidget *popupReceiver = 0;
- if (popupWidget) {
- QWidget *popupChild = popupWidget->childAt(popupWidget->mapFromGlobal(globalPos));
- popupReceiver = popupChild ? popupChild : popupWidget;
- }
-
- if (mouseGrabber) {
- if (popupReceiver) {
- sendMouseEvent(popupReceiver, type, globalPos, button, modifiers);
- } else {
- sendMouseEvent(mouseGrabber, type, globalPos, button, modifiers);
- }
- // No Enter/Leave events in grabbing mode.
- return;
- }
-
- QWidget *widgetUnderPointer = qwidget->childAt(widgetPos);
- if (!widgetUnderPointer)
- widgetUnderPointer = qwidget;
-
- QApplicationPrivate::dispatchEnterLeave(widgetUnderPointer, S60->lastPointerEventTarget);
- S60->lastPointerEventTarget = widgetUnderPointer;
-
- QWidget *receiver;
- if (!popupReceiver && S60->mousePressTarget && type != QEvent::MouseButtonPress) {
- receiver = S60->mousePressTarget;
- if (type == QEvent::MouseButtonRelease)
- S60->mousePressTarget = 0;
- } else {
- receiver = popupReceiver ? popupReceiver : widgetUnderPointer;
- if (type == QEvent::MouseButtonPress)
- S60->mousePressTarget = receiver;
- }
-
-#if !defined(QT_NO_CURSOR) && !defined(Q_SYMBIAN_FIXED_POINTER_CURSORS)
- if (S60->brokenPointerCursors)
- qt_symbian_move_cursor_sprite();
-#endif
-
-//Generate single touch event for S60 5.0 (has touchscreen, does not have advanced pointers)
-#ifndef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
- if (S60->hasTouchscreen) {
- processTouchEvent(0, pEvent.iType, QPointF(globalPos), 1.0);
- }
-#endif
-
- sendMouseEvent(receiver, type, globalPos, button, modifiers);
-}
-
-#ifdef Q_WS_S60
-void QSymbianControl::HandleStatusPaneSizeChange()
-{
- QS60MainAppUi *s60AppUi = static_cast<QS60MainAppUi *>(S60->appUi());
- s60AppUi->HandleStatusPaneSizeChange();
-}
-#endif
-
-void QSymbianControl::sendMouseEvent(
- QWidget *receiver,
- QEvent::Type type,
- const QPoint &globalPos,
- Qt::MouseButton button,
- Qt::KeyboardModifiers modifiers)
-{
- Q_ASSERT(receiver);
- QMouseEvent mEvent(type, receiver->mapFromGlobal(globalPos), globalPos,
- button, QApplicationPrivate::mouse_buttons, modifiers);
- QEventDispatcherS60 *dispatcher;
- // It is theoretically possible for someone to install a different event dispatcher.
- if ((dispatcher = qobject_cast<QEventDispatcherS60 *>(receiver->d_func()->threadData->eventDispatcher)) != 0) {
- if (dispatcher->excludeUserInputEvents()) {
- dispatcher->saveInputEvent(this, receiver, new QMouseEvent(mEvent));
- return;
- }
- }
-
- sendMouseEvent(receiver, &mEvent);
-}
-
-bool QSymbianControl::sendMouseEvent(QWidget *widget, QMouseEvent *mEvent)
-{
- return qt_sendSpontaneousEvent(widget, mEvent);
-}
-
-TKeyResponse QSymbianControl::OfferKeyEventL(const TKeyEvent& keyEvent, TEventCode type)
-{
- TKeyResponse r = EKeyWasNotConsumed;
- QT_TRYCATCH_LEAVING(r = OfferKeyEvent(keyEvent, type));
- return r;
-}
-
-TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCode type)
-{
- /*
- S60 has a confusing way of delivering key events. There are three types of
- events: EEventKey, EEventKeyDown and EEventKeyUp. When a key is pressed,
- EEventKeyDown is first generated, followed by EEventKey. Then, when the key is
- released, EEventKeyUp is generated.
- However, it is possible that only the EEventKey is generated alone, typically
- in relation to virtual keyboards. In that case we need to take care to
- generate both press and release events in Qt, since applications expect that.
- We do this by having three states for each used scan code, depending on the
- events received. See the switch below for what happens in each state
- transition.
- */
-
- if (type != EEventKeyDown)
- if (handleVirtualMouse(keyEvent, type) == EKeyWasConsumed)
- return EKeyWasConsumed;
-
- TKeyResponse ret = EKeyWasNotConsumed;
-#define GET_RETURN(x) (ret = ((x) == EKeyWasConsumed) ? EKeyWasConsumed : ret)
-
- // This top level switch corresponds to the states, and the inner switches
- // correspond to the transitions.
- QS60Data::ScanCodeState &scanCodeState = S60->scanCodeStates[keyEvent.iScanCode];
- switch (scanCodeState) {
- case QS60Data::Unpressed:
- switch (type) {
- case EEventKeyDown:
- scanCodeState = QS60Data::KeyDown;
- break;
- case EEventKey:
- GET_RETURN(sendSymbianKeyEvent(keyEvent, QEvent::KeyPress));
- GET_RETURN(sendSymbianKeyEvent(keyEvent, QEvent::KeyRelease));
- break;
- case EEventKeyUp:
- // No action.
- break;
- }
- break;
- case QS60Data::KeyDown:
- switch (type) {
- case EEventKeyDown:
- // This should never happen, just stay in this state to be safe.
- break;
- case EEventKey:
- GET_RETURN(sendSymbianKeyEvent(keyEvent, QEvent::KeyPress));
- scanCodeState = QS60Data::KeyDownAndKey;
- break;
- case EEventKeyUp:
- scanCodeState = QS60Data::Unpressed;
- break;
- }
- break;
- case QS60Data::KeyDownAndKey:
- switch (type) {
- case EEventKeyDown:
- // This should never happen, just stay in this state to be safe.
- break;
- case EEventKey:
- GET_RETURN(sendSymbianKeyEvent(keyEvent, QEvent::KeyRelease));
- GET_RETURN(sendSymbianKeyEvent(keyEvent, QEvent::KeyPress));
- break;
- case EEventKeyUp:
- GET_RETURN(sendSymbianKeyEvent(keyEvent, QEvent::KeyRelease));
- scanCodeState = QS60Data::Unpressed;
- break;
- }
- break;
- }
- return ret;
-
-#undef GET_RETURN
-}
-
-TKeyResponse QSymbianControl::sendSymbianKeyEvent(const TKeyEvent &keyEvent, QEvent::Type type)
-{
- // Because S60 does not generate keysyms for EKeyEventDown and EKeyEventUp
- // events, we need to cache the keysyms from the EKeyEvent events. This is what
- // resolveS60ScanCode does.
- TUint s60Keysym = QApplicationPrivate::resolveS60ScanCode(keyEvent.iScanCode,
- keyEvent.iCode);
- int keyCode;
- if (s60Keysym == EKeyNull){ //some key events have 0 in iCode, for them iScanCode should be used
- keyCode = qt_keymapper_private()->mapS60ScanCodesToQt(keyEvent.iScanCode);
- } else if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) {
- // Normal characters keys.
- keyCode = s60Keysym;
- } else {
- // Special S60 keys.
- keyCode = qt_keymapper_private()->mapS60KeyToQt(s60Keysym);
- }
-
- Qt::KeyboardModifiers mods = mapToQtModifiers(keyEvent.iModifiers);
- QKeyEventEx qKeyEvent(type, keyCode, mods, qt_keymapper_private()->translateKeyEvent(keyCode, mods),
- (keyEvent.iRepeats != 0), 1, keyEvent.iScanCode, s60Keysym, keyEvent.iModifiers);
- QWidget *widget;
- widget = QWidget::keyboardGrabber();
- if (!widget) {
- if (QApplicationPrivate::popupWidgets != 0) {
- widget = QApplication::activePopupWidget()->focusWidget();
- if (!widget) {
- widget = QApplication::activePopupWidget();
- }
- } else {
- widget = QApplicationPrivate::focus_widget;
- if (!widget) {
- widget = qwidget;
- }
- }
- }
-
- QEventDispatcherS60 *dispatcher;
- // It is theoretically possible for someone to install a different event dispatcher.
- if ((dispatcher = qobject_cast<QEventDispatcherS60 *>(widget->d_func()->threadData->eventDispatcher)) != 0) {
- if (dispatcher->excludeUserInputEvents()) {
- dispatcher->saveInputEvent(this, widget, new QKeyEventEx(qKeyEvent));
- return EKeyWasConsumed;
- }
- }
- return sendKeyEvent(widget, &qKeyEvent);
-}
-
-TKeyResponse QSymbianControl::handleVirtualMouse(const TKeyEvent& keyEvent,TEventCode type)
-{
-#ifndef QT_NO_CURSOR
- if (S60->mouseInteractionEnabled && S60->virtualMouseRequired) {
- //translate keys to pointer
- if ((keyEvent.iScanCode >= EStdKeyLeftArrow && keyEvent.iScanCode <= EStdKeyDownArrow) ||
- (keyEvent.iScanCode >= EStdKeyDevice10 && keyEvent.iScanCode <= EStdKeyDevice13) ||
- keyEvent.iScanCode == EStdKeyDevice3) {
- QPoint pos = QCursor::pos();
- TPointerEvent fakeEvent;
- fakeEvent.iType = (TPointerEvent::TType)(-1);
- fakeEvent.iModifiers = keyEvent.iModifiers;
- TInt x = pos.x();
- TInt y = pos.y();
- if (type == EEventKeyUp) {
- S60->virtualMouseAccelTimeout.start();
- switch (keyEvent.iScanCode) {
- case EStdKeyLeftArrow:
- S60->virtualMousePressedKeys &= ~QS60Data::Left;
- break;
- case EStdKeyRightArrow:
- S60->virtualMousePressedKeys &= ~QS60Data::Right;
- break;
- case EStdKeyUpArrow:
- S60->virtualMousePressedKeys &= ~QS60Data::Up;
- break;
- case EStdKeyDownArrow:
- S60->virtualMousePressedKeys &= ~QS60Data::Down;
- break;
- // diagonal keys (named aliases don't exist in 3.1 SDK)
- case EStdKeyDevice10:
- S60->virtualMousePressedKeys &= ~QS60Data::LeftUp;
- break;
- case EStdKeyDevice11:
- S60->virtualMousePressedKeys &= ~QS60Data::RightUp;
- break;
- case EStdKeyDevice12:
- S60->virtualMousePressedKeys &= ~QS60Data::RightDown;
- break;
- case EStdKeyDevice13:
- S60->virtualMousePressedKeys &= ~QS60Data::LeftDown;
- break;
- case EStdKeyDevice3: //select
- if (S60->virtualMousePressedKeys & QS60Data::Select)
- fakeEvent.iType = TPointerEvent::EButton1Up;
- S60->virtualMousePressedKeys &= ~QS60Data::Select;
- break;
- }
- }
- else if (type == EEventKey) {
- int dx = 0;
- int dy = 0;
- if (keyEvent.iScanCode != EStdKeyDevice3) {
- m_doubleClickTimer.invalidate();
- //reset mouse accelleration after a short time with no moves
- const int maxTimeBetweenKeyEventsMs = 500;
- if (S60->virtualMouseAccelTimeout.isValid() &&
- S60->virtualMouseAccelTimeout.hasExpired(maxTimeBetweenKeyEventsMs)) {
- S60->virtualMouseAccelDX = 0;
- S60->virtualMouseAccelDY = 0;
- }
- S60->virtualMouseAccelTimeout.invalidate();
- }
- switch (keyEvent.iScanCode) {
- case EStdKeyLeftArrow:
- S60->virtualMousePressedKeys |= QS60Data::Left;
- dx = -1;
- fakeEvent.iType = TPointerEvent::EMove;
- break;
- case EStdKeyRightArrow:
- S60->virtualMousePressedKeys |= QS60Data::Right;
- dx = 1;
- fakeEvent.iType = TPointerEvent::EMove;
- break;
- case EStdKeyUpArrow:
- S60->virtualMousePressedKeys |= QS60Data::Up;
- dy = -1;
- fakeEvent.iType = TPointerEvent::EMove;
- break;
- case EStdKeyDownArrow:
- S60->virtualMousePressedKeys |= QS60Data::Down;
- dy = 1;
- fakeEvent.iType = TPointerEvent::EMove;
- break;
- case EStdKeyDevice10:
- S60->virtualMousePressedKeys |= QS60Data::LeftUp;
- dx = -1;
- dy = -1;
- fakeEvent.iType = TPointerEvent::EMove;
- break;
- case EStdKeyDevice11:
- S60->virtualMousePressedKeys |= QS60Data::RightUp;
- dx = 1;
- dy = -1;
- fakeEvent.iType = TPointerEvent::EMove;
- break;
- case EStdKeyDevice12:
- S60->virtualMousePressedKeys |= QS60Data::RightDown;
- dx = 1;
- dy = 1;
- fakeEvent.iType = TPointerEvent::EMove;
- break;
- case EStdKeyDevice13:
- S60->virtualMousePressedKeys |= QS60Data::LeftDown;
- dx = -1;
- dy = 1;
- fakeEvent.iType = TPointerEvent::EMove;
- break;
- case EStdKeyDevice3:
- // Platform bug. If you start pressing several keys simultaneously (for
- // example for drag'n'drop), Symbian starts producing spurious up and
- // down messages for some keys. Therefore, make sure we have a clean slate
- // of pressed keys before starting a new button press.
- if (S60->virtualMousePressedKeys & QS60Data::Select) {
- return EKeyWasConsumed;
- } else {
- S60->virtualMousePressedKeys |= QS60Data::Select;
- fakeEvent.iType = TPointerEvent::EButton1Down;
- if (m_doubleClickTimer.isValid()
- && !m_doubleClickTimer.hasExpired(QApplication::doubleClickInterval())) {
- fakeEvent.iModifiers |= EModifierDoubleClick;
- m_doubleClickTimer.invalidate();
- } else {
- m_doubleClickTimer.start();
- }
- }
- break;
- }
- if (dx) {
- int cdx = S60->virtualMouseAccelDX;
- //reset accel on change of sign, else double accel
- if (dx * cdx <= 0)
- cdx = dx;
- else
- cdx *= 4;
- //cap accelleration
- if (dx * cdx > S60->virtualMouseMaxAccel)
- cdx = dx * S60->virtualMouseMaxAccel;
- //move mouse position
- x += cdx;
- S60->virtualMouseAccelDX = cdx;
- }
-
- if (dy) {
- int cdy = S60->virtualMouseAccelDY;
- if (dy * cdy <= 0)
- cdy = dy;
- else
- cdy *= 4;
- if (dy * cdy > S60->virtualMouseMaxAccel)
- cdy = dy * S60->virtualMouseMaxAccel;
- y += cdy;
- S60->virtualMouseAccelDY = cdy;
- }
- }
- //clip to screen size (window server allows a sprite hotspot to be outside the screen)
- int screenNumber = S60->screenNumberForWidget(qwidget);
- if (x < 0)
- x = 0;
- else if (x >= S60->screenWidthInPixelsForScreen[screenNumber])
- x = S60->screenWidthInPixelsForScreen[screenNumber] - 1;
- if (y < 0)
- y = 0;
- else if (y >= S60->screenHeightInPixelsForScreen[screenNumber])
- y = S60->screenHeightInPixelsForScreen[screenNumber] - 1;
- TPoint epos(x, y);
- TPoint cpos = epos - PositionRelativeToScreen();
- fakeEvent.iPosition = cpos;
- fakeEvent.iParentPosition = epos;
- if(fakeEvent.iType != -1)
- HandlePointerEvent(fakeEvent);
- return EKeyWasConsumed;
- }
- }
-#endif
-
- return EKeyWasNotConsumed;
-}
-
-void QSymbianControl::sendInputEvent(QWidget *widget, QInputEvent *inputEvent)
-{
- switch (inputEvent->type()) {
- case QEvent::KeyPress:
- case QEvent::KeyRelease:
- sendKeyEvent(widget, static_cast<QKeyEvent *>(inputEvent));
- break;
- case QEvent::MouseButtonDblClick:
- case QEvent::MouseButtonPress:
- case QEvent::MouseButtonRelease:
- case QEvent::MouseMove:
- sendMouseEvent(widget, static_cast<QMouseEvent *>(inputEvent));
- break;
- default:
- // Shouldn't get here.
- Q_ASSERT_X(0 == 1, "QSymbianControl::sendInputEvent()", "inputEvent->type() is unknown");
- break;
- }
-}
-
-TKeyResponse QSymbianControl::sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent)
-{
-#if !defined(QT_NO_IM) && defined(Q_WS_S60)
- if (widget && widget->isEnabled() && widget->testAttribute(Qt::WA_InputMethodEnabled)) {
- QInputContext *qic = widget->inputContext();
- if (qic && qic->filterEvent(keyEvent))
- return EKeyWasConsumed;
- }
-#endif // !defined(QT_NO_IM) && defined(Q_OS_SYMBIAN)
-
- if (widget && qt_sendSpontaneousEvent(widget, keyEvent))
- if (keyEvent->isAccepted())
- return EKeyWasConsumed;
-
- return EKeyWasNotConsumed;
-}
-
-#if !defined(QT_NO_IM) && defined(Q_WS_S60)
-TCoeInputCapabilities QSymbianControl::InputCapabilities() const
-{
- QWidget *w = 0;
-
- if (qwidget->hasFocus())
- w = qwidget;
- else
- w = qwidget->focusWidget();
-
- QCoeFepInputContext *ic;
- if (w && w->isEnabled() && w->testAttribute(Qt::WA_InputMethodEnabled)
- && (ic = qobject_cast<QCoeFepInputContext *>(w->inputContext()))) {
- return ic->inputCapabilities();
- } else {
- return TCoeInputCapabilities(TCoeInputCapabilities::ENone, 0, 0);
- }
-}
-#endif
-
-void QSymbianControl::Draw(const TRect& controlRect) const
-{
- // Set flag to avoid calling DrawNow in window surface
- QWidget *window = qwidget->window();
- Q_ASSERT(window);
- QTLWExtra *topExtra = window->d_func()->maybeTopData();
- Q_ASSERT(topExtra);
-
- TRect wcontrolRect = translateRectForFixedNativeOrientation(controlRect);
-
- if (!topExtra->inExpose) {
- topExtra->inExpose = true;
- if (!qwidget->isWindow()) {
- // If we get here, then it means we have a native child window
- // Since no content should ever be painted to these windows, we
- // erase them with a transparent brush when they get an expose.
- CWindowGc &gc = SystemGc();
- gc.SetBrushColor(TRgb(0, 0, 0, 0));
- gc.Clear(controlRect);
- }
- QRect exposeRect = qt_TRect2QRect(wcontrolRect);
- qwidget->d_func()->syncBackingStore(exposeRect);
- topExtra->inExpose = false;
- }
-
- QWindowSurface *surface = qwidget->windowSurface();
- QPaintEngine *engine = surface ? surface->paintDevice()->paintEngine() : NULL;
-
- if (!engine)
- return;
-
- const bool sendNativePaintEvents = qwidget->d_func()->extraData()->receiveNativePaintEvents;
- if (sendNativePaintEvents) {
- const QRect r = qt_TRect2QRect(wcontrolRect);
- QMetaObject::invokeMethod(qwidget, "beginNativePaintEvent", Qt::DirectConnection, Q_ARG(QRect, r));
- }
-
- // Map source rectangle into coordinates of the backing store.
- const QPoint controlBase(controlRect.iTl.iX, controlRect.iTl.iY);
- const QPoint backingStoreBase = qwidget->mapTo(qwidget->window(), controlBase);
- const TRect backingStoreRect(TPoint(backingStoreBase.x(), backingStoreBase.y()), controlRect.Size());
-
- if (engine->type() == QPaintEngine::Raster) {
- QS60WindowSurface *s60Surface;
-#ifdef QT_GRAPHICSSYSTEM_RUNTIME
- if (QApplicationPrivate::runtime_graphics_system) {
- QRuntimeWindowSurface *rtSurface =
- static_cast<QRuntimeWindowSurface*>(qwidget->windowSurface());
- s60Surface = static_cast<QS60WindowSurface *>(rtSurface->m_windowSurface.data());
- } else
-#endif
- s60Surface = static_cast<QS60WindowSurface *>(qwidget->windowSurface());
-
- CFbsBitmap *bitmap = s60Surface->symbianBitmap();
- CWindowGc &gc = SystemGc();
-
- QWExtra::NativePaintMode nativePaintMode = qwidget->d_func()->extraData()->nativePaintMode;
- if(qwidget->d_func()->paintOnScreen())
- nativePaintMode = QWExtra::Disable;
-
- switch(nativePaintMode) {
- case QWExtra::Disable:
- // Do nothing
- break;
- case QWExtra::Blit:
- case QWExtra::BlitWriteAlpha:
- if (qwidget->d_func()->isOpaque || nativePaintMode == QWExtra::BlitWriteAlpha)
- gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
- gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect);
- break;
- case QWExtra::ZeroFill:
- if (Window().DisplayMode() == EColor16MA
- || Window().DisplayMode() == Q_SYMBIAN_ECOLOR16MAP) {
- gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
- gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
- gc.SetBrushColor(TRgb::Color16MA(0));
- gc.Clear(controlRect);
- } else {
- gc.SetBrushColor(TRgb(0x000000));
- gc.Clear(controlRect);
- };
- break;
- default:
- Q_ASSERT(false);
- }
- }
-
- if (sendNativePaintEvents) {
- const QRect r = qt_TRect2QRect(wcontrolRect);
- // The draw ops aren't actually sent to WSERV until the graphics
- // context is deactivated, which happens in the function calling
- // this one. We therefore delay the delivery of endNativePaintEvent,
- // to ensure that drawing has completed by the time the widget
- // receives the event. Note that, if the widget needs to ensure
- // that the draw ops have actually been executed into the output
- // framebuffer, a call to RWsSession::Flush is required in the
- // endNativePaintEvent implementation.
- QMetaObject::invokeMethod(qwidget, "endNativePaintEvent", Qt::QueuedConnection, Q_ARG(QRect, r));
- }
-}
-
-void QSymbianControl::qwidgetResize_helper(const QSize &newSize)
-{
- QRect cr = qwidget->geometry();
- QSize oldSize(cr.size());
- cr.setSize(newSize);
- qwidget->data->crect = cr;
- if (qwidget->isVisible()) {
- QTLWExtra *tlwExtra = qwidget->d_func()->maybeTopData();
- bool slowResize = qgetenv("QT_SLOW_TOPLEVEL_RESIZE").toInt();
- if (!slowResize && tlwExtra)
- tlwExtra->inTopLevelResize = true;
- QResizeEvent e(newSize, oldSize);
- qt_sendSpontaneousEvent(qwidget, &e);
- if (!qwidget->testAttribute(Qt::WA_StaticContents))
- qwidget->d_func()->syncBackingStore();
- if (!slowResize && tlwExtra)
- tlwExtra->inTopLevelResize = false;
- } else {
- if (!qwidget->testAttribute(Qt::WA_PendingResizeEvent)) {
- QResizeEvent *e = new QResizeEvent(newSize, oldSize);
- QApplication::postEvent(qwidget, e);
- }
- }
-}
-
-void QSymbianControl::SizeChanged()
-{
- CCoeControl::SizeChanged();
-
- // When FixNativeOrientation had been called, the RWindow/CCoeControl size
- // and the surface/QWidget size have nothing to do with each other.
- if (qwidget->d_func()->fixNativeOrientationCalled)
- return;
-
- QSize oldSize = qwidget->size();
- QSize newSize(Size().iWidth, Size().iHeight);
-
- if (oldSize != newSize) {
- // Enforce the proper size for fullscreen widgets on the secondary screen.
- const bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen;
- const int screenNumber = S60->screenNumberForWidget(qwidget);
- if (!m_inExternalScreenOverride && isFullscreen && screenNumber > 0) {
- int screenWidth = S60->screenWidthInPixelsForScreen[screenNumber];
- int screenHeight = S60->screenHeightInPixelsForScreen[screenNumber];
- TSize screenSize(screenWidth, screenHeight);
- if (screenWidth > 0 && screenHeight > 0 && screenSize != Size()) {
- m_inExternalScreenOverride = true;
- SetExtent(TPoint(0, 0), screenSize);
- return;
- }
- }
-
- qwidgetResize_helper(newSize);
- }
-
- m_inExternalScreenOverride = false;
-
- // CCoeControl::SetExtent calls SizeChanged, but does not call
- // PositionChanged, so we call it here to ensure that the widget's
- // position is updated.
- PositionChanged();
-}
-
-void QSymbianControl::PositionChanged()
-{
- CCoeControl::PositionChanged();
-
- QPoint oldPos = qwidget->geometry().topLeft();
- QPoint newPos(Position().iX, Position().iY);
-
- if (oldPos != newPos) {
- QRect cr = qwidget->geometry();
- cr.moveTopLeft(newPos);
- qwidget->data->crect = cr;
- QTLWExtra *top = qwidget->d_func()->maybeTopData();
- if (top && (qwidget->windowState() & (~Qt::WindowActive)) == Qt::WindowNoState)
- top->normalGeometry.moveTopLeft(newPos);
- if (qwidget->isVisible()) {
- QMoveEvent e(newPos, oldPos);
- qt_sendSpontaneousEvent(qwidget, &e);
- } else {
- QMoveEvent * e = new QMoveEvent(newPos, oldPos);
- QApplication::postEvent(qwidget, e);
- }
- }
-}
-
-void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
-{
- if (m_ignoreFocusChanged || (qwidget->windowType() & Qt::WindowType_Mask) == Qt::Desktop)
- return;
-
-#ifdef Q_WS_S60
- if (S60->splitViewLastWidget)
- return;
-#endif
-
- // Popups never get focused, but still receive the FocusChanged when they are hidden.
- if (QApplicationPrivate::popupWidgets != 0
- || (qwidget->windowType() & Qt::Popup) == Qt::Popup)
- return;
-
- if (IsFocused() && IsVisible()) {
- if (m_symbianPopupIsOpen) {
- QWidget *fw = QApplication::focusWidget();
- if (fw) {
- QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason);
- QCoreApplication::sendEvent(fw, &event);
- }
- m_symbianPopupIsOpen = false;
- }
-
- QApplication::setActiveWindow(qwidget->window());
- qwidget->d_func()->setWindowIcon_sys(true);
- qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle());
-#ifdef Q_WS_S60
- if (qwidget->isWindow())
- S60->setRecursiveDecorationsVisibility(qwidget, qwidget->windowState());
-#endif
- } else if (QApplication::activeWindow() == qwidget->window()) {
- bool focusedControlFound = false;
- WId winId = 0;
- for (QWidget *w = qwidget->parentWidget(); w && (winId = w->internalWinId()); w = w->parentWidget()) {
- if (winId->IsFocused() && winId->IsVisible()) {
- focusedControlFound = true;
- break;
- } else if (w->isWindow())
- break;
- }
- if (!focusedControlFound) {
- if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) {
- QWidget *fw = QApplication::focusWidget();
- if (fw) {
- QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason);
- QCoreApplication::sendEvent(fw, &event);
- }
- m_symbianPopupIsOpen = true;
- return;
- }
-
- QApplication::setActiveWindow(0);
- }
- }
- // else { We don't touch the active window unless we were explicitly activated or deactivated }
-}
-
-void QSymbianControl::handleClientAreaChange()
-{
- const bool cbaVisibilityHint = qwidget->windowFlags() & Qt::WindowSoftkeysVisibleHint;
- if (qwidget->isFullScreen() && !cbaVisibilityHint) {
- SetExtentToWholeScreen();
- } else if (qwidget->isMaximized() || (qwidget->isFullScreen() && cbaVisibilityHint)) {
- TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
- SetExtent(r.iTl, r.Size());
- } else if (!qwidget->isMinimized()) { // Normal geometry
- if (!qwidget->testAttribute(Qt::WA_Resized)) {
- qwidget->adjustSize();
- 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();
- SetPosition(r.iTl);
- qwidget->setAttribute(Qt::WA_Moved, false); // not really an explicit position
- }
- }
-}
-
-bool QSymbianControl::isSplitViewWidget(QWidget *widget) {
- bool returnValue = true;
- //Ignore events sent to non-active windows, not visible widgets and not parents of input widget.
- if (!qwidget->isActiveWindow()
- || !qwidget->isVisible()
- || !qwidget->isAncestorOf(widget)) {
-
- returnValue = false;
- }
- return returnValue;
-}
-
-void QSymbianControl::HandleResourceChange(int resourceType)
-{
- switch (resourceType) {
- case KSplitViewCloseEvent: //intentional fall-through
- case KSplitViewOpenEvent: {
-#if !defined(QT_NO_IM) && defined(Q_WS_S60)
-
- //Fetch widget getting the text input
- QWidget *widget = QWidget::keyboardGrabber();
- if (!widget) {
- if (QApplicationPrivate::popupWidgets) {
- widget = QApplication::activePopupWidget()->focusWidget();
- if (!widget) {
- widget = QApplication::activePopupWidget();
- }
- } else {
- widget = QApplicationPrivate::focus_widget;
- if (!widget) {
- widget = qwidget;
- }
- }
- }
- if (widget) {
- QCoeFepInputContext *ic = qobject_cast<QCoeFepInputContext *>(widget->inputContext());
- if (!ic) {
- ic = qobject_cast<QCoeFepInputContext *>(qApp->inputContext());
- }
- if (ic && isSplitViewWidget(widget)) {
- if (resourceType == KSplitViewCloseEvent) {
- ic->resetSplitViewWidget();
- } else {
- ic->ensureFocusWidgetVisible(widget);
- }
- }
- }
-#endif // !defined(QT_NO_IM) && defined(Q_WS_S60)
- }
- break;
- case KInternalStatusPaneChange:
- // When status pane is not visible, only handle client area change if status pane was
- // previously visible, as size changes to hidden status pane should not affect
- // client area.
- if (S60->statusPane() && (S60->statusPane()->IsVisible() || m_lastStatusPaneVisibility)) {
- m_lastStatusPaneVisibility = S60->statusPane()->IsVisible();
- handleClientAreaChange();
- }
- if (IsFocused() && IsVisible()) {
- qwidget->d_func()->setWindowIcon_sys(true);
- qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle());
- }
- break;
- case KUidValueCoeFontChangeEvent:
- // font change event
- break;
-#ifdef Q_WS_S60
- case KEikDynamicLayoutVariantSwitch:
- {
- handleClientAreaChange();
- // Send resize event to trigger desktopwidget workAreaResized signal
- if (qt_desktopWidget) {
- QResizeEvent e(qt_desktopWidget->size(), qt_desktopWidget->size());
- QApplication::sendEvent(qt_desktopWidget, &e);
- }
- break;
- }
-#endif
- default:
- break;
- }
-
- CCoeControl::HandleResourceChange(resourceType);
-
-}
-void QSymbianControl::CancelLongTapTimer()
-{
- m_longTapDetector->Cancel();
-}
-
-TTypeUid::Ptr QSymbianControl::MopSupplyObject(TTypeUid id)
-{
- if (id.iUid == ETypeId)
- return id.MakePtr(this);
-
- return CCoeControl::MopSupplyObject(id);
-}
-
-void QSymbianControl::setFocusSafely(bool focus)
-{
- // The stack hack in here is very unfortunate, but it is the only way to ensure proper
- // focus in Symbian. If this is not executed, the control which happens to be on
- // the top of the stack may randomly be assigned focus by Symbian, for example
- // when creating new windows (specifically in CCoeAppUi::HandleStackChanged()).
-
- // Close any popups.
- CEikonEnv::Static()->EikAppUi()->StopDisplayingMenuBar();
-
- if (focus) {
- S60->appUi()->RemoveFromStack(this);
- // Symbian doesn't automatically remove focus from the last focused control, so we need to
- // remember it and clear focus ourselves.
- if (lastFocusedControl && lastFocusedControl != this)
- lastFocusedControl->SetFocus(false);
- QT_TRAP_THROWING(S60->appUi()->AddToStackL(this,
- ECoeStackPriorityDefault + 1, ECoeStackFlagStandard)); // Note the + 1
- lastFocusedControl = this;
- this->SetFocus(true);
- } else {
- S60->appUi()->RemoveFromStack(this);
- QT_TRAP_THROWING(S60->appUi()->AddToStackL(this,
- ECoeStackPriorityDefault, ECoeStackFlagStandard));
- if(this == lastFocusedControl)
- lastFocusedControl = 0;
- this->SetFocus(false);
- }
-}
-
-bool QSymbianControl::isControlActive()
-{
- return IsActivated() ? true : false;
-}
-
-void QSymbianControl::ensureFixNativeOrientation()
-{
-#if defined(Q_SYMBIAN_SUPPORTS_FIXNATIVEORIENTATION)
- if (!qwidget->isWindow() || qwidget->windowType() == Qt::Desktop)
- return;
- if (S60->screenNumberForWidget(qwidget) > 0)
- return;
- const bool isFixed = qwidget->d_func()->fixNativeOrientationCalled;
- const bool isFixEnabled = qwidget->testAttribute(Qt::WA_SymbianNoSystemRotation);
- const bool isFullScreen = qwidget->windowState().testFlag(Qt::WindowFullScreen);
- if (isFullScreen && isFixEnabled) {
- const bool surfaceBasedGs =
- QApplicationPrivate::graphics_system_name == QLatin1String("openvg")
- || QApplicationPrivate::graphics_system_name == QLatin1String("opengl");
- if (!surfaceBasedGs)
- qwidget->setAttribute(Qt::WA_SymbianNoSystemRotation, false);
- if (!isFixed && surfaceBasedGs) {
- if (Window().FixNativeOrientation() == KErrNone) {
- qwidget->d_func()->fixNativeOrientationCalled = true;
- // The EGL window surface is now fixed to the native orientation
- // of the device, no matter what size we pass when creating it.
- // Enforce the same size for the QWidget too. For the underlying
- // CCoeControl and RWindow it is up to the system to resize them
- // when the standard auto-rotation mechanism is in use, we must not
- // change that behavior by forcing any size for those. In practice
- // this means that the QWidget and the underlying native control
- // dimensions will be out of sync when FixNativeOrientation was
- // called and the device is turned to the non-native (typically
- // landscape) orientation. The pointer event handling and certain
- // functions like Draw() will need to compensate for this.
- QSize newSize(S60->nativeScreenWidthInPixels, S60->nativeScreenHeightInPixels);
- if (qwidget->size() != newSize)
- qwidgetResize_helper(newSize);
- } else {
- qwidget->setAttribute(Qt::WA_SymbianNoSystemRotation, false);
- }
- }
- } else if (isFixed) {
- qwidget->setAttribute(Qt::WA_SymbianNoSystemRotation, false);
- qwidget->d_func()->fixNativeOrientationCalled = false;
- qwidget->hide();
- qwidget->d_func()->create_sys(0, false, true);
- qwidget->show();
- }
-#else
- qwidget->setAttribute(Qt::WA_SymbianNoSystemRotation, false);
-#endif
-}
-
-/*!
- \typedef QApplication::QS60MainApplicationFactory
- \since 4.6
-
- 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()
-*/
-
-/*!
- \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, 0x040000))
-{
- 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, _internal))
-{
- 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 creates a new trap handler which will render any existing traps
- // invalid as long as it is active. This means that all code in main() that occurs after
- // the QApplication construction needs to be surrounded by a new trap, despite having
- // an outer one already. To avoid this, we save the original trap handler here, and set
- // it back after the S60 framework is constructed. Then we restore it right before the S60
- // framework destruction.
- TTrapHandler *origTrapHandler = User::TrapHandler();
-
- // The S60 framework has not been initialized. We need to do it.
- TApaApplicationFactory factory(S60->s60ApplicationFactory ?
- S60->s60ApplicationFactory : newS60Application);
- CApaCommandLine* commandLine = q_check_ptr(QCoreApplicationPrivate::symbianCommandLine());
- if (commandLine) {
- // After this construction, CEikonEnv will be available from CEikonEnv::Static().
- // (much like our qApp).
- QtEikonEnv* coe = new QtEikonEnv;
- //not using QT_TRAP_THROWING, because coe owns the cleanupstack so it can't be pushed there.
- TRAPD(err, coe->ConstructAppFromCommandLineL(factory, *commandLine));
- if(err != KErrNone) {
- qWarning() << "qt_init: Eikon application construct failed ("
- << err
- << "), maybe missing resource file on S60 3.1?";
- delete coe;
- qt_symbian_throwIfError(err);
- }
- }
-
- S60->s60InstalledTrapHandler = User::SetTrapHandler(origTrapHandler);
-
- S60->qtOwnsS60Environment = true;
- } else {
- S60->qtOwnsS60Environment = false;
- }
-
-#ifdef QT_NO_DEBUG
- if (!qgetenv("QT_S60_AUTO_FLUSH_WSERV").isEmpty())
-#endif
- S60->wsSession().SetAutoFlush(ETrue);
-
-#ifdef Q_SYMBIAN_WINDOW_SIZE_CACHE
- TRAP_IGNORE(S60->wsSession().EnableWindowSizeCacheL());
-#endif
-
- S60->updateScreenSize();
-
-
- TDisplayMode mode = S60->screenDevice()->DisplayMode();
- S60->screenDepth = TDisplayModeUtils::NumDisplayModeBitsPerPixel(mode);
-
- //NB: RWsSession::GetColorModeList tells you what window modes are supported,
- //not what bitmap formats.
- if(QSysInfo::symbianVersion() == QSysInfo::SV_9_2)
- S60->supportsPremultipliedAlpha = 0;
- else
- S60->supportsPremultipliedAlpha = 1;
-
- RProcess me;
- TSecureId securId = me.SecureId();
- S60->uid = securId.operator TUid();
-
- // enable focus events - used to re-enable mouse after focus changed between mouse and non mouse app,
- // and for dimming behind modal windows
- S60->windowGroup().EnableFocusChangeEvents();
-
- //Check if mouse interaction is supported (either EMouse=1 in the HAL, or EMachineUID is one of the phones known to support this)
- const TInt KMachineUidSamsungI8510 = 0x2000C51E;
- // HAL::Get(HALData::EPen, TInt& result) may set 'result' to 1 on some 3.1 systems (e.g. N95).
- // But we know that S60 systems below 5.0 did not support touch.
- static const bool touchIsUnsupportedOnSystem =
- QSysInfo::s60Version() == QSysInfo::SV_S60_3_1
- || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2;
- TInt machineUID;
- TInt mouse;
- TInt touch;
- TInt err;
- err = HAL::Get(HALData::EMouse, mouse);
- if (err != KErrNone)
- mouse = 0;
- err = HAL::Get(HALData::EMachineUid, machineUID);
- if (err != KErrNone)
- machineUID = 0;
- err = HAL::Get(HALData::EPen, touch);
- if (err != KErrNone || touchIsUnsupportedOnSystem)
- touch = 0;
-#ifdef __WINS__
- if(QSysInfo::symbianVersion() <= QSysInfo::SV_9_4) {
- //for symbian SDK emulator, force values to match typical devices.
- mouse = 0;
- touch = touchIsUnsupportedOnSystem ? 0 : 1;
- }
-#endif
- if (mouse || machineUID == KMachineUidSamsungI8510) {
- S60->hasTouchscreen = false;
- S60->virtualMouseRequired = false;
- }
- else if (!touch) {
- S60->hasTouchscreen = false;
- S60->virtualMouseRequired = true;
- }
- else {
- S60->hasTouchscreen = true;
- S60->virtualMouseRequired = false;
- }
-
- S60->avkonComponentsSupportTransparency = false;
- S60->menuBeingConstructed = false;
-
-#ifdef Q_WS_S60
- TUid KCRUidAvkon = { 0x101F876E };
- TUint32 KAknAvkonTransparencyEnabled = 0x0000000D;
-
- CRepository* repository = 0;
- TRAP(err, repository = CRepository::NewL(KCRUidAvkon));
-
- if(err == KErrNone) {
- TInt value = 0;
- err = repository->Get(KAknAvkonTransparencyEnabled, value);
- if(err == KErrNone) {
- S60->avkonComponentsSupportTransparency = (value==1) ? true : false;
- }
- }
- delete repository;
- repository = 0;
-#endif
-
- qt_keymapper_private()->updateInputLanguage();
-
-#ifdef QT_KEYPAD_NAVIGATION
- if (touch) {
- QApplicationPrivate::navigationMode = Qt::NavigationModeNone;
- } else {
- QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadDirectional;
- }
-#endif
-
-#ifndef QT_NO_CURSOR
- //Check if window server pointer cursors are supported or not
-#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
- //In generic binary, use the HAL and OS version
- //Any other known good phones should be added here.
- if (machineUID == KMachineUidSamsungI8510 || (QSysInfo::symbianVersion() != QSysInfo::SV_9_4
- && QSysInfo::symbianVersion() != QSysInfo::SV_9_3 && QSysInfo::symbianVersion()
- != QSysInfo::SV_9_2)) {
- S60->brokenPointerCursors = false;
- qt_symbian_setWindowGroupCursor(Qt::ArrowCursor, S60->windowGroup());
- }
- else
- S60->brokenPointerCursors = true;
-#endif
-
- if (S60->mouseInteractionEnabled) {
-#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
- if (S60->brokenPointerCursors) {
- qt_symbian_set_pointer_sprite(Qt::ArrowCursor);
- qt_symbian_show_pointer_sprite();
- }
- else
-#endif
- S60->wsSession().SetPointerCursorMode(EPointerCursorNormal);
- }
-#endif
-
- QFont systemFont;
- systemFont.setFamily(systemFont.defaultFamily());
- QApplicationPrivate::setSystemFont(systemFont);
-
- QObject::connect(qApp, SIGNAL(aboutToQuit()), qApp, SLOT(_q_aboutToQuit()));
-
-#ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE
- QApplicationPrivate::instance()->useTranslucentEGLSurfaces = true;
-
- const TUid KIvePropertyCat = {0x2726beef};
- enum TIvePropertyChipType {
- EVCBCM2727B1 = 0x00000000,
- EVCBCM2763A0 = 0x04000100,
- EVCBCM2763B0 = 0x04000102,
- EVCBCM2763C0 = 0x04000103,
- EVCBCM2763C1 = 0x04000104,
- EVCBCMUnknown = 0x7fffffff
- };
-
- TInt chipType = EVCBCMUnknown;
- if (RProperty::Get(KIvePropertyCat, 0 /*chip type*/, chipType) == KErrNone) {
- if (chipType == EVCBCM2727B1) {
- // We have only 32MB GPU memory. Use raster surfaces
- // for transparent TLWs.
- QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false;
- }
- } else {
- QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false;
- }
- if (QApplicationPrivate::graphics_system_name == QLatin1String("raster"))
- QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false;
-#else
- QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false;
-#endif
-/*
- ### Commented out for now as parameter handling not needed in SOS(yet). Code below will break testlib with -o flag
- int argc = priv->argc;
- char **argv = priv->argv;
-
- // Get command line params
- int j = argc ? 1 : 0;
- for (int i=1; i<argc; i++) {
- if (argv[i] && *argv[i] != '-') {
- argv[j++] = argv[i];
- continue;
- }
-
-#if defined(QT_DEBUG)
- if (qstrcmp(argv[i], "-nograb") == 0)
- appNoGrab = !appNoGrab;
- else
-#endif // QT_DEBUG
- ;
- }
-*/
-
- // Register WId with the metatype system. This is to enable
- // QWidgetPrivate::create_sys to used delayed slot invocation in order
- // to destroy WId objects during reparenting.
- qRegisterMetaType<WId>("WId");
-}
-
-#ifdef QT_NO_FREETYPE
-extern void qt_cleanup_symbianFontDatabase(); // qfontdatabase_s60.cpp
-#endif
-
-/*****************************************************************************
- qt_cleanup() - cleans up when the application is finished
- *****************************************************************************/
-void qt_cleanup()
-{
-#ifdef Q_WS_S60
- S60->setButtonGroupContainer(0);
-#endif
- if(qt_S60Beep) {
- delete qt_S60Beep;
- qt_S60Beep = 0;
- }
- QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles
- QPixmapCache::clear(); // Has to happen now, since QS60PlatformPixmap has FBS handles
-
-#ifdef QT_NO_FREETYPE
- qt_cleanup_symbianFontDatabase();
-#endif
-// S60 structure and window server session are freed in eventdispatcher destructor as they are needed there
-
- // It's important that this happens here, before the event dispatcher gets
- // deleted, because the input context needs the event loop one last time before
- // it dies.
- delete QApplicationPrivate::inputContext;
- QApplicationPrivate::inputContext = 0;
-
- //Change mouse pointer back
- S60->wsSession().SetPointerCursorMode(EPointerCursorNone);
-
-#ifdef Q_WS_S60
- // Clear CBA
- CEikonEnv::Static()->AppUiFactory()->SwapButtonGroup(0);
- delete S60->buttonGroupContainer();
- S60->setButtonGroupContainer(0);
-#endif
-
- // Call EndFullScreen() to prevent confusing the system effect state machine.
- qt_endFullScreenEffect();
-
- if (S60->qtOwnsS60Environment) {
- // Restore the S60 framework trap handler. See qt_init().
- User::SetTrapHandler(S60->s60InstalledTrapHandler);
-
- CEikonEnv* coe = CEikonEnv::Static();
- coe->PrepareToExit();
- // The CEikonEnv itself is destroyed in here.
- coe->DestroyEnvironment();
- }
-}
-
-void QApplicationPrivate::initializeWidgetPaletteHash()
-{
- // TODO: Implement QApplicationPrivate::initializeWidgetPaletteHash()
- // Possibly a task fot the S60Style guys
-}
-
-void QApplicationPrivate::createEventDispatcher()
-{
- Q_Q(QApplication);
- eventDispatcher = new QEventDispatcherS60(q);
-}
-
-QString QApplicationPrivate::appName() const
-{
- return QCoreApplicationPrivate::appName();
-}
-
-bool QApplicationPrivate::modalState()
-{
- return app_do_modal;
-}
-
-void QApplicationPrivate::enterModal_sys(QWidget *widget)
-{
-#ifdef Q_SYMBIAN_TRANSITION_EFFECTS
- S60->wsSession().SendEffectCommand(ETfxCmdAppModalModeEnter);
-#endif
- if (widget) {
- static_cast<QSymbianControl *>(widget->effectiveWinId())->FadeBehindPopup(ETrue);
- // Modal partial screen dialogs (like queries) capture pointer events.
- // ### FixMe: Add specialized behaviour for fullscreen modal dialogs
- widget->effectiveWinId()->SetGloballyCapturing(ETrue);
- widget->effectiveWinId()->SetPointerCapture(ETrue);
- }
- if (!qt_modal_stack)
- qt_modal_stack = new QWidgetList;
- qt_modal_stack->insert(0, widget);
- app_do_modal = true;
-}
-
-void QApplicationPrivate::leaveModal_sys(QWidget *widget)
-{
-#ifdef Q_SYMBIAN_TRANSITION_EFFECTS
- S60->wsSession().SendEffectCommand(ETfxCmdAppModalModeExit);
-#endif
- if (widget) {
- static_cast<QSymbianControl *>(widget->effectiveWinId())->FadeBehindPopup(EFalse);
- // ### FixMe: Add specialized behaviour for fullscreen modal dialogs
- widget->effectiveWinId()->SetGloballyCapturing(EFalse);
- widget->effectiveWinId()->SetPointerCapture(EFalse);
- }
- if (qt_modal_stack && qt_modal_stack->removeAll(widget)) {
- if (qt_modal_stack->isEmpty()) {
- delete qt_modal_stack;
- qt_modal_stack = 0;
- }
- }
- app_do_modal = qt_modal_stack != 0;
-}
-
-void QApplicationPrivate::openPopup(QWidget *popup)
-{
- if (popup && qobject_cast<QComboBox *>(popup->parentWidget()))
- static_cast<QSymbianControl *>(popup->effectiveWinId())->FadeBehindPopup(ETrue);
-
- if (!QApplicationPrivate::popupWidgets)
- QApplicationPrivate::popupWidgets = new QWidgetList;
- QApplicationPrivate::popupWidgets->append(popup);
-
- // Cancel focus widget pointer capture and long tap timer
- if (QApplication::focusWidget()) {
- static_cast<QSymbianControl*>(QApplication::focusWidget()->effectiveWinId())->CancelLongTapTimer();
- QApplication::focusWidget()->effectiveWinId()->SetPointerCapture(false);
- }
-
- if (!qt_nograb()) {
- // Cancel pointer capture and long tap timer for earlier popup
- int popupCount = QApplicationPrivate::popupWidgets->count();
- if (popupCount > 1) {
- QWidget* prevPopup = QApplicationPrivate::popupWidgets->at(popupCount-2);
- static_cast<QSymbianControl*>(prevPopup->effectiveWinId())->CancelLongTapTimer();
- prevPopup->effectiveWinId()->SetPointerCapture(false);
- }
-
- // Enable pointer capture for this (topmost) popup
- Q_ASSERT(popup->testAttribute(Qt::WA_WState_Created));
- WId id = popup->effectiveWinId();
- id->SetPointerCapture(true);
- }
-
- // popups are not focus-handled by the window system (the first
- // popup grabbed the keyboard), so we have to do that manually: A
- // new popup gets the focus
- QWidget *fw = popup->focusWidget();
- if (fw) {
- fw->setFocus(Qt::PopupFocusReason);
- } else if (QApplicationPrivate::popupWidgets->count() == 1) { // this was the first popup
- fw = QApplication::focusWidget();
- if (fw) {
- QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason);
- q_func()->sendEvent(fw, &e);
- }
- }
-}
-
-void QApplicationPrivate::closePopup(QWidget *popup)
-{
- if (popup && qobject_cast<QComboBox *>(popup->parentWidget()))
- static_cast<QSymbianControl *>(popup->effectiveWinId())->FadeBehindPopup(EFalse);
-
- if (!QApplicationPrivate::popupWidgets)
- return;
- QApplicationPrivate::popupWidgets->removeAll(popup);
-
- // Cancel pointer capture and long tap for this popup
- WId id = popup->effectiveWinId();
- id->SetPointerCapture(false);
- static_cast<QSymbianControl*>(id)->CancelLongTapTimer();
-
- if (QApplicationPrivate::popupWidgets->isEmpty()) { // this was the last popup
- delete QApplicationPrivate::popupWidgets;
- QApplicationPrivate::popupWidgets = 0;
- if (!qt_nograb()) { // grabbing not disabled
- Q_ASSERT(popup->testAttribute(Qt::WA_WState_Created));
- if (QWidgetPrivate::mouseGrabber != 0)
- QWidgetPrivate::mouseGrabber->grabMouse();
-
- if (QWidgetPrivate::keyboardGrabber != 0)
- QWidgetPrivate::keyboardGrabber->grabKeyboard();
-
- QWidget *fw = QApplicationPrivate::active_window ? QApplicationPrivate::active_window->focusWidget()
- : q_func()->focusWidget();
- if (fw) {
- if(fw->window()->isModal()) // restore pointer capture for modal window
- fw->effectiveWinId()->SetPointerCapture(true);
-
- if (fw != q_func()->focusWidget()) {
- fw->setFocus(Qt::PopupFocusReason);
- } else {
- QFocusEvent e(QEvent::FocusIn, Qt::PopupFocusReason);
- q_func()->sendEvent(fw, &e);
- }
- }
- }
- } else {
-
- // popups are not focus-handled by the window system (the
- // first popup grabbed the keyboard), so we have to do that
- // manually: A popup was closed, so the previous popup gets
- // the focus.
- QWidget* aw = QApplicationPrivate::popupWidgets->last();
- if (QWidget *fw = QApplication::focusWidget()) {
- QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason);
- q_func()->sendEvent(fw, &e);
- }
-
- // Enable pointer capture for previous popup
- if (aw) {
- aw->effectiveWinId()->SetPointerCapture(true);
- }
- }
-}
-
-QWidget * QApplication::topLevelAt(QPoint const& point)
-{
- QWidget *found = 0;
- int lowestZ = INT_MAX;
- QWidgetList list = QApplication::topLevelWidgets();
- for (int i = 0; i < list.count(); ++i) {
- QWidget *widget = list.at(i);
- if (widget->isVisible() && !(widget->windowType() == Qt::Desktop)) {
- Q_ASSERT(widget->testAttribute(Qt::WA_WState_Created));
- if (widget->geometry().adjusted(0,0,1,1).contains(point)) {
- // At this point we know there is a Qt widget under the point.
- // Now we need to make sure it is the top most in the z-order.
- RDrawableWindow *const window = widget->effectiveWinId()->DrawableWindow();
- int z = window->OrdinalPosition();
- if (z < lowestZ) {
- lowestZ = z;
- found = widget;
- }
- }
- }
- }
- return found;
-}
-
-void QApplication::alert(QWidget * /* widget */, int /* duration */)
-{
- // TODO: Implement QApplication::alert(QWidget *widget, int duration)
-}
-
-int QApplication::doubleClickInterval()
-{
- TTimeIntervalMicroSeconds32 us;
- TInt distance;
- S60->wsSession().GetDoubleClickSettings(us, distance);
- return (us.Int() / 1000);
-}
-
-void QApplication::setDoubleClickInterval(int ms)
-{
- TTimeIntervalMicroSeconds32 newUs( ms * 1000);
- TTimeIntervalMicroSeconds32 us;
- TInt distance;
- S60->wsSession().GetDoubleClickSettings(us, distance);
- if (us != newUs)
- S60->wsSession().SetDoubleClick(newUs, distance);
-}
-
-int QApplication::keyboardInputInterval()
-{
- return QApplicationPrivate::keyboard_input_time;
-}
-
-void QApplication::setKeyboardInputInterval(int ms)
-{
- QApplicationPrivate::keyboard_input_time = ms;
-}
-
-int QApplication::cursorFlashTime()
-{
- return QApplicationPrivate::cursor_flash_time;
-}
-
-void QApplication::setCursorFlashTime(int msecs)
-{
- QApplicationPrivate::cursor_flash_time = msecs;
-}
-
-void QApplication::beep()
-{
- if (!qt_S60Beep) {
- TInt frequency = 880;
- TTimeIntervalMicroSeconds duration(500000);
- TRAP_IGNORE(qt_S60Beep=QS60Beep::NewL(frequency, duration));
- }
- if (qt_S60Beep)
- qt_S60Beep->Play();
-}
-
-static inline bool callSymbianEventFilters(const QSymbianEvent *event)
-{
- long unused;
- return qApp->filterEvent(const_cast<QSymbianEvent *>(event), &unused);
-}
-
-/*!
- \warning This function is only available on Symbian.
- \since 4.6
-
- This function processes an individual Symbian event
- \a event. It returns 1 if the event was handled, 0 if
- the \a event was not handled, and -1 if the event was
- not handled because the event is not known to Qt.
- */
-
-int QApplication::symbianProcessEvent(const QSymbianEvent *event)
-{
- Q_D(QApplication);
-
- QScopedLoopLevelCounter counter(d->threadData);
-
- if (d->eventDispatcher->filterEvent(const_cast<QSymbianEvent *>(event)))
- return 1;
-
- QWidget *w = qApp ? qApp->focusWidget() : 0;
- if (w) {
- QInputContext *ic = w->inputContext();
- if (ic && ic->symbianFilterEvent(w, event))
- return 1;
- }
-
- if (symbianEventFilter(event))
- return 1;
-
- switch (event->type()) {
- case QSymbianEvent::WindowServerEvent:
- return d->symbianProcessWsEvent(event);
- case QSymbianEvent::CommandEvent:
- return d->symbianHandleCommand(event);
- case QSymbianEvent::ResourceChangeEvent:
- return d->symbianResourceChange(event);
- default:
- return -1;
- }
-}
-
-int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent)
-{
- // Qt event handling. Handle some events regardless of if the handle is in our
- // widget map or not.
- const TWsEvent *event = symbianEvent->windowServerEvent();
- CCoeControl* control = reinterpret_cast<CCoeControl*>(event->Handle());
- const bool controlInMap = QWidgetPrivate::mapper && QWidgetPrivate::mapper->contains(control);
- switch (event->Type()) {
- case EEventPointerEnter:
- if (controlInMap) {
- callSymbianEventFilters(symbianEvent);
- return 1; // Qt::Enter will be generated in HandlePointerL
- }
- break;
- case EEventPointerExit:
- if (controlInMap) {
- if (callSymbianEventFilters(symbianEvent))
- return 1;
- if (S60) {
- // mouseEvent outside our window, send leave event to last focused widget
- QMouseEvent mEvent(QEvent::Leave, S60->lastPointerEventPos, S60->lastCursorPos,
- Qt::NoButton, QApplicationPrivate::mouse_buttons, Qt::NoModifier);
- if (S60->lastPointerEventTarget)
- qt_sendSpontaneousEvent(S60->lastPointerEventTarget,&mEvent);
- S60->lastPointerEventTarget = 0;
- }
- return 1;
- }
- break;
- case EEventScreenDeviceChanged: // fallthrough
-#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS)
- case EEventDisplayChanged:
-#endif
- if (callSymbianEventFilters(symbianEvent))
- return 1;
- if (S60)
- S60->updateScreenSize();
- if (qt_desktopWidget) {
- QSize oldSize = qt_desktopWidget->size();
- qt_desktopWidget->data->crect.setWidth(S60->screenWidthInPixels);
- qt_desktopWidget->data->crect.setHeight(S60->screenHeightInPixels);
- QResizeEvent e(qt_desktopWidget->size(), oldSize);
- QApplication::sendEvent(qt_desktopWidget, &e);
- }
- return 0; // Propagate to CONE
- case EEventWindowVisibilityChanged:
- if (controlInMap) {
- if (callSymbianEventFilters(symbianEvent))
- return 1;
- const TWsVisibilityChangedEvent *visChangedEvent = event->VisibilityChanged();
- if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible)
- S60->controlVisibilityChanged(control, false);
- else if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible)
- S60->controlVisibilityChanged(control, true);
- return 1;
- }
- break;
- case EEventFocusGained:
- if (callSymbianEventFilters(symbianEvent))
- return 1;
-#ifndef QT_NO_CURSOR
- //re-enable mouse interaction
- if (S60->mouseInteractionEnabled) {
-#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
- if (S60->brokenPointerCursors)
- qt_symbian_show_pointer_sprite();
- else
-#endif
- S60->wsSession().SetPointerCursorMode(EPointerCursorNormal);
- }
-#endif
-#ifdef QT_SOFTKEYS_ENABLED
- if (!CEikonEnv::Static()->EikAppUi()->IsDisplayingMenuOrDialog())
- QSoftKeyManager::updateSoftKeys();
-#endif
- break;
- case EEventFocusLost:
- if (callSymbianEventFilters(symbianEvent))
- return 1;
-#ifndef QT_NO_CURSOR
- //disable mouse as may be moving to application that does not support it
- if (S60->mouseInteractionEnabled) {
-#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
- if (S60->brokenPointerCursors)
- qt_symbian_hide_pointer_sprite();
- else
-#endif
- S60->wsSession().SetPointerCursorMode(EPointerCursorNone);
- }
-#endif
- break;
- case KGoomMemoryLowEvent:
-#ifdef QT_DEBUG
- qDebug() << "QApplicationPrivate::symbianProcessWsEvent - KGoomMemoryLowEvent";
-#endif
- if (callSymbianEventFilters(symbianEvent))
- return 1;
-#ifdef QT_GRAPHICSSYSTEM_RUNTIME
- if(QApplicationPrivate::runtime_graphics_system) {
- bool switchToSwRendering(false);
-
- foreach (QWidget *w, QApplication::topLevelWidgets()) {
- if(w->d_func()->topData()->backingStore) {
- switchToSwRendering = true;
- break;
- }
- }
-
- if (switchToSwRendering) {
- QRuntimeGraphicsSystem *gs =
- static_cast<QRuntimeGraphicsSystem*>(QApplicationPrivate::graphics_system);
- gs->setGraphicsSystem(QLatin1String("raster"));
- }
- }
-#endif
- break;
- case KGoomMemoryGoodEvent:
-#ifdef QT_DEBUG
- qDebug() << "QApplicationPrivate::symbianProcessWsEvent - KGoomMemoryGoodEvent";
-#endif
- if (callSymbianEventFilters(symbianEvent))
- return 1;
-#ifdef QT_GRAPHICSSYSTEM_RUNTIME
- if(QApplicationPrivate::runtime_graphics_system) {
- QRuntimeGraphicsSystem *gs =
- static_cast<QRuntimeGraphicsSystem*>(QApplicationPrivate::graphics_system);
- gs->setGraphicsSystem(QLatin1String("openvg"));
- }
-#endif
- break;
-#ifdef Q_SYMBIAN_SUPPORTS_SURFACES
- case EEventUser:
- {
- // GOOM is looking for candidates to kill so indicate that we are
- // capable of cleaning up by handling this event
- TInt32 *data = reinterpret_cast<TInt32 *>(event->EventData());
- if (data[0] == EApaSystemEventShutdown && data[1] == KGoomMemoryLowEvent)
- return 1;
- }
- break;
-#endif
-
-#ifdef Q_WS_S60
- case KEikInputLanguageChange:
- qt_keymapper_private()->updateInputLanguage();
- break;
-#endif
-
- default:
- break;
- }
-
- if (!controlInMap)
- return -1;
-
- return 0;
-}
-
-/*!
- \warning This virtual function is only available on Symbian.
- \since 4.6
-
- If you create an application that inherits QApplication and reimplement
- this function, you get direct access to events that the are received
- from Symbian. The events are passed in the \a event parameter.
-
- Return true if you want to stop the event from being processed. Return
- false for normal event dispatching. The default implementation returns
- false, and does nothing with \a event.
- */
-bool QApplication::symbianEventFilter(const QSymbianEvent *event)
-{
- Q_UNUSED(event);
- return false;
-}
-
-/*!
- \warning This function is only available on Symbian.
- \since 4.6
-
- Handles \a{command}s which are typically handled by
- CAknAppUi::HandleCommandL(). Qts Ui integration into Symbian is
- partially achieved by deriving from CAknAppUi. Currently, exit,
- menu and softkey commands are handled.
-
- \sa s60EventFilter(), s60ProcessEvent()
-*/
-int QApplicationPrivate::symbianHandleCommand(const QSymbianEvent *symbianEvent)
-{
- Q_Q(QApplication);
- int ret = 0;
-
- if (callSymbianEventFilters(symbianEvent))
- return 1;
-
- int command = symbianEvent->command();
-
- switch (command) {
-#ifdef Q_WS_S60
- case EAknSoftkeyExit: {
- QCloseEvent ev;
- QApplication::sendSpontaneousEvent(q, &ev);
- if (ev.isAccepted()) {
- q->quit();
- ret = 1;
- }
- break;
- }
-#endif
- case EEikCmdExit:
- q->quit();
- ret = 1;
- break;
- default:
-#ifdef Q_WS_S60
- bool handled = QSoftKeyManager::handleCommand(command);
- if (handled)
- ret = 1;
- else
- ret = QMenuBarPrivate::symbianCommands(command);
-#endif
- break;
- }
-
- return ret;
-}
-
-/*!
- \warning This function is only available on Symbian.
- \since 4.6
-
- Handles the resource change specified by \a type.
-
- Currently, KEikDynamicLayoutVariantSwitch and
- KAknsMessageSkinChange are handled.
- */
-int QApplicationPrivate::symbianResourceChange(const QSymbianEvent *symbianEvent)
-{
- int ret = 0;
-
- int type = symbianEvent->resourceChangeType();
-
- switch (type) {
-#ifdef Q_WS_S60
- case KEikDynamicLayoutVariantSwitch:
- {
- if (callSymbianEventFilters(symbianEvent))
- return 1;
- if (S60)
- S60->updateScreenSize();
-
-#ifndef QT_NO_STYLE_S60
- QS60Style *s60Style = 0;
-
-#ifndef QT_NO_STYLE_STYLESHEET
- QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle*>(QApplication::style());
- if (proxy)
- s60Style = qobject_cast<QS60Style*>(proxy->baseStyle());
- else
-#endif
- s60Style = qobject_cast<QS60Style*>(QApplication::style());
-
- if (s60Style) {
- s60Style->d_func()->handleDynamicLayoutVariantSwitch();
- ret = 1;
- }
-#endif
- }
- break;
-
-#ifndef QT_NO_STYLE_S60
- case KAknsMessageSkinChange:
- if (callSymbianEventFilters(symbianEvent))
- return 1;
- if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style())) {
- s60Style->d_func()->handleSkinChange();
- ret = 1;
- }
- break;
-#endif
-#endif // Q_WS_S60
- default:
- break;
- }
-
- return ret;
-}
-
-#ifndef QT_NO_WHEELEVENT
-int QApplication::wheelScrollLines()
-{
- return QApplicationPrivate::wheel_scroll_lines;
-}
-
-void QApplication::setWheelScrollLines(int n)
-{
- QApplicationPrivate::wheel_scroll_lines = n;
-}
-#endif //QT_NO_WHEELEVENT
-
-bool QApplication::isEffectEnabled(Qt::UIEffect /* effect */)
-{
- // TODO: Implement QApplication::isEffectEnabled(Qt::UIEffect effect)
- return false;
-}
-
-void QApplication::setEffectEnabled(Qt::UIEffect /* effect */, bool /* enable */)
-{
- // TODO: Implement QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable)
-}
-
-TUint QApplicationPrivate::resolveS60ScanCode(TInt scanCode, TUint keysym)
-{
- if (!scanCode)
- return keysym;
-
- QApplicationPrivate *d = QApplicationPrivate::instance();
-
- if (keysym) {
- // If keysym is specified, cache it.
- d->scanCodeCache.insert(scanCode, keysym);
- return keysym;
- } else {
- // If not, retrieve the cached version.
- return d->scanCodeCache[scanCode];
- }
-}
-
-void QApplicationPrivate::initializeMultitouch_sys()
-{
-#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
- if (HAL::Get(HALData::EPointer3DPressureSupported, pressureSupported) != KErrNone)
- pressureSupported = 0;
- if (HAL::Get(HALData::EPointer3DMaxPressure, maxTouchPressure) != KErrNone)
- maxTouchPressure = KMaxTInt;
-#else
- pressureSupported = 0;
- maxTouchPressure = KMaxTInt;
-#endif
-}
-
-void QApplicationPrivate::cleanupMultitouch_sys()
-{ }
-
-#ifndef QT_NO_SESSIONMANAGER
-QSessionManager::QSessionManager(QApplication * /* app */, QString & /* id */, QString& /* key */)
-{
-
-}
-
-QSessionManager::~QSessionManager()
-{
-
-}
-
-bool QSessionManager::allowsInteraction()
-{
- return false;
-}
-
-void QSessionManager::cancel()
-{
-
-}
-#endif //QT_NO_SESSIONMANAGER
-
-#ifdef QT_KEYPAD_NAVIGATION
-/*
- * Show/Hide the mouse cursor depending on phone type and chosen mode
- */
-void QApplicationPrivate::setNavigationMode(Qt::NavigationMode mode)
-{
-#ifndef QT_NO_CURSOR
- const bool wasCursorOn = (QApplicationPrivate::navigationMode == Qt::NavigationModeCursorAuto
- && !S60->hasTouchscreen)
- || QApplicationPrivate::navigationMode == Qt::NavigationModeCursorForceVisible;
- const bool isCursorOn = (mode == Qt::NavigationModeCursorAuto
- && !S60->hasTouchscreen)
- || mode == Qt::NavigationModeCursorForceVisible;
-
- if (!wasCursorOn && isCursorOn) {
- //Show the cursor, when changing from another mode to cursor mode
- qt_symbian_set_cursor_visible(true);
- }
- else if (wasCursorOn && !isCursorOn) {
- //Hide the cursor, when leaving cursor mode
- qt_symbian_set_cursor_visible(false);
- }
-#endif
- QApplicationPrivate::navigationMode = mode;
-}
-#endif
-
-#ifndef QT_NO_CURSOR
-/*****************************************************************************
- QApplication cursor stack
- *****************************************************************************/
-
-void QApplication::setOverrideCursor(const QCursor &cursor)
-{
- qApp->d_func()->cursor_list.prepend(cursor);
- qt_symbian_setGlobalCursor(cursor);
-}
-
-void QApplication::restoreOverrideCursor()
-{
- if (qApp->d_func()->cursor_list.isEmpty())
- return;
- qApp->d_func()->cursor_list.removeFirst();
-
- if (!qApp->d_func()->cursor_list.isEmpty()) {
- qt_symbian_setGlobalCursor(qApp->d_func()->cursor_list.first());
- }
- else {
- //determine which widget has focus
- QWidget *w = QApplication::widgetAt(QCursor::pos());
-#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
- if (S60->brokenPointerCursors) {
- qt_symbian_set_pointer_sprite(w ? w->cursor() : Qt::ArrowCursor);
- }
- else
-#endif
- {
- //because of the internals of window server, we need to force the cursor
- //to be set in all child windows too, otherwise when the cursor is over
- //the child window it may show a widget cursor or arrow cursor instead,
- //depending on construction order.
- QListIterator<WId> iter(QWidgetPrivate::mapper->uniqueKeys());
- while (iter.hasNext()) {
- CCoeControl *ctrl = iter.next();
- if(ctrl->OwnsWindow()) {
- ctrl->DrawableWindow()->ClearPointerCursor();
- }
- }
- if (w)
- qt_symbian_setWindowCursor(w->cursor(), w->effectiveWinId());
- else
- qt_symbian_setWindowGroupCursor(Qt::ArrowCursor, S60->windowGroup());
- }
- }
-}
-
-#endif // QT_NO_CURSOR
-
-void QApplicationPrivate::_q_aboutToQuit()
-{
- qt_beginFullScreenEffect();
-
-#ifdef Q_SYMBIAN_TRANSITION_EFFECTS
- // Send the shutdown tfx command
- S60->wsSession().SendEffectCommand(ETfxCmdAppShutDown);
-#endif
-}
-
-QS60ThreadLocalData::QS60ThreadLocalData()
-{
- CCoeEnv *env = CCoeEnv::Static();
- if (env) {
- //if this is the UI thread, share objects owned by CONE
- usingCONEinstances = true;
- wsSession = env->WsSession();
- screenDevice = env->ScreenDevice();
- }
- else {
- usingCONEinstances = false;
- qt_symbian_throwIfError(wsSession.Connect(qt_s60GetRFs()));
- screenDevice = new CWsScreenDevice(wsSession);
- screenDevice->Construct();
- }
-}
-
-QS60ThreadLocalData::~QS60ThreadLocalData()
-{
- for (int i = 0; i < releaseFuncs.count(); ++i)
- releaseFuncs[i]();
- releaseFuncs.clear();
- if (!usingCONEinstances) {
- delete screenDevice;
- wsSession.Close();
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/s60/qclipboard_s60.cpp b/src/widgets/platforms/s60/qclipboard_s60.cpp
deleted file mode 100644
index f5314bd9e7..0000000000
--- a/src/widgets/platforms/s60/qclipboard_s60.cpp
+++ /dev/null
@@ -1,331 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qclipboard.h"
-
-#ifndef QT_NO_CLIPBOARD
-
-#include "qapplication.h"
-#include "qbitmap.h"
-#include "qdatetime.h"
-#include "qbuffer.h"
-#include "qwidget.h"
-#include "qevent.h"
-#include "private/qcore_symbian_p.h"
-#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
-#include "txtclipboard.h"
-#endif
-#include "txtetext.h"
-#include <QtDebug>
-
-// Symbian's clipboard
-#include <baclipb.h>
-QT_BEGIN_NAMESPACE
-
-const TUid KQtCbDataStream = {0x2001B2DD};
-const TInt KPlainTextBegin = 0;
-
-class QClipboardData
-{
-public:
- QClipboardData();
- ~QClipboardData();
-
- void setSource(QMimeData* s)
- {
- if (s == src)
- return;
- delete src;
- src = s;
- }
- QMimeData* source()
- { return src; }
- bool connected()
- { return connection; }
- void clear();
-
-private:
- QMimeData* src;
- bool connection;
-};
-
-QClipboardData::QClipboardData():src(0),connection(true)
-{
- clear();
-}
-
-QClipboardData::~QClipboardData()
-{
- connection = false;
- delete src;
-}
-
-void QClipboardData::clear()
-{
- QMimeData* newSrc = new QMimeData;
- delete src;
- src = newSrc;
-}
-
-static QClipboardData *internalCbData = 0;
-
-static void cleanupClipboardData()
-{
- delete internalCbData;
- internalCbData = 0;
-}
-
-static QClipboardData *clipboardData()
-{
- if (internalCbData == 0) {
- internalCbData = new QClipboardData;
- if (internalCbData)
- {
- if (!internalCbData->connected())
- {
- delete internalCbData;
- internalCbData = 0;
- }
- else
- {
- qAddPostRoutine(cleanupClipboardData);
- }
- }
- }
- return internalCbData;
-}
-
-void writeToStreamLX(const QMimeData* aData, RWriteStream& aStream)
-{
- // This function both leaves and throws exceptions. There must be no destructor
- // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects.
- QStringList headers = aData->formats();
- aStream << TCardinality(headers.count());
- for (QStringList::const_iterator iter= headers.constBegin();iter != headers.constEnd();iter++)
- {
- HBufC* stringData = TPtrC(reinterpret_cast<const TUint16*>((*iter).utf16())).AllocLC();
- QByteArray ba = aData->data((*iter));
- // mime type
- aStream << TCardinality(stringData->Size());
- aStream << *(stringData);
- // mime data
- aStream << TCardinality(ba.size());
- aStream.WriteL(reinterpret_cast<const uchar*>(ba.constData()),ba.size());
- CleanupStack::PopAndDestroy(stringData);
- }
-}
-
-void writeToSymbianStoreLX(const QMimeData* aData, CClipboard* clipboard)
-{
- // This function both leaves and throws exceptions. There must be no destructor
- // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects.
- if (aData->hasText()) {
- CPlainText* text = CPlainText::NewL();
- CleanupStack::PushL(text);
-
- TPtrC textPtr(qt_QString2TPtrC(aData->text()));
- text->InsertL(KPlainTextBegin, textPtr);
- text->CopyToStoreL(clipboard->Store(), clipboard->StreamDictionary(),
- KPlainTextBegin, textPtr.Length());
- CleanupStack::PopAndDestroy(text);
- }
-}
-
-void readSymbianStoreLX(QMimeData* aData, CClipboard* clipboard)
-{
- // This function both leaves and throws exceptions. There must be no destructor
- // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects.
- CPlainText* text = CPlainText::NewL();
- CleanupStack::PushL(text);
- TInt dataLength = text->PasteFromStoreL(clipboard->Store(), clipboard->StreamDictionary(),
- KPlainTextBegin);
- if (dataLength == 0) {
- User::Leave(KErrNotFound);
- }
- HBufC* hBuf = HBufC::NewL(dataLength);
- TPtr buf = hBuf->Des();
- text->Extract(buf, KPlainTextBegin, dataLength);
-
- QString string = qt_TDesC2QString(buf);
- CleanupStack::PopAndDestroy(text);
-
- aData->setText(string);
-}
-
-void readFromStreamLX(QMimeData* aData,RReadStream& aStream)
-{
- // This function both leaves and throws exceptions. There must be no destructor
- // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects.
- TCardinality mimeTypeCount;
- aStream >> mimeTypeCount;
- for (int i = 0; i< mimeTypeCount;i++)
- {
- // mime type
- TCardinality mimeTypeSize;
- aStream >> mimeTypeSize;
- HBufC* mimeTypeBuf = HBufC::NewLC(aStream,mimeTypeSize);
- QString mimeType = QString(reinterpret_cast<const QChar *>(mimeTypeBuf->Des().Ptr()),
- mimeTypeBuf->Length());
- CleanupStack::PopAndDestroy(mimeTypeBuf);
- // mime data
- TCardinality dataSize;
- aStream >> dataSize;
- QByteArray ba;
- ba.reserve(dataSize);
- aStream.ReadL(reinterpret_cast<uchar*>(ba.data_ptr()->data),dataSize);
- ba.data_ptr()->size = dataSize;
- aData->setData(mimeType,ba);
- }
-}
-
-
-/*****************************************************************************
- QClipboard member functions
- *****************************************************************************/
-
-void QClipboard::clear(Mode mode)
-{
- setText(QString(), mode);
-}
-const QMimeData* QClipboard::mimeData(Mode mode) const
-{
- if (mode != Clipboard) return 0;
- QClipboardData *d = clipboardData();
- bool dataExists(false);
- if (d)
- {
- TRAPD(err,{
- RFs fs = qt_s60GetRFs();
- CClipboard* cb = CClipboard::NewForReadingLC(fs);
- Q_ASSERT(cb);
- //stream for qt
- RStoreReadStream stream;
- TStreamId stid = (cb->StreamDictionary()).At(KQtCbDataStream);
- if (stid != 0) {
- stream.OpenLC(cb->Store(),stid);
- QT_TRYCATCH_LEAVING(readFromStreamLX(d->source(),stream));
- CleanupStack::PopAndDestroy(&stream);
- dataExists = true;
- }
- else {
- //symbian clipboard
- RStoreReadStream symbianStream;
- TStreamId symbianStId = (cb->StreamDictionary()).At(KClipboardUidTypePlainText);
- if (symbianStId != 0) {
- symbianStream.OpenLC(cb->Store(), symbianStId);
- QT_TRYCATCH_LEAVING(readSymbianStoreLX(d->source(), cb));
- CleanupStack::PopAndDestroy(&symbianStream);
- dataExists = true;
- }
- }
- CleanupStack::PopAndDestroy(cb);
- });
- if (err != KErrNone){
- qDebug()<< "clipboard is empty/err: " << err;
- }
-
- if (dataExists) {
- return d->source();
- }
- }
- return 0;
-}
-
-
-void QClipboard::setMimeData(QMimeData* src, Mode mode)
-{
- if (mode != Clipboard) return;
- QClipboardData *d = clipboardData();
- if (d)
- {
- TRAPD(err,{
- RFs fs = qt_s60GetRFs();
- CClipboard* cb = CClipboard::NewForWritingLC(fs);
- //stream for qt
- RStoreWriteStream stream;
- TStreamId stid = stream.CreateLC(cb->Store());
- QT_TRYCATCH_LEAVING(writeToStreamLX(src,stream));
- d->setSource(src);
- stream.CommitL();
- (cb->StreamDictionary()).AssignL(KQtCbDataStream,stid);
- cb->CommitL();
-
- //stream for symbian
- RStoreWriteStream symbianStream;
- TStreamId symbianStId = symbianStream.CreateLC(cb->Store());
- QT_TRYCATCH_LEAVING(writeToSymbianStoreLX(src, cb));
- (cb->StreamDictionary()).AssignL(KClipboardUidTypePlainText, symbianStId);
- cb->CommitL();
- CleanupStack::PopAndDestroy(3,cb);
- });
- if (err != KErrNone){
- qDebug()<< "clipboard write err :" << err;
- }
- }
- emitChanged(QClipboard::Clipboard);
-}
-
-bool QClipboard::supportsMode(Mode mode) const
-{
- return (mode == Clipboard);
-}
-
-bool QClipboard::ownsMode(Mode mode) const
-{
- if (mode == Clipboard)
- qWarning("QClipboard::ownsClipboard: UNIMPLEMENTED!");
- return false;
-}
-
-bool QClipboard::event(QEvent * /* e */)
-{
- return true;
-}
-
-void QClipboard::connectNotify( const char * )
-{
-}
-
-void QClipboard::ownerDestroyed()
-{
-}
-QT_END_NAMESPACE
-#endif // QT_NO_CLIPBOARD
diff --git a/src/widgets/platforms/s60/qcoefepinputcontext_p.h b/src/widgets/platforms/s60/qcoefepinputcontext_p.h
deleted file mode 100644
index 148f092ac5..0000000000
--- a/src/widgets/platforms/s60/qcoefepinputcontext_p.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCOEFEPINPUTCONTEXT_P_H
-#define QCOEFEPINPUTCONTEXT_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.
-//
-
-#ifndef QT_NO_IM
-
-#include "qinputcontext.h"
-#include <qhash.h>
-#include <qtimer.h>
-#include <private/qcore_symbian_p.h>
-#include <private/qt_s60_p.h>
-
-#include <fepbase.h>
-#include <aknedsts.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_AUTOTEST_EXPORT QCoeFepInputContext : public QInputContext,
- public MCoeFepAwareTextEditor,
- public MCoeFepAwareTextEditor_Extension1,
- public MObjectProvider
-{
- Q_OBJECT
-
-public:
- QCoeFepInputContext(QObject *parent = 0);
- ~QCoeFepInputContext();
-
- QString identifierName() { return QLatin1String("coefep"); }
- QString language();
-
- void reset();
- void update();
-
- bool filterEvent(const QEvent *event);
- bool symbianFilterEvent(QWidget *keyWidget, const QSymbianEvent *event);
- void mouseHandler( int x, QMouseEvent *event);
- bool isComposing() const { return !m_preeditString.isEmpty(); }
-
- void setFocusWidget(QWidget * w);
- void widgetDestroyed(QWidget *w);
-
- TCoeInputCapabilities inputCapabilities();
-
- void resetSplitViewWidget(bool keepInputWidget = false);
- void ensureFocusWidgetVisible(QWidget *widget);
-
-protected:
- void timerEvent(QTimerEvent *timerEvent);
-
-private:
- void commitCurrentString(bool cancelFepTransaction);
- void updateHints(bool mustUpdateInputCapabilities);
- void applyHints(Qt::InputMethodHints hints);
- void applyFormat(QList<QInputMethodEvent::Attribute> *attributes);
- void queueInputCapabilitiesChanged();
- bool needsInputPanel();
- void commitTemporaryPreeditString();
- bool isWidgetVisible(QWidget *widget, int offset = 0);
-
-private Q_SLOTS:
- void ensureInputCapabilitiesChanged();
- void translateInputWidget();
-
- // From MCoeFepAwareTextEditor
-public:
- void StartFepInlineEditL(const TDesC& aInitialInlineText, TInt aPositionOfInsertionPointInInlineText,
- TBool aCursorVisibility, const MFormCustomDraw* aCustomDraw,
- MFepInlineTextFormatRetriever& aInlineTextFormatRetriever,
- MFepPointerEventHandlerDuringInlineEdit& aPointerEventHandlerDuringInlineEdit);
- void UpdateFepInlineTextL(const TDesC& aNewInlineText, TInt aPositionOfInsertionPointInInlineText);
- void SetInlineEditingCursorVisibilityL(TBool aCursorVisibility);
- void CancelFepInlineEdit();
- TInt DocumentLengthForFep() const;
- TInt DocumentMaximumLengthForFep() const;
- void SetCursorSelectionForFepL(const TCursorSelection& aCursorSelection);
- void GetCursorSelectionForFep(TCursorSelection& aCursorSelection) const;
- void GetEditorContentForFep(TDes& aEditorContent, TInt aDocumentPosition, TInt aLengthToRetrieve) const;
- void GetFormatForFep(TCharFormat& aFormat, TInt aDocumentPosition) const;
- void GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLine, TInt& aHeight, TInt& aAscent,
- TInt aDocumentPosition) const;
-private:
- void DoCommitFepInlineEditL();
- MCoeFepAwareTextEditor_Extension1* Extension1(TBool& aSetToTrue);
- void ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType);
-
- // From MCoeFepAwareTextEditor_Extension1
-public:
- void SetStateTransferingOwnershipL(MCoeFepAwareTextEditor_Extension1::CState* aState, TUid aTypeSafetyUid);
- MCoeFepAwareTextEditor_Extension1::CState* State(TUid aTypeSafetyUid);
-
- // From MObjectProvider
-public:
- TTypeUid::Ptr MopSupplyObject(TTypeUid id);
- MObjectProvider *MopNext();
-
-private:
- QSymbianControl *m_parent;
- CAknEdwinState *m_fepState;
- QString m_preeditString;
- Qt::InputMethodHints m_lastImHints;
- TUint m_textCapabilities;
- bool m_inDestruction;
- bool m_pendingInputCapabilitiesChanged;
- int m_cursorVisibility;
- int m_inlinePosition;
- MFepInlineTextFormatRetriever *m_formatRetriever;
- MFepPointerEventHandlerDuringInlineEdit *m_pointerHandler;
- QBasicTimer m_tempPreeditStringTimeout;
- bool m_hasTempPreeditString;
-
- int m_splitViewResizeBy;
- Qt::WindowStates m_splitViewPreviousWindowStates;
- QRectF m_transformation;
-
- friend class tst_QInputContext;
-};
-
-Q_WIDGETS_EXPORT void qt_s60_setPartialScreenInputMode(bool enable);
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_IM
-
-#endif // QCOEFEPINPUTCONTEXT_P_H
diff --git a/src/widgets/platforms/s60/qcoefepinputcontext_s60.cpp b/src/widgets/platforms/s60/qcoefepinputcontext_s60.cpp
deleted file mode 100644
index 8c215360d8..0000000000
--- a/src/widgets/platforms/s60/qcoefepinputcontext_s60.cpp
+++ /dev/null
@@ -1,1200 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT_NO_IM
-
-#include "qcoefepinputcontext_p.h"
-#include <qapplication.h>
-#include <qtextformat.h>
-#include <qgraphicsview.h>
-#include <qgraphicsscene.h>
-#include <qgraphicswidget.h>
-#include <qsymbianevent.h>
-#include <qlayout.h>
-#include <qdesktopwidget.h>
-#include <private/qcore_symbian_p.h>
-
-#include <fepitfr.h>
-#include <hal.h>
-
-#include <limits.h>
-// You only find these enumerations on SDK 5 onwards, so we need to provide our own
-// to remain compatible with older releases. They won't be called by pre-5.0 SDKs.
-
-// MAknEdStateObserver::EAknCursorPositionChanged
-#define QT_EAknCursorPositionChanged MAknEdStateObserver::EAknEdwinStateEvent(6)
-// MAknEdStateObserver::EAknActivatePenInputRequest
-#define QT_EAknActivatePenInputRequest MAknEdStateObserver::EAknEdwinStateEvent(7)
-
-// EAknEditorFlagSelectionVisible is only valid from 3.2 onwards.
-// Sym^3 AVKON FEP manager expects that this flag is used for FEP-aware editors
-// that support text selection.
-#define QT_EAknEditorFlagSelectionVisible 0x100000
-
-// EAknEditorFlagEnablePartialScreen is only valid from Sym^3 onwards.
-#define QT_EAknEditorFlagEnablePartialScreen 0x200000
-
-QT_BEGIN_NAMESPACE
-
-Q_WIDGETS_EXPORT void qt_s60_setPartialScreenInputMode(bool enable)
-{
- S60->partial_keyboard = enable;
-
- QInputContext *ic = 0;
- if (QApplication::focusWidget()) {
- ic = QApplication::focusWidget()->inputContext();
- } else if (qApp && qApp->inputContext()) {
- ic = qApp->inputContext();
- }
- if (ic)
- ic->update();
-}
-
-QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
- : QInputContext(parent),
- m_fepState(q_check_ptr(new CAknEdwinState)), // CBase derived object needs check on new
- m_lastImHints(Qt::ImhNone),
- m_textCapabilities(TCoeInputCapabilities::EAllText),
- m_inDestruction(false),
- m_pendingInputCapabilitiesChanged(false),
- m_cursorVisibility(1),
- m_inlinePosition(0),
- m_formatRetriever(0),
- m_pointerHandler(0),
- m_hasTempPreeditString(false),
- m_splitViewResizeBy(0),
- m_splitViewPreviousWindowStates(Qt::WindowNoState)
-{
- m_fepState->SetObjectProvider(this);
- int defaultFlags = EAknEditorFlagDefault;
- if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) {
- if (S60->partial_keyboard) {
- defaultFlags |= QT_EAknEditorFlagEnablePartialScreen;
- }
- defaultFlags |= QT_EAknEditorFlagSelectionVisible;
- }
- m_fepState->SetFlags(defaultFlags);
- m_fepState->SetDefaultInputMode( EAknEditorTextInputMode );
- m_fepState->SetPermittedInputModes( EAknEditorAllInputModes );
- m_fepState->SetDefaultCase( EAknEditorTextCase );
- m_fepState->SetPermittedCases( EAknEditorAllCaseModes );
- m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG);
- m_fepState->SetNumericKeymap(EAknEditorAlphanumericNumberModeKeymap);
-}
-
-QCoeFepInputContext::~QCoeFepInputContext()
-{
- m_inDestruction = true;
-
- // This is to make sure that the FEP manager "forgets" about us,
- // otherwise we may get callbacks even after we're destroyed.
- // The call below is essentially equivalent to InputCapabilitiesChanged(),
- // but is synchronous, rather than asynchronous.
- CCoeEnv::Static()->SyncNotifyFocusObserversOfChangeInFocus();
-
- if (m_fepState)
- delete m_fepState;
-}
-
-void QCoeFepInputContext::reset()
-{
- commitCurrentString(true);
-}
-
-void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType)
-{
- QT_TRAP_THROWING(m_fepState->ReportAknEdStateEventL(aEventType));
-}
-
-void QCoeFepInputContext::update()
-{
- updateHints(false);
-
- // For pre-5.0 SDKs, we don't do text updates on S60 side.
- if (QSysInfo::s60Version() < QSysInfo::SV_S60_5_0) {
- return;
- }
-
- // Don't be fooled (as I was) by the name of this enumeration.
- // What it really does is tell the virtual keyboard UI that the text has been
- // updated and it should be reflected in the internal display of the VK.
- ReportAknEdStateEvent(QT_EAknCursorPositionChanged);
-}
-
-void QCoeFepInputContext::setFocusWidget(QWidget *w)
-{
- commitCurrentString(true);
-
- QInputContext::setFocusWidget(w);
-
- updateHints(true);
-}
-
-void QCoeFepInputContext::widgetDestroyed(QWidget *w)
-{
- // Make sure that the input capabilities of whatever new widget got focused are queried.
- CCoeControl *ctrl = w->effectiveWinId();
- if (ctrl->IsFocused()) {
- queueInputCapabilitiesChanged();
- }
-}
-
-QString QCoeFepInputContext::language()
-{
- TLanguage lang = m_fepState->LocalLanguage();
- const QByteArray localeName = qt_symbianLocaleName(lang);
- if (!localeName.isEmpty()) {
- return QString::fromLatin1(localeName);
- } else {
- return QString::fromLatin1("C");
- }
-}
-
-bool QCoeFepInputContext::needsInputPanel()
-{
- switch (QSysInfo::s60Version()) {
- case QSysInfo::SV_S60_3_1:
- case QSysInfo::SV_S60_3_2:
- // There are no touch phones for pre-5.0 SDKs.
- return false;
-#ifdef Q_CC_NOKIAX86
- default:
- // For emulator we assume that we need an input panel, since we can't
- // separate between phone types.
- return true;
-#else
- case QSysInfo::SV_S60_5_0: {
- // For SDK == 5.0, we need phone specific detection, since the HAL API
- // is no good on most phones. However, all phones at the time of writing use the
- // input panel, except N97 in landscape mode, but in this mode it refuses to bring
- // up the panel anyway, so we don't have to care.
- return true;
- }
- default:
- // For unknown/newer types, we try to use the HAL API.
- int keyboardEnabled;
- int keyboardType;
- int err[2];
- err[0] = HAL::Get(HAL::EKeyboard, keyboardType);
- err[1] = HAL::Get(HAL::EKeyboardState, keyboardEnabled);
- if (err[0] == KErrNone && err[1] == KErrNone
- && keyboardType != 0 && keyboardEnabled)
- // Means that we have some sort of keyboard.
- return false;
-
- // Fall back to using the input panel.
- return true;
-#endif // !Q_CC_NOKIAX86
- }
-}
-
-bool QCoeFepInputContext::filterEvent(const QEvent *event)
-{
- // The CloseSoftwareInputPanel event is not handled here, because the VK will automatically
- // close when it discovers that the underlying widget does not have input capabilities.
-
- if (!focusWidget())
- return false;
-
- switch (event->type()) {
- case QEvent::MouseButtonPress:
- // Alphanumeric keypad doesn't like it when we click and text is still getting displayed
- // It ignores the mouse event, so we need to commit and send a selection event (which will get triggered
- // after the commit)
- if (!m_preeditString.isEmpty()) {
- commitCurrentString(true);
-
- int pos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt();
-
- QList<QInputMethodEvent::Attribute> selectAttributes;
- selectAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, pos, 0, QVariant());
- QInputMethodEvent selectEvent(QLatin1String(""), selectAttributes);
- sendEvent(selectEvent);
- }
- break;
- case QEvent::KeyPress:
- commitTemporaryPreeditString();
- // fall through intended
- case QEvent::KeyRelease:
- const QKeyEvent *keyEvent = static_cast<const QKeyEvent *>(event);
- //If proxy exists, always use hints from proxy.
- QWidget *proxy = focusWidget()->focusProxy();
- Qt::InputMethodHints currentHints = proxy ? proxy->inputMethodHints() : focusWidget()->inputMethodHints();
-
- switch (keyEvent->key()) {
- case Qt::Key_F20:
- Q_ASSERT(m_lastImHints == currentHints);
- if (m_lastImHints & Qt::ImhHiddenText) {
- // Special case in Symbian. On editors with secret text, F20 is for some reason
- // considered to be a backspace.
- QKeyEvent modifiedEvent(keyEvent->type(), Qt::Key_Backspace, keyEvent->modifiers(),
- keyEvent->text(), keyEvent->isAutoRepeat(), keyEvent->count());
- QApplication::sendEvent(focusWidget(), &modifiedEvent);
- return true;
- }
- break;
- case Qt::Key_Select:
- if (!m_preeditString.isEmpty()) {
- commitCurrentString(true);
- return true;
- }
- break;
- default:
- break;
- }
-
- QString widgetText = focusWidget()->inputMethodQuery(Qt::ImSurroundingText).toString();
- bool validLength;
- int maxLength = focusWidget()->inputMethodQuery(Qt::ImMaximumTextLength).toInt(&validLength);
- if (!keyEvent->text().isEmpty() && validLength
- && widgetText.size() + m_preeditString.size() >= maxLength) {
- // Don't send key events with string content if the widget is "full".
- return true;
- }
-
- if (keyEvent->type() == QEvent::KeyPress
- && currentHints & Qt::ImhHiddenText
- && !keyEvent->text().isEmpty()) {
- // Send some temporary preedit text in order to make text visible for a moment.
- m_preeditString = keyEvent->text();
- QList<QInputMethodEvent::Attribute> attributes;
- QInputMethodEvent imEvent(m_preeditString, attributes);
- sendEvent(imEvent);
- m_tempPreeditStringTimeout.start(1000, this);
- m_hasTempPreeditString = true;
- update();
- return true;
- }
- break;
- }
-
- if (!needsInputPanel())
- return false;
-
- if (event->type() == QEvent::RequestSoftwareInputPanel) {
- // Notify S60 that we want the virtual keyboard to show up.
- QSymbianControl *sControl;
- sControl = focusWidget()->effectiveWinId()->MopGetObject(sControl);
- Q_ASSERT(sControl);
-
- // The FEP UI temporarily steals focus when it shows up the first time, causing
- // all sorts of weird effects on the focused widgets. Since it will immediately give
- // back focus to us, we temporarily disable focus handling until the job's done.
- if (sControl) {
- sControl->setIgnoreFocusChanged(true);
- }
-
- ensureInputCapabilitiesChanged();
- m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::QT_EAknActivatePenInputRequest);
-
- if (sControl) {
- sControl->setIgnoreFocusChanged(false);
- }
- return true;
- }
-
- return false;
-}
-
-bool QCoeFepInputContext::symbianFilterEvent(QWidget *keyWidget, const QSymbianEvent *event)
-{
- Q_UNUSED(keyWidget);
- if (event->type() == QSymbianEvent::CommandEvent)
- // A command basically means the same as a button being pushed. With Qt buttons
- // that would normally result in a reset of the input method due to the focus change.
- // This should also happen for commands.
- reset();
-
- if (event->type() == QSymbianEvent::WindowServerEvent
- && event->windowServerEvent()
- && event->windowServerEvent()->Type() == EEventWindowVisibilityChanged
- && S60->splitViewLastWidget) {
-
- QGraphicsView *gv = qobject_cast<QGraphicsView*>(S60->splitViewLastWidget);
- const bool alwaysResize = (gv && gv->verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOff);
-
- if (alwaysResize) {
- TUint visibleFlags = event->windowServerEvent()->VisibilityChanged()->iFlags;
- if (visibleFlags & TWsVisibilityChangedEvent::EPartiallyVisible)
- ensureFocusWidgetVisible(S60->splitViewLastWidget);
- if (visibleFlags & TWsVisibilityChangedEvent::ENotVisible)
- resetSplitViewWidget(true);
- }
- }
-
- return false;
-}
-
-void QCoeFepInputContext::timerEvent(QTimerEvent *timerEvent)
-{
- if (timerEvent->timerId() == m_tempPreeditStringTimeout.timerId())
- commitTemporaryPreeditString();
-}
-
-void QCoeFepInputContext::commitTemporaryPreeditString()
-{
- if (m_tempPreeditStringTimeout.isActive())
- m_tempPreeditStringTimeout.stop();
-
- if (!m_hasTempPreeditString)
- return;
-
- commitCurrentString(false);
-}
-
-void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event)
-{
- Q_ASSERT(focusWidget());
-
- if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::LeftButton) {
- commitCurrentString(true);
- int pos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt();
-
- QList<QInputMethodEvent::Attribute> attributes;
- attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, pos + x, 0, QVariant());
- QInputMethodEvent event(QLatin1String(""), attributes);
- sendEvent(event);
- }
-}
-
-TCoeInputCapabilities QCoeFepInputContext::inputCapabilities()
-{
- if (m_inDestruction || !focusWidget()) {
- return TCoeInputCapabilities(TCoeInputCapabilities::ENone, 0, 0);
- }
-
- return TCoeInputCapabilities(m_textCapabilities, this, 0);
-}
-
-void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget)
-{
- QGraphicsView *gv = qobject_cast<QGraphicsView*>(S60->splitViewLastWidget);
-
- if (!gv) {
- return;
- }
-
- QSymbianControl *symControl = static_cast<QSymbianControl*>(gv->effectiveWinId());
- symControl->CancelLongTapTimer();
-
- const bool alwaysResize = (gv->verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOff);
- QWidget *windowToMove = gv->window();
-
- bool userResize = gv->testAttribute(Qt::WA_Resized);
-
- windowToMove->setUpdatesEnabled(false);
-
- if (!alwaysResize) {
- if (gv->scene()) {
- if (gv->scene()->focusItem()) {
- // Check if the widget contains cursorPositionChanged signal and disconnect from it.
- QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged()));
- int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1));
- if (index != -1)
- disconnect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget()));
- }
-
- QGraphicsItem *rootItem = 0;
- foreach (QGraphicsItem *item, gv->scene()->items()) {
- if (!item->parentItem()) {
- rootItem = item;
- break;
- }
- }
- if (rootItem)
- rootItem->resetTransform();
- }
- } else {
- if (m_splitViewResizeBy)
- gv->resize(gv->rect().width(), m_splitViewResizeBy);
- }
- // Resizing might have led to widget losing its original windowstate.
- // Restore previous window state.
-
- if (m_splitViewPreviousWindowStates != windowToMove->windowState())
- windowToMove->setWindowState(m_splitViewPreviousWindowStates);
-
- windowToMove->setUpdatesEnabled(true);
-
- gv->setAttribute(Qt::WA_Resized, userResize); //not a user resize
-
- m_splitViewResizeBy = 0;
- if (!keepInputWidget) {
- m_splitViewPreviousWindowStates = Qt::WindowNoState;
- S60->splitViewLastWidget = 0;
- }
-}
-
-// Checks if a given widget is visible in the splitview rect. The offset
-// parameter can be used to validate if moving widget upwards or downwards
-// by the offset would make a difference for the visibility.
-
-bool QCoeFepInputContext::isWidgetVisible(QWidget *widget, int offset)
-{
- bool visible = false;
- if (widget) {
- QRect splitViewRect = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect());
- QWidget *window = QApplication::activeWindow();
- QGraphicsView *gv = qobject_cast<QGraphicsView*>(widget);
- if (gv && window) {
- if (QGraphicsScene *scene = gv->scene()) {
- if (QGraphicsItem *focusItem = scene->focusItem()) {
- QPoint cursorPos = window->mapToGlobal(focusItem->cursor().pos());
- cursorPos.setY(cursorPos.y() + offset);
- if (splitViewRect.contains(cursorPos)) {
- visible = true;
- }
- }
- }
- }
- }
- return visible;
-}
-
-// Ensure that the input widget is visible in the splitview rect.
-
-void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget)
-{
- // Native side opening and closing its virtual keyboard when it changes the keyboard layout,
- // has an adverse impact on long tap timer. Cancel the timer when splitview opens to avoid this.
- QSymbianControl *symControl = static_cast<QSymbianControl*>(widget->effectiveWinId());
- symControl->CancelLongTapTimer();
-
- // Graphicsviews that have vertical scrollbars should always be resized to the splitview area.
- // Graphicsviews without scrollbars should be translated.
-
- QGraphicsView *gv = qobject_cast<QGraphicsView*>(widget);
- if (!gv)
- return;
-
- const bool alwaysResize = (gv && gv->verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOff);
- const bool moveWithinVisibleArea = (S60->splitViewLastWidget != 0);
-
- QWidget *windowToMove = gv ? gv : symControl->widget();
- if (!windowToMove->isWindow())
- windowToMove = windowToMove->window();
- if (!windowToMove) {
- return;
- }
-
- // When opening the keyboard (not moving within the splitview area), save the original
- // window state. In some cases, ensuring input widget visibility might lead to window
- // states getting changed.
-
- if (!moveWithinVisibleArea) {
- // Check if the widget contains cursorPositionChanged signal and connect to it.
- QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged()));
- if (gv->scene() && gv->scene()->focusItem()) {
- int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1));
- if (index != -1)
- connect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget()));
- }
- S60->splitViewLastWidget = widget;
- m_splitViewPreviousWindowStates = windowToMove->windowState();
- }
-
- int windowTop = widget->window()->pos().y();
-
- const bool userResize = widget->testAttribute(Qt::WA_Resized);
-
- QRect splitViewRect = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect());
-
-
- // When resizing a window widget, it will lose its maximized window state.
- // Native applications hide statuspane in splitview state, so lets move to
- // fullscreen mode. This makes available area slightly bigger, which helps usability
- // and greatly reduces event passing in orientation switch cases,
- // as the statuspane size is not changing.
-
- if (alwaysResize)
- windowToMove->setUpdatesEnabled(false);
-
- if (!(windowToMove->windowState() & Qt::WindowFullScreen)) {
- windowToMove->setWindowState(
- (windowToMove->windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen)) | Qt::WindowFullScreen);
- }
-
- if (alwaysResize) {
- if (!moveWithinVisibleArea) {
- m_splitViewResizeBy = widget->height();
- windowTop = widget->geometry().top();
- widget->resize(widget->width(), splitViewRect.height() - windowTop);
- }
-
- if (gv->scene()) {
- const QRectF microFocusRect = gv->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF();
- gv->ensureVisible(microFocusRect);
- }
- } else {
- translateInputWidget();
- }
-
- if (alwaysResize)
- windowToMove->setUpdatesEnabled(true);
-
- widget->setAttribute(Qt::WA_Resized, userResize); //not a user resize
-}
-
-static QTextCharFormat qt_TCharFormat2QTextCharFormat(const TCharFormat &cFormat, bool validStyleColor)
-{
- QTextCharFormat qFormat;
-
- if (validStyleColor) {
- QBrush foreground(QColor(cFormat.iFontPresentation.iTextColor.Internal()));
- qFormat.setForeground(foreground);
- }
-
- qFormat.setFontStrikeOut(cFormat.iFontPresentation.iStrikethrough == EStrikethroughOn);
- qFormat.setFontUnderline(cFormat.iFontPresentation.iUnderline == EUnderlineOn);
-
- return qFormat;
-}
-
-void QCoeFepInputContext::updateHints(bool mustUpdateInputCapabilities)
-{
- QWidget *w = focusWidget();
- if (w) {
- QWidget *proxy = w->focusProxy();
- Qt::InputMethodHints hints = proxy ? proxy->inputMethodHints() : w->inputMethodHints();
-
- // Since splitview support works like an input method hint, yet it is private flag,
- // we need to update its state separately.
- if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) {
- TInt currentFlags = m_fepState->Flags();
- if (S60->partial_keyboard)
- currentFlags |= QT_EAknEditorFlagEnablePartialScreen;
- else
- currentFlags &= ~QT_EAknEditorFlagEnablePartialScreen;
- if (currentFlags != m_fepState->Flags())
- m_fepState->SetFlags(currentFlags);
- }
-
- if (hints != m_lastImHints) {
- m_lastImHints = hints;
- applyHints(hints);
- } else if (!mustUpdateInputCapabilities) {
- // Optimization. Return immediately if there was no change.
- return;
- }
- }
- queueInputCapabilitiesChanged();
-}
-
-void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints)
-{
- using namespace Qt;
-
- commitTemporaryPreeditString();
-
- const bool anynumbermodes = hints & (ImhDigitsOnly | ImhFormattedNumbersOnly | ImhDialableCharactersOnly);
- const bool anytextmodes = hints & (ImhUppercaseOnly | ImhLowercaseOnly | ImhEmailCharactersOnly | ImhUrlCharactersOnly);
- const bool numbersOnly = anynumbermodes && !anytextmodes;
- const bool noOnlys = !(hints & ImhExclusiveInputMask);
- // if alphanumeric input, or if multiple incompatible number modes are selected;
- // then make all symbols available in numeric mode too.
- const bool needsCharMap= !numbersOnly || ((hints & ImhFormattedNumbersOnly) && (hints & ImhDialableCharactersOnly));
- TInt flags;
- Qt::InputMethodHints oldHints = hints;
-
- // Some sanity checking. Make sure that only one preference is set.
- InputMethodHints prefs = ImhPreferNumbers | ImhPreferUppercase | ImhPreferLowercase;
- prefs &= hints;
- if (prefs != ImhPreferNumbers && prefs != ImhPreferUppercase && prefs != ImhPreferLowercase) {
- hints &= ~prefs;
- }
- if (!noOnlys) {
- // Make sure that the preference is within the permitted set.
- if (hints & ImhPreferNumbers && !anynumbermodes) {
- hints &= ~ImhPreferNumbers;
- } else if (hints & ImhPreferUppercase && !(hints & ImhUppercaseOnly)) {
- hints &= ~ImhPreferUppercase;
- } else if (hints & ImhPreferLowercase && !(hints & ImhLowercaseOnly)) {
- hints &= ~ImhPreferLowercase;
- }
- // If there is no preference, set it to something within the permitted set.
- if (!(hints & ImhPreferNumbers || hints & ImhPreferUppercase || hints & ImhPreferLowercase)) {
- if (hints & ImhLowercaseOnly) {
- hints |= ImhPreferLowercase;
- } else if (hints & ImhUppercaseOnly) {
- hints |= ImhPreferUppercase;
- } else if (numbersOnly) {
- hints |= ImhPreferNumbers;
- }
- }
- }
-
- if (hints & ImhPreferNumbers) {
- m_fepState->SetDefaultInputMode(EAknEditorNumericInputMode);
- m_fepState->SetCurrentInputMode(EAknEditorNumericInputMode);
- } else {
- m_fepState->SetDefaultInputMode(EAknEditorTextInputMode);
- m_fepState->SetCurrentInputMode(EAknEditorTextInputMode);
- }
- flags = 0;
- if (noOnlys || (anynumbermodes && anytextmodes)) {
- flags = EAknEditorAllInputModes;
- }
- 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;
- }
- else {
- flags = EAknEditorAllInputModes;
- }
- m_fepState->SetPermittedInputModes(flags);
- ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateInputModeUpdate);
-
- if (hints & ImhPreferLowercase) {
- m_fepState->SetDefaultCase(EAknEditorLowerCase);
- m_fepState->SetCurrentCase(EAknEditorLowerCase);
- } else if (hints & ImhPreferUppercase) {
- m_fepState->SetDefaultCase(EAknEditorUpperCase);
- m_fepState->SetCurrentCase(EAknEditorUpperCase);
- } else if (hints & ImhNoAutoUppercase) {
- m_fepState->SetDefaultCase(EAknEditorLowerCase);
- m_fepState->SetCurrentCase(EAknEditorLowerCase);
- } else {
- m_fepState->SetDefaultCase(EAknEditorTextCase);
- m_fepState->SetCurrentCase(EAknEditorTextCase);
- }
- flags = 0;
- if (hints & ImhUppercaseOnly) {
- flags |= EAknEditorUpperCase;
- }
- if (hints & ImhLowercaseOnly) {
- flags |= EAknEditorLowerCase;
- }
- if (flags == 0) {
- flags = EAknEditorAllCaseModes;
- if (hints & ImhNoAutoUppercase) {
- flags &= ~EAknEditorTextCase;
- }
- }
- m_fepState->SetPermittedCases(flags);
- ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateCaseModeUpdate);
-
- flags = 0;
- if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) {
- if (S60->partial_keyboard)
- flags |= QT_EAknEditorFlagEnablePartialScreen;
- flags |= QT_EAknEditorFlagSelectionVisible;
- }
- if (hints & ImhUppercaseOnly && !(hints & ImhLowercaseOnly)
- || hints & ImhLowercaseOnly && !(hints & ImhUppercaseOnly)) {
- flags |= EAknEditorFlagFixedCase;
- }
- // Using T9 and hidden text together may actually crash the FEP, so check for hidden text too.
- if (hints & ImhNoPredictiveText || hints & ImhHiddenText) {
- flags |= EAknEditorFlagNoT9;
- }
- if (needsCharMap)
- flags |= EAknEditorFlagUseSCTNumericCharmap;
- m_fepState->SetFlags(flags);
- ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateFlagsUpdate);
-
- if (hints & ImhDialableCharactersOnly) {
- // This is first, because if (ImhDialableCharactersOnly | ImhFormattedNumbersOnly)
- // is specified, this one is more natural (# key enters a #)
- flags = EAknEditorStandardNumberModeKeymap;
- } else if (hints & ImhFormattedNumbersOnly) {
- // # key enters decimal point
- flags = EAknEditorCalculatorNumberModeKeymap;
- } else if (hints & ImhDigitsOnly) {
- // This is last, because it is most restrictive (# key is inactive)
- flags = EAknEditorPlainNumberModeKeymap;
- } else {
- flags = EAknEditorStandardNumberModeKeymap;
- }
- m_fepState->SetNumericKeymap(static_cast<TAknEditorNumericKeymap>(flags));
-
- if (hints & ImhUrlCharactersOnly) {
- // URL characters is everything except space, so a superset of the other restrictions
- m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG);
- } else if (hints & ImhEmailCharactersOnly) {
- 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);
- }
-
- if (hints & ImhHiddenText) {
- m_textCapabilities = TCoeInputCapabilities::EAllText | TCoeInputCapabilities::ESecretText;
- } else {
- m_textCapabilities = TCoeInputCapabilities::EAllText;
- }
-}
-
-void QCoeFepInputContext::applyFormat(QList<QInputMethodEvent::Attribute> *attributes)
-{
- TCharFormat cFormat;
- QColor styleTextColor;
- if (QWidget *focused = focusWidget()) {
- QGraphicsView *gv = qobject_cast<QGraphicsView*>(focused);
- if (!gv) // could be either the QGV or its viewport that has focus
- gv = qobject_cast<QGraphicsView*>(focused->parentWidget());
- if (gv) {
- if (QGraphicsScene *scene = gv->scene()) {
- if (QGraphicsItem *focusItem = scene->focusItem()) {
- if (focusItem->isWidget()) {
- styleTextColor = static_cast<QGraphicsWidget*>(focusItem)->palette().text().color();
- }
- }
- }
- } else {
- styleTextColor = focused->palette().text().color();
- }
- } else {
- styleTextColor = QApplication::palette("QLineEdit").text().color();
- }
-
- if (styleTextColor.isValid()) {
- const TLogicalRgb fontColor(TRgb(styleTextColor.red(), styleTextColor.green(), styleTextColor.blue(), styleTextColor.alpha()));
- cFormat.iFontPresentation.iTextColor = fontColor;
- }
-
- TInt numChars = 0;
- TInt charPos = 0;
- int oldSize = attributes->size();
- while (m_formatRetriever) {
- m_formatRetriever->GetFormatOfFepInlineText(cFormat, numChars, charPos);
- if (numChars <= 0) {
- // This shouldn't happen according to S60 docs, but apparently does sometimes.
- break;
- }
- attributes->append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat,
- charPos,
- numChars,
- QVariant(qt_TCharFormat2QTextCharFormat(cFormat, styleTextColor.isValid()))));
- charPos += numChars;
- if (charPos >= m_preeditString.size()) {
- break;
- }
- }
-
- if (attributes->size() == oldSize) {
- // S60 didn't provide any format, so let's give our own instead.
- attributes->append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat,
- 0,
- m_preeditString.size(),
- standardFormat(PreeditFormat)));
- }
-}
-
-void QCoeFepInputContext::queueInputCapabilitiesChanged()
-{
- if (m_pendingInputCapabilitiesChanged)
- return;
-
- // Call ensureInputCapabilitiesChanged asynchronously. This is done to improve performance
- // by not updating input capabilities too often. The reason we don't call the Symbian
- // asynchronous version of InputCapabilitiesChanged is because we need to ensure that it
- // is synchronous in some specific cases. Those will call ensureInputCapabilitesChanged.
- QMetaObject::invokeMethod(this, "ensureInputCapabilitiesChanged", Qt::QueuedConnection);
- m_pendingInputCapabilitiesChanged = true;
-}
-
-void QCoeFepInputContext::ensureInputCapabilitiesChanged()
-{
- if (!m_pendingInputCapabilitiesChanged)
- return;
-
- // The call below is essentially equivalent to InputCapabilitiesChanged(),
- // but is synchronous, rather than asynchronous.
- CCoeEnv::Static()->SyncNotifyFocusObserversOfChangeInFocus();
- m_pendingInputCapabilitiesChanged = false;
-}
-
-void QCoeFepInputContext::translateInputWidget()
-{
- QGraphicsView *gv = qobject_cast<QGraphicsView *>(S60->splitViewLastWidget);
- QRect splitViewRect = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect());
-
- QRectF cursor = gv->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF();
- QPolygon cursorP = gv->mapFromScene(cursor);
- QRectF vkbRect = QRectF(splitViewRect.bottomLeft(), qApp->desktop()->rect().bottomRight());
- if (cursor.isEmpty() || vkbRect.isEmpty())
- return;
-
- // Fetch root item (i.e. graphicsitem with no parent)
- QGraphicsItem *rootItem = 0;
- foreach (QGraphicsItem *item, gv->scene()->items()) {
- if (!item->parentItem()) {
- rootItem = item;
- break;
- }
- }
- if (!rootItem)
- return;
-
- 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()))
- 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)
- return;
-
- rootItem->setTransform(QTransform::fromTranslate(0, dy), true);
-}
-
-void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText,
- TInt aPositionOfInsertionPointInInlineText, TBool aCursorVisibility, const MFormCustomDraw* /*aCustomDraw*/,
- MFepInlineTextFormatRetriever& aInlineTextFormatRetriever,
- MFepPointerEventHandlerDuringInlineEdit& aPointerEventHandlerDuringInlineEdit)
-{
- QWidget *w = focusWidget();
- if (!w)
- return;
-
- commitTemporaryPreeditString();
-
- QList<QInputMethodEvent::Attribute> attributes;
-
- m_cursorVisibility = aCursorVisibility ? 1 : 0;
- m_inlinePosition = aPositionOfInsertionPointInInlineText;
- m_preeditString = qt_TDesC2QString(aInitialInlineText);
-
- m_formatRetriever = &aInlineTextFormatRetriever;
- m_pointerHandler = &aPointerEventHandlerDuringInlineEdit;
-
- // With T9 aInitialInlineText is typically empty when StartFepInlineEditL is called,
- // but FEP requires that selected text is always removed at StartFepInlineEditL.
- // Let's remove the selected text if aInitialInlineText is empty and there is selected text
- if (m_preeditString.isEmpty()) {
- int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt();
- int cursorPos = w->inputMethodQuery(Qt::ImCursorPosition).toInt();
- int replacementLength = qAbs(cursorPos-anchor);
- if (replacementLength > 0) {
- int replacementStart = cursorPos < anchor ? 0 : -replacementLength;
- QList<QInputMethodEvent::Attribute> clearSelectionAttributes;
- QInputMethodEvent clearSelectionEvent(QLatin1String(""), clearSelectionAttributes);
- clearSelectionEvent.setCommitString(QLatin1String(""), replacementStart, replacementLength);
- sendEvent(clearSelectionEvent);
- }
- }
-
- applyFormat(&attributes);
-
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor,
- m_inlinePosition,
- m_cursorVisibility,
- QVariant()));
- QInputMethodEvent event(m_preeditString, attributes);
- sendEvent(event);
-}
-
-void QCoeFepInputContext::UpdateFepInlineTextL(const TDesC& aNewInlineText,
- TInt aPositionOfInsertionPointInInlineText)
-{
- QWidget *w = focusWidget();
- if (!w)
- return;
-
- commitTemporaryPreeditString();
-
- m_inlinePosition = aPositionOfInsertionPointInInlineText;
-
- QList<QInputMethodEvent::Attribute> attributes;
- applyFormat(&attributes);
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor,
- m_inlinePosition,
- m_cursorVisibility,
- QVariant()));
- QString newPreeditString = qt_TDesC2QString(aNewInlineText);
- QInputMethodEvent event(newPreeditString, attributes);
- if (newPreeditString.isEmpty() && m_preeditString.isEmpty()) {
- // In Symbian world this means "erase last character".
- event.setCommitString(QLatin1String(""), -1, 1);
- }
- m_preeditString = newPreeditString;
- sendEvent(event);
-}
-
-void QCoeFepInputContext::SetInlineEditingCursorVisibilityL(TBool aCursorVisibility)
-{
- QWidget *w = focusWidget();
- if (!w)
- return;
-
- m_cursorVisibility = aCursorVisibility ? 1 : 0;
-
- QList<QInputMethodEvent::Attribute> attributes;
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor,
- m_inlinePosition,
- m_cursorVisibility,
- QVariant()));
- QInputMethodEvent event(m_preeditString, attributes);
- sendEvent(event);
-}
-
-void QCoeFepInputContext::CancelFepInlineEdit()
-{
- // We are not supposed to ever have a tempPreeditString and a real preedit string
- // from S60 at the same time, so it should be safe to rely on this test to determine
- // whether we should honor S60's request to clear the text or not.
- if (m_hasTempPreeditString)
- return;
-
- QList<QInputMethodEvent::Attribute> attributes;
- QInputMethodEvent event(QLatin1String(""), attributes);
- event.setCommitString(QLatin1String(""), 0, 0);
- m_preeditString.clear();
- m_inlinePosition = 0;
- sendEvent(event);
-}
-
-TInt QCoeFepInputContext::DocumentLengthForFep() const
-{
- QWidget *w = focusWidget();
- if (!w)
- return 0;
-
- QVariant variant = w->inputMethodQuery(Qt::ImSurroundingText);
- return variant.value<QString>().size() + m_preeditString.size();
-}
-
-TInt QCoeFepInputContext::DocumentMaximumLengthForFep() const
-{
- QWidget *w = focusWidget();
- if (!w)
- return 0;
-
- QVariant variant = w->inputMethodQuery(Qt::ImMaximumTextLength);
- int size;
- if (variant.isValid()) {
- size = variant.toInt();
- } else {
- size = INT_MAX; // Sensible default for S60.
- }
- return size;
-}
-
-void QCoeFepInputContext::SetCursorSelectionForFepL(const TCursorSelection& aCursorSelection)
-{
- QWidget *w = focusWidget();
- if (!w)
- return;
-
- commitTemporaryPreeditString();
-
- int pos = aCursorSelection.iAnchorPos;
- int length = aCursorSelection.iCursorPos - pos;
-
- QList<QInputMethodEvent::Attribute> attributes;
- attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, pos, length, QVariant());
- QInputMethodEvent event(m_preeditString, attributes);
- sendEvent(event);
-}
-
-void QCoeFepInputContext::GetCursorSelectionForFep(TCursorSelection& aCursorSelection) const
-{
- QWidget *w = focusWidget();
- if (!w) {
- aCursorSelection.SetSelection(0,0);
- return;
- }
-
- int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt() + m_preeditString.size();
- int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt() + m_preeditString.size();
- QString text = w->inputMethodQuery(Qt::ImSurroundingText).value<QString>();
- int combinedSize = text.size() + m_preeditString.size();
- if (combinedSize < anchor || combinedSize < cursor) {
- // ### TODO! FIXME! QTBUG-5050
- // This is a hack to prevent crashing in 4.6 with QLineEdits that use input masks.
- // The root problem is that cursor position is relative to displayed text instead of the
- // actual text we get.
- //
- // To properly fix this we would need to know the displayText of QLineEdits instead
- // of just the text, which on itself should be a trivial change. The difficulties start
- // when we need to commit the changes back to the QLineEdit, which would have to be somehow
- // able to handle displayText, too.
- //
- // Until properly fixed, the cursor and anchor positions will not reflect correct positions
- // for masked QLineEdits, unless all the masked positions are filled in order so that
- // cursor position relative to the displayed text matches position relative to actual text.
- aCursorSelection.iAnchorPos = combinedSize;
- aCursorSelection.iCursorPos = combinedSize;
- } else {
- aCursorSelection.iAnchorPos = anchor;
- aCursorSelection.iCursorPos = cursor;
- }
-}
-
-void QCoeFepInputContext::GetEditorContentForFep(TDes& aEditorContent, TInt aDocumentPosition,
- TInt aLengthToRetrieve) const
-{
- QWidget *w = focusWidget();
- if (!w) {
- aEditorContent.FillZ(aLengthToRetrieve);
- return;
- }
-
- QString text = w->inputMethodQuery(Qt::ImSurroundingText).value<QString>();
- // FEP expects the preedit string to be part of the editor content, so let's mix it in.
- int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt();
- text.insert(cursor, m_preeditString);
- aEditorContent.Copy(qt_QString2TPtrC(text.mid(aDocumentPosition, aLengthToRetrieve)));
-}
-
-void QCoeFepInputContext::GetFormatForFep(TCharFormat& aFormat, TInt /* aDocumentPosition */) const
-{
- QWidget *w = focusWidget();
- if (!w) {
- aFormat = TCharFormat();
- return;
- }
-
- QFont font = w->inputMethodQuery(Qt::ImFont).value<QFont>();
- QFontMetrics metrics(font);
- //QString name = font.rawName();
- QString name = font.defaultFamily(); // TODO! FIXME! Should be the above.
- QHBufC hBufC(name);
- aFormat = TCharFormat(hBufC->Des(), metrics.height());
-}
-
-void QCoeFepInputContext::GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLine, TInt& aHeight,
- TInt& aAscent, TInt /* aDocumentPosition */) const
-{
- QWidget *w = focusWidget();
- if (!w) {
- aLeftSideOfBaseLine = TPoint(0,0);
- aHeight = 0;
- aAscent = 0;
- return;
- }
-
- QRect rect = w->inputMethodQuery(Qt::ImMicroFocus).value<QRect>();
- aLeftSideOfBaseLine.iX = rect.left();
- aLeftSideOfBaseLine.iY = rect.bottom();
-
- QFont font = w->inputMethodQuery(Qt::ImFont).value<QFont>();
- QFontMetrics metrics(font);
- aHeight = metrics.height();
- aAscent = metrics.ascent();
-}
-
-void QCoeFepInputContext::DoCommitFepInlineEditL()
-{
- commitCurrentString(false);
- if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0)
- ReportAknEdStateEvent(QT_EAknCursorPositionChanged);
-
-}
-
-void QCoeFepInputContext::commitCurrentString(bool cancelFepTransaction)
-{
- QList<QInputMethodEvent::Attribute> attributes;
- QInputMethodEvent event(QLatin1String(""), attributes);
- event.setCommitString(m_preeditString, 0, 0);
- m_preeditString.clear();
- m_inlinePosition = 0;
- sendEvent(event);
-
- m_hasTempPreeditString = false;
-
- if (cancelFepTransaction) {
- CCoeFep* fep = CCoeEnv::Static()->Fep();
- if (fep)
- fep->CancelTransaction();
- }
-}
-
-MCoeFepAwareTextEditor_Extension1* QCoeFepInputContext::Extension1(TBool& aSetToTrue)
-{
- aSetToTrue = ETrue;
- return this;
-}
-
-void QCoeFepInputContext::SetStateTransferingOwnershipL(MCoeFepAwareTextEditor_Extension1::CState* aState,
- TUid /*aTypeSafetyUid*/)
-{
- // Note: The S60 docs are wrong! See the State() function.
- if (m_fepState)
- delete m_fepState;
- m_fepState = static_cast<CAknEdwinState *>(aState);
-}
-
-MCoeFepAwareTextEditor_Extension1::CState* QCoeFepInputContext::State(TUid /*aTypeSafetyUid*/)
-{
- // Note: The S60 docs are horribly wrong when describing the
- // SetStateTransferingOwnershipL function and this function. They say that the former
- // sets a CState object identified by the TUid, and the latter retrieves it.
- // In reality, the CState is expected to always be a CAknEdwinState (even if it was not
- // previously set), and the TUid is ignored. All in all, there is a single CAknEdwinState
- // per QCoeFepInputContext, which should be deleted if the SetStateTransferingOwnershipL
- // function is used to set a new one.
- return m_fepState;
-}
-
-TTypeUid::Ptr QCoeFepInputContext::MopSupplyObject(TTypeUid /*id*/)
-{
- return TTypeUid::Null();
-}
-
-MObjectProvider *QCoeFepInputContext::MopNext()
-{
- QWidget *w = focusWidget();
- if (w)
- return w->effectiveWinId();
- return 0;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_IM
diff --git a/src/widgets/platforms/s60/qcolormap_s60.cpp b/src/widgets/platforms/s60/qcolormap_s60.cpp
deleted file mode 100644
index 9dd5135d29..0000000000
--- a/src/widgets/platforms/s60/qcolormap_s60.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcolormap.h"
-#include "qcolor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QColormapPrivate
-{
-public:
- inline QColormapPrivate()
- : ref(1)
- { }
-
- QAtomicInt ref;
-};
-
-void QColormap::initialize()
-{
-}
-
-void QColormap::cleanup()
-{
-}
-
-QColormap QColormap::instance(int)
-{
- return QColormap();
-}
-
-QColormap::QColormap() : d(new QColormapPrivate)
-{}
-
-QColormap::QColormap(const QColormap &colormap) :d (colormap.d)
-{ d->ref.ref(); }
-
-QColormap::~QColormap()
-{
- if (!d->ref.deref())
- delete d;
-}
-
-QColormap::Mode QColormap::mode() const
-{ return QColormap::Direct; }
-
-int QColormap::depth() const
-{
- return 32;
-}
-
-int QColormap::size() const
-{
- return -1;
-}
-
-uint QColormap::pixel(const QColor &color) const
-{ return color.rgba(); }
-
-const QColor QColormap::colorAt(uint pixel) const
-{ return QColor(pixel); }
-
-const QVector<QColor> QColormap::colormap() const
-{ return QVector<QColor>(); }
-
-QColormap &QColormap::operator=(const QColormap &colormap)
-{ qAtomicAssign(d, colormap.d); return *this; }
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/s60/qcursor_s60.cpp b/src/widgets/platforms/s60/qcursor_s60.cpp
deleted file mode 100644
index 2e9a2bfa33..0000000000
--- a/src/widgets/platforms/s60/qcursor_s60.cpp
+++ /dev/null
@@ -1,533 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qcursor_p.h>
-#include <private/qwidget_p.h>
-#include <private/qapplication_p.h>
-#include <coecntrl.h>
-#include <qcursor.h>
-#include <private/qt_s60_p.h>
-#include <qbitmap.h>
-#include <w32std.h>
-#include <qapplication.h>
-#include <qwidget.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_CURSOR
-static QCursor cursorSprite;
-static int cursorSpriteVisible;
-#endif
-
-//pos and setpos are required whether cursors are configured or not.
-QPoint QCursor::pos()
-{
- return S60->lastCursorPos;
-}
-
-void QCursor::setPos(int x, int y)
-{
- //clip to screen size (window server allows a sprite hotspot to be outside the screen)
- if (x < 0)
- x=0;
- else if (x >= S60->screenWidthInPixels)
- x = S60->screenWidthInPixels - 1;
- if (y < 0)
- y = 0;
- else if (y >= S60->screenHeightInPixels)
- y = S60->screenHeightInPixels - 1;
-
-#ifndef QT_NO_CURSOR
-#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
- if (S60->brokenPointerCursors && cursorSpriteVisible)
- cursorSprite.d->scurs.SetPosition(TPoint(x,y));
- else
-#endif
- S60->wsSession().SetPointerCursorPosition(TPoint(x, y));
-#endif
- S60->lastCursorPos = QPoint(x, y);
- //send a fake mouse move event, so that enter/leave events go to the widget hierarchy
- QWidget *w = QApplication::topLevelAt(S60->lastCursorPos);
- if (w) {
- CCoeControl* ctrl = w->effectiveWinId();
- TPoint epos(x, y);
- TPoint cpos = epos - ctrl->PositionRelativeToScreen();
- TPointerEvent fakeEvent;
- fakeEvent.iType = TPointerEvent::EMove;
- fakeEvent.iModifiers = 0U;
- fakeEvent.iPosition = cpos;
- fakeEvent.iParentPosition = epos;
- ctrl->HandlePointerEventL(fakeEvent);
- }
-}
-
-#ifndef QT_NO_CURSOR
-/*
- * Request cursor to be turned on or off.
- * Reference counted, so 2 on + 1 off = on, for example
- */
-void qt_symbian_set_cursor_visible(bool visible) {
- if (visible)
- cursorSpriteVisible++;
- else
- cursorSpriteVisible--;
- Q_ASSERT(cursorSpriteVisible >=0);
-
- if (cursorSpriteVisible && !S60->mouseInteractionEnabled) {
-#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
- if (S60->brokenPointerCursors)
- qt_symbian_show_pointer_sprite();
- else
-#endif
- S60->wsSession().SetPointerCursorMode(EPointerCursorNormal);
- } else if (!cursorSpriteVisible && S60->mouseInteractionEnabled) {
-#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
- if (S60->brokenPointerCursors)
- qt_symbian_hide_pointer_sprite();
- else
-#endif
- S60->wsSession().SetPointerCursorMode(EPointerCursorNone);
- }
- S60->mouseInteractionEnabled = ((cursorSpriteVisible > 0) ? true : false);
-}
-
-/*
- * Check if the cursor is on or off
- */
-bool qt_symbian_is_cursor_visible() {
- return S60->mouseInteractionEnabled;
-}
-
-QCursorData::QCursorData(Qt::CursorShape s) :
- cshape(s), bm(0), bmm(0), hx(0), hy(0), pcurs()
-{
- ref = 1;
-}
-
-QCursorData::~QCursorData()
-{
- for(int i=0;i<nativeSpriteMembers.Count();i++) {
- delete nativeSpriteMembers[i]->iBitmap;
- delete nativeSpriteMembers[i]->iMaskBitmap;
- }
- nativeSpriteMembers.ResetAndDestroy();
- pcurs.Close();
- delete bm;
- delete bmm;
-}
-
-/* Create a bitmap cursor, this is called by public constructors in the
- * generic QCursor code.
- */
-QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY)
-{
- if (!QCursorData::initialized)
- QCursorData::initialize();
- if (bitmap.depth() != 1 || mask.depth() != 1 || bitmap.size() != mask.size()) {
- qWarning("QCursor: Cannot create bitmap cursor; invalid bitmap(s)");
- QCursorData *c = qt_cursorTable[0];
- c->ref.ref();
- return c;
- }
- QCursorData *d = new QCursorData;
- d->bm = new QBitmap(bitmap);
- d->bmm = new QBitmap(mask);
- d->cshape = Qt::BitmapCursor;
- d->hx = hotX >= 0 ? hotX : bitmap.width() / 2;
- d->hy = hotY >= 0 ? hotY : bitmap.height() / 2;
- return d;
-}
-
-/*
- * returns an opaque native handle to a cursor.
- * It happens to be the address of the native handle, as window server handles
- * are not POD types. Note there is no QCursor(HANDLE) constructor on Symbian,
- * Mac or QWS.
- */
-Qt::HANDLE QCursor::handle() const
-{
- if (d->pcurs.WsHandle())
- return reinterpret_cast<Qt::HANDLE> (&(d->pcurs));
-
-#ifdef Q_SYMBIAN_HAS_SYSTEM_CURSORS
- // don't construct shape cursors, QApplication_s60 will use the system cursor instead
- if (!(d->bm))
- return 0;
-#endif
-
- d->pcurs = RWsPointerCursor(S60->wsSession());
- d->pcurs.Construct(0);
- d->constructCursorSprite(d->pcurs);
- d->pcurs.Activate();
-
- return reinterpret_cast<Qt::HANDLE> (&(d->pcurs));
-}
-
-#ifndef Q_SYMBIAN_HAS_SYSTEM_CURSORS
-/*
- * Loads a single cursor shape from resources and appends it to a native sprite.
- * Animated cursors (e.g. the busy cursor) have multiple members.
- */
-void QCursorData::loadShapeFromResource(RWsSpriteBase& target, QString resource, int hx, int hy, int interval)
-{
- QPixmap pix;
- CFbsBitmap* native;
- QScopedPointer<TSpriteMember> member(new TSpriteMember);
- member->iInterval = interval;
- member->iInvertMask = false;
- member->iMaskBitmap = 0; // all shapes are RGBA
- member->iDrawMode = CGraphicsContext::EDrawModePEN;
- member->iOffset = TPoint(-hx, -hy);
- QString res(QLatin1String(":/trolltech/symbian/cursors/images/%1.png"));
- pix.load(res.arg(resource));
- native = pix.toSymbianCFbsBitmap();
- member->iBitmap = native;
- qt_symbian_throwIfError(nativeSpriteMembers.Append(member.data()));
- target.AppendMember(*(member.take()));
-}
-
-//TODO: after 4.6, connect with style & skins?
-/*
- * Constructs the native cursor from resources compiled into QtGui
- * This is needed only when the platform doesn't have system cursors.
- *
- * System cursors are higher performance, since they are constructed once
- * and shared by all applications by specifying the shape number.
- * Due to symbian platform security considerations, and the fact most
- * existing phones have a broken RWsPointerCursor, system cursors are not
- * being used.
- */
-void QCursorData::constructShapeSprite(RWsSpriteBase& target)
-{
- int i;
- switch (cshape) {
- default:
- qWarning("QCursorData::constructShapeSprite unknown shape %d", cshape);
- //fall through and give arrow cursor
- case Qt::ArrowCursor:
- loadShapeFromResource(target, QLatin1String("pointer"), 1, 1);
- break;
- case Qt::UpArrowCursor:
- loadShapeFromResource(target, QLatin1String("uparrow"), 4, 0);
- break;
- case Qt::CrossCursor:
- loadShapeFromResource(target, QLatin1String("cross"), 7, 7);
- break;
- case Qt::WaitCursor:
- for (i = 1; i <= 12; i++) {
- loadShapeFromResource(target, QString(QLatin1String("wait%1")).arg(i), 7, 7, 1000000);
- }
- break;
- case Qt::IBeamCursor:
- loadShapeFromResource(target, QLatin1String("ibeam"), 3, 10);
- break;
- case Qt::SizeVerCursor:
- loadShapeFromResource(target, QLatin1String("sizever"), 4, 8);
- break;
- case Qt::SizeHorCursor:
- loadShapeFromResource(target, QLatin1String("sizehor"), 8, 4);
- break;
- case Qt::SizeBDiagCursor:
- loadShapeFromResource(target, QLatin1String("sizebdiag"), 8, 8);
- break;
- case Qt::SizeFDiagCursor:
- loadShapeFromResource(target, QLatin1String("sizefdiag"), 8, 8);
- break;
- case Qt::SizeAllCursor:
- loadShapeFromResource(target, QLatin1String("sizeall"), 7, 7);
- break;
- case Qt::BlankCursor:
- loadShapeFromResource(target, QLatin1String("blank"), 0, 0);
- break;
- case Qt::SplitVCursor:
- loadShapeFromResource(target, QLatin1String("splitv"), 7, 7);
- break;
- case Qt::SplitHCursor:
- loadShapeFromResource(target, QLatin1String("splith"), 7, 7);
- break;
- case Qt::PointingHandCursor:
- loadShapeFromResource(target, QLatin1String("handpoint"), 5, 0);
- break;
- case Qt::ForbiddenCursor:
- loadShapeFromResource(target, QLatin1String("forbidden"), 7, 7);
- break;
- case Qt::WhatsThisCursor:
- loadShapeFromResource(target, QLatin1String("whatsthis"), 1, 1);
- break;
- case Qt::BusyCursor:
- loadShapeFromResource(target, QLatin1String("busy3"), 1, 1, 1000000);
- loadShapeFromResource(target, QLatin1String("busy6"), 1, 1, 1000000);
- loadShapeFromResource(target, QLatin1String("busy9"), 1, 1, 1000000);
- loadShapeFromResource(target, QLatin1String("busy12"), 1, 1, 1000000);
- break;
- case Qt::OpenHandCursor:
- loadShapeFromResource(target, QLatin1String("openhand"), 7, 7);
- break;
- case Qt::ClosedHandCursor:
- loadShapeFromResource(target, QLatin1String("closehand"), 7, 7);
- break;
- }
-}
-#endif
-
-/*
- * Common code between the sprite workaround and standard modes of operation.
- * RWsSpriteBase is the base class for both RWsSprite and RWsPointerCursor.
- * It is called from both handle() and qt_s60_show_pointer_sprite()
- */
-void QCursorData::constructCursorSprite(RWsSpriteBase& target)
-{
- int count = nativeSpriteMembers.Count();
- if (count) {
- // already constructed
- for (int i = 0; i < count; i++)
- target.AppendMember(*(nativeSpriteMembers[i]));
-
- return;
- }
- if (pixmap.isNull() && !bm) {
-#ifndef Q_SYMBIAN_HAS_SYSTEM_CURSORS
- //shape cursor
- constructShapeSprite(target);
-#endif
- return;
- }
- QScopedPointer<TSpriteMember> member(new TSpriteMember);
- if (pixmap.isNull()) {
- //construct mono cursor
- member->iBitmap = bm->toSymbianCFbsBitmap();
- member->iMaskBitmap = bmm->toSymbianCFbsBitmap();
- }
- else {
- //construct normal cursor
- member->iBitmap = pixmap.toSymbianCFbsBitmap();
- if (pixmap.hasAlphaChannel()) {
- member->iMaskBitmap = 0; //use alpha blending
- }
- else if (pixmap.hasAlpha()) {
- member->iMaskBitmap = pixmap.mask().toSymbianCFbsBitmap();
- }
- else {
- member->iMaskBitmap = 0; //opaque rectangle cursor (due to EDrawModePEN)
- }
- }
-
- member->iDrawMode = CGraphicsContext::EDrawModePEN;
- member->iInvertMask = EFalse;
- member->iInterval = 0;
- member->iOffset = TPoint(-(hx), -(hy)); //Symbian hotspot coordinates are negative
- qt_symbian_throwIfError(nativeSpriteMembers.Append(member.data()));
- target.AppendMember(*(member.take()));
-}
-
-/*
- * shows the pointer sprite by constructing a native handle, and registering
- * it with the window server.
- * Only used when the sprite workaround is in use.
- */
-void qt_symbian_show_pointer_sprite()
-{
- if (cursorSprite.d) {
- if (cursorSprite.d->scurs.WsHandle())
- cursorSprite.d->scurs.Close();
- } else {
- cursorSprite = QCursor(Qt::ArrowCursor);
- }
-
- cursorSprite.d->scurs = RWsSprite(S60->wsSession());
- QPoint pos = QCursor::pos();
- cursorSprite.d->scurs.Construct(S60->windowGroup(), TPoint(pos.x(), pos.y()), ESpriteNoChildClip | ESpriteNoShadows);
-
- cursorSprite.d->constructCursorSprite(cursorSprite.d->scurs);
- cursorSprite.d->scurs.Activate();
-}
-
-/*
- * hides the pointer sprite by closing the native handle.
- * Only used when the sprite workaround is in use.
- */
-void qt_symbian_hide_pointer_sprite()
-{
- if (cursorSprite.d) {
- cursorSprite.d->scurs.Close();
- }
-}
-
-/*
- * Changes the cursor sprite to the cursor specified.
- * Only used when the sprite workaround is in use.
- */
-void qt_symbian_set_pointer_sprite(const QCursor& cursor)
-{
- if (S60->mouseInteractionEnabled)
- qt_symbian_hide_pointer_sprite();
- cursorSprite = cursor;
- if (S60->mouseInteractionEnabled)
- qt_symbian_show_pointer_sprite();
-}
-
-/*
- * When using sprites as a workaround on phones that have a broken
- * RWsPointerCursor, this function is called in response to pointer events
- * and when QCursor::setPos() is called.
- * Performance is worse than a real pointer cursor, due to extra context
- * switches vs. the window server moving the cursor by itself.
- */
-void qt_symbian_move_cursor_sprite()
-{
- if (S60->mouseInteractionEnabled) {
- cursorSprite.d->scurs.SetPosition(TPoint(S60->lastCursorPos.x(), S60->lastCursorPos.y()));
- }
-}
-
-/*
- * Translate from Qt::CursorShape to OS system pointer cursor list index.
- * Currently we control the implementation of the system pointer cursor list,
- * so this function is trivial. That may not always be the case.
- */
-TInt qt_symbian_translate_cursor_shape(Qt::CursorShape shape)
-{
- return (TInt) shape;
-}
-
-/*
- Internal function called from QWidget::setCursor()
- force is true if this function is called from dispatchEnterLeave, it means that the
- mouse is actually directly under this widget.
-*/
-void qt_symbian_set_cursor(QWidget *w, bool force)
-{
- static QPointer<QWidget> lastUnderMouse = 0;
- if (force) {
- lastUnderMouse = w;
- }
- else if (w->testAttribute(Qt::WA_WState_Created) && lastUnderMouse
- && lastUnderMouse->effectiveWinId() == w->effectiveWinId()) {
- w = lastUnderMouse;
- }
-
- if (!S60->curWin && w && w->internalWinId())
- return;
- QWidget* cW = w && !w->internalWinId() ? w : QWidget::find(S60->curWin);
- if (!cW || cW->window() != w->window() || !cW->isVisible() || !cW->underMouse()
- || QApplication::overrideCursor())
- return;
-
-#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
- if (S60->brokenPointerCursors)
- qt_symbian_set_pointer_sprite(cW->cursor());
- else
-#endif
- qt_symbian_setWindowCursor(cW->cursor(), w->effectiveWinId());
-}
-
-/*
- * Makes the specified cursor appear above a specific native window group
- * Called from QSymbianControl and QApplication::restoreOverrideCursor
- *
- * Window server is needed for this, so there is no equivalent when using
- * the sprite workaround.
- */
-void qt_symbian_setWindowGroupCursor(const QCursor &cursor, RWindowTreeNode &node)
-{
- Qt::HANDLE handle = cursor.handle();
- if (handle) {
- RWsPointerCursor *pcurs = reinterpret_cast<RWsPointerCursor *> (handle);
- node.SetCustomPointerCursor(*pcurs);
- } else
-#ifdef Q_SYMBIAN_HAS_SYSTEM_CURSORS
- {
- TInt shape = qt_symbian_translate_cursor_shape(cursor.shape());
- node.SetPointerCursor(shape);
- }
-#else
- qWarning("qt_s60_setWindowGroupCursor - null handle");
-#endif
-}
-
-/*
- * Makes the specified cursor appear above a specific native window
- * Called from QSymbianControl and QApplication::restoreOverrideCursor
- *
- * Window server is needed for this, so there is no equivalent when using
- * the sprite workaround.
- */
-void qt_symbian_setWindowCursor(const QCursor &cursor, const CCoeControl* wid)
-{
- //find the window for this control
- while (!wid->OwnsWindow()) {
- wid = wid->Parent();
- if (!wid)
- return;
- }
- RWindowTreeNode *node = wid->DrawableWindow();
- qt_symbian_setWindowGroupCursor(cursor, *node);
-}
-
-/*
- * Makes the specified cursor appear everywhere.
- * Called from QApplication::setOverrideCursor
- */
-void qt_symbian_setGlobalCursor(const QCursor &cursor)
-{
-#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
- if (S60->brokenPointerCursors) {
- qt_symbian_set_pointer_sprite(cursor);
- } else
-#endif
- {
- //because of the internals of window server, we need to force the cursor
- //to be set in all child windows too, otherwise when the cursor is over
- //the child window it may show a widget cursor or arrow cursor instead,
- //depending on construction order.
- QListIterator<WId> iter(QWidgetPrivate::mapper->uniqueKeys());
- while(iter.hasNext())
- {
- CCoeControl *ctrl = iter.next();
- if(ctrl->OwnsWindow()) {
- RWindowTreeNode *node = ctrl->DrawableWindow();
- qt_symbian_setWindowGroupCursor(cursor, *node);
- }
- }
- }
-}
-QT_END_NAMESPACE
-#endif // QT_NO_CURSOR
diff --git a/src/widgets/platforms/s60/qdesktopwidget_s60.cpp b/src/widgets/platforms/s60/qdesktopwidget_s60.cpp
deleted file mode 100644
index 156c9700ed..0000000000
--- a/src/widgets/platforms/s60/qdesktopwidget_s60.cpp
+++ /dev/null
@@ -1,316 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdesktopwidget.h"
-#include "qapplication_p.h"
-#include "qwidget_p.h"
-#include "qt_s60_p.h"
-#include <w32std.h>
-#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS)
-#include <graphics/displaycontrol.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-extern int qt_symbian_create_desktop_on_screen;
-
-class QSingleDesktopWidget : public QWidget
-{
-public:
- QSingleDesktopWidget();
- ~QSingleDesktopWidget();
-};
-
-QSingleDesktopWidget::QSingleDesktopWidget()
- : QWidget(0, Qt::Desktop)
-{
-}
-
-QSingleDesktopWidget::~QSingleDesktopWidget()
-{
- const QObjectList &childList = children();
- for (int i = childList.size(); i > 0 ;) {
- --i;
- childList.at(i)->setParent(0);
- }
-}
-
-class QDesktopWidgetPrivate : public QWidgetPrivate
-{
-public:
- QDesktopWidgetPrivate();
- ~QDesktopWidgetPrivate();
- static void init(QDesktopWidget *that);
- static void cleanup();
- static void init_sys();
-
- static int screenCount;
- static int primaryScreen;
-
- static QVector<QRect> *rects;
- static QVector<QRect> *workrects;
- static QVector<QWidget *> *screens;
-
- static int refcount;
-
-#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS)
- static MDisplayControl *displayControl;
-#endif
-};
-
-int QDesktopWidgetPrivate::screenCount = 1;
-int QDesktopWidgetPrivate::primaryScreen = 0;
-QVector<QRect> *QDesktopWidgetPrivate::rects = 0;
-QVector<QRect> *QDesktopWidgetPrivate::workrects = 0;
-QVector<QWidget *> *QDesktopWidgetPrivate::screens = 0;
-int QDesktopWidgetPrivate::refcount = 0;
-#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS)
-MDisplayControl *QDesktopWidgetPrivate::displayControl = 0;
-#endif
-
-QDesktopWidgetPrivate::QDesktopWidgetPrivate()
-{
- ++refcount;
-}
-
-QDesktopWidgetPrivate::~QDesktopWidgetPrivate()
-{
- if (!--refcount)
- cleanup();
-}
-
-void QDesktopWidgetPrivate::init(QDesktopWidget *that)
-{
- // Note that on S^3 devices the screen count retrieved via RWsSession
- // will always be 2 but the width and height for screen number 1 will
- // be 0 as long as TV-out is not connected.
- //
- // On the other hand a valid size for screen 1 will be reported even
- // after the cable is disconnected. In order to overcome this, we use
- // MDisplayControl::NumberOfResolutions() to check if the display is
- // valid or not.
-
- screenCount = S60->screenCount();
-#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS)
- if (displayControl) {
- if (displayControl->NumberOfResolutions() < 1)
- screenCount = 1;
- }
-#endif
- if (screenCount < 1) {
- qWarning("No screen available");
- screenCount = 1;
- }
-
- rects = new QVector<QRect>();
- workrects = new QVector<QRect>();
- screens = new QVector<QWidget *>();
-
- rects->resize(screenCount);
- workrects->resize(screenCount);
- screens->resize(screenCount);
-
- for (int i = 0; i < screenCount; ++i) {
- // All screens will have a position of (0, 0) as there is no true virtual desktop
- // or pointer event support for multiple screens on Symbian.
- QRect r(0, 0,
- S60->screenWidthInPixelsForScreen[i], S60->screenHeightInPixelsForScreen[i]);
- // Stop here if empty and ignore this screen.
- if (r.isEmpty()) {
- screenCount = i;
- break;
- }
- (*rects)[i] = r;
- QRect wr;
- if (i == 0)
- wr = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect());
- else
- wr = rects->at(i);
- (*workrects)[i].setRect(wr.x(), wr.y(), wr.width(), wr.height());
- (*screens)[i] = 0;
- }
- (*screens)[0] = that;
-}
-
-void QDesktopWidgetPrivate::cleanup()
-{
- delete rects;
- rects = 0;
- delete workrects;
- workrects = 0;
- if (screens) {
- // First item is the QDesktopWidget so skip it.
- for (int i = 1; i < screens->count(); ++i)
- delete screens->at(i);
- }
- delete screens;
- screens = 0;
-}
-
-void QDesktopWidgetPrivate::init_sys()
-{
-#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS)
- if (S60->screenCount() > 1) {
- CWsScreenDevice *dev = S60->screenDevice(1);
- if (dev) {
- displayControl = static_cast<MDisplayControl *>(
- dev->GetInterface(MDisplayControl::ETypeId));
- if (displayControl) {
- displayControl->EnableDisplayChangeEvents(ETrue);
- }
- }
- }
-#endif
-}
-
-
-QDesktopWidget::QDesktopWidget()
- : QWidget(*new QDesktopWidgetPrivate, 0, Qt::Desktop)
-{
- setObjectName(QLatin1String("desktop"));
- QDesktopWidgetPrivate::init_sys();
- QDesktopWidgetPrivate::init(this);
-}
-
-QDesktopWidget::~QDesktopWidget()
-{
-}
-
-bool QDesktopWidget::isVirtualDesktop() const
-{
- return false;
-}
-
-int QDesktopWidget::primaryScreen() const
-{
- return QDesktopWidgetPrivate::primaryScreen;
-}
-
-int QDesktopWidget::numScreens() const
-{
- Q_D(const QDesktopWidget);
- return QDesktopWidgetPrivate::screenCount;
-}
-
-static inline QWidget *newSingleDesktopWidget(int screen)
-{
- qt_symbian_create_desktop_on_screen = screen;
- QWidget *w = new QSingleDesktopWidget;
- qt_symbian_create_desktop_on_screen = -1;
- return w;
-}
-
-QWidget *QDesktopWidget::screen(int screen)
-{
- Q_D(QDesktopWidget);
- if (screen < 0 || screen >= d->screenCount)
- screen = d->primaryScreen;
- if (!d->screens->at(screen)
- || d->screens->at(screen)->windowType() != Qt::Desktop)
- (*d->screens)[screen] = newSingleDesktopWidget(screen);
- return (*d->screens)[screen];
-}
-
-const QRect QDesktopWidget::availableGeometry(int screen) const
-{
- Q_D(const QDesktopWidget);
- if (screen < 0 || screen >= d->screenCount)
- screen = d->primaryScreen;
-
- return d->workrects->at(screen);
-}
-
-const QRect QDesktopWidget::screenGeometry(int screen) const
-{
- Q_D(const QDesktopWidget);
- if (screen < 0 || screen >= d->screenCount)
- screen = d->primaryScreen;
-
- return d->rects->at(screen);
-}
-
-int QDesktopWidget::screenNumber(const QWidget *widget) const
-{
- Q_D(const QDesktopWidget);
- return widget
- ? S60->screenNumberForWidget(widget)
- : d->primaryScreen;
-}
-
-int QDesktopWidget::screenNumber(const QPoint &point) const
-{
- Q_UNUSED(point);
- Q_D(const QDesktopWidget);
- return d->primaryScreen;
-}
-
-void QDesktopWidget::resizeEvent(QResizeEvent *)
-{
- Q_D(QDesktopWidget);
- QVector<QRect> oldrects;
- oldrects = *d->rects;
- QVector<QRect> oldworkrects;
- oldworkrects = *d->workrects;
- int oldscreencount = d->screenCount;
-
- QDesktopWidgetPrivate::cleanup();
- QDesktopWidgetPrivate::init(this);
-
- for (int i = 0; i < qMin(oldscreencount, d->screenCount); ++i) {
- QRect oldrect = oldrects[i];
- QRect newrect = d->rects->at(i);
- if (oldrect != newrect)
- emit resized(i);
- }
-
- for (int j = 0; j < qMin(oldscreencount, d->screenCount); ++j) {
- QRect oldrect = oldworkrects[j];
- QRect newrect = d->workrects->at(j);
- if (oldrect != newrect)
- emit workAreaResized(j);
- }
-
- if (oldscreencount != d->screenCount) {
- emit screenCountChanged(d->screenCount);
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/s60/qdnd_s60.cpp b/src/widgets/platforms/s60/qdnd_s60.cpp
deleted file mode 100644
index 53afa71828..0000000000
--- a/src/widgets/platforms/s60/qdnd_s60.cpp
+++ /dev/null
@@ -1,359 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qapplication.h"
-
-#ifndef QT_NO_DRAGANDDROP
-
-#include "qwidget.h"
-#include "qdatetime.h"
-#include "qbitmap.h"
-#include "qcursor.h"
-#include "qevent.h"
-#include "qpainter.h"
-#include "qdnd_p.h"
-#include "qt_s60_p.h"
-
-#include <coecntrl.h>
-// pointer cursor
-#include <w32std.h>
-#include <gdi.h>
-#include <QCursor>
-
-QT_BEGIN_NAMESPACE
-//### artistic impression of Symbians default DnD cursor ?
-
-static QPixmap *defaultPm = 0;
-static const int default_pm_hotx = -50;
-static const int default_pm_hoty = -50;
-static const char *const default_pm[] = {
-"13 9 3 1",
-". c None",
-" c #000000",
-"X c #FFFFFF",
-"X X X X X X X",
-" X X X X X X ",
-"X ......... X",
-" X.........X ",
-"X ......... X",
-" X.........X ",
-"X ......... X",
-" X X X X X X ",
-"X X X X X X X",
-};
-//### actions need to be redefined for S60
-// Shift/Ctrl handling, and final drop status
-static Qt::DropAction global_accepted_action = Qt::MoveAction;
-static Qt::DropActions possible_actions = Qt::IgnoreAction;
-
-
-// static variables in place of a proper cross-process solution
-static QDrag *drag_object;
-static bool qt_symbian_dnd_dragging = false;
-
-
-static Qt::KeyboardModifiers oldstate;
-
-void QDragManager::updatePixmap()
-{
- QPixmap pm;
- QPoint pm_hot(default_pm_hotx,default_pm_hoty);
- if (drag_object) {
- pm = drag_object->pixmap();
- if (!pm.isNull())
- pm_hot = drag_object->hotSpot();
- }
- if (pm.isNull()) {
- if (!defaultPm)
- defaultPm = new QPixmap(default_pm);
- pm = *defaultPm;
- }
-#ifndef QT_NO_CURSOR
- QCursor cursor(pm, pm_hot.x(), pm_hot.y());
- overrideCursor = cursor;
-#endif
-}
-
-void QDragManager::timerEvent(QTimerEvent *) { }
-
-void QDragManager::move(const QPoint&) {
-}
-
-void QDragManager::updateCursor()
-{
-#ifndef QT_NO_CURSOR
- QCursor cursor = willDrop ? overrideCursor : Qt::ForbiddenCursor;
- if (!restoreCursor) {
- QApplication::setOverrideCursor(cursor);
- restoreCursor = true;
- }
- else {
- QApplication::changeOverrideCursor(cursor);
- }
-#endif
-}
-
-
-bool QDragManager::eventFilter(QObject *o, QEvent *e)
-{
- if (beingCancelled) {
- return false;
- }
- if (!o->isWidgetType())
- return false;
-
- switch(e->type()) {
- case QEvent::MouseButtonPress:
- {
- }
- case QEvent::MouseMove:
- {
- if (!object) { //#### this should not happen
- qWarning("QDragManager::eventFilter: No object");
- return true;
- }
- QDragManager *manager = QDragManager::self();
- QMimeData *dropData = manager->object ? manager->dragPrivate()->data : manager->dropData;
- if (manager->object)
- possible_actions = manager->dragPrivate()->possible_actions;
- else
- possible_actions = Qt::IgnoreAction;
-
- QMouseEvent *me = (QMouseEvent *)e;
-
- if (me->buttons()) {
- Qt::DropAction prevAction = global_accepted_action;
- QWidget *cw = QApplication::widgetAt(me->globalPos());
- // map the Coords relative to the window.
- if (!cw)
- return true;
-
- while (cw && !cw->acceptDrops() && !cw->isWindow())
- cw = cw->parentWidget();
-
- bool oldWillDrop = willDrop;
- if (object->target() != cw) {
- if (object->target()) {
- QDragLeaveEvent dle;
- QApplication::sendEvent(object->target(), &dle);
- willDrop = false;
- global_accepted_action = Qt::IgnoreAction;
- if (oldWillDrop != willDrop)
- updateCursor();
- object->d_func()->target = 0;
- }
- if (cw && cw->acceptDrops()) {
- object->d_func()->target = cw;
- QDragEnterEvent dee(cw->mapFromGlobal(me->globalPos()), possible_actions, dropData,
- me->buttons(), me->modifiers());
- QApplication::sendEvent(object->target(), &dee);
- willDrop = dee.isAccepted() && dee.dropAction() != Qt::IgnoreAction;
- global_accepted_action = willDrop ? dee.dropAction() : Qt::IgnoreAction;
- if (oldWillDrop != willDrop)
- updateCursor();
- }
- } else if (cw) {
- QDragMoveEvent dme(cw->mapFromGlobal(me->globalPos()), possible_actions, dropData,
- me->buttons(), me->modifiers());
- if (global_accepted_action != Qt::IgnoreAction) {
- dme.setDropAction(global_accepted_action);
- dme.accept();
- }
- QApplication::sendEvent(cw, &dme);
- willDrop = dme.isAccepted();
- global_accepted_action = willDrop ? dme.dropAction() : Qt::IgnoreAction;
- if (oldWillDrop != willDrop) {
- updatePixmap();
- updateCursor();
- }
- }
- if (global_accepted_action != prevAction)
- emitActionChanged(global_accepted_action);
- }
- return true; // Eat all mouse events
- }
-
- case QEvent::MouseButtonRelease:
- {
- qApp->removeEventFilter(this);
-#ifndef QT_NO_CURSOR
- if (restoreCursor) {
- QApplication::restoreOverrideCursor();
- willDrop = false;
- restoreCursor = false;
- }
-#endif
- if (object && object->target()) {
-
- QMouseEvent *me = (QMouseEvent *)e;
-
- QDragManager *manager = QDragManager::self();
- QMimeData *dropData = manager->object ? manager->dragPrivate()->data : manager->dropData;
-
- QDropEvent de(object->target()->mapFromGlobal(me->globalPos()), possible_actions, dropData,
- me->buttons(), me->modifiers());
- QApplication::sendEvent(object->target(), &de);
- if (de.isAccepted())
- global_accepted_action = de.dropAction();
- else
- global_accepted_action = Qt::IgnoreAction;
-
- if (object)
- object->deleteLater();
- drag_object = object = 0;
- }
- eventLoop->exit();
- return true; // Eat all mouse events
- }
-
- default:
- break;
- }
- return false;
-}
-
-Qt::DropAction QDragManager::drag(QDrag *o)
-{
- Q_ASSERT(!qt_symbian_dnd_dragging);
- if (object == o || !o || !o->source())
- return Qt::IgnoreAction;
-
- if (object) {
- cancel();
- qApp->removeEventFilter(this);
- beingCancelled = false;
- }
-
- object = drag_object = o;
-
- oldstate = Qt::NoModifier; // #### Should use state that caused the drag
- willDrop = false;
- updatePixmap();
- updateCursor();
-
-#ifndef QT_NO_CURSOR
- qt_symbian_set_cursor_visible(true); //force cursor on even for touch phone
-#endif
-
- object->d_func()->target = 0;
-
- qApp->installEventFilter(this);
-
- global_accepted_action = defaultAction(dragPrivate()->possible_actions, Qt::NoModifier);
- qt_symbian_dnd_dragging = true;
-
- eventLoop = new QEventLoop;
- // block
- (void) eventLoop->exec(QEventLoop::AllEvents);
- delete eventLoop;
- eventLoop = 0;
-
-#ifndef QT_NO_CURSOR
- qt_symbian_set_cursor_visible(false);
-
- overrideCursor = QCursor(); //deref the cursor data
- qt_symbian_dnd_dragging = false;
-#endif
-
- return global_accepted_action;
-}
-
-
-void QDragManager::cancel(bool deleteSource)
-{
- beingCancelled = true;
-
- if (object->target()) {
- QDragLeaveEvent dle;
- QApplication::sendEvent(object->target(), &dle);
- }
-
- if (drag_object) {
- if (deleteSource)
- object->deleteLater();
- drag_object = object = 0;
- }
-
-#ifndef QT_NO_CURSOR
- if (restoreCursor) {
- QApplication::restoreOverrideCursor();
- restoreCursor = false;
- }
-#endif
-
- global_accepted_action = Qt::IgnoreAction;
-}
-
-
-void QDragManager::drop()
-{
-#ifndef QT_NO_CURSOR
- if (restoreCursor) {
- QApplication::restoreOverrideCursor();
- restoreCursor = false;
- }
-#endif
-}
-
-QVariant QDropData::retrieveData_sys(const QString &mimetype, QVariant::Type type) const
-{
- if (!drag_object)
- return QVariant();
- QByteArray data = drag_object->mimeData()->data(mimetype);
- if (type == QVariant::String)
- return QString::fromUtf8(data);
- return data;
-}
-
-bool QDropData::hasFormat_sys(const QString &format) const
-{
- return formats().contains(format);
-}
-
-QStringList QDropData::formats_sys() const
-{
- if (drag_object)
- return drag_object->mimeData()->formats();
- return QStringList();
-}
-
-QT_END_NAMESPACE
-#endif // QT_NO_DRAGANDDROP
diff --git a/src/widgets/platforms/s60/qeventdispatcher_s60.cpp b/src/widgets/platforms/s60/qeventdispatcher_s60.cpp
deleted file mode 100644
index 3f20c08084..0000000000
--- a/src/widgets/platforms/s60/qeventdispatcher_s60.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qwidget.h>
-
-#include "qeventdispatcher_s60_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QtEikonEnv::QtEikonEnv()
- : m_lastIterationCount(0)
- , m_savedStatusCode(KRequestPending)
- , m_hasAlreadyRun(false)
-{
-}
-
-QtEikonEnv::~QtEikonEnv()
-{
-}
-
-void QtEikonEnv::RunL()
-{
- QEventDispatcherS60 *dispatcher = qobject_cast<QEventDispatcherS60 *>(QAbstractEventDispatcher::instance());
- if (!dispatcher) {
- CEikonEnv::RunL();
- return;
- }
-
- if (m_lastIterationCount != dispatcher->iterationCount()) {
- m_hasAlreadyRun = false;
- m_lastIterationCount = dispatcher->iterationCount();
- }
-
- if (m_hasAlreadyRun) {
- // Fool the active scheduler into believing we are still waiting for events.
- // The window server thinks we are not, however.
- m_savedStatusCode = iStatus.Int();
- iStatus = KRequestPending;
- SetActive();
- dispatcher->queueDeferredActiveObjectsCompletion();
- } else {
- m_hasAlreadyRun = true;
- CEikonEnv::RunL();
- }
-}
-
-void QtEikonEnv::DoCancel()
-{
- complete();
-
- CEikonEnv::DoCancel();
-}
-
-void QtEikonEnv::complete()
-{
- if (m_hasAlreadyRun) {
- if (m_savedStatusCode != KRequestPending) {
- TRequestStatus *status = &iStatus;
- QEventDispatcherSymbian::RequestComplete(status, m_savedStatusCode);
- m_savedStatusCode = KRequestPending;
- }
- m_hasAlreadyRun = false;
- }
-}
-
-QEventDispatcherS60::QEventDispatcherS60(QObject *parent)
- : QEventDispatcherSymbian(parent),
- m_noInputEvents(false)
-{
-}
-
-QEventDispatcherS60::~QEventDispatcherS60()
-{
- for (int c = 0; c < m_deferredInputEvents.size(); ++c) {
- delete m_deferredInputEvents[c].event;
- }
-}
-
-bool QEventDispatcherS60::processEvents ( QEventLoop::ProcessEventsFlags flags )
-{
- bool ret = false;
-
- QT_TRY {
- bool oldNoInputEventsValue = m_noInputEvents;
- if (flags & QEventLoop::ExcludeUserInputEvents) {
- m_noInputEvents = true;
- } else {
- m_noInputEvents = false;
- ret = sendDeferredInputEvents() || ret;
- }
-
- ret = QEventDispatcherSymbian::processEvents(flags) || ret;
-
- m_noInputEvents = oldNoInputEventsValue;
- } QT_CATCH (const std::exception& ex) {
-#ifndef QT_NO_EXCEPTIONS
- CActiveScheduler::Current()->Error(qt_symbian_exception2Error(ex));
-#endif
- }
-
- return ret;
-}
-
-bool QEventDispatcherS60::hasPendingEvents()
-{
- return !m_deferredInputEvents.isEmpty() || QEventDispatcherSymbian::hasPendingEvents();
-}
-
-void QEventDispatcherS60::saveInputEvent(QSymbianControl *control, QWidget *widget, QInputEvent *event)
-{
- DeferredInputEvent inputEvent = {control, widget, event};
- m_deferredInputEvents.append(inputEvent);
- connect(widget, SIGNAL(destroyed(QObject*)), SLOT(removeInputEventsForWidget(QObject*)));
-}
-
-bool QEventDispatcherS60::sendDeferredInputEvents()
-{
- bool eventsSent = false;
- while (!m_deferredInputEvents.isEmpty()) {
- DeferredInputEvent inputEvent = m_deferredInputEvents.takeFirst();
-#ifndef QT_NO_EXCEPTIONS
- try {
-#endif
- inputEvent.control->sendInputEvent(inputEvent.widget, inputEvent.event);
-#ifndef QT_NO_EXCEPTIONS
- } catch (...) {
- delete inputEvent.event;
- throw;
- }
-#endif
- delete inputEvent.event;
- eventsSent = true;
- }
-
- return eventsSent;
-}
-
-void QEventDispatcherS60::removeInputEventsForWidget(QObject *object)
-{
- for (int c = 0; c < m_deferredInputEvents.size(); ++c) {
- if (m_deferredInputEvents[c].widget == object) {
- delete m_deferredInputEvents[c].event;
- m_deferredInputEvents.removeAt(c--);
- }
- }
-}
-
-// reimpl
-void QEventDispatcherS60::reactivateDeferredActiveObjects()
-{
- if (S60->qtOwnsS60Environment) {
- static_cast<QtEikonEnv *>(CCoeEnv::Static())->complete();
- }
-
- QEventDispatcherSymbian::reactivateDeferredActiveObjects();
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/s60/qeventdispatcher_s60_p.h b/src/widgets/platforms/s60/qeventdispatcher_s60_p.h
deleted file mode 100644
index 8e644a2d06..0000000000
--- a/src/widgets/platforms/s60/qeventdispatcher_s60_p.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QEVENTDISPATCHER_S60_P_H
-#define QEVENTDISPATCHER_S60_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.
-//
-
-#include <private/qeventdispatcher_symbian_p.h>
-#include "qt_s60_p.h"
-
-#include <eikenv.h>
-
-QT_BEGIN_NAMESPACE
-
-class QEventDispatcherS60;
-
-class QtEikonEnv : public CEikonEnv
-{
-public:
- QtEikonEnv();
- ~QtEikonEnv();
-
- // from CActive.
- void RunL();
- void DoCancel();
-
- void complete();
-
-private:
- // Workaround for a BC break from S60 3.2 -> 5.0, where the CEikonEnv override was removed.
- // To avoid linking to that when we build against 3.2, define an empty body here.
- // Reserved_*() have been verified to be empty in the S60 code.
- void Reserved_1() {}
- void Reserved_2() {}
-
-private:
- int m_lastIterationCount;
- TInt m_savedStatusCode;
- bool m_hasAlreadyRun;
-};
-
-class Q_WIDGETS_EXPORT QEventDispatcherS60 : public QEventDispatcherSymbian
-{
- Q_OBJECT
-
-public:
- QEventDispatcherS60(QObject *parent = 0);
- ~QEventDispatcherS60();
-
- bool processEvents ( QEventLoop::ProcessEventsFlags flags );
- bool hasPendingEvents();
-
- bool excludeUserInputEvents() { return m_noInputEvents; }
-
- void saveInputEvent(QSymbianControl *control, QWidget *widget, QInputEvent *event);
-
- void reactivateDeferredActiveObjects();
-
-private:
- bool sendDeferredInputEvents();
-
-private Q_SLOTS:
- void removeInputEventsForWidget(QObject *object);
-
-private:
- bool m_noInputEvents;
-
- struct DeferredInputEvent
- {
- QSymbianControl *control;
- QWidget *widget;
- QInputEvent *event;
- };
- QList<DeferredInputEvent> m_deferredInputEvents;
-};
-
-QT_END_NAMESPACE
-
-#endif // QEVENTDISPATCHER_S60_P_H
diff --git a/src/widgets/platforms/s60/qfont_s60.cpp b/src/widgets/platforms/s60/qfont_s60.cpp
deleted file mode 100644
index e0f4bad527..0000000000
--- a/src/widgets/platforms/s60/qfont_s60.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qfont.h"
-#include "qfont_p.h"
-#include <private/qt_s60_p.h>
-#include <private/qpixmap_s60_p.h>
-#include "qmutex.h"
-
-QT_BEGIN_NAMESPACE
-
-#ifdef QT_NO_FREETYPE
-Q_GLOBAL_STATIC(QMutex, lastResortFamilyMutex);
-#endif // QT_NO_FREETYPE
-
-extern QStringList qt_symbian_fontFamiliesOnFontServer(); // qfontdatabase_s60.cpp
-Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, fontFamiliesOnFontServer, {
- // We are only interested in the initial font families. No Application fonts.
- // Therefore, we are allowed to cache the list.
- x->append(qt_symbian_fontFamiliesOnFontServer());
-});
-
-QString QFont::lastResortFont() const
-{
- // Symbian's font Api does not distinguish between font and family.
- // Therefore we try to get a "Family" first, then fall back to "Sans".
- static QString font = lastResortFamily();
- if (font.isEmpty())
- font = QLatin1String("Sans");
- return font;
-}
-
-QString QFont::lastResortFamily() const
-{
-#ifdef QT_NO_FREETYPE
- QMutexLocker locker(lastResortFamilyMutex());
- static QString family;
- if (family.isEmpty()) {
-
- QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
-
- CFont *font;
- const TInt err = S60->screenDevice()->GetNearestFontInTwips(font, TFontSpec());
- Q_ASSERT(err == KErrNone);
- const TFontSpec spec = font->FontSpecInTwips();
- family = QString((const QChar *)spec.iTypeface.iName.Ptr(), spec.iTypeface.iName.Length());
- S60->screenDevice()->ReleaseFont(font);
-
- lock.relock();
- }
- return family;
-#else // QT_NO_FREETYPE
- // For the FreeType case we just hard code the face name, since otherwise on
- // East Asian systems we may get a name for a stroke based (non-ttf) font.
-
- // TODO: Get the type face name in a proper way
-
- const bool isJapaneseOrChineseSystem =
- User::Language() == ELangJapanese || User::Language() == ELangPrcChinese;
-
- static QString family;
- if (family.isEmpty()) {
- QStringList families = qt_symbian_fontFamiliesOnFontServer();
- const char* const preferredFamilies[] = {"Nokia Sans S60", "Series 60 Sans"};
- for (int i = 0; i < sizeof preferredFamilies / sizeof preferredFamilies[0]; ++i) {
- const QString preferredFamily = QLatin1String(preferredFamilies[i]);
- if (families.contains(preferredFamily)) {
- family = preferredFamily;
- break;
- }
- }
- }
-
- return QLatin1String(isJapaneseOrChineseSystem?"Heisei Kaku Gothic S60":family.toLatin1());
-#endif // QT_NO_FREETYPE
-}
-
-QString QFont::defaultFamily() const
-{
-#ifdef QT_NO_FREETYPE
- switch(d->request.styleHint) {
- case QFont::SansSerif: {
- static const char* const preferredSansSerif[] = {"Nokia Sans S60", "Series 60 Sans"};
- for (int i = 0; i < sizeof preferredSansSerif / sizeof preferredSansSerif[0]; ++i) {
- const QString sansSerif = QLatin1String(preferredSansSerif[i]);
- if (fontFamiliesOnFontServer()->contains(sansSerif))
- return sansSerif;
- }
- }
- // No break. Intentional fall through.
- default:
- return lastResortFamily();
- }
-#endif // QT_NO_FREETYPE
- return lastResortFamily();
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/s60/qfontdatabase_s60.cpp b/src/widgets/platforms/s60/qfontdatabase_s60.cpp
deleted file mode 100644
index cfa405dbc1..0000000000
--- a/src/widgets/platforms/s60/qfontdatabase_s60.cpp
+++ /dev/null
@@ -1,1099 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qapplication_p.h>
-#include "qdir.h"
-#include "qfont_p.h"
-#include "qfontengine_s60_p.h"
-#include "qabstractfileengine.h"
-#include "qdesktopservices.h"
-#include "qtemporaryfile.h"
-#include "qtextcodec.h"
-#include <private/qpixmap_s60_p.h>
-#include <private/qt_s60_p.h>
-#include "qendian.h"
-#include <private/qcore_symbian_p.h>
-#ifdef QT_NO_FREETYPE
-#include <openfont.h>
-#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
-#include <graphics/openfontrasterizer.h> // COpenFontRasterizer has moved to a new header file
-#endif // SYMBIAN_ENABLE_SPLIT_HEADERS
-#endif // QT_NO_FREETYPE
-
-QT_BEGIN_NAMESPACE
-
-QStringList qt_symbian_fontFamiliesOnFontServer() // Also used in qfont_s60.cpp
-{
- QStringList result;
- QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
- const int numTypeFaces = S60->screenDevice()->NumTypefaces();
- for (int i = 0; i < numTypeFaces; i++) {
- TTypefaceSupport typefaceSupport;
- S60->screenDevice()->TypefaceSupport(typefaceSupport, i);
- const QString familyName((const QChar *)typefaceSupport.iTypeface.iName.Ptr(), typefaceSupport.iTypeface.iName.Length());
- result.append(familyName);
- }
- lock.relock();
- return result;
-}
-
-QFileInfoList alternativeFilePaths(const QString &path, const QStringList &nameFilters,
- QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort,
- bool uniqueFileNames = true)
-{
- QFileInfoList result;
-
- // Prepare a 'soft to hard' drive list: W:, X: ... A:, Z:
- QStringList driveStrings;
- foreach (const QFileInfo &drive, QDir::drives())
- driveStrings.append(drive.absolutePath());
- driveStrings.sort();
- const QString zDriveString(QLatin1String("Z:/"));
- driveStrings.removeAll(zDriveString);
- driveStrings.prepend(zDriveString);
-
- QStringList uniqueFileNameList;
- for (int i = driveStrings.count() - 1; i >= 0; --i) {
- const QDir dirOnDrive(driveStrings.at(i) + path);
- const QFileInfoList entriesOnDrive = dirOnDrive.entryInfoList(nameFilters, filters, sort);
- if (uniqueFileNames) {
- foreach(const QFileInfo &entry, entriesOnDrive) {
- if (!uniqueFileNameList.contains(entry.fileName())) {
- uniqueFileNameList.append(entry.fileName());
- result.append(entry);
- }
- }
- } else {
- result.append(entriesOnDrive);
- }
- }
- return result;
-}
-
-#ifdef QT_NO_FREETYPE
-class QSymbianFontDatabaseExtrasImplementation : public QSymbianFontDatabaseExtras
-{
-public:
- QSymbianFontDatabaseExtrasImplementation();
- ~QSymbianFontDatabaseExtrasImplementation();
-
- const QSymbianTypeFaceExtras *extras(const QString &typeface, bool bold, bool italic) const;
- void removeAppFontData(QFontDatabasePrivate::ApplicationFont *fnt);
- static inline bool appFontLimitReached();
- TUid addFontFileToFontStore(const QFileInfo &fontFileInfo);
- static void clear();
-
- static inline QString tempAppFontFolder();
- static const QString appFontMarkerPrefix;
- static QString appFontMarker(); // 'qaf<shortUid[+shortPid]>'
-
- struct CFontFromFontStoreReleaser {
- static inline void cleanup(CFont *font)
- {
- if (!font)
- return;
- const QSymbianFontDatabaseExtrasImplementation *dbExtras =
- static_cast<const QSymbianFontDatabaseExtrasImplementation*>(privateDb()->symbianExtras);
- dbExtras->m_store->ReleaseFont(font);
- }
- };
-
- struct CFontFromScreenDeviceReleaser {
- static inline void cleanup(CFont *font)
- {
- if (!font)
- return;
- S60->screenDevice()->ReleaseFont(font);
- }
- };
-
-// m_heap, m_store, m_rasterizer and m_extras are used if Symbian
-// does not provide the Font Table API
- RHeap* m_heap;
- CFontStore *m_store;
- COpenFontRasterizer *m_rasterizer;
- mutable QList<const QSymbianTypeFaceExtras *> m_extras;
-
- mutable QSet<QString> m_applicationFontFamilies;
-};
-
-const QString QSymbianFontDatabaseExtrasImplementation::appFontMarkerPrefix =
- QLatin1String("Q");
-
-inline QString QSymbianFontDatabaseExtrasImplementation::tempAppFontFolder()
-{
- return QDir::toNativeSeparators(QDir::tempPath()) + QLatin1Char('\\');
-}
-
-QString QSymbianFontDatabaseExtrasImplementation::appFontMarker()
-{
- static QString result;
- if (result.isEmpty()) {
- quint16 id = 0;
- if (QSymbianTypeFaceExtras::symbianFontTableApiAvailable()) {
- // We are allowed to load app fonts even from previous, crashed runs
- // of this application, since we can access the font tables.
- const quint32 uid = RProcess().Type().MostDerived().iUid;
- id = static_cast<quint16>(uid + (uid >> 16));
- } else {
- // If no font table Api is available, we must not even load a font
- // from a previous (crashed) run of this application. Reason: we
- // won't get the font tables, they are not in the CFontStore.
- // So, we use the pid, for more uniqueness.
- id = static_cast<quint16>(RProcess().Id().Id());
- }
- result = appFontMarkerPrefix + QString::fromLatin1("%1").arg(id & 0x7fff, 3, 32, QLatin1Char('0'));
- Q_ASSERT(appFontMarkerPrefix.length() == 1 && result.length() == 4);
- }
- return result;
-}
-
-static inline bool qt_symbian_fontNameHasAppFontMarker(const QString &fontName)
-{
- const int idLength = 3; // Keep in sync with id length in appFontMarker().
- const QString &prefix = QSymbianFontDatabaseExtrasImplementation::appFontMarkerPrefix;
- if (fontName.length() < prefix.length() + idLength
- || fontName.mid(fontName.length() - idLength - prefix.length(), prefix.length()) != prefix)
- return false;
- // Testing if the the id is base32 data
- for (int i = fontName.length() - idLength; i < fontName.length(); ++i) {
- const QChar &c = fontName.at(i);
- if (!(c >= QLatin1Char('0') && c <= QLatin1Char('9')
- || c >= QLatin1Char('a') && c <= QLatin1Char('v')))
- return false;
- }
- return true;
-}
-
-// If fontName is an application font of this app, prepend the app font marker
-QString qt_symbian_fontNameWithAppFontMarker(const QString &fontName)
-{
- QFontDatabasePrivate *db = privateDb();
- Q_ASSERT(db);
- const QSymbianFontDatabaseExtrasImplementation *dbExtras =
- static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras);
- return dbExtras->m_applicationFontFamilies.contains(fontName) ?
- fontName + QSymbianFontDatabaseExtrasImplementation::appFontMarker()
- : fontName;
-}
-
-static inline QString qt_symbian_appFontNameWithoutMarker(const QString &markedFontName)
-{
- return markedFontName.left(markedFontName.length()
- - QSymbianFontDatabaseExtrasImplementation::appFontMarker().length());
-}
-
-QSymbianFontDatabaseExtrasImplementation::QSymbianFontDatabaseExtrasImplementation()
-{
- if (!QSymbianTypeFaceExtras::symbianFontTableApiAvailable()) {
- QStringList filters;
- filters.append(QLatin1String("*.ttf"));
- filters.append(QLatin1String("*.ccc"));
- filters.append(QLatin1String("*.ltt"));
- const QFileInfoList fontFiles = alternativeFilePaths(QLatin1String("resource\\Fonts"), filters);
-
- const TInt heapMinLength = 0x1000;
- const TInt heapMaxLength = qMax(0x20000 * fontFiles.count(), heapMinLength);
- m_heap = User::ChunkHeap(NULL, heapMinLength, heapMaxLength);
- QT_TRAP_THROWING(
- m_store = CFontStore::NewL(m_heap);
- m_rasterizer = COpenFontRasterizer::NewL(TUid::Uid(0x101F7F5E));
- CleanupStack::PushL(m_rasterizer);
- m_store->InstallRasterizerL(m_rasterizer);
- CleanupStack::Pop(m_rasterizer););
-
- foreach (const QFileInfo &fontFileInfo, fontFiles)
- addFontFileToFontStore(fontFileInfo);
- }
-}
-
-void QSymbianFontDatabaseExtrasImplementation::clear()
-{
- QFontDatabasePrivate *db = privateDb();
- if (!db)
- return;
- const QSymbianFontDatabaseExtrasImplementation *dbExtras =
- static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras);
- if (!dbExtras)
- return; // initializeDb() has never been called
- QSymbianTypeFaceExtrasHash &extrasHash = S60->fontData();
- if (QSymbianTypeFaceExtras::symbianFontTableApiAvailable()) {
- qDeleteAll(extrasHash);
- } else {
- typedef QList<const QSymbianTypeFaceExtras *>::iterator iterator;
- for (iterator p = dbExtras->m_extras.begin(); p != dbExtras->m_extras.end(); ++p) {
- dbExtras->m_store->ReleaseFont((*p)->fontOwner());
- delete *p;
- }
- dbExtras->m_extras.clear();
- }
- extrasHash.clear();
-}
-
-void qt_cleanup_symbianFontDatabase()
-{
- static bool cleanupDone = false;
- if (cleanupDone)
- return;
- cleanupDone = true;
-
- QFontDatabasePrivate *db = privateDb();
- if (!db)
- return;
-
- QSymbianFontDatabaseExtrasImplementation::clear();
-
- if (!db->applicationFonts.isEmpty()) {
- QFontDatabase::removeAllApplicationFonts();
- // We remove the left over temporary font files of Qt application.
- // Active fonts are undeletable since the font server holds a handle
- // on them, so we do not need to worry to delete other running
- // applications' fonts.
- const QDir dir(QSymbianFontDatabaseExtrasImplementation::tempAppFontFolder());
- const QStringList filter(
- QSymbianFontDatabaseExtrasImplementation::appFontMarkerPrefix + QLatin1String("*.ttf"));
- foreach (const QFileInfo &ttfFile, dir.entryInfoList(filter))
- QFile(ttfFile.absoluteFilePath()).remove();
- db->applicationFonts.clear();
- }
-}
-
-QSymbianFontDatabaseExtrasImplementation::~QSymbianFontDatabaseExtrasImplementation()
-{
- qt_cleanup_symbianFontDatabase();
- if (!QSymbianTypeFaceExtras::symbianFontTableApiAvailable()) {
- delete m_store;
- m_heap->Close();
- }
-}
-
-#ifndef FNTSTORE_H_INLINES_SUPPORT_FMM
-/*
- Workaround: fntstore.h has an inlined function 'COpenFont* CBitmapFont::OpenFont()'
- that returns a private data member. The header will change between SDKs. But Qt has
- to build on any SDK version and run on other versions of Symbian OS.
- This function performs the needed pointer arithmetic to get the right COpenFont*
-*/
-COpenFont* OpenFontFromBitmapFont(const CBitmapFont* aBitmapFont)
-{
- const TInt offsetIOpenFont = 92; // '_FOFF(CBitmapFont, iOpenFont)' ..if iOpenFont weren't private
- const TUint valueIOpenFont = *(TUint*)PtrAdd(aBitmapFont, offsetIOpenFont);
- return (valueIOpenFont & 1) ?
- (COpenFont*)PtrAdd(aBitmapFont, valueIOpenFont & ~1) : // New behavior: iOpenFont is offset
- (COpenFont*)valueIOpenFont; // Old behavior: iOpenFont is pointer
-}
-#endif // FNTSTORE_H_INLINES_SUPPORT_FMM
-
-const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(const QString &aTypeface,
- bool bold, bool italic) const
-{
- QSymbianTypeFaceExtrasHash &extrasHash = S60->fontData();
- if (extrasHash.isEmpty() && QThread::currentThread() != QApplication::instance()->thread())
- S60->addThreadLocalReleaseFunc(clear);
- const QString typeface = qt_symbian_fontNameWithAppFontMarker(aTypeface);
- const QString searchKey = typeface + QString::number(int(bold)) + QString::number(int(italic));
- if (!extrasHash.contains(searchKey)) {
- TFontSpec searchSpec(qt_QString2TPtrC(typeface), 1);
- if (bold)
- searchSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
- if (italic)
- searchSpec.iFontStyle.SetPosture(EPostureItalic);
-
- CFont* font = NULL;
- if (QSymbianTypeFaceExtras::symbianFontTableApiAvailable()) {
- const TInt err = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(font, searchSpec);
- Q_ASSERT(err == KErrNone && font);
- QScopedPointer<CFont, CFontFromScreenDeviceReleaser> sFont(font);
- QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font);
- sFont.take();
- extrasHash.insert(searchKey, extras);
- } else {
- const TInt err = m_store->GetNearestFontToDesignHeightInPixels(font, searchSpec);
- Q_ASSERT(err == KErrNone && font);
- const CBitmapFont *bitmapFont = static_cast<CBitmapFont*>(font);
- COpenFont *openFont =
-#ifdef FNTSTORE_H_INLINES_SUPPORT_FMM
- bitmapFont->OpenFont();
-#else // FNTSTORE_H_INLINES_SUPPORT_FMM
- OpenFontFromBitmapFont(bitmapFont);
-#endif // FNTSTORE_H_INLINES_SUPPORT_FMM
- const TOpenFontFaceAttrib* const attrib = openFont->FaceAttrib();
- const QString foundKey =
- QString((const QChar*)attrib->FullName().Ptr(), attrib->FullName().Length());
- if (!extrasHash.contains(foundKey)) {
- QScopedPointer<CFont, CFontFromFontStoreReleaser> sFont(font);
- QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font, openFont);
- sFont.take();
- m_extras.append(extras);
- extrasHash.insert(searchKey, extras);
- extrasHash.insert(foundKey, extras);
- } else {
- m_store->ReleaseFont(font);
- extrasHash.insert(searchKey, extrasHash.value(foundKey));
- }
- }
- }
- return extrasHash.value(searchKey);
-}
-
-void QSymbianFontDatabaseExtrasImplementation::removeAppFontData(
- QFontDatabasePrivate::ApplicationFont *fnt)
-{
- clear();
- if (!QSymbianTypeFaceExtras::symbianFontTableApiAvailable()
- && fnt->fontStoreFontFileUid.iUid != 0)
- m_store->RemoveFile(fnt->fontStoreFontFileUid);
- if (!fnt->families.isEmpty())
- m_applicationFontFamilies.remove(fnt->families.first());
- if (fnt->screenDeviceFontFileId != 0)
- S60->screenDevice()->RemoveFile(fnt->screenDeviceFontFileId);
- QFile::remove(fnt->temporaryFileName);
- *fnt = QFontDatabasePrivate::ApplicationFont();
-}
-
-bool QSymbianFontDatabaseExtrasImplementation::appFontLimitReached()
-{
- QFontDatabasePrivate *db = privateDb();
- if (!db)
- return false;
- const int maxAppFonts = 5;
- int registeredAppFonts = 0;
- foreach (const QFontDatabasePrivate::ApplicationFont &appFont, db->applicationFonts)
- if (!appFont.families.isEmpty() && ++registeredAppFonts == maxAppFonts)
- return true;
- return false;
-}
-
-TUid QSymbianFontDatabaseExtrasImplementation::addFontFileToFontStore(const QFileInfo &fontFileInfo)
-{
- Q_ASSERT(!QSymbianTypeFaceExtras::symbianFontTableApiAvailable());
- const QString fontFile = QDir::toNativeSeparators(fontFileInfo.absoluteFilePath());
- const TPtrC fontFilePtr(qt_QString2TPtrC(fontFile));
- TUid fontUid = {0};
- TRAP_IGNORE(fontUid = m_store->AddFileL(fontFilePtr));
- return fontUid;
-}
-
-#else // QT_NO_FREETYPE
-class QFontEngineFTS60 : public QFontEngineFT
-{
-public:
- QFontEngineFTS60(const QFontDef &fd);
-};
-
-QFontEngineFTS60::QFontEngineFTS60(const QFontDef &fd)
- : QFontEngineFT(fd)
-{
- default_hint_style = HintFull;
-}
-#endif // QT_NO_FREETYPE
-
-/*
- QFontEngineS60::pixelsToPoints, QFontEngineS60::pointsToPixels, QFontEngineMultiS60::QFontEngineMultiS60
- and QFontEngineMultiS60::QFontEngineMultiS60 should be in qfontengine_s60.cpp. But since also the
- Freetype based font rendering need them, they are here.
-*/
-qreal QFontEngineS60::pixelsToPoints(qreal pixels, Qt::Orientation orientation)
-{
- CWsScreenDevice* device = S60->screenDevice();
- return (orientation == Qt::Horizontal?
- device->HorizontalPixelsToTwips(pixels)
- :device->VerticalPixelsToTwips(pixels)) / KTwipsPerPoint;
-}
-
-qreal QFontEngineS60::pointsToPixels(qreal points, Qt::Orientation orientation)
-{
- CWsScreenDevice* device = S60->screenDevice();
- const int twips = points * KTwipsPerPoint;
- return orientation == Qt::Horizontal?
- device->HorizontalTwipsToPixels(twips)
- :device->VerticalTwipsToPixels(twips);
-}
-
-QFontEngineMultiS60::QFontEngineMultiS60(QFontEngine *first, int script, const QStringList &fallbackFamilies)
- : QFontEngineMulti(fallbackFamilies.size() + 1)
- , m_script(script)
- , m_fallbackFamilies(fallbackFamilies)
-{
- engines[0] = first;
- first->ref.ref();
- fontDef = engines[0]->fontDef;
-}
-
-void QFontEngineMultiS60::loadEngine(int at)
-{
- Q_ASSERT(at < engines.size());
- Q_ASSERT(engines.at(at) == 0);
-
- QFontDef request = fontDef;
- request.styleStrategy |= QFont::NoFontMerging;
- request.family = m_fallbackFamilies.at(at-1);
- engines[at] = QFontDatabase::findFont(m_script,
- /*fontprivate*/0,
- request);
- Q_ASSERT(engines[at]);
-}
-
-#ifdef QT_NO_FREETYPE
-static bool registerScreenDeviceFont(int screenDeviceFontIndex,
- const QSymbianFontDatabaseExtrasImplementation *dbExtras)
-{
- TTypefaceSupport typefaceSupport;
- S60->screenDevice()->TypefaceSupport(typefaceSupport, screenDeviceFontIndex);
-
- QString familyName((const QChar*)typefaceSupport.iTypeface.iName.Ptr(), typefaceSupport.iTypeface.iName.Length());
- if (qt_symbian_fontNameHasAppFontMarker(familyName)) {
- const QString &marker = QSymbianFontDatabaseExtrasImplementation::appFontMarker();
- if (familyName.endsWith(marker)) {
- familyName = qt_symbian_appFontNameWithoutMarker(familyName);
- dbExtras->m_applicationFontFamilies.insert(familyName);
- } else {
- return false; // This was somebody else's application font. Skip it.
- }
- }
-
- CFont *font; // We have to get a font instance in order to know all the details
- TFontSpec fontSpec(typefaceSupport.iTypeface.iName, 11);
- if (S60->screenDevice()->GetNearestFontInPixels(font, fontSpec) != KErrNone)
- return false;
- QScopedPointer<CFont, QSymbianFontDatabaseExtrasImplementation::CFontFromScreenDeviceReleaser> sFont(font);
- if (font->TypeUid() != KCFbsFontUid)
- return false;
- TOpenFontFaceAttrib faceAttrib;
- const CFbsFont *cfbsFont = static_cast<const CFbsFont *>(font);
- cfbsFont->GetFaceAttrib(faceAttrib);
-
- QtFontStyle::Key styleKey;
- styleKey.style = faceAttrib.IsItalic()?QFont::StyleItalic:QFont::StyleNormal;
- styleKey.weight = faceAttrib.IsBold()?QFont::Bold:QFont::Normal;
-
- QtFontFamily *family = privateDb()->family(familyName, true);
- family->fixedPitch = faceAttrib.IsMonoWidth();
- QtFontFoundry *foundry = family->foundry(QString(), true);
- QtFontStyle *style = foundry->style(styleKey, QString(), true);
- style->smoothScalable = typefaceSupport.iIsScalable;
- style->pixelSize(0, true);
-
- const QSymbianTypeFaceExtras *typeFaceExtras =
- dbExtras->extras(familyName, faceAttrib.IsBold(), faceAttrib.IsItalic());
- const QByteArray os2Table = typeFaceExtras->getSfntTable(MAKE_TAG('O', 'S', '/', '2'));
- const unsigned char* data = reinterpret_cast<const unsigned char*>(os2Table.constData());
- const unsigned char* ulUnicodeRange = data + 42;
- quint32 unicodeRange[4] = {
- qFromBigEndian<quint32>(ulUnicodeRange),
- qFromBigEndian<quint32>(ulUnicodeRange + 4),
- qFromBigEndian<quint32>(ulUnicodeRange + 8),
- qFromBigEndian<quint32>(ulUnicodeRange + 12)
- };
- const unsigned char* ulCodePageRange = data + 78;
- quint32 codePageRange[2] = {
- qFromBigEndian<quint32>(ulCodePageRange),
- qFromBigEndian<quint32>(ulCodePageRange + 4)
- };
- const QList<QFontDatabase::WritingSystem> writingSystems =
- qt_determine_writing_systems_from_truetype_bits(unicodeRange, codePageRange);
- foreach (const QFontDatabase::WritingSystem system, writingSystems)
- family->writingSystems[system] = QtFontFamily::Supported;
- return true;
-}
-#endif
-
-static void initializeDb()
-{
- QFontDatabasePrivate *db = privateDb();
- if(!db || db->count)
- return;
-
-#ifdef QT_NO_FREETYPE
- if (!db->symbianExtras)
- db->symbianExtras = new QSymbianFontDatabaseExtrasImplementation;
-
- QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
-
- const int numTypeFaces = S60->screenDevice()->NumTypefaces();
- const QSymbianFontDatabaseExtrasImplementation *dbExtras =
- static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras);
- for (int i = 0; i < numTypeFaces; i++)
- registerScreenDeviceFont(i, dbExtras);
-
- // We have to clear/release all CFonts, here, in case one of the fonts is
- // an application font of another running Qt app. Otherwise the other Qt app
- // cannot remove it's application font, anymore -> "Zombie Font".
- QSymbianFontDatabaseExtrasImplementation::clear();
-
- lock.relock();
-
-#else // QT_NO_FREETYPE
- QDir dir(QDesktopServices::storageLocation(QDesktopServices::FontsLocation));
- dir.setNameFilters(QStringList() << QLatin1String("*.ttf")
- << QLatin1String("*.ttc") << QLatin1String("*.pfa")
- << QLatin1String("*.pfb"));
- for (int i = 0; i < int(dir.count()); ++i) {
- const QByteArray file = QFile::encodeName(dir.absoluteFilePath(dir[i]));
- db->addTTFile(file);
- }
-#endif // QT_NO_FREETYPE
-}
-
-static inline void load(const QString &family = QString(), int script = -1)
-{
- Q_UNUSED(family)
- Q_UNUSED(script)
- initializeDb();
-}
-
-struct OffsetTable {
- quint32 sfntVersion;
- quint16 numTables, searchRange, entrySelector, rangeShift;
-};
-
-struct TableRecord {
- quint32 tag, checkSum, offset, length;
-};
-
-struct NameTableHead {
- quint16 format, count, stringOffset;
-};
-
-struct NameRecord {
- quint16 platformID, encodingID, languageID, nameID, length, offset;
-};
-
-static quint32 ttfCalcChecksum(const char *data, quint32 bytesCount)
-{
- quint32 result = 0;
- const quint32 *ptr = reinterpret_cast<const quint32*>(data);
- const quint32 *endPtr =
- ptr + (bytesCount + sizeof(quint32) - 1) / sizeof(quint32);
- while (ptr < endPtr) {
- const quint32 unit32Value = *ptr++;
- result += qFromBigEndian(unit32Value);
- }
- return result;
-}
-
-static inline quint32 toDWordBoundary(quint32 value)
-{
- return (value + 3) & ~3;
-}
-
-static inline quint32 dWordPadding(quint32 value)
-{
- return (4 - (value & 3)) & 3;
-}
-
-static inline bool ttfMarkNameTable(QByteArray &table, const QString &marker)
-{
- const quint32 tableLength = static_cast<quint32>(table.size());
-
- if (tableLength > 50000 // hard limit
- || tableLength < sizeof(NameTableHead)) // corrupt name table
- return false;
-
- const NameTableHead *head = reinterpret_cast<const NameTableHead*>(table.constData());
- const quint16 count = qFromBigEndian(head->count);
- const quint16 stringOffset = qFromBigEndian(head->stringOffset);
- if (count > 200 // hard limit
- || stringOffset >= tableLength // corrupt name table
- || sizeof(NameTableHead) + count * sizeof(NameRecord) >= tableLength) // corrupt name table
- return false;
-
- QTextEncoder encoder(QTextCodec::codecForName("UTF-16BE"), QTextCodec::IgnoreHeader);
- const QByteArray markerUtf16BE = encoder.fromUnicode(marker);
- const QByteArray markerAscii = marker.toAscii();
-
- QByteArray markedTable;
- markedTable.reserve(tableLength + marker.length() * 20); // Original size plus some extra
- markedTable.append(table, stringOffset);
- QByteArray markedStrings;
- quint32 stringDataCount = stringOffset;
- for (quint16 i = 0; i < count; ++i) {
- const quint32 nameRecordOffset = sizeof(NameTableHead) + sizeof(NameRecord) * i;
- NameRecord *nameRecord =
- reinterpret_cast<NameRecord*>(markedTable.data() + nameRecordOffset);
- const quint16 nameID = qFromBigEndian(nameRecord->nameID);
- const quint16 platformID = qFromBigEndian(nameRecord->platformID);
- const quint16 encodingID = qFromBigEndian(nameRecord->encodingID);
- const quint16 offset = qFromBigEndian(nameRecord->offset);
- const quint16 length = qFromBigEndian(nameRecord->length);
- stringDataCount += length;
- if (stringDataCount > 80000 // hard limit. String data may be > name table size. Multiple records can reference the same string.
- || static_cast<quint32>(stringOffset + offset + length) > tableLength) // String outside bounds
- return false;
- const bool needsMarker =
- nameID == 1 || nameID == 3 || nameID == 4 || nameID == 16 || nameID == 21;
- const bool isUnicode =
- platformID == 0 || platformID == 3 && encodingID == 1;
- const QByteArray originalString =
- QByteArray::fromRawData(table.constData() + stringOffset + offset, length);
- QByteArray markedString;
- if (needsMarker) {
- const int maxBytesLength = (KMaxTypefaceNameLength - marker.length()) * (isUnicode ? 2 : 1);
- markedString = originalString.left(maxBytesLength) + (isUnicode ? markerUtf16BE : markerAscii);
- } else {
- markedString = originalString;
- }
- nameRecord->offset = qToBigEndian(static_cast<quint16>(markedStrings.length()));
- nameRecord->length = qToBigEndian(static_cast<quint16>(markedString.length()));
- markedStrings.append(markedString);
- }
- markedTable.append(markedStrings);
- table = markedTable;
- return true;
-}
-
-const quint32 ttfMaxFileSize = 3500000;
-
-static inline bool ttfMarkAppFont(QByteArray &ttf, const QString &marker)
-{
- const quint32 ttfChecksumNumber = 0xb1b0afba;
- const quint32 alignment = 4;
- const quint32 ttfLength = static_cast<quint32>(ttf.size());
- if (ttfLength > ttfMaxFileSize // hard limit
- || ttfLength % alignment != 0 // ttf sizes are always factors of 4
- || ttfLength <= sizeof(OffsetTable) // ttf too short
- || ttfCalcChecksum(ttf.constData(), ttf.size()) != ttfChecksumNumber) // ttf checksum is invalid
- return false;
-
- const OffsetTable *offsetTable = reinterpret_cast<const OffsetTable*>(ttf.constData());
- const quint16 numTables = qFromBigEndian(offsetTable->numTables);
- const quint32 recordsLength =
- toDWordBoundary(sizeof(OffsetTable) + numTables * sizeof(TableRecord));
- if (numTables > 30 // hard limit
- || recordsLength + numTables * alignment > ttfLength) // Corrupt ttf. Tables would not fit, even if empty.
- return false;
-
- QByteArray markedTtf;
- markedTtf.reserve(ttfLength + marker.length() * 20); // Original size plus some extra
- markedTtf.append(ttf.constData(), recordsLength);
-
- const quint32 ttfCheckSumAdjustmentOffset = 8; // Offset from the start of 'head'
- int indexOfHeadTable = -1;
- quint32 ttfDataSize = recordsLength;
- typedef QPair<quint32, quint32> Range;
- QList<Range> memoryRanges;
- memoryRanges.reserve(numTables);
- for (int i = 0; i < numTables; ++i) {
- TableRecord *tableRecord =
- reinterpret_cast<TableRecord*>(markedTtf.data() + sizeof(OffsetTable) + i * sizeof(TableRecord));
- const quint32 offset = qFromBigEndian(tableRecord->offset);
- const quint32 length = qFromBigEndian(tableRecord->length);
- const quint32 lengthAligned = toDWordBoundary(length);
- ttfDataSize += lengthAligned;
- if (offset < recordsLength // must not intersect ttf header/records
- || offset % alignment != 0 // must be aligned
- || offset > ttfLength - alignment // table out of bounds
- || offset + lengthAligned > ttfLength // table out of bounds
- || ttfDataSize > ttfLength) // tables would not fit into the ttf
- return false;
-
- foreach (const Range &range, memoryRanges)
- if (offset < range.first + range.second && offset + lengthAligned > range.first)
- return false; // Overlaps with another table
- memoryRanges.append(Range(offset, lengthAligned));
-
- quint32 checkSum = qFromBigEndian(tableRecord->checkSum);
- if (tableRecord->tag == qToBigEndian(static_cast<quint32>('head'))) {
- if (length < ttfCheckSumAdjustmentOffset + sizeof(quint32))
- return false; // Invalid 'head' table
- const quint32 *checkSumAdjustmentTag =
- reinterpret_cast<const quint32*>(ttf.constData() + offset + ttfCheckSumAdjustmentOffset);
- const quint32 checkSumAdjustment = qFromBigEndian(*checkSumAdjustmentTag);
- checkSum += checkSumAdjustment;
- indexOfHeadTable = i; // For the ttf checksum re-calculation, later
- }
- if (checkSum != ttfCalcChecksum(ttf.constData() + offset, length))
- return false; // Table checksum is invalid
-
- bool updateTableChecksum = false;
- QByteArray table;
- if (tableRecord->tag == qToBigEndian(static_cast<quint32>('name'))) {
- table = QByteArray(ttf.constData() + offset, length);
- if (!ttfMarkNameTable(table, marker))
- return false; // Name table was not markable.
- updateTableChecksum = true;
- } else {
- table = QByteArray::fromRawData(ttf.constData() + offset, length);
- }
-
- tableRecord->offset = qToBigEndian(markedTtf.size());
- tableRecord->length = qToBigEndian(table.size());
- markedTtf.append(table);
- markedTtf.append(QByteArray(dWordPadding(table.size()), 0)); // 0-padding
- if (updateTableChecksum) {
- TableRecord *tableRecord = // Need to recalculate, since markedTtf changed
- reinterpret_cast<TableRecord*>(markedTtf.data() + sizeof(OffsetTable) + i * sizeof(TableRecord));
- const quint32 offset = qFromBigEndian(tableRecord->offset);
- const quint32 length = qFromBigEndian(tableRecord->length);
- tableRecord->checkSum = qToBigEndian(ttfCalcChecksum(markedTtf.constData() + offset, length));
- }
- }
- if (indexOfHeadTable == -1 // 'head' table is mandatory
- || ttfDataSize != ttfLength) // We do not allow ttf data "holes". Neither does Symbian.
- return false;
- TableRecord *headRecord =
- reinterpret_cast<TableRecord*>(markedTtf.data() + sizeof(OffsetTable) + indexOfHeadTable * sizeof(TableRecord));
- quint32 *checkSumAdjustmentTag =
- reinterpret_cast<quint32*>(markedTtf.data() + qFromBigEndian(headRecord->offset) + ttfCheckSumAdjustmentOffset);
- *checkSumAdjustmentTag = 0;
- const quint32 ttfChecksum = ttfCalcChecksum(markedTtf.constData(), markedTtf.count());
- *checkSumAdjustmentTag = qToBigEndian(ttfChecksumNumber - ttfChecksum);
- ttf = markedTtf;
- return true;
-}
-
-static inline bool ttfCanSymbianLoadFont(const QByteArray &data, const QString &fileName)
-{
- bool result = false;
- QString ttfFileName;
- QFile tempFileGuard;
- QFileInfo info(fileName);
- if (!data.isEmpty()) {
- QTemporaryFile tempfile(QSymbianFontDatabaseExtrasImplementation::tempAppFontFolder()
- + QSymbianFontDatabaseExtrasImplementation::appFontMarker()
- + QLatin1String("XXXXXX.ttf"));
- if (!tempfile.open() || tempfile.write(data) == -1)
- return false;
- ttfFileName = QDir::toNativeSeparators(QFileInfo(tempfile).canonicalFilePath());
- tempfile.setAutoRemove(false);
- tempfile.close();
- tempFileGuard.setFileName(ttfFileName);
- if (!tempFileGuard.open(QIODevice::ReadOnly))
- return false;
- } else if (info.isFile()) {
- ttfFileName = QDir::toNativeSeparators(info.canonicalFilePath());
- } else {
- return false;
- }
-
- CFontStore *store = 0;
- RHeap* heap = User::ChunkHeap(NULL, 0x1000, 0x20000);
- if (heap) {
- QT_TRAP_THROWING(
- CleanupClosePushL(*heap);
- store = CFontStore::NewL(heap);
- CleanupStack::PushL(store);
- COpenFontRasterizer *rasterizer = COpenFontRasterizer::NewL(TUid::Uid(0x101F7F5E));
- CleanupStack::PushL(rasterizer);
- store->InstallRasterizerL(rasterizer);
- CleanupStack::Pop(rasterizer);
- TUid fontUid = {-1};
- TRAP_IGNORE(fontUid = store->AddFileL(qt_QString2TPtrC(ttfFileName)));
- if (fontUid.iUid != -1)
- result = true;
- CleanupStack::PopAndDestroy(2, heap); // heap, store
- );
- }
-
- if (tempFileGuard.isOpen())
- tempFileGuard.remove();
-
- return result;
-}
-
-static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
-{
- if (QSymbianFontDatabaseExtrasImplementation::appFontLimitReached()
- || fnt->data.size() > ttfMaxFileSize // hard limit
- || fnt->data.isEmpty() && (!fnt->fileName.endsWith(QLatin1String(".ttf"), Qt::CaseInsensitive) // Only buffer or .ttf
- || QFileInfo(fnt->fileName).size() > ttfMaxFileSize)) // hard limit
- return;
-
-// Using ttfCanSymbianLoadFont() causes crashes on app destruction (Symbian^3|PR1 and lower).
-// Therefore, not using it for now, but eventually in a later version.
-// if (!ttfCanSymbianLoadFont(fnt->data, fnt->fileName))
-// return;
-
- QFontDatabasePrivate *db = privateDb();
- if (!db)
- return;
-
- if (!db->count)
- initializeDb();
-
- QSymbianFontDatabaseExtrasImplementation *dbExtras =
- static_cast<QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras);
- if (!dbExtras)
- return;
-
- const QString &marker = QSymbianFontDatabaseExtrasImplementation::appFontMarker();
-
- // The QTemporaryFile object being used in the following section must be
- // destructed before letting Symbian load the TTF file. Symbian would not
- // load it otherwise, because QTemporaryFile will still keep some handle
- // on it. The scope is used to reduce the life time of the QTemporaryFile.
- // In order to prevent other processes from modifying the file between the
- // moment where the QTemporaryFile is destructed and the file is loaded by
- // Symbian, we have a QFile "tempFileGuard" outside the scope which opens
- // the file in ReadOnly mode while the QTemporaryFile is still alive.
- QFile tempFileGuard;
- {
- QTemporaryFile tempfile(QSymbianFontDatabaseExtrasImplementation::tempAppFontFolder()
- + marker + QLatin1String("XXXXXX.ttf"));
- if (!tempfile.open())
- return;
- const QString tempFileName = QFileInfo(tempfile).canonicalFilePath();
- if (fnt->data.isEmpty()) {
- QFile sourceFile(fnt->fileName);
- if (!sourceFile.open(QIODevice::ReadOnly))
- return;
- fnt->data = sourceFile.readAll();
- }
- if (!ttfMarkAppFont(fnt->data, marker) || tempfile.write(fnt->data) == -1)
- return;
- tempfile.setAutoRemove(false);
- tempfile.close(); // Tempfile still keeps a file handle, forbidding write access
- fnt->data.clear(); // The TTF data was marked and saved. Not needed in memory, anymore.
- tempFileGuard.setFileName(tempFileName);
- if (!tempFileGuard.open(QIODevice::ReadOnly))
- return;
- fnt->temporaryFileName = tempFileName;
- }
-
- const QString fullFileName = QDir::toNativeSeparators(fnt->temporaryFileName);
- QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
- const QStringList fontsOnServerBefore = qt_symbian_fontFamiliesOnFontServer();
- const TInt err =
- S60->screenDevice()->AddFile(qt_QString2TPtrC(fullFileName), fnt->screenDeviceFontFileId);
- tempFileGuard.close(); // Did its job
- const QStringList fontsOnServerAfter = qt_symbian_fontFamiliesOnFontServer();
- if (err == KErrNone && fontsOnServerBefore.count() < fontsOnServerAfter.count()) { // Added to screen device?
- int fontOnServerIndex = fontsOnServerAfter.count() - 1;
- for (int i = 0; i < fontsOnServerBefore.count(); i++) {
- if (fontsOnServerBefore.at(i) != fontsOnServerAfter.at(i)) {
- fontOnServerIndex = i;
- break;
- }
- }
-
- // Must remove all font engines with their CFonts, first.
- QFontCache::instance()->clear();
- db->free();
- QSymbianFontDatabaseExtrasImplementation::clear();
-
- if (!QSymbianTypeFaceExtras::symbianFontTableApiAvailable())
- fnt->fontStoreFontFileUid = dbExtras->addFontFileToFontStore(QFileInfo(fullFileName));
-
- const QString &appFontName = fontsOnServerAfter.at(fontOnServerIndex);
- fnt->families.append(qt_symbian_appFontNameWithoutMarker(appFontName));
- if (!qt_symbian_fontNameHasAppFontMarker(appFontName)
- || !registerScreenDeviceFont(fontOnServerIndex, dbExtras))
- dbExtras->removeAppFontData(fnt);
- } else {
- if (fnt->screenDeviceFontFileId > 0)
- S60->screenDevice()->RemoveFile(fnt->screenDeviceFontFileId); // May still have the file open!
- QFile::remove(fnt->temporaryFileName);
- *fnt = QFontDatabasePrivate::ApplicationFont();
- }
- lock.relock();
-}
-
-bool QFontDatabase::removeApplicationFont(int handle)
-{
- QMutexLocker locker(fontDatabaseMutex());
-
- QFontDatabasePrivate *db = privateDb();
- if (!db || handle < 0 || handle >= db->applicationFonts.count())
- return false;
- QSymbianFontDatabaseExtrasImplementation *dbExtras =
- static_cast<QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras);
- if (!dbExtras)
- return false;
-
- QFontDatabasePrivate::ApplicationFont *fnt = &db->applicationFonts[handle];
- if (fnt->families.isEmpty())
- return true; // Nothing to remove. Return peacefully.
-
- // Must remove all font engines with their CFonts, first
- QFontCache::instance()->clear();
- db->free();
- dbExtras->removeAppFontData(fnt);
-
- db->invalidate(); // This will just emit 'fontDatabaseChanged()'
- return true;
-}
-
-bool QFontDatabase::removeAllApplicationFonts()
-{
- QMutexLocker locker(fontDatabaseMutex());
-
- const int applicationFontsCount = privateDb()->applicationFonts.count();
- for (int i = 0; i < applicationFontsCount; ++i)
- if (!removeApplicationFont(i))
- return false;
- return true;
-}
-
-bool QFontDatabase::supportsThreadedFontRendering()
-{
- return QSymbianTypeFaceExtras::symbianFontTableApiAvailable();
-}
-
-static
-QFontDef cleanedFontDef(const QFontDef &req)
-{
- QFontDef result = req;
- if (result.pixelSize <= 0) {
- result.pixelSize = QFontEngineS60::pointsToPixels(qMax(qreal(1.0), result.pointSize));
- result.pointSize = 0;
- }
- return result;
-}
-
-QFontEngine *QFontDatabase::findFont(int script, const QFontPrivate *d, const QFontDef &req)
-{
- const QFontCache::Key key(cleanedFontDef(req), script);
-
- if (!privateDb()->count)
- initializeDb();
-
- QFontEngine *fe = QFontCache::instance()->findEngine(key);
- if (!fe) {
- // Making sure that fe->fontDef.family will be an existing font.
- initializeDb();
- QFontDatabasePrivate *db = privateDb();
- QtFontDesc desc;
- QList<int> blacklistedFamilies;
- match(script, key.def, key.def.family, QString(), -1, &desc, blacklistedFamilies);
- if (!desc.family) // falling back to application font
- desc.family = db->family(QApplication::font().defaultFamily());
- Q_ASSERT(desc.family);
-
- // Making sure that desc.family supports the requested script
- QtFontDesc mappedDesc;
- bool supportsScript = false;
- do {
- match(script, req, QString(), QString(), -1, &mappedDesc, blacklistedFamilies);
- if (mappedDesc.family == desc.family) {
- supportsScript = true;
- break;
- }
- blacklistedFamilies.append(mappedDesc.familyIndex);
- } while (mappedDesc.family);
- if (!supportsScript) {
- blacklistedFamilies.clear();
- match(script, req, QString(), QString(), -1, &mappedDesc, blacklistedFamilies);
- if (mappedDesc.family)
- desc = mappedDesc;
- }
-
- const QString fontFamily = desc.family->name;
- QFontDef request = req;
- request.family = fontFamily;
-#ifdef QT_NO_FREETYPE
- const QSymbianFontDatabaseExtrasImplementation *dbExtras =
- static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras);
- const QSymbianTypeFaceExtras *typeFaceExtras =
- dbExtras->extras(fontFamily, request.weight > QFont::Normal, request.style != QFont::StyleNormal);
-
- // We need a valid pixelSize, e.g. for lineThickness()
- if (request.pixelSize < 0)
- request.pixelSize = request.pointSize * d->dpi / 72;
-
- fe = new QFontEngineS60(request, typeFaceExtras);
-#else // QT_NO_FREETYPE
- Q_UNUSED(d)
- QFontEngine::FaceId faceId;
- const QtFontFamily * const reqQtFontFamily = db->family(fontFamily);
- faceId.filename = reqQtFontFamily->fontFilename;
- faceId.index = reqQtFontFamily->fontFileIndex;
-
- QFontEngineFTS60 *fte = new QFontEngineFTS60(cleanedFontDef(request));
- if (fte->init(faceId, true, QFontEngineFT::Format_A8))
- fe = fte;
- else
- delete fte;
-#endif // QT_NO_FREETYPE
-
- Q_ASSERT(fe);
- if (script == QUnicodeTables::Common
- && !(req.styleStrategy & QFont::NoFontMerging)
- && !fe->symbol) {
-
- QStringList commonFonts;
- for (int ws = 1; ws < QFontDatabase::WritingSystemsCount; ++ws) {
- if (scriptForWritingSystem[ws] != script)
- continue;
- for (int i = 0; i < db->count; ++i) {
- if (db->families[i]->writingSystems[ws] & QtFontFamily::Supported)
- commonFonts.append(db->families[i]->name);
- }
- }
-
- // Hack: Prioritize .ccc fonts
- const QString niceEastAsianFont(QLatin1String("Sans MT 936_S60"));
- if (commonFonts.removeAll(niceEastAsianFont) > 0)
- commonFonts.prepend(niceEastAsianFont);
-
- fe = new QFontEngineMultiS60(fe, script, commonFonts);
- }
- }
- fe->ref.ref();
- QFontCache::instance()->insertEngine(key, fe);
- return fe;
-}
-
-void QFontDatabase::load(const QFontPrivate *d, int script)
-{
- QFontEngine *fe = 0;
- QFontDef req = d->request;
-
- if (!d->engineData) {
- const QFontCache::Key key(cleanedFontDef(req), script);
- getEngineData(d, key);
- }
-
- // the cached engineData could have already loaded the engine we want
- if (d->engineData->engines[script])
- fe = d->engineData->engines[script];
-
- if (!fe) {
- if (qt_enable_test_font && req.family == QLatin1String("__Qt__Box__Engine__")) {
- fe = new QTestFontEngine(req.pixelSize);
- fe->fontDef = req;
- } else {
- fe = findFont(script, d, req);
- }
- d->engineData->engines[script] = fe;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/s60/qfontengine_s60.cpp b/src/widgets/platforms/s60/qfontengine_s60.cpp
deleted file mode 100644
index b4de066306..0000000000
--- a/src/widgets/platforms/s60/qfontengine_s60.cpp
+++ /dev/null
@@ -1,566 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qfontengine_s60_p.h"
-#include "qtextengine_p.h"
-#include "qendian.h"
-#include "qglobal.h"
-#include <private/qapplication_p.h>
-#include "qimage.h"
-#include <private/qt_s60_p.h>
-#include <private/qpixmap_s60_p.h>
-
-#include <e32base.h>
-#include <e32std.h>
-#include <eikenv.h>
-#include <gdi.h>
-#if defined(Q_SYMBIAN_HAS_GLYPHOUTLINE_API)
-#include <graphics/gdi/gdiplatapi.h>
-#endif // Q_SYMBIAN_HAS_GLYPHOUTLINE_API
-
-// Replication of TGetFontTableParam & friends.
-// There is unfortunately no compile time flag like SYMBIAN_FONT_TABLE_API
-// that would help us to only replicate these things for Symbian versions
-// that do not yet have the font table Api. Symbian's public SDK does
-// generally not define any usable macros.
-class QSymbianTGetFontTableParam
-{
-public:
- TUint32 iTag;
- TAny *iContent;
- TInt iLength;
-};
-const TUid QSymbianKFontGetFontTable = {0x102872C1};
-const TUid QSymbianKFontReleaseFontTable = {0x2002AC24};
-
-QT_BEGIN_NAMESPACE
-
-QSymbianTypeFaceExtras::QSymbianTypeFaceExtras(CFont* cFont, COpenFont *openFont)
- : m_cFont(cFont)
- , m_symbolCMap(false)
- , m_openFont(openFont)
-{
- if (!symbianFontTableApiAvailable()) {
- TAny *trueTypeExtension = NULL;
- m_openFont->ExtendedInterface(KUidOpenFontTrueTypeExtension, trueTypeExtension);
- m_trueTypeExtension = static_cast<MOpenFontTrueTypeExtension*>(trueTypeExtension);
- Q_ASSERT(m_trueTypeExtension);
- }
-}
-
-QSymbianTypeFaceExtras::~QSymbianTypeFaceExtras()
-{
- if (symbianFontTableApiAvailable())
- S60->screenDevice()->ReleaseFont(m_cFont);
-}
-
-QByteArray QSymbianTypeFaceExtras::getSfntTable(uint tag) const
-{
- if (symbianFontTableApiAvailable()) {
- QSymbianTGetFontTableParam fontTableParams = { tag, 0, 0 };
- if (m_cFont->ExtendedFunction(QSymbianKFontGetFontTable, &fontTableParams) == KErrNone) {
- const char* const fontTableContent =
- static_cast<const char *>(fontTableParams.iContent);
- const QByteArray fontTable(fontTableContent, fontTableParams.iLength);
- m_cFont->ExtendedFunction(QSymbianKFontReleaseFontTable, &fontTableParams);
- return fontTable;
- }
- return QByteArray();
- } else {
- Q_ASSERT(m_trueTypeExtension->HasTrueTypeTable(tag));
- TInt error = KErrNone;
- TInt tableByteLength = 0;
- TAny *table = m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength);
- Q_CHECK_PTR(table);
- const QByteArray result(static_cast<const char*>(table), tableByteLength);
- m_trueTypeExtension->ReleaseTrueTypeTable(table);
- return result;
- }
-}
-
-bool QSymbianTypeFaceExtras::getSfntTableData(uint tag, uchar *buffer, uint *length) const
-{
- bool result = true;
- if (symbianFontTableApiAvailable()) {
- QSymbianTGetFontTableParam fontTableParams = { tag, 0, 0 };
- if (m_cFont->ExtendedFunction(QSymbianKFontGetFontTable, &fontTableParams) == KErrNone) {
- if (*length > 0 && *length < fontTableParams.iLength) {
- result = false; // Caller did not allocate enough memory
- } else {
- *length = fontTableParams.iLength;
- if (buffer)
- memcpy(buffer, fontTableParams.iContent, fontTableParams.iLength);
- }
- m_cFont->ExtendedFunction(QSymbianKFontReleaseFontTable, &fontTableParams);
- } else {
- result = false;
- }
- } else {
- if (!m_trueTypeExtension->HasTrueTypeTable(tag))
- return false;
-
- TInt error = KErrNone;
- TInt tableByteLength;
- TAny *table = m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength);
- Q_CHECK_PTR(table);
-
- if (error != KErrNone) {
- return false;
- } else if (*length > 0 && *length < tableByteLength) {
- result = false; // Caller did not allocate enough memory
- } else {
- *length = tableByteLength;
- if (buffer)
- memcpy(buffer, table, tableByteLength);
- }
-
- m_trueTypeExtension->ReleaseTrueTypeTable(table);
- }
- return result;
-}
-
-const uchar *QSymbianTypeFaceExtras::cmap() const
-{
- if (m_cmapTable.isNull()) {
- const QByteArray cmapTable = getSfntTable(MAKE_TAG('c', 'm', 'a', 'p'));
- int size = 0;
- const uchar *cmap = QFontEngine::getCMap(reinterpret_cast<const uchar *>
- (cmapTable.constData()), cmapTable.size(), &m_symbolCMap, &size);
- m_cmapTable = QByteArray(reinterpret_cast<const char *>(cmap), size);
- }
- return reinterpret_cast<const uchar *>(m_cmapTable.constData());
-}
-
-bool QSymbianTypeFaceExtras::isSymbolCMap() const
-{
- return m_symbolCMap;
-}
-
-CFont *QSymbianTypeFaceExtras::fontOwner() const
-{
- return m_cFont;
-}
-
-QFixed QSymbianTypeFaceExtras::unitsPerEm() const
-{
- if (m_unitsPerEm.value() != 0)
- return m_unitsPerEm;
- const QByteArray head = getSfntTable(MAKE_TAG('h', 'e', 'a', 'd'));
- const int unitsPerEmOffset = 18;
- if (head.size() > unitsPerEmOffset + sizeof(quint16)) {
- const uchar* tableData = reinterpret_cast<const uchar*>(head.constData());
- const uchar* unitsPerEm = tableData + unitsPerEmOffset;
- m_unitsPerEm = qFromBigEndian<quint16>(unitsPerEm);
- } else {
- // Bitmap font? Corrupt font?
- // We return -1 and let the QFontEngineS60 return the pixel size.
- m_unitsPerEm = -1;
- }
- return m_unitsPerEm;
-}
-
-bool QSymbianTypeFaceExtras::symbianFontTableApiAvailable()
-{
- enum FontTableApiAvailability {
- Unknown,
- Available,
- Unavailable
- };
- static FontTableApiAvailability availability =
- QSysInfo::symbianVersion() < QSysInfo::SV_SF_3 ?
- Unavailable : Unknown;
- if (availability == Unknown) {
- // Actually, we should ask CFeatureDiscovery::IsFeatureSupportedL()
- // with FfFontTable here. But since at the time of writing, the
- // FfFontTable flag check either gave false positives or false
- // negatives. Here comes an implicit check via CFont::ExtendedFunction.
- QSymbianTGetFontTableParam fontTableParams = {
- MAKE_TAG('O', 'S', '/', '2'), 0, 0 };
- QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
- CFont *font;
- const TInt getFontErr = S60->screenDevice()->GetNearestFontInTwips(font, TFontSpec());
- Q_ASSERT(getFontErr == KErrNone);
- if (font->ExtendedFunction(QSymbianKFontGetFontTable, &fontTableParams) == KErrNone) {
- font->ExtendedFunction(QSymbianKFontReleaseFontTable, &fontTableParams);
- availability = Available;
- } else {
- availability = Unavailable;
- }
- S60->screenDevice()->ReleaseFont(font);
- lock.relock();
- }
- return availability == Available;
-}
-
-// duplicated from qfontengine_xyz.cpp
-static inline unsigned int getChar(const QChar *str, int &i, const int len)
-{
- uint ucs4 = str[i].unicode();
- if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) {
- ++i;
- ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode());
- }
- return ucs4;
-}
-
-extern QString qt_symbian_fontNameWithAppFontMarker(const QString &fontName); // qfontdatabase_s60.cpp
-
-CFont *QFontEngineS60::fontWithSize(qreal size) const
-{
- CFont *result = 0;
- const QString family = qt_symbian_fontNameWithAppFontMarker(QFontEngine::fontDef.family);
- TFontSpec fontSpec(qt_QString2TPtrC(family), TInt(size));
- fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
- fontSpec.iFontStyle.SetPosture(QFontEngine::fontDef.style == QFont::StyleNormal?EPostureUpright:EPostureItalic);
- fontSpec.iFontStyle.SetStrokeWeight(QFontEngine::fontDef.weight > QFont::Normal?EStrokeWeightBold:EStrokeWeightNormal);
- const TInt errorCode = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(result, fontSpec);
- Q_ASSERT(result && (errorCode == 0));
- return result;
-}
-
-void QFontEngineS60::setFontScale(qreal scale)
-{
- if (qFuzzyCompare(scale, qreal(1))) {
- if (!m_originalFont)
- m_originalFont = fontWithSize(m_originalFontSizeInPixels);
- m_activeFont = m_originalFont;
- } else {
- const qreal scaledFontSizeInPixels = m_originalFontSizeInPixels * scale;
- if (!m_scaledFont ||
- (TInt(scaledFontSizeInPixels) != TInt(m_scaledFontSizeInPixels))) {
- releaseFont(m_scaledFont);
- m_scaledFontSizeInPixels = scaledFontSizeInPixels;
- m_scaledFont = fontWithSize(m_scaledFontSizeInPixels);
- }
- m_activeFont = m_scaledFont;
- }
-}
-
-void QFontEngineS60::releaseFont(CFont *&font)
-{
- if (font) {
- S60->screenDevice()->ReleaseFont(font);
- font = 0;
- }
-}
-
-QFontEngineS60::QFontEngineS60(const QFontDef &request, const QSymbianTypeFaceExtras *extras)
- : m_extras(extras)
- , m_originalFont(0)
- , m_originalFontSizeInPixels((request.pixelSize >= 0)?
- request.pixelSize:pointsToPixels(request.pointSize))
- , m_scaledFont(0)
- , m_scaledFontSizeInPixels(0)
- , m_activeFont(0)
-{
- QFontEngine::fontDef = request;
- setFontScale(1.0);
- cache_cost = sizeof(QFontEngineS60);
-}
-
-QFontEngineS60::~QFontEngineS60()
-{
- releaseFont(m_originalFont);
- releaseFont(m_scaledFont);
-}
-
-QFixed QFontEngineS60::emSquareSize() const
-{
- const QFixed unitsPerEm = m_extras->unitsPerEm();
- return unitsPerEm.toInt() == -1 ?
- QFixed::fromReal(m_originalFontSizeInPixels) : unitsPerEm;
-}
-
-bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const
-{
- if (*nglyphs < len) {
- *nglyphs = len;
- return false;
- }
-
- HB_Glyph *g = glyphs->glyphs;
- const unsigned char* cmap = m_extras->cmap();
- const bool isRtl = (flags & QTextEngine::RightToLeft);
- for (int i = 0; i < len; ++i) {
- const unsigned int uc = getChar(characters, i, len);
- *g++ = QFontEngine::getTrueTypeGlyphIndex(cmap,
- (isRtl && !m_extras->isSymbolCMap()) ? QChar::mirroredChar(uc) : uc);
- }
-
- glyphs->numGlyphs = g - glyphs->glyphs;
- *nglyphs = glyphs->numGlyphs;
-
- if (flags & QTextEngine::GlyphIndicesOnly)
- return true;
-
- recalcAdvances(glyphs, flags);
- return true;
-}
-
-void QFontEngineS60::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const
-{
- Q_UNUSED(flags);
- TOpenFontCharMetrics metrics;
- const TUint8 *glyphBitmapBytes;
- TSize glyphBitmapSize;
- for (int i = 0; i < glyphs->numGlyphs; i++) {
- getCharacterData(glyphs->glyphs[i], metrics, glyphBitmapBytes, glyphBitmapSize);
- glyphs->advances_x[i] = metrics.HorizAdvance();
- glyphs->advances_y[i] = 0;
- }
-}
-
-#ifdef Q_SYMBIAN_HAS_GLYPHOUTLINE_API
-static bool parseGlyphPathData(const char *dataStr, const char *dataEnd, QPainterPath &path,
- qreal fontPixelSize, const QPointF &offset, bool hinted);
-#endif //Q_SYMBIAN_HAS_GLYPHOUTLINE_API
-
-void QFontEngineS60::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions,
- int nglyphs, QPainterPath *path,
- QTextItem::RenderFlags flags)
-{
-#ifdef Q_SYMBIAN_HAS_GLYPHOUTLINE_API
- Q_UNUSED(flags)
- RGlyphOutlineIterator iterator;
- const TInt error = iterator.Open(*m_activeFont, glyphs, nglyphs);
- if (KErrNone != error)
- return;
- const qreal fontSizeInPixels = qreal(m_activeFont->HeightInPixels());
- int count = 0;
- do {
- const TUint8* outlineUint8 = iterator.Outline();
- const char* const outlineChar = reinterpret_cast<const char*>(outlineUint8);
- const char* const outlineEnd = outlineChar + iterator.OutlineLength();
- parseGlyphPathData(outlineChar, outlineEnd, *path, fontSizeInPixels,
- positions[count++].toPointF(), false);
- } while(KErrNone == iterator.Next() && count <= nglyphs);
- iterator.Close();
-#else // Q_SYMBIAN_HAS_GLYPHOUTLINE_API
- QFontEngine::addGlyphsToPath(glyphs, positions, nglyphs, path, flags);
-#endif //Q_SYMBIAN_HAS_GLYPHOUTLINE_API
-}
-
-QImage QFontEngineS60::alphaMapForGlyph(glyph_t glyph)
-{
- // Note: On some Symbian versions (apparently <= Symbian^1), this
- // function will return gray values 0x00, 0x10 ... 0xe0, 0xf0 due
- // to a bug. The glyphs are nowhere perfectly opaque.
- // This has been fixed for Symbian^3.
-
- TOpenFontCharMetrics metrics;
- const TUint8 *glyphBitmapBytes;
- TSize glyphBitmapSize;
- getCharacterData(glyph, metrics, glyphBitmapBytes, glyphBitmapSize);
- QImage result(glyphBitmapBytes, glyphBitmapSize.iWidth, glyphBitmapSize.iHeight, glyphBitmapSize.iWidth, QImage::Format_Indexed8);
- result.setColorTable(grayPalette());
- return result;
-}
-
-glyph_metrics_t QFontEngineS60::boundingBox(const QGlyphLayout &glyphs)
-{
- if (glyphs.numGlyphs == 0)
- return glyph_metrics_t();
-
- QFixed w = 0;
- for (int i = 0; i < glyphs.numGlyphs; ++i)
- w += glyphs.effectiveAdvance(i);
-
- return glyph_metrics_t(0, -ascent(), w - lastRightBearing(glyphs), ascent()+descent()+1, w, 0);
-}
-
-glyph_metrics_t QFontEngineS60::boundingBox_const(glyph_t glyph) const
-{
- TOpenFontCharMetrics metrics;
- const TUint8 *glyphBitmapBytes;
- TSize glyphBitmapSize;
- getCharacterData(glyph, metrics, glyphBitmapBytes, glyphBitmapSize);
- const glyph_metrics_t result(
- metrics.HorizBearingX(),
- -metrics.HorizBearingY(),
- metrics.Width(),
- metrics.Height(),
- metrics.HorizAdvance(),
- 0
- );
- return result;
-}
-
-glyph_metrics_t QFontEngineS60::boundingBox(glyph_t glyph)
-{
- return boundingBox_const(glyph);
-}
-
-QFixed QFontEngineS60::ascent() const
-{
- // Workaround for QTBUG-8013
- // Stroke based fonts may return an incorrect FontMaxAscent of 0.
- const QFixed ascent = m_originalFont->FontMaxAscent();
- return (ascent > 0) ? ascent : QFixed::fromReal(m_originalFontSizeInPixels) - descent();
-}
-
-QFixed QFontEngineS60::descent() const
-{
- return m_originalFont->FontMaxDescent();
-}
-
-QFixed QFontEngineS60::leading() const
-{
- return 0;
-}
-
-qreal QFontEngineS60::maxCharWidth() const
-{
- return m_originalFont->MaxCharWidthInPixels();
-}
-
-const char *QFontEngineS60::name() const
-{
- return "QFontEngineS60";
-}
-
-bool QFontEngineS60::canRender(const QChar *string, int len)
-{
- const unsigned char *cmap = m_extras->cmap();
- for (int i = 0; i < len; ++i) {
- const unsigned int uc = getChar(string, i, len);
- if (QFontEngine::getTrueTypeGlyphIndex(cmap, uc) == 0)
- return false;
- }
- return true;
-}
-
-QByteArray QFontEngineS60::getSfntTable(uint tag) const
-{
- return m_extras->getSfntTable(tag);
-}
-
-bool QFontEngineS60::getSfntTableData(uint tag, uchar *buffer, uint *length) const
-{
- return m_extras->getSfntTableData(tag, buffer, length);
-}
-
-QFontEngine::Type QFontEngineS60::type() const
-{
- return QFontEngine::S60FontEngine;
-}
-
-void QFontEngineS60::getCharacterData(glyph_t glyph, TOpenFontCharMetrics& metrics, const TUint8*& bitmap, TSize& bitmapSize) const
-{
- // Setting the most significant bit tells GetCharacterData
- // that 'code' is a Glyph ID, rather than a UTF-16 value
- const TUint specialCode = (TUint)glyph | 0x80000000;
-
- const CFont::TCharacterDataAvailability availability =
- m_activeFont->GetCharacterData(specialCode, metrics, bitmap, bitmapSize);
- const glyph_t fallbackGlyph = '?';
- if (availability != CFont::EAllCharacterData) {
- const CFont::TCharacterDataAvailability fallbackAvailability =
- m_activeFont->GetCharacterData(fallbackGlyph, metrics, bitmap, bitmapSize);
- Q_ASSERT(fallbackAvailability == CFont::EAllCharacterData);
- }
-}
-
-#ifdef Q_SYMBIAN_HAS_GLYPHOUTLINE_API
-static inline void skipSpacesAndComma(const char* &str, const char* const strEnd)
-{
- while (str <= strEnd && (*str == ' ' || *str == ','))
- ++str;
-}
-
-static bool parseGlyphPathData(const char *svgPath, const char *svgPathEnd, QPainterPath &path,
- qreal fontPixelSize, const QPointF &offset, bool hinted)
-{
- Q_UNUSED(hinted)
- QPointF p1, p2, firstSubPathPoint;
- qreal *elementValues[] =
- {&p1.rx(), &p1.ry(), &p2.rx(), &p2.ry()};
- const int unitsPerEm = 2048; // See: http://en.wikipedia.org/wiki/Em_%28typography%29
- const qreal resizeFactor = fontPixelSize / unitsPerEm;
-
- while (svgPath < svgPathEnd) {
- skipSpacesAndComma(svgPath, svgPathEnd);
- const char pathElem = *svgPath++;
- skipSpacesAndComma(svgPath, svgPathEnd);
-
- if (pathElem != 'Z') {
- char *endStr = 0;
- int elementValuesCount = 0;
- for (int i = 0; i < 4; ++i) { // 4 = size of elementValues[]
- qreal coordinateValue = strtod(svgPath, &endStr);
- if (svgPath == endStr)
- break;
- if (i % 2) // Flip vertically
- coordinateValue = -coordinateValue;
- *elementValues[i] = coordinateValue * resizeFactor;
- elementValuesCount++;
- svgPath = endStr;
- skipSpacesAndComma(svgPath, svgPathEnd);
- }
- p1 += offset;
- if (elementValuesCount == 2)
- p2 = firstSubPathPoint;
- else
- p2 += offset;
- }
-
- switch (pathElem) {
- case 'M':
- firstSubPathPoint = p1;
- path.moveTo(p1);
- break;
- case 'Z':
- path.closeSubpath();
- break;
- case 'L':
- path.lineTo(p1);
- break;
- case 'Q':
- path.quadTo(p1, p2);
- break;
- default:
- return false;
- }
- }
- return true;
-}
-#endif // Q_SYMBIAN_HAS_GLYPHOUTLINE_API
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/s60/qfontengine_s60_p.h b/src/widgets/platforms/s60/qfontengine_s60_p.h
deleted file mode 100644
index c4fa9d16fe..0000000000
--- a/src/widgets/platforms/s60/qfontengine_s60_p.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QFONTENGINE_S60_P_H
-#define QFONTENGINE_S60_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.
-//
-
-#include "qconfig.h"
-#include <private/qfontengine_p.h>
-#include "qsize.h"
-#include <openfont.h>
-
-// The glyph outline code is intentionally disabled. It will be reactivated as
-// soon as the glyph outline API is backported from Symbian(^4) to Symbian(^3).
-#if 0
-#define Q_SYMBIAN_HAS_GLYPHOUTLINE_API
-#endif
-
-class CFont;
-
-QT_BEGIN_NAMESPACE
-
-// ..gives us access to truetype tables
-class QSymbianTypeFaceExtras
-{
-public:
- QSymbianTypeFaceExtras(CFont* cFont, COpenFont *openFont = 0);
- ~QSymbianTypeFaceExtras();
-
- QByteArray getSfntTable(uint tag) const;
- bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
- const uchar *cmap() const;
- CFont *fontOwner() const;
- bool isSymbolCMap() const;
- QFixed unitsPerEm() const;
- static bool symbianFontTableApiAvailable();
-
-private:
- CFont* m_cFont;
- mutable bool m_symbolCMap;
- mutable QByteArray m_cmapTable;
- mutable QFixed m_unitsPerEm;
-
- // m_openFont and m_openFont are used if Symbian does not provide
- // the Font Table API
- COpenFont *m_openFont;
- mutable MOpenFontTrueTypeExtension *m_trueTypeExtension;
-};
-
-class QFontEngineS60 : public QFontEngine
-{
-public:
- QFontEngineS60(const QFontDef &fontDef, const QSymbianTypeFaceExtras *extras);
- ~QFontEngineS60();
-
- QFixed emSquareSize() const;
- bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
- void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const;
-
- void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
- QPainterPath *path, QTextItem::RenderFlags flags);
-
- QImage alphaMapForGlyph(glyph_t glyph);
-
- glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
- glyph_metrics_t boundingBox_const(glyph_t glyph) const; // Const correctnes quirk.
- glyph_metrics_t boundingBox(glyph_t glyph);
-
- QFixed ascent() const;
- QFixed descent() const;
- QFixed leading() const;
- qreal maxCharWidth() const;
- qreal minLeftBearing() const { return 0; }
- qreal minRightBearing() const { return 0; }
-
- QByteArray getSfntTable(uint tag) const;
- bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
-
- static qreal pixelsToPoints(qreal pixels, Qt::Orientation orientation = Qt::Horizontal);
- static qreal pointsToPixels(qreal points, Qt::Orientation orientation = Qt::Horizontal);
-
- const char *name() const;
-
- bool canRender(const QChar *string, int len);
-
- Type type() const;
-
- void getCharacterData(glyph_t glyph, TOpenFontCharMetrics& metrics, const TUint8*& bitmap, TSize& bitmapSize) const;
- void setFontScale(qreal scale);
-
-private:
- friend class QFontPrivate;
- friend class QSymbianVGFontGlyphCache;
-
- QFixed glyphAdvance(HB_Glyph glyph) const;
- CFont *fontWithSize(qreal size) const;
- static void releaseFont(CFont *&font);
-
- const QSymbianTypeFaceExtras *m_extras;
- CFont* m_originalFont;
- const qreal m_originalFontSizeInPixels;
- CFont* m_scaledFont;
- qreal m_scaledFontSizeInPixels;
- CFont* m_activeFont;
-};
-
-class QFontEngineMultiS60 : public QFontEngineMulti
-{
-public:
- QFontEngineMultiS60(QFontEngine *first, int script, const QStringList &fallbackFamilies);
- void loadEngine(int at);
-
- int m_script;
- QStringList m_fallbackFamilies;
-};
-
-QT_END_NAMESPACE
-
-#endif // QFONTENGINE_S60_P_H
diff --git a/src/widgets/platforms/s60/qkeymapper_s60.cpp b/src/widgets/platforms/s60/qkeymapper_s60.cpp
deleted file mode 100644
index 1113b77875..0000000000
--- a/src/widgets/platforms/s60/qkeymapper_s60.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "private/qkeymapper_p.h"
-#include <private/qcore_symbian_p.h>
-#include <e32keys.h>
-#include <e32cmn.h>
-#include <centralrepository.h>
-#include <biditext.h>
-
-QT_BEGIN_NAMESPACE
-
-QKeyMapperPrivate::QKeyMapperPrivate()
-{
-}
-
-QKeyMapperPrivate::~QKeyMapperPrivate()
-{
-}
-
-QList<int> QKeyMapperPrivate::possibleKeys(QKeyEvent * /* e */)
-{
- QList<int> result;
- return result;
-}
-
-void QKeyMapperPrivate::clearMappings()
-{
- // stub
-}
-
-QString QKeyMapperPrivate::translateKeyEvent(int keySym, Qt::KeyboardModifiers /* modifiers */)
-{
- if (keySym >= Qt::Key_Escape) {
- switch (keySym) {
- case Qt::Key_Tab:
- return QString(QChar('\t'));
- case Qt::Key_Return: // fall through
- case Qt::Key_Enter:
- return QString(QChar('\r'));
- default:
- return QString();
- }
- }
-
- // Symbian doesn't actually use modifiers, but gives us the character code directly.
-
- return QString(QChar(keySym));
-}
-
-#include <e32keys.h>
-struct KeyMapping{
- TKeyCode s60KeyCode;
- TStdScanCode s60ScanCode;
- Qt::Key qtKey;
-};
-
-using namespace Qt;
-
-static const KeyMapping keyMapping[] = {
- {EKeyBackspace, EStdKeyBackspace, Key_Backspace},
- {EKeyTab, EStdKeyTab, Key_Tab},
- {EKeyEnter, EStdKeyEnter, Key_Enter},
- {EKeyEscape, EStdKeyEscape, Key_Escape},
- {EKeySpace, EStdKeySpace, Key_Space},
- {EKeyDelete, EStdKeyDelete, Key_Delete},
- {EKeyPrintScreen, EStdKeyPrintScreen, Key_SysReq},
- {EKeyPause, EStdKeyPause, Key_Pause},
- {EKeyHome, EStdKeyHome, Key_Home},
- {EKeyEnd, EStdKeyEnd, Key_End},
- {EKeyPageUp, EStdKeyPageUp, Key_PageUp},
- {EKeyPageDown, EStdKeyPageDown, Key_PageDown},
- {EKeyInsert, EStdKeyInsert, Key_Insert},
- {EKeyLeftArrow, EStdKeyLeftArrow, Key_Left},
- {EKeyRightArrow, EStdKeyRightArrow, Key_Right},
- {EKeyUpArrow, EStdKeyUpArrow, Key_Up},
- {EKeyDownArrow, EStdKeyDownArrow, Key_Down},
- {EKeyLeftShift, EStdKeyLeftShift, Key_Shift},
- {EKeyRightShift, EStdKeyRightShift, Key_Shift},
- {EKeyLeftAlt, EStdKeyLeftAlt, Key_Alt},
- {EKeyRightAlt, EStdKeyRightAlt, Key_AltGr},
- {EKeyLeftCtrl, EStdKeyLeftCtrl, Key_Control},
- {EKeyRightCtrl, EStdKeyRightCtrl, Key_Control},
- {EKeyLeftFunc, EStdKeyLeftFunc, Key_Super_L},
- {EKeyRightFunc, EStdKeyRightFunc, Key_Super_R},
- {EKeyCapsLock, EStdKeyCapsLock, Key_CapsLock},
- {EKeyNumLock, EStdKeyNumLock, Key_NumLock},
- {EKeyScrollLock, EStdKeyScrollLock, Key_ScrollLock},
- {EKeyF1, EStdKeyF1, Key_F1},
- {EKeyF2, EStdKeyF2, Key_F2},
- {EKeyF3, EStdKeyF3, Key_F3},
- {EKeyF4, EStdKeyF4, Key_F4},
- {EKeyF5, EStdKeyF5, Key_F5},
- {EKeyF6, EStdKeyF6, Key_F6},
- {EKeyF7, EStdKeyF7, Key_F7},
- {EKeyF8, EStdKeyF8, Key_F8},
- {EKeyF9, EStdKeyF9, Key_F9},
- {EKeyF10, EStdKeyF10, Key_F10},
- {EKeyF11, EStdKeyF11, Key_F11},
- {EKeyF12, EStdKeyF12, Key_F12},
- {EKeyF13, EStdKeyF13, Key_F13},
- {EKeyF14, EStdKeyF14, Key_F14},
- {EKeyF15, EStdKeyF15, Key_F15},
- {EKeyF16, EStdKeyF16, Key_F16},
- {EKeyF17, EStdKeyF17, Key_F17},
- {EKeyF18, EStdKeyF18, Key_F18},
- {EKeyF19, EStdKeyF19, Key_F19},
- {EKeyF20, EStdKeyF20, Key_F20},
- {EKeyF21, EStdKeyF21, Key_F21},
- {EKeyF22, EStdKeyF22, Key_F22},
- {EKeyF23, EStdKeyF23, Key_F23},
- {EKeyF24, EStdKeyF24, Key_F24},
- {EKeyOff, EStdKeyOff, Key_PowerOff},
-// {EKeyMenu, EStdKeyMenu, Key_Menu}, // Menu is EKeyApplication0
- {EKeyHelp, EStdKeyHelp, Key_Help},
- {EKeyDial, EStdKeyDial, Key_Call},
- {EKeyIncVolume, EStdKeyIncVolume, Key_VolumeUp},
- {EKeyDecVolume, EStdKeyDecVolume, Key_VolumeDown},
- {EKeyDevice0, EStdKeyDevice0, Key_Context1}, // Found by manual testing.
- {EKeyDevice1, EStdKeyDevice1, Key_Context2}, // Found by manual testing.
- {EKeyDevice3, EStdKeyDevice3, Key_Select},
- {EKeyDevice7, EStdKeyDevice7, Key_Camera},
- {EKeyApplication0, EStdKeyApplication0, Key_Menu}, // Found by manual testing.
- {EKeyApplication1, EStdKeyApplication1, Key_Launch1}, // Found by manual testing.
- {EKeyApplication2, EStdKeyApplication2, Key_MediaPlay}, // Found by manual testing.
- {EKeyApplication3, EStdKeyApplication3, Key_MediaStop}, // Found by manual testing.
- {EKeyApplication4, EStdKeyApplication4, Key_MediaNext}, // Found by manual testing.
- {EKeyApplication5, EStdKeyApplication5, Key_MediaPrevious}, // Found by manual testing.
- {EKeyApplication6, EStdKeyApplication6, Key_Launch6},
- {EKeyApplication7, EStdKeyApplication7, Key_Launch7},
- {EKeyApplication8, EStdKeyApplication8, Key_Launch8},
- {EKeyApplication9, EStdKeyApplication9, Key_Launch9},
- {EKeyApplicationA, EStdKeyApplicationA, Key_LaunchA},
- {EKeyApplicationB, EStdKeyApplicationB, Key_LaunchB},
- {EKeyApplicationC, EStdKeyApplicationC, Key_LaunchC},
- {EKeyApplicationD, EStdKeyApplicationD, Key_LaunchD},
- {EKeyApplicationE, EStdKeyApplicationE, Key_LaunchE},
- {EKeyApplicationF, EStdKeyApplicationF, Key_LaunchF},
- {EKeyApplication19, EStdKeyApplication19, Key_CameraFocus},
- {EKeyYes, EStdKeyYes, Key_Yes},
- {EKeyNo, EStdKeyNo, Key_No},
- {TKeyCode(0), TStdScanCode(0), Qt::Key(0)}
-};
-
-int QKeyMapperPrivate::mapS60KeyToQt(TUint s60key)
-{
- int res = Qt::Key_unknown;
- for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) {
- if (keyMapping[i].s60KeyCode == s60key) {
- res = keyMapping[i].qtKey;
- break;
- }
- }
- return res;
-}
-
-int QKeyMapperPrivate::mapS60ScanCodesToQt(TUint s60scanCode)
-{
- int res = Qt::Key_unknown;
- for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) {
- if (keyMapping[i].s60ScanCode == s60scanCode) {
- res = keyMapping[i].qtKey;
- break;
- }
- }
- return res;
-}
-
-int QKeyMapperPrivate::mapQtToS60Key(int qtKey)
-{
- int res = KErrUnknown;
- for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) {
- if (keyMapping[i].qtKey == qtKey) {
- res = keyMapping[i].s60KeyCode;
- break;
- }
- }
- return res;
-}
-
-int QKeyMapperPrivate::mapQtToS60ScanCodes(int qtKey)
-{
- int res = KErrUnknown;
- for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) {
- if (keyMapping[i].qtKey == qtKey) {
- res = keyMapping[i].s60ScanCode;
- break;
- }
- }
- return res;
-}
-
-void QKeyMapperPrivate::updateInputLanguage()
-{
-#ifdef Q_WS_S60
- TInt err;
- CRepository *repo;
- const TUid KCRUidAknFep = TUid::Uid(0x101F876D);
- const TUint32 KAknFepInputTxtLang = 0x00000005;
- TRAP(err, repo = CRepository::NewL(KCRUidAknFep));
- if (err != KErrNone)
- return;
-
- TInt symbianLang;
- err = repo->Get(KAknFepInputTxtLang, symbianLang);
- delete repo;
- if (err != KErrNone)
- return;
-
- QString qtLang = QString::fromAscii(qt_symbianLocaleName(symbianLang));
- keyboardInputLocale = QLocale(qtLang);
- keyboardInputDirection = (TBidiText::ScriptDirectionality(TLanguage(symbianLang)) == TBidiText::ERightToLeft)
- ? Qt::RightToLeft : Qt::LeftToRight;
-#else
- keyboardInputLocale = QLocale();
- keyboardInputDirection = Qt::LeftToRight;
-#endif
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/s60/qpaintengine_s60.cpp b/src/widgets/platforms/s60/qpaintengine_s60.cpp
deleted file mode 100644
index 67984008ca..0000000000
--- a/src/widgets/platforms/s60/qpaintengine_s60.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <private/qpaintengine_s60_p.h>
-#include <private/qpixmap_s60_p.h>
-#include <private/qt_s60_p.h>
-#include <private/qvolatileimage_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QS60PaintEnginePrivate : public QRasterPaintEnginePrivate
-{
-public:
- QS60PaintEnginePrivate() {}
-};
-
-QS60PaintEngine::QS60PaintEngine(QPaintDevice *device, QS60PlatformPixmap *data)
- : QRasterPaintEngine(*(new QS60PaintEnginePrivate), device), handle(data)
-{
-}
-
-bool QS60PaintEngine::begin(QPaintDevice *device)
-{
- Q_D(QS60PaintEngine);
-
- if (handle->classId() == QPlatformPixmap::RasterClass) {
- handle->beginDataAccess();
- bool ret = QRasterPaintEngine::begin(device);
- // Make sure QPaintEngine::paintDevice() returns the proper device.
- // QRasterPaintEngine changes pdev to QImage in case of RasterClass QPlatformPixmap
- // which is incorrect in Symbian.
- d->pdev = device;
- return ret;
- }
-
- return QRasterPaintEngine::begin(device);
-}
-
-bool QS60PaintEngine::end()
-{
- if (handle->classId() == QPlatformPixmap::RasterClass) {
- bool ret = QRasterPaintEngine::end();
- handle->endDataAccess();
- return ret;
- }
- return QRasterPaintEngine::end();
-}
-
-void QS60PaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm)
-{
- if (pm.handle()->classId() == QPlatformPixmap::RasterClass) {
- QS60PlatformPixmap *srcData = static_cast<QS60PlatformPixmap *>(pm.handle());
- srcData->beginDataAccess();
- QRasterPaintEngine::drawPixmap(p, pm);
- srcData->endDataAccess();
- } else {
- void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage);
- if (nativeData) {
- QVolatileImage *img = static_cast<QVolatileImage *>(nativeData);
- img->beginDataAccess();
- QRasterPaintEngine::drawImage(p, img->imageRef());
- img->endDataAccess(true);
- } else {
- QRasterPaintEngine::drawPixmap(p, pm);
- }
- }
-}
-
-void QS60PaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
-{
- if (pm.handle()->classId() == QPlatformPixmap::RasterClass) {
- QS60PlatformPixmap *srcData = static_cast<QS60PlatformPixmap *>(pm.handle());
- srcData->beginDataAccess();
- QRasterPaintEngine::drawPixmap(r, pm, sr);
- srcData->endDataAccess();
- } else {
- void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage);
- if (nativeData) {
- QVolatileImage *img = static_cast<QVolatileImage *>(nativeData);
- img->beginDataAccess();
- QRasterPaintEngine::drawImage(r, img->imageRef(), sr);
- img->endDataAccess(true);
- } else {
- QRasterPaintEngine::drawPixmap(r, pm, sr);
- }
- }
-}
-
-void QS60PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr)
-{
- if (pm.handle()->classId() == QPlatformPixmap::RasterClass) {
- QS60PlatformPixmap *srcData = static_cast<QS60PlatformPixmap *>(pm.handle());
- srcData->beginDataAccess();
- QRasterPaintEngine::drawTiledPixmap(r, pm, sr);
- srcData->endDataAccess();
- } else {
- QRasterPaintEngine::drawTiledPixmap(r, pm, sr);
- }
-}
-
-void QS60PaintEngine::prepare(QImage *image)
-{
- QRasterBuffer *buffer = d_func()->rasterBuffer.data();
- if (buffer)
- buffer->prepare(image);
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/s60/qpaintengine_s60_p.h b/src/widgets/platforms/s60/qpaintengine_s60_p.h
deleted file mode 100644
index 4cea87954f..0000000000
--- a/src/widgets/platforms/s60/qpaintengine_s60_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPAINTENGINE_S60_P_H
-#define QPAINTENGINE_S60_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "private/qpaintengine_raster_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QS60PaintEnginePrivate;
-class QS60PlatformPixmap;
-
-class QS60PaintEngine : public QRasterPaintEngine
-{
- Q_DECLARE_PRIVATE(QS60PaintEngine)
-
-public:
- QS60PaintEngine(QPaintDevice *device, QS60PlatformPixmap* data);
- bool begin(QPaintDevice *device);
- bool end();
-
- void drawPixmap(const QPointF &p, const QPixmap &pm);
- void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
- void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr);
-
- void prepare(QImage* image);
-
-private:
- QS60PlatformPixmap *handle;
-};
-
-QT_END_NAMESPACE
-
-#endif // QPAINTENGINE_S60_P_H
diff --git a/src/widgets/platforms/s60/qpixmap_s60.cpp b/src/widgets/platforms/s60/qpixmap_s60.cpp
deleted file mode 100644
index 5e1474546e..0000000000
--- a/src/widgets/platforms/s60/qpixmap_s60.cpp
+++ /dev/null
@@ -1,1040 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <exception>
-#include <w32std.h>
-#include <fbs.h>
-
-#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 "qpixmap.h"
-#include "qpixmap_raster_p.h"
-#include <qwidget.h>
-#include "qpixmap_s60_p.h"
-#include "qnativeimage_p.h"
-#include "qbitmap.h"
-#include "qimage.h"
-#include "qimage_p.h"
-
-#include <fbs.h>
-
-QT_BEGIN_NAMESPACE
-
-const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08,
- 0x10, 0x20, 0x40, 0x80 };
-
-static bool cleanup_function_registered = false;
-static QS60PlatformPixmap *firstPixmap = 0;
-
-// static
-void QS60PlatformPixmap::qt_symbian_register_pixmap(QS60PlatformPixmap *pd)
-{
- if (!cleanup_function_registered) {
- qAddPostRoutine(qt_symbian_release_pixmaps);
- cleanup_function_registered = true;
- }
-
- pd->next = firstPixmap;
- pd->prev = 0;
- if (firstPixmap)
- firstPixmap->prev = pd;
- firstPixmap = pd;
-}
-
-// static
-void QS60PlatformPixmap::qt_symbian_unregister_pixmap(QS60PlatformPixmap *pd)
-{
- if (pd->next)
- pd->next->prev = pd->prev;
- if (pd->prev)
- pd->prev->next = pd->next;
- else
- firstPixmap = pd->next;
-}
-
-// static
-void QS60PlatformPixmap::qt_symbian_release_pixmaps()
-{
- // Scan all QS60PlatformPixmap objects in the system and destroy them.
- QS60PlatformPixmap *pd = firstPixmap;
- while (pd != 0) {
- pd->release();
- pd = pd->next;
- }
-}
-
-/*
- \class QSymbianFbsClient
- \since 4.6
- \internal
-
- Symbian Font And Bitmap server client that is
- used to lock the global bitmap heap. Only used in
- S60 v3.1 and S60 v3.2.
-*/
-_LIT(KFBSERVLargeBitmapAccessName,"FbsLargeBitmapAccess");
-class QSymbianFbsClient
-{
-public:
-
- QSymbianFbsClient() : heapLocked(false)
- {
- heapLock.OpenGlobal(KFBSERVLargeBitmapAccessName);
- }
-
- ~QSymbianFbsClient()
- {
- heapLock.Close();
- }
-
- bool lockHeap()
- {
- bool wasLocked = heapLocked;
-
- if (heapLock.Handle() && !heapLocked) {
- heapLock.Wait();
- heapLocked = true;
- }
-
- return wasLocked;
- }
-
- bool unlockHeap()
- {
- bool wasLocked = heapLocked;
-
- if (heapLock.Handle() && heapLocked) {
- heapLock.Signal();
- heapLocked = false;
- }
-
- return wasLocked;
- }
-
-
-private:
-
- RMutex heapLock;
- bool heapLocked;
-};
-
-Q_GLOBAL_STATIC(QSymbianFbsClient, qt_symbianFbsClient);
-
-
-
-// QSymbianFbsHeapLock
-
-QSymbianFbsHeapLock::QSymbianFbsHeapLock(LockAction a)
-: action(a), wasLocked(false)
-{
- QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
- if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3)
- wasLocked = qt_symbianFbsClient()->unlockHeap();
-}
-
-QSymbianFbsHeapLock::~QSymbianFbsHeapLock()
-{
- // Do nothing
-}
-
-void QSymbianFbsHeapLock::relock()
-{
- QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
- if (wasLocked && (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3))
- qt_symbianFbsClient()->lockHeap();
-}
-
-/*
- \class QSymbianBitmapDataAccess
- \since 4.6
- \internal
-
- Data access class that is used to locks/unlocks pixel data
- when drawing or modifying CFbsBitmap pixel data.
-*/
-class QSymbianBitmapDataAccess
-{
-public:
-
- static int heapRefCount;
- QSysInfo::SymbianVersion symbianVersion;
-
- explicit QSymbianBitmapDataAccess()
- {
- symbianVersion = QSysInfo::symbianVersion();
- };
-
- ~QSymbianBitmapDataAccess() {};
-
- inline void beginDataAccess(CFbsBitmap *bitmap)
- {
- if (symbianVersion == QSysInfo::SV_9_2) {
- if (heapRefCount == 0)
- qt_symbianFbsClient()->lockHeap();
- } else {
- bitmap->LockHeap(ETrue);
- }
-
- heapRefCount++;
- }
-
- inline void endDataAccess(CFbsBitmap *bitmap)
- {
- heapRefCount--;
-
- if (symbianVersion == QSysInfo::SV_9_2) {
- if (heapRefCount == 0)
- qt_symbianFbsClient()->unlockHeap();
- } else {
- bitmap->UnlockHeap(ETrue);
- }
- }
-};
-
-int QSymbianBitmapDataAccess::heapRefCount = 0;
-
-
-#define UPDATE_BUFFER() \
- { \
- beginDataAccess(); \
- endDataAccess(); \
-}
-
-
-static CFbsBitmap* createSymbianCFbsBitmap(const TSize& size, TDisplayMode mode)
-{
- QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
-
- CFbsBitmap* bitmap = 0;
- QT_TRAP_THROWING(bitmap = new (ELeave) CFbsBitmap);
-
- if (bitmap->Create(size, mode) != KErrNone) {
- delete bitmap;
- bitmap = 0;
- }
-
- lock.relock();
-
- return bitmap;
-}
-
-static CFbsBitmap* uncompress(CFbsBitmap* bitmap)
-{
- if(bitmap->IsCompressedInRAM()) {
- QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
-
- CFbsBitmap *uncompressed = 0;
- QT_TRAP_THROWING(uncompressed = new (ELeave) CFbsBitmap);
-
- if (uncompressed->Create(bitmap->SizeInPixels(), bitmap->DisplayMode()) != KErrNone) {
- delete bitmap;
- bitmap = 0;
- lock.relock();
-
- return bitmap;
- }
-
- lock.relock();
-
- CFbsBitmapDevice* bitmapDevice = 0;
- CFbsBitGc *bitmapGc = 0;
- QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(uncompressed));
- QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL());
- bitmapGc->Activate(bitmapDevice);
-
- bitmapGc->BitBlt(TPoint(), bitmap);
-
- delete bitmapGc;
- delete bitmapDevice;
-
- return uncompressed;
- } else {
- return bitmap;
- }
-}
-
-QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h)
-{
- CWsScreenDevice* screenDevice = S60->screenDevice();
- TSize screenSize = screenDevice->SizeInPixels();
-
- TSize srcSize;
- // Find out if this is one of our windows.
- QSymbianControl *sControl;
- sControl = winId->MopGetObject(sControl);
- if (sControl && sControl->widget()->windowType() == Qt::Desktop) {
- // Grabbing desktop widget
- srcSize = screenSize;
- } else {
- TPoint relativePos = winId->PositionRelativeToScreen();
- x += relativePos.iX;
- y += relativePos.iY;
- srcSize = winId->Size();
- }
-
- TRect srcRect(TPoint(x, y), srcSize);
- // Clip to the screen
- srcRect.Intersection(TRect(screenSize));
-
- if (w > 0 && h > 0) {
- TRect subRect(TPoint(x, y), TSize(w, h));
- // Clip to the subRect
- srcRect.Intersection(subRect);
- }
-
- if (srcRect.IsEmpty())
- return QPixmap();
-
- CFbsBitmap* temporary = createSymbianCFbsBitmap(srcRect.Size(), screenDevice->DisplayMode());
-
- QPixmap pix;
-
- if (temporary && screenDevice->CopyScreenToBitmap(temporary, srcRect) == KErrNone) {
- pix = QPixmap::fromSymbianCFbsBitmap(temporary);
- }
-
- delete temporary;
- return pix;
-}
-
-/*!
- \fn CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const
- \since 4.6
-
- 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, semi-transparent pixmaps are always copied
- and not duplicated.
- \warning This function is only available on Symbian OS.
-
- \sa fromSymbianCFbsBitmap()
-*/
-CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const
-{
- QPlatformPixmap *data = handle();
- if (!data || data->isNull())
- return 0;
-
- return reinterpret_cast<CFbsBitmap*>(data->toNativeType(QPlatformPixmap::FbsBitmap));
-}
-
-/*!
- \fn QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap)
- \since 4.6
-
- 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.
- For performance reasons it is recommended to use a \a bitmap with a display
- mode of EColor16MAP or EColor16MU whenever possible.
-
- \warning This function is only available on Symbian OS.
-
- \sa toSymbianCFbsBitmap(), {QPixmap#Pixmap Conversion}{Pixmap Conversion}
-*/
-QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap)
-{
- if (!bitmap)
- return QPixmap();
-
- QScopedPointer<QPlatformPixmap> data(QPlatformPixmap::create(0,0, QPlatformPixmap::PixmapType));
- data->fromNativeType(reinterpret_cast<void*>(bitmap), QPlatformPixmap::FbsBitmap);
- QPixmap pixmap(data.take());
- return pixmap;
-}
-
-QS60PlatformPixmap::QS60PlatformPixmap(PixelType type) : QRasterPlatformPixmap(type),
- symbianBitmapDataAccess(new QSymbianBitmapDataAccess),
- cfbsBitmap(0),
- pengine(0),
- bytes(0),
- formatLocked(false),
- next(0),
- prev(0)
-{
- qt_symbian_register_pixmap(this);
-}
-
-QS60PlatformPixmap::~QS60PlatformPixmap()
-{
- release();
- delete symbianBitmapDataAccess;
- qt_symbian_unregister_pixmap(this);
-}
-
-void QS60PlatformPixmap::resize(int width, int height)
-{
- if (width <= 0 || height <= 0) {
- w = width;
- h = height;
- is_null = true;
-
- release();
- return;
- } else if (!cfbsBitmap) {
- TDisplayMode mode;
- if (pixelType() == BitmapType)
- mode = EGray2;
- else
- mode = EColor16MU;
-
- CFbsBitmap* bitmap = createSymbianCFbsBitmap(TSize(width, height), mode);
- fromSymbianBitmap(bitmap);
- } else {
-
- TSize newSize(width, height);
-
- if(cfbsBitmap->SizeInPixels() != newSize) {
- cfbsBitmap->Resize(TSize(width, height));
- if(pengine) {
- delete pengine;
- pengine = 0;
- }
- }
-
- UPDATE_BUFFER();
- }
-}
-
-void QS60PlatformPixmap::release()
-{
- if (cfbsBitmap) {
- QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
- delete cfbsBitmap;
- lock.relock();
- }
-
- delete pengine;
- image = QImage();
- cfbsBitmap = 0;
- pengine = 0;
- bytes = 0;
-}
-
-/*!
- * Takes ownership of bitmap. Used by window surface
- */
-void QS60PlatformPixmap::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat)
-{
- Q_ASSERT(bitmap);
-
- release();
-
- cfbsBitmap = bitmap;
- formatLocked = lockFormat;
-
- setSerialNumber(cfbsBitmap->Handle());
-
- UPDATE_BUFFER();
-
- // Create default palette if needed
- if (cfbsBitmap->DisplayMode() == EGray2) {
- image.setColorCount(2);
- image.setColor(0, QColor(Qt::color0).rgba());
- image.setColor(1, QColor(Qt::color1).rgba());
-
- //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 if (cfbsBitmap->DisplayMode() == EGray256) {
- for (int i=0; i < 256; ++i)
- image.setColor(i, qRgb(i, i, i));
- } else if (cfbsBitmap->DisplayMode() == EColor256) {
- const TColor256Util *palette = TColor256Util::Default();
- for (int i=0; i < 256; ++i)
- image.setColor(i, (QRgb)(palette->Color256(i).Value()));
- }
-}
-
-QImage QS60PlatformPixmap::toImage(const QRect &r) const
-{
- QS60PlatformPixmap *that = const_cast<QS60PlatformPixmap*>(this);
- that->beginDataAccess();
- QImage copy = that->image.copy(r);
- that->endDataAccess();
-
- return copy;
-}
-
-void QS60PlatformPixmap::fromImage(const QImage &img, Qt::ImageConversionFlags flags)
-{
- release();
-
- QImage sourceImage;
-
- if (pixelType() == BitmapType) {
- sourceImage = img.convertToFormat(QImage::Format_MonoLSB);
- } else {
- if (img.depth() == 1) {
- sourceImage = img.hasAlphaChannel()
- ? img.convertToFormat(QImage::Format_ARGB32_Premultiplied)
- : img.convertToFormat(QImage::Format_RGB32);
- } else {
-
- QImage::Format opaqueFormat = QNativeImage::systemFormat();
- QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied;
-
- if (!img.hasAlphaChannel()
- || ((flags & Qt::NoOpaqueDetection) == 0
- && !const_cast<QImage &>(img).data_ptr()->checkForAlphaPixels())) {
- sourceImage = img.convertToFormat(opaqueFormat);
- } else {
- sourceImage = img.convertToFormat(alphaFormat);
- }
- }
- }
-
-
- QImage::Format destFormat = sourceImage.format();
- TDisplayMode mode;
- switch (destFormat) {
- case QImage::Format_MonoLSB:
- mode = EGray2;
- break;
- case QImage::Format_RGB32:
- mode = EColor16MU;
- break;
- case QImage::Format_ARGB32_Premultiplied:
- if (S60->supportsPremultipliedAlpha) {
- mode = Q_SYMBIAN_ECOLOR16MAP;
- break;
- } else {
- destFormat = QImage::Format_ARGB32;
- }
- // Fall through intended
- case QImage::Format_ARGB32:
- mode = EColor16MA;
- break;
- case QImage::Format_Invalid:
- return;
- default:
- qWarning("Image format not supported: %d", image.format());
- return;
- }
-
- cfbsBitmap = createSymbianCFbsBitmap(TSize(sourceImage.width(), sourceImage.height()), mode);
- if (!cfbsBitmap) {
- qWarning("Could not create CFbsBitmap");
- release();
- return;
- }
-
- setSerialNumber(cfbsBitmap->Handle());
-
- const uchar *sptr = const_cast<const QImage &>(sourceImage).bits();
- symbianBitmapDataAccess->beginDataAccess(cfbsBitmap);
- uchar *dptr = (uchar*)cfbsBitmap->DataAddress();
- Mem::Copy(dptr, sptr, sourceImage.byteCount());
- symbianBitmapDataAccess->endDataAccess(cfbsBitmap);
-
- UPDATE_BUFFER();
-
- if (destFormat == QImage::Format_MonoLSB) {
- image.setColorCount(2);
- image.setColor(0, QColor(Qt::color0).rgba());
- image.setColor(1, QColor(Qt::color1).rgba());
- } else {
- image.setColorTable(sourceImage.colorTable());
- }
-}
-
-void QS60PlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect)
-{
- const QS60PlatformPixmap *s60Data = static_cast<const QS60PlatformPixmap*>(data);
- fromImage(s60Data->toImage(rect), Qt::AutoColor | Qt::OrderedAlphaDither);
-}
-
-bool QS60PlatformPixmap::scroll(int dx, int dy, const QRect &rect)
-{
- beginDataAccess();
- bool res = QRasterPlatformPixmap::scroll(dx, dy, rect);
- endDataAccess();
- return res;
-}
-
-int QS60PlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const
-{
- if (!cfbsBitmap)
- return 0;
-
- switch (metric) {
- case QPaintDevice::PdmWidth:
- return cfbsBitmap->SizeInPixels().iWidth;
- case QPaintDevice::PdmHeight:
- return cfbsBitmap->SizeInPixels().iHeight;
- case QPaintDevice::PdmWidthMM:
- return qRound(cfbsBitmap->SizeInPixels().iWidth * 25.4 / qt_defaultDpiX());
- case QPaintDevice::PdmHeightMM:
- return qRound(cfbsBitmap->SizeInPixels().iHeight * 25.4 / qt_defaultDpiY());
- case QPaintDevice::PdmNumColors:
- return TDisplayModeUtils::NumDisplayModeColors(cfbsBitmap->DisplayMode());
- case QPaintDevice::PdmDpiX:
- case QPaintDevice::PdmPhysicalDpiX:
- return qt_defaultDpiX();
- case QPaintDevice::PdmDpiY:
- case QPaintDevice::PdmPhysicalDpiY:
- return qt_defaultDpiY();
- case QPaintDevice::PdmDepth:
- return TDisplayModeUtils::NumDisplayModeBitsPerPixel(cfbsBitmap->DisplayMode());
- default:
- qWarning("QPixmap::metric: Invalid metric command");
- }
- return 0;
-
-}
-
-void QS60PlatformPixmap::fill(const QColor &color)
-{
- if (color.alpha() != 255) {
- QImage im(width(), height(), QImage::Format_ARGB32_Premultiplied);
- im.fill(PREMUL(color.rgba()));
- release();
- fromImage(im, Qt::AutoColor | Qt::OrderedAlphaDither);
- } else {
- beginDataAccess();
- QRasterPlatformPixmap::fill(color);
- endDataAccess();
- }
-}
-
-void QS60PlatformPixmap::setMask(const QBitmap &mask)
-{
- if (mask.size().isEmpty()) {
- if (image.depth() != 1) {
- QImage newImage = image.convertToFormat(QImage::Format_RGB32);
- release();
- fromImage(newImage, Qt::AutoColor | Qt::OrderedAlphaDither);
- }
- } else if (image.depth() == 1) {
- beginDataAccess();
- QRasterPlatformPixmap::setMask(mask);
- endDataAccess();
- } else {
- const int w = image.width();
- const int h = image.height();
-
- const QImage imageMask = mask.toImage().convertToFormat(QImage::Format_MonoLSB);
- QImage newImage = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
- for (int y = 0; y < h; ++y) {
- const uchar *mscan = imageMask.scanLine(y);
- QRgb *tscan = (QRgb *)newImage.scanLine(y);
- for (int x = 0; x < w; ++x) {
- if (!(mscan[x>>3] & qt_pixmap_bit_mask[x&7]))
- tscan[x] = 0;
- }
- }
- release();
- fromImage(newImage, Qt::AutoColor | Qt::OrderedAlphaDither);
- }
-}
-
-void QS60PlatformPixmap::setAlphaChannel(const QPixmap &alphaChannel)
-{
- QImage img(toImage());
- img.setAlphaChannel(alphaChannel.toImage());
- release();
- fromImage(img, Qt::OrderedDither | Qt::OrderedAlphaDither);
-}
-
-QImage QS60PlatformPixmap::toImage() const
-{
- return toImage(QRect());
-}
-
-QPaintEngine* QS60PlatformPixmap::paintEngine() const
-{
- if (!pengine) {
- QS60PlatformPixmap *that = const_cast<QS60PlatformPixmap*>(this);
- that->pengine = new QS60PaintEngine(&that->image, that);
- }
- return pengine;
-}
-
-void QS60PlatformPixmap::beginDataAccess()
-{
- if(!cfbsBitmap)
- return;
-
- symbianBitmapDataAccess->beginDataAccess(cfbsBitmap);
-
- uchar* newBytes = (uchar*)cfbsBitmap->DataAddress();
-
- TSize size = cfbsBitmap->SizeInPixels();
-
- if (newBytes == bytes && image.width() == size.iWidth && image.height() == size.iHeight)
- return;
-
- bytes = newBytes;
- TDisplayMode mode = cfbsBitmap->DisplayMode();
- QImage::Format format = qt_TDisplayMode2Format(mode);
- // On S60 3.1, premultiplied alpha pixels are stored in a bitmap with 16MA type.
- // S60 window surface needs backing store pixmap for transparent window in ARGB32 format.
- // In that case formatLocked is true.
- if (!formatLocked && format == QImage::Format_ARGB32)
- format = QImage::Format_ARGB32_Premultiplied; // pixel data is actually in premultiplied format
-
- QVector<QRgb> savedColorTable;
- if (!image.isNull())
- savedColorTable = image.colorTable();
-
- image = QImage(bytes, size.iWidth, size.iHeight, format);
-
- // Restore the palette or create a default
- if (!savedColorTable.isEmpty()) {
- image.setColorTable(savedColorTable);
- }
-
- w = size.iWidth;
- h = size.iHeight;
- d = image.depth();
- is_null = (w <= 0 || h <= 0);
-
- if (pengine) {
- QS60PaintEngine *engine = static_cast<QS60PaintEngine *>(pengine);
- engine->prepare(&image);
- }
-}
-
-void QS60PlatformPixmap::endDataAccess(bool readOnly) const
-{
- Q_UNUSED(readOnly);
-
- if(!cfbsBitmap)
- return;
-
- symbianBitmapDataAccess->endDataAccess(cfbsBitmap);
-}
-
-/*!
- \since 4.6
-
- Returns a QPixmap that wraps given \a sgImage graphics resource.
- The data should be valid even when original RSgImage handle has been
- closed.
-
- \warning This function is only available on Symbian OS.
-
- \sa toSymbianRSgImage(), {QPixmap#Pixmap Conversion}{Pixmap Conversion}
-*/
-
-QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage)
-{
- // It is expected that RSgImage will
- // CURRENTLY be used in conjuction with
- // OpenVG graphics system
- //
- // Surely things might change in future
-
- if (!sgImage)
- return QPixmap();
-
- QScopedPointer<QPlatformPixmap> data(QPlatformPixmap::create(0,0, QPlatformPixmap::PixmapType));
- data->fromNativeType(reinterpret_cast<void*>(sgImage), QPlatformPixmap::SgImage);
- QPixmap pixmap(data.take());
- return pixmap;
-}
-
-/*!
-\since 4.6
-
-Returns a \c RSgImage that is equivalent to the QPixmap by copying the data.
-
-It is the caller's responsibility to close/delete the \c RSgImage after use.
-
-\warning This function is only available on Symbian OS.
-
-\sa fromSymbianRSgImage()
-*/
-
-RSgImage *QPixmap::toSymbianRSgImage() const
-{
- // It is expected that RSgImage will
- // CURRENTLY be used in conjuction with
- // OpenVG graphics system
- //
- // Surely things might change in future
-
- if (isNull())
- return 0;
-
- RSgImage *sgImage = reinterpret_cast<RSgImage*>(handle()->toNativeType(QPlatformPixmap::SgImage));
-
- return sgImage;
-}
-
-void* QS60PlatformPixmap::toNativeType(NativeType type)
-{
- if (type == QPlatformPixmap::SgImage) {
- return 0;
- } else if (type == QPlatformPixmap::FbsBitmap) {
-
- if (isNull() || !cfbsBitmap)
- return 0;
-
- bool convertToArgb32 = false;
- bool needsCopy = false;
-
- if (!(S60->supportsPremultipliedAlpha)) {
- // Convert argb32_premultiplied to argb32 since Symbian 9.2 does
- // 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.
- beginDataAccess();
- image.invertPixels();
- endDataAccess();
- needsCopy = true;
- }
-
- if (needsCopy) {
- QImage source;
-
- if (convertToArgb32) {
- beginDataAccess();
- source = image.convertToFormat(QImage::Format_ARGB32);
- endDataAccess();
- 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.byteCount());
-
- 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
- beginDataAccess();
- image.invertPixels();
- endDataAccess();
- }
-
- return reinterpret_cast<void*>(bitmap);
-
- }
-
- return 0;
-}
-
-void QS60PlatformPixmap::fromNativeType(void* pixmap, NativeType nativeType)
-{
- if (nativeType == QPlatformPixmap::SgImage) {
- return;
- } else if (nativeType == QPlatformPixmap::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)
- ? QPlatformPixmap::PixmapType
- : QPlatformPixmap::BitmapType;
-
- if (needsCopy) {
-
- TSize size = sourceBitmap->SizeInPixels();
- int bytesPerLine = sourceBitmap->ScanLineLength(size.iWidth, displayMode);
-
- QSymbianBitmapDataAccess da;
- da.beginDataAccess(sourceBitmap);
- uchar *bytes = (uchar*)sourceBitmap->DataAddress();
- QImage img = QImage(bytes, size.iWidth, size.iHeight, bytesPerLine, format);
- img = img.copy();
- da.endDataAccess(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.
- img.invertPixels();
- } else if(displayMode == EColor16M) {
- img = img.rgbSwapped(); // EColor16M is BGR
- }
-
- fromImage(img, Qt::AutoColor);
-
- if(deleteSourceBitmap)
- delete sourceBitmap;
- } 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;
- }
- }
-}
-
-void QS60PlatformPixmap::convertToDisplayMode(int mode)
-{
- const TDisplayMode displayMode = static_cast<TDisplayMode>(mode);
- if (!cfbsBitmap || cfbsBitmap->DisplayMode() == displayMode)
- return;
- if (image.depth() != TDisplayModeUtils::NumDisplayModeBitsPerPixel(displayMode)) {
- qWarning("Cannot convert display mode due to depth mismatch");
- return;
- }
-
- const TSize size = cfbsBitmap->SizeInPixels();
- QScopedPointer<CFbsBitmap> newBitmap(createSymbianCFbsBitmap(size, displayMode));
-
- const uchar *sptr = const_cast<const QImage &>(image).bits();
- symbianBitmapDataAccess->beginDataAccess(newBitmap.data());
- uchar *dptr = (uchar*)newBitmap->DataAddress();
- Mem::Copy(dptr, sptr, image.byteCount());
- symbianBitmapDataAccess->endDataAccess(newBitmap.data());
-
- QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
- delete cfbsBitmap;
- lock.relock();
- cfbsBitmap = newBitmap.take();
- setSerialNumber(cfbsBitmap->Handle());
- UPDATE_BUFFER();
-}
-
-QPlatformPixmap *QS60PlatformPixmap::createCompatiblePlatformPixmap() const
-{
- return new QS60PlatformPixmap(pixelType());
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/s60/qpixmap_s60_p.h b/src/widgets/platforms/s60/qpixmap_s60_p.h
deleted file mode 100644
index 2f282e9498..0000000000
--- a/src/widgets/platforms/s60/qpixmap_s60_p.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPIXMAPDATA_S60_P_H
-#define QPIXMAPDATA_S60_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.
-//
-
-#include <QtGui/private/qpixmap_raster_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class CFbsBitmap;
-class CFbsBitmapDevice;
-class CFbsBitGc;
-
-class QSymbianBitmapDataAccess;
-
-class QSymbianFbsHeapLock
-{
-public:
-
- enum LockAction {
- Unlock
- };
-
- explicit QSymbianFbsHeapLock(LockAction a);
- ~QSymbianFbsHeapLock();
- void relock();
-
-private:
-
- LockAction action;
- bool wasLocked;
-};
-
-class QS60PlatformPixmap : public QRasterPlatformPixmap
-{
-public:
- QS60PlatformPixmap(PixelType type);
- ~QS60PlatformPixmap();
-
- QPlatformPixmap *createCompatiblePlatformPixmap() const;
-
- void resize(int width, int height);
- void fromImage(const QImage &image, Qt::ImageConversionFlags flags);
- void copy(const QPlatformPixmap *data, const QRect &rect);
- bool scroll(int dx, int dy, const QRect &rect);
-
- int metric(QPaintDevice::PaintDeviceMetric metric) const;
- void fill(const QColor &color);
- void setMask(const QBitmap &mask);
- void setAlphaChannel(const QPixmap &alphaChannel);
- QImage toImage() const;
- QPaintEngine* paintEngine() const;
-
- void beginDataAccess();
- void endDataAccess(bool readOnly=false) const;
-
- void* toNativeType(NativeType type);
- void fromNativeType(void* pixmap, NativeType type);
-
- void convertToDisplayMode(int mode);
-
-private:
- void release();
- void fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat=false);
- QImage toImage(const QRect &r) const;
-
- QSymbianBitmapDataAccess *symbianBitmapDataAccess;
-
- CFbsBitmap *cfbsBitmap;
- QPaintEngine *pengine;
- uchar* bytes;
-
- bool formatLocked;
-
- QS60PlatformPixmap *next;
- QS60PlatformPixmap *prev;
-
- static void qt_symbian_register_pixmap(QS60PlatformPixmap *pd);
- static void qt_symbian_unregister_pixmap(QS60PlatformPixmap *pd);
- static void qt_symbian_release_pixmaps();
-
- friend class QPixmap;
- friend class QS60WindowSurface;
- friend class QS60PaintEngine;
- friend class QS60Data;
-};
-
-QT_END_NAMESPACE
-
-#endif // QPIXMAPDATA_S60_P_H
-
diff --git a/src/widgets/platforms/s60/qregion_s60.cpp b/src/widgets/platforms/s60/qregion_s60.cpp
deleted file mode 100644
index bd5b701ca8..0000000000
--- a/src/widgets/platforms/s60/qregion_s60.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qbitmap.h"
-#include "qbuffer.h"
-#include "qimage.h"
-#include "qpolygon.h"
-#include "qregion.h"
-
-QT_BEGIN_NAMESPACE
-
-QRegion::QRegionData QRegion::shared_empty = { Q_BASIC_ATOMIC_INITIALIZER(1), 0 };
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/s60/qsoftkeymanager_s60.cpp b/src/widgets/platforms/s60/qsoftkeymanager_s60.cpp
deleted file mode 100644
index a7f83aaa43..0000000000
--- a/src/widgets/platforms/s60/qsoftkeymanager_s60.cpp
+++ /dev/null
@@ -1,440 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qapplication.h"
-#include "qevent.h"
-#include "qbitmap.h"
-#include "qstyle.h"
-#include "qmenubar.h"
-#include "private/qt_s60_p.h"
-#include "private/qmenu_p.h"
-#include "private/qaction_p.h"
-#include "private/qsoftkeymanager_p.h"
-#include "private/qsoftkeymanager_s60_p.h"
-#include "private/qobject_p.h"
-#include <eiksoftkeyimage.h>
-#include <eikcmbut.h>
-
-#ifndef QT_NO_SOFTKEYMANAGER
-QT_BEGIN_NAMESPACE
-
-const int S60_COMMAND_START = 6000;
-const int LSK_POSITION = 0;
-const int MSK_POSITION = 3;
-const int RSK_POSITION = 2;
-
-QSoftKeyManagerPrivateS60::QSoftKeyManagerPrivateS60() : cbaHasImage(4) // 4 since MSK position index is 3
-{
- cachedCbaIconSize[0] = QSize(0,0);
- cachedCbaIconSize[1] = QSize(0,0);
- cachedCbaIconSize[2] = QSize(0,0);
- cachedCbaIconSize[3] = QSize(0,0);
-}
-
-bool QSoftKeyManagerPrivateS60::skipCbaUpdate()
-{
- // Lets not update softkeys if
- // 1. We don't have application panes, i.e. cba
- // 2. Our CBA is not active, i.e. S60 native dialog or menu with custom CBA is shown
- // 2.1. Except if thre is no current CBA at all and WindowSoftkeysRespondHint is set
-
- // Note: Cannot use IsDisplayingMenuOrDialog since CBA update can be triggered before
- // menu/dialog CBA is actually displayed i.e. it is being costructed.
- CEikButtonGroupContainer *appUiCba = S60->buttonGroupContainer();
- if (!appUiCba)
- return true;
- // CEikButtonGroupContainer::Current returns 0 if CBA is not visible at all
- CEikButtonGroupContainer *currentCba = CEikButtonGroupContainer::Current();
- // Check if softkey need to be update even they are not visible
- bool cbaRespondsWhenInvisible = false;
- QWidget *window = QApplication::activeWindow();
- if (window && (window->windowFlags() & Qt::WindowSoftkeysRespondHint))
- cbaRespondsWhenInvisible = true;
-
- if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)
- || (appUiCba != currentCba && !cbaRespondsWhenInvisible)) {
- return true;
- }
- return false;
-}
-
-void QSoftKeyManagerPrivateS60::ensureCbaVisibilityAndResponsiviness(CEikButtonGroupContainer &cba)
-{
- RDrawableWindow *cbaWindow = cba.DrawableWindow();
- Q_ASSERT_X(cbaWindow, Q_FUNC_INFO, "Native CBA does not have window!");
- // Make sure CBA is visible, i.e. CBA window is on top
- cbaWindow->SetOrdinalPosition(0);
- // Qt shares same CBA instance between top-level widgets,
- // make sure we are not faded by underlying window.
- cbaWindow->SetFaded(EFalse, RWindowTreeNode::EFadeIncludeChildren);
- // Modal dialogs capture pointer events, but shared cba instance
- // shall stay responsive. Raise pointer capture priority to keep
- // softkeys responsive in modal dialogs
- cbaWindow->SetPointerCapturePriority(1);
-}
-
-void QSoftKeyManagerPrivateS60::clearSoftkeys(CEikButtonGroupContainer &cba)
-{
-#ifdef SYMBIAN_VERSION_SYMBIAN3
- QT_TRAP_THROWING(
- //EAknSoftkeyEmpty is used, because using -1 adds softkeys without actions on Symbian3
- cba.SetCommandL(0, EAknSoftkeyEmpty, KNullDesC);
- cba.SetCommandL(2, EAknSoftkeyEmpty, KNullDesC);
- );
-#else
- QT_TRAP_THROWING(
- //Using -1 instead of EAknSoftkeyEmpty to avoid flickering.
- cba.SetCommandL(0, -1, KNullDesC);
- // TODO: Should we clear also middle SK?
- cba.SetCommandL(2, -1, KNullDesC);
- );
-#endif
- realSoftKeyActions.clear();
-}
-
-QString QSoftKeyManagerPrivateS60::softkeyText(QAction &softkeyAction)
-{
- // In S60 softkeys and menu items do not support key accelerators (i.e.
- // CTRL+X). Therefore, removing the accelerator characters from both softkey
- // and menu item texts.
- const int underlineShortCut = QApplication::style()->styleHint(QStyle::SH_UnderlineShortcut);
- QString iconText = softkeyAction.iconText();
- return underlineShortCut ? softkeyAction.text() : iconText;
-}
-
-QAction *QSoftKeyManagerPrivateS60::highestPrioritySoftkey(QAction::SoftKeyRole role)
-{
- QAction *ret = NULL;
- // Priority look up is two level
- // 1. First widget with softkeys always has highest priority
- for (int level = 0; !ret; level++) {
- // 2. Highest priority action within widget
- QList<QAction*> actions = requestedSoftKeyActions.values(level);
- if (actions.isEmpty())
- break;
- qSort(actions.begin(), actions.end(), QSoftKeyManagerPrivateS60::actionPriorityMoreThan);
- foreach (QAction *action, actions) {
- if (action->softKeyRole() == role) {
- ret = action;
- break;
- }
- }
- }
- return ret;
-}
-
-bool QSoftKeyManagerPrivateS60::actionPriorityMoreThan(const QAction *firstItem, const QAction *secondItem)
-{
- return firstItem->priority() > secondItem->priority();
-}
-
-void QSoftKeyManagerPrivateS60::setNativeSoftkey(CEikButtonGroupContainer &cba,
- TInt position, TInt command, const TDesC &text)
-{
- // Calling SetCommandL causes CBA redraw
- QT_TRAP_THROWING(cba.SetCommandL(position, command, text));
-}
-
-QPoint QSoftKeyManagerPrivateS60::softkeyIconPosition(int position, QSize sourceSize, QSize targetSize)
-{
- QPoint iconPosition(0,0);
- switch( AknLayoutUtils::CbaLocation() )
- {
- case AknLayoutUtils::EAknCbaLocationBottom:
- // RSK must be moved to right, LSK in on correct position by default
- if (position == RSK_POSITION)
- iconPosition.setX(targetSize.width() - sourceSize.width());
- break;
- case AknLayoutUtils::EAknCbaLocationRight:
- case AknLayoutUtils::EAknCbaLocationLeft:
- // Already in correct position
- default:
- break;
- }
-
- // Align horizontally to center
- iconPosition.setY((targetSize.height() - sourceSize.height()) >> 1);
- return iconPosition;
-}
-
-QPixmap QSoftKeyManagerPrivateS60::prepareSoftkeyPixmap(QPixmap src, int position, QSize targetSize)
-{
- QPixmap target(targetSize);
- target.fill(Qt::transparent);
- QPainter p;
- p.begin(&target);
- p.drawPixmap(softkeyIconPosition(position, src.size(), targetSize), src);
- p.end();
- return target;
-}
-
-bool QSoftKeyManagerPrivateS60::isOrientationLandscape()
-{
- // Hard to believe that there is no public API in S60 to
- // get current orientation. This workaround works with currently supported resolutions
- return S60->screenHeightInPixels < S60->screenWidthInPixels;
-}
-
-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);
- }
- }
- }
-
- return cachedCbaIconSize[index];
-}
-
-bool QSoftKeyManagerPrivateS60::setSoftkeyImage(CEikButtonGroupContainer *cba,
- QAction &action, int position)
-{
- bool ret = false;
-
- const bool left = (position == LSK_POSITION);
- if(position == LSK_POSITION || position == RSK_POSITION) {
- QIcon icon = action.icon();
- if (!icon.isNull()) {
- // Get size of CBA icon area based on button position and orientation
- QSize requiredIconSize = cbaIconSize(cba, position);
- // Get pixmap out of icon based on preferred size, the aspect ratio is kept
- QPixmap pmWihtAspectRatio = icon.pixmap(requiredIconSize);
- // Native softkeys require that pixmap size is exactly the same as requiredIconSize
- // prepareSoftkeyPixmap creates a new pixmap with requiredIconSize and blits the 'pmWihtAspectRatio'
- // to correct location of it
- QPixmap softkeyPixmap = prepareSoftkeyPixmap(pmWihtAspectRatio, position, requiredIconSize);
-
- QPixmap softkeyAlpha = softkeyPixmap.alphaChannel();
- // Alpha channel in 5.1 and older devices need to be inverted
- // TODO: Switch to use toSymbianCFbsBitmap with invert when available
- if(QSysInfo::s60Version() <= QSysInfo::SV_S60_5_1) {
- QImage alphaImage = softkeyAlpha.toImage();
- alphaImage.invertPixels();
- softkeyAlpha = QPixmap::fromImage(alphaImage);
- }
-
- CFbsBitmap* nBitmap = softkeyPixmap.toSymbianCFbsBitmap();
- CFbsBitmap* nMask = softkeyAlpha.toSymbianCFbsBitmap();
-
- CEikImage* myimage = new (ELeave) CEikImage;
- myimage->SetPicture( nBitmap, nMask ); // nBitmap and nMask ownership transferred
-
- EikSoftkeyImage::SetImage(cba, *myimage, left); // Takes myimage ownership
- cbaHasImage[position] = true;
- ret = true;
- } else {
- // Restore softkey to text based
- if (cbaHasImage[position]) {
- EikSoftkeyImage::SetLabel(cba, left);
- cbaHasImage[position] = false;
- }
- }
- }
- return ret;
-}
-
-bool QSoftKeyManagerPrivateS60::setSoftkey(CEikButtonGroupContainer &cba,
- QAction::SoftKeyRole role, int position)
-{
- QAction *action = highestPrioritySoftkey(role);
- if (action) {
- setSoftkeyImage(&cba, *action, position);
- QString text = softkeyText(*action);
- TPtrC nativeText = qt_QString2TPtrC(text);
- int command = S60_COMMAND_START + position;
-#ifdef SYMBIAN_VERSION_SYMBIAN3
- if (softKeyCommandActions.contains(action))
- command = softKeyCommandActions.value(action);
-#endif
- setNativeSoftkey(cba, position, command, nativeText);
- const bool dimmed = !action->isEnabled() && !QSoftKeyManager::isForceEnabledInSofkeys(action);
- cba.DimCommand(command, dimmed);
- realSoftKeyActions.insert(command, action);
- return true;
- }
- return false;
-}
-
-bool QSoftKeyManagerPrivateS60::setLeftSoftkey(CEikButtonGroupContainer &cba)
-{
- return setSoftkey(cba, QAction::PositiveSoftKey, LSK_POSITION);
-}
-
-bool QSoftKeyManagerPrivateS60::setMiddleSoftkey(CEikButtonGroupContainer &cba)
-{
- // Note: In order to get MSK working, application has to have EAknEnableMSK flag set
- // Currently it is not possible very easily)
- // For more information see: http://wiki.forum.nokia.com/index.php/Middle_softkey_usage
- return setSoftkey(cba, QAction::SelectSoftKey, MSK_POSITION);
-}
-
-bool QSoftKeyManagerPrivateS60::setRightSoftkey(CEikButtonGroupContainer &cba)
-{
- if (!setSoftkey(cba, QAction::NegativeSoftKey, RSK_POSITION)) {
- const Qt::WindowType windowType = initialSoftKeySource
- ? initialSoftKeySource->window()->windowType() : Qt::Window;
- if (windowType != Qt::Dialog && windowType != Qt::Popup) {
- QString text(QSoftKeyManager::tr("Exit"));
- TPtrC nativeText = qt_QString2TPtrC(text);
- if (cbaHasImage[RSK_POSITION]) {
- EikSoftkeyImage::SetLabel(&cba, false);
- cbaHasImage[RSK_POSITION] = false;
- }
- setNativeSoftkey(cba, RSK_POSITION, EAknSoftkeyExit, nativeText);
- cba.DimCommand(EAknSoftkeyExit, false);
- return true;
- }
- }
- return false;
-}
-
-void QSoftKeyManagerPrivateS60::setSoftkeys(CEikButtonGroupContainer &cba)
-{
- int requestedSoftkeyCount = requestedSoftKeyActions.count();
- const int maxSoftkeyCount = 2; // TODO: differs based on orientation ans S60 versions (some have MSK)
- if (requestedSoftkeyCount > maxSoftkeyCount) {
- // We have more softkeys than available slots
- // Put highest priority negative action to RSK and Options menu with rest of softkey actions to LSK
- // TODO: Build menu
- setLeftSoftkey(cba);
- if(AknLayoutUtils::MSKEnabled())
- setMiddleSoftkey(cba);
- setRightSoftkey(cba);
- } else {
- // We have less softkeys than available slots
- // Put softkeys to request slots based on role
- setLeftSoftkey(cba);
- if(AknLayoutUtils::MSKEnabled())
- setMiddleSoftkey(cba);
- setRightSoftkey(cba);
- }
-}
-
-void QSoftKeyManagerPrivateS60::updateSoftKeys_sys()
-{
- if (skipCbaUpdate())
- return;
-
- CEikButtonGroupContainer *nativeContainer = S60->buttonGroupContainer();
- Q_ASSERT_X(nativeContainer, Q_FUNC_INFO, "Native CBA does not exist!");
- ensureCbaVisibilityAndResponsiviness(*nativeContainer);
- clearSoftkeys(*nativeContainer);
- setSoftkeys(*nativeContainer);
-
- nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation
-}
-
-static void resetMenuBeingConstructed(TAny* /*aAny*/)
-{
- S60->menuBeingConstructed = false;
-}
-
-void QSoftKeyManagerPrivateS60::tryDisplayMenuBarL()
-{
- CleanupStack::PushL(TCleanupItem(resetMenuBeingConstructed, NULL));
- S60->menuBeingConstructed = true;
- S60->menuBar()->TryDisplayMenuBarL();
- CleanupStack::PopAndDestroy(); // Reset menuBeingConstructed to false in all cases
-}
-
-bool QSoftKeyManagerPrivateS60::handleCommand(int command)
-{
- QAction *action = realSoftKeyActions.value(command);
- if (action) {
- bool property = QActionPrivate::get(action)->menuActionSoftkeys;
- if (property) {
- QT_TRAP_THROWING(tryDisplayMenuBarL());
- } else if (action->menu()) {
- // TODO: This is hack, in order to use exising QMenuBar implementation for Symbian
- // menubar needs to have widget to which it is associated. Since we want to associate
- // menubar to action (which is inherited from QObject), we create and associate QWidget
- // to action and pass that for QMenuBar. This associates the menubar to action, and we
- // can have own menubar for each action.
- QWidget *actionContainer = action->property("_q_action_widget").value<QWidget*>();
- if(!actionContainer) {
- actionContainer = new QWidget(action->parentWidget());
- QMenuBar *menuBar = new QMenuBar(actionContainer);
- foreach(QAction *menuAction, action->menu()->actions()) {
- QMenu *menu = menuAction->menu();
- if(menu)
- menuBar->addMenu(menu);
- else
- menuBar->addAction(menuAction);
- }
- QVariant v;
- v.setValue(actionContainer);
- action->setProperty("_q_action_widget", v);
- }
- qt_symbian_next_menu_from_action(actionContainer);
- QT_TRAP_THROWING(tryDisplayMenuBarL());
- }
-
- Q_ASSERT(action->softKeyRole() != QAction::NoSoftKey);
- QWidget *actionParent = action->parentWidget();
- Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!");
- if (actionParent->isEnabled()) {
- action->activate(QAction::Trigger);
- return true;
- }
- }
- return false;
-}
-
-QT_END_NAMESPACE
-#endif //QT_NO_SOFTKEYMANAGER
diff --git a/src/widgets/platforms/s60/qsoftkeymanager_s60_p.h b/src/widgets/platforms/s60/qsoftkeymanager_s60_p.h
deleted file mode 100644
index a16a8ca2ac..0000000000
--- a/src/widgets/platforms/s60/qsoftkeymanager_s60_p.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSOFTKEYMANAGER_S60_P_H
-#define QSOFTKEYMANAGER_S60_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.
-//
-
-#include "qbitarray.h"
-#include "private/qobject_p.h"
-#include "private/qsoftkeymanager_common_p.h"
-
-QT_BEGIN_HEADER
-
-#ifndef QT_NO_SOFTKEYMANAGER
-
-QT_BEGIN_NAMESPACE
-
-class CEikButtonGroupContainer;
-class QAction;
-
-class QSoftKeyManagerPrivateS60 : public QSoftKeyManagerPrivate
-{
- Q_DECLARE_PUBLIC(QSoftKeyManager)
-
-public:
- QSoftKeyManagerPrivateS60();
-
-public:
- void updateSoftKeys_sys();
- bool handleCommand(int command);
-
-private:
- void tryDisplayMenuBarL();
- bool skipCbaUpdate();
- void ensureCbaVisibilityAndResponsiviness(CEikButtonGroupContainer &cba);
- void clearSoftkeys(CEikButtonGroupContainer &cba);
- QString softkeyText(QAction &softkeyAction);
- QAction *highestPrioritySoftkey(QAction::SoftKeyRole role);
- static bool actionPriorityMoreThan(const QAction* item1, const QAction* item2);
- void setNativeSoftkey(CEikButtonGroupContainer &cba, TInt position, TInt command, const TDesC& text);
- QPoint softkeyIconPosition(int position, QSize sourceSize, QSize targetSize);
- QPixmap prepareSoftkeyPixmap(QPixmap src, int position, QSize targetSize);
- bool isOrientationLandscape();
- QSize cbaIconSize(CEikButtonGroupContainer *cba, int position);
- bool setSoftkeyImage(CEikButtonGroupContainer *cba, QAction &action, int position);
- bool setSoftkey(CEikButtonGroupContainer &cba, QAction::SoftKeyRole role, int position);
- bool setLeftSoftkey(CEikButtonGroupContainer &cba);
- bool setMiddleSoftkey(CEikButtonGroupContainer &cba);
- bool setRightSoftkey(CEikButtonGroupContainer &cba);
- void setSoftkeys(CEikButtonGroupContainer &cba);
-
-private:
- QHash<int, QAction*> realSoftKeyActions;
- QSize cachedCbaIconSize[4];
- QBitArray cbaHasImage;
-};
-
-
-QT_END_NAMESPACE
-
-#endif //QT_NO_SOFTKEYMANAGER
-
-QT_END_HEADER
-
-#endif // QSOFTKEYMANAGER_S60_P_H
diff --git a/src/widgets/platforms/s60/qsound_s60.cpp b/src/widgets/platforms/s60/qsound_s60.cpp
deleted file mode 100644
index 1ed2ef3131..0000000000
--- a/src/widgets/platforms/s60/qsound_s60.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-
-#ifndef QT_NO_SOUND
-
-#include "qdir.h"
-#include "qapplication.h"
-#include "qsound.h"
-#include "qsound_p.h"
-#include "qfileinfo.h"
-#include <private/qcore_symbian_p.h>
-
-#include <e32std.h>
-#include <mdaaudiosampleplayer.h>
-
-QT_BEGIN_NAMESPACE
-
-class QAuServerS60;
-
-class QAuBucketS60 : public QAuBucket, public MMdaAudioPlayerCallback
-{
-public:
- QAuBucketS60(QAuServerS60 *server, QSound *sound);
- ~QAuBucketS60();
-
- void play();
- void stop();
-
- inline QSound *sound() const { return m_sound; }
-
-public: // from MMdaAudioPlayerCallback
- void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
- void MapcPlayComplete(TInt aError);
-
-private:
- QSound *m_sound;
- QAuServerS60 *m_server;
- bool m_prepared;
- bool m_playCalled;
- CMdaAudioPlayerUtility *m_playUtility;
-};
-
-
-class QAuServerS60 : public QAuServer
-{
-public:
- QAuServerS60(QObject *parent);
-
- void init(QSound *s)
- {
- QAuBucketS60 *bucket = new QAuBucketS60(this, s);
- setBucket(s, bucket);
- }
-
- void play(QSound *s)
- {
- bucket(s)->play();
- }
-
- void stop(QSound *s)
- {
- bucket(s)->stop();
- }
-
- bool okay() { return true; }
-
- void play(const QString& filename);
-
-protected:
- void playCompleted(QAuBucketS60 *bucket, int error);
-
-protected:
- QAuBucketS60 *bucket(QSound *s)
- {
- return (QAuBucketS60 *)QAuServer::bucket( s );
- }
-
- friend class QAuBucketS60;
-
- // static QSound::play(filename) cannot be stopped, meaning that playCompleted
- // will get always called and QSound gets removed form this list.
- QList<QSound *> staticPlayingSounds;
-};
-
-QAuServerS60::QAuServerS60(QObject *parent) :
- QAuServer(parent)
-{
- setObjectName(QLatin1String("QAuServerS60"));
-}
-
-void QAuServerS60::play(const QString& filename)
-{
- QSound *s = new QSound(filename);
- staticPlayingSounds.append(s);
- play(s);
-}
-
-void QAuServerS60::playCompleted(QAuBucketS60 *bucket, int error)
-{
- QSound *sound = bucket->sound();
- if (!error) {
- // We need to handle repeats by ourselves, since with Symbian API we don't
- // know how many loops have been played when user asks it
- if (decLoop(sound)) {
- play(sound);
- } else {
- if (staticPlayingSounds.removeAll(sound))
- delete sound;
- }
- } else {
- // We don't have a way to inform about errors -> just decrement loops
- // in order that QSound::isFinished will return true;
- while (decLoop(sound) > 0) {}
- if (staticPlayingSounds.removeAll(sound))
- delete sound;
- }
-}
-
-QAuServer *qt_new_audio_server()
-{
- return new QAuServerS60(qApp);
-}
-
-QAuBucketS60::QAuBucketS60(QAuServerS60 *server, QSound *sound)
- : m_sound(sound), m_server(server), m_prepared(false), m_playCalled(false)
-{
- QString filepath = QFileInfo(m_sound->fileName()).absoluteFilePath();
- filepath = QDir::toNativeSeparators(filepath);
- TPtrC filepathPtr(qt_QString2TPtrC(filepath));
- TRAPD(err, m_playUtility = CMdaAudioPlayerUtility::NewL(*this);
- m_playUtility->OpenFileL(filepathPtr));
- if (err) {
- m_server->playCompleted(this, err);
- }
-}
-
-void QAuBucketS60::play()
-{
- if (m_prepared) {
- // OpenFileL call is completed we can start playing immediately
- m_playUtility->Play();
- } else {
- m_playCalled = true;
- }
-
-}
-
-void QAuBucketS60::stop()
-{
- m_playCalled = false;
- m_playUtility->Stop();
-}
-
-void QAuBucketS60::MapcPlayComplete(TInt aError)
-{
- m_server->playCompleted(this, aError);
-}
-
-void QAuBucketS60::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/)
-{
- if (aError) {
- m_server->playCompleted(this, aError);
- } else {
- m_prepared = true;
- if (m_playCalled){
- play();
- }
- }
-}
-
-QAuBucketS60::~QAuBucketS60()
-{
- if (m_playUtility){
- m_playUtility->Stop();
- m_playUtility->Close();
- }
-
- delete m_playUtility;
-}
-
-
-#endif // QT_NO_SOUND
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/s60/qt_s60_p.h b/src/widgets/platforms/s60/qt_s60_p.h
deleted file mode 100644
index aa60d16fab..0000000000
--- a/src/widgets/platforms/s60/qt_s60_p.h
+++ /dev/null
@@ -1,651 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT_S60_P_H
-#define QT_S60_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.
-//
-
-#include "QtGui/qwindowdefs.h"
-#include "private/qcore_symbian_p.h"
-#include "qhash.h"
-#include "qpoint.h"
-#include "QtGui/qfont.h"
-#include "QtGui/qimage.h"
-#include "QtGui/qevent.h"
-#include "qpointer.h"
-#include "qapplication.h"
-#include "qelapsedtimer.h"
-#include "QtCore/qthreadstorage.h"
-#include "qwidget_p.h"
-#include <w32std.h>
-#include <coecntrl.h>
-#include <eikenv.h>
-#include <eikappui.h>
-
-#ifdef Q_WS_S60
-#include <AknUtils.h> // AknLayoutUtils
-#include <avkon.hrh> // EEikStatusPaneUidTitle
-#include <akntitle.h> // CAknTitlePane
-#include <akncontext.h> // CAknContextPane
-#include <eikspane.h> // CEikStatusPane
-#include <AknPopupFader.h> // MAknFadedComponent and TAknPopupFader
-#include <gfxtranseffect/gfxtranseffect.h> // BeginFullScreen
-#ifdef QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H
-#include <akntranseffect.h> // BeginFullScreen
-#endif
-#endif
-
-QT_BEGIN_NAMESPACE
-
-// Application internal HandleResourceChangeL events,
-// system events seems to start with 0x10
-const TInt KInternalStatusPaneChange = 0x50000000;
-
-// For BeginFullScreen().
-const TUint KQtAppExitFlag = 0x400;
-
-static const int qt_symbian_max_screens = 4;
-
-//this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2
-#define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13)
-
-class QSymbianTypeFaceExtras;
-typedef QHash<QString, const QSymbianTypeFaceExtras *> QSymbianTypeFaceExtrasHash;
-typedef void (*QThreadLocalReleaseFunc)();
-
-class Q_AUTOTEST_EXPORT QS60ThreadLocalData
-{
-public:
- QS60ThreadLocalData();
- ~QS60ThreadLocalData();
- bool usingCONEinstances;
- RWsSession wsSession;
- CWsScreenDevice *screenDevice;
- QSymbianTypeFaceExtrasHash fontData;
- QVector<QThreadLocalReleaseFunc> releaseFuncs;
-};
-
-class QS60Data
-{
-public:
- QS60Data();
- QThreadStorage<QS60ThreadLocalData *> tls;
- TUid uid;
- int screenDepth;
- QPoint lastCursorPos;
- QPoint lastPointerEventPos;
- QPointer<QWidget> lastPointerEventTarget;
- QPointer<QWidget> mousePressTarget;
- int screenWidthInPixels;
- int screenHeightInPixels;
- int screenWidthInTwips;
- int screenHeightInTwips;
- int defaultDpiX;
- int defaultDpiY;
- WId curWin;
- enum PressedKeys {
- Select = 0x1,
- Right = 0x2,
- Down = 0x4,
- Left = 0x8,
- Up = 0x10,
- LeftUp = 0x20,
- RightUp = 0x40,
- RightDown = 0x80,
- LeftDown = 0x100
- };
- int virtualMousePressedKeys; // of the above type, but avoids casting problems
- int virtualMouseAccelDX;
- int virtualMouseAccelDY;
- QElapsedTimer virtualMouseAccelTimeout;
- int virtualMouseMaxAccel;
-#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
- int brokenPointerCursors : 1;
-#endif
- int hasTouchscreen : 1;
- int mouseInteractionEnabled : 1;
- int virtualMouseRequired : 1;
- int qtOwnsS60Environment : 1;
- int supportsPremultipliedAlpha : 1;
- int avkonComponentsSupportTransparency : 1;
- int menuBeingConstructed : 1;
- int orientationSet : 1;
- int partial_keyboard : 1;
- QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type
- QPointer<QWidget> splitViewLastWidget;
-
- static CEikButtonGroupContainer *cba;
-
- enum ScanCodeState {
- Unpressed,
- KeyDown,
- KeyDownAndKey
- };
- QHash<TInt, ScanCodeState> scanCodeStates;
-
- static inline void updateScreenSize();
- inline RWsSession& wsSession();
- static inline int screenCount();
- static inline RWindowGroup& windowGroup();
- static inline RWindowGroup& windowGroup(const QWidget *widget);
- static inline RWindowGroup& windowGroup(int screenNumber);
- inline CWsScreenDevice* screenDevice();
- inline CWsScreenDevice* screenDevice(const QWidget *widget);
- inline CWsScreenDevice* screenDevice(int screenNumber);
- static inline int screenNumberForWidget(const QWidget *widget);
- inline QSymbianTypeFaceExtrasHash& fontData();
- inline void addThreadLocalReleaseFunc(QThreadLocalReleaseFunc func);
- static inline CCoeAppUi* appUi();
- static inline CEikMenuBar* menuBar();
-#ifdef Q_WS_S60
- static inline CEikStatusPane* statusPane();
- static inline CCoeControl* statusPaneSubPane(TInt aPaneId);
- static inline CAknTitlePane* titlePane();
- static inline CAknContextPane* contextPane();
- static inline CEikButtonGroupContainer* buttonGroupContainer();
- static inline void setButtonGroupContainer(CEikButtonGroupContainer* newCba);
- static void setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, bool buttonGroupVisible);
- static bool setRecursiveDecorationsVisibility(QWidget *window, Qt::WindowStates newState);
-#endif
- static void controlVisibilityChanged(CCoeControl *control, bool visible);
-
-#ifdef Q_OS_SYMBIAN
- TTrapHandler *s60InstalledTrapHandler;
-#endif
-
- int screenWidthInPixelsForScreen[qt_symbian_max_screens];
- int screenHeightInPixelsForScreen[qt_symbian_max_screens];
- int screenWidthInTwipsForScreen[qt_symbian_max_screens];
- int screenHeightInTwipsForScreen[qt_symbian_max_screens];
-
- int nativeScreenWidthInPixels;
- int nativeScreenHeightInPixels;
-
- int beginFullScreenCalled : 1;
- int endFullScreenCalled : 1;
-};
-
-Q_AUTOTEST_EXPORT QS60Data* qGlobalS60Data();
-#define S60 qGlobalS60Data()
-
-class QAbstractLongTapObserver
-{
-public:
- virtual void HandleLongTapEventL( const TPoint& aPenEventLocation,
- const TPoint& aPenEventScreenLocation ) = 0;
-};
-class QLongTapTimer;
-
-
-class QSymbianControl : public CCoeControl, public QAbstractLongTapObserver
-#ifdef Q_WS_S60
-, public MAknFadedComponent, public MEikStatusPaneObserver
-#endif
-{
-public:
- DECLARE_TYPE_ID(0x51740000) // Fun fact: the two first values are "Qt" in ASCII.
-
-public:
- QSymbianControl(QWidget *w);
- void ConstructL(bool isWindowOwning = false, bool desktop = false);
- ~QSymbianControl();
- void HandleResourceChange(int resourceType);
- void HandlePointerEventL(const TPointerEvent& aPointerEvent);
- TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
-#if !defined(QT_NO_IM) && defined(Q_WS_S60)
- TCoeInputCapabilities InputCapabilities() const;
-#endif
- TTypeUid::Ptr MopSupplyObject(TTypeUid id);
-
- inline QWidget* widget() const { return qwidget; }
- void setWidget(QWidget *w);
- void sendInputEvent(QWidget *widget, QInputEvent *inputEvent);
- void setIgnoreFocusChanged(bool enabled) { m_ignoreFocusChanged = enabled; }
- void CancelLongTapTimer();
-
- void setFocusSafely(bool focus);
-
- bool isControlActive();
-
- void ensureFixNativeOrientation();
- QPoint translatePointForFixedNativeOrientation(const TPoint &pointerEventPos) const;
- TRect translateRectForFixedNativeOrientation(const TRect &controlRect) const;
-
-#ifdef Q_WS_S60
- void FadeBehindPopup(bool fade){ popupFader.FadeBehindPopup( this, this, fade); }
- void HandleStatusPaneSizeChange();
-
-protected: // from MAknFadedComponent
- TInt CountFadedComponents() {return 1;}
- CCoeControl* FadedComponent(TInt /*aIndex*/) {return this;}
-#else
- // #warning No fallback implementation for QSymbianControl::FadeBehindPopup
- void FadeBehindPopup(bool /*fade*/){ }
-#endif
-
-protected:
- void Draw(const TRect& aRect) const;
- void SizeChanged();
- void PositionChanged();
- void FocusChanged(TDrawNow aDrawNow);
-
-protected:
- void qwidgetResize_helper(const QSize &newSize);
-
-private:
- void HandlePointerEvent(const TPointerEvent& aPointerEvent);
- TKeyResponse OfferKeyEvent(const TKeyEvent& aKeyEvent,TEventCode aType);
- TKeyResponse sendSymbianKeyEvent(const TKeyEvent &keyEvent, QEvent::Type type);
- TKeyResponse sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent);
- TKeyResponse handleVirtualMouse(const TKeyEvent& keyEvent,TEventCode type);
- bool sendMouseEvent(QWidget *widget, QMouseEvent *mEvent);
- void sendMouseEvent(
- QWidget *receiver,
- QEvent::Type type,
- const QPoint &globalPos,
- Qt::MouseButton button,
- Qt::KeyboardModifiers modifiers);
- void processTouchEvent(int pointerNumber, TPointerEvent::TType type, QPointF screenPos, qreal pressure);
- void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation );
-#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
- void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event);
-#endif
- bool isSplitViewWidget(QWidget *widget);
-
-public:
- void handleClientAreaChange();
-
-private:
- static QSymbianControl *lastFocusedControl;
-
-private:
- QWidget *qwidget;
- QLongTapTimer* m_longTapDetector;
- QElapsedTimer m_doubleClickTimer;
- bool m_ignoreFocusChanged : 1;
- bool m_symbianPopupIsOpen : 1;
-
-#ifdef Q_WS_S60
- // Fader object used to fade everything except this menu and the CBA.
- TAknPopupFader popupFader;
-#endif
-
- bool m_inExternalScreenOverride : 1;
- bool m_lastStatusPaneVisibility : 1;
-};
-
-inline QS60Data::QS60Data()
-: uid(TUid::Null()),
- screenDepth(0),
- screenWidthInPixels(0),
- screenHeightInPixels(0),
- screenWidthInTwips(0),
- screenHeightInTwips(0),
- defaultDpiX(0),
- defaultDpiY(0),
- curWin(0),
- virtualMousePressedKeys(0),
- virtualMouseAccelDX(0),
- virtualMouseAccelDY(0),
- virtualMouseMaxAccel(0),
-#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
- brokenPointerCursors(0),
-#endif
- hasTouchscreen(0),
- mouseInteractionEnabled(0),
- virtualMouseRequired(0),
- qtOwnsS60Environment(0),
- supportsPremultipliedAlpha(0),
- avkonComponentsSupportTransparency(0),
- menuBeingConstructed(0),
- orientationSet(0),
- partial_keyboard(0),
- s60ApplicationFactory(0)
-#ifdef Q_OS_SYMBIAN
- ,s60InstalledTrapHandler(0)
-#endif
- ,beginFullScreenCalled(0),
- endFullScreenCalled(0)
-{
-}
-
-inline void QS60Data::updateScreenSize()
-{
- CWsScreenDevice *dev = S60->screenDevice();
- int screenModeCount = dev->NumScreenModes();
- int mode = dev->CurrentScreenMode();
- TPixelsTwipsAndRotation params;
- dev->GetScreenModeSizeAndRotation(mode, params);
- S60->screenWidthInPixels = params.iPixelSize.iWidth;
- S60->screenHeightInPixels = params.iPixelSize.iHeight;
- S60->screenWidthInTwips = params.iTwipsSize.iWidth;
- S60->screenHeightInTwips = params.iTwipsSize.iHeight;
-
- S60->virtualMouseMaxAccel = qMax(S60->screenHeightInPixels, S60->screenWidthInPixels) / 10;
-
- TReal inches = S60->screenHeightInTwips / (TReal)KTwipsPerInch;
- S60->defaultDpiY = S60->screenHeightInPixels / inches;
- inches = S60->screenWidthInTwips / (TReal)KTwipsPerInch;
- S60->defaultDpiX = S60->screenWidthInPixels / inches;
-
- int screens = S60->screenCount();
- for (int i = 0; i < screens; ++i) {
- CWsScreenDevice *dev = S60->screenDevice(i);
- mode = dev->CurrentScreenMode();
- dev->GetScreenModeSizeAndRotation(mode, params);
- S60->screenWidthInPixelsForScreen[i] = params.iPixelSize.iWidth;
- S60->screenHeightInPixelsForScreen[i] = params.iPixelSize.iHeight;
- S60->screenWidthInTwipsForScreen[i] = params.iTwipsSize.iWidth;
- S60->screenHeightInTwipsForScreen[i] = params.iTwipsSize.iHeight;
- }
-
- // Look for a screen mode with rotation 0
- // in order to decide what the native orientation is.
- for (mode = 0; mode < screenModeCount; ++mode) {
- TPixelsAndRotation sizeAndRotation;
- dev->GetScreenModeSizeAndRotation(mode, sizeAndRotation);
- if (sizeAndRotation.iRotation == CFbsBitGc::EGraphicsOrientationNormal) {
- S60->nativeScreenWidthInPixels = sizeAndRotation.iPixelSize.iWidth;
- S60->nativeScreenHeightInPixels = sizeAndRotation.iPixelSize.iHeight;
- break;
- }
- }
-}
-
-inline RWsSession& QS60Data::wsSession()
-{
- if(!tls.hasLocalData()) {
- tls.setLocalData(new QS60ThreadLocalData);
- }
- return tls.localData()->wsSession;
-}
-
-inline int QS60Data::screenCount()
-{
-#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS)
- CCoeEnv *env = CCoeEnv::Static();
- if (env) {
- return qMin(env->WsSession().NumberOfScreens(), qt_symbian_max_screens);
- }
-#endif
- return 1;
-}
-
-inline RWindowGroup& QS60Data::windowGroup()
-{
- return CCoeEnv::Static()->RootWin();
-}
-
-inline RWindowGroup& QS60Data::windowGroup(const QWidget *widget)
-{
- return windowGroup(screenNumberForWidget(widget));
-}
-
-inline RWindowGroup& QS60Data::windowGroup(int screenNumber)
-{
-#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS)
- RWindowGroup *wg = CCoeEnv::Static()->RootWin(screenNumber);
- return wg ? *wg : windowGroup();
-#else
- Q_UNUSED(screenNumber);
- return windowGroup();
-#endif
-}
-
-inline CWsScreenDevice* QS60Data::screenDevice()
-{
- if(!tls.hasLocalData()) {
- tls.setLocalData(new QS60ThreadLocalData);
- }
- return tls.localData()->screenDevice;
-}
-
-inline CWsScreenDevice* QS60Data::screenDevice(const QWidget *widget)
-{
- return screenDevice(screenNumberForWidget(widget));
-}
-
-inline CWsScreenDevice* QS60Data::screenDevice(int screenNumber)
-{
-#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS)
- CCoeEnv *env = CCoeEnv::Static();
- if (env) {
- CWsScreenDevice *dev = env->ScreenDevice(screenNumber);
- return dev ? dev : screenDevice();
- } else {
- return screenDevice();
- }
-#else
- return screenDevice();
-#endif
-}
-
-inline int QS60Data::screenNumberForWidget(const QWidget *widget)
-{
- if (!widget)
- return 0;
- const QWidget *w = widget;
- while (w->parentWidget())
- w = w->parentWidget();
- return qt_widget_private(const_cast<QWidget *>(w))->symbianScreenNumber;
-}
-
-inline QSymbianTypeFaceExtrasHash& QS60Data::fontData()
-{
- if (!tls.hasLocalData()) {
- tls.setLocalData(new QS60ThreadLocalData);
- }
- return tls.localData()->fontData;
-}
-
-inline void QS60Data::addThreadLocalReleaseFunc(QThreadLocalReleaseFunc func)
-{
- if (!tls.hasLocalData()) {
- tls.setLocalData(new QS60ThreadLocalData);
- }
- QS60ThreadLocalData *data = tls.localData();
- if (!data->releaseFuncs.contains(func))
- data->releaseFuncs.append(func);
-}
-
-inline CCoeAppUi* QS60Data::appUi()
-{
- return CCoeEnv::Static()-> AppUi();
-}
-
-inline CEikMenuBar* QS60Data::menuBar()
-{
- return CEikonEnv::Static()->AppUiFactory()->MenuBar();
-}
-
-#ifdef Q_WS_S60
-inline CEikStatusPane* QS60Data::statusPane()
-{
- return CEikonEnv::Static()->AppUiFactory()->StatusPane();
-}
-
-// Returns the application's status pane control, if not present returns NULL.
-inline CCoeControl* QS60Data::statusPaneSubPane( TInt aPaneId )
-{
- const TUid paneUid = { aPaneId };
- CEikStatusPane* statusPane = S60->statusPane();
- if (statusPane && statusPane->PaneCapabilities(paneUid).IsPresent()) {
- CCoeControl* control = NULL;
- // ControlL shouldn't leave because the pane is present
- TRAPD(err, control = statusPane->ControlL(paneUid));
- return err != KErrNone ? NULL : control;
- }
- return NULL;
-}
-
-// Returns the application's title pane, if not present returns NULL.
-inline CAknTitlePane* QS60Data::titlePane()
-{
- return static_cast<CAknTitlePane*>(S60->statusPaneSubPane(EEikStatusPaneUidTitle));
-}
-
-// Returns the application's title pane, if not present returns NULL.
-inline CAknContextPane* QS60Data::contextPane()
-{
- return static_cast<CAknContextPane*>(S60->statusPaneSubPane(EEikStatusPaneUidContext));
-}
-
-inline CEikButtonGroupContainer* QS60Data::buttonGroupContainer()
-{
- return QS60Data::cba;
-}
-
-inline void QS60Data::setButtonGroupContainer(CEikButtonGroupContainer *newCba)
-{
- QS60Data::cba = newCba;
-}
-#endif // Q_WS_S60
-
-static inline QFont qt_TFontSpec2QFontL(const TFontSpec &fontSpec)
-{
- return QFont(
- qt_TDesC2QString(fontSpec.iTypeface.iName),
- fontSpec.iHeight / KTwipsPerPoint,
- fontSpec.iFontStyle.StrokeWeight() == EStrokeWeightNormal ? QFont::Normal : QFont::Bold,
- fontSpec.iFontStyle.Posture() == EPostureItalic
- );
-}
-
-static inline QImage::Format qt_TDisplayMode2Format(TDisplayMode mode)
-{
- QImage::Format format;
- switch(mode) {
- case EGray2:
- format = QImage::Format_MonoLSB;
- break;
- case EColor256:
- case EGray256:
- format = QImage::Format_Indexed8;
- break;
- case EColor4K:
- format = QImage::Format_RGB444;
- break;
- case EColor64K:
- format = QImage::Format_RGB16;
- break;
- case EColor16M:
- format = QImage::Format_RGB888;
- break;
- case EColor16MU:
- format = QImage::Format_RGB32;
- break;
- case EColor16MA:
- format = QImage::Format_ARGB32;
- break;
- case Q_SYMBIAN_ECOLOR16MAP:
- format = QImage::Format_ARGB32_Premultiplied;
- break;
- default:
- format = QImage::Format_Invalid;
- break;
- }
- return format;
-}
-
-#ifndef QT_NO_CURSOR
-void qt_symbian_setWindowCursor(const QCursor &cursor, const CCoeControl* wid);
-void qt_symbian_setWindowGroupCursor(const QCursor &cursor, RWindowTreeNode &node);
-void qt_symbian_setGlobalCursor(const QCursor &cursor);
-void qt_symbian_set_cursor_visible(bool visible);
-bool qt_symbian_is_cursor_visible();
-#endif
-
-static inline bool qt_beginFullScreenEffect()
-{
-#if defined(Q_WS_S60) && defined(QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H)
- // Only for post-S^3. On earlier versions the system transition effects
- // may not be able to capture the non-Avkon content, leading to confusing
- // looking effects, so just skip the whole thing.
- if (S60->beginFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2)
- return false;
- S60->beginFullScreenCalled = true;
- // For Avkon apps the app-exit effect is triggered from CAknAppUi::PrepareToExit().
- // That is good for Avkon apps, but in case of Qt the RWindows are destroyed earlier.
- // Therefore we call BeginFullScreen() ourselves.
- GfxTransEffect::BeginFullScreen(AknTransEffect::EApplicationExit,
- TRect(0, 0, 0, 0),
- AknTransEffect::EParameterType,
- AknTransEffect::GfxTransParam(S60->uid,
- AknTransEffect::TParameter::EAvkonCheck | KQtAppExitFlag));
- return true;
-#else
- return false;
-#endif
-}
-
-static inline void qt_abortFullScreenEffect()
-{
-#if defined(Q_WS_S60) && defined(QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H)
- if (!S60->beginFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2)
- return;
- GfxTransEffect::AbortFullScreen();
- S60->beginFullScreenCalled = S60->endFullScreenCalled = false;
-#endif
-}
-
-static inline void qt_endFullScreenEffect()
-{
-#if defined(Q_WS_S60) && defined(QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H)
- if (S60->endFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2)
- return;
- S60->endFullScreenCalled = true;
- GfxTransEffect::EndFullScreen();
-#endif
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_S60_P_H
diff --git a/src/widgets/platforms/s60/qwidget_s60.cpp b/src/widgets/platforms/s60/qwidget_s60.cpp
deleted file mode 100644
index d0b1299898..0000000000
--- a/src/widgets/platforms/s60/qwidget_s60.cpp
+++ /dev/null
@@ -1,1464 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwidget_p.h"
-#include "qdesktopwidget.h"
-#include "qapplication.h"
-#include "qapplication_p.h"
-#include "private/qbackingstore_p.h"
-#include "qevent.h"
-#include "qt_s60_p.h"
-
-#include "qbitmap.h"
-#include "private/qwindowsurface_s60_p.h"
-
-#include <qinputcontext.h>
-
-#ifdef Q_WS_S60
-#include <aknappui.h>
-#include <eikbtgpc.h>
-#endif
-
-// This is necessary in order to be able to perform delayed invocation on slots
-// which take arguments of type WId. One example is
-// QWidgetPrivate::_q_delayedDestroy, which is used to delay destruction of
-// CCoeControl objects until after the CONE event handler has finished running.
-Q_DECLARE_METATYPE(WId)
-
-// Workaround for the fact that S60 SDKs 3.x do not contain the akntoolbar.h
-// header, even though the documentation says that it should be there, and indeed
-// it is present in the library.
-class CAknToolbar : public CAknControl,
- public MCoeControlObserver,
- public MCoeControlBackground,
- public MEikCommandObserver,
- public MAknFadedComponent
-{
-public:
- IMPORT_C void SetToolbarVisibility(const TBool visible);
-};
-
-QT_BEGIN_NAMESPACE
-
-extern bool qt_nograb();
-
-QWidget *QWidgetPrivate::mouseGrabber = 0;
-QWidget *QWidgetPrivate::keyboardGrabber = 0;
-CEikButtonGroupContainer *QS60Data::cba = 0;
-
-int qt_symbian_create_desktop_on_screen = -1;
-
-static bool isEqual(const QList<QAction*>& a, const QList<QAction*>& b)
-{
- if ( a.count() != b.count())
- return false;
- int index=0;
- while (index<a.count()) {
- if (a.at(index)->softKeyRole() != b.at(index)->softKeyRole())
- return false;
- if (a.at(index)->text().compare(b.at(index)->text())!=0)
- return false;
- index++;
- }
- return true;
-}
-
-void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &)
-{
- // Note: based on x11 implementation
-
- static const int XCOORD_MAX = 16383;
- static const int WRECT_MAX = 16383;
-
- Q_Q(QWidget);
-
- Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
-
- /*
- There are up to four different coordinate systems here:
- Qt coordinate system for this widget.
- Symbian coordinate system for this widget (relative to wrect).
- Qt coordinate system for parent
- Symbian coordinate system for parent (relative to parent's wrect).
- */
-
- QRect validRange(-XCOORD_MAX,-XCOORD_MAX, 2*XCOORD_MAX, 2*XCOORD_MAX);
- QRect wrectRange(-WRECT_MAX,-WRECT_MAX, 2*WRECT_MAX, 2*WRECT_MAX);
- QRect wrect;
- //xrect is the Symbian geometry of my widget. (starts out in parent's Qt coord sys, and ends up in parent's Symbian coord sys)
- QRect xrect = data.crect;
-
- const QWidget *const parent = q->parentWidget();
- QRect parentWRect = parent->data->wrect;
-
- if (parentWRect.isValid()) {
- // parent is clipped, and we have to clip to the same limit as parent
- if (!parentWRect.contains(xrect)) {
- xrect &= parentWRect;
- wrect = xrect;
- //translate from parent's to my Qt coord sys
- wrect.translate(-data.crect.topLeft());
- }
- //translate from parent's Qt coords to parent's X coords
- xrect.translate(-parentWRect.topLeft());
-
- } else {
- // parent is not clipped, we may or may not have to clip
-
- if (data.wrect.isValid() && QRect(QPoint(),data.crect.size()).contains(data.wrect)) {
- // This is where the main optimization is: we are already
- // clipped, and if our clip is still valid, we can just
- // move our window, and do not need to move or clip
- // children
-
- QRect vrect = xrect & parent->rect();
- vrect.translate(-data.crect.topLeft()); //the part of me that's visible through parent, in my Qt coords
- if (data.wrect.contains(vrect)) {
- xrect = data.wrect;
- xrect.translate(data.crect.topLeft());
- if (data.winid)
- data.winid->SetExtent(TPoint(xrect.x(), xrect.y()), TSize(xrect.width(), xrect.height()));
- return;
- }
- }
-
- if (!validRange.contains(xrect)) {
- // we are too big, and must clip
- xrect &=wrectRange;
- wrect = xrect;
- wrect.translate(-data.crect.topLeft());
- //parent's X coord system is equal to parent's Qt coord
- //sys, so we don't need to map xrect.
- }
- }
-
- // unmap if we are outside the valid window system coord system
- bool outsideRange = !xrect.isValid();
- bool mapWindow = false;
- if (q->testAttribute(Qt::WA_OutsideWSRange) != outsideRange) {
- q->setAttribute(Qt::WA_OutsideWSRange, outsideRange);
- if (outsideRange) {
- if (data.winid)
- data.winid->DrawableWindow()->SetVisible(EFalse);
- q->setAttribute(Qt::WA_Mapped, false);
- } else if (!q->isHidden()) {
- mapWindow = true;
- }
- }
-
- if (outsideRange)
- return;
-
- bool jump = (data.wrect != wrect);
- data.wrect = wrect;
-
- // and now recursively for all children...
- for (int i = 0; i < children.size(); ++i) {
- QObject *object = children.at(i);
- if (object->isWidgetType()) {
- QWidget *w = static_cast<QWidget *>(object);
- if (!w->isWindow() && w->testAttribute(Qt::WA_WState_Created))
- w->d_func()->setWSGeometry(jump);
- }
- }
-
- if (data.winid) {
- // move ourselves to the new position and map (if necessary) after
- // the movement. Rationale: moving unmapped windows is much faster
- // than moving mapped windows
- if (!parent->internalWinId())
- xrect.translate(parent->mapTo(q->nativeParentWidget(), QPoint(0, 0)));
-
- data.winid->SetExtent(TPoint(xrect.x(), xrect.y()), TSize(xrect.width(), xrect.height()));
- }
-
- if (mapWindow and !dontShow) {
- q->setAttribute(Qt::WA_Mapped);
- if (q->internalWinId())
- q->internalWinId()->DrawableWindow()->SetVisible(ETrue);
- }
-
- if (jump && data.winid) {
- RWindow *const window = static_cast<RWindow *>(data.winid->DrawableWindow());
- window->Invalidate(TRect(0, 0, wrect.width(), wrect.height()));
- }
-}
-
-void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
-{
- Q_Q(QWidget);
-
- Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
-
- if ((q->windowType() == Qt::Desktop))
- return;
-
- QPoint oldPos(q->pos());
- QSize oldSize(q->size());
- QRect oldGeom(data.crect);
-
- // Lose maximized status if deliberate resize
- if (w != oldSize.width() || h != oldSize.height())
- data.window_state &= ~Qt::WindowMaximized;
-
- bool checkExtra = true;
- if (q->isWindow() && (data.window_state & Qt::WindowFullScreen)) {
- // Do not modity window size for fullscreen windows, if requested
- // size is already equal to clientRect.
- TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
- if (w == r.Width() && h == r.Height())
- checkExtra = false;
- }
-
- if (checkExtra && extra) { // any size restrictions?
- w = qMin(w,extra->maxw);
- h = qMin(h,extra->maxh);
- w = qMax(w,extra->minw);
- h = qMax(h,extra->minh);
- }
-
- if (q->isWindow())
- topData()->normalGeometry = QRect(0, 0, -1, -1);
- else {
- uint s = data.window_state;
- s &= ~(Qt::WindowMaximized | Qt::WindowFullScreen);
- data.window_state = s;
- }
-
- bool isResize = w != oldSize.width() || h != oldSize.height();
- if (!isMove && !isResize)
- return;
-
- if (q->isWindow()) {
- if (w == 0 || h == 0) {
- q->setAttribute(Qt::WA_OutsideWSRange, true);
- if (q->isVisible() && q->testAttribute(Qt::WA_Mapped))
- hide_sys();
- data.crect = QRect(x, y, w, h);
- data.window_state &= ~Qt::WindowFullScreen;
- } else if (q->isVisible() && q->testAttribute(Qt::WA_OutsideWSRange)) {
- q->setAttribute(Qt::WA_OutsideWSRange, false);
-
- // put the window in its place and show it
- q->internalWinId()->SetRect(TRect(TPoint(x, y), TSize(w, h)));
- data.crect.setRect(x, y, w, h);
- show_sys();
- } else {
- QRect r = QRect(x, y, w, h);
- data.crect = r;
- q->internalWinId()->SetRect(TRect(TPoint(x, y), TSize(w, h)));
- topData()->normalGeometry = data.crect;
- }
- QSymbianControl *window = static_cast<QSymbianControl *>(q->internalWinId());
- window->ensureFixNativeOrientation();
- } else {
- data.crect.setRect(x, y, w, h);
-
- QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData();
- const bool inTopLevelResize = tlwExtra ? tlwExtra->inTopLevelResize : false;
-
- if (q->isVisible() && (!inTopLevelResize || q->internalWinId())) {
- // Top-level resize optimization does not work for native child widgets;
- // disable it for this particular widget.
- if (inTopLevelResize)
- tlwExtra->inTopLevelResize = false;
- if (!isResize && maybeBackingStore())
- moveRect(QRect(oldPos, oldSize), x - oldPos.x(), y - oldPos.y());
- else
- invalidateBuffer_resizeHelper(oldPos, oldSize);
-
- if (inTopLevelResize)
- tlwExtra->inTopLevelResize = true;
- }
- if (q->testAttribute(Qt::WA_WState_Created))
- setWSGeometry();
- }
-
- if (q->isVisible()) {
- if (isMove && q->pos() != oldPos) {
- QMoveEvent e(q->pos(), oldPos);
- QApplication::sendEvent(q, &e);
- }
- if (isResize) {
- bool slowResize = qgetenv("QT_SLOW_TOPLEVEL_RESIZE").toInt();
- const bool setTopLevelResize = !slowResize && q->isWindow() && extra && extra->topextra
- && !extra->topextra->inTopLevelResize;
- if (setTopLevelResize)
- extra->topextra->inTopLevelResize = true;
- QResizeEvent e(q->size(), oldSize);
- QApplication::sendEvent(q, &e);
- if (!q->testAttribute(Qt::WA_StaticContents) && q->internalWinId())
- q->internalWinId()->DrawDeferred();
- if (setTopLevelResize)
- extra->topextra->inTopLevelResize = false;
- }
- } else {
- if (isMove && q->pos() != oldPos)
- q->setAttribute(Qt::WA_PendingMoveEvent, true);
- if (isResize)
- q->setAttribute(Qt::WA_PendingResizeEvent, true);
- }
-}
-
-void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool destroyOldWindow)
-{
- Q_Q(QWidget);
-
- Qt::WindowType type = q->windowType();
- Qt::WindowFlags &flags = data.window_flags;
- QWidget *parentWidget = q->parentWidget();
-
- bool topLevel = (flags & Qt::Window);
- bool popup = (type == Qt::Popup);
- bool dialog = (type == Qt::Dialog
- || type == Qt::Sheet
- || (flags & Qt::MSWindowsFixedSizeDialogHint));
- bool desktop = (type == Qt::Desktop);
- //bool tool = (type == Qt::Tool || type == Qt::Drawer);
-
- if (popup)
- flags |= Qt::WindowStaysOnTopHint; // a popup stays on top
-
- TRect clientRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
- int sw = clientRect.Width();
- int sh = clientRect.Height();
-
- if (desktop) {
- symbianScreenNumber = qMax(qt_symbian_create_desktop_on_screen, 0);
- TSize screenSize = S60->screenDevice(symbianScreenNumber)->SizeInPixels();
- data.crect.setRect(0, 0, screenSize.iWidth, screenSize.iHeight);
- q->setAttribute(Qt::WA_DontShowOnScreen);
- } else if (topLevel && !q->testAttribute(Qt::WA_Resized)){
- int width = sw;
- int height = sh;
- if (symbianScreenNumber > 0) {
- TSize screenSize = S60->screenDevice(symbianScreenNumber)->SizeInPixels();
- width = screenSize.iWidth;
- height = screenSize.iHeight;
- }
- if (extra) {
- width = qMax(qMin(width, extra->maxw), extra->minw);
- height = qMax(qMin(height, extra->maxh), extra->minh);
- }
- data.crect.setSize(QSize(width, height));
- }
-
- CCoeControl *const destroyw = destroyOldWindow ? data.winid : 0;
-
- createExtra();
- if (window) {
- setWinId(window);
- TRect tr = window->Rect();
- data.crect.setRect(tr.iTl.iX, tr.iTl.iY, tr.Width(), tr.Height());
-
- } else if (topLevel) {
- if (!q->testAttribute(Qt::WA_Moved) && !q->testAttribute(Qt::WA_DontShowOnScreen))
- data.crect.moveTopLeft(QPoint(clientRect.iTl.iX, clientRect.iTl.iY));
-
- QScopedPointer<QSymbianControl> control( new QSymbianControl(q) );
- Q_CHECK_PTR(control);
-
- QT_TRAP_THROWING(control->ConstructL(true, desktop));
- control->SetMopParent(static_cast<CEikAppUi*>(S60->appUi()));
-
- // Symbian windows are always created in an inactive state
- // We perform this assignment for the case where the window is being re-created
- // as a result of a call to setParent_sys, on either this widget or one of its
- // ancestors.
- extra->activated = 0;
-
- if (!desktop) {
- TInt stackingFlags;
- if ((q->windowType() & Qt::Popup) == Qt::Popup) {
- stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus;
- } else {
- stackingFlags = ECoeStackFlagStandard;
- }
- control->MakeVisible(false);
- QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control.data(), ECoeStackPriorityDefault, stackingFlags));
- // Avoid keyboard focus to a hidden window.
- control->setFocusSafely(false);
-
- RDrawableWindow *const drawableWindow = control->DrawableWindow();
- // Request mouse move events.
- drawableWindow->PointerFilter(EPointerFilterEnterExit
- | EPointerFilterMove | EPointerFilterDrag, 0);
- drawableWindow->EnableVisibilityChangeEvents();
-
- }
-
- q->setAttribute(Qt::WA_WState_Created);
-
- int x, y, w, h;
- data.crect.getRect(&x, &y, &w, &h);
- control->SetRect(TRect(TPoint(x, y), TSize(w, h)));
-
- // We wait until the control is fully constructed before calling setWinId, because
- // this generates a WinIdChanged event.
- setWinId(control.take());
-
- if (!desktop)
- s60UpdateIsOpaque(); // must be called after setWinId()
-
- } else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create native child widget
-
- QScopedPointer<QSymbianControl> control( new QSymbianControl(q) );
- Q_CHECK_PTR(control);
-
- QT_TRAP_THROWING(control->ConstructL(!parentWidget));
-
- // Symbian windows are always created in an inactive state
- // We perform this assignment for the case where the window is being re-created
- // as a result of a call to setParent_sys, on either this widget or one of its
- // ancestors.
- extra->activated = 0;
-
- TInt stackingFlags;
- if ((q->windowType() & Qt::Popup) == Qt::Popup) {
- stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus;
- } else {
- stackingFlags = ECoeStackFlagStandard;
- }
- control->MakeVisible(false);
- QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control.data(), ECoeStackPriorityDefault, stackingFlags));
- // Avoid keyboard focus to a hidden window.
- control->setFocusSafely(false);
-
- q->setAttribute(Qt::WA_WState_Created);
- int x, y, w, h;
- data.crect.getRect(&x, &y, &w, &h);
- control->SetRect(TRect(TPoint(x, y), TSize(w, h)));
-
- RDrawableWindow *const drawableWindow = control->DrawableWindow();
- // Request mouse move events.
- drawableWindow->PointerFilter(EPointerFilterEnterExit
- | EPointerFilterMove | EPointerFilterDrag, 0);
- drawableWindow->EnableVisibilityChangeEvents();
-
- if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) {
- activateSymbianWindow(control.data());
- control->MakeVisible(true);
- }
-
- // We wait until the control is fully constructed before calling setWinId, because
- // this generates a WinIdChanged event.
- setWinId(control.take());
- }
-
- if (destroyw) {
- destroyw->ControlEnv()->AppUi()->RemoveFromStack(destroyw);
-
- // Delay deletion of the control in case this function is called in the
- // context of a CONE event handler such as
- // CCoeControl::ProcessPointerEventL
- QMetaObject::invokeMethod(q, "_q_delayedDestroy",
- Qt::QueuedConnection, Q_ARG(WId, destroyw));
- }
-
- if (q->testAttribute(Qt::WA_AcceptTouchEvents))
- registerTouchWindow();
-}
-
-
-void QWidgetPrivate::show_sys()
-{
- Q_Q(QWidget);
-
- if (q->testAttribute(Qt::WA_OutsideWSRange))
- return;
-
- Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
-
- q->setAttribute(Qt::WA_Mapped);
-
- if (q->testAttribute(Qt::WA_DontShowOnScreen)) {
- invalidateBuffer(q->rect());
- return;
- }
-
- if (q->internalWinId()) {
- if (!extra->activated)
- activateSymbianWindow();
-
- QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId());
- const bool isFullscreen = q->windowState() & Qt::WindowFullScreen;
- const TBool cbaRequested = q->windowFlags() & Qt::WindowSoftkeysVisibleHint;
-
-#ifdef Q_WS_S60
- // Lazily initialize the S60 screen furniture when the first window is shown.
- if (q->isWindow() && !QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)
- && !S60->buttonGroupContainer() && !S60->statusPane()) {
-
- if (!q->testAttribute(Qt::WA_DontShowOnScreen)) {
-
- // Create the status pane and CBA here
- CEikAppUi *ui = static_cast<CEikAppUi *>(S60->appUi());
- MEikAppUiFactory *factory = CEikonEnv::Static()->AppUiFactory();
-
- 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)
- cba->MakeVisible(false);
-
- CEikButtonGroupContainer *oldCba = factory->SwapButtonGroup(cba);
- Q_ASSERT(!oldCba);
- S60->setButtonGroupContainer(cba);
-
- // If the creation of the first widget is delayed, for example by doing it
- // inside the event loop, S60 somehow "forgets" to set the visibility of the
- // toolbar (the three middle softkeys) when you flip the phone over, so we
- // need to do it ourselves to avoid a "hole" in the application, even though
- // Qt itself does not use the toolbar directly..
- CAknAppUi *appui = dynamic_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
- if (appui) {
- CAknToolbar *toolbar = appui->PopupToolbar();
- if (toolbar && !toolbar->IsVisible())
- toolbar->SetToolbarVisibility(ETrue);
- }
-
- CEikMenuBar *menuBar = new(ELeave) CEikMenuBar;
- menuBar->ConstructL(ui, 0, R_AVKON_MENUPANE_EMPTY);
- menuBar->SetMenuType(CEikMenuBar::EMenuOptions);
- S60->appUi()->AddToStackL(menuBar,ECoeStackPriorityMenu,ECoeStackFlagRefusesFocus);
-
- CEikMenuBar *oldMenu = factory->SwapMenuBar(menuBar);
- Q_ASSERT(!oldMenu);
- )
-
- if (S60->statusPane()) {
- // Use QDesktopWidget as the status pane observer to proxy for the AppUi.
- // Can't use AppUi directly because it privately inherits from MEikStatusPaneObserver.
- QSymbianControl *desktopControl = static_cast<QSymbianControl *>(QApplication::desktop()->winId());
- S60->statusPane()->SetObserver(desktopControl);
- if (isFullscreen) {
- const bool cbaVisible = S60->buttonGroupContainer() && S60->buttonGroupContainer()->IsVisible();
- S60->setStatusPaneAndButtonGroupVisibility(false, cbaVisible);
- if (cbaVisible) {
- // Fix window dimensions as without screen furniture they will have
- // defaulted to full screen dimensions initially.
- id->handleClientAreaChange();
- }
- }
- }
- }
- }
-#endif
-
- // Fill client area if maximized OR
- // Put window below status pane unless the window has an explicit position.
- if (!isFullscreen) {
- if (q->windowState() & Qt::WindowMaximized) {
- TRect r = static_cast<CEikAppUi*>(S60->appUi())->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->MakeVisible(true);
-
- if(q->isWindow()&&!q->testAttribute(Qt::WA_ShowWithoutActivating))
- id->setFocusSafely(true);
- }
-
- invalidateBuffer(q->rect());
-}
-
-void QWidgetPrivate::activateSymbianWindow(WId wid)
-{
- Q_Q(QWidget);
-
- Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- Q_ASSERT(q->testAttribute(Qt::WA_Mapped));
- Q_ASSERT(!extra->activated);
-
- if(!wid)
- wid = q->internalWinId();
-
- Q_ASSERT(wid);
-
- QT_TRAP_THROWING(wid->ActivateL());
- extra->activated = 1;
-}
-
-void QWidgetPrivate::hide_sys()
-{
- Q_Q(QWidget);
-
- Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- deactivateWidgetCleanup();
- QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId());
-
- if (id) {
- //Incorrect optimization - for popup windows, Qt's focus is moved before
- //hide_sys is called, resulting in the popup window keeping its elevated
- //position in the CONE control stack.
- //This can result in keyboard focus being in an invisible widget in some
- //conditions - e.g. QTBUG-4733
- //if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged()
- id->setFocusSafely(false);
- id->MakeVisible(false);
- if (QWidgetBackingStore *bs = maybeBackingStore())
- bs->releaseBuffer();
- } else {
- invalidateBuffer(q->rect());
- }
-
- q->setAttribute(Qt::WA_Mapped, false);
-}
-
-void QWidgetPrivate::setFocus_sys()
-{
- Q_Q(QWidget);
- if (q->testAttribute(Qt::WA_WState_Created) && q->window()->windowType() != Qt::Popup)
- if (!q->effectiveWinId()->IsFocused()) // Avoid unnecessry calls to FocusChanged()
- static_cast<QSymbianControl *>(q->effectiveWinId())->setFocusSafely(true);
-}
-
-void QWidgetPrivate::raise_sys()
-{
- Q_Q(QWidget);
-
- Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- if (q->internalWinId()) {
- q->internalWinId()->DrawableWindow()->SetOrdinalPosition(0);
-
- // If toplevel widget, raise app to foreground
- if (q->isWindow())
- S60->wsSession().SetWindowGroupOrdinalPosition(S60->windowGroup(q).Identifier(), 0);
- }
-}
-
-void QWidgetPrivate::lower_sys()
-{
- Q_Q(QWidget);
-
- Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- if (q->internalWinId()) {
- // If toplevel widget, lower app to background
- if (q->isWindow())
- S60->wsSession().SetWindowGroupOrdinalPosition(S60->windowGroup(q).Identifier(), -1);
- else
- q->internalWinId()->DrawableWindow()->SetOrdinalPosition(-1);
- }
-
- if (!q->isWindow())
- invalidateBuffer(q->rect());
-}
-
-void QWidgetPrivate::setModal_sys()
-{
-
-}
-
-void QWidgetPrivate::stackUnder_sys(QWidget* w)
-{
- Q_Q(QWidget);
- Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
-
- if (q->internalWinId() && w->internalWinId()) {
- RDrawableWindow *const thisWindow = q->internalWinId()->DrawableWindow();
- RDrawableWindow *const otherWindow = w->internalWinId()->DrawableWindow();
- thisWindow->SetOrdinalPosition(otherWindow->OrdinalPosition() + 1);
- }
-
- if (!q->isWindow() || !w->internalWinId())
- invalidateBuffer(q->rect());
-}
-
-void QWidgetPrivate::reparentChildren()
-{
- Q_Q(QWidget);
-
- QObjectList chlist = q->children();
- for (int i = 0; i < chlist.size(); ++i) { // reparent children
- QObject *obj = chlist.at(i);
- if (obj->isWidgetType()) {
- QWidget *w = (QWidget *)obj;
- if (!w->testAttribute(Qt::WA_WState_Created))
- continue;
- if (!w->isWindow()) {
- w->d_func()->invalidateBuffer(w->rect());
- WId parent = q->effectiveWinId();
- WId child = w->effectiveWinId();
- if (parent != child) {
- // Child widget is native. Because Symbian windows cannot be
- // re-parented, we must re-create the window.
- const WId window = 0;
- const bool initializeWindow = false;
- const bool destroyOldWindow = true;
- w->d_func()->create_sys(window, initializeWindow, destroyOldWindow);
- }
- // ### TODO: We probably also need to update the component array here
- w->d_func()->reparentChildren();
- } else {
- bool showIt = w->isVisible();
- QPoint old_pos = w->pos();
- w->setParent(q, w->windowFlags());
- w->move(old_pos);
- if (showIt)
- w->show();
- }
- }
- }
-}
-
-void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
-{
- Q_Q(QWidget);
-
- if (parent && parent->windowType() == Qt::Desktop) {
- symbianScreenNumber = qt_widget_private(parent)->symbianScreenNumber;
- parent = 0;
- }
-
- bool wasCreated = q->testAttribute(Qt::WA_WState_Created);
-
- if (q->isVisible() && q->parentWidget() && parent != q->parentWidget())
- q->parentWidget()->d_func()->invalidateBuffer(q->geometry());
-
- if (q->testAttribute(Qt::WA_DropSiteRegistered))
- q->setAttribute(Qt::WA_DropSiteRegistered, false);
-
- QSymbianControl *old_winid = static_cast<QSymbianControl *>(wasCreated ? data.winid : 0);
- if ((q->windowType() == Qt::Desktop))
- old_winid = 0;
-
- // old_winid may not have received a 'not visible' visibility
- // changed event before being destroyed; make sure that it is
- // removed from the backing store's list of visible windows.
- if (old_winid)
- S60->controlVisibilityChanged(old_winid, false);
-
- setWinId(0);
-
- // hide and reparent our own window away. Otherwise we might get
- // destroyed when emitting the child remove event below. See QWorkspace.
- if (wasCreated && old_winid) {
- old_winid->MakeVisible(false);
- if (old_winid->IsFocused()) // Avoid unnecessary calls to FocusChanged()
- old_winid->setFocusSafely(false);
- old_winid->SetParent(0);
- }
-
- QObjectPrivate::setParent_helper(parent);
- bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide);
-
- data.window_flags = f;
- data.fstrut_dirty = true;
- q->setAttribute(Qt::WA_WState_Created, false);
- q->setAttribute(Qt::WA_WState_Visible, false);
- q->setAttribute(Qt::WA_WState_Hidden, false);
- adjustFlags(data.window_flags, q);
- // keep compatibility with previous versions, we need to preserve the created state
- // (but we recreate the winId for the widget being reparented, again for compatibility)
- if (wasCreated || (!q->isWindow() && parent->testAttribute(Qt::WA_WState_Created)))
- createWinId();
- if (q->isWindow() || (!parent || parent->isVisible()) || explicitlyHidden)
- q->setAttribute(Qt::WA_WState_Hidden);
- q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden);
-
- if (wasCreated)
- reparentChildren();
-
- if (old_winid) {
- CBase::Delete(old_winid);
- }
-
- if (q->testAttribute(Qt::WA_AcceptDrops)
- || (!q->isWindow() && q->parentWidget() && q->parentWidget()->testAttribute(Qt::WA_DropSiteRegistered)))
- q->setAttribute(Qt::WA_DropSiteRegistered, true);
-
- invalidateBuffer(q->rect());
-}
-
-void QWidgetPrivate::setConstraints_sys()
-{
-
-}
-
-
-void QWidgetPrivate::s60UpdateIsOpaque()
-{
- Q_Q(QWidget);
-
- if (!q->testAttribute(Qt::WA_WState_Created))
- return;
-
- const bool writeAlpha = extraData()->nativePaintMode == QWExtra::BlitWriteAlpha;
- if (!q->testAttribute(Qt::WA_TranslucentBackground) && !writeAlpha)
- return;
- const bool requireAlphaChannel = !isOpaque || writeAlpha;
-
- createTLExtra();
-
- RWindow *const window = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow());
-
-#ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE
- if (QApplicationPrivate::instance()->useTranslucentEGLSurfaces) {
- window->SetSurfaceTransparency(!isOpaque);
- extra->topextra->nativeWindowTransparencyEnabled = !isOpaque;
- return;
- }
-#endif
- if (requireAlphaChannel) {
- const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA));
- if (window->SetTransparencyAlphaChannel() == KErrNone) {
- window->SetBackgroundColor(TRgb(255, 255, 255, 0));
- extra->topextra->nativeWindowTransparencyEnabled = 1;
- if (extra->topextra->backingStore.data() && (
- QApplicationPrivate::graphics_system_name == QLatin1String("openvg")
- || QApplicationPrivate::graphics_system_name == QLatin1String("opengl"))) {
- // Semi-transparent EGL surfaces aren't supported. We need to
- // recreate backing store to get translucent surface (raster surface).
- extra->topextra->backingStore.create(q);
- extra->topextra->backingStore.registerWidget(q);
- // FixNativeOrientation() will not work without an EGL surface.
- q->setAttribute(Qt::WA_SymbianNoSystemRotation, false);
- }
- }
- } else if (extra->topextra->nativeWindowTransparencyEnabled) {
- window->SetTransparentRegion(TRegionFix<1>());
- extra->topextra->nativeWindowTransparencyEnabled = 0;
- }
-}
-
-void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
-{
-#ifdef Q_WS_S60
- Q_Q(QWidget);
-
- if (!q->testAttribute(Qt::WA_WState_Created) || !q->isWindow() )
- return;
-
- QTLWExtra* topData = this->topData();
- if (topData->iconPixmap && !forceReset)
- // already been set
- return;
-
- TRect cPaneRect;
- TBool found = AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EContextPane, cPaneRect );
- CAknContextPane* contextPane = S60->contextPane();
- if (found && contextPane) { // We have context pane with valid metrics
- QIcon icon = q->windowIcon();
- if (!icon.isNull()) {
- // Valid icon -> set it as an context pane picture
- QSize size = icon.actualSize(QSize(cPaneRect.Size().iWidth, cPaneRect.Size().iHeight));
- QPixmap pm = icon.pixmap(size);
- QBitmap mask = pm.mask();
- if (mask.isNull()) {
- mask = QBitmap(pm.size());
- mask.fill(Qt::color1);
- }
-
- CFbsBitmap* nBitmap = pm.toSymbianCFbsBitmap();
- CFbsBitmap* nMask = mask.toSymbianCFbsBitmap();
- contextPane->SetPicture(nBitmap,nMask);
- } else {
- // Icon set to null -> set context pane picture to default
- QT_TRAP_THROWING(contextPane->SetPictureToDefaultL());
- }
- } else {
- // Context pane does not exist, try setting small icon to title pane
- TRect titlePaneRect;
- TBool found = AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::ETitlePane, titlePaneRect );
- CAknTitlePane* titlePane = S60->titlePane();
- if (found && titlePane) { // We have title pane with valid metrics
- // The API to get title_pane graphics size is not public -> assume square space based
- // on titlebar font height. CAknBitmap would be optimum, wihtout setting the size, since
- // then title pane would automatically scale the bitmap. Unfortunately it is not public API
- // Also this function is leaving, although it is not named as such.
- const CFont * font;
- QT_TRAP_THROWING(font = AknLayoutUtils::FontFromId(EAknLogicalFontTitleFont));
- TSize iconSize(font->HeightInPixels(), font->HeightInPixels());
-
- QIcon icon = q->windowIcon();
- if (!icon.isNull()) {
- // Valid icon -> set it as an title pane small picture
- QSize size = icon.actualSize(QSize(iconSize.iWidth, iconSize.iHeight));
- QPixmap pm = icon.pixmap(size);
- QBitmap mask = pm.mask();
- if (mask.isNull()) {
- mask = QBitmap(pm.size());
- mask.fill(Qt::color1);
- }
-
- CFbsBitmap* nBitmap = pm.toSymbianCFbsBitmap();
- CFbsBitmap* nMask = mask.toSymbianCFbsBitmap();
- titlePane->SetSmallPicture( nBitmap, nMask, ETrue );
- } else {
- // Icon set to null -> set context pane picture to default
- titlePane->SetSmallPicture( NULL, NULL, EFalse );
- }
- }
- }
-
-#else
- Q_UNUSED(forceReset)
-#endif
-}
-
-void QWidgetPrivate::setWindowTitle_sys(const QString &caption)
-{
-#ifdef Q_WS_S60
- Q_Q(QWidget);
- if (q->isWindow()) {
- Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- CAknTitlePane* titlePane = S60->titlePane();
- if (titlePane) {
- if (caption.isEmpty()) {
- QT_TRAP_THROWING(titlePane->SetTextToDefaultL());
- } else {
- QT_TRAP_THROWING(titlePane->SetTextL(qt_QString2TPtrC(caption)));
- }
- }
- }
-#else
- Q_UNUSED(caption)
-#endif
-}
-
-void QWidgetPrivate::setWindowIconText_sys(const QString & /*iconText */)
-{
-
-}
-
-void QWidgetPrivate::scroll_sys(int dx, int dy)
-{
- Q_Q(QWidget);
-
- scrollChildren(dx, dy);
- if (!paintOnScreen() || !q->internalWinId() || !q->internalWinId()->OwnsWindow()) {
- scrollRect(q->rect(), dx, dy);
- } else {
- Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- RDrawableWindow *const window = q->internalWinId()->DrawableWindow();
- window->Scroll(TPoint(dx, dy));
- }
-}
-
-void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r)
-{
- Q_Q(QWidget);
-
- if (!paintOnScreen() || !q->internalWinId() || !q->internalWinId()->OwnsWindow()) {
- scrollRect(r, dx, dy);
- } else {
- Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- RDrawableWindow *const window = q->internalWinId()->DrawableWindow();
- window->Scroll(TPoint(dx, dy), qt_QRect2TRect(r));
- }
-}
-
-/*!
- For this function to work in the emulator, you must add:
- TRANSPARENCY
- To a line in the wsini.ini file.
-*/
-void QWidgetPrivate::setWindowOpacity_sys(qreal)
-{
- // ### TODO: Implement uniform window transparency
-}
-
-void QWidgetPrivate::updateFrameStrut()
-{
-
-}
-
-void QWidgetPrivate::updateSystemBackground()
-{
-
-}
-
-void QWidgetPrivate::registerDropSite(bool /* on */)
-{
-
-}
-
-void QWidgetPrivate::createTLSysExtra()
-{
- extra->topextra->inExpose = 0;
- extra->topextra->nativeWindowTransparencyEnabled = 0;
-}
-
-void QWidgetPrivate::deleteTLSysExtra()
-{
- extra->topextra->backingStore.destroy();
-}
-
-void QWidgetPrivate::createSysExtra()
-{
- extra->activated = 0;
- extra->nativePaintMode = QWExtra::Default;
- extra->receiveNativePaintEvents = 0;
-}
-
-void QWidgetPrivate::deleteSysExtra()
-{
- // this should only be non-zero if destroy() has not run due to constructor fail
- if (data.winid) {
- data.winid->ControlEnv()->AppUi()->RemoveFromStack(data.winid);
- delete data.winid;
- data.winid = 0;
- }
-}
-
-QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys()
-{
- return new QS60WindowSurface(q_func());
-}
-
-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());
- QSymbianControl *window = static_cast<QSymbianControl *>(q->effectiveWinId());
- //Enabling advanced pointer events for controls that already have active windows causes a panic.
- if (!window->isControlActive())
- rwindow->EnableAdvancedPointers();
- }
-#endif
-}
-
-int QWidget::metric(PaintDeviceMetric m) const
-{
- Q_D(const QWidget);
- int val;
- if (m == PdmWidth) {
- val = data->crect.width();
- } else if (m == PdmHeight) {
- val = data->crect.height();
- } else {
- CWsScreenDevice *scr = S60->screenDevice(this);
- switch(m) {
- case PdmDpiX:
- case PdmPhysicalDpiX:
- if (d->extra && d->extra->customDpiX) {
- val = d->extra->customDpiX;
- } else {
- const QWidgetPrivate *p = d;
- while (p->parent) {
- p = static_cast<const QWidget *>(p->parent)->d_func();
- if (p->extra && p->extra->customDpiX) {
- val = p->extra->customDpiX;
- break;
- }
- }
- if (p == d || !(p->extra && p->extra->customDpiX))
- val = S60->defaultDpiX;
- }
- break;
- case PdmDpiY:
- case PdmPhysicalDpiY:
- if (d->extra && d->extra->customDpiY) {
- val = d->extra->customDpiY;
- } else {
- const QWidgetPrivate *p = d;
- while (p->parent) {
- p = static_cast<const QWidget *>(p->parent)->d_func();
- if (p->extra && p->extra->customDpiY) {
- val = p->extra->customDpiY;
- break;
- }
- }
- if (p == d || !(p->extra && p->extra->customDpiY))
- val = S60->defaultDpiY;
- }
- break;
- case PdmWidthMM:
- {
- TInt twips = scr->HorizontalPixelsToTwips(data->crect.width());
- val = (int)(twips * (25.4/KTwipsPerInch));
- break;
- }
- case PdmHeightMM:
- {
- TInt twips = scr->VerticalPixelsToTwips(data->crect.height());
- val = (int)(twips * (25.4/KTwipsPerInch));
- break;
- }
- case PdmNumColors:
- val = TDisplayModeUtils::NumDisplayModeColors(scr->DisplayMode());
- break;
- case PdmDepth:
- val = TDisplayModeUtils::NumDisplayModeBitsPerPixel(scr->DisplayMode());
- break;
- default:
- val = 0;
- qWarning("QWidget::metric: Invalid metric command");
- }
- }
- return val;
-}
-
-QPaintEngine *QWidget::paintEngine() const
-{
- return 0;
-}
-
-QPoint QWidget::mapToGlobal(const QPoint &pos) const
-{
- Q_D(const QWidget);
- if (!testAttribute(Qt::WA_WState_Created) || !internalWinId()) {
-
- QPoint p = pos + data->crect.topLeft();
- return (isWindow() || !parentWidget()) ? p : parentWidget()->mapToGlobal(p);
-
- } else if ((d->data.window_flags & Qt::Window) && internalWinId()) { //toplevel
- QPoint tp = geometry().topLeft();
- return pos + tp;
- }
-
- // Native window case
- const TPoint widgetScreenOffset = internalWinId()->PositionRelativeToScreen();
- const QPoint globalPos = QPoint(widgetScreenOffset.iX, widgetScreenOffset.iY) + pos;
- return globalPos;
-}
-
-QPoint QWidget::mapFromGlobal(const QPoint &pos) const
-{
- Q_D(const QWidget);
- if (!testAttribute(Qt::WA_WState_Created) || !internalWinId()) {
- QPoint p = (isWindow() || !parentWidget()) ? pos : parentWidget()->mapFromGlobal(pos);
- return p - data->crect.topLeft();
- } else if ((d->data.window_flags & Qt::Window) && internalWinId()) { //toplevel
- QPoint tp = geometry().topLeft();
- return pos - tp;
- }
-
- // Native window case
- const TPoint widgetScreenOffset = internalWinId()->PositionRelativeToScreen();
- const QPoint widgetPos = pos - QPoint(widgetScreenOffset.iX, widgetScreenOffset.iY);
- return widgetPos;
-}
-
-static Qt::WindowStates effectiveState(Qt::WindowStates state)
-{
- if (state & Qt::WindowMinimized)
- return Qt::WindowMinimized;
- else if (state & Qt::WindowFullScreen)
- return Qt::WindowFullScreen;
- else if (state & Qt::WindowMaximized)
- return Qt::WindowMaximized;
- return Qt::WindowNoState;
-}
-
-void QWidget::setWindowState(Qt::WindowStates newstate)
-{
- Q_D(QWidget);
-
- Qt::WindowStates oldstate = windowState();
-
- const TBool isFullscreen = newstate & Qt::WindowFullScreen;
-#ifdef Q_WS_S60
- const TBool cbaRequested = windowFlags() & Qt::WindowSoftkeysVisibleHint;
- const TBool cbaVisible = CEikButtonGroupContainer::Current() ? true : false;
- const TBool softkeyVisibilityChange = isFullscreen && (cbaRequested != cbaVisible);
-
- if (oldstate == newstate && !softkeyVisibilityChange)
- return;
-#endif // Q_WS_S60
-
- if (isWindow()) {
- createWinId();
- Q_ASSERT(testAttribute(Qt::WA_WState_Created));
-
- const bool wasResized = testAttribute(Qt::WA_Resized);
- const bool wasMoved = testAttribute(Qt::WA_Moved);
-
- QSymbianControl *window = static_cast<QSymbianControl *>(effectiveWinId());
- if (window && newstate & Qt::WindowMinimized) {
- window->setFocusSafely(false);
- window->MakeVisible(false);
- } else if (window && oldstate & Qt::WindowMinimized) {
- window->setFocusSafely(true);
- window->MakeVisible(true);
- }
-
-#ifdef Q_WS_S60
- // The window decoration visibility has to be changed before doing actual window state
- // change since in that order the availableGeometry will return directly the right size and
- // we will avoid unnecessary redraws
- bool decorationsVisible = S60->setRecursiveDecorationsVisibility(this, newstate);
-#endif // Q_WS_S60
-
- // Ensure the initial size is valid, since we store it as normalGeometry below.
- if (!wasResized && !isVisible())
- adjustSize();
-
- QTLWExtra *top = d->topData();
- QRect normalGeometry = (top->normalGeometry.width() < 0) ? geometry() : top->normalGeometry;
-
- const bool cbaVisibilityHint = windowFlags() & Qt::WindowSoftkeysVisibleHint;
- if (newstate & Qt::WindowFullScreen && !cbaVisibilityHint) {
- setAttribute(Qt::WA_OutsideWSRange, false);
- if (d->symbianScreenNumber > 0) {
- int w = S60->screenWidthInPixelsForScreen[d->symbianScreenNumber];
- int h = S60->screenHeightInPixelsForScreen[d->symbianScreenNumber];
- if (w <= 0 || h <= 0)
- window->SetExtentToWholeScreen();
- else
- window->SetExtent(TPoint(0, 0), TSize(w, h));
- } else {
- window->SetExtentToWholeScreen();
- }
- } else if (newstate & Qt::WindowMaximized || ((newstate & Qt::WindowFullScreen) && cbaVisibilityHint)) {
- setAttribute(Qt::WA_OutsideWSRange, false);
- TRect maxExtent = qt_QRect2TRect(qApp->desktop()->availableGeometry(this));
- window->SetExtent(maxExtent.iTl, maxExtent.Size());
- } else {
-#ifdef Q_WS_S60
- // With delayed creation of S60 app panes, the normalGeometry calculated above is not
- // accurate because it did not consider the status pane. This means that when returning
- // 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;
- normalGeometry.setTopLeft(QPoint(tl.iX, tl.iY));
- }
-#endif
- setGeometry(normalGeometry);
- }
-
- //restore normal geometry
- top->normalGeometry = normalGeometry;
-
- // FixMe QTBUG-8977
- // In some platforms, WA_Resized and WA_Moved are also not set when application window state is
- // anything else than normal. In Symbian we can restore them only for normal window state since
- // restoring for other modes, will make fluidlauncher to be launched in wrong size (200x100)
- if (effectiveState(newstate) == Qt::WindowNoState) {
- setAttribute(Qt::WA_Resized, wasResized);
- setAttribute(Qt::WA_Moved, wasMoved);
- }
- }
-
- data->window_state = newstate;
-
- if (newstate & Qt::WindowActive)
- activateWindow();
-
- if (isWindow()) {
- // Now that the new state is set, fix the display memory layout, if needed.
- QSymbianControl *window = static_cast<QSymbianControl *>(effectiveWinId());
- window->ensureFixNativeOrientation();
- }
-
- QWindowStateChangeEvent e(oldstate);
- QApplication::sendEvent(this, &e);
-}
-
-
-void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
-{
- Q_D(QWidget);
- d->aboutToDestroy();
- if (!isWindow() && parentWidget())
- parentWidget()->d_func()->invalidateBuffer(geometry());
- d->deactivateWidgetCleanup();
- QSymbianControl *id = static_cast<QSymbianControl *>(internalWinId());
- if (testAttribute(Qt::WA_WState_Created)) {
-
-#ifndef QT_NO_IM
- if (d->ic) {
- delete d->ic;
- } else {
- QInputContext *ic = QApplicationPrivate::inputContext;
- if (ic) {
- ic->widgetDestroyed(this);
- }
- }
-#endif
-
- if (QWidgetPrivate::mouseGrabber == this)
- releaseMouse();
- if (QWidgetPrivate::keyboardGrabber == this)
- releaseKeyboard();
- setAttribute(Qt::WA_WState_Created, false);
- QObjectList childList = children();
- for (int i = 0; i < childList.size(); ++i) { // destroy all widget children
- register QObject *obj = childList.at(i);
- if (obj->isWidgetType())
- static_cast<QWidget*>(obj)->destroy(destroySubWindows,
- destroySubWindows);
- }
- if (destroyWindow && !(windowType() == Qt::Desktop) && id) {
- if (id->IsFocused()) // Avoid unnecessry calls to FocusChanged()
- id->setFocusSafely(false);
- id->ControlEnv()->AppUi()->RemoveFromStack(id);
- }
- }
-
- QT_TRY {
- d->setWinId(0);
- } QT_CATCH (const std::bad_alloc &) {
- // swallow - destructors must not throw
- }
-
- if (destroyWindow) {
- delete id;
- // At this point the backing store should already be destroyed
- // so we flush the command buffer to ensure that the freeing of
- // those resources and deleting the window can happen "atomically"
- if (qApp)
- S60->wsSession().Flush();
- }
-}
-
-QWidget *QWidget::mouseGrabber()
-{
- return QWidgetPrivate::mouseGrabber;
-}
-
-QWidget *QWidget::keyboardGrabber()
-{
- return QWidgetPrivate::keyboardGrabber;
-}
-
-void QWidget::grabKeyboard()
-{
- if (!qt_nograb()) {
- if (QWidgetPrivate::keyboardGrabber && QWidgetPrivate::keyboardGrabber != this)
- QWidgetPrivate::keyboardGrabber->releaseKeyboard();
-
- // ### TODO: Native keyboard grab
-
- QWidgetPrivate::keyboardGrabber = this;
- }
-}
-
-void QWidget::releaseKeyboard()
-{
- if (!qt_nograb() && QWidgetPrivate::keyboardGrabber == this) {
- // ### TODO: Native keyboard release
- QWidgetPrivate::keyboardGrabber = 0;
- }
-}
-
-void QWidget::grabMouse()
-{
- if (isVisible() && !qt_nograb()) {
- if (QWidgetPrivate::mouseGrabber && QWidgetPrivate::mouseGrabber != this)
- QWidgetPrivate::mouseGrabber->releaseMouse();
- Q_ASSERT(testAttribute(Qt::WA_WState_Created));
- WId id = effectiveWinId();
- id->SetPointerCapture(true);
- QWidgetPrivate::mouseGrabber = this;
-
-#ifndef QT_NO_CURSOR
- QApplication::setOverrideCursor(cursor());
-#endif
- }
-}
-
-#ifndef QT_NO_CURSOR
-void QWidget::grabMouse(const QCursor &cursor)
-{
- if (isVisible() && !qt_nograb()) {
- if (QWidgetPrivate::mouseGrabber && QWidgetPrivate::mouseGrabber != this)
- QWidgetPrivate::mouseGrabber->releaseMouse();
- Q_ASSERT(testAttribute(Qt::WA_WState_Created));
- WId id = effectiveWinId();
- id->SetPointerCapture(true);
- QWidgetPrivate::mouseGrabber = this;
-
- QApplication::setOverrideCursor(cursor);
- }
-}
-#endif
-
-void QWidget::releaseMouse()
-{
- if (!qt_nograb() && QWidgetPrivate::mouseGrabber == this) {
- Q_ASSERT(testAttribute(Qt::WA_WState_Created));
- if(!window()->isModal()) {
- WId id = effectiveWinId();
- id->SetPointerCapture(false);
- }
- QWidgetPrivate::mouseGrabber = 0;
-#ifndef QT_NO_CURSOR
- QApplication::restoreOverrideCursor();
-#endif
- }
-}
-
-void QWidget::activateWindow()
-{
- Q_D(QWidget);
-
- QWidget *tlw = window();
- if (tlw->isVisible()) {
- window()->createWinId();
- QSymbianControl *id = static_cast<QSymbianControl *>(tlw->internalWinId());
- if (!id->IsFocused())
- id->setFocusSafely(true);
- }
-}
-
-#ifndef QT_NO_CURSOR
-
-void QWidgetPrivate::setCursor_sys(const QCursor &cursor)
-{
- Q_UNUSED(cursor);
- Q_Q(QWidget);
- qt_symbian_set_cursor(q, false);
-}
-
-void QWidgetPrivate::unsetCursor_sys()
-{
- Q_Q(QWidget);
- qt_symbian_set_cursor(q, false);
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/widgets/s60framework/qs60mainapplication.cpp b/src/widgets/s60framework/qs60mainapplication.cpp
deleted file mode 100644
index 6be08957fe..0000000000
--- a/src/widgets/s60framework/qs60mainapplication.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 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$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// INCLUDE FILES
-#include <exception>
-#include <private/qcore_symbian_p.h>
-#include "qs60maindocument.h"
-#include "qs60mainapplication_p.h"
-#include "qs60mainapplication.h"
-#include <bautils.h>
-#include <coemain.h>
-#ifndef Q_WS_S60
-# include <eikserverapp.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-/**
- * factory function to create the QS60Main application class
- */
-CApaApplication *newS60Application()
-{
- return new QS60MainApplication;
-}
-
-
-/*!
- \class QS60MainApplication
- \since 4.6
- \brief The QS60MainApplication class provides support for migration from S60.
-
- \inmodule QtWidgets
-
- \warning This class is provided only to get access to S60 specific
- functionality in the application framework classes. It is not
- portable. We strongly recommend against using it in new applications.
-
- 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 CEikApplication class from
- Symbian, but internally provides extensions used by Qt.
-
- When modifying old S60 applications that rely on implementing
- functions in \c CEikApplication, the class should be modified to
- inherit from this class instead of \c CEikApplication. Then the
- application can choose to override only certain functions. To make
- Qt use the custom application objects, pass a factory function to
- \c{QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **)}.
-
- For more information on \c CEikApplication, please see the S60 documentation.
-
- Unlike other Qt classes, QS60MainApplication behaves like an S60 class, and can throw Symbian
- leaves.
-
- \sa QS60MainDocument, QS60MainAppUi, QApplication::QS60MainApplicationFactory
- */
-
-/*!
- * \brief Contructs an instance of QS60MainApplication.
- */
-QS60MainApplication::QS60MainApplication()
-{
-}
-
-/*!
- * \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 new (ELeave) QS60MainDocument(*this);
-}
-
-
-/*!
- * \brief Returns the UID of the application.
- */
-TUid QS60MainApplication::AppDllUid() const
-{
- // Return the UID for the QtS60Main application
- return RProcess().SecureId().operator TUid();
-}
-
-/*!
- * \brief Returns the resource file name.
- */
-TFileName QS60MainApplication::ResourceFileName() const
-{
- return KNullDesC();
-}
-
-/*!
- \internal
-*/
-void QS60MainApplication::PreDocConstructL()
-{
- QS60MainApplicationBase::PreDocConstructL();
-}
-
-/*!
- \internal
-*/
-CDictionaryStore *QS60MainApplication::OpenIniFileLC(RFs &aFs) const
-{
- return QS60MainApplicationBase::OpenIniFileLC(aFs);
-}
-
-/*!
- \internal
-*/
-void QS60MainApplication::NewAppServerL(CApaAppServer *&aAppServer)
-{
-#ifdef Q_WS_S60
- QS60MainApplicationBase::NewAppServerL(aAppServer);
-#else
- aAppServer = new(ELeave) CEikAppServer;
-#endif
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/s60framework/qs60mainapplication.h b/src/widgets/s60framework/qs60mainapplication.h
deleted file mode 100644
index 2e06181b86..0000000000
--- a/src/widgets/s60framework/qs60mainapplication.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 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$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QS60MAINAPPLICATION_H
-#define QS60MAINAPPLICATION_H
-
-#include <QtCore/qglobal.h>
-
-#ifdef Q_OS_SYMBIAN
-
-#ifdef Q_WS_S60
-#include <aknapp.h>
-typedef CAknApplication QS60MainApplicationBase;
-#else
-#include <eikapp.h>
-typedef CEikApplication QS60MainApplicationBase;
-#endif
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class Q_WIDGETS_EXPORT QS60MainApplication : public QS60MainApplicationBase
-{
-public:
- QS60MainApplication();
- // The virtuals are for qdoc.
- virtual ~QS60MainApplication();
-
- virtual TUid AppDllUid() const;
-
- virtual TFileName ResourceFileName() const;
-
-public:
-
- virtual void PreDocConstructL();
-
- virtual CDictionaryStore *OpenIniFileLC(RFs &aFs) const;
-
- virtual void NewAppServerL(CApaAppServer *&aAppServer);
-
-protected:
-
- virtual CApaDocument *CreateDocumentL();
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // Q_OS_SYMBIAN
-
-#endif // QS60MAINAPPLICATION_H
diff --git a/src/widgets/s60framework/qs60mainapplication_p.h b/src/widgets/s60framework/qs60mainapplication_p.h
deleted file mode 100644
index 3568f6d475..0000000000
--- a/src/widgets/s60framework/qs60mainapplication_p.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QS60MAINAPPLICATION_P_H
-#define QS60MAINAPPLICATION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// 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.
-//
-
-#include <qglobal.h>
-
-#include <apparc.h>
-
-QT_BEGIN_NAMESPACE
-
-CApaApplication *newS60Application();
-
-QT_END_NAMESPACE
-
-#endif // QS60MAINAPPLICATION_P_H
diff --git a/src/widgets/s60framework/qs60mainappui.cpp b/src/widgets/s60framework/qs60mainappui.cpp
deleted file mode 100644
index 5759bc68f6..0000000000
--- a/src/widgets/s60framework/qs60mainappui.cpp
+++ /dev/null
@@ -1,432 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 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$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// INCLUDE FILES
-#include <exception>
-#include <qglobal.h>
-#ifdef Q_WS_S60
-#include <avkon.hrh>
-#include <eikmenub.h>
-#include <eikmenup.h>
-#include <avkon.rsg>
-#endif
-#include <barsread.h>
-#include <coeutils.h>
-#include <qconfig.h>
-
-#include "qs60mainappui.h"
-#include <QtWidgets/qapplication.h>
-#include <QtWidgets/qsymbianevent.h>
-#include <QtWidgets/qmenu.h>
-#include <private/qmenu_p.h>
-#include <private/qt_s60_p.h>
-#include <qdebug.h>
-
-//Animated wallpapers in Qt applications are not supported.
-const TInt KAknDisableAnimationBackground = 0x02000000;
-const TInt KAknSingleClickCompatible = 0x01000000;
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QS60MainAppUi
- \since 4.6
- \brief The QS60MainAppUi class is a helper class for S60 migration.
-
- \inmodule QtWidgets
-
- \warning This class is provided only to get access to S60 specific
- functionality in the application framework classes. It is not
- portable. We strongly recommend against using it in new applications.
-
- 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
- // objects can still exist in static data at that point. Instead we will print relevant information
- // so that comparative checks may be made for memory leaks, using ~SPrintExitInfo in corelib.
- iEikonEnv->DisableExitChecks(ETrue);
-
- // Initialise app UI with standard value.
- // ENoAppResourceFile and ENonStandardResourceFile makes UI to work without
- // resource files in most SDKs. S60 3rd FP1 public seems to require resource file
- // even these flags are defined
- TInt flags = CEikAppUi::ENoScreenFurniture
- | CEikAppUi::ENonStandardResourceFile;
-#ifdef Q_WS_S60
- flags |= CAknAppUi::EAknEnableSkin;
- // After 5th Edition S60, native side supports animated wallpapers.
- // However, there is no support for that feature on Qt side, so indicate to
- // native UI framework that this application will not support background animations.
-
- // Also, add support for single touch for post 5th edition platforms.
- // This has only impact when launching native dialogs/menus from inside QApplication.
- if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) {
- flags |= (KAknDisableAnimationBackground | KAknSingleClickCompatible);
- }
-#endif
- BaseConstructL(flags);
-}
-
-/*!
- * \brief Contructs an instance of QS60MainAppUi.
- */
-QS60MainAppUi::QS60MainAppUi()
-{
- // No implementation required
-}
-
-/*!
- * \brief Destroys the QS60MainAppUi.
- */
-QS60MainAppUi::~QS60MainAppUi()
-{
-}
-
-/*!
- * \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) {
- QSymbianEvent event(QSymbianEvent::CommandEvent, command);
- QT_TRYCATCH_LEAVING(qApp->symbianProcessEvent(&event));
- }
-}
-
-/*!
- * \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)
-{
- QS60MainAppUiBase::HandleResourceChangeL(type);
-
- if (qApp) {
- QSymbianEvent event(QSymbianEvent::ResourceChangeEvent, type);
- QT_TRYCATCH_LEAVING(qApp->symbianProcessEvent(&event));
- }
-}
-
-/*!
- * \brief Handles raw window server events.
- *
- * The event type and information is passed in \a wsEvent, 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 &wsEvent, CCoeControl *destination)
-{
- int result = 0;
- if (qApp) {
- QSymbianEvent event(&wsEvent);
- QT_TRYCATCH_LEAVING(
- result = qApp->symbianProcessEvent(&event)
- );
- }
-
- if (result <= 0)
- QS60MainAppUiBase::HandleWsEventL(wsEvent, destination);
-}
-
-
-/*!
- * \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()
-{
- TRAP_IGNORE(HandleResourceChangeL(KInternalStatusPaneChange));
- HandleStackedControlsResourceChange(KInternalStatusPaneChange);
-}
-
-/*!
- * \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 */)
-{
-}
-
-/*!
- * \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)
-{
-#ifdef Q_WS_S60
- if (resourceId == R_AVKON_MENUPANE_EMPTY) {
- 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));
- }
-#else
- QS60MainAppUiBase::DynInitMenuPaneL(resourceId, menuPane);
-#endif
-}
-
-/*!
- * \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)
-{
-#ifdef Q_WS_S60
- if (resourceId >= QT_SYMBIAN_FIRST_MENU_ITEM && resourceId <= QT_SYMBIAN_LAST_MENU_ITEM) {
- if (menuType == EMenuPane)
- DynInitMenuPaneL(resourceId, (CEikMenuPane*)menuWindow);
- else
- DynInitMenuBarL(resourceId, (CEikMenuBar*)menuWindow);
- } else if(resourceId == R_AVKON_MENUPANE_EMPTY) {
- CEikMenuBarTitle *title = new(ELeave) CEikMenuBarTitle;
- CleanupStack::PushL(title);
-
- title->iData.iMenuPaneResourceId = R_AVKON_MENUPANE_EMPTY;
- title->iTitleFlags = 0;
-
- S60->menuBar()->TitleArray()->AddTitleL(title);
- CleanupStack::Pop( title );
- }
- else
-#endif
- {
- QS60MainAppUiBase::RestoreMenuL(menuWindow, resourceId, menuType);
- }
-}
-
-/*!
- \internal
-*/
-void QS60MainAppUi::Exit()
-{
- QS60MainAppUiBase::Exit();
-}
-
-/*!
- \internal
-*/
-void QS60MainAppUi::SetFadedL(TBool aFaded)
-{
- QS60MainAppUiBase::SetFadedL(aFaded);
-}
-
-/*!
- \internal
-*/
-TRect QS60MainAppUi::ApplicationRect() const
-{
- return QS60MainAppUiBase::ApplicationRect();
-}
-
-/*!
- \internal
-*/
-void QS60MainAppUi::HandleScreenDeviceChangedL()
-{
- QS60MainAppUiBase::HandleScreenDeviceChangedL();
-}
-
-/*!
- \internal
-*/
-void QS60MainAppUi::HandleApplicationSpecificEventL(TInt aType, const TWsEvent &aEvent)
-{
- QS60MainAppUiBase::HandleApplicationSpecificEventL(aType, aEvent);
-}
-
-/*!
- \internal
-*/
-TTypeUid::Ptr QS60MainAppUi::MopSupplyObject(TTypeUid aId)
-{
- return QS60MainAppUiBase::MopSupplyObject(aId);
-}
-
-/*!
- \internal
-*/
-void QS60MainAppUi::ProcessCommandL(TInt aCommand)
-{
- QS60MainAppUiBase::ProcessCommandL(aCommand);
-}
-
-/*!
- \internal
-*/
-TErrorHandlerResponse QS60MainAppUi::HandleError (TInt aError, const SExtendedError &aExtErr, TDes &aErrorText, TDes &aContextText)
-{
- return QS60MainAppUiBase::HandleError(aError, aExtErr, aErrorText, aContextText);
-}
-
-/*!
- \internal
-*/
-void QS60MainAppUi::HandleViewDeactivation(const TVwsViewId &aViewIdToBeDeactivated, const TVwsViewId &aNewlyActivatedViewId)
-{
- QS60MainAppUiBase::HandleViewDeactivation(aViewIdToBeDeactivated, aNewlyActivatedViewId);
-}
-
-/*!
- \internal
-*/
-void QS60MainAppUi::PrepareToExit()
-{
- QS60MainAppUiBase::PrepareToExit();
-}
-
-/*!
- \internal
-*/
-void QS60MainAppUi::HandleTouchPaneSizeChange()
-{
- QS60MainAppUiBase::HandleTouchPaneSizeChange();
-}
-
-/*!
- \internal
-*/
-void QS60MainAppUi::HandleSystemEventL(const TWsEvent &aEvent)
-{
- QS60MainAppUiBase::HandleSystemEventL(aEvent);
-}
-
-/*!
- \internal
-*/
-void QS60MainAppUi::Reserved_MtsmPosition()
-{
- QS60MainAppUiBase::Reserved_MtsmPosition();
-}
-
-/*!
- \internal
-*/
-void QS60MainAppUi::Reserved_MtsmObject()
-{
- QS60MainAppUiBase::Reserved_MtsmObject();
-}
-
-/*!
- \internal
-*/
-void QS60MainAppUi::HandleForegroundEventL(TBool aForeground)
-{
- QS60MainAppUiBase::HandleForegroundEventL(aForeground);
-}
-
-/*!
- \internal
-*/
-TBool QS60MainAppUi::ProcessCommandParametersL(TApaCommand /*aCommand*/, TFileName &/*aDocumentName*/, const TDesC8 &/*aTail*/)
-{
- // bypass CEikAppUi::ProcessCommandParametersL(..) which modifies aDocumentName, preventing apparc document opening from working.
- // The return value is effectively unused in Qt apps (see QS60MainDocument::OpenFileL)
- return EFalse;
-}
-
-#ifndef Q_WS_S60
-
-void QS60StubAknAppUi::HandleViewDeactivation(const TVwsViewId &, const TVwsViewId &) {}
-void QS60StubAknAppUi::HandleTouchPaneSizeChange() {}
-void QS60StubAknAppUi::HandleStatusPaneSizeChange() {}
-void QS60StubAknAppUi::Reserved_MtsmPosition() {}
-void QS60StubAknAppUi::Reserved_MtsmObject() {}
-
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/widgets/s60framework/qs60mainappui.h b/src/widgets/s60framework/qs60mainappui.h
deleted file mode 100644
index 7d5a265a2a..0000000000
--- a/src/widgets/s60framework/qs60mainappui.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 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$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QS60MAINAPPUI_H
-#define QS60MAINAPPUI_H
-
-#include <QtCore/qglobal.h>
-
-#ifdef Q_OS_SYMBIAN
-
-#ifdef Q_WS_S60
-#include <aknappui.h>
-typedef CAknAppUi QS60MainAppUiBase;
-#else
-#include <eikappui.h>
-// these stub classes simulate the structure of CAknAppUi, to help binary compatibility between Qt configured with and without S60/Avkon
-class QS60StubAknAppUiBase : public CEikAppUi
-{
-private:
- int qS60StubAknAppUiBaseSpace[4];
-};
-
-class QS60StubMEikStatusPaneObserver
-{
-public:
- virtual void HandleStatusPaneSizeChange() = 0;
-};
-
-class QS60StubMAknTouchPaneObserver
-{
-public:
- virtual void HandleTouchPaneSizeChange() = 0;
-};
-
-class QS60StubAknAppUi : public QS60StubAknAppUiBase, QS60StubMEikStatusPaneObserver,
- public MCoeViewDeactivationObserver,
- public QS60StubMAknTouchPaneObserver
-{
-public: // MCoeViewDeactivationObserver
- virtual void HandleViewDeactivation(const TVwsViewId&, const TVwsViewId &);
-
-public: // from MAknTouchPaneObserver
- virtual void HandleTouchPaneSizeChange();
-
-protected: // from MEikStatusPaneObserver
- virtual void HandleStatusPaneSizeChange();
-
-protected: // from CAknAppUi
- virtual void Reserved_MtsmPosition();
- virtual void Reserved_MtsmObject();
-
-private:
- int qS60StubAknAppUiSpace[4];
-};
-
-typedef QS60StubAknAppUi QS60MainAppUiBase;
-#endif
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class Q_WIDGETS_EXPORT QS60MainAppUi : public QS60MainAppUiBase
-{
-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);
-
-public:
- virtual void Exit();
- virtual void SetFadedL(TBool aFaded);
- virtual TRect ApplicationRect() const;
- virtual void ProcessCommandL(TInt aCommand);
- virtual TErrorHandlerResponse HandleError (TInt aError, const SExtendedError &aExtErr, TDes &aErrorText, TDes &aContextText);
- virtual void HandleViewDeactivation(const TVwsViewId &aViewIdToBeDeactivated, const TVwsViewId &aNewlyActivatedViewId);
- virtual void PrepareToExit();
- virtual void HandleTouchPaneSizeChange();
- virtual TBool ProcessCommandParametersL(TApaCommand aCommand, TFileName &aDocumentName, const TDesC8 &aTail);
-
-protected:
- virtual void HandleScreenDeviceChangedL();
- virtual void HandleApplicationSpecificEventL(TInt aType, const TWsEvent &aEvent);
- virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
- virtual void HandleSystemEventL(const TWsEvent &aEvent);
- virtual void Reserved_MtsmPosition();
- virtual void Reserved_MtsmObject();
- virtual void HandleForegroundEventL(TBool aForeground);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // Q_OS_SYMBIAN
-
-#endif // QS60MAINAPPUI_H
diff --git a/src/widgets/s60framework/qs60maindocument.cpp b/src/widgets/s60framework/qs60maindocument.cpp
deleted file mode 100644
index 20f9c4de75..0000000000
--- a/src/widgets/s60framework/qs60maindocument.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 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$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qs60mainappui.h"
-#include "qs60maindocument.h"
-#include "qcoreapplication.h"
-#include "qevent.h"
-#include "private/qcore_symbian_p.h"
-
-#include <exception>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QS60MainDocument
- \since 4.6
- \brief The QS60MainDocument class is a helper class for S60 migration.
-
- \inmodule QtWidgets
-
- \warning This class is provided only to get access to S60 specific
- functionality in the application framework classes. It is not
- portable. We strongly recommend against using it in new applications.
-
- 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 CEikDocument class from
- Symbian, but internally provides extensions used by Qt.
-
- When modifying old S60 applications that rely on implementing
- functions in \c CEikDocument, the class should be modified to
- inherit from this class instead of \c CEikDocument. Then the
- application can choose to override only certain functions.
-
- For more information on \c CEikDocument, please see the S60
- documentation.
-
- Unlike other Qt classes, QS60MainDocument behaves like an S60 class,
- and can throw Symbian leaves.
-
- \sa QS60MainApplication, QS60MainAppUi
- */
-
-/*!
- * \brief Constructs an instance of QS60MainDocument.
- *
- * \a mainApplication should contain a pointer to a QS60MainApplication instance.
- */
-QS60MainDocument::QS60MainDocument(CEikApplication &mainApplication)
- : QS60MainDocumentBase(mainApplication)
-{
- // No implementation required
-}
-
-/*!
- * \brief Destroys the QS60MainDocument.
- */
-QS60MainDocument::~QS60MainDocument()
-{
- // No implementation required
-}
-
-/*!
- * \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
- return (static_cast <CEikAppUi*>(new(ELeave)QS60MainAppUi));
-}
-
-/*!
- \internal
- */
-CFileStore *QS60MainDocument::OpenFileL(TBool /*aDoOpen*/, const TDesC &aFilename, RFs &/*aFs*/)
-{
- QT_TRYCATCH_LEAVING( {
- QCoreApplication* app = QCoreApplication::instance();
- QString qname = qt_TDesC2QString(aFilename);
- QFileOpenEvent* event = new QFileOpenEvent(qname);
- app->postEvent(app, event);
- })
- return 0;
-}
-
-/*!
- \internal
- */
-void QS60MainDocument::OpenFileL(CFileStore *&aFileStore, RFile &aFile)
-{
- QT_TRYCATCH_LEAVING( {
- QCoreApplication* app = QCoreApplication::instance();
- QFileOpenEvent* event = new QFileOpenEvent(aFile);
- app->postEvent(app, event);
- aFileStore = 0;
- })
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/s60framework/qs60maindocument.h b/src/widgets/s60framework/qs60maindocument.h
deleted file mode 100644
index 6a8e9a52f7..0000000000
--- a/src/widgets/s60framework/qs60maindocument.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 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$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QS60MAINDOCUMENT_H
-#define QS60MAINDOCUMENT_H
-
-#include <QtCore/qglobal.h>
-
-#ifdef Q_OS_SYMBIAN
-
-#ifdef Q_WS_S60
-#include <AknDoc.h>
-typedef CAknDocument QS60MainDocumentBase;
-#else
-#include <eikdoc.h>
-typedef CEikDocument QS60MainDocumentBase;
-#endif
-
-class CEikApplication;
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QS60MainAppUi;
-
-class Q_WIDGETS_EXPORT QS60MainDocument : public QS60MainDocumentBase
-{
-public:
-
- QS60MainDocument(CEikApplication &mainApplication);
- // The virtuals are for qdoc.
- virtual ~QS60MainDocument();
-
-public:
-
- virtual CEikAppUi *CreateAppUiL();
-
-public:
-
- virtual CFileStore *OpenFileL(TBool aDoOpen, const TDesC &aFilename, RFs &aFs);
-
- virtual void OpenFileL(CFileStore *&aFileStore, RFile &aFile);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // Q_OS_SYMBIAN
-
-#endif // QS60MAINDOCUMENT_H
diff --git a/src/widgets/s60framework/s60framework.pri b/src/widgets/s60framework/s60framework.pri
deleted file mode 100644
index 19525b7fdb..0000000000
--- a/src/widgets/s60framework/s60framework.pri
+++ /dev/null
@@ -1,10 +0,0 @@
-SOURCES += s60framework/qs60mainapplication.cpp \
- s60framework/qs60mainappui.cpp \
- s60framework/qs60maindocument.cpp
-
-HEADERS += s60framework/qs60mainapplication_p.h \
- s60framework/qs60mainapplication.h \
- s60framework/qs60mainappui.h \
- s60framework/qs60maindocument.h
-
-!isEmpty(QT_LIBINFIX): DEFINES += QT_LIBINFIX_UNQUOTED=$$QT_LIBINFIX \ No newline at end of file
diff --git a/src/widgets/s60framework/s60main.rss b/src/widgets/s60framework/s60main.rss
deleted file mode 100644
index 799dc09794..0000000000
--- a/src/widgets/s60framework/s60main.rss
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 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$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// Even S60 application have ENoAppResourceFile and ENonStandardResourceFile
-// flags set, the S60 3rd Edition FP1 emulator requires applications to have
-// very minimalistic application resource file, otherwise apps refures to start
-// This file serves the minimalistic resource file for S60 3.1 platforms.
-
-// RESOURCE IDENTIFIER
-NAME QTMA // 4 letter ID
-
-// INCLUDES
-//#include <eikon.rh>
-#include <appinfo.rh>
-#include <eikon.rh>
-#include <avkon.rsg>
-#include <avkon.rh>
-#include <avkon.mbg>
-
-// RESOURCE DEFINITIONS
-RESOURCE RSS_SIGNATURE
- {
- }
-
-RESOURCE TBUF r_default_document_name
- {
- buf="QTMA";
- }
-
-RESOURCE EIK_APP_INFO
- {
- menubar = r_qt_wrapperapp_menubar;
- cba = R_AVKON_SOFTKEYS_EXIT;
- }
-
-RESOURCE MENU_BAR r_qt_wrapperapp_menubar
- {
- titles =
- {
- MENU_TITLE { menu_pane = r_qt_wrapperapp_menu; }
- };
- }
-
-RESOURCE MENU_PANE r_qt_wrapperapp_menu
- {
- }
-// End of File
diff --git a/src/widgets/styles/images/defaults60theme.blob b/src/widgets/styles/images/defaults60theme.blob
deleted file mode 100644
index f3a59528d6..0000000000
--- a/src/widgets/styles/images/defaults60theme.blob
+++ /dev/null
Binary files differ
diff --git a/src/widgets/styles/qs60style.cpp b/src/widgets/styles/qs60style.cpp
deleted file mode 100644
index df20265c1e..0000000000
--- a/src/widgets/styles/qs60style.cpp
+++ /dev/null
@@ -1,3619 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qs60style_p.h"
-
-#include "qapplication.h"
-#include "qpainter.h"
-#include "qstyleoption.h"
-#include "qevent.h"
-#include "qpixmapcache.h"
-
-#include "qcalendarwidget.h"
-#include "qdial.h"
-#include "qdialog.h"
-#include "qmessagebox.h"
-#include "qgroupbox.h"
-#include "qheaderview.h"
-#include "qlist.h"
-#include "qlistwidget.h"
-#include "qlistview.h"
-#include "qmenu.h"
-#include "qmenubar.h"
-#include "qpushbutton.h"
-#include "qscrollarea.h"
-#include "qscrollbar.h"
-#include "qtabbar.h"
-#include "qtableview.h"
-#include "qtextedit.h"
-#include "qtoolbar.h"
-#include "qtoolbutton.h"
-#include "qfocusframe.h"
-#include "qformlayout.h"
-#include "qradiobutton.h"
-#include "qcheckbox.h"
-#include "qdesktopwidget.h"
-#include "qprogressbar.h"
-#include "qlabel.h"
-
-#include "private/qtoolbarextension_p.h"
-#include "private/qcombobox_p.h"
-#include "private/qwidget_p.h"
-#include "private/qapplication_p.h"
-#include "private/qfont_p.h"
-
-#if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN)
-
-QT_BEGIN_NAMESPACE
-
-const QS60StylePrivate::SkinElementFlags QS60StylePrivate::KDefaultSkinElementFlags =
- SkinElementFlags(SF_PointNorth | SF_StateEnabled);
-
-static const qreal goldenRatio = 1.618;
-
-const layoutHeader QS60StylePrivate::m_layoutHeaders[] = {
-// *** generated layout data ***
-{240,320,1,19,"QVGA Landscape"},
-{320,240,1,19,"QVGA Portrait"},
-{360,640,1,19,"NHD Landscape"},
-{640,360,1,19,"NHD Portrait"},
-{352,800,1,12,"E90 Landscape"},
-{480,640,1,19,"VGA Landscape"}
-// *** End of generated data ***
-};
-const int QS60StylePrivate::m_numberOfLayouts =
- (int)sizeof(QS60StylePrivate::m_layoutHeaders)/sizeof(QS60StylePrivate::m_layoutHeaders[0]);
-
-const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = {
-// *** generated pixel metrics ***
-{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},
-{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},
-{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},
-{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},
-{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}
-// *** End of generated data ***
-};
-
-const short *QS60StylePrivate::m_pmPointer = QS60StylePrivate::data[0];
-
-// theme background texture
-QPixmap *QS60StylePrivate::m_background = 0;
-QPixmap *QS60StylePrivate::m_placeHolderTexture = 0;
-
-// theme palette
-QPalette *QS60StylePrivate::m_themePalette = 0;
-
-qint64 QS60StylePrivate::m_webPaletteKey = 0;
-
-QPointer<QWidget> QS60StylePrivate::m_pressedWidget = 0;
-
-const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameElementsData[] = {
- {SE_ButtonNormal, QS60StyleEnums::SP_QsnFrButtonTbCenter},
- {SE_ButtonPressed, QS60StyleEnums::SP_QsnFrButtonTbCenterPressed},
- {SE_FrameLineEdit, QS60StyleEnums::SP_QsnFrInputCenter},
- {SE_ListHighlight, QS60StyleEnums::SP_QsnFrListCenter},
- {SE_PopupBackground, QS60StyleEnums::SP_QsnFrPopupCenter},
- {SE_SettingsList, QS60StyleEnums::SP_QsnFrSetOptCenter},
- {SE_TableItem, QS60StyleEnums::SP_QsnFrCaleCenter},
- {SE_TableHeaderItem, QS60StyleEnums::SP_QsnFrCaleHeadingCenter},
- {SE_ToolTip, QS60StyleEnums::SP_QsnFrPopupPreviewCenter},
- {SE_ToolBar, QS60StyleEnums::SP_QsnFrPopupSubCenter},
- {SE_ToolBarButton, QS60StyleEnums::SP_QgnFrSctrlButtonCenter},
- {SE_ToolBarButtonPressed, QS60StyleEnums::SP_QgnFrSctrlButtonCenterPressed},
- {SE_PanelBackground, QS60StyleEnums::SP_QsnFrSetOptCenter},
- {SE_ButtonInactive, QS60StyleEnums::SP_QsnFrButtonCenterInactive},
- {SE_Editor, QS60StyleEnums::SP_QsnFrInputCenter},
- {SE_TableItemPressed, QS60StyleEnums::SP_QsnFrGridCenterPressed},
- {SE_ListItemPressed, QS60StyleEnums::SP_QsnFrListCenterPressed},
-};
-
-static const int frameElementsCount =
- int(sizeof(QS60StylePrivate::m_frameElementsData)/sizeof(QS60StylePrivate::m_frameElementsData[0]));
-
-const int KNotFound = -909;
-const double KTabFontMul = 0.72;
-
-QS60StylePrivate::~QS60StylePrivate()
-{
- clearCaches(); //deletes also background image
- if (m_placeHolderTexture) {
- delete m_placeHolderTexture;
- m_placeHolderTexture = 0;
- }
- deleteThemePalette();
-#ifdef Q_WS_S60
- removeAnimations();
-#endif
-}
-
-void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter,
- const QRect &rect, SkinElementFlags flags)
-{
- switch (element) {
- case SE_ButtonNormal:
- drawFrame(SF_ButtonNormal, painter, rect, flags | SF_PointNorth);
- break;
- case SE_ButtonPressed:
- drawFrame(SF_ButtonPressed, painter, rect, flags | SF_PointNorth);
- break;
- case SE_FrameLineEdit:
- drawFrame(SF_FrameLineEdit, painter, rect, flags | SF_PointNorth);
- break;
- case SE_ProgressBarGrooveHorizontal:
- drawRow(QS60StyleEnums::SP_QgnGrafBarFrameSideL, QS60StyleEnums::SP_QgnGrafBarFrameCenter,
- QS60StyleEnums::SP_QgnGrafBarFrameSideR, Qt::Horizontal, painter, rect, flags | SF_PointNorth);
- break;
- case SE_ProgressBarGrooveVertical:
- drawRow(QS60StyleEnums::SP_QgnGrafBarFrameSideL, QS60StyleEnums::SP_QgnGrafBarFrameCenter,
- QS60StyleEnums::SP_QgnGrafBarFrameSideR, Qt::Vertical, painter, rect, flags | SF_PointEast);
- break;
- case SE_ProgressBarIndicatorHorizontal:
- drawPart(QS60StyleEnums::SP_QgnGrafBarProgress, painter, rect, flags | SF_PointNorth);
- break;
- case SE_ProgressBarIndicatorVertical:
- drawPart(QS60StyleEnums::SP_QgnGrafBarProgress, painter, rect, flags | SF_PointWest);
- break;
- case SE_ScrollBarGrooveHorizontal:
- drawRow(QS60StyleEnums::SP_QsnCpScrollBgBottom, QS60StyleEnums::SP_QsnCpScrollBgMiddle,
- QS60StyleEnums::SP_QsnCpScrollBgTop, Qt::Horizontal, painter, rect, flags | SF_PointEast);
- break;
- case SE_ScrollBarGrooveVertical:
- drawRow(QS60StyleEnums::SP_QsnCpScrollBgTop, QS60StyleEnums::SP_QsnCpScrollBgMiddle,
- QS60StyleEnums::SP_QsnCpScrollBgBottom, Qt::Vertical, painter, rect, flags | SF_PointNorth);
- break;
- case SE_ScrollBarHandleHorizontal:
- drawRow(QS60StyleEnums::SP_QsnCpScrollHandleBottom, QS60StyleEnums::SP_QsnCpScrollHandleMiddle,
- QS60StyleEnums::SP_QsnCpScrollHandleTop, Qt::Horizontal, painter, rect, flags | SF_PointEast);
- break;
- case SE_ScrollBarHandleVertical:
- drawRow(QS60StyleEnums::SP_QsnCpScrollHandleTop, QS60StyleEnums::SP_QsnCpScrollHandleMiddle,
- QS60StyleEnums::SP_QsnCpScrollHandleBottom, Qt::Vertical, painter, rect, flags | SF_PointNorth);
- break;
- case SE_SliderHandleHorizontal:
- drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarker, painter, rect, flags | SF_PointNorth);
- break;
- case SE_SliderHandleVertical:
- drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarker, painter, rect, flags | SF_PointEast);
- break;
- case SE_SliderHandleSelectedHorizontal:
- drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected, painter, rect, flags | SF_PointNorth);
- break;
- case SE_SliderHandleSelectedVertical:
- drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected, painter, rect, flags | SF_PointEast);
- break;
- case SE_SliderGrooveVertical:
- drawRow(QS60StyleEnums::SP_QgnGrafNsliderEndLeft, QS60StyleEnums::SP_QgnGrafNsliderMiddle,
- QS60StyleEnums::SP_QgnGrafNsliderEndRight, Qt::Vertical, painter, rect, flags | SF_PointEast);
- break;
- case SE_SliderGrooveHorizontal:
- drawRow(QS60StyleEnums::SP_QgnGrafNsliderEndLeft, QS60StyleEnums::SP_QgnGrafNsliderMiddle,
- QS60StyleEnums::SP_QgnGrafNsliderEndRight, Qt::Horizontal, painter, rect, flags | SF_PointNorth);
- break;
- case SE_TabBarTabEastActive:
- drawRow(QS60StyleEnums::SP_QgnGrafTabActiveL, QS60StyleEnums::SP_QgnGrafTabActiveM,
- QS60StyleEnums::SP_QgnGrafTabActiveR, Qt::Vertical, painter, rect, flags | SF_PointEast);
- break;
- case SE_TabBarTabEastInactive:
- drawRow(QS60StyleEnums::SP_QgnGrafTabPassiveL, QS60StyleEnums::SP_QgnGrafTabPassiveM,
- QS60StyleEnums::SP_QgnGrafTabPassiveR, Qt::Vertical, painter, rect, flags | SF_PointEast);
- break;
- case SE_TabBarTabNorthActive:
- drawRow(QS60StyleEnums::SP_QgnGrafTabActiveL, QS60StyleEnums::SP_QgnGrafTabActiveM,
- QS60StyleEnums::SP_QgnGrafTabActiveR, Qt::Horizontal, painter, rect, flags | SF_PointNorth);
- break;
- case SE_TabBarTabNorthInactive:
- drawRow(QS60StyleEnums::SP_QgnGrafTabPassiveL, QS60StyleEnums::SP_QgnGrafTabPassiveM,
- QS60StyleEnums::SP_QgnGrafTabPassiveR, Qt::Horizontal, painter, rect, flags | SF_PointNorth);
- break;
- case SE_TabBarTabSouthActive:
- drawRow(QS60StyleEnums::SP_QgnGrafTabActiveR, QS60StyleEnums::SP_QgnGrafTabActiveM,
- QS60StyleEnums::SP_QgnGrafTabActiveL, Qt::Horizontal, painter, rect, flags | SF_PointSouth);
- break;
- case SE_TabBarTabSouthInactive:
- drawRow(QS60StyleEnums::SP_QgnGrafTabPassiveR, QS60StyleEnums::SP_QgnGrafTabPassiveM,
- QS60StyleEnums::SP_QgnGrafTabPassiveL, Qt::Horizontal, painter, rect, flags | SF_PointSouth);
- break;
- case SE_TabBarTabWestActive:
- drawRow(QS60StyleEnums::SP_QgnGrafTabActiveR, QS60StyleEnums::SP_QgnGrafTabActiveM,
- QS60StyleEnums::SP_QgnGrafTabActiveL, Qt::Vertical, painter, rect, flags | SF_PointWest);
- break;
- case SE_TabBarTabWestInactive:
- drawRow(QS60StyleEnums::SP_QgnGrafTabPassiveR, QS60StyleEnums::SP_QgnGrafTabPassiveM,
- QS60StyleEnums::SP_QgnGrafTabPassiveL, Qt::Vertical, painter, rect, flags | SF_PointWest);
- break;
- case SE_ListHighlight:
- drawFrame(SF_ListHighlight, painter, rect, flags | SF_PointNorth);
- break;
- case SE_PopupBackground:
- drawFrame(SF_PopupBackground, painter, rect, flags | SF_PointNorth);
- break;
- case SE_SettingsList:
- drawFrame(SF_SettingsList, painter, rect, flags | SF_PointNorth);
- break;
- case SE_TableItem:
- drawFrame(SF_TableItem, painter, rect, flags | SF_PointNorth);
- break;
- case SE_TableHeaderItem:
- drawFrame(SF_TableHeaderItem, painter, rect, flags | SF_PointNorth);
- break;
- case SE_ToolTip:
- drawFrame(SF_ToolTip, painter, rect, flags | SF_PointNorth);
- break;
- case SE_ToolBar:
- drawFrame(SF_ToolBar, painter, rect, flags | SF_PointNorth);
- break;
- case SE_ToolBarButton:
- drawFrame(SF_ToolBarButton, painter, rect, flags | SF_PointNorth);
- break;
- case SE_ToolBarButtonPressed:
- drawFrame(SF_ToolBarButtonPressed, painter, rect, flags | SF_PointNorth);
- break;
- case SE_PanelBackground:
- drawFrame(SF_PanelBackground, painter, rect, flags | SF_PointNorth);
- break;
- case SE_ScrollBarHandlePressedHorizontal:
- drawRow(QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed, QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed,
- QS60StyleEnums::SP_QsnCpScrollHandleTopPressed, Qt::Horizontal, painter, rect, flags | SF_PointEast);
- break;
- case SE_ScrollBarHandlePressedVertical:
- drawRow(QS60StyleEnums::SP_QsnCpScrollHandleTopPressed, QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed,
- QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed, Qt::Vertical, painter, rect, flags | SF_PointNorth);
- break;
- case SE_ButtonInactive:
- drawFrame(SF_ButtonInactive, painter, rect, flags | SF_PointNorth);
- break;
- case SE_Editor:
- drawFrame(SF_FrameLineEdit, painter, rect, flags | SF_PointNorth);
- break;
- case SE_DropArea:
- drawPart(QS60StyleEnums::SP_QgnGrafOrgBgGrid, painter, rect, flags | SF_PointNorth);
- break;
- case SE_TableItemPressed:
- drawFrame(SF_TableItemPressed, painter, rect, flags | SF_PointNorth);
- break;
- case SE_ListItemPressed:
- drawFrame(SF_ListItemPressed, painter, rect, flags | SF_PointNorth);
- break;
- default:
- break;
- }
-}
-
-void QS60StylePrivate::drawSkinPart(QS60StyleEnums::SkinParts part,
- QPainter *painter, const QRect &rect, SkinElementFlags flags)
-{
- drawPart(part, painter, rect, flags);
-}
-
-short QS60StylePrivate::pixelMetric(int metric)
-{
- //If it is a custom value, need to strip away the base to map to internal
- //pixel metric value table
- if (metric & QStyle::PM_CustomBase) {
- metric -= QStyle::PM_CustomBase;
- metric += MAX_NON_CUSTOM_PIXELMETRICS - 1;
- }
-
- Q_ASSERT(metric < MAX_PIXELMETRICS);
- const short returnValue = m_pmPointer[metric];
- return returnValue;
-}
-
-QColor QS60StylePrivate::stateColor(const QColor &color, const QStyleOption *option)
-{
- QColor retColor (color);
- if (option && !(option->state & QStyle::State_Enabled)) {
- QColor hsvColor = retColor.toHsv();
- int colorSat = hsvColor.saturation();
- int colorVal = hsvColor.value();
- colorSat = (colorSat != 0) ? (colorSat >> 1) : 128;
- colorVal = (colorVal != 0) ? (colorVal >> 1) : 128;
- hsvColor.setHsv(hsvColor.hue(), colorSat, colorVal);
- retColor = hsvColor.toRgb();
- }
- return retColor;
-}
-
-QColor QS60StylePrivate::lighterColor(const QColor &baseColor)
-{
- QColor result(baseColor);
- bool modifyColor = false;
- if (result.saturation() == 0) {
- result.setHsv(result.hue(), 128, result.value());
- modifyColor = true;
- }
- if (result.value() == 0) {
- result.setHsv(result.hue(), result.saturation(), 128);
- modifyColor = true;
- }
- if (modifyColor)
- result = result.lighter(175);
- else
- result = result.lighter(225);
- return result;
-}
-
-bool QS60StylePrivate::drawsOwnThemeBackground(const QWidget *widget)
-{
- return (widget ? (widget->windowType() == Qt::Dialog) : false);
-}
-
-QFont QS60StylePrivate::s60Font(
- QS60StyleEnums::FontCategories fontCategory,
- int pointSize, bool resolveFontSize) const
-{
- QFont result;
- int actualPointSize = pointSize;
- if (actualPointSize <= 0) {
- const QFont appFont = QApplication::font();
- actualPointSize = appFont.pointSize();
- if (actualPointSize <= 0)
- actualPointSize = appFont.pixelSize() * 72 / qt_defaultDpiY();
- }
- Q_ASSERT(actualPointSize > 0);
- const QPair<QS60StyleEnums::FontCategories, int> key(fontCategory, actualPointSize);
- if (!m_mappedFontsCache.contains(key)) {
- result = s60Font_specific(fontCategory, actualPointSize, resolveFontSize);
- m_mappedFontsCache.insert(key, result);
- } else {
- result = m_mappedFontsCache.value(key);
- if (result.pointSize() != actualPointSize)
- result.setPointSize(actualPointSize);
- }
- return result;
-}
-
-void QS60StylePrivate::clearCaches(CacheClearReason reason)
-{
- switch(reason){
- case CC_LayoutChange:
- // when layout changes, the colors remain in cache, but graphics and fonts can change
- m_mappedFontsCache.clear();
- QPixmapCache::clear();
- break;
- case CC_ThemeChange:
- QPixmapCache::clear();
-#ifdef Q_WS_S60
- deleteStoredSettings();
-#endif
- deleteBackground();
- break;
- case CC_UndefinedChange:
- default:
- m_mappedFontsCache.clear();
- QPixmapCache::clear();
- deleteBackground();
- break;
- }
-}
-
-QColor QS60StylePrivate::calculatedColor(SkinFrameElements frame) const
-{
- const int frameCornerWidth = pixelMetric(PM_FrameCornerWidth);
- const int frameCornerHeight = pixelMetric(PM_FrameCornerHeight);
- Q_ASSERT(2 * frameCornerWidth < 32);
- Q_ASSERT(2 * frameCornerHeight < 32);
-
- const QImage frameImage = QS60StylePrivate::frame(frame, QSize(32, 32)).toImage();
- Q_ASSERT(frameImage.bytesPerLine() > 0);
- if (frameImage.isNull())
- return Qt::black;
-
- const QRgb *pixelRgb = (const QRgb*)frameImage.constBits();
- const int pixels = frameImage.byteCount() / sizeof(QRgb);
-
- int estimatedRed = 0;
- int estimatedGreen = 0;
- int estimatedBlue = 0;
-
- int skips = 0;
- int estimations = 0;
-
- const int topBorderLastPixel = frameCornerHeight * frameImage.width() - 1;
- const int bottomBorderFirstPixel = frameImage.width() * frameImage.height() - topBorderLastPixel;
- const int rightBorderFirstPixel = frameImage.width() - frameCornerWidth;
- const int leftBorderLastPixel = frameCornerWidth;
-
- while ((skips + estimations) < pixels) {
- if ((skips + estimations) > topBorderLastPixel &&
- (skips + estimations) < bottomBorderFirstPixel) {
- for (int rowIndex = 0; rowIndex < frameImage.width(); rowIndex++) {
- if (rowIndex > leftBorderLastPixel &&
- rowIndex < rightBorderFirstPixel) {
- estimatedRed += qRed(*pixelRgb);
- estimatedGreen += qGreen(*pixelRgb);
- estimatedBlue += qBlue(*pixelRgb);
- }
- pixelRgb++;
- estimations++;
- }
- } else {
- pixelRgb++;
- skips++;
- }
- }
- QColor frameColor(estimatedRed/estimations, estimatedGreen/estimations, estimatedBlue/estimations);
- return !estimations ? Qt::black : frameColor;
-}
-
-void QS60StylePrivate::setThemePalette(QApplication *app) const
-{
- Q_UNUSED(app)
- QPalette widgetPalette = QPalette(Qt::white);
- setThemePalette(&widgetPalette);
-}
-
-QPalette* QS60StylePrivate::themePalette()
-{
- return m_themePalette;
-}
-
-bool QS60StylePrivate::equalToThemePalette(QColor color, QPalette::ColorRole role)
-{
- if (!m_themePalette)
- return false;
- if (color == m_themePalette->color(role))
- return true;
- return false;
-}
-
-bool QS60StylePrivate::equalToThemePalette(qint64 cacheKey, QPalette::ColorRole role)
-{
- if (!m_themePalette)
- return false;
- if (cacheKey == m_themePalette->brush(role).texture().cacheKey())
- return true;
- return false;
-}
-
-void QS60StylePrivate::setBackgroundTexture(QApplication *app) const
-{
- Q_UNUSED(app)
- QPalette applicationPalette = QApplication::palette();
- // The initial QPalette::Window is just a placeHolder QPixmap to save RAM
- // if the actual texture is not needed. The real texture is created just before
- // painting it in qt_s60_fill_background().
- applicationPalette.setBrush(QPalette::Window, placeHolderTexture());
- setThemePalette(&applicationPalette);
-}
-
-void QS60StylePrivate::deleteBackground()
-{
- if (m_background) {
- delete m_background;
- m_background = 0;
- }
-}
-
-void QS60StylePrivate::setCurrentLayout(int index)
-{
- m_pmPointer = data[index];
-}
-
-void QS60StylePrivate::drawPart(QS60StyleEnums::SkinParts skinPart,
- QPainter *painter, const QRect &rect, SkinElementFlags flags)
-{
- static const bool doCache =
-#if defined(Q_WS_S60)
- // Freezes on 3.1. Anyways, caching is only really needed on touch UI
- !(QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2);
-#else
- true;
-#endif
-
- const QPixmap skinPartPixMap((doCache ? cachedPart : part)(skinPart, rect.size(), painter, flags));
- if (!skinPartPixMap.isNull())
- painter->drawPixmap(rect.topLeft(), skinPartPixMap);
-}
-
-void QS60StylePrivate::drawFrame(SkinFrameElements frameElement, QPainter *painter, const QRect &rect, SkinElementFlags flags)
-{
- static const bool doCache =
-#if defined(Q_WS_S60)
- // Freezes on 3.1. Anyways, caching is only really needed on touch UI
- !(QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2);
-#else
- true;
-#endif
- const QPixmap frameElementPixMap((doCache ? cachedFrame : frame)(frameElement, rect.size(), flags));
- if (!frameElementPixMap.isNull())
- painter->drawPixmap(rect.topLeft(), frameElementPixMap);
-}
-
-void QS60StylePrivate::drawRow(QS60StyleEnums::SkinParts start,
- QS60StyleEnums::SkinParts middle, QS60StyleEnums::SkinParts end,
- Qt::Orientation orientation, QPainter *painter, const QRect &rect,
- SkinElementFlags flags)
-{
- QSize startEndSize(partSize(start, flags));
- startEndSize.scale(rect.size(), Qt::KeepAspectRatio);
-
- QRect startRect = QRect(rect.topLeft(), startEndSize);
- QRect middleRect = rect;
- QRect endRect;
-
- if (orientation == Qt::Horizontal) {
- startRect.setHeight(rect.height());
- startRect.setWidth(qMin((rect.width() >> 1) - 1, startRect.width()));
- endRect = startRect.translated(rect.width() - startRect.width(), 0);
- middleRect.adjust(startRect.width(), 0, -startRect.width(), 0);
- if (startRect.bottomRight().x() > endRect.topLeft().x()) {
- const int overlap = (startRect.bottomRight().x() - endRect.topLeft().x()) >> 1;
- startRect.setWidth(startRect.width() - overlap);
- endRect.adjust(overlap, 0, 0, 0);
- }
- } else {
- startRect.setWidth(rect.width());
- startRect.setHeight(qMin((rect.height() >> 1) - 1, startRect.height()));
- endRect = startRect.translated(0, rect.height() - startRect.height());
- middleRect.adjust(0, startRect.height(), 0, -startRect.height());
- if (startRect.topRight().y() > endRect.bottomLeft().y()) {
- const int overlap = (startRect.topRight().y() - endRect.bottomLeft().y()) >> 1;
- startRect.setHeight(startRect.height() - overlap);
- endRect.adjust(0, overlap, 0, 0);
- }
- }
-
-#if 0
- painter->save();
- painter->setOpacity(.3);
- painter->fillRect(startRect, Qt::red);
- painter->fillRect(middleRect, Qt::green);
- painter->fillRect(endRect, Qt::blue);
- painter->restore();
-#else
- drawPart(start, painter, startRect, flags);
- if (middleRect.isValid())
- drawPart(middle, painter, middleRect, flags);
- drawPart(end, painter, endRect, flags);
-#endif
-}
-
-QPixmap QS60StylePrivate::cachedPart(QS60StyleEnums::SkinParts part,
- const QSize &size, QPainter *painter, SkinElementFlags flags)
-{
- QPixmap result;
- const int animationFrame = (flags & SF_Animation) ? currentAnimationFrame(part) : 0;
-
- const QString cacheKey =
- QString::fromLatin1("S60Style: SkinParts=%1 QSize=%2|%3 SkinPartFlags=%4 AnimationFrame=%5")
- .arg((int)part).arg(size.width()).arg(size.height()).arg((int)flags).arg(animationFrame);
- if (!QPixmapCache::find(cacheKey, result)) {
- result = QS60StylePrivate::part(part, size, painter, flags);
- QPixmapCache::insert(cacheKey, result);
- }
- return result;
-}
-
-QPixmap QS60StylePrivate::cachedFrame(SkinFrameElements frame, const QSize &size, SkinElementFlags flags)
-{
- QPixmap result;
- const QString cacheKey =
- QString::fromLatin1("S60Style: SkinFrameElements=%1 QSize=%2|%3 SkinElementFlags=%4")
- .arg((int)frame).arg(size.width()).arg(size.height()).arg((int)flags);
- if (!QPixmapCache::find(cacheKey, result)) {
- result = QS60StylePrivate::frame(frame, size, flags);
- QPixmapCache::insert(cacheKey, result);
- }
- return result;
-}
-
-void QS60StylePrivate::setFont(QWidget *widget) const
-{
- QS60StyleEnums::FontCategories fontCategory = QS60StyleEnums::FC_Undefined;
- if (!widget)
- return;
- if (qobject_cast<QPushButton *>(widget)){
- fontCategory = QS60StyleEnums::FC_Primary;
- } else if (qobject_cast<QToolButton *>(widget)){
- fontCategory = QS60StyleEnums::FC_Primary;
- } else if (qobject_cast<QHeaderView *>(widget)){
- fontCategory = QS60StyleEnums::FC_Secondary;
- } else if (qobject_cast<QGroupBox *>(widget)){
- fontCategory = QS60StyleEnums::FC_Title;
- } else if (qobject_cast<QMessageBox *>(widget)){
- fontCategory = QS60StyleEnums::FC_Primary;
- } else if (qobject_cast<QMenu *>(widget)){
- fontCategory = QS60StyleEnums::FC_Primary;
- } else if (qobject_cast<QCalendarWidget *>(widget)){
- fontCategory = QS60StyleEnums::FC_Secondary;
- }
- if (fontCategory != QS60StyleEnums::FC_Undefined) {
- const bool resolveFontSize = widget->testAttribute(Qt::WA_SetFont)
- && (widget->font().resolve() & QFont::SizeResolved);
- const QFont suggestedFont =
- s60Font(fontCategory, widget->font().pointSizeF(), resolveFontSize);
- widget->setFont(suggestedFont);
- }
-}
-
-void QS60StylePrivate::setThemePalette(QWidget *widget)
-{
- if(!widget)
- return;
-
- //header view and its viewport need to be set 100% transparent button color, since drawing code will
- //draw transparent theme graphics to table column and row headers.
- if (qobject_cast<QHeaderView *>(widget)){
- QPalette widgetPalette = QApplication::palette(widget);
- widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0));
- QHeaderView* header = qobject_cast<QHeaderView *>(widget);
- widgetPalette.setColor(QPalette::Button, Qt::transparent );
- if (header->viewport())
- header->viewport()->setPalette(widgetPalette);
- QApplication::setPalette(widgetPalette, "QHeaderView");
- } else if (qobject_cast<QLabel *>(widget)) {
- if (widget->window() && widget->window()->windowType() == Qt::Dialog) {
- QPalette widgetPalette = widget->palette();
- widgetPalette.setColor(QPalette::WindowText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 19, 0));
- widget->setPalette(widgetPalette);
- }
- }
-}
-
-void QS60StylePrivate::setThemePalette(QPalette *palette) const
-{
- if (!palette)
- return;
-
- // basic colors
- palette->setColor(QPalette::WindowText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
- palette->setColor(QPalette::ButtonText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 20, 0));
- palette->setColor(QPalette::Text,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
- palette->setColor(QPalette::ToolTipText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 55, 0));
- palette->setColor(QPalette::BrightText, palette->color(QPalette::WindowText).lighter());
- palette->setColor(QPalette::HighlightedText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0));
- palette->setColor(QPalette::Link,
- s60Color(QS60StyleEnums::CL_QsnHighlightColors, 3, 0));
- palette->setColor(QPalette::LinkVisited, palette->color(QPalette::Link).darker());
- palette->setColor(QPalette::Highlight,
- s60Color(QS60StyleEnums::CL_QsnHighlightColors, 2, 0));
- // The initial QPalette::Window is just a placeHolder QPixmap to save RAM
- // if the actual texture is not needed. The real texture is created just before
- // painting it in qt_s60_fill_background().
- palette->setBrush(QPalette::Window, placeHolderTexture());
- // set as transparent so that styled full screen theme background is visible
- palette->setBrush(QPalette::Base, Qt::transparent);
- // set button color based on pixel colors
-#ifndef Q_WS_S60
- //For emulated style, just calculate the color every time
- const QColor buttonColor = calculatedColor(SF_ButtonNormal);
-#else
- const QColor buttonColor = colorFromFrameGraphics(SF_ButtonNormal);
-#endif
- palette->setColor(QPalette::Button, buttonColor);
- palette->setColor(QPalette::Light, palette->color(QPalette::Button).lighter());
- palette->setColor(QPalette::Dark, palette->color(QPalette::Button).darker());
- palette->setColor(QPalette::Midlight, palette->color(QPalette::Button).lighter(125));
- palette->setColor(QPalette::Mid, palette->color(QPalette::Button).darker(150));
- palette->setColor(QPalette::Shadow, Qt::black);
- QColor alternateBase = palette->light().color();
- alternateBase.setAlphaF(0.8);
- palette->setColor(QPalette::AlternateBase, alternateBase);
-
- QApplication::setPalette(*palette); //calling QApplication::setPalette clears palette hash
- setThemePaletteHash(palette);
- storeThemePalette(palette);
-}
-
-void QS60StylePrivate::deleteThemePalette()
-{
- if (m_themePalette) {
- delete m_themePalette;
- m_themePalette = 0;
- }
-}
-
-void QS60StylePrivate::storeThemePalette(QPalette *palette)
-{
- deleteThemePalette();
- //store specified palette for latter use.
- m_themePalette = new QPalette(*palette);
-}
-
-// set widget specific palettes
-void QS60StylePrivate::setThemePaletteHash(QPalette *palette)
-{
- if (!palette)
- return;
-
- //store the original palette
- QPalette widgetPalette = *palette;
- const QColor mainAreaTextColor =
- s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0);
-
- widgetPalette.setColor(QPalette::WindowText,
- s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0));
- QApplication::setPalette(widgetPalette, "QSlider");
- // return to original palette after each widget
- widgetPalette = *palette;
-
- widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, mainAreaTextColor);
- widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, mainAreaTextColor);
- const QStyleOption opt;
- widgetPalette.setColor(QPalette::Disabled, QPalette::ButtonText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 6, &opt));
- QApplication::setPalette(widgetPalette, "QPushButton");
- widgetPalette = *palette;
-
- widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, mainAreaTextColor);
- widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, mainAreaTextColor);
- QApplication::setPalette(widgetPalette, "QToolButton");
- widgetPalette = *palette;
-
- widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0));
- QApplication::setPalette(widgetPalette, "QHeaderView");
- widgetPalette = *palette;
-
- widgetPalette.setColor(QPalette::ButtonText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0));
- QApplication::setPalette(widgetPalette, "QMenuBar");
- widgetPalette = *palette;
-
- widgetPalette.setColor(QPalette::Text,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0));
- widgetPalette.setColor(QPalette::HighlightedText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 11, 0));
- QApplication::setPalette(widgetPalette, "QMenu");
- widgetPalette = *palette;
-
- widgetPalette.setColor(QPalette::WindowText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0));
- widgetPalette.setColor(QPalette::HighlightedText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 3, 0));
- QApplication::setPalette(widgetPalette, "QTabBar");
- widgetPalette = *palette;
-
- widgetPalette.setColor(QPalette::HighlightedText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0));
- QApplication::setPalette(widgetPalette, "QListView");
- widgetPalette = *palette;
-
- widgetPalette.setColor(QPalette::Text,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0));
- widgetPalette.setColor(QPalette::HighlightedText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 11, 0));
- QApplication::setPalette(widgetPalette, "QTableView");
- widgetPalette = *palette;
-
- widgetPalette.setColor(QPalette::Text,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 27, 0));
- widgetPalette.setColor(QPalette::HighlightedText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0));
- QApplication::setPalette(widgetPalette, "QLineEdit");
- QApplication::setPalette(widgetPalette, "QTextEdit");
- QApplication::setPalette(widgetPalette, "QComboBox");
- QApplication::setPalette(widgetPalette, "QSpinBox");
- widgetPalette = *palette;
-
- widgetPalette.setColor(QPalette::WindowText, s60Color(QS60StyleEnums::CL_QsnTextColors, 7, 0));
- widgetPalette.setColor(QPalette::HighlightedText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 11, 0));
- QApplication::setPalette(widgetPalette, "QRadioButton");
- QApplication::setPalette(widgetPalette, "QCheckBox");
- widgetPalette = *palette;
-
- widgetPalette.setColor(QPalette::WindowText, mainAreaTextColor);
- widgetPalette.setColor(QPalette::Button, QApplication::palette().color(QPalette::Button));
- widgetPalette.setColor(QPalette::Dark, mainAreaTextColor.darker());
- widgetPalette.setColor(QPalette::Light, mainAreaTextColor.lighter());
- QApplication::setPalette(widgetPalette, "QDial");
- widgetPalette = *palette;
-
- widgetPalette.setBrush(QPalette::Window, QBrush());
- QApplication::setPalette(widgetPalette, "QScrollArea");
- widgetPalette = *palette;
-
- //Webpages should not use S60 theme colors as they are designed to work
- //with themeBackground and do not generally mesh well with web page backgrounds.
- QPalette webPalette = *palette;
- webPalette.setColor(QPalette::WindowText, Qt::black);
- webPalette.setColor(QPalette::Text, Qt::black);
- webPalette.setBrush(QPalette::Base, Qt::white);
-
- QApplication::setPalette(webPalette, "QWebView");
- QApplication::setPalette(webPalette, "QGraphicsWebView");
-
- m_webPaletteKey = webPalette.cacheKey();
-}
-
-QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlags flags)
-{
- QSize result(20, 20);
- switch (part)
- {
- case QS60StyleEnums::SP_QgnGrafBarProgress:
- result.setWidth(pixelMetric(QStyle::PM_ProgressBarChunkWidth));
- break;
- case QS60StyleEnums::SP_QgnGrafTabActiveM:
- case QS60StyleEnums::SP_QgnGrafTabPassiveM:
- case QS60StyleEnums::SP_QgnGrafTabActiveR:
- case QS60StyleEnums::SP_QgnGrafTabPassiveR:
- case QS60StyleEnums::SP_QgnGrafTabPassiveL:
- case QS60StyleEnums::SP_QgnGrafTabActiveL:
- //Returned QSize for tabs must not be square, but narrow rectangle with width:height
- //ratio of 1:2 for horizontal tab bars (and 2:1 for vertical ones).
- result.setWidth(result.height() >> 1);
- break;
-
- case QS60StyleEnums::SP_QgnGrafNsliderEndLeft:
- case QS60StyleEnums::SP_QgnGrafNsliderEndRight:
- case QS60StyleEnums::SP_QgnGrafNsliderMiddle:
- break;
-
- case QS60StyleEnums::SP_QgnGrafNsliderMarker:
- case QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected:
- result.scale(pixelMetric(QStyle::PM_SliderLength),
- pixelMetric(QStyle::PM_SliderControlThickness), Qt::IgnoreAspectRatio);
- break;
-
- case QS60StyleEnums::SP_QgnGrafBarFrameSideL:
- case QS60StyleEnums::SP_QgnGrafBarFrameSideR:
- result.setWidth(pixelMetric(PM_FrameCornerWidth));
- break;
-
- case QS60StyleEnums::SP_QsnCpScrollHandleTopPressed:
- case QS60StyleEnums::SP_QsnCpScrollBgBottom:
- case QS60StyleEnums::SP_QsnCpScrollBgTop:
- case QS60StyleEnums::SP_QsnCpScrollHandleBottom:
- case QS60StyleEnums::SP_QsnCpScrollHandleTop:
- case QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed:
- result.setHeight(pixelMetric(QStyle::PM_ScrollBarExtent));
- result.setWidth(pixelMetric(QStyle::PM_ScrollBarExtent));
- break;
- case QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed:
- case QS60StyleEnums::SP_QsnCpScrollBgMiddle:
- case QS60StyleEnums::SP_QsnCpScrollHandleMiddle:
- result.setHeight(pixelMetric(QStyle::PM_ScrollBarExtent));
- result.setWidth(pixelMetric(QStyle::PM_ScrollBarSliderMin));
- break;
- default:
- // Generic frame part size gathering.
- for (int i = 0; i < frameElementsCount; ++i)
- {
- switch (m_frameElementsData[i].center - part) {
- case 8: /* CornerTl */
- case 7: /* CornerTr */
- case 6: /* CornerBl */
- case 5: /* CornerBr */
- result.setWidth(pixelMetric(PM_FrameCornerWidth));
- // Falltrough intended...
- case 4: /* SideT */
- case 3: /* SideB */
- result.setHeight(pixelMetric(PM_FrameCornerHeight));
- break;
- case 2: /* SideL */
- case 1: /* SideR */
- result.setWidth(pixelMetric(PM_FrameCornerWidth));
- break;
- case 0: /* center */
- default:
- break;
- }
- }
- break;
- }
- if (flags & (SF_PointEast | SF_PointWest)) {
- const int temp = result.width();
- result.setWidth(result.height());
- result.setHeight(temp);
- }
- return result;
-}
-
-bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush, const QWidget *widget)
-{
- // Always return true for web pages.
- if (widget && m_webPaletteKey == QApplication::palette(widget).cacheKey())
- return true;
- //If brush is not changed from style's default values, draw theme graphics.
- return (backgroundBrush.color() == Qt::transparent ||
- backgroundBrush.style() == Qt::NoBrush) ? true : false;
-}
-
-bool QS60StylePrivate::isWidgetPressed(const QWidget *widget)
-{
- return (widget && widget == m_pressedWidget);
-}
-
-// Generates 1*1 white pixmap as a placeholder for real texture.
-// The actual theme texture is drawn in qt_s60_fill_background().
-QPixmap QS60StylePrivate::placeHolderTexture()
-{
- if (!m_placeHolderTexture) {
- m_placeHolderTexture = new QPixmap(1,1);
- m_placeHolderTexture->fill(Qt::green);
- }
- return *m_placeHolderTexture;
-}
-
-/*!
- \class QS60Style
- \brief The QS60Style class provides a look and feel suitable for applications on S60.
- \since 4.6
- \ingroup appearance
- \inmodule QtWidgets
-
- \sa QMacStyle, QWindowsStyle, QWindowsXPStyle, QWindowsVistaStyle, QPlastiqueStyle, QCleanlooksStyle, QMotifStyle
-*/
-
-
-/*!
- Destroys the style.
-*/
-QS60Style::~QS60Style()
-{
-}
-
-/*!
- \reimp
-*/
-void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
-{
- const QS60StylePrivate::SkinElementFlags flags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled;
- SubControls sub = option->subControls;
-
- switch (control) {
-#ifndef QT_NO_SCROLLBAR
- case CC_ScrollBar:
- if (const QStyleOptionSlider *optionSlider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- const bool horizontal = optionSlider->orientation == Qt::Horizontal;
-
- const QRect scrollBarSlider = subControlRect(control, optionSlider, SC_ScrollBarSlider, widget);
- const QRect grooveRect = subControlRect(control, optionSlider, SC_ScrollBarGroove, widget);
-
- const QS60StylePrivate::SkinElements grooveElement =
- horizontal ? QS60StylePrivate::SE_ScrollBarGrooveHorizontal : QS60StylePrivate::SE_ScrollBarGrooveVertical;
- QS60StylePrivate::drawSkinElement(grooveElement, painter, grooveRect, flags);
-
- const SubControls subControls = optionSlider->subControls;
-
- // select correct slider (horizontal/vertical/pressed)
- const bool sliderPressed = ((optionSlider->state & State_Sunken) && (subControls & SC_ScrollBarSlider));
- const QS60StylePrivate::SkinElements handleElement =
- horizontal ?
- ( sliderPressed ?
- QS60StylePrivate::SE_ScrollBarHandlePressedHorizontal :
- QS60StylePrivate::SE_ScrollBarHandleHorizontal ) :
- ( sliderPressed ?
- QS60StylePrivate::SE_ScrollBarHandlePressedVertical :
- QS60StylePrivate::SE_ScrollBarHandleVertical);
- QS60StylePrivate::drawSkinElement(handleElement, painter, scrollBarSlider, flags);
- }
- break;
-#endif // QT_NO_SCROLLBAR
-#ifndef QT_NO_SLIDER
- case CC_Slider:
- if (const QStyleOptionSlider *optionSlider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
-
- const QRect sliderGroove = subControlRect(control, optionSlider, SC_SliderGroove, widget);
- const bool horizontal = optionSlider->orientation == Qt::Horizontal;
-
- //Highlight
-/* if (optionSlider->state & State_HasFocus)
- drawPrimitive(PE_FrameFocusRect, optionSlider, painter, widget);*/
-
- //Groove graphics
- if (QS60StylePrivate::hasSliderGrooveGraphic()) {
- const QS60StylePrivate::SkinElements grooveElement = horizontal ?
- QS60StylePrivate::SE_SliderGrooveHorizontal :
- QS60StylePrivate::SE_SliderGrooveVertical;
- QS60StylePrivate::drawSkinElement(grooveElement, painter, sliderGroove, flags);
- } else {
- const QPoint sliderGrooveCenter = sliderGroove.center();
- const bool horizontal = optionSlider->orientation == Qt::Horizontal;
- painter->save();
- if (widget)
- painter->setPen(widget->palette().windowText().color());
- if (horizontal)
- painter->drawLine(0, sliderGrooveCenter.y(), sliderGroove.right(), sliderGrooveCenter.y());
- else
- painter->drawLine(sliderGrooveCenter.x(), 0, sliderGrooveCenter.x(), sliderGroove.bottom());
- painter->restore();
- }
-
- //Handle graphics
- const QRect sliderHandle = subControlRect(control, optionSlider, SC_SliderHandle, widget);
- QS60StylePrivate::SkinElements handleElement;
- if (optionSlider->state & State_Sunken)
- handleElement =
- horizontal ? QS60StylePrivate::SE_SliderHandleSelectedHorizontal : QS60StylePrivate::SE_SliderHandleSelectedVertical;
- else
- handleElement =
- horizontal ? QS60StylePrivate::SE_SliderHandleHorizontal : QS60StylePrivate::SE_SliderHandleVertical;
- QS60StylePrivate::drawSkinElement(handleElement, painter, sliderHandle, flags);
- }
- break;
-#endif // QT_NO_SLIDER
-#ifndef QT_NO_COMBOBOX
- case CC_ComboBox:
- if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- const QRect cmbxEditField = subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget);
- const QRect cmbxFrame = subControlRect(CC_ComboBox, option, SC_ComboBoxFrame, widget);
- const bool direction = cmb->direction == Qt::LeftToRight;
-
- // Button frame
- QStyleOptionFrame buttonOption;
- buttonOption.QStyleOption::operator=(*cmb);
- const int maxButtonSide = cmbxFrame.width() - cmbxEditField.width();
- const int newTop = cmbxEditField.center().y() - maxButtonSide / 2;
- const int topLeftPoint = direction ?
- (cmbxEditField.right() + 1) : (cmbxEditField.left() + 1 - maxButtonSide);
- const QRect buttonRect(topLeftPoint, newTop, maxButtonSide, maxButtonSide);
- buttonOption.rect = buttonRect;
- buttonOption.state = cmb->state;
- drawPrimitive(PE_PanelButtonCommand, &buttonOption, painter, widget);
-
- // draw label background - label itself is drawn separately
- const QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_FrameLineEdit;
- QS60StylePrivate::drawSkinElement(skinElement, painter, cmbxEditField, flags);
-
- // Draw the combobox arrow
- if (sub & SC_ComboBoxArrow) {
- // Make rect slightly smaller
- buttonOption.rect.adjust(1, 1, -1, -1);
- painter->save();
- painter->setPen(option->palette.buttonText().color());
- drawPrimitive(PE_IndicatorSpinDown, &buttonOption, painter, widget);
- painter->restore();
- }
- }
- break;
-#endif // QT_NO_COMBOBOX
-#ifndef QT_NO_TOOLBUTTON
- case CC_ToolButton:
- if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
- State bflags = toolBtn->state & ~State_Sunken;
-
- if (bflags & State_AutoRaise) {
- if (!(bflags & State_MouseOver) || !(bflags & State_Enabled)) {
- bflags &= ~State_Raised;
- }
- }
- State mflags = bflags;
- if (toolBtn->state & State_Sunken) {
- bflags |= State_Sunken;
- mflags |= State_Sunken;
- }
-
- const QRect button(subControlRect(control, toolBtn, SC_ToolButton, widget));
- QRect menuRect = QRect();
- if (toolBtn->subControls & SC_ToolButtonMenu)
- menuRect = subControlRect(control, toolBtn, SC_ToolButtonMenu, widget);
-
- if (toolBtn->subControls & SC_ToolButton) {
- QStyleOption tool(0);
- tool.palette = toolBtn->palette;
-
- if (bflags & (State_Sunken | State_On | State_Raised | State_Enabled)) {
- tool.rect = button.unite(menuRect);
- tool.state = bflags;
- drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
- }
- if (toolBtn->subControls & SC_ToolButtonMenu) {
- tool.rect = menuRect;
- tool.state = mflags;
- drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget);
- }
- }
- QStyleOptionToolButton toolButton = *toolBtn;
- if (toolBtn->features & QStyleOptionToolButton::Arrow) {
- PrimitiveElement pe;
- switch (toolBtn->arrowType) {
- case Qt::LeftArrow:
- pe = PE_IndicatorArrowLeft;
- break;
- case Qt::RightArrow:
- pe = PE_IndicatorArrowRight;
- break;
- case Qt::UpArrow:
- pe = PE_IndicatorArrowUp;
- break;
- case Qt::DownArrow:
- pe = PE_IndicatorArrowDown;
- break;
- default:
- break; }
- toolButton.rect = button;
- drawPrimitive(pe, &toolButton, painter, widget);
- }
-
- if (toolBtn->text.length() > 0 ||
- !toolBtn->icon.isNull()) {
- const int frameWidth = pixelMetric(PM_DefaultFrameWidth, option, widget);
- toolButton.rect = button.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth);
- drawControl(CE_ToolButtonLabel, &toolButton, painter, widget);
- }
- }
- break;
-#endif //QT_NO_TOOLBUTTON
-#ifndef QT_NO_SPINBOX
- case CC_SpinBox:
- if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- QStyleOptionSpinBox copy = *spinBox;
- PrimitiveElement pe;
-
- if (spinBox->subControls & SC_SpinBoxUp) {
- copy.subControls = SC_SpinBoxUp;
- QPalette spinBoxPal = spinBox->palette;
- if (!(spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) {
- spinBoxPal.setCurrentColorGroup(QPalette::Disabled);
- copy.state &= ~State_Enabled;
- copy.palette = spinBoxPal;
- }
-
- if (spinBox->activeSubControls == SC_SpinBoxUp && (spinBox->state & State_Sunken)) {
- copy.state |= State_On;
- copy.state |= State_Sunken;
- } else {
- copy.state |= State_Raised;
- copy.state &= ~State_Sunken;
- }
- pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) ?
- PE_IndicatorSpinPlus :
- PE_IndicatorSpinUp;
-
- copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget);
- drawPrimitive(PE_PanelButtonBevel, &copy, painter, widget);
- copy.rect.adjust(1, 1, -1, -1);
- drawPrimitive(pe, &copy, painter, widget);
- }
-
- if (spinBox->subControls & SC_SpinBoxDown) {
- copy.subControls = SC_SpinBoxDown;
- copy.state = spinBox->state;
- QPalette spinBoxPal = spinBox->palette;
- if (!(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) {
- spinBoxPal.setCurrentColorGroup(QPalette::Disabled);
- copy.state &= ~State_Enabled;
- copy.palette = spinBoxPal;
- }
-
- if (spinBox->activeSubControls == SC_SpinBoxDown && (spinBox->state & State_Sunken)) {
- copy.state |= State_On;
- copy.state |= State_Sunken;
- } else {
- copy.state |= State_Raised;
- copy.state &= ~State_Sunken;
- }
- pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) ?
- PE_IndicatorSpinMinus :
- PE_IndicatorSpinDown;
-
- copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget);
- drawPrimitive(PE_PanelButtonBevel, &copy, painter, widget);
- copy.rect.adjust(1, 1, -1, -1);
- drawPrimitive(pe, &copy, painter, widget);
- }
- }
- break;
-#endif //QT_NO_SPINBOX
-#ifndef QT_NO_GROUPBOX
- case CC_GroupBox:
- if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
- // Draw frame
- const QRect textRect = subControlRect(CC_GroupBox, option, SC_GroupBoxLabel, widget);
- const QRect checkBoxRect = subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget);
- if (groupBox->subControls & SC_GroupBoxFrame) {
- QStyleOptionFrameV2 frame;
- frame.QStyleOption::operator=(*groupBox);
- frame.features = groupBox->features;
- frame.lineWidth = groupBox->lineWidth;
- frame.midLineWidth = groupBox->midLineWidth;
- frame.rect = subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
- drawPrimitive(PE_FrameGroupBox, &frame, painter, widget);
- }
-
- // Draw title
- if ((groupBox->subControls & SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
- const QColor textColor = groupBox->textColor;
- painter->save();
-
- if (textColor.isValid())
- painter->setPen(textColor);
- int alignment = int(groupBox->textAlignment);
- if (!styleHint(SH_UnderlineShortcut, option, widget))
- alignment |= Qt::TextHideMnemonic;
-
- drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | Qt::AlignVCenter | alignment,
- groupBox->palette, groupBox->state & State_Enabled, groupBox->text,
- textColor.isValid() ? QPalette::NoRole : QPalette::WindowText);
- painter->restore();
- }
-
- // Draw checkbox
- if (groupBox->subControls & SC_GroupBoxCheckBox) {
- QStyleOptionButton box;
- box.QStyleOption::operator=(*groupBox);
- box.rect = checkBoxRect;
- drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
- }
- }
- break;
-#endif //QT_NO_GROUPBOX
- default:
- QCommonStyle::drawComplexControl(control, option, painter, widget);
- }
-}
-
-/*!
- \reimp
-*/
-void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
-{
- Q_D(const QS60Style);
- const QS60StylePrivate::SkinElementFlags flags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled;
- switch (element) {
- case CE_CheckBox:
- case CE_RadioButton:
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- bool isRadio = (element == CE_RadioButton);
- QStyleOptionButton subopt = *btn;
-
- // Highlight needs to be drawn first, as it goes "underneath" the text and indicator.
- if (btn->state & State_HasFocus) {
- QStyleOptionFocusRect fropt;
- fropt.QStyleOption::operator=(*btn);
- fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect
- : SE_CheckBoxFocusRect, btn, widget);
- drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
-
- subopt.palette.setColor(QPalette::Active, QPalette::WindowText,
- subopt.palette.highlightedText().color());
- }
-
- subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator
- : SE_CheckBoxIndicator, btn, widget);
- drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
- &subopt, painter, widget);
- subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents
- : SE_CheckBoxContents, btn, widget);
-
- drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget);
- }
- break;
-
- case CE_PushButton:
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
-
- drawControl(CE_PushButtonBevel, btn, painter, widget);
- QStyleOptionButton subopt = *btn;
- subopt.rect = subElementRect(SE_PushButtonContents, btn, widget);
-
- drawControl(CE_PushButtonLabel, &subopt, painter, widget);
- }
- break;
- case CE_PushButtonBevel:
- if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- const bool isDisabled = !(option->state & State_Enabled);
- const bool isFlat = button->features & QStyleOptionButton::Flat;
- QS60StyleEnums::SkinParts skinPart;
- QS60StylePrivate::SkinElements skinElement;
- if (!isDisabled) {
- const bool isPressed = (option->state & State_Sunken) ||
- (option->state & State_On);
- if (isFlat) {
- skinPart =
- isPressed ? QS60StyleEnums::SP_QsnFrButtonTbCenterPressed : QS60StyleEnums::SP_QsnFrButtonTbCenter;
- } else {
- skinElement =
- isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal;
- }
- } else {
- if (isFlat)
- skinPart =QS60StyleEnums::SP_QsnFrButtonCenterInactive;
- else
- skinElement = QS60StylePrivate::SE_ButtonInactive;
- }
- if (isFlat)
- QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, flags);
- else
- QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags);
- }
- break;
-#ifndef QT_NO_TOOLBUTTON
- case CE_ToolButtonLabel:
- if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
- QStyleOptionToolButton optionToolButton = *toolBtn;
-
- if (!optionToolButton.icon.isNull() && (optionToolButton.state & State_Sunken)
- && (optionToolButton.state & State_Enabled)) {
-
- const QIcon::State state = optionToolButton.state & State_On ? QIcon::On : QIcon::Off;
- const QPixmap pm(optionToolButton.icon.pixmap(optionToolButton.rect.size().boundedTo(optionToolButton.iconSize),
- QIcon::Normal, state));
- optionToolButton.icon = generatedIconPixmap(QIcon::Selected, pm, &optionToolButton);
- }
-
- QCommonStyle::drawControl(element, &optionToolButton, painter, widget);
- }
- break;
-#endif //QT_NO_TOOLBUTTON
-#ifndef QT_NO_COMBOBOX
- case CE_ComboBoxLabel:
- if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- QStyleOption optionComboBox = *comboBox;
- optionComboBox.palette.setColor(QPalette::Active, QPalette::WindowText,
- optionComboBox.palette.text().color() );
- optionComboBox.palette.setColor(QPalette::Inactive, QPalette::WindowText,
- optionComboBox.palette.text().color() );
- QRect editRect = subControlRect(CC_ComboBox, comboBox, SC_ComboBoxEditField, widget);
- const int frameW = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
-
- if (!comboBox->currentIcon.isNull()) {
- const QIcon::Mode mode = comboBox->state & State_Enabled ? QIcon::Normal : QIcon::Disabled;
- const QPixmap pixmap = comboBox->currentIcon.pixmap(comboBox->iconSize, mode);
- QRect iconRect(editRect);
- iconRect.setWidth(comboBox->iconSize.width() + frameW);
- iconRect = alignedRect(comboBox->direction,
- Qt::AlignLeft | Qt::AlignVCenter,
- iconRect.size(), editRect);
- if (comboBox->editable)
- painter->fillRect(iconRect, optionComboBox.palette.brush(QPalette::Base));
- drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
-
- if (comboBox->direction == Qt::RightToLeft)
- editRect.setRight(editRect.right() - frameW - comboBox->iconSize.width());
- else
- editRect.setLeft(comboBox->iconSize.width() + frameW);
- }
- if (!comboBox->currentText.isEmpty() && !comboBox->editable) {
- const Qt::TextElideMode elideMode = (comboBox->direction == Qt::LeftToRight) ? Qt::ElideRight : Qt::ElideLeft;
- const QString text = comboBox->fontMetrics.elidedText(comboBox->currentText, elideMode, editRect.width());
-
- QCommonStyle::drawItemText(painter,
- editRect.adjusted(QS60StylePrivate::pixelMetric(PM_FrameCornerWidth), 0, -1, 0),
- visualAlignment(comboBox->direction, Qt::AlignLeft | Qt::AlignVCenter),
- comboBox->palette, comboBox->state & State_Enabled, text);
- }
- }
- break;
-#endif //QT_NO_COMBOBOX
-#ifndef QT_NO_ITEMVIEWS
- case CE_ItemViewItem:
- if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
- QStyleOptionViewItemV4 voptAdj = *vopt;
- painter->save();
-
- painter->setClipRect(voptAdj.rect);
- const bool isSelected = (vopt->state & State_Selected);
- const bool hasFocus = (vopt->state & State_HasFocus);
-
- bool isScrollBarVisible = false;
- int scrollBarWidth = 0;
- QList<QScrollBar *> scrollBars = widget->findChildren<QScrollBar *>();
- for (int i = 0; i < scrollBars.size(); ++i) {
- QScrollBar *scrollBar = scrollBars.at(i);
- if (scrollBar && scrollBar->orientation() == Qt::Vertical) {
- isScrollBarVisible = scrollBar->isVisible();
- scrollBarWidth = scrollBar->size().width();
- break;
- }
- }
-
- int rightValue = widget ? widget->contentsRect().right() : voptAdj.rect.right();
-
- if (isScrollBarVisible)
- rightValue -= scrollBarWidth;
-
- if (voptAdj.rect.right() > rightValue)
- voptAdj.rect.setRight(rightValue);
-
- const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &voptAdj, widget);
- QRect textRect = subElementRect(SE_ItemViewItemText, &voptAdj, widget);
- const QAbstractItemView *itemView = qobject_cast<const QAbstractItemView *>(widget);
-
- const bool singleSelection = itemView &&
- ((itemView->selectionMode() == QAbstractItemView::SingleSelection ||
- itemView->selectionMode() == QAbstractItemView::NoSelection));
- const bool selectItems = itemView && (itemView->selectionBehavior() == QAbstractItemView::SelectItems);
-
- // draw themed background for itemview unless background brush has been defined.
- if (vopt->backgroundBrush == Qt::NoBrush) {
- if (itemView) {
- //With single item selection, use highlight focus as selection indicator.
- if (singleSelection && isSelected){
- voptAdj.state = voptAdj.state | State_HasFocus;
- if (!hasFocus && selectItems) {
- painter->save();
- painter->setOpacity(0.5);
- }
- }
- drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);
- if (singleSelection && isSelected && !hasFocus && selectItems)
- painter->restore();
- }
- } else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);}
-
- // draw the icon
- const QIcon::Mode mode = (voptAdj.state & State_Enabled) ? QIcon::Normal : QIcon::Disabled;
- const QIcon::State state = (voptAdj.state & State_Open) ? QIcon::On : QIcon::Off;
- voptAdj.icon.paint(painter, iconRect, voptAdj.decorationAlignment, mode, state);
-
- // Draw selection check mark or checkbox
- if (itemView && (!singleSelection || (vopt->features & QStyleOptionViewItemV2::HasCheckIndicator))) {
- const QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget);
-
- QStyleOptionViewItemV4 checkMarkOption(voptAdj);
- if (selectionRect.isValid())
- checkMarkOption.rect = selectionRect;
- // Draw selection mark.
- if (isSelected && selectItems) {
- proxy()->drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget);
- // @todo: this should happen in the rect retrievel i.e. subElementRect()
- if (textRect.right() > selectionRect.left())
- textRect.setRight(selectionRect.left());
- } else if (voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) {
- checkMarkOption.state = checkMarkOption.state & ~State_HasFocus;
-
- switch (vopt->checkState) {
- case Qt::Unchecked:
- checkMarkOption.state |= State_Off;
- break;
- case Qt::PartiallyChecked:
- checkMarkOption.state |= State_NoChange;
- break;
- case Qt::Checked:
- checkMarkOption.state |= State_On;
- break;
- }
- drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget);
- }
- }
-
- // draw the text
- if (!voptAdj.text.isEmpty()) {
- if (hasFocus)
- painter->setPen(voptAdj.palette.highlightedText().color());
- else
- painter->setPen(voptAdj.palette.text().color());
- d->viewItemDrawText(painter, &voptAdj, textRect);
- }
- painter->restore();
- }
- break;
-#endif // QT_NO_ITEMVIEWS
-#ifndef QT_NO_TABBAR
- case CE_TabBarTabShape:
- if (const QStyleOptionTabV3 *optionTab = qstyleoption_cast<const QStyleOptionTabV3 *>(option)) {
- QStyleOptionTabV3 optionTabAdj = *optionTab;
- const bool isSelected = optionTab->state & State_Selected;
- const bool directionMirrored = (optionTab->direction == Qt::RightToLeft);
- QS60StylePrivate::SkinElements skinElement;
- switch (optionTab->shape) {
- case QTabBar::TriangularEast:
- case QTabBar::RoundedEast:
- skinElement = isSelected ? QS60StylePrivate::SE_TabBarTabEastActive:
- QS60StylePrivate::SE_TabBarTabEastInactive;
- break;
- case QTabBar::TriangularSouth:
- case QTabBar::RoundedSouth:
- skinElement = isSelected ? QS60StylePrivate::SE_TabBarTabSouthActive:
- QS60StylePrivate::SE_TabBarTabSouthInactive;
- break;
- case QTabBar::TriangularWest:
- case QTabBar::RoundedWest:
- skinElement = isSelected ? QS60StylePrivate::SE_TabBarTabWestActive:
- QS60StylePrivate::SE_TabBarTabWestInactive;
- break;
- case QTabBar::TriangularNorth:
- case QTabBar::RoundedNorth:
- default:
- skinElement = isSelected ? QS60StylePrivate::SE_TabBarTabNorthActive:
- QS60StylePrivate::SE_TabBarTabNorthInactive;
- break;
- }
- if (skinElement == QS60StylePrivate::SE_TabBarTabEastInactive ||
- skinElement == QS60StylePrivate::SE_TabBarTabNorthInactive ||
- skinElement == QS60StylePrivate::SE_TabBarTabSouthInactive ||
- skinElement == QS60StylePrivate::SE_TabBarTabWestInactive ||
- skinElement == QS60StylePrivate::SE_TabBarTabEastActive ||
- skinElement == QS60StylePrivate::SE_TabBarTabNorthActive ||
- skinElement == QS60StylePrivate::SE_TabBarTabSouthActive ||
- skinElement==QS60StylePrivate::SE_TabBarTabWestActive) {
- const int borderThickness =
- QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
- int tabOverlap = pixelMetric(PM_TabBarTabOverlap);
- if (tabOverlap > borderThickness)
- tabOverlap -= borderThickness;
-
- const bool usesScrollButtons =
- (widget) ? (qobject_cast<const QTabBar*>(widget))->usesScrollButtons() : false;
- const int roomForScrollButton =
- usesScrollButtons ? QS60StylePrivate::pixelMetric(PM_TabBarScrollButtonWidth) : 0;
-
- // adjust for overlapping tabs and scrollbuttons, if necessary
- if (skinElement == QS60StylePrivate::SE_TabBarTabEastInactive ||
- skinElement == QS60StylePrivate::SE_TabBarTabEastActive ||
- skinElement == QS60StylePrivate::SE_TabBarTabWestInactive ||
- skinElement == QS60StylePrivate::SE_TabBarTabWestActive){
- if (optionTabAdj.position == QStyleOptionTabV3::Beginning)
- optionTabAdj.rect.adjust(0, roomForScrollButton, 0, tabOverlap);
- else if (optionTabAdj.position == QStyleOptionTabV3::End)
- optionTabAdj.rect.adjust(0, 0, 0, tabOverlap);
- else
- optionTabAdj.rect.adjust(0, 0, 0, tabOverlap);
- } else {
- if (directionMirrored) {
- if (optionTabAdj.position == QStyleOptionTabV3::Beginning)
- optionTabAdj.rect.adjust(-tabOverlap, 0, -roomForScrollButton, 0);
- else
- optionTabAdj.rect.adjust(-tabOverlap, 0, 0, 0);
- } else {
- if (optionTabAdj.position == QStyleOptionTabV3::Beginning)
- optionTabAdj.rect.adjust(roomForScrollButton, 0, tabOverlap, 0);
- else
- optionTabAdj.rect.adjust(0, 0, tabOverlap, 0);
- }
- }
- }
- QS60StylePrivate::drawSkinElement(skinElement, painter, optionTabAdj.rect, flags);
- }
- break;
- case CE_TabBarTabLabel:
- if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(option)) {
- QStyleOptionTabV3 optionTab = *tab;
- QRect tr = optionTab.rect;
- const bool directionMirrored = (optionTab.direction == Qt::RightToLeft);
- const int borderThickness =
- QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
- int tabOverlap = pixelMetric(PM_TabBarTabOverlap);
- if (tabOverlap > borderThickness)
- tabOverlap -= borderThickness;
- const bool usesScrollButtons =
- (widget) ? (qobject_cast<const QTabBar*>(widget))->usesScrollButtons() : false;
- const int roomForScrollButton =
- usesScrollButtons ? QS60StylePrivate::pixelMetric(PM_TabBarScrollButtonWidth) : 0;
-
- switch (tab->shape) {
- case QTabBar::TriangularWest:
- case QTabBar::RoundedWest:
- case QTabBar::TriangularEast:
- case QTabBar::RoundedEast:
- tr.adjust(0, 0, 0, tabOverlap);
- break;
- case QTabBar::TriangularSouth:
- case QTabBar::RoundedSouth:
- case QTabBar::TriangularNorth:
- case QTabBar::RoundedNorth:
- default:
- if (directionMirrored)
- tr.adjust(-tabOverlap, 0, 0, 0);
- else
- tr.adjust(0, 0, tabOverlap, 0);
- break;
- }
- painter->save();
- QFont f = painter->font();
- f.setPointSizeF(f.pointSizeF() * KTabFontMul);
- painter->setFont(f);
-
- const bool selected = optionTab.state & State_Selected;
- if (selected)
- optionTab.palette.setColor(QPalette::Active, QPalette::WindowText,
- optionTab.palette.highlightedText().color());
-
- const bool verticalTabs = optionTab.shape == QTabBar::RoundedEast
- || optionTab.shape == QTabBar::RoundedWest
- || optionTab.shape == QTabBar::TriangularEast
- || optionTab.shape == QTabBar::TriangularWest;
-
- //make room for scrollbuttons
- if (!verticalTabs) {
- if ((tab->position == QStyleOptionTabV3::Beginning && !directionMirrored))
- tr.adjust(roomForScrollButton, 0, 0, 0);
- else if ((tab->position == QStyleOptionTabV3::Beginning && directionMirrored))
- tr.adjust(0, 0, -roomForScrollButton, 0);
- } else {
- if (tab->position == QStyleOptionTabV3::Beginning)
- tr.adjust(0, roomForScrollButton, 0, 0);
- }
-
- if (verticalTabs) {
- painter->save();
- int newX, newY, newRotation;
- if (optionTab.shape == QTabBar::RoundedEast || optionTab.shape == QTabBar::TriangularEast) {
- newX = tr.width();
- newY = tr.y();
- newRotation = 90;
- } else {
- newX = 0;
- newY = tr.y() + tr.height();
- newRotation = -90;
- }
- tr.setRect(0, 0, tr.height(), tr.width());
- QTransform m;
- m.translate(newX, newY);
- m.rotate(newRotation);
- painter->setTransform(m, true);
- }
- tr.adjust(0, 0, pixelMetric(PM_TabBarTabShiftHorizontal, tab, widget),
- pixelMetric(PM_TabBarTabShiftVertical, tab, widget));
-
- if (selected) {
- tr.setBottom(tr.bottom() - pixelMetric(PM_TabBarTabShiftVertical, tab, widget));
- tr.setRight(tr.right() - pixelMetric(PM_TabBarTabShiftHorizontal, tab, widget));
- }
-
- int alignment = Qt::AlignCenter | Qt::TextShowMnemonic;
- if (!styleHint(SH_UnderlineShortcut, &optionTab, widget))
- alignment |= Qt::TextHideMnemonic;
- if (!optionTab.icon.isNull()) {
- QSize iconSize = optionTab.iconSize;
- if (!iconSize.isValid()) {
- const int iconExtent = pixelMetric(PM_TabBarIconSize);
- iconSize = QSize(iconExtent, iconExtent);
- }
- QPixmap tabIcon = optionTab.icon.pixmap(iconSize,
- (optionTab.state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
- if (tab->text.isEmpty())
- painter->drawPixmap(tr.center().x() - (tabIcon.height() >> 1),
- tr.center().y() - (tabIcon.height() >> 1),
- tabIcon);
- else
- painter->drawPixmap(tr.left() + tabOverlap,
- tr.center().y() - (tabIcon.height() >> 1),
- tabIcon);
- tr.setLeft(tr.left() + iconSize.width() + 4); //todo: magic four
- }
-
- QCommonStyle::drawItemText(painter, tr, alignment, optionTab.palette, tab->state & State_Enabled, tab->text, QPalette::WindowText);
- if (verticalTabs)
- painter->restore();
-
- painter->restore();
- }
- break;
-#endif // QT_NO_TABBAR
-#ifndef QT_NO_PROGRESSBAR
- case CE_ProgressBarContents:
- if (const QStyleOptionProgressBarV2 *optionProgressBar = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
- QRect progressRect = optionProgressBar->rect;
-
- if (optionProgressBar->minimum == optionProgressBar->maximum && optionProgressBar->minimum == 0) {
- // busy indicator
- const QS60StylePrivate::SkinElementFlag orientationFlag = optionProgressBar->orientation == Qt::Horizontal ?
- QS60StylePrivate::SF_PointNorth : QS60StylePrivate::SF_PointWest;
-
- QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnGrafBarWaitAnim,
- painter, progressRect, flags | orientationFlag | QS60StylePrivate::SF_Animation );
- } else {
- const qreal progressFactor = (optionProgressBar->minimum == optionProgressBar->maximum) ? 1.0
- : (qreal)optionProgressBar->progress / optionProgressBar->maximum;
- const int frameWidth = pixelMetric(PM_DefaultFrameWidth, option, widget);
- if (optionProgressBar->orientation == Qt::Horizontal) {
- progressRect.setWidth(int(progressRect.width() * progressFactor));
- if(optionProgressBar->direction == Qt::RightToLeft)
- progressRect.translate(optionProgressBar->rect.width() - progressRect.width(), 0);
- progressRect.adjust(frameWidth, 0, -frameWidth, 0);
- } else {
- progressRect.adjust(0, frameWidth, 0, -frameWidth);
- progressRect.setTop(progressRect.bottom() - int(progressRect.height() * progressFactor));
- }
-
- const QS60StylePrivate::SkinElements skinElement = optionProgressBar->orientation == Qt::Horizontal ?
- QS60StylePrivate::SE_ProgressBarIndicatorHorizontal : QS60StylePrivate::SE_ProgressBarIndicatorVertical;
- QS60StylePrivate::drawSkinElement(skinElement, painter, progressRect, flags);
- }
- }
- break;
- case CE_ProgressBarGroove:
- if (const QStyleOptionProgressBarV2 *optionProgressBar = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
- const QS60StylePrivate::SkinElements skinElement = optionProgressBar->orientation == Qt::Horizontal ?
- QS60StylePrivate::SE_ProgressBarGrooveHorizontal : QS60StylePrivate::SE_ProgressBarGrooveVertical;
- QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags);
- }
- break;
- case CE_ProgressBarLabel:
- if (const QStyleOptionProgressBarV2 *progressbar = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
- QStyleOptionProgressBarV2 optionProgressBar = *progressbar;
- QCommonStyle::drawItemText(painter, progressbar->rect, flags | Qt::AlignCenter | Qt::TextSingleLine, optionProgressBar.palette,
- progressbar->state & State_Enabled, progressbar->text, QPalette::WindowText);
- }
- break;
-#endif // QT_NO_PROGRESSBAR
-#ifndef QT_NO_MENU
- case CE_MenuItem:
- if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
- QStyleOptionMenuItem optionMenuItem = *menuItem;
-
- bool drawSubMenuIndicator = false;
- bool drawSeparator = false;
- switch(menuItem->menuItemType) {
- case QStyleOptionMenuItem::Separator:
- drawSeparator = true;
- break;
- case QStyleOptionMenuItem::Scroller:
- return; // no scrollers in S60 menus
- case QStyleOptionMenuItem::SubMenu:
- drawSubMenuIndicator = true;
- break;
- default:
- break;
- }
- if (drawSeparator) {
- painter->save();
- painter->setPen(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 10, 0));
- painter->drawLine(optionMenuItem.rect.topLeft(), optionMenuItem.rect.bottomRight());
- painter->restore();
- return;
- }
- const bool enabled = optionMenuItem.state & State_Enabled;
- const bool checkable = optionMenuItem.checkType != QStyleOptionMenuItem::NotCheckable;
- bool ignoreCheckMark = false;
-
-#ifndef QT_NO_COMBOBOX
- if (qobject_cast<const QComboBox*>(widget))
- ignoreCheckMark = true; //ignore the checkmarks provided by the QComboMenuDelegate
-#endif
-
- uint text_flags = Qt::AlignLeading | Qt::TextShowMnemonic | Qt::TextDontClip
- | Qt::TextSingleLine | Qt::AlignVCenter;
- if (!styleHint(SH_UnderlineShortcut, menuItem, widget))
- text_flags |= Qt::TextHideMnemonic;
-
- QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget);
- QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget);
-
- QStyleOptionMenuItem optionCheckBox;
-
- //Regardless of checkbox visibility, make room for it, this mirrors native implementation,
- //where text and icon placement is static regardless of content of menu item.
- optionCheckBox.QStyleOptionMenuItem::operator=(*menuItem);
- optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth));
- optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight));
-
- const int vSpacing = QS60StylePrivate::pixelMetric(PM_LayoutVerticalSpacing);
- //The vertical spacing is doubled; it needs one spacing to separate checkbox from
- //highlight and then it needs one to separate it whatever is shown after it (text/icon/both).
- const int moveByX = optionCheckBox.rect.width() + 2 * vSpacing;
- optionCheckBox.rect.moveCenter(QPoint(
- optionCheckBox.rect.center().x() + moveByX >> 1,
- menuItem->rect.center().y()));
-
- if (optionMenuItem.direction != Qt::LeftToRight)
- optionCheckBox.rect.translate(textRect.width() + iconRect.width(), 0);
-
-
- const bool selected = (option->state & State_Selected) && (option->state & State_Enabled);
- if (selected) {
- const int spacing = ignoreCheckMark ? (vSpacing + QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth)) : 0;
- const int start = optionMenuItem.rect.left() + spacing;
- const int end = optionMenuItem.rect.right() - spacing;
- //-1 adjustment to avoid highlight being on top of possible separator item
- const QRect highlightRect = QRect(
- QPoint(start, option->rect.top()),
- QPoint(end, option->rect.bottom() - 1));
- QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, highlightRect, flags);
- }
-
- if (checkable && !ignoreCheckMark)
- drawPrimitive(PE_IndicatorMenuCheckMark, &optionCheckBox, painter, widget);
-
- //draw icon and/or checkState
- QPixmap pix = menuItem->icon.pixmap(pixelMetric(PM_SmallIconSize),
- enabled ? QIcon::Normal : QIcon::Disabled);
- const bool itemWithIcon = !pix.isNull();
- if (itemWithIcon) {
- drawItemPixmap(painter, iconRect, text_flags, pix);
- if (optionMenuItem.direction == Qt::LeftToRight)
- textRect.translate(vSpacing, 0);
- else
- textRect.translate(-vSpacing, 0);
- textRect.setWidth(textRect.width() - vSpacing);
- }
-
- //draw indicators
- if (drawSubMenuIndicator) {
- QStyleOptionMenuItem arrowOptions;
- arrowOptions.QStyleOption::operator=(*menuItem);
- const int indicatorWidth = (pixelMetric(PM_ListViewIconSize, option, widget) >> 1) +
- pixelMetric(PM_LayoutVerticalSpacing, option, widget);
- if (optionMenuItem.direction == Qt::LeftToRight)
- arrowOptions.rect.setLeft(textRect.right());
- arrowOptions.rect.setWidth(indicatorWidth);
- //by default sub menu indicator in S60 points to east,so here icon
- // direction is set to north (and south when in RightToLeft)
- const QS60StylePrivate::SkinElementFlag arrowDirection = (arrowOptions.direction == Qt::LeftToRight) ?
- QS60StylePrivate::SF_PointNorth : QS60StylePrivate::SF_PointSouth;
- painter->save();
- painter->setPen(option->palette.windowText().color());
- QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnIndiSubmenu, painter, arrowOptions.rect,
- (flags | QS60StylePrivate::SF_ColorSkinned | arrowDirection));
- painter->restore();
- }
-
- //draw text
- if (!enabled){
- //In s60, if something becomes disabled, it is removed from menu, so no native look-alike available.
- optionMenuItem.palette.setColor(QPalette::Disabled, QPalette::Text, QS60StylePrivate::lighterColor(
- optionMenuItem.palette.color(QPalette::Disabled, QPalette::Text)));
- painter->save();
- painter->setOpacity(0.5);
- }
- if (selected)
- optionMenuItem.palette.setColor(
- QPalette::Active, QPalette::Text, optionMenuItem.palette.highlightedText().color());
-
- QCommonStyle::drawItemText(painter, textRect, text_flags,
- optionMenuItem.palette, enabled,
- optionMenuItem.text, QPalette::Text);
-
- //In Sym^3, native menu items have "lines" between them
- if (QS60StylePrivate::isSingleClickUi()) {
- int diff = widget->geometry().bottom() - optionMenuItem.rect.bottom();
- if (const QComboBox *cb = qobject_cast<const QComboBox*>(widget))
- diff = cb->view()->geometry().bottom() - optionMenuItem.rect.bottom();
-
- // Skip drawing the horizontal line for the last menu item.
- if (diff > optionMenuItem.rect.height()) {
- const QColor lineColorAlpha = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 15, 0);
- //native platform sets each color byte to same value for "line 16" which just defines alpha for
- //menuitem lines; lets use first byte "red".
- QColor lineColor = optionMenuItem.palette.text().color();
- if (lineColorAlpha.isValid())
- lineColor.setAlpha(lineColorAlpha.red());
- painter->save();
- painter->setPen(lineColor);
- const int horizontalMargin = 2 * QS60StylePrivate::pixelMetric(PM_FrameCornerWidth) - QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
- const int lineStartX = optionMenuItem.rect.left() + horizontalMargin;
- const int lineEndX = optionMenuItem.rect.right() - horizontalMargin;
- painter->drawLine(QPoint(lineStartX, optionMenuItem.rect.bottom()), QPoint(lineEndX, optionMenuItem.rect.bottom()));
- painter->restore();
- }
- }
- if (!enabled)
- painter->restore();
- }
- break;
- case CE_MenuEmptyArea:
- break;
-#endif //QT_NO_MENU
-
-#ifndef QT_NO_MENUBAR
- case CE_MenuBarEmptyArea:
- break;
-#endif //QT_NO_MENUBAR
-
- case CE_HeaderSection:
- if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
- painter->save();
- QPen linePen = QPen(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 1, header));
- const int penWidth = (header->orientation == Qt::Horizontal) ?
- linePen.width() + QS60StylePrivate::pixelMetric(PM_BoldLineWidth)
- : linePen.width() + QS60StylePrivate::pixelMetric(PM_ThinLineWidth);
- linePen.setWidth(penWidth);
- painter->setPen(linePen);
- if (header->orientation == Qt::Horizontal){
- painter->drawLine(header->rect.bottomLeft(), header->rect.bottomRight());
- } else {
- if ( header->direction == Qt::LeftToRight ) {
- painter->drawLine(header->rect.topRight(), header->rect.bottomRight());
- } else {
- painter->drawLine(header->rect.topLeft(), header->rect.bottomLeft());
- }
- }
- painter->restore();
-
- //Draw corner button as normal pushButton.
- if (qobject_cast<const QAbstractButton *>(widget)) {
- //Make cornerButton slightly smaller so that it is not on top of table border graphic.
- QStyleOptionHeader subopt = *header;
- const int borderTweak =
- QS60StylePrivate::pixelMetric(PM_FrameCornerWidth) >> 1;
- if (subopt.direction == Qt::LeftToRight)
- subopt.rect.adjust(borderTweak, borderTweak, 0, -borderTweak);
- else
- subopt.rect.adjust(0, borderTweak, -borderTweak, -borderTweak);
- drawPrimitive(PE_PanelButtonBevel, &subopt, painter, widget);
- } else if ((header->palette.brush(QPalette::Button) != Qt::transparent)) {
- //Draw non-themed background. Background for theme is drawn in CE_ShapedFrame
- //to get continuous theme graphic across all the header cells.
- qDrawShadePanel(painter, header->rect, header->palette,
- header->state & (State_Sunken | State_On), penWidth,
- &header->palette.brush(QPalette::Button));
- }
- }
- break;
- case CE_HeaderEmptyArea: // no need to draw this
- break;
- case CE_Header:
- if ( const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
- drawControl(CE_HeaderSection, header, painter, widget);
- QStyleOptionHeader subopt = *header;
- subopt.rect = subElementRect(SE_HeaderLabel, header, widget);
- if (subopt.rect.isValid())
- drawControl(CE_HeaderLabel, &subopt, painter, widget);
- if (header->sortIndicator != QStyleOptionHeader::None) {
- subopt.rect = subElementRect(SE_HeaderArrow, option, widget);
- drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget);
- }
- }
- break;
-#ifndef QT_NO_TOOLBAR
- case CE_ToolBar:
- if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) {
- const QToolBar *tbWidget = qobject_cast<const QToolBar *>(widget);
-
- //toolbar within a toolbar, skip
- if (!tbWidget || (widget && qobject_cast<QToolBar *>(widget->parentWidget())))
- break;
-
- // Normally in S60 5.0+ there is no background for toolbar, but in some cases with versatile QToolBar,
- // it looks a bit strange. So, lets fillRect with Button.
- if (!QS60StylePrivate::isToolBarBackground()) {
- QList<QAction *> actions = tbWidget->actions();
- bool justToolButtonsInToolBar = true;
- for (int i = 0; i < actions.size(); ++i) {
- QWidget *childWidget = tbWidget->widgetForAction(actions.at(i));
- const QToolButton *button = qobject_cast<const QToolButton *>(childWidget);
- if (!button){
- justToolButtonsInToolBar = false;
- }
- }
-
- // Draw frame background
- // for vertical toolbars with text only and
- // for toolbars with extension buttons and
- // for toolbars with widgets in them.
- if (!justToolButtonsInToolBar ||
- (tbWidget &&
- (tbWidget->orientation() == Qt::Vertical) &&
- (tbWidget->toolButtonStyle() == Qt::ToolButtonTextOnly))) {
- painter->save();
- if (widget)
- painter->setBrush(widget->palette().button());
- painter->setOpacity(0.3);
- painter->fillRect(toolBar->rect, painter->brush());
- painter->restore();
- }
- } else {
- QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBar, painter, toolBar->rect, flags);
- }
- }
- break;
-#endif //QT_NO_TOOLBAR
- case CE_ShapedFrame:
- if (const QTextEdit *textEdit = qobject_cast<const QTextEdit *>(widget)) {
- const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option);
- if (frame && QS60StylePrivate::canDrawThemeBackground(frame->palette.base(), widget))
- QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_Editor, painter, option->rect, flags);
- else
- QCommonStyle::drawControl(element, option, painter, widget);
- } else if (qobject_cast<const QTableView *>(widget)) {
- QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableItem, painter, option->rect, flags);
- } else if (const QHeaderView *header = qobject_cast<const QHeaderView *>(widget)) {
- //QS60style draws header background here instead of in each headersection, to get
- //continuous graphic from section to section.
- QS60StylePrivate::SkinElementFlags adjustableFlags = flags;
- QRect headerRect = option->rect;
- if (header->orientation() != Qt::Horizontal) {
- //todo: update to horizontal table graphic
- adjustableFlags = (adjustableFlags | QS60StylePrivate::SF_PointWest);
- } else {
- const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
- if (option->direction == Qt::LeftToRight)
- headerRect.adjust(-2 * frameWidth, 0, 0, 0);
- else
- headerRect.adjust(0, 0, 2 * frameWidth, 0);
- }
- if (option->palette.brush(QPalette::Button).color() == Qt::transparent)
- QS60StylePrivate::drawSkinElement(
- QS60StylePrivate::SE_TableHeaderItem, painter, headerRect, adjustableFlags);
-
- } else if (qobject_cast<const QFrame *>(widget)) {
- QCommonStyle::drawControl(element, option, painter, widget);
- }
- break;
- case CE_MenuScroller:
- break;
- case CE_FocusFrame: {
-#ifdef QT_KEYPAD_NAVIGATION
- bool editFocus = false;
- if (const QFocusFrame *focusFrame = qobject_cast<const QFocusFrame*>(widget)) {
- if (focusFrame->widget() && focusFrame->widget()->hasEditFocus())
- editFocus = true;
- }
- const qreal opacity = editFocus ? 1 : 0.75; // Trial and error factors. Feel free to improve.
-#else
- const qreal opacity = 0.85;
-#endif
- // We need to reduce the focus frame size if LayoutSpacing is smaller than FocusFrameMargin
- // Otherwise, we would overlay adjacent widgets.
- const int frameHeightReduction =
- qMin(0, pixelMetric(PM_LayoutVerticalSpacing)
- - pixelMetric(PM_FocusFrameVMargin));
- const int frameWidthReduction =
- qMin(0, pixelMetric(PM_LayoutHorizontalSpacing)
- - pixelMetric(PM_FocusFrameHMargin));
- const int rounding =
- qMin(pixelMetric(PM_FocusFrameVMargin),
- pixelMetric(PM_LayoutVerticalSpacing));
- const QRect frameRect =
- option->rect.adjusted(-frameWidthReduction, -frameHeightReduction,
- frameWidthReduction, frameHeightReduction);
- QPainterPath framePath;
- framePath.addRoundedRect(frameRect, rounding, rounding);
-
- painter->save();
- painter->setRenderHint(QPainter::Antialiasing);
- painter->setOpacity(opacity);
- painter->fillPath(framePath, option->palette.color(QPalette::Text));
- painter->restore();
- }
- break;
- case CE_Splitter:
- if (option->state & State_Sunken && option->state & State_Enabled && QS60StylePrivate::themePalette()) {
- painter->save();
- painter->setOpacity(0.5);
- painter->setBrush(QS60StylePrivate::themePalette()->light());
- painter->setRenderHint(QPainter::Antialiasing);
- const qreal roundRectRadius = 4 * goldenRatio;
- painter->drawRoundedRect(option->rect, roundRectRadius, roundRectRadius);
- painter->restore();
- }
- break;
- default:
- QCommonStyle::drawControl(element, option, painter, widget);
- }
-}
-
-/*!
- \reimp
-*/
-void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
-{
- const QS60StylePrivate::SkinElementFlags flags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled;
- bool commonStyleDraws = false;
-
- switch (element) {
- case PE_FrameFocusRect: {
- //Draw themed highlight to radiobuttons and checkboxes.
- //For other widgets skip, unless palette has been modified. In that case, draw with commonstyle.
- if (QS60StylePrivate::equalToThemePalette(option->palette.highlight().color(), QPalette::Highlight)) {
- if ((qstyleoption_cast<const QStyleOptionFocusRect *>(option) &&
- (qobject_cast<const QRadioButton *>(widget) || qobject_cast<const QCheckBox *>(widget))))
- QS60StylePrivate::drawSkinElement(
- QS60StylePrivate::isWidgetPressed(widget) ?
- QS60StylePrivate::SE_ListItemPressed :
- QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags);
- } else {
- commonStyleDraws = true;
- }
- }
- break;
-#ifndef QT_NO_LINEEDIT
- case PE_PanelLineEdit:
- if (const QStyleOptionFrame *lineEdit = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
-#ifndef QT_NO_COMBOBOX
- if (widget && qobject_cast<const QComboBox *>(widget->parentWidget()))
- break;
-#endif
- if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget))
- QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_FrameLineEdit, painter, option->rect, flags);
- else
- commonStyleDraws = true;
- }
- break;
-#endif // QT_NO_LINEEDIT
- case PE_IndicatorCheckBox: {
- // Draw checkbox indicator as color skinned graphics.
- const QS60StyleEnums::SkinParts skinPart = (option->state & State_On) ?
- QS60StyleEnums::SP_QgnIndiCheckboxOn : QS60StyleEnums::SP_QgnIndiCheckboxOff;
- painter->save();
-
- if (QS60StylePrivate::equalToThemePalette(option->palette.windowText().color(), QPalette::WindowText))
- painter->setPen(option->palette.windowText().color());
-
- QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, flags | QS60StylePrivate::SF_ColorSkinned );
- painter->restore();
- }
- break;
- case PE_IndicatorViewItemCheck:
-#ifndef QT_NO_ITEMVIEWS
- if (const QAbstractItemView *itemView = (qobject_cast<const QAbstractItemView *>(widget))) {
- if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
- const bool checkBoxVisible = vopt->features & QStyleOptionViewItemV2::HasCheckIndicator;
- const bool singleSelection = itemView->selectionMode() ==
- QAbstractItemView::SingleSelection || itemView->selectionMode() == QAbstractItemView::NoSelection;
- // draw either checkbox at the beginning
- if (checkBoxVisible && singleSelection) {
- drawPrimitive(PE_IndicatorCheckBox, option, painter, widget);
- // ... or normal "tick" selection at the end.
- } else if (option->state & State_Selected) {
- QRect tickRect = option->rect;
- const int frameBorderWidth = QS60StylePrivate::pixelMetric(PM_FrameCornerWidth);
- // adjust tickmark rect to exclude frame border
- tickRect.adjust(0, -frameBorderWidth, 0, -frameBorderWidth);
- QS60StyleEnums::SkinParts skinPart = QS60StyleEnums::SP_QgnIndiMarkedAdd;
- QS60StylePrivate::drawSkinPart(skinPart, painter, tickRect,
- (flags | QS60StylePrivate::SF_ColorSkinned));
- }
- }
- }
-#endif //QT_NO_ITEMVIEWS
- break;
- case PE_IndicatorRadioButton: {
- QRect buttonRect = option->rect;
- //there is empty (a. 33%) space in svg graphics for radiobutton
- const qreal reduceWidth = (qreal)buttonRect.width() / 3.0;
- const qreal rectWidth = (qreal)option->rect.width() != 0 ? option->rect.width() : 1.0;
- // Try to occupy the full area
- const qreal scaler = 1 + (reduceWidth/rectWidth);
- buttonRect.setWidth((int)((buttonRect.width()-reduceWidth) * scaler));
- buttonRect.setHeight((int)(buttonRect.height() * scaler));
- // move the rect up for half of the new height-gain
- const int newY = (buttonRect.bottomRight().y() - option->rect.bottomRight().y()) >> 1 ;
- buttonRect.adjust(0, -newY, -1, -newY);
-
- painter->save();
- const QColor themeColor = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, option);
- const QColor buttonTextColor = option->palette.buttonText().color();
- if (themeColor != buttonTextColor)
- painter->setPen(buttonTextColor);
- else
- painter->setPen(themeColor);
-
- // Draw radiobutton indicator as color skinned graphics.
- QS60StyleEnums::SkinParts skinPart = (option->state & State_On) ?
- QS60StyleEnums::SP_QgnIndiRadiobuttOn : QS60StyleEnums::SP_QgnIndiRadiobuttOff;
- QS60StylePrivate::drawSkinPart(skinPart, painter, buttonRect,
- (flags | QS60StylePrivate::SF_ColorSkinned));
- painter->restore();
- }
- break;
- case PE_PanelButtonCommand:
- case PE_PanelButtonTool:
- case PE_PanelButtonBevel:
- case PE_FrameButtonBevel:
- if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget)) {
- const bool isPressed = (option->state & State_Sunken) || (option->state & State_On);
- QS60StylePrivate::SkinElements skinElement;
- if (element == PE_PanelButtonTool)
- skinElement = isPressed ? QS60StylePrivate::SE_ToolBarButtonPressed : QS60StylePrivate::SE_ToolBarButton;
- else
- skinElement = isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal;
- QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags);
- } else {
- commonStyleDraws = true;
- }
- break;
-#ifndef QT_NO_TOOLBUTTON
- case PE_IndicatorArrowDown:
- case PE_IndicatorArrowLeft:
- case PE_IndicatorArrowRight:
- case PE_IndicatorArrowUp: {
- QS60StyleEnums::SkinParts skinPart;
- if (element==PE_IndicatorArrowDown)
- skinPart = QS60StyleEnums::SP_QgnGrafScrollArrowDown;
- else if (element==PE_IndicatorArrowLeft)
- skinPart = QS60StyleEnums::SP_QgnGrafScrollArrowLeft;
- else if (element==PE_IndicatorArrowRight)
- skinPart = QS60StyleEnums::SP_QgnGrafScrollArrowRight;
- else if (element==PE_IndicatorArrowUp)
- skinPart = QS60StyleEnums::SP_QgnGrafScrollArrowUp;
-
- QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, flags);
- }
- break;
-#endif //QT_NO_TOOLBUTTON
-#ifndef QT_NO_SPINBOX
- case PE_IndicatorSpinDown:
- case PE_IndicatorSpinUp:
- if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- if (QS60StylePrivate::canDrawThemeBackground(spinBox->palette.base(), widget)) {
- QStyleOptionSpinBox optionSpinBox = *spinBox;
- const QS60StyleEnums::SkinParts part = (element == PE_IndicatorSpinUp) ?
- QS60StyleEnums::SP_QgnGrafScrollArrowUp :
- QS60StyleEnums::SP_QgnGrafScrollArrowDown;
- const int iconMargin = QS60StylePrivate::pixelMetric(PM_FrameCornerWidth) >> 1;
- optionSpinBox.rect.translate(0, (element == PE_IndicatorSpinDown) ? iconMargin : -iconMargin );
- QS60StylePrivate::drawSkinPart(part, painter, optionSpinBox.rect, flags);
- } else {
- commonStyleDraws = true;
- }
- }
-#endif //QT_NO_SPINBOX
-#ifndef QT_NO_COMBOBOX
- if (const QStyleOptionFrame *cmb = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
- if (QS60StylePrivate::canDrawThemeBackground( option->palette.base(), widget)) {
- // We want to draw down arrow here for comboboxes as well.
- QStyleOptionFrame optionsComboBox = *cmb;
- const QS60StyleEnums::SkinParts part = QS60StyleEnums::SP_QgnGrafScrollArrowDown;
- const int iconMargin = QS60StylePrivate::pixelMetric(PM_FrameCornerWidth) >> 1;
- optionsComboBox.rect.translate(0, (element == PE_IndicatorSpinDown) ? iconMargin : -iconMargin );
- QS60StylePrivate::drawSkinPart(part, painter, optionsComboBox.rect, flags);
- } else {
- commonStyleDraws = true;
- }
- }
-#endif //QT_NO_COMBOBOX
- break;
- case PE_IndicatorSpinMinus:
- case PE_IndicatorSpinPlus:
- if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- QStyleOptionSpinBox optionSpinBox = *spinBox;
- QCommonStyle::drawPrimitive(element, &optionSpinBox, painter, widget);
- }
-#ifndef QT_NO_COMBOBOX
- else if (const QStyleOptionFrame *cmb = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
- // We want to draw down arrow here for comboboxes as well.
- QStyleOptionFrame comboBox = *cmb;
- const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
- comboBox.rect.adjust(0, frameWidth, 0, -frameWidth);
- QCommonStyle::drawPrimitive(element, &comboBox, painter, widget);
- }
-#endif //QT_NO_COMBOBOX
- break;
- case PE_Widget:
- if (QS60StylePrivate::drawsOwnThemeBackground(widget)
-#ifndef QT_NO_COMBOBOX
- || qobject_cast<const QComboBoxListView *>(widget)
-#endif //QT_NO_COMBOBOX
-#ifndef QT_NO_MENU
- || qobject_cast<const QMenu *> (widget)
-#endif //QT_NO_MENU
- ) {
- //Need extra check since dialogs have their own theme background
- if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget)
- && QS60StylePrivate::equalToThemePalette(option->palette.window().texture().cacheKey(), QPalette::Window)) {
- const bool comboMenu = qobject_cast<const QComboBoxListView *>(widget);
- // Add margin area to the background, to avoid background being cut for first and last item.
- const int verticalMenuAdjustment = comboMenu ? QS60StylePrivate::pixelMetric(PM_MenuVMargin) : 0;
- const QRect adjustedMenuRect = option->rect.adjusted(0, -verticalMenuAdjustment, 0, verticalMenuAdjustment);
- QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PopupBackground, painter, adjustedMenuRect, flags);
- } else {
- commonStyleDraws = true;
- }
- }
- break;
- case PE_FrameWindow:
- case PE_FrameTabWidget:
- if (const QStyleOptionTabWidgetFrame *tabFrame = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) {
- QStyleOptionTabWidgetFrame optionTabFrame = *tabFrame;
- QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PanelBackground, painter, optionTabFrame.rect, flags);
- }
- break;
- case PE_IndicatorHeaderArrow:
- if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
- if (header->sortIndicator & QStyleOptionHeader::SortUp)
- drawPrimitive(PE_IndicatorArrowUp, header, painter, widget);
- else if (header->sortIndicator & QStyleOptionHeader::SortDown)
- drawPrimitive(PE_IndicatorArrowDown, header, painter, widget);
- } // QStyleOptionHeader::None is not drawn => not needed
- break;
-#ifndef QT_NO_GROUPBOX
- case PE_FrameGroupBox:
- if (const QStyleOptionFrameV2 *frame = qstyleoption_cast<const QStyleOptionFrameV2 *>(option))
- QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_SettingsList, painter, frame->rect, flags);
- break;
-#endif //QT_NO_GROUPBOX
-
- // Qt3 primitives are not supported
- case PE_Q3CheckListController:
- case PE_Q3CheckListExclusiveIndicator:
- case PE_Q3CheckListIndicator:
- case PE_Q3DockWindowSeparator:
- case PE_Q3Separator:
- Q_ASSERT(false);
- break;
- case PE_Frame:
- break;
-#ifndef QT_NO_ITEMVIEWS
- case PE_PanelItemViewItem:
- if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
- const bool isSelected = (vopt->state & State_Selected);
- const bool hasFocus = (vopt->state & State_HasFocus);
- const bool isPressed = QS60StylePrivate::isWidgetPressed(widget);
-
- if (QS60StylePrivate::equalToThemePalette(option->palette.highlight().color(), QPalette::Highlight)) {
- QRect highlightRect = vopt->rect.adjusted(1,1,-1,-1);
- const QAbstractItemView *itemView = qobject_cast<const QAbstractItemView *>(widget);
- QAbstractItemView::SelectionBehavior selectionBehavior =
- itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems;
- // Set the draw area for highlights (focus, select rect or pressed rect)
- if (hasFocus || isPressed) {
- if (selectionBehavior != QAbstractItemView::SelectItems) {
- // set highlight rect so that it is continuous from cell to cell, yet sligthly
- // smaller than cell rect
- int xBeginning = 0, yBeginning = 0, xEnd = 0, yEnd = 0;
- if (selectionBehavior == QAbstractItemView::SelectRows) {
- yBeginning = 1; yEnd = -1;
- if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning)
- xBeginning = 1;
- else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End)
- xEnd = -1;
- } else if (selectionBehavior == QAbstractItemView::SelectColumns) {
- xBeginning = 1; xEnd = -1;
- if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning)
- yBeginning = 1;
- else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End)
- yEnd = -1;
- }
- highlightRect = option->rect.adjusted(xBeginning, yBeginning, xEnd, yEnd);
- }
- }
- bool tableView = false;
- if (itemView && qobject_cast<const QTableView *>(widget))
- tableView = true;
-
- QS60StylePrivate::SkinElements element;
- bool themeGraphicDefined = false;
- QRect elementRect = option->rect;
-
- //draw item is drawn as pressed, if it already has focus.
- if (isPressed && hasFocus) {
- themeGraphicDefined = true;
- element = tableView ? QS60StylePrivate::SE_TableItemPressed : QS60StylePrivate::SE_ListItemPressed;
- } else if (hasFocus || (isSelected && selectionBehavior != QAbstractItemView::SelectItems)) {
- element = QS60StylePrivate::SE_ListHighlight;
- elementRect = highlightRect;
- themeGraphicDefined = true;
- }
- if (themeGraphicDefined)
- QS60StylePrivate::drawSkinElement(element, painter, elementRect, flags);
- } else {
- QCommonStyle::drawPrimitive(element, option, painter, widget);
- }
- }
- break;
-#endif //QT_NO_ITEMVIEWS
-
- case PE_IndicatorMenuCheckMark:
- if (const QStyleOptionMenuItem *checkBox = qstyleoption_cast<const QStyleOptionMenuItem *>(option)){
- QStyleOptionMenuItem optionCheckBox = *checkBox;
- if (optionCheckBox.checked)
- optionCheckBox.state = (optionCheckBox.state | State_On);
- drawPrimitive(PE_IndicatorCheckBox, &optionCheckBox, painter, widget);
- }
- break;
-#ifndef QT_NO_TOOLBAR
- case PE_IndicatorToolBarHandle:
- // no toolbar handles in S60/AVKON UI
- case PE_IndicatorToolBarSeparator:
- // no separators in S60/AVKON UI
- break;
-#endif //QT_NO_TOOLBAR
-
- case PE_PanelMenuBar:
- case PE_FrameMenu:
- break; //disable frame in menu
-
- case PE_IndicatorBranch:
-#if defined(Q_WS_S60)
- // 3.1 AVKON UI does not have tree view component, use common style for drawing there
- if (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1) {
-#else
- if (true) {
-#endif
- QCommonStyle::drawPrimitive(element, option, painter, widget);
- } else {
- if (const QStyleOptionViewItemV2 *vopt = qstyleoption_cast<const QStyleOptionViewItemV2 *>(option)) {
- const bool rightLine = option->state & State_Item;
- const bool downLine = option->state & State_Sibling;
- const bool upLine = option->state & (State_Open | State_Children | State_Item | State_Sibling);
- QS60StylePrivate::SkinElementFlags adjustedFlags = flags;
-
- QS60StyleEnums::SkinParts skinPart;
- bool drawSkinPart = false;
- if (rightLine && downLine && upLine) {
- skinPart = QS60StyleEnums::SP_QgnIndiHlLineBranch;
- drawSkinPart = true;
- } else if (rightLine && upLine) {
- skinPart = QS60StyleEnums::SP_QgnIndiHlLineEnd;
- drawSkinPart = true;
- } else if (upLine && downLine) {
- skinPart = QS60StyleEnums::SP_QgnIndiHlLineStraight;
- drawSkinPart = true;
- }
-
- if (option->direction == Qt::RightToLeft)
- adjustedFlags |= QS60StylePrivate::SF_Mirrored_X_Axis;
-
- if (drawSkinPart)
- QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, adjustedFlags);
-
- if (option->state & State_Children) {
- QS60StyleEnums::SkinParts skinPart =
- (option->state & State_Open) ? QS60StyleEnums::SP_QgnIndiHlColSuper : QS60StyleEnums::SP_QgnIndiHlExpSuper;
- const QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, vopt, widget);
- const int minDimension = qMin(option->rect.width(), option->rect.height());
- const int magicTweak = (option->direction == Qt::RightToLeft) ? -3 : 3; //@todo: magic
- //The branch indicator icon in S60 is supposed to be superimposed on top of branch lines.
- QRect iconRect(QPoint(option->rect.left() + magicTweak, selectionRect.top() + 1), QSize(minDimension, minDimension));
- if (!QS60StylePrivate::isTouchSupported())
- iconRect.translate(0, -4); //@todo: magic
- QS60StylePrivate::drawSkinPart(skinPart, painter, iconRect, adjustedFlags);
- }
- }
- }
- break;
- case PE_PanelItemViewRow: // ### Qt 5: remove
-#ifndef QT_NO_ITEMVIEWS
- if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
- if (!QS60StylePrivate::equalToThemePalette(vopt->palette.base().texture().cacheKey(), QPalette::Base)) {
- //QPalette::Base has been changed, let commonstyle draw the item
- commonStyleDraws = true;
- } else {
- QPalette::ColorGroup cg = vopt->state & State_Enabled ? QPalette::Normal : QPalette::Disabled;
- if (cg == QPalette::Normal && !(vopt->state & State_Active))
- cg = QPalette::Inactive;
- if (vopt->features & QStyleOptionViewItemV2::Alternate)
- painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase));
- //apart from alternate base, no background for list item is drawn for S60Style
- }
- }
-#endif
- break;
- case PE_PanelScrollAreaCorner:
- break;
- case PE_IndicatorItemViewItemDrop:
- if (QS60StylePrivate::isTouchSupported())
- QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_DropArea, painter, option->rect, flags);
- else
- commonStyleDraws = true;
- break;
- // todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases
- case PE_FrameLineEdit:
- case PE_IndicatorDockWidgetResizeHandle:
- case PE_PanelTipLabel:
-
-#ifndef QT_NO_TABBAR
- case PE_IndicatorTabTear: // No tab tear in S60
-#endif // QT_NO_TABBAR
- case PE_FrameDefaultButton:
-#ifndef QT_NO_DOCKWIDGET
- case PE_FrameDockWidget:
-#endif //QT_NO_DOCKWIDGET
-#ifndef QT_NO_PROGRESSBAR
- case PE_IndicatorProgressChunk:
-#endif //QT_NO_PROGRESSBAR
-#ifndef QT_NO_TOOLBAR
- case PE_PanelToolBar:
-#endif //QT_NO_TOOLBAR
-#ifndef QT_NO_COLUMNVIEW
- case PE_IndicatorColumnViewArrow:
-#endif //QT_NO_COLUMNVIEW
- case PE_FrameTabBarBase: // since tabs are in S60 always in navipane, let's use common style for tab base in Qt.
- default:
- commonStyleDraws = true;
- }
- if (commonStyleDraws) {
- QCommonStyle::drawPrimitive(element, option, painter, widget);
- }
-}
-
-/*! \reimp */
-int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
-{
- int metricValue = QS60StylePrivate::pixelMetric(metric);
- if (metricValue == KNotFound)
- metricValue = QCommonStyle::pixelMetric(metric, option, widget);
-
- // Menu scrollers should be set to zero height for combobox popups
- if (metric == PM_MenuScrollerHeight && !qobject_cast<const QMenu *>(widget))
- metricValue = 0;
-
- //if layout direction is mirrored, switch left and right border margins
- if (option && option->direction == Qt::RightToLeft) {
- if (metric == PM_LayoutLeftMargin)
- metricValue = QS60StylePrivate::pixelMetric(PM_LayoutRightMargin);
- else if (metric == PM_LayoutRightMargin)
- metricValue = QS60StylePrivate::pixelMetric(PM_LayoutLeftMargin);
- }
-
- if (widget && (metric == PM_LayoutTopMargin || metric == PM_LayoutLeftMargin || metric == PM_LayoutRightMargin))
- if (widget->windowType() == Qt::Dialog)
- //double the layout margins (except bottom) for dialogs, it is very close to real value
- //without having to define custom pixel metric
- metricValue *= 2;
-
-#if defined(Q_WS_S60)
- if (metric == PM_TabBarTabOverlap && (QSysInfo::s60Version() > QSysInfo::SV_S60_5_2))
- metricValue = 0;
-#endif
-
- return metricValue;
-}
-
-/*! \reimp */
-QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt,
- const QSize &csz, const QWidget *widget) const
-{
- QSize sz(csz);
- switch (ct) {
- case CT_ToolButton:
- sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
- //FIXME properly - style should calculate the location of border frame-part
- sz += QSize(2 * pixelMetric(PM_ButtonMargin), 2 * pixelMetric(PM_ButtonMargin));
- if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast<const QStyleOptionToolButton *>(opt))
- if (toolBtn->subControls & SC_ToolButtonMenu)
- sz += QSize(pixelMetric(PM_MenuButtonIndicator), 0);
-
- //Make toolbuttons in toolbar stretch the whole screen area
- if (widget && qobject_cast<const QToolBar *>(widget->parentWidget())) {
- const QToolBar *tb = qobject_cast<const QToolBar *>(widget->parentWidget());
- const bool parentCanGrowHorizontally = !(tb->sizePolicy().horizontalPolicy() == QSizePolicy::Fixed ||
- tb->sizePolicy().horizontalPolicy() == QSizePolicy::Maximum) && tb->orientation() == Qt::Horizontal;
-
- if (parentCanGrowHorizontally) {
- int buttons = 0;
- //Make the auto-stretch to happen only for horizontal orientation
- if (tb && tb->orientation() == Qt::Horizontal) {
- QList<QAction*> actionList = tb->actions();
- for (int i = 0; i < actionList.count(); i++) {
- buttons++;
- }
- }
-
- if (widget->parentWidget() && buttons > 0) {
- QWidget *w = const_cast<QWidget *>(widget);
- int toolBarMaxWidth = 0;
- int totalMargin = 0;
- while (w) {
- //honor fixed width parents
- if (w->maximumWidth() == w->minimumWidth())
- toolBarMaxWidth = qMax(toolBarMaxWidth, w->maximumWidth());
- if (w->layout() && w->windowType() == Qt::Widget) {
- totalMargin += w->layout()->contentsMargins().left() +
- w->layout()->contentsMargins().right();
- }
- w = w->parentWidget();
- }
- totalMargin += 2 * pixelMetric(QStyle::PM_ToolBarFrameWidth);
-
- if (toolBarMaxWidth == 0)
- toolBarMaxWidth =
- QApplication::desktop()->availableGeometry(widget->parentWidget()).width();
- //Reduce the margins, toolbar frame, item spacing and internal margin from available area
- toolBarMaxWidth -= totalMargin;
-
- //ensure that buttons are side-by-side and not on top of each other
- const int toolButtonWidth = (toolBarMaxWidth / buttons)
- - pixelMetric(QStyle::PM_ToolBarItemSpacing)
- - pixelMetric(QStyle::PM_ToolBarItemMargin)
- //toolbar frame needs to be reduced again, since QToolBarLayout adds it for each toolbar action
- - 2 * pixelMetric(QStyle::PM_ToolBarFrameWidth) - 1;
- sz.setWidth(qMax(toolButtonWidth, sz.width()));
- }
- }
- }
- break;
- case CT_PushButton:
- sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
- //FIXME properly - style should calculate the location of border frame-part
- if (const QAbstractButton *buttonWidget = (qobject_cast<const QAbstractButton *>(widget))) {
- if (buttonWidget->isCheckable())
- sz += QSize(pixelMetric(PM_IndicatorWidth) + pixelMetric(PM_CheckBoxLabelSpacing), 0);
- const int iconHeight = (!buttonWidget->icon().isNull()) ? buttonWidget->iconSize().height() : 0;
- const int textHeight = (buttonWidget->text().length() > 0) ?
- buttonWidget->fontMetrics().size(Qt::TextSingleLine, buttonWidget->text()).height() : opt->fontMetrics.height();
- const int decoratorHeight = (buttonWidget->isCheckable()) ? pixelMetric(PM_IndicatorHeight) : 0;
-
- const int contentHeight =
- qMax(qMax(iconHeight, decoratorHeight) + pixelMetric(PM_ButtonMargin),
- textHeight + 2*pixelMetric(PM_ButtonMargin));
- sz.setHeight(qMax(sz.height(), contentHeight));
- sz += QSize(2 * pixelMetric(PM_ButtonMargin), 0);
- }
- break;
- case CT_LineEdit:
- if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt))
- sz += QSize(2 * f->lineWidth, 4 * f->lineWidth);
- break;
- case CT_TabBarTab: {
- sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);
- // Adjust beginning tabbar item size, if scrollbuttons are used. This is to ensure that the
- // tabbar item content fits, since scrollbuttons are making beginning tabbar item smaller.
- int scrollButtonSize = 0;
- if (const QTabBar *tabBar = qobject_cast<const QTabBar *>(widget))
- scrollButtonSize = tabBar->usesScrollButtons() ? pixelMetric(PM_TabBarScrollButtonWidth) : 0;
- if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
- const bool verticalTabs = tab->shape == QTabBar::RoundedEast
- || tab->shape == QTabBar::RoundedWest
- || tab->shape == QTabBar::TriangularEast
- || tab->shape == QTabBar::TriangularWest;
- if (tab->position == QStyleOptionTab::Beginning)
- sz += QSize(verticalTabs ? 0 : scrollButtonSize, !verticalTabs ? 0 : scrollButtonSize);
- }
- }
- break;
- case CT_MenuItem:
- case CT_ItemViewItem:
- if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
- if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
- sz = QSize(menuItem->rect.width() - 2 * pixelMetric(PM_MenuHMargin) - 2 * QS60StylePrivate::pixelMetric(PM_FrameCornerWidth), 1);
- break;
- }
- }
- sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
- if (QS60StylePrivate::isTouchSupported()) {
- //Make itemview easier to use in touch devices
- sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin));
- //QCommonStyle does not adjust height with horizontal margin, it only adjusts width
- if (ct == CT_MenuItem)
- sz.setHeight(sz.height() - 8); //QCommonstyle adds 8 to height that this style handles through PM values
- }
- break;
-#ifndef QT_NO_COMBOBOX
- case CT_ComboBox: {
- // Fixing Ui design issues with too wide QComboBoxes and greedy SizeHints
- // Make sure, that the combobox stays within the screen.
- const QSize desktopContentSize = QApplication::desktop()->availableGeometry().size()
- - QSize(pixelMetric(PM_LayoutLeftMargin) + pixelMetric(PM_LayoutRightMargin), 0);
- sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget).
- boundedTo(desktopContentSize);
- }
- break;
-#endif
- default:
- sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
- break;
- }
- if (!sz.isValid())
- sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);
- return sz;
-}
-
-/*! \reimp */
-int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *widget,
- QStyleHintReturn *hret) const
-{
- int retValue = 0;
- switch (sh) {
- case SH_RequestSoftwareInputPanel:
- if (QS60StylePrivate::isSingleClickUi())
- retValue = RSIP_OnMouseClick;
- else
- retValue = RSIP_OnMouseClickAndAlreadyFocused;
- break;
- case SH_ComboBox_Popup:
- retValue = true;
- break;
- case SH_Table_GridLineColor:
- retValue = int(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 2, 0).rgba());
- break;
- case SH_GroupBox_TextLabelColor:
- retValue = int(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0).rgba());
- break;
- case SH_ScrollBar_ScrollWhenPointerLeavesControl:
- retValue = true;
- break;
- case SH_Slider_SnapToValue:
- retValue = true;
- break;
- case SH_Slider_StopMouseOverSlider:
- retValue = true;
- break;
- case SH_LineEdit_PasswordCharacter:
- retValue = '*';
- break;
- case SH_ComboBox_PopupFrameStyle:
- retValue = QFrame::NoFrame | QFrame::Plain;
- break;
- case SH_Dial_BackgroundRole:
- retValue = QPalette::Base;
- break;
- case SH_ItemView_ActivateItemOnSingleClick: {
- if (QS60StylePrivate::isSingleClickUi())
- retValue = true;
- else if (opt && opt->state & QStyle::State_Selected)
- retValue = true;
- break;
- }
- case SH_ProgressDialog_TextLabelAlignment:
- retValue = (QApplication::layoutDirection() == Qt::LeftToRight) ?
- Qt::AlignLeft :
- Qt::AlignRight;
- break;
- case SH_Menu_SubMenuPopupDelay:
- retValue = 300;
- break;
- case SH_Menu_Scrollable:
- retValue = true;
- break;
- case SH_Menu_SelectionWrap:
- retValue = true;
- break;
- case SH_Menu_MouseTracking:
- retValue = true;
- break;
- case SH_ItemView_ShowDecorationSelected:
- retValue = true;
- break;
- case SH_ToolBar_Movable:
- retValue = false;
- break;
- case SH_BlinkCursorWhenTextSelected:
- retValue = true;
- break;
- case SH_UnderlineShortcut:
- retValue = 0;
- break;
- case SH_FormLayoutWrapPolicy:
- retValue = QFormLayout::WrapLongRows;
- break;
- case SH_ScrollBar_ContextMenu:
- retValue = false;
- break;
- default:
- retValue = QCommonStyle::styleHint(sh, opt, widget, hret);
- break;
- }
- return retValue;
-}
-
-/*! \reimp */
-QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl scontrol, const QWidget *widget) const
-{
- QRect ret;
- switch (control) {
-#ifndef QT_NO_SCROLLBAR
- // This implementation of subControlRect(CC_ScrollBar..) basically just removes the SC_ScrollBarSubLine and SC_ScrollBarAddLine
- case CC_ScrollBar:
- if (const QStyleOptionSlider *scrollbarOption = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- const QRect scrollBarRect = scrollbarOption->rect;
- const bool isHorizontal = scrollbarOption->orientation == Qt::Horizontal;
- const int maxlen = isHorizontal ? scrollBarRect.width() : scrollBarRect.height();
- int sliderlen;
-
- // calculate slider length
- if (scrollbarOption->maximum != scrollbarOption->minimum) {
- const uint range = scrollbarOption->maximum - scrollbarOption->minimum;
- sliderlen = (qint64(scrollbarOption->pageStep) * maxlen) / (range + scrollbarOption->pageStep);
-
- const int slidermin = pixelMetric(PM_ScrollBarSliderMin, scrollbarOption, widget);
- if (sliderlen < slidermin || range > (INT_MAX >> 1))
- sliderlen = slidermin;
- if (sliderlen > maxlen)
- sliderlen = maxlen;
- } else {
- sliderlen = maxlen;
- }
-
- const int sliderstart = sliderPositionFromValue(scrollbarOption->minimum,
- scrollbarOption->maximum,
- scrollbarOption->sliderPosition,
- maxlen - sliderlen,
- scrollbarOption->upsideDown);
-
- switch (scontrol) {
- case SC_ScrollBarSubPage: // between top/left button and slider
- if (isHorizontal)
- ret.setRect(0, 0, sliderstart, scrollBarRect.height());
- else
- ret.setRect(0, 0, scrollBarRect.width(), sliderstart);
- break;
- case SC_ScrollBarAddPage: { // between bottom/right button and slider
- const int addPageLength = sliderstart + sliderlen;
- if (isHorizontal)
- ret = scrollBarRect.adjusted(addPageLength, 0, 0, 0);
- else
- ret = scrollBarRect.adjusted(0, addPageLength, 0, 0);
- }
- break;
- case SC_ScrollBarGroove:
- ret = scrollBarRect;
- break;
- case SC_ScrollBarSlider:
- if (scrollbarOption->orientation == Qt::Horizontal)
- ret.setRect(sliderstart, 0, sliderlen, scrollBarRect.height());
- else
- ret.setRect(0, sliderstart, scrollBarRect.width(), sliderlen);
- break;
- case SC_ScrollBarSubLine: // top/left button
- case SC_ScrollBarAddLine: // bottom/right button
- default:
- break;
- }
- ret = visualRect(scrollbarOption->direction, scrollBarRect, ret);
- }
- break;
-#endif // QT_NO_SCROLLBAR
- case CC_SpinBox:
- if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- const int frameThickness = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
- const int buttonMargin = spinbox->frame ? 2 : 0;
- const int buttonContentWidth = QS60StylePrivate::pixelMetric(PM_ButtonIconSize) + 2 * buttonMargin;
- // Spinbox buttons should be no larger than one fourth of total width.
- // Thus, side-by-side buttons would take half of the total width.
- const int maxSize = qMax(spinbox->rect.width() / 4, buttonContentWidth);
- QSize buttonSize;
- buttonSize.setHeight(qMin(maxSize, qMax(8, spinbox->rect.height() - frameThickness)));
- //width should at least be equal to height
- buttonSize.setWidth(qMax(buttonSize.height(), buttonContentWidth));
- buttonSize = buttonSize.expandedTo(QApplication::globalStrut());
-
- // Normally spinbuttons should be side-by-side, but if spinbox grows very big
- // and spinbuttons reach their maximum size, they can be deployed one top of the other.
- const bool sideBySide = (buttonSize.height() * 2 < spinbox->rect.height()) ? false : true;
- const int y = frameThickness + spinbox->rect.y() +
- (spinbox->rect.height() - (sideBySide ? 1 : 2) * buttonSize.height()) / 2;
- const int x = spinbox->rect.x() +
- spinbox->rect.width() - frameThickness - (sideBySide ? 2 : 1) * buttonSize.width();
-
- switch (scontrol) {
- case SC_SpinBoxUp:
- if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
- return QRect();
- ret = QRect(x, y, buttonSize.width(), buttonSize.height());
- break;
- case SC_SpinBoxDown:
- if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
- return QRect();
- ret = QRect(x + (sideBySide ? buttonSize.width() : 0),
- y + (sideBySide ? 0 : buttonSize.height()),
- buttonSize.width(), buttonSize.height());
- break;
- case SC_SpinBoxEditField:
- if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
- ret = QRect(
- frameThickness,
- frameThickness,
- spinbox->rect.width() - 2 * frameThickness,
- spinbox->rect.height() - 2 * frameThickness);
- else
- ret = QRect(
- frameThickness,
- frameThickness,
- x - frameThickness,
- spinbox->rect.height() - 2 * frameThickness);
- break;
- case SC_SpinBoxFrame:
- ret = spinbox->rect;
- break;
- default:
- break;
- }
- ret = visualRect(spinbox->direction, spinbox->rect, ret);
- }
- break;
- case CC_ComboBox:
- if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- ret = cmb->rect;
- const int width = cmb->rect.width();
- const int height = cmb->rect.height();
- const int buttonMargin = cmb->frame ? 2 : 0;
- // lets use spinbox frame here as well, as no combobox specific value available.
- const int frameThickness = cmb->frame ? pixelMetric(PM_SpinBoxFrameWidth, cmb, widget) : 0;
- const int buttonMinSize = QS60StylePrivate::pixelMetric(PM_ButtonIconSize) + 2 * buttonMargin;
- QSize buttonSize;
- //allow button to grow to one fourth of the frame height, if the frame is really tall
- buttonSize.setHeight(qMin(height, qMax(width / 4, buttonMinSize)));
- buttonSize.setWidth(buttonSize.height());
- buttonSize = buttonSize.expandedTo(QApplication::globalStrut());
- switch (scontrol) {
- case SC_ComboBoxArrow: {
- const int xposMod = cmb->rect.x() + width - buttonMargin - buttonSize.width();
- const int ypos = cmb->rect.y();
- ret.setRect(xposMod, ypos + buttonMargin, buttonSize.width(), height - 2 * buttonMargin);
- }
- break;
- case SC_ComboBoxEditField: {
- ret = QRect(0, 0, cmb->rect.x() + width - buttonSize.width(), height);
- }
- break;
- case SC_ComboBoxListBoxPopup: {
- ret = QApplication::desktop()->availableGeometry();
- }
- break;
- default:
- break;
- }
- ret = visualRect(cmb->direction, cmb->rect, ret);
- }
- break;
- case CC_GroupBox:
- if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
- ret = QCommonStyle::subControlRect(control, option, scontrol, widget);
- switch (scontrol) {
- case SC_GroupBoxCheckBox: //fallthrough
- case SC_GroupBoxLabel: {
- //slightly indent text and boxes, so that dialog border does not mess with them.
- const int horizontalSpacing =
- QS60StylePrivate::pixelMetric(PM_LayoutHorizontalSpacing);
- ret.adjust(2, horizontalSpacing - 3, 0, 0);
- }
- break;
- case SC_GroupBoxFrame: {
- const QRect textBox = subControlRect(control, option, SC_GroupBoxLabel, widget);
- const int tbHeight = textBox.height();
- ret.translate(0, -ret.y());
- // include title to within the groupBox frame
- ret.setHeight(ret.height() + tbHeight);
- if (widget && ret.bottom() > widget->rect().bottom())
- ret.setBottom(widget->rect().bottom());
- }
- break;
- default:
- break;
- }
- }
- break;
- case CC_ToolButton:
- if (const QStyleOptionToolButton *toolButton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
- const int indicatorRect = pixelMetric(PM_MenuButtonIndicator) + 2 * pixelMetric(PM_ButtonMargin);
- const int border = pixelMetric(PM_ButtonMargin) + pixelMetric(PM_DefaultFrameWidth);
- ret = toolButton->rect;
- const bool popup = (toolButton->features &
- (QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay))
- == QStyleOptionToolButton::MenuButtonPopup;
- switch (scontrol) {
- case SC_ToolButton:
- if (popup)
- ret.adjust(0, 0, -indicatorRect, 0);
- break;
- case SC_ToolButtonMenu:
- if (popup)
- ret.adjust(ret.width() - indicatorRect, border, -pixelMetric(PM_ButtonMargin), -border);
- break;
- default:
- break;
- }
- ret = visualRect(toolButton->direction, toolButton->rect, ret);
- }
- break;
- default:
- ret = QCommonStyle::subControlRect(control, option, scontrol, widget);
- }
- return ret;
-}
-
-/*!
- \reimp
-*/
-QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, const QWidget *widget) const
-{
- QRect ret;
- switch (element) {
- case SE_RadioButtonFocusRect:
- ret = opt->rect;
- break;
- case SE_LineEditContents: {
- // in S60 the input text box doesn't start from line Edit's TL, but
- // a bit indented (8 pixels).
- const int KLineEditDefaultIndention = 8;
- ret = visualRect(
- opt->direction, opt->rect, opt->rect.adjusted(KLineEditDefaultIndention, 0, 0, 0));
- }
- break;
- case SE_TabBarTearIndicator:
- ret = QRect(0, 0, 0, 0);
- break;
- case SE_TabWidgetTabBar:
- if (const QStyleOptionTabWidgetFrame *optionTab = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
- ret = QCommonStyle::subElementRect(element, opt, widget);
-
- if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
- const int borderThickness =
- QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
- int tabOverlap = pixelMetric(PM_TabBarTabOverlap);
- if (tabOverlap > borderThickness)
- tabOverlap -= borderThickness;
- const QTabWidget *tab = qobject_cast<const QTabWidget *>(widget);
- int gain = (tab) ? tabOverlap * tab->count() : 0;
- switch (twf->shape) {
- case QTabBar::RoundedNorth:
- case QTabBar::TriangularNorth:
- case QTabBar::RoundedSouth:
- case QTabBar::TriangularSouth: {
- if (widget) {
- // make sure that gain does not set the rect outside of widget boundaries
- if (twf->direction == Qt::RightToLeft) {
- if ((ret.left() - gain) < widget->rect().left())
- gain = widget->rect().left() - ret.left();
- ret.adjust(-gain, 0, 0, 0);
- } else {
- if ((ret.right() + gain) > widget->rect().right())
- gain = widget->rect().right() - ret.right();
- ret.adjust(0, 0, gain, 0);
- }
- }
- break;
- }
- default: {
- if (widget) {
- if ((ret.bottom() + gain) > widget->rect().bottom())
- gain = widget->rect().bottom() - ret.bottom();
- ret.adjust(0, 0, 0, gain);
- }
- break;
- }
- }
- }
- }
- break;
- case SE_ItemViewItemText:
- case SE_ItemViewItemDecoration:
- if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
- const QAbstractItemView *listItem = qobject_cast<const QAbstractItemView *>(widget);
- const bool multiSelection = !listItem ? false :
- listItem->selectionMode() == QAbstractItemView::MultiSelection ||
- listItem->selectionMode() == QAbstractItemView::ExtendedSelection ||
- listItem->selectionMode() == QAbstractItemView::ContiguousSelection;
- ret = QCommonStyle::subElementRect(element, opt, widget);
- // If both multiselect & check-state, then remove checkbox and move
- // text and decoration towards the beginning
- if (listItem &&
- multiSelection &&
- (vopt->features & QStyleOptionViewItemV2::HasCheckIndicator)) {
- const int verticalSpacing =
- QS60StylePrivate::pixelMetric(PM_LayoutVerticalSpacing);
- //const int horizontalSpacing = QS60StylePrivate::pixelMetric(PM_LayoutHorizontalSpacing);
- const int checkBoxRectWidth = subElementRect(SE_ItemViewItemCheckIndicator, opt, widget).width();
- ret.adjust(-checkBoxRectWidth - verticalSpacing, 0, -checkBoxRectWidth - verticalSpacing, 0);
- }
- } else if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
- const bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable;
- const int indicatorWidth = checkable ?
- pixelMetric(PM_ListViewIconSize, opt, widget) :
- pixelMetric(PM_SmallIconSize, opt, widget);
- ret = menuItem->rect;
-
- QRect checkBoxRect = checkable ? menuItem->rect : QRect();
- if (checkable) {
- checkBoxRect.setWidth(pixelMetric(PM_IndicatorWidth));
- checkBoxRect.setHeight(pixelMetric(PM_IndicatorHeight));
- }
-
- const int vSpacing = QS60StylePrivate::pixelMetric(PM_LayoutVerticalSpacing);
- //The vertical spacing is doubled; it needs one spacing to separate checkbox from
- //highlight and then it needs one to separate it whatever is shown after it (text/icon/both).
- const int moveByX = checkBoxRect.width() + 2 * vSpacing;
-
- if (element == SE_ItemViewItemDecoration) {
- if (menuItem->icon.isNull()) {
- ret = QRect();
- } else {
- if (menuItem->direction == Qt::RightToLeft)
- ret.translate(ret.width() - indicatorWidth - moveByX, 0);
- else
- ret.translate(moveByX, 0);
- ret.setWidth(indicatorWidth);
- }
- } else {
- if (!menuItem->icon.isNull()) {
- if (menuItem->direction == Qt::LeftToRight)
- ret.adjust(indicatorWidth, 0, 0, 0);
- else
- ret.adjust(0, 0, -indicatorWidth, 0);
- }
- if (menuItem->direction == Qt::LeftToRight)
- ret.adjust(moveByX, 0, 0, 0);
- else
- ret.adjust(0, 0, -moveByX, 0);
-
- // Make room for submenu indicator
- if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu){
- // submenu indicator is very small, so lets halve the rect
- if (menuItem->direction == Qt::LeftToRight)
- ret.adjust(0, 0, -(indicatorWidth >> 1), 0);
- else
- ret.adjust((indicatorWidth >> 1), 0, 0, 0);
- }
- }
- }
- break;
- case SE_ItemViewItemCheckIndicator:
- if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
- const QAbstractItemView *listItem = qobject_cast<const QAbstractItemView *>(widget);
-
- const bool singleSelection = listItem &&
- (listItem->selectionMode() == QAbstractItemView::SingleSelection ||
- listItem->selectionMode() == QAbstractItemView::NoSelection);
- const bool checkBoxOnly = (vopt->features & QStyleOptionViewItemV2::HasCheckIndicator) &&
- listItem &&
- singleSelection && vopt->text.isEmpty() && vopt->icon.isNull();
-
- // Selection check mark rect.
- const int indicatorWidth = QS60StylePrivate::pixelMetric(PM_IndicatorWidth);
- const int indicatorHeight = QS60StylePrivate::pixelMetric(PM_IndicatorHeight);
- const int spacing = QS60StylePrivate::pixelMetric(PM_CheckBoxLabelSpacing);
-
- const int itemHeight = opt->rect.height();
- int heightOffset = 0;
- if (indicatorHeight < itemHeight)
- heightOffset = ((itemHeight - indicatorHeight) >> 1);
- if (checkBoxOnly) {
- // Move rect and make it slightly smaller, so that
- // a) highlight border does not cross the rect
- // b) in s60 list checkbox is smaller than normal checkbox
- //todo; magic three
- ret.setRect(opt->rect.left() + 3, opt->rect.top() + heightOffset,
- indicatorWidth - 3, indicatorHeight - 3);
- } else {
- ret.setRect(opt->rect.right() - indicatorWidth - spacing, opt->rect.top() + heightOffset,
- indicatorWidth, indicatorHeight);
- }
- } else {
- ret = QCommonStyle::subElementRect(element, opt, widget);
- }
- break;
- case SE_HeaderLabel:
- ret = QCommonStyle::subElementRect(element, opt, widget);
- if (qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
- // Subtract area needed for line
- if (opt->state & State_Horizontal)
- ret.setHeight(ret.height() - QS60StylePrivate::pixelMetric(PM_BoldLineWidth));
- else
- ret.setWidth(ret.width() - QS60StylePrivate::pixelMetric(PM_ThinLineWidth));
- }
- ret = visualRect(opt->direction, opt->rect, ret);
- break;
- case SE_RadioButtonIndicator: {
- const int height = pixelMetric(PM_ExclusiveIndicatorHeight, opt, widget);
- ret.setRect(opt->rect.x(), opt->rect.y() + ((opt->rect.height() - height) >> 1),
- pixelMetric(PM_ExclusiveIndicatorWidth, opt, widget), height);
- ret.translate(2, 0); //move indicator slightly to avoid highlight crossing over it
- ret = visualRect(opt->direction, opt->rect, ret);
- }
- break;
- case SE_CheckBoxIndicator: {
- const int height = pixelMetric(PM_IndicatorHeight, opt, widget);
- ret.setRect(opt->rect.x(), opt->rect.y() + ((opt->rect.height() - height) >> 1),
- pixelMetric(PM_IndicatorWidth, opt, widget), height);
- ret.translate(2, 0); //move indicator slightly to avoid highlight crossing over it
- ret = visualRect(opt->direction, opt->rect, ret);
- }
- break;
- case SE_CheckBoxFocusRect:
- ret = opt->rect;
- break;
- case SE_ProgressBarLabel:
- case SE_ProgressBarContents:
- case SE_ProgressBarGroove:
- ret = opt->rect;
- break;
- default:
- ret = QCommonStyle::subElementRect(element, opt, widget);
- }
- return ret;
-}
-
-/*!
- \reimp
- */
-void QS60Style::polish(QWidget *widget)
-{
- Q_D(const QS60Style);
- QCommonStyle::polish(widget);
-
- if (!widget)
- return;
-
- //Currently we only support animations in QProgressBar.
-#ifndef QT_NO_PROGRESSBAR
- if (qobject_cast<QProgressBar *>(widget))
- widget->installEventFilter(this);
-#endif
-
- if (false
-#ifndef QT_NO_SCROLLBAR
- || qobject_cast<QScrollBar *>(widget)
-#endif
- ) {
- widget->setAttribute(Qt::WA_OpaquePaintEvent, false);
- }
-
- if (QS60StylePrivate::drawsOwnThemeBackground(widget)) {
- widget->setAttribute(Qt::WA_StyledBackground);
- } else if (false
-#ifndef QT_NO_MENU
- || qobject_cast<const QMenu *> (widget)
-#endif // QT_NO_MENU
- ) {
- widget->setAttribute(Qt::WA_StyledBackground);
- } else if (false
-#ifndef QT_NO_COMBOBOX
- || qobject_cast<const QComboBoxListView *>(widget)
-#endif //QT_NO_COMBOBOX
- ) {
- widget->setAttribute(Qt::WA_StyledBackground);
- }
- d->setThemePalette(widget);
- d->setFont(widget);
-}
-
-/*!
- \reimp
- */
-void QS60Style::unpolish(QWidget *widget)
-{
- Q_D(QS60Style);
-
- if (false
- #ifndef QT_NO_SCROLLBAR
- || qobject_cast<QScrollBar *>(widget)
- #endif
- )
- widget->setAttribute(Qt::WA_OpaquePaintEvent);
-
- if (QS60StylePrivate::drawsOwnThemeBackground(widget)) {
- widget->setAttribute(Qt::WA_StyledBackground, false);
- } else if (false
-#ifndef QT_NO_MENU
- || qobject_cast<const QMenu *> (widget)
-#endif // QT_NO_MENU
- ) {
- widget->setAttribute(Qt::WA_StyledBackground, false);
- } else if (false
-#ifndef QT_NO_COMBOBOX
- || qobject_cast<const QComboBoxListView *>(widget)
-#endif //QT_NO_COMBOBOX
- ) {
- widget->setAttribute(Qt::WA_StyledBackground, false);
- }
-
- if (widget)
- widget->setPalette(QPalette());
-
-#if defined(Q_WS_S60) && !defined(QT_NO_PROGRESSBAR)
- if (QProgressBar *bar = qobject_cast<QProgressBar *>(widget)) {
- widget->removeEventFilter(this);
- d->m_bars.removeAll(bar);
- }
-#else
- Q_UNUSED(d)
-#endif
- QCommonStyle::unpolish(widget);
-}
-
-/*!
- \reimp
- */
-void QS60Style::polish(QApplication *application)
-{
- Q_D(QS60Style);
- QCommonStyle::polish(qApp);
- d->m_originalPalette = application->palette();
- d->setThemePalette(application);
- if (QS60StylePrivate::isTouchSupported())
- qApp->installEventFilter(this);
-}
-
-/*!
- \reimp
- */
-void QS60Style::unpolish(QApplication *application)
-{
- Q_UNUSED(application)
-
- Q_D(QS60Style);
- QCommonStyle::unpolish(qApp);
- const QPalette newPalette = QApplication::style()->standardPalette();
- QApplication::setPalette(newPalette);
- QApplicationPrivate::setSystemPalette(d->m_originalPalette);
- if (QS60StylePrivate::isTouchSupported())
- qApp->removeEventFilter(this);
-}
-
-/*!
- \reimp
- */
-bool QS60Style::event(QEvent *e)
-{
-#ifdef QT_KEYPAD_NAVIGATION
- Q_D(QS60Style);
- const QEvent::Type eventType = e->type();
- if ((eventType == QEvent::FocusIn ||
- eventType == QEvent::FocusOut ||
- eventType == QEvent::EnterEditFocus ||
- eventType == QEvent::LeaveEditFocus) &&
- QS60StylePrivate::isTouchSupported())
- return false;
-#endif
-
- switch (e->type()) {
- case QEvent::Timer: {
- QTimerEvent *te = static_cast<QTimerEvent*>(e);
- timerEvent(te);
- }
- break;
-#ifdef QT_KEYPAD_NAVIGATION
- case QEvent::FocusIn:
- if (QWidget *focusWidget = QApplication::focusWidget()) {
-
- // Menus and combobox popups do not draw focus frame around them
- if (qobject_cast<QComboBoxListView *>(focusWidget) ||
- qobject_cast<QMenu *>(focusWidget))
- break;
-
- if (!d->m_focusFrame)
- d->m_focusFrame = new QFocusFrame(focusWidget);
- d->m_focusFrame->setWidget(focusWidget);
- } else if (d->m_focusFrame) {
- d->m_focusFrame->setWidget(0);
- }
- break;
- case QEvent::FocusOut:
- if (d->m_focusFrame)
- d->m_focusFrame->setWidget(0);
- break;
- case QEvent::EnterEditFocus:
- case QEvent::LeaveEditFocus:
- if (d->m_focusFrame)
- d->m_focusFrame->update();
- break;
-#endif
- default:
- break;
- }
- return false;
-}
-
-/*!
- \internal
- */
-QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon,
- const QStyleOption *option, const QWidget *widget) const
-{
- QS60StyleEnums::SkinParts part;
- qreal iconHeightMultiplier = 1.0;
- qreal iconWidthMultiplier = 1.0;
- QS60StylePrivate::SkinElementFlags adjustedFlags;
- if (option)
- adjustedFlags = (option->state & State_Enabled || option->state == 0) ?
- QS60StylePrivate::SF_StateEnabled :
- QS60StylePrivate::SF_StateDisabled;
-
- switch(standardIcon) {
- case SP_MessageBoxWarning:
- // By default, S60 messagebox icons have 4:3 ratio. Value is from S60 LAF documentation.
- iconHeightMultiplier = 1.33;
- part = QS60StyleEnums::SP_QgnNoteWarning;
- break;
- case SP_MessageBoxInformation:
- iconHeightMultiplier = 1.33;
- part = QS60StyleEnums::SP_QgnNoteInfo;
- break;
- case SP_MessageBoxCritical:
- iconHeightMultiplier = 1.33;
- part = QS60StyleEnums::SP_QgnNoteError;
- break;
- case SP_MessageBoxQuestion:
- iconHeightMultiplier = 1.33;
- part = QS60StyleEnums::SP_QgnNoteQuery;
- break;
- case SP_ArrowRight:
- part = QS60StyleEnums::SP_QgnIndiNaviArrowRight;
- break;
- case SP_ArrowLeft:
- part = QS60StyleEnums::SP_QgnIndiNaviArrowLeft;
- break;
- case SP_ArrowUp:
- part = QS60StyleEnums::SP_QgnIndiNaviArrowLeft;
- adjustedFlags |= QS60StylePrivate::SF_PointEast;
- break;
- case SP_ArrowDown:
- part = QS60StyleEnums::SP_QgnIndiNaviArrowLeft;
- adjustedFlags |= QS60StylePrivate::SF_PointWest;
- break;
- case SP_ArrowBack:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
- return QS60Style::standardIcon(SP_ArrowRight, option, widget);
- return QS60Style::standardIcon(SP_ArrowLeft, option, widget);
- case SP_ArrowForward:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
- return QS60Style::standardIcon(SP_ArrowLeft, option, widget);
- return QS60Style::standardIcon(SP_ArrowRight, option, widget);
- case SP_ComputerIcon:
- part = QS60StyleEnums::SP_QgnPropPhoneMemcLarge;
- break;
- case SP_DirClosedIcon:
- part = QS60StyleEnums::SP_QgnPropFolderSmall;
- break;
- case SP_DirOpenIcon:
- part = QS60StyleEnums::SP_QgnPropFolderCurrent;
- break;
- case SP_DirIcon:
- part = QS60StyleEnums::SP_QgnPropFolderSmall;
- break;
- case SP_FileDialogNewFolder:
- part = QS60StyleEnums::SP_QgnPropFolderSmallNew;
- break;
- case SP_FileIcon:
- part = QS60StyleEnums::SP_QgnPropFileSmall;
- break;
- case SP_TrashIcon:
- part = QS60StyleEnums::SP_QgnNoteErased;
- break;
- case SP_ToolBarHorizontalExtensionButton:
- part = QS60StyleEnums::SP_QgnIndiSubmenu;
- if (QApplication::layoutDirection() == Qt::RightToLeft)
- adjustedFlags |= QS60StylePrivate::SF_PointSouth;
- break;
- case SP_ToolBarVerticalExtensionButton:
- adjustedFlags |= QS60StylePrivate::SF_PointEast;
- part = QS60StyleEnums::SP_QgnIndiSubmenu;
- break;
- default:
- return QCommonStyle::standardIconImplementation(standardIcon, option, widget);
- }
- const QS60StylePrivate::SkinElementFlags flags = adjustedFlags;
- const int iconDimension = QS60StylePrivate::pixelMetric(PM_ToolBarIconSize);
- const QRect iconSize = (!option) ?
- QRect(0, 0, iconDimension * iconWidthMultiplier, iconDimension * iconHeightMultiplier) : option->rect;
- const QPixmap cachedPixMap(QS60StylePrivate::cachedPart(part, iconSize.size(), 0, flags));
- return cachedPixMap.isNull() ?
- QCommonStyle::standardIconImplementation(standardIcon, option, widget) : QIcon(cachedPixMap);
-}
-
-/*!
- \internal
- Animate indeterminate progress bars only when visible
-*/
-bool QS60Style::eventFilter(QObject *object, QEvent *event)
-{
- Q_D(QS60Style);
- switch(event->type()) {
- case QEvent::MouseButtonPress: {
- QWidget *w = QApplication::widgetAt(QCursor::pos());
- if (w) {
- QWidget *focusW = w->focusProxy();
- if (qobject_cast<QAbstractItemView *>(focusW) ||
- qobject_cast<QRadioButton *>(focusW) ||
- qobject_cast<QCheckBox *>(focusW))
- d->m_pressedWidget = focusW;
- else if (qobject_cast<QAbstractItemView *>(w)||
- qobject_cast<QRadioButton *>(w) ||
- qobject_cast<QCheckBox *>(w))
- d->m_pressedWidget = w;
-
- if (d->m_pressedWidget)
- d->m_pressedWidget->update();
- }
- break;
- }
- case QEvent::MouseButtonRelease: {
- if (d->m_pressedWidget) {
- d->m_pressedWidget->update();
- d->m_pressedWidget = 0;
- }
- break;
- }
- default:
- break;
- }
-
-#ifdef Q_WS_S60
-#ifndef QT_NO_PROGRESSBAR
- switch(event->type()) {
- case QEvent::StyleChange:
- case QEvent::Show:
- if (QProgressBar *bar = qobject_cast<QProgressBar *>(object)) {
- if (!d->m_bars.contains(bar))
- d->m_bars << bar;
- if (d->m_bars.size() == 1) //only start with first animated progressbar
- d->startAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim);
- }
- break;
- case QEvent::Destroy:
- case QEvent::Hide:
- if (QProgressBar *bar = reinterpret_cast<QProgressBar *>(object)) {
- d->stopAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim);
- d->m_bars.removeAll(bar);
- }
- break;
- default:
- break;
- }
-#endif // QT_NO_PROGRESSBAR
-#endif // Q_WS_S60
- return QCommonStyle::eventFilter(object, event);
-}
-
-/*!
- \internal
- Handle the timer \a event.
-*/
-void QS60Style::timerEvent(QTimerEvent *event)
-{
-#ifdef Q_WS_S60
-#ifndef QT_NO_PROGRESSBAR
- Q_D(QS60Style);
-
- QS60StyleAnimation *progressBarAnimation =
- QS60StylePrivate::animationDefinition(QS60StyleEnums::SP_QgnGrafBarWaitAnim);
-
- if (event->timerId() == progressBarAnimation->timerId()) {
-
- Q_ASSERT(progressBarAnimation->interval() > 0);
-
- if (progressBarAnimation->currentFrame() == progressBarAnimation->frameCount() )
- if (progressBarAnimation->playMode() == QS60StyleEnums::AM_Looping)
- progressBarAnimation->setCurrentFrame(0);
- else
- d->stopAnimation(progressBarAnimation->animationId());
-
- foreach (QProgressBar *bar, d->m_bars) {
- if ((bar->minimum() == 0 && bar->maximum() == 0))
- bar->update();
- }
- progressBarAnimation->setCurrentFrame(progressBarAnimation->currentFrame() + 1);
- }
-#endif // QT_NO_PROGRESSBAR
-#endif // Q_WS_S60
- event->ignore();
-}
-
-extern QPoint qt_s60_fill_background_offset(const QWidget *targetWidget);
-
-bool qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush)
-{
- // Check if the widget's palette matches placeholder or actual background texture.
- // When accessing backgroundTexture, use parameter value 'true' to avoid creating
- // the texture, if it is not already created.
-
- const QPixmap placeHolder(QS60StylePrivate::placeHolderTexture());
- const QPixmap bg(QS60StylePrivate::backgroundTexture(true));
- if (placeHolder.cacheKey() != brush.texture().cacheKey()
- && bg.cacheKey() != brush.texture().cacheKey())
- return false;
-
- const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture());
-
- const QPaintDevice *target = painter->device();
- if (target->devType() == QInternal::Widget) {
- const QWidget *widget = static_cast<const QWidget *>(target);
- if (!widget->testAttribute(Qt::WA_TranslucentBackground)) {
- const QVector<QRect> &rects = rgn.rects();
- for (int i = 0; i < rects.size(); ++i) {
- const QRect rect(rects.at(i));
- painter->drawPixmap(rect.topLeft(), backgroundTexture,
- rect.translated(qt_s60_fill_background_offset(widget)));
- }
- }
- }
- return true;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_STYLE_S60 || QT_PLUGIN
diff --git a/src/widgets/styles/qs60style.h b/src/widgets/styles/qs60style.h
deleted file mode 100644
index 4520d19fd3..0000000000
--- a/src/widgets/styles/qs60style.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QS60STYLE_H
-#define QS60STYLE_H
-
-#include <QtWidgets/qcommonstyle.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-//Public custom pixel metrics values.
-//These can be used to fetch custom pixel metric value from outside QS60Style.
-enum {
- PM_FrameCornerWidth = QStyle::PM_CustomBase + 1,
- PM_FrameCornerHeight,
- PM_BoldLineWidth,
- PM_ThinLineWidth,
- PM_MessageBoxHeight
- };
-
-class QS60StylePrivate;
-
-class Q_WIDGETS_EXPORT QS60Style : public QCommonStyle
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QS60Style)
-
-public:
- QS60Style();
- ~QS60Style();
-
- void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const;
- void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const;
- void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const;
- int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
- QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w = 0) const;
- int styleHint(StyleHint sh, const QStyleOption *opt = 0, const QWidget *w = 0,
- QStyleHintReturn *shret = 0) const;
- QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl scontrol, const QWidget *widget = 0) const;
- QRect subElementRect(SubElement element, const QStyleOption *opt, const QWidget *widget = 0) const;
- void polish(QWidget *widget);
- void unpolish(QWidget *widget);
- void polish(QApplication *application);
- void unpolish(QApplication *application);
-#ifndef Q_NO_USING_KEYWORD
- using QCommonStyle::polish;
-#endif
- bool event(QEvent *e);
-
-#ifndef Q_OS_SYMBIAN
- static QStringList partKeys();
- static QStringList colorListKeys();
- void setS60Theme(const QHash<QString, QPicture> &parts,
- const QHash<QPair<QString , int>, QColor> &colors);
- bool loadS60ThemeFromBlob(const QString &blobFile);
- bool saveS60ThemeToBlob(const QString &blobFile) const;
-#endif // !Q_OS_SYMBIAN
-
-protected Q_SLOTS:
- QIcon standardIconImplementation(
- StandardPixmap standardIcon, const QStyleOption * option = 0, const QWidget * widget = 0 ) const;
-
-protected:
- void timerEvent(QTimerEvent *event);
- bool eventFilter(QObject *o, QEvent *e);
-private:
- Q_DISABLE_COPY(QS60Style)
- friend class QStyleFactory;
- friend class QApplicationPrivate;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QS60STYLE_H
diff --git a/src/widgets/styles/qs60style_p.h b/src/widgets/styles/qs60style_p.h
deleted file mode 100644
index ee981c036b..0000000000
--- a/src/widgets/styles/qs60style_p.h
+++ /dev/null
@@ -1,638 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QS60STYLE_P_H
-#define QS60STYLE_P_H
-
-#include "qs60style.h"
-#include "qcommonstyle_p.h"
-#include <QtCore/qhash.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.
-//
-
-QT_BEGIN_NAMESPACE
-
-const int MAX_NON_CUSTOM_PIXELMETRICS = 92;
-const int CUSTOMVALUESCOUNT = 5;
-
-const int MAX_PIXELMETRICS = MAX_NON_CUSTOM_PIXELMETRICS + CUSTOMVALUESCOUNT;
-
-typedef struct {
- unsigned short height;
- unsigned short width;
- int major_version;
- int minor_version;
- const char* layoutName;
-} layoutHeader;
-
-#ifdef Q_OS_SYMBIAN
-NONSHARABLE_CLASS (QS60StyleEnums)
-#else
-class QS60StyleEnums
-#endif
-: public QObject
-{
-#ifndef Q_WS_S60
- Q_OBJECT
- Q_ENUMS(FontCategories)
- Q_ENUMS(SkinParts)
- Q_ENUMS(ColorLists)
-#endif // !Q_WS_S60
-
-public:
-
- // S60 definitions within theme
- enum ThemeDefinitions {
- TD_AnimationData,
- };
-
- //Defines which values are contained within animation data (retrieved using TD_AnimationData).
- //Additionally defines the order in which the items are given out in QList<QVariant>.
- enum AnimationData {
- AD_Interval = 0,
- AD_NumberOfFrames,
- AD_AnimationPlayMode, //currently not used as themes seem to contain invalid data
- };
-
- // Animation modes
- enum AnimationMode {
- AM_PlayOnce = 0, //animation is played exactly once
- AM_Looping, //animation is repeated until stopped
- AM_Bounce //animation is played repeatedly until stopped,
- //but frames are played in reverse order every second time
- //(no support yet)
- };
-
- // S60 look-and-feel font categories
- enum FontCategories {
- FC_Undefined,
- FC_Primary,
- FC_Secondary,
- FC_Title,
- FC_PrimarySmall,
- FC_Digital
- };
-
- enum SkinParts {
- SP_QgnGrafBarWaitAnim,
- SP_QgnGrafBarFrameCenter,
- SP_QgnGrafBarFrameSideL,
- SP_QgnGrafBarFrameSideR,
- SP_QgnGrafBarProgress,
- SP_QgnGrafOrgBgGrid,
- SP_QgnGrafScrollArrowDown,
- SP_QgnGrafScrollArrowLeft,
- SP_QgnGrafScrollArrowRight,
- SP_QgnGrafScrollArrowUp,
- SP_QgnGrafTabActiveL,
- SP_QgnGrafTabActiveM,
- SP_QgnGrafTabActiveR,
- SP_QgnGrafTabPassiveL,
- SP_QgnGrafTabPassiveM,
- SP_QgnGrafTabPassiveR,
- SP_QgnGrafNsliderEndLeft,
- SP_QgnGrafNsliderEndRight,
- SP_QgnGrafNsliderMiddle,
- SP_QgnIndiCheckboxOff,
- SP_QgnIndiCheckboxOn,
- SP_QgnIndiHlColSuper, // Available in S60 release 3.2 and later.
- SP_QgnIndiHlExpSuper, // Available in S60 release 3.2 and later.
- SP_QgnIndiHlLineBranch, // Available in S60 release 3.2 and later.
- SP_QgnIndiHlLineEnd, // Available in S60 release 3.2 and later.
- SP_QgnIndiHlLineStraight, // Available in S60 release 3.2 and later.
- SP_QgnIndiMarkedAdd,
- SP_QgnIndiNaviArrowLeft,
- SP_QgnIndiNaviArrowRight,
- SP_QgnIndiRadiobuttOff,
- SP_QgnIndiRadiobuttOn,
- SP_QgnGrafNsliderMarker,
- SP_QgnGrafNsliderMarkerSelected,
- SP_QgnIndiSubmenu,
- SP_QgnNoteErased,
- SP_QgnNoteError,
- SP_QgnNoteInfo,
- SP_QgnNoteOk,
- SP_QgnNoteQuery,
- SP_QgnNoteWarning,
- SP_QgnPropFileSmall,
- SP_QgnPropFolderCurrent,
- SP_QgnPropFolderSmall,
- SP_QgnPropFolderSmallNew,
- SP_QgnPropPhoneMemcLarge,
- SP_QgnFrSctrlButtonCornerTl, // Toolbar button
- SP_QgnFrSctrlButtonCornerTr,
- SP_QgnFrSctrlButtonCornerBl,
- SP_QgnFrSctrlButtonCornerBr,
- SP_QgnFrSctrlButtonSideT,
- SP_QgnFrSctrlButtonSideB,
- SP_QgnFrSctrlButtonSideL,
- SP_QgnFrSctrlButtonSideR,
- SP_QgnFrSctrlButtonCenter,
- SP_QgnFrSctrlButtonCornerTlPressed, // Toolbar button, pressed
- SP_QgnFrSctrlButtonCornerTrPressed,
- SP_QgnFrSctrlButtonCornerBlPressed,
- SP_QgnFrSctrlButtonCornerBrPressed,
- SP_QgnFrSctrlButtonSideTPressed,
- SP_QgnFrSctrlButtonSideBPressed,
- SP_QgnFrSctrlButtonSideLPressed,
- SP_QgnFrSctrlButtonSideRPressed,
- SP_QgnFrSctrlButtonCenterPressed,
- SP_QsnCpScrollHandleBottomPressed, //ScrollBar handle, pressed state
- SP_QsnCpScrollHandleMiddlePressed,
- SP_QsnCpScrollHandleTopPressed,
- SP_QsnBgScreen,
- SP_QsnCpScrollBgBottom,
- SP_QsnCpScrollBgMiddle,
- SP_QsnCpScrollBgTop,
- SP_QsnCpScrollHandleBottom,
- SP_QsnCpScrollHandleMiddle,
- SP_QsnCpScrollHandleTop,
- SP_QsnFrButtonTbCornerTl, // Button, normal state
- SP_QsnFrButtonTbCornerTr,
- SP_QsnFrButtonTbCornerBl,
- SP_QsnFrButtonTbCornerBr,
- SP_QsnFrButtonTbSideT,
- SP_QsnFrButtonTbSideB,
- SP_QsnFrButtonTbSideL,
- SP_QsnFrButtonTbSideR,
- SP_QsnFrButtonTbCenter,
- SP_QsnFrButtonTbCornerTlPressed, // Button, pressed state
- SP_QsnFrButtonTbCornerTrPressed,
- SP_QsnFrButtonTbCornerBlPressed,
- SP_QsnFrButtonTbCornerBrPressed,
- SP_QsnFrButtonTbSideTPressed,
- SP_QsnFrButtonTbSideBPressed,
- SP_QsnFrButtonTbSideLPressed,
- SP_QsnFrButtonTbSideRPressed,
- SP_QsnFrButtonTbCenterPressed,
- SP_QsnFrCaleCornerTl, // calendar grid item
- SP_QsnFrCaleCornerTr,
- SP_QsnFrCaleCornerBl,
- SP_QsnFrCaleCornerBr,
- SP_QsnFrCaleSideT,
- SP_QsnFrCaleSideB,
- SP_QsnFrCaleSideL,
- SP_QsnFrCaleSideR,
- SP_QsnFrCaleCenter,
- SP_QsnFrCaleHeadingCornerTl, // calendar grid header
- SP_QsnFrCaleHeadingCornerTr,
- SP_QsnFrCaleHeadingCornerBl,
- SP_QsnFrCaleHeadingCornerBr,
- SP_QsnFrCaleHeadingSideT,
- SP_QsnFrCaleHeadingSideB,
- SP_QsnFrCaleHeadingSideL,
- SP_QsnFrCaleHeadingSideR,
- SP_QsnFrCaleHeadingCenter,
- SP_QsnFrInputCornerTl, // Text input field
- SP_QsnFrInputCornerTr,
- SP_QsnFrInputCornerBl,
- SP_QsnFrInputCornerBr,
- SP_QsnFrInputSideT,
- SP_QsnFrInputSideB,
- SP_QsnFrInputSideL,
- SP_QsnFrInputSideR,
- SP_QsnFrInputCenter,
- SP_QsnFrListCornerTl, // List background
- SP_QsnFrListCornerTr,
- SP_QsnFrListCornerBl,
- SP_QsnFrListCornerBr,
- SP_QsnFrListSideT,
- SP_QsnFrListSideB,
- SP_QsnFrListSideL,
- SP_QsnFrListSideR,
- SP_QsnFrListCenter,
- SP_QsnFrPopupCornerTl, // Option menu background
- SP_QsnFrPopupCornerTr,
- SP_QsnFrPopupCornerBl,
- SP_QsnFrPopupCornerBr,
- SP_QsnFrPopupSideT,
- SP_QsnFrPopupSideB,
- SP_QsnFrPopupSideL,
- SP_QsnFrPopupSideR,
- SP_QsnFrPopupCenter,
- SP_QsnFrPopupPreviewCornerTl, // tool tip background
- SP_QsnFrPopupPreviewCornerTr,
- SP_QsnFrPopupPreviewCornerBl,
- SP_QsnFrPopupPreviewCornerBr,
- SP_QsnFrPopupPreviewSideT,
- SP_QsnFrPopupPreviewSideB,
- SP_QsnFrPopupPreviewSideL,
- SP_QsnFrPopupPreviewSideR,
- SP_QsnFrPopupPreviewCenter,
- SP_QsnFrSetOptCornerTl, // Settings list
- SP_QsnFrSetOptCornerTr,
- SP_QsnFrSetOptCornerBl,
- SP_QsnFrSetOptCornerBr,
- SP_QsnFrSetOptSideT,
- SP_QsnFrSetOptSideB,
- SP_QsnFrSetOptSideL,
- SP_QsnFrSetOptSideR,
- SP_QsnFrSetOptCenter,
- SP_QsnFrPopupSubCornerTl, // Toolbar background
- SP_QsnFrPopupSubCornerTr,
- SP_QsnFrPopupSubCornerBl,
- SP_QsnFrPopupSubCornerBr,
- SP_QsnFrPopupSubSideT,
- SP_QsnFrPopupSubSideB,
- SP_QsnFrPopupSubSideL,
- SP_QsnFrPopupSubSideR,
- SP_QsnFrPopupSubCenter,
- SP_QsnFrButtonCornerTlInactive, // Inactive button
- SP_QsnFrButtonCornerTrInactive,
- SP_QsnFrButtonCornerBlInactive,
- SP_QsnFrButtonCornerBrInactive,
- SP_QsnFrButtonSideTInactive,
- SP_QsnFrButtonSideBInactive,
- SP_QsnFrButtonSideLInactive,
- SP_QsnFrButtonSideRInactive,
- SP_QsnFrButtonCenterInactive,
- SP_QsnFrGridCornerTlPressed, // Pressed table item
- SP_QsnFrGridCornerTrPressed,
- SP_QsnFrGridCornerBlPressed,
- SP_QsnFrGridCornerBrPressed,
- SP_QsnFrGridSideTPressed,
- SP_QsnFrGridSideBPressed,
- SP_QsnFrGridSideLPressed,
- SP_QsnFrGridSideRPressed,
- SP_QsnFrGridCenterPressed,
- SP_QsnFrListCornerTlPressed, // Pressed list item
- SP_QsnFrListCornerTrPressed,
- SP_QsnFrListCornerBlPressed,
- SP_QsnFrListCornerBrPressed,
- SP_QsnFrListSideTPressed,
- SP_QsnFrListSideBPressed,
- SP_QsnFrListSideLPressed,
- SP_QsnFrListSideRPressed,
- SP_QsnFrListCenterPressed,
- };
-
- enum ColorLists {
- CL_QsnHighlightColors,
- CL_QsnIconColors,
- CL_QsnLineColors,
- CL_QsnOtherColors,
- CL_QsnParentColors,
- CL_QsnTextColors
- };
-};
-
-#ifdef Q_WS_S60
-class CAknBitmapAnimation;
-NONSHARABLE_CLASS (AnimationData) : public QObject
-{
-public:
- AnimationData(const QS60StyleEnums::SkinParts part, int frames, int interval);
-
- const QS60StyleEnums::SkinParts m_id;
- int m_frames;
- int m_interval;
- QS60StyleEnums::AnimationMode m_mode;
-};
-
-
-NONSHARABLE_CLASS (AnimationDataV2) : public AnimationData
-{
-public:
- AnimationDataV2(const AnimationData &data);
- ~AnimationDataV2();
-
- CAknBitmapAnimation *m_animation;
- int m_currentFrame;
- bool m_resourceBased;
- int m_timerId;
-};
-
-
-class QS60StyleAnimation : public QObject
-{
-public:
- QS60StyleAnimation(const QS60StyleEnums::SkinParts part, int frames, int interval);
- ~QS60StyleAnimation();
-
-public:
- QS60StyleEnums::SkinParts animationId() const {return m_currentData->m_id;}
- int frameCount() const { return m_currentData->m_frames;}
- int interval() const {return m_currentData->m_interval;}
- QS60StyleEnums::AnimationMode playMode() const {return m_currentData->m_mode;}
- CAknBitmapAnimation* animationObject() const {return m_currentData->m_animation;}
- bool isResourceBased() const {return m_currentData->m_resourceBased;}
- int timerId() const {return m_currentData->m_timerId;}
- int currentFrame() const {return m_currentData->m_currentFrame;}
-
- void setFrameCount(int frameCount) {m_currentData->m_frames = frameCount;}
- void setInterval(int interval) {m_currentData->m_interval = interval;}
- void setAnimationObject(CAknBitmapAnimation* animation);
- void setResourceBased(bool resourceBased) {m_currentData->m_resourceBased = resourceBased;}
- void setTimerId(int timerId) {m_currentData->m_timerId = timerId;}
- void setCurrentFrame(int currentFrame) {m_currentData->m_currentFrame = currentFrame;}
-
- void resetToDefaults();
-
-private: //data members
- //TODO: consider changing these to non-pointers as the classes are rather small anyway
- AnimationData *m_defaultData;
- AnimationDataV2 *m_currentData;
-};
-
-#endif //Q_WS_S60
-
-
-class QFocusFrame;
-class QProgressBar;
-class QS60StyleAnimation;
-
-// Private class
-#ifdef Q_OS_SYMBIAN
-NONSHARABLE_CLASS (QS60StylePrivate)
-#else
-class QS60StylePrivate
-#endif
-: public QCommonStylePrivate
-{
- Q_DECLARE_PUBLIC(QS60Style)
-
-public:
- QS60StylePrivate();
- ~QS60StylePrivate();
-
- enum SkinElements {
- SE_ButtonNormal,
- SE_ButtonPressed,
- SE_FrameLineEdit,
- SE_ProgressBarGrooveHorizontal,
- SE_ProgressBarIndicatorHorizontal,
- SE_ProgressBarGrooveVertical,
- SE_ProgressBarIndicatorVertical,
- SE_ScrollBarGrooveHorizontal,
- SE_ScrollBarGrooveVertical,
- SE_ScrollBarHandleHorizontal,
- SE_ScrollBarHandleVertical,
- SE_SliderHandleHorizontal,
- SE_SliderHandleVertical,
- SE_SliderHandleSelectedHorizontal,
- SE_SliderHandleSelectedVertical,
- SE_SliderGrooveVertical,
- SE_SliderGrooveHorizontal,
- SE_TabBarTabEastActive,
- SE_TabBarTabEastInactive,
- SE_TabBarTabNorthActive,
- SE_TabBarTabNorthInactive,
- SE_TabBarTabSouthActive,
- SE_TabBarTabSouthInactive,
- SE_TabBarTabWestActive,
- SE_TabBarTabWestInactive,
- SE_ListHighlight,
- SE_PopupBackground,
- SE_SettingsList,
- SE_TableItem,
- SE_TableHeaderItem,
- SE_ToolTip, //own graphic available on 3.2+ releases,
- SE_ToolBar,
- SE_ToolBarButton,
- SE_ToolBarButtonPressed,
- SE_PanelBackground,
- SE_ScrollBarHandlePressedHorizontal,
- SE_ScrollBarHandlePressedVertical,
- SE_ButtonInactive,
- SE_Editor,
- SE_DropArea,
- SE_TableItemPressed,
- SE_ListItemPressed,
- };
-
- enum SkinFrameElements {
- SF_ButtonNormal,
- SF_ButtonPressed,
- SF_FrameLineEdit,
- SF_ListHighlight,
- SF_PopupBackground,
- SF_SettingsList,
- SF_TableItem,
- SF_TableHeaderItem,
- SF_ToolTip,
- SF_ToolBar,
- SF_ToolBarButton,
- SF_ToolBarButtonPressed,
- SF_PanelBackground,
- SF_ButtonInactive,
- SF_TableItemPressed,
- SF_ListItemPressed,
- };
-
- enum SkinElementFlag {
- SF_PointNorth = 0x0001, // North = the default
- SF_PointEast = 0x0002,
- SF_PointSouth = 0x0004,
- SF_PointWest = 0x0008,
-
- SF_StateEnabled = 0x0010, // Enabled = the default
- SF_StateDisabled = 0x0020,
- SF_ColorSkinned = 0x0040, // pixmap is colored with foreground pen color
- SF_Animation = 0x0080,
- SF_Mirrored_X_Axis = 0x0100,
- SF_Mirrored_Y_Axis = 0x0200
- };
-
- enum CacheClearReason {
- CC_UndefinedChange = 0,
- CC_LayoutChange,
- CC_ThemeChange
- };
-
- Q_DECLARE_FLAGS(SkinElementFlags, SkinElementFlag)
-
- // draws skin element
- static void drawSkinElement(SkinElements element, QPainter *painter,
- const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags);
- // draws a specific skin part
- static void drawSkinPart(QS60StyleEnums::SkinParts part, QPainter *painter,
- const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags);
- // gets pixel metrics value
- static short pixelMetric(int metric);
- // gets color. 'index' is NOT 0-based.
- // It corresponds to the enum key 1-based numbers of TAknsQsnXYZColorsIndex, not the values.
- static QColor s60Color(QS60StyleEnums::ColorLists list,
- int index, const QStyleOption *option);
- // gets state specific color
- static QColor stateColor(const QColor &color, const QStyleOption *option);
- // gets lighter color than base color
- static QColor lighterColor(const QColor &baseColor);
- //deduces if the given widget should have separately themeable background
- static bool drawsOwnThemeBackground(const QWidget *widget);
-
- QFont s60Font(QS60StyleEnums::FontCategories fontCategory,
- int pointSize = -1, bool resolveFontSize = true) const;
- // clears all style caches (fonts, colors, pixmaps)
- void clearCaches(CacheClearReason reason = CC_UndefinedChange);
-
- // themed main background oprations
- void setBackgroundTexture(QApplication *application) const;
- static void deleteBackground();
-
- static bool isTouchSupported();
- static bool isToolBarBackground();
- static bool hasSliderGrooveGraphic();
- static bool isSingleClickUi();
- static bool isWidgetPressed(const QWidget *widget);
-
-#ifdef Q_WS_S60
- static void deleteStoredSettings();
- // calculates average color based on theme graphics (minus borders).
- QColor colorFromFrameGraphics(SkinFrameElements frame) const;
-#endif
- QColor calculatedColor(SkinFrameElements frame) const;
-
- //set theme palette for application
- void setThemePalette(QApplication *application) const;
- //access to theme palette
- static QPalette* themePalette();
-
- static const layoutHeader m_layoutHeaders[];
- static const short data[][MAX_PIXELMETRICS];
-
- void setCurrentLayout(int layoutIndex);
- void setActiveLayout();
- // Pointer
- static short const *m_pmPointer;
- // number of layouts supported by the style
- static const int m_numberOfLayouts;
-
- mutable QHash<QPair<QS60StyleEnums::FontCategories , int>, QFont> m_mappedFontsCache;
-
- // Has one entry per SkinFrameElements
- static const struct frameElementCenter {
- SkinElements element;
- QS60StyleEnums::SkinParts center;
- } m_frameElementsData[];
-
- static QPixmap frame(SkinFrameElements frame, const QSize &size,
- SkinElementFlags flags = KDefaultSkinElementFlags);
- static QPixmap backgroundTexture(bool skipCreation = false);
- static QPixmap placeHolderTexture();
-
-#ifdef Q_WS_S60
- void handleDynamicLayoutVariantSwitch();
- void handleSkinChange();
-#endif // Q_WS_S60
-
- //Checks that the current brush is transparent or has BrushStyle NoBrush,
- //so that theme graphic background can be drawn.
- static bool canDrawThemeBackground(const QBrush &backgroundBrush, const QWidget *widget);
-
- static int currentAnimationFrame(QS60StyleEnums::SkinParts part);
-#ifdef Q_WS_S60
-
- //No support for animations on emulated style
- void startAnimation(QS60StyleEnums::SkinParts animation);
- void stopAnimation(QS60StyleEnums::SkinParts animation);
- static QS60StyleAnimation* animationDefinition(QS60StyleEnums::SkinParts part);
- static void removeAnimations();
-
-#endif
-
-private:
- static void drawPart(QS60StyleEnums::SkinParts part, QPainter *painter,
- const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags);
- static void drawRow(QS60StyleEnums::SkinParts start, QS60StyleEnums::SkinParts middle,
- QS60StyleEnums::SkinParts end, Qt::Orientation orientation, QPainter *painter,
- const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags);
- static void drawFrame(SkinFrameElements frame, QPainter *painter,
- const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags);
-
- static QPixmap cachedPart(QS60StyleEnums::SkinParts part, const QSize &size,
- QPainter *painter, SkinElementFlags flags = KDefaultSkinElementFlags);
- static QPixmap cachedFrame(SkinFrameElements frame, const QSize &size,
- SkinElementFlags flags = KDefaultSkinElementFlags);
-
- // set S60 font for widget
- void setFont(QWidget *widget) const;
- static void setThemePalette(QWidget *widget);
- void setThemePalette(QPalette *palette) const;
- static void setThemePaletteHash(QPalette *palette);
- static void storeThemePalette(QPalette *palette);
- static void deleteThemePalette();
- static bool equalToThemePalette(QColor color, QPalette::ColorRole role);
- static bool equalToThemePalette(qint64 cacheKey, QPalette::ColorRole role);
-
- static QSize partSize(QS60StyleEnums::SkinParts part,
- SkinElementFlags flags = KDefaultSkinElementFlags);
- static QPixmap part(QS60StyleEnums::SkinParts part, const QSize &size,
- QPainter *painter, SkinElementFlags flags = KDefaultSkinElementFlags);
-
- static QFont s60Font_specific(QS60StyleEnums::FontCategories fontCategory,
- int pointSize, bool resolveFontSize);
-
- static QSize screenSize();
-
- // Contains background texture.
- static QPixmap *m_background;
- // Placeholder pixmap for the real background texture.
- static QPixmap *m_placeHolderTexture;
-
- const static SkinElementFlags KDefaultSkinElementFlags;
- // defined theme palette
- static QPalette *m_themePalette;
- QPalette m_originalPalette;
-
- QPointer<QFocusFrame> m_focusFrame;
- static qint64 m_webPaletteKey;
-
- static QPointer<QWidget> m_pressedWidget;
-
-#ifdef Q_WS_S60
- //list of progress bars having animation running
- QList<QProgressBar *> m_bars;
-#endif
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QS60STYLE_P_H
diff --git a/src/widgets/styles/qs60style_s60.cpp b/src/widgets/styles/qs60style_s60.cpp
deleted file mode 100644
index f7ced9e8f8..0000000000
--- a/src/widgets/styles/qs60style_s60.cpp
+++ /dev/null
@@ -1,1591 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qs60style.h"
-#include "qs60style_p.h"
-#include "qpainter.h"
-#include "qstyleoption.h"
-#include "qstyle.h"
-#include "private/qt_s60_p.h"
-#include "private/qpixmap_s60_p.h"
-#include "private/qcore_symbian_p.h"
-#include "private/qvolatileimage_p.h"
-#include "qapplication.h"
-#include "qsettings.h"
-
-#include <w32std.h>
-#include <AknsConstants.h>
-#include <aknconsts.h>
-#include <AknsItemID.h>
-#include <AknsUtils.h>
-#include <AknsDrawUtils.h>
-#include <AknsSkinInstance.h>
-#include <AknsBasicBackgroundControlContext.h>
-#include <avkon.mbg>
-#include <AknFontAccess.h>
-#include <AknLayoutFont.h>
-#include <AknUtils.h>
-#include <aknnavi.h>
-#include <gulicon.h>
-#include <AknBitmapAnimation.h>
-#include <centralrepository.h>
-
-#if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN)
-
-QT_BEGIN_NAMESPACE
-
-enum TDrawType {
- EDrawIcon,
- EDrawGulIcon,
- EDrawBackground,
- EDrawAnimation,
- ENoDraw
-};
-
-const TUid personalisationUID = { 0x101F876F };
-
-enum TSupportRelease {
- ES60_None = 0x0000, //indicates that the commonstyle should draw the graphics
- ES60_3_1 = 0x0001,
- ES60_3_2 = 0x0002,
- ES60_5_0 = 0x0004,
- ES60_5_1 = 0x0008,
- ES60_5_2 = 0x0010,
- ES60_5_3 = 0x0020,
- ES60_3_X = ES60_3_1 | ES60_3_2,
- // Releases before Symbian Foundation
- ES60_PreSF = ES60_3_1 | ES60_3_2 | ES60_5_0,
- // Releases before the S60 5.2
- ES60_Pre52 = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1,
- // Releases before S60 5.3
- ES60_Pre53 = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2,
- // Add all new releases here
- ES60_All = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 | ES60_5_3
-};
-
-typedef struct {
- const TAknsItemID &skinID; // Determines default theme graphics ID.
- TDrawType drawType; // Determines which native drawing routine is used to draw this item.
- int supportInfo; // Defines the S60 versions that use the default graphics.
- // These two, define new graphics that are used in releases other than partMapEntry.supportInfo defined releases.
- // In general, these are given in numeric form to allow style compilation in earlier
- // native releases that do not contain the new graphics.
- int newMajorSkinId;
- int newMinorSkinId;
-} partMapEntry;
-
-AnimationData::AnimationData(const QS60StyleEnums::SkinParts part, int frames, int interval) : m_id(part),
- m_frames(frames), m_interval(interval), m_mode(QS60StyleEnums::AM_Looping)
-{
-}
-
-AnimationDataV2::AnimationDataV2(const AnimationData &data) : AnimationData(data.m_id, data.m_frames, data.m_interval),
- m_animation(0), m_currentFrame(0), m_resourceBased(false), m_timerId(0)
-{
-}
-AnimationDataV2::~AnimationDataV2()
-{
- delete m_animation;
-}
-
-QS60StyleAnimation::QS60StyleAnimation(const QS60StyleEnums::SkinParts part, int frames, int interval)
-{
- QT_TRAP_THROWING(m_defaultData = new (ELeave) AnimationData(part, frames, interval));
- QT_TRAP_THROWING(m_currentData = new (ELeave) AnimationDataV2(*m_defaultData));
-}
-
-QS60StyleAnimation::~QS60StyleAnimation()
-{
- delete m_currentData;
- delete m_defaultData;
-}
-
-void QS60StyleAnimation::setAnimationObject(CAknBitmapAnimation* animation)
-{
- Q_ASSERT(animation);
- if (m_currentData->m_animation)
- delete m_currentData->m_animation;
- m_currentData->m_animation = animation;
-}
-
-void QS60StyleAnimation::resetToDefaults()
-{
- delete m_currentData;
- m_currentData = 0;
- QT_TRAP_THROWING(m_currentData = new (ELeave) AnimationDataV2(*m_defaultData));
-}
-
-class QS60StyleModeSpecifics
-{
-public:
- static QPixmap skinnedGraphics(QS60StyleEnums::SkinParts stylepart,
- const QSize &size, QS60StylePrivate::SkinElementFlags flags);
- static QPixmap skinnedGraphics(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags);
- static QPixmap colorSkinnedGraphics(const QS60StyleEnums::SkinParts &stylepart,
- const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags);
- static QColor colorValue(const TAknsItemID &colorGroup, int colorIndex);
- static QPixmap fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, const TSize& targetSize);
- static bool disabledPartGraphic(QS60StyleEnums::SkinParts &part);
- static bool disabledFrameGraphic(QS60StylePrivate::SkinFrameElements &frame);
- static QPixmap generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part, const QSize &size, QS60StylePrivate::SkinElementFlags flags);
- static TAknsItemID partSpecificThemeId(int part);
-
- static QVariant themeDefinition(QS60StyleEnums::ThemeDefinitions definition, QS60StyleEnums::SkinParts part);
-
-private:
- static QPixmap createSkinnedGraphicsLX(QS60StyleEnums::SkinParts part,
- const QSize &size, QS60StylePrivate::SkinElementFlags flags);
- static QPixmap createSkinnedGraphicsLX(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags);
- static QPixmap colorSkinnedGraphicsLX(const QS60StyleEnums::SkinParts &stylepart,
- const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags);
- static void frameIdAndCenterId(QS60StylePrivate::SkinFrameElements frameElement, TAknsItemID &frameId, TAknsItemID &centerId);
- static TRect innerRectFromElement(QS60StylePrivate::SkinFrameElements frameElement, const TRect &outerRect);
- static void fallbackInfo(const QS60StyleEnums::SkinParts &stylePart, TInt &fallbackIndex);
- static bool checkSupport(const int supportedRelease);
- // Array to match the skin ID, fallback graphics and Qt widget graphics.
- static const partMapEntry m_partMap[];
-};
-
-const partMapEntry QS60StyleModeSpecifics::m_partMap[] = {
- /* SP_QgnGrafBarWaitAnim */ {KAknsIIDQgnGrafBarWaitAnim, EDrawAnimation, ES60_All, -1,-1},
- /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_All, -1,-1},
- // No drop area for 3.x non-touch devices
- /* SP_QgnGrafOrgBgGrid */ {KAknsIIDNone, EDrawIcon, ES60_3_X, EAknsMajorGeneric ,0x1eba}, //KAknsIIDQgnGrafOrgBgGrid
- /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawGulIcon, ES60_All, -1,-1},
- /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawGulIcon, ES60_All, -1,-1},
- /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawGulIcon, ES60_All, -1,-1},
- /* SP_QgnGrafScrollArrowUp */ {KAknsIIDQgnGrafScrollArrowUp, EDrawGulIcon, ES60_All, -1,-1},
-
- // In S60 5.3 there is a new tab graphic
- /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_Pre53, EAknsMajorSkin, 0x2219}, //KAknsIIDQtgFrTabActiveNormalL
- /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_Pre53, EAknsMajorSkin, 0x221b}, //KAknsIIDQtgFrTabActiveNormalC
- /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_Pre53, EAknsMajorSkin, 0x221a}, //KAknsIIDQtgFrTabActiveNormalR
- /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_Pre53, EAknsMajorSkin, 0x2221}, //KAknsIIDQtgFrTabPassiveNormalL
- /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_Pre53, EAknsMajorSkin, 0x2223}, //KAknsIIDQtgFrTabPassiveNormalC
- /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_Pre53, EAknsMajorSkin, 0x2222}, //KAknsIIDQtgFrTabPassiveNormalR
-
- // In 3.1 there is no slider groove.
- /* SP_QgnGrafNsliderEndLeft */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19cf /* KAknsIIDQgnGrafNsliderEndLeft */},
- /* SP_QgnGrafNsliderEndRight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d0 /* KAknsIIDQgnGrafNsliderEndRight */},
- /* SP_QgnGrafNsliderMiddle */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d2 /* KAknsIIDQgnGrafNsliderMiddle */},
- /* SP_QgnIndiCheckboxOff */ {KAknsIIDQgnIndiCheckboxOff, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnIndiCheckboxOn */ {KAknsIIDQgnIndiCheckboxOn, EDrawIcon, ES60_All, -1,-1},
-
- // Following 5 items (SP_QgnIndiHlColSuper - SP_QgnIndiHlLineStraight) are available starting from S60 release 3.2.
- // In 3.1 CommonStyle drawing is used for these QTreeView elements, since no similar icons in AVKON UI.
- /* SP_QgnIndiHlColSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d5 /* KAknsIIDQgnIndiHlColSuper */},
- /* SP_QgnIndiHlExpSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d6 /* KAknsIIDQgnIndiHlExpSuper */},
- /* SP_QgnIndiHlLineBranch */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d7 /* KAknsIIDQgnIndiHlLineBranch */},
- /* SP_QgnIndiHlLineEnd */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d8 /* KAknsIIDQgnIndiHlLineEnd */},
- /* SP_QgnIndiHlLineStraight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d9 /* KAknsIIDQgnIndiHlLineStraight */},
- /* SP_QgnIndiMarkedAdd */ {KAknsIIDQgnIndiMarkedAdd, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnIndiNaviArrowLeft */ {KAknsIIDQgnIndiNaviArrowLeft, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnIndiNaviArrowRight, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_All, -1,-1},
-
- // In 3.1 there different slider graphic and no pressed state.
- /* SP_QgnGrafNsliderMarker */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d1 /* KAknsIIDQgnGrafNsliderMarker */},
- /* SP_QgnGrafNsliderMarkerSelected */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x1a4a /* KAknsIIDQgnGrafNsliderMarkerSelected */},
- /* SP_QgnIndiSubmenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnNoteInfo */ {KAknsIIDQgnNoteInfo, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnNoteOk */ {KAknsIIDQgnNoteOk, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnNoteQuery */ {KAknsIIDQgnNoteQuery, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnNoteWarning */ {KAknsIIDQgnNoteWarning, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnPropFileSmall */ {KAknsIIDQgnPropFileSmall, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnPropFolderCurrent */ {KAknsIIDQgnPropFolderCurrent, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnPropFolderSmall */ {KAknsIIDQgnPropFolderSmall, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_All, -1,-1},
-
- // Toolbar graphics is different in 3.1/3.2 vs. 5.0
- /* SP_QgnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/
- /* SP_QgnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2302},
- /* SP_QgnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2303},
- /* SP_QgnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2304},
- /* SP_QgnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2305},
- /* SP_QgnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2306},
- /* SP_QgnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2307},
- /* SP_QgnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2308},
- /* SP_QgnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/
-
- // No pressed state for toolbar button in 3.1/3.2.
- /* SP_QgnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2621}, /*KAknsIIDQgnFrSctrlButtonCornerTlPressed*/
- /* SP_QgnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2622},
- /* SP_QgnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2623},
- /* SP_QgnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2624},
- /* SP_QgnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2625},
- /* SP_QgnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2626},
- /* SP_QgnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2627},
- /* SP_QgnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2628},
- /* SP_QgnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2629},
-
- // 3.1 & 3.2 do not have pressed state for scrollbar, so use normal scrollbar graphics instead.
- /* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/
- /* SP_QsnCpScrollHandleMiddlePressed*/ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20f9}, /*KAknsIIDQsnCpScrollHandleMiddlePressed*/
- /* SP_QsnCpScrollHandleTopPressed*/ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20fa}, /*KAknsIIDQsnCpScrollHandleTopPressed*/
-
- /* SP_QsnBgScreen */ {KAknsIIDQsnBgScreen, EDrawBackground, ES60_All, -1,-1},
-
- /* SP_QsnCpScrollBgBottom */ {KAknsIIDQsnCpScrollBgBottom, EDrawIcon, ES60_All, -1,-1},
- /* SP_QsnCpScrollBgMiddle */ {KAknsIIDQsnCpScrollBgMiddle, EDrawIcon, ES60_All, -1,-1},
- /* SP_QsnCpScrollBgTop */ {KAknsIIDQsnCpScrollBgTop, EDrawIcon, ES60_All, -1,-1},
-
- /* SP_QsnCpScrollHandleBottom */ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_All, -1,-1},
- /* SP_QsnCpScrollHandleMiddle */ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_All, -1,-1},
- /* SP_QsnCpScrollHandleTop */ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_All, -1,-1},
-
- /* SP_QsnFrButtonTbCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_All, -1, -1},
- /* SP_QsnFrButtonTbCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_All, -1, -1},
- /* SP_QsnFrButtonTbCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_All, -1, -1},
- /* SP_QsnFrButtonTbCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_All, -1, -1},
- /* SP_QsnFrButtonTbSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_All, -1, -1},
- /* SP_QsnFrButtonTbSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_All, -1, -1},
- /* SP_QsnFrButtonTbSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_All, -1, -1},
- /* SP_QsnFrButtonTbSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_All, -1, -1},
- /* SP_QsnFrButtonTbCenter */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_All, -1, -1},
-
- /* SP_QsnFrButtonTbCornerTlPressed */{KAknsIIDQsnFrButtonTbCornerTlPressed, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrButtonTbCornerTrPressed */{KAknsIIDQsnFrButtonTbCornerTrPressed, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrButtonTbCornerBlPressed */{KAknsIIDQsnFrButtonTbCornerBlPressed, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrButtonTbCornerBrPressed */{KAknsIIDQsnFrButtonTbCornerBrPressed, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrButtonTbSideTPressed */ {KAknsIIDQsnFrButtonTbSideTPressed, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrButtonTbSideBPressed */ {KAknsIIDQsnFrButtonTbSideBPressed, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrButtonTbSideLPressed */ {KAknsIIDQsnFrButtonTbSideLPressed, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrButtonTbSideRPressed */ {KAknsIIDQsnFrButtonTbSideRPressed, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrButtonTbCenterPressed */ {KAknsIIDQsnFrButtonTbCenterPressed, EDrawIcon, ES60_All, -1,-1},
-
- /* SP_QsnFrCaleCornerTl */ {KAknsIIDQsnFrCaleCornerTl, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleCornerTr */ {KAknsIIDQsnFrCaleCornerTr, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleCornerBl */ {KAknsIIDQsnFrCaleCornerBl, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleCornerBr */ {KAknsIIDQsnFrCaleCornerBr, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleSideT */ {KAknsIIDQsnFrCaleSideT, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleSideB */ {KAknsIIDQsnFrCaleSideB, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleSideL */ {KAknsIIDQsnFrCaleSideL, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleSideR */ {KAknsIIDQsnFrCaleSideR, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleCenter */ {KAknsIIDQsnFrCaleCenter, ENoDraw, ES60_All, -1,-1},
-
- /* SP_QsnFrCaleHeadingCornerTl */ {KAknsIIDQsnFrCaleHeadingCornerTl, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleHeadingCornerTr */ {KAknsIIDQsnFrCaleHeadingCornerTr, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleHeadingCornerBl */ {KAknsIIDQsnFrCaleHeadingCornerBl, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleHeadingCornerBr */ {KAknsIIDQsnFrCaleHeadingCornerBr, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleHeadingSideT */ {KAknsIIDQsnFrCaleHeadingSideT, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleHeadingSideB */ {KAknsIIDQsnFrCaleHeadingSideB, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleHeadingSideL */ {KAknsIIDQsnFrCaleHeadingSideL, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleHeadingSideR */ {KAknsIIDQsnFrCaleHeadingSideR, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleHeadingCenter */ {KAknsIIDQsnFrCaleHeadingCenter, ENoDraw, ES60_All, -1,-1},
-
- /* SP_QsnFrInputCornerTl */ {KAknsIIDQsnFrInputCornerTl, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrInputCornerTr */ {KAknsIIDQsnFrInputCornerTr, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrInputCornerBl */ {KAknsIIDQsnFrInputCornerBl, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrInputCornerBr */ {KAknsIIDQsnFrInputCornerBr, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrInputSideT */ {KAknsIIDQsnFrInputSideT, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrInputSideB */ {KAknsIIDQsnFrInputSideB, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrInputSideL */ {KAknsIIDQsnFrInputSideL, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrInputSideR */ {KAknsIIDQsnFrInputSideR, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrInputCenter */ {KAknsIIDQsnFrInputCenter, ENoDraw, ES60_All, -1,-1},
-
- /* SP_QsnFrListCornerTl */ {KAknsIIDQsnFrListCornerTl, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrListCornerTr */ {KAknsIIDQsnFrListCornerTr, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrListCornerBl */ {KAknsIIDQsnFrListCornerBl, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrListCornerBr */ {KAknsIIDQsnFrListCornerBr, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrListSideT */ {KAknsIIDQsnFrListSideT, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrListSideB */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrListSideL */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrListSideR */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrListCenter */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_All, -1,-1},
-
- /* SP_QsnFrPopupCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrPopupCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrPopupCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrPopupCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrPopupSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrPopupSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrPopupSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrPopupSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrPopupCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_All, -1,-1},
-
- // ToolTip graphics different in 3.1 vs. 3.2+.
- /* SP_QsnFrPopupPreviewCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c5}, /* KAknsIIDQsnFrPopupPreviewCornerTl */
- /* SP_QsnFrPopupPreviewCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c6},
- /* SP_QsnFrPopupPreviewCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c3},
- /* SP_QsnFrPopupPreviewCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c4},
- /* SP_QsnFrPopupPreviewSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19ca},
- /* SP_QsnFrPopupPreviewSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c7},
- /* SP_QsnFrPopupPreviewSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c8},
- /* SP_QsnFrPopupPreviewSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c9},
- /* SP_QsnFrPopupPreviewCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c2},
-
- /* SP_QsnFrSetOptCornerTl */ {KAknsIIDQsnFrSetOptCornerTl, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrSetOptCornerTr */ {KAknsIIDQsnFrSetOptCornerTr, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrSetOptCornerBl */ {KAknsIIDQsnFrSetOptCornerBl, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrSetOptCornerBr */ {KAknsIIDQsnFrSetOptCornerBr, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrSetOptSideT */ {KAknsIIDQsnFrSetOptSideT, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrSetOptSideB */ {KAknsIIDQsnFrSetOptSideB, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrSetOptSideL */ {KAknsIIDQsnFrSetOptSideL, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrSetOptSideR */ {KAknsIIDQsnFrSetOptSideR, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrSetOptCenter */ {KAknsIIDQsnFrSetOptCenter, ENoDraw, ES60_All, -1,-1},
-
- // No toolbar frame for 5.0+ releases.
- /* SP_QsnFrPopupSubCornerTl */ {KAknsIIDQsnFrPopupSubCornerTl, ENoDraw, ES60_3_X, -1,-1},
- /* SP_QsnFrPopupSubCornerTr */ {KAknsIIDQsnFrPopupSubCornerTr, ENoDraw, ES60_3_X, -1,-1},
- /* SP_QsnFrPopupSubCornerBl */ {KAknsIIDQsnFrPopupSubCornerBl, ENoDraw, ES60_3_X, -1,-1},
- /* SP_QsnFrPopupSubCornerBr */ {KAknsIIDQsnFrPopupSubCornerBr, ENoDraw, ES60_3_X, -1,-1},
- /* SP_QsnFrPopupSubSideT */ {KAknsIIDQsnFrPopupSubSideT, ENoDraw, ES60_3_X, -1,-1},
- /* SP_QsnFrPopupSubSideB */ {KAknsIIDQsnFrPopupSubSideB, ENoDraw, ES60_3_X, -1,-1},
- /* SP_QsnFrPopupSubSideL */ {KAknsIIDQsnFrPopupSubSideL, ENoDraw, ES60_3_X, -1,-1},
- /* SP_QsnFrPopupSubSideR */ {KAknsIIDQsnFrPopupSubSideR, ENoDraw, ES60_3_X, -1,-1},
- /* SP_QsnFrPopupSubCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_3_X, -1,-1},
-
- // No inactive button graphics in 3.1/3.2
- /* SP_QsnFrButtonCornerTlInactive */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b1}, /*KAknsIIDQsnFrButtonCornerTlInactive*/
- /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b2},
- /* SP_QsnFrButtonCornerBlInactive */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b3},
- /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b4},
- /* SP_QsnFrButtonSideTInactive */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b5},
- /* SP_QsnFrButtonSideBInactive */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b6},
- /* SP_QsnFrButtonSideLInactive */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b7},
- /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b8},
- /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_X, EAknsMajorSkin, 0x21b9},
-
- // No pressed down grid in 3.1/3.2
- /* SP_QsnFrGridCornerTlPressed */ {KAknsIIDQsnFrGridCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2681}, /*KAknsIIDQsnFrGridCornerTlPressed*/
- /* SP_QsnFrGridCornerTrPressed */ {KAknsIIDQsnFrGridCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2682},
- /* SP_QsnFrGridCornerBlPressed */ {KAknsIIDQsnFrGridCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2683},
- /* SP_QsnFrGridCornerBrPressed */ {KAknsIIDQsnFrGridCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2684},
- /* SP_QsnFrGridSideTPressed */ {KAknsIIDQsnFrGridSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2685},
- /* SP_QsnFrGridSideBPressed */ {KAknsIIDQsnFrGridSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2686},
- /* SP_QsnFrGridSideLPressed */ {KAknsIIDQsnFrGridSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2687},
- /* SP_QsnFrGridSideRPressed */ {KAknsIIDQsnFrGridSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2688},
- /* SP_QsnFrGridCenterPressed */ {KAknsIIDQsnFrGridCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2689},
-
- // No pressed down list in 3.1/3.2
- /* SP_QsnFrListCornerTlPressed */ {KAknsIIDQsnFrListCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268b}, /*KAknsIIDQsnFrListCornerTlPressed*/
- /* SP_QsnFrListCornerTrPressed */ {KAknsIIDQsnFrListCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268c},
- /* SP_QsnFrListCornerBlPressed */ {KAknsIIDQsnFrListCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268d},
- /* SP_QsnFrListCornerBrPressed */ {KAknsIIDQsnFrListCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268e},
- /* SP_QsnFrListSideTPressed */ {KAknsIIDQsnFrListSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268f},
- /* SP_QsnFrListSideBPressed */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2690},
- /* SP_QsnFrListSideLPressed */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2691},
- /* SP_QsnFrListSideRPressed */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2692},
- /* SP_QsnFrListCenterPressed */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2693},
-};
-
-QPixmap QS60StyleModeSpecifics::skinnedGraphics(
- QS60StyleEnums::SkinParts stylepart, const QSize &size,
- QS60StylePrivate::SkinElementFlags flags)
-{
- QPixmap themedImage;
- TRAPD( error, QT_TRYCATCH_LEAVING({
- const QPixmap skinnedImage = createSkinnedGraphicsLX(stylepart, size, flags);
- themedImage = skinnedImage;
- }));
- if (error)
- return themedImage = QPixmap();
- return themedImage;
-}
-
-QPixmap QS60StyleModeSpecifics::skinnedGraphics(
- QS60StylePrivate::SkinFrameElements frame, const QSize &size, QS60StylePrivate::SkinElementFlags flags)
-{
- QPixmap themedImage;
- TRAPD( error, QT_TRYCATCH_LEAVING({
- const QPixmap skinnedImage = createSkinnedGraphicsLX(frame, size, flags);
- themedImage = skinnedImage;
- }));
- if (error)
- return themedImage = QPixmap();
- return themedImage;
-}
-
-QPixmap QS60StyleModeSpecifics::colorSkinnedGraphics(
- const QS60StyleEnums::SkinParts &stylepart, const QSize &size, QPainter *painter,
- QS60StylePrivate::SkinElementFlags flags)
-{
- QPixmap colorGraphics;
- TRAPD(error, QT_TRYCATCH_LEAVING(colorGraphics = colorSkinnedGraphicsLX(stylepart, size, painter, flags)));
- return error ? QPixmap() : colorGraphics;
-}
-
-void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &stylePart, TInt &fallbackIndex)
-{
- switch(stylePart) {
- case QS60StyleEnums::SP_QgnGrafBarWaitAnim:
- fallbackIndex = EMbmAvkonQgn_graf_bar_wait_1;
- break;
- case QS60StyleEnums::SP_QgnGrafBarFrameCenter:
- fallbackIndex = EMbmAvkonQgn_graf_bar_frame_center;
- break;
- case QS60StyleEnums::SP_QgnGrafBarFrameSideL:
- fallbackIndex = EMbmAvkonQgn_graf_bar_frame_side_l;
- break;
- case QS60StyleEnums::SP_QgnGrafBarFrameSideR:
- fallbackIndex = EMbmAvkonQgn_graf_bar_frame_side_r;
- break;
- case QS60StyleEnums::SP_QgnGrafBarProgress:
- fallbackIndex = EMbmAvkonQgn_graf_bar_progress;
- break;
- case QS60StyleEnums::SP_QgnGrafTabActiveL:
- fallbackIndex = EMbmAvkonQgn_graf_tab_active_l;
- break;
- case QS60StyleEnums::SP_QgnGrafTabActiveM:
- fallbackIndex = EMbmAvkonQgn_graf_tab_active_m;
- break;
- case QS60StyleEnums::SP_QgnGrafTabActiveR:
- fallbackIndex = EMbmAvkonQgn_graf_tab_active_r;
- break;
- case QS60StyleEnums::SP_QgnGrafTabPassiveL:
- fallbackIndex = EMbmAvkonQgn_graf_tab_passive_l;
- break;
- case QS60StyleEnums::SP_QgnGrafTabPassiveM:
- fallbackIndex = EMbmAvkonQgn_graf_tab_passive_m;
- break;
- case QS60StyleEnums::SP_QgnGrafTabPassiveR:
- fallbackIndex = EMbmAvkonQgn_graf_tab_passive_r;
- break;
- case QS60StyleEnums::SP_QgnIndiCheckboxOff:
- fallbackIndex = EMbmAvkonQgn_indi_checkbox_off;
- break;
- case QS60StyleEnums::SP_QgnIndiCheckboxOn:
- fallbackIndex = EMbmAvkonQgn_indi_checkbox_on;
- break;
- case QS60StyleEnums::SP_QgnIndiHlColSuper:
- fallbackIndex = 0x4456; /* EMbmAvkonQgn_indi_hl_col_super */
- break;
- case QS60StyleEnums::SP_QgnIndiHlExpSuper:
- fallbackIndex = 0x4458; /* EMbmAvkonQgn_indi_hl_exp_super */
- break;
- case QS60StyleEnums::SP_QgnIndiHlLineBranch:
- fallbackIndex = 0x445A; /* EMbmAvkonQgn_indi_hl_line_branch */
- break;
- case QS60StyleEnums::SP_QgnIndiHlLineEnd:
- fallbackIndex = 0x445C; /* EMbmAvkonQgn_indi_hl_line_end */
- break;
- case QS60StyleEnums::SP_QgnIndiHlLineStraight:
- fallbackIndex = 0x445E; /* EMbmAvkonQgn_indi_hl_line_straight */
- break;
- case QS60StyleEnums::SP_QgnIndiMarkedAdd:
- fallbackIndex = EMbmAvkonQgn_indi_marked_add;
- break;
- case QS60StyleEnums::SP_QgnIndiNaviArrowLeft:
- fallbackIndex = EMbmAvkonQgn_indi_navi_arrow_left;
- break;
- case QS60StyleEnums::SP_QgnIndiNaviArrowRight:
- fallbackIndex = EMbmAvkonQgn_indi_navi_arrow_right;
- break;
- case QS60StyleEnums::SP_QgnIndiRadiobuttOff:
- fallbackIndex = EMbmAvkonQgn_indi_radiobutt_off;
- break;
- case QS60StyleEnums::SP_QgnIndiRadiobuttOn:
- fallbackIndex = EMbmAvkonQgn_indi_radiobutt_on;
- break;
- case QS60StyleEnums::SP_QgnGrafNsliderMarker:
- fallbackIndex = 17572; /* EMbmAvkonQgn_graf_nslider_marker */
- break;
- case QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected:
- fallbackIndex = 17574; /* EMbmAvkonQgn_graf_nslider_marker_selected */
- break;
- case QS60StyleEnums::SP_QgnIndiSubmenu:
- fallbackIndex = EMbmAvkonQgn_indi_submenu;
- break;
- case QS60StyleEnums::SP_QgnNoteErased:
- fallbackIndex = EMbmAvkonQgn_note_erased;
- break;
- case QS60StyleEnums::SP_QgnNoteError:
- fallbackIndex = EMbmAvkonQgn_note_error;
- break;
- case QS60StyleEnums::SP_QgnNoteInfo:
- fallbackIndex = EMbmAvkonQgn_note_info;
- break;
- case QS60StyleEnums::SP_QgnNoteOk:
- fallbackIndex = EMbmAvkonQgn_note_ok;
- break;
- case QS60StyleEnums::SP_QgnNoteQuery:
- fallbackIndex = EMbmAvkonQgn_note_query;
- break;
- case QS60StyleEnums::SP_QgnNoteWarning:
- fallbackIndex = EMbmAvkonQgn_note_warning;
- break;
- case QS60StyleEnums::SP_QgnPropFileSmall:
- fallbackIndex = EMbmAvkonQgn_prop_file_small;
- break;
- case QS60StyleEnums::SP_QgnPropFolderCurrent:
- fallbackIndex = EMbmAvkonQgn_prop_folder_current;
- break;
- case QS60StyleEnums::SP_QgnPropFolderSmall:
- fallbackIndex = EMbmAvkonQgn_prop_folder_small;
- break;
- case QS60StyleEnums::SP_QgnPropFolderSmallNew:
- fallbackIndex = EMbmAvkonQgn_prop_folder_small_new;
- break;
- case QS60StyleEnums::SP_QgnPropPhoneMemcLarge:
- fallbackIndex = EMbmAvkonQgn_prop_phone_memc_large;
- break;
- default:
- fallbackIndex = -1;
- break;
- }
-}
-
-QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX(
- const QS60StyleEnums::SkinParts &stylepart,
- const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags)
-{
- // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts.
- const int stylepartIndex = (int)stylepart;
- const TAknsItemID skinId = m_partMap[stylepartIndex].skinID;
-
- TInt fallbackGraphicID = -1;
- HBufC* iconFile = HBufC::NewLC( KMaxFileName );
- fallbackInfo(stylepart, fallbackGraphicID);
-
- TAknsItemID colorGroup = KAknsIIDQsnIconColors;
- TRgb defaultColor = KRgbBlack;
- int colorIndex = -1; //set a bogus value to color index to ensure that painter color is used
- //to color the icon
- if (painter) {
- QRgb widgetColor = painter->pen().color().rgb();
- defaultColor = TRgb(qRed(widgetColor), qGreen(widgetColor), qBlue(widgetColor));
- }
-
- const bool rotatedBy90or270 =
- (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest));
- const TSize targetSize =
- rotatedBy90or270?TSize(size.height(), size.width()):TSize(size.width(), size.height());
- CFbsBitmap *icon = 0;
- CFbsBitmap *iconMask = 0;
- const TInt fallbackGraphicsMaskID =
- fallbackGraphicID == KErrNotFound?KErrNotFound:fallbackGraphicID+1; //masks are auto-generated as next in mif files
- MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
- AknsUtils::CreateColorIconLC(
- skinInstance,
- skinId,
- colorGroup,
- colorIndex,
- icon,
- iconMask,
- AknIconUtils::AvkonIconFileName(),
- fallbackGraphicID,
- fallbackGraphicsMaskID,
- defaultColor);
-
- QPixmap result = fromFbsBitmap(icon, iconMask, flags, targetSize);
- CleanupStack::PopAndDestroy(3); //icon, iconMask, iconFile
- return result;
-}
-
-QColor QS60StyleModeSpecifics::colorValue(const TAknsItemID &colorGroup, int colorIndex)
-{
- TRgb skinnedColor;
- MAknsSkinInstance* skin = AknsUtils::SkinInstance();
- AknsUtils::GetCachedColor(skin, skinnedColor, colorGroup, colorIndex);
- return QColor(skinnedColor.Red(),skinnedColor.Green(),skinnedColor.Blue());
-}
-
-struct QAutoFbsBitmapHeapLock
-{
- QAutoFbsBitmapHeapLock(CFbsBitmap* aBmp) : mBmp(aBmp) { mBmp->LockHeap(); }
- ~QAutoFbsBitmapHeapLock() { mBmp->UnlockHeap(); }
- CFbsBitmap* mBmp;
-};
-
-QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, const TSize &targetSize)
-{
- Q_ASSERT(icon);
-
- AknIconUtils::DisableCompression(icon);
- TInt error = AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved);
-
- if (mask && !error) {
- AknIconUtils::DisableCompression(mask);
- error = AknIconUtils::SetSize(mask, targetSize, EAspectRatioNotPreserved);
- }
- if (error)
- return QPixmap();
-
- QPixmap pixmap;
- QScopedPointer<QPlatformPixmap> pd(QPlatformPixmap::create(0, 0, QPlatformPixmap::PixmapType));
- if (mask) {
- // Try the efficient path with less copying and conversion.
- QVolatileImage img(icon, mask);
- pd->fromNativeType(&img, QPlatformPixmap::VolatileImage);
- if (!pd->isNull())
- pixmap = QPixmap(pd.take());
- }
- if (pixmap.isNull()) {
- // Potentially more expensive path.
- pd->fromNativeType(icon, QPlatformPixmap::FbsBitmap);
- pixmap = QPixmap(pd.take());
- if (mask) {
- pixmap.setAlphaChannel(QPixmap::fromSymbianCFbsBitmap(mask));
- }
- }
-
- if ((flags & QS60StylePrivate::SF_PointEast) ||
- (flags & QS60StylePrivate::SF_PointSouth) ||
- (flags & QS60StylePrivate::SF_PointWest)) {
- QImage iconImage = pixmap.toImage();
- QTransform imageTransform;
- if (flags & QS60StylePrivate::SF_PointEast) {
- imageTransform.rotate(90);
- } else if (flags & QS60StylePrivate::SF_PointSouth) {
- imageTransform.rotate(180);
- iconImage = iconImage.transformed(imageTransform);
- } else if (flags & QS60StylePrivate::SF_PointWest) {
- imageTransform.rotate(270);
- }
- if (imageTransform.isRotating())
- iconImage = iconImage.transformed(imageTransform);
-
- pixmap = QPixmap::fromImage(iconImage);
- }
- if ((flags & QS60StylePrivate::SF_Mirrored_X_Axis) ||
- (flags & QS60StylePrivate::SF_Mirrored_Y_Axis)) {
- QImage iconImage = pixmap.toImage().mirrored(
- flags & QS60StylePrivate::SF_Mirrored_X_Axis,
- flags & QS60StylePrivate::SF_Mirrored_Y_Axis);
- pixmap = QPixmap::fromImage(iconImage);
- }
-
- return pixmap;
-}
-
-bool QS60StylePrivate::isTouchSupported()
-{
- return bool(AknLayoutUtils::PenEnabled());
-}
-
-bool QS60StylePrivate::isToolBarBackground()
-{
- return (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2);
-}
-
-bool QS60StylePrivate::hasSliderGrooveGraphic()
-{
- return QSysInfo::s60Version() != QSysInfo::SV_S60_3_1;
-}
-
-bool QS60StylePrivate::isSingleClickUi()
-{
- return (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0);
-}
-
-void QS60StylePrivate::deleteStoredSettings()
-{
- QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
- settings.beginGroup(QLatin1String("QS60Style"));
- settings.remove(QString());
- settings.endGroup();
-}
-
-// Since S60Style has 'button' as a graphic, we don't have any native color which to use
-// for QPalette::Button. Therefore S60Style needs to guesstimate palette color by calculating
-// average rgb values for button pixels.
-// Returns Qt::black if there is an issue with the graphics (image is NULL, or no constBits() found).
-QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const
-{
-#ifndef QT_NO_SETTINGS
- TInt themeID = 0;
- //First we need to fetch active theme ID. We need to store the themeID at the same time
- //as color, so that we can later check if the stored color is still from the same theme.
- //Native side stores active theme UID/Timestamp into central repository.
- int error = 0;
- QT_TRAP_THROWING(
- CRepository *themeRepository = CRepository::NewLC(personalisationUID);
- if (themeRepository) {
- TBuf<32> value; //themeID is currently max of 8 + 1 + 8 characters, but lets have some extra space
- const TUint32 key = 0x00000002; //active theme key in the repository
- error = themeRepository->Get(key, value);
- if (error == KErrNone) {
- TLex lex(value);
- TPtrC numberToken(lex.NextToken());
- if (numberToken.Length())
- error = TLex(numberToken).Val(themeID);
- else
- error = KErrArgument;
- }
- }
- CleanupStack::PopAndDestroy(themeRepository);
- );
-
- QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
- settings.beginGroup(QLatin1String("QS60Style"));
- if (themeID != 0) {
- QVariant buttonColor = settings.value(QLatin1String("ButtonColor"));
- if (!buttonColor.isNull()) {
- //there is a stored color value, lets see if the theme ID matches
- if (error == KErrNone) {
- QVariant themeUID = settings.value(QLatin1String("ThemeUID"));
- if (!themeUID.isNull() && themeUID.toInt() == themeID) {
- QColor storedColor(buttonColor.value<QColor>());
- if (storedColor.isValid())
- return storedColor;
- }
- }
- settings.remove(QString()); //if color was invalid, or theme has been changed, just delete all stored settings
- }
- }
-#endif
-
- QColor color = calculatedColor(frame);
-
-#ifndef QT_NO_SETTINGS
- settings.setValue(QLatin1String("ThemeUID"), QVariant(themeID));
- if (frame == SF_ButtonNormal) //other colors are not currently calculated from graphics
- settings.setValue(QLatin1String("ButtonColor"), QVariant(color));
- settings.endGroup();
-#endif
-
- return color;
-}
-
-QPoint qt_s60_fill_background_offset(const QWidget *targetWidget)
-{
- CCoeControl *control = targetWidget->effectiveWinId();
- TPoint pos(0,0);
- if (control)
- pos = control->PositionRelativeToScreen();
- return QPoint(pos.iX, pos.iY);
-}
-
-QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(
- QS60StyleEnums::SkinParts part, const QSize &size,
- QS60StylePrivate::SkinElementFlags flags)
-{
- // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts.
- if (!size.isValid())
- return QPixmap();
-
- // Check release support and change part, if necessary.
- const TAknsItemID skinId = partSpecificThemeId((int)part);
- const int stylepartIndex = (int)part;
- const TDrawType drawType = m_partMap[stylepartIndex].drawType;
- Q_ASSERT(drawType != ENoDraw);
- const bool rotatedBy90or270 =
- (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest));
- const TSize targetSize =
- rotatedBy90or270 ? TSize(size.height(), size.width()) : qt_QSize2TSize(size);
-
- MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
- static const TDisplayMode displayMode = S60->supportsPremultipliedAlpha ? Q_SYMBIAN_ECOLOR16MAP : EColor16MA;
- static const TInt drawParam = S60->supportsPremultipliedAlpha ? KAknsDrawParamDefault : KAknsDrawParamRGBOnly;
-
- QPixmap result;
-
- switch (drawType) {
- case EDrawGulIcon: {
- CGulIcon* icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), skinId, EFalse );
- if (icon)
- result = fromFbsBitmap(icon->Bitmap(), icon->Mask(), flags, targetSize);
- delete icon;
- break;
- }
- case EDrawIcon: {
- TInt fallbackGraphicID = -1;
- fallbackInfo(part, fallbackGraphicID);
-
- CFbsBitmap *icon = 0;
- CFbsBitmap *iconMask = 0;
- const TInt fallbackGraphicsMaskID =
- fallbackGraphicID == KErrNotFound?KErrNotFound:fallbackGraphicID+1; //masks are auto-generated as next in mif files
-
- AknsUtils::CreateIconL(
- skinInstance,
- skinId,
- icon,
- iconMask,
- AknIconUtils::AvkonIconFileName(),
- fallbackGraphicID ,
- fallbackGraphicsMaskID);
-
- result = fromFbsBitmap(icon, iconMask, flags, targetSize);
- delete icon;
- delete iconMask;
- break;
- }
- case EDrawBackground: {
- // QS60WindowSurface::unlockBitmapHeap();
- CFbsBitmap *background = new (ELeave) CFbsBitmap(); //offscreen
- CleanupStack::PushL(background);
- User::LeaveIfError(background->Create(targetSize, displayMode));
-
- CFbsBitmapDevice *dev = CFbsBitmapDevice::NewL(background);
- CleanupStack::PushL(dev);
- CFbsBitGc *gc = NULL;
- User::LeaveIfError(dev->CreateContext(gc));
- CleanupStack::PushL(gc);
-
- CAknsBasicBackgroundControlContext *bgContext = CAknsBasicBackgroundControlContext::NewL(
- skinId,
- targetSize,
- EFalse);
- CleanupStack::PushL(bgContext);
-
- const TBool drawn = AknsDrawUtils::DrawBackground(
- skinInstance,
- bgContext,
- NULL,
- *gc,
- TPoint(),
- targetSize,
- drawParam);
-
- if (drawn)
- result = fromFbsBitmap(background, NULL, flags, targetSize);
- // if drawing fails in skin server, just ignore the background (probably OOM case)
-
- CleanupStack::PopAndDestroy(4, background); //background, dev, gc, bgContext
- // QS60WindowSurface::lockBitmapHeap();
- break;
- }
- case EDrawAnimation: {
- CFbsBitmap* animationFrame;
- CFbsBitmap* frameMask;
- CAknBitmapAnimation* aknAnimation = 0;
- TBool constructedFromTheme = ETrue;
-
- QS60StyleAnimation* animation = QS60StylePrivate::animationDefinition(part); //ownership is not passed
- if (animation) {
- if (!animation->animationObject() && !animation->isResourceBased()) {// no pre-made item exists, create new animation
- CAknBitmapAnimation* newAnimation = CAknBitmapAnimation::NewL();
- CleanupStack::PushL(newAnimation);
- if (newAnimation)
- constructedFromTheme = newAnimation->ConstructFromSkinL(skinId);
- if (constructedFromTheme && newAnimation->BitmapAnimData()->FrameArray().Count() > 0) {
- animation->setResourceBased(false);
- animation->setAnimationObject(newAnimation); //animation takes ownership
- }
- CleanupStack::Pop(newAnimation);
- }
- //fill-in stored information
- aknAnimation = animation->animationObject();
- constructedFromTheme = !animation->isResourceBased();
- }
-
- const int currentFrame = QS60StylePrivate::currentAnimationFrame(part);
- if (constructedFromTheme && aknAnimation && aknAnimation->BitmapAnimData()->FrameArray().Count() > 0) {
- //Animation was created successfully and contains frames, just fetch current frame
- if(currentFrame >= aknAnimation->BitmapAnimData()->FrameArray().Count())
- User::Leave(KErrOverflow);
- const CBitmapFrameData* frameData = aknAnimation->BitmapAnimData()->FrameArray().At(currentFrame);
- if (frameData) {
- animationFrame = frameData->Bitmap();
- frameMask = frameData->Mask();
- }
- } else {
- //Theme does not contain animation theming, create frames from resource file
- TInt fallbackGraphicID = -1;
- fallbackInfo(part, fallbackGraphicID);
- fallbackGraphicID = fallbackGraphicID + (currentFrame * 2); //skip masks
- TInt fallbackGraphicsMaskID =
- (fallbackGraphicID == KErrNotFound) ? KErrNotFound : fallbackGraphicID + 1; //masks are auto-generated as next in mif files
- if (fallbackGraphicsMaskID != KErrNotFound)
- fallbackGraphicsMaskID = fallbackGraphicsMaskID + (currentFrame * 2); //skip actual graphics
-
- //Then draw animation frame
- AknsUtils::CreateIconL(
- skinInstance,
- KAknsIIDDefault, //animation is not themed, lets force fallback graphics
- animationFrame,
- frameMask,
- AknIconUtils::AvkonIconFileName(),
- fallbackGraphicID ,
- fallbackGraphicsMaskID);
- }
- result = fromFbsBitmap(animationFrame, frameMask, flags, targetSize);
- if (!constructedFromTheme) {
- delete animationFrame;
- animationFrame = 0;
- delete frameMask;
- frameMask = 0;
- }
- break;
- }
- }
- if (!result)
- result = QPixmap();
-
- return result;
-}
-
-QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFrameElements frameElement,
- const QSize &size, QS60StylePrivate::SkinElementFlags flags)
-{
- // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts.
- if (!size.isValid())
- return QPixmap();
-
- const bool rotatedBy90or270 =
- (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest));
- const TSize targetSize =
- rotatedBy90or270 ? TSize(size.height(), size.width()) : qt_QSize2TSize(size);
-
- MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
- QPixmap result;
-
- static const TDisplayMode displayMode = S60->supportsPremultipliedAlpha ? Q_SYMBIAN_ECOLOR16MAP : EColor16MA;
- static const TInt drawParam = S60->supportsPremultipliedAlpha ? KAknsDrawParamDefault : KAknsDrawParamNoClearUnderImage|KAknsDrawParamRGBOnly;
-
- CFbsBitmap *frame = new (ELeave) CFbsBitmap(); //offscreen
- CleanupStack::PushL(frame);
- User::LeaveIfError(frame->Create(targetSize, displayMode));
-
- CFbsBitmapDevice* bitmapDev = CFbsBitmapDevice::NewL(frame);
- CleanupStack::PushL(bitmapDev);
- CFbsBitGc* bitmapGc = NULL;
- User::LeaveIfError(bitmapDev->CreateContext(bitmapGc));
- CleanupStack::PushL(bitmapGc);
-
- frame->LockHeap();
- memset(frame->DataAddress(), 0, frame->SizeInPixels().iWidth * frame->SizeInPixels().iHeight * 4); // 4: argb bytes
- frame->UnlockHeap();
-
- const TRect outerRect(TPoint(0, 0), targetSize);
- const TRect innerRect = innerRectFromElement(frameElement, outerRect);
-
- TAknsItemID frameSkinID, centerSkinID;
- frameSkinID = centerSkinID = partSpecificThemeId(QS60StylePrivate::m_frameElementsData[frameElement].center);
- frameIdAndCenterId(frameElement, frameSkinID, centerSkinID);
-
- TBool drawn = AknsDrawUtils::DrawFrame(
- skinInstance,
- *bitmapGc,
- outerRect,
- innerRect,
- frameSkinID,
- centerSkinID,
- drawParam );
-
- if (S60->supportsPremultipliedAlpha) {
- if (drawn) {
- result = fromFbsBitmap(frame, NULL, flags, targetSize);
- } else {
- // Drawing might fail due to OOM (we can do nothing about that),
- // or due to skin item not being available.
- // If the latter occurs, lets try switch to non-release specific items (if available)
- // and re-try the drawing.
- frameSkinID = centerSkinID = m_partMap[(int)QS60StylePrivate::m_frameElementsData[frameElement].center].skinID;
- frameIdAndCenterId(frameElement, frameSkinID, centerSkinID);
- drawn = AknsDrawUtils::DrawFrame( skinInstance,
- *bitmapGc, outerRect, innerRect,
- frameSkinID, centerSkinID,
- drawParam );
- // in case drawing fails, even after using default graphics, ignore the error
- if (drawn)
- result = fromFbsBitmap(frame, NULL, flags, targetSize);
- }
- } else {
- TDisplayMode maskDepth = EGray256;
- // Query the skin item for possible frame graphics mask details.
- if (skinInstance) {
- CAknsMaskedBitmapItemData* skinMaskedBmp = static_cast<CAknsMaskedBitmapItemData*>(
- skinInstance->GetCachedItemData(frameSkinID,EAknsITMaskedBitmap));
- if (skinMaskedBmp && skinMaskedBmp->Mask())
- maskDepth = skinMaskedBmp->Mask()->DisplayMode();
- }
- if (maskDepth != ENone) {
- CFbsBitmap *frameMask = new (ELeave) CFbsBitmap(); //offscreen
- CleanupStack::PushL(frameMask);
- User::LeaveIfError(frameMask->Create(targetSize, maskDepth));
-
- CFbsBitmapDevice* maskBitmapDevice = CFbsBitmapDevice::NewL(frameMask);
- CleanupStack::PushL(maskBitmapDevice);
- CFbsBitGc* maskBitGc = NULL;
- User::LeaveIfError(maskBitmapDevice->CreateContext(maskBitGc));
- CleanupStack::PushL(maskBitGc);
-
- if (drawn) {
- //ensure that the mask is really transparent
- maskBitGc->Activate( maskBitmapDevice );
- maskBitGc->SetPenStyle(CGraphicsContext::ENullPen);
- maskBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
- maskBitGc->SetBrushColor(KRgbWhite);
- maskBitGc->Clear();
- maskBitGc->SetBrushStyle(CGraphicsContext::ENullBrush);
-
- drawn = AknsDrawUtils::DrawFrame(skinInstance,
- *maskBitGc, outerRect, innerRect,
- frameSkinID, centerSkinID,
- KAknsSDMAlphaOnly |KAknsDrawParamNoClearUnderImage);
- if (drawn)
- result = fromFbsBitmap(frame, frameMask, flags, targetSize);
- }
- CleanupStack::PopAndDestroy(3, frameMask);
- }
- }
- CleanupStack::PopAndDestroy(3, frame); //frame, bitmapDev, bitmapGc
- return result;
-}
-
-void QS60StyleModeSpecifics::frameIdAndCenterId(QS60StylePrivate::SkinFrameElements frameElement, TAknsItemID &frameId, TAknsItemID &centerId)
-{
-// There are some major mix-ups in skin declarations for some frames.
-// First, the frames are not declared in sequence.
-// Second, the parts use different major than the frame-master.
-
- switch(frameElement) {
- case QS60StylePrivate::SF_ToolTip:
- if (QSysInfo::s60Version() != QSysInfo::SV_S60_3_1) {
- centerId.Set(EAknsMajorGeneric, 0x19c2);
- frameId.Set(EAknsMajorSkin, 0x5300);
- } else {
- centerId.Set(KAknsIIDQsnFrPopupCenter);
- frameId.iMinor = centerId.iMinor - 9;
- }
- break;
- case QS60StylePrivate::SF_ToolBar:
- if (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 ||
- QSysInfo::s60Version() == QSysInfo::SV_S60_3_2) {
- centerId.Set(KAknsIIDQsnFrPopupCenterSubmenu);
- frameId.Set(KAknsIIDQsnFrPopupSub);
- }
- break;
- case QS60StylePrivate::SF_PopupBackground:
- centerId.Set(KAknsIIDQsnFrPopupCenterSubmenu);
- frameId.Set(KAknsIIDQsnFrPopupSub);
- break;
- case QS60StylePrivate::SF_PanelBackground:
- // remove center piece for panel graphics, so that only border is drawn
- centerId.Set(KAknsIIDNone);
- frameId.Set(KAknsIIDQsnFrSetOpt);
- break;
- default:
- // center should be correct here
- frameId.iMinor = centerId.iMinor - 9;
- break;
- }
-}
-
-TRect QS60StyleModeSpecifics::innerRectFromElement(QS60StylePrivate::SkinFrameElements frameElement, const TRect &outerRect)
-{
- TInt widthShrink = QS60StylePrivate::pixelMetric(PM_FrameCornerWidth);
- TInt heightShrink = QS60StylePrivate::pixelMetric(PM_FrameCornerHeight);
- switch(frameElement) {
- case QS60StylePrivate::SF_PanelBackground:
- // panel should have slightly slimmer border to enable thin line of background graphics between closest component
- widthShrink = widthShrink - 2;
- heightShrink = heightShrink - 2;
- break;
- case QS60StylePrivate::SF_ToolTip:
- widthShrink = widthShrink >> 1;
- heightShrink = heightShrink >> 1;
- break;
- case QS60StylePrivate::SF_ListHighlight:
- //In Sym^3 devices highlights are less blocky
- if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) {
- widthShrink += 2;
- heightShrink += 2;
- } else {
- widthShrink -= 2;
- heightShrink -= 2;
- }
- break;
- case QS60StylePrivate::SF_PopupBackground:
- widthShrink = widthShrink + 5;
- heightShrink = heightShrink + 5;
- break;
- default:
- break;
- }
- TRect innerRect(outerRect);
- innerRect.Shrink(widthShrink, heightShrink);
- return innerRect;
-}
-
-bool QS60StyleModeSpecifics::checkSupport(const int supportedRelease)
-{
- const QSysInfo::S60Version currentRelease = QSysInfo::s60Version();
- return ( (currentRelease == QSysInfo::SV_S60_3_1 && supportedRelease & ES60_3_1) ||
- (currentRelease == QSysInfo::SV_S60_3_2 && supportedRelease & ES60_3_2) ||
- (currentRelease == QSysInfo::SV_S60_5_0 && supportedRelease & ES60_5_0) ||
- (currentRelease == QSysInfo::SV_S60_5_1 && supportedRelease & ES60_5_1) ||
- (currentRelease == QSysInfo::SV_S60_5_2 && supportedRelease & ES60_5_2) ||
- (currentRelease == QSysInfo::SV_S60_5_3 && supportedRelease & ES60_5_3) );
-}
-
-TAknsItemID QS60StyleModeSpecifics::partSpecificThemeId(int part)
-{
- TAknsItemID newSkinId;
- if (!checkSupport(m_partMap[(int)part].supportInfo))
- newSkinId.Set(m_partMap[(int)part].newMajorSkinId, m_partMap[(int)part].newMinorSkinId);
- else
- newSkinId.Set(m_partMap[(int)part].skinID);
- return newSkinId;
-}
-
-QFont QS60StylePrivate::s60Font_specific(
- QS60StyleEnums::FontCategories fontCategory,
- int pointSize, bool resolveFontSize)
-{
- Q_UNUSED(resolveFontSize);
-
- TAknFontCategory aknFontCategory = EAknFontCategoryUndefined;
- switch (fontCategory) {
- case QS60StyleEnums::FC_Primary:
- aknFontCategory = EAknFontCategoryPrimary;
- break;
- case QS60StyleEnums::FC_Secondary:
- aknFontCategory = EAknFontCategorySecondary;
- break;
- case QS60StyleEnums::FC_Title:
- aknFontCategory = EAknFontCategoryTitle;
- break;
- case QS60StyleEnums::FC_PrimarySmall:
- aknFontCategory = EAknFontCategoryPrimarySmall;
- break;
- case QS60StyleEnums::FC_Digital:
- aknFontCategory = EAknFontCategoryDigital;
- break;
- case QS60StyleEnums::FC_Undefined:
- default:
- break;
- }
-
- // Create AVKON font according the given parameters
- CWsScreenDevice* dev = CCoeEnv::Static()->ScreenDevice();
- TAknFontSpecification spec(aknFontCategory, TFontSpec(), NULL);
- if (pointSize > 0) {
- const TInt pixelSize = dev->VerticalTwipsToPixels(pointSize * KTwipsPerPoint);
- spec.SetTextPaneHeight(pixelSize + 4); // TODO: Is 4 a reasonable top+bottom margin?
- }
-
- QFont result;
- TRAPD( error, QT_TRYCATCH_LEAVING({
- const CAknLayoutFont* aknFont =
- AknFontAccess::CreateLayoutFontFromSpecificationL(*dev, spec);
-
- result = qt_TFontSpec2QFontL(aknFont->DoFontSpecInTwips());
- if (result.pointSize() != pointSize)
- result.setPointSize(pointSize); // Correct the font size returned by CreateLayoutFontFromSpecificationL()
-
- delete aknFont;
- }));
- if (error) result = QFont();
- return result;
-}
-
-void QS60StylePrivate::setActiveLayout()
-{
- const QSize activeScreenSize(screenSize());
- int activeLayoutIndex = -1;
- const short screenHeight = (short)activeScreenSize.height();
- const short screenWidth = (short)activeScreenSize.width();
- for (int i=0; i<m_numberOfLayouts; i++) {
- if (screenHeight==m_layoutHeaders[i].height &&
- screenWidth==m_layoutHeaders[i].width) {
- activeLayoutIndex = i;
- break;
- }
- }
-
- //not found, lets try with either of dimensions
- if (activeLayoutIndex==-1){
- const QSysInfo::S60Version currentRelease = QSysInfo::s60Version();
- const bool landscape = screenHeight < screenWidth;
-
- activeLayoutIndex = (currentRelease == QSysInfo::SV_S60_3_1 || currentRelease == QSysInfo::SV_S60_3_2) ? 0 : 2;
- activeLayoutIndex += (!landscape) ? 1 : 0;
- }
-
- setCurrentLayout(activeLayoutIndex);
-}
-
-Q_GLOBAL_STATIC(QList<QS60StyleAnimation *>, m_animations)
-
-QS60StylePrivate::QS60StylePrivate()
-{
- //Animation defaults need to be created when style is instantiated
- QS60StyleAnimation* progressBarAnimation = new QS60StyleAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim, 7, 100);
- m_animations()->append(progressBarAnimation);
- // No need to set active layout, if dynamic metrics API is available
- setActiveLayout();
-}
-
-void QS60StylePrivate::removeAnimations()
-{
- //currently only one animation in the list.
- m_animations()->removeFirst();
-}
-
-QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list,
- int index, const QStyleOption *option)
-{
- static const TAknsItemID *idMap[] = {
- &KAknsIIDQsnHighlightColors,
- &KAknsIIDQsnIconColors,
- &KAknsIIDQsnLineColors,
- &KAknsIIDQsnOtherColors,
- &KAknsIIDQsnParentColors,
- &KAknsIIDQsnTextColors
- };
- Q_ASSERT((int)list < (int)sizeof(idMap)/sizeof(idMap[0]));
- const QColor color = QS60StyleModeSpecifics::colorValue(*idMap[(int) list], index - 1);
- return option ? QS60StylePrivate::stateColor(color, option) : color;
-}
-
-// In some cases, the AVKON UI themegraphic is already in 'disabled state'.
-// If so, return true for these parts.
-bool QS60StyleModeSpecifics::disabledPartGraphic(QS60StyleEnums::SkinParts &part)
-{
- bool disabledGraphic = false;
- switch(part){
- // inactive button graphics are available from 5.0 onwards
- case QS60StyleEnums::SP_QsnFrButtonCornerTlInactive:
- case QS60StyleEnums::SP_QsnFrButtonCornerTrInactive:
- case QS60StyleEnums::SP_QsnFrButtonCornerBlInactive:
- case QS60StyleEnums::SP_QsnFrButtonCornerBrInactive:
- case QS60StyleEnums::SP_QsnFrButtonSideTInactive:
- case QS60StyleEnums::SP_QsnFrButtonSideBInactive:
- case QS60StyleEnums::SP_QsnFrButtonSideLInactive:
- case QS60StyleEnums::SP_QsnFrButtonSideRInactive:
- case QS60StyleEnums::SP_QsnFrButtonCenterInactive:
- if (!(QSysInfo::s60Version()==QSysInfo::SV_S60_3_1 ||
- QSysInfo::s60Version()==QSysInfo::SV_S60_3_2))
- disabledGraphic = true;
- break;
- default:
- break;
- }
- return disabledGraphic;
-}
-
-// In some cases, the AVKON UI themegraphic is already in 'disabled state'.
-// If so, return true for these frames.
-bool QS60StyleModeSpecifics::disabledFrameGraphic(QS60StylePrivate::SkinFrameElements &frame)
-{
- bool disabledGraphic = false;
- switch(frame){
- // inactive button graphics are available from 5.0 onwards
- case QS60StylePrivate::SF_ButtonInactive:
- if (!(QSysInfo::s60Version()==QSysInfo::SV_S60_3_1 ||
- QSysInfo::s60Version()==QSysInfo::SV_S60_3_2))
- disabledGraphic = true;
- break;
- default:
- break;
- }
- return disabledGraphic;
-}
-
-QPixmap QS60StyleModeSpecifics::generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part,
- const QSize &size, QS60StylePrivate::SkinElementFlags flags)
-{
- if (!QS60StylePrivate::isTouchSupported())
- return QPixmap();
-
- QS60StyleEnums::SkinParts updatedPart = part;
- switch(part){
- // AVKON UI has a abnormal handling for scrollbar graphics. It is possible that the root
- // skin does not contain mandatory graphics for scrollbar pressed states. Therefore, AVKON UI
- // creates dynamically these graphics by modifying the normal state scrollbar graphics slightly.
- // S60Style needs to work similarly. Therefore if skingraphics call provides to be a miss
- // (i.e. result is not valid), style needs to draw normal graphics instead and apply some
- // modifications (similar to generatedIconPixmap()) to the result.
- case QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed:
- updatedPart = QS60StyleEnums::SP_QsnCpScrollHandleBottom;
- break;
- case QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed:
- updatedPart = QS60StyleEnums::SP_QsnCpScrollHandleMiddle;
- break;
- case QS60StyleEnums::SP_QsnCpScrollHandleTopPressed:
- updatedPart = QS60StyleEnums::SP_QsnCpScrollHandleTop;
- break;
- default:
- break;
- }
- if (part==updatedPart) {
- return QPixmap();
- } else {
- QPixmap result = skinnedGraphics(updatedPart, size, flags);
- QStyleOption opt;
- QPalette *themePalette = QS60StylePrivate::themePalette();
- if (themePalette)
- opt.palette = *themePalette;
-
- // For now, always generate new icon based on "selected". In the future possibly, expand
- // this to consist other possibilities as well.
- result = QApplication::style()->generatedIconPixmap(QIcon::Selected, result, &opt);
- return result;
- }
-}
-
-QPixmap QS60StylePrivate::part(QS60StyleEnums::SkinParts part,
- const QSize &size, QPainter *painter, SkinElementFlags flags)
-{
- QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
-
- QPixmap result = (flags & SF_ColorSkinned)?
- QS60StyleModeSpecifics::colorSkinnedGraphics(part, size, painter, flags)
- : QS60StyleModeSpecifics::skinnedGraphics(part, size, flags);
-
- lock.relock();
-
- if (flags & SF_StateDisabled && !QS60StyleModeSpecifics::disabledPartGraphic(part)) {
- QStyleOption opt;
- QPalette *themePalette = QS60StylePrivate::themePalette();
- if (themePalette)
- opt.palette = *themePalette;
- result = QApplication::style()->generatedIconPixmap(QIcon::Disabled, result, &opt);
- }
-
- if (!result)
- result = QS60StyleModeSpecifics::generateMissingThemeGraphic(part, size, flags);
-
- return result;
-}
-
-QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size, SkinElementFlags flags)
-{
- QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
- QPixmap result = QS60StyleModeSpecifics::skinnedGraphics(frame, size, flags);
- lock.relock();
-
- if (flags & SF_StateDisabled && !QS60StyleModeSpecifics::disabledFrameGraphic(frame)) {
- QStyleOption opt;
- QPalette *themePalette = QS60StylePrivate::themePalette();
- if (themePalette)
- opt.palette = *themePalette;
- result = QApplication::style()->generatedIconPixmap(QIcon::Disabled, result, &opt);
- }
- return result;
-}
-
-QPixmap QS60StylePrivate::backgroundTexture(bool skipCreation)
-{
- bool createNewBackground = false;
- TRect applicationRect = (static_cast<CEikAppUi*>(S60->appUi())->ApplicationRect());
- if (!m_background) {
- createNewBackground = true;
- } else {
- //if background brush does not match screensize, re-create it
- if (m_background->width() != applicationRect.Width() ||
- m_background->height() != applicationRect.Height()) {
- delete m_background;
- m_background = 0;
- createNewBackground = true;
- }
- }
-
- if (createNewBackground && !skipCreation) {
- QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen,
- QSize(applicationRect.Width(), applicationRect.Height()), 0, SkinElementFlags());
- m_background = new QPixmap(background);
-
- // Notify all widgets that palette is updated with the actual background texture.
- QPalette pal = QApplication::palette();
- pal.setBrush(QPalette::Window, *m_background);
- QApplication::setPalette(pal);
- setThemePaletteHash(&pal);
- storeThemePalette(&pal);
- foreach (QWidget *widget, QApplication::allWidgets()){
- QEvent e(QEvent::PaletteChange);
- QApplication::sendEvent(widget, &e);
- setThemePalette(widget);
- widget->ensurePolished();
- }
- }
- if (!m_background)
- return QPixmap();
- return *m_background;
-}
-
-QSize QS60StylePrivate::screenSize()
-{
- return QSize(S60->screenWidthInPixels, S60->screenHeightInPixels);
-}
-
-QS60Style::QS60Style()
- : QCommonStyle(*new QS60StylePrivate)
-{
-}
-
-#ifdef Q_WS_S60
-void QS60StylePrivate::handleDynamicLayoutVariantSwitch()
-{
- clearCaches(QS60StylePrivate::CC_LayoutChange);
- setBackgroundTexture(qApp);
- setActiveLayout();
- foreach (QWidget *widget, QApplication::allWidgets())
- widget->ensurePolished();
-}
-
-void QS60StylePrivate::handleSkinChange()
-{
- clearCaches(QS60StylePrivate::CC_ThemeChange);
- setThemePalette(qApp);
- foreach (QWidget *topLevelWidget, QApplication::allWidgets()){
- QEvent e(QEvent::StyleChange);
- QApplication::sendEvent(topLevelWidget, &e);
- setThemePalette(topLevelWidget);
- topLevelWidget->ensurePolished();
- }
-#ifndef QT_NO_PROGRESSBAR
- //re-start animation timer
- stopAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim); //todo: once we have more animations, we could say "stop all running ones"
- startAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim); //and "re-start all previously running ones"
-#endif
-}
-
-int QS60StylePrivate::currentAnimationFrame(QS60StyleEnums::SkinParts part)
-{
- QS60StyleAnimation *animation = animationDefinition(part);
- // todo: looping could be done in QS60Style::timerEvent
- if (animation->frameCount() == animation->currentFrame())
- animation->setCurrentFrame(0);
- return animation->currentFrame();
-}
-
-QS60StyleAnimation* QS60StylePrivate::animationDefinition(QS60StyleEnums::SkinParts part)
-{
- int i = 0;
- const int animationsCount = m_animations()->isEmpty() ? 0 : m_animations()->count();
- for(; i < animationsCount; i++) {
- if (part == m_animations()->at(i)->animationId())
- break;
- }
- return m_animations()->at(i);
-}
-
-void QS60StylePrivate::startAnimation(QS60StyleEnums::SkinParts animationPart)
-{
- Q_Q(QS60Style);
-
- //Query animation data from theme and store values to local struct.
- QVariant themeAnimationDataVariant = QS60StyleModeSpecifics::themeDefinition(
- QS60StyleEnums::TD_AnimationData, animationPart);
- QList<QVariant> themeAnimationData = themeAnimationDataVariant.toList();
-
- QS60StyleAnimation *animation = QS60StylePrivate::animationDefinition(animationPart);
- if (animation) {
- if (themeAnimationData.at(QS60StyleEnums::AD_Interval).toInt() != 0)
- animation->setInterval(themeAnimationData.at(QS60StyleEnums::AD_Interval).toInt());
-
- if (themeAnimationData.at(QS60StyleEnums::AD_NumberOfFrames).toInt() != 0)
- animation->setFrameCount(themeAnimationData.at(QS60StyleEnums::AD_NumberOfFrames).toInt());
-
- //todo: playmode is ignored for now, since it seems to return invalid data on some themes
- //lets use the table values for play mode
-
- animation->setCurrentFrame(0); //always initialize
- const int timerId = q->startTimer(animation->interval());
- animation->setTimerId(timerId);
- }
-}
-
-void QS60StylePrivate::stopAnimation(QS60StyleEnums::SkinParts animationPart)
-{
- Q_Q(QS60Style);
-
- QS60StyleAnimation *animation = QS60StylePrivate::animationDefinition(animationPart);
- if (animation) {
- animation->setCurrentFrame(0);
- if (animation->timerId() != 0) {
- q->killTimer(animation->timerId());
- animation->setTimerId(0);
- }
- animation->resetToDefaults();
- }
-}
-
-QVariant QS60StyleModeSpecifics::themeDefinition(
- QS60StyleEnums::ThemeDefinitions definition, QS60StyleEnums::SkinParts part)
-{
- MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
-
- Q_ASSERT(skinInstance);
-
- switch(definition) {
- //Animation definitions
- case QS60StyleEnums::TD_AnimationData:
- {
- CAknsBmpAnimItemData *animationData;
- TAknsItemID animationSkinId = partSpecificThemeId(part);
- QList<QVariant> list;
-
- TRAPD( error, QT_TRYCATCH_LEAVING(
- animationData = static_cast<CAknsBmpAnimItemData*>(skinInstance->CreateUncachedItemDataL(
- animationSkinId, EAknsITBmpAnim))));
- if (error)
- return list;
-
- if (animationData) {
- list.append((int)animationData->FrameInterval());
- list.append((int)animationData->NumberOfImages());
-
- QS60StyleEnums::AnimationMode playMode;
- switch(animationData->PlayMode()) {
- case CBitmapAnimClientData::EPlay:
- playMode = QS60StyleEnums::AM_PlayOnce;
- break;
- case CBitmapAnimClientData::ECycle:
- playMode = QS60StyleEnums::AM_Looping;
- break;
- case CBitmapAnimClientData::EBounce:
- playMode = QS60StyleEnums::AM_Bounce;
- break;
- default:
- break;
- }
- list.append(QVariant((int)playMode));
- delete animationData;
- } else {
- list.append(0);
- list.append(0);
- }
- return list;
- }
- break;
- default:
- break;
- }
- return QVariant();
-}
-
-#endif // Q_WS_S60
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_STYLE_S60 || QT_PLUGIN
diff --git a/src/widgets/styles/qs60style_simulated.cpp b/src/widgets/styles/qs60style_simulated.cpp
deleted file mode 100644
index ca02cdf5e1..0000000000
--- a/src/widgets/styles/qs60style_simulated.cpp
+++ /dev/null
@@ -1,457 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qs60style.h"
-#include "qs60style_p.h"
-#include "qfile.h"
-#include "qhash.h"
-#include "qapplication.h"
-#include "qpainter.h"
-#include "qpicture.h"
-#include "qstyleoption.h"
-#include "qtransform.h"
-#include "qlayout.h"
-#include "qpixmapcache.h"
-#include "qmetaobject.h"
-#include "qdebug.h"
-#include "qbuffer.h"
-#include "qdesktopwidget.h"
-
-#if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN)
-
-QT_BEGIN_NAMESPACE
-
-static const quint32 blobVersion = 1;
-static const int pictureSize = 256;
-
-#if defined(Q_CC_GNU)
-#if __GNUC__ >= 2
-#define __FUNCTION__ __func__
-#endif
-#endif
-
-
-bool saveThemeToBlob(const QString &themeBlob,
- const QHash<QString, QPicture> &partPictures,
- const QHash<QPair<QString, int>, QColor> &colors)
-{
- QFile blob(themeBlob);
- if (!blob.open(QIODevice::WriteOnly)) {
- qWarning() << __FUNCTION__ << ": Could not create blob: " << themeBlob;
- return false;
- }
-
- QByteArray data;
- QBuffer dataBuffer(&data);
- dataBuffer.open(QIODevice::WriteOnly);
- QDataStream dataOut(&dataBuffer);
-
- const int colorsCount = colors.count();
- dataOut << colorsCount;
- const QList<QPair<QString, int> > colorKeys = colors.keys();
- for (int i = 0; i < colorsCount; ++i) {
- const QPair<QString, int> &key = colorKeys.at(i);
- dataOut << key;
- const QColor color = colors.value(key);
- dataOut << color;
- }
-
- dataOut << partPictures.count();
- QHashIterator<QString, QPicture> i(partPictures);
- while (i.hasNext()) {
- i.next();
- dataOut << i.key();
- dataOut << i.value(); // the QPicture
- }
-
- QDataStream blobOut(&blob);
- blobOut << blobVersion;
- blobOut << qCompress(data);
- return blobOut.status() == QDataStream::Ok;
-}
-
-bool loadThemeFromBlob(const QString &themeBlob,
- QHash<QString, QPicture> &partPictures,
- QHash<QPair<QString, int>, QColor> &colors)
-{
- QFile blob(themeBlob);
- if (!blob.open(QIODevice::ReadOnly)) {
- qWarning() << __FUNCTION__ << ": Could not read blob: " << themeBlob;
- return false;
- }
- QDataStream blobIn(&blob);
-
- quint32 version;
- blobIn >> version;
-
- if (version != blobVersion) {
- qWarning() << __FUNCTION__ << ": Invalid blob version: " << version << " ...expected: " << blobVersion;
- return false;
- }
-
- QByteArray data;
- blobIn >> data;
- data = qUncompress(data);
- QBuffer dataBuffer(&data);
- dataBuffer.open(QIODevice::ReadOnly);
- QDataStream dataIn(&dataBuffer);
-
- int colorsCount;
- dataIn >> colorsCount;
- for (int i = 0; i < colorsCount; ++i) {
- QPair<QString, int> key;
- dataIn >> key;
- QColor value;
- dataIn >> value;
- colors.insert(key, value);
- }
-
- int picturesCount;
- dataIn >> picturesCount;
- for (int i = 0; i < picturesCount; ++i) {
- QString key;
- dataIn >> key;
- QPicture value;
- dataIn >> value;
- value.setBoundingRect(QRect(0, 0, pictureSize, pictureSize)); // Bug? The forced bounding rect was not deserialized.
- partPictures.insert(key, value);
- }
-
- if (dataIn.status() != QDataStream::Ok) {
- qWarning() << __FUNCTION__ << ": Invalid data blob: " << themeBlob;
- return false;
- }
- return true;
-}
-
-class QS60StyleModeSpecifics
-{
-public:
- static QPixmap skinnedGraphics(QS60StyleEnums::SkinParts stylepart,
- const QSize &size, QS60StylePrivate::SkinElementFlags flags);
- static QHash<QString, QPicture> m_partPictures;
- static QHash<QPair<QString , int>, QColor> m_colors;
-};
-QHash<QString, QPicture> QS60StyleModeSpecifics::m_partPictures;
-QHash<QPair<QString , int>, QColor> QS60StyleModeSpecifics::m_colors;
-
-QS60StylePrivate::QS60StylePrivate()
-{
- setCurrentLayout(0);
-}
-
-QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list,
- int index, const QStyleOption *option)
-{
- const QString listKey = QS60Style::colorListKeys().at(list);
- return QS60StylePrivate::stateColor(
- QS60StyleModeSpecifics::m_colors.value(QPair<QString, int>(listKey, index)),
- option
- );
-}
-
-QPixmap QS60StylePrivate::part(QS60StyleEnums::SkinParts part, const QSize &size,
- QPainter *painter, QS60StylePrivate::SkinElementFlags flags)
-{
- Q_UNUSED(painter);
-
- const QString partKey = QS60Style::partKeys().at(part);
- const QPicture partPicture = QS60StyleModeSpecifics::m_partPictures.value(partKey);
- QSize partSize(partPicture.boundingRect().size());
- if (flags & (SF_PointEast | SF_PointWest)) {
- const int temp = partSize.width();
- partSize.setWidth(partSize.height());
- partSize.setHeight(temp);
- }
- const qreal scaleX = size.width() / (qreal)partSize.width();
- const qreal scaleY = size.height() / (qreal)partSize.height();
-
- QImage partImage(size, QImage::Format_ARGB32);
- partImage.fill(Qt::transparent);
- QPainter resultPainter(&partImage);
- QTransform t;
-
- if (flags & SF_PointEast)
- t.translate(size.width(), 0);
- else if (flags & SF_PointSouth)
- t.translate(size.width(), size.height());
- else if (flags & SF_PointWest)
- t.translate(0, size.height());
-
- t.scale(scaleX, scaleY);
-
- if (flags & SF_PointEast)
- t.rotate(90);
- else if (flags & SF_PointSouth)
- t.rotate(180);
- else if (flags & SF_PointWest)
- t.rotate(270);
-
- resultPainter.setTransform(t, true);
- const_cast<QPicture *>(&partPicture)->play(&resultPainter);
- resultPainter.end();
-
- QPixmap result = QPixmap::fromImage(partImage);
- if (flags & SF_StateDisabled) {
- QStyleOption opt;
- QPalette *themePalette = QS60StylePrivate::themePalette();
- if (themePalette)
- opt.palette = *themePalette;
- result = QApplication::style()->generatedIconPixmap(QIcon::Disabled, result, &opt);
- }
-
- return result;
-}
-
-QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size,
- SkinElementFlags flags)
-{
- const QS60StyleEnums::SkinParts center = m_frameElementsData[frame].center;
- const QS60StyleEnums::SkinParts topLeft = QS60StyleEnums::SkinParts(center - 8);
- const QS60StyleEnums::SkinParts topRight = QS60StyleEnums::SkinParts(center - 7);
- const QS60StyleEnums::SkinParts bottomLeft = QS60StyleEnums::SkinParts(center - 6);
- const QS60StyleEnums::SkinParts bottomRight = QS60StyleEnums::SkinParts(center - 5);
- const QS60StyleEnums::SkinParts top = QS60StyleEnums::SkinParts(center - 4);
- const QS60StyleEnums::SkinParts bottom = QS60StyleEnums::SkinParts(center - 3);
- const QS60StyleEnums::SkinParts left = QS60StyleEnums::SkinParts(center - 2);
- const QS60StyleEnums::SkinParts right = QS60StyleEnums::SkinParts(center - 1);
-
- // The size of topLeft defines all other sizes
- const QSize cornerSize(partSize(topLeft));
- // if frame is so small that corners would cover it completely, draw only center piece
- const bool drawOnlyCenter =
- 2 * cornerSize.width() + 1 >= size.width() || 2 * cornerSize.height() + 1 >= size.height();
-
- const int cornerWidth = cornerSize.width();
- const int cornerHeight = cornerSize.height();
- const int rectWidth = size.width();
- const int rectHeight = size.height();
- const QRect rect(QPoint(), size);
-
- const QRect topLeftRect = QRect(rect.topLeft(), cornerSize);
- const QRect topRect = rect.adjusted(cornerWidth, 0, -cornerWidth, -(rectHeight - cornerHeight));
- const QRect topRightRect = topLeftRect.translated(rectWidth - cornerWidth, 0);
- const QRect rightRect = rect.adjusted(rectWidth - cornerWidth, cornerHeight, 0, -cornerHeight);
- const QRect bottomRightRect = topRightRect.translated(0, rectHeight - cornerHeight);
- const QRect bottomRect = topRect.translated(0, rectHeight - cornerHeight);
- const QRect bottomLeftRect = topLeftRect.translated(0, rectHeight - cornerHeight);
- const QRect leftRect = rightRect.translated(cornerWidth - rectWidth, 0);
- const QRect centerRect = drawOnlyCenter ? rect : rect.adjusted(cornerWidth, cornerWidth, -cornerWidth, -cornerWidth);
-
- QPixmap result(size);
- result.fill(Qt::transparent);
- QPainter painter(&result);
-
-#if 0
- painter.save();
- painter.setOpacity(.3);
- painter.fillRect(topLeftRect, Qt::red);
- painter.fillRect(topRect, Qt::green);
- painter.fillRect(topRightRect, Qt::blue);
- painter.fillRect(rightRect, Qt::green);
- painter.fillRect(bottomRightRect, Qt::red);
- painter.fillRect(bottomRect, Qt::blue);
- painter.fillRect(bottomLeftRect, Qt::green);
- painter.fillRect(leftRect, Qt::blue);
- painter.fillRect(centerRect, Qt::red);
- painter.restore();
-#else
- drawPart(topLeft, &painter, topLeftRect, flags);
- drawPart(top, &painter, topRect, flags);
- drawPart(topRight, &painter, topRightRect, flags);
- drawPart(right, &painter, rightRect, flags);
- drawPart(bottomRight, &painter, bottomRightRect, flags);
- drawPart(bottom, &painter, bottomRect, flags);
- drawPart(bottomLeft, &painter, bottomLeftRect, flags);
- drawPart(left, &painter, leftRect, flags);
- drawPart(center, &painter, centerRect, flags);
-#endif
-
- return result;
-}
-
-QPixmap QS60StylePrivate::backgroundTexture(bool /*skipCreation*/)
-{
- if (!m_background) {
- const QSize size = QApplication::desktop()->screen()->size();
- QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size, 0);
- m_background = new QPixmap(background);
- }
- return *m_background;
-}
-
-bool QS60StylePrivate::isTouchSupported()
-{
-#ifdef QT_KEYPAD_NAVIGATION
- return !QApplication::keypadNavigationEnabled();
-#else
- return true;
-#endif
-}
-
-bool QS60StylePrivate::isToolBarBackground()
-{
- return true;
-}
-
-bool QS60StylePrivate::hasSliderGrooveGraphic()
-{
- return false;
-}
-
-bool QS60StylePrivate::isSingleClickUi()
-{
- return false;
-}
-
-QFont QS60StylePrivate::s60Font_specific(
- QS60StyleEnums::FontCategories fontCategory,
- int pointSize, bool resolveFontSize)
-{
- QFont result;
- if (resolveFontSize)
- result.setPointSize(pointSize);
- switch (fontCategory) {
- case QS60StyleEnums::FC_Primary:
- result.setBold(true);
- break;
- case QS60StyleEnums::FC_Secondary:
- case QS60StyleEnums::FC_Title:
- case QS60StyleEnums::FC_PrimarySmall:
- case QS60StyleEnums::FC_Digital:
- case QS60StyleEnums::FC_Undefined:
- default:
- break;
- }
- return result;
-}
-
-int QS60StylePrivate::currentAnimationFrame(QS60StyleEnums::SkinParts part)
-{
- return 0;
-}
-
-/*!
- Constructs a QS60Style object.
-*/
-QS60Style::QS60Style()
- : QCommonStyle(*new QS60StylePrivate)
-{
- const QString defaultBlob = QString::fromLatin1(":/trolltech/styles/s60style/images/defaults60theme.blob");
- if (QFile::exists(defaultBlob))
- loadS60ThemeFromBlob(defaultBlob);
-}
-
-Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, enumPartKeys, {
- const int enumIndex = QS60StyleEnums::staticMetaObject.indexOfEnumerator("SkinParts");
- Q_ASSERT(enumIndex >= 0);
- const QMetaEnum metaEnum = QS60StyleEnums::staticMetaObject.enumerator(enumIndex);
- for (int i = 0; i < metaEnum.keyCount(); ++i) {
- const QString enumKey = QString::fromLatin1(metaEnum.key(i));
- QString partKey;
- // Following loop does following conversions: "SP_QgnNoteInfo" to "qgn_note_info"...
- for (int charPosition = 3; charPosition < enumKey.length(); charPosition++) {
- if (charPosition > 3 && enumKey[charPosition].isUpper())
- partKey.append(QChar::fromLatin1('_'));
- partKey.append(enumKey[charPosition].toLower());
- }
- x->append(partKey);
- }
-})
-
-QStringList QS60Style::partKeys()
-{
- return *enumPartKeys();
-}
-
-Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, enumColorListKeys, {
- const int enumIndex = QS60StyleEnums::staticMetaObject.indexOfEnumerator("ColorLists");
- Q_ASSERT(enumIndex >= 0);
- const QMetaEnum metaEnum = QS60StyleEnums::staticMetaObject.enumerator(enumIndex);
- for (int i = 0; i < metaEnum.keyCount(); i++) {
- const QString enumKey = QString::fromLatin1(metaEnum.key(i));
- // Following line does following conversions: CL_QsnTextColors to "text"...
- x->append(enumKey.mid(6, enumKey.length() - 12).toLower());
- }
-})
-
-QStringList QS60Style::colorListKeys()
-{
- return *enumColorListKeys();
-}
-
-void QS60Style::setS60Theme(const QHash<QString, QPicture> &parts,
- const QHash<QPair<QString , int>, QColor> &colors)
-{
- Q_D(QS60Style);
- QS60StyleModeSpecifics::m_partPictures = parts;
- QS60StyleModeSpecifics::m_colors = colors;
- d->clearCaches(QS60StylePrivate::CC_ThemeChange);
- d->setBackgroundTexture(qApp);
- d->setThemePalette(qApp);
-}
-
-bool QS60Style::loadS60ThemeFromBlob(const QString &blobFile)
-{
- QHash<QString, QPicture> partPictures;
- QHash<QPair<QString, int>, QColor> colors;
-
- if (!loadThemeFromBlob(blobFile, partPictures, colors))
- return false;
- setS60Theme(partPictures, colors);
- return true;
-}
-
-bool QS60Style::saveS60ThemeToBlob(const QString &blobFile) const
-{
- return saveThemeToBlob(blobFile,
- QS60StyleModeSpecifics::m_partPictures, QS60StyleModeSpecifics::m_colors);
-}
-
-QPoint qt_s60_fill_background_offset(const QWidget *targetWidget)
-{
- Q_UNUSED(targetWidget)
- return QPoint();
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_STYLE_S60 || QT_PLUGIN
diff --git a/src/widgets/styles/qs60style_stub.cpp b/src/widgets/styles/qs60style_stub.cpp
deleted file mode 100644
index ce2f7743ad..0000000000
--- a/src/widgets/styles/qs60style_stub.cpp
+++ /dev/null
@@ -1,131 +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 QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qs60style.h"
-#include "qdebug.h"
-
-#if defined(QT_NO_STYLE_S60)
-QT_BEGIN_NAMESPACE
-
-QS60Style::QS60Style()
-{
- qWarning() << "QS60Style stub created";
-}
-
-QS60Style::~QS60Style()
-{
-}
-
-void QS60Style::drawComplexControl(ComplexControl , const QStyleOptionComplex *, QPainter *, const QWidget *) const
-{
-}
-
-void QS60Style::drawControl(ControlElement , const QStyleOption *, QPainter *, const QWidget *) const
-{
-}
-
-void QS60Style::drawPrimitive(PrimitiveElement , const QStyleOption *, QPainter *, const QWidget *) const
-{
-}
-
-int QS60Style::pixelMetric(PixelMetric , const QStyleOption *, const QWidget *) const
-{
- return 0;
-}
-
-QSize QS60Style::sizeFromContents(ContentsType , const QStyleOption *, const QSize &, const QWidget *) const
-{
- return QSize();
-}
-
-int QS60Style::styleHint(StyleHint , const QStyleOption *, const QWidget *, QStyleHintReturn *) const
-{
- return 0;
-}
-
-QRect QS60Style::subControlRect(ComplexControl , const QStyleOptionComplex *, SubControl , const QWidget *) const
-{
- return QRect();
-}
-
-QRect QS60Style::subElementRect(SubElement , const QStyleOption *, const QWidget *) const
-{
- return QRect();
-}
-
-void QS60Style::polish(QWidget *)
-{
-}
-
-void QS60Style::unpolish(QWidget *)
-{
-}
-
-void QS60Style::polish(QApplication *)
-{
-}
-
-void QS60Style::unpolish(QApplication *)
-{
-}
-
-bool QS60Style::event(QEvent *)
-{
- return false;
-}
-
-QIcon QS60Style::standardIconImplementation(StandardPixmap , const QStyleOption *, const QWidget *) const
-{
- return QIcon();
-}
-
-void QS60Style::timerEvent(QTimerEvent *)
-{
-}
-
-bool QS60Style::eventFilter(QObject *, QEvent *)
-{
- return false;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_STYLE_S60
diff --git a/src/widgets/styles/qstyle_s60.qrc b/src/widgets/styles/qstyle_s60.qrc
deleted file mode 100644
index dbee38b266..0000000000
--- a/src/widgets/styles/qstyle_s60.qrc
+++ /dev/null
@@ -1,137 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/trolltech/styles/commonstyle">
-<!-- <file>images/filelink-16.png</file> -->
-<file>images/filelink-32.png</file>
-<!-- <file>images/filelink-128.png</file> -->
-<!-- <file>images/file-16.png</file> -->
-<file>images/file-32.png</file>
-<!-- <file>images/file-128.png</file> -->
-<!-- <file>images/newdirectory-16.png</file> -->
-<file>images/newdirectory-32.png</file>
-<!-- <file>images/newdirectory-128.png</file> -->
-<!-- <file>images/parentdir-16.png</file> -->
-<file>images/parentdir-32.png</file>
-<!-- <file>images/parentdir-128.png</file> -->
-<!-- <file>images/dvd-16.png</file> -->
-<!-- <file>images/dvd-32.png</file> -->
-<!-- <file>images/dvd-128.png</file> -->
-<!-- <file>images/cdr-16.png</file> -->
-<!-- <file>images/cdr-32.png</file> -->
-<!-- <file>images/cdr-128.png</file> -->
-<!-- <file>images/floppy-16.png</file> -->
-<!-- <file>images/floppy-32.png</file> -->
-<!-- <file>images/floppy-128.png</file> -->
-<!-- <file>images/harddrive-16.png</file> -->
-<file>images/harddrive-32.png</file>
-<!-- <file>images/harddrive-128.png</file> -->
-<!-- <file>images/trash-16.png</file> -->
-<!-- <file>images/trash-32.png</file> -->
-<!-- <file>images/trash-128.png</file> -->
-<!-- <file>images/networkdrive-16.png</file> -->
-<!-- <file>images/networkdrive-32.png</file> -->
-<!-- <file>images/networkdrive-128.png</file> -->
-<!-- <file>images/computer-16.png</file> -->
-<!-- <file>images/computer-32.png</file> -->
-<!-- <file>images/desktop-16.png</file> -->
-<file>images/desktop-32.png</file>
-<!-- <file>images/dirclosed-16.png</file> -->
-<file>images/dirclosed-32.png</file>
-<!-- <file>images/dirclosed-128.png</file> -->
-<!-- <file>images/dirlink-16.png</file> -->
-<file>images/dirlink-32.png</file>
-<!-- <file>images/dirlink-128.png</file> -->
-<!-- <file>images/diropen-16.png</file> -->
-<file>images/diropen-32.png</file>
-<!-- <file>images/diropen-128.png</file> -->
-<!-- <file>images/left-16.png</file> -->
-<file>images/left-32.png</file>
-<!-- <file>images/left-128.png</file> -->
-<!-- <file>images/right-16.png</file> -->
-<file>images/right-32.png</file>
-<!-- <file>images/right-128.png</file> -->
-<!-- <file>images/up-16.png</file> -->
-<file>images/up-32.png</file>
-<!-- <file>images/up-128.png</file> -->
-<!-- <file>images/down-16.png</file> -->
-<file>images/down-32.png</file>
-<!-- <file>images/down-128.png</file> -->
-<!-- <file>images/filecontents-16.png</file> -->
-<file>images/filecontents-32.png</file>
-<!-- <file>images/filecontents-128.png</file> -->
-<!-- <file>images/fileinfo-16.png</file> -->
-<file>images/fileinfo-32.png</file>
-<!-- <file>images/fileinfo-128.png</file> -->
-<!-- <file>images/viewdetailed-16.png</file> -->
-<file>images/viewdetailed-32.png</file>
-<!-- <file>images/viewdetailed-128.png</file> -->
-<!-- <file>images/viewlist-16.png</file> -->
-<file>images/viewlist-32.png</file>
-<!-- <file>images/viewlist-128.png</file> -->
-<file>images/fontbitmap-16.png</file>
-<file>images/fonttruetype-16.png</file>
-<!-- <file>images/standardbutton-apply-128.png</file> -->
-<!-- <file>images/standardbutton-apply-16.png</file> -->
-<file>images/standardbutton-apply-32.png</file>
-<!-- <file>images/standardbutton-cancel-128.png</file> -->
-<!-- <file>images/standardbutton-cancel-16.png</file> -->
-<file>images/standardbutton-cancel-32.png</file>
-<!-- <file>images/standardbutton-clear-128.png</file> -->
-<!-- <file>images/standardbutton-clear-16.png</file> -->
-<file>images/standardbutton-clear-32.png</file>
-<!-- <file>images/standardbutton-close-128.png</file> -->
-<!-- <file>images/standardbutton-close-16.png</file> -->
-<file>images/standardbutton-close-32.png</file>
-<!-- <file>images/standardbutton-delete-128.png</file> -->
-<!-- <file>images/standardbutton-delete-16.png</file> -->
-<file>images/standardbutton-delete-32.png</file>
-<!-- <file>images/standardbutton-help-128.png</file> -->
-<!-- <file>images/standardbutton-help-16.png</file> -->
-<file>images/standardbutton-help-32.png</file>
-<!-- <file>images/standardbutton-no-128.png</file> -->
-<!-- <file>images/standardbutton-no-16.png</file> -->
-<file>images/standardbutton-no-32.png</file>
-<!-- <file>images/standardbutton-ok-128.png</file> -->
-<!-- <file>images/standardbutton-ok-16.png</file> -->
-<file>images/standardbutton-ok-32.png</file>
-<!-- <file>images/standardbutton-open-128.png</file> -->
-<!-- <file>images/standardbutton-open-16.png</file> -->
-<file>images/standardbutton-open-32.png</file>
-<!-- <file>images/standardbutton-save-128.png</file> -->
-<!-- <file>images/standardbutton-save-16.png</file> -->
-<file>images/standardbutton-save-32.png</file>
-<!-- <file>images/standardbutton-yes-128.png</file> -->
-<!-- <file>images/standardbutton-yes-16.png</file> -->
-<file>images/standardbutton-yes-32.png</file>
-<file>images/standardbutton-closetab-16.png</file>
-<file>images/standardbutton-closetab-down-16.png</file>
-<file>images/standardbutton-closetab-hover-16.png</file>
-<!-- <file>images/refresh-24.png</file> -->
-<file>images/refresh-32.png</file>
-<!-- <file>images/stop-24.png</file> -->
-<file>images/stop-32.png</file>
-<!-- <file>images/media-stop-16.png</file> -->
-<file>images/media-stop-32.png</file>
-<!-- <file>images/media-play-16.png</file> -->
-<file>images/media-play-32.png</file>
-<!-- <file>images/media-pause-16.png</file> -->
-<file>images/media-pause-32.png</file>
-<!-- <file>images/media-seek-forward-16.png</file> -->
-<file>images/media-seek-forward-32.png</file>
-<!-- <file>images/media-seek-backward-16.png</file> -->
-<file>images/media-seek-backward-32.png</file>
-<!-- <file>images/media-skip-forward-16.png</file> -->
-<file>images/media-skip-forward-32.png</file>
-<!-- <file>images/media-skip-backward-16.png</file> -->
-<file>images/media-skip-backward-32.png</file>
-<file>images/media-volume-16.png</file>
-<file>images/media-volume-muted-16.png</file>
-</qresource>
-<!--
-<qresource prefix="/trolltech/styles/macstyle">
-<file>images/closedock-16.png</file>
-<file>images/closedock-down-16.png</file>
-<file>images/dockdock-16.png</file>
-<file>images/dockdock-down-16.png</file>
-</qresource>
--->
-</RCC>
diff --git a/src/widgets/styles/qstyle_s60_simulated.qrc b/src/widgets/styles/qstyle_s60_simulated.qrc
deleted file mode 100644
index 969732e1e0..0000000000
--- a/src/widgets/styles/qstyle_s60_simulated.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<!DOCTYPE RCC>
-<RCC version="1.0">
- <qresource prefix="/trolltech/styles/s60style">
- <file>images/defaults60theme.blob</file>
- </qresource>
-</RCC>
diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri
index b20caf726e..1b107cc846 100644
--- a/src/widgets/styles/styles.pri
+++ b/src/widgets/styles/styles.pri
@@ -29,8 +29,6 @@ SOURCES += \
wince* {
RESOURCES += styles/qstyle_wince.qrc
-} else:symbian {
- RESOURCES += styles/qstyle_s60.qrc
} else {
RESOURCES += styles/qstyle.qrc
}
@@ -167,28 +165,3 @@ contains( styles, windowsmobile ) {
} else {
DEFINES += QT_NO_STYLE_WINDOWSMOBILE
}
-
-contains( styles, s60 ):contains(QT_CONFIG, s60) {
- HEADERS += \
- styles/qs60style.h \
- styles/qs60style_p.h
- SOURCES += styles/qs60style.cpp
- symbian {
- SOURCES += styles/qs60style_s60.cpp
- LIBS += -legul -lbmpanim
- contains(CONFIG, is_using_gnupoc) {
- LIBS += -laknicon -laknskins -laknskinsrv -lfontutils
- } else {
- LIBS += -lAknIcon -lAKNSKINS -lAKNSKINSRV -lFontUtils
- }
- } else {
- SOURCES += styles/qs60style_simulated.cpp
- RESOURCES += styles/qstyle_s60_simulated.qrc
- }
-} else {
- symbian {
- HEADERS += styles/qs60style.h
- SOURCES += styles/qs60style_stub.cpp
- }
- DEFINES += QT_NO_STYLE_S60
-}
diff --git a/src/widgets/symbian/images/blank.png b/src/widgets/symbian/images/blank.png
deleted file mode 100644
index bd396de62e..0000000000
--- a/src/widgets/symbian/images/blank.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/busy12.png b/src/widgets/symbian/images/busy12.png
deleted file mode 100644
index 909e70fa4f..0000000000
--- a/src/widgets/symbian/images/busy12.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/busy3.png b/src/widgets/symbian/images/busy3.png
deleted file mode 100644
index 983f5d8b8f..0000000000
--- a/src/widgets/symbian/images/busy3.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/busy6.png b/src/widgets/symbian/images/busy6.png
deleted file mode 100644
index b2e878074f..0000000000
--- a/src/widgets/symbian/images/busy6.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/busy9.png b/src/widgets/symbian/images/busy9.png
deleted file mode 100644
index e093d015c5..0000000000
--- a/src/widgets/symbian/images/busy9.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/closehand.png b/src/widgets/symbian/images/closehand.png
deleted file mode 100644
index 05534f580d..0000000000
--- a/src/widgets/symbian/images/closehand.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/cross.png b/src/widgets/symbian/images/cross.png
deleted file mode 100644
index 50da7aafc3..0000000000
--- a/src/widgets/symbian/images/cross.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/forbidden.png b/src/widgets/symbian/images/forbidden.png
deleted file mode 100644
index a3a0fd61e1..0000000000
--- a/src/widgets/symbian/images/forbidden.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/handpoint.png b/src/widgets/symbian/images/handpoint.png
deleted file mode 100644
index a221548d22..0000000000
--- a/src/widgets/symbian/images/handpoint.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/ibeam.png b/src/widgets/symbian/images/ibeam.png
deleted file mode 100644
index ace2fada1c..0000000000
--- a/src/widgets/symbian/images/ibeam.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/openhand.png b/src/widgets/symbian/images/openhand.png
deleted file mode 100644
index 6f232f0d8f..0000000000
--- a/src/widgets/symbian/images/openhand.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/pointer.png b/src/widgets/symbian/images/pointer.png
deleted file mode 100644
index 677404e250..0000000000
--- a/src/widgets/symbian/images/pointer.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/sizeall.png b/src/widgets/symbian/images/sizeall.png
deleted file mode 100644
index 29500677eb..0000000000
--- a/src/widgets/symbian/images/sizeall.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/sizebdiag.png b/src/widgets/symbian/images/sizebdiag.png
deleted file mode 100644
index f565a3a7a1..0000000000
--- a/src/widgets/symbian/images/sizebdiag.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/sizefdiag.png b/src/widgets/symbian/images/sizefdiag.png
deleted file mode 100644
index 9493f12723..0000000000
--- a/src/widgets/symbian/images/sizefdiag.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/sizehor.png b/src/widgets/symbian/images/sizehor.png
deleted file mode 100644
index 217bf39fe2..0000000000
--- a/src/widgets/symbian/images/sizehor.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/sizever.png b/src/widgets/symbian/images/sizever.png
deleted file mode 100644
index 2c99038c3f..0000000000
--- a/src/widgets/symbian/images/sizever.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/splith.png b/src/widgets/symbian/images/splith.png
deleted file mode 100644
index 343bed529a..0000000000
--- a/src/widgets/symbian/images/splith.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/splitv.png b/src/widgets/symbian/images/splitv.png
deleted file mode 100644
index 69ee4163e8..0000000000
--- a/src/widgets/symbian/images/splitv.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/uparrow.png b/src/widgets/symbian/images/uparrow.png
deleted file mode 100644
index 92dd933856..0000000000
--- a/src/widgets/symbian/images/uparrow.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/wait1.png b/src/widgets/symbian/images/wait1.png
deleted file mode 100644
index 5aebaab1f9..0000000000
--- a/src/widgets/symbian/images/wait1.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/wait10.png b/src/widgets/symbian/images/wait10.png
deleted file mode 100644
index 3b549b08ed..0000000000
--- a/src/widgets/symbian/images/wait10.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/wait11.png b/src/widgets/symbian/images/wait11.png
deleted file mode 100644
index 24a943fa68..0000000000
--- a/src/widgets/symbian/images/wait11.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/wait12.png b/src/widgets/symbian/images/wait12.png
deleted file mode 100644
index 15afd4daa2..0000000000
--- a/src/widgets/symbian/images/wait12.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/wait2.png b/src/widgets/symbian/images/wait2.png
deleted file mode 100644
index f2022b2853..0000000000
--- a/src/widgets/symbian/images/wait2.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/wait3.png b/src/widgets/symbian/images/wait3.png
deleted file mode 100644
index 5b73e57124..0000000000
--- a/src/widgets/symbian/images/wait3.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/wait4.png b/src/widgets/symbian/images/wait4.png
deleted file mode 100644
index 17a03396e0..0000000000
--- a/src/widgets/symbian/images/wait4.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/wait5.png b/src/widgets/symbian/images/wait5.png
deleted file mode 100644
index 16a5c231f2..0000000000
--- a/src/widgets/symbian/images/wait5.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/wait6.png b/src/widgets/symbian/images/wait6.png
deleted file mode 100644
index 2870093a30..0000000000
--- a/src/widgets/symbian/images/wait6.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/wait7.png b/src/widgets/symbian/images/wait7.png
deleted file mode 100644
index 54f75a1db0..0000000000
--- a/src/widgets/symbian/images/wait7.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/wait8.png b/src/widgets/symbian/images/wait8.png
deleted file mode 100644
index 1d370c752e..0000000000
--- a/src/widgets/symbian/images/wait8.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/wait9.png b/src/widgets/symbian/images/wait9.png
deleted file mode 100644
index c28096fe63..0000000000
--- a/src/widgets/symbian/images/wait9.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/images/whatsthis.png b/src/widgets/symbian/images/whatsthis.png
deleted file mode 100644
index 3386ef0c50..0000000000
--- a/src/widgets/symbian/images/whatsthis.png
+++ /dev/null
Binary files differ
diff --git a/src/widgets/symbian/qsymbianevent.cpp b/src/widgets/symbian/qsymbianevent.cpp
deleted file mode 100644
index a4e8e01297..0000000000
--- a/src/widgets/symbian/qsymbianevent.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsymbianevent.h"
-#include <qdebug.h>
-
-#include <w32std.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QSymbianEvent
- \brief The QSymbianEvent class contains a Symbian event of any type.
- \since 4.6
- \inmodule QtWidgets
-
- The class is used as a generic container type for all types of Symbian
- events.
-
- \note This class is only available on Symbian.
-
- \sa QApplication::symbianEventFilter()
-*/
-
-/*!
- \enum QSymbianEvent::Type
-
- \value InvalidEvent The event is not valid.
- \value WindowServerEvent Indicates an event of type \c TWsEvent.
- \value CommandEvent Indicates that the event is a Symbian command.
- \value ResourceChangeEvent Indicates that the event is a Symbian resource change type.
-*/
-
-/*!
- \fn QSymbianEvent::type() const
-
- Returns the event type contained in the QSymbianEvent instance.
-*/
-
-/*!
- \fn QSymbianEvent::isValid() const
-
- Returns whether this QSymbianEvent instance contains a valid event.
-*/
-
-/*!
- Constructs a QSymbianEvent containing the given window server event
- \a windowServerEvent.
-*/
-QSymbianEvent::QSymbianEvent(const TWsEvent *windowServerEvent)
- : m_type(WindowServerEvent)
- , m_eventPtr(windowServerEvent)
-{
-}
-
-/*!
- Constructs a QSymbianEvent containing the given event value
- \a value. The type of event is controlled by the \a eventType parameter.
-*/
-QSymbianEvent::QSymbianEvent(QSymbianEvent::Type eventType, int value)
-{
- switch (eventType) {
- case CommandEvent:
- case ResourceChangeEvent:
- m_type = eventType;
- m_eventValue = value;
- break;
- default:
- m_type = InvalidEvent;
- m_eventValue = 0;
- break;
- }
-}
-
-/*!
- Destroys the QSymbianEvent.
-*/
-QSymbianEvent::~QSymbianEvent()
-{
-}
-
-/*!
- Returns the window server event contained in the class instance, or 0 if the event type
- is not \c WindowServerEvent.
-*/
-const TWsEvent *QSymbianEvent::windowServerEvent() const
-{
- return (m_type == WindowServerEvent) ? static_cast<const TWsEvent *>(m_eventPtr) : 0;
-}
-
-/*!
- Returns the command contained in the class instance, or 0 if the event type
- is not \c CommandEvent.
-*/
-int QSymbianEvent::command() const
-{
- return (m_type == CommandEvent) ? m_eventValue : 0;
-}
-
-/*!
- Returns the resource change type contained in the class instance, or 0 if the event type
- is not \c ResourceChangeEvent.
-*/
-int QSymbianEvent::resourceChangeType() const
-{
- return (m_type == ResourceChangeEvent) ? m_eventValue : 0;
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug dbg, const QSymbianEvent *o)
-{
- if (!o) {
- dbg << "QSymbianEvent(0x0)";
- return dbg;
- }
- dbg.nospace() << "QSymbianEvent(";
- switch (o->type()) {
- case QSymbianEvent::InvalidEvent:
- dbg << "InvalidEvent";
- break;
- case QSymbianEvent::WindowServerEvent:
- dbg << "WindowServerEvent, Type = " << o->windowServerEvent()->Type();
- break;
- case QSymbianEvent::CommandEvent:
- dbg << "CommandEvent, command = " << o->command();
- break;
- case QSymbianEvent::ResourceChangeEvent:
- dbg << "ResourceChangeEvent, resourceChangeType = " << o->resourceChangeType();
- break;
- default:
- dbg << "Unknown event type";
- break;
- }
- dbg << ")";
- return dbg.space();
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/widgets/symbian/qsymbianevent.h b/src/widgets/symbian/qsymbianevent.h
deleted file mode 100644
index 2ecc846a8e..0000000000
--- a/src/widgets/symbian/qsymbianevent.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSYMBIANEVENT_H
-#define QSYMBIANEVENT_H
-
-#include <QtCore/qglobal.h>
-
-#ifdef Q_OS_SYMBIAN
-
-class TWsEvent;
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class Q_WIDGETS_EXPORT QSymbianEvent
-{
-public:
- enum Type {
- InvalidEvent,
- WindowServerEvent,
- CommandEvent,
- ResourceChangeEvent
- };
-
- QSymbianEvent(const TWsEvent *windowServerEvent);
- QSymbianEvent(Type eventType, int value);
- ~QSymbianEvent();
-
- Type type() const;
- bool isValid() const;
-
- const TWsEvent *windowServerEvent() const;
- int command() const;
- int resourceChangeType() const;
-
-private:
- Type m_type;
- union {
- const void *m_eventPtr;
- int m_eventValue;
-
- qint64 m_reserved;
- };
-};
-
-inline QSymbianEvent::Type QSymbianEvent::type() const
-{
- return m_type;
-}
-
-inline bool QSymbianEvent::isValid() const
-{
- return m_type != InvalidEvent;
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_WIDGETS_EXPORT QDebug operator<<(QDebug dbg, const QSymbianEvent *o);
-#endif
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // Q_OS_SYMBIAN
-
-#endif // QSYMBIANEVENT_H
diff --git a/src/widgets/symbian/symbianresources.qrc b/src/widgets/symbian/symbianresources.qrc
deleted file mode 100644
index 0a4fc36c9a..0000000000
--- a/src/widgets/symbian/symbianresources.qrc
+++ /dev/null
@@ -1,37 +0,0 @@
-<RCC>
- <qresource prefix="/trolltech/symbian/cursors" >
- <file>images/blank.png</file>
- <file>images/busy3.png</file>
- <file>images/busy6.png</file>
- <file>images/busy9.png</file>
- <file>images/busy12.png</file>
- <file>images/closehand.png</file>
- <file>images/cross.png</file>
- <file>images/forbidden.png</file>
- <file>images/handpoint.png</file>
- <file>images/ibeam.png</file>
- <file>images/openhand.png</file>
- <file>images/pointer.png</file>
- <file>images/sizeall.png</file>
- <file>images/sizebdiag.png</file>
- <file>images/sizefdiag.png</file>
- <file>images/sizehor.png</file>
- <file>images/sizever.png</file>
- <file>images/splith.png</file>
- <file>images/splitv.png</file>
- <file>images/uparrow.png</file>
- <file>images/wait1.png</file>
- <file>images/wait2.png</file>
- <file>images/wait3.png</file>
- <file>images/wait4.png</file>
- <file>images/wait5.png</file>
- <file>images/wait6.png</file>
- <file>images/wait7.png</file>
- <file>images/wait8.png</file>
- <file>images/wait9.png</file>
- <file>images/wait10.png</file>
- <file>images/wait11.png</file>
- <file>images/wait12.png</file>
- <file>images/whatsthis.png</file>
- </qresource>
-</RCC>
diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri
index 2eec946338..9deb3b5efc 100644
--- a/src/widgets/util/util.pri
+++ b/src/widgets/util/util.pri
@@ -50,22 +50,6 @@ qpa {
OBJECTIVE_SOURCES += util/qsystemtrayicon_mac.mm
}
-symbian {
- LIBS += -letext -lplatformenv
- contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
- LIBS += -lsendas2 -lapmime
- contains(QT_CONFIG, s60) {
- contains(CONFIG, is_using_gnupoc) {
- LIBS += -lcommonui
- } else {
- LIBS += -lCommonUI
- }
- }
- } else {
- DEFINES += USE_SCHEMEHANDLER
- }
-}
-
macx {
OBJECTIVE_SOURCES += util/qscroller_mac.mm
}
diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro
index 74d5e9d7ed..730a0fc63c 100644
--- a/src/widgets/widgets.pro
+++ b/src/widgets/widgets.pro
@@ -11,7 +11,7 @@ DEFINES += QT_BUILD_WIDGETS_LIB QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
-!win32:!qpa:!mac:!symbian:CONFIG += x11
+!win32:!qpa:!mac:CONFIG += x11
unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
@@ -25,10 +25,6 @@ contains(QT_CONFIG, x11sm):CONFIG += x11sm
x11:include(kernel/x11.pri)
mac:include(kernel/mac.pri)
win32:include(kernel/win.pri)
-symbian {
- include(kernel/symbian.pri)
- include(s60framework/s60framework.pri)
-}
#modules
include(animation/animation.pri)
@@ -51,13 +47,6 @@ contains(DEFINES,QT_EVAL):include($$QT_SOURCE_TREE/src/corelib/eval.pri)
QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist
DEFINES += Q_INTERNAL_QAPP_SRC
-symbian {
- TARGET.UID3=0x2001B2DD
-
- # ro-section in gui can exceed default allocated space, so move rw-section a little further
- QMAKE_LFLAGS.ARMCC += --rw-base 0x800000
- QMAKE_LFLAGS.GCCE += -Tdata 0x800000
-}
neon:*-g++* {
DEFINES += QT_HAVE_NEON
diff --git a/src/widgets/widgets/qmenu_symbian.cpp b/src/widgets/widgets/qmenu_symbian.cpp
deleted file mode 100644
index 4250601f98..0000000000
--- a/src/widgets/widgets/qmenu_symbian.cpp
+++ /dev/null
@@ -1,464 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the S60 port of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmenu.h"
-#include "qapplication.h"
-#include "qevent.h"
-#include "qstyle.h"
-#include "qdebug.h"
-#include "qwidgetaction.h"
-#include <private/qapplication_p.h>
-#include <private/qmenu_p.h>
-#include <private/qmenubar_p.h>
-#include <private/qt_s60_p.h>
-#include <QtCore/qlibrary.h>
-
-#ifdef Q_WS_S60
-#include <eikmenub.h>
-#include <eikmenup.h>
-#include <eikaufty.h>
-#include <eikbtgpc.h>
-#include <avkon.rsg>
-#endif
-
-#if !defined(QT_NO_MENUBAR) && defined(Q_WS_S60)
-
-QT_BEGIN_NAMESPACE
-
-typedef QMultiHash<QWidget *, QMenuBarPrivate *> MenuBarHash;
-Q_GLOBAL_STATIC(MenuBarHash, menubars)
-
-struct SymbianMenuItem
-{
- int id;
- CEikMenuPaneItem::SData menuItemData;
- QList<SymbianMenuItem*> children;
- QAction* action;
-};
-
-Q_GLOBAL_STATIC_WITH_ARGS(QAction, contextAction, (0))
-
-static QList<SymbianMenuItem*> symbianMenus;
-static QList<QMenuBar*> nativeMenuBars;
-static uint qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM;
-static QPointer<QWidget> widgetWithContextMenu;
-static QList<QAction*> contextMenuActionList;
-static QWidget* actionMenu = NULL;
-static int contexMenuCommand=0;
-
-bool menuExists()
-{
- QWidget *w = qApp->activeWindow();
- QMenuBarPrivate *mb = menubars()->value(w);
- if ((!mb) && !menubars()->count())
- return false;
- return true;
-}
-
-static bool hasContextMenu(QWidget* widget)
-{
- if (!widget)
- return false;
- const Qt::ContextMenuPolicy policy = widget->contextMenuPolicy();
- if (policy != Qt::NoContextMenu && policy != Qt::PreventContextMenu ) {
- return true;
- }
- return false;
-}
-
-static SymbianMenuItem* qt_symbian_find_menu(int id, const QList<SymbianMenuItem*> &parent)
-{
- int index=0;
- while (index < parent.count()) {
- SymbianMenuItem* temp = parent[index];
- if (temp->menuItemData.iCascadeId == id)
- return temp;
- else if (temp->menuItemData.iCascadeId != 0) {
- SymbianMenuItem* result = qt_symbian_find_menu( id, temp->children);
- if (result)
- return result;
- }
- index++;
- }
- return 0;
-}
-
-static SymbianMenuItem* qt_symbian_find_menu_item(int id, const QList<SymbianMenuItem*> &parent)
-{
- int index=0;
- while (index < parent.count()) {
- SymbianMenuItem* temp = parent[index];
- if (temp->menuItemData.iCascadeId != 0) {
- SymbianMenuItem* result = qt_symbian_find_menu_item( id, temp->children);
- if (result)
- return result;
- }
- else if (temp->menuItemData.iCommandId == id)
- return temp;
- index++;
-
- }
- return 0;
-}
-
-static void qt_symbian_insert_action(QSymbianMenuAction* action, QList<SymbianMenuItem*>* parent)
-{
- if (action->action->isVisible()) {
- if (action->action->isSeparator())
- return;
-
- Q_ASSERT_X(action->command <= QT_SYMBIAN_LAST_MENU_ITEM, "qt_symbian_insert_action",
- "Too many menu actions");
-
- const int underlineShortCut = QApplication::style()->styleHint(QStyle::SH_UnderlineShortcut);
- QString actionText;
- if (underlineShortCut)
- actionText = action->action->text().left(CEikMenuPaneItem::SData::ENominalTextLength);
- else
- actionText = action->action->iconText().left(CEikMenuPaneItem::SData::ENominalTextLength);
- TPtrC menuItemText = qt_QString2TPtrC(actionText);
- if (action->action->menu()) {
- SymbianMenuItem* menuItem = new SymbianMenuItem();
- menuItem->menuItemData.iCascadeId = action->command;
- menuItem->menuItemData.iCommandId = action->command;
- menuItem->menuItemData.iFlags = 0;
- menuItem->menuItemData.iText = menuItemText;
- menuItem->action = action->action;
- if (action->action->menu()->actions().size() == 0 || !action->action->isEnabled() )
- menuItem->menuItemData.iFlags |= EEikMenuItemDimmed;
- parent->append(menuItem);
-
- if (action->action->menu()->actions().size() > 0) {
- for (int c2= 0; c2 < action->action->menu()->actions().size(); ++c2) {
- QScopedPointer<QSymbianMenuAction> symbianAction2(new QSymbianMenuAction);
- symbianAction2->action = action->action->menu()->actions().at(c2);
- QMenu * menu = symbianAction2->action->menu();
- symbianAction2->command = qt_symbian_menu_static_cmd_id++;
- qt_symbian_insert_action(symbianAction2.data(), &(menuItem->children));
- }
- }
-
- } else {
- SymbianMenuItem* menuItem = new SymbianMenuItem();
- menuItem->menuItemData.iCascadeId = 0;
- menuItem->menuItemData.iCommandId = action->command;
- menuItem->menuItemData.iFlags = 0;
- menuItem->menuItemData.iText = menuItemText;
- menuItem->action = action->action;
- if (!action->action->isEnabled()){
- menuItem->menuItemData.iFlags += EEikMenuItemDimmed;
- }
-
- if (action->action->isCheckable()) {
- if (action->action->isChecked())
- menuItem->menuItemData.iFlags += EEikMenuItemCheckBox | EEikMenuItemSymbolOn;
- else
- menuItem->menuItemData.iFlags += EEikMenuItemCheckBox;
- }
- parent->append(menuItem);
- }
- }
-}
-
-void deleteAll(QList<SymbianMenuItem*> *items)
-{
- while (!items->isEmpty()) {
- SymbianMenuItem* temp = items->takeFirst();
- deleteAll(&temp->children);
- delete temp;
- }
-}
-
-static void rebuildMenu()
-{
- widgetWithContextMenu = 0;
- QMenuBarPrivate *mb = 0;
- QWidget *w = qApp->activeWindow();
- QWidget* focusWidget = QApplication::focusWidget();
- if (focusWidget) {
- if (hasContextMenu(focusWidget))
- widgetWithContextMenu = focusWidget;
- }
-
- if (w) {
- mb = menubars()->value(w);
- qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM;
- deleteAll( &symbianMenus );
- if (!mb)
- return;
- mb->symbian_menubar->rebuild();
- }
-}
-
-#ifdef Q_WS_S60
-void qt_symbian_next_menu_from_action(QWidget *actionContainer)
-{
- actionMenu = actionContainer;
-}
-
-void qt_symbian_show_toplevel( CEikMenuPane* menuPane)
-{
- if (actionMenu) {
- QMenuBarPrivate *mb = 0;
- mb = menubars()->value(actionMenu);
- qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM;
- deleteAll( &symbianMenus );
- Q_ASSERT(mb);
- mb->symbian_menubar->rebuild();
- for (int i = 0; i < symbianMenus.count(); ++i)
- QT_TRAP_THROWING(menuPane->AddMenuItemL(symbianMenus.at(i)->menuItemData));
- actionMenu = NULL;
- return;
- }
-
- if (!menuExists())
- return;
- rebuildMenu();
- for (int i = 0; i < symbianMenus.count(); ++i)
- QT_TRAP_THROWING(menuPane->AddMenuItemL(symbianMenus.at(i)->menuItemData));
-}
-
-void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id)
-{
- SymbianMenuItem* menu = qt_symbian_find_menu(id, symbianMenus);
- if (menu) {
- // Normally first AddMenuItemL call for menuPane will create the item array.
- // However if we don't have any items, we still need the item array. Otherwise
- // menupane will crash. That's why we create item array here manually, and
- // AddMenuItemL will then use the existing array.
- CEikMenuPane::CItemArray* itemArray = new CEikMenuPane::CItemArray;
- Q_CHECK_PTR(itemArray);
- menuPane->SetItemArray(itemArray);
- menuPane->SetItemArrayOwnedExternally(EFalse);
-
- for (int i = 0; i < menu->children.count(); ++i)
- QT_TRAP_THROWING(menuPane->AddMenuItemL(menu->children.at(i)->menuItemData));
- }
-}
-#endif // Q_WS_S60
-
-int QMenuBarPrivate::symbianCommands(int command)
-{
- int ret = 0;
-
- if (command == contexMenuCommand && !widgetWithContextMenu.isNull()) {
- QContextMenuEvent* event = new QContextMenuEvent(QContextMenuEvent::Keyboard, QPoint(0,0));
- QCoreApplication::postEvent(widgetWithContextMenu, event);
- ret = 1;
- }
-
- int size = nativeMenuBars.size();
- for (int i = 0; i < nativeMenuBars.size(); ++i) {
- SymbianMenuItem* menu = qt_symbian_find_menu_item(command, symbianMenus);
- if (!menu)
- continue;
-
- emit nativeMenuBars.at(i)->triggered(menu->action);
- menu->action->activate(QAction::Trigger);
- ret = 1;
- break;
- }
-
- return ret;
-}
-
-void QMenuBarPrivate::symbianCreateMenuBar(QWidget *parent)
-{
- Q_Q(QMenuBar);
- if (parent) {
- if(parent->isWindow()) {
- menubars()->insert(q->window(), this);
- symbian_menubar = new QSymbianMenuBarPrivate(this);
- nativeMenuBars.append(q);
- } else {
- menubars()->insert(q->parentWidget(), this);
- symbian_menubar = new QSymbianMenuBarPrivate(this);
- nativeMenuBars.append(q);
- }
- }
-}
-
-void QMenuBarPrivate::symbianDestroyMenuBar()
-{
- Q_Q(QMenuBar);
- int index = nativeMenuBars.indexOf(q);
- nativeMenuBars.removeAt(index);
- menubars()->remove(q->window(), this);
- menubars()->remove(q->parentWidget(), this);
- rebuildMenu();
- if (symbian_menubar)
- delete symbian_menubar;
- symbian_menubar = 0;
-}
-
-void QMenuBarPrivate::reparentMenuBar(QWidget *oldParent, QWidget *newParent)
-{
- if (menubars()->contains(oldParent)) {
- QMenuBarPrivate *object = menubars()->take(oldParent);
- menubars()->insert(newParent, object);
- }
-}
-
-QMenuBarPrivate::QSymbianMenuBarPrivate::QSymbianMenuBarPrivate(QMenuBarPrivate *menubar)
-{
- d = menubar;
-}
-
-QMenuBarPrivate::QSymbianMenuBarPrivate::~QSymbianMenuBarPrivate()
-{
- qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM;
- deleteAll( &symbianMenus );
- symbianMenus.clear();
- d = 0;
- rebuild();
-}
-
-QMenuPrivate::QSymbianMenuPrivate::QSymbianMenuPrivate()
-{
-}
-
-QMenuPrivate::QSymbianMenuPrivate::~QSymbianMenuPrivate()
-{
-
-}
-
-void QMenuPrivate::QSymbianMenuPrivate::addAction(QAction *a, QSymbianMenuAction *before)
-{
- QSymbianMenuAction *action = new QSymbianMenuAction;
- action->action = a;
- action->command = qt_symbian_menu_static_cmd_id++;
- addAction(action, before);
-}
-
-void QMenuPrivate::QSymbianMenuPrivate::addAction(QSymbianMenuAction *action, QSymbianMenuAction *before)
-{
- if (!action)
- return;
- int before_index = actionItems.indexOf(before);
- if (before_index < 0) {
- before = 0;
- before_index = actionItems.size();
- }
- actionItems.insert(before_index, action);
-}
-
-
-void QMenuPrivate::QSymbianMenuPrivate::syncAction(QSymbianMenuAction *)
-{
- rebuild();
-}
-
-void QMenuPrivate::QSymbianMenuPrivate::removeAction(QSymbianMenuAction *action)
-{
- actionItems.removeAll(action);
- delete action;
- action = 0;
- rebuild();
-}
-
-void QMenuPrivate::QSymbianMenuPrivate::rebuild(bool)
-{
-}
-
-void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QAction *a, QAction *before)
-{
- QSymbianMenuAction *action = new QSymbianMenuAction;
- action->action = a;
- action->command = qt_symbian_menu_static_cmd_id++;
- addAction(action, findAction(before));
-}
-
-void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QSymbianMenuAction *action, QSymbianMenuAction *before)
-{
- if (!action)
- return;
- int before_index = actionItems.indexOf(before);
- if (before_index < 0) {
- before = 0;
- before_index = actionItems.size();
- }
- actionItems.insert(before_index, action);
-}
-
-void QMenuBarPrivate::QSymbianMenuBarPrivate::syncAction(QSymbianMenuAction*)
-{
- rebuild();
-}
-
-void QMenuBarPrivate::QSymbianMenuBarPrivate::removeAction(QSymbianMenuAction *action)
-{
- actionItems.removeAll(action);
- delete action;
- rebuild();
-}
-
-void QMenuBarPrivate::QSymbianMenuBarPrivate::insertNativeMenuItems(const QList<QAction*> &actions)
-{
- for (int i = 0; i <actions.size(); ++i) {
- QScopedPointer<QSymbianMenuAction> symbianActionTopLevel(new QSymbianMenuAction);
- symbianActionTopLevel->action = actions.at(i);
- symbianActionTopLevel->parent = 0;
- symbianActionTopLevel->command = qt_symbian_menu_static_cmd_id++;
- qt_symbian_insert_action(symbianActionTopLevel.data(), &symbianMenus);
- }
-}
-
-
-
-void QMenuBarPrivate::QSymbianMenuBarPrivate::rebuild()
-{
- contexMenuCommand = 0;
- qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM;
- deleteAll( &symbianMenus );
- if (d)
- insertNativeMenuItems(d->actions);
-
- contextMenuActionList.clear();
- if (widgetWithContextMenu) {
- contexMenuCommand = qt_symbian_menu_static_cmd_id; // Increased inside insertNativeMenuItems
- contextAction()->setText(QMenuBar::tr("Actions"));
- contextMenuActionList.append(contextAction());
- insertNativeMenuItems(contextMenuActionList);
- }
-}
-QT_END_NAMESPACE
-
-#endif //QT_NO_MENUBAR
diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri
index 986e5e79a0..c33408087d 100644
--- a/src/widgets/widgets/widgets.pri
+++ b/src/widgets/widgets/widgets.pri
@@ -159,7 +159,3 @@ wince*: {
RC_FILE = widgets/qmenu_wince.rc
!static: QMAKE_WRITE_DEFAULT_RC = 1
}
-
-symbian: {
- SOURCES += widgets/qmenu_symbian.cpp
-}