diff options
Diffstat (limited to 'src/gui')
55 files changed, 1765 insertions, 304 deletions
diff --git a/src/gui/accessible/qaccessible2.cpp b/src/gui/accessible/qaccessible2.cpp index 35b24f6..078ff13 100644 --- a/src/gui/accessible/qaccessible2.cpp +++ b/src/gui/accessible/qaccessible2.cpp @@ -42,6 +42,7 @@ #include "qaccessible2.h" #include "qapplication.h" #include "qclipboard.h" +#include "qtextboundaryfinder.h" #ifndef QT_NO_ACCESSIBILITY @@ -132,6 +133,117 @@ QT_BEGIN_NAMESPACE \link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink */ + +/*! + \internal +*/ +QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset, const QString& text) +{ + QTextBoundaryFinder::BoundaryType type; + switch (boundaryType) { + case QAccessible2::CharBoundary: + type = QTextBoundaryFinder::Grapheme; + break; + case QAccessible2::WordBoundary: + type = QTextBoundaryFinder::Word; + break; + case QAccessible2::SentenceBoundary: + type = QTextBoundaryFinder::Sentence; + break; + default: + // in any other case return the whole line + *startOffset = 0; + *endOffset = text.length(); + return text; + } + + QTextBoundaryFinder boundary(type, text); + boundary.setPosition(offset); + + if (!boundary.isAtBoundary()) { + boundary.toPreviousBoundary(); + } + boundary.toPreviousBoundary(); + *startOffset = boundary.position(); + boundary.toNextBoundary(); + *endOffset = boundary.position(); + + return text.mid(*startOffset, *endOffset - *startOffset); +} + +/*! + \internal +*/ +QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset, const QString& text) +{ + QTextBoundaryFinder::BoundaryType type; + switch (boundaryType) { + case QAccessible2::CharBoundary: + type = QTextBoundaryFinder::Grapheme; + break; + case QAccessible2::WordBoundary: + type = QTextBoundaryFinder::Word; + break; + case QAccessible2::SentenceBoundary: + type = QTextBoundaryFinder::Sentence; + break; + default: + // in any other case return the whole line + *startOffset = 0; + *endOffset = text.length(); + return text; + } + + QTextBoundaryFinder boundary(type, text); + boundary.setPosition(offset); + + boundary.toNextBoundary(); + *startOffset = boundary.position(); + boundary.toNextBoundary(); + *endOffset = boundary.position(); + + return text.mid(*startOffset, *endOffset - *startOffset); +} + +/*! + \internal +*/ +QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset, const QString& text) +{ + QTextBoundaryFinder::BoundaryType type; + switch (boundaryType) { + case QAccessible2::CharBoundary: + type = QTextBoundaryFinder::Grapheme; + break; + case QAccessible2::WordBoundary: + type = QTextBoundaryFinder::Word; + break; + case QAccessible2::SentenceBoundary: + type = QTextBoundaryFinder::Sentence; + break; + default: + // in any other case return the whole line + *startOffset = 0; + *endOffset = text.length(); + return text; + } + + QTextBoundaryFinder boundary(type, text); + boundary.setPosition(offset); + + if (!boundary.isAtBoundary()) { + boundary.toPreviousBoundary(); + } + *startOffset = boundary.position(); + boundary.toNextBoundary(); + *endOffset = boundary.position(); + + return text.mid(*startOffset, *endOffset - *startOffset); +} + QAccessibleSimpleEditableTextInterface::QAccessibleSimpleEditableTextInterface( QAccessibleInterface *accessibleInterface) : iface(accessibleInterface) diff --git a/src/gui/dialogs/qerrormessage.cpp b/src/gui/dialogs/qerrormessage.cpp index 890e6ca..0a6580a 100644 --- a/src/gui/dialogs/qerrormessage.cpp +++ b/src/gui/dialogs/qerrormessage.cpp @@ -249,12 +249,20 @@ QErrorMessage::QErrorMessage(QWidget * parent) d->icon->setPixmap(QMessageBox::standardIcon(QMessageBox::Information)); d->icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop); #endif - grid->addWidget(d->icon, 0, 0, Qt::AlignTop); +#ifdef Q_WS_S60 + //In Symbian, messagebox icons are in LtR UIs on right. Thus, layout needs to switch icon and text columns. + const int preferredIconColumn = (QApplication::layoutDirection() == Qt::LeftToRight) ? 1 : 0; + const int preferredTextColumn = (QApplication::layoutDirection() == Qt::LeftToRight) ? 0 : 1; +#else + const int preferredIconColumn = 0; + const int preferredTextColumn = 1; +#endif + grid->addWidget(d->icon, 0, preferredIconColumn, Qt::AlignTop); d->errors = new QErrorMessageTextView(this); - grid->addWidget(d->errors, 0, 1); + grid->addWidget(d->errors, 0, preferredTextColumn); d->again = new QCheckBox(this); d->again->setChecked(true); - grid->addWidget(d->again, 1, 1, Qt::AlignTop); + grid->addWidget(d->again, 1, preferredTextColumn, Qt::AlignTop); d->ok = new QPushButton(this); #ifdef QT_SOFTKEYS_ENABLED d->okAction = new QAction(d->ok); @@ -270,7 +278,7 @@ QErrorMessage::QErrorMessage(QWidget * parent) connect(d->ok, SIGNAL(clicked()), this, SLOT(accept())); d->ok->setFocus(); grid->addWidget(d->ok, 2, 0, 1, 2, Qt::AlignCenter); - grid->setColumnStretch(1, 42); + grid->setColumnStretch(preferredTextColumn, 42); grid->setRowStretch(0, 42); d->retranslateStrings(); } diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index 90ca080..a2f086b 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -259,8 +259,15 @@ void QMessageBoxPrivate::init(const QString &title, const QString &text) QGridLayout *grid = new QGridLayout; #ifndef Q_WS_MAC - grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop); - grid->addWidget(label, 0, 1, 1, 1); +#ifdef Q_WS_S60 + const int preferredIconColumn = (QApplication::layoutDirection() == Qt::LeftToRight) ? 1 : 0; + const int preferredTextColumn = (QApplication::layoutDirection() == Qt::LeftToRight) ? 0 : 1; +#else + const int preferredIconColumn = 0; + const int preferredTextColumn = 1; +#endif + grid->addWidget(iconLabel, 0, preferredIconColumn, 2, 1, Qt::AlignTop); + grid->addWidget(label, 0, preferredTextColumn, 1, 1); // -- leave space for information label -- grid->addWidget(buttonBox, 2, 0, 1, 2); #else @@ -2500,7 +2507,12 @@ void QMessageBox::setInformativeText(const QString &text) label->hide(); QTextBrowser *textBrowser = new QTextBrowser(this); textBrowser->setOpenExternalLinks(true); - grid->addWidget(textBrowser, 1, 1, 1, 1); +#if defined(Q_OS_SYMBIAN) + const int preferredTextColumn = (QApplication::layoutDirection() == Qt::LeftToRight) ? 0 : 1; +#else + const int preferredTextColumn = 1; +#endif + grid->addWidget(textBrowser, 1, preferredTextColumn, 1, 1); d->textBrowser = textBrowser; #else grid->addWidget(label, 1, 1, 1, 1); diff --git a/src/gui/graphicsview/qgraphicsgridlayout.cpp b/src/gui/graphicsview/qgraphicsgridlayout.cpp index 2fbfc5d..fb4bd32 100644 --- a/src/gui/graphicsview/qgraphicsgridlayout.cpp +++ b/src/gui/graphicsview/qgraphicsgridlayout.cpp @@ -600,6 +600,8 @@ void QGraphicsGridLayout::removeAt(int index) } /*! + \since 4.8 + Removes the layout item \a item without destroying it. Ownership of the item is transferred to the caller. diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp index 6fbe849..d01c3af 100644 --- a/src/gui/graphicsview/qgraphicslayout.cpp +++ b/src/gui/graphicsview/qgraphicslayout.cpp @@ -466,7 +466,6 @@ void QGraphicsLayout::addChildLayoutItem(QGraphicsLayoutItem *layoutItem) static bool g_instantInvalidatePropagation = false; /*! - \internal \since 4.8 \sa instantInvalidatePropagation() @@ -496,7 +495,6 @@ void QGraphicsLayout::setInstantInvalidatePropagation(bool enable) } /*! - \internal \since 4.8 \sa setInstantInvalidatePropagation() diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 5d3d8d9..9857015 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -108,6 +108,7 @@ private: bool needsInputPanel(); void commitTemporaryPreeditString(); bool isWidgetVisible(QWidget *widget, int offset = 0); + bool isPartialKeyboardSupported(); private Q_SLOTS: void ensureInputCapabilitiesChanged(); diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index f8d7e28..5ddd53f 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,12 +73,18 @@ // 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) { S60->partial_keyboard = enable; + QApplication::setAttribute(Qt::AA_S60DisablePartialScreenInputMode, !S60->partial_keyboard); + QInputContext *ic = 0; if (QApplication::focusWidget()) { ic = QApplication::focusWidget()->inputContext(); @@ -111,7 +118,7 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_fepState->SetObjectProvider(this); int defaultFlags = EAknEditorFlagDefault; if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) { - if (S60->partial_keyboard) { + if (isPartialKeyboardSupported()) { defaultFlags |= QT_EAknEditorFlagEnablePartialScreen; } defaultFlags |= QT_EAknEditorFlagSelectionVisible; @@ -312,28 +319,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; @@ -402,7 +427,8 @@ void QCoeFepInputContext::mouseHandler(int x, QMouseEvent *event) //If splitview is open and T9 word is tapped, pass the pointer event to pointer handler. //This will open the "suggested words" list. Pass pointer position always as zero, to make //full word replacement in case user makes a selection. - if (S60->partial_keyboard && S60->partialKeyboardOpen + if (isPartialKeyboardSupported() + && S60->partialKeyboardOpen && m_pointerHandler && !(currentHints & Qt::ImhNoPredictiveText) && (x > 0 && x < m_preeditString.length())) { @@ -516,6 +542,11 @@ bool QCoeFepInputContext::isWidgetVisible(QWidget *widget, int offset) return visible; } +bool QCoeFepInputContext::isPartialKeyboardSupported() +{ + return (S60->partial_keyboard || !QApplication::testAttribute(Qt::AA_S60DisablePartialScreenInputMode)); +} + // Ensure that the input widget is visible in the splitview rect. void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget) @@ -627,7 +658,7 @@ void QCoeFepInputContext::updateHints(bool mustUpdateInputCapabilities) // we need to update its state separately. if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) { TInt currentFlags = m_fepState->Flags(); - if (S60->partial_keyboard) + if (isPartialKeyboardSupported()) currentFlags |= QT_EAknEditorFlagEnablePartialScreen; else currentFlags &= ~QT_EAknEditorFlagEnablePartialScreen; @@ -744,7 +775,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) flags = 0; if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) { - if (S60->partial_keyboard) + if (isPartialKeyboardSupported()) flags |= QT_EAknEditorFlagEnablePartialScreen; flags |= QT_EAknEditorFlagSelectionVisible; } diff --git a/src/gui/itemviews/qabstractproxymodel.cpp b/src/gui/itemviews/qabstractproxymodel.cpp index 48c84ac..f00b7ee 100644 --- a/src/gui/itemviews/qabstractproxymodel.cpp +++ b/src/gui/itemviews/qabstractproxymodel.cpp @@ -298,6 +298,7 @@ bool QAbstractProxyModel::setHeaderData(int section, Qt::Orientation orientation /*! \reimp + \since 4.8 */ QModelIndex QAbstractProxyModel::buddy(const QModelIndex &index) const { @@ -307,6 +308,7 @@ QModelIndex QAbstractProxyModel::buddy(const QModelIndex &index) const /*! \reimp + \since 4.8 */ bool QAbstractProxyModel::canFetchMore(const QModelIndex &parent) const { @@ -316,6 +318,7 @@ bool QAbstractProxyModel::canFetchMore(const QModelIndex &parent) const /*! \reimp + \since 4.8 */ void QAbstractProxyModel::fetchMore(const QModelIndex &parent) { @@ -325,6 +328,7 @@ void QAbstractProxyModel::fetchMore(const QModelIndex &parent) /*! \reimp + \since 4.8 */ void QAbstractProxyModel::sort(int column, Qt::SortOrder order) { @@ -334,6 +338,7 @@ void QAbstractProxyModel::sort(int column, Qt::SortOrder order) /*! \reimp + \since 4.8 */ QSize QAbstractProxyModel::span(const QModelIndex &index) const { @@ -343,6 +348,7 @@ QSize QAbstractProxyModel::span(const QModelIndex &index) const /*! \reimp + \since 4.8 */ bool QAbstractProxyModel::hasChildren(const QModelIndex &parent) const { @@ -352,6 +358,7 @@ bool QAbstractProxyModel::hasChildren(const QModelIndex &parent) const /*! \reimp + \since 4.8 */ QMimeData* QAbstractProxyModel::mimeData(const QModelIndexList &indexes) const { @@ -364,6 +371,7 @@ QMimeData* QAbstractProxyModel::mimeData(const QModelIndexList &indexes) const /*! \reimp + \since 4.8 */ QStringList QAbstractProxyModel::mimeTypes() const { @@ -373,6 +381,7 @@ QStringList QAbstractProxyModel::mimeTypes() const /*! \reimp + \since 4.8 */ Qt::DropActions QAbstractProxyModel::supportedDropActions() const { diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 361ec6d..cd13894 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -1019,6 +1019,10 @@ void QApplicationPrivate::initialize() QApplicationPrivate::wheel_scroll_lines = 3; #endif +#ifdef Q_WS_S60 + q->setAttribute(Qt::AA_S60DisablePartialScreenInputMode); +#endif + if (qt_is_gui_used) initializeMultitouch(); } diff --git a/src/gui/kernel/qgenericplugin_qpa.cpp b/src/gui/kernel/qgenericplugin_qpa.cpp index e7b65b7..dae512d 100644 --- a/src/gui/kernel/qgenericplugin_qpa.cpp +++ b/src/gui/kernel/qgenericplugin_qpa.cpp @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE \class QGenericPlugin \ingroup plugins \ingroup qpa + \since 4.8 \brief The QGenericPlugin class is an abstract base class for window-system related plugins in Qt QPA. diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.cpp b/src/gui/kernel/qgenericpluginfactory_qpa.cpp index fb6a0d8..86e146a 100644 --- a/src/gui/kernel/qgenericpluginfactory_qpa.cpp +++ b/src/gui/kernel/qgenericpluginfactory_qpa.cpp @@ -61,6 +61,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, /*! \class QGenericPluginFactory \ingroup qpa + \since 4.8 \brief The QGenericPluginFactory class creates window-system related plugin drivers in Qt QPA. diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h index 2607c2a..1d624f9 100644 --- a/src/gui/kernel/qkeymapper_p.h +++ b/src/gui/kernel/qkeymapper_p.h @@ -213,6 +213,8 @@ public: int mapS60ScanCodesToQt(TUint s60key); int mapQtToS60Key(int qtKey); int mapQtToS60ScanCodes(int qtKey); + int mapS60RemConIdToS60Key(int s60RemConId); + int mapS60RemConIdToS60ScanCodes(int s60RemConId); void updateInputLanguage(); #endif }; diff --git a/src/gui/kernel/qkeymapper_s60.cpp b/src/gui/kernel/qkeymapper_s60.cpp index 1113b77..2a7083e 100644 --- a/src/gui/kernel/qkeymapper_s60.cpp +++ b/src/gui/kernel/qkeymapper_s60.cpp @@ -87,97 +87,104 @@ QString QKeyMapperPrivate::translateKeyEvent(int keySym, Qt::KeyboardModifiers / } #include <e32keys.h> +#include <remconcoreapi.h> struct KeyMapping{ TKeyCode s60KeyCode; TStdScanCode s60ScanCode; + TRemConCoreApiOperationId s60RemConId; Qt::Key qtKey; }; using namespace Qt; +// key mapping table in the format of +// {S60 key code, S60 scan code, S60 RemCon operation Id, Qt key code} static const KeyMapping keyMapping[] = { - {EKeyBackspace, EStdKeyBackspace, Key_Backspace}, - {EKeyTab, EStdKeyTab, Key_Tab}, - {EKeyEnter, EStdKeyEnter, Key_Enter}, - {EKeyEscape, EStdKeyEscape, Key_Escape}, - {EKeySpace, EStdKeySpace, Key_Space}, - {EKeyDelete, EStdKeyDelete, Key_Delete}, - {EKeyPrintScreen, EStdKeyPrintScreen, Key_SysReq}, - {EKeyPause, EStdKeyPause, Key_Pause}, - {EKeyHome, EStdKeyHome, Key_Home}, - {EKeyEnd, EStdKeyEnd, Key_End}, - {EKeyPageUp, EStdKeyPageUp, Key_PageUp}, - {EKeyPageDown, EStdKeyPageDown, Key_PageDown}, - {EKeyInsert, EStdKeyInsert, Key_Insert}, - {EKeyLeftArrow, EStdKeyLeftArrow, Key_Left}, - {EKeyRightArrow, EStdKeyRightArrow, Key_Right}, - {EKeyUpArrow, EStdKeyUpArrow, Key_Up}, - {EKeyDownArrow, EStdKeyDownArrow, Key_Down}, - {EKeyLeftShift, EStdKeyLeftShift, Key_Shift}, - {EKeyRightShift, EStdKeyRightShift, Key_Shift}, - {EKeyLeftAlt, EStdKeyLeftAlt, Key_Alt}, - {EKeyRightAlt, EStdKeyRightAlt, Key_AltGr}, - {EKeyLeftCtrl, EStdKeyLeftCtrl, Key_Control}, - {EKeyRightCtrl, EStdKeyRightCtrl, Key_Control}, - {EKeyLeftFunc, EStdKeyLeftFunc, Key_Super_L}, - {EKeyRightFunc, EStdKeyRightFunc, Key_Super_R}, - {EKeyCapsLock, EStdKeyCapsLock, Key_CapsLock}, - {EKeyNumLock, EStdKeyNumLock, Key_NumLock}, - {EKeyScrollLock, EStdKeyScrollLock, Key_ScrollLock}, - {EKeyF1, EStdKeyF1, Key_F1}, - {EKeyF2, EStdKeyF2, Key_F2}, - {EKeyF3, EStdKeyF3, Key_F3}, - {EKeyF4, EStdKeyF4, Key_F4}, - {EKeyF5, EStdKeyF5, Key_F5}, - {EKeyF6, EStdKeyF6, Key_F6}, - {EKeyF7, EStdKeyF7, Key_F7}, - {EKeyF8, EStdKeyF8, Key_F8}, - {EKeyF9, EStdKeyF9, Key_F9}, - {EKeyF10, EStdKeyF10, Key_F10}, - {EKeyF11, EStdKeyF11, Key_F11}, - {EKeyF12, EStdKeyF12, Key_F12}, - {EKeyF13, EStdKeyF13, Key_F13}, - {EKeyF14, EStdKeyF14, Key_F14}, - {EKeyF15, EStdKeyF15, Key_F15}, - {EKeyF16, EStdKeyF16, Key_F16}, - {EKeyF17, EStdKeyF17, Key_F17}, - {EKeyF18, EStdKeyF18, Key_F18}, - {EKeyF19, EStdKeyF19, Key_F19}, - {EKeyF20, EStdKeyF20, Key_F20}, - {EKeyF21, EStdKeyF21, Key_F21}, - {EKeyF22, EStdKeyF22, Key_F22}, - {EKeyF23, EStdKeyF23, Key_F23}, - {EKeyF24, EStdKeyF24, Key_F24}, - {EKeyOff, EStdKeyOff, Key_PowerOff}, -// {EKeyMenu, EStdKeyMenu, Key_Menu}, // Menu is EKeyApplication0 - {EKeyHelp, EStdKeyHelp, Key_Help}, - {EKeyDial, EStdKeyDial, Key_Call}, - {EKeyIncVolume, EStdKeyIncVolume, Key_VolumeUp}, - {EKeyDecVolume, EStdKeyDecVolume, Key_VolumeDown}, - {EKeyDevice0, EStdKeyDevice0, Key_Context1}, // Found by manual testing. - {EKeyDevice1, EStdKeyDevice1, Key_Context2}, // Found by manual testing. - {EKeyDevice3, EStdKeyDevice3, Key_Select}, - {EKeyDevice7, EStdKeyDevice7, Key_Camera}, - {EKeyApplication0, EStdKeyApplication0, Key_Menu}, // Found by manual testing. - {EKeyApplication1, EStdKeyApplication1, Key_Launch1}, // Found by manual testing. - {EKeyApplication2, EStdKeyApplication2, Key_MediaPlay}, // Found by manual testing. - {EKeyApplication3, EStdKeyApplication3, Key_MediaStop}, // Found by manual testing. - {EKeyApplication4, EStdKeyApplication4, Key_MediaNext}, // Found by manual testing. - {EKeyApplication5, EStdKeyApplication5, Key_MediaPrevious}, // Found by manual testing. - {EKeyApplication6, EStdKeyApplication6, Key_Launch6}, - {EKeyApplication7, EStdKeyApplication7, Key_Launch7}, - {EKeyApplication8, EStdKeyApplication8, Key_Launch8}, - {EKeyApplication9, EStdKeyApplication9, Key_Launch9}, - {EKeyApplicationA, EStdKeyApplicationA, Key_LaunchA}, - {EKeyApplicationB, EStdKeyApplicationB, Key_LaunchB}, - {EKeyApplicationC, EStdKeyApplicationC, Key_LaunchC}, - {EKeyApplicationD, EStdKeyApplicationD, Key_LaunchD}, - {EKeyApplicationE, EStdKeyApplicationE, Key_LaunchE}, - {EKeyApplicationF, EStdKeyApplicationF, Key_LaunchF}, - {EKeyApplication19, EStdKeyApplication19, Key_CameraFocus}, - {EKeyYes, EStdKeyYes, Key_Yes}, - {EKeyNo, EStdKeyNo, Key_No}, - {TKeyCode(0), TStdScanCode(0), Qt::Key(0)} + {EKeyBackspace, EStdKeyBackspace, ENop, Key_Backspace}, + {EKeyTab, EStdKeyTab, ENop, Key_Tab}, + {EKeyEnter, EStdKeyEnter, ERemConCoreApiEnter, Key_Enter}, + {EKeyEscape, EStdKeyEscape, ENop, Key_Escape}, + {EKeySpace, EStdKeySpace, ENop, Key_Space}, + {EKeyDelete, EStdKeyDelete, ENop, Key_Delete}, + {EKeyPrintScreen, EStdKeyPrintScreen, ENop, Key_SysReq}, + {EKeyPause, EStdKeyPause, ENop, Key_Pause}, + {EKeyHome, EStdKeyHome, ENop, Key_Home}, + {EKeyEnd, EStdKeyEnd, ENop, Key_End}, + {EKeyPageUp, EStdKeyPageUp, ERemConCoreApiPageUp, Key_PageUp}, + {EKeyPageDown, EStdKeyPageDown, ERemConCoreApiPageDown, Key_PageDown}, + {EKeyInsert, EStdKeyInsert, ENop, Key_Insert}, + {EKeyLeftArrow, EStdKeyLeftArrow, ERemConCoreApiLeft, Key_Left}, + {EKeyRightArrow, EStdKeyRightArrow, ERemConCoreApiRight, Key_Right}, + {EKeyUpArrow, EStdKeyUpArrow, ERemConCoreApiUp, Key_Up}, + {EKeyDownArrow, EStdKeyDownArrow, ERemConCoreApiDown, Key_Down}, + {EKeyLeftShift, EStdKeyLeftShift, ENop, Key_Shift}, + {EKeyRightShift, EStdKeyRightShift, ENop, Key_Shift}, + {EKeyLeftAlt, EStdKeyLeftAlt, ENop, Key_Alt}, + {EKeyRightAlt, EStdKeyRightAlt, ENop, Key_AltGr}, + {EKeyLeftCtrl, EStdKeyLeftCtrl, ENop, Key_Control}, + {EKeyRightCtrl, EStdKeyRightCtrl, ENop, Key_Control}, + {EKeyLeftFunc, EStdKeyLeftFunc, ENop, Key_Super_L}, + {EKeyRightFunc, EStdKeyRightFunc, ENop, Key_Super_R}, + {EKeyCapsLock, EStdKeyCapsLock, ENop, Key_CapsLock}, + {EKeyNumLock, EStdKeyNumLock, ENop, Key_NumLock}, + {EKeyScrollLock, EStdKeyScrollLock, ENop, Key_ScrollLock}, + {EKeyF1, EStdKeyF1, ERemConCoreApiF1, Key_F1}, + {EKeyF2, EStdKeyF2, ERemConCoreApiF2, Key_F2}, + {EKeyF3, EStdKeyF3, ERemConCoreApiF3, Key_F3}, + {EKeyF4, EStdKeyF4, ERemConCoreApiF4, Key_F4}, + {EKeyF5, EStdKeyF5, ERemConCoreApiF5, Key_F5}, + {EKeyF6, EStdKeyF6, ENop, Key_F6}, + {EKeyF7, EStdKeyF7, ENop, Key_F7}, + {EKeyF8, EStdKeyF8, ENop, Key_F8}, + {EKeyF9, EStdKeyF9, ENop, Key_F9}, + {EKeyF10, EStdKeyF10, ENop, Key_F10}, + {EKeyF11, EStdKeyF11, ENop, Key_F11}, + {EKeyF12, EStdKeyF12, ENop, Key_F12}, + {EKeyF13, EStdKeyF13, ENop, Key_F13}, + {EKeyF14, EStdKeyF14, ENop, Key_F14}, + {EKeyF15, EStdKeyF15, ENop, Key_F15}, + {EKeyF16, EStdKeyF16, ENop, Key_F16}, + {EKeyF17, EStdKeyF17, ENop, Key_F17}, + {EKeyF18, EStdKeyF18, ENop, Key_F18}, + {EKeyF19, EStdKeyF19, ENop, Key_F19}, + {EKeyF20, EStdKeyF20, ENop, Key_F20}, + {EKeyF21, EStdKeyF21, ENop, Key_F21}, + {EKeyF22, EStdKeyF22, ENop, Key_F22}, + {EKeyF23, EStdKeyF23, ENop, Key_F23}, + {EKeyF24, EStdKeyF24, ENop, Key_F24}, + {EKeyOff, EStdKeyOff, ENop, Key_PowerOff}, +// {EKeyMenu, EStdKeyMenu, ENop, Key_Menu}, // Menu is EKeyApplication0 + {EKeyHelp, EStdKeyHelp, ERemConCoreApiHelp, Key_Help}, + {EKeyDial, EStdKeyDial, ENop, Key_Call}, + {EKeyIncVolume, EStdKeyIncVolume, ERemConCoreApiVolumeUp, Key_VolumeUp}, + {EKeyDecVolume, EStdKeyDecVolume, ERemConCoreApiVolumeDown, Key_VolumeDown}, + {EKeyDevice0, EStdKeyDevice0, ENop, Key_Context1}, // Found by manual testing. + {EKeyDevice1, EStdKeyDevice1, ENop, Key_Context2}, // Found by manual testing. + {EKeyDevice3, EStdKeyDevice3, ERemConCoreApiSelect, Key_Select}, + {EKeyDevice7, EStdKeyDevice7, ENop, Key_Camera}, + {EKeyApplication0, EStdKeyApplication0, ENop, Key_Menu}, // Found by manual testing. + {EKeyApplication1, EStdKeyApplication1, ENop, Key_Launch1}, // Found by manual testing. + {EKeyApplication2, EStdKeyApplication2, ERemConCoreApiPlay, Key_MediaPlay}, // Found by manual testing. + {EKeyApplication3, EStdKeyApplication3, ERemConCoreApiStop, Key_MediaStop}, // Found by manual testing. + {EKeyApplication4, EStdKeyApplication4, ERemConCoreApiForward, Key_MediaNext}, // Found by manual testing. + {EKeyApplication5, EStdKeyApplication5, ERemConCoreApiBackward, Key_MediaPrevious}, // Found by manual testing. + {EKeyApplication6, EStdKeyApplication6, ENop, Key_Launch6}, + {EKeyApplication7, EStdKeyApplication7, ENop, Key_Launch7}, + {EKeyApplication8, EStdKeyApplication8, ENop, Key_Launch8}, + {EKeyApplication9, EStdKeyApplication9, ENop, Key_Launch9}, + {EKeyApplicationA, EStdKeyApplicationA, ENop, Key_LaunchA}, + {EKeyApplicationB, EStdKeyApplicationB, ENop, Key_LaunchB}, + {EKeyApplicationC, EStdKeyApplicationC, ENop, Key_LaunchC}, + {EKeyApplicationD, EStdKeyApplicationD, ENop, Key_LaunchD}, + {EKeyApplicationE, EStdKeyApplicationE, ENop, Key_LaunchE}, + {EKeyApplicationF, EStdKeyApplicationF, ENop, Key_LaunchF}, + {EKeyApplication19, EStdKeyApplication19, ENop, Key_CameraFocus}, + {EKeyYes, EStdKeyYes, ENop, Key_Yes}, + {EKeyNo, EStdKeyNo, ENop, Key_No}, + {EKeyDevice20, EStdKeyDevice20, ERemConCoreApiPausePlayFunction, Key_MediaTogglePlayPause}, + {EKeyDevice21, EStdKeyDevice21, ERemConCoreApiRewind, Key_AudioRewind}, + {EKeyDevice22, EStdKeyDevice22, ERemConCoreApiFastForward, Key_AudioForward}, + {TKeyCode(0), TStdScanCode(0), ENop, Qt::Key(0)} }; int QKeyMapperPrivate::mapS60KeyToQt(TUint s60key) @@ -228,6 +235,30 @@ int QKeyMapperPrivate::mapQtToS60ScanCodes(int qtKey) return res; } +int QKeyMapperPrivate::mapS60RemConIdToS60Key(int s60RemConId) +{ + int res = KErrUnknown; + for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) { + if (keyMapping[i].s60RemConId == s60RemConId) { + res = keyMapping[i].s60KeyCode; + break; + } + } + return res; +} + +int QKeyMapperPrivate::mapS60RemConIdToS60ScanCodes(int s60RemConId) +{ + int res = KErrUnknown; + for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) { + if (keyMapping[i].s60RemConId == s60RemConId) { + res = keyMapping[i].s60ScanCode; + break; + } + } + return res; +} + void QKeyMapperPrivate::updateInputLanguage() { #ifdef Q_WS_S60 diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 117b72f..5fc72d4 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -933,7 +933,7 @@ QKeySequence::QKeySequence(const QString &key) } /*! - \since 4.x + \since 4.7 Creates a key sequence from the \a key string based on \a format. */ QKeySequence::QKeySequence(const QString &key, QKeySequence::SequenceFormat format) @@ -1130,7 +1130,7 @@ int QKeySequence::assign(const QString &ks) /*! \fn int QKeySequence::assign(const QString &keys, QKeySequence::SequenceFormat format) - \since 4.x + \since 4.7 Adds the given \a keys to the key sequence (based on \a format). \a keys may contain up to four key codes, provided they are diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp index 0695486..0426226 100644 --- a/src/gui/kernel/qplatformcursor_qpa.cpp +++ b/src/gui/kernel/qplatformcursor_qpa.cpp @@ -53,6 +53,7 @@ QList <QWeakPointer<QPlatformCursor> > QPlatformCursorPrivate::instances; /*! \class QPlatformCursor + \since 4.8 \brief The QPlatformCursor class provides information about pointer device events (movement, buttons), and requests to change @@ -105,6 +106,7 @@ QPlatformCursor::QPlatformCursor(QPlatformScreen *scr ) /*! \class QPlatformCursorImage + \since 4.8 \brief The QPlatformCursorImage class provides a set of graphics intended to be used as cursors. diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp index 482ae68..4ab8dfd 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.cpp +++ b/src/gui/kernel/qplatformwindowformat_qpa.cpp @@ -101,11 +101,11 @@ public: /*! \class QPlatformWindowFormat + \ingroup painting + \since 4.8 \brief The QPlatformWindowFormat class specifies the display format of an OpenGL rendering context and if possible attributes of the corresponding QPlatformWindow. - \ingroup painting - QWidget has a setter and getter function for QPlatformWindowFormat. These functions can be used by the application programmer to signal what kind of format he wants to the window and glcontext should have. However, it is not always possible to fulfill these requirements. The application @@ -937,6 +937,8 @@ void QPlatformWindowFormat::setDefaultFormat(const QPlatformWindowFormat &f) /*! + \since 4.8 + Returns true if all the options of the two QPlatformWindowFormat objects \a a and \a b are equal; otherwise returns false. @@ -960,6 +962,8 @@ bool operator==(const QPlatformWindowFormat& a, const QPlatformWindowFormat& b) /*! + \since 4.8 + Returns false if all the options of the two QPlatformWindowFormat objects \a a and \a b are equal; otherwise returns true. diff --git a/src/gui/kernel/qsizepolicy.qdoc b/src/gui/kernel/qsizepolicy.qdoc index 593560e..7002ed3 100644 --- a/src/gui/kernel/qsizepolicy.qdoc +++ b/src/gui/kernel/qsizepolicy.qdoc @@ -263,6 +263,7 @@ /*! \fn void QSizePolicy::setWidthForHeight(bool dependent) + \since 4.8 Sets the flag determining whether the widget's width depends on its height, to \a dependent. @@ -276,6 +277,7 @@ /*! \fn bool QSizePolicy::hasWidthForHeight() const + \since 4.8 Returns true if the widget's width depends on its height; otherwise returns false. diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 56c3010..224f574 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -690,6 +690,7 @@ int QWidget::metric(PaintDeviceMetric m) const /*! \preliminary + \since 4.8 Sets the window to be the platform \a window specified. @@ -710,6 +711,7 @@ void QWidget::setPlatformWindow(QPlatformWindow *window) /*! \preliminary + \since 4.8 Returns the QPlatformWindow this widget will be drawn into. */ @@ -724,6 +726,8 @@ QPlatformWindow *QWidget::platformWindow() const } /*! + \since 4.8 + Sets the platform window format for the widget to the \a format specified. */ void QWidget::setPlatformWindowFormat(const QPlatformWindowFormat &format) @@ -743,6 +747,8 @@ void QWidget::setPlatformWindowFormat(const QPlatformWindowFormat &format) } /*! + \since 4.8 + Returns the platform window format for the widget. */ QPlatformWindowFormat QWidget::platformWindowFormat() const diff --git a/src/gui/painting/qbezier_p.h b/src/gui/painting/qbezier_p.h index 399dd89..f1f7eb1 100644 --- a/src/gui/painting/qbezier_p.h +++ b/src/gui/painting/qbezier_p.h @@ -162,27 +162,27 @@ inline void QBezier::coefficients(qreal t, qreal &a, qreal &b, qreal &c, qreal & inline QPointF QBezier::pointAt(qreal t) const { -#if 1 - qreal a, b, c, d; - coefficients(t, a, b, c, d); - return QPointF(a*x1 + b*x2 + c*x3 + d*x4, a*y1 + b*y2 + c*y3 + d*y4); -#else // numerically more stable: + qreal x, y; + qreal m_t = 1. - t; - qreal a = x1*m_t + x2*t; - qreal b = x2*m_t + x3*t; - qreal c = x3*m_t + x4*t; - a = a*m_t + b*t; - b = b*m_t + c*t; - qreal x = a*m_t + b*t; - qreal a = y1*m_t + y2*t; - qreal b = y2*m_t + y3*t; - qreal c = y3*m_t + y4*t; - a = a*m_t + b*t; - b = b*m_t + c*t; - qreal y = a*m_t + b*t; + { + qreal a = x1*m_t + x2*t; + qreal b = x2*m_t + x3*t; + qreal c = x3*m_t + x4*t; + a = a*m_t + b*t; + b = b*m_t + c*t; + x = a*m_t + b*t; + } + { + qreal a = y1*m_t + y2*t; + qreal b = y2*m_t + y3*t; + qreal c = y3*m_t + y4*t; + a = a*m_t + b*t; + b = b*m_t + c*t; + y = a*m_t + b*t; + } return QPointF(x, y); -#endif } inline QPointF QBezier::normalVector(qreal t) const diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index 994986b..147d2ec 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -1611,6 +1611,8 @@ void QX11PaintEnginePrivate::fillPolygon_dev(const QPointF *polygonPoints, int p && (fill.style() != Qt::NoBrush) && ((has_fill_texture && fill.texture().hasAlpha()) || antialias || !solid_fill || has_alpha_pen != has_alpha_brush)) { + tessellator->tessellate((QPointF *)clippedPoints, clippedCount, + mode == QPaintEngine::WindingMode); if (tessellator->size > 0) { XRenderPictureAttributes attrs; attrs.poly_edge = antialias ? PolyEdgeSmooth : PolyEdgeSharp; diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 435e12a..9bd9733 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -6646,6 +6646,10 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti) qreal x = p.x(); qreal y = p.y(); + bool rtl = ti.flags & QTextItem::RightToLeft; + if (rtl) + x += ti.width.toReal(); + int start = 0; int end, i; for (end = 0; end < ti.glyphs.numGlyphs; ++end) { @@ -6662,14 +6666,19 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti) ti2.width += ti.glyphs.effectiveAdvance(i); } + if (rtl) + x -= ti2.width.toReal(); + d->engine->drawTextItem(QPointF(x, y), ti2); + if (!rtl) + x += ti2.width.toReal(); + // reset the high byte for all glyphs and advance to the next sub-string const int hi = which << 24; for (i = start; i < end; ++i) { glyphs.glyphs[i] = hi | glyphs.glyphs[i]; } - x += ti2.width.toReal(); // change engine start = end; @@ -6684,6 +6693,9 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti) ti2.width += ti.glyphs.effectiveAdvance(i); } + if (rtl) + x -= ti2.width.toReal(); + if (d->extended) d->extended->drawTextItem(QPointF(x, y), ti2); else diff --git a/src/gui/painting/qprinterinfo.cpp b/src/gui/painting/qprinterinfo.cpp index a7ddc85..c00a1cc 100644 --- a/src/gui/painting/qprinterinfo.cpp +++ b/src/gui/painting/qprinterinfo.cpp @@ -79,6 +79,8 @@ QPrinterInfo::QPrinterInfo() } /*! + \since 4.8 + Constructs a copy of \a other. */ QPrinterInfo::QPrinterInfo(const QPrinterInfo &other) @@ -117,6 +119,8 @@ QPrinterInfo::~QPrinterInfo() } /*! + \since 4.8 + Sets the QPrinterInfo object to be equal to \a other. */ QPrinterInfo &QPrinterInfo::operator=(const QPrinterInfo &other) diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index fdba9c9..3973abd 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -198,7 +198,7 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const Coord c = { 0, 0, // will be filled in later glyph_width, glyph_height, // texture coords - metrics.x.round().truncate(), + metrics.x.truncate(), -metrics.y.truncate() }; // baseline for horizontal scripts listItemCoordinates.insert(key, c); @@ -367,9 +367,7 @@ void QImageTextureGlyphCache::createTextureData(int width, int height) int QImageTextureGlyphCache::glyphMargin() const { -#if (defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) - return 1; -#elif defined(Q_WS_X11) +#if (defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) || defined(Q_WS_X11) return 0; #else return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0; diff --git a/src/gui/s60framework/qs60keycapture.cpp b/src/gui/s60framework/qs60keycapture.cpp new file mode 100644 index 0000000..415c3e1 --- /dev/null +++ b/src/gui/s60framework/qs60keycapture.cpp @@ -0,0 +1,308 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <remconinterfaceselector.h> +#include <remconcoreapitarget.h> +#include <coemain.h> +#include "qkeymapper_p.h" +#include "qs60keycapture_p.h" + +QT_BEGIN_NAMESPACE + +/* + * Helper class for sending key handling responses to RemCon. +*/ +class CResponseHandler : public CActive +{ +public: + static CResponseHandler *NewL(CRemConCoreApiTarget &remConCoreApiTarget); + virtual ~CResponseHandler(); + void CompleteAnyKey(TRemConCoreApiOperationId operationId); + +private: + CResponseHandler(CRemConCoreApiTarget &remConCoreApiTarget); + + void RunL(); + void DoCancel(); + +private: + RArray<TRemConCoreApiOperationId> iResponseArray; + CRemConCoreApiTarget &iRemConCoreApiTarget; +}; + +CResponseHandler::CResponseHandler(CRemConCoreApiTarget &remConCoreApiTarget) + : CActive(CActive::EPriorityStandard), + iRemConCoreApiTarget(remConCoreApiTarget) +{ + CActiveScheduler::Add(this); +} + +CResponseHandler *CResponseHandler::NewL(CRemConCoreApiTarget &remConCoreApiTarget) +{ + CResponseHandler *self = + new (ELeave) CResponseHandler(remConCoreApiTarget); + return self; +} + +CResponseHandler::~CResponseHandler() +{ + Cancel(); + iResponseArray.Close(); +} + +void CResponseHandler::CompleteAnyKey(TRemConCoreApiOperationId operationId) +{ + if (!IsActive()) { + TInt error = KErrNone; + iRemConCoreApiTarget.SendResponse(iStatus, operationId, error); + SetActive(); + } else { + // already active. Append to array and complete later. + iResponseArray.Append(operationId); + } +} + +void CResponseHandler::DoCancel() +{ + iRemConCoreApiTarget.Cancel(); +} + +void CResponseHandler::RunL() +{ + // if any existing -> Send response + if (iResponseArray.Count()) { + CompleteAnyKey(iResponseArray[0]); + // Remove already completed key + iResponseArray.Remove(0); + iResponseArray.Compress(); + } +} + + +/* + * QS60KeyCapture provides media key handling using services from RemCon. + */ +QS60KeyCapture::QS60KeyCapture(CCoeEnv *env, QObject *parent): + QObject(parent), coeEnv(env), selector(0), target(0), handler(0) +{ + initRemCon(); + + TTimeIntervalMicroSeconds32 initialTime; + TTimeIntervalMicroSeconds32 time; + coeEnv->WsSession().GetKeyboardRepeatRate(initialTime, time); + initialRepeatTime = (initialTime.Int() / 1000); // msecs + repeatTime = (time.Int() / 1000); // msecs + + int clickTimeout = initialRepeatTime + repeatTime; + + volumeUpClickTimer.setSingleShot(true); + volumeDownClickTimer.setSingleShot(true); + repeatTimer.setSingleShot(true); + + volumeUpClickTimer.setInterval(clickTimeout); + volumeDownClickTimer.setInterval(clickTimeout); + repeatTimer.setInterval(initialRepeatTime); + + connect(&volumeUpClickTimer, SIGNAL(timeout()), this, SLOT(volumeUpClickTimerExpired())); + connect(&volumeDownClickTimer, SIGNAL(timeout()), this, SLOT(volumeDownClickTimerExpired())); + connect(&repeatTimer, SIGNAL(timeout()), this, SLOT(repeatTimerExpired())); +} + +/* + * Initializes RemCon connection for receiving key events + */ +void QS60KeyCapture::initRemCon() +{ + try { + QT_TRAP_THROWING( + selector = CRemConInterfaceSelector::NewL(); + target = CRemConCoreApiTarget::NewL(*selector, *this); + handler = CResponseHandler::NewL(*target); + selector->OpenTargetL()); + } catch (const std::exception &e) { + delete handler; + delete selector; + selector = 0; + target = 0; + handler = 0; + } +} + +QS60KeyCapture::~QS60KeyCapture() +{ + delete handler; + delete selector; +} + +void QS60KeyCapture::MrccatoCommand(TRemConCoreApiOperationId operationId, + TRemConCoreApiButtonAction buttonAction) +{ + if (!target) + return; + + switch (operationId) { + // Volume up/down keys auto repeat if user hold the key long enough + case ERemConCoreApiVolumeUp: + case ERemConCoreApiVolumeDown: + { + // Side key events are sent using following scheme: + // - ButtonClick is sent first + // - if nothing happens before repeat timer expires, no further events are generated + // - if user holds the button longer, ButtonPress is sent and + // when button is finally released ButtonRelease is sent. + + QTimer &timer = (operationId == ERemConCoreApiVolumeUp) ? volumeUpClickTimer : volumeDownClickTimer; + + switch (buttonAction) { + case ERemConCoreApiButtonPress: + if (timer.isActive()) { + timer.stop(); + // force repeat event + repeatKeyEvent = mapToKeyEvent(operationId); + repeatTimerExpired(); + } else { + sendKey(operationId, QEvent::KeyPress); + repeatTimer.start(initialRepeatTime); + } + break; + case ERemConCoreApiButtonRelease: + timer.stop(); + sendKey(operationId, QEvent::KeyRelease); + repeatTimer.stop(); + break; + case ERemConCoreApiButtonClick: + if (timer.isActive()) { + timer.stop(); + sendKey(operationId, QEvent::KeyRelease); + } + sendKey(operationId, QEvent::KeyPress); + timer.start(); + repeatTimer.stop(); + break; + default: + break; + } + } + break; + default: + switch (buttonAction) { + case ERemConCoreApiButtonPress: + sendKey(operationId, QEvent::KeyPress); + repeatTimer.start(initialRepeatTime); + break; + case ERemConCoreApiButtonRelease: + sendKey(operationId, QEvent::KeyRelease); + repeatTimer.stop(); + break; + case ERemConCoreApiButtonClick: + sendKey(operationId, QEvent::KeyPress); + sendKey(operationId, QEvent::KeyRelease); + repeatTimer.stop(); + break; + default: + break; + } + break; + } + + if (handler) + handler->CompleteAnyKey(operationId); +} + +/* + * Sends volume up KeyRelease event + */ +void QS60KeyCapture::volumeUpClickTimerExpired() +{ + sendKey(ERemConCoreApiVolumeUp, QEvent::KeyRelease); +} + +/* + * Sends volume down KeyRelease event + */ +void QS60KeyCapture::volumeDownClickTimerExpired() +{ + sendKey(ERemConCoreApiVolumeDown, QEvent::KeyRelease); +} + +/* + * Repeats last key event + */ +void QS60KeyCapture::repeatTimerExpired() +{ + // set auto repeat flag on + repeatKeyEvent.iRepeats = 1; + coeEnv->SimulateKeyEventL(repeatKeyEvent, EEventKey); + repeatTimer.start(repeatTime); +} + +/* + * Maps RemCon operation id to key event (includes key code and scan codes) + */ +TKeyEvent QS60KeyCapture::mapToKeyEvent(TRemConCoreApiOperationId operationId) +{ + TKeyEvent keyEvent; + keyEvent.iModifiers = 0; + keyEvent.iRepeats = 0; + keyEvent.iCode = qt_keymapper_private()->mapS60RemConIdToS60Key(operationId); + keyEvent.iScanCode = qt_keymapper_private()->mapS60RemConIdToS60ScanCodes(operationId); + return keyEvent; +} + +/* + * Delivers key events to the application. + * RemCon operations are converted to simulated key events + */ +void QS60KeyCapture::sendKey(TRemConCoreApiOperationId operationId, QEvent::Type type) +{ + TKeyEvent keyEvent = mapToKeyEvent(operationId); + + if (type == QEvent::KeyPress) { + coeEnv->SimulateKeyEventL(keyEvent, EEventKeyDown); + coeEnv->SimulateKeyEventL(keyEvent, EEventKey); + // save the key press event for repeats + repeatKeyEvent = keyEvent; + } else { + coeEnv->SimulateKeyEventL(keyEvent, EEventKeyUp); + } +} + +QT_END_NAMESPACE diff --git a/src/gui/s60framework/qs60keycapture_p.h b/src/gui/s60framework/qs60keycapture_p.h new file mode 100644 index 0000000..a50fad7 --- /dev/null +++ b/src/gui/s60framework/qs60keycapture_p.h @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QS60KEYCAPTURE_P_H +#define QS60KEYCAPTURE_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 <QtCore/qglobal.h> + +#ifdef Q_OS_SYMBIAN + +#include <QObject> +#include <QEvent> +#include <QTimer> +#include <remconcoreapitargetobserver.h> +#include <w32std.h> + +class CRemConInterfaceSelector; +class CRemConCoreApiTarget; +class CResponseHandler; +class CCoeEnv; + +QT_BEGIN_NAMESPACE + +class QS60KeyCapture: public QObject, + public MRemConCoreApiTargetObserver +{ + Q_OBJECT +public: + QS60KeyCapture(CCoeEnv *env, QObject *parent = 0); + ~QS60KeyCapture(); + + void MrccatoCommand(TRemConCoreApiOperationId operationId, + TRemConCoreApiButtonAction buttonAct); + +private slots: + void volumeUpClickTimerExpired(); + void volumeDownClickTimerExpired(); + void repeatTimerExpired(); + +private: + void sendKey(TRemConCoreApiOperationId operationId, QEvent::Type type); + TKeyEvent mapToKeyEvent(TRemConCoreApiOperationId operationId); + void initRemCon(); + +private: + QS60KeyCapture(); + Q_DISABLE_COPY(QS60KeyCapture) + + CCoeEnv *coeEnv; + + CRemConInterfaceSelector *selector; + CRemConCoreApiTarget *target; + CResponseHandler *handler; + + QTimer volumeUpClickTimer; + QTimer volumeDownClickTimer; + + TKeyEvent repeatKeyEvent; + int initialRepeatTime; // time before first repeat key event + int repeatTime; // time between subsequent repeat key events + QTimer repeatTimer; +}; + +QT_END_NAMESPACE + +#endif // Q_OS_SYMBIAN +#endif // QS60KEYCAPTURE_P_H diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index ec97f7b..bd3017c 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -59,6 +59,7 @@ #include <private/qmenu_p.h> #include <private/qt_s60_p.h> #include <qdebug.h> +#include "qs60keycapture_p.h" //Animated wallpapers in Qt applications are not supported. const TInt KAknDisableAnimationBackground = 0x02000000; @@ -66,6 +67,20 @@ const TInt KAknSingleClickCompatible = 0x01000000; QT_BEGIN_NAMESPACE +static QS60KeyCapture *qt_S60KeyCapture = 0; + +static void installS60KeyCapture(CCoeEnv *env) +{ + if (QApplication::testAttribute(Qt::AA_CaptureMultimediaKeys)) + qt_S60KeyCapture = new QS60KeyCapture(env); +} + +static void removeS60KeyCapture() +{ + delete qt_S60KeyCapture; + qt_S60KeyCapture = 0; +} + /*! \class QS60MainAppUi \since 4.6 @@ -127,6 +142,7 @@ void QS60MainAppUi::ConstructL() } #endif BaseConstructL(flags); + installS60KeyCapture(iCoeEnv); } /*! @@ -142,6 +158,7 @@ QS60MainAppUi::QS60MainAppUi() */ QS60MainAppUi::~QS60MainAppUi() { + removeS60KeyCapture(); } /*! diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri index 19525b7..e30d2c0 100644 --- a/src/gui/s60framework/s60framework.pri +++ b/src/gui/s60framework/s60framework.pri @@ -1,10 +1,13 @@ SOURCES += s60framework/qs60mainapplication.cpp \ - s60framework/qs60mainappui.cpp \ - s60framework/qs60maindocument.cpp - -HEADERS += s60framework/qs60mainapplication_p.h \ - s60framework/qs60mainapplication.h \ - s60framework/qs60mainappui.h \ - s60framework/qs60maindocument.h - -!isEmpty(QT_LIBINFIX): DEFINES += QT_LIBINFIX_UNQUOTED=$$QT_LIBINFIX
\ No newline at end of file + s60framework/qs60mainappui.cpp \ + s60framework/qs60maindocument.cpp \ + s60framework/qs60keycapture.cpp +HEADERS += qs60keycapture_p.h \ + s60framework/qs60mainapplication_p.h \ + s60framework/qs60mainapplication.h \ + s60framework/qs60mainappui.h \ + s60framework/qs60maindocument.h \ + s60framework/qs60keycapture_p.h +LIBS += -lremconcoreapi \ + -lremconinterfacebase +!isEmpty(QT_LIBINFIX):DEFINES += QT_LIBINFIX_UNQUOTED=$$QT_LIBINFIX diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 40c28f6..8436856 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -1195,15 +1195,15 @@ QRect QMacStylePrivate::comboboxEditBounds(const QRect &outerBounds, const HIThe QRect ret = outerBounds; switch (bdi.kind){ case kThemeComboBox: - ret.adjust(5, 8, -21, -4); + ret.adjust(5, 8, -22, -4); break; case kThemeComboBoxSmall: - ret.adjust(4, 5, -18, 0); - ret.setHeight(16); + ret.adjust(4, 6, -20, 0); + ret.setHeight(14); break; case kThemeComboBoxMini: - ret.adjust(4, 5, -16, 0); - ret.setHeight(13); + ret.adjust(4, 5, -18, -1); + ret.setHeight(12); break; case kThemePopupButton: ret.adjust(10, 3, -23, -3); @@ -3681,9 +3681,27 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter proxy()->drawItemText(p, nr, alignment, np, tab->state & State_Enabled, tab->text, QPalette::WindowText); p->restore(); - } + QCommonStyle::drawControl(ce, &myTab, p, w); + } else if (qMacVersion() >= QSysInfo::MV_10_7 && (tab->state & State_Selected)) { + p->save(); + rotateTabPainter(p, myTab.shape, myTab.rect); - QCommonStyle::drawControl(ce, &myTab, p, w); + QPalette np = tab->palette; + np.setColor(QPalette::WindowText, QColor(0, 0, 0, 75)); + QRect nr = subElementRect(SE_TabBarTabText, opt, w); + nr.moveTop(-1); + int alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextHideMnemonic; + proxy()->drawItemText(p, nr, alignment, np, tab->state & State_Enabled, + tab->text, QPalette::WindowText); + + np.setColor(QPalette::WindowText, QColor(255, 255, 255, 255)); + nr.moveTop(-2); + proxy()->drawItemText(p, nr, alignment, np, tab->state & State_Enabled, + tab->text, QPalette::WindowText); + p->restore(); + } else { + QCommonStyle::drawControl(ce, &myTab, p, w); + } } else { p->save(); CGContextSetShouldAntialias(cg, true); @@ -4707,7 +4725,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex HIThemeFrameDrawInfo fdi; fdi.version = qt_mac_hitheme_version; - fdi.state = tds; + fdi.state = ((sb->state & State_ReadOnly) || !(sb->state & State_Enabled)) ? kThemeStateInactive : kThemeStateActive; fdi.kind = kHIThemeFrameTextFieldSquare; fdi.isFocused = false; HIRect hirect = qt_hirectForQRect(lineeditRect); diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index b0ea0d1..e9f7a86 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -141,6 +141,7 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme {SE_Editor, QS60StyleEnums::SP_QsnFrInputCenter}, {SE_TableItemPressed, QS60StyleEnums::SP_QsnFrGridCenterPressed}, {SE_ListItemPressed, QS60StyleEnums::SP_QsnFrListCenterPressed}, + {SE_DialogBackground, QS60StyleEnums::SP_QsnFrPopupCenter}, }; static const int frameElementsCount = @@ -263,6 +264,9 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, case SE_PopupBackground: drawFrame(SF_PopupBackground, painter, rect, flags | SF_PointNorth); break; + case SE_DialogBackground: + drawFrame(SF_DialogBackground, painter, rect, flags | SF_PointNorth); + break; case SE_SettingsList: drawFrame(SF_SettingsList, painter, rect, flags | SF_PointNorth); break; @@ -497,8 +501,10 @@ bool QS60StylePrivate::equalToThemePalette(qint64 cacheKey, QPalette::ColorRole { if (!m_themePalette) return false; - if (cacheKey == m_themePalette->brush(role).texture().cacheKey()) + if ((m_placeHolderTexture && (cacheKey == m_placeHolderTexture->cacheKey())) + || (cacheKey == m_themePalette->brush(role).texture().cacheKey())) return true; + return false; } @@ -2261,10 +2267,14 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget) && QS60StylePrivate::equalToThemePalette(option->palette.window().texture().cacheKey(), QPalette::Window)) { const bool comboMenu = qobject_cast<const QComboBoxListView *>(widget); + const bool menu = qobject_cast<const QMenu *>(widget); // Add margin area to the background, to avoid background being cut for first and last item. const int verticalMenuAdjustment = comboMenu ? QS60StylePrivate::pixelMetric(PM_MenuVMargin) : 0; const QRect adjustedMenuRect = option->rect.adjusted(0, -verticalMenuAdjustment, 0, verticalMenuAdjustment); - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PopupBackground, painter, adjustedMenuRect, flags); + if (comboMenu || menu) + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PopupBackground, painter, adjustedMenuRect, flags); + else + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_DialogBackground, painter, adjustedMenuRect, flags); } else { commonStyleDraws = true; } @@ -3345,6 +3355,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 +3431,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_p.h b/src/gui/styles/qs60style_p.h index 62c4b00..2fa8c7f 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 { @@ -445,6 +541,7 @@ public: SE_DropArea, SE_TableItemPressed, SE_ListItemPressed, + SE_DialogBackground, }; enum SkinFrameElements { @@ -464,6 +561,7 @@ public: SF_ButtonInactive, SF_TableItemPressed, SF_ListItemPressed, + SF_DialogBackground, }; enum SkinElementFlag { diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 14fdbd3..913352a 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -413,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( @@ -1060,6 +1160,10 @@ void QS60StyleModeSpecifics::frameIdAndCenterId(QS60StylePrivate::SkinFrameEleme centerId.Set(KAknsIIDQsnFrPopupCenterSubmenu); frameId.Set(KAknsIIDQsnFrPopupSub); break; + case QS60StylePrivate::SF_DialogBackground: + centerId.Set(KAknsIIDQsnFrPopupCenter); + frameId.Set(KAknsIIDQsnFrPopup); + break; case QS60StylePrivate::SF_SettingsList: // Starting from S60_5_3, the root theme has been changed so that KAknsIIDQsnFrSetOpt is empty. // Set the theme ID to None, to avoid theme server trying to draw the empty frame. diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 98186df..3762f39 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -218,16 +218,14 @@ struct QtFontStyle Key(const QString &styleString); Key() : style(QFont::StyleNormal), weight(QFont::Normal), stretch(0) { } - Key(const Key &o) : style(o.style), - weight(o.weight), stretch(o.stretch) { } + Key(const Key &o) : style(o.style), weight(o.weight), stretch(o.stretch) { } uint style : 2; signed int weight : 8; signed int stretch : 12; bool operator==(const Key & other) { - return (style == other.style && - weight == other.weight && - (stretch == 0 || other.stretch == 0 || stretch == other.stretch)); + return (style == other.style && weight == other.weight && + (stretch == 0 || other.stretch == 0 || stretch == other.stretch)); } bool operator!=(const Key &other) { return !operator==(other); @@ -279,6 +277,7 @@ struct QtFontStyle bool smoothScalable : 1; signed int count : 30; QtFontSize *pixelSizes; + QString styleName; #ifdef Q_WS_X11 const char *weightName; @@ -353,13 +352,20 @@ struct QtFontFoundry int count; QtFontStyle **styles; - QtFontStyle *style(const QtFontStyle::Key &, bool = false); + QtFontStyle *style(const QtFontStyle::Key &, const QString & = QString(), bool = false); }; -QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, bool create) +QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, const QString &styleName, bool create) { int pos = 0; if (count) { + // if styleName for searching first if possible + if (!styleName.isEmpty()) { + for (; pos < count; pos++) { + if (styles[pos]->styleName == styleName) + return styles[pos]; + } + } int low = 0; int high = count; pos = count / 2; @@ -386,6 +392,7 @@ QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, bool create) } QtFontStyle *style = new QtFontStyle(key); + style->styleName = styleName; memmove(styles + pos + 1, styles + pos, (count-pos)*sizeof(QtFontStyle *)); styles[pos] = style; count++; @@ -814,7 +821,7 @@ void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundr } QtFontFoundry *foundry = f->foundry(QString::fromLatin1(foundryname), true); - QtFontStyle *style = foundry->style(styleKey, true); + QtFontStyle *style = foundry->style(styleKey, QString(), true); style->smoothScalable = (pixelSize == 0); style->antialiased = antialiased; QtFontSize *size = style->pixelSize(pixelSize?pixelSize:SMOOTH_SCALABLE, true); @@ -1131,7 +1138,8 @@ QString QFontDatabase::resolveFontFamilyAlias(const QString &family) #endif QT_END_INCLUDE_NAMESPACE -static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey) +static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey, + const QString &styleName = QString()) { int best = 0; int dist = 0xffff; @@ -1139,6 +1147,12 @@ static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &st for ( int i = 0; i < foundry->count; i++ ) { QtFontStyle *style = foundry->styles[i]; + if (!styleName.isEmpty() && styleName == style->styleName) { + dist = 0; + best = i; + break; + } + int d = qAbs( styleKey.weight - style->key.weight ); if ( styleKey.stretch != 0 && style->key.stretch != 0 ) { @@ -1532,7 +1546,8 @@ static QString styleStringHelper(int weight, QFont::Style style) */ QString QFontDatabase::styleString(const QFont &font) { - return styleStringHelper(font.weight(), font.style()); + return font.styleName().isEmpty() ? styleStringHelper(font.weight(), font.style()) + : font.styleName(); } /*! @@ -1542,7 +1557,8 @@ QString QFontDatabase::styleString(const QFont &font) */ QString QFontDatabase::styleString(const QFontInfo &fontInfo) { - return styleStringHelper(fontInfo.weight(), fontInfo.style()); + return fontInfo.styleName().isEmpty() ? styleStringHelper(fontInfo.weight(), fontInfo.style()) + : fontInfo.styleName(); } @@ -1788,13 +1804,17 @@ QStringList QFontDatabase::styles(const QString &family) const for (int k = 0; k < foundry->count; k++) { QtFontStyle::Key ke(foundry->styles[k]->key); ke.stretch = 0; - allStyles.style(ke, true); + allStyles.style(ke, foundry->styles[k]->styleName, true); } } } - for (int i = 0; i < allStyles.count; i++) - l.append(styleStringHelper(allStyles.styles[i]->key.weight, (QFont::Style)allStyles.styles[i]->key.style)); + for (int i = 0; i < allStyles.count; i++) { + l.append(allStyles.styles[i]->styleName.isEmpty() ? + styleStringHelper(allStyles.styles[i]->key.weight, + (QFont::Style)allStyles.styles[i]->key.style) : + allStyles.styles[i]->styleName); + } return l; } @@ -1852,7 +1872,9 @@ bool QFontDatabase::isBitmapScalable(const QString &family, QtFontFoundry *foundry = f->foundries[j]; if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { for (int k = 0; k < foundry->count; k++) - if ((style.isEmpty() || foundry->styles[k]->key == styleKey) + if ((style.isEmpty() || + foundry->styles[k]->styleName == style || + foundry->styles[k]->key == styleKey) && foundry->styles[k]->bitmapScalable && !foundry->styles[k]->smoothScalable) { bitmapScalable = true; goto end; @@ -1891,7 +1913,9 @@ bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &sty QtFontFoundry *foundry = f->foundries[j]; if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { for (int k = 0; k < foundry->count; k++) - if ((style.isEmpty() || foundry->styles[k]->key == styleKey) && foundry->styles[k]->smoothScalable) { + if ((style.isEmpty() || + foundry->styles[k]->styleName == style || + foundry->styles[k]->key == styleKey) && foundry->styles[k]->smoothScalable) { smoothScalable = true; goto end; } @@ -1924,12 +1948,12 @@ bool QFontDatabase::isScalable(const QString &family, \sa smoothSizes(), standardSizes() */ QList<int> QFontDatabase::pointSizes(const QString &family, - const QString &style) + const QString &styleName) { #if defined(Q_WS_WIN) // windows and macosx are always smoothly scalable Q_UNUSED(family); - Q_UNUSED(style); + Q_UNUSED(styleName); return standardSizes(); #else bool smoothScalable = false; @@ -1940,7 +1964,7 @@ QList<int> QFontDatabase::pointSizes(const QString &family, QT_PREPEND_NAMESPACE(load)(familyName); - QtFontStyle::Key styleKey(style); + QtFontStyle::Key styleKey(styleName); QList<int> sizes; @@ -1957,7 +1981,7 @@ QList<int> QFontDatabase::pointSizes(const QString &family, for (int j = 0; j < fam->count; j++) { QtFontFoundry *foundry = fam->foundries[j]; if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { - QtFontStyle *style = foundry->style(styleKey); + QtFontStyle *style = foundry->style(styleKey, styleName); if (!style) continue; if (style->smoothScalable) { @@ -2008,17 +2032,20 @@ QFont QFontDatabase::font(const QString &family, const QString &style, QtFontFoundry *foundry = f->foundries[j]; if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { for (int k = 0; k < foundry->count; k++) - allStyles.style(foundry->styles[k]->key, true); + allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true); } } QtFontStyle::Key styleKey(style); - QtFontStyle *s = bestStyle(&allStyles, styleKey); + QtFontStyle *s = bestStyle(&allStyles, styleKey, style); if (!s) // no styles found? return QApplication::font(); + QFont fnt(family, pointSize, s->key.weight); fnt.setStyle((QFont::Style)s->key.style); + if (!s->styleName.isEmpty()) + fnt.setStyleName(s->styleName); return fnt; } @@ -2032,11 +2059,11 @@ QFont QFontDatabase::font(const QString &family, const QString &style, \sa pointSizes(), standardSizes() */ QList<int> QFontDatabase::smoothSizes(const QString &family, - const QString &style) + const QString &styleName) { #ifdef Q_WS_WIN Q_UNUSED(family); - Q_UNUSED(style); + Q_UNUSED(styleName); return QFontDatabase::standardSizes(); #else bool smoothScalable = false; @@ -2047,7 +2074,7 @@ QList<int> QFontDatabase::smoothSizes(const QString &family, QT_PREPEND_NAMESPACE(load)(familyName); - QtFontStyle::Key styleKey(style); + QtFontStyle::Key styleKey(styleName); QList<int> sizes; @@ -2064,7 +2091,7 @@ QList<int> QFontDatabase::smoothSizes(const QString &family, for (int j = 0; j < fam->count; j++) { QtFontFoundry *foundry = fam->foundries[j]; if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { - QtFontStyle *style = foundry->style(styleKey); + QtFontStyle *style = foundry->style(styleKey, styleName); if (!style) continue; if (style->smoothScalable) { @@ -2131,12 +2158,12 @@ bool QFontDatabase::italic(const QString &family, const QString &style) const QtFontFoundry *foundry = f->foundries[j]; if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { for (int k = 0; k < foundry->count; k++) - allStyles.style(foundry->styles[k]->key, true); + allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true); } } QtFontStyle::Key styleKey(style); - QtFontStyle *s = allStyles.style(styleKey); + QtFontStyle *s = allStyles.style(styleKey, style); return s && s->key.style == QFont::StyleItalic; } @@ -2166,12 +2193,12 @@ bool QFontDatabase::bold(const QString &family, if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { for (int k = 0; k < foundry->count; k++) - allStyles.style(foundry->styles[k]->key, true); + allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true); } } QtFontStyle::Key styleKey(style); - QtFontStyle *s = allStyles.style(styleKey); + QtFontStyle *s = allStyles.style(styleKey, style); return s && s->key.weight >= QFont::Bold; } @@ -2202,12 +2229,12 @@ int QFontDatabase::weight(const QString &family, if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { for (int k = 0; k < foundry->count; k++) - allStyles.style(foundry->styles[k]->key, true); + allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true); } } QtFontStyle::Key styleKey(style); - QtFontStyle *s = allStyles.style(styleKey); + QtFontStyle *s = allStyles.style(styleKey, style); return s ? s->key.weight : -1; } diff --git a/src/gui/text/qfontdatabase_mac.cpp b/src/gui/text/qfontdatabase_mac.cpp index 60cf586..fc8247d 100644 --- a/src/gui/text/qfontdatabase_mac.cpp +++ b/src/gui/text/qfontdatabase_mac.cpp @@ -106,12 +106,14 @@ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) { CTFontDescriptorRef font = (CTFontDescriptorRef)CFArrayGetValueAtIndex(fonts, i); QCFString family_name = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute); + QCFString style_name = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontStyleNameAttribute); QtFontFamily *family = db->family(family_name, true); for(int ws = 1; ws < QFontDatabase::WritingSystemsCount; ++ws) family->writingSystems[ws] = QtFontFamily::Supported; QtFontFoundry *foundry = family->foundry(foundry_name, true); QtFontStyle::Key styleKey; + QString styleName = style_name; if(QCFType<CFDictionaryRef> styles = (CFDictionaryRef)CTFontDescriptorCopyAttribute(font, kCTFontTraitsAttribute)) { if(CFNumberRef weight = (CFNumberRef)CFDictionaryGetValue(styles, kCTFontWeightTrait)) { Q_ASSERT(CFNumberIsFloatType(weight)); @@ -132,7 +134,7 @@ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) { } } - QtFontStyle *style = foundry->style(styleKey, true); + QtFontStyle *style = foundry->style(styleKey, styleName, true); style->smoothScalable = true; if(QCFType<CFNumberRef> size = (CFNumberRef)CTFontDescriptorCopyAttribute(font, kCTFontSizeAttribute)) { //qDebug() << "WHEE"; @@ -205,7 +207,7 @@ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) { QtFontFamily *family = db->family(familyName, true); QtFontFoundry *foundry = family->foundry(QString(), true); - QtFontStyle *style = foundry->style(styleKey, true); + QtFontStyle *style = foundry->style(styleKey, QString(), true); style->pixelSize(0, true); style->smoothScalable = true; diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index fd5c6b4..6b6f4f1 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -73,7 +73,7 @@ Q_GUI_EXPORT void qt_registerFont(const QString &familyName, const QString &fou } QtFontFoundry *foundry = f->foundry(foundryname, true); - QtFontStyle *fontStyle = foundry->style(styleKey, true); + QtFontStyle *fontStyle = foundry->style(styleKey, QString(), true); fontStyle->smoothScalable = scalable; fontStyle->antialiased = antialiased; QtFontSize *size = fontStyle->pixelSize(pixelSize?pixelSize:SMOOTH_SCALABLE, true); diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 980b5de..2f4d055 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -508,7 +508,7 @@ static bool registerScreenDeviceFont(int screenDeviceFontIndex, QtFontFamily *family = privateDb()->family(familyName, true); family->fixedPitch = faceAttrib.IsMonoWidth(); QtFontFoundry *foundry = family->foundry(QString(), true); - QtFontStyle *style = foundry->style(styleKey, true); + QtFontStyle *style = foundry->style(styleKey, QString(), true); style->smoothScalable = typefaceSupport.iIsScalable; style->pixelSize(0, true); diff --git a/src/gui/text/qfontdatabase_win.cpp b/src/gui/text/qfontdatabase_win.cpp index 20f945a..788eb30 100644 --- a/src/gui/text/qfontdatabase_win.cpp +++ b/src/gui/text/qfontdatabase_win.cpp @@ -284,7 +284,7 @@ void addFontToDatabase(QString familyName, const QString &scriptName, family->english_name = getEnglishName(familyName); QtFontFoundry *foundry = family->foundry(foundryName, true); - QtFontStyle *style = foundry->style(styleKey, true); + QtFontStyle *style = foundry->style(styleKey, QString(), true); style->smoothScalable = scalable; style->pixelSize( size, TRUE); @@ -292,14 +292,14 @@ void addFontToDatabase(QString familyName, const QString &scriptName, if (styleKey.weight <= QFont::DemiBold) { QtFontStyle::Key key(styleKey); key.weight = QFont::Bold; - QtFontStyle *style = foundry->style(key, true); + QtFontStyle *style = foundry->style(key, QString(), true); style->smoothScalable = scalable; style->pixelSize( size, TRUE); } if (styleKey.style != QFont::StyleItalic) { QtFontStyle::Key key(styleKey); key.style = QFont::StyleItalic; - QtFontStyle *style = foundry->style(key, true); + QtFontStyle *style = foundry->style(key, QString(), true); style->smoothScalable = scalable; style->pixelSize( size, TRUE); } @@ -307,7 +307,7 @@ void addFontToDatabase(QString familyName, const QString &scriptName, QtFontStyle::Key key(styleKey); key.weight = QFont::Bold; key.style = QFont::StyleItalic; - QtFontStyle *style = foundry->style(key, true); + QtFontStyle *style = foundry->style(key, QString(), true); style->smoothScalable = scalable; style->pixelSize( size, TRUE); } diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index 958daa2..922a97f 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -680,7 +680,7 @@ static void loadXlfds(const char *reqFamily, int encoding_id) family->fontFileIndex = -1; family->symbol_checked = true; QtFontFoundry *foundry = family->foundry(QLatin1String(foundryName), true); - QtFontStyle *style = foundry->style(styleKey, true); + QtFontStyle *style = foundry->style(styleKey, QString(), true); delete [] style->weightName; style->weightName = qstrdup(tokens[Weight]); @@ -1034,13 +1034,14 @@ static void loadFontConfig() FcChar8 *file_value; int index_value; FcChar8 *foundry_value; + FcChar8 *style_value; FcBool scalable; { FcObjectSet *os = FcObjectSetCreate(); FcPattern *pattern = FcPatternCreate(); const char *properties [] = { - FC_FAMILY, FC_WEIGHT, FC_SLANT, + FC_FAMILY, FC_STYLE, FC_WEIGHT, FC_SLANT, FC_SPACING, FC_FILE, FC_INDEX, FC_LANG, FC_CHARSET, FC_FOUNDRY, FC_SCALABLE, FC_PIXEL_SIZE, FC_WEIGHT, FC_WIDTH, @@ -1085,6 +1086,8 @@ static void loadFontConfig() scalable = FcTrue; if (FcPatternGetString(fonts->fonts[i], FC_FOUNDRY, 0, &foundry_value) != FcResultMatch) foundry_value = 0; + if (FcPatternGetString(fonts->fonts[i], FC_STYLE, 0, &style_value) != FcResultMatch) + style_value = 0; QtFontFamily *family = db->family(familyName, true); FcLangSet *langset = 0; @@ -1142,6 +1145,7 @@ static void loadFontConfig() family->fontFileIndex = index_value; QtFontStyle::Key styleKey; + QString styleName = style_value ? QString::fromUtf8((const char *) style_value) : QString(); styleKey.style = (slant_value == FC_SLANT_ITALIC) ? QFont::StyleItalic : ((slant_value == FC_SLANT_OBLIQUE) @@ -1156,7 +1160,7 @@ static void loadFontConfig() QtFontFoundry *foundry = family->foundry(foundry_value ? QString::fromUtf8((const char *)foundry_value) : QString(), true); - QtFontStyle *style = foundry->style(styleKey, true); + QtFontStyle *style = foundry->style(styleKey, styleName, true); if (spacing_value < FC_MONO) family->fixedPitch = false; @@ -1208,7 +1212,7 @@ static void loadFontConfig() for (int i = 0; i < 4; ++i) { styleKey.style = (i%2) ? QFont::StyleNormal : QFont::StyleItalic; styleKey.weight = (i > 1) ? QFont::Bold : QFont::Normal; - QtFontStyle *style = foundry->style(styleKey, true); + QtFontStyle *style = foundry->style(styleKey, QString(), true); style->smoothScalable = true; QtFontSize *size = style->pixelSize(SMOOTH_SCALABLE, true); QtFontEncoding *enc = size->encodingID(-1, 0, 0, 0, 0, true); @@ -1356,7 +1360,7 @@ static void initializeDb() if (equiv) continue; // let's fake one... - equiv = foundry->style(key, true); + equiv = foundry->style(key, QString(), true); equiv->smoothScalable = true; QtFontSize *equiv_size = equiv->pixelSize(SMOOTH_SCALABLE, true); diff --git a/src/gui/text/qfontengine_coretext.mm b/src/gui/text/qfontengine_coretext.mm index 64b8682..64d4a24 100644 --- a/src/gui/text/qfontengine_coretext.mm +++ b/src/gui/text/qfontengine_coretext.mm @@ -492,17 +492,6 @@ void QCoreTextFontEngine::init() avgCharWidth = QFixed::fromReal(width * fontDef.pixelSize / emSize); } else avgCharWidth = QFontEngine::averageCharWidth(); - - ctMaxCharWidth = ctMinLeftBearing = ctMinRightBearing = 0; - QByteArray hheaTable = getSfntTable(MAKE_TAG('h', 'h', 'e', 'a')); - if (hheaTable.size() >= 16) { - quint16 width = qFromBigEndian<quint16>(reinterpret_cast<const uchar *>(hheaTable.constData() + 10)); - ctMaxCharWidth = width * fontDef.pixelSize / emSize; - qint16 bearing = qFromBigEndian<qint16>(reinterpret_cast<const uchar *>(hheaTable.constData() + 12)); - ctMinLeftBearing = bearing * fontDef.pixelSize / emSize; - bearing = qFromBigEndian<qint16>(reinterpret_cast<const uchar *>(hheaTable.constData() + 14)); - ctMinRightBearing = bearing * fontDef.pixelSize / emSize; - } } bool QCoreTextFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, @@ -599,20 +588,17 @@ QFixed QCoreTextFontEngine::averageCharWidth() const qreal QCoreTextFontEngine::maxCharWidth() const { - return (fontDef.styleStrategy & QFont::ForceIntegerMetrics) - ? qRound(ctMaxCharWidth) : ctMaxCharWidth; + return 0; } qreal QCoreTextFontEngine::minLeftBearing() const { - return (fontDef.styleStrategy & QFont::ForceIntegerMetrics) - ? qRound(ctMinLeftBearing) : ctMinLeftBearing; + return 0; } qreal QCoreTextFontEngine::minRightBearing() const { - return (fontDef.styleStrategy & QFont::ForceIntegerMetrics) - ? qRound(ctMinRightBearing) : ctMinLeftBearing; + return 0; } void QCoreTextFontEngine::draw(CGContextRef ctx, qreal x, qreal y, const QTextItemInt &ti, int paintDeviceHeight) @@ -732,8 +718,9 @@ void QCoreTextFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *position QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition, int margin, bool aa) { + Q_UNUSED(margin); const glyph_metrics_t br = boundingBox(glyph); - QImage im(qRound(br.width) + margin * 2, qRound(br.height) + margin * 2, QImage::Format_RGB32); + QImage im(qRound(br.width) + 2, qRound(br.height) + 2, QImage::Format_RGB32); im.fill(0); CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); @@ -764,8 +751,8 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition CGContextSetFont(ctx, cgFont); - qreal pos_x = -br.x.toReal() + subPixelPosition.toReal() + margin; - qreal pos_y = im.height() + br.y.toReal() - margin; + qreal pos_x = -br.x.truncate() + subPixelPosition.toReal(); + qreal pos_y = im.height() + br.y.toReal(); CGContextSetTextPosition(ctx, pos_x, pos_y); CGSize advance; diff --git a/src/gui/text/qfontengine_coretext_p.h b/src/gui/text/qfontengine_coretext_p.h index 3ca8a0a..efe8295 100644 --- a/src/gui/text/qfontengine_coretext_p.h +++ b/src/gui/text/qfontengine_coretext_p.h @@ -103,9 +103,6 @@ private: int synthesisFlags; CGAffineTransform transform; QFixed avgCharWidth; - qreal ctMaxCharWidth; - qreal ctMinLeftBearing; - qreal ctMinRightBearing; friend class QCoreTextFontEngineMulti; }; diff --git a/src/gui/text/qfontenginedirectwrite.cpp b/src/gui/text/qfontenginedirectwrite.cpp index 890cad9..d693273 100644 --- a/src/gui/text/qfontenginedirectwrite.cpp +++ b/src/gui/text/qfontenginedirectwrite.cpp @@ -390,6 +390,60 @@ glyph_metrics_t QFontEngineDirectWrite::boundingBox(const QGlyphLayout &glyphs) return glyph_metrics_t(0, -m_ascent, w - lastRightBearing(glyphs), m_ascent + m_descent, w, 0); } +glyph_metrics_t QFontEngineDirectWrite::alphaMapBoundingBox(glyph_t glyph, QFixed subPixelPosition, + const QTransform &matrix, + GlyphFormat /*format*/) +{ + glyph_metrics_t bbox = QFontEngine::boundingBox(glyph, matrix); // To get transformed advance + + UINT16 glyphIndex = glyph; + FLOAT glyphAdvance = 0; + + DWRITE_GLYPH_OFFSET glyphOffset; + glyphOffset.advanceOffset = 0; + glyphOffset.ascenderOffset = 0; + + DWRITE_GLYPH_RUN glyphRun; + glyphRun.fontFace = m_directWriteFontFace; + glyphRun.fontEmSize = fontDef.pixelSize; + glyphRun.glyphCount = 1; + glyphRun.glyphIndices = &glyphIndex; + glyphRun.glyphAdvances = &glyphAdvance; + glyphRun.isSideways = false; + glyphRun.bidiLevel = 0; + glyphRun.glyphOffsets = &glyphOffset; + + DWRITE_MATRIX transform; + transform.dx = subPixelPosition.toReal(); + transform.dy = 0; + transform.m11 = matrix.m11(); + transform.m12 = matrix.m12(); + transform.m21 = matrix.m21(); + transform.m22 = matrix.m22(); + + IDWriteGlyphRunAnalysis *glyphAnalysis = NULL; + HRESULT hr = m_directWriteFactory->CreateGlyphRunAnalysis( + &glyphRun, + 1.0f, + &transform, + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC, + DWRITE_MEASURING_MODE_NATURAL, + 0.0, 0.0, + &glyphAnalysis + ); + + if (SUCCEEDED(hr)) { + RECT rect; + glyphAnalysis->GetAlphaTextureBounds(DWRITE_TEXTURE_CLEARTYPE_3x1, &rect); + glyphAnalysis->Release(); + + return glyph_metrics_t(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, + bbox.xoff, bbox.yoff); + } else { + return glyph_metrics_t(); + } +} + glyph_metrics_t QFontEngineDirectWrite::boundingBox(glyph_t g) { if (m_directWriteFontFace == 0) @@ -459,9 +513,10 @@ qreal QFontEngineDirectWrite::maxCharWidth() const extern uint qt_pow_gamma[256]; -QImage QFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) +QImage QFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, + const QTransform &xform) { - QImage im = imageForGlyph(glyph, subPixelPosition, 0, QTransform()); + QImage im = imageForGlyph(glyph, subPixelPosition, 0, xform); QImage indexed(im.width(), im.height(), QImage::Format_Indexed8); QVector<QRgb> colors(256); @@ -492,12 +547,8 @@ QImage QFontEngineDirectWrite::imageForGlyph(glyph_t t, int margin, const QTransform &xform) { - glyph_metrics_t metrics = QFontEngine::boundingBox(t, xform); - int width = (metrics.width + margin * 2 + 4).ceil().toInt() ; - int height = (metrics.height + margin * 2 + 4).ceil().toInt(); - UINT16 glyphIndex = t; - FLOAT glyphAdvance = metrics.xoff.toReal(); + FLOAT glyphAdvance = 0; DWRITE_GLYPH_OFFSET glyphOffset; glyphOffset.advanceOffset = 0; @@ -513,12 +564,9 @@ QImage QFontEngineDirectWrite::imageForGlyph(glyph_t t, glyphRun.bidiLevel = 0; glyphRun.glyphOffsets = &glyphOffset; - QFixed x = margin - metrics.x.round() + subPixelPosition; - QFixed y = margin - metrics.y.floor(); - DWRITE_MATRIX transform; - transform.dx = x.toReal(); - transform.dy = y.toReal(); + transform.dx = subPixelPosition.toReal(); + transform.dy = 0; transform.m11 = xform.m11(); transform.m12 = xform.m12(); transform.m21 = xform.m21(); @@ -537,48 +585,54 @@ QImage QFontEngineDirectWrite::imageForGlyph(glyph_t t, if (SUCCEEDED(hr)) { RECT rect; - rect.left = 0; - rect.top = 0; - rect.right = width; - rect.bottom = height; - - int size = width * height * 3; - BYTE *alphaValues = new BYTE[size]; - qMemSet(alphaValues, size, 0); - - hr = glyphAnalysis->CreateAlphaTexture(DWRITE_TEXTURE_CLEARTYPE_3x1, - &rect, - alphaValues, - size); - - if (SUCCEEDED(hr)) { - QImage img(width, height, QImage::Format_RGB32); - img.fill(0xffffffff); + glyphAnalysis->GetAlphaTextureBounds(DWRITE_TEXTURE_CLEARTYPE_3x1, &rect); - for (int y=0; y<height; ++y) { - uint *dest = reinterpret_cast<uint *>(img.scanLine(y)); - BYTE *src = alphaValues + width * 3 * y; + rect.left -= margin; + rect.top -= margin; + rect.right += margin; + rect.bottom += margin; - for (int x=0; x<width; ++x) { - dest[x] = *(src) << 16 - | *(src + 1) << 8 - | *(src + 2); + int width = rect.right - rect.left; + int height = rect.bottom - rect.top; - src += 3; + int size = width * height * 3; + if (size > 0) { + BYTE *alphaValues = new BYTE[size]; + qMemSet(alphaValues, size, 0); + + hr = glyphAnalysis->CreateAlphaTexture(DWRITE_TEXTURE_CLEARTYPE_3x1, + &rect, + alphaValues, + size); + + if (SUCCEEDED(hr)) { + QImage img(width, height, QImage::Format_RGB32); + img.fill(0xffffffff); + + for (int y=0; y<height; ++y) { + uint *dest = reinterpret_cast<uint *>(img.scanLine(y)); + BYTE *src = alphaValues + width * 3 * y; + + for (int x=0; x<width; ++x) { + dest[x] = *(src) << 16 + | *(src + 1) << 8 + | *(src + 2); + + src += 3; + } } - } - delete[] alphaValues; - glyphAnalysis->Release(); + delete[] alphaValues; + glyphAnalysis->Release(); - return img; - } else { - delete[] alphaValues; - glyphAnalysis->Release(); + return img; + } else { + delete[] alphaValues; + glyphAnalysis->Release(); - qErrnoWarning("QFontEngineDirectWrite::imageForGlyph: CreateAlphaTexture failed"); + qErrnoWarning("QFontEngineDirectWrite::imageForGlyph: CreateAlphaTexture failed"); + } } - } else { qErrnoWarning("QFontEngineDirectWrite::imageForGlyph: CreateGlyphRunAnalysis failed"); } diff --git a/src/gui/text/qfontenginedirectwrite_p.h b/src/gui/text/qfontenginedirectwrite_p.h index d0086fc..edf1e6a 100644 --- a/src/gui/text/qfontenginedirectwrite_p.h +++ b/src/gui/text/qfontenginedirectwrite_p.h @@ -86,6 +86,10 @@ public: glyph_metrics_t boundingBox(const QGlyphLayout &glyphs); glyph_metrics_t boundingBox(glyph_t g); + glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, + QFixed subPixelPosition, + const QTransform &matrix, + GlyphFormat format); QFixed ascent() const; QFixed descent() const; @@ -97,7 +101,7 @@ public: bool supportsSubPixelPositions() const; - QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition); + QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t); QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, int margin, const QTransform &xform); diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 9e1646f..f3d4107 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -442,6 +442,8 @@ bool QFontMetrics::inFont(QChar ch) const } /*! + \since 4.8 + Returns true if the character encoded in UCS-4/UTF-32 is a valid character in the font; otherwise returns false. */ @@ -1330,6 +1332,7 @@ bool QFontMetricsF::inFont(QChar ch) const /*! \fn bool QFontMetricsF::inFontUcs4(uint ch) const + \since 4.8 Returns true if the character given by \a ch, encoded in UCS-4/UTF-32, is a valid character in the font; otherwise returns false. diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp index 7e829db..d1d1f94 100644 --- a/src/gui/text/qplatformfontdatabase_qpa.cpp +++ b/src/gui/text/qplatformfontdatabase_qpa.cpp @@ -203,6 +203,7 @@ bool QSupportedWritingSystems::supported(QFontDatabase::WritingSystem writingSys \brief The QSupportedWritingSystems class is used when registering fonts with the internal Qt fontdatabase \ingroup painting + \since 4.8 Its to provide an easy to use interface for indicating what writing systems a specific font supports. @@ -322,6 +323,7 @@ QString QPlatformFontDatabase::fontDir() const \class QPlatformFontDatabase \brief The QPlatformFontDatabase class makes it possible to customize how fonts are discovered and how they are rendered + \since 4.8 \ingroup painting diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index 8bbe86c..7e7ca6c 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -2569,6 +2569,7 @@ QTextDocument *QTextCursor::document() const /*! \enum Qt::CursorMoveStyle + \since 4.8 This enum describes the movement style available to text cursors. The options are: diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 0abafb8..143dc1a 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -2710,7 +2710,7 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block) html += QLatin1Char('>'); if (block.begin().atEnd()) - html += "<br />"; + html += QLatin1String("<br />"); QTextBlock::Iterator it = block.begin(); if (fragmentMarkers && !it.atEnd() && block == doc->begin()) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 8ddf3eb..c900918 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -3051,6 +3051,22 @@ QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFo : justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format), num_chars(0), chars(0), logClusters(0), f(0), fontEngine(0) { + f = font; + fontEngine = f->d->engineForScript(si.analysis.script); + Q_ASSERT(fontEngine); + + initWithScriptItem(si); +} + +QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format) + : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format), + num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe) +{ +} + +// Fix up flags and underlineStyle with given info +void QTextItemInt::initWithScriptItem(const QScriptItem &si) +{ // explicitly initialize flags so that initFontAttributes can be called // multiple times on the same TextItem flags = 0; @@ -3058,13 +3074,10 @@ QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFo flags |= QTextItem::RightToLeft; ascent = si.ascent; descent = si.descent; - f = font; - fontEngine = f->d->engineForScript(si.analysis.script); - Q_ASSERT(fontEngine); - if (format.hasProperty(QTextFormat::TextUnderlineStyle)) { - underlineStyle = format.underlineStyle(); - } else if (format.boolProperty(QTextFormat::FontUnderline) + if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) { + underlineStyle = charFormat.underlineStyle(); + } else if (charFormat.boolProperty(QTextFormat::FontUnderline) || f->d->underline) { underlineStyle = QTextCharFormat::SingleUnderline; } @@ -3073,18 +3086,12 @@ QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFo if (underlineStyle == QTextCharFormat::SingleUnderline) flags |= QTextItem::Underline; - if (f->d->overline || format.fontOverline()) + if (f->d->overline || charFormat.fontOverline()) flags |= QTextItem::Overline; - if (f->d->strikeOut || format.fontStrikeOut()) + if (f->d->strikeOut || charFormat.fontStrikeOut()) flags |= QTextItem::StrikeOut; } -QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe) - : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), - num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe) -{ -} - QTextItemInt QTextItemInt::midItem(QFontEngine *fontEngine, int firstGlyphIndex, int numGlyphs) const { QTextItemInt ti = *this; diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 055974a..b1bd0c3 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -312,11 +312,13 @@ public: logClusters(0), f(0), fontEngine(0) {} QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFormat &format = QTextCharFormat()); - QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars, int numChars, QFontEngine *fe); + QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars, int numChars, QFontEngine *fe, + const QTextCharFormat &format = QTextCharFormat()); /// copy the structure items, adjusting the glyphs arrays to the right subarrays. /// the width of the returned QTextItemInt is not adjusted, for speed reasons QTextItemInt midItem(QFontEngine *fontEngine, int firstGlyphIndex, int numGlyphs) const; + void initWithScriptItem(const QScriptItem &si); QFixed descent; QFixed ascent; diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index c1bc846..3f0b9e8 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -579,6 +579,8 @@ bool QTextLayout::cacheEnabled() const } /*! + \since 4.8 + Set the cursor movement style. If the QTextLayout is backed by a document, you can ignore this and use the option in QTextDocument, this option is for widgets like QLineEdit or custom widgets without @@ -592,6 +594,8 @@ void QTextLayout::setCursorMoveStyle(Qt::CursorMoveStyle style) } /*! + \since 4.8 + The cursor movement style of this QTextLayout. The default is Qt::LogicalMoveStyle. @@ -725,9 +729,11 @@ int QTextLayout::previousCursorPosition(int oldPos, CursorMode mode) const } /*! + \since 4.8 + Returns the cursor position to the right of \a oldPos, next to it. - It's dependent on the visual position of characters, after bi-directional - reordering. + The position is dependent on the visual position of characters, after + bi-directional reordering. \sa leftCursorPosition(), nextCursorPosition() */ @@ -739,9 +745,11 @@ int QTextLayout::rightCursorPosition(int oldPos) const } /*! + \since 4.8 + Returns the cursor position to the left of \a oldPos, next to it. - It's dependent on the visual position of characters, after bi-directional - reordering. + The position is dependent on the visual position of characters, after + bi-directional reordering. \sa rightCursorPosition(), previousCursorPosition() */ @@ -2381,13 +2389,13 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR unsigned short *logClusters = eng->logClusters(&si); QGlyphLayout glyphs = eng->shapedGlyphs(&si); - QTextItemInt gf(si, &f, format); - gf.glyphs = glyphs.mid(iterator.glyphsStart, iterator.glyphsEnd - iterator.glyphsStart); - gf.chars = eng->layoutData->string.unicode() + iterator.itemStart; + QTextItemInt gf(glyphs.mid(iterator.glyphsStart, iterator.glyphsEnd - iterator.glyphsStart), + &f, eng->layoutData->string.unicode() + iterator.itemStart, + iterator.itemEnd - iterator.itemStart, eng->fontEngine(si), format); gf.logClusters = logClusters + iterator.itemStart - si.position; - gf.num_chars = iterator.itemEnd - iterator.itemStart; gf.width = iterator.itemWidth; gf.justified = line.justified; + gf.initWithScriptItem(si); Q_ASSERT(gf.fontEngine); diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp index 4372ae3..7a985a1 100644 --- a/src/gui/widgets/qabstractspinbox.cpp +++ b/src/gui/widgets/qabstractspinbox.cpp @@ -1655,6 +1655,8 @@ void QAbstractSpinBox::initStyleOption(QStyleOptionSpinBox *option) const : (QAbstractSpinBox::StepDownEnabled|QAbstractSpinBox::StepUpEnabled); option->frame = d->frame; + if (d->readOnly) + option->state |= QStyle::State_ReadOnly; } /*! diff --git a/src/gui/widgets/qcheckbox.cpp b/src/gui/widgets/qcheckbox.cpp index 9904a15..2210488 100644 --- a/src/gui/widgets/qcheckbox.cpp +++ b/src/gui/widgets/qcheckbox.cpp @@ -303,6 +303,7 @@ QSize QCheckBox::sizeHint() const /*! \reimp + \since 4.8 */ QSize QCheckBox::minimumSizeHint() const { diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 2d63f63..7d35766 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1128,6 +1128,8 @@ void QLineEdit::setDragEnabled(bool b) */ /*! + \since 4.8 + Returns the movement style for the cursor in the line edit. */ Qt::CursorMoveStyle QLineEdit::cursorMoveStyle() const @@ -1137,6 +1139,8 @@ Qt::CursorMoveStyle QLineEdit::cursorMoveStyle() const } /*! + \since 4.8 + Sets the movement style for the cursor in the line edit to the given \a style. */ diff --git a/src/gui/widgets/qradiobutton.cpp b/src/gui/widgets/qradiobutton.cpp index eeef40e..9ce4eba 100644 --- a/src/gui/widgets/qradiobutton.cpp +++ b/src/gui/widgets/qradiobutton.cpp @@ -206,6 +206,7 @@ QSize QRadioButton::sizeHint() const /*! \reimp + \since 4.8 */ QSize QRadioButton::minimumSizeHint() const { diff --git a/src/gui/widgets/qtabwidget.cpp b/src/gui/widgets/qtabwidget.cpp index c6551e5..78dda23 100644 --- a/src/gui/widgets/qtabwidget.cpp +++ b/src/gui/widgets/qtabwidget.cpp @@ -885,6 +885,7 @@ QSize QTabWidget::minimumSizeHint() const /*! \reimp + \since 4.8 */ int QTabWidget::heightForWidth(int width) const { diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index 2670089..61d4fed 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -2472,6 +2472,8 @@ bool QTextEdit::find(const QString &exp, QTextDocument::FindFlags options) and the text edit will try to guess the right format. Use setHtml() or setPlainText() directly to avoid text edit's guessing. + + \sa toPlainText(), toHtml() */ void QTextEdit::setText(const QString &text) { |