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>
This commit is contained in:
Friedemann Kleint 2011-10-18 08:38:05 +02:00 committed by Qt by Nokia
parent 3c2aea92cf
commit ae30d71413
89 changed files with 2 additions and 21772 deletions

View File

@ -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,\\.,_))

View File

@ -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

View File

@ -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

View File

@ -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 += \

View File

@ -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
}

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -1,6 +0,0 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/trolltech/styles/s60style">
<file>images/defaults60theme.blob</file>
</qresource>
</RCC>

View File

@ -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
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -159,7 +159,3 @@ wince*: {
RC_FILE = widgets/qmenu_wince.rc
!static: QMAKE_WRITE_DEFAULT_RC = 1
}
symbian: {
SOURCES += widgets/qmenu_symbian.cpp
}