diff options
author | Sami Lempinen <sami.lempinen@nokia.com> | 2011-07-05 07:10:56 (GMT) |
---|---|---|
committer | Sami Lempinen <sami.lempinen@nokia.com> | 2011-07-05 07:10:56 (GMT) |
commit | 89260bad8fddcbbfe54b3c5238ef370a620ab9e6 (patch) | |
tree | 31aac7993c1b06634e83e802a16fb1be87615c10 /src/gui | |
parent | bad513727833e207f7f8ca0d7c07c44c1addfb57 (diff) | |
parent | 601b12b7879e9a743ef9e516470219aae73e611d (diff) | |
download | Qt-89260bad8fddcbbfe54b3c5238ef370a620ab9e6.zip Qt-89260bad8fddcbbfe54b3c5238ef370a620ab9e6.tar.gz Qt-89260bad8fddcbbfe54b3c5238ef370a620ab9e6.tar.bz2 |
Merge remote-tracking branch 'qt/4.8'
Diffstat (limited to 'src/gui')
26 files changed, 1181 insertions, 281 deletions
diff --git a/src/gui/accessible/qaccessible_mac.mm b/src/gui/accessible/qaccessible_mac.mm index 432b536..a250730 100644 --- a/src/gui/accessible/qaccessible_mac.mm +++ b/src/gui/accessible/qaccessible_mac.mm @@ -2427,7 +2427,7 @@ void QAccessible::updateAccessibility(QObject *object, int child, Event reason) } // There is no equivalent Mac notification for ObjectShow/Hide, so we call HIObjectSetAccessibilityIgnored - // and isItIntersting which will mark the HIObject accociated with the element as ignored if the + // and isItInteresting which will mark the HIObject accociated with the element as ignored if the // QAccessible::Invisible state bit is set. QAInterface interface = accessibleHierarchyManager()->lookup(element); if (interface.isValid()) { diff --git a/src/gui/accessible/qaccessible_win.cpp b/src/gui/accessible/qaccessible_win.cpp index 3c42864..79ac442 100644 --- a/src/gui/accessible/qaccessible_win.cpp +++ b/src/gui/accessible/qaccessible_win.cpp @@ -47,6 +47,11 @@ #include "qt_windows.h" #include "qwidget.h" #include "qsettings.h" +#include <QtCore/qmap.h> +#include <QtCore/qpair.h> +#include <QtGui/qgraphicsitem.h> +#include <QtGui/qgraphicsscene.h> +#include <QtGui/qgraphicsview.h> #include <winuser.h> #if !defined(WINABLEAPI) @@ -148,6 +153,106 @@ static const char *roleString(QAccessible::Role role) return roles[int(role)]; } +static const char *eventString(QAccessible::Event ev) +{ + static const char *events[] = { + "null", // 0 + "SoundPlayed" /*= 0x0001*/, + "Alert" /*= 0x0002*/, + "ForegroundChanged" /*= 0x0003*/, + "MenuStart" /*= 0x0004*/, + "MenuEnd" /*= 0x0005*/, + "PopupMenuStart" /*= 0x0006*/, + "PopupMenuEnd" /*= 0x0007*/, + "ContextHelpStart" /*= 0x000C*/, // 8 + "ContextHelpEnd" /*= 0x000D*/, + "DragDropStart" /*= 0x000E*/, + "DragDropEnd" /*= 0x000F*/, + "DialogStart" /*= 0x0010*/, + "DialogEnd" /*= 0x0011*/, + "ScrollingStart" /*= 0x0012*/, + "ScrollingEnd" /*= 0x0013*/, + "MenuCommand" /*= 0x0018*/, // 16 + + // Values from IAccessible2 + "ActionChanged" /*= 0x0101*/, // 17 + "ActiveDescendantChanged", + "AttributeChanged", + "DocumentContentChanged", + "DocumentLoadComplete", + "DocumentLoadStopped", + "DocumentReload", + "HyperlinkEndIndexChanged", + "HyperlinkNumberOfAnchorsChanged", + "HyperlinkSelectedLinkChanged", + "HypertextLinkActivated", + "HypertextLinkSelected", + "HyperlinkStartIndexChanged", + "HypertextChanged", + "HypertextNLinksChanged", + "ObjectAttributeChanged", + "PageChanged", + "SectionChanged", + "TableCaptionChanged", + "TableColumnDescriptionChanged", + "TableColumnHeaderChanged", + "TableModelChanged", + "TableRowDescriptionChanged", + "TableRowHeaderChanged", + "TableSummaryChanged", + "TextAttributeChanged", + "TextCaretMoved", + // TextChanged, deprecated, use TextUpdated + //TextColumnChanged = TextCaretMoved + 2, + "TextInserted", + "TextRemoved", + "TextUpdated", + "TextSelectionChanged", + "VisibleDataChanged", /*= 0x0101+32*/ + "ObjectCreated" /*= 0x8000*/, // 49 + "ObjectDestroyed" /*= 0x8001*/, + "ObjectShow" /*= 0x8002*/, + "ObjectHide" /*= 0x8003*/, + "ObjectReorder" /*= 0x8004*/, + "Focus" /*= 0x8005*/, + "Selection" /*= 0x8006*/, + "SelectionAdd" /*= 0x8007*/, + "SelectionRemove" /*= 0x8008*/, + "SelectionWithin" /*= 0x8009*/, + "StateChanged" /*= 0x800A*/, + "LocationChanged" /*= 0x800B*/, + "NameChanged" /*= 0x800C*/, + "DescriptionChanged" /*= 0x800D*/, + "ValueChanged" /*= 0x800E*/, + "ParentChanged" /*= 0x800F*/, + "HelpChanged" /*= 0x80A0*/, + "DefaultActionChanged" /*= 0x80B0*/, + "AcceleratorChanged" /*= 0x80C0*/ + }; + int e = int(ev); + if (e <= 0x80c0) { + const int last = sizeof(events)/sizeof(char*) - 1; + + if (e <= 0x07) + return events[e]; + else if (e <= 0x13) + return events[e - 0x0c + 8]; + else if (e == 0x18) + return events[16]; + else if (e <= 0x0101 + 32) + return events[e - 0x101 + 17]; + else if (e <= 0x800f) + return events[e - 0x8000 + 49]; + else if (e == 0x80a0) + return events[last - 2]; + else if (e == 0x80b0) + return events[last - 1]; + else if (e == 0x80c0) + return events[last]; + } + return "unknown"; +}; + void showDebug(const char* funcName, const QAccessibleInterface *iface) { qDebug() << "Role:" << roleString(iface->role(0)) @@ -159,6 +264,12 @@ void showDebug(const char* funcName, const QAccessibleInterface *iface) # define showDebug(f, iface) #endif +// This stuff is used for widgets/items with no window handle: +typedef QMap<int, QPair<QObject*,int> > NotifyMap; +Q_GLOBAL_STATIC(NotifyMap, qAccessibleRecentSentEvents) +static int eventNum = 0; + + void QAccessible::initialize() { @@ -251,18 +362,35 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason) // An event has to be associated with a window, // so find the first parent that is a widget. QWidget *w = 0; - if (o->isWidgetType()) { - w = (QWidget*)o; - } else { - QObject *p = o; - while ((p = p->parent()) != 0) { - if (p->isWidgetType()) { - w = (QWidget*)p; + QObject *p = o; + do { + if (p->isWidgetType()) { + w = static_cast<QWidget*>(p); + if (w->internalWinId()) break; + } + if (QGraphicsObject *gfxObj = qobject_cast<QGraphicsObject*>(p)) { + QGraphicsItem *parentItem = gfxObj->parentItem(); + if (parentItem) { + p = parentItem->toGraphicsObject(); + } else { + QGraphicsView *view = 0; + if (QGraphicsScene *scene = gfxObj->scene()) { + QWidget *fw = QApplication::focusWidget(); + const QList<QGraphicsView*> views = scene->views(); + for (int i = 0 ; i < views.count() && view != fw; ++i) { + view = views.at(i); + } + } + p = view; } + } else { + p = p->parent(); } - } + } while (p); + + //qDebug() << "updateAccessibility(), hwnd:" << w << ", object:" << o << "," << eventString(reason); if (!w) { if (reason != QAccessible::ContextHelpStart && reason != QAccessible::ContextHelpEnd) @@ -282,12 +410,81 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason) } } + WId wid = w->internalWinId(); if (reason != MenuCommand) { // MenuCommand is faked - ptrNotifyWinEvent(reason, w->winId(), OBJID_CLIENT, who); + if (w != o) { + // See comment "SENDING EVENTS TO OBJECTS WITH NO WINDOW HANDLE" + eventNum %= 50; //[0..49] + int eventId = - eventNum - 1; + + qAccessibleRecentSentEvents()->insert(eventId, qMakePair(o,who)); + ptrNotifyWinEvent(reason, wid, OBJID_CLIENT, eventId ); + + ++eventNum; + } else { + ptrNotifyWinEvent(reason, wid, OBJID_CLIENT, who); + } } #endif // Q_WS_WINCE } +/* == SENDING EVENTS TO OBJECTS WITH NO WINDOW HANDLE == + + If the user requested to send the event to a widget with no window, + we need to send an event to an object with no hwnd. + The way we do that is to send it to the *first* ancestor widget + with a window. + Then we'll need a way of identifying the child: + We'll just keep a list of the most recent events that we have sent, + where each entry in the list is identified by a negative value + between [-50,-1]. This negative value we will pass on to + NotifyWinEvent() as the child id. When the negative value have + reached -50, it will wrap around to -1. This seems to be enough + + Now, when the client receives that event, he will first call + AccessibleObjectFromEvent() where dwChildID is the special + negative value. AccessibleObjectFromEvent does two steps: + 1. It will first sent a WM_GETOBJECT to the server, asking + for the IAccessible interface for the HWND. + 2. With the IAccessible interface it got hold of it will call + acc_getChild where the child id argument is the special + negative identifier. In our reimplementation of get_accChild + we check for this if the child id is negative. If it is, then + we'll look up in our table for the entry that is associated + with that value. + The entry will then contain a pointer to the QObject /QWidget + that we can use to call queryAccessibleInterface() on. + + + The following figure shows how the interaction between server and + client is in the case when the server is sending an event. + +SERVER (Qt) | CLIENT | +--------------------------------------------+---------------------------------------+ + | +acc->updateAccessibility(obj, childIndex) | + | +recentEvents()->insert(- 1 - eventNum, | + qMakePair(obj, childIndex) | +NotifyWinEvent(hwnd, childId) => | + | AccessibleObjectFromEvent(event, hwnd, OBJID_CLIENT, childId ) + | will do: + <=== 1. send WM_GETOBJECT(hwnd, OBJID_CLIENT) +widget ~= hwnd +iface = queryAccessibleInteface(widget) +(create IAccessible interface wrapper for + iface) + return iface ===> IAccessible* iface; (for hwnd) + | + <=== call iface->get_accChild(childId) +get_accChild() { | + if (varChildID.lVal < 0) { + QPair ref = recentEvents().value(varChildID.lVal); + [...] + } +*/ + + void QAccessible::setRootObject(QObject *o) { if (rootObjectHandler) { @@ -418,15 +615,18 @@ public: delete accessible; } + /* IUnknown */ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, LPVOID *); ULONG STDMETHODCALLTYPE AddRef(); ULONG STDMETHODCALLTYPE Release(); + /* IDispatch */ HRESULT STDMETHODCALLTYPE GetTypeInfoCount(unsigned int *); HRESULT STDMETHODCALLTYPE GetTypeInfo(unsigned int, unsigned long, ITypeInfo **); HRESULT STDMETHODCALLTYPE GetIDsOfNames(const _GUID &, wchar_t **, unsigned int, unsigned long, long *); HRESULT STDMETHODCALLTYPE Invoke(long, const _GUID &, unsigned long, unsigned short, tagDISPPARAMS *, tagVARIANT *, tagEXCEPINFO *, unsigned int *); + /* IAccessible */ HRESULT STDMETHODCALLTYPE accHitTest(long xLeft, long yTop, VARIANT *pvarID); HRESULT STDMETHODCALLTYPE accLocation(long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varID); HRESULT STDMETHODCALLTYPE accNavigate(long navDir, VARIANT varStart, VARIANT *pvarEnd); @@ -451,6 +651,7 @@ public: HRESULT STDMETHODCALLTYPE get_accFocus(VARIANT *pvarID); HRESULT STDMETHODCALLTYPE get_accSelection(VARIANT *pvarChildren); + /* IOleWindow */ HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd); HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); @@ -896,9 +1097,30 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accChild(VARIANT varChildID, I if (varChildID.vt == VT_EMPTY) return E_INVALIDARG; + + int childIndex = varChildID.lVal; QAccessibleInterface *acc = 0; - RelationFlag rel = varChildID.lVal ? Child : Self; - accessible->navigate(rel, varChildID.lVal, &acc); + + if (childIndex < 0) { + const int entry = childIndex; + QPair<QObject*, int> ref = qAccessibleRecentSentEvents()->value(entry); + if (ref.first) { + acc = queryAccessibleInterface(ref.first); + if (acc && ref.second) { + if (ref.second) { + QAccessibleInterface *res; + int index = acc->navigate(Child, ref.second, &res); + delete acc; + if (index == -1) + return E_INVALIDARG; + acc = res; + } + } + } + } else { + RelationFlag rel = childIndex ? Child : Self; + accessible->navigate(rel, childIndex, &acc); + } if (acc) { QWindowsAccessible* wacc = new QWindowsAccessible(acc); @@ -1203,7 +1425,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::GetWindow(HWND *phwnd) if (!o || !o->isWidgetType()) return E_FAIL; - *phwnd = static_cast<QWidget*>(o)->winId(); + *phwnd = static_cast<QWidget*>(o)->effectiveWinId(); return S_OK; } diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index c22af65..5e8533e 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -66,6 +66,9 @@ #if defined(Q_OS_WINCE) extern bool qt_priv_ptr_valid; #endif +#if defined(Q_OS_UNIX) +#include <pwd.h> +#endif #endif QT_BEGIN_NAMESPACE @@ -858,23 +861,78 @@ void QFileDialog::selectFile(const QString &filename) d->lineEdit()->setText(file); } +#ifdef Q_OS_UNIX +Q_AUTOTEST_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded = 0) +{ + if (expanded != 0) + *expanded = false; + if (!path.startsWith(QLatin1Char('~'))) + return path; + QString ret = path; + QStringList tokens = ret.split(QDir::separator()); + if (tokens.first() == QLatin1String("~")) { + ret.replace(0, 1, QDir::homePath()); + } else { + QString userName = tokens.first(); + userName.remove(0, 1); +#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) + passwd pw; + passwd *tmpPw; + char buf[200]; + const int bufSize = sizeof(buf); + int err = getpwnam_r(userName.toLocal8Bit().constData(), &pw, buf, bufSize, &tmpPw); + if (err || !tmpPw) + return ret; + const QString homePath = QString::fromLocal8Bit(pw.pw_dir); +#else + passwd *pw = getpwnam(userName.toLocal8Bit().constData()); + if (!pw) + return ret; + const QString homePath = QString::fromLocal8Bit(pw->pw_dir); +#endif + ret.replace(0, tokens.first().length(), homePath); + } + if (expanded != 0) + *expanded = true; + return ret; +} +#endif + /** Returns the text in the line edit which can be one or more file names */ QStringList QFileDialogPrivate::typedFiles() const { + Q_Q(const QFileDialog); QStringList files; QString editText = lineEdit()->text(); - if (!editText.contains(QLatin1Char('"'))) + if (!editText.contains(QLatin1Char('"'))) { +#ifdef Q_OS_UNIX + const QString prefix = q->directory().absolutePath() + QDir::separator(); + if (QFile::exists(prefix + editText)) + files << editText; + else + files << qt_tildeExpansion(editText); +#else files << editText; - else { +#endif + } else { // " is used to separate files like so: "file1" "file2" "file3" ... // ### need escape character for filenames with quotes (") QStringList tokens = editText.split(QLatin1Char('\"')); for (int i=0; i<tokens.size(); ++i) { if ((i % 2) == 0) continue; // Every even token is a separator +#ifdef Q_OS_UNIX + const QString token = tokens.at(i); + const QString prefix = q->directory().absolutePath() + QDir::separator(); + if (QFile::exists(prefix + token)) + files << token; + else + files << qt_tildeExpansion(token); +#else files << toInternal(tokens.at(i)); +#endif } } return addDefaultSuffixToFiles(files); @@ -3338,6 +3396,17 @@ QStringList QFSCompleter::splitPath(const QString &path) const pathCopy = pathCopy.mid(2); else doubleSlash.clear(); +#elif defined(Q_OS_UNIX) + bool expanded; + pathCopy = qt_tildeExpansion(pathCopy, &expanded); + if (expanded) { + QFileSystemModel *dirModel; + if (proxyModel) + dirModel = qobject_cast<QFileSystemModel *>(proxyModel->sourceModel()); + else + dirModel = sourceModel; + dirModel->fetchMore(dirModel->index(pathCopy)); + } #endif QRegExp re(QLatin1Char('[') + QRegExp::escape(sep) + QLatin1Char(']')); @@ -3354,14 +3423,14 @@ QStringList QFSCompleter::splitPath(const QString &path) const parts.append(QString()); #else QStringList parts = pathCopy.split(re); - if (path[0] == sep[0]) // read the "/" at the beginning as the split removed it + if (pathCopy[0] == sep[0]) // read the "/" at the beginning as the split removed it parts[0] = sep[0]; #endif #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) bool startsFromRoot = !parts.isEmpty() && parts[0].endsWith(QLatin1Char(':')); #else - bool startsFromRoot = path[0] == sep[0]; + bool startsFromRoot = pathCopy[0] == sep[0]; #endif if (parts.count() == 1 || (parts.count() > 1 && !startsFromRoot)) { const QFileSystemModel *dirModel; diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index fb52274..f1d3a4a 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -305,12 +305,13 @@ QT_USE_NAMESPACE QString qtFileName = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)(filename); QFileInfo info(qtFileName.normalized(QT_PREPEND_NAMESPACE(QString::NormalizationForm_C))); QString path = info.absolutePath(); + QString name = info.fileName(); if (path != *mLastFilterCheckPath){ *mLastFilterCheckPath = path; *mQDirFilterEntryList = info.dir().entryList(*mQDirFilter); } // Check if the QDir filter accepts the file: - if (!mQDirFilterEntryList->contains(info.fileName())) + if (!mQDirFilterEntryList->contains(name)) return NO; // No filter means accept everything @@ -318,7 +319,7 @@ QT_USE_NAMESPACE return YES; // Check if the current file name filter accepts the file: for (int i=0; i<mSelectedNameFilter->size(); ++i) { - if (QDir::match(mSelectedNameFilter->at(i), qtFileName)) + if (QDir::match(mSelectedNameFilter->at(i), name)) return YES; } return NO; diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index e8f80b4..ef53963 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7395,15 +7395,19 @@ void QGraphicsItem::updateMicroFocus() if (QWidget *fw = QApplication::focusWidget()) { if (scene()) { for (int i = 0 ; i < scene()->views().count() ; ++i) { - if (scene()->views().at(i) == fw) - if (QInputContext *inputContext = fw->inputContext()) + if (scene()->views().at(i) == fw) { + if (QInputContext *inputContext = fw->inputContext()) { inputContext->update(); - } - } #ifndef QT_NO_ACCESSIBILITY - // ##### is this correct - QAccessible::updateAccessibility(fw, 0, QAccessible::StateChanged); + // ##### is this correct + if (toGraphicsObject()) + QAccessible::updateAccessibility(toGraphicsObject(), 0, QAccessible::StateChanged); #endif + break; + } + } + } + } } #endif } diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 7e70f47..655725b 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -245,6 +245,10 @@ #include <QtGui/qtransform.h> #include <QtGui/qinputcontext.h> #include <QtGui/qgraphicseffect.h> +#ifndef QT_NO_ACCESSIBILITY +# include <QtGui/qaccessible.h> +#endif + #include <private/qapplication_p.h> #include <private/qobject_p.h> #ifdef Q_WS_X11 @@ -837,6 +841,14 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, if (item) focusItem = item; updateInputMethodSensitivityInViews(); + +#ifndef QT_NO_ACCESSIBILITY + if (focusItem) { + if (QGraphicsObject *focusObj = focusItem->toGraphicsObject()) { + QAccessible::updateAccessibility(focusObj, 0, QAccessible::Focus); + } + } +#endif if (item) { QFocusEvent event(QEvent::FocusIn, focusReason); sendEvent(item, &event); diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h index 6ea2586..fd96fce 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.h +++ b/src/gui/graphicsview/qgraphicswidget_p.h @@ -182,12 +182,12 @@ public: return (attributes & (1 << bit)) != 0; } // 32 bits - quint32 refCountInvokeRelayout : 16; quint32 attributes : 10; quint32 inSetGeometry : 1; quint32 polished: 1; quint32 inSetPos : 1; quint32 autoFillBackground : 1; + quint32 refCountInvokeRelayout : 16; quint32 padding : 2; // feel free to use // Focus diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index f8d7e28..5fe25b2 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -54,6 +54,7 @@ #include <fepitfr.h> #include <hal.h> +#include <e32property.h> #include <limits.h> // You only find these enumerations on SDK 5 onwards, so we need to provide our own @@ -72,6 +73,10 @@ // EAknEditorFlagEnablePartialScreen is only valid from Sym^3 onwards. #define QT_EAknEditorFlagEnablePartialScreen 0x200000 +// Properties to detect VKB status from AknFepInternalPSKeys.h +#define QT_EPSUidAknFep 0x100056de +#define QT_EAknFepTouchInputActive 0x00000004 + QT_BEGIN_NAMESPACE Q_GUI_EXPORT void qt_s60_setPartialScreenInputMode(bool enable) @@ -312,28 +317,46 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) return false; if (event->type() == QEvent::RequestSoftwareInputPanel) { - // Notify S60 that we want the virtual keyboard to show up. - QSymbianControl *sControl; - sControl = focusWidget()->effectiveWinId()->MopGetObject(sControl); - Q_ASSERT(sControl); - - // The FEP UI temporarily steals focus when it shows up the first time, causing - // all sorts of weird effects on the focused widgets. Since it will immediately give - // back focus to us, we temporarily disable focus handling until the job's done. - if (sControl) { - sControl->setIgnoreFocusChanged(true); + // Only request virtual keyboard if it is not yet active or if this is the first time + // panel is requested for this application. + static bool firstTime = true; + int vkbActive = 0; + + if (firstTime) { + // Sometimes the global QT_EAknFepTouchInputActive value can be left incorrect at + // application exit if the application is exited when input panel is active. + // Therefore we always want to open the panel the first time application requests it. + firstTime = false; + } else { + const TUid KPSUidAknFep = {QT_EPSUidAknFep}; + // No need to check for return value, as vkbActive stays zero in that case + RProperty::Get(KPSUidAknFep, QT_EAknFepTouchInputActive, vkbActive); } - ensureInputCapabilitiesChanged(); - m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::QT_EAknActivatePenInputRequest); + if (!vkbActive) { + // Notify S60 that we want the virtual keyboard to show up. + QSymbianControl *sControl; + sControl = focusWidget()->effectiveWinId()->MopGetObject(sControl); + Q_ASSERT(sControl); + + // The FEP UI temporarily steals focus when it shows up the first time, causing + // all sorts of weird effects on the focused widgets. Since it will immediately give + // back focus to us, we temporarily disable focus handling until the job's done. + if (sControl) { + sControl->setIgnoreFocusChanged(true); + } + + ensureInputCapabilitiesChanged(); + m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::QT_EAknActivatePenInputRequest); - if (sControl) { - sControl->setIgnoreFocusChanged(false); + if (sControl) { + sControl->setIgnoreFocusChanged(false); + } + //If m_pointerHandler has already been set, it means that fep inline editing is in progress. + //When this is happening, do not filter out pointer events. + if (!m_pointerHandler) + return true; } - //If m_pointerHandler has already been set, it means that fep inline editing is in progress. - //When this is happening, do not filter out pointer events. - if (!m_pointerHandler) - return true; } return false; diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 3803599..361ec6d 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -1288,8 +1288,8 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis || event->type() == QEvent::LanguageChange || event->type() == QEvent::UpdateSoftKeys || event->type() == QEvent::InputMethod)) { - for (int i = 0; i < postedEvents->size(); ++i) { - const QPostEvent &cur = postedEvents->at(i); + for (QPostEventList::const_iterator it = postedEvents->constBegin(); it != postedEvents->constEnd(); ++it) { + const QPostEvent &cur = *it; if (cur.receiver != receiver || cur.event == 0 || cur.event->type() != event->type()) continue; if (cur.event->type() == QEvent::LayoutRequest diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index ea2412b..a2109b4 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -6434,6 +6434,10 @@ void QWidget::setFocus(Qt::FocusReason reason) if (!(testAttribute(Qt::WA_WState_Created) && window()->windowType() != Qt::Popup && internalWinId())) //setFocusWidget will already post a focus event for us (that the AT client receives) on Windows # endif +# ifdef Q_OS_UNIX + // menus update the focus manually and this would create bogus events + if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem"))) +# endif QAccessible::updateAccessibility(f, 0, QAccessible::Focus); #endif #ifndef QT_NO_GRAPHICSVIEW @@ -11354,8 +11358,10 @@ void QWidget::updateMicroFocus() } #endif #ifndef QT_NO_ACCESSIBILITY - // ##### is this correct - QAccessible::updateAccessibility(this, 0, QAccessible::StateChanged); + if (isVisible()) { + // ##### is this correct + QAccessible::updateAccessibility(this, 0, QAccessible::StateChanged); + } #endif } diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index b3bf365..a51e295 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3490,7 +3490,10 @@ void QWidgetPrivate::show_sys() QWidget *top = 0; if (QApplicationPrivate::tryModalHelper(q, &top)) { - [window makeKeyAndOrderFront:window]; + if (q->testAttribute(Qt::WA_ShowWithoutActivating)) + [window orderFront:window]; + else + [window makeKeyAndOrderFront:window]; // If this window is app modal, we need to start spinning // a modal session for it. Interrupting // the event dispatcher will make this happend: diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index cdc0978..dbe957e 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -7,29 +7,29 @@ ** 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. +** 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 +** 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. -** -** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. ** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. ** ** ** diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h index 0aa71fc..d7bd79a 100644 --- a/src/gui/painting/qcosmeticstroker_p.h +++ b/src/gui/painting/qcosmeticstroker_p.h @@ -7,29 +7,29 @@ ** 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. +** 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 +** 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. -** -** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. ** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. ** ** ** diff --git a/src/gui/painting/qgraphicssystemfactory.cpp b/src/gui/painting/qgraphicssystemfactory.cpp index 4309140..01ece09 100644 --- a/src/gui/painting/qgraphicssystemfactory.cpp +++ b/src/gui/painting/qgraphicssystemfactory.cpp @@ -74,7 +74,7 @@ QGraphicsSystem *QGraphicsSystemFactory::create(const QString& key) if (system.isEmpty()) { system = QLatin1String("runtime"); } -#elif defined (QT_GRAPHICSSYSTEM_RASTER) && !defined(Q_WS_WIN) && !defined(Q_OS_SYMBIAN) || defined(Q_WS_X11) || (defined (Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) +#elif defined (QT_GRAPHICSSYSTEM_RASTER) && !defined(Q_WS_WIN) && !defined(Q_OS_SYMBIAN) || defined(Q_WS_X11) if (system.isEmpty()) { system = QLatin1String("raster"); } diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 30553b5..9ba4592 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2774,10 +2774,12 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, { Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); + const QFixed offs = QFixed::fromReal(aliasedCoordinateDelta); #if !defined(QT_NO_FREETYPE) if (fontEngine->type() == QFontEngine::Freetype) { QFontEngineFT *fe = static_cast<QFontEngineFT *>(fontEngine); + const QFixed xOffs = fe->supportsSubPixelPositions() ? 0 : offs; QFontEngineFT::GlyphFormat neededFormat = painter()->device()->devType() == QInternal::Widget ? fe->defaultGlyphFormat() @@ -2851,8 +2853,8 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, }; alphaPenBlt(glyph->data, pitch, depth, - qFloor(positions[i].x) + glyph->x, - qFloor(positions[i].y) - glyph->y, + qFloor(positions[i].x + xOffs) + glyph->x, + qFloor(positions[i].y + offs) - glyph->y, glyph->width, glyph->height); } if (lockedFace) @@ -2892,7 +2894,6 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, rightShift = 3; // divide by 8 int margin = cache->glyphMargin(); - const QFixed offs = QFixed::fromReal(aliasedCoordinateDelta); const uchar *bits = image.bits(); for (int i=0; i<numGlyphs; ++i) { diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 5a566d1..435e12a 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2737,7 +2737,7 @@ QRectF QPainter::clipBoundingRect() const } // Accumulate the bounding box in device space. This is not 100% - // precise, but it fits within the guarantee and it is resonably + // precise, but it fits within the guarantee and it is reasonably // fast. QRectF bounds; for (int i=0; i<d->state->clipInfo.size(); ++i) { diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index b0ea0d1..b47b4c8 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -3345,6 +3345,12 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled; + int metric = PM_ToolBarIconSize; +#if defined(Q_WS_S60) + //Support version specific standard icons only with Symbian/S60 platform. + QSysInfo::S60Version versionSupport = QSysInfo::SV_S60_Unknown; +#endif + switch(standardIcon) { case SP_MessageBoxWarning: // By default, S60 messagebox icons have 4:3 ratio. Value is from S60 LAF documentation. @@ -3415,11 +3421,353 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, adjustedFlags |= QS60StylePrivate::SF_PointEast; part = QS60StyleEnums::SP_QgnIndiSubmenu; break; + case SP_TitleBarMenuButton: +#if defined(Q_WS_S60) + versionSupport = QSysInfo::SV_S60_5_3; +#endif + metric = PM_SmallIconSize; + part = QS60StyleEnums::SP_QtgToolBarOptions; + break; + case SP_DirHomeIcon: + metric = PM_SmallIconSize; + part = QS60StyleEnums::SP_QgnIndiBrowserTbHome; + break; + case SP_BrowserReload: + metric = PM_SmallIconSize; + part = QS60StyleEnums::SP_QgnIndiBrowserTbReload; + break; + case SP_BrowserStop: + metric = PM_SmallIconSize; + part = QS60StyleEnums::SP_QgnIndiBrowserTbStop; + break; +#if defined(Q_WS_S60) + case SP_MediaPlay: + versionSupport = QSysInfo::SV_S60_5_3; + metric = PM_SmallIconSize; + part = QS60StyleEnums::SP_QtgToolBarPlay; + break; + case SP_MediaStop: + versionSupport = QSysInfo::SV_S60_5_3; + metric = PM_SmallIconSize; + part = QS60StyleEnums::SP_QtgToolBarStop; + break; + case SP_MediaPause: + versionSupport = QSysInfo::SV_S60_5_3; + metric = PM_SmallIconSize; + part = QS60StyleEnums::SP_QtgToolBarPause; + break; + case SP_MediaSkipForward: + versionSupport = QSysInfo::SV_S60_5_3; + metric = PM_SmallIconSize; + part = QS60StyleEnums::SP_QtgToolBarNext; + break; + case SP_MediaSkipBackward: + versionSupport = QSysInfo::SV_S60_5_3; + metric = PM_SmallIconSize; + part = QS60StyleEnums::SP_QtgToolBarPrevious; + break; + case SP_MediaSeekForward: + versionSupport = QSysInfo::SV_S60_5_3; + metric = PM_SmallIconSize; + part = QS60StyleEnums::SP_QtgToolBarForward; + break; + case SP_MediaSeekBackward: + versionSupport = QSysInfo::SV_S60_5_3; + metric = PM_SmallIconSize; + part = QS60StyleEnums::SP_QtgToolBarRewind; + break; +#endif +// Custom icons + case SP_CustomToolBarAdd: + part = QS60StyleEnums::SP_QtgToolBarAdd; + break; + case SP_CustomToolBarAddDetail: + part = QS60StyleEnums::SP_QtgToolBarAddDetail; + break; + case SP_CustomToolBarAgain: + part = QS60StyleEnums::SP_QtgToolBarAgain; + break; + case SP_CustomToolBarAgenda: + part = QS60StyleEnums::SP_QtgToolBarAgenda; + break; + case SP_CustomToolBarAudioOff: + part = QS60StyleEnums::SP_QtgToolBarAudioOff; + break; + case SP_CustomToolBarAudioOn: + part = QS60StyleEnums::SP_QtgToolBarAudioOn; + break; + case SP_CustomToolBarBack: + part = QS60StyleEnums::SP_QtgToolBarBack; + break; + case SP_CustomToolBarBluetoothOff: + part = QS60StyleEnums::SP_QtgToolBarBluetoothOff; + break; + case SP_CustomToolBarBluetoothOn: + part = QS60StyleEnums::SP_QtgToolBarBluetoothOn; + break; + case SP_CustomToolBarCancel: + part = QS60StyleEnums::SP_QtgToolBarCancel; + break; + case SP_CustomToolBarDelete: + part = QS60StyleEnums::SP_QtgToolBarDelete; + break; + case SP_CustomToolBarDone: + part = QS60StyleEnums::SP_QtgToolBarDone; + break; + case SP_CustomToolBarEdit: + part = QS60StyleEnums::SP_QtgToolBarEdit; + break; + case SP_CustomToolBarEmailSend: + part = QS60StyleEnums::SP_QtgToolBarEmailSend; + break; + case SP_CustomToolBarEmergencyCall: + part = QS60StyleEnums::SP_QtgToolBarEmergencyCall; + break; + case SP_CustomToolBarFavouriteAdd: + part = QS60StyleEnums::SP_QtgToolBarFavouriteAdd; + break; + case SP_CustomToolBarFavouriteRemove: + part = QS60StyleEnums::SP_QtgToolBarFavouriteRemove; + break; + case SP_CustomToolBarFavourites: + part = QS60StyleEnums::SP_QtgToolBarFavourites; + break; + case SP_CustomToolBarGo: + part = QS60StyleEnums::SP_QtgToolBarGo; + break; + case SP_CustomToolBarHome: + part = QS60StyleEnums::SP_QtgToolBarHome; + break; + case SP_CustomToolBarList: + part = QS60StyleEnums::SP_QtgToolBarList; + break; + case SP_CustomToolBarLock: + part = QS60StyleEnums::SP_QtgToolBarLock; + break; + case SP_CustomToolBarLogs: + part = QS60StyleEnums::SP_QtgToolBarLogs; + break; + case SP_CustomToolBarMenu: + part = QS60StyleEnums::SP_QtgToolBarMenu; + break; + case SP_CustomToolBarNewContact: + part = QS60StyleEnums::SP_QtgToolBarNewContact; + break; + case SP_CustomToolBarNewGroup: + part = QS60StyleEnums::SP_QtgToolBarNewGroup; + break; + case SP_CustomToolBarNowPlay: + part = QS60StyleEnums::SP_QtgToolBarNowPlay; + break; + case SP_CustomToolBarOptions: + part = QS60StyleEnums::SP_QtgToolBarOptions; + break; + case SP_CustomToolBarOther: + part = QS60StyleEnums::SP_QtgToolBarOther; + break; + case SP_CustomToolBarOvi: + part = QS60StyleEnums::SP_QtgToolBarOvi; + break; + case SP_CustomToolBarRead: + part = QS60StyleEnums::SP_QtgToolBarRead; + break; + case SP_CustomToolBarRefresh: + part = QS60StyleEnums::SP_QtgToolBarRefresh; + break; + case SP_CustomToolBarRemoveDetail: + part = QS60StyleEnums::SP_QtgToolBarRemoveDetail; + break; + case SP_CustomToolBarRepeat: + part = QS60StyleEnums::SP_QtgToolBarRepeat; + break; + case SP_CustomToolBarRepeatOff: + part = QS60StyleEnums::SP_QtgToolBarRepeatOff; + break; + case SP_CustomToolBarRepeatOne: + part = QS60StyleEnums::SP_QtgToolBarRepeatOne; + break; + case SP_CustomToolBarSearch: + part = QS60StyleEnums::SP_QtgToolBarSearch; + break; + case SP_CustomToolBarSelfTimer: + part = QS60StyleEnums::SP_QtgToolBarSelfTimer; + break; + case SP_CustomToolBarSend: + part = QS60StyleEnums::SP_QtgToolBarSend; + break; + case SP_CustomToolBarShare: + part = QS60StyleEnums::SP_QtgToolBarShare; + break; + case SP_CustomToolBarShift: + part = QS60StyleEnums::SP_QtgToolBarShift; + break; + case SP_CustomToolBarShuffle: + part = QS60StyleEnums::SP_QtgToolBarShuffle; + break; + case SP_CustomToolBarShuffleOff: + part = QS60StyleEnums::SP_QtgToolBarShuffleOff; + break; + case SP_CustomToolBarSignalOff: + part = QS60StyleEnums::SP_QtgToolBarSignalOff; + break; + case SP_CustomToolBarSignalOn: + part = QS60StyleEnums::SP_QtgToolBarSignalOn; + break; + case SP_CustomToolBarSync: + part = QS60StyleEnums::SP_QtgToolBarSync; + break; + case SP_CustomToolBarUnlock: + part = QS60StyleEnums::SP_QtgToolBarUnlock; + break; + case SP_CustomToolBarUnmark: + part = QS60StyleEnums::SP_QtgToolBarUnmark; + break; + case SP_CustomToolBarView: + part = QS60StyleEnums::SP_QtgToolBarView; + break; + case SP_CustomToolBarWlanOff: + part = QS60StyleEnums::SP_QtgToolBarWlanOff; + break; + case SP_CustomToolBarWlanOn: + part = QS60StyleEnums::SP_QtgToolBarWlanOn; + break; +#if defined(Q_WS_S60) + case SP_CustomCameraCaptureButton: + versionSupport = QSysInfo::SV_S60_5_2; + part = QS60StyleEnums::SP_QtgGrafCameraButtonCaptureNormal; + break; + case SP_CustomCameraCaptureButtonPressed: + versionSupport = QSysInfo::SV_S60_5_2; + part = QS60StyleEnums::SP_QtgGrafCameraButtonCapturePressed; + break; + case SP_CustomCameraPauseButton: + versionSupport = QSysInfo::SV_S60_5_2; + part = QS60StyleEnums::SP_QtgGrafCameraButtonPauseNormal; + break; + case SP_CustomCameraPauseButtonPressed: + versionSupport = QSysInfo::SV_S60_5_2; + part = QS60StyleEnums::SP_QtgGrafCameraButtonPausePressed; + break; + case SP_CustomCameraPlayButton: + versionSupport = QSysInfo::SV_S60_5_2; + part = QS60StyleEnums::SP_QtgGrafCameraButtonPlayNormal; + break; + case SP_CustomCameraPlayButtonPressed: + versionSupport = QSysInfo::SV_S60_5_2; + part = QS60StyleEnums::SP_QtgGrafCameraButtonPlayPressed; + break; + case SP_CustomCameraRecButton: + versionSupport = QSysInfo::SV_S60_5_2; + part = QS60StyleEnums::SP_QtgGrafCameraButtonRecNormal; + break; + case SP_CustomCameraRecButtonPressed: + versionSupport = QSysInfo::SV_S60_5_2; + part = QS60StyleEnums::SP_QtgGrafCameraButtonRecPressed; + break; + case SP_CustomCameraStopButton: + versionSupport = QSysInfo::SV_S60_5_2; + part = QS60StyleEnums::SP_QtgGrafCameraButtonStopNormal; + break; + case SP_CustomCameraStopButtonPressed: + versionSupport = QSysInfo::SV_S60_5_2; + part = QS60StyleEnums::SP_QtgGrafCameraButtonStopPressed; + break; +#endif + case SP_CustomTabAll: + part = QS60StyleEnums::SP_QtgTabAll; + break; + case SP_CustomTabArtist: + part = QS60StyleEnums::SP_QtgTabArtist; + break; + case SP_CustomTabFavourite: + part = QS60StyleEnums::SP_QtgTabFavourite; + break; + case SP_CustomTabGenre: + part = QS60StyleEnums::SP_QtgTabGenre; + break; + case SP_CustomTabLanguage: + part = QS60StyleEnums::SP_QtgTabLanguage; + break; + case SP_CustomTabMusicAlbum: + part = QS60StyleEnums::SP_QtgTabMusicAlbum; + break; + case SP_CustomTabPhotosAlbum: + part = QS60StyleEnums::SP_QtgTabPhotosAlbum; + break; + case SP_CustomTabPhotosAll: + part = QS60StyleEnums::SP_QtgTabPhotosAll; + break; + case SP_CustomTabPlaylist: + part = QS60StyleEnums::SP_QtgTabPlaylist; + break; + case SP_CustomTabServices: + part = QS60StyleEnums::SP_QtgTabServices; + break; + case SP_CustomTabSongs: + part = QS60StyleEnums::SP_QtgTabSongs; + break; + case SP_CustomTabVideos: + part = QS60StyleEnums::SP_QtgTabVideos; + break; + case SP_CustomToolBarEditDisabled: + part = QS60StyleEnums::SP_QtgToolBarEditDisabled; + break; + case SP_CustomToolBarImageTools: + part = QS60StyleEnums::SP_QtgToolBarImageTools; + break; + case SP_CustomToolBarNextFrame: + part = QS60StyleEnums::SP_QtgToolBarNextFrame; + break; + case SP_CustomToolBarPreviousFrame: + part = QS60StyleEnums::SP_QtgToolBarPreviousFrame; + break; + case SP_CustomToolBarRedoDisabled: + part = QS60StyleEnums::SP_QtgToolBarRedoDisabled; + break; + case SP_CustomToolBarRedo: + part = QS60StyleEnums::SP_QtgToolBarRedo; + break; + case SP_CustomToolBarRemoveDisabled: + part = QS60StyleEnums::SP_QtgToolBarRemoveDisabled; + break; + case SP_CustomToolBarSearchDisabled: + part = QS60StyleEnums::SP_QtgToolBarSearchDisabled; + break; + case SP_CustomToolBarSelectContent: + part = QS60StyleEnums::SP_QtgToolBarSelectContent; + break; + case SP_CustomToolBarSendDimmed: + part = QS60StyleEnums::SP_QtgToolBarSendDimmed; + break; + case SP_CustomToolBarTools: + part = QS60StyleEnums::SP_QtgToolBarTools; + break; + case SP_CustomToolBarTrim: + part = QS60StyleEnums::SP_QtgToolBarTrim; + break; default: return QCommonStyle::standardIconImplementation(standardIcon, option, widget); } + +#if defined(Q_WS_S60) + //If new custom standardIcon is missing version information, assume S60 5.3. + if (standardIcon & QStyle::SP_CustomBase) { + if (versionSupport == QSysInfo::SV_Unknown) + versionSupport = QSysInfo::SV_S60_5_3; + metric = PM_SmallIconSize; + } + + // Toolbar icons are only available from SV_S60_5_3 onwards. Use common style for earlier releases. + if ((versionSupport != QSysInfo::SV_Unknown) && QSysInfo::s60Version() < versionSupport) { + return QCommonStyle::standardIconImplementation(standardIcon, option, widget); + } +#else + if (standardIcon >= SP_CustomToolBarAdd) + metric = PM_SmallIconSize; +#endif + const QS60StylePrivate::SkinElementFlags flags = adjustedFlags; - const int iconDimension = QS60StylePrivate::pixelMetric(PM_ToolBarIconSize); + const int iconDimension = QS60StylePrivate::pixelMetric(metric); const QRect iconSize = (!option) ? QRect(0, 0, iconDimension * iconWidthMultiplier, iconDimension * iconHeightMultiplier) : option->rect; const QPixmap cachedPixMap(QS60StylePrivate::cachedPart(part, iconSize.size(), 0, flags)); diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index 8ec5eb9..0e76cf2 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -62,6 +62,94 @@ enum { PM_CbaIconHeight }; +enum { + SP_CustomToolBarAdd = QStyle::SP_CustomBase + 1, + SP_CustomToolBarAddDetail, + SP_CustomToolBarAgain, + SP_CustomToolBarAgenda, + SP_CustomToolBarAudioOff, + SP_CustomToolBarAudioOn, + SP_CustomToolBarBack, + SP_CustomToolBarBluetoothOff, + SP_CustomToolBarBluetoothOn, + SP_CustomToolBarCancel, + SP_CustomToolBarDelete, + SP_CustomToolBarDone, + SP_CustomToolBarEdit, + SP_CustomToolBarEditDisabled, + SP_CustomToolBarEmailSend, + SP_CustomToolBarEmergencyCall, + SP_CustomToolBarFavouriteAdd, + SP_CustomToolBarFavouriteRemove, + SP_CustomToolBarFavourites, + SP_CustomToolBarGo, + SP_CustomToolBarHome, + SP_CustomToolBarImageTools, + SP_CustomToolBarList, + SP_CustomToolBarLock, + SP_CustomToolBarLogs, + SP_CustomToolBarMenu, + SP_CustomToolBarNewContact, + SP_CustomToolBarNewGroup, + SP_CustomToolBarNextFrame, + SP_CustomToolBarNowPlay, + SP_CustomToolBarOptions, + SP_CustomToolBarOther, + SP_CustomToolBarOvi, + SP_CustomToolBarPreviousFrame, + SP_CustomToolBarRead, + SP_CustomToolBarRedoDisabled, + SP_CustomToolBarRedo, + SP_CustomToolBarRefresh, + SP_CustomToolBarRemoveDetail, + SP_CustomToolBarRemoveDisabled, + SP_CustomToolBarRepeat, + SP_CustomToolBarRepeatOff, + SP_CustomToolBarRepeatOne, + SP_CustomToolBarSearch, + SP_CustomToolBarSearchDisabled, + SP_CustomToolBarSelectContent, + SP_CustomToolBarSelfTimer, + SP_CustomToolBarSend, + SP_CustomToolBarSendDimmed, + SP_CustomToolBarShare, + SP_CustomToolBarShift, + SP_CustomToolBarShuffle, + SP_CustomToolBarShuffleOff, + SP_CustomToolBarSignalOff, + SP_CustomToolBarSignalOn, + SP_CustomToolBarSync, + SP_CustomToolBarTools, + SP_CustomToolBarTrim, + SP_CustomToolBarUnlock, + SP_CustomToolBarUnmark, + SP_CustomToolBarView, + SP_CustomToolBarWlanOff, + SP_CustomToolBarWlanOn, + SP_CustomCameraCaptureButton, + SP_CustomCameraCaptureButtonPressed, + SP_CustomCameraPauseButton, + SP_CustomCameraPauseButtonPressed, + SP_CustomCameraPlayButton, + SP_CustomCameraPlayButtonPressed, + SP_CustomCameraRecButton, + SP_CustomCameraRecButtonPressed, + SP_CustomCameraStopButton, + SP_CustomCameraStopButtonPressed, + SP_CustomTabAll, + SP_CustomTabArtist, + SP_CustomTabFavourite, + SP_CustomTabGenre, + SP_CustomTabLanguage, + SP_CustomTabMusicAlbum, + SP_CustomTabPhotosAlbum, + SP_CustomTabPhotosAll, + SP_CustomTabPlaylist, + SP_CustomTabServices, + SP_CustomTabSongs, + SP_CustomTabVideos +}; + class QS60StylePrivate; class Q_GUI_EXPORT QS60Style : public QCommonStyle diff --git a/src/gui/styles/qs60style_feedbackinterface_p.h b/src/gui/styles/qs60style_feedbackinterface_p.h index 81fcdc3..0dc46b8 100644 --- a/src/gui/styles/qs60style_feedbackinterface_p.h +++ b/src/gui/styles/qs60style_feedbackinterface_p.h @@ -7,29 +7,29 @@ ** 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. +** 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 +** 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. -** -** -** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. ** ** ** diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 62c4b00..de3cab7 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -142,11 +142,11 @@ public: SP_QgnGrafNsliderMiddle, SP_QgnIndiCheckboxOff, SP_QgnIndiCheckboxOn, - SP_QgnIndiHlColSuper, // Available in S60 release 3.2 and later. - SP_QgnIndiHlExpSuper, // Available in S60 release 3.2 and later. - SP_QgnIndiHlLineBranch, // Available in S60 release 3.2 and later. - SP_QgnIndiHlLineEnd, // Available in S60 release 3.2 and later. - SP_QgnIndiHlLineStraight, // Available in S60 release 3.2 and later. + SP_QgnIndiHlColSuper, + SP_QgnIndiHlExpSuper, + SP_QgnIndiHlLineBranch, + SP_QgnIndiHlLineEnd, + SP_QgnIndiHlLineStraight, SP_QgnIndiMarkedAdd, SP_QgnIndiNaviArrowLeft, SP_QgnIndiNaviArrowRight, @@ -311,6 +311,102 @@ public: SP_QsnFrListSideLPressed, SP_QsnFrListSideRPressed, SP_QsnFrListCenterPressed, + SP_QtgToolBarAdd, + SP_QtgToolBarAddDetail, + SP_QtgToolBarAgain, + SP_QtgToolBarAgenda, + SP_QtgToolBarAudioOff, + SP_QtgToolBarAudioOn, + SP_QtgToolBarBack, + SP_QtgToolBarBluetoothOff, + SP_QtgToolBarBluetoothOn, + SP_QtgToolBarCancel, + SP_QtgToolBarDelete, + SP_QtgToolBarDetails, + SP_QtgToolBarDone, + SP_QtgToolBarEdit, + SP_QtgToolBarEditDisabled, + SP_QtgToolBarEmailSend, + SP_QtgToolBarEmergencyCall, + SP_QtgToolBarFavouriteAdd, + SP_QtgToolBarFavouriteRemove, + SP_QtgToolBarFavourites, + SP_QtgToolBarForward, + SP_QtgToolBarGo, + SP_QtgToolBarHome, + SP_QtgToolBarImageTools, + SP_QtgToolBarList, + SP_QtgToolBarLock, + SP_QtgToolBarLogs, + SP_QtgToolBarMenu, + SP_QtgToolBarNewContact, + SP_QtgToolBarNewGroup, + SP_QtgToolBarNext, + SP_QtgToolBarNextFrame, + SP_QtgToolBarNowPlay, + SP_QtgToolBarOptions, + SP_QtgToolBarOther, + SP_QtgToolBarOvi, + SP_QtgToolBarPause, + SP_QtgToolBarPlay, + SP_QtgToolBarPrevious, + SP_QtgToolBarPreviousFrame, + SP_QtgToolBarRead, + SP_QtgToolBarRedo, + SP_QtgToolBarRedoDisabled, + SP_QtgToolBarRefresh, + SP_QtgToolBarRemoveDetail, + SP_QtgToolBarRemoveDisabled, + SP_QtgToolBarRepeat, + SP_QtgToolBarRepeatOff, + SP_QtgToolBarRepeatOne, + SP_QtgToolBarRewind, + SP_QtgToolBarSearch, + SP_QtgToolBarSearchDisabled, + SP_QtgToolBarSelectContent, + SP_QtgToolBarSelfTimer, + SP_QtgToolBarSend, + SP_QtgToolBarSendDimmed, + SP_QtgToolBarShare, + SP_QtgToolBarShift, + SP_QtgToolBarShuffle, + SP_QtgToolBarShuffleOff, + SP_QtgToolBarSignalOff, + SP_QtgToolBarSignalOn, + SP_QtgToolBarStop, + SP_QtgToolBarSync, + SP_QtgToolBarTools, + SP_QtgToolBarTrim, + SP_QtgToolBarUnlock, + SP_QtgToolBarUnmark, + SP_QtgToolBarView, + SP_QtgToolBarWlanOff, + SP_QtgToolBarWlanOn, + SP_QtgGrafCameraButtonCaptureNormal, + SP_QtgGrafCameraButtonCapturePressed, + SP_QtgGrafCameraButtonPauseNormal, + SP_QtgGrafCameraButtonPausePressed, + SP_QtgGrafCameraButtonPlayNormal, + SP_QtgGrafCameraButtonPlayPressed, + SP_QtgGrafCameraButtonRecNormal, + SP_QtgGrafCameraButtonRecPressed, + SP_QtgGrafCameraButtonStopNormal, + SP_QtgGrafCameraButtonStopPressed, + SP_QtgTabAll, + SP_QtgTabArtist, + SP_QtgTabFavourite, + SP_QtgTabGenre, + SP_QtgTabLanguage, + SP_QtgTabMusicAlbum, + SP_QtgTabPhotosAlbum, + SP_QtgTabPhotosAll, + SP_QtgTabPlaylist, + SP_QtgTabServices, + SP_QtgTabSongs, + SP_QtgTabVideos, + SP_QgnIndiBrowserTbReload, + SP_QgnIndiBrowserTbHome, + SP_QgnIndiBrowserTbStop, }; enum ColorLists { diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 2d2710c..59d5da4 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -44,6 +44,7 @@ #include "qpainter.h" #include "qstyleoption.h" #include "qstyle.h" +#include "private/qapplication_p.h" #include "private/qt_s60_p.h" #include "private/qpixmap_raster_symbian_p.h" #include "private/qcore_symbian_p.h" @@ -412,6 +413,106 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* SP_QsnFrListSideLPressed */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2691}, /* SP_QsnFrListSideRPressed */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2692}, /* SP_QsnFrListCenterPressed */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2693}, + + /* SP_QtgToolBarAdd */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x27c0}, //KAknsIIDQtgToolbarAdd + /* SP_QtgToolBarAddDetail */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2778}, //KAknsIIDQtgToolbarAddDetail + /* SP_QtgToolbarAgain */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x271a}, //KAknsIIDQtgToolbarAgain + /* SP_QtgToolBarAgenda */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x281a}, //KAknsIIDQtgToolbarAgenda + /* SP_QtgToolBarAudioOff */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2751}, //KAknsIIDQtgToolbarAudioOff + /* SP_QtgToolBarAudioOn */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2752}, //KAknsIIDQtgToolbarAudioOn + /* SP_CustomToolBarBack */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x271b}, //KAknsIIDQtgToolbarBack + /* SP_QtgToolBarBluetoothOff */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2753}, //KAknsIIDQtgToolbarBluetoothOff + /* SP_QtgToolBarBluetoothOn */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2754}, //KAknsIIDQtgToolbarBluetoothOn + /* SP_QtgToolBarCancel */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2895}, //KAknsIIDQtgToolbarCancel + /* SP_QtgToolBarDelete */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2755}, //KAknsIIDQtgToolbarDelete + /* SP_QtgToolBarDetails */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x271e}, //KAknsIIDQtgToolbarDetails + /* SP_QtgToolBarDone */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x271f}, //KAknsIIDQtgToolbarDone + /* SP_QtgToolBarEdit */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2720}, //KAknsIIDQtgToolbarEdit + /* SP_QtgToolBarEditDisabled */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2946}, //KAknsIIDQtgToolbarEditDisabled + /* SP_QtgToolBarEmailSend */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x292f}, //KAknsIIDQtgToolbarEmailSend + /* SP_QtgToolBarEmergencyCall */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2721}, //KAknsIIDQtgToolbarEmergencyCall + /* SP_QtgToolBarFavouriteAdd */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x28ed}, //KAknsIIDQtgToolbarFavouriteAdd + /* SP_QtgToolBarFavouriteRemove */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x28ee}, //KAknsIIDQtgToolbarFavouriteRemove + /* SP_QtgToolBarFavourites */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x28b8}, //KAknsIIDQtgToolbarFavourites + /* SP_QtgToolBarForward */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x281b}, //KAknsIIDQtgToolbarForward + /* SP_QtgToolBarGo */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2930}, //KAknsIIDQtgToolbarGo + /* SP_QtgToolBarHome */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2722}, //KAknsIIDQtgToolbarHome + /* SP_QtgToolBarImageTools */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2947}, //KAknsIIDQtgToolbarImageTools + /* SP_QtgToolBarList */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x28b9}, //KAknsIIDQtgToolbarList + /* SP_QtgToolBarLock */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2723}, //KAknsIIDQtgToolbarLock + /* SP_QtgToolBarLogs */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x281c}, //KAknsIIDQtgToolbarLogs + /* SP_QtgToolBarMenu */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2724}, //KAknsIIDQtgToolbarMenu + /* SP_QtgToolBarNewContact */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2779}, //KAknsIIDQtgToolbarNewContact + /* SP_QtgToolBarNewGroup */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x277a}, //KAknsIIDQtgToolbarNewGroup + /* SP_QtgToolBarNext */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x281d}, //KAknsIIDQtgToolbarNext + /* SP_QtgToolBarNextFrame */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2981}, //KAknsIIDQtgToolbarNextFrame + /* SP_QtgToolBarNowPlay */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x28ef}, //KAknsIIDQtgToolbarNowplay + /* SP_QtgToolBarOptions */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2725}, //KAknsIIDQtgToolbarOptions + /* SP_QtgToolBarOther */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2726}, //KAknsIIDQtgToolbarOther + /* SP_QtgToolBarOvi */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2931}, //KAknsIIDQtgToolbarOvi + /* SP_QtgToolBarPause */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2727}, //KAknsIIDQtgToolbarPause + /* SP_QtgToolBarPlay */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2728}, //KAknsIIDQtgToolbarPlay + /* SP_QtgToolBarPrevious */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x281e}, //KAknsIIDQtgToolbarPrevious + /* SP_QtgToolBarPreviousFrame */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2982}, //KAknsIIDQtgToolbarPreviousFrame + /* SP_QtgToolBarRead */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2729}, //KAknsIIDQtgToolbarRead + /* SP_QtgToolBarRedo */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2948}, //KAknsIIDQtgToolbarRedo + /* SP_QtgToolBarRedoDisabled */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2949}, //KAknsIIDQtgToolbarRedoDisabled + /* SP_QtgToolBarRefresh */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2932}, //KAknsIIDQtgToolbarRefresh + /* SP_QtgToolBarRemoveDetail */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x277b}, //KAknsIIDQtgToolbarRemoveDetail + /* SP_QtgToolBarRemoveDisabled */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x294a}, //KAknsIIDQtgToolbarRemoveDisabled + /* SP_QtgToolBarRepeat */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x281f}, //KAknsIIDQtgToolbarRepeat + /* SP_QtgToolBarRepeatOff */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2820}, //KAknsIIDQtgToolbarRepeatOff + /* SP_QtgToolBarRepeatOne */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2821}, //KAknsIIDQtgToolbarRepeatOne + /* SP_QtgToolBarRewind */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2822}, //KAknsIIDQtgToolbarRewind + /* SP_QtgToolBarSearch */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x272a}, //KAknsIIDQtgToolbarSearch + /* SP_QtgToolBarSearchDisabled */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x294b}, //KAknsIIDQtgToolbarSearchDisabled + /* SP_QtgToolBarSelectContent */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x294c}, //KAknsIIDQtgToolbarSelectContent + /* SP_QtgToolBarSelfTimer */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2756}, //KAknsIIDQtgToolbarSelfTimer + /* SP_QtgToolBarSend */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x272b}, //KAknsIIDQtgToolbarSend + /* SP_QtgToolBarSendDimmed */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x29b0}, //KAknsIIDQtgToolbarSendDimmed + /* SP_QtgToolBarShare */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2823}, //KAknsIIDQtgToolbarShare + /* SP_QtgToolBarShift */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x272c}, //KAknsIIDQtgToolbarShift + /* SP_QtgToolBarShuffle */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2824}, //KAknsIIDQtgToolbarShuffle + /* SP_QtgToolBarShuffleOff */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2825}, //KAknsIIDQtgToolbarShuffleOff + /* SP_QtgToolBarSignalOff */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2757}, //KAknsIIDQtgToolbarSignalOff + /* SP_QtgToolBarSignalOn */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2758}, //KAknsIIDQtgToolbarSignalOn + /* SP_QtgToolBarStop */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x272d}, //KAknsIIDQtgToolbarStop + /* SP_QtgToolBarSync */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2894}, //KAknsIIDQtgToolbarSync + /* SP_QtgToolBarTools */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2983}, //KAknsIIDQtgToolbarTools + /* SP_QtgToolBarTrim */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2954}, //KAknsIIDQtgToolbarTrim + /* SP_QtgToolBarUnlock */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x272e}, //KAknsIIDQtgToolbarUnlock + /* SP_QtgToolBarUnmark */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x272f}, //KAknsIIDQtgToolbarUnmark + /* SP_QtgToolBarView */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2730}, //KAknsIIDQtgToolbarView + /* SP_QtgToolBarWlanOff */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2759}, //KAknsIIDQtgToolbarWlanOff + /* SP_QtgToolBarWlanOn */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x275a}, //KAknsIIDQtgToolbarWlanOn + + /* SP_QtgGrafCameraButtonCaptureNormal */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x2743}, //KAknsIIDQtgGrafCameraButtonCaptureNormal (already in 9.2) + /* SP_QtgGrafCameraButtonCapturePressed */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x2744}, //KAknsIIDQtgGrafCameraButtonCapturePressed + /* SP_QtgGrafCameraButtonPauseNormal */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x2745}, //KAknsIIDQtgGrafCameraButtonPauseNormal + /* SP_QtgGrafCameraButtonPausePressed */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x2746}, //KAknsIIDQtgGrafCameraButtonPausePressed + /* SP_QtgGrafCameraButtonPlayNormal */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x2747}, //KAknsIIDQtgGrafCameraButtonPlayNormal + /* SP_QtgGrafCameraButtonPlayPressed */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x2748}, //KAknsIIDQtgGrafCameraButtonPlayPressed + /* SP_QtgGrafCameraButtonRecNormal */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x2749}, //KAknsIIDQtgGrafCameraButtonRecNormal + /* SP_QtgGrafCameraButtonRecPressed */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x274a}, //KAknsIIDQtgGrafCameraButtonRecPressed + /* SP_QtgGrafCameraButtonStopNormal */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x274b}, //KAknsIIDQtgGrafCameraButtonStopNormal + /* SP_QtgGrafCameraButtonStopPressed */ {KAknsIIDNone, EDrawIcon, ES60_Pre52, EAknsMajorGeneric, 0x274c}, //KAknsIIDQtgGrafCameraButtonStopPressed + + /* SP_QtgTabAll */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2851}, //KAknsIIDQtgTabAll + /* SP_QtgTabArtist */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x288f}, //KAknsIIDQtgTabArtist + /* SP_QtgTabFavourite */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x28eb}, //KAknsIIDQtgTabFavourite + /* SP_QtgTabGenre */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2890}, //KAknsIIDQtgTabGenre + /* SP_QtgTabLanguage */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x28ec}, //KAknsIIDQtgTabLanguage + /* SP_QtgTabMusicAlbum */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2891}, //KAknsIIDQtgTabMusicAlbum + /* SP_QtgTabPhotosAlbum */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2818}, //KAknsIIDQtgTabPhotosAlbum + /* SP_QtgTabPhotosAll */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2819}, //KAknsIIDQtgTabPhotosAll + /* SP_QtgTabPlaylist */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2892}, //KAknsIIDQtgTabPlaylist + /* SP_QtgTabServices */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x274f}, //KAknsIIDQtgTabServices + /* SP_QtgTabSongs */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2893}, //KAknsIIDQtgTabSongs + /* SP_QtgTabVideos */ {KAknsIIDNone, EDrawIcon, ES60_Pre53, EAknsMajorGeneric, 0x2750}, //KAknsIIDQtgTabVideos + + /* SP_QgnIndiBrowserTbReload */ {KAknsIIDQgnIndiBrowserTbReload, EDrawIcon, ES60_All, -1, -1}, + /* SP_QgnIndiBrowserTbHome */ {KAknsIIDQgnIndiBrowserTbHome, EDrawIcon, ES60_All, -1, -1}, + /* SP_QgnIndiBrowserTbStop */ {KAknsIIDQgnIndiBrowserTbStop, EDrawIcon, ES60_All, -1, -1}, }; QPixmap QS60StyleModeSpecifics::skinnedGraphics( @@ -1387,12 +1488,26 @@ QPixmap QS60StylePrivate::backgroundTexture(bool skipCreation) // Notify all widgets that palette is updated with the actual background texture. QPalette pal = QApplication::palette(); pal.setBrush(QPalette::Window, *m_background); + + //Application palette hash is automatically cleared when QApplication::setPalette is called. + //To avoid losing palette hash data, back it up before calling the setPalette() API and + //restore it afterwards. + typedef QHash<QByteArray, QPalette> PaletteHash; + PaletteHash hash; + if (qt_app_palettes_hash() || !qt_app_palettes_hash()->isEmpty()) + hash = *qt_app_palettes_hash(); QApplication::setPalette(pal); - setThemePaletteHash(&pal); + if (hash.isEmpty()) { + //set default theme palette hash + setThemePaletteHash(&pal); + } else { + for (int i = 0; i < hash.count() - 1; i++) { + QByteArray widgetClassName = hash.keys().at(i); + QApplication::setPalette(hash.value(widgetClassName), widgetClassName); + } + } storeThemePalette(&pal); - foreach (QWidget *widget, QApplication::allWidgets()){ - QEvent e(QEvent::PaletteChange); - QApplication::sendEvent(widget, &e); + foreach (QWidget *widget, QApplication::allWidgets()) { setThemePalette(widget); widget->ensurePolished(); } diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index d4c81b9..2d6af3b 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -147,6 +147,7 @@ bool QFontDef::exactMatch(const QFontDef &other) const && weight == other.weight && style == other.style && this_family == other_family + && (styleName.isEmpty() || other.styleName.isEmpty() || styleName == other.styleName) && (this_foundry.isEmpty() || other_foundry.isEmpty() || this_foundry == other_foundry) diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 8eeae6f..ebc842c 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -113,6 +113,7 @@ struct QFontDef && styleStrategy == other.styleStrategy && ignorePitch == other.ignorePitch && fixedPitch == other.fixedPitch && family == other.family + && (styleName.isEmpty() || other.styleName.isEmpty() || styleName == other.styleName) && hintingPreference == other.hintingPreference #ifdef Q_WS_X11 && addStyle == other.addStyle @@ -128,6 +129,8 @@ struct QFontDef if (styleHint != other.styleHint) return styleHint < other.styleHint; if (styleStrategy != other.styleStrategy) return styleStrategy < other.styleStrategy; if (family != other.family) return family < other.family; + if (!styleName.isEmpty() && !other.styleName.isEmpty() && styleName != other.styleName) + return styleName < other.styleName; if (hintingPreference != other.hintingPreference) return hintingPreference < other.hintingPreference; #ifdef Q_WS_X11 diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp index 4c1045e..30a1623 100644 --- a/src/gui/text/qfontengine_qpf.cpp +++ b/src/gui/text/qfontengine_qpf.cpp @@ -251,8 +251,8 @@ QList<QByteArray> QFontEngineQPF::cleanUpAfterClientCrash(const QList<int> &cras { QList<QByteArray> removedFonts; QDir dir(qws_fontCacheDir(), QLatin1String("*.qsf")); - for (int i = 0; i < int(dir.count()); ++i) { - const QByteArray fileName = QFile::encodeName(dir.absoluteFilePath(dir[i])); + foreach (const QFileInfo &fi, dir.entryInfoList()) { + const QByteArray fileName = QFile::encodeName(fi.absoluteFilePath()); int fd = QT_OPEN(fileName.constData(), O_RDONLY, 0); if (fd >= 0) { @@ -342,14 +342,14 @@ QFontEngineQPF::QFontEngineQPF(const QFontDef &def, int fileDescriptor, QFontEng fd = QT_OPEN(encodedFileName, O_RDONLY); if (fd == -1) { #if defined(DEBUG_FONTENGINE) - qErrnoWarning("QFontEngineQPF: unable to open %s", encodedName.constData()); + qErrnoWarning("QFontEngineQPF: unable to open %s", encodedFileName.constData()); #endif return; } } if (fd == -1) { #if defined(DEBUG_FONTENGINE) - qWarning("QFontEngineQPF: insufficient access rights to %s", encodedName.constData()); + qWarning("QFontEngineQPF: insufficient access rights to %s", encodedFileName.constData()); #endif return; } @@ -361,7 +361,7 @@ QFontEngineQPF::QFontEngineQPF(const QFontDef &def, int fileDescriptor, QFontEng fd = QT_OPEN(encodedFileName, O_RDWR | O_EXCL | O_CREAT, 0644); if (fd == -1) { #if defined(DEBUG_FONTENGINE) - qErrnoWarning(errno, "QFontEngineQPF: open() failed for %s", encodedName.constData()); + qErrnoWarning(errno, "QFontEngineQPF: open() failed for %s", encodedFileName.constData()); #endif return; } @@ -374,7 +374,7 @@ QFontEngineQPF::QFontEngineQPF(const QFontDef &def, int fileDescriptor, QFontEng const QByteArray &data = buffer.data(); if (QT_WRITE(fd, data.constData(), data.size()) == -1) { #if defined(DEBUG_FONTENGINE) - qErrnoWarning(errno, "QFontEngineQPF: write() failed for %s", encodedName.constData()); + qErrnoWarning(errno, "QFontEngineQPF: write() failed for %s", encodedFileName.constData()); #endif return; } diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp index 4c6dff2..237842b 100644 --- a/src/gui/text/qfontengine_qws.cpp +++ b/src/gui/text/qfontengine_qws.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include "qfontengine_p.h" -#include <private/qunicodetables_p.h> #include <qwsdisplay_qws.h> #include <qvarlengtharray.h> #include <private/qpainter_p.h> @@ -51,15 +50,17 @@ #include <qdebug.h> - #ifndef QT_NO_QWS_QPF +#include "qplatformdefs.h" #include "qfile.h" -#include "qdir.h" -#define QT_USE_MMAP #include <stdlib.h> +#if !defined(Q_OS_INTEGRITY) +#define QT_USE_MMAP +#endif + #ifdef QT_USE_MMAP // for mmap #include <unistd.h> @@ -69,22 +70,17 @@ #include <fcntl.h> #include <errno.h> -# if defined(QT_LINUXBASE) && !defined(MAP_FILE) - // LSB 3.2 does not define MAP_FILE -# define MAP_FILE 0 -# endif - +#ifndef MAP_FILE +# define MAP_FILE 0 +#endif +#ifndef MAP_FAILED +# define MAP_FAILED (void *)-1 #endif -#endif // QT_NO_QWS_QPF +#endif // QT_USE_MMAP QT_BEGIN_NAMESPACE -#ifndef QT_NO_QWS_QPF -QT_BEGIN_INCLUDE_NAMESPACE -#include "qplatformdefs.h" -QT_END_INCLUDE_NAMESPACE - static inline unsigned int getChar(const QChar *str, int &i, const int len) { unsigned int uc = str[i].unicode(); @@ -161,17 +157,10 @@ public: QPFGlyphTree* more; QPFGlyph* glyph; public: -#ifdef QT_USE_MMAP QPFGlyphTree(uchar*& data) { read(data); } -#else - QPFGlyphTree(QIODevice& f) - { - read(f); - } -#endif ~QPFGlyphTree() { @@ -237,7 +226,6 @@ private: { } -#ifdef QT_USE_MMAP void read(uchar*& data) { // All node data first @@ -247,19 +235,7 @@ private: // Then all video data readData(data); } -#else - void read(QIODevice& f) - { - // All node data first - readNode(f); - // Then all non-video data - readMetrics(f); - // Then all video data - readData(f); - } -#endif -#ifdef QT_USE_MMAP void readNode(uchar*& data) { uchar rw = *data++; @@ -285,38 +261,7 @@ private: if ( more ) more->readNode(data); } -#else - void readNode(QIODevice& f) - { - char rw; - char cl; - f.getChar(&rw); - f.getChar(&cl); - min = (rw << 8) | cl; - f.getChar(&rw); - f.getChar(&cl); - max = (rw << 8) | cl; - char flags; - f.getChar(&flags); - if ( flags & 1 ) - less = new QPFGlyphTree; - else - less = 0; - if ( flags & 2 ) - more = new QPFGlyphTree; - else - more = 0; - int n = max-min+1; - glyph = new QPFGlyph[n]; - - if ( less ) - less->readNode(f); - if ( more ) - more->readNode(f); - } -#endif -#ifdef QT_USE_MMAP void readMetrics(uchar*& data) { int n = max-min+1; @@ -329,22 +274,7 @@ private: if ( more ) more->readMetrics(data); } -#else - void readMetrics(QIODevice& f) - { - int n = max-min+1; - for (int i=0; i<n; i++) { - glyph[i].metrics = new QPFGlyphMetrics; - f.read((char*)glyph[i].metrics, sizeof(QPFGlyphMetrics)); - } - if ( less ) - less->readMetrics(f); - if ( more ) - more->readMetrics(f); - } -#endif -#ifdef QT_USE_MMAP void readData(uchar*& data) { int n = max-min+1; @@ -359,24 +289,6 @@ private: if ( more ) more->readData(data); } -#else - void readData(QIODevice& f) - { - int n = max-min+1; - for (int i=0; i<n; i++) { - QSize s( glyph[i].metrics->width, glyph[i].metrics->height ); - //############### s = qt_screen->mapToDevice( s ); - uint datasize = glyph[i].metrics->linestep * s.height(); - glyph[i].data = new uchar[datasize]; // ### deleted? - f.read((char*)glyph[i].data, datasize); - } - if ( less ) - less->readData(f); - if ( more ) - more->readData(f); - } -#endif - }; class QFontEngineQPF1Data @@ -384,73 +296,58 @@ class QFontEngineQPF1Data public: QPFFontMetrics fm; QPFGlyphTree *tree; - void *mmapStart; + uchar *mmapStart; size_t mmapLength; -}; - -#if defined(Q_OS_INTEGRITY) -static void *qt_mmap(void *start, size_t length, int /*prot*/, int /*flags*/, int fd, off_t offset) -{ - // INTEGRITY cannot mmap local files - load it into a local buffer - if (::lseek(fd, offset, SEEK_SET) == -1) { -# if defined(DEBUG_FONTENGINE) - perror("lseek failed"); -# endif - } - void *buf = malloc(length); - if (::read(fd, buf, length) != (ssize_t)length) { -# if defined(DEBUG_FONTENGINE) - perror("read failed"); -# endif - } - - return buf; -} -#else -static inline void *qt_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) -{ - return mmap(start, length, prot, flags, fd, offset); -} +#ifdef QT_USE_MMAP + bool used_mmap; #endif - - +}; QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn) { cache_cost = 1; - int f = QT_OPEN( QFile::encodeName(fn), O_RDONLY, 0); - Q_ASSERT(f>=0); + int fd = QT_OPEN(QFile::encodeName(fn).constData(), O_RDONLY, 0); + if (fd == -1) + qFatal("Failed to open '%s'", QFile::encodeName(fn).constData()); + QT_STATBUF st; - if ( QT_FSTAT( f, &st ) ) - qFatal("Failed to stat %s",QFile::encodeName(fn).data()); - uchar* data = (uchar*)qt_mmap( 0, // any address - st.st_size, // whole file - PROT_READ, // read-only memory -#if defined(Q_OS_INTEGRITY) - 0, -#elif !defined(Q_OS_SOLARIS) && !defined(Q_OS_QNX4) && !defined(Q_OS_VXWORKS) - MAP_FILE | MAP_PRIVATE, // swap-backed map from file -#else - MAP_PRIVATE, -#endif - f, 0 ); // from offset 0 of f -#if !defined(MAP_FAILED) && (defined(Q_OS_QNX4) || defined(Q_OS_INTEGRITY)) -#define MAP_FAILED ((void *)-1) -#endif - if ( !data || data == (uchar*)MAP_FAILED ) - qFatal("Failed to mmap %s",QFile::encodeName(fn).data()); - QT_CLOSE(f); + if (QT_FSTAT(fd, &st) != 0) + qFatal("Failed to stat '%s'", QFile::encodeName(fn).constData()); d = new QFontEngineQPF1Data; - d->mmapStart = data; + d->mmapStart = 0; d->mmapLength = st.st_size; - memcpy(reinterpret_cast<char*>(&d->fm),data,sizeof(d->fm)); - data += sizeof(d->fm); - d->tree = new QPFGlyphTree(data); - glyphFormat = (d->fm.flags & FM_SMOOTH) ? QFontEngineGlyphCache::Raster_A8 - : QFontEngineGlyphCache::Raster_Mono; +#ifdef QT_USE_MMAP + d->used_mmap = true; + d->mmapStart = (uchar *)::mmap(0, st.st_size, // any address, whole file + PROT_READ, // read-only memory + MAP_FILE | MAP_PRIVATE, // swap-backed map from file + fd, 0); // from offset 0 of fd + if (d->mmapStart == (uchar *)MAP_FAILED) + d->mmapStart = 0; +#endif + + if (!d->mmapStart) { +#ifdef QT_USE_MMAP + d->used_mmap = false; +#endif + d->mmapStart = new uchar[d->mmapLength]; + if (QT_READ(fd, d->mmapStart, d->mmapLength) != d->mmapLength) + qFatal("Failed to read '%s'", QFile::encodeName(fn).constData()); + } + QT_CLOSE(fd); + + if (d->mmapStart) { + uchar* data = d->mmapStart; + + memcpy(reinterpret_cast<char*>(&d->fm), data, sizeof(d->fm)); + data += sizeof(d->fm); + + d->tree = new QPFGlyphTree(data); + glyphFormat = (d->fm.flags & FM_SMOOTH) ? QFontEngineGlyphCache::Raster_A8 + : QFontEngineGlyphCache::Raster_Mono; #if 0 qDebug() << "font file" << fn << "ascent" << d->fm.ascent << "descent" << d->fm.descent @@ -462,12 +359,19 @@ QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn) << "underlinepos" << d->fm.underlinepos << "underlinewidth" << d->fm.underlinewidth; #endif + } } QFontEngineQPF1::~QFontEngineQPF1() { - if (d->mmapStart) - munmap(d->mmapStart, d->mmapLength); + if (d->mmapStart) { +#if defined(QT_USE_MMAP) + if (d->used_mmap) + ::munmap(d->mmapStart, d->mmapLength); + else +#endif + delete [] d->mmapStart; + } delete d->tree; delete d; } diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index d8192b7..c985427 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -427,14 +427,17 @@ namespace { public: DrawTextItemRecorder(bool untransformedCoordinates, bool useBackendOptimizations) : m_dirtyPen(false), m_useBackendOptimizations(useBackendOptimizations), - m_untransformedCoordinates(untransformedCoordinates) + m_untransformedCoordinates(untransformedCoordinates), m_currentColor(Qt::black) { } virtual void updateState(const QPaintEngineState &newState) { - if (newState.state() & QPaintEngine::DirtyPen) + if (newState.state() & QPaintEngine::DirtyPen + && newState.pen().color() != m_currentColor) { m_dirtyPen = true; + m_currentColor = newState.pen().color(); + } } virtual void drawTextItem(const QPointF &position, const QTextItem &textItem) @@ -450,7 +453,7 @@ namespace { currentItem.positionOffset = m_glyphs.size(); // Offset into position pool currentItem.useBackendOptimizations = m_useBackendOptimizations; if (m_dirtyPen) - currentItem.color = state->pen().color(); + currentItem.color = m_currentColor; QTransform matrix = m_untransformedCoordinates ? QTransform() : state->transform(); matrix.translate(position.x(), position.y()); @@ -521,6 +524,7 @@ namespace { bool m_dirtyPen; bool m_useBackendOptimizations; bool m_untransformedCoordinates; + QColor m_currentColor; }; class DrawTextItemDevice: public QPaintDevice |