diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2010-02-04 12:37:18 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2010-02-04 12:37:18 (GMT) |
commit | 8f83747d12efc612b730a7dd911f916127387c0c (patch) | |
tree | d61b4c877cd14247ae0de260034cb99494434c5d /src | |
parent | 53038b678ccba374da5ce9ad216044f075a3ffd8 (diff) | |
parent | 8e98033a67263f6a2d9155f228dc28e2faee4f5e (diff) | |
download | Qt-8f83747d12efc612b730a7dd911f916127387c0c.zip Qt-8f83747d12efc612b730a7dd911f916127387c0c.tar.gz Qt-8f83747d12efc612b730a7dd911f916127387c0c.tar.bz2 |
Merge remote branch 'origin/4.6' into qt-master-from-4.6
Conflicts:
examples/assistant/simpletextviewer/findfiledialog.cpp
qmake/generators/symbian/symmake.cpp
tools/assistant/lib/qhelpgenerator.cpp
tools/assistant/lib/qhelpsearchquerywidget.cpp
translations/translations.pri
Diffstat (limited to 'src')
63 files changed, 1150 insertions, 350 deletions
diff --git a/src/3rdparty/phonon/mmf/environmentalreverb.cpp b/src/3rdparty/phonon/mmf/environmentalreverb.cpp index 89f8d60..4a6ce29 100644 --- a/src/3rdparty/phonon/mmf/environmentalreverb.cpp +++ b/src/3rdparty/phonon/mmf/environmentalreverb.cpp @@ -140,55 +140,75 @@ bool EnvironmentalReverb::getParameters(CMdaAudioOutputStream *stream, TUint32 umin, umax; // DecayHFRatio + // Ratio of high-frequency decay time to the value specified by + // DecayTime. effect->DecayHFRatioRange(umin, umax); parameters.append(createParameter( DecayHFRatio, tr("Decay HF ratio (%)"), effect->DecayHFRatio(), umin, umax)); // DecayTime + // Time over which reverberation is diminished. effect->DecayTimeRange(umin, umax); parameters.append(createParameter( DecayTime, tr("Decay time (ms)"), effect->DecayTime(), umin, umax)); // Density + // Delay between first and subsequent reflections. + // Note that the S60 platform documentation does not make clear + // the distinction between this value and the Diffusion value. parameters.append(createParameter( Density, tr("Density (%)"), effect->Density(), 0, 100)); // Diffusion + // Delay between first and subsequent reflections. + // Note that the S60 platform documentation does not make clear + // the distinction between this value and the Density value. parameters.append(createParameter( Diffusion, tr("Diffusion (%)"), effect->Diffusion(), 0, 100)); // ReflectionsDelay + // Amount of delay between the arrival the direct path from the + // source and the arrival of the first reflection. parameters.append(createParameter( ReflectionsDelay, tr("Reflections delay (ms)"), effect->ReflectionsDelay(), 0, effect->ReflectionsDelayMax())); // ReflectionsLevel - effect->ReflectionLevelRange(min, max); + // Amplitude of reflections. This value is corrected by the RoomLevel + // to give the final reflection amplitude. + effect->ReflectionLevelRange(min, max); parameters.append(createParameter( ReflectionsLevel, tr("Reflections level (mB)"), effect->ReflectionsLevel(), min, max, EffectParameter::LogarithmicHint)); // ReverbDelay + // Amount of time between arrival of the first reflection and start of + // the late reverberation. parameters.append(createParameter( ReverbDelay, tr("Reverb delay (ms)"), effect->ReverbDelay(), 0, effect->ReverbDelayMax())); // ReverbLevel + // Amplitude of reverberations. This value is corrected by the + // RoomLevel to give the final reverberation amplitude. effect->ReverbLevelRange(min, max); parameters.append(createParameter( ReverbLevel, tr("Reverb level (mB)"), effect->ReverbLevel(), min, max, EffectParameter::LogarithmicHint)); // RoomHFLevel + // Amplitude of low-pass filter used to attenuate the high frequency + // component of reflected sound. effect->RoomHFLevelRange(min, max); parameters.append(createParameter( RoomHFLevel, tr("Room HF level"), effect->RoomHFLevel(), min, max)); // RoomLevel + // Master volume control for all reflected sound. effect->RoomLevelRange(min, max); parameters.append(createParameter( RoomLevel, tr("Room level (mB)"), effect->RoomLevel(), diff --git a/src/3rdparty/phonon/mmf/utils.h b/src/3rdparty/phonon/mmf/utils.h index 56ccafc..acad55a 100644 --- a/src/3rdparty/phonon/mmf/utils.h +++ b/src/3rdparty/phonon/mmf/utils.h @@ -44,7 +44,7 @@ enum PanicCode { class Utils { - Q_DECLARE_TR_FUNCTIONS(Utils) + Q_DECLARE_TR_FUNCTIONS(Phonon::MMF) public: /** diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 2a3c73b..c304876 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - afc4c208fe296f5a1dd0e73f2bd1273bd22d9b24 + 69dd29fbeb12d076741dce70ac6bc155101ccd6f diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index bded3d8..18d119a 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,18 @@ +2010-02-01 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Use the fallback style on Maemo 5 + + https://bugs.webkit.org/show_bug.cgi?id=34376 + + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::RenderThemeQt): + (WebCore::RenderThemeQt::fallbackStyle): + (WebCore::RenderThemeQt::qStyle): + (WebCore::RenderThemeQt::setPaletteFromPageClientIfExists): + * platform/qt/RenderThemeQt.h: + 2010-01-29 Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index f364d3b..7b0366d 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -6,6 +6,7 @@ symbian: { TARGET.EPOCALLOWDLLDATA=1 TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 // Min 128kB, Max 32MB TARGET.CAPABILITY = All -Tcb + TARGET.UID3 = 0x200267C2 webkitlibs.sources = QtWebKit.dll webkitlibs.path = /sys/bin @@ -23,7 +24,6 @@ symbian: { DEPLOYMENT += webkitlibs webkitbackup - TARGET.UID3 = 0x200267C2 # RO text (code) section in qtwebkit.dll exceeds allocated space for gcce udeb target. # Move RW-section base address to start from 0xE00000 instead of the toolchain default 0x400000. MMP_RULES += "LINKEROPTION armcc --rw-base 0xE00000" diff --git a/src/3rdparty/webkit/WebCore/platform/PopupMenu.h b/src/3rdparty/webkit/WebCore/platform/PopupMenu.h index f2fffb5..c150a94 100644 --- a/src/3rdparty/webkit/WebCore/platform/PopupMenu.h +++ b/src/3rdparty/webkit/WebCore/platform/PopupMenu.h @@ -44,7 +44,9 @@ typedef struct HBITMAP__* HBITMAP; namespace WebCore { class QWebPopup; } +QT_BEGIN_NAMESPACE class QGraphicsProxyWidget; +QT_END_NAMESPACE #elif PLATFORM(GTK) typedef struct _GtkMenu GtkMenu; typedef struct _GtkMenuItem GtkMenuItem; diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp index 501a28b..6a1eee8 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp @@ -125,7 +125,6 @@ PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page) RenderThemeQt::RenderThemeQt(Page* page) : RenderTheme() , m_page(page) - , m_fallbackStyle(0) { QPushButton button; button.setAttribute(Qt::WA_MacSmallSize); @@ -135,6 +134,8 @@ RenderThemeQt::RenderThemeQt(Page* page) #ifdef Q_WS_MAC m_buttonFontPixelSize = fontInfo.pixelSize(); #endif + + m_fallbackStyle = QStyleFactory::create(QLatin1String("windows")); } RenderThemeQt::~RenderThemeQt() @@ -143,19 +144,17 @@ RenderThemeQt::~RenderThemeQt() } // for some widget painting, we need to fallback to Windows style -QStyle* RenderThemeQt::fallbackStyle() +QStyle* RenderThemeQt::fallbackStyle() const { - if (!m_fallbackStyle) - m_fallbackStyle = QStyleFactory::create(QLatin1String("windows")); - - if (!m_fallbackStyle) - m_fallbackStyle = QApplication::style(); - - return m_fallbackStyle; + return (m_fallbackStyle) ? m_fallbackStyle : QApplication::style(); } QStyle* RenderThemeQt::qStyle() const { +#ifdef Q_WS_MAEMO_5 + return fallbackStyle(); +#endif + if (m_page) { ChromeClientQt* client = static_cast<ChromeClientQt*>(m_page->chrome()->client()); @@ -758,6 +757,10 @@ ControlPart RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) con if (result == RadioPart || result == CheckboxPart) option.state |= (isChecked(o) ? QStyle::State_On : QStyle::State_Off); +#ifdef Q_WS_MAEMO_5 + static QPalette lightGrayPalette(Qt::lightGray); + option.palette = lightGrayPalette; +#else // If the owner widget has a custom palette, use it Page* page = o->document()->page(); if (page) { @@ -766,6 +769,7 @@ ControlPart RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) con if (pageClient) option.palette = pageClient->palette(); } +#endif return result; } diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h index 617c875..19337ac 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h @@ -138,7 +138,7 @@ private: void setPopupPadding(RenderStyle*) const; QStyle* qStyle() const; - QStyle* fallbackStyle(); + QStyle* fallbackStyle() const; Page* m_page; diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp index f7d3b06..7655c51 100644 --- a/src/corelib/codecs/qutfcodec.cpp +++ b/src/corelib/codecs/qutfcodec.cpp @@ -326,11 +326,11 @@ QString QUtf16::convertToUnicode(const char *chars, int len, QTextCodec::Convert ch.setCell(*chars++); } if (!headerdone) { + headerdone = true; if (endian == DetectEndianness) { - if (ch == QChar::ByteOrderSwapped && endian != BigEndianness) { + if (ch == QChar::ByteOrderSwapped) { endian = LittleEndianness; - } else if (ch == QChar::ByteOrderMark && endian != LittleEndianness) { - // ignore BOM + } else if (ch == QChar::ByteOrderMark) { endian = BigEndianness; } else { if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { @@ -344,7 +344,6 @@ QString QUtf16::convertToUnicode(const char *chars, int len, QTextCodec::Convert } else if (ch != QChar::ByteOrderMark) { *qch++ = ch; } - headerdone = true; } else { *qch++ = ch; } diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 9a15bf1..7f33791 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -35,4 +35,6 @@ symbian: { # Workaroud for problems with paging this dll MMP_RULES -= PAGED MMP_RULES *= UNPAGED + # Timezone server + LIBS += -ltzclient } diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 38e1886..177bee4 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -497,6 +497,9 @@ public: WA_WState_AcceptedTouchBeginEvent = 122, WA_TouchPadAcceptSingleTouchEvents = 123, + WA_MergeSoftkeys = 124, + WA_MergeSoftkeysRecursively = 125, + // Add new attributes before this line WA_AttributeCount }; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 871dd5c..6627c76 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -524,11 +524,11 @@ receiver are in the same thread. Same as QueuedConnection, if the emitter and receiver are in different threads. - \value DirectConnection + \value DirectConnection The slot is invoked immediately, when the signal is emitted. - \value QueuedConnection + \value QueuedConnection The slot is invoked when control returns to the event loop of the receiver's thread. The slot is executed in the receiver's thread. @@ -1243,6 +1243,17 @@ \value WA_TouchPadAcceptSingleTouchEvents Allows touchpad single touch events to be sent to the widget. + \value WA_MergeSoftkeys Allows widget to merge softkeys with parent widget, + i.e. widget can set only one softkeys and request softkey implementation + to take rest of the softkeys from the parent. Note parents are traversed until + WA_MergeSoftkeys is not set. See also Qt::WA_MergeSoftkeysRecursively + This attribute currently has effect only on Symbian platforms + + \value WA_MergeSoftkeysRecursively Allows widget to merge softkeys recursively + with all parents. If this attribute is set, the widget parents are traversed until + window boundary (widget without parent or dialog) is found. + This attribute currently has effect only on Symbian platforms + \omitvalue WA_SetLayoutDirection \omitvalue WA_InputMethodTransparent \omitvalue WA_WState_CompressKeys diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 1c68716..bc68599 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -83,7 +83,7 @@ public: if(stream->message_output) { QT_TRY { qt_message_output(stream->type, stream->buffer.toLocal8Bit().data()); - } QT_CATCH(std::bad_alloc) { /* We're out of memory - give up. */ } + } QT_CATCH(std::bad_alloc&) { /* We're out of memory - give up. */ } } delete stream; } diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp index ddced73..75cde51 100644 --- a/src/corelib/io/qprocess_symbian.cpp +++ b/src/corelib/io/qprocess_symbian.cpp @@ -919,34 +919,41 @@ bool QProcessPrivate::waitForFinished(int msecs) Q_Q(QProcess); QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished(%d)", msecs); - TRequestStatus timerStatus = 0; - TRequestStatus logonStatus = 0; + TRequestStatus timerStatus = KErrNone; + TRequestStatus logonStatus = KErrNone; bool timeoutOccurred = false; // Logon to process to observe its death if (qt_rprocess_running(symbianProcess)) { symbianProcess->Logon(logonStatus); - // Create timer - RTimer timer; - timer.CreateLocal(); - TTimeIntervalMicroSeconds32 interval(msecs*1000); - timer.After(timerStatus, interval); + if (msecs < 0) { + // If timeout is negative, there is no timeout + QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Waiting (just logon)..."); + User::WaitForRequest(logonStatus); + QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Wait completed"); + } else { + // Create timer + RTimer timer; + timer.CreateLocal(); + TTimeIntervalMicroSeconds32 interval(msecs*1000); + timer.After(timerStatus, interval); - QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Waiting..."); - User::WaitForRequest(logonStatus, timerStatus); - QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Wait completed"); + QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Waiting (logon + timer)..."); + User::WaitForRequest(logonStatus, timerStatus); + QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Wait completed"); - if (timerStatus == KErrNone) - timeoutOccurred = true; + if (timerStatus == KErrNone) + timeoutOccurred = true; - timer.Cancel(); - timer.Close(); + timer.Cancel(); + timer.Close(); - symbianProcess->LogonCancel(logonStatus); + symbianProcess->LogonCancel(logonStatus); - // Eat cancel request completion so that it won't mess up main thread scheduling later - User::WaitForRequest(logonStatus, timerStatus); + // Eat cancel request completion so that it won't mess up main thread scheduling later + User::WaitForRequest(logonStatus, timerStatus); + } } else { QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished(), qt_rprocess_running returned false"); } diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 0bf7d3f..5119ec0 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -783,7 +783,7 @@ bool QProcessPrivate::processStarted() // did we read an error message? if (i > 0) - q_func()->setErrorString(QString::fromUtf16(buf, i / sizeof(QChar))); + q_func()->setErrorString(QString((const QChar *)buf, i / sizeof(QChar))); return i <= 0; } diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp index 5d2a6a5..0257ac4 100644 --- a/src/corelib/kernel/qcore_symbian_p.cpp +++ b/src/corelib/kernel/qcore_symbian_p.cpp @@ -71,7 +71,7 @@ Q_CORE_EXPORT QString qt_TDesC2QString(const TDesC& aDescriptor) #ifdef QT_NO_UNICODE return QString::fromLocal8Bit(aDescriptor.Ptr(), aDescriptor.Length()); #else - return QString::fromUtf16(aDescriptor.Ptr(), aDescriptor.Length()); + return QString(reinterpret_cast<const QChar *>(aDescriptor.Ptr()), aDescriptor.Length()); #endif } diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 005dedc..2da5a7d 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2219,7 +2219,8 @@ QStringList QCoreApplication::libraryPaths() TFindFile finder(fs); TInt err = finder.FindByDir(tempPathPtr, tempPathPtr); while (err == KErrNone) { - QString foundDir = QString::fromUtf16(finder.File().Ptr(), finder.File().Length()); + QString foundDir(reinterpret_cast<const QChar *>(finder.File().Ptr()), + finder.File().Length()); foundDir = QDir(foundDir).canonicalPath(); if (!app_libpaths->contains(foundDir)) app_libpaths->append(foundDir); @@ -2267,6 +2268,10 @@ QStringList QCoreApplication::libraryPaths() \a paths. All existing paths will be deleted and the path list will consist of the paths given in \a paths. + In Symbian this function is only useful for setting paths for + finding Qt extension plugin stubs, since the OS can only + load libraries from the \c{/sys/bin} directory. + \sa libraryPaths(), addLibraryPath(), removeLibraryPath(), QLibrary */ void QCoreApplication::setLibraryPaths(const QStringList &paths) @@ -2290,6 +2295,10 @@ void QCoreApplication::setLibraryPaths(const QStringList &paths) is \c INSTALL/plugins, where \c INSTALL is the directory where Qt was installed. + In Symbian this function is only useful for adding paths for + finding Qt extension plugin stubs, since the OS can only + load libraries from the \c{/sys/bin} directory. + \sa removeLibraryPath(), libraryPaths(), setLibraryPaths() */ void QCoreApplication::addLibraryPath(const QString &path) diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index d177b26..3a51cf8 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -133,10 +133,10 @@ QT_BEGIN_NAMESPACE \value GrabKeyboard Item gains keyboard grab (QGraphicsItem only). \value GrabMouse Item gains mouse grab (QGraphicsItem only). \value GraphicsSceneContextMenu Context popup menu over a graphics scene (QGraphicsSceneContextMenuEvent). - \value GraphicsSceneDragEnter The cursor enters a graphics scene during a drag and drop operation. - \value GraphicsSceneDragLeave The cursor leaves a graphics scene during a drag and drop operation. - \value GraphicsSceneDragMove A drag and drop operation is in progress over a scene. - \value GraphicsSceneDrop A drag and drop operation is completed over a scene. + \value GraphicsSceneDragEnter The cursor enters a graphics scene during a drag and drop operation (QGraphicsSceneDragDropEvent). + \value GraphicsSceneDragLeave The cursor leaves a graphics scene during a drag and drop operation (QGraphicsSceneDragDropEvent). + \value GraphicsSceneDragMove A drag and drop operation is in progress over a scene (QGraphicsSceneDragDropEvent). + \value GraphicsSceneDrop A drag and drop operation is completed over a scene (QGraphicsSceneDragDropEvent). \value GraphicsSceneHelp The user requests help for a graphics scene (QHelpEvent). \value GraphicsSceneHoverEnter The mouse cursor enters a hover item in a graphics scene (QGraphicsSceneHoverEvent). \value GraphicsSceneHoverLeave The mouse cursor leaves a hover item in a graphics scene (QGraphicsSceneHoverEvent). diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index b7e6ea0..7d1e1d3 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -633,7 +633,7 @@ static QString getMessage(const uchar *m, const uchar *end, const char *context, end: if (!tn) return QString(); - QString str = QString::fromUtf16((const ushort *)tn, tn_length/2); + QString str = QString((const QChar *)tn, tn_length/2); if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) { for (int i = 0; i < str.length(); ++i) str[i] = QChar((str.at(i).unicode() >> 8) + ((str.at(i).unicode() << 8) & 0xff00)); diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 02c0aa1..a2c575a 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -539,6 +539,7 @@ bool QLibraryPrivate::loadPlugin() \row \i AIX \i \c .a \row \i HP-UX \i \c .sl, \c .so (HP-UXi) \row \i Mac OS X \i \c .dylib, \c .bundle, \c .so + \row \i Symbian \i \c .dll \endtable Trailing versioning numbers on Unix are ignored. diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index c1027ed..9a361c0 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -75,6 +75,7 @@ #if defined(Q_OS_SYMBIAN) #include <e32std.h> +#include <tz.h> #endif QT_BEGIN_NAMESPACE @@ -3721,23 +3722,32 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time) #elif defined(Q_OS_SYMBIAN) // months and days are zero index based _LIT(KUnixEpoch, "19700000:000000.000000"); - TTimeIntervalSeconds utcOffset = User::UTCOffset(); TTimeIntervalSeconds tTimeIntervalSecsSince1Jan1970UTC(secsSince1Jan1970UTC); TTime epochTTime; TInt err = epochTTime.Set(KUnixEpoch); tm res; if(err == KErrNone) { TTime utcTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC; - utcTTime = utcTTime + utcOffset; - TDateTime utcDateTime = utcTTime.DateTime(); - res.tm_sec = utcDateTime.Second(); - res.tm_min = utcDateTime.Minute(); - res.tm_hour = utcDateTime.Hour(); - res.tm_mday = utcDateTime.Day() + 1; // non-zero based index for tm struct - res.tm_mon = utcDateTime.Month(); - res.tm_year = utcDateTime.Year() - 1900; - res.tm_isdst = 0; - brokenDown = &res; + TRAP(err, + RTz tz; + User::LeaveIfError(tz.Connect()); + CleanupClosePushL(tz); + res.tm_isdst = tz.IsDaylightSavingOnL(*tz.GetTimeZoneIdL(),utcTTime); + User::LeaveIfError(tz.ConvertToLocalTime(utcTTime)); + CleanupStack::PopAndDestroy(&tz)); + if (KErrNone == err) { + TDateTime localDateTime = utcTTime.DateTime(); + res.tm_sec = localDateTime.Second(); + res.tm_min = localDateTime.Minute(); + res.tm_hour = localDateTime.Hour(); + res.tm_mday = localDateTime.Day() + 1; // non-zero based index for tm struct + res.tm_mon = localDateTime.Month(); + res.tm_year = localDateTime.Year() - 1900; + // Symbian's timezone server doesn't know how to handle DST before year 1997 + if (res.tm_year < 97) + res.tm_isdst = -1; + brokenDown = &res; + } } #elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) // use the reentrant version of localtime() where available @@ -3812,23 +3822,27 @@ static void localToUtc(QDate &date, QTime &time, int isdst) #elif defined(Q_OS_SYMBIAN) // months and days are zero index based _LIT(KUnixEpoch, "19700000:000000.000000"); - TTimeIntervalSeconds utcOffset = TTimeIntervalSeconds(0 - User::UTCOffset().Int()); TTimeIntervalSeconds tTimeIntervalSecsSince1Jan1970UTC(secsSince1Jan1970UTC); TTime epochTTime; TInt err = epochTTime.Set(KUnixEpoch); tm res; if(err == KErrNone) { - TTime utcTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC; - utcTTime = utcTTime + utcOffset; - TDateTime utcDateTime = utcTTime.DateTime(); - res.tm_sec = utcDateTime.Second(); - res.tm_min = utcDateTime.Minute(); - res.tm_hour = utcDateTime.Hour(); - res.tm_mday = utcDateTime.Day() + 1; // non-zero based index for tm struct - res.tm_mon = utcDateTime.Month(); - res.tm_year = utcDateTime.Year() - 1900; - res.tm_isdst = (int)isdst; - brokenDown = &res; + TTime localTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC; + RTz tz; + if (KErrNone == tz.Connect()) { + if (KErrNone == tz.ConvertToUniversalTime(localTTime)) { + TDateTime utcDateTime = localTTime.DateTime(); + res.tm_sec = utcDateTime.Second(); + res.tm_min = utcDateTime.Minute(); + res.tm_hour = utcDateTime.Hour(); + res.tm_mday = utcDateTime.Day() + 1; // non-zero based index for tm struct + res.tm_mon = utcDateTime.Month(); + res.tm_year = utcDateTime.Year() - 1900; + res.tm_isdst = (int)isdst; + brokenDown = &res; + } + tz.Close(); + } } #elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) // use the reentrant version of gmtime() where available diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 7111e68..285f4c9 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -68,8 +68,8 @@ static uint hash(const uchar *p, int n) while (n--) { h = (h << 4) + *p++; - if ((g = (h & 0xf0000000)) != 0) - h ^= g >> 23; + g = h & 0xf0000000; + h ^= g >> 23; h &= ~g; } return h; @@ -82,8 +82,8 @@ static uint hash(const QChar *p, int n) while (n--) { h = (h << 4) + (*p++).unicode(); - if ((g = (h & 0xf0000000)) != 0) - h ^= g >> 23; + g = h & 0xf0000000; + h ^= g >> 23; h &= ~g; } return h; diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index 3f124c9..ce62016 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -208,7 +208,7 @@ void **QListData::append2(const QListData& l) int n = l.d->end - l.d->begin; if (n) { if (e + n > d->alloc) - realloc(grow(e + l.d->end - l.d->begin)); + realloc(grow(e + n)); d->end += n; } return d->array + e; diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index a791ae9..dec59b7 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -886,7 +886,7 @@ int QString::grow(int size) QString QString::fromWCharArray(const wchar_t *string, int size) { if (sizeof(wchar_t) == sizeof(QChar)) { - return fromUtf16((ushort *)string, size); + return fromUtf16((const ushort *)string, size); } else { return fromUcs4((uint *)string, size); } @@ -3863,6 +3863,12 @@ QString QString::fromUtf8(const char *str, int size) If \a size is -1 (default), \a unicode must be terminated with a 0. + This function checks for a Byte Order Mark (BOM). If it is missing, + host byte order is assumed. + + This function is comparatively slow. + Use QString(const ushort *, int) if possible. + QString makes a deep copy of the Unicode data. \sa utf16(), setUtf16() @@ -3929,6 +3935,9 @@ QString& QString::setUnicode(const QChar *unicode, int size) If \a unicode is 0, nothing is copied, but the string is still resized to \a size. + Note that unlike fromUtf16(), this function does not consider BOMs and + possibly differing byte ordering. + \sa utf16(), setUnicode() */ @@ -4675,6 +4684,8 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1, Returns the QString as a '\\0\'-terminated array of unsigned shorts. The result remains valid until the string is modified. + The returned string is in host byte order. + \sa unicode() */ @@ -7746,7 +7757,7 @@ QString QStringRef::toString() const { return QString(); if (m_size && m_position == 0 && m_size == m_string->size()) return *m_string; - return QString::fromUtf16(reinterpret_cast<const ushort*>(m_string->unicode() + m_position), m_size); + return QString(m_string->unicode() + m_position, m_size); } diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 4215f97..8ad3bac 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -54,4 +54,5 @@ DEFINES += Q_INTERNAL_QAPP_SRC symbian:TARGET.UID3=0x2001B2DD # ro-section in gui can exceed default allocated space, so more rw-section little further -symbian-sbsv2: QMAKE_LFLAGS.ARMCC += --rw-base 0x800000" +symbian-sbsv2: QMAKE_LFLAGS.ARMCC += --rw-base 0x800000 +symbian: QMAKE_LFLAGS.GCCE += -Tdata 0xC00000 diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 793bcde..e5ab300 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -101,11 +101,7 @@ QCoeFepInputContext::~QCoeFepInputContext() void QCoeFepInputContext::reset() { - commitTemporaryPreeditString(); - - CCoeFep* fep = CCoeEnv::Static()->Fep(); - if (fep) - fep->CancelTransaction(); + commitCurrentString(false); } void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType) @@ -290,7 +286,6 @@ void QCoeFepInputContext::commitTemporaryPreeditString() return; commitCurrentString(false); - m_hasTempPreeditString = false; } void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event) @@ -765,6 +760,7 @@ void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian) m_preeditString.clear(); sendEvent(event); + m_hasTempPreeditString = false; m_longPress = 0; if (!triggeredBySymbian) { diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp index 6fd26a7..9069ce4 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/gui/itemviews/qitemdelegate.cpp @@ -1033,7 +1033,7 @@ static QString qPixmapSerial(quint64 i, bool enabled) i >>= 4; } - return QString::fromUtf16(ptr, int(&arr[sizeof(arr) / sizeof(ushort)] - ptr)); + return QString((const QChar *)ptr, int(&arr[sizeof(arr) / sizeof(ushort)] - ptr)); } /*! diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 30cb043..6fd45ad 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -7,7 +7,7 @@ PRECOMPILED_HEADER = kernel/qt_gui_pch.h KERNEL_P= kernel HEADERS += \ kernel/qaction.h \ - kernel/qaction_p.h \ + kernel/qaction_p.h \ kernel/qactiongroup.h \ kernel/qapplication.h \ kernel/qapplication_p.h \ @@ -37,8 +37,8 @@ HEADERS += \ kernel/qstackedlayout.h \ kernel/qtooltip.h \ kernel/qwhatsthis.h \ - kernel/qwidget.h \ - kernel/qwidget_p.h \ + kernel/qwidget.h \ + kernel/qwidget_p.h \ kernel/qwidgetaction.h \ kernel/qwidgetaction_p.h \ kernel/qwindowdefs.h \ @@ -49,6 +49,7 @@ HEADERS += \ kernel/qgesturerecognizer.h \ kernel/qgesturemanager_p.h \ kernel/qsoftkeymanager_p.h \ + kernel/qsoftkeymanager_common_p.h \ kernel/qguiplatformplugin_p.h SOURCES += \ @@ -84,14 +85,14 @@ SOURCES += \ kernel/qgesturerecognizer.cpp \ kernel/qgesturemanager.cpp \ kernel/qsoftkeymanager.cpp \ - kernel/qdesktopwidget.cpp \ + kernel/qdesktopwidget.cpp \ kernel/qguiplatformplugin.cpp win32 { DEFINES += QT_NO_DIRECTDRAW - HEADERS += \ - kernel/qwinnativepangesturerecognizer_win_p.h + HEADERS += \ + kernel/qwinnativepangesturerecognizer_win_p.h SOURCES += \ kernel/qapplication_win.cpp \ @@ -103,30 +104,34 @@ win32 { kernel/qsound_win.cpp \ kernel/qwidget_win.cpp \ kernel/qole_win.cpp \ - kernel/qkeymapper_win.cpp \ - kernel/qwinnativepangesturerecognizer_win.cpp + kernel/qkeymapper_win.cpp \ + kernel/qwinnativepangesturerecognizer_win.cpp - !contains(DEFINES, QT_NO_DIRECTDRAW):LIBS += ddraw.lib + !contains(DEFINES, QT_NO_DIRECTDRAW):LIBS += ddraw.lib } symbian { - SOURCES += \ - kernel/qapplication_s60.cpp \ - kernel/qeventdispatcher_s60.cpp \ - kernel/qwidget_s60.cpp \ - kernel/qcursor_s60.cpp \ - kernel/qdesktopwidget_s60.cpp \ - kernel/qkeymapper_s60.cpp\ - kernel/qclipboard_s60.cpp\ - kernel/qdnd_s60.cpp \ - kernel/qsound_s60.cpp + SOURCES += \ + kernel/qapplication_s60.cpp \ + kernel/qeventdispatcher_s60.cpp \ + kernel/qwidget_s60.cpp \ + kernel/qcursor_s60.cpp \ + kernel/qdesktopwidget_s60.cpp \ + kernel/qkeymapper_s60.cpp\ + kernel/qclipboard_s60.cpp\ + kernel/qdnd_s60.cpp \ + kernel/qsound_s60.cpp \ + kernel/qsoftkeymanager_s60.cpp - HEADERS += \ - kernel/qt_s60_p.h \ - kernel/qeventdispatcher_s60_p.h - LIBS += -lbafl -lestor + HEADERS += \ + kernel/qt_s60_p.h \ + kernel/qeventdispatcher_s60_p.h \ + kernel/qsoftkeymanager_s60_p.h + + LIBS += -lbafl -lestor - INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += ../3rdparty/s60 } diff --git a/src/gui/kernel/qclipboard_s60.cpp b/src/gui/kernel/qclipboard_s60.cpp index 71c355b..f07e066 100644 --- a/src/gui/kernel/qclipboard_s60.cpp +++ b/src/gui/kernel/qclipboard_s60.cpp @@ -164,7 +164,8 @@ void readFromStreamLX(QMimeData* aData,RReadStream& aStream) TCardinality mimeTypeSize; aStream >> mimeTypeSize; HBufC* mimeTypeBuf = HBufC::NewLC(aStream,mimeTypeSize); - QString mimeType = QString::fromUtf16(mimeTypeBuf->Des().Ptr(),mimeTypeBuf->Length()); + QString mimeType = QString(reinterpret_cast<const QChar *>(mimeTypeBuf->Des().Ptr()), + mimeTypeBuf->Length()); CleanupStack::PopAndDestroy(mimeTypeBuf); // mime data TCardinality dataSize; diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index edab6a0..33968bd 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -617,7 +617,7 @@ QVariant QX11Data::xdndMimeConvertToFormat(Atom a, const QByteArray &data, const // so it should be safe to check that the second char is 0 // to verify that it is utf16 if (data.size() > 1 && data.at(1) == 0) - return QString::fromUtf16(reinterpret_cast<const ushort *>(data.constData()), + return QString::fromRawData((const QChar *)data.constData(), data.size() / 2).split(QLatin1Char('\n')).first().toLatin1(); } } diff --git a/src/gui/kernel/qmime_mac.cpp b/src/gui/kernel/qmime_mac.cpp index 775bf1b..c6fd184 100644 --- a/src/gui/kernel/qmime_mac.cpp +++ b/src/gui/kernel/qmime_mac.cpp @@ -432,8 +432,8 @@ QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, Q firstData.size(), CFStringGetSystemEncoding(), false)); ret = QString(str); } else if (flavor == QLatin1String("public.utf16-plain-text")) { - ret = QString::fromUtf16(reinterpret_cast<const ushort *>(firstData.constData()), - firstData.size() / sizeof(ushort)); + ret = QString(reinterpret_cast<const QChar *>(firstData.constData()), + firstData.size() / sizeof(QChar)); } else { qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype)); } diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 354f90b..6d108b0 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -41,34 +41,18 @@ #include "qapplication.h" #include "qevent.h" -#ifdef Q_WS_S60 -#include "qstyle.h" -#include "private/qt_s60_p.h" -#endif +#include "qbitmap.h" #include "private/qsoftkeymanager_p.h" #include "private/qobject_p.h" - -#ifndef QT_NO_SOFTKEYMANAGER -QT_BEGIN_NAMESPACE +#include "private/qsoftkeymanager_common_p.h" #ifdef Q_WS_S60 -static const int s60CommandStart = 6000; +#include "private/qsoftkeymanager_s60_p.h" #endif -class QSoftKeyManagerPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QSoftKeyManager) - -public: - static void updateSoftKeys_sys(const QList<QAction*> &softKeys); - -private: - QHash<QAction*, Qt::Key> keyedActions; - static QSoftKeyManager *self; - static QWidget *softKeySource; -}; +#ifndef QT_NO_SOFTKEYMANAGER +QT_BEGIN_NAMESPACE -QWidget *QSoftKeyManagerPrivate::softKeySource = 0; QSoftKeyManager *QSoftKeyManagerPrivate::self = 0; const char *QSoftKeyManager::standardSoftKeyText(StandardSoftKey standardKey) @@ -105,7 +89,12 @@ QSoftKeyManager *QSoftKeyManager::instance() return QSoftKeyManagerPrivate::self; } -QSoftKeyManager::QSoftKeyManager() : QObject(*(new QSoftKeyManagerPrivate), 0) +QSoftKeyManager::QSoftKeyManager() : +#ifdef Q_WS_S60 + QObject(*(new QSoftKeyManagerPrivateS60), 0) +#else + QObject(*(new QSoftKeyManagerPrivate), 0) +#endif { } @@ -115,10 +104,11 @@ QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *act QAction *action = new QAction(QSoftKeyManager::tr(text), actionWidget); QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey; switch (standardKey) { + case MenuSoftKey: // FALL-THROUGH + action->setProperty(MENU_ACTION_PROPERTY, QVariant(true)); // TODO: can be refactored away to use _q_action_menubar case OkSoftKey: case SelectSoftKey: case DoneSoftKey: - case MenuSoftKey: softKeyRole = QAction::PositiveSoftKey; break; case CancelSoftKey: @@ -147,7 +137,7 @@ QAction *QSoftKeyManager::createKeyedAction(StandardSoftKey standardKey, Qt::Key #endif //QT_NO_ACTION } -void QSoftKeyManager::cleanupHash(QObject* obj) +void QSoftKeyManager::cleanupHash(QObject *obj) { Q_D(QSoftKeyManager); QAction *action = qobject_cast<QAction*>(obj); @@ -175,137 +165,78 @@ void QSoftKeyManager::updateSoftKeys() QApplication::postEvent(QSoftKeyManager::instance(), event); } -bool QSoftKeyManager::event(QEvent *e) +bool QSoftKeyManager::appendSoftkeys(const QWidget &source, int level) { -#ifndef QT_NO_ACTION - if (e->type() == QEvent::UpdateSoftKeys) { - QList<QAction*> softKeys; - QWidget *source = QApplication::focusWidget(); - do { - if (source) { - QList<QAction*> actions = source->actions(); - for (int i = 0; i < actions.count(); ++i) { - if (actions.at(i)->softKeyRole() != QAction::NoSoftKey) - softKeys.append(actions.at(i)); - } - - QWidget *parent = source->parentWidget(); - if (parent && softKeys.isEmpty() && !source->isWindow()) - source = parent; - else - break; - } else { - source = QApplication::activeWindow(); - } - } while (source); - - QSoftKeyManagerPrivate::softKeySource = source; - QSoftKeyManagerPrivate::updateSoftKeys_sys(softKeys); - return true; + Q_D(QSoftKeyManager); + bool ret = false; + QList<QAction*> actions = source.actions(); + for (int i = 0; i < actions.count(); ++i) { + if (actions.at(i)->softKeyRole() != QAction::NoSoftKey) { + d->requestedSoftKeyActions.insert(level, actions.at(i)); + ret = true; + } } -#endif //QT_NO_ACTION - return false; + return ret; } -#ifdef Q_WS_S60 -void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &softkeys) +QWidget *QSoftKeyManager::softkeySource(QWidget *previousSource, bool& recursiveMerging) { - // lets not update softkeys if s60 native dialog or menu is shown - if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) - || CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) - return; - - CEikButtonGroupContainer* nativeContainer = S60->buttonGroupContainer(); - nativeContainer->DrawableWindow()->SetOrdinalPosition(0); - nativeContainer->DrawableWindow()->SetPointerCapturePriority(1); //keep softkeys available in modal dialog - nativeContainer->DrawableWindow()->SetFaded(EFalse, RWindowTreeNode::EFadeIncludeChildren); - - int position = -1; - bool needsExitButton = true; - QT_TRAP_THROWING( - //Using -1 instead of EAknSoftkeyEmpty to avoid flickering. - nativeContainer->SetCommandL(0, -1, KNullDesC); - nativeContainer->SetCommandL(2, -1, KNullDesC); - ); - - for (int index = 0; index < softkeys.count(); index++) { - const QAction* softKeyAction = softkeys.at(index); - switch (softKeyAction->softKeyRole()) { - // Positive Actions on the LSK - case QAction::PositiveSoftKey: - position = 0; - break; - case QAction::SelectSoftKey: - position = 0; - break; - // Negative Actions on the RSK - case QAction::NegativeSoftKey: - needsExitButton = false; - position = 2; - break; - default: - break; - } - - int command = (softKeyAction->objectName().contains(QLatin1String("_q_menuSoftKeyAction"))) - ? EAknSoftkeyOptions - : s60CommandStart + index; - - // _q_menuSoftKeyAction action is set to "invisible" and all invisible actions are by default - // disabled. However we never want to dim options softkey, even it is set to "invisible" - bool dimmed = (command == EAknSoftkeyOptions) ? false : !softKeyAction->isEnabled(); - - if (position != -1) { - const int underlineShortCut = QApplication::style()->styleHint(QStyle::SH_UnderlineShortcut); - QString iconText = softKeyAction->iconText(); - TPtrC text = qt_QString2TPtrC( underlineShortCut ? softKeyAction->text() : iconText); - QT_TRAP_THROWING( - nativeContainer->SetCommandL(position, command, text); - nativeContainer->DimCommand(command, dimmed); - ); - } + Q_D(QSoftKeyManager); + QWidget *source = NULL; + if (!previousSource) { + // Initial source is primarily focuswidget and secondarily activeWindow + source = QApplication::focusWidget(); + if (!source) + source = QApplication::activeWindow(); + } else { + // Softkey merging is based on four criterias + // 1. Implicit merging is used whenever focus widget does not specify any softkeys + bool implicitMerging = d->requestedSoftKeyActions.isEmpty(); + // 2. Explicit merging with parent is used whenever WA_MergeSoftkeys widget attribute is set + bool explicitMerging = previousSource->testAttribute(Qt::WA_MergeSoftkeys); + // 3. Explicit merging with all parents + recursiveMerging |= previousSource->testAttribute(Qt::WA_MergeSoftkeysRecursively); + // 4. Implicit and explicit merging always stops at window boundary + bool merging = (implicitMerging || explicitMerging || recursiveMerging) && !previousSource->isWindow(); + + source = merging ? previousSource->parentWidget() : NULL; } - - const Qt::WindowType sourceWindowType = QSoftKeyManagerPrivate::softKeySource - ? QSoftKeyManagerPrivate::softKeySource->window()->windowType() - : Qt::Widget; - - if (needsExitButton && sourceWindowType != Qt::Dialog && sourceWindowType != Qt::Popup) - QT_TRAP_THROWING( - nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QSoftKeyManager::tr("Exit")))); - - nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation + return source; } -bool QSoftKeyManager::handleCommand(int command) +bool QSoftKeyManager::handleUpdateSoftKeys() { - if (command >= s60CommandStart && QSoftKeyManagerPrivate::softKeySource) { - int index = command - s60CommandStart; - const QList<QAction*>& softKeys = QSoftKeyManagerPrivate::softKeySource->actions(); - for (int i = 0, j = 0; i < softKeys.count(); ++i) { - QAction *action = softKeys.at(i); - if (action->softKeyRole() != QAction::NoSoftKey) { - if (j == index) { - QWidget *parent = action->parentWidget(); - if (parent && parent->isEnabled()) { - action->activate(QAction::Trigger); - return true; - } - } - j++; - } + Q_D(QSoftKeyManager); + int level = 0; + d->requestedSoftKeyActions.clear(); + bool recursiveMerging = false; + QWidget *source = softkeySource(NULL, recursiveMerging); + do { + if (source) { + bool added = appendSoftkeys(*source, level); + source = softkeySource(source, recursiveMerging); + level = added ? ++level : level; } - } + } while (source); - return false; + d->updateSoftKeys_sys(); + return true; } -#else - -void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &) +bool QSoftKeyManager::event(QEvent *e) { +#ifndef QT_NO_ACTION + if (e->type() == QEvent::UpdateSoftKeys) + return handleUpdateSoftKeys(); +#endif //QT_NO_ACTION + return false; } +#ifdef Q_WS_S60 +bool QSoftKeyManager::handleCommand(int command) +{ + return static_cast<QSoftKeyManagerPrivateS60*>(QSoftKeyManager::instance()->d_func())->handleCommand(command); +} #endif QT_END_NAMESPACE diff --git a/src/gui/kernel/qsoftkeymanager_common_p.h b/src/gui/kernel/qsoftkeymanager_common_p.h new file mode 100644 index 0000000..460d0dc --- /dev/null +++ b/src/gui/kernel/qsoftkeymanager_common_p.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSOFTKEYMANAGER_COMMON_P_H +#define QSOFTKEYMANAGER_COMMON_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +QT_BEGIN_HEADER + +#ifndef QT_NO_SOFTKEYMANAGER + +QT_BEGIN_NAMESPACE + +class QSoftKeyManagerPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QSoftKeyManager) + +public: + virtual void updateSoftKeys_sys() {}; + +protected: + static QSoftKeyManager *self; + QHash<QAction*, Qt::Key> keyedActions; + QMultiHash<int, QAction*> requestedSoftKeyActions; + +}; + +QT_END_NAMESPACE + +#endif //QT_NO_SOFTKEYMANAGER + +QT_END_HEADER + +#endif // QSOFTKEYMANAGER_COMMON_P_H
\ No newline at end of file diff --git a/src/gui/kernel/qsoftkeymanager_p.h b/src/gui/kernel/qsoftkeymanager_p.h index c901a29..ce902fe 100644 --- a/src/gui/kernel/qsoftkeymanager_p.h +++ b/src/gui/kernel/qsoftkeymanager_p.h @@ -63,6 +63,8 @@ QT_BEGIN_NAMESPACE class QSoftKeyManagerPrivate; +const char MENU_ACTION_PROPERTY[] = "_q_menuaction"; + class Q_AUTOTEST_EXPORT QSoftKeyManager : public QObject { Q_OBJECT @@ -79,26 +81,30 @@ public: }; static void updateSoftKeys(); - static QAction *createAction(StandardSoftKey standardKey, QWidget *actionWidget); - static QAction *createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget); - #ifdef Q_WS_S60 static bool handleCommand(int); #endif -private: - QSoftKeyManager(); - static QSoftKeyManager *instance(); - static const char *standardSoftKeyText(StandardSoftKey standardKey); + static QAction *createAction(StandardSoftKey standardKey, QWidget *actionWidget); + static QAction *createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget); protected: bool event(QEvent *e); - Q_DISABLE_COPY(QSoftKeyManager) +private: + QSoftKeyManager(); + static QSoftKeyManager *instance(); + static const char *standardSoftKeyText(StandardSoftKey standardKey); + bool appendSoftkeys(const QWidget &source, int level); + QWidget *softkeySource(QWidget *previousSource, bool& recursiveMerging); + bool handleUpdateSoftKeys(); private Q_SLOTS: void cleanupHash(QObject* obj); void sendKeyEvent(); + +private: + Q_DISABLE_COPY(QSoftKeyManager) }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp new file mode 100644 index 0000000..67ed8b0 --- /dev/null +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -0,0 +1,366 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qapplication.h" +#include "qevent.h" +#include "qbitmap.h" +#include "qstyle.h" +#include "qmenubar.h" +#include "private/qt_s60_p.h" +#include "private/qmenu_p.h" +#include "private/qsoftkeymanager_p.h" +#include "private/qsoftkeymanager_s60_p.h" +#include "private/qobject_p.h" +//#include <eiksoftkeyimage.h> +#include <eikcmbut.h> + +#ifndef QT_NO_SOFTKEYMANAGER +QT_BEGIN_NAMESPACE + +const int S60_COMMAND_START = 6000; +const int LSK_POSITION = 0; +const int MSK_POSITION = 3; +const int RSK_POSITION = 2; + +QSoftKeyManagerPrivateS60::QSoftKeyManagerPrivateS60() +{ + cachedCbaIconSize[0] = QSize(0,0); + cachedCbaIconSize[1] = QSize(0,0); + skipNextUpdate = false; +} + +bool QSoftKeyManagerPrivateS60::skipCbaUpdate() +{ + // lets not update softkeys if + // 1. We don't have application panes, i.e. cba + // 2. S60 native dialog or menu is shown + if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) || + CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || skipNextUpdate) { + skipNextUpdate = false; + return true; + } + return false; +} + +void QSoftKeyManagerPrivateS60::ensureCbaVisibilityAndResponsiviness(CEikButtonGroupContainer &cba) +{ + RDrawableWindow *cbaWindow = cba.DrawableWindow(); + Q_ASSERT_X(cbaWindow, Q_FUNC_INFO, "Native CBA does not have window!"); + // Make sure CBA is visible, i.e. CBA window is on top + cbaWindow->SetOrdinalPosition(0); + // Qt shares same CBA instance between top-level widgets, + // make sure we are not faded by underlying window. + cbaWindow->SetFaded(EFalse, RWindowTreeNode::EFadeIncludeChildren); + // Modal dialogs capture pointer events, but shared cba instance + // shall stay responsive. Raise pointer capture priority to keep + // softkeys responsive in modal dialogs + cbaWindow->SetPointerCapturePriority(1); +} + +void QSoftKeyManagerPrivateS60::clearSoftkeys(CEikButtonGroupContainer &cba) +{ + QT_TRAP_THROWING( + //Using -1 instead of EAknSoftkeyEmpty to avoid flickering. + cba.SetCommandL(0, -1, KNullDesC); + // TODO: Should we clear also middle SK? + cba.SetCommandL(2, -1, KNullDesC); + ); + realSoftKeyActions.clear(); +} + +QString QSoftKeyManagerPrivateS60::softkeyText(QAction &softkeyAction) +{ + // In S60 softkeys and menu items do not support key accelerators (i.e. + // CTRL+X). Therefore, removing the accelerator characters from both softkey + // and menu item texts. + const int underlineShortCut = QApplication::style()->styleHint(QStyle::SH_UnderlineShortcut); + QString iconText = softkeyAction.iconText(); + return underlineShortCut ? softkeyAction.text() : iconText; +} + +QAction *QSoftKeyManagerPrivateS60::highestPrioritySoftkey(QAction::SoftKeyRole role) +{ + QAction *ret = NULL; + // Priority look up is two level + // 1. First widget with softkeys always has highest priority + for (int level = 0; !ret; level++) { + // 2. Highest priority action within widget + QList<QAction*> actions = requestedSoftKeyActions.values(level); + if (actions.isEmpty()) + break; + qSort(actions.begin(), actions.end(), QSoftKeyManagerPrivateS60::actionPriorityMoreThan); + foreach (QAction *action, actions) { + if (action->softKeyRole() == role) { + ret = action; + break; + } + } + } + return ret; +} + +bool QSoftKeyManagerPrivateS60::actionPriorityMoreThan(const QAction *firstItem, const QAction *secondItem) +{ + return firstItem->priority() > secondItem->priority(); +} + +void QSoftKeyManagerPrivateS60::setNativeSoftkey(CEikButtonGroupContainer &cba, + TInt position, TInt command, const TDesC &text) +{ + // Calling SetCommandL causes CBA redraw + QT_TRAP_THROWING(cba.SetCommandL(position, command, text)); +} + +bool QSoftKeyManagerPrivateS60::isOrientationLandscape() +{ + // Hard to believe that there is no public API in S60 to + // get current orientation. This workaround works with currently supported resolutions + return S60->screenHeightInPixels < S60->screenWidthInPixels; +} + +QSize QSoftKeyManagerPrivateS60::cbaIconSize(CEikButtonGroupContainer *cba, int position) +{ + Q_UNUSED(cba); + Q_UNUSED(position); + + // Will be implemented when EikSoftkeyImage usage license wise is OK +/* + const int index = isOrientationLandscape() ? 0 : 1; + if(cachedCbaIconSize[index].isNull()) { + // Only way I figured out to get CBA icon size without RnD SDK, was + // Only way I figured out to get CBA icon size without RnD SDK, was + // to set some dummy icon to CBA first and then ask CBA button CCoeControl::Size() + // The returned value is cached to avoid unnecessary icon setting every time. + const bool left = (position == LSK_POSITION); + if(position == LSK_POSITION || position == RSK_POSITION) { + CEikImage* tmpImage = NULL; + QT_TRAP_THROWING(tmpImage = new (ELeave) CEikImage); + EikSoftkeyImage::SetImage(cba, *tmpImage, left); // Takes myimage ownership + int command = S60_COMMAND_START + position; + setNativeSoftkey(*cba, position, command, KNullDesC()); + cachedCbaIconSize[index] = qt_TSize2QSize(cba->ControlOrNull(command)->Size()); + EikSoftkeyImage::SetLabel(cba, left); + } + } + + return cachedCbaIconSize[index]; +*/ + return QSize(); +} + +bool QSoftKeyManagerPrivateS60::setSoftkeyImage(CEikButtonGroupContainer *cba, + QAction &action, int position) +{ + bool ret = false; + Q_UNUSED(cba); + Q_UNUSED(action); + Q_UNUSED(position); + + // Will be implemented when EikSoftkeyImage usage license wise is OK + /* + const bool left = (position == LSK_POSITION); + if(position == LSK_POSITION || position == RSK_POSITION) { + QIcon icon = action.icon(); + if (!icon.isNull()) { + QPixmap pm = icon.pixmap(cbaIconSize(cba, position)); + pm = pm.scaled(cbaIconSize(cba, position)); + QBitmap mask = pm.mask(); + if (mask.isNull()) { + mask = QBitmap(pm.size()); + mask.fill(Qt::color1); + } + + CFbsBitmap* nBitmap = pm.toSymbianCFbsBitmap(); + CFbsBitmap* nMask = mask.toSymbianCFbsBitmap(); + + CEikImage* myimage = new (ELeave) CEikImage; + myimage->SetPicture( nBitmap, nMask ); // nBitmap and nMask ownership transfered + + EikSoftkeyImage::SetImage(cba, *myimage, left); // Takes myimage ownership + ret = true; + } else { + // Restore softkey to text based + EikSoftkeyImage::SetLabel(cba, left); + } + } + */ + return ret; +} + +bool QSoftKeyManagerPrivateS60::setSoftkey(CEikButtonGroupContainer &cba, + QAction::SoftKeyRole role, int position) +{ + QAction *action = highestPrioritySoftkey(role); + if (action) { + setSoftkeyImage(&cba, *action, position); + QString text = softkeyText(*action); + TPtrC nativeText = qt_QString2TPtrC(text); + int command = S60_COMMAND_START + position; + setNativeSoftkey(cba, position, command, nativeText); + cba.DimCommand(command, !action->isEnabled()); + realSoftKeyActions.insert(command, action); + return true; + } + return false; +} + +bool QSoftKeyManagerPrivateS60::setLeftSoftkey(CEikButtonGroupContainer &cba) +{ + return setSoftkey(cba, QAction::PositiveSoftKey, LSK_POSITION); +} + +bool QSoftKeyManagerPrivateS60::setMiddleSoftkey(CEikButtonGroupContainer &cba) +{ + // Note: In order to get MSK working, application has to have EAknEnableMSK flag set + // Currently it is not possible very easily) + // For more information see: http://wiki.forum.nokia.com/index.php/Middle_softkey_usage + return setSoftkey(cba, QAction::SelectSoftKey, MSK_POSITION); +} + +bool QSoftKeyManagerPrivateS60::setRightSoftkey(CEikButtonGroupContainer &cba) +{ + if (!setSoftkey(cba, QAction::NegativeSoftKey, RSK_POSITION)) { + Qt::WindowType windowType = Qt::Window; + QAction *action = requestedSoftKeyActions.value(0); + if (action) { + QWidget *actionParent = action->parentWidget(); + Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!"); + + QWidget *actionWindow = actionParent->window(); + Q_ASSERT_X(actionWindow, Q_FUNC_INFO, "Softkey action does not have window!"); + windowType = actionWindow->windowType(); + } + + if (windowType != Qt::Dialog && windowType != Qt::Popup) { + QString text(QSoftKeyManager::tr("Exit")); + TPtrC nativeText = qt_QString2TPtrC(text); + setNativeSoftkey(cba, RSK_POSITION, EAknSoftkeyExit, nativeText); + return true; + } + } + return false; +} + +void QSoftKeyManagerPrivateS60::setSoftkeys(CEikButtonGroupContainer &cba) +{ + int requestedSoftkeyCount = requestedSoftKeyActions.count(); + const int maxSoftkeyCount = 2; // TODO: differs based on orientation ans S60 versions (some have MSK) + if (requestedSoftkeyCount > maxSoftkeyCount) { + // We have more softkeys than available slots + // Put highest priority negative action to RSK and Options menu with rest of softkey actions to LSK + // TODO: Build menu + setLeftSoftkey(cba); + if(AknLayoutUtils::MSKEnabled()) + setMiddleSoftkey(cba); + setRightSoftkey(cba); + } else { + // We have less softkeys than available slots + // Put softkeys to request slots based on role + setLeftSoftkey(cba); + if(AknLayoutUtils::MSKEnabled()) + setMiddleSoftkey(cba); + setRightSoftkey(cba); + } +} + +void QSoftKeyManagerPrivateS60::updateSoftKeys_sys() +{ + //bool status = CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog(); + if (skipCbaUpdate()) + return; + + CEikButtonGroupContainer *nativeContainer = S60->buttonGroupContainer(); + Q_ASSERT_X(nativeContainer, Q_FUNC_INFO, "Native CBA does not exist!"); + ensureCbaVisibilityAndResponsiviness(*nativeContainer); + clearSoftkeys(*nativeContainer); + setSoftkeys(*nativeContainer); + + nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation +} + +bool QSoftKeyManagerPrivateS60::handleCommand(int command) +{ + QAction *action = realSoftKeyActions.value(command); + if (action) { + QVariant property = action->property(MENU_ACTION_PROPERTY); + if (property.isValid() && property.toBool()) { + QT_TRAP_THROWING(S60->menuBar()->TryDisplayMenuBarL()); + } else if (action->menu()) { + // TODO: This is hack, in order to use exising QMenuBar implementation for Symbian + // menubar needs to have widget to which it is associated. Since we want to associate + // menubar to action (which is inherited from QObejct), we create and associate QWidget + // to action and pass that for QMenuBar. This associates the menubar to action, and we + // can have own menubar for each action. + QWidget *actionContainer = action->property("_q_action_widget").value<QWidget*>(); + if(!actionContainer) { + actionContainer = new QWidget(action->parentWidget()); + QMenuBar *menuBar = new QMenuBar(actionContainer); + foreach(QAction *menuAction, action->menu()->actions()) { + QMenu *menu = menuAction->menu(); + if(menu) + menuBar->addMenu(action->menu()); + else + menuBar->addAction(menuAction); + } + QVariant v; + v.setValue(actionContainer); + action->setProperty("_q_action_widget", v); + } + qt_symbian_next_menu_from_action(actionContainer); + QT_TRAP_THROWING(S60->menuBar()->TryDisplayMenuBarL()); + // TODO: hack remove, it can happen that IsDisplayingMenuOrDialog return false + // in updateSoftKeys_sys, and we will override menu CBA with our own + skipNextUpdate = true; + } else { + Q_ASSERT(action->softKeyRole() != QAction::NoSoftKey); + QWidget *actionParent = action->parentWidget(); + Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!"); + if (actionParent->isEnabled()) { + action->activate(QAction::Trigger); + return true; + } + } + } + return false; +} + +QT_END_NAMESPACE +#endif //QT_NO_SOFTKEYMANAGER diff --git a/src/gui/kernel/qsoftkeymanager_s60_p.h b/src/gui/kernel/qsoftkeymanager_s60_p.h new file mode 100644 index 0000000..46e3596 --- /dev/null +++ b/src/gui/kernel/qsoftkeymanager_s60_p.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSOFTKEYMANAGER_S60_P_H +#define QSOFTKEYMANAGER_S60_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "private/qobject_p.h" +#include "private/qsoftkeymanager_common_p.h" + +QT_BEGIN_HEADER + +#ifndef QT_NO_SOFTKEYMANAGER + +QT_BEGIN_NAMESPACE + +class CEikButtonGroupContainer; +class QAction; + +class QSoftKeyManagerPrivateS60 : public QSoftKeyManagerPrivate +{ + Q_DECLARE_PUBLIC(QSoftKeyManager) + +public: + QSoftKeyManagerPrivateS60(); + +public: + void updateSoftKeys_sys(); + bool handleCommand(int command); + +private: + bool skipCbaUpdate(); + void ensureCbaVisibilityAndResponsiviness(CEikButtonGroupContainer &cba); + void clearSoftkeys(CEikButtonGroupContainer &cba); + QString softkeyText(QAction &softkeyAction); + QAction *highestPrioritySoftkey(QAction::SoftKeyRole role); + static bool actionPriorityMoreThan(const QAction* item1, const QAction* item2); + void setNativeSoftkey(CEikButtonGroupContainer &cba, TInt position, TInt command, const TDesC& text); + bool isOrientationLandscape(); + QSize cbaIconSize(CEikButtonGroupContainer *cba, int position); + bool setSoftkeyImage(CEikButtonGroupContainer *cba, QAction &action, int position); + bool setSoftkey(CEikButtonGroupContainer &cba, QAction::SoftKeyRole role, int position); + bool setLeftSoftkey(CEikButtonGroupContainer &cba); + bool setMiddleSoftkey(CEikButtonGroupContainer &cba); + bool setRightSoftkey(CEikButtonGroupContainer &cba); + void setSoftkeys(CEikButtonGroupContainer &cba); + +private: + QHash<int, QAction*> realSoftKeyActions; + QSize cachedCbaIconSize[2]; + bool skipNextUpdate; +}; + + +QT_END_NAMESPACE + +#endif //QT_NO_SOFTKEYMANAGER + +QT_END_HEADER + +#endif // QSOFTKEYMANAGER_S60_P_H diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 1163055..735ca7a 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -128,6 +128,7 @@ public: static inline RWindowGroup& windowGroup(); static inline CWsScreenDevice* screenDevice(); static inline CCoeAppUi* appUi(); + static inline CEikMenuBar* menuBar(); #ifdef Q_WS_S60 static inline CEikStatusPane* statusPane(); static inline CCoeControl* statusPaneSubPane(TInt aPaneId); @@ -270,6 +271,11 @@ inline CCoeAppUi* QS60Data::appUi() return CCoeEnv::Static()-> AppUi(); } +inline CEikMenuBar* QS60Data::menuBar() +{ + return CEikonEnv::Static()->AppUiFactory()->MenuBar(); +} + #ifdef Q_WS_S60 inline CEikStatusPane* QS60Data::statusPane() { diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 3f2322e..bc56ed0 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3081,6 +3081,8 @@ void QRasterPaintEngine::drawGlyphsS60(const QPointF &p, const QTextItemInt &ti) QVarLengthArray<glyph_t> glyphs; QTransform matrix = s->matrix; matrix.translate(p.x(), p.y()); + if (matrix.type() == QTransform::TxScale) + fe->setFontScale(matrix.m11()); ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); const QFixed aliasDelta = QFixed::fromReal(aliasedCoordinateDelta); @@ -3097,6 +3099,9 @@ void QRasterPaintEngine::drawGlyphsS60(const QPointF &p, const QTextItemInt &ti) alphaPenBlt(glyphBitmapBytes, glyphBitmapSize.iWidth, 8, x, y, glyphBitmapSize.iWidth, glyphBitmapSize.iHeight); } + if (matrix.type() == QTransform::TxScale) + fe->setFontScale(1.0); + return; } #endif // Q_OS_SYMBIAN && QT_NO_FREETYPE @@ -3269,7 +3274,9 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte } #elif defined (Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) // Q_WS_WIN || Q_WS_MAC - if (s->matrix.type() <= QTransform::TxTranslate) { + if (s->matrix.type() <= QTransform::TxTranslate + || (s->matrix.type() == QTransform::TxScale + && (qFuzzyCompare(s->matrix.m11(), s->matrix.m22())))) { drawGlyphsS60(p, ti); return; } diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 2a1d336..3132dd1 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -1608,7 +1608,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (toolbutton->toolButtonStyle == Qt::ToolButtonTextUnderIcon) { pr.setHeight(pmSize.height() + 6); - tr.adjust(0, pr.height() - 1, 0, -3); + tr.adjust(0, pr.height() - 1, 0, -2); pr.translate(shiftX, shiftY); if (!hasArrow) { proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pm); diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index e8298cf..a077cf0 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -2411,7 +2411,12 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW ret = 0; break; case PM_ToolBarFrameWidth: - ret = 0; + ret = 1; + if (widget) { + if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(widget->parent())) + if (mainWindow->unifiedTitleAndToolBarOnMac()) + ret = 0; + } break; default: ret = QWindowsStyle::pixelMetric(metric, opt, widget); @@ -5726,12 +5731,16 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, break; case CT_ToolButton: if (widget && qobject_cast<const QToolBar *>(widget->parentWidget())) { - sz.rwidth() += 4; - if (sz.height() <= 32) { - // Workaround strange HIToolBar bug when getting constraints. - sz.rheight() += 1; + if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(widget->parent())) { + if (mainWindow->unifiedTitleAndToolBarOnMac()) { + sz.rwidth() += 4; + if (sz.height() <= 32) { + // Workaround strange HIToolBar bug when getting constraints. + sz.rheight() += 1; + } + return sz; + } } - return sz; } sz.rwidth() += 10; sz.rheight() += 10; diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 9b99161..9025e5b 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -92,10 +92,10 @@ static const qreal goldenRatio = 1.618; const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** -{240,320,1,15,"QVGA Landscape"}, -{320,240,1,15,"QVGA Portrait"}, -{360,640,1,15,"NHD Landscape"}, -{640,360,1,15,"NHD Portrait"}, +{240,320,1,16,"QVGA Landscape"}, +{320,240,1,16,"QVGA Portrait"}, +{360,640,1,16,"NHD Landscape"}, +{640,360,1,16,"NHD Portrait"}, {352,800,1,12,"E90 Landscape"} // *** End of generated data *** }; @@ -104,10 +104,10 @@ const int QS60StylePrivate::m_numberOfLayouts = const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** -{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,3,3,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1}, -{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1}, -{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, -{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,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,96,35,96,5,5,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, +{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1}, +{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1}, +{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, +{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,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,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, {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,7,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 *** }; @@ -2399,22 +2399,15 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin)); break; #ifndef QT_NO_COMBOBOX - case CT_ComboBox: - if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) { - const int frameWidth = cmb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0; - const int textMargins = 2*(pixelMetric(PM_FocusFrameHMargin) + 1); - const int smallestExtraWidth = 23; - // QItemDelegate::sizeHint expands the textMargins two times, thus the 2*textMargins... - const int extra = - qMax(smallestExtraWidth, 2*textMargins + pixelMetric(PM_ScrollBarExtent, opt, widget)); - sz = QSize(sz.width() + frameWidth + extra, sz.height() + frameWidth); - int maxScreenWidth = QApplication::desktop()->availableGeometry().size().width(); - if (sz.width() > maxScreenWidth) { - maxScreenWidth = maxScreenWidth - (extra + frameWidth); - sz.setWidth(maxScreenWidth); - } - } - break; + case CT_ComboBox: { + // Fixing Ui design issues with too wide QComboBoxes and greedy SizeHints + // Make sure, that the combobox says within the screen. + const QSize desktopContentSize = QApplication::desktop()->availableGeometry().size() + -QSize(pixelMetric(PM_LayoutLeftMargin) + pixelMetric(PM_LayoutRightMargin), 0); + sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget). + boundedTo(desktopContentSize); + } + break; #endif default: sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 4625667..9dd4af7 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -129,26 +129,62 @@ static inline unsigned int getChar(const QChar *str, int &i, const int len) return uc; } +CFont *QFontEngineS60::fontWithSize(qreal size) const +{ + CFont *result = 0; + TFontSpec fontSpec(qt_QString2TPtrC(QFontEngine::fontDef.family), TInt(size)); + fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); + fontSpec.iFontStyle.SetPosture(QFontEngine::fontDef.style == QFont::StyleNormal?EPostureUpright:EPostureItalic); + fontSpec.iFontStyle.SetStrokeWeight(QFontEngine::fontDef.weight > QFont::Normal?EStrokeWeightBold:EStrokeWeightNormal); + const TInt errorCode = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(result, fontSpec); + Q_ASSERT(result && (errorCode == 0)); + return result; +} + +void QFontEngineS60::setFontScale(qreal scale) +{ + if (qFuzzyCompare(scale, qreal(1))) { + if (!m_originalFont) + m_originalFont = fontWithSize(m_originalFontSizeInPixels); + m_activeFont = m_originalFont; + } else { + const qreal scaledFontSizeInPixels = m_originalFontSizeInPixels * scale; + if (!m_scaledFont || + (TInt(scaledFontSizeInPixels) != TInt(m_scaledFontSizeInPixels))) { + releaseFont(m_scaledFont); + m_scaledFontSizeInPixels = scaledFontSizeInPixels; + m_scaledFont = fontWithSize(m_scaledFontSizeInPixels); + } + m_activeFont = m_scaledFont; + } +} + +void QFontEngineS60::releaseFont(CFont *&font) +{ + if (font) { + S60->screenDevice()->ReleaseFont(font); + font = 0; + } +} + QFontEngineS60::QFontEngineS60(const QFontDef &request, const QFontEngineS60Extensions *extensions) : m_extensions(extensions) + , m_originalFont(0) + , m_originalFontSizeInPixels((request.pixelSize >= 0)? + request.pixelSize:pointsToPixels(request.pointSize)) + , m_scaledFont(0) + , m_scaledFontSizeInPixels(0) + , m_activeFont(0) { QFontEngine::fontDef = request; - m_fontSizeInPixels = (request.pixelSize >= 0)? - request.pixelSize:pointsToPixels(request.pointSize); - - TFontSpec fontSpec(qt_QString2TPtrC(request.family), m_fontSizeInPixels); - fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); - fontSpec.iFontStyle.SetPosture(request.style == QFont::StyleNormal?EPostureUpright:EPostureItalic); - fontSpec.iFontStyle.SetStrokeWeight(request.weight > QFont::Normal?EStrokeWeightBold:EStrokeWeightNormal); - const TInt errorCode = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(m_font, fontSpec); - Q_ASSERT(errorCode == 0); - + setFontScale(1.0); cache_cost = sizeof(QFontEngineS60); } QFontEngineS60::~QFontEngineS60() { - S60->screenDevice()->ReleaseFont(m_font); + releaseFont(m_originalFont); + releaseFont(m_scaledFont); } bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const @@ -251,12 +287,12 @@ glyph_metrics_t QFontEngineS60::boundingBox(glyph_t glyph) QFixed QFontEngineS60::ascent() const { - return m_font->FontMaxAscent(); + return m_originalFont->FontMaxAscent(); } QFixed QFontEngineS60::descent() const { - return m_font->FontMaxDescent(); + return m_originalFont->FontMaxDescent(); } QFixed QFontEngineS60::leading() const @@ -266,7 +302,7 @@ QFixed QFontEngineS60::leading() const qreal QFontEngineS60::maxCharWidth() const { - return m_font->MaxCharWidthInPixels(); + return m_originalFont->MaxCharWidthInPixels(); } const char *QFontEngineS60::name() const @@ -302,11 +338,11 @@ void QFontEngineS60::getCharacterData(glyph_t glyph, TOpenFontCharMetrics& metri const TUint specialCode = (TUint)glyph | 0x80000000; const CFont::TCharacterDataAvailability availability = - m_font->GetCharacterData(specialCode, metrics, bitmap, bitmapSize); + m_activeFont->GetCharacterData(specialCode, metrics, bitmap, bitmapSize); const glyph_t fallbackGlyph = '?'; if (availability != CFont::EAllCharacterData) { const CFont::TCharacterDataAvailability fallbackAvailability = - m_font->GetCharacterData(fallbackGlyph, metrics, bitmap, bitmapSize); + m_activeFont->GetCharacterData(fallbackGlyph, metrics, bitmap, bitmapSize); Q_ASSERT(fallbackAvailability == CFont::EAllCharacterData); } } diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h index 6d47b9d..5834cc4 100644 --- a/src/gui/text/qfontengine_s60_p.h +++ b/src/gui/text/qfontengine_s60_p.h @@ -58,9 +58,6 @@ #include "qsize.h" #include <openfont.h> -class CFbsBitmap; -class CFbsBitmapDevice; -class CFbsBitGc; class CFont; QT_BEGIN_NAMESPACE @@ -120,15 +117,21 @@ public: Type type() const; void getCharacterData(glyph_t glyph, TOpenFontCharMetrics& metrics, const TUint8*& bitmap, TSize& bitmapSize) const; + void setFontScale(qreal scale); private: friend class QFontPrivate; QFixed glyphAdvance(HB_Glyph glyph) const; + CFont *fontWithSize(qreal size) const; + static void releaseFont(CFont *&font); - CFont* m_font; const QFontEngineS60Extensions *m_extensions; - qreal m_fontSizeInPixels; + CFont* m_originalFont; + const qreal m_originalFontSizeInPixels; + CFont* m_scaledFont; + qreal m_scaledFontSizeInPixels; + CFont* m_activeFont; }; class QFontEngineMultiS60 : public QFontEngineMulti diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 1622191..269cd12 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -119,8 +119,6 @@ void QMainWindowPrivate::init() q->setAttribute(Qt::WA_Hover); #ifdef QT_SOFTKEYS_ENABLED menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, q); - menuBarAction->setObjectName(QLatin1String("_q_menuSoftKeyAction")); - menuBarAction->setVisible(false); #endif } diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index b7272f7..aaed6b1 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -71,6 +71,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_MENU #ifdef Q_WS_S60 +void qt_symbian_next_menu_from_action(QWidget* actionContainer); void qt_symbian_show_toplevel(CEikMenuPane* menuPane); void qt_symbian_show_submenu(CEikMenuPane* menuPane, int id); #endif // Q_WS_S60 @@ -87,7 +88,7 @@ QT_BEGIN_NAMESPACE typedef void NSMenuItem; # endif //__OBJC__ struct QMacMenuAction { - QMacMenuAction() + QMacMenuAction() #ifndef QT_MAC_USE_COCOA : command(0) #else @@ -124,7 +125,7 @@ typedef QList<QMenuMergeItem> QMenuMergeList; #ifdef Q_WS_WINCE struct QWceMenuAction { - uint command; + uint command; QPointer<QAction> action; HMENU menuHandle; QWceMenuAction() : menuHandle(0), command(0) {} @@ -340,7 +341,7 @@ public: QList<QWceMenuAction*> actionItems; HMENU menuHandle; QWceMenuPrivate(); - ~QWceMenuPrivate(); + ~QWceMenuPrivate(); void addAction(QAction *, QWceMenuAction* =0); void addAction(QWceMenuAction *, QWceMenuAction* =0); void syncAction(QWceMenuAction *); diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 28b27d4..eae97a6 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -81,6 +81,7 @@ static QList<QMenuBar*> nativeMenuBars; static uint qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM; static QPointer<QWidget> widgetWithContextMenu; static QList<QAction*> contextMenuActionList; +static QWidget* actionMenu = NULL; static int contexMenuCommand=0; bool menuExists() @@ -224,8 +225,26 @@ static void rebuildMenu() } #ifdef Q_WS_S60 +void qt_symbian_next_menu_from_action(QWidget *actionContainer) +{ + actionMenu = actionContainer; +} + void qt_symbian_show_toplevel( CEikMenuPane* menuPane) { + if (actionMenu) { + QMenuBarPrivate *mb = 0; + mb = menubars()->value(actionMenu); + qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM; + deleteAll( &symbianMenus ); + Q_ASSERT(mb); + mb->symbian_menubar->rebuild(); + for (int i = 0; i < symbianMenus.count(); ++i) + QT_TRAP_THROWING(menuPane->AddMenuItemL(symbianMenus.at(i)->menuItemData)); + actionMenu = NULL; + return; + } + if (!menuExists()) return; rebuildMenu(); @@ -271,10 +290,16 @@ int QMenuBarPrivate::symbianCommands(int command) void QMenuBarPrivate::symbianCreateMenuBar(QWidget *parent) { Q_Q(QMenuBar); - if (parent && parent->isWindow()){ - menubars()->insert(q->window(), this); - symbian_menubar = new QSymbianMenuBarPrivate(this); - nativeMenuBars.append(q); + if (parent) { + if(parent->isWindow()) { + menubars()->insert(q->window(), this); + symbian_menubar = new QSymbianMenuBarPrivate(this); + nativeMenuBars.append(q); + } else { + menubars()->insert(q->parentWidget(), this); + symbian_menubar = new QSymbianMenuBarPrivate(this); + nativeMenuBars.append(q); + } } } @@ -284,6 +309,7 @@ void QMenuBarPrivate::symbianDestroyMenuBar() int index = nativeMenuBars.indexOf(q); nativeMenuBars.removeAt(index); menubars()->remove(q->window(), this); + menubars()->remove(q->parentWidget(), this); rebuildMenu(); if (symbian_menubar) delete symbian_menubar; diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 0e14385..9caadb7 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -667,7 +667,7 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti \i Application Menu | About <application name> \i The application name is fetched from the \c {Info.plist} file (see note below). If this entry is not found no About item - will appear in the Application Menu. + will appear in the Application Menu. \row \i config, options, setup, settings or preferences \i Application Menu | Preferences \i If this entry is not found the Settings item will be disabled diff --git a/src/gui/widgets/qprintpreviewwidget.cpp b/src/gui/widgets/qprintpreviewwidget.cpp index 747a227..45b15ef 100644 --- a/src/gui/widgets/qprintpreviewwidget.cpp +++ b/src/gui/widgets/qprintpreviewwidget.cpp @@ -151,7 +151,11 @@ class GraphicsView : public QGraphicsView public: GraphicsView(QWidget* parent = 0) : QGraphicsView(parent) - {} + { +#ifdef Q_WS_MAC + setFrameStyle(QFrame::NoFrame); +#endif + } signals: void resized(); diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index fff7097..cc6a1c8 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -688,8 +688,14 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() if (channels[i].resendCurrent) { channels[i].resendCurrent = false; channels[i].state = QHttpNetworkConnectionChannel::IdleState; - if (channels[i].reply) + if (channels[i].reply) { + + // if this is not possible, error will be emitted and connection terminated + if (!channels[i].resetUploadData()) + continue; + channels[i].sendRequest(); + } } } diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index b80ae9a..70a301d 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -674,15 +674,8 @@ void QHttpNetworkConnectionChannel::handleStatus() case 407: // proxy auth required if (connection->d_func()->handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend)) { if (resend) { - QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); - if (uploadByteDevice) { - if (uploadByteDevice->reset()) { - written = 0; - } else { - connection->d_func()->emitReplyError(socket, reply, QNetworkReply::ContentReSendError); - break; - } - } + if (!resetUploadData()) + break; reply->d_func()->eraseData(); @@ -712,6 +705,22 @@ void QHttpNetworkConnectionChannel::handleStatus() } } +bool QHttpNetworkConnectionChannel::resetUploadData() +{ + QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); + if (!uploadByteDevice) + return true; + + if (uploadByteDevice->reset()) { + written = 0; + return true; + } else { + connection->d_func()->emitReplyError(socket, reply, QNetworkReply::ContentReSendError); + return false; + } +} + + void QHttpNetworkConnectionChannel::pipelineInto(HttpMessagePair &pair) { // this is only called for simple GET diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h index c30c236..75ab50d 100644 --- a/src/network/access/qhttpnetworkconnectionchannel_p.h +++ b/src/network/access/qhttpnetworkconnectionchannel_p.h @@ -151,6 +151,8 @@ public: void allDone(); // reply header + body have been read void handleStatus(); // called from allDone() + bool resetUploadData(); // return true if resetting worked or there is no upload data + void pipelineInto(HttpMessagePair &pair); void requeueCurrentlyPipelinedRequests(); void detectPipeliningSupport(); diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp index 47a998c..404eee7 100644 --- a/src/network/socket/qtcpserver.cpp +++ b/src/network/socket/qtcpserver.cpp @@ -513,6 +513,10 @@ bool QTcpServer::hasPendingConnections() const 0 is returned if this function is called when there are no pending connections. + \note The returned QTcpSocket object cannot be used from another + thread. If you want to use an incoming connection from another thread, + you need to override incomingConnection(). + \sa hasPendingConnections() */ QTcpSocket *QTcpServer::nextPendingConnection() @@ -543,6 +547,11 @@ QTcpSocket *QTcpServer::nextPendingConnection() may not be usable with native socket functions, and should only be used with QTcpSocket::setSocketDescriptor(). + \note If you want to handle an incoming connection as a new QTcpSocket + object in another thread you have to pass the socketDescriptor + to the other thread and create the QTcpSocket object there and + use its setSocketDescriptor() method. + \sa newConnection(), nextPendingConnection() */ void QTcpServer::incomingConnection(int socketDescriptor) diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index cc0e5a1..3087b77 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -46,11 +46,13 @@ #include "qvgimagepool_p.h" #ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE +#include <private/qt_s60_p.h> +#include <fbs.h> #include <graphics/sgimage.h> typedef EGLImageKHR (*pfnEglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, EGLint*); typedef EGLBoolean (*pfnEglDestroyImageKHR)(EGLDisplay, EGLImageKHR); typedef VGImage (*pfnVgCreateEGLImageTargetKHR)(VGeglImageKHR); -#endif +#endif // QT_SYMBIAN_SUPPORTS_SGIMAGE QT_BEGIN_NAMESPACE @@ -425,6 +427,34 @@ Q_OPENVG_EXPORT VGImage qPixmapToVGImage(const QPixmap& pixmap) } #if defined(Q_OS_SYMBIAN) + +static CFbsBitmap* createBlitCopy(CFbsBitmap* bitmap) +{ + CFbsBitmap *copy = q_check_ptr(new CFbsBitmap); + if(!copy) + return 0; + + if (copy->Create(bitmap->SizeInPixels(), bitmap->DisplayMode()) != KErrNone) { + delete copy; + copy = 0; + + return 0; + } + + CFbsBitmapDevice* bitmapDevice = 0; + CFbsBitGc *bitmapGc = 0; + QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(copy)); + QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL()); + bitmapGc->Activate(bitmapDevice); + + bitmapGc->BitBlt(TPoint(), bitmap); + + delete bitmapGc; + delete bitmapDevice; + + return copy; +} + void QVGPixmapData::cleanup() { is_null = w = h = 0; @@ -510,7 +540,49 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) eglDestroyImageKHR(context->display(), eglImage); SgDriver::Close(); } else if (type == QPixmapData::FbsBitmap) { + CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap*>(pixmap); + + bool deleteSourceBitmap = false; + +#ifdef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE + + // Rasterize extended bitmaps + + TUid extendedBitmapType = bitmap->ExtendedBitmapType(); + if (extendedBitmapType != KNullUid) { + bitmap = createBlitCopy(bitmap); + deleteSourceBitmap = true; + } +#endif + + if (bitmap->IsCompressedInRAM()) { + bitmap = createBlitCopy(bitmap); + deleteSourceBitmap = true; + } + + TDisplayMode displayMode = bitmap->DisplayMode(); + QImage::Format format = qt_TDisplayMode2Format(displayMode); + + TSize size = bitmap->SizeInPixels(); + + bitmap->BeginDataAccess(); + uchar *bytes = (uchar*)bitmap->DataAddress(); + QImage img = QImage(bytes, size.iWidth, size.iHeight, format); + img = img.copy(); + bitmap->EndDataAccess(); + + if(displayMode == EGray2) { + //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid + //So invert mono bitmaps so that masks work correctly. + img.invertPixels(); + } else if(displayMode == EColor16M) { + img = img.rgbSwapped(); // EColor16M is BGR + } + + fromImage(img, Qt::AutoColor); + if(deleteSourceBitmap) + delete bitmap; } #else Q_UNUSED(pixmap); @@ -593,7 +665,25 @@ void* QVGPixmapData::toNativeType(NativeType type) SgDriver::Close(); return reinterpret_cast<void*>(sgImage); } else if (type == QPixmapData::FbsBitmap) { - return 0; + CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); + + if (bitmap) { + if (bitmap->Create(TSize(source.width(), source.height()), + EColor16MAP) == KErrNone) { + const uchar *sptr = qt_vg_imageBits(source); + bitmap->BeginDataAccess(); + + uchar *dptr = (uchar*)bitmap->DataAddress(); + Mem::Copy(dptr, sptr, source.byteCount()); + + bitmap->EndDataAccess(); + } else { + delete bitmap; + bitmap = 0; + } + } + + return reinterpret_cast<void*>(bitmap); } #else Q_UNUSED(type); diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index da65230..155e3e7 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -5527,7 +5527,7 @@ EXPORTS ?invalidateChildrenSceneTransform@QGraphicsItemPrivate@@QAEXXZ @ 5526 NONAME ; void QGraphicsItemPrivate::invalidateChildrenSceneTransform(void) ?invalidateDepthRecursively@QGraphicsItemPrivate@@QAEXXZ @ 5527 NONAME ; void QGraphicsItemPrivate::invalidateDepthRecursively(void) ?invalidateFilter@QSortFilterProxyModel@@IAEXXZ @ 5528 NONAME ; void QSortFilterProxyModel::invalidateFilter(void) - ?invalidateGraphicsEffectsRecursively@QGraphicsItemPrivate@@QAEXXZ @ 5529 NONAME ; void QGraphicsItemPrivate::invalidateGraphicsEffectsRecursively(void) + ?invalidateGraphicsEffectsRecursively@QGraphicsItemPrivate@@QAEXXZ @ 5529 NONAME ABSENT ; void QGraphicsItemPrivate::invalidateGraphicsEffectsRecursively(void) ?invalidateGraphicsEffectsRecursively@QWidgetPrivate@@QAEXXZ @ 5530 NONAME ; void QWidgetPrivate::invalidateGraphicsEffectsRecursively(void) ?invalidateScene@QGraphicsView@@QAEXABVQRectF@@V?$QFlags@W4SceneLayer@QGraphicsScene@@@@@Z @ 5531 NONAME ; void QGraphicsView::invalidateScene(class QRectF const &, class QFlags<enum QGraphicsScene::SceneLayer>) ?invalidateSizeCache@QWidgetItemV2@@AAEXXZ @ 5532 NONAME ; void QWidgetItemV2::invalidateSizeCache(void) @@ -9555,7 +9555,7 @@ EXPORTS ?setParent@QWidget@@QAEXPAV1@@Z @ 9554 NONAME ; void QWidget::setParent(class QWidget *) ?setParent@QWidget@@QAEXPAV1@V?$QFlags@W4WindowType@Qt@@@@@Z @ 9555 NONAME ; void QWidget::setParent(class QWidget *, class QFlags<enum Qt::WindowType>) ?setParentItem@QGraphicsItem@@QAEXPAV1@@Z @ 9556 NONAME ; void QGraphicsItem::setParentItem(class QGraphicsItem *) - ?setParentItemHelper@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@@Z @ 9557 NONAME ; void QGraphicsItemPrivate::setParentItemHelper(class QGraphicsItem *) + ?setParentItemHelper@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@@Z @ 9557 NONAME ABSENT ; void QGraphicsItemPrivate::setParentItemHelper(class QGraphicsItem *) ?setParentLayoutItem@QGraphicsLayoutItem@@QAEXPAV1@@Z @ 9558 NONAME ; void QGraphicsLayoutItem::setParentLayoutItem(class QGraphicsLayoutItem *) ?setParent_sys@QWidgetPrivate@@QAEXPAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z @ 9559 NONAME ; void QWidgetPrivate::setParent_sys(class QWidget *, class QFlags<enum Qt::WindowType>) ?setPasswordCharacter@QLineControl@@QAEXABVQChar@@@Z @ 9560 NONAME ; void QLineControl::setPasswordCharacter(class QChar const &) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 05f620c..a9a69aa 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -4671,7 +4671,7 @@ EXPORTS _ZN20QGraphicsItemPrivate18setTransformHelperERK10QTransform @ 4670 NONAME _ZN20QGraphicsItemPrivate18subFocusItemChangeEv @ 4671 NONAME _ZN20QGraphicsItemPrivate18updateAncestorFlagEN13QGraphicsItem16GraphicsItemFlagENS_12AncestorFlagEbb @ 4672 NONAME - _ZN20QGraphicsItemPrivate19setParentItemHelperEP13QGraphicsItem @ 4673 NONAME + _ZN20QGraphicsItemPrivate19setParentItemHelperEP13QGraphicsItem @ 4673 NONAME ABSENT _ZN20QGraphicsItemPrivate20removeExtraItemCacheEv @ 4674 NONAME _ZN20QGraphicsItemPrivate23appendGraphicsTransformEP18QGraphicsTransform @ 4675 NONAME _ZN20QGraphicsItemPrivate25movableAncestorIsSelectedEPK13QGraphicsItem @ 4676 NONAME @@ -11639,7 +11639,7 @@ EXPORTS _ZN19QGraphicsBlurEffect4drawEP8QPainter @ 11638 NONAME _ZN19QKeyEventTransition15setModifierMaskE6QFlagsIN2Qt16KeyboardModifierEE @ 11639 NONAME _ZN20QGraphicsItemPrivate18siblingOrderChangeEv @ 11640 NONAME - _ZN20QGraphicsItemPrivate36invalidateGraphicsEffectsRecursivelyEv @ 11641 NONAME + _ZN20QGraphicsItemPrivate36invalidateGraphicsEffectsRecursivelyEv @ 11641 NONAME ABSENT _ZN21QMouseEventTransition14setHitTestPathERK12QPainterPath @ 11642 NONAME _ZN21QMouseEventTransition15setModifierMaskE6QFlagsIN2Qt16KeyboardModifierEE @ 11643 NONAME _ZN22QGraphicsOpacityEffect4drawEP8QPainter @ 11644 NONAME diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index aaecf6c..5318693 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -114,6 +114,10 @@ symbian: { graphicssystems_plugins.sources += qvggraphicssystem.dll } + contains(QT_CONFIG, multimedia) { + qtlibraries.sources += QtMultimedia.dll + } + BLD_INF_RULES.prj_exports += "qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)" BLD_INF_RULES.prj_exports += "qtdemoapps.iby $$CORE_APP_LAYER_IBY_EXPORT_PATH(qtdemoapps.iby)" } diff --git a/src/s60installs/sqlite3.sis b/src/s60installs/sqlite3.sis Binary files differindex 1785365..11e069e 100644 --- a/src/s60installs/sqlite3.sis +++ b/src/s60installs/sqlite3.sis diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index 9dbefaf..9fff552 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -245,9 +245,9 @@ bool QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int i values[i + idx] = QVariant(QVariant::String); break; default: - values[i + idx] = QString::fromUtf16(static_cast<const ushort *>( + values[i + idx] = QString(reinterpret_cast<const QChar *>( sqlite3_column_text16(stmt, i)), - sqlite3_column_bytes16(stmt, i) / sizeof(ushort)); + sqlite3_column_bytes16(stmt, i) / sizeof(QChar)); break; } } diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp index 5f12b55..3d63f88 100644 --- a/src/sql/kernel/qsqlresult.cpp +++ b/src/sql/kernel/qsqlresult.cpp @@ -136,7 +136,7 @@ static QString qFieldSerial(int i) i >>= 4; } - return QString::fromUtf16(arr, int(ptr - arr) + 1); + return QString(reinterpret_cast<const QChar *>(arr), int(ptr - arr) + 1); } static bool qIsAlnum(QChar ch) diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index e41cd55..1f6e58f 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -544,6 +544,8 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file) const QString filename = nodes.at(nodes.size()-1); RCCFileInfo *s = new RCCFileInfo(file); s->m_parent = parent; + if (parent->m_children.contains(filename)) + qWarning("potential duplicate alias detected: '%s'", qPrintable(filename)); parent->m_children.insertMulti(filename, s); return true; } diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index d9aff1b..8099ffa 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -2787,8 +2787,8 @@ static void generateMultiDirectiveBegin(QTextStream &outputStream, const QSet<QS return; QMap<QString, bool> map; // bool is dummy. The idea is to sort that (always generate in the same order) by putting a set into a map - foreach (QString str, directives) - map[str] = true; + foreach (const QString &str, directives) + map.insert(str, true); if (map.size() == 1) { outputStream << "#ifndef " << map.constBegin().key() << endl; @@ -2797,7 +2797,7 @@ static void generateMultiDirectiveBegin(QTextStream &outputStream, const QSet<QS outputStream << "#if"; bool doOr = false; - foreach (QString str, map.keys()) { + foreach (const QString &str, map.keys()) { if (doOr) outputStream << " ||"; outputStream << " !defined(" << str << ')'; diff --git a/src/tools/uic3/converter.cpp b/src/tools/uic3/converter.cpp index 2bf293d..e1b4b38 100644 --- a/src/tools/uic3/converter.cpp +++ b/src/tools/uic3/converter.cpp @@ -401,7 +401,7 @@ DomUI *Ui3Reader::generateUi4(const QDomElement &widget) bool resolved = false; if (objName == receiver) { // see if it's a custom slot - foreach (QString cs, ui_custom_slots) { + foreach (const QString &cs, ui_custom_slots) { if (cs == slot) { resolved = true; break; @@ -1122,7 +1122,7 @@ void Ui3Reader::createProperties(const QDomElement &n, QList<DomProperty*> *prop if (prop->kind() == DomProperty::Set) { QStringList flags = prop->elementSet().split(QLatin1Char('|')); QStringList v; - foreach (QString fl, flags) { + foreach (const QString &fl, flags) { QString e = WidgetInfo::resolveEnumerator(className, fl); if (e.isEmpty()) { e = m_porting->renameEnumerator(className + QLatin1String("::") + fl); @@ -1283,7 +1283,7 @@ QString Ui3Reader::fixType(const QString &t) const QString newText = t; //split type name on <>*& and whitespace QStringList typeNames = t.split(QRegExp(QLatin1String("<|>|\\*|&| ")), QString::SkipEmptyParts); - foreach(QString typeName , typeNames) { + foreach(const QString &typeName , typeNames) { QString newName = fixClassName(typeName); if( newName != typeName ) { newText.replace(typeName, newName); diff --git a/src/tools/uic3/main.cpp b/src/tools/uic3/main.cpp index 6acc94f..1ebb76a 100644 --- a/src/tools/uic3/main.cpp +++ b/src/tools/uic3/main.cpp @@ -338,10 +338,10 @@ int runUic3(int argc, char * argv[]) QStringList globalIncludes, localIncludes; ui3.computeDeps(e, globalIncludes, localIncludes, impl); - foreach (QString i, globalIncludes) + foreach (const QString &i, globalIncludes) printf("%s\n", i.toLatin1().constData()); - foreach (QString i, localIncludes) + foreach (const QString &i, localIncludes) printf("%s\n", i.toLatin1().constData()); if (impl) |