diff options
author | Iain <qt-info@nokia.com> | 2009-06-04 15:23:03 (GMT) |
---|---|---|
committer | Iain <qt-info@nokia.com> | 2009-06-04 15:23:03 (GMT) |
commit | aa081e40af9f3dd7b7e9a47e062f7784e0dbb515 (patch) | |
tree | 795ebd361f31956ac7ab5f8b850ec51ed7338dd0 /src | |
parent | 2b6dda723b168b3379684bc89b128ea1e792eddf (diff) | |
parent | 422905e301394dfd23b59a09ac9a725803ddf4e4 (diff) | |
download | Qt-aa081e40af9f3dd7b7e9a47e062f7784e0dbb515.zip Qt-aa081e40af9f3dd7b7e9a47e062f7784e0dbb515.tar.gz Qt-aa081e40af9f3dd7b7e9a47e062f7784e0dbb515.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt-s60-public
Diffstat (limited to 'src')
137 files changed, 3712 insertions, 1546 deletions
diff --git a/src/3rdparty/phonon/phonon/effectwidget.cpp b/src/3rdparty/phonon/phonon/effectwidget.cpp index da5a51a..d5c6c81 100644 --- a/src/3rdparty/phonon/phonon/effectwidget.cpp +++ b/src/3rdparty/phonon/phonon/effectwidget.cpp @@ -165,6 +165,7 @@ void EffectWidgetPrivate::autogenerateUi() if (minValue == -1. && maxValue == 1.) { //Special case values between -1 and 1.0 to use a slider for improved usability QSlider *slider = new QSlider(Qt::Horizontal, q); + control = slider; slider->setRange(-SLIDER_RANGE, +SLIDER_RANGE); slider->setValue(int(SLIDER_RANGE * value.toDouble())); slider->setTickPosition(QSlider::TicksBelow); @@ -188,10 +189,10 @@ void EffectWidgetPrivate::autogenerateUi() break; } + if (control) { #ifndef QT_NO_TOOLTIP control->setToolTip(para.description()); #endif - if (control) { #ifndef QT_NO_SHORTCUT label->setBuddy(control); #endif diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index 5dc6363..e565476 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -268,7 +268,7 @@ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object } /*! - Returns the frame's content, converted to HTML. + Returns the frame's content as HTML, enclosed in HTML and BODY tags. \sa setHtml(), toPlainText() */ @@ -280,7 +280,8 @@ QString QWebFrame::toHtml() const } /*! - Returns the content of this frame converted to plain text. + Returns the content of this frame converted to plain text, completely + stripped of all HTML formatting. \sa toHtml() */ diff --git a/src/corelib/arch/qatomic_symbian.h b/src/corelib/arch/qatomic_symbian.h index 902b320..9b8b341 100644 --- a/src/corelib/arch/qatomic_symbian.h +++ b/src/corelib/arch/qatomic_symbian.h @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/corelib/arch/qatomic_windows.h b/src/corelib/arch/qatomic_windows.h index c795ea6..a1a5a7d 100644 --- a/src/corelib/arch/qatomic_windows.h +++ b/src/corelib/arch/qatomic_windows.h @@ -220,6 +220,9 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueTo #if !defined(Q_OS_WINCE) && !defined(Q_CC_MWERKS) // use compiler intrinsics for all atomic functions +//those functions need to be define in the global namespace +QT_END_NAMESPACE + extern "C" { long __cdecl _InterlockedIncrement(volatile long *); long __cdecl _InterlockedDecrement(volatile long *); @@ -252,6 +255,9 @@ extern "C" { # define _InterlockedExchangeAddPointer(a,b) \ _InterlockedExchangeAdd(reinterpret_cast<volatile long *>(a), long(b)) # endif + +QT_BEGIN_NAMESPACE + inline bool QBasicAtomicInt::ref() { return _InterlockedIncrement(reinterpret_cast<volatile long *>(&_q_value)) != 0; @@ -334,6 +340,8 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueTo #define Q_ARGUMENT_TYPE #endif +QT_END_NAMESPACE + extern "C" { long __cdecl InterlockedIncrement(long Q_ARGUMENT_TYPE * lpAddend); long __cdecl InterlockedDecrement(long Q_ARGUMENT_TYPE * lpAddend); @@ -350,6 +358,8 @@ long __cdecl InterlockedExchangeAdd(long Q_ARGUMENT_TYPE * Addend, long Value); # pragma intrinsic (_InterlockedExchangeAdd) #endif +QT_BEGIN_NAMESPACE + #endif @@ -408,6 +418,8 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueTo // MinGW's definition, such that we pick up variations in the headers. #ifndef __INTERLOCKED_DECLARED #define __INTERLOCKED_DECLARED +QT_END_NAMESPACE + extern "C" { __declspec(dllimport) long __stdcall InterlockedCompareExchange(long *, long, long); __declspec(dllimport) long __stdcall InterlockedIncrement(long *); @@ -415,6 +427,8 @@ extern "C" { __declspec(dllimport) long __stdcall InterlockedExchange(long *, long); __declspec(dllimport) long __stdcall InterlockedExchangeAdd(long *, long); } + +QT_BEGIN_NAMESPACE #endif inline bool QBasicAtomicInt::ref() diff --git a/src/corelib/arch/symbian/qatomic_symbian.cpp b/src/corelib/arch/symbian/qatomic_symbian.cpp index bcb0bd4..170b737 100644 --- a/src/corelib/arch/symbian/qatomic_symbian.cpp +++ b/src/corelib/arch/symbian/qatomic_symbian.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 4538dc4..ca243e7 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -132,7 +132,8 @@ QT_BEGIN_NAMESPACE If you want to use QFlags for your own enum types, use the Q_DECLARE_FLAGS() and Q_DECLARE_OPERATORS_FOR_FLAGS(). - For example: + + Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 1 @@ -449,14 +450,18 @@ QT_BEGIN_NAMESPACE function. You can retrieve the minimum and maximum of two given objects using qMin() and qMax() respectively. All these functions return a corresponding template type; the template types can be - replaced by any other type. For example: + replaced by any other type. + + Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 3 <QtGlobal> also contains functions that generate messages from the given string argument: qCritical(), qDebug(), qFatal() and qWarning(). These functions call the message handler with the - given message. For example: + given message. + + Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 4 @@ -701,7 +706,9 @@ QT_BEGIN_NAMESPACE \relates <QtGlobal> Wraps the signed 64-bit integer \a literal in a - platform-independent way. For example: + platform-independent way. + + Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 8 @@ -712,7 +719,9 @@ QT_BEGIN_NAMESPACE \relates <QtGlobal> Wraps the unsigned 64-bit integer \a literal in a - platform-independent way. For example: + platform-independent way. + + Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 9 @@ -741,7 +750,11 @@ QT_BEGIN_NAMESPACE /*! \fn const T &qAbs(const T &value) \relates <QtGlobal> - Returns the absolute value of \a value. For example: + Compares \a value to the 0 of type T and returns the absolute + value. Thus if T is \e {double}, then \a value is compared to + \e{(double) 0}. + + Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 10 */ @@ -749,7 +762,9 @@ QT_BEGIN_NAMESPACE /*! \fn int qRound(qreal value) \relates <QtGlobal> - Rounds \a value to the nearest integer. For example: + Rounds \a value to the nearest integer. + + Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 11 */ @@ -757,7 +772,9 @@ QT_BEGIN_NAMESPACE /*! \fn qint64 qRound64(qreal value) \relates <QtGlobal> - Rounds \a value to the nearest 64-bit integer. For example: + Rounds \a value to the nearest 64-bit integer. + + Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 12 */ @@ -765,7 +782,9 @@ QT_BEGIN_NAMESPACE /*! \fn const T &qMin(const T &value1, const T &value2) \relates <QtGlobal> - Returns the minimum of \a value1 and \a value2. For example: + Returns the minimum of \a value1 and \a value2. + + Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 13 @@ -775,7 +794,9 @@ QT_BEGIN_NAMESPACE /*! \fn const T &qMax(const T &value1, const T &value2) \relates <QtGlobal> - Returns the maximum of \a value1 and \a value2. For example: + Returns the maximum of \a value1 and \a value2. + + Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 14 @@ -786,7 +807,9 @@ QT_BEGIN_NAMESPACE \relates <QtGlobal> Returns \a value bounded by \a min and \a max. This is equivalent - to qMax(\a min, qMin(\a value, \a max)). For example: + to qMax(\a min, qMin(\a value, \a max)). + + Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 15 @@ -932,7 +955,9 @@ QT_BEGIN_NAMESPACE 4.1.2, the QT_VERSION macro will expand to 0x040102. You can use QT_VERSION to use the latest Qt features where - available. For example: + available. + + Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 16 diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index e0ca27c..43740ed 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1395,22 +1395,26 @@ public: ImCursorPosition, ImSurroundingText, ImCurrentSelection, - ImMaximumTextLength + ImMaximumTextLength, + ImAnchorPosition }; enum InputMethodHint { ImhNone = 0x0, ImhHiddenText = 0x1, - ImhDigitsOnly = 0x2, - ImhFormattedNumbersOnly = 0x4, - ImhUppercaseOnly = 0x8, - ImhLowercaseOnly = 0x10, - ImhNoAutoUppercase = 0x20, - ImhPreferNumbers = 0x40, - ImhPreferUppercase = 0x80, - ImhPreferLowercase = 0x100, - ImhNoPredictiveText = 0x200, - ImhDialableCharactersOnly = 0x400 + ImhNoAutoUppercase = 0x2, + ImhPreferNumbers = 0x4, + ImhPreferUppercase = 0x8, + ImhPreferLowercase = 0x10, + ImhNoPredictiveText = 0x20, + + ImhDigitsOnly = 0x10000, + ImhFormattedNumbersOnly = 0x20000, + ImhUppercaseOnly = 0x40000, + ImhLowercaseOnly = 0x80000, + ImhDialableCharactersOnly = 0x100000, + + ImhExclusiveInputMask = 0xffff0000 }; Q_DECLARE_FLAGS(InputMethodHints, InputMethodHint) diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index b203899..e324ffe 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -622,11 +622,16 @@ QDataStream &QDataStream::operator>>(qint16 &i) setStatus(ReadPastEnd); } } else { - register uchar *p = (uchar *)(&i); + union { + qint16 val1; + char val2[2]; + } x; + char *p = x.val2; char b[2]; if (dev->read(b, 2) == 2) { *p++ = b[1]; *p = b[0]; + i = x.val1; } else { setStatus(ReadPastEnd); } @@ -660,13 +665,18 @@ QDataStream &QDataStream::operator>>(qint32 &i) setStatus(ReadPastEnd); } } else { // swap bytes - uchar *p = (uchar *)(&i); + union { + qint32 val1; + char val2[4]; + } x; + char *p = x.val2; char b[4]; if (dev->read(b, 4) == 4) { *p++ = b[3]; *p++ = b[2]; *p++ = b[1]; *p = b[0]; + i = x.val1; } else { setStatus(ReadPastEnd); } @@ -703,7 +713,12 @@ QDataStream &QDataStream::operator>>(qint64 &i) setStatus(ReadPastEnd); } } else { // swap bytes - uchar *p = (uchar *)(&i); + union { + qint64 val1; + char val2[8]; + } x; + + char *p = x.val2; char b[8]; if (dev->read(b, 8) == 8) { *p++ = b[7]; @@ -714,6 +729,7 @@ QDataStream &QDataStream::operator>>(qint64 &i) *p++ = b[2]; *p++ = b[1]; *p = b[0]; + i = x.val1; } else { setStatus(ReadPastEnd); } @@ -751,13 +767,19 @@ QDataStream &QDataStream::operator>>(float &f) setStatus(ReadPastEnd); } } else { // swap bytes - uchar *p = (uchar *)(&f); + union { + float val1; + char val2[4]; + } x; + + char *p = x.val2; char b[4]; if (dev->read(b, 4) == 4) { *p++ = b[3]; *p++ = b[2]; *p++ = b[1]; *p = b[0]; + f = x.val1; } else { setStatus(ReadPastEnd); } @@ -788,7 +810,11 @@ QDataStream &QDataStream::operator>>(double &f) setStatus(ReadPastEnd); } } else { // swap bytes - register uchar *p = (uchar *)(&f); + union { + double val1; + char val2[8]; + } x; + char *p = x.val2; char b[8]; if (dev->read(b, 8) == 8) { *p++ = b[7]; @@ -799,13 +825,18 @@ QDataStream &QDataStream::operator>>(double &f) *p++ = b[2]; *p++ = b[1]; *p = b[0]; + f = x.val1; } else { setStatus(ReadPastEnd); } } #else //non-standard floating point format - register uchar *p = (uchar *)(&f); + union { + double val1; + char val2[8]; + } x; + char *p = x.val2; char b[8]; if (dev->read(b, 8) == 8) { if (noswap) { @@ -827,6 +858,7 @@ QDataStream &QDataStream::operator>>(double &f) *p++ = b[Q_DF(1)]; *p = b[Q_DF(0)]; } + f = x.val1; } else { setStatus(ReadPastEnd); } @@ -970,7 +1002,12 @@ QDataStream &QDataStream::operator<<(qint16 i) if (noswap) { dev->write((char *)&i, sizeof(qint16)); } else { // swap bytes - register uchar *p = (uchar *)(&i); + union { + qint16 val1; + char val2[2]; + } x; + x.val1 = i; + char *p = x.val2; char b[2]; b[1] = *p++; b[0] = *p; @@ -992,7 +1029,12 @@ QDataStream &QDataStream::operator<<(qint32 i) if (noswap) { dev->write((char *)&i, sizeof(qint32)); } else { // swap bytes - register uchar *p = (uchar *)(&i); + union { + qint32 val1; + char val2[4]; + } x; + x.val1 = i; + char *p = x.val2; char b[4]; b[3] = *p++; b[2] = *p++; @@ -1022,13 +1064,18 @@ QDataStream &QDataStream::operator<<(qint64 i) { CHECK_STREAM_PRECOND(*this) if (version() < 6) { - quint32 i1 = i & 0xffffffff; - quint32 i2 = i >> 32; - *this << i2 << i1; + quint32 i1 = i & 0xffffffff; + quint32 i2 = i >> 32; + *this << i2 << i1; } else if (noswap) { // no conversion needed dev->write((char *)&i, sizeof(qint64)); } else { // swap bytes - register uchar *p = (uchar *)(&i); + union { + qint64 val1; + char val2[8]; + } x; + x.val1 = i; + char *p = x.val2; char b[8]; b[7] = *p++; b[6] = *p++; @@ -1077,7 +1124,12 @@ QDataStream &QDataStream::operator<<(float f) if (noswap) { // no conversion needed dev->write((char *)&g, sizeof(float)); } else { // swap bytes - register uchar *p = (uchar *)(&g); + union { + float val1; + char val2[4]; + } x; + x.val1 = f; + char *p = x.val2; char b[4]; b[3] = *p++; b[2] = *p++; @@ -1103,7 +1155,12 @@ QDataStream &QDataStream::operator<<(double f) if (noswap) { dev->write((char *)&f, sizeof(double)); } else { - register uchar *p = (uchar *)(&f); + union { + double val1; + char val2[8]; + } x; + x.val1 = f; + char *p = x.val2; char b[8]; b[7] = *p++; b[6] = *p++; @@ -1116,7 +1173,12 @@ QDataStream &QDataStream::operator<<(double f) dev->write(b, 8); } #else - register uchar *p = (uchar *)(&f); + union { + double val1; + char val2[8]; + } x; + x.val1 = f; + char *p = x.val2; char b[8]; if (noswap) { b[Q_DF(0)] = *p++; diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp index 883b70f..b1a6188 100644 --- a/src/corelib/io/qfilesystemwatcher_symbian.cpp +++ b/src/corelib/io/qfilesystemwatcher_symbian.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/corelib/io/qfilesystemwatcher_symbian_p.h b/src/corelib/io/qfilesystemwatcher_symbian_p.h index b34418a..9919114 100644 --- a/src/corelib/io/qfilesystemwatcher_symbian_p.h +++ b/src/corelib/io/qfilesystemwatcher_symbian_p.h @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 3816803..765bf40 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -362,7 +362,7 @@ QIODevice::QIODevice() { #if defined QIODEVICE_DEBUG QFile *file = qobject_cast<QFile *>(this); - printf("%p QIODevice::QIODevice(\"%s\") %s\n", this, className(), + printf("%p QIODevice::QIODevice(\"%s\") %s\n", this, metaObject()->className(), qPrintable(file ? file->fileName() : QString())); #endif } @@ -375,7 +375,7 @@ QIODevice::QIODevice(QObject *parent) : QObject(*new QIODevicePrivate, parent) { #if defined QIODEVICE_DEBUG - printf("%p QIODevice::QIODevice(%p \"%s\")\n", this, parent, className()); + printf("%p QIODevice::QIODevice(%p \"%s\")\n", this, parent, metaObject()->className()); #endif } diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp index ae7f51a..a59976c 100644 --- a/src/corelib/io/qprocess_symbian.cpp +++ b/src/corelib/io/qprocess_symbian.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 14fc2d4..6152518 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -3468,7 +3468,7 @@ void QSettings::setPath(Format format, Scope scope, const QString &path) \typedef QSettings::SettingsMap Typedef for QMap<QString, QVariant>. - + \sa registerFormat() */ @@ -3479,6 +3479,11 @@ void QSettings::setPath(Format format, Scope scope, const QString &path) \snippet doc/src/snippets/code/src_corelib_io_qsettings.cpp 27 + \c ReadFunc is used in \c registerFormat() as a pointer to a function + that reads a set of key/value pairs. \c ReadFunc should read all the + options in one pass, and return all the settings in the \c SettingsMap + container, which is initially empty. + \sa WriteFunc, registerFormat() */ @@ -3489,6 +3494,10 @@ void QSettings::setPath(Format format, Scope scope, const QString &path) \snippet doc/src/snippets/code/src_corelib_io_qsettings.cpp 28 + \c WriteFunc is used in \c registerFormat() as a pointer to a function + that writes a set of key/value pairs. \c WriteFunc is only called once, + so you need to output the settings in one go. + \sa ReadFunc, registerFormat() */ @@ -3504,7 +3513,7 @@ void QSettings::setPath(Format format, Scope scope, const QString &path) extension associated to the format (without the '.'). The \a readFunc and \a writeFunc parameters are pointers to - functions that read and write a set of (key, value) pairs. The + functions that read and write a set of key/value pairs. The QIODevice parameter to the read and write functions is always opened in binary mode (i.e., without the QIODevice::Text flag). diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp index 19c1510..4f18490 100644 --- a/src/corelib/kernel/qcore_symbian_p.cpp +++ b/src/corelib/kernel/qcore_symbian_p.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/corelib/kernel/qcore_symbian_p.h b/src/corelib/kernel/qcore_symbian_p.h index a7d2ce4..3b974c3 100644 --- a/src/corelib/kernel/qcore_symbian_p.h +++ b/src/corelib/kernel/qcore_symbian_p.h @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index d745406..30b865e 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 393749f..64ea282 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index ce38b73..6aa3b56 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -54,7 +54,7 @@ #include <stdio.h> #include <stdlib.h> -#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) || defined(QT_BOOTSTRAPPED) && !defined(Q_OS_SYMBIAN) +#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) || defined(QT_BOOTSTRAPPED) # include <sys/times.h> #endif @@ -65,7 +65,7 @@ Q_CORE_EXPORT bool qt_disable_lowpriority_timers=false; /***************************************************************************** UNIX signal handling *****************************************************************************/ -#if !defined(Q_OS_SYMBIAN) + static sig_atomic_t signal_received; static sig_atomic_t signals_fired[NSIG]; @@ -74,7 +74,7 @@ static void signalHandler(int sig) signals_fired[sig] = 1; signal_received = 1; } -#endif + static void initThreadPipeFD(int fd) { @@ -134,7 +134,6 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags, int nsel; do { -#if !defined(Q_OS_SYMBIAN) if (mainThread) { while (signal_received) { signal_received = 0; @@ -146,7 +145,7 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags, } } } -#endif + // Process timers and socket notifiers - the common UNIX stuff int highest = 0; if (! (flags & QEventLoop::ExcludeSocketNotifiers) && (sn_highest >= 0)) { @@ -258,7 +257,7 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags, QTimerInfoList::QTimerInfoList() { -#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_SYMBIAN) +#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) useMonotonicTimers = false; # if (_POSIX_MONOTONIC_CLOCK == 0) @@ -299,7 +298,7 @@ timeval QTimerInfoList::updateCurrentTime() return currentTime; } -#if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) || defined(QT_BOOTSTRAPPED)) && !defined(Q_OS_SYMBIAN) +#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) || defined(QT_BOOTSTRAPPED) /* Returns true if the real time clock has changed by more than 10% @@ -375,11 +374,7 @@ void QTimerInfoList::repairTimersIfNeeded() void QTimerInfoList::getTime(timeval &t) { timespec ts; -#if !defined(Q_OS_SYMBIAN) clock_gettime(CLOCK_MONOTONIC, &ts); -#else - clock_gettime(CLOCK_REALTIME, &ts); -#endif t.tv_sec = ts.tv_sec; t.tv_usec = ts.tv_nsec / 1000; } @@ -944,7 +939,7 @@ void QEventDispatcherUNIX::flush() -#if !defined(Q_OS_SYMBIAN) + void QCoreApplication::watchUnixSignal(int sig, bool watch) { if (sig < NSIG) { @@ -958,10 +953,5 @@ void QCoreApplication::watchUnixSignal(int sig, bool watch) sigaction(sig, &sa, 0); } } -#else -void QCoreApplication::watchUnixSignal(int, bool) -{ -} -#endif QT_END_NAMESPACE diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 6ea2d9f..310bd41 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2068,7 +2068,7 @@ void QObject::deleteLater() or - \tt{/*: ... \starslash} + \tt{\begincomment: ... \endcomment} Examples: diff --git a/src/corelib/kernel/qsharedmemory_symbian.cpp b/src/corelib/kernel/qsharedmemory_symbian.cpp index afb161c..b3b50e3 100644 --- a/src/corelib/kernel/qsharedmemory_symbian.cpp +++ b/src/corelib/kernel/qsharedmemory_symbian.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/corelib/kernel/qsystemsemaphore_symbian.cpp b/src/corelib/kernel/qsystemsemaphore_symbian.cpp index 0c138c4..cd5c3ff 100644 --- a/src/corelib/kernel/qsystemsemaphore_symbian.cpp +++ b/src/corelib/kernel/qsystemsemaphore_symbian.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp index 9063ae4..917679c 100644 --- a/src/corelib/tools/qcryptographichash.cpp +++ b/src/corelib/tools/qcryptographichash.cpp @@ -78,7 +78,7 @@ public: QCryptographicHash can be used to generate cryptographic hashes of binary or text data. - Currently MD4, MD5, and SHA1 are supported. + Currently MD4, MD5, and SHA-1 are supported. */ /*! diff --git a/src/corelib/tools/qlistdata.cpp b/src/corelib/tools/qlistdata.cpp index d40b6b6..34a5d80 100644 --- a/src/corelib/tools/qlistdata.cpp +++ b/src/corelib/tools/qlistdata.cpp @@ -1173,7 +1173,8 @@ void **QListData::erase(void **xi) /*! \typedef QList::iterator::iterator_category - \internal + A synonym for \e {std::random_access_iterator_tag} indicating + this iterator is a random access iterator. */ /*! \typedef QList::iterator::difference_type @@ -1432,7 +1433,8 @@ void **QListData::erase(void **xi) /*! \typedef QList::const_iterator::iterator_category - \internal + A synonym for \e {std::random_access_iterator_tag} indicating + this iterator is a random access iterator. */ /*! \typedef QList::const_iterator::difference_type diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 0699400..07df28d 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -902,7 +902,8 @@ void QMapData::dump() /*! \typedef QMap::iterator::iterator_category - \internal + A synonym for \e {std::bidirectional_iterator_tag} indicating + this iterator is a bidirectional iterator. */ /*! \typedef QMap::iterator::pointer @@ -1123,7 +1124,8 @@ void QMapData::dump() /*! \typedef QMap::const_iterator::iterator_category - \internal + A synonym for \e {std::bidirectional_iterator_tag} indicating + this iterator is a bidirectional iterator. */ /*! \typedef QMap::const_iterator::pointer diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index e22f122..cf1bff8 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -621,8 +621,6 @@ int QtPrivate::QStringList_lastIndexOf(const QStringList *that, QRegExp &rx, int the list, searching forward from index position \a from. Returns -1 if no item matched. - By default, this function is case sensitive. - \sa lastIndexOf(), contains(), QList::indexOf() */ diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 789b364..7d61eac 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -568,8 +568,9 @@ bool QFileDialogPrivate::canBeNativeDialog() } /*! - Sets the given \a option to be enabled if \a on is true; - otherwise, clears the given \a option. + \since 4.5 + Sets the given \a option to be enabled if \a on is true; otherwise, + clears the given \a option. \sa options, testOption() */ @@ -779,6 +780,7 @@ void QFileDialog::selectFile(const QString &filename) } QModelIndex index = d->model->index(filename); + QString file; if (!index.isValid()) { // save as dialog where we want to input a default value QString text = filename; @@ -793,13 +795,13 @@ void QFileDialog::selectFile(const QString &filename) ) text = text.remove(0,1); } - if (!isVisible() || !d->lineEdit()->hasFocus()) - d->lineEdit()->setText(text); + file = text; } else { - d->qFileDialogUi->listView->selectionModel()->clear(); - if (!isVisible() || !d->lineEdit()->hasFocus()) - d->lineEdit()->setText(index.data().toString()); + file = index.data().toString(); } + d->qFileDialogUi->listView->selectionModel()->clear(); + if (!isVisible() || !d->lineEdit()->hasFocus()) + d->lineEdit()->setText(file); } /** @@ -2110,6 +2112,7 @@ void QFileDialogPrivate::createWidgets() #else model->setNameFilterDisables(false); #endif + model->d_func()->disableRecursiveSort = true; QFileDialog::connect(model, SIGNAL(fileRenamed(const QString &, const QString &, const QString &)), q, SLOT(_q_fileRenamed(const QString &, const QString &, const QString &))); QFileDialog::connect(model, SIGNAL(rootPathChanged(const QString &)), q, SLOT(_q_pathChanged(const QString &))); diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp index 49a3f2e..44adc75 100644 --- a/src/gui/dialogs/qfilesystemmodel.cpp +++ b/src/gui/dialogs/qfilesystemmodel.cpp @@ -1095,6 +1095,7 @@ private: */ void QFileSystemModelPrivate::sortChildren(int column, const QModelIndex &parent) { + Q_Q(QFileSystemModel); QFileSystemModelPrivate::QFileSystemNode *indexNode = node(parent); if (indexNode->children.count() == 0) return; @@ -1118,6 +1119,16 @@ void QFileSystemModelPrivate::sortChildren(int column, const QModelIndex &parent indexNode->visibleChildren.append(values.at(i).first->fileName); values.at(i).first->isVisible = true; } + + if (!disableRecursiveSort) { + for (int i = 0; i < q->rowCount(parent); ++i) { + const QModelIndex childIndex = q->index(i, 0, parent); + QFileSystemModelPrivate::QFileSystemNode *indexNode = node(childIndex); + //Only do a recursive sort on visible nodes + if (indexNode->isVisible) + sortChildren(column, childIndex); + } + } } /*! diff --git a/src/gui/dialogs/qfilesystemmodel_p.h b/src/gui/dialogs/qfilesystemmodel_p.h index 0a1265a..af4fada 100644 --- a/src/gui/dialogs/qfilesystemmodel_p.h +++ b/src/gui/dialogs/qfilesystemmodel_p.h @@ -164,9 +164,12 @@ public: QHash<QString, QFileSystemNode *>::const_iterator iterator; for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) { //On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/) - if (!path.isEmpty()) - iterator.value()->updateIcon(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName); - else + if (!path.isEmpty()) { + if (path.endsWith(QLatin1Char('/'))) + iterator.value()->updateIcon(iconProvider, path + iterator.value()->fileName); + else + iterator.value()->updateIcon(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName); + } else iterator.value()->updateIcon(iconProvider, iterator.value()->fileName); } } @@ -177,9 +180,12 @@ public: QHash<QString, QFileSystemNode *>::const_iterator iterator; for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) { //On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/) - if (!path.isEmpty()) - iterator.value()->retranslateStrings(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName); - else + if (!path.isEmpty()) { + if (path.endsWith(QLatin1Char('/'))) + iterator.value()->retranslateStrings(iconProvider, path + iterator.value()->fileName); + else + iterator.value()->retranslateStrings(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName); + } else iterator.value()->retranslateStrings(iconProvider, iterator.value()->fileName); } } @@ -202,7 +208,8 @@ public: readOnly(true), setRootPath(false), filters(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs), - nameFilterDisables(true) // false on windows, true on mac and unix + nameFilterDisables(true), // false on windows, true on mac and unix + disableRecursiveSort(false) { delayedSortTimer.setSingleShot(true); } @@ -288,6 +295,10 @@ public: QDir::Filters filters; QHash<const QFileSystemNode*, bool> bypassFilters; bool nameFilterDisables; + //This flag is an optimization for the QFileDialog + //It enable a sort which is not recursive, it means + //we sort only what we see. + bool disableRecursiveSort; #ifndef QT_NO_REGEXP QList<QRegExp> nameFilters; #endif diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp index 4c5bf4f..aa1c553 100644 --- a/src/gui/dialogs/qfontdialog.cpp +++ b/src/gui/dialogs/qfontdialog.cpp @@ -337,6 +337,14 @@ void QFontDialogPrivate::init() QFontDialog::~QFontDialog() { +#ifdef Q_WS_MAC + Q_D(QFontDialog); + if (d->delegate) { + QFontDialogPrivate::closeCocoaFontPanel(d->delegate); + QFontDialogPrivate::sharedFontPanelAvailable = true; + return; + } +#endif } /*! diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm index 50917a1..3be53db 100644 --- a/src/gui/dialogs/qfontdialog_mac.mm +++ b/src/gui/dialogs/qfontdialog_mac.mm @@ -47,6 +47,7 @@ #include <private/qapplication_p.h> #include <private/qfont_p.h> #include <private/qfontengine_p.h> +#include <private/qt_cocoa_helpers_mac_p.h> #include <private/qt_mac_p.h> #include <qdebug.h> #import <AppKit/AppKit.h> @@ -123,16 +124,16 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) QFont newFont; if (cocoaFont) { int pSize = qRound([cocoaFont pointSize]); - QString family(QCFString::toQString(reinterpret_cast<CFStringRef>([cocoaFont familyName]))); - QString typeface(QCFString::toQString(reinterpret_cast<CFStringRef>([cocoaFont fontName]))); -// qDebug() << "original family" << family << "typeface" << typeface << "psize" << pSize; + QString family(qt_mac_NSStringToQString([cocoaFont familyName])); + QString typeface(qt_mac_NSStringToQString([cocoaFont fontName])); + int hyphenPos = typeface.indexOf(QLatin1Char('-')); if (hyphenPos != -1) { typeface.remove(0, hyphenPos + 1); } else { typeface = QLatin1String("Normal"); } -// qDebug() << " massaged family" << family << "typeface" << typeface << "psize" << pSize; + newFont = QFontDatabase().font(family, typeface, pSize); newFont.setUnderline(resolveFont.underline()); newFont.setStrikeOut(resolveFont.strikeOut()); @@ -566,6 +567,7 @@ void *QFontDialogPrivate::openCocoaFontPanel(const QFont &initial, void QFontDialogPrivate::closeCocoaFontPanel(void *delegate) { + QMacCocoaAutoReleasePool pool; QCocoaFontPanelDelegate *theDelegate = static_cast<QCocoaFontPanelDelegate *>(delegate); NSWindow *ourPanel = [theDelegate actualPanel]; [ourPanel close]; @@ -597,15 +599,37 @@ QFont QFontDialogPrivate::execCocoaFontPanel(bool *ok, const QFont &initial, } } -void QFontDialogPrivate::setFont(void * delegate, const QFont &font) +void QFontDialogPrivate::setFont(void *delegate, const QFont &font) { + QMacCocoaAutoReleasePool pool; QFontEngine *fe = font.d->engineForScript(QUnicodeTables::Common); + NSFontManager *mgr = [NSFontManager sharedFontManager]; + NSFont *nsFont = 0; + #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 if (qstrcmp(fe->name(), "CoreText") == 0) { - const NSFont *nsFont = reinterpret_cast<const NSFont *>(static_cast<QCoreTextFontEngineMulti *>(fe)->ctfont); - [[NSFontManager sharedFontManager] setSelectedFont:nsFont isMultiple:NO]; - } + nsFont = reinterpret_cast<const NSFont *>(static_cast<QCoreTextFontEngineMulti *>(fe)->ctfont); + } else #endif + { + int weight = 5; + NSFontTraitMask mask = 0; + if (font.style() == QFont::StyleItalic) { + mask |= NSItalicFontMask; + } + if (font.weight() == QFont::Bold) { + weight = 9; + mask |= NSBoldFontMask; + } + + NSFontManager *mgr = [NSFontManager sharedFontManager]; + nsFont = [mgr fontWithFamily:qt_mac_QStringToNSString(font.family()) + traits:mask + weight:weight + size:font.pointSize()]; + } + + [mgr setSelectedFont:nsFont isMultiple:NO]; [static_cast<QCocoaFontPanelDelegate *>(delegate) setQtFont:font]; } diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index 220faa3..00baf01 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -1723,7 +1723,7 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title) QMessageBox *msgBox = new QMessageBox(parent); msgBox->setAttribute(Qt::WA_DeleteOnClose); msgBox->setWindowTitle(title.isEmpty() ? tr("About Qt") : title); - msgBox->setText(translatedTextAboutQt); + msgBox->setInformativeText(translatedTextAboutQt); QPixmap pm(QLatin1String(":/trolltech/qmessagebox/images/qtlogo-64.png")); if (!pm.isNull()) diff --git a/src/gui/embedded/qkbdtty_qws.cpp b/src/gui/embedded/qkbdtty_qws.cpp index b588e55..7c162bc 100644 --- a/src/gui/embedded/qkbdtty_qws.cpp +++ b/src/gui/embedded/qkbdtty_qws.cpp @@ -97,6 +97,7 @@ private slots: private: QWSPC101KeyboardHandler *handler; struct termios origTermData; + int originalKbdMode; }; QWSTtyKeyboardHandler::QWSTtyKeyboardHandler(const QString &device) @@ -156,6 +157,7 @@ QWSTtyKbPrivate::QWSTtyKbPrivate(QWSPC101KeyboardHandler *h, const QString &devi tcgetattr(kbdFD, &termdata); #if defined(Q_OS_LINUX) + ioctl(kbdFD, KDGKBMODE, &originalKbdMode); # ifdef QT_QWS_USE_KEYCODES ioctl(kbdFD, KDSKBMODE, K_MEDIUMRAW); # else @@ -202,7 +204,7 @@ QWSTtyKbPrivate::~QWSTtyKbPrivate() { if (kbdFD >= 0) { #if defined(Q_OS_LINUX) - ioctl(kbdFD, KDSKBMODE, K_XLATE); + ioctl(kbdFD, KDSKBMODE, originalKbdMode); #endif tcsetattr(kbdFD, TCSANOW, &origTermData); ::close(kbdFD); diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 4908296..e8ace65 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1522,6 +1522,10 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo if (visible == quint32(newVisible)) return; + // Don't show child if parent is not visible + if (parent && newVisible && !parent->d_ptr->visible) + return; + // Modify the property. const QVariant newVisibleVariant(q_ptr->itemChange(QGraphicsItem::ItemVisibleChange, quint32(newVisible))); diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index a795fb4..8137f8e 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -1195,6 +1195,11 @@ QGraphicsView::QGraphicsView(QWidget *parent) // using a simple reference count. The same goes for acceptDrops and mouse // tracking. setAttribute(Qt::WA_InputMethodEnabled); + + // viewport part of the graphics view has to be enabled + // as well, because when events come this widget is asked + // for input context and so on + viewport()->setAttribute(Qt::WA_InputMethodEnabled); } /*! @@ -1209,6 +1214,11 @@ QGraphicsView::QGraphicsView(QGraphicsScene *scene, QWidget *parent) setAcceptDrops(true); setBackgroundRole(QPalette::Base); setAttribute(Qt::WA_InputMethodEnabled); + + // viewport part of the graphics view has to be enabled + // as well, because when events come this widget is asked + // for input context and so on + viewport()->setAttribute(Qt::WA_InputMethodEnabled); } /*! @@ -1221,6 +1231,11 @@ QGraphicsView::QGraphicsView(QGraphicsViewPrivate &dd, QWidget *parent) setAcceptDrops(true); setBackgroundRole(QPalette::Base); setAttribute(Qt::WA_InputMethodEnabled); + + // viewport part of the graphics view has to be enabled + // as well, because when events come this widget is asked + // for input context and so on + viewport()->setAttribute(Qt::WA_InputMethodEnabled); } /*! diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 7f02fb9..7781258 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -1887,8 +1887,10 @@ void QGraphicsWidget::insertAction(QAction *before, QAction *action) } d->actions.insert(pos, action); - QActionPrivate *apriv = action->d_func(); - apriv->graphicsWidgets.append(this); + if (index == -1) { + QActionPrivate *apriv = action->d_func(); + apriv->graphicsWidgets.append(this); + } QActionEvent e(QEvent::ActionAdded, action, before); QApplication::sendEvent(this, &e); diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index a880a13..0799ea7 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -428,10 +428,13 @@ bool QPixmapIconEngine::read(QDataStream &in) in >> sz; in >> mode; in >> state; - if (pm.isNull()) + if (pm.isNull()) { addFile(fileName, sz, QIcon::Mode(mode), QIcon::State(state)); - else - addPixmap(pm, QIcon::Mode(mode), QIcon::State(state)); + } else { + QPixmapIconEngineEntry pe(fileName, sz, QIcon::Mode(mode), QIcon::State(state)); + pe.pixmap = pm; + pixmaps += pe; + } } return true; } diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 3ef5be3..f85e21a 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -2021,4 +2021,99 @@ QPixmapData* QPixmap::pixmapData() const return data; } +/*! + \enum QPixmap::HBitmapFormat + + \bold{Win32 only:} This enum defines how the conversion between \c + HBITMAP and QPixmap is performed. + + \warning This enum is only available on Windows. + + \value NoAlpha The alpha channel is ignored and always treated as + being set to fully opaque. This is preferred if the \c HBITMAP is + used with standard GDI calls, such as \c BitBlt(). + + \value PremultipliedAlpha The \c HBITMAP is treated as having an + alpha channel and premultiplied colors. This is preferred if the + \c HBITMAP is accessed through the \c AlphaBlend() GDI function. + + \value Alpha The \c HBITMAP is treated as having a plain alpha + channel. This is the preferred format if the \c HBITMAP is going + to be used as an application icon or systray icon. + + \sa fromWinHBITMAP(), toWinHBITMAP() +*/ + +/*! \fn HBITMAP QPixmap::toWinHBITMAP(HBitmapFormat format) const + \bold{Win32 only:} Creates a \c HBITMAP equivalent to the QPixmap, + based on the given \a format. Returns the \c HBITMAP handle. + + It is the caller's responsibility to free the \c HBITMAP data + after use. + + \warning This function is only available on Windows. + + \sa fromWinHBITMAP() +*/ + +/*! \fn QPixmap QPixmap::fromWinHBITMAP(HBITMAP bitmap, HBitmapFormat format) + \bold{Win32 only:} Returns a QPixmap that is equivalent to the + given \a bitmap. The conversion is based on the specified \a + format. + + \warning This function is only available on Windows. + + \sa toWinHBITMAP(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} + +*/ + +/*! \fn const QX11Info &QPixmap::x11Info() const + \bold{X11 only:} Returns information about the configuration of + the X display used to display the widget. + + \warning This function is only available on X11. + + \sa {QPixmap#Pixmap Information}{Pixmap Information} +*/ + +/*! \fn Qt::HANDLE QPixmap::x11PictureHandle() const + \bold{X11 only:} Returns the X11 Picture handle of the pixmap for + XRender support. + + This function will return 0 if XRender support is not compiled + into Qt, if the XRender extension is not supported on the X11 + display, or if the handle could not be created. Use of this + function is not portable. + + \warning This function is only available on X11. + + \sa {QPixmap#Pixmap Information}{Pixmap Information} +*/ + +/*! \fn int QPixmap::x11SetDefaultScreen(int screen) + \internal +*/ + +/*! \fn void QPixmap::x11SetScreen(int screen) + \internal +*/ + +/*! \fn QRgb* QPixmap::clut() const + \internal +*/ + +/*! \fn int QPixmap::numCols() const + \internal +*/ + +/*! \fn const uchar* QPixmap::qwsBits() const + \internal + \since 4.1 +*/ + +/*! \fn int QPixmap::qwsBytesPerLine() const + \internal + \since 4.1 +*/ + QT_END_NAMESPACE diff --git a/src/gui/image/qpixmap_qws.cpp b/src/gui/image/qpixmap_qws.cpp index 6cc7981..7e383ab 100644 --- a/src/gui/image/qpixmap_qws.cpp +++ b/src/gui/image/qpixmap_qws.cpp @@ -109,9 +109,6 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) return QPixmap::fromImage(img); } -/*! - \internal -*/ QRgb* QPixmap::clut() const { if (data->classId() == QPixmapData::RasterClass) { @@ -122,9 +119,6 @@ QRgb* QPixmap::clut() const return 0; } -/*! - \internal -*/ int QPixmap::numCols() const { if (data->classId() == QPixmapData::RasterClass) { @@ -135,10 +129,6 @@ int QPixmap::numCols() const return 0; } -/*! - \internal - \since 4.1 -*/ const uchar* QPixmap::qwsBits() const { if (data->classId() == QPixmapData::RasterClass) { @@ -149,10 +139,6 @@ const uchar* QPixmap::qwsBits() const return 0; } -/*! - \internal - \since 4.1 -*/ int QPixmap::qwsBytesPerLine() const { if (data->classId() == QPixmapData::RasterClass) { diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 625988a..52e2fe7 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ #include <w32std.h> diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp index cbe9004..6a8b38a 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/gui/image/qpixmap_win.cpp @@ -119,42 +119,6 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h ) return pixmap; } - - -/*! - \enum QPixmap::HBitmapFormat - - This enum defines how the conversion between \c HBITMAP - and QPixmap is performed. - - \warning This enum is only available on Windows. - - \value NoAlpha The alpha channel is ignored and always treated as - being set to fully opaque. This is preferred if the \c HBITMAP is - used with standard GDI calls, such as \c BitBlt(). - - \value PremultipliedAlpha The \c HBITMAP is treated as having an - alpha channel and premultiplied colors. This is preferred if the - \c HBITMAP is accessed through the \c AlphaBlend() GDI function. - - \value Alpha The \c HBITMAP is treated as having a plain alpha - channel. This is the preferred format if the \c HBITMAP is going - to be used as an application icon or systray icon. - - \sa fromWinHBITMAP(), toWinHBITMAP() -*/ - -/*! - Creates a \c HBITMAP equivalent to the QPixmap, based on the given - \a format. Returns the \c HBITMAP handle. - - It is the caller's responsibility to free the \c HBITMAP data - after use. - - \warning This function is only available on Windows. - - \sa fromWinHBITMAP() -*/ HBITMAP QPixmap::toWinHBITMAP(HBitmapFormat format) const { HBITMAP bitmap = 0; @@ -209,15 +173,6 @@ HBITMAP QPixmap::toWinHBITMAP(HBitmapFormat format) const return bitmap; } -/*! - Returns a QPixmap that is equivalent to the given \a bitmap. The - conversion is based on the specified \a format. - - \warning This function is only available on Windows. - - \sa toWinHBITMAP(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} - -*/ QPixmap QPixmap::fromWinHBITMAP(HBITMAP bitmap, HBitmapFormat format) { // Verify size diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 38916c7..d2e8d84 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1914,9 +1914,6 @@ QPixmap QX11PixmapData::transformed(const QTransform &transform, } } -/*! - \internal -*/ int QPixmap::x11SetDefaultScreen(int screen) { int old = defaultScreen; @@ -1924,9 +1921,6 @@ int QPixmap::x11SetDefaultScreen(int screen) return old; } -/*! - \internal -*/ void QPixmap::x11SetScreen(int screen) { if (paintingActive()) { @@ -2034,14 +2028,6 @@ bool QX11PixmapData::hasAlphaChannel() const return d == 32; } -/*! - Returns information about the configuration of the X display used to display - the widget. - - \warning This function is only available on X11. - - \sa {QPixmap#Pixmap Information}{Pixmap Information} -*/ const QX11Info &QPixmap::x11Info() const { if (data->classId() == QPixmapData::X11Class) @@ -2098,20 +2084,6 @@ QPaintEngine* QX11PixmapData::paintEngine() const return that->pengine; } -/*! - Returns the X11 Picture handle of the pixmap for XRender - support. - - This function will return 0 if XRender support is not compiled - into Qt, if the XRender extension is not supported on the X11 - display, or if the handle could not be created. Use of this - function is not portable. - - \warning This function is only available on X11. - - \sa {QPixmap#Pixmap Information}{Pixmap Information} -*/ - Qt::HANDLE QPixmap::x11PictureHandle() const { #ifndef QT_NO_XRENDER diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 50f8a12..c2677b1 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 8612e55..0a5fd22 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -13,6 +43,7 @@ #include "qcoefepinputcontext_p.h" #include <qapplication.h> +#include <private/qapplication_p.h> #include <qtextformat.h> #include <fepitfr.h> @@ -59,9 +90,12 @@ QCoeFepInputContext::~QCoeFepInputContext() // This is to make sure that the FEP manager "forgets" about us, // otherwise we may get callbacks even after we're destroyed. // The call is asynchronous though, so we must spin the event loop - // to make sure it gets detected. + // to make sure it gets detected. However we will not spin eventloop + // in case that app is closing, since eventDispatcher is already deleted. CCoeEnv::Static()->InputCapabilitiesChanged(); - QApplication::processEvents(); + if(!QApplicationPrivate::is_app_closing) { + QApplication::processEvents(); + } if (m_fepState) delete m_fepState; @@ -606,13 +640,13 @@ void QCoeFepInputContext::SetCursorSelectionForFepL(const TCursorSelection& aCur if (!w) return; - int pos = w->inputMethodQuery(Qt::ImCursorPosition).toInt() + aCursorSelection.iCursorPos + 1; + int pos = aCursorSelection.iAnchorPos; + int length = aCursorSelection.iCursorPos - pos; QList<QInputMethodEvent::Attribute> attributes; - attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, pos, 1, QVariant()); + attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, pos, length, QVariant()); QInputMethodEvent event(m_preeditString, attributes); - // ### FIXME Sets preeditcursor and not cursor. Probably needs new API. - //sendEvent(event); + sendEvent(event); } void QCoeFepInputContext::GetCursorSelectionForFep(TCursorSelection& aCursorSelection) const @@ -621,9 +655,8 @@ void QCoeFepInputContext::GetCursorSelectionForFep(TCursorSelection& aCursorSele if (!w) return; - QVariant cursorVar = w->inputMethodQuery(Qt::ImCursorPosition); - int cursor = cursorVar.toInt() + m_preeditString.size(); - int anchor = cursor - w->inputMethodQuery(Qt::ImCurrentSelection).toString().size(); + int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt() + m_preeditString.size(); + int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt() + m_preeditString.size(); aCursorSelection.iAnchorPos = anchor; aCursorSelection.iCursorPos = cursor; } diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index d373163..f888f5f 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -1267,8 +1267,10 @@ void QHeaderView::setSortIndicator(int logicalIndex, Qt::SortOrder order) d->sortIndicatorSection = logicalIndex; d->sortIndicatorOrder = order; - if (logicalIndex >= d->sectionCount) + if (logicalIndex >= d->sectionCount) { + emit sortIndicatorChanged(logicalIndex, order); return; // nothing to do + } if (old != logicalIndex && ((logicalIndex >= 0 && resizeMode(logicalIndex) == ResizeToContents) diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index 43feda8..92dfd19 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -1518,7 +1518,8 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel) d->clear_mapping(); reset(); - d->update_source_sort_column(); + if (d->update_source_sort_column() && d->dynamic_sortfilter) + d->sort(); } /*! diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 62c1277..1070648 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -246,7 +246,7 @@ void QTreeView::setModel(QAbstractItemModel *model) connect(d->model, SIGNAL(modelAboutToBeReset()), SLOT(_q_modelAboutToBeReset())); if (d->sortingEnabled) - sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder()); + d->_q_sortIndicatorChanged(header()->sortIndicatorSection(), header()->sortIndicatorOrder()); } /*! @@ -846,17 +846,19 @@ void QTreeView::setExpanded(const QModelIndex &index, bool expanded) void QTreeView::setSortingEnabled(bool enable) { Q_D(QTreeView); - d->sortingEnabled = enable; header()->setSortIndicatorShown(enable); header()->setClickable(enable); if (enable) { + //sortByColumn has to be called before we connect or set the sortingEnabled flag + // because otherwise it will not call sort on the model. + sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder()); connect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(_q_sortIndicatorChanged(int, Qt::SortOrder))); - sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder()); } else { disconnect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(_q_sortIndicatorChanged(int, Qt::SortOrder))); } + d->sortingEnabled = enable; } bool QTreeView::isSortingEnabled() const diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index fb002a3..eaaeb4b 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -4764,7 +4764,7 @@ void QApplicationPrivate::emitLastWindowClosed() If \a enable is true, Qt::Key_Up and Qt::Key_Down are used to change focus. - This feature is available in Qt for Embedded Linux only. + This feature is available in Qt for Embedded Linux and Symbian only. \sa keypadNavigationEnabled() */ @@ -4775,9 +4775,9 @@ void QApplication::setKeypadNavigationEnabled(bool enable) /*! Returns true if Qt is set to use keypad navigation; otherwise returns - false. The default is false. + false. The default value is true on Symbian, but false on other platforms. - This feature is available in Qt for Embedded Linux only. + This feature is available in Qt for Embedded Linux and Symbian only. \sa setKeypadNavigationEnabled() */ diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index ca0eb98..e1b8b26 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -233,7 +233,8 @@ public: #if defined(Q_WS_S60) int s60ProcessEvent(TWsEvent *event); virtual bool s60EventFilter(TWsEvent *aEvent); - void s60HandleCommandL(int command); + void symbianHandleCommand(int command); + void symbianResourceChange(int type); #endif #if defined(Q_WS_QWS) virtual bool qwsEventFilter(QWSEvent *); diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index dd51fcd..2f7bdcf 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -14,6 +44,7 @@ #include "qevent.h" #include "qeventdispatcher_s60_p.h" #include "qwidget.h" +#include "qdesktopwidget.h" #include "private/qbackingstore_p.h" #include "qt_s60_p.h" #include "private/qevent_p.h" @@ -27,7 +58,7 @@ #endif #include "private/qwindowsurface_s60_p.h" #include "qpaintengine.h" -#include "qmenubar.h" +#include "private/qmenubar_p.h" #include "apgwgnam.h" // For CApaWindowGroupName #include <MdaAudioTonePlayer.h> // For CMdaAudioToneUtility @@ -49,6 +80,8 @@ static bool appNoGrab = false; // Grabbing enabled Q_GUI_EXPORT QS60Data *qt_s60Data = 0; extern bool qt_sendSpontaneousEvent(QObject*,QEvent*); +extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp + QWidget *qt_button_down = 0; // widget got last button-down bool qt_nograb() // application no-grab option @@ -201,7 +234,7 @@ static void mapS60MouseEventTypeToQt(QEvent::Type *type, Qt::MouseButton *button *type = QEvent::MouseButtonDblClick; } - if (*type == QEvent::MouseButtonPress) + if (*type == QEvent::MouseButtonPress || *type == QEvent::MouseButtonDblClick) QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons | (*button); else if (*type == QEvent::MouseButtonRelease) QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons &(~(*button)); @@ -310,7 +343,7 @@ void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, cons QMouseEvent mEvent(QEvent::MouseButtonPress, alienWidget->mapFrom(qwidget, widgetPos), globalPos, Qt::RightButton, QApplicationPrivate::mouse_buttons, Qt::NoModifier); sendMouseEvent(alienWidget, &mEvent); - m_previousEventLongTap = true; + m_previousEventLongTap = false; } void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) @@ -339,7 +372,7 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) TPoint controlScreenPos = PositionRelativeToScreen(); QPoint globalPos = QPoint(controlScreenPos.iX, controlScreenPos.iY) + widgetPos; - if (type == QEvent::MouseButtonPress) + if (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick) { // get the button press target alienWidget = qwidget->childAt(widgetPos); @@ -359,7 +392,7 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) alienWidget = S60->mousePressTarget; if (alienWidget != S60->lastPointerEventTarget) - if (type == QEvent::MouseButtonPress || type == QEvent::MouseMove) + if (type == QEvent::MouseButtonPress || QEvent::MouseButtonDblClick || type == QEvent::MouseMove) { //moved to another widget, create enter and leave events if (S60->lastPointerEventTarget) @@ -521,7 +554,14 @@ TKeyResponse QSymbianControl::sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent) #ifndef QT_NO_IM TCoeInputCapabilities QSymbianControl::InputCapabilities() const { - QWidget *w = qwidget->focusWidget(); + QWidget *w = 0; + + if(qwidget->hasFocus()) { + w = qwidget; + } else { + w = qwidget->focusWidget(); + } + QCoeFepInputContext *ic; if (w && w->isEnabled() && w->testAttribute(Qt::WA_InputMethodEnabled) && (ic = qobject_cast<QCoeFepInputContext *>(w->inputContext()))) { @@ -639,21 +679,7 @@ void QSymbianControl::HandleResourceChange(int resourceType) // font change event break; case KEikDynamicLayoutVariantSwitch: - { -#ifndef QT_NO_STYLE_S60 - QS60Style *s60Style = 0; - -#ifndef QT_NO_STYLE_STYLESHEET - QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle*>(QApplication::style()); - if (proxy) - s60Style = qobject_cast<QS60Style*>(proxy->baseStyle()); - else -#endif - s60Style = qobject_cast<QS60Style*>(QApplication::style()); - - if (s60Style) - s60Style->handleDynamicLayoutVariantSwitch(); -#endif + { if (qwidget->isFullScreen()) { SetExtentToWholeScreen(); } else if (qwidget->isMaximized()) { @@ -662,12 +688,6 @@ void QSymbianControl::HandleResourceChange(int resourceType) } break; } -#ifndef QT_NO_STYLE_S60 - case KAknsMessageSkinChange: - if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style())) - s60Style->handleSkinChange(); - break; -#endif default: break; } @@ -988,6 +1008,13 @@ int QApplication::s60ProcessEvent(TWsEvent *event) case EEventScreenDeviceChanged: if (S60) S60->updateScreenSize(); + if (qt_desktopWidget) { + QSize oldSize = qt_desktopWidget->size(); + qt_desktopWidget->data->crect.setWidth(S60->screenWidthInPixels); + qt_desktopWidget->data->crect.setHeight(S60->screenHeightInPixels); + QResizeEvent e(qt_desktopWidget->size(), oldSize); + QApplication::sendEvent(qt_desktopWidget, &e); + } return 0; // Propagate to CONE case EEventWindowVisibilityChanged: if (controlInMap) { @@ -1001,6 +1028,7 @@ int QApplication::s60ProcessEvent(TWsEvent *event) } else if ((visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) && !w->d_func()->maybeBackingStore()) { w->d_func()->topData()->backingStore = new QWidgetBackingStore(w); + w->update(); } return 1; } @@ -1020,7 +1048,14 @@ bool QApplication::s60EventFilter(TWsEvent *aEvent) return false; } -void QApplication::s60HandleCommandL(int command) +/*! + Handles commands which are typically handled by CAknAppUi::HandleCommandL() + Qts Ui integration into Symbian is partially achieved by deriving from CAknAppUi. + Currently, exit, menu and softkey commands are handled + + \sa s60EventFilter(), s60ProcessEvent() +*/ +void QApplication::symbianHandleCommand(int command) { switch (command) { case EEikCmdExit: @@ -1030,7 +1065,41 @@ void QApplication::s60HandleCommandL(int command) break; default: // For now assume all unknown menu items are Qt menu items - QMenuBar::symbianCommands(command); + QMenuBarPrivate::symbianCommands(command); + break; + } +} + +void QApplication::symbianResourceChange(int type) +{ + switch (type) { + case KEikDynamicLayoutVariantSwitch: + { +#ifndef QT_NO_STYLE_S60 + QS60Style *s60Style = 0; + +#ifndef QT_NO_STYLE_STYLESHEET + QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle*>(QApplication::style()); + if (proxy) + s60Style = qobject_cast<QS60Style*>(proxy->baseStyle()); + else +#endif + s60Style = qobject_cast<QS60Style*>(QApplication::style()); + + if (s60Style) + s60Style->handleDynamicLayoutVariantSwitch(); +#endif + } + break; + +#ifndef QT_NO_STYLE_S60 + case KAknsMessageSkinChange: + if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style())) + s60Style->handleSkinChange(); + break; +#endif + + default: break; } } diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index f14ad6f..239ee14 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -1675,20 +1675,23 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam // send the context menu event is a different one if (!alienWidget->testAttribute(Qt::WA_NativeWindow) && !alienWidget->testAttribute(Qt::WA_PaintOnScreen)) { alienWidget = QApplication::widgetAt(globalPos); - pos = alienWidget->mapFromGlobal(globalPos); + if (alienWidget) + pos = alienWidget->mapFromGlobal(globalPos); } - SHRGINFO shrg; - shrg.cbSize = sizeof(shrg); - shrg.hwndClient = hwnd; - shrg.ptDown.x = GET_X_LPARAM(lParam); - shrg.ptDown.y = GET_Y_LPARAM(lParam); - shrg.dwFlags = SHRG_RETURNCMD | SHRG_NOANIMATION; - resolveAygLibs(); - if (ptrRecognizeGesture && (ptrRecognizeGesture(&shrg) == GN_CONTEXTMENU)) { - if (qApp->activePopupWidget()) - qApp->activePopupWidget()->close(); - QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos); - result = qt_sendSpontaneousEvent(alienWidget, &e); + if (alienWidget) { + SHRGINFO shrg; + shrg.cbSize = sizeof(shrg); + shrg.hwndClient = hwnd; + shrg.ptDown.x = GET_X_LPARAM(lParam); + shrg.ptDown.y = GET_Y_LPARAM(lParam); + shrg.dwFlags = SHRG_RETURNCMD | SHRG_NOANIMATION; + resolveAygLibs(); + if (ptrRecognizeGesture && (ptrRecognizeGesture(&shrg) == GN_CONTEXTMENU)) { + if (qApp->activePopupWidget()) + qApp->activePopupWidget()->close(); + QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos); + result = qt_sendSpontaneousEvent(alienWidget, &e); + } } } } diff --git a/src/gui/kernel/qclipboard_s60.cpp b/src/gui/kernel/qclipboard_s60.cpp index ec595b5..f89f3e5 100644 --- a/src/gui/kernel/qclipboard_s60.cpp +++ b/src/gui/kernel/qclipboard_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm index 9a24645..2ca6a3d 100644 --- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm +++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm @@ -90,6 +90,7 @@ QT_BEGIN_NAMESPACE extern void onApplicationChangedActivation(bool); // qapplication_mac.mm +extern void qt_release_apple_event_handler(); //qapplication_mac.mm QT_END_NAMESPACE QT_FORWARD_DECLARE_CLASS(QDesktopWidgetImplementation) @@ -207,7 +208,6 @@ static void cleanupCocoaApplicationDelegate() { Q_UNUSED(aNotification); inLaunch = false; - extern void qt_release_apple_event_handler(); //qapplication_mac.mm qt_release_apple_event_handler(); } diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 4ceae3f..f1a7f39 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -789,10 +789,22 @@ extern "C" { bool wheelOK = false; Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([theEvent modifierFlags]); + QWidget *widgetToGetMouse = qwidget; + if (widgetToGetMouse->testAttribute(Qt::WA_TransparentForMouseEvents)) { + // Simulate passing the event through since Cocoa doesn't do that for us. + // Start by building a tree up. + NSView *candidateView = [self viewUnderTransparentForMouseView:self + widget:widgetToGetMouse + withWindowPoint:windowPoint]; + if (candidateView != nil) { + widgetToGetMouse = QWidget::find(WId(candidateView)); + } + } + // Mouse wheel deltas seem to tick in at increments of 0.1. Qt widgets - // expect the delta to be a multiple of 120. + // expect the delta to be a multiple of 120. const int ScrollFactor = 10 * 120; - // The qMax(...) factor reduces the + // The qMax(...) factor reduces the // acceleration for large wheel deltas. int deltaX = [theEvent deltaX] * ScrollFactor * qMax(0.6, 1.1 - qAbs([theEvent deltaX])); int deltaY = [theEvent deltaY] * ScrollFactor * qMax(0.6, 1.1 - qAbs([theEvent deltaY])); @@ -800,10 +812,10 @@ extern "C" { if (deltaX != 0) { QWheelEvent qwe(qlocal, qglobal, deltaX, buttons, keyMods, Qt::Horizontal); - qt_sendSpontaneousEvent(qwidget, &qwe); + qt_sendSpontaneousEvent(widgetToGetMouse, &qwe); wheelOK = qwe.isAccepted(); if (!wheelOK && QApplicationPrivate::focus_widget - && QApplicationPrivate::focus_widget != qwidget) { + && QApplicationPrivate::focus_widget != widgetToGetMouse) { QWheelEvent qwe2(QApplicationPrivate::focus_widget->mapFromGlobal(qglobal), qglobal, deltaX, buttons, keyMods, Qt::Horizontal); qt_sendSpontaneousEvent(QApplicationPrivate::focus_widget, &qwe2); @@ -813,10 +825,10 @@ extern "C" { if (deltaY) { QWheelEvent qwe(qlocal, qglobal, deltaY, buttons, keyMods, Qt::Vertical); - qt_sendSpontaneousEvent(qwidget, &qwe); + qt_sendSpontaneousEvent(widgetToGetMouse, &qwe); wheelOK = qwe.isAccepted(); if (!wheelOK && QApplicationPrivate::focus_widget - && QApplicationPrivate::focus_widget != qwidget) { + && QApplicationPrivate::focus_widget != widgetToGetMouse) { QWheelEvent qwe2(QApplicationPrivate::focus_widget->mapFromGlobal(qglobal), qglobal, deltaY, buttons, keyMods, Qt::Vertical); qt_sendSpontaneousEvent(QApplicationPrivate::focus_widget, &qwe2); @@ -828,10 +840,10 @@ extern "C" { // Qt doesn't explicitly support wheels with a Z component. In a misguided attempt to // try to be ahead of the pack, I'm adding this extra value. QWheelEvent qwe(qlocal, qglobal, deltaZ, buttons, keyMods, (Qt::Orientation)3); - qt_sendSpontaneousEvent(qwidget, &qwe); + qt_sendSpontaneousEvent(widgetToGetMouse, &qwe); wheelOK = qwe.isAccepted(); if (!wheelOK && QApplicationPrivate::focus_widget - && QApplicationPrivate::focus_widget != qwidget) { + && QApplicationPrivate::focus_widget != widgetToGetMouse) { QWheelEvent qwe2(QApplicationPrivate::focus_widget->mapFromGlobal(qglobal), qglobal, deltaZ, buttons, keyMods, (Qt::Orientation)3); qt_sendSpontaneousEvent(QApplicationPrivate::focus_widget, &qwe2); diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h index 983c762..527b1a6 100644 --- a/src/gui/kernel/qcocoaview_mac_p.h +++ b/src/gui/kernel/qcocoaview_mac_p.h @@ -59,6 +59,7 @@ QT_FORWARD_DECLARE_CLASS(QWidgetPrivate); QT_FORWARD_DECLARE_CLASS(QWidget); QT_FORWARD_DECLARE_CLASS(QEvent); QT_FORWARD_DECLARE_CLASS(QCocoaDropData); +QT_FORWARD_DECLARE_CLASS(QStringList); QT_BEGIN_NAMESPACE struct DnDParams diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index c24abc4..21a4287 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -375,7 +375,9 @@ void QCursorData::cleanup() return; for (int shape = 0; shape <= Qt::LastCursor; ++shape) { - delete qt_cursorTable[shape]; + // In case someone has a static QCursor defined with this shape + if (!qt_cursorTable[shape]->ref.deref()) + delete qt_cursorTable[shape]; qt_cursorTable[shape] = 0; } QCursorData::initialized = false; diff --git a/src/gui/kernel/qcursor_s60.cpp b/src/gui/kernel/qcursor_s60.cpp index 4d3f067..a281130 100644 --- a/src/gui/kernel/qcursor_s60.cpp +++ b/src/gui/kernel/qcursor_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp index 029892e..eefd0ef 100644 --- a/src/gui/kernel/qdesktopwidget_s60.cpp +++ b/src/gui/kernel/qdesktopwidget_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -32,34 +62,58 @@ public: static int screenCount; static int primaryScreen; + + static QVector<QRect> *rects; + static QVector<QRect> *workrects; + + static int refcount; }; int QDesktopWidgetPrivate::screenCount = 1; int QDesktopWidgetPrivate::primaryScreen = 0; +QVector<QRect> *QDesktopWidgetPrivate::rects = 0; +QVector<QRect> *QDesktopWidgetPrivate::workrects = 0; +int QDesktopWidgetPrivate::refcount = 0; QDesktopWidgetPrivate::QDesktopWidgetPrivate() { + ++refcount; } QDesktopWidgetPrivate::~QDesktopWidgetPrivate() { + if (!--refcount) + cleanup(); } void QDesktopWidgetPrivate::init(QDesktopWidget *that) { - TInt screenCount=0; - TInt result=0; + int screenCount=0; + + if (HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCount) == KErrNone) + QDesktopWidgetPrivate::screenCount = screenCount; + else + QDesktopWidgetPrivate::screenCount = 0; + + rects = new QVector<QRect>(); + workrects = new QVector<QRect>(); - result = HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCount); - QDesktopWidgetPrivate::screenCount = screenCount; - if( result != KErrNone) - { - // ### What to do if no screens found? - } + rects->resize(QDesktopWidgetPrivate::screenCount); + workrects->resize(QDesktopWidgetPrivate::screenCount); + + // ### TODO: Implement proper multi-display support + rects->resize(1); + rects->replace(0, that->rect()); + workrects->resize(1); + workrects->replace(0, that->rect()); } void QDesktopWidgetPrivate::cleanup() { + delete rects; + rects = 0; + delete workrects; + workrects = 0; } @@ -120,6 +174,29 @@ int QDesktopWidget::screenNumber(const QPoint &point) const 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); + } } QT_END_NAMESPACE diff --git a/src/gui/kernel/qdnd_s60.cpp b/src/gui/kernel/qdnd_s60.cpp index 09605be..c459f8f 100644 --- a/src/gui/kernel/qdnd_s60.cpp +++ b/src/gui/kernel/qdnd_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 2aed287..ba85eea 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -1665,6 +1665,17 @@ Qt::ButtonState QContextMenuEvent::state() const several are specified for any character in the string the behaviour is undefined. + \value Selection + If set, the edit cursor should be moved to the specified position + in the editor text contents. In contrast with \c Cursor, this + attribute does not work on the preedit text, but on the surrounding + text. The cursor will be moved after the commit string has been + committed, and the preedit string will be located at the new edit + position. + The start position specifies the new position and the length + variable can be used to set a selection starting from that point. + The value is unused. + \sa Attribute */ diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 2724315..7696d05 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -424,7 +424,8 @@ public: TextFormat, Cursor, Language, - Ruby + Ruby, + Selection }; class Attribute { public: diff --git a/src/gui/kernel/qeventdispatcher_s60.cpp b/src/gui/kernel/qeventdispatcher_s60.cpp index 862f4ef..6ac2863 100644 --- a/src/gui/kernel/qeventdispatcher_s60.cpp +++ b/src/gui/kernel/qeventdispatcher_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/kernel/qeventdispatcher_s60_p.h b/src/gui/kernel/qeventdispatcher_s60_p.h index fec8773..e42af95 100644 --- a/src/gui/kernel/qeventdispatcher_s60_p.h +++ b/src/gui/kernel/qeventdispatcher_s60_p.h @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/kernel/qkeymapper_s60.cpp b/src/gui/kernel/qkeymapper_s60.cpp index 2919551..bb074c1 100644 --- a/src/gui/kernel/qkeymapper_s60.cpp +++ b/src/gui/kernel/qkeymapper_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 352d26a..3bcf9e3 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -629,8 +629,6 @@ const uint QKeySequencePrivate::numberOfKeyBindings = sizeof(QKeySequencePrivate This enum represent standard key bindings. They can be used to assign platform dependent keyboard shortcuts to a QAction. - QKeyEvent also provides the function QKeyEvent::standardKey() to - query if it matches an existing key binding. Note that the key bindings are platform dependent. The currently bound shortcuts can be queried using keyBindings(). diff --git a/src/gui/kernel/qsound_s60.cpp b/src/gui/kernel/qsound_s60.cpp index 2ac7e26..7eb6463 100644 --- a/src/gui/kernel/qsound_s60.cpp +++ b/src/gui/kernel/qsound_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 4eac35e..aed8241 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index dae4179..955ac8b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -2046,17 +2046,20 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QPoin // Defined in qmacstyle_mac.cpp extern void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, const QBrush &brush); qt_mac_fill_background(painter, rgn, offset, brush); -#elif defined(Q_WS_S60) - // Defined in qs60style_symbian.cpp - extern void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, - const QPoint &offset, const QBrush &brush); - qt_s60_fill_background(painter, rgn, offset, brush); #else - const QRegion translated = rgn.translated(offset); - const QRect rect(translated.boundingRect()); - painter->setClipRegion(translated); - painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft()); -#endif +#if !defined(QT_NO_STYLE_S60) + // Defined in qs60style.cpp + extern bool qt_s60_fill_background(QPainter *painter, const QRegion &rgn, + const QPoint &offset, const QBrush &brush); + if (!qt_s60_fill_background(painter, rgn, offset, brush)) +#endif // !defined(QT_NO_STYLE_S60) + { + const QRegion translated = rgn.translated(offset); + const QRect rect(translated.boundingRect()); + painter->setClipRegion(translated); + painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft()); + } +#endif // Q_WS_MAC } else { const QVector<QRect> &rects = rgn.rects(); for (int i = 0; i < rects.size(); ++i) @@ -8497,6 +8500,9 @@ QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const return QRect(width()/2, 0, 1, height()); case Qt::ImFont: return font(); + case Qt::ImAnchorPosition: + // Fallback. + return inputMethodQuery(Qt::ImCursorPosition); default: return QVariant(); } diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 5c3055d..11cb974 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 6202b35..6250fb77 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -1509,7 +1509,6 @@ QWidget *QWidget::keyboardGrabber() void QWidget::activateWindow() { - Q_D(QWidget); QWidget *tlw = window(); if (tlw->isVisible() && !tlw->d_func()->topData()->embedded && !X11->deferred_map.contains(tlw)) { if (X11->userTime == 0) @@ -2487,6 +2486,8 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r) QRect sr = valid_rect ? r : clipRect(); if (just_update) q->update(); + else if (!valid_rect) + dirty.translate(dx, dy); int x1, y1, x2, y2, w = sr.width(), h = sr.height(); if (dx > 0) { diff --git a/src/gui/painting/qpaintdevice_s60.cpp b/src/gui/painting/qpaintdevice_s60.cpp index ec1b765..a2c4499 100644 --- a/src/gui/painting/qpaintdevice_s60.cpp +++ b/src/gui/painting/qpaintdevice_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 9ce16d3..1b2c4e3 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -2695,7 +2695,7 @@ qreal QPainterPath::length() const /*! Returns percentage of the whole path at the specified length \a len. - Note that similarly to other percent methods, the percentage measurment + Note that similarly to other percent methods, the percentage measurement is not linear with regards to the length, if curves are present in the path. When curves are present the percentage argument is mapped to the t parameter of the Bezier equations. @@ -2812,7 +2812,7 @@ static inline QBezier bezierAtT(const QPainterPath &path, qreal t, qreal *starti Returns the point at at the percentage \a t of the current path. The argument \a t has to be between 0 and 1. - Note that similarly to other percent methods, the percentage measurment + Note that similarly to other percent methods, the percentage measurement is not linear with regards to the length, if curves are present in the path. When curves are present the percentage argument is mapped to the t parameter of the Bezier equations. @@ -2843,7 +2843,7 @@ QPointF QPainterPath::pointAtPercent(qreal t) const Positive values for the angles mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position. - Note that similarly to the other percent methods, the percentage measurment + Note that similarly to the other percent methods, the percentage measurement is not linear with regards to the length if curves are present in the path. When curves are present the percentage argument is mapped to the t parameter of the Bezier equations. @@ -2875,7 +2875,7 @@ qreal QPainterPath::angleAtPercent(qreal t) const Returns the slope of the path at the percentage \a t. The argument \a t has to be between 0 and 1. - Note that similarly to other percent methods, the percentage measurment + Note that similarly to other percent methods, the percentage measurement is not linear with regards to the length, if curves are present in the path. When curves are present the percentage argument is mapped to the t parameter of the Bezier equations. diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp index 5090b3a..ed72077 100644 --- a/src/gui/painting/qprinter.cpp +++ b/src/gui/painting/qprinter.cpp @@ -480,26 +480,26 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke \value A7 74 x 105 mm \value A8 52 x 74 mm \value A9 37 x 52 mm - \value B0 1030 x 1456 mm - \value B1 728 x 1030 mm - \value B10 32 x 45 mm - \value B2 515 x 728 mm - \value B3 364 x 515 mm - \value B4 257 x 364 mm - \value B5 182 x 257 mm, 7.17 x 10.13 inches - \value B6 128 x 182 mm - \value B7 91 x 128 mm - \value B8 64 x 91 mm - \value B9 45 x 64 mm + \value B0 1000 x 1414 mm + \value B1 707 x 1000 mm + \value B2 500 x 707 mm + \value B3 353 x 500 mm + \value B4 250 x 353 mm + \value B5 176 x 250 mm, 6.93 x 9.84 inches + \value B6 125 x 176 mm + \value B7 88 x 125 mm + \value B8 62 x 88 mm + \value B9 33 x 62 mm + \value B10 31 x 44 mm \value C5E 163 x 229 mm \value Comm10E 105 x 241 mm, U.S. Common 10 Envelope \value DLE 110 x 220 mm - \value Executive 7.5 x 10 inches, 191 x 254 mm + \value Executive 7.5 x 10 inches, 190.5 x 254 mm \value Folio 210 x 330 mm - \value Ledger 432 x 279 mm - \value Legal 8.5 x 14 inches, 216 x 356 mm - \value Letter 8.5 x 11 inches, 216 x 279 mm - \value Tabloid 279 x 432 mm + \value Ledger 431.8 x 279.4 mm + \value Legal 8.5 x 14 inches, 215.9 x 355.6 mm + \value Letter 8.5 x 11 inches, 215.9 x 279.4 mm + \value Tabloid 279.4 x 431.8 mm \value Custom Unknown, or a user defined size. With setFullPage(false) (the default), the metrics will be a bit diff --git a/src/gui/painting/qregion_s60.cpp b/src/gui/painting/qregion_s60.cpp index 4504118..4d96910 100644 --- a/src/gui/painting/qregion_s60.cpp +++ b/src/gui/painting/qregion_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 3fd1ffb..89df869 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -92,8 +92,8 @@ void QTextureGlyphCache::populate(const QTextItemInt &ti, int glyph_height = metrics.height.ceil().toInt(); if (glyph_height == 0 || glyph_width == 0) continue; - glyph_width += margin * 2 + 2; - glyph_height += margin * 2 + 2; + glyph_width += margin * 2 + 4; + glyph_height += margin * 2 + 4; // align to 8-bit boundary if (m_type == QFontEngineGlyphCache::Raster_Mono) glyph_width = (glyph_width+7)&~7; @@ -189,7 +189,11 @@ void QImageTextureGlyphCache::createTextureData(int width, int height) int QImageTextureGlyphCache::glyphMargin() const { +#ifdef Q_WS_MAC return 2; +#else + return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0; +#endif } void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g) diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 2618ce2..2a20b44 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/painting/qwindowsurface_s60_p.h b/src/gui/painting/qwindowsurface_s60_p.h index 7b70fd5..40a866d 100644 --- a/src/gui/painting/qwindowsurface_s60_p.h +++ b/src/gui/painting/qwindowsurface_s60_p.h @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 86653df..0e54af8 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -940,10 +940,6 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, case PE_FrameLineEdit: { GtkWidget *gtkEntry = QGtk::gtkWidget(QLS("GtkEntry")); - if (option->state & State_HasFocus) - GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS); - else - GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS); gboolean interior_focus; gint focus_line_width; @@ -957,6 +953,9 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, if (!interior_focus && option->state & State_HasFocus) rect.adjust(focus_line_width, focus_line_width, -focus_line_width, -focus_line_width); + + if (option->state & State_HasFocus) + GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS); gtkPainter.paintShadow(gtkEntry, "entry", rect, option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, gtkEntry->style, @@ -965,6 +964,9 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, gtkPainter.paintShadow(gtkEntry, "entry", option->rect, option->state & State_Enabled ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, gtkEntry->style, QLS("GtkEntryShadowIn")); + + if (option->state & State_HasFocus) + GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS); } break; @@ -1050,17 +1052,13 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, GTK_WIDGET_SET_FLAGS(gtkButton, GTK_HAS_DEFAULT); gtkPainter.paintBox(gtkButton, "buttondefault", buttonRect, state, GTK_SHADOW_IN, style, isDefault ? QLS("d") : QString()); - } else - GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_DEFAULT); + } bool hasFocus = option->state & State_HasFocus; if (hasFocus) { key += QLS("def"); GTK_WIDGET_SET_FLAGS(gtkButton, GTK_HAS_FOCUS); - - } else { - GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_FOCUS); } if (!interiorFocus) @@ -1071,6 +1069,10 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, gtkPainter.paintBox(gtkButton, "button", buttonRect, state, shadow, style, key); + if (isDefault) + GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_DEFAULT); + if (hasFocus) + GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_FOCUS); } break; @@ -1334,6 +1336,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom GtkWidget *gtkToggleButton = QGtk::gtkWidget(buttonPath); QGtk::gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); if (gtkToggleButton && (appears_as_list || comboBox->editable)) { + if (focus) + GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS); // Draw the combo box as a line edit with a button next to it if (comboBox->editable || appears_as_list) { GtkStateType frameState = (state == GTK_STATE_PRELIGHT) ? GTK_STATE_NORMAL : state; @@ -1347,22 +1351,16 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom else frameRect.setRight(arrowButtonRect.left()); - // Required for inner blue highlight with clearlooks - if (focus) { - GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS); - GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS); - - } else { - GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS); - GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS); - } - // Fill the line edit background // We could have used flat_box with "entry_bg" but that is probably not worth the overhead uint resolve_mask = option->palette.resolve(); int xt = gtkEntry->style->xthickness; int yt = gtkEntry->style->ythickness; QRect contentRect = frameRect.adjusted(xt, yt, -xt, -yt); + // Required for inner blue highlight with clearlooks + if (focus) + GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS); + if (widget && widget->testAttribute(Qt::WA_SetPalette) && resolve_mask & (1 << QPalette::Base)) // Palette overridden by user p->fillRect(contentRect, option->palette.base().color()); @@ -1376,6 +1374,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom GTK_SHADOW_IN, gtkEntry->style, entryPath + QString::number(focus) + QString::number(comboBox->editable) + QString::number(option->direction)); + if (focus) + GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS); } GtkStateType buttonState = GTK_STATE_NORMAL; @@ -1394,22 +1394,21 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom gtkCachedPainter.paintBox( gtkToggleButton, "button", arrowButtonRect, buttonState, shadow, gtkToggleButton->style, buttonPath + QString::number(focus) + QString::number(option->direction)); - + if (focus) + GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS); } else { // Draw combo box as a button QRect buttonRect = option->rect; - if (focus) { // Clearlooks actually check the widget for the default state + if (focus) // Clearlooks actually check the widget for the default state GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS); - - } else { - GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS); - } - gtkCachedPainter.paintBox(gtkToggleButton, "button", buttonRect, state, shadow, gtkToggleButton->style, buttonPath + QString::number(focus)); + if (focus) + GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS); + // Draw the separator between label and arrows QString vSeparatorPath = buttonPath + QLS(".GtkHBox.GtkVSeparator"); @@ -1775,15 +1774,12 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom shadow = GTK_SHADOW_IN; style = gtkPainter.getStyle(gtkSpinButton); - if (option->state & State_HasFocus) - GTK_WIDGET_SET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS); - else - GTK_WIDGET_UNSET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS); QString key; - - if (option->state & State_HasFocus) + if (option->state & State_HasFocus) { key = QLS("f"); + GTK_WIDGET_SET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS); + } uint resolve_mask = option->palette.resolve(); @@ -1816,6 +1812,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style, key); else gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style, key); + + if (option->state & State_HasFocus) + GTK_WIDGET_UNSET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS); } if (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) { @@ -2344,7 +2343,7 @@ void QGtkStyle::drawControl(ControlElement element, case CE_SizeGrip: { GtkWidget *gtkStatusbar = QGtk::gtkWidget(QLS("GtkStatusbar.GtkFrame")); QRect gripRect = option->rect.adjusted(0, 0, -gtkStatusbar->style->xthickness, -gtkStatusbar->style->ythickness); - gtkPainter.paintResizeGrip( gtkStatusbar, "window", gripRect, GTK_STATE_NORMAL, + gtkPainter.paintResizeGrip( gtkStatusbar, "statusbar", gripRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, QApplication::isRightToLeft() ? GDK_WINDOW_EDGE_SOUTH_WEST : GDK_WINDOW_EDGE_SOUTH_EAST, gtkStatusbar->style); diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 071b60a..83f5a6b 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -20,7 +50,6 @@ #include "qcalendarwidget.h" #include "qdial.h" #include "qdialog.h" -#include "qerrormessage.h" #include "qgroupbox.h" #include "qheaderview.h" #include "qlist.h" @@ -28,7 +57,6 @@ #include "qlistview.h" #include "qmenu.h" #include "qmenubar.h" -#include "qmessagebox.h" #include "qpushbutton.h" #include "qscrollarea.h" #include "qscrollbar.h" @@ -57,7 +85,6 @@ const QS60StylePrivate::SkinElementFlags QS60StylePrivate::KDefaultSkinElementFl static const QByteArray propertyKeyLayouts = "layouts"; static const QByteArray propertyKeyCurrentlayout = "currentlayout"; -#if defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** {240,320,1,14,true,QLatin1String("QVGA Landscape Mirrored")}, @@ -87,15 +114,16 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { {7,0,-909,0,0,2,0,0,-1,20,52,28,19,19,9,258,-909,-909,-909,29,19,6,0,0,32,-909,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,98,35,98,5,5,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,2,-909,-909,-909,-909,7,7,3,1}, {7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,-909,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,5,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,8,6,5,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1}, {7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,-909,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1} - - // *** End of generated data *** }; const short *QS60StylePrivate::m_pmPointer = QS60StylePrivate::data[0]; -#endif // defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) -bool QS60StylePrivate::m_backgroundValid = false; +// theme background texture +QPixmap *QS60StylePrivate::m_background = 0; + +// theme palette +QPalette *QS60StylePrivate::m_themePalette = 0; const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameElementsData[] = { {SE_ButtonNormal, QS60StyleEnums::SP_QsnFrButtonTbCenter}, @@ -113,10 +141,18 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme {SE_PanelBackground, QS60StyleEnums::SP_QsnFrSetOptCenter}, {SE_ButtonInactive, QS60StyleEnums::SP_QsnFrButtonCenterInactive}, }; + static const int frameElementsCount = int(sizeof(QS60StylePrivate::m_frameElementsData)/sizeof(QS60StylePrivate::m_frameElementsData[0])); -const int KNotFound = -1; +const int KNotFound = -909; +const double KTabFontMul = 0.72; + +QS60StylePrivate::~QS60StylePrivate() +{ + clearCaches(); //deletes also background image + delete m_themePalette; +} void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, const QRect &rect, SkinElementFlags flags) @@ -251,10 +287,16 @@ void QS60StylePrivate::drawSkinPart(QS60StyleEnums::SkinParts part, drawPart(part, painter, rect, flags); } +short QS60StylePrivate::pixelMetric(int metric) +{ + Q_ASSERT(metric < MAX_PIXELMETRICS); + const short returnValue = m_pmPointer[metric]; + return returnValue; +} + void QS60StylePrivate::setStyleProperty(const char *name, const QVariant &value) { if (name == propertyKeyCurrentlayout) { -#if !defined(QT_WS_S60) || defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) static const QStringList layouts = styleProperty(propertyKeyLayouts).toStringList(); const QString layout = value.toString(); Q_ASSERT(layouts.contains(layout)); @@ -263,30 +305,22 @@ void QS60StylePrivate::setStyleProperty(const char *name, const QVariant &value) QApplication::setLayoutDirection(m_layoutHeaders[layoutIndex].mirroring ? Qt::RightToLeft : Qt::LeftToRight); clearCaches(); refreshUI(); - return; -#else - qFatal("Cannot set static layout. Dynamic layouts are used!"); -#endif } } QVariant QS60StylePrivate::styleProperty(const char *name) const { if (name == propertyKeyLayouts) { -#if !defined(QT_WS_S60) || defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) static QStringList layouts; if (layouts.isEmpty()) for (int i = 0; i < QS60StylePrivate::m_numberOfLayouts; i++) layouts.append(QS60StylePrivate::m_layoutHeaders[i].layoutName); return layouts; -#else - qFatal("Cannot return list of 'canned' static layouts. Dynamic layouts are used!"); -#endif } return QVariant(); } -QColor QS60StylePrivate::stateColor(const QColor& color, const QStyleOption *option) +QColor QS60StylePrivate::stateColor(const QColor &color, const QStyleOption *option) { QColor retColor (color); if (option && !(option->state & QStyle::State_Enabled)) { @@ -322,8 +356,7 @@ QColor QS60StylePrivate::lighterColor(const QColor &baseColor) bool QS60StylePrivate::drawsOwnThemeBackground(const QWidget *widget) { - return (qobject_cast<const QMessageBox *> (widget) || - qobject_cast<const QErrorMessage *> (widget)); + return qobject_cast<const QDialog *> (widget); } QFont QS60StylePrivate::s60Font( @@ -352,30 +385,31 @@ QFont QS60StylePrivate::s60Font( void QS60StylePrivate::clearCaches(QS60StylePrivate::CacheClearReason reason) { - switch(reason){ + switch(reason){ case CC_LayoutChange: // when layout changes, the colors remain in cache, but graphics and fonts can change m_mappedFontsCache.clear(); - m_backgroundValid = false; + deleteBackground(); QPixmapCache::clear(); break; case CC_ThemeChange: m_colorCache.clear(); QPixmapCache::clear(); - m_backgroundValid = false; + deleteBackground(); + break; case CC_UndefinedChange: default: m_colorCache.clear(); m_mappedFontsCache.clear(); QPixmapCache::clear(); - m_backgroundValid = false; + deleteBackground(); break; - } + } } // Since S60Style has 'button' and 'tooltip' as a graphic, we don't have any native color which to use -// for QPalette::Button and QPalette::ToolTipBase. Therefore we need to guesstimate -// this by calculating average rgb values for button pixels. +// for QPalette::Button and QPalette::ToolTipBase. Therefore S60Style needs to guesstimate +// palette colors by calculating average rgb values for button pixels. // Returns Qt::black if there is an issue with the graphics (image is NULL, or no bits() found). QColor QS60StylePrivate::colorFromFrameGraphics(QS60StylePrivate::SkinFrameElements frame) const { @@ -440,116 +474,18 @@ void QS60StylePrivate::setThemePalette(QApplication *app) const return; QPalette widgetPalette = QPalette(Qt::white); - - // basic colors - widgetPalette.setColor(QPalette::WindowText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::Text, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::ToolTipText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 55, 0)); - widgetPalette.setColor(QPalette::BrightText, widgetPalette.color(QPalette::WindowText).lighter()); - widgetPalette.setColor(QPalette::HighlightedText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0)); - widgetPalette.setColor(QPalette::Link, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 3, 0)); - widgetPalette.setColor(QPalette::LinkVisited, widgetPalette.color(QPalette::Link).darker()); - widgetPalette.setColor(QPalette::Highlight, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 2, 0)); - // set these as transparent so that styled full screen theme background is visible - widgetPalette.setColor(QPalette::AlternateBase, Qt::transparent); - widgetPalette.setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture()); - widgetPalette.setColor(QPalette::Base, Qt::transparent); - // set button and tooltipbase based on pixel colors - const QColor buttonColor = colorFromFrameGraphics(QS60StylePrivate::SF_ButtonNormal); - widgetPalette.setColor(QPalette::Button, buttonColor ); - widgetPalette.setColor(QPalette::Light, widgetPalette.color(QPalette::Button).lighter()); - widgetPalette.setColor(QPalette::Dark, widgetPalette.color(QPalette::Button).darker()); - widgetPalette.setColor(QPalette::Midlight, widgetPalette.color(QPalette::Button).lighter(125)); - widgetPalette.setColor(QPalette::Mid, widgetPalette.color(QPalette::Button).darker(150)); - widgetPalette.setColor(QPalette::Shadow, Qt::black); - QColor toolTipColor = colorFromFrameGraphics(QS60StylePrivate::SF_ToolTip); - widgetPalette.setColor(QPalette::ToolTipBase, toolTipColor ); - + setThemePalette(&widgetPalette); app->setPalette(widgetPalette); } -void QS60StylePrivate::setThemePalette(QWidget *widget) const +void QS60StylePrivate::setThemePalette(QStyleOption *option) const { - if(!widget) - return; - QPalette widgetPalette = widget->palette(); + setThemePalette(&option->palette); +} - // widget specific colors and fonts - if (qobject_cast<QSlider *>(widget)){ - widgetPalette.setColor(QPalette::All, QPalette::WindowText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0)); - QApplication::setPalette(widgetPalette, "QSlider"); - } else if (qobject_cast<QPushButton *>(widget)){ - const QFont suggestedFont = s60Font( - QS60StyleEnums::FC_Primary, widget->font().pointSizeF()); - widget->setFont(suggestedFont); - widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - const QStyleOption opt; - widgetPalette.setColor(QPalette::Disabled, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, &opt)); - QApplication::setPalette(widgetPalette, "QPushButton"); - } else if (qobject_cast<QToolButton *>(widget)){ - const QFont suggestedFont = s60Font( - QS60StyleEnums::FC_Primary, widget->font().pointSizeF()); - widget->setFont(suggestedFont); - widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - QApplication::setPalette(widgetPalette, "QToolButton"); - } else if (qobject_cast<QHeaderView *>(widget)){ - const QFont suggestedFont = s60Font( - QS60StyleEnums::FC_Secondary, widget->font().pointSizeF()); - widget->setFont(suggestedFont); - widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0)); - QHeaderView* header = qobject_cast<QHeaderView *>(widget); - widgetPalette.setColor(QPalette::Button, Qt::transparent ); - if ( header->viewport() ) - header->viewport()->setPalette(widgetPalette); - QApplication::setPalette(widgetPalette, "QHeaderView"); - } else if (qobject_cast<QMenuBar *>(widget)){ - widgetPalette.setColor(QPalette::All, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0)); - QApplication::setPalette(widgetPalette, "QMenuBar"); - } else if (qobject_cast<QTabBar *>(widget)){ - widgetPalette.setColor(QPalette::Active, QPalette::WindowText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0)); - QApplication::setPalette(widgetPalette, "QTabBar"); - } else if (qobject_cast<QTableView *>(widget)){ - widgetPalette.setColor(QPalette::All, QPalette::Text, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0)); - QApplication::setPalette(widgetPalette, "QTableView"); - } else if (qobject_cast<QGroupBox *>(widget)){ - const QFont suggestedFont = s60Font( - QS60StyleEnums::FC_Title, widget->font().pointSizeF()); - widget->setFont(suggestedFont); - } else if (qobject_cast<QLineEdit *>(widget)) { - widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); - QApplication::setPalette(widgetPalette, "QLineEdit"); - } else if (qobject_cast<QDial *> (widget)) { - const QColor color(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::WindowText, color); - widgetPalette.setColor(QPalette::Button, QApplication::palette().color(QPalette::Button)); - widgetPalette.setColor(QPalette::Dark, color.darker()); - widgetPalette.setColor(QPalette::Light, color.lighter()); - QApplication::setPalette(widgetPalette, "QDial"); - } else if (qobject_cast<QScrollArea *>(widget)) { - widgetPalette.setBrush(QPalette::Window, QBrush()); - QApplication::setPalette(widgetPalette, "QScrollArea"); - } +QPalette* QS60StylePrivate::themePalette() +{ + return m_themePalette; } void QS60StylePrivate::setBackgroundTexture(QApplication *app) const @@ -561,18 +497,23 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const app->setPalette(applicationPalette); } +void QS60StylePrivate::deleteBackground() +{ + if (QS60StylePrivate::m_background) { + delete QS60StylePrivate::m_background; + QS60StylePrivate::m_background = 0; + } +} + int QS60StylePrivate::focusRectPenWidth() { return pixelMetric(QS60Style::PM_DefaultFrameWidth); } -#if !defined(QT_WS_S60) || defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) void QS60StylePrivate::setCurrentLayout(int index) { m_pmPointer = data[index]; } -#endif - void QS60StylePrivate::drawPart(QS60StyleEnums::SkinParts skinPart, QPainter *painter, const QRect &rect, SkinElementFlags flags) @@ -616,11 +557,11 @@ void QS60StylePrivate::drawRow(QS60StyleEnums::SkinParts start, QRect endRect; if (orientation == Qt::Horizontal) { - startRect.setWidth(qMin(rect.width() / 2 - 1, startRect.width())); + startRect.setWidth(qMin(rect.width() >>1 - 1, startRect.width())); endRect = startRect.translated(rect.width() - startRect.width(), 0); middleRect.adjust(startRect.width(), 0, -startRect.width(), 0); } else { - startRect.setHeight(qMin(rect.height() / 2 - 1, startRect.height())); + startRect.setHeight(qMin(rect.height() >>1 - 1, startRect.height())); endRect = startRect.translated(0, rect.height() - startRect.height()); middleRect.adjust(0, startRect.height(), 0, -startRect.height()); } @@ -669,15 +610,182 @@ QPixmap QS60StylePrivate::cachedFrame(SkinFrameElements frame, const QSize &size void QS60StylePrivate::refreshUI() { - foreach (QWidget *topLevelWidget, QApplication::allWidgets()) { - topLevelWidget->updateGeometry(); - //todo: study how we can get rid of this. Apparently scrollbars cache pixelmetrics values, and we need them to update themselves - // maybe styleChanged event is enough? - //QCoreApplication::postEvent(topLevelWidget, new QEvent(QEvent::StyleChange)); - QCoreApplication::postEvent(topLevelWidget, new QResizeEvent(topLevelWidget->size(), topLevelWidget->size())); + QList<QWidget *> widgets = QApplication::allWidgets(); + + for (int i = 0; i < widgets.size(); ++i) { + QWidget *widget = widgets.at(i); + if (widget == 0) + continue; + + if (widget->style()) { + widget->style()->polish(widget); + QEvent event(QEvent::StyleChange); + qApp->sendEvent(widget, &event); + } + widget->update(); + widget->updateGeometry(); } } +void QS60StylePrivate::setFont(QWidget *widget) const +{ + QS60StyleEnums::FontCategories fontCategory = QS60StyleEnums::FC_Undefined; + if (!widget) + return; + if (qobject_cast<QPushButton *>(widget)){ + fontCategory = QS60StyleEnums::FC_Primary; + } else if (qobject_cast<QToolButton *>(widget)){ + fontCategory = QS60StyleEnums::FC_Primary; + } else if (qobject_cast<QHeaderView *>(widget)){ + fontCategory = QS60StyleEnums::FC_Secondary; + } else if (qobject_cast<QGroupBox *>(widget)){ + fontCategory = QS60StyleEnums::FC_Title; + } + if (fontCategory != QS60StyleEnums::FC_Undefined) { + const QFont suggestedFont = + s60Font(fontCategory, widget->font().pointSizeF()); + widget->setFont(suggestedFont); + } +} + +void QS60StylePrivate::setThemePalette(QWidget *widget) const +{ + if(!widget) + return; + QPalette widgetPalette = widget->palette(); + + //header view and its viewport need to be set 100% transparent button color, since drawing code will + //draw transparent theme graphics to table column and row headers. + if (qobject_cast<QHeaderView *>(widget)){ + widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0)); + QHeaderView* header = qobject_cast<QHeaderView *>(widget); + widgetPalette.setColor(QPalette::Button, Qt::transparent ); + if ( header->viewport() ) + header->viewport()->setPalette(widgetPalette); + QApplication::setPalette(widgetPalette, "QHeaderView"); + } +} + +void QS60StylePrivate::setThemePalette(QPalette *palette) const +{ + if (!palette) + return; + + // basic colors + palette->setColor(QPalette::WindowText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); + palette->setColor(QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); + palette->setColor(QPalette::Text, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); + palette->setColor(QPalette::ToolTipText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 55, 0)); + palette->setColor(QPalette::BrightText, palette->color(QPalette::WindowText).lighter()); + palette->setColor(QPalette::HighlightedText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0)); + palette->setColor(QPalette::Link, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 3, 0)); + palette->setColor(QPalette::LinkVisited, palette->color(QPalette::Link).darker()); + palette->setColor(QPalette::Highlight, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 2, 0)); + // set background image as a texture brush + palette->setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture()); + // set these as transparent so that styled full screen theme background is visible + palette->setColor(QPalette::AlternateBase, Qt::transparent); + palette->setBrush(QPalette::Base, Qt::transparent); + // set button and tooltipbase based on pixel colors + const QColor buttonColor = this->colorFromFrameGraphics(QS60StylePrivate::SF_ButtonNormal); + palette->setColor(QPalette::Button, buttonColor ); + const QColor toolTipColor = this->colorFromFrameGraphics(QS60StylePrivate::SF_ToolTip); + palette->setColor(QPalette::ToolTipBase, toolTipColor ); + palette->setColor(QPalette::Light, palette->color(QPalette::Button).lighter()); + palette->setColor(QPalette::Dark, palette->color(QPalette::Button).darker()); + palette->setColor(QPalette::Midlight, palette->color(QPalette::Button).lighter(125)); + palette->setColor(QPalette::Mid, palette->color(QPalette::Button).darker(150)); + palette->setColor(QPalette::Shadow, Qt::black); + + setThemePaletteHash(palette); + QS60StylePrivate::storeThemePalette(palette); +} + +void QS60StylePrivate::storeThemePalette(QPalette *palette) +{ + //store specified palette for latter use. + if (m_themePalette) { + delete m_themePalette; + m_themePalette = 0; + } + m_themePalette = new QPalette(*palette); +} + +// set widget specific palettes +void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const +{ + if (!palette) + return; + + //store the original palette + QPalette widgetPalette = *palette; + const QColor mainAreaTextColor = + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0); + + widgetPalette.setColor(QPalette::All, QPalette::WindowText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0)); + QApplication::setPalette(widgetPalette, "QSlider"); + // return to original palette after each widget + widgetPalette = *palette; + + widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, mainAreaTextColor); + widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, mainAreaTextColor); + const QStyleOption opt; + widgetPalette.setColor(QPalette::Disabled, QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, &opt)); + QApplication::setPalette(widgetPalette, "QPushButton"); + widgetPalette = *palette; + + widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, mainAreaTextColor); + widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, mainAreaTextColor); + QApplication::setPalette(widgetPalette, "QToolButton"); + widgetPalette = *palette; + + widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0)); + QApplication::setPalette(widgetPalette, "QHeaderView"); + widgetPalette = *palette; + + widgetPalette.setColor(QPalette::All, QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0)); + QApplication::setPalette(widgetPalette, "QMenuBar"); + widgetPalette = *palette; + + widgetPalette.setColor(QPalette::Active, QPalette::WindowText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0)); + QApplication::setPalette(widgetPalette, "QTabBar"); + widgetPalette = *palette; + + widgetPalette.setColor(QPalette::All, QPalette::Text, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0)); + QApplication::setPalette(widgetPalette, "QTableView"); + widgetPalette = *palette; + + widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); + QApplication::setPalette(widgetPalette, "QLineEdit"); + widgetPalette = *palette; + + widgetPalette.setColor(QPalette::WindowText, mainAreaTextColor); + widgetPalette.setColor(QPalette::Button, QApplication::palette().color(QPalette::Button)); + widgetPalette.setColor(QPalette::Dark, mainAreaTextColor.darker()); + widgetPalette.setColor(QPalette::Light, mainAreaTextColor.lighter()); + QApplication::setPalette(widgetPalette, "QDial"); + widgetPalette = *palette; + + widgetPalette.setBrush(QPalette::Window, QBrush()); + QApplication::setPalette(widgetPalette, "QScrollArea"); + widgetPalette = *palette; +} + QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlags flags) { QSize result(20, 20); @@ -753,14 +861,6 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag \sa QMacStyle, QWindowsStyle, QWindowsXPStyle, QWindowsVistaStyle, QPlastiqueStyle, QCleanlooksStyle, QMotifStyle */ -/*! - Constructs a QS60Style object. -*/ -QS60Style::QS60Style() - : QCommonStyle(*new QS60StylePrivate) -{ -} - QS60Style::~QS60Style() { } @@ -786,7 +886,7 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom horizontal ? QS60StylePrivate::SE_ScrollBarGrooveHorizontal : QS60StylePrivate::SE_ScrollBarGrooveVertical; QS60StylePrivate::drawSkinElement(grooveElement, painter, grooveRect, flags); - QStyle::SubControls subControls = optionSlider->subControls; + const QStyle::SubControls subControls = optionSlider->subControls; // select correct slider (horizontal/vertical/pressed) const bool sliderPressed = ((optionSlider->state & QStyle::State_Sunken) && (subControls & SC_ScrollBarSlider)); @@ -838,7 +938,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { const QRect cmbxEditField = subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget); const QRect cmbxFrame = subControlRect(CC_ComboBox, option, SC_ComboBoxFrame, widget); - const bool direction = cmb->direction == Qt::LeftToRight; // Button frame @@ -856,8 +955,9 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom const QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_FrameLineEdit; QS60StylePrivate::drawSkinElement(skinElement, painter, cmbxEditField, flags); + // Draw the combobox arrow if (sub & SC_ComboBoxArrow) { - // Draw the little arrow + // Make rect slightly smaller buttonOption.rect.adjust(1, 1, -1, -1); painter->save(); painter->setPen(option->palette.buttonText().color()); @@ -998,14 +1098,13 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (spinBox->subControls & SC_SpinBoxUp) { copy.subControls = SC_SpinBoxUp; - QPalette pal2 = spinBox->palette; + QPalette spinBoxPal = spinBox->palette; if (!(spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) { - pal2.setCurrentColorGroup(QPalette::Disabled); + spinBoxPal.setCurrentColorGroup(QPalette::Disabled); copy.state &= ~State_Enabled; + copy.palette = spinBoxPal; } - copy.palette = pal2; - if (spinBox->activeSubControls == SC_SpinBoxUp && (spinBox->state & State_Sunken)) { copy.state |= State_On; copy.state |= State_Sunken; @@ -1013,8 +1112,9 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom copy.state |= State_Raised; copy.state &= ~State_Sunken; } - pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus - : PE_IndicatorSpinUp); + pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) ? + PE_IndicatorSpinPlus : + PE_IndicatorSpinUp; copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget); drawPrimitive(PE_PanelButtonBevel, ©, painter, widget); @@ -1025,12 +1125,12 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (spinBox->subControls & SC_SpinBoxDown) { copy.subControls = SC_SpinBoxDown; copy.state = spinBox->state; - QPalette pal2 = spinBox->palette; + QPalette spinBoxPal = spinBox->palette; if (!(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) { - pal2.setCurrentColorGroup(QPalette::Disabled); + spinBoxPal.setCurrentColorGroup(QPalette::Disabled); copy.state &= ~State_Enabled; + copy.palette = spinBoxPal; } - copy.palette = pal2; if (spinBox->activeSubControls == SC_SpinBoxDown && (spinBox->state & State_Sunken)) { copy.state |= State_On; @@ -1039,8 +1139,9 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom copy.state |= State_Raised; copy.state &= ~State_Sunken; } - pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus - : PE_IndicatorSpinDown); + pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) ? + PE_IndicatorSpinMinus : + PE_IndicatorSpinDown; copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget); drawPrimitive(PE_PanelButtonBevel, ©, painter, widget); @@ -1100,15 +1201,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom } break; #endif //QT_NO_GROUPBOX -#ifndef QT_NO_DIAL - case CC_Dial: - if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - QStyleOptionSlider optionSlider = *slider; - QCommonStyle::drawComplexControl(control, &optionSlider, painter, widget); - } - break; -#endif //QT_NO_DIAL - default: QCommonStyle::drawComplexControl(control, option, painter, widget); } @@ -1166,24 +1258,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); } break; - case CE_PushButtonLabel: - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - QStyleOptionButton optionButton = *button; - QCommonStyle::drawControl(element, &optionButton, painter, widget); - } - break; - case CE_CheckBoxLabel: - if (const QStyleOptionButton *checkBox = qstyleoption_cast<const QStyleOptionButton *>(option)) { - QStyleOptionButton optionCheckBox = *checkBox; - QCommonStyle::drawControl(element, &optionCheckBox, painter, widget); - } - break; - case CE_RadioButtonLabel: - if (const QStyleOptionButton *radioButton = qstyleoption_cast<const QStyleOptionButton *>(option)) { - QStyleOptionButton optionRadioButton = *radioButton; - QCommonStyle::drawControl(element, &optionRadioButton, painter, widget); - } - break; #ifndef QT_NO_TOOLBUTTON case CE_ToolButtonLabel: if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { @@ -1202,12 +1276,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } break; #endif //QT_NO_TOOLBUTTON - case CE_HeaderLabel: - if (const QStyleOptionHeader *headerLabel = qstyleoption_cast<const QStyleOptionHeader *>(option)) { - QStyleOptionHeader optionHeaderLabel = *headerLabel; - QCommonStyle::drawControl(element, &optionHeaderLabel, painter, widget); - } - break; #ifndef QT_NO_COMBOBOX case CE_ComboBoxLabel: if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { @@ -1281,13 +1349,12 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, // draw themed background for table unless background brush has been defined. if (vopt->backgroundBrush == Qt::NoBrush) { - // draw the background const QStyleOptionViewItemV4 *tableOption = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option); const QTableView *table = qobject_cast<const QTableView *>(widget); if (table && tableOption) { const QModelIndex index = tableOption->index; //todo: Draw cell background only once - for the first cell. - QStyleOptionViewItemV4 voptAdj2 = voptAdj2; + QStyleOptionViewItemV4 voptAdj2 = voptAdj; const QModelIndex indexFirst = table->model()->index(0,0); const QModelIndex indexLast = table->model()->index( table->model()->rowCount()-1,table->model()->columnCount()-1); @@ -1313,17 +1380,15 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, listView && (listView->selectionMode() == QAbstractItemView::SingleSelection || listView->selectionMode() == QAbstractItemView::NoSelection); - QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget); - if (voptAdj.state & QStyle::State_Selected && - !singleSelection) { + const QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget); + if (voptAdj.state & QStyle::State_Selected && !singleSelection) { QStyleOptionViewItemV4 option(voptAdj); option.rect = selectionRect; // Draw selection mark. drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, painter, widget); if ( textRect.right() > selectionRect.left() ) textRect.setRight(selectionRect.left()); - } - else if (singleSelection && + } else if (singleSelection && voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) { // draw the check mark if (selectionRect.isValid()) { @@ -1352,9 +1417,11 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, const QStyleOptionViewItemV4 *tableOption = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option); if (isSelected) { if (qobject_cast<const QTableView *>(widget) && tableOption) - voptAdj.palette.setColor(QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 11, 0)); + voptAdj.palette.setColor( + QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 11, 0)); else - voptAdj.palette.setColor(QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0)); + voptAdj.palette.setColor( + QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0)); } painter->setPen(voptAdj.palette.text().color()); d->viewItemDrawText(painter, &voptAdj, textRect); @@ -1452,7 +1519,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } painter->save(); QFont f = painter->font(); - f.setPointSizeF(f.pointSizeF() * 0.72); + f.setPointSizeF(f.pointSizeF() * KTabFontMul); painter->setFont(f); if (option->state & QStyle::State_Selected){ @@ -1460,27 +1527,27 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 3, option)); } - bool verticalTabs = optionTab.shape == QTabBar::RoundedEast + const bool verticalTabs = optionTab.shape == QTabBar::RoundedEast || optionTab.shape == QTabBar::RoundedWest || optionTab.shape == QTabBar::TriangularEast || optionTab.shape == QTabBar::TriangularWest; - bool selected = optionTab.state & State_Selected; + const bool selected = optionTab.state & State_Selected; if (verticalTabs) { painter->save(); - int newX, newY, newRot; + int newX, newY, newRotation; if (optionTab.shape == QTabBar::RoundedEast || optionTab.shape == QTabBar::TriangularEast) { newX = tr.width(); newY = tr.y(); - newRot = 90; + newRotation = 90; } else { newX = 0; newY = tr.y() + tr.height(); - newRot = -90; + newRotation = -90; } tr.setRect(0, 0, tr.height(), tr.width()); QTransform m; m.translate(newX, newY); - m.rotate(newRot); + m.rotate(newRotation); painter->setTransform(m, true); } tr.adjust(0, 0, pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget), @@ -1502,9 +1569,13 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QPixmap tabIcon = optionTab.icon.pixmap(iconSize, (optionTab.state & State_Enabled) ? QIcon::Normal : QIcon::Disabled); if (tab->text.isEmpty()) - painter->drawPixmap(tr.center().x() - (tabIcon.height() >>1), tr.center().y() - (tabIcon.height() >>1), tabIcon); + painter->drawPixmap(tr.center().x() - (tabIcon.height() >>1), + tr.center().y() - (tabIcon.height() >>1), + tabIcon); else - painter->drawPixmap(tr.left() + tabOverlap, tr.center().y() - (tabIcon.height() >>1), tabIcon); + painter->drawPixmap(tr.left() + tabOverlap, + tr.center().y() - (tabIcon.height() >>1), + tabIcon); tr.setLeft(tr.left() + iconSize.width() + 4); } @@ -1514,13 +1585,13 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (optionTab.state & State_HasFocus) { const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth); - const int x1 = optionTab.rect.left(); - const int x2 = optionTab.rect.right() - 1; + const int leftBorder = optionTab.rect.left(); + const int rightBorder = optionTab.rect.right() - 1; QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*tab); - fropt.rect.setRect(x1 + 1 + OFFSET, optionTab.rect.y() + OFFSET, - x2 - x1 - 2*OFFSET, optionTab.rect.height() - 2*OFFSET); + fropt.rect.setRect(leftBorder + 1 + OFFSET, optionTab.rect.y() + OFFSET, + rightBorder - leftBorder - 2*OFFSET, optionTab.rect.height() - 2*OFFSET); drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); } @@ -1570,31 +1641,12 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } break; #endif // QT_NO_PROGRESSBAR -#ifndef QT_NO_MENUBAR - case CE_MenuBarItem: - if (const QStyleOptionMenuItem *menuBarItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { - QStyleOptionMenuItem optionMenuBarItem = *menuBarItem; - QCommonStyle::drawControl(element, &optionMenuBarItem, painter, widget); - } - break; -#endif //QT_NO_MENUBAR #ifndef QT_NO_MENU case CE_MenuItem: if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { QStyleOptionMenuItem optionMenuItem = *menuItem; - const bool enabled = optionMenuItem.state & State_Enabled; - const bool checkable = optionMenuItem.checkType != QStyleOptionMenuItem::NotCheckable; - - uint text_flags = Qt::AlignLeading | Qt::TextShowMnemonic | Qt::TextDontClip - | Qt::TextSingleLine | Qt::AlignVCenter; - if (!styleHint(SH_UnderlineShortcut, menuItem, widget)) - text_flags |= Qt::TextHideMnemonic; - - QRect iconRect = - subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget); - QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget); + bool drawSubMenuIndicator = false; - switch(menuItem->menuItemType) { case QStyleOptionMenuItem::Scroller: case QStyleOptionMenuItem::Separator: @@ -1605,20 +1657,29 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, default: break; } + const bool enabled = optionMenuItem.state & State_Enabled; + const bool checkable = optionMenuItem.checkType != QStyleOptionMenuItem::NotCheckable; + + uint text_flags = Qt::AlignLeading | Qt::TextShowMnemonic | Qt::TextDontClip + | Qt::TextSingleLine | Qt::AlignVCenter; + if (!styleHint(SH_UnderlineShortcut, menuItem, widget)) + text_flags |= Qt::TextHideMnemonic; + + QRect iconRect = + subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget); + QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget); if ((option->state & State_Selected) && (option->state & State_Enabled)) QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags); //todo: move the vertical spacing stuff into subElementRect const int vSpacing = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutVerticalSpacing); - QStyleOptionMenuItem optionCheckBox; if (checkable){ - QRect checkBoxRect = optionMenuItem.rect; - checkBoxRect.setWidth(pixelMetric(PM_IndicatorWidth)); - checkBoxRect.setHeight(pixelMetric(PM_IndicatorHeight)); + QStyleOptionMenuItem optionCheckBox; optionCheckBox.QStyleOption::operator=(*menuItem); - optionCheckBox.rect = checkBoxRect; - const int moveByX = checkBoxRect.width()+vSpacing; + optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth)); + optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight)); + const int moveByX = optionCheckBox.rect.width()+vSpacing; if (optionMenuItem.direction == Qt::LeftToRight) { textRect.translate(moveByX,0); iconRect.translate(moveByX, 0); @@ -1669,20 +1730,18 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, optionMenuItem.palette.color(QPalette::Disabled, QPalette::Text))); painter->save(); painter->setOpacity(0.5); - QCommonStyle::drawItemText(painter, textRect, text_flags, + } + QCommonStyle::drawItemText(painter, textRect, text_flags, optionMenuItem.palette, enabled, optionMenuItem.text, QPalette::Text); + if (!enabled) painter->restore(); - } else { - QCommonStyle::drawItemText(painter, textRect, text_flags, - optionMenuItem.palette, enabled, - optionMenuItem.text, QPalette::Text); - } } break; + case CE_MenuEmptyArea: + break; #endif //QT_NO_MENU - case CE_MenuEmptyArea: #ifndef QT_NO_MENUBAR case CE_MenuBarEmptyArea: break; @@ -1712,19 +1771,19 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, case CE_HeaderEmptyArea: { QS60StylePrivate::SkinElementFlags adjFlags = flags; - QRect mtyRect = option->rect; + QRect emptyAreaRect = option->rect; if (option->state & QStyle::State_Horizontal) { - mtyRect.adjust(-2,-2,2,-2); + emptyAreaRect.adjust(-2,-2,2,-2); } else { if ( option->direction == Qt::LeftToRight ) { - mtyRect.adjust(-2,-2,0,2); + emptyAreaRect.adjust(-2,-2,0,2); adjFlags |= QS60StylePrivate::SF_PointWest; } else { - mtyRect.adjust(2,2,0,-2); + emptyAreaRect.adjust(2,2,0,-2); adjFlags |= QS60StylePrivate::SF_PointEast; } } - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, mtyRect, adjFlags); + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, emptyAreaRect, adjFlags); } break; case CE_Header: @@ -1744,7 +1803,19 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } } QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, mtyRect, adjFlags); - QCommonStyle::drawControl(element, header, painter, widget); + + QRegion clipRegion = painter->clipRegion(); + painter->setClipRect(option->rect); + drawControl(CE_HeaderSection, header, painter, widget); + QStyleOptionHeader subopt = *header; + subopt.rect = subElementRect(SE_HeaderLabel, header, widget); + if (subopt.rect.isValid()) + drawControl(CE_HeaderLabel, &subopt, painter, widget); + if (header->sortIndicator != QStyleOptionHeader::None) { + subopt.rect = subElementRect(SE_HeaderArrow, option, widget); + drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget); + } + painter->setClipRegion(clipRegion); } break; #ifndef QT_NO_TOOLBAR @@ -1752,6 +1823,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) { const QToolBar *tbWidget = qobject_cast<const QToolBar *>(widget); + //toolbar within a toolbar, skip if (!tbWidget || (widget && qobject_cast<QToolBar *>(widget->parentWidget()))) break; @@ -1789,49 +1861,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } break; #endif //QT_NO_TOOLBAR - - //todo: remove non-used widgets in final version - case CE_ShapedFrame: - case CE_MenuVMargin: - case CE_MenuHMargin: -#ifndef QT_NO_MENU - case CE_MenuScroller: - case CE_MenuTearoff: -#endif //QT_NO_MENU - - case CE_CheckBox: - case CE_RadioButton: -#ifndef QT_NO_TABBAR - case CE_TabBarTab: -#endif //QT_NO_TABBAR -#ifndef QT_NO_PROGRESSBAR - case CE_ProgressBar: -#endif // QT_NO_PROGRESSBAR - case CE_Q3DockWindowEmptyArea: -#ifndef QT_NO_SIZEGRIP - case CE_SizeGrip: -#endif //QT_NO_SIZEGRIP - case CE_Splitter: -#ifndef QT_NO_RUBBERBAND - case CE_RubberBand: -#endif //QT_NO_RUBBERBAND -#ifndef QT_NO_DOCKWIDGET - case CE_DockWidgetTitle: -#endif //QT_NO_DOCKWIDGET - case CE_ScrollBarAddLine: - case CE_ScrollBarSubLine: - case CE_ScrollBarAddPage: - case CE_ScrollBarSubPage: - case CE_ScrollBarSlider: - case CE_ScrollBarFirst: - case CE_ScrollBarLast: - case CE_FocusFrame: -#ifndef QT_NO_TOOLBOX - case CE_ToolBoxTab: - case CE_ToolBoxTabShape: - case CE_ToolBoxTabLabel: -#endif //QT_NO_TOOLBOX - case CE_ColumnViewGrip: default: QCommonStyle::drawControl(element, option, painter, widget); } @@ -1870,6 +1899,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti } break; case PE_IndicatorViewItemCheck: +#ifndef QT_NO_ITEMVIEWS if (const QListView *listItem = (qobject_cast<const QListView *>(widget))) { if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { const bool checkBoxVisible = vopt->features & QStyleOptionViewItemV2::HasCheckIndicator; @@ -1890,9 +1920,9 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti } } } +#endif //QT_NO_ITEMVIEWS break; - case PE_IndicatorRadioButton: - { + case PE_IndicatorRadioButton: { QRect buttonRect = option->rect; //there is empty (a. 33%) space in svg graphics for radiobutton const qreal reduceWidth = (qreal)buttonRect.width()/3.0; @@ -1915,8 +1945,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti case PE_PanelButtonCommand: case PE_PanelButtonTool: case PE_PanelButtonBevel: - case PE_FrameButtonBevel: - { + case PE_FrameButtonBevel: { const bool isPressed = option->state & QStyle::State_Sunken; const QS60StylePrivate::SkinElements skinElement = isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal; @@ -1927,8 +1956,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti case PE_IndicatorArrowDown: case PE_IndicatorArrowLeft: case PE_IndicatorArrowRight: - case PE_IndicatorArrowUp: - { + case PE_IndicatorArrowUp: { QS60StyleEnums::SkinParts skinPart; if (element==PE_IndicatorArrowDown) skinPart = QS60StyleEnums::SP_QgnGrafScrollArrowDown; @@ -1983,6 +2011,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti break; #endif //QT_NO_SPINBOX case PE_FrameFocusRect: +// Calendar widget and combox both do not use styled itemDelegate if (!(widget && qobject_cast<const QCalendarWidget *>(widget->parent())) || qobject_cast<const QComboBoxListView *>(widget)) { // no focus selection for touch @@ -2013,11 +2042,16 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti } break; case PE_Widget: - if (QS60StylePrivate::drawsOwnThemeBackground(widget) || - qobject_cast<const QComboBoxListView *>(widget) || - qobject_cast<const QMenu *> (widget)) { - QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_OptionsMenu; - QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); + if (QS60StylePrivate::drawsOwnThemeBackground(widget) +#ifndef QT_NO_COMBOBOX + || qobject_cast<const QComboBoxListView *>(widget) +#endif //QT_NO_COMBOBOX +#ifndef QT_NO_MENU + || qobject_cast<const QMenu *> (widget) +#endif //QT_NO_MENU + ) { + QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_OptionsMenu; + QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); } break; case PE_FrameWindow: @@ -2083,8 +2117,8 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti break; //disable frame in menu case PE_IndicatorBranch: - { #if defined(Q_WS_S60) + // 3.1 AVKON UI does not have tree view component, use common style for drawing there if (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1) { #else if (true) { @@ -2126,7 +2160,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti QS60StylePrivate::drawSkinPart(skinPart, painter, iconRect, flags); } } - } break; // todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases @@ -2159,18 +2192,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti } } -/*! - \reimp - sets the default colors -*/ -void QS60Style::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette & palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const -{ - QPalette override = palette; - QCommonStyle::drawItemText(painter, rectangle, alignment, override, enabled, text, textRole); -} - -/*! - \reimp -*/ +/*! \reimp */ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const { int metricValue = QS60StylePrivate::pixelMetric(metric); @@ -2178,7 +2200,6 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const metricValue = QCommonStyle::pixelMetric(metric, option, widget); if (metric == PM_SubMenuOverlap && widget){ - const int widgetWidth = widget->width(); const QMenu *menu = qobject_cast<const QMenu *>(widget); if (menu && menu->activeAction() && menu->activeAction()->menu()) { const int menuWidth = menu->activeAction()->menu()->sizeHint().width(); @@ -2187,6 +2208,7 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const } return metricValue; } + /*! \reimp */ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &csz, const QWidget *widget) const @@ -2209,22 +2231,19 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, } return sz; } + /*! \reimp */ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *widget, QStyleHintReturn *hret) const { int retValue = -1; switch (sh) { - case SH_Table_GridLineColor: { - QColor lineColor = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors,2,0); - retValue = lineColor.rgb(); - } - break; - case SH_GroupBox_TextLabelColor: { - QColor groupBoxTxtColor = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors,6,0); - retValue = groupBoxTxtColor.rgb(); - } - break; + case SH_Table_GridLineColor: + retValue = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors,2,0).rgb(); + break; + case SH_GroupBox_TextLabelColor: + retValue = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors,6,0).rgb(); + break; case SH_ScrollBar_ScrollWhenPointerLeavesControl: retValue = true; break; @@ -2250,10 +2269,7 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w return retValue; } - -/*! - \reimp -*/ +/*! \reimp */ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl scontrol, const QWidget *widget) const { QRect ret; @@ -2288,35 +2304,33 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple scrollbarOption->upsideDown); switch (scontrol) { - case SC_ScrollBarSubLine: // top/left button - case SC_ScrollBarAddLine: // bottom/right button - break; - case SC_ScrollBarSubPage: // between top/left button and slider - if (isHorizontal) - ret.setRect(0, 0, sliderstart, scrollBarRect.height()); - else - ret.setRect(0, 0, scrollBarRect.width(), sliderstart); - break; - case SC_ScrollBarAddPage: // between bottom/right button and slider - { + case SC_ScrollBarSubPage: // between top/left button and slider + if (isHorizontal) + ret.setRect(0, 0, sliderstart, scrollBarRect.height()); + else + ret.setRect(0, 0, scrollBarRect.width(), sliderstart); + break; + case SC_ScrollBarAddPage: { // between bottom/right button and slider const int addPageLength = sliderstart + sliderlen; if (isHorizontal) ret = scrollBarRect.adjusted(addPageLength, 0, 0, 0); else ret = scrollBarRect.adjusted(0, addPageLength, 0, 0); - } - break; - case SC_ScrollBarGroove: - ret = scrollBarRect; - break; - case SC_ScrollBarSlider: - if (scrollbarOption->orientation == Qt::Horizontal) - ret.setRect(sliderstart, 0, sliderlen, scrollBarRect.height()); - else - ret.setRect(0, sliderstart, scrollBarRect.width(), sliderlen); - break; - default: - break; + } + break; + case SC_ScrollBarGroove: + ret = scrollBarRect; + break; + case SC_ScrollBarSlider: + if (scrollbarOption->orientation == Qt::Horizontal) + ret.setRect(sliderstart, 0, sliderlen, scrollBarRect.height()); + else + ret.setRect(0, sliderstart, scrollBarRect.width(), sliderlen); + break; + case SC_ScrollBarSubLine: // top/left button + case SC_ScrollBarAddLine: // bottom/right button + default: + break; } ret = visualRect(scrollbarOption->direction, scrollBarRect, ret); } @@ -2334,37 +2348,37 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple const int y = frameThickness + spinbox->rect.y(); const int x = spinbox->rect.x() + spinbox->rect.width() - frameThickness - 2*buttonSize.width(); - + switch (scontrol) { - case SC_SpinBoxUp: - if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) - return QRect(); - ret = QRect(x, y, buttonWidth, buttonSize.height()); - break; - case SC_SpinBoxDown: - if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) - return QRect(); - ret = QRect(x+buttonSize.width(), y, buttonWidth, buttonSize.height()); - break; - case SC_SpinBoxEditField: - if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) - ret = QRect( - frameThickness, - frameThickness, - spinbox->rect.width() - 2*frameThickness, - spinbox->rect.height() - 2*frameThickness); - else - ret = QRect( - frameThickness, - frameThickness, - x - frameThickness, - spinbox->rect.height() - 2*frameThickness); - break; - case SC_SpinBoxFrame: - ret = spinbox->rect; - break; - default: - break; + case SC_SpinBoxUp: + if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) + return QRect(); + ret = QRect(x, y, buttonWidth, buttonSize.height()); + break; + case SC_SpinBoxDown: + if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) + return QRect(); + ret = QRect(x+buttonSize.width(), y, buttonWidth, buttonSize.height()); + break; + case SC_SpinBoxEditField: + if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) + ret = QRect( + frameThickness, + frameThickness, + spinbox->rect.width() - 2*frameThickness, + spinbox->rect.height() - 2*frameThickness); + else + ret = QRect( + frameThickness, + frameThickness, + x - frameThickness, + spinbox->rect.height() - 2*frameThickness); + break; + case SC_SpinBoxFrame: + ret = spinbox->rect; + break; + default: + break; } ret = visualRect(spinbox->direction, spinbox->rect, ret); } @@ -2378,7 +2392,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple // lets use spinbox frame here as well, as no combobox specific value available. const int frameThickness = cmb->frame ? pixelMetric(PM_SpinBoxFrameWidth, cmb, widget) : 0; const int buttonWidth = QS60StylePrivate::pixelMetric(QStyle::PM_ButtonIconSize); - int xposMod = (cmb->rect.x()) + width - buttonMargin - buttonWidth; + const int xposMod = (cmb->rect.x()) + width - buttonMargin - buttonWidth; const int ypos = cmb->rect.y(); QSize buttonSize; @@ -2407,25 +2421,26 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { ret = QCommonStyle::subControlRect(control, option, scontrol, widget); switch (scontrol) { - case SC_GroupBoxCheckBox: //fallthrough - case SC_GroupBoxLabel: - //slightly indent text and boxes, so that dialog border does not mess with them. - const int horizontalSpacing = - QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing); - ret.adjust(2,horizontalSpacing-3,0,0); - break; - case SC_GroupBoxFrame: { - const QRect textBox = subControlRect(control, option, SC_GroupBoxLabel, widget); - const int tbHeight = textBox.height(); - ret.translate(0, -ret.y()); - // include title to within the groupBox frame - ret.setHeight(ret.height()+tbHeight); - if (widget && ret.bottom() > widget->rect().bottom()) - ret.setBottom(widget->rect().bottom()); - } - break; - default: - break; + case SC_GroupBoxCheckBox: //fallthrough + case SC_GroupBoxLabel: { + //slightly indent text and boxes, so that dialog border does not mess with them. + const int horizontalSpacing = + QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing); + ret.adjust(2,horizontalSpacing-3,0,0); + } + break; + case SC_GroupBoxFrame: { + const QRect textBox = subControlRect(control, option, SC_GroupBoxLabel, widget); + const int tbHeight = textBox.height(); + ret.translate(0, -ret.y()); + // include title to within the groupBox frame + ret.setHeight(ret.height()+tbHeight); + if (widget && ret.bottom() > widget->rect().bottom()) + ret.setBottom(widget->rect().bottom()); + } + break; + default: + break; } } break; @@ -2443,7 +2458,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con // in S60 the input text box doesn't start from line Edit's TL, but // a bit indented. QRect lineEditRect = opt->rect; - int adjustment = opt->rect.height()>>2; + const int adjustment = opt->rect.height()>>2; lineEditRect.adjust(adjustment,0,0,0); ret = lineEditRect; } @@ -2515,7 +2530,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con } } else if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { const bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable; - int indicatorWidth = checkable ? + const int indicatorWidth = checkable ? pixelMetric(PM_ListViewIconSize, opt, widget) : pixelMetric(PM_SmallIconSize, opt, widget); ret = menuItem->rect; @@ -2535,11 +2550,10 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con // Make room for submenu indicator if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu){ // submenu indicator is very small, so lets halve the rect - indicatorWidth = indicatorWidth >> 1; if (menuItem->direction == Qt::LeftToRight) - ret.adjust(0,0,-indicatorWidth,0); + ret.adjust(0,0,-(indicatorWidth >> 1),0); else - ret.adjust(indicatorWidth,0,0,0); + ret.adjust((indicatorWidth >> 1),0,0,0); } } } @@ -2568,7 +2582,9 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con // Move rect and make it slightly smaller, so that // a) highlight border does not cross the rect // b) in s60 list checkbox is smaller than normal checkbox - ret.setRect(opt->rect.left()+3, opt->rect.top() + heightOffset, indicatorWidth-3, indicatorHeight-3); + //todo; magic three + ret.setRect(opt->rect.left()+3, opt->rect.top() + heightOffset, + indicatorWidth-3, indicatorHeight-3); } else { ret.setRect(opt->rect.right() - indicatorWidth - spacing, opt->rect.top() + heightOffset, indicatorWidth, indicatorHeight); @@ -2634,6 +2650,7 @@ void QS60Style::polish(QWidget *widget) widget->setAttribute(Qt::WA_StyledBackground); } d->setThemePalette(widget); + d->setFont(widget); } void QS60Style::unpolish(QWidget *widget) @@ -2642,9 +2659,8 @@ void QS60Style::unpolish(QWidget *widget) #ifndef QT_NO_SCROLLBAR || qobject_cast<QScrollBar *>(widget) #endif - ) { + ) widget->setAttribute(Qt::WA_OpaquePaintEvent); - } if (QS60StylePrivate::drawsOwnThemeBackground(widget)) { widget->setAttribute(Qt::WA_StyledBackground, false); @@ -2662,25 +2678,25 @@ void QS60Style::unpolish(QWidget *widget) widget->setAttribute(Qt::WA_StyledBackground, false); } - if (widget) { + if (widget) widget->setPalette(QPalette()); - } QCommonStyle::unpolish(widget); } void QS60Style::polish(QApplication *application) { - Q_D(const QS60Style); - originalPalette = application->palette(); + Q_D(QS60Style); + d->m_originalPalette = application->palette(); d->setThemePalette(application); } void QS60Style::unpolish(QApplication *application) { - QPalette newPalette = qApp->style()->standardPalette(); + Q_D(QS60Style); + const QPalette newPalette = QApplication::style()->standardPalette(); application->setPalette(newPalette); - QApplicationPrivate::setSystemPalette(originalPalette); + QApplicationPrivate::setSystemPalette(d->m_originalPalette); } void QS60Style::setStyleProperty(const char *name, const QVariant &value) @@ -2703,7 +2719,9 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, QS60StyleEnums::SkinParts part; QS60StylePrivate::SkinElementFlags adjustedFlags; if (option) - adjustedFlags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled; + adjustedFlags = (option->state & State_Enabled) ? + QS60StylePrivate::SF_StateEnabled : + QS60StylePrivate::SF_StateDisabled; switch(standardIcon) { case QStyle::SP_MessageBoxWarning: @@ -2780,6 +2798,29 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, QCommonStyle::standardIconImplementation(standardIcon, option, widget) : QIcon(cachedPixMap); } +extern QPoint qt_s60_fill_background_offset(const QWidget *targetWidget); + +bool qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, + const QBrush &brush) +{ + const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture()); + if (backgroundTexture.cacheKey() != brush.texture().cacheKey()) + return false; + + const QPaintDevice *target = painter->device(); + if (target->devType() == QInternal::Widget) { + const QWidget *widget = static_cast<const QWidget *>(target); + const QRegion translated = rgn.translated(offset); + const QVector<QRect> &rects = translated.rects(); + for (int i = 0; i < rects.size(); ++i) { + const QRect rect(rects.at(i)); + painter->drawPixmap(rect.topLeft(), backgroundTexture, + rect.translated(qt_s60_fill_background_offset(widget))); + } + } + return true; +} + QT_END_NAMESPACE #endif // QT_NO_STYLE_S60 || QT_PLUGIN diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index 945e182..21cdd1c 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -36,7 +66,6 @@ public: 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; - void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) 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, @@ -56,6 +85,8 @@ public: 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_WS_S60 #ifdef Q_WS_S60 @@ -71,7 +102,6 @@ protected slots: private: Q_DISABLE_COPY(QS60Style) friend class QStyleFactory; - QPalette originalPalette; }; #endif // QT_NO_STYLE_S60 diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index ba7dca3..385c6e8 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -331,13 +361,13 @@ public: SF_StateDisabled = 0x0020, SF_ColorSkinned = 0x0040, }; - + enum CacheClearReason { CC_UndefinedChange = 0, CC_LayoutChange, CC_ThemeChange }; - + Q_DECLARE_FLAGS(SkinElementFlags, SkinElementFlag) // draws skin element @@ -366,28 +396,31 @@ public: static QColor lighterColor(const QColor &baseColor); //deduces if the given widget should have separately themeable background static bool drawsOwnThemeBackground(const QWidget *widget); - // gets layout - static const QHash<QStyle::PixelMetric, int> &s60StyleLayout(); QFont s60Font(QS60StyleEnums::FontCategories fontCategory, int pointSize = -1) const; // clears all style caches (fonts, colors, pixmaps) void clearCaches(CacheClearReason reason = CC_UndefinedChange); - // returns themed background texture - static QPixmap backgroundTexture(); + + // themed main background oprations + void setBackgroundTexture(QApplication *application) const; + static void deleteBackground(); static bool isTouchSupported(); static bool isToolBarBackground(); // calculates average color based on button skin graphics (minus borders). QColor colorFromFrameGraphics(QS60StylePrivate::SkinFrameElements frame) const; + + //set theme palette for application void setThemePalette(QApplication *application) const; - void setThemePalette(QWidget *widget) const; - void setBackgroundTexture(QApplication *application) const; + //set theme palette for style option + void setThemePalette(QStyleOption *option) const; + //access to theme palette + static QPalette* themePalette(); static int focusRectPenWidth(); -#if defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) static const layoutHeader m_layoutHeaders[]; static const short data[][MAX_PIXELMETRICS]; @@ -397,7 +430,6 @@ public: static short const *m_pmPointer; // number of layouts supported by the style static const int m_numberOfLayouts; -#endif // defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) mutable QHash<QPair<QS60StyleEnums::FontCategories , int>, QFont> m_mappedFontsCache; mutable QHash<QS60StylePrivate::SkinFrameElements, QColor> m_colorCache; @@ -410,6 +442,7 @@ public: static QPixmap frame(SkinFrameElements frame, const QSize &size, SkinElementFlags flags = KDefaultSkinElementFlags); + static QPixmap backgroundTexture(); private: static void drawPart(QS60StyleEnums::SkinParts part, QPainter *painter, @@ -424,9 +457,16 @@ private: SkinElementFlags flags = KDefaultSkinElementFlags); static QPixmap cachedFrame(SkinFrameElements frame, const QSize &size, SkinElementFlags flags = KDefaultSkinElementFlags); - + static void refreshUI(); - + + // set S60 font for widget + void setFont(QWidget *widget) const; + void setThemePalette(QWidget *widget) const; + void setThemePalette(QPalette *palette) const; + void setThemePaletteHash(QPalette *palette) const; + static void QS60StylePrivate::storeThemePalette(QPalette *palette); + static QSize partSize(QS60StyleEnums::SkinParts part, SkinElementFlags flags = KDefaultSkinElementFlags); static QPixmap part(QS60StyleEnums::SkinParts part, const QSize &size, @@ -436,8 +476,12 @@ private: static QSize screenSize(); - static bool m_backgroundValid; + // Contains background texture. + static QPixmap *m_background; const static SkinElementFlags KDefaultSkinElementFlags; + // defined theme palette + static QPalette *m_themePalette; + QPalette m_originalPalette; }; QT_END_NAMESPACE diff --git a/src/gui/styles/qs60style_symbian.cpp b/src/gui/styles/qs60style_s60.cpp index 3fc4c8c..dbb98c5 100644 --- a/src/gui/styles/qs60style_symbian.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -47,8 +77,10 @@ enum TSupportRelease { ES60_3_1 = 0x0001, ES60_3_2 = 0x0002, ES60_5_0 = 0x0004, + ES60_5_1 = 0x0008, + ES60_5_2 = 0x0010, // Add all new releases here - ES60_AllReleases = ES60_3_1 | ES60_3_2 | ES60_5_0 + ES60_AllReleases = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 }; typedef struct { @@ -59,17 +91,6 @@ typedef struct { int newMinorSkinId; } partMapEntry; -enum TFallbackMbmFile { - EAvkonMbm = 0, - ELastMbm -}; - -typedef struct { - const QS60StyleEnums::SkinParts partID; - TFallbackMbmFile fallbackFileID; //to avoid putting large char strings to table, lets only have a mapping value - int fallbackGraphicID; -} fallbackMapEntry; - class QS60StyleModeSpecifics { public: @@ -105,198 +126,198 @@ private: }; const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { - /* SP_QgnGrafBarWait */ {KAknsIIDQgnGrafBarWaitAnim, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafScrollArrowUp */ {KAknsIIDQgnGrafScrollArrowUp, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiCheckboxOff */ {KAknsIIDQgnIndiCheckboxOff, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiCheckboxOn */ {KAknsIIDQgnIndiCheckboxOn, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafBarWait */ {KAknsIIDQgnGrafBarWaitAnim, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafScrollArrowUp */ {KAknsIIDQgnGrafScrollArrowUp, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnIndiCheckboxOff */ {KAknsIIDQgnIndiCheckboxOff, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnIndiCheckboxOn */ {KAknsIIDQgnIndiCheckboxOn, EDrawIcon, ES60_AllReleases, -1,-1}, // Following 5 items (SP_QgnIndiHlColSuper - SP_QgnIndiHlLineStraight) are available starting from S60 release 3.2. // In 3.1 CommonStyle drawing is used for these QTreeView elements, since no similar icons in AVKON UI. - /* SP_QgnIndiHlColSuper */ {KAknsIIDNone, EDrawIcon, ES60_None, EAknsMajorGeneric, 0x17d5 /* KAknsIIDQgnIndiHlColSuper */}, - /* SP_QgnIndiHlExpSuper */ {KAknsIIDNone, EDrawIcon, ES60_None, EAknsMajorGeneric, 0x17d6 /* KAknsIIDQgnIndiHlExpSuper */}, - /* SP_QgnIndiHlLineBranch */ {KAknsIIDNone, EDrawIcon, ES60_None, EAknsMajorGeneric, 0x17d7 /* KAknsIIDQgnIndiHlLineBranch */}, - /* SP_QgnIndiHlLineEnd */ {KAknsIIDNone, EDrawIcon, ES60_None, EAknsMajorGeneric, 0x17d8 /* KAknsIIDQgnIndiHlLineEnd */}, - /* SP_QgnIndiHlLineStraight */ {KAknsIIDNone, EDrawIcon, ES60_None, EAknsMajorGeneric, 0x17d9 /* KAknsIIDQgnIndiHlLineStraight */}, - /* SP_QgnIndiMarkedAdd */ {KAknsIIDQgnIndiMarkedAdd, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiNaviArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiSliderEdit */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnNoteInfo */ {KAknsIIDQgnNoteInfo, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnNoteOk */ {KAknsIIDQgnNoteOk, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnNoteQuery */ {KAknsIIDQgnNoteQuery, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnNoteWarning */ {KAknsIIDQgnNoteWarning, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnPropFileSmall */ {KAknsIIDQgnPropFileSmall, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnPropFolderCurrent */ {KAknsIIDQgnPropFolderCurrent, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnPropFolderSmall */ {KAknsIIDQgnPropFolderSmall, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnIndiHlColSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d5 /* KAknsIIDQgnIndiHlColSuper */}, + /* SP_QgnIndiHlExpSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d6 /* KAknsIIDQgnIndiHlExpSuper */}, + /* SP_QgnIndiHlLineBranch */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d7 /* KAknsIIDQgnIndiHlLineBranch */}, + /* SP_QgnIndiHlLineEnd */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d8 /* KAknsIIDQgnIndiHlLineEnd */}, + /* SP_QgnIndiHlLineStraight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d9 /* KAknsIIDQgnIndiHlLineStraight */}, + /* SP_QgnIndiMarkedAdd */ {KAknsIIDQgnIndiMarkedAdd, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnIndiNaviArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnIndiSliderEdit */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnNoteInfo */ {KAknsIIDQgnNoteInfo, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnNoteOk */ {KAknsIIDQgnNoteOk, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnNoteQuery */ {KAknsIIDQgnNoteQuery, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnNoteWarning */ {KAknsIIDQgnNoteWarning, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnPropFileSmall */ {KAknsIIDQgnPropFileSmall, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnPropFolderCurrent */ {KAknsIIDQgnPropFolderCurrent, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnPropFolderSmall */ {KAknsIIDQgnPropFolderSmall, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_AllReleases, -1,-1}, // 3.1 & 3.2 do not have pressed state for scrollbar, so use normal scrollbar graphics instead. - /* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/ - /* SP_QsnCpScrollHandleMiddlePressed*/ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20f9}, /*KAknsIIDQsnCpScrollHandleMiddlePressed*/ - /* SP_QsnCpScrollHandleTopPressed*/ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20fa}, /*KAknsIIDQsnCpScrollHandleTopPressed*/ - - /* SP_QsnBgScreen */ {KAknsIIDQsnBgScreen, EDrawBackground, ES60_AllReleases, -1,-1}, - - /* SP_QsnCpScrollBgBottom */ {KAknsIIDQsnCpScrollBgBottom, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QsnCpScrollBgMiddle */ {KAknsIIDQsnCpScrollBgMiddle, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QsnCpScrollBgTop */ {KAknsIIDQsnCpScrollBgTop, EDrawIcon, ES60_AllReleases, -1,-1}, - - /* SP_QsnCpScrollHandleBottom */ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QsnCpScrollHandleMiddle */ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QsnCpScrollHandleTop */ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_AllReleases, -1,-1}, - - /* SP_QsnFrButtonTbCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, //todo: use "normal button" from 5.0 onwards - /* SP_QsnFrButtonTbCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbCenter */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_AllReleases, -1,-1}, - - /* SP_QsnFrButtonTbCornerTlPressed */{KAknsIIDQsnFrButtonTbCornerTlPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbCornerTrPressed */{KAknsIIDQsnFrButtonTbCornerTrPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbCornerBlPressed */{KAknsIIDQsnFrButtonTbCornerBlPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbCornerBrPressed */{KAknsIIDQsnFrButtonTbCornerBrPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideTPressed */ {KAknsIIDQsnFrButtonTbSideTPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideBPressed */ {KAknsIIDQsnFrButtonTbSideBPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideLPressed */ {KAknsIIDQsnFrButtonTbSideLPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideRPressed */ {KAknsIIDQsnFrButtonTbSideRPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbCenterPressed */ {KAknsIIDQsnFrButtonTbCenterPressed, EDrawIcon, ES60_AllReleases, -1,-1}, - - /* SP_QsnFrCaleCornerTl */ {KAknsIIDQsnFrCaleCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleCornerTr */ {KAknsIIDQsnFrCaleCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleCornerBl */ {KAknsIIDQsnFrCaleCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleCornerBr */ {KAknsIIDQsnFrCaleCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleGSideT */ {KAknsIIDQsnFrCaleSideT, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleGSideB */ {KAknsIIDQsnFrCaleSideB, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleGSideL */ {KAknsIIDQsnFrCaleSideL, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleGSideR */ {KAknsIIDQsnFrCaleSideR, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleCenter */ {KAknsIIDQsnFrCaleCenter, ENoDraw, ES60_AllReleases, -1,-1}, - - /* SP_QsnFrCaleHeadingCornerTl */ {KAknsIIDQsnFrCaleHeadingCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingCornerTr */ {KAknsIIDQsnFrCaleHeadingCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingCornerBl */ {KAknsIIDQsnFrCaleHeadingCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingCornerBr */ {KAknsIIDQsnFrCaleHeadingCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingSideT */ {KAknsIIDQsnFrCaleHeadingSideT, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingSideB */ {KAknsIIDQsnFrCaleHeadingSideB, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingSideL */ {KAknsIIDQsnFrCaleHeadingSideL, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingSideR */ {KAknsIIDQsnFrCaleHeadingSideR, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingCenter */ {KAknsIIDQsnFrCaleHeadingCenter, ENoDraw, ES60_AllReleases, -1,-1}, - - /* SP_QsnFrInputCornerTl */ {KAknsIIDQsnFrInputCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputCornerTr */ {KAknsIIDQsnFrInputCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputCornerBl */ {KAknsIIDQsnFrInputCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputCornerBr */ {KAknsIIDQsnFrInputCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputSideT */ {KAknsIIDQsnFrInputSideT, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputSideB */ {KAknsIIDQsnFrInputSideB, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputSideL */ {KAknsIIDQsnFrInputSideL, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputSideR */ {KAknsIIDQsnFrInputSideR, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputCenter */ {KAknsIIDQsnFrInputCenter, ENoDraw, ES60_AllReleases, -1,-1}, - - /* SP_QsnFrListCornerTl */ {KAknsIIDQsnFrListCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListCornerTr */ {KAknsIIDQsnFrListCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListCornerBl */ {KAknsIIDQsnFrListCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListCornerBr */ {KAknsIIDQsnFrListCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListSideT */ {KAknsIIDQsnFrListSideT, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListSideB */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListSideL */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListSideR */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListCenter */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_AllReleases, -1,-1}, - - /* SP_QsnFrPopupCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/ + /* SP_QsnCpScrollHandleMiddlePressed*/ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20f9}, /*KAknsIIDQsnCpScrollHandleMiddlePressed*/ + /* SP_QsnCpScrollHandleTopPressed*/ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20fa}, /*KAknsIIDQsnCpScrollHandleTopPressed*/ + + /* SP_QsnBgScreen */ {KAknsIIDQsnBgScreen, EDrawBackground, ES60_AllReleases, -1,-1}, + + /* SP_QsnCpScrollBgBottom */ {KAknsIIDQsnCpScrollBgBottom, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QsnCpScrollBgMiddle */ {KAknsIIDQsnCpScrollBgMiddle, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QsnCpScrollBgTop */ {KAknsIIDQsnCpScrollBgTop, EDrawIcon, ES60_AllReleases, -1,-1}, + + /* SP_QsnCpScrollHandleBottom */ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QsnCpScrollHandleMiddle */ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QsnCpScrollHandleTop */ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_AllReleases, -1,-1}, + + /* SP_QsnFrButtonTbCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, //todo: use "normal button" from 5.0 onwards + /* SP_QsnFrButtonTbCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrButtonTbCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrButtonTbCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrButtonTbSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrButtonTbSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrButtonTbSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrButtonTbSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrButtonTbCenter */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_AllReleases, -1,-1}, + + /* SP_QsnFrButtonTbCornerTlPressed */{KAknsIIDQsnFrButtonTbCornerTlPressed, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrButtonTbCornerTrPressed */{KAknsIIDQsnFrButtonTbCornerTrPressed, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrButtonTbCornerBlPressed */{KAknsIIDQsnFrButtonTbCornerBlPressed, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrButtonTbCornerBrPressed */{KAknsIIDQsnFrButtonTbCornerBrPressed, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrButtonTbSideTPressed */ {KAknsIIDQsnFrButtonTbSideTPressed, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrButtonTbSideBPressed */ {KAknsIIDQsnFrButtonTbSideBPressed, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrButtonTbSideLPressed */ {KAknsIIDQsnFrButtonTbSideLPressed, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrButtonTbSideRPressed */ {KAknsIIDQsnFrButtonTbSideRPressed, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrButtonTbCenterPressed */ {KAknsIIDQsnFrButtonTbCenterPressed, EDrawIcon, ES60_AllReleases, -1,-1}, + + /* SP_QsnFrCaleCornerTl */ {KAknsIIDQsnFrCaleCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleCornerTr */ {KAknsIIDQsnFrCaleCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleCornerBl */ {KAknsIIDQsnFrCaleCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleCornerBr */ {KAknsIIDQsnFrCaleCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleGSideT */ {KAknsIIDQsnFrCaleSideT, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleGSideB */ {KAknsIIDQsnFrCaleSideB, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleGSideL */ {KAknsIIDQsnFrCaleSideL, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleGSideR */ {KAknsIIDQsnFrCaleSideR, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleCenter */ {KAknsIIDQsnFrCaleCenter, ENoDraw, ES60_AllReleases, -1,-1}, + + /* SP_QsnFrCaleHeadingCornerTl */ {KAknsIIDQsnFrCaleHeadingCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleHeadingCornerTr */ {KAknsIIDQsnFrCaleHeadingCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleHeadingCornerBl */ {KAknsIIDQsnFrCaleHeadingCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleHeadingCornerBr */ {KAknsIIDQsnFrCaleHeadingCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleHeadingSideT */ {KAknsIIDQsnFrCaleHeadingSideT, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleHeadingSideB */ {KAknsIIDQsnFrCaleHeadingSideB, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleHeadingSideL */ {KAknsIIDQsnFrCaleHeadingSideL, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleHeadingSideR */ {KAknsIIDQsnFrCaleHeadingSideR, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrCaleHeadingCenter */ {KAknsIIDQsnFrCaleHeadingCenter, ENoDraw, ES60_AllReleases, -1,-1}, + + /* SP_QsnFrInputCornerTl */ {KAknsIIDQsnFrInputCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrInputCornerTr */ {KAknsIIDQsnFrInputCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrInputCornerBl */ {KAknsIIDQsnFrInputCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrInputCornerBr */ {KAknsIIDQsnFrInputCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrInputSideT */ {KAknsIIDQsnFrInputSideT, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrInputSideB */ {KAknsIIDQsnFrInputSideB, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrInputSideL */ {KAknsIIDQsnFrInputSideL, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrInputSideR */ {KAknsIIDQsnFrInputSideR, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrInputCenter */ {KAknsIIDQsnFrInputCenter, ENoDraw, ES60_AllReleases, -1,-1}, + + /* SP_QsnFrListCornerTl */ {KAknsIIDQsnFrListCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrListCornerTr */ {KAknsIIDQsnFrListCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrListCornerBl */ {KAknsIIDQsnFrListCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrListCornerBr */ {KAknsIIDQsnFrListCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrListSideT */ {KAknsIIDQsnFrListSideT, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrListSideB */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrListSideL */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrListSideR */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrListCenter */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_AllReleases, -1,-1}, + + /* SP_QsnFrPopupCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrPopupCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrPopupCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrPopupCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrPopupSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrPopupSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrPopupSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrPopupSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrPopupCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_AllReleases, -1,-1}, // ToolTip graphics different in 3.1 vs. 3.2+. - /* SP_QsnFrPopupPreviewCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c5}, /* KAknsIIDQsnFrPopupPreviewCornerTl */ - /* SP_QsnFrPopupPreviewCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c6}, - /* SP_QsnFrPopupPreviewCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c3}, - /* SP_QsnFrPopupPreviewCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c4}, - /* SP_QsnFrPopupPreviewSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19ca}, - /* SP_QsnFrPopupPreviewSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c7}, - /* SP_QsnFrPopupPreviewSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c8}, - /* SP_QsnFrPopupPreviewSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c9}, - /* SP_QsnFrPopupPreviewCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c2}, - - /* SP_QsnFrSetOptCornerTl */ {KAknsIIDQsnFrSetOptCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptCornerTr */ {KAknsIIDQsnFrSetOptCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptCornerBl */ {KAknsIIDQsnFrSetOptCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptCornerBr */ {KAknsIIDQsnFrSetOptCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptSideT */ {KAknsIIDQsnFrSetOptSideT, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptSideB */ {KAknsIIDQsnFrSetOptSideB, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptSideL */ {KAknsIIDQsnFrSetOptSideL, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptSideR */ {KAknsIIDQsnFrSetOptSideR, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptCenter */ {KAknsIIDQsnFrSetOptCenter, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrPopupPreviewCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c5}, /* KAknsIIDQsnFrPopupPreviewCornerTl */ + /* SP_QsnFrPopupPreviewCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c6}, + /* SP_QsnFrPopupPreviewCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c3}, + /* SP_QsnFrPopupPreviewCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c4}, + /* SP_QsnFrPopupPreviewSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19ca}, + /* SP_QsnFrPopupPreviewSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c7}, + /* SP_QsnFrPopupPreviewSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c8}, + /* SP_QsnFrPopupPreviewSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c9}, + /* SP_QsnFrPopupPreviewCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c2}, + + /* SP_QsnFrSetOptCornerTl */ {KAknsIIDQsnFrSetOptCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrSetOptCornerTr */ {KAknsIIDQsnFrSetOptCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrSetOptCornerBl */ {KAknsIIDQsnFrSetOptCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrSetOptCornerBr */ {KAknsIIDQsnFrSetOptCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrSetOptSideT */ {KAknsIIDQsnFrSetOptSideT, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrSetOptSideB */ {KAknsIIDQsnFrSetOptSideB, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrSetOptSideL */ {KAknsIIDQsnFrSetOptSideL, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrSetOptSideR */ {KAknsIIDQsnFrSetOptSideR, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrSetOptCenter */ {KAknsIIDQsnFrSetOptCenter, ENoDraw, ES60_AllReleases, -1,-1}, // No toolbar frame for 5.0+ releases. - /* SP_QsnFrPopupSubCornerTl */ {KAknsIIDQsnFrPopupSubCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubCornerTr */ {KAknsIIDQsnFrPopupSubCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubCornerBl */ {KAknsIIDQsnFrPopupSubCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubCornerBr */ {KAknsIIDQsnFrPopupSubCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubSideT */ {KAknsIIDQsnFrPopupSubSideT, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubSideB */ {KAknsIIDQsnFrPopupSubSideB, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubSideL */ {KAknsIIDQsnFrPopupSubSideL, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubSideR */ {KAknsIIDQsnFrPopupSubSideR, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, + /* SP_QsnFrPopupSubCornerTl */ {KAknsIIDQsnFrPopupSubCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, + /* SP_QsnFrPopupSubCornerTr */ {KAknsIIDQsnFrPopupSubCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, + /* SP_QsnFrPopupSubCornerBl */ {KAknsIIDQsnFrPopupSubCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, + /* SP_QsnFrPopupSubCornerBr */ {KAknsIIDQsnFrPopupSubCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, + /* SP_QsnFrPopupSubSideT */ {KAknsIIDQsnFrPopupSubSideT, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, + /* SP_QsnFrPopupSubSideB */ {KAknsIIDQsnFrPopupSubSideB, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, + /* SP_QsnFrPopupSubSideL */ {KAknsIIDQsnFrPopupSubSideL, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, + /* SP_QsnFrPopupSubSideR */ {KAknsIIDQsnFrPopupSubSideR, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, + /* SP_QsnFrPopupSubCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, // Toolbar graphics is different in 3.1/3.2 vs. 5.0 - /* SP_QsnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/ - /* SP_QsnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2302}, - /* SP_QsnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2303}, - /* SP_QsnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2304}, - /* SP_QsnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2305}, - /* SP_QsnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2306}, - /* SP_QsnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2307}, - /* SP_QsnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2308}, - /* SP_QsnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/ + /* SP_QsnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/ + /* SP_QsnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2302}, + /* SP_QsnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2303}, + /* SP_QsnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2304}, + /* SP_QsnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2305}, + /* SP_QsnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2306}, + /* SP_QsnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2307}, + /* SP_QsnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2308}, + /* SP_QsnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/ // No pressed state for toolbar button in 3.1/3.2. - /* SP_QsnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2621}, /*KAknsIIDQsnFrSctrlButtonCornerTlPressed*/ - /* SP_QsnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2622}, - /* SP_QsnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2623}, - /* SP_QsnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2624}, - /* SP_QsnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2625}, - /* SP_QsnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2626}, - /* SP_QsnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2627}, - /* SP_QsnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2628}, - /* SP_QsnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2629}, + /* SP_QsnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2621}, /*KAknsIIDQsnFrSctrlButtonCornerTlPressed*/ + /* SP_QsnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2622}, + /* SP_QsnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2623}, + /* SP_QsnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2624}, + /* SP_QsnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2625}, + /* SP_QsnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2626}, + /* SP_QsnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2627}, + /* SP_QsnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2628}, + /* SP_QsnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2629}, // No inactive button graphics in 3.1/3.2 - /* SP_QsnFrButtonCornerTlInactive */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b1}, /*KAknsIIDQsnFrButtonCornerTlInactive*/ - /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b2}, - /* SP_QsnFrButtonCornerBlInactive */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b3}, - /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b4}, - /* SP_QsnFrButtonSideTInactive */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b5}, - /* SP_QsnFrButtonSideBInactive */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b6}, - /* SP_QsnFrButtonSideLInactive */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b7}, - /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b8}, - /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon,ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b9} + /* SP_QsnFrButtonCornerTlInactive */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b1}, /*KAknsIIDQsnFrButtonCornerTlInactive*/ + /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b2}, + /* SP_QsnFrButtonCornerBlInactive */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b3}, + /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b4}, + /* SP_QsnFrButtonSideTInactive */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b5}, + /* SP_QsnFrButtonSideBInactive */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b6}, + /* SP_QsnFrButtonSideLInactive */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b7}, + /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b8}, + /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b9} }; @@ -583,26 +604,6 @@ QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask return QPixmap::fromImage(iconImage); } -QPixmap QS60StylePrivate::backgroundTexture() -{ - static QPixmap result; - // Poor mans caching. + Making sure that there is always only one background image in memory at a time - -/* - TODO: 1) Hold the background QPixmap as pointer in a static class member. - Also add a deleteBackground() function and call that in ~QS60StylePrivate() - 2) Don't cache the background at all as soon as we have native pixmap support -*/ - - if (!m_backgroundValid) { - result = QPixmap(); - result = part(QS60StyleEnums::SP_QsnBgScreen, - QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), SkinElementFlags()); - m_backgroundValid = true; - } - return result; -} - bool QS60StylePrivate::isTouchSupported() { return bool(AknLayoutUtils::PenEnabled()); @@ -613,30 +614,11 @@ bool QS60StylePrivate::isToolBarBackground() return (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2); } -void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, - const QBrush &brush) +QPoint qt_s60_fill_background_offset(const QWidget *targetWidget) { - const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture()); - if (backgroundTexture.cacheKey() == brush.texture().cacheKey()) { - const QPaintDevice *target = painter->device(); - if (target->devType() == QInternal::Widget) { - const QWidget *widget = static_cast<const QWidget *>(target); - CCoeControl *control = widget->effectiveWinId(); - TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0); - const QRegion translated = rgn.translated(offset); - const QVector<QRect> &rects = translated.rects(); - for (int i = 0; i < rects.size(); ++i) { - const QRect rect(rects.at(i)); - painter->drawPixmap(rect.topLeft(), backgroundTexture, - rect.translated(globalPos.iX, globalPos.iY)); - } - } - } else { - const QRegion translated = rgn.translated(offset); - const QRect rect(translated.boundingRect()); - painter->setClipRegion(translated); - painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft()); - } + CCoeControl *control = targetWidget->effectiveWinId(); + TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0); + return QPoint(globalPos.iX, globalPos.iY); } QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL( @@ -653,7 +635,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL( Q_ASSERT(drawType != ENoDraw); const bool rotatedBy90or270 = (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest)); - TSize targetSize = + const TSize targetSize = rotatedBy90or270 ? TSize(size.height(), size.width()) : qt_QSize2TSize(size); MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); @@ -661,65 +643,63 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL( QPixmap result; switch (drawType) { - case EDrawIcon: - { - TInt fallbackGraphicID = -1; - HBufC* iconFile = HBufC::NewLC( KMaxFileName ); - TPtr fileNamePtr = iconFile->Des(); - fallbackInfo(part, fileNamePtr, fallbackGraphicID); - // todo: could we instead use AknIconUtils::AvkonIconFileName(); to avoid allocating each time? - - CFbsBitmap *icon = 0; - CFbsBitmap *iconMask = 0; - const TInt fallbackGraphicsMaskID = - fallbackGraphicID == KErrNotFound?KErrNotFound:fallbackGraphicID+1; //masks are auto-generated as next in mif files -// QS60WindowSurface::unlockBitmapHeap(); - AknsUtils::CreateIconLC(skinInstance, skinId, icon, iconMask, fileNamePtr, fallbackGraphicID , fallbackGraphicsMaskID); - User::LeaveIfError(AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved)); - User::LeaveIfError(AknIconUtils::SetSize(iconMask, targetSize, EAspectRatioNotPreserved)); - result = fromFbsBitmap(icon, iconMask, flags, qt_TDisplayMode2Format(icon->DisplayMode())); - CleanupStack::PopAndDestroy(3); // iconMask, icon, iconFile -// QS60WindowSurface::lockBitmapHeap(); - break; - } - case EDrawBackground: - { -// QS60WindowSurface::unlockBitmapHeap(); - CFbsBitmap *background = new (ELeave) CFbsBitmap(); //offscreen - CleanupStack::PushL(background); - User::LeaveIfError(background->Create(targetSize, EColor16MA)); - - CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(background); - CleanupStack::PushL(dev); - CFbsBitGc* gc = NULL; - User::LeaveIfError(dev->CreateContext(gc)); - CleanupStack::PushL(gc); - - CAknsBasicBackgroundControlContext* bgContext = CAknsBasicBackgroundControlContext::NewL( - skinId, - targetSize, - EFalse); - CleanupStack::PushL(bgContext); - - const TBool drawn = AknsDrawUtils::DrawBackground( - skinInstance, - bgContext, - NULL, - *gc, - TPoint(), - targetSize, - KAknsDrawParamDefault | KAknsDrawParamRGBOnly); - - if (drawn) - result = fromFbsBitmap(background, NULL, flags, QImage::Format_RGB32); - - CleanupStack::PopAndDestroy(4, background); //background, dev, gc, bgContext -// QS60WindowSurface::lockBitmapHeap(); - break; - } + case EDrawIcon: { + TInt fallbackGraphicID = -1; + HBufC* iconFile = HBufC::NewLC( KMaxFileName ); + TPtr fileNamePtr = iconFile->Des(); + fallbackInfo(part, fileNamePtr, fallbackGraphicID); + // todo: could we instead use AknIconUtils::AvkonIconFileName(); to avoid allocating each time? + + CFbsBitmap *icon = 0; + CFbsBitmap *iconMask = 0; + const TInt fallbackGraphicsMaskID = + fallbackGraphicID == KErrNotFound?KErrNotFound:fallbackGraphicID+1; //masks are auto-generated as next in mif files + // QS60WindowSurface::unlockBitmapHeap(); + AknsUtils::CreateIconLC(skinInstance, skinId, icon, iconMask, fileNamePtr, fallbackGraphicID , fallbackGraphicsMaskID); + User::LeaveIfError(AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved)); + User::LeaveIfError(AknIconUtils::SetSize(iconMask, targetSize, EAspectRatioNotPreserved)); + result = fromFbsBitmap(icon, iconMask, flags, qt_TDisplayMode2Format(icon->DisplayMode())); + CleanupStack::PopAndDestroy(3); // iconMask, icon, iconFile + // QS60WindowSurface::lockBitmapHeap(); + break; + } + case EDrawBackground: { + // QS60WindowSurface::unlockBitmapHeap(); + CFbsBitmap *background = new (ELeave) CFbsBitmap(); //offscreen + CleanupStack::PushL(background); + User::LeaveIfError(background->Create(targetSize, EColor16MA)); + + CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(background); + CleanupStack::PushL(dev); + CFbsBitGc* gc = NULL; + User::LeaveIfError(dev->CreateContext(gc)); + CleanupStack::PushL(gc); + + CAknsBasicBackgroundControlContext* bgContext = CAknsBasicBackgroundControlContext::NewL( + skinId, + targetSize, + EFalse); + CleanupStack::PushL(bgContext); + + const TBool drawn = AknsDrawUtils::DrawBackground( + skinInstance, + bgContext, + NULL, + *gc, + TPoint(), + targetSize, + KAknsDrawParamDefault | KAknsDrawParamRGBOnly); + + if (drawn) + result = fromFbsBitmap(background, NULL, flags, QImage::Format_RGB32); + + CleanupStack::PopAndDestroy(4, background); //background, dev, gc, bgContext + // QS60WindowSurface::lockBitmapHeap(); + break; + } } - return result; // TODO: Let fromFbsBitmap return a QPixmap + return result; } QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL(QS60StylePrivate::SkinFrameElements frameElement, @@ -730,11 +710,10 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL(QS60StylePrivate::SkinFra const bool rotatedBy90or270 = (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest)); - TSize targetSize = + const TSize targetSize = rotatedBy90or270 ? TSize(size.height(), size.width()) : qt_QSize2TSize(size); MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); - QPixmap result; // QS60WindowSurface::unlockBitmapHeap(); @@ -778,7 +757,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL(QS60StylePrivate::SkinFra skinInstance->GetCachedItemData(frameSkinID,EAknsITMaskedBitmap)); if (skinMaskedBmp && skinMaskedBmp->Mask()) maskDepth = skinMaskedBmp->Mask()->DisplayMode(); - } + } if (maskDepth != ENone) { CFbsBitmap *frameMask = new (ELeave) CFbsBitmap(); //offscreen CleanupStack::PushL(frameMask); @@ -806,11 +785,10 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL(QS60StylePrivate::SkinFra result = fromFbsBitmap(frame, frameMask, flags, QImage::Format_ARGB32); } CleanupStack::PopAndDestroy(3, frameMask); - } } + } CleanupStack::PopAndDestroy(3, frame); //frame, bitmapDev, bitmapGc - - return result; // TODO: Let fromFbsBitmap return a QPixmap + return result; } void QS60StyleModeSpecifics::frameIdAndCenterId(QS60StylePrivate::SkinFrameElements frameElement, TAknsItemID &frameId, TAknsItemID ¢erId) @@ -914,7 +892,7 @@ void QS60StyleModeSpecifics::checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBit QFont QS60StylePrivate::s60Font_specific( QS60StyleEnums::FontCategories fontCategory, int pointSize) { - enum TAknFontCategory aknFontCategory = EAknFontCategoryUndefined; + TAknFontCategory aknFontCategory = EAknFontCategoryUndefined; switch (fontCategory) { case QS60StyleEnums::FC_Primary: aknFontCategory = EAknFontCategoryPrimary; @@ -959,7 +937,6 @@ QFont QS60StylePrivate::s60Font_specific( return result; } -#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED void QS60StylePrivate::setActiveLayout() { const QSize activeScreenSize(screenSize()); @@ -975,7 +952,7 @@ void QS60StylePrivate::setActiveLayout() break; } } - + //not found, lets try without mirroring info if (activeLayoutIndex==-1){ for (int i=0; i<m_numberOfLayouts; i++) { @@ -999,19 +976,11 @@ void QS60StylePrivate::setActiveLayout() m_pmPointer = data[activeLayoutIndex]; } -#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED QS60StylePrivate::QS60StylePrivate() { -#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED // No need to set active layout, if dynamic metrics API is available setActiveLayout(); -#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED -} - -QS60StylePrivate::~QS60StylePrivate() -{ - m_backgroundValid = false; } void QS60StylePrivate::setStyleProperty_specific(const char *name, const QVariant &value) @@ -1031,20 +1000,6 @@ QVariant QS60StylePrivate::styleProperty_specific(const char *name) const return styleProperty(name); } -short QS60StylePrivate::pixelMetric(int metric) -{ -#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED - Q_ASSERT(metric < MAX_PIXELMETRICS); - const short returnValue = m_pmPointer[metric]; - if (returnValue==-909) - return -1; - return returnValue; -#else - //todo - call the pixelmetrics API directly - return 0; -#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED -} - QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list, int index, const QStyleOption *option) { @@ -1135,9 +1090,10 @@ QPixmap QS60StyleModeSpecifics::generateMissingThemeGraphic(QS60StyleEnums::Skin return QPixmap(); } else { QPixmap result = skinnedGraphics(updatedPart, size, flags); - // TODO: fix this QStyleOption opt; - //opt.palette = q->standardPalette(); + QPalette *themePalette = QS60StylePrivate::themePalette(); + if (themePalette) + opt.palette = *themePalette; // For now, always generate new icon based on "selected". In the future possibly, expand // this to consist other possibilities as well. @@ -1156,9 +1112,10 @@ QPixmap QS60StylePrivate::part(QS60StyleEnums::SkinParts part, QS60WindowSurface::lockBitmapHeap(); if (flags & SF_StateDisabled && !QS60StyleModeSpecifics::disabledPartGraphic(part)) { - // TODO: fix this QStyleOption opt; -// opt.palette = q->standardPalette(); + QPalette *themePalette = QS60StylePrivate::themePalette(); + if (themePalette) + opt.palette = *themePalette; result = QApplication::style()->generatedIconPixmap(QIcon::Disabled, result, &opt); } @@ -1175,14 +1132,25 @@ QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size, Skin QS60WindowSurface::lockBitmapHeap(); if (flags & SF_StateDisabled && !QS60StyleModeSpecifics::disabledFrameGraphic(frame)) { - // TODO: fix this QStyleOption opt; -// opt.palette = q->standardPalette(); + QPalette *themePalette = QS60StylePrivate::themePalette(); + if (themePalette) + opt.palette = *themePalette; result = QApplication::style()->generatedIconPixmap(QIcon::Disabled, result, &opt); } return result; } +QPixmap QS60StylePrivate::backgroundTexture() +{ + if (!m_background) { + QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, + QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), SkinElementFlags()); + m_background = new QPixmap(background); + } + return *m_background; +} + // If the public SDK returns compressed images, please let us also uncompress those! void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap* aTrgBitmap, CFbsBitmap* aSrcBitmap) { @@ -1199,8 +1167,8 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap if (displayMode != aTrgBitmap->DisplayMode()) User::Leave(KErrArgument); - TSize trgSize = aTrgBitmap->SizeInPixels(); - TSize srcSize = aSrcBitmap->SizeInPixels(); + const TSize trgSize = aTrgBitmap->SizeInPixels(); + const TSize srcSize = aSrcBitmap->SizeInPixels(); // calculate the valid drawing area TRect drawRect = aTrgRect; @@ -1236,14 +1204,14 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap const TInt drawWidth = drawRect.Width(); const TInt drawHeight = drawRect.Height(); - TRect offsetRect(aTrgRect.iTl, drawRect.iTl); + const TRect offsetRect(aTrgRect.iTl, drawRect.iTl); const TInt yPosOffset = ySkip * offsetRect.Height(); const TInt xPosOffset = xSkip * offsetRect.Width(); if ((displayMode == EGray256) || (displayMode == EColor256)) { - TInt srcScanLen8 = CFbsBitmap::ScanLineLength(srcSize.iWidth, + const TInt srcScanLen8 = CFbsBitmap::ScanLineLength(srcSize.iWidth, displayMode); - TInt trgScanLen8 = CFbsBitmap::ScanLineLength(trgSize.iWidth, + const TInt trgScanLen8 = CFbsBitmap::ScanLineLength(trgSize.iWidth, displayMode); TUint8* trgAddress8 = reinterpret_cast<TUint8*> (trgAddress); @@ -1253,7 +1221,7 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap trgAddress8 += trgScanLen8 * drawRect.iTl.iY + drawRect.iTl.iX; for (TInt y = 0; y < drawHeight; y++) { - TUint8* srcAddress8 = reinterpret_cast<TUint8*> (srcAddress) + const TUint8* srcAddress8 = reinterpret_cast<const TUint8*> (srcAddress) + (srcScanLen8 * (yPos >> 8)); TInt xPos = xPosOffset; @@ -1267,9 +1235,9 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap trgAddress8 += trgScanLen8 - drawWidth; } } else if (displayMode == EColor4K || displayMode == EColor64K) { - TInt srcScanLen16 = CFbsBitmap::ScanLineLength(srcSize.iWidth, + const TInt srcScanLen16 = CFbsBitmap::ScanLineLength(srcSize.iWidth, displayMode) >>1; - TInt trgScanLen16 = CFbsBitmap::ScanLineLength(trgSize.iWidth, + const TInt trgScanLen16 = CFbsBitmap::ScanLineLength(trgSize.iWidth, displayMode) >>1; TUint16* trgAddress16 = reinterpret_cast<TUint16*> (trgAddress); @@ -1279,7 +1247,7 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap trgAddress16 += trgScanLen16 * drawRect.iTl.iY + drawRect.iTl.iX; for (TInt y = 0; y < drawHeight; y++) { - TUint16* srcAddress16 = reinterpret_cast<TUint16*> (srcAddress) + const TUint16* srcAddress16 = reinterpret_cast<const TUint16*> (srcAddress) + (srcScanLen16 * (yPos >> 8)); TInt xPos = xPosOffset; @@ -1293,9 +1261,9 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap trgAddress16 += trgScanLen16 - drawWidth; } } else if (displayMode == EColor16MU || displayMode == EColor16MA) { - TInt srcScanLen32 = CFbsBitmap::ScanLineLength(srcSize.iWidth, + const TInt srcScanLen32 = CFbsBitmap::ScanLineLength(srcSize.iWidth, displayMode) >>2; - TInt trgScanLen32 = CFbsBitmap::ScanLineLength(trgSize.iWidth, + const TInt trgScanLen32 = CFbsBitmap::ScanLineLength(trgSize.iWidth, displayMode) >>2; TUint32* trgAddress32 = reinterpret_cast<TUint32*> (trgAddress); @@ -1305,7 +1273,7 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap trgAddress32 += trgScanLen32 * drawRect.iTl.iY + drawRect.iTl.iX; for (TInt y = 0; y < drawHeight; y++) { - TUint32* srcAddress32 = reinterpret_cast<TUint32*> (srcAddress) + const TUint32* srcAddress32 = reinterpret_cast<const TUint32*> (srcAddress) + (srcScanLen32 * (yPos >> 8)); TInt xPos = xPosOffset; @@ -1325,8 +1293,8 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap QSize QS60StylePrivate::screenSize() { - TSize mySize = QS60Data::screenDevice()->SizeInPixels(); - return QSize(mySize.iWidth, mySize.iHeight); + const TSize screenSize = QS60Data::screenDevice()->SizeInPixels(); + return QSize(screenSize.iWidth, screenSize.iHeight); } void QS60StyleModeSpecifics::colorGroupAndIndex( @@ -1349,13 +1317,19 @@ void QS60StyleModeSpecifics::colorGroupAndIndex( } } +/*! + Constructs a QS60Style object. +*/ +QS60Style::QS60Style() + : QCommonStyle(*new QS60StylePrivate) +{ +} + void QS60Style::handleDynamicLayoutVariantSwitch() { Q_D(QS60Style); d->clearCaches(QS60StylePrivate::CC_LayoutChange); -#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED d->setActiveLayout(); -#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED d->refreshUI(); d->setBackgroundTexture(qApp); foreach (QWidget *widget, QApplication::allWidgets()) diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index 65336ae..a94d73e 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -21,11 +51,109 @@ #include "qlayout.h" #include "qpixmapcache.h" #include "qmetaobject.h" +#include "qdebug.h" +#include "qbuffer.h" #if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN) QT_BEGIN_NAMESPACE +static const quint32 blobVersion = 1; +static const int pictureSize = 256; + +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; + } + + const int picturesCount = partPictures.count(); + dataOut << picturesCount; + foreach (const QString &key, partPictures.keys()) { + const QPicture picture = partPictures.value(key); + dataOut << key; + dataOut << picture; + } + + 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: @@ -42,19 +170,6 @@ QS60StylePrivate::QS60StylePrivate() setCurrentLayout(0); } -QS60StylePrivate::~QS60StylePrivate() -{ -} - -short QS60StylePrivate::pixelMetric(int metric) -{ - Q_ASSERT(metric < MAX_PIXELMETRICS); - const short returnValue = m_pmPointer[metric]; - if (returnValue==-909) - return -1; - return returnValue; -} - QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list, int index, const QStyleOption *option) { @@ -106,9 +221,10 @@ QPixmap QS60StylePrivate::part(QS60StyleEnums::SkinParts part, const QSize &size QPixmap result = QPixmap::fromImage(partImage); if (flags & SF_StateDisabled) { - // TODO: fix this QStyleOption opt; -// opt.palette = q->standardPalette(); + QPalette *themePalette = QS60StylePrivate::themePalette(); + if (themePalette) + opt.palette = *themePalette; result = QApplication::style()->generatedIconPixmap(QIcon::Disabled, result, &opt); } @@ -151,6 +267,7 @@ QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size, const QRect centerRect = drawOnlyCenter ? rect : rect.adjusted(cornerWidth, cornerWidth, -cornerWidth, -cornerWidth); QImage result(size, QImage::Format_ARGB32); + result.fill(Qt::transparent); QPainter painter(&result); #if 0 @@ -193,24 +310,15 @@ QVariant QS60StylePrivate::styleProperty_specific(const char *name) const QPixmap QS60StylePrivate::backgroundTexture() { - static QPixmap result; - // Poor mans caching. + Making sure that there is always only one background image in memory at a time - -/* - TODO: 1) Hold the background QPixmap as pointer in a static class member. - Also add a deleteBackground() function and call that in ~QS60StylePrivate() - 2) Don't cache the background at all as soon as we have native pixmap support -*/ - - if (!m_backgroundValid) { - result = QPixmap(); - const QSize size = QApplication::activeWindow()?QApplication::activeWindow()->size():QSize(100, 100); - result = part(QS60StyleEnums::SP_QsnBgScreen, size); - m_backgroundValid = true; + if (!m_background) { + const QSize size = QApplication::desktop()->screen()->size(); + QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size); + m_background = new QPixmap(background); } - return result; + return *m_background; } + bool QS60StylePrivate::isTouchSupported() { #ifdef QT_KEYPAD_NAVIGATION @@ -225,7 +333,6 @@ bool QS60StylePrivate::isToolBarBackground() return true; } - QFont QS60StylePrivate::s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize) { QFont result; @@ -245,6 +352,16 @@ QFont QS60StylePrivate::s60Font_specific(QS60StyleEnums::FontCategories fontCate return result; } +/*! + Constructs a QS60Style object. +*/ +QS60Style::QS60Style() + : QCommonStyle(*new QS60StylePrivate) +{ + // Assume, that the resource system has a ':/s60Stylethemes/Default.blob' + loadS60ThemeFromBlob(QString::fromLatin1(":/s60Stylethemes/Default.blob")); +} + Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, enumPartKeys, { const int enumIndex = QS60StyleEnums::staticMetaObject.indexOfEnumerator("SkinParts"); Q_ASSERT(enumIndex >= 0); @@ -290,6 +407,31 @@ void QS60Style::setS60Theme(const QHash<QString, QPicture> &parts, 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 diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 714b8c5..bd80bb6 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -5252,9 +5252,12 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi #ifndef QT_NO_COMBOBOX if (qobject_cast<const QComboBox *>(w)) { QAbstractItemView *view = qFindChild<QAbstractItemView *>(w); - QRenderRule subRule = renderRule(view, PseudoElement_None); - if (subRule.hasBox() || !subRule.hasNativeBorder()) - return QFrame::NoFrame; + if (view) { + view->ensurePolished(); + QRenderRule subRule = renderRule(view, PseudoElement_None); + if (subRule.hasBox() || !subRule.hasNativeBorder()) + return QFrame::NoFrame; + } } #endif // QT_NO_COMBOBOX break; diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index 9aa170e..050d81d 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -160,9 +160,8 @@ contains( styles, s60 ) { styles/qs60style.h \ styles/qs60style_p.h SOURCES += styles/qs60style.cpp - DEFINES += QT_S60STYLE_LAYOUTDATA_SIMULATED symbian { - SOURCES += styles/qs60style_symbian.cpp + SOURCES += styles/qs60style_s60.cpp # TODO: fix the following LIBS hack. Line 1 is for armv5, 2 for winscw LIBS += aknicon aknskins aknskinsrv fontutils LIBS += -laknicon -laknskins -laknskinsrv -lfontutils diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 4d316f6..930e8af 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -173,8 +173,7 @@ Q_GUI_EXPORT int qt_defaultDpiX() screen = subScreens.at(0); dpi = qRound(screen->width() / (screen->physicalWidth() / qreal(25.4))); #elif defined(Q_WS_S60) - const TReal inchWidth = (TReal)S60->screenWidthInTwips / KTwipsPerInch; - dpi = S60->screenWidthInPixels / inchWidth; + dpi = S60->defaultDpiX; #endif // Q_WS_X11 return dpi; @@ -202,8 +201,7 @@ Q_GUI_EXPORT int qt_defaultDpiY() screen = subScreens.at(0); dpi = qRound(screen->height() / (screen->physicalHeight() / qreal(25.4))); #elif defined(Q_WS_S60) - const TReal inchHeight = (TReal)S60->screenHeightInTwips / KTwipsPerInch; - dpi = S60->screenHeightInPixels / inchHeight; + dpi = S60->defaultDpiY; #endif // Q_WS_X11 return dpi; diff --git a/src/gui/text/qfont_s60.cpp b/src/gui/text/qfont_s60.cpp index 2606091..533e51f 100644 --- a/src/gui/text/qfont_s60.cpp +++ b/src/gui/text/qfont_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 0b4567c..ab9291f 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index eec09f4..2e1abb2 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -197,27 +227,14 @@ QImage QFontEngineS60::alphaMapForGlyph(glyph_t glyph) glyph_metrics_t QFontEngineS60::boundingBox(const QGlyphLayout &glyphs) { - glyph_metrics_t overall; - // initialize with line height, we get the same behaviour on all platforms - overall.y = -ascent(); - overall.height = ascent() + descent() + 1; - - QFixed ymax = 0; - QFixed xmax = 0; - for (int i = 0; i < glyphs.numGlyphs; i++) { - const glyph_metrics_t glyphBounds = boundingBox_const(glyphs.glyphs[i]); - QFixed x = overall.xoff + glyphs.offsets[i].x + glyphBounds.x; - QFixed y = overall.yoff + glyphs.offsets[i].y - glyphBounds.y; - overall.x = qMin(overall.x, x); - overall.y = qMin(overall.y, y); - xmax = qMax(xmax, x + glyphBounds.width); - ymax = qMax(ymax, y + glyphBounds.height); - overall.xoff += glyphBounds.xoff; - } - overall.height = qMax(overall.height, ymax - overall.y); - overall.width = xmax - overall.x; + if (glyphs.numGlyphs == 0) + return glyph_metrics_t(); + + QFixed w = 0; + for (int i = 0; i < glyphs.numGlyphs; ++i) + w += glyphs.effectiveAdvance(i); - return overall; + return glyph_metrics_t(0, -ascent(), w, ascent()+descent()+1, w, 0); } glyph_metrics_t QFontEngineS60::boundingBox_const(glyph_t glyph) const diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h index ef4a508..2998de8 100644 --- a/src/gui/text/qfontengine_s60_p.h +++ b/src/gui/text/qfontengine_s60_p.h @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index bf3a176..7341665 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -1406,8 +1406,8 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin #endif #endif - QNativeImage *ni = new QNativeImage(iw + 2 * margin + 2, - ih + 2 * margin + 2, + QNativeImage *ni = new QNativeImage(iw + 2 * margin + 4, + ih + 2 * margin + 4, QNativeImage::systemFormat(), true); ni->image.fill(0xffffffff); @@ -1449,7 +1449,7 @@ QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform) font = CreateFontIndirectW(&lf); } - QNativeImage *mask = drawGDIGlyph(font, glyph, 2, xform); + QNativeImage *mask = drawGDIGlyph(font, glyph, 0, xform); if (mask == 0) return QImage(); diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 88d0610..87da628 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -670,8 +670,8 @@ QRect QFontMetrics::boundingRect(const QString &text) const Returns the rectangle that is covered by ink if character \a ch were to be drawn at the origin of the coordinate system. - Note that the bounding rectangle may extend to the left of (0, 0), - e.g. for italicized fonts, and that the text output may cover \e + Note that the bounding rectangle may extend to the left of (0, 0) + (e.g., for italicized fonts), and that the text output may cover \e all pixels in the bounding rectangle. For a space character the rectangle will usually be empty. @@ -724,7 +724,7 @@ QRect QFontMetrics::boundingRect(QChar ch) const \o Qt::AlignCenter (== \c{Qt::AlignHCenter | Qt::AlignVCenter}) \o Qt::TextSingleLine ignores newline characters in the text. \o Qt::TextExpandTabs expands tabs (see below) - \o Qt::TextShowMnemonic interprets "&x" as \underline{x}, i.e. underlined. + \o Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined. \o Qt::TextWordWrap breaks the text to fit the rectangle. \endlist @@ -781,7 +781,7 @@ QRect QFontMetrics::boundingRect(const QRect &rect, int flags, const QString &te \list \o Qt::TextSingleLine ignores newline characters. \o Qt::TextExpandTabs expands tabs (see below) - \o Qt::TextShowMnemonic interprets "&x" as \underline{x}, i.e. underlined. + \o Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined. \o Qt::TextWordBreak breaks the text to fit the rectangle. \endlist @@ -1500,7 +1500,7 @@ QRectF QFontMetricsF::boundingRect(QChar ch) const \o Qt::AlignCenter (== \c{Qt::AlignHCenter | Qt::AlignVCenter}) \o Qt::TextSingleLine ignores newline characters in the text. \o Qt::TextExpandTabs expands tabs (see below) - \o Qt::TextShowMnemonic interprets "&x" as \underline{x}, i.e. underlined. + \o Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined. \o Qt::TextWordWrap breaks the text to fit the rectangle. \endlist @@ -1559,7 +1559,7 @@ QRectF QFontMetricsF::boundingRect(const QRectF &rect, int flags, const QString& \list \o Qt::TextSingleLine ignores newline characters. \o Qt::TextExpandTabs expands tabs (see below) - \o Qt::TextShowMnemonic interprets "&x" as \underline{x}, i.e. underlined. + \o Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined. \o Qt::TextWordBreak breaks the text to fit the rectangle. \endlist diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index c74af23..6647558 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1611,6 +1611,9 @@ void QTextControlPrivate::mouseMoveEvent(Qt::MouseButtons buttons, const QPointF if (cursor.position() != oldCursorPos) emit q->cursorPositionChanged(); _q_updateCurrentCharFormatAndSelection(); + if (QInputContext *ic = inputContext()) { + ic->update(); + } } else { //emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1))); if (cursor.position() != oldCursorPos) @@ -1813,13 +1816,18 @@ bool QTextControlPrivate::dropEvent(const QMimeData *mimeData, const QPointF &po void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) { + Q_Q(QTextControl); if (!(interactionFlags & Qt::TextEditable) || cursor.isNull()) { e->ignore(); return; } - cursor.beginEditBlock(); + bool isGettingInput = !e->commitString().isEmpty() || !e->preeditString().isEmpty() + || e->replacementLength() > 0; - cursor.removeSelectedText(); + if (isGettingInput) { + cursor.beginEditBlock(); + cursor.removeSelectedText(); + } // insert commit string if (!e->commitString().isEmpty() || e->replacementLength()) { @@ -1829,6 +1837,17 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) c.insertText(e->commitString()); } + for (int i = 0; i < e->attributes().size(); ++i) { + const QInputMethodEvent::Attribute &a = e->attributes().at(i); + if (a.type == QInputMethodEvent::Selection) { + QTextCursor oldCursor = cursor; + cursor.setPosition(a.start, QTextCursor::MoveAnchor); + cursor.setPosition(a.start + a.length, QTextCursor::KeepAnchor); + q->ensureCursorVisible(); + repaintOldAndNewSelection(oldCursor); + } + } + QTextBlock block = cursor.block(); QTextLayout *layout = block.layout(); layout->setPreeditArea(cursor.position() - block.position(), e->preeditString()); @@ -1852,7 +1871,9 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) } } layout->setAdditionalFormats(overrides); - cursor.endEditBlock(); + + if (isGettingInput) + cursor.endEditBlock(); } QVariant QTextControl::inputMethodQuery(Qt::InputMethodQuery property) const @@ -1865,13 +1886,15 @@ QVariant QTextControl::inputMethodQuery(Qt::InputMethodQuery property) const case Qt::ImFont: return QVariant(d->cursor.charFormat().font()); case Qt::ImCursorPosition: - return QVariant(d->cursor.selectionEnd() - block.position()); + return QVariant(d->cursor.position() - block.position()); case Qt::ImSurroundingText: return QVariant(block.text()); case Qt::ImCurrentSelection: return QVariant(d->cursor.selectedText()); case Qt::ImMaximumTextLength: return QVariant(); // No limit. + case Qt::ImAnchorPosition: + return QVariant(qBound(0, d->cursor.anchor() - block.position(), block.length())); default: return QVariant(); } diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index a32a91c..a30e2ed 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp index 347f89a..2bf1cda 100644 --- a/src/gui/widgets/qabstractspinbox.cpp +++ b/src/gui/widgets/qabstractspinbox.cpp @@ -659,7 +659,6 @@ void QAbstractSpinBox::setLineEdit(QLineEdit *lineEdit) d->edit->setParent(this); d->edit->setFrame(false); - d->edit->setAttribute(Qt::WA_InputMethodEnabled, false); d->edit->setFocusProxy(this); d->edit->setAcceptDrops(false); @@ -690,6 +689,18 @@ void QAbstractSpinBox::interpretText() d->interpret(EmitIfChanged); } +/* + Reimplemented in 4.6, so be careful. + */ +/*! + \reimp +*/ +QVariant QAbstractSpinBox::inputMethodQuery(Qt::InputMethodQuery query) const +{ + Q_D(const QAbstractSpinBox); + return d->edit->inputMethodQuery(query); +} + /*! \reimp */ diff --git a/src/gui/widgets/qabstractspinbox.h b/src/gui/widgets/qabstractspinbox.h index 4e7fc3f..aa8905f 100644 --- a/src/gui/widgets/qabstractspinbox.h +++ b/src/gui/widgets/qabstractspinbox.h @@ -122,6 +122,8 @@ public: void interpretText(); bool event(QEvent *event); + QVariant inputMethodQuery(Qt::InputMethodQuery) const; + virtual QValidator::State validate(QString &input, int &pos) const; virtual void fixup(QString &input) const; diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp index 83bec68..4d34691 100644 --- a/src/gui/widgets/qdatetimeedit.cpp +++ b/src/gui/widgets/qdatetimeedit.cpp @@ -2390,6 +2390,7 @@ void QDateTimeEditPrivate::init(const QVariant &var) q->setCalendarPopup(true); #endif updateTimeSpec(); + q->setInputMethodHints(Qt::ImhPreferNumbers); setLayoutItemMargins(QStyle::SE_DateTimeEditLayoutItem); } diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 0d8e16f..a95d2f2 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -2274,8 +2274,16 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e) } #endif - int priorState = d->undoState; - d->removeSelectedText(); + int priorState = 0; + bool isGettingInput = !e->commitString().isEmpty() || !e->preeditString().isEmpty() + || e->replacementLength() > 0; + bool cursorPositionChanged = false; + + if (isGettingInput) { + // If any text is being input, remove selected text. + priorState = d->undoState; + d->removeSelectedText(); + } int c = d->cursor; // cursor position after insertion of commit string if (e->replacementStart() <= 0) @@ -2289,11 +2297,30 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e) d->selend = d->selstart + e->replacementLength(); d->removeSelectedText(); } - if (!e->commitString().isEmpty()) + if (!e->commitString().isEmpty()) { d->insert(e->commitString()); + cursorPositionChanged = true; + } d->cursor = qMin(c, d->text.length()); + for (int i = 0; i < e->attributes().size(); ++i) { + const QInputMethodEvent::Attribute &a = e->attributes().at(i); + if (a.type == QInputMethodEvent::Selection) { + d->cursor = qBound(0, a.start + a.length, d->text.length()); + if (a.length) { + d->selstart = qMax(0, qMin(a.start, d->text.length())); + d->selend = d->cursor; + if (d->selend < d->selstart) { + qSwap(d->selstart, d->selend); + } + } else { + d->selstart = d->selend = 0; + } + cursorPositionChanged = true; + } + } + d->textLayout.setPreeditArea(d->cursor, e->preeditString()); d->preeditCursor = e->preeditString().length(); d->hideCursor = false; @@ -2317,9 +2344,12 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e) d->textLayout.setAdditionalFormats(formats); d->updateTextLayout(); update(); - if (!e->commitString().isEmpty()) + if (cursorPositionChanged) d->emitCursorPositionChanged(); - d->finishChange(priorState); + + if (isGettingInput) + d->finishChange(priorState); + #ifndef QT_NO_COMPLETER if (!e->commitString().isEmpty()) d->complete(Qt::Key_unknown); @@ -2337,13 +2367,20 @@ QVariant QLineEdit::inputMethodQuery(Qt::InputMethodQuery property) const case Qt::ImFont: return font(); case Qt::ImCursorPosition: - return QVariant((d->selend - d->selstart == 0) ? d->cursor : d->selend); + return QVariant(d->cursor); case Qt::ImSurroundingText: return QVariant(d->text); case Qt::ImCurrentSelection: return QVariant(selectedText()); case Qt::ImMaximumTextLength: return QVariant(maxLength()); + case Qt::ImAnchorPosition: + if (d->selstart == d->selend) + return QVariant(d->cursor); + else if (d->selstart == d->cursor) + return QVariant(d->selend); + else + return QVariant(d->selstart); default: return QVariant(); } diff --git a/src/gui/widgets/qmenu.h b/src/gui/widgets/qmenu.h index 1676eb8..bf1c39f 100644 --- a/src/gui/widgets/qmenu.h +++ b/src/gui/widgets/qmenu.h @@ -184,9 +184,6 @@ protected: #ifdef Q_OS_WINCE QAction* wceCommands(uint command); #endif -#ifdef Q_OS_SYMBIAN - void symbianCommands(int command); -#endif private Q_SLOTS: void internalSetSloppyAction(); diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index a45f12f..aafc945 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -358,7 +358,6 @@ public: return 0; } } *symbian_menu; - bool symbianCommands(int command); #endif QPointer<QWidget> noReplayFor; }; diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 86affe3..48c2cf6 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -4,7 +4,37 @@ ** Contact: Qt Software Information (qt-info@nokia.com) ** ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -219,42 +249,18 @@ Q_GUI_EXPORT void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id) } } -void QMenu::symbianCommands(int command) -{ - Q_D(QMenu); - d->symbianCommands(command); -} - -void QMenuBar::symbianCommands(int command) +void QMenuBarPrivate::symbianCommands(int command) { int size = nativeMenuBars.size(); for (int i = 0; i < nativeMenuBars.size(); ++i) { - bool result = nativeMenuBars.at(i)->d_func()->symbianCommands(command); - if (result) - return; - } -} - -bool QMenuBarPrivate::symbianCommands(int command) -{ SymbianMenuItem* menu = qt_symbian_find_menu_item(command, symbianMenus); if (!menu) - return false; - - emit q_func()->triggered(menu->action); - menu->action->activate(QAction::Trigger); - return true; -} - -bool QMenuPrivate::symbianCommands(int command) -{ - SymbianMenuItem* menu = qt_symbian_find_menu_item(command, symbianMenus); - if (!menu) - return false; + continue; - emit q_func()->triggered(menu->action); + emit nativeMenuBars.at(i)->triggered(menu->action); menu->action->activate(QAction::Trigger); - return true; + break; + } } void QMenuBarPrivate::symbianCreateMenuBar(QWidget *parent) diff --git a/src/gui/widgets/qmenubar.h b/src/gui/widgets/qmenubar.h index 36c983b..42f0c0c 100644 --- a/src/gui/widgets/qmenubar.h +++ b/src/gui/widgets/qmenubar.h @@ -118,10 +118,6 @@ public: static void wceRefresh(); #endif -#ifdef Q_OS_SYMBIAN - static void symbianCommands(int command); -#endif - public Q_SLOTS: virtual void setVisible(bool visible); diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h index d562cd9..7993acd 100644 --- a/src/gui/widgets/qmenubar_p.h +++ b/src/gui/widgets/qmenubar_p.h @@ -259,7 +259,7 @@ public: } } *symbian_menubar; - bool symbianCommands(int command); + static void symbianCommands(int command); #endif }; diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index e563fa1..3d2c4f5 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -72,6 +72,11 @@ QT_BEGIN_NAMESPACE +static inline bool shouldEnableInputMethod(QPlainTextEdit *plaintextedit) +{ + return !plaintextedit->isReadOnly(); +} + class QPlainTextDocumentLayoutPrivate : public QAbstractTextDocumentLayoutPrivate { Q_DECLARE_PUBLIC(QPlainTextDocumentLayout) @@ -705,7 +710,8 @@ QPlainTextEditPrivate::QPlainTextEditPrivate() tabChangesFocus(false), lineWrap(QPlainTextEdit::WidgetWidth), wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere), - topLine(0), pageUpDownLastCursorYIsValid(false) + clickCausedFocus(0),topLine(0), + pageUpDownLastCursorYIsValid(false) { showCursorOnInitialShow = true; backgroundVisible = false; @@ -1905,6 +1911,13 @@ void QPlainTextEdit::mouseReleaseEvent(QMouseEvent *e) d->autoScrollTimer.stop(); d->ensureCursorVisible(); } + + if (e->button() == Qt::LeftButton && qApp->autoSipEnabled() + && (!d->clickCausedFocus || qApp->autoSipOnMouseFocus())) { + QEvent event(QEvent::RequestSoftwareInputPanel); + QApplication::sendEvent(this, &event); + } + d->clickCausedFocus = 0; } /*! \reimp @@ -2038,6 +2051,9 @@ QVariant QPlainTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const void QPlainTextEdit::focusInEvent(QFocusEvent *e) { Q_D(QPlainTextEdit); + if (e->reason() == Qt::MouseFocusReason) { + d->clickCausedFocus = 1; + } QAbstractScrollArea::focusInEvent(e); d->sendControlEvent(e); } @@ -2304,7 +2320,7 @@ void QPlainTextEdit::setReadOnly(bool ro) } else { flags = Qt::TextEditorInteraction; } - setAttribute(Qt::WA_InputMethodEnabled, !ro); + setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this)); d->control->setTextInteractionFlags(flags); } diff --git a/src/gui/widgets/qplaintextedit_p.h b/src/gui/widgets/qplaintextedit_p.h index 0739d53..56a3aa9 100644 --- a/src/gui/widgets/qplaintextedit_p.h +++ b/src/gui/widgets/qplaintextedit_p.h @@ -91,7 +91,10 @@ public: return r; } inline QRectF cursorRect() { return cursorRect(textCursor()); } - void ensureCursorVisible() { textEdit->ensureCursorVisible(); } + void ensureCursorVisible() { + textEdit->ensureCursorVisible(); + emit microFocusChanged(); + } QPlainTextEdit *textEdit; @@ -148,6 +151,7 @@ public: uint backgroundVisible : 1; uint centerOnScroll : 1; uint inDrag : 1; + uint clickCausedFocus : 1; int topLine; diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp index c691eaf..295bf48 100644 --- a/src/gui/widgets/qspinbox.cpp +++ b/src/gui/widgets/qspinbox.cpp @@ -77,6 +77,8 @@ public: QChar thousand; inline void init() { + Q_Q(QSpinBox); + q->setInputMethodHints(Qt::ImhDigitsOnly); setLayoutItemMargins(QStyle::SE_SpinBoxLayoutItem); } }; @@ -97,6 +99,11 @@ public: // variables int decimals; QChar delimiter, thousand; + + inline void init() { + Q_Q(QDoubleSpinBox); + q->setInputMethodHints(Qt::ImhFormattedNumbersOnly); + } }; @@ -592,6 +599,8 @@ void QSpinBox::fixup(QString &input) const QDoubleSpinBox::QDoubleSpinBox(QWidget *parent) : QAbstractSpinBox(*new QDoubleSpinBoxPrivate(parent), parent) { + Q_D(QDoubleSpinBox); + d->init(); } /*! diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 69221ba..785d772 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -1536,9 +1536,10 @@ void QTabBar::paintEvent(QPaintEvent *) } if (!d->dragInProgress) p.drawControl(QStyle::CE_TabBarTab, tab); - else - d->movingTab->setGeometry(tab.rect); - + else { + int taboverlap = style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0, this); + d->movingTab->setGeometry(tab.rect.adjusted(-taboverlap, 0, taboverlap, 0)); + } } // Only draw the tear indicator if necessary. Most of the time we don't need too. @@ -1805,7 +1806,9 @@ void QTabBarPrivate::setupMovableTab() if (!movingTab) movingTab = new QWidget(q); + int taboverlap = q->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0 ,q); QRect grabRect = q->tabRect(pressedIndex); + grabRect.adjust(-taboverlap, 0, taboverlap, 0); QPixmap grabImage(grabRect.size()); grabImage.fill(Qt::transparent); @@ -1813,7 +1816,7 @@ void QTabBarPrivate::setupMovableTab() QStyleOptionTabV3 tab; q->initStyleOption(&tab, pressedIndex); - tab.rect.moveTopLeft(QPoint(0, 0)); + tab.rect.moveTopLeft(QPoint(taboverlap, 0)); p.drawControl(QStyle::CE_TabBarTab, tab); p.end(); diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index 1c4df93..c1ec5c2 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -74,6 +74,10 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_TEXTEDIT +static inline bool shouldEnableInputMethod(QTextEdit *textedit) +{ + return !textedit->isReadOnly(); +} class QTextEditControl : public QTextControl { @@ -104,7 +108,7 @@ public: QTextEditPrivate::QTextEditPrivate() : control(0), autoFormatting(QTextEdit::AutoNone), tabChangesFocus(false), - lineWrap(QTextEdit::WidgetWidth), lineWrapColumnOrWidth(0), + lineWrap(QTextEdit::WidgetWidth), lineWrapColumnOrWidth(0), clickCausedFocus(0), wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere), textFormat(Qt::AutoText) { ignoreAutomaticScrollbarAdjustment = false; @@ -1559,6 +1563,12 @@ void QTextEdit::mouseReleaseEvent(QMouseEvent *e) d->autoScrollTimer.stop(); ensureCursorVisible(); } + if (e->button() == Qt::LeftButton && qApp->autoSipEnabled() + && (!d->clickCausedFocus || qApp->autoSipOnMouseFocus())) { + QEvent event(QEvent::RequestSoftwareInputPanel); + QApplication::sendEvent(this, &event); + } + d->clickCausedFocus = 0; } /*! \reimp @@ -1694,6 +1704,9 @@ QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const void QTextEdit::focusInEvent(QFocusEvent *e) { Q_D(QTextEdit); + if (e->reason() == Qt::MouseFocusReason) { + d->clickCausedFocus = 1; + } QAbstractScrollArea::focusInEvent(e); d->sendControlEvent(e); } @@ -2058,7 +2071,7 @@ void QTextEdit::setReadOnly(bool ro) } else { flags = Qt::TextEditorInteraction; } - setAttribute(Qt::WA_InputMethodEnabled, !ro); + setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this)); d->control->setTextInteractionFlags(flags); } diff --git a/src/gui/widgets/qtextedit_p.h b/src/gui/widgets/qtextedit_p.h index 3c37868..594174a 100644 --- a/src/gui/widgets/qtextedit_p.h +++ b/src/gui/widgets/qtextedit_p.h @@ -123,6 +123,7 @@ public: uint preferRichText : 1; uint showCursorOnInitialShow : 1; uint inDrag : 1; + uint clickCausedFocus : 1; // Qt3 COMPAT only, for setText Qt::TextFormat textFormat; diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 79c3d1a..6f715e5 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -382,7 +382,8 @@ void QNetworkReplyImplPrivate::feed(const QByteArray &data) void QNetworkReplyImplPrivate::feed(QIODevice *data) { Q_Q(QNetworkReplyImpl); - Q_ASSERT(q->isOpen()); + if (!q->isOpen()) + return; // read until EOF from data if (copyDevice) { diff --git a/src/network/kernel/qnetworkinterface_symbian.cpp b/src/network/kernel/qnetworkinterface_symbian.cpp index 82c673f..59f1c02 100644 --- a/src/network/kernel/qnetworkinterface_symbian.cpp +++ b/src/network/kernel/qnetworkinterface_symbian.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 768cafb..b6f91e4 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -99,7 +99,7 @@ the client has read the data). Note that Qt does not limit the write buffer size. You can monitor its size by listening to this signal. - + The readyRead() signal is emitted every time a new chunk of data has arrived. bytesAvailable() then returns the number of bytes that are available for reading. Typically, you would connect the @@ -199,9 +199,10 @@ parameter describes the type of error that occurred. QAbstractSocket::SocketError is not a registered metatype, so for queued - connections, you will have to register it with Q_REGISTER_METATYPE. + connections, you will have to register it with Q_DECLARE_METATYPE() and + qRegisterMetaType(). - \sa error(), errorString() + \sa error(), errorString(), {Creating Custom Qt Types} */ /*! @@ -211,9 +212,10 @@ The \a socketState parameter is the new state. QAbstractSocket::SocketState is not a registered metatype, so for queued - connections, you will have to register it with Q_REGISTER_METATYPE. + connections, you will have to register it with Q_REGISTER_METATYPE() and + qRegisterMetaType(). - \sa state() + \sa state(), {Creating Custom Qt Types} */ /*! @@ -1865,9 +1867,9 @@ bool QAbstractSocket::waitForDisconnected(int msecs) } /*! - Aborts the current connection and resets the socket. Unlike - disconnectFromHost(), this function immediately closes the socket, discarding - any pending data in the write buffer. + Aborts the current connection and resets the socket. Unlike disconnectFromHost(), + this function immediately closes the socket, discarding any pending data in the + write buffer. \sa disconnectFromHost(), close() */ @@ -2164,7 +2166,12 @@ void QAbstractSocket::setPeerName(const QString &name) } /*! - Disconnects the socket's connection with the host. + Closes the I/O device for the socket, disconnects the socket's connection with the + host, closes the socket, and resets the name, address, port number and underlying + socket descriptor. + + See QIODevice::close() for a description of the actions that occur when an I/O + device is closed. \sa abort() */ @@ -2457,7 +2464,8 @@ QNetworkProxy QAbstractSocket::proxy() const #endif // QT_NO_NETWORKPROXY #ifdef QT3_SUPPORT -/*! \enum QAbstractSocket::Error +/*! + \enum QAbstractSocket::Error \compat Use QAbstractSocket::SocketError instead. diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index a2ba644..7b554dc 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -267,7 +267,7 @@ QByteArray QSslCertificate::serialNumber() const /*! Returns a cryptographic digest of this certificate. By default, - and MD5 digest will be generated, but you can also specify a + an MD5 digest will be generated, but you can also specify a custom \a algorithm. */ QByteArray QSslCertificate::digest(QCryptographicHash::Algorithm algorithm) const diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 6f8cf42..cb101af 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -482,30 +482,7 @@ void QSslSocketPrivate::resetDefaultCiphers() QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates() { -#ifdef QQ_OS_UNIX - // Check known locations for the system's default bundle. ### On Windows, - // we should use CAPI to find the bundle, and not rely on default unix - // locations. - const char *standardLocations[] = {"/etc/ssl/certs/", -#if 0 - // KDE uses KConfig for its SSL store, - // but it also stores the bundle at - // this location - "$HOME/.kde/share/apps/kssl/ca-bundle.crt", -#endif - 0}; - const char **it = standardLocations; - QStringList nameFilter; - nameFilter << QLatin1String("*.pem") << QLatin1String("*.crt"); - while (*it) { - if (QDirIterator(QLatin1String(*it), nameFilter).hasNext()) - return certificatesFromPath(QLatin1String(*it)); - ++it; - } -#endif - - // Qt provides a default bundle when we cannot detect the system's default - // bundle. + // Qt provides a default bundle of certificates QFile caBundle(QLatin1String(":/trolltech/network/ssl/qt-ca-bundle.crt")); if (caBundle.open(QIODevice::ReadOnly | QIODevice::Text)) return QSslCertificate::fromDevice(&caBundle); diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 42c09f5..0723822 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -231,10 +231,16 @@ DEFINEFUNC3(DSA *, d2i_DSAPrivateKey, DSA **a, a, unsigned char **b, b, long c, DEFINEFUNC(void, OPENSSL_add_all_algorithms_noconf, void, DUMMYARG, return, DUMMYARG) DEFINEFUNC(void, OPENSSL_add_all_algorithms_conf, void, DUMMYARG, return, DUMMYARG) +#ifdef Q_OS_SYMBIAN +#define RESOLVEFUNC(func, ordinal, lib) \ + if (!(_q_##func = _q_PTR_##func(lib->resolve(#ordinal)))) \ + qWarning("QSslSocket: cannot resolve "#func); +#else #define RESOLVEFUNC(func) \ if (!(_q_##func = _q_PTR_##func(libs.first->resolve(#func))) \ && !(_q_##func = _q_PTR_##func(libs.second->resolve(#func)))) \ qWarning("QSslSocket: cannot resolve "#func); +#endif #if !defined QT_LINKED_OPENSSL @@ -335,7 +341,24 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl() pair.first = ssleay32; pair.second = libeay32; return pair; +# elif defined(Q_OS_SYMBIAN) + QLibrary *libssl = new QLibrary(QLatin1String("libssl")); + if (!libssl->load()) { + // Cannot find ssleay32.dll + delete libssl; + return pair; + } + QLibrary *libcrypto = new QLibrary(QLatin1String("libcrypto")); + if (!libcrypto->load()) { + delete libcrypto; + delete libssl; + return pair; + } + + pair.first = libssl; + pair.second = libcrypto; + return pair; # elif defined(Q_OS_UNIX) QLibrary *&libssl = pair.first; QLibrary *&libcrypto = pair.second; @@ -437,6 +460,127 @@ bool q_resolveOpenSslSymbols() // failed to load them return false; +#ifdef Q_OS_SYMBIAN +#ifdef SSLEAY_MACROS + RESOLVEFUNC(ASN1_dup, 125, libs.second ) +#endif + RESOLVEFUNC(ASN1_STRING_data, 71, libs.second ) + RESOLVEFUNC(ASN1_STRING_length, 76, libs.second ) + RESOLVEFUNC(BIO_ctrl, 184, libs.second ) + RESOLVEFUNC(BIO_free, 209, libs.second ) + RESOLVEFUNC(BIO_new, 222, libs.second ) + RESOLVEFUNC(BIO_new_mem_buf, 230, libs.second ) + RESOLVEFUNC(BIO_read, 244, libs.second ) + RESOLVEFUNC(BIO_s_mem, 251, libs.second ) + RESOLVEFUNC(BIO_write, 269, libs.second ) + RESOLVEFUNC(BN_num_bits, 387, libs.second ) + RESOLVEFUNC(CRYPTO_free, 469, libs.second ) + RESOLVEFUNC(CRYPTO_num_locks, 500, libs.second ) + RESOLVEFUNC(CRYPTO_set_id_callback, 513, libs.second ) + RESOLVEFUNC(CRYPTO_set_locking_callback, 516, libs.second ) + RESOLVEFUNC(DSA_free, 594, libs.second ) + RESOLVEFUNC(ERR_error_string, 744, libs.second ) + RESOLVEFUNC(ERR_get_error, 749, libs.second ) + RESOLVEFUNC(EVP_des_ede3_cbc, 919, libs.second ) + RESOLVEFUNC(EVP_PKEY_assign, 859, libs.second ) + RESOLVEFUNC(EVP_PKEY_free, 867, libs.second ) + RESOLVEFUNC(EVP_PKEY_get1_DSA, 869, libs.second ) + RESOLVEFUNC(EVP_PKEY_get1_RSA, 870, libs.second ) + RESOLVEFUNC(EVP_PKEY_new, 876, libs.second ) + RESOLVEFUNC(EVP_PKEY_type, 882, libs.second ) + RESOLVEFUNC(OBJ_nid2sn, 1036, libs.second ) + RESOLVEFUNC(OBJ_obj2nid, 1037, libs.second ) +#ifdef SSLEAY_MACROS // ### verify + RESOLVEFUNC(PEM_ASN1_read_bio, 1180, libs.second ) +#else + RESOLVEFUNC(PEM_read_bio_DSAPrivateKey, 1219, libs.second ) + RESOLVEFUNC(PEM_read_bio_RSAPrivateKey, 1228, libs.second ) + RESOLVEFUNC(PEM_write_bio_DSAPrivateKey, 1260, libs.second ) + RESOLVEFUNC(PEM_write_bio_RSAPrivateKey, 1271, libs.second ) +#endif + RESOLVEFUNC(PEM_read_bio_DSA_PUBKEY, 1220, libs.second ) + RESOLVEFUNC(PEM_read_bio_RSA_PUBKEY, 1230, libs.second ) + RESOLVEFUNC(PEM_write_bio_DSA_PUBKEY, 1261, libs.second ) + RESOLVEFUNC(PEM_write_bio_RSA_PUBKEY, 1273, libs.second ) + RESOLVEFUNC(RAND_seed, 1426, libs.second ) + RESOLVEFUNC(RAND_status, 1429, libs.second ) + RESOLVEFUNC(RSA_free, 1450, libs.second ) + RESOLVEFUNC(sk_free, 2571, libs.second ) + RESOLVEFUNC(sk_num, 2576, libs.second ) + RESOLVEFUNC(sk_value, 2585, libs.second ) + RESOLVEFUNC(SSL_CIPHER_description, 11, libs.first ) + RESOLVEFUNC(SSL_CTX_check_private_key, 21, libs.first ) + RESOLVEFUNC(SSL_CTX_ctrl, 22, libs.first ) + RESOLVEFUNC(SSL_CTX_free, 24, libs.first ) + RESOLVEFUNC(SSL_CTX_new, 35, libs.first ) + RESOLVEFUNC(SSL_CTX_set_cipher_list, 40, libs.first ) + RESOLVEFUNC(SSL_CTX_set_default_verify_paths, 44, libs.first ) + RESOLVEFUNC(SSL_CTX_set_verify, 56, libs.first ) + RESOLVEFUNC(SSL_CTX_set_verify_depth, 57, libs.first ) + RESOLVEFUNC(SSL_CTX_use_certificate, 64, libs.first ) + RESOLVEFUNC(SSL_CTX_use_certificate_file, 67, libs.first ) + RESOLVEFUNC(SSL_CTX_use_PrivateKey, 58, libs.first ) + RESOLVEFUNC(SSL_CTX_use_RSAPrivateKey, 61, libs.first ) + RESOLVEFUNC(SSL_CTX_use_PrivateKey_file, 60, libs.first ) + RESOLVEFUNC(SSL_accept, 82, libs.first ) + RESOLVEFUNC(SSL_clear, 92, libs.first ) + RESOLVEFUNC(SSL_connect, 93, libs.first ) + RESOLVEFUNC(SSL_free, 99, libs.first ) + RESOLVEFUNC(SSL_get_ciphers, 104, libs.first ) + RESOLVEFUNC(SSL_get_current_cipher, 106, libs.first ) + RESOLVEFUNC(SSL_get_error, 110, libs.first ) + RESOLVEFUNC(SSL_get_peer_cert_chain, 117, libs.first ) + RESOLVEFUNC(SSL_get_peer_certificate, 118, libs.first ) + RESOLVEFUNC(SSL_get_verify_result, 132, libs.first ) + RESOLVEFUNC(SSL_library_init, 137, libs.first ) + RESOLVEFUNC(SSL_load_error_strings, 139, libs.first ) + RESOLVEFUNC(SSL_new, 140, libs.first ) + RESOLVEFUNC(SSL_read, 143, libs.first ) + RESOLVEFUNC(SSL_set_accept_state, 148, libs.first ) + RESOLVEFUNC(SSL_set_bio, 149, libs.first ) + RESOLVEFUNC(SSL_set_connect_state, 152, libs.first ) + RESOLVEFUNC(SSL_shutdown, 173, libs.first ) + RESOLVEFUNC(SSL_write, 188, libs.first ) + RESOLVEFUNC(SSLv2_client_method, 192, libs.first ) + RESOLVEFUNC(SSLv3_client_method, 195, libs.first ) + RESOLVEFUNC(SSLv23_client_method, 189, libs.first ) + RESOLVEFUNC(TLSv1_client_method, 198, libs.first ) + RESOLVEFUNC(SSLv2_server_method, 194, libs.first ) + RESOLVEFUNC(SSLv3_server_method, 197, libs.first ) + RESOLVEFUNC(SSLv23_server_method, 191, libs.first ) + RESOLVEFUNC(TLSv1_server_method, 200, libs.first ) + RESOLVEFUNC(X509_NAME_oneline, 1830, libs.second ) + RESOLVEFUNC(X509_PUBKEY_get, 1844, libs.second ) + RESOLVEFUNC(X509_STORE_free, 1939, libs.second ) + RESOLVEFUNC(X509_STORE_new, 1942, libs.second ) + RESOLVEFUNC(X509_STORE_add_cert, 1936, libs.second ) + RESOLVEFUNC(X509_STORE_CTX_free, 1907, libs.second ) + RESOLVEFUNC(X509_STORE_CTX_init, 1919, libs.second ) + RESOLVEFUNC(X509_STORE_CTX_new, 1920, libs.second ) + RESOLVEFUNC(X509_STORE_CTX_set_purpose, 1931, libs.second ) + RESOLVEFUNC(X509_cmp, 1992, libs.second ) +#ifndef SSLEAY_MACROS + RESOLVEFUNC(X509_dup, 1997, libs.second ) +#endif + RESOLVEFUNC(X509_EXTENSION_get_object, 1785, libs.second ) + RESOLVEFUNC(X509_free, 2001, libs.second ) + RESOLVEFUNC(X509_get_ext, 2012, libs.second ) + RESOLVEFUNC(X509_get_ext_count, 2016, libs.second ) + RESOLVEFUNC(X509_get_ext_d2i, 2017, libs.second ) + RESOLVEFUNC(X509_get_issuer_name, 2018, libs.second ) + RESOLVEFUNC(X509_get_subject_name, 2022, libs.second ) + RESOLVEFUNC(X509_verify_cert, 2069, libs.second ) + RESOLVEFUNC(d2i_X509, 2309, libs.second ) + RESOLVEFUNC(i2d_X509, 2489, libs.second ) +#ifdef SSLEAY_MACROS + RESOLVEFUNC(i2d_DSAPrivateKey, 2395, libs.second ) + RESOLVEFUNC(i2d_RSAPrivateKey, 2476, libs.second ) + RESOLVEFUNC(d2i_DSAPrivateKey, 2220, libs.second ) + RESOLVEFUNC(d2i_RSAPrivateKey, 2296, libs.second ) +#endif + RESOLVEFUNC(OPENSSL_add_all_algorithms_noconf, 1153, libs.second ) + RESOLVEFUNC(OPENSSL_add_all_algorithms_conf, 1152, libs.second ) +#else // Q_OS_SYMBIAN #ifdef SSLEAY_MACROS RESOLVEFUNC(ASN1_dup) #endif @@ -556,6 +700,7 @@ bool q_resolveOpenSslSymbols() #endif RESOLVEFUNC(OPENSSL_add_all_algorithms_noconf) RESOLVEFUNC(OPENSSL_add_all_algorithms_conf) +#endif // Q_OS_SYMBIAN symbolsResolved = true; delete libs.first; delete libs.second; diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index a74f044..beb4da6 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -926,6 +926,9 @@ void QGL2PaintEngineEx::drawCachedGlyphs(const QPointF &p, const QTextItemInt &t const QImage &image = cache->image(); int margin = cache->glyphMargin(); + if (image.isNull()) + return; + glActiveTexture(QT_BRUSH_TEXTURE_UNIT); d->ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, true); diff --git a/src/phonon/phonon.pro b/src/phonon/phonon.pro index 679a1b0..b38adb8 100644 --- a/src/phonon/phonon.pro +++ b/src/phonon/phonon.pro @@ -13,13 +13,6 @@ PHONON_DIR = $$QT_SOURCE_TREE/src/3rdparty/phonon/phonon unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork -# Phonon depends on numeric_limits. Enabling STL support in Qt -# would bring in link dependencies, and we don't need that for -# numeric_limits, hence we here merely ensure we bring in the necessary -# header. -symbian:INCLUDEPATH += $${EPOCROOT}epoc32/include/stdapis/stlport \ - $$OS_LAYER_STDCPP_SYSTEMINCLUDE - # Input HEADERS += $$PHONON_DIR/abstractaudiooutput.h \ $$PHONON_DIR/abstractaudiooutput_p.h \ @@ -122,7 +115,16 @@ contains(QT_CONFIG, dbus) { contains(QT_CONFIG, reduce_exports): CONFIG += hide_symbols symbian: { + # Phonon depends on numeric_limits. Enabling STL support in Qt + # would bring in link dependencies, and we don't need that for + # numeric_limits, hence we here merely ensure we bring in the necessary + # header. + INCLUDEPATH *= $${EPOCROOT}epoc32/include/stdapis/stlport \ + $$OS_LAYER_STDCPP_SYSTEMINCLUDE + # Without this setting, code using numeric_limits will fail # for winscw, although armv5 works fine no matter what. - MMP_RULES += "option cw -wchar_t on" + QMAKE_CXXFLAGS.CW *= $$STLLIB_USAGE_CW_FLAGS + + TARGET.UID3 = 0x2001E624 } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h index 13f0a8f..180acaf 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h @@ -61,8 +61,6 @@ public: void lockDirectFB(uint flags); void unlockDirectFB(); - inline bool forceRasterPrimitives() const { return forceRaster; } - // Reimplemented from QCustomRasterPaintDevice: void* memory() const; QImage::Format format() const; @@ -77,7 +75,6 @@ protected: dfbSurface(0), lockedImage(0), screen(scr), - forceRaster(false), lock(0), mem(0) {} @@ -95,7 +92,6 @@ protected: QImage *lockedImage; QDirectFBScreen *screen; int bpl; - bool forceRaster; uint lock; uchar *mem; private: diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index a68bc8f..2fb533a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -81,7 +81,7 @@ template <> inline const bool* ptr<bool>(const bool &) { return 0; } template <typename device, typename T1, typename T2, typename T3> static void rasterFallbackWarn(const char *msg, const char *func, const device *dev, int scale, bool matrixRotShear, bool simplePen, - bool dfbHandledClip, bool forceRasterPrimitives, + bool dfbHandledClip, const char *nameOne, const T1 &one, const char *nameTwo, const T2 &two, const char *nameThree, const T3 &three) @@ -98,8 +98,7 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * dbg << "scale" << scale << "matrixRotShear" << matrixRotShear << "simplePen" << simplePen - << "dfbHandledClip" << dfbHandledClip - << "forceRasterPrimitives" << forceRasterPrimitives; + << "dfbHandledClip" << dfbHandledClip; const T1 *t1 = ptr(one); const T2 *t2 = ptr(two); @@ -125,7 +124,6 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * __FUNCTION__, state()->painter->device(), \ d_func()->scale, d_func()->matrixRotShear, \ d_func()->simplePen, d_func()->dfbCanHandleClip(), \ - d_func()->forceRasterPrimitives, \ #one, one, #two, two, #three, three); \ if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \ return; @@ -140,7 +138,6 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * __FUNCTION__, state()->painter->device(), \ d_func()->scale, d_func()->matrixRotShear, \ d_func()->simplePen, d_func()->dfbCanHandleClip(), \ - d_func()->forceRasterPrimitives, \ #one, one, #two, two, #three, three); #else #define RASTERFALLBACK(op, one, two, three) @@ -218,8 +215,8 @@ public: void setTransform(const QTransform &m); void setPen(const QPen &pen); - void setCompositionMode(QPainter::CompositionMode mode); - void setOpacity(quint8 value); + inline void setCompositionMode(QPainter::CompositionMode mode); + inline void setOpacity(quint8 value); void setRenderHints(QPainter::RenderHints hints); inline void setDFBColor(const QColor &color); @@ -263,7 +260,6 @@ private: QPen pen; bool antialiased; - bool forceRasterPrimitives; bool simplePen; @@ -280,14 +276,12 @@ private: quint8 opacity; - quint32 drawFlagsFromCompositionMode, blitFlagsFromCompositionMode; - DFBSurfacePorterDuffRule porterDuffRule; - bool dirtyClip; bool dfbHandledClip; bool ignoreSystemClip; QDirectFBPaintDevice *dfbDevice; void *lockedMemory; + bool unsupportedCompositionMode; QDirectFBPaintEngine *q; friend class QDirectFBPaintEngine; @@ -407,9 +401,8 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount) Q_D(QDirectFBPaintEngine); d->updateClip(); const QBrush &brush = state()->brush; - if (!d->dfbCanHandleClip() || d->matrixRotShear - || !d->simplePen || d->forceRasterPrimitives - || !d->isSimpleBrush(brush)) { + if (d->unsupportedCompositionMode || !d->dfbCanHandleClip() || d->matrixRotShear + || !d->simplePen || !d->isSimpleBrush(brush)) { RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); @@ -433,9 +426,8 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount) Q_D(QDirectFBPaintEngine); d->updateClip(); const QBrush &brush = state()->brush; - if (!d->dfbCanHandleClip() || d->matrixRotShear - || !d->simplePen || d->forceRasterPrimitives - || !d->isSimpleBrush(brush)) { + if (d->unsupportedCompositionMode || !d->dfbCanHandleClip() || d->matrixRotShear + || !d->simplePen || !d->isSimpleBrush(brush)) { RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); @@ -458,7 +450,7 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount) { Q_D(QDirectFBPaintEngine); d->updateClip(); - if (!d->simplePen || !d->dfbCanHandleClip() || d->forceRasterPrimitives) { + if (d->unsupportedCompositionMode || !d->simplePen || !d->dfbCanHandleClip()) { RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawLines(lines, lineCount); @@ -476,7 +468,7 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount) { Q_D(QDirectFBPaintEngine); d->updateClip(); - if (!d->simplePen || !d->dfbCanHandleClip() || d->forceRasterPrimitives) { + if (d->unsupportedCompositionMode || !d->simplePen || !d->dfbCanHandleClip()) { RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawLines(lines, lineCount); @@ -516,7 +508,8 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image, d->updateClip(); #if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE - if (d->matrixRotShear + if (d->unsupportedCompositionMode + || d->matrixRotShear || d->scale == QDirectFBPaintEnginePrivate::NegativeScale || !d->dfbCanHandleClip(r) #ifndef QT_DIRECTFB_IMAGECACHE @@ -560,7 +553,7 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr); d->lock(); QRasterPaintEngine::drawPixmap(r, pixmap, sr); - } else if (!d->dfbCanHandleClip(r) || d->matrixRotShear + } else if (d->unsupportedCompositionMode || !d->dfbCanHandleClip(r) || d->matrixRotShear || d->scale == QDirectFBPaintEnginePrivate::NegativeScale) { RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr); const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ); @@ -592,7 +585,7 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r, RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), sp); d->lock(); QRasterPaintEngine::drawTiledPixmap(r, pixmap, sp); - } else if (!d->dfbCanHandleClip(r) || d->matrixRotShear || !sp.isNull() + } else if (d->unsupportedCompositionMode || !d->dfbCanHandleClip(r) || d->matrixRotShear || !sp.isNull() || d->scale == QDirectFBPaintEnginePrivate::NegativeScale) { RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), sp); const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ); @@ -688,11 +681,9 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) { Q_D(QDirectFBPaintEngine); d->updateClip(); - if (d->dfbCanHandleClip(rect) && !d->matrixRotShear) { + if (!d->unsupportedCompositionMode && d->dfbCanHandleClip(rect) && !d->matrixRotShear) { switch (brush.style()) { case Qt::SolidPattern: { - if (d->forceRasterPrimitives) - break; d->unlock(); d->setDFBColor(brush.color()); const QRect r = d->transform.mapRect(rect).toRect(); @@ -720,7 +711,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color) { Q_D(QDirectFBPaintEngine); d->updateClip(); - if (!d->dfbCanHandleClip() || d->matrixRotShear || d->forceRasterPrimitives) { + if (d->unsupportedCompositionMode || !d->dfbCanHandleClip() || d->matrixRotShear) { RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG()); d->lock(); QRasterPaintEngine::fillRect(rect, color); @@ -737,38 +728,32 @@ void QDirectFBPaintEngine::drawColorSpans(const QSpan *spans, int count, uint color) { Q_D(QDirectFBPaintEngine); - if (d->forceRasterPrimitives) { - RASTERFALLBACK(DRAW_COLORSPANS, count, color, VOID_ARG()); - d->lock(); - QRasterPaintEngine::drawColorSpans(spans, count, color); - } else { - color = INV_PREMUL(color); - - QVarLengthArray<DFBRegion> lines(count); - int j = 0; - for (int i = 0; i < count; ++i) { - if (spans[i].coverage == 255) { - lines[j].x1 = spans[i].x; - lines[j].y1 = spans[i].y; - lines[j].x2 = spans[i].x + spans[i].len - 1; - lines[j].y2 = spans[i].y; - ++j; - } else { - DFBSpan span = { spans[i].x, spans[i].len }; - uint c = BYTE_MUL(color, spans[i].coverage); - // ### how does this play with setDFBColor - d->surface->SetColor(d->surface, - qRed(c), qGreen(c), qBlue(c), qAlpha(c)); - d->surface->FillSpans(d->surface, spans[i].y, &span, 1); - } - } - if (j > 0) { + color = INV_PREMUL(color); + + QVarLengthArray<DFBRegion> lines(count); + int j = 0; + for (int i = 0; i < count; ++i) { + if (spans[i].coverage == 255) { + lines[j].x1 = spans[i].x; + lines[j].y1 = spans[i].y; + lines[j].x2 = spans[i].x + spans[i].len - 1; + lines[j].y2 = spans[i].y; + ++j; + } else { + DFBSpan span = { spans[i].x, spans[i].len }; + uint c = BYTE_MUL(color, spans[i].coverage); + // ### how does this play with setDFBColor d->surface->SetColor(d->surface, - qRed(color), qGreen(color), qBlue(color), - qAlpha(color)); - d->surface->DrawLines(d->surface, lines.data(), j); + qRed(c), qGreen(c), qBlue(c), qAlpha(c)); + d->surface->FillSpans(d->surface, spans[i].y, &span, 1); } } + if (j > 0) { + d->surface->SetColor(d->surface, + qRed(color), qGreen(color), qBlue(color), + qAlpha(color)); + d->surface->DrawLines(d->surface, lines.data(), j); + } } void QDirectFBPaintEngine::drawBufferSpan(const uint *buffer, int bufsize, @@ -803,11 +788,11 @@ void QDirectFBPaintEngine::initImageCache(int size) QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p) - : surface(0), antialiased(false), forceRasterPrimitives(false), simplePen(false), + : surface(0), antialiased(false), simplePen(false), matrixRotShear(false), scale(NoScale), lastLockedHeight(-1), - fbWidth(-1), fbHeight(-1), opacity(255), drawFlagsFromCompositionMode(0), - blitFlagsFromCompositionMode(0), porterDuffRule(DSPD_SRC_OVER), dirtyClip(true), - dfbHandledClip(false), dfbDevice(0), lockedMemory(0), q(p) + fbWidth(-1), fbHeight(-1), opacity(255), dirtyClip(true), + dfbHandledClip(false), dfbDevice(0), lockedMemory(0), + unsupportedCompositionMode(false), q(p) { fb = QDirectFBScreen::instance()->dfb(); ignoreSystemClip = QDirectFBScreen::instance()->directFBFlags() & QDirectFBScreen::IgnoreSystemClip; @@ -896,13 +881,12 @@ void QDirectFBPaintEnginePrivate::begin(QPaintDevice *device) device->devType()); } lockedMemory = 0; - forceRasterPrimitives = dfbDevice->forceRasterPrimitives(); surface->GetSize(surface, &fbWidth, &fbHeight); setTransform(QTransform()); antialiased = false; - opacity = 255; + setOpacity(255); setCompositionMode(q->state()->compositionMode()); dirtyClip = true; setPen(q->state()->pen); @@ -930,72 +914,13 @@ void QDirectFBPaintEnginePrivate::setPen(const QPen &p) void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode mode) { - blitFlagsFromCompositionMode = DSBLIT_NOFX; - drawFlagsFromCompositionMode = DSDRAW_NOFX; - - bool blend = true; - switch (mode) { - case QPainter::CompositionMode_SourceOver: - porterDuffRule = DSPD_SRC_OVER; - break; - case QPainter::CompositionMode_DestinationOver: - porterDuffRule = DSPD_DST_OVER; - break; - case QPainter::CompositionMode_Clear: - porterDuffRule = DSPD_CLEAR; - blend = false; - break; - case QPainter::CompositionMode_Source: - porterDuffRule = DSPD_SRC; - blend = false; - break; - case QPainter::CompositionMode_Destination: - porterDuffRule = DSPD_NONE; // ### need to double check this - blend = false; - return; - case QPainter::CompositionMode_SourceIn: - porterDuffRule = DSPD_SRC_IN; - break; - case QPainter::CompositionMode_DestinationIn: - porterDuffRule = DSPD_DST_IN; - break; - case QPainter::CompositionMode_SourceOut: - porterDuffRule = DSPD_SRC_OUT; - break; - case QPainter::CompositionMode_DestinationOut: - porterDuffRule = DSPD_DST_OUT; - break; - case QPainter::CompositionMode_Xor: - porterDuffRule = DSPD_XOR; - blitFlagsFromCompositionMode |= DSBLIT_XOR; - drawFlagsFromCompositionMode |= DSDRAW_XOR; - break; -// case QPainter::CompositionMode_Plus: // ??? -// porterDuffRule = DSPD_ADD; -// break; - default: - qWarning("QDirectFBPaintEnginePrivate::setCompositionMode(): " - "mode %d not implemented", mode); - return; - } - // intentially not comparing with current porterDuffRule. surface might have changed. - if (blend) { - blitFlagsFromCompositionMode |= DSBLIT_BLEND_ALPHACHANNEL; - drawFlagsFromCompositionMode |= DSDRAW_BLEND; - } - if (opacity != 255) { - setOpacity(opacity); - } + unsupportedCompositionMode = (mode != QPainter::CompositionMode_SourceOver); } + void QDirectFBPaintEnginePrivate::setOpacity(quint8 op) { opacity = op; - if (opacity == 255) { - blitFlagsFromCompositionMode &= ~DSBLIT_BLEND_COLORALPHA; - } else { - blitFlagsFromCompositionMode |= DSBLIT_BLEND_COLORALPHA; - } } void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints) @@ -1009,15 +934,9 @@ void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints) void QDirectFBPaintEnginePrivate::prepareForBlit(bool alpha) { - quint32 blittingFlags = blitFlagsFromCompositionMode; - if (alpha) { - surface->SetPorterDuff(surface, - (blittingFlags & DSBLIT_BLEND_COLORALPHA) - ? DSPD_NONE - : porterDuffRule); - } else { - blittingFlags &= ~DSBLIT_BLEND_ALPHACHANNEL; - surface->SetPorterDuff(surface, DSPD_NONE); + quint32 blittingFlags = alpha ? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; + if (opacity != 255) { + blittingFlags |= DSBLIT_BLEND_COLORALPHA; } surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); surface->SetBlittingFlags(surface, DFBSurfaceBlittingFlags(blittingFlags)); @@ -1028,15 +947,9 @@ void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) Q_ASSERT(surface); const quint8 alpha = (opacity == 255 ? color.alpha() : ALPHA_MUL(color.alpha(), opacity)); - surface->SetColor(surface, - color.red(), color.green(), color.blue(), alpha); - quint32 drawingFlags = drawFlagsFromCompositionMode; - if (alpha == 255) { - drawingFlags &= ~DSDRAW_BLEND; - } + surface->SetColor(surface, color.red(), color.green(), color.blue(), alpha); surface->SetPorterDuff(surface, DSPD_NONE); - // PorterDuff messes up alpha values for primitives - surface->SetDrawingFlags(surface, DFBSurfaceDrawingFlags(drawingFlags)); + surface->SetDrawingFlags(surface, alpha == 255 ? DSDRAW_NOFX : DSDRAW_BLEND); } void QDirectFBPaintEnginePrivate::drawLines(const QLine *lines, int n) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index c9b676a..dba1b51 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -76,7 +76,6 @@ void QDirectFBPixmapData::resize(int width, int height) format, QDirectFBScreen::TrackSurface); alpha = false; - forceRaster = (format == QImage::Format_RGB32); if (!dfbSurface) { invalidate(); qWarning("QDirectFBPixmapData::resize(): Unable to allocate surface"); @@ -187,7 +186,6 @@ void QDirectFBPixmapData::fromImage(const QImage &i, } dfbSurface = screen->copyToDFBSurface(img, format, QDirectFBScreen::TrackSurface); - forceRaster = (format == QImage::Format_RGB32); if (!dfbSurface) { qWarning("QDirectFBPixmapData::fromImage()"); invalidate(); @@ -216,7 +214,6 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect) invalidate(); return; } - forceRaster = (format == QImage::Format_RGB32); if (hasAlpha) { dfbSurface->Clear(dfbSurface, 0, 0, 0, 0); @@ -268,7 +265,6 @@ void QDirectFBPixmapData::fill(const QColor &color) screen->releaseDFBSurface(dfbSurface); format = screen->alphaPixmapFormat(); dfbSurface = screen->createDFBSurface(size, screen->alphaPixmapFormat(), QDirectFBScreen::TrackSurface); - forceRaster = false; setSerialNumber(++global_ser_no); if (!dfbSurface) { qWarning("QDirectFBPixmapData::fill()"); @@ -277,24 +273,7 @@ void QDirectFBPixmapData::fill(const QColor &color) } } - if (forceRaster) { - // in DSPF_RGB32 all dfb drawing causes the Alpha byte to be - // set to 0. This causes issues for the raster engine. - uchar *mem = QDirectFBScreen::lockSurface(dfbSurface, DSLF_WRITE, &bpl); - if (mem) { - const int h = QPixmapData::height(); - const int w = QPixmapData::width() * 4; // 4 bytes per 32 bit pixel - const int c = color.rgba(); - for (int i = 0; i < h; ++i) { - memset(mem, c, w); - mem += bpl; - } - dfbSurface->Unlock(dfbSurface); - } - } else { - dfbSurface->Clear(dfbSurface, color.red(), color.green(), color.blue(), - color.alpha()); - } + dfbSurface->Clear(dfbSurface, color.red(), color.green(), color.blue(), color.alpha()); } QPixmap QDirectFBPixmapData::transformed(const QTransform &transform, diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 98e32ed..9e35a66 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -958,9 +958,6 @@ bool QDirectFBScreen::connect(const QString &displaySpec) return false; } - if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive)) - printDirectFBInfo(d_ptr->dfb, d_ptr->dfbSurface); - // Work out what format we're going to use for surfaces with an alpha channel d_ptr->alphaPixmapFormat = QDirectFBScreen::getImageFormat(d_ptr->dfbSurface); setPixelFormat(d_ptr->alphaPixmapFormat); @@ -971,12 +968,17 @@ bool QDirectFBScreen::connect(const QString &displaySpec) case QImage::Format_RGB444: d_ptr->alphaPixmapFormat = QImage::Format_ARGB4444_Premultiplied; break; + case QImage::Format_RGB32: + qWarning("QDirectFBScreen::connect(). Qt/DirectFB does not work with the RGB32 pixelformat. " + "We recommmend using ARGB instead"); + return false; + case QImage::Format_Indexed8: + qWarning("QDirectFBScreen::connect(). Qt/DirectFB does not work with the LUT8 pixelformat."); + return false; case QImage::NImageFormats: case QImage::Format_Invalid: case QImage::Format_Mono: case QImage::Format_MonoLSB: - case QImage::Format_Indexed8: - case QImage::Format_RGB32: case QImage::Format_RGB888: case QImage::Format_RGB16: case QImage::Format_RGB555: @@ -1037,6 +1039,9 @@ bool QDirectFBScreen::connect(const QString &displaySpec) setGraphicsSystem(d_ptr); + if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive)) + printDirectFBInfo(d_ptr->dfb, d_ptr->dfbSurface); + return true; } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index cd8796b..330eb88 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -127,7 +127,6 @@ void QDirectFBWindowSurface::createWindow() dfbSurface->Release(dfbSurface); dfbWindow->GetSurface(dfbWindow, &dfbSurface); - forceRaster = (format == QImage::Format_RGB32); #endif } #endif // QT_NO_DIRECTFB_WM @@ -164,7 +163,6 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect, const QRegion &mask) rect.width(), rect.height() }; result = primarySurface->GetSubSurface(primarySurface, &r, &dfbSurface); } - forceRaster = (dfbSurface && QDirectFBScreen::getImageFormat(dfbSurface) == QImage::Format_RGB32); } else { const bool isResize = rect.size() != geometry().size(); #ifdef QT_NO_DIRECTFB_WM @@ -179,7 +177,6 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect, const QRegion &mask) } dfbSurface = screen->createDFBSurface(rect.size(), screen->pixelFormat(), QDirectFBScreen::DontTrackSurface); - forceRaster = (dfbSurface && QDirectFBScreen::getImageFormat(dfbSurface) == QImage::Format_RGB32); } else { Q_ASSERT(dfbSurface); } @@ -242,31 +239,28 @@ void QDirectFBWindowSurface::setPermanentState(const QByteArray &state) #endif } -bool QDirectFBWindowSurface::scroll(const QRegion ®ion, int dx, int dy) +static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) { - if (!dfbSurface || !(flipFlags & DSFLIP_BLIT)) - return false; - - const QVector<QRect> rects = region.rects(); - const int n = rects.size(); - - QVarLengthArray<DFBRectangle, 8> dfbRects(n); - QVarLengthArray<DFBPoint, 8> dfbPoints(n); + surface->SetBlittingFlags(surface, DSBLIT_NOFX); + const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; + surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy); +} - for (int i = 0; i < n; ++i) { - const QRect r = rects.at(i); - dfbRects[i].x = r.x(); - dfbRects[i].y = r.y(); - dfbRects[i].w = r.width(); - dfbRects[i].h = r.height(); - dfbPoints[i].x = r.x() + dx; - dfbPoints[i].y = r.y() + dy; - } +bool QDirectFBWindowSurface::scroll(const QRegion ®ion, int dx, int dy) +{ + if (!dfbSurface || !(flipFlags & DSFLIP_BLIT) || region.isEmpty()) + return false; dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); - dfbSurface->BatchBlit(dfbSurface, dfbSurface, - dfbRects.data(), dfbPoints.data(), n); - dfbSurface->ReleaseSource(dfbSurface); + if (region.numRects() == 1) { + ::scrollSurface(dfbSurface, region.boundingRect(), dx, dy); + } else { + const QVector<QRect> rects = region.rects(); + const int n = rects.size(); + for (int i=0; i<n; ++i) { + ::scrollSurface(dfbSurface, rects.at(i), dx, dy); + } + } return true; } diff --git a/src/plugins/s60/src/qdesktopservices_3_1.cpp b/src/plugins/s60/src/qdesktopservices_3_1.cpp index 1b7edbd..0551a74 100644 --- a/src/plugins/s60/src/qdesktopservices_3_1.cpp +++ b/src/plugins/s60/src/qdesktopservices_3_1.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/s60/src/qdesktopservices_3_2.cpp b/src/plugins/s60/src/qdesktopservices_3_2.cpp index e563c14..7695f00 100644 --- a/src/plugins/s60/src/qdesktopservices_3_2.cpp +++ b/src/plugins/s60/src/qdesktopservices_3_2.cpp @@ -5,15 +5,47 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ #include <private/qcore_symbian_p.h> -#include <cdirectorylocalizer.h> // CDirectoryLocalizer #include <qstring.h> #include <qdir.h> +#include <e32base.h> // CBase -> Required by cdirectorylocalizer.h +#include <cdirectorylocalizer.h> // CDirectoryLocalizer + EXPORT_C QString localizedDirectoryName(QString& rawPath) { QString ret; diff --git a/src/plugins/s60/src/qlocale_3_1.cpp b/src/plugins/s60/src/qlocale_3_1.cpp index 95cf244..b2e6a5d 100644 --- a/src/plugins/s60/src/qlocale_3_1.cpp +++ b/src/plugins/s60/src/qlocale_3_1.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/s60/src/qlocale_3_2.cpp b/src/plugins/s60/src/qlocale_3_2.cpp index 027eefc..ab3040b 100644 --- a/src/plugins/s60/src/qlocale_3_2.cpp +++ b/src/plugins/s60/src/qlocale_3_2.cpp @@ -5,11 +5,42 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ #include <e32std.h> +#include <e32base.h> EXPORT_C TPtrC defaultGetLongDateFormatSpec(TExtendedLocale& locale) { diff --git a/src/s60main/qts60main.cpp b/src/s60main/qts60main.cpp index 1d19cc6..965c02b 100644 --- a/src/s60main/qts60main.cpp +++ b/src/s60main/qts60main.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp index 10a784a..b7bf1a3 100644 --- a/src/s60main/qts60main_mcrt0.cpp +++ b/src/s60main/qts60main_mcrt0.cpp @@ -2,7 +2,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_3RDPARTY_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/s60main/qts60mainapplication.cpp b/src/s60main/qts60mainapplication.cpp index 807b5af..680243f 100644 --- a/src/s60main/qts60mainapplication.cpp +++ b/src/s60main/qts60mainapplication.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/s60main/qts60mainapplication.h b/src/s60main/qts60mainapplication.h index 318f83b..70b6909 100644 --- a/src/s60main/qts60mainapplication.h +++ b/src/s60main/qts60mainapplication.h @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/s60main/qts60mainappui.cpp b/src/s60main/qts60mainappui.cpp index dafbe96..47312af 100644 --- a/src/s60main/qts60mainappui.cpp +++ b/src/s60main/qts60mainappui.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -73,7 +103,20 @@ CQtS60MainAppUi::~CQtS60MainAppUi() void CQtS60MainAppUi::HandleCommandL( TInt aCommand ) { if (qApp) - qApp->s60HandleCommandL(aCommand); + qApp->symbianHandleCommand(aCommand); +} + +// ----------------------------------------------------------------------------- +// CQtS60MainAppUi::HandleResourceChangeL() +// Takes care of event handling. +// ----------------------------------------------------------------------------- +// +void CQtS60MainAppUi::HandleResourceChangeL(TInt aType) +{ + CAknAppUi::HandleResourceChangeL(aType); + + if (qApp) + qApp->symbianResourceChange(aType); } void CQtS60MainAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl *control) diff --git a/src/s60main/qts60mainappui.h b/src/s60main/qts60mainappui.h index 3addb0c..6bdeb2e 100644 --- a/src/s60main/qts60mainappui.h +++ b/src/s60main/qts60mainappui.h @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -61,6 +91,13 @@ class CQtS60MainAppUi : public CAknAppUi void HandleCommandL( TInt aCommand ); /** + * From CAknAppUi, HandleResourceChangeL + * Handles resource change events such as layout switches in global level. + * @param aType event type. + */ + void HandleResourceChangeL(TInt aType); + + /** * HandleStatusPaneSizeChange. * Called by the framework when the application status pane * size is changed. diff --git a/src/s60main/qts60maindocument.cpp b/src/s60main/qts60maindocument.cpp index 9ab426d..b4a2e66 100644 --- a/src/s60main/qts60maindocument.cpp +++ b/src/s60main/qts60maindocument.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/s60main/qts60maindocument.h b/src/s60main/qts60maindocument.h index 4979e7f..a95e620 100644 --- a/src/s60main/qts60maindocument.h +++ b/src/s60main/qts60maindocument.h @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/s60main/s60main.rss b/src/s60main/s60main.rss index 569f59e..6e8004c 100644 --- a/src/s60main/s60main.rss +++ b/src/s60main/s60main.rss @@ -5,7 +5,37 @@ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** -** $TROLLTECH_DUAL_EMBEDDED_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/svg/qsvggenerator.cpp b/src/svg/qsvggenerator.cpp index e822da5..fd4c875 100644 --- a/src/svg/qsvggenerator.cpp +++ b/src/svg/qsvggenerator.cpp @@ -261,7 +261,7 @@ public: constantAlpha &= (stops.at(i).second.alpha() == alpha); if (!constantAlpha) { - const qreal spacing = 0.02; + const qreal spacing = qreal(0.02); QGradientStops newStops; QRgb fromColor = PREMUL(stops.at(0).second.rgba()); QRgb toColor; diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index 6ea38f7..15319ce 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -226,10 +226,17 @@ int main(int argc, char *argv[]) \ #include <QtTest/qtest_gui.h> +#ifdef QT_KEYPAD_NAVIGATION +# define QTEST_DISABLE_KEYPAD_NAVIGATION QApplication::setKeypadNavigationEnabled(false); +#else +# define QTEST_DISABLE_KEYPAD_NAVIGATION +#endif + #define QTEST_MAIN(TestObject) \ int main(int argc, char *argv[]) \ { \ QApplication app(argc, argv); \ + QTEST_DISABLE_KEYPAD_NAVIGATION \ TestObject tc; \ return QTest::qExec(&tc, argc, argv); \ } diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 27ba6da..b676012 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -300,10 +300,15 @@ QT_BEGIN_NAMESPACE the \a TestClass, and executes all tests in the order they were defined. Use this macro to build stand-alone executables. + \bold {Note:} On platforms that have keypad navigation enabled by default (eg: Symbian), + this macro will forcfully disable it to simplify the usage of key events when writing + autotests. If you wish to write a test case that uses keypad navigation, you should + enable it either in the \c {initTestCase()} or \c {init()} functions of your test case. + Example: \snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 11 - \sa QTEST_APPLESS_MAIN(), QTest::qExec() + \sa QTEST_APPLESS_MAIN(), QTest::qExec(), QApplication::setKeypadNavigationEnabled() */ /*! \macro QTEST_APPLESS_MAIN(TestClass) |