From 49b6219dd12815d5155aa28bd8d1dbf26cf0b1d7 Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 3 Jun 2009 17:13:29 +0200 Subject: Fixed a small input method bug in QLineEdit. We need to check for replacementLength as well. Otherwise there will be no undo information if text is deleted using input methods. --- src/gui/widgets/qlineedit.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index d9e39d3..a95d2f2 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -2275,7 +2275,8 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e) #endif int priorState = 0; - bool isGettingInput = !e->commitString().isEmpty() || !e->preeditString().isEmpty(); + bool isGettingInput = !e->commitString().isEmpty() || !e->preeditString().isEmpty() + || e->replacementLength() > 0; bool cursorPositionChanged = false; if (isGettingInput) { -- cgit v0.12 From 34c1e57a003cea4f359c05f07b6f255132e97b5f Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 3 Jun 2009 17:15:55 +0200 Subject: Added inputMethodQuery fallback to QWidget. --- src/gui/kernel/qwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 4fcedb4..955ac8b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -8500,6 +8500,9 @@ QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const return QRect(width()/2, 0, 1, height()); case Qt::ImFont: return font(); + case Qt::ImAnchorPosition: + // Fallback. + return inputMethodQuery(Qt::ImCursorPosition); default: return QVariant(); } -- cgit v0.12 From ad0f42aa8f07b453e9ccfb960f24f40f4f00280d Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 3 Jun 2009 17:16:50 +0200 Subject: Gave QTextControl support for ImAnchorPosition and Selection. RevBy: Trust me The fix is almost identical to the one made for QLineEdit. --- src/gui/text/qtextcontrol.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index f6092bb..482d50b 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1813,13 +1813,18 @@ bool QTextControlPrivate::dropEvent(const QMimeData *mimeData, const QPointF &po void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) { + Q_Q(QTextControl); if (!(interactionFlags & Qt::TextEditable) || cursor.isNull()) { e->ignore(); return; } - cursor.beginEditBlock(); + bool isGettingInput = !e->commitString().isEmpty() || !e->preeditString().isEmpty() + || e->replacementLength() > 0; - cursor.removeSelectedText(); + if (isGettingInput) { + cursor.beginEditBlock(); + cursor.removeSelectedText(); + } // insert commit string if (!e->commitString().isEmpty() || e->replacementLength()) { @@ -1829,6 +1834,17 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) c.insertText(e->commitString()); } + for (int i = 0; i < e->attributes().size(); ++i) { + const QInputMethodEvent::Attribute &a = e->attributes().at(i); + if (a.type == QInputMethodEvent::Selection) { + QTextCursor oldCursor = cursor; + cursor.setPosition(a.start, QTextCursor::MoveAnchor); + cursor.setPosition(a.start + a.length, QTextCursor::KeepAnchor); + q->ensureCursorVisible(); + repaintOldAndNewSelection(oldCursor); + } + } + QTextBlock block = cursor.block(); QTextLayout *layout = block.layout(); layout->setPreeditArea(cursor.position() - block.position(), e->preeditString()); @@ -1852,7 +1868,9 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) } } layout->setAdditionalFormats(overrides); - cursor.endEditBlock(); + + if (isGettingInput) + cursor.endEditBlock(); } QVariant QTextControl::inputMethodQuery(Qt::InputMethodQuery property) const @@ -1872,6 +1890,8 @@ QVariant QTextControl::inputMethodQuery(Qt::InputMethodQuery property) const return QVariant(d->cursor.selectedText()); case Qt::ImMaximumTextLength: return QVariant(); // No limit. + case Qt::ImAnchorPosition: + return QVariant(qBound(0, d->cursor.anchor() - block.position(), block.length())); default: return QVariant(); } -- cgit v0.12 From 3893a10158e3ef5bec79c55ad89666cdc4ad14f5 Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 3 Jun 2009 17:19:02 +0200 Subject: Fixed an update bug in QTextControl. Previously, the input context would not get updated on every selection update. --- src/gui/text/qtextcontrol.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 482d50b..6647558 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1611,6 +1611,9 @@ void QTextControlPrivate::mouseMoveEvent(Qt::MouseButtons buttons, const QPointF if (cursor.position() != oldCursorPos) emit q->cursorPositionChanged(); _q_updateCurrentCharFormatAndSelection(); + if (QInputContext *ic = inputContext()) { + ic->update(); + } } else { //emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1))); if (cursor.position() != oldCursorPos) -- cgit v0.12 From cfbe3355b36d629f0ba40ddcf421d807e624a1d3 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 3 Jun 2009 20:42:47 +0200 Subject: Added loadS60ThemeFromBlob and saveS60ThemeToBlob. The simulated style will by default try to load the 'Default.blob' --- src/gui/styles/qs60style.cpp | 8 --- src/gui/styles/qs60style.h | 2 + src/gui/styles/qs60style_s60.cpp | 8 +++ src/gui/styles/qs60style_simulated.cpp | 125 +++++++++++++++++++++++++++++++++ 4 files changed, 135 insertions(+), 8 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index f7a1700..b30cc0d 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -870,14 +870,6 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag \sa QMacStyle, QWindowsStyle, QWindowsXPStyle, QWindowsVistaStyle, QPlastiqueStyle, QCleanlooksStyle, QMotifStyle */ -/*! - Constructs a QS60Style object. -*/ -QS60Style::QS60Style() - : QCommonStyle(*new QS60StylePrivate) -{ -} - QS60Style::~QS60Style() { } diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index bf8f22e..21cdd1c 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -85,6 +85,8 @@ public: static QStringList colorListKeys(); void setS60Theme(const QHash &parts, const QHash, QColor> &colors); + bool loadS60ThemeFromBlob(const QString &blobFile); + bool saveS60ThemeToBlob(const QString &blobFile) const; #endif // !Q_WS_S60 #ifdef Q_WS_S60 diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index d6f7109..55e80b9 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -1326,6 +1326,14 @@ void QS60StyleModeSpecifics::colorGroupAndIndex( } } +/*! + Constructs a QS60Style object. +*/ +QS60Style::QS60Style() + : QCommonStyle(*new QS60StylePrivate) +{ +} + void QS60Style::handleDynamicLayoutVariantSwitch() { Q_D(QS60Style); diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index 089a252..a94d73e 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -51,11 +51,109 @@ #include "qlayout.h" #include "qpixmapcache.h" #include "qmetaobject.h" +#include "qdebug.h" +#include "qbuffer.h" #if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN) QT_BEGIN_NAMESPACE +static const quint32 blobVersion = 1; +static const int pictureSize = 256; + +bool saveThemeToBlob(const QString &themeBlob, + const QHash &partPictures, + const QHash, QColor> &colors) +{ + QFile blob(themeBlob); + if (!blob.open(QIODevice::WriteOnly)) { + qWarning() << __FUNCTION__": Could not create blob: " << themeBlob; + return false; + } + + QByteArray data; + QBuffer dataBuffer(&data); + dataBuffer.open(QIODevice::WriteOnly); + QDataStream dataOut(&dataBuffer); + + const int colorsCount = colors.count(); + dataOut << colorsCount; + const QList > colorKeys = colors.keys(); + for (int i = 0; i < colorsCount; ++i) { + const QPair &key = colorKeys.at(i); + dataOut << key; + const QColor color = colors.value(key); + dataOut << color; + } + + const int picturesCount = partPictures.count(); + dataOut << picturesCount; + foreach (const QString &key, partPictures.keys()) { + const QPicture picture = partPictures.value(key); + dataOut << key; + dataOut << picture; + } + + QDataStream blobOut(&blob); + blobOut << blobVersion; + blobOut << qCompress(data); + return blobOut.status() == QDataStream::Ok; +} + +bool loadThemeFromBlob(const QString &themeBlob, + QHash &partPictures, + QHash, QColor> &colors) +{ + QFile blob(themeBlob); + if (!blob.open(QIODevice::ReadOnly)) { + qWarning() << __FUNCTION__": Could not read blob: " << themeBlob; + return false; + } + QDataStream blobIn(&blob); + + quint32 version; + blobIn >> version; + + if (version != blobVersion) { + qWarning() << __FUNCTION__": Invalid blob version: " << version << " ...expected: " << blobVersion; + return false; + } + + QByteArray data; + blobIn >> data; + data = qUncompress(data); + QBuffer dataBuffer(&data); + dataBuffer.open(QIODevice::ReadOnly); + QDataStream dataIn(&dataBuffer); + + int colorsCount; + dataIn >> colorsCount; + for (int i = 0; i < colorsCount; ++i) { + QPair key; + dataIn >> key; + QColor value; + dataIn >> value; + colors.insert(key, value); + } + + int picturesCount; + dataIn >> picturesCount; + for (int i = 0; i < picturesCount; ++i) { + QString key; + dataIn >> key; + QPicture value; + dataIn >> value; + value.setBoundingRect(QRect(0, 0, pictureSize, pictureSize)); // Bug? The forced bounding rect was not deserialized. + partPictures.insert(key, value); + } + + if (dataIn.status() != QDataStream::Ok) { + qWarning() << __FUNCTION__": Invalid data blob: " << themeBlob; + return false; + } + return true; +} + class QS60StyleModeSpecifics { public: @@ -254,6 +352,16 @@ QFont QS60StylePrivate::s60Font_specific(QS60StyleEnums::FontCategories fontCate return result; } +/*! + Constructs a QS60Style object. +*/ +QS60Style::QS60Style() + : QCommonStyle(*new QS60StylePrivate) +{ + // Assume, that the resource system has a ':/s60Stylethemes/Default.blob' + loadS60ThemeFromBlob(QString::fromLatin1(":/s60Stylethemes/Default.blob")); +} + Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, enumPartKeys, { const int enumIndex = QS60StyleEnums::staticMetaObject.indexOfEnumerator("SkinParts"); Q_ASSERT(enumIndex >= 0); @@ -303,6 +411,23 @@ void QS60Style::setS60Theme(const QHash &parts, d->setThemePalette(qApp); } +bool QS60Style::loadS60ThemeFromBlob(const QString &blobFile) +{ + QHash partPictures; + QHash, QColor> colors; + + if (!loadThemeFromBlob(blobFile, partPictures, colors)) + return false; + setS60Theme(partPictures, colors); + return true; +} + +bool QS60Style::saveS60ThemeToBlob(const QString &blobFile) const +{ + return saveThemeToBlob(blobFile, + QS60StyleModeSpecifics::m_partPictures, QS60StyleModeSpecifics::m_colors); +} + QPoint qt_s60_fill_background_offset(const QWidget *targetWidget) { Q_UNUSED(targetWidget) -- cgit v0.12 From 58d05bc0ddbbae72128849676d12493058272cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 4 Jun 2009 09:29:46 +0300 Subject: S60Style: Draw all dialog with popup menu theme background. --- src/gui/styles/qs60style.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index f7a1700..9fbad41 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -50,7 +50,6 @@ #include "qcalendarwidget.h" #include "qdial.h" #include "qdialog.h" -#include "qerrormessage.h" #include "qgroupbox.h" #include "qheaderview.h" #include "qlist.h" @@ -58,7 +57,6 @@ #include "qlistview.h" #include "qmenu.h" #include "qmenubar.h" -#include "qmessagebox.h" #include "qpushbutton.h" #include "qscrollarea.h" #include "qscrollbar.h" @@ -116,8 +114,6 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { {7,0,-909,0,0,2,0,0,-1,20,52,28,19,19,9,258,-909,-909,-909,29,19,6,0,0,32,-909,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,98,35,98,5,5,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,2,-909,-909,-909,-909,7,7,3,1}, {7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,-909,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,5,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,8,6,5,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1}, {7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,-909,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1} - - // *** End of generated data *** }; @@ -126,6 +122,7 @@ const short *QS60StylePrivate::m_pmPointer = QS60StylePrivate::data[0]; // theme background texture QPixmap *QS60StylePrivate::m_background = 0; +// theme palette QPalette *QS60StylePrivate::m_themePalette = 0; const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameElementsData[] = { @@ -144,6 +141,7 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme {SE_PanelBackground, QS60StyleEnums::SP_QsnFrSetOptCenter}, {SE_ButtonInactive, QS60StyleEnums::SP_QsnFrButtonCenterInactive}, }; + static const int frameElementsCount = int(sizeof(QS60StylePrivate::m_frameElementsData)/sizeof(QS60StylePrivate::m_frameElementsData[0])); @@ -360,8 +358,7 @@ QColor QS60StylePrivate::lighterColor(const QColor &baseColor) bool QS60StylePrivate::drawsOwnThemeBackground(const QWidget *widget) { - return (qobject_cast (widget) || - qobject_cast (widget)); + return qobject_cast (widget); } QFont QS60StylePrivate::s60Font( @@ -413,8 +410,8 @@ void QS60StylePrivate::clearCaches(QS60StylePrivate::CacheClearReason reason) } // Since S60Style has 'button' and 'tooltip' as a graphic, we don't have any native color which to use -// for QPalette::Button and QPalette::ToolTipBase. Therefore we need to guesstimate -// this by calculating average rgb values for button pixels. +// for QPalette::Button and QPalette::ToolTipBase. Therefore S60Style needs to guesstimate +// palette colors by calculating average rgb values for button pixels. // Returns Qt::black if there is an issue with the graphics (image is NULL, or no bits() found). QColor QS60StylePrivate::colorFromFrameGraphics(QS60StylePrivate::SkinFrameElements frame) const { @@ -615,9 +612,7 @@ QPixmap QS60StylePrivate::cachedFrame(SkinFrameElements frame, const QSize &size void QS60StylePrivate::refreshUI() { - QList widgets = QApplication::allWidgets(); - - // The following is similar to updateWidgets in qstylesheetstyle.cpp. + QList widgets = QApplication::allWidgets(); for (int i = 0; i < widgets.size(); ++i) { QWidget *widget = widgets.at(i); @@ -662,7 +657,7 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) const QPalette widgetPalette = widget->palette(); //header view and its viewport need to be set 100% transparent button color, since drawing code will - //draw transparent theme graphics there. + //draw transparent theme graphics to table column and row headers. if (qobject_cast(widget)){ widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0)); -- cgit v0.12 From efcc087e7da35f6db0e544f48493626f4fa2d56a Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Wed, 3 Jun 2009 10:29:24 +0200 Subject: In QGraphicsView the viewport itself has to be enabled for InputMethods. When events are comming, exactly that widget will be aske for InputContext. --- src/gui/graphicsview/qgraphicsview.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index a795fb4..8137f8e 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -1195,6 +1195,11 @@ QGraphicsView::QGraphicsView(QWidget *parent) // using a simple reference count. The same goes for acceptDrops and mouse // tracking. setAttribute(Qt::WA_InputMethodEnabled); + + // viewport part of the graphics view has to be enabled + // as well, because when events come this widget is asked + // for input context and so on + viewport()->setAttribute(Qt::WA_InputMethodEnabled); } /*! @@ -1209,6 +1214,11 @@ QGraphicsView::QGraphicsView(QGraphicsScene *scene, QWidget *parent) setAcceptDrops(true); setBackgroundRole(QPalette::Base); setAttribute(Qt::WA_InputMethodEnabled); + + // viewport part of the graphics view has to be enabled + // as well, because when events come this widget is asked + // for input context and so on + viewport()->setAttribute(Qt::WA_InputMethodEnabled); } /*! @@ -1221,6 +1231,11 @@ QGraphicsView::QGraphicsView(QGraphicsViewPrivate &dd, QWidget *parent) setAcceptDrops(true); setBackgroundRole(QPalette::Base); setAttribute(Qt::WA_InputMethodEnabled); + + // viewport part of the graphics view has to be enabled + // as well, because when events come this widget is asked + // for input context and so on + viewport()->setAttribute(Qt::WA_InputMethodEnabled); } /*! -- cgit v0.12 From 08d020409ecf08c81f31faf33f1da329177cc207 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 4 Jun 2009 11:59:07 +0300 Subject: Added proper picture for Drilldown example in fluidlauncher --- demos/embedded/fluidlauncher/screenshots/drilldown.png | Bin 0 -> 102922 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 demos/embedded/fluidlauncher/screenshots/drilldown.png diff --git a/demos/embedded/fluidlauncher/screenshots/drilldown.png b/demos/embedded/fluidlauncher/screenshots/drilldown.png new file mode 100644 index 0000000..413d713 Binary files /dev/null and b/demos/embedded/fluidlauncher/screenshots/drilldown.png differ -- cgit v0.12 From fc96ef8bf45482483d795fe3d979fb842869a315 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 4 Jun 2009 12:15:05 +0300 Subject: Added proper UID for phonon.pro, and did some symbian scope cleanup, too. --- src/phonon/phonon.pro | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/phonon/phonon.pro b/src/phonon/phonon.pro index 679a1b0..b38adb8 100644 --- a/src/phonon/phonon.pro +++ b/src/phonon/phonon.pro @@ -13,13 +13,6 @@ PHONON_DIR = $$QT_SOURCE_TREE/src/3rdparty/phonon/phonon unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork -# Phonon depends on numeric_limits. Enabling STL support in Qt -# would bring in link dependencies, and we don't need that for -# numeric_limits, hence we here merely ensure we bring in the necessary -# header. -symbian:INCLUDEPATH += $${EPOCROOT}epoc32/include/stdapis/stlport \ - $$OS_LAYER_STDCPP_SYSTEMINCLUDE - # Input HEADERS += $$PHONON_DIR/abstractaudiooutput.h \ $$PHONON_DIR/abstractaudiooutput_p.h \ @@ -122,7 +115,16 @@ contains(QT_CONFIG, dbus) { contains(QT_CONFIG, reduce_exports): CONFIG += hide_symbols symbian: { + # Phonon depends on numeric_limits. Enabling STL support in Qt + # would bring in link dependencies, and we don't need that for + # numeric_limits, hence we here merely ensure we bring in the necessary + # header. + INCLUDEPATH *= $${EPOCROOT}epoc32/include/stdapis/stlport \ + $$OS_LAYER_STDCPP_SYSTEMINCLUDE + # Without this setting, code using numeric_limits will fail # for winscw, although armv5 works fine no matter what. - MMP_RULES += "option cw -wchar_t on" + QMAKE_CXXFLAGS.CW *= $$STLLIB_USAGE_CW_FLAGS + + TARGET.UID3 = 0x2001E624 } -- cgit v0.12 From c244010c866cf1a80f1de7382a3b78e2eb0cb56b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 4 Jun 2009 12:17:39 +0300 Subject: S60Style: Cleanup code before Tower release. --- src/gui/styles/qs60style.cpp | 413 ++++++++++++++++++++------------------- src/gui/styles/qs60style_s60.cpp | 49 ++--- 2 files changed, 229 insertions(+), 233 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index c8582eb..7db0992 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -145,7 +145,7 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme static const int frameElementsCount = int(sizeof(QS60StylePrivate::m_frameElementsData)/sizeof(QS60StylePrivate::m_frameElementsData[0])); -const int KNotFound = -1; +const int KNotFound = -909; QS60StylePrivate::~QS60StylePrivate() { @@ -290,8 +290,6 @@ short QS60StylePrivate::pixelMetric(int metric) { Q_ASSERT(metric < MAX_PIXELMETRICS); const short returnValue = m_pmPointer[metric]; - if (returnValue==-909) - return -1; return returnValue; } @@ -306,7 +304,6 @@ void QS60StylePrivate::setStyleProperty(const char *name, const QVariant &value) QApplication::setLayoutDirection(m_layoutHeaders[layoutIndex].mirroring ? Qt::RightToLeft : Qt::LeftToRight); clearCaches(); refreshUI(); - return; } } @@ -559,11 +556,11 @@ void QS60StylePrivate::drawRow(QS60StyleEnums::SkinParts start, QRect endRect; if (orientation == Qt::Horizontal) { - startRect.setWidth(qMin(rect.width() / 2 - 1, startRect.width())); + startRect.setWidth(qMin(rect.width() >>1 - 1, startRect.width())); endRect = startRect.translated(rect.width() - startRect.width(), 0); middleRect.adjust(startRect.width(), 0, -startRect.width(), 0); } else { - startRect.setHeight(qMin(rect.height() / 2 - 1, startRect.height())); + startRect.setHeight(qMin(rect.height() >>1 - 1, startRect.height())); endRect = startRect.translated(0, rect.height() - startRect.height()); middleRect.adjust(0, startRect.height(), 0, -startRect.height()); } @@ -691,20 +688,21 @@ void QS60StylePrivate::setThemePalette(QPalette *palette) const palette->setColor(QPalette::LinkVisited, palette->color(QPalette::Link).darker()); palette->setColor(QPalette::Highlight, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 2, 0)); + // set background image as a texture brush + palette->setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture()); // set these as transparent so that styled full screen theme background is visible palette->setColor(QPalette::AlternateBase, Qt::transparent); - palette->setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture()); - palette->setColor(QPalette::Base, Qt::transparent); + palette->setBrush(QPalette::Base, Qt::transparent); // set button and tooltipbase based on pixel colors const QColor buttonColor = this->colorFromFrameGraphics(QS60StylePrivate::SF_ButtonNormal); palette->setColor(QPalette::Button, buttonColor ); + const QColor toolTipColor = this->colorFromFrameGraphics(QS60StylePrivate::SF_ToolTip); + palette->setColor(QPalette::ToolTipBase, toolTipColor ); palette->setColor(QPalette::Light, palette->color(QPalette::Button).lighter()); palette->setColor(QPalette::Dark, palette->color(QPalette::Button).darker()); palette->setColor(QPalette::Midlight, palette->color(QPalette::Button).lighter(125)); palette->setColor(QPalette::Mid, palette->color(QPalette::Button).darker(150)); palette->setColor(QPalette::Shadow, Qt::black); - QColor toolTipColor = this->colorFromFrameGraphics(QS60StylePrivate::SF_ToolTip); - palette->setColor(QPalette::ToolTipBase, toolTipColor ); setThemePaletteHash(palette); QS60StylePrivate::storeThemePalette(palette); @@ -728,6 +726,8 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const //store the original palette QPalette widgetPalette = *palette; + const QColor mainAreaTextColor = + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0); widgetPalette.setColor(QPalette::All, QPalette::WindowText, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0)); @@ -735,20 +735,16 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const // return to original palette after each widget widgetPalette = *palette; - widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); + widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, mainAreaTextColor); + widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, mainAreaTextColor); const QStyleOption opt; widgetPalette.setColor(QPalette::Disabled, QPalette::ButtonText, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, &opt)); QApplication::setPalette(widgetPalette, "QPushButton"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); + widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, mainAreaTextColor); + widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, mainAreaTextColor); QApplication::setPalette(widgetPalette, "QToolButton"); widgetPalette = *palette; @@ -777,11 +773,10 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const QApplication::setPalette(widgetPalette, "QLineEdit"); widgetPalette = *palette; - const QColor color(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::WindowText, color); + widgetPalette.setColor(QPalette::WindowText, mainAreaTextColor); widgetPalette.setColor(QPalette::Button, QApplication::palette().color(QPalette::Button)); - widgetPalette.setColor(QPalette::Dark, color.darker()); - widgetPalette.setColor(QPalette::Light, color.lighter()); + widgetPalette.setColor(QPalette::Dark, mainAreaTextColor.darker()); + widgetPalette.setColor(QPalette::Light, mainAreaTextColor.lighter()); QApplication::setPalette(widgetPalette, "QDial"); widgetPalette = *palette; @@ -890,7 +885,7 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom horizontal ? QS60StylePrivate::SE_ScrollBarGrooveHorizontal : QS60StylePrivate::SE_ScrollBarGrooveVertical; QS60StylePrivate::drawSkinElement(grooveElement, painter, grooveRect, flags); - QStyle::SubControls subControls = optionSlider->subControls; + const QStyle::SubControls subControls = optionSlider->subControls; // select correct slider (horizontal/vertical/pressed) const bool sliderPressed = ((optionSlider->state & QStyle::State_Sunken) && (subControls & SC_ScrollBarSlider)); @@ -942,7 +937,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (const QStyleOptionComboBox *cmb = qstyleoption_cast(option)) { const QRect cmbxEditField = subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget); const QRect cmbxFrame = subControlRect(CC_ComboBox, option, SC_ComboBoxFrame, widget); - const bool direction = cmb->direction == Qt::LeftToRight; // Button frame @@ -960,8 +954,9 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom const QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_FrameLineEdit; QS60StylePrivate::drawSkinElement(skinElement, painter, cmbxEditField, flags); + // Draw the combobox arrow if (sub & SC_ComboBoxArrow) { - // Draw the little arrow + // Make rect slightly smaller buttonOption.rect.adjust(1, 1, -1, -1); painter->save(); painter->setPen(option->palette.buttonText().color()); @@ -1102,14 +1097,13 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (spinBox->subControls & SC_SpinBoxUp) { copy.subControls = SC_SpinBoxUp; - QPalette pal2 = spinBox->palette; + QPalette spinBoxPal = spinBox->palette; if (!(spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) { - pal2.setCurrentColorGroup(QPalette::Disabled); + spinBoxPal.setCurrentColorGroup(QPalette::Disabled); copy.state &= ~State_Enabled; + copy.palette = spinBoxPal; } - copy.palette = pal2; - if (spinBox->activeSubControls == SC_SpinBoxUp && (spinBox->state & State_Sunken)) { copy.state |= State_On; copy.state |= State_Sunken; @@ -1117,8 +1111,9 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom copy.state |= State_Raised; copy.state &= ~State_Sunken; } - pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus - : PE_IndicatorSpinUp); + pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) ? + PE_IndicatorSpinPlus : + PE_IndicatorSpinUp; copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget); drawPrimitive(PE_PanelButtonBevel, ©, painter, widget); @@ -1129,12 +1124,12 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (spinBox->subControls & SC_SpinBoxDown) { copy.subControls = SC_SpinBoxDown; copy.state = spinBox->state; - QPalette pal2 = spinBox->palette; + QPalette spinBoxPal = spinBox->palette; if (!(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) { - pal2.setCurrentColorGroup(QPalette::Disabled); + spinBoxPal.setCurrentColorGroup(QPalette::Disabled); copy.state &= ~State_Enabled; + copy.palette = spinBoxPal; } - copy.palette = pal2; if (spinBox->activeSubControls == SC_SpinBoxDown && (spinBox->state & State_Sunken)) { copy.state |= State_On; @@ -1143,8 +1138,9 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom copy.state |= State_Raised; copy.state &= ~State_Sunken; } - pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus - : PE_IndicatorSpinDown); + pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) ? + PE_IndicatorSpinMinus : + PE_IndicatorSpinDown; copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget); drawPrimitive(PE_PanelButtonBevel, ©, painter, widget); @@ -1352,13 +1348,12 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, // draw themed background for table unless background brush has been defined. if (vopt->backgroundBrush == Qt::NoBrush) { - // draw the background const QStyleOptionViewItemV4 *tableOption = qstyleoption_cast(option); const QTableView *table = qobject_cast(widget); if (table && tableOption) { const QModelIndex index = tableOption->index; //todo: Draw cell background only once - for the first cell. - QStyleOptionViewItemV4 voptAdj2 = voptAdj2; + QStyleOptionViewItemV4 voptAdj2 = voptAdj; const QModelIndex indexFirst = table->model()->index(0,0); const QModelIndex indexLast = table->model()->index( table->model()->rowCount()-1,table->model()->columnCount()-1); @@ -1384,7 +1379,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, listView && (listView->selectionMode() == QAbstractItemView::SingleSelection || listView->selectionMode() == QAbstractItemView::NoSelection); - QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget); + const QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget); if (voptAdj.state & QStyle::State_Selected && !singleSelection) { QStyleOptionViewItemV4 option(voptAdj); option.rect = selectionRect; @@ -1421,9 +1416,11 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, const QStyleOptionViewItemV4 *tableOption = qstyleoption_cast(option); if (isSelected) { if (qobject_cast(widget) && tableOption) - voptAdj.palette.setColor(QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 11, 0)); + voptAdj.palette.setColor( + QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 11, 0)); else - voptAdj.palette.setColor(QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0)); + voptAdj.palette.setColor( + QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0)); } painter->setPen(voptAdj.palette.text().color()); d->viewItemDrawText(painter, &voptAdj, textRect); @@ -1521,7 +1518,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } painter->save(); QFont f = painter->font(); - f.setPointSizeF(f.pointSizeF() * 0.72); + f.setPointSizeF(f.pointSizeF() * KTabFontMul); painter->setFont(f); if (option->state & QStyle::State_Selected){ @@ -1529,27 +1526,27 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 3, option)); } - bool verticalTabs = optionTab.shape == QTabBar::RoundedEast + const bool verticalTabs = optionTab.shape == QTabBar::RoundedEast || optionTab.shape == QTabBar::RoundedWest || optionTab.shape == QTabBar::TriangularEast || optionTab.shape == QTabBar::TriangularWest; - bool selected = optionTab.state & State_Selected; + const bool selected = optionTab.state & State_Selected; if (verticalTabs) { painter->save(); - int newX, newY, newRot; + int newX, newY, newRotation; if (optionTab.shape == QTabBar::RoundedEast || optionTab.shape == QTabBar::TriangularEast) { newX = tr.width(); newY = tr.y(); - newRot = 90; + newRotation = 90; } else { newX = 0; newY = tr.y() + tr.height(); - newRot = -90; + newRotation = -90; } tr.setRect(0, 0, tr.height(), tr.width()); QTransform m; m.translate(newX, newY); - m.rotate(newRot); + m.rotate(newRotation); painter->setTransform(m, true); } tr.adjust(0, 0, pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget), @@ -1571,9 +1568,13 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QPixmap tabIcon = optionTab.icon.pixmap(iconSize, (optionTab.state & State_Enabled) ? QIcon::Normal : QIcon::Disabled); if (tab->text.isEmpty()) - painter->drawPixmap(tr.center().x() - (tabIcon.height() >>1), tr.center().y() - (tabIcon.height() >>1), tabIcon); + painter->drawPixmap(tr.center().x() - (tabIcon.height() >>1), + tr.center().y() - (tabIcon.height() >>1), + tabIcon); else - painter->drawPixmap(tr.left() + tabOverlap, tr.center().y() - (tabIcon.height() >>1), tabIcon); + painter->drawPixmap(tr.left() + tabOverlap, + tr.center().y() - (tabIcon.height() >>1), + tabIcon); tr.setLeft(tr.left() + iconSize.width() + 4); } @@ -1583,13 +1584,13 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (optionTab.state & State_HasFocus) { const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth); - const int x1 = optionTab.rect.left(); - const int x2 = optionTab.rect.right() - 1; + const int leftBorder = optionTab.rect.left(); + const int rightBorder = optionTab.rect.right() - 1; QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*tab); - fropt.rect.setRect(x1 + 1 + OFFSET, optionTab.rect.y() + OFFSET, - x2 - x1 - 2*OFFSET, optionTab.rect.height() - 2*OFFSET); + fropt.rect.setRect(leftBorder + 1 + OFFSET, optionTab.rect.y() + OFFSET, + rightBorder - leftBorder - 2*OFFSET, optionTab.rect.height() - 2*OFFSET); drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); } @@ -1639,25 +1640,12 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } break; #endif // QT_NO_PROGRESSBAR -#ifndef QT_NO_MENUBAR -#endif //QT_NO_MENUBAR #ifndef QT_NO_MENU case CE_MenuItem: if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast(option)) { QStyleOptionMenuItem optionMenuItem = *menuItem; - const bool enabled = optionMenuItem.state & State_Enabled; - const bool checkable = optionMenuItem.checkType != QStyleOptionMenuItem::NotCheckable; - - uint text_flags = Qt::AlignLeading | Qt::TextShowMnemonic | Qt::TextDontClip - | Qt::TextSingleLine | Qt::AlignVCenter; - if (!styleHint(SH_UnderlineShortcut, menuItem, widget)) - text_flags |= Qt::TextHideMnemonic; - - QRect iconRect = - subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget); - QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget); + bool drawSubMenuIndicator = false; - switch(menuItem->menuItemType) { case QStyleOptionMenuItem::Scroller: case QStyleOptionMenuItem::Separator: @@ -1668,20 +1656,29 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, default: break; } + const bool enabled = optionMenuItem.state & State_Enabled; + const bool checkable = optionMenuItem.checkType != QStyleOptionMenuItem::NotCheckable; + + uint text_flags = Qt::AlignLeading | Qt::TextShowMnemonic | Qt::TextDontClip + | Qt::TextSingleLine | Qt::AlignVCenter; + if (!styleHint(SH_UnderlineShortcut, menuItem, widget)) + text_flags |= Qt::TextHideMnemonic; + + QRect iconRect = + subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget); + QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget); if ((option->state & State_Selected) && (option->state & State_Enabled)) QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags); //todo: move the vertical spacing stuff into subElementRect const int vSpacing = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutVerticalSpacing); - QStyleOptionMenuItem optionCheckBox; if (checkable){ - QRect checkBoxRect = optionMenuItem.rect; - checkBoxRect.setWidth(pixelMetric(PM_IndicatorWidth)); - checkBoxRect.setHeight(pixelMetric(PM_IndicatorHeight)); + QStyleOptionMenuItem optionCheckBox; optionCheckBox.QStyleOption::operator=(*menuItem); - optionCheckBox.rect = checkBoxRect; - const int moveByX = checkBoxRect.width()+vSpacing; + optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth)); + optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight)); + const int moveByX = optionCheckBox.rect.width()+vSpacing; if (optionMenuItem.direction == Qt::LeftToRight) { textRect.translate(moveByX,0); iconRect.translate(moveByX, 0); @@ -1732,20 +1729,18 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, optionMenuItem.palette.color(QPalette::Disabled, QPalette::Text))); painter->save(); painter->setOpacity(0.5); - QCommonStyle::drawItemText(painter, textRect, text_flags, + } + QCommonStyle::drawItemText(painter, textRect, text_flags, optionMenuItem.palette, enabled, optionMenuItem.text, QPalette::Text); + if (!enabled) painter->restore(); - } else { - QCommonStyle::drawItemText(painter, textRect, text_flags, - optionMenuItem.palette, enabled, - optionMenuItem.text, QPalette::Text); - } } break; + case CE_MenuEmptyArea: + break; #endif //QT_NO_MENU - case CE_MenuEmptyArea: #ifndef QT_NO_MENUBAR case CE_MenuBarEmptyArea: break; @@ -1775,19 +1770,19 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, case CE_HeaderEmptyArea: { QS60StylePrivate::SkinElementFlags adjFlags = flags; - QRect mtyRect = option->rect; + QRect emptyAreaRect = option->rect; if (option->state & QStyle::State_Horizontal) { - mtyRect.adjust(-2,-2,2,-2); + emptyAreaRect.adjust(-2,-2,2,-2); } else { if ( option->direction == Qt::LeftToRight ) { - mtyRect.adjust(-2,-2,0,2); + emptyAreaRect.adjust(-2,-2,0,2); adjFlags |= QS60StylePrivate::SF_PointWest; } else { - mtyRect.adjust(2,2,0,-2); + emptyAreaRect.adjust(2,2,0,-2); adjFlags |= QS60StylePrivate::SF_PointEast; } } - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, mtyRect, adjFlags); + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, emptyAreaRect, adjFlags); } break; case CE_Header: @@ -1807,7 +1802,19 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } } QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, mtyRect, adjFlags); - QCommonStyle::drawControl(element, header, painter, widget); + + QRegion clipRegion = painter->clipRegion(); + painter->setClipRect(option->rect); + drawControl(CE_HeaderSection, header, painter, widget); + QStyleOptionHeader subopt = *header; + subopt.rect = subElementRect(SE_HeaderLabel, header, widget); + if (subopt.rect.isValid()) + drawControl(CE_HeaderLabel, &subopt, painter, widget); + if (header->sortIndicator != QStyleOptionHeader::None) { + subopt.rect = subElementRect(SE_HeaderArrow, option, widget); + drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget); + } + painter->setClipRegion(clipRegion); } break; #ifndef QT_NO_TOOLBAR @@ -1815,6 +1822,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (const QStyleOptionToolBar *toolBar = qstyleoption_cast(option)) { const QToolBar *tbWidget = qobject_cast(widget); + //toolbar within a toolbar, skip if (!tbWidget || (widget && qobject_cast(widget->parentWidget()))) break; @@ -1890,6 +1898,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti } break; case PE_IndicatorViewItemCheck: +#ifndef QT_NO_ITEMVIEWS if (const QListView *listItem = (qobject_cast(widget))) { if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast(option)) { const bool checkBoxVisible = vopt->features & QStyleOptionViewItemV2::HasCheckIndicator; @@ -1910,9 +1919,9 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti } } } +#endif //QT_NO_ITEMVIEWS break; - case PE_IndicatorRadioButton: - { + case PE_IndicatorRadioButton: { QRect buttonRect = option->rect; //there is empty (a. 33%) space in svg graphics for radiobutton const qreal reduceWidth = (qreal)buttonRect.width()/3.0; @@ -1935,8 +1944,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti case PE_PanelButtonCommand: case PE_PanelButtonTool: case PE_PanelButtonBevel: - case PE_FrameButtonBevel: - { + case PE_FrameButtonBevel: { const bool isPressed = option->state & QStyle::State_Sunken; const QS60StylePrivate::SkinElements skinElement = isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal; @@ -1947,8 +1955,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti case PE_IndicatorArrowDown: case PE_IndicatorArrowLeft: case PE_IndicatorArrowRight: - case PE_IndicatorArrowUp: - { + case PE_IndicatorArrowUp: { QS60StyleEnums::SkinParts skinPart; if (element==PE_IndicatorArrowDown) skinPart = QS60StyleEnums::SP_QgnGrafScrollArrowDown; @@ -2003,6 +2010,8 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti break; #endif //QT_NO_SPINBOX case PE_FrameFocusRect: +// Calendar widget and combox both do not use styled itemDelegate +#if not defined (QT_NO_CALENDARWIDGET) && not defined (QT_NO_COMBOBOX) if (!(widget && qobject_cast(widget->parent())) || qobject_cast(widget)) { // no focus selection for touch @@ -2031,13 +2040,19 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti painter->restore(); } } +#endif //!QT_NO_CALENDARWIDGET && !QT_NO_COMBOBOX break; case PE_Widget: - if (QS60StylePrivate::drawsOwnThemeBackground(widget) || - qobject_cast(widget) || - qobject_cast (widget)) { - QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_OptionsMenu; - QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); + if (QS60StylePrivate::drawsOwnThemeBackground(widget) +#ifndef QT_NO_COMBOBOX + || qobject_cast(widget) +#endif //QT_NO_COMBOBOX +#ifndef QT_NO_MENU + || qobject_cast (widget) +#endif //QT_NO_MENU + ) { + QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_OptionsMenu; + QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); } break; case PE_FrameWindow: @@ -2103,8 +2118,8 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti break; //disable frame in menu case PE_IndicatorBranch: - { #if defined(Q_WS_S60) + // 3.1 AVKON UI does not have tree view component, use common style for drawing there if (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1) { #else if (true) { @@ -2146,7 +2161,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti QS60StylePrivate::drawSkinPart(skinPart, painter, iconRect, flags); } } - } break; // todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases @@ -2179,9 +2193,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti } } -/*! - \reimp -*/ +/*! \reimp */ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const { int metricValue = QS60StylePrivate::pixelMetric(metric); @@ -2197,6 +2209,7 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const } return metricValue; } + /*! \reimp */ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &csz, const QWidget *widget) const @@ -2219,22 +2232,19 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, } return sz; } + /*! \reimp */ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *widget, QStyleHintReturn *hret) const { int retValue = -1; switch (sh) { - case SH_Table_GridLineColor: { - QColor lineColor = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors,2,0); - retValue = lineColor.rgb(); - } - break; - case SH_GroupBox_TextLabelColor: { - QColor groupBoxTxtColor = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors,6,0); - retValue = groupBoxTxtColor.rgb(); - } - break; + case SH_Table_GridLineColor: + retValue = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors,2,0).rgb(); + break; + case SH_GroupBox_TextLabelColor: + retValue = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors,6,0).rgb(); + break; case SH_ScrollBar_ScrollWhenPointerLeavesControl: retValue = true; break; @@ -2260,10 +2270,7 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w return retValue; } - -/*! - \reimp -*/ +/*! \reimp */ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl scontrol, const QWidget *widget) const { QRect ret; @@ -2298,35 +2305,33 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple scrollbarOption->upsideDown); switch (scontrol) { - case SC_ScrollBarSubLine: // top/left button - case SC_ScrollBarAddLine: // bottom/right button - break; - case SC_ScrollBarSubPage: // between top/left button and slider - if (isHorizontal) - ret.setRect(0, 0, sliderstart, scrollBarRect.height()); - else - ret.setRect(0, 0, scrollBarRect.width(), sliderstart); - break; - case SC_ScrollBarAddPage: // between bottom/right button and slider - { + case SC_ScrollBarSubPage: // between top/left button and slider + if (isHorizontal) + ret.setRect(0, 0, sliderstart, scrollBarRect.height()); + else + ret.setRect(0, 0, scrollBarRect.width(), sliderstart); + break; + case SC_ScrollBarAddPage: { // between bottom/right button and slider const int addPageLength = sliderstart + sliderlen; if (isHorizontal) ret = scrollBarRect.adjusted(addPageLength, 0, 0, 0); else ret = scrollBarRect.adjusted(0, addPageLength, 0, 0); - } - break; - case SC_ScrollBarGroove: - ret = scrollBarRect; - break; - case SC_ScrollBarSlider: - if (scrollbarOption->orientation == Qt::Horizontal) - ret.setRect(sliderstart, 0, sliderlen, scrollBarRect.height()); - else - ret.setRect(0, sliderstart, scrollBarRect.width(), sliderlen); - break; - default: - break; + } + break; + case SC_ScrollBarGroove: + ret = scrollBarRect; + break; + case SC_ScrollBarSlider: + if (scrollbarOption->orientation == Qt::Horizontal) + ret.setRect(sliderstart, 0, sliderlen, scrollBarRect.height()); + else + ret.setRect(0, sliderstart, scrollBarRect.width(), sliderlen); + break; + case SC_ScrollBarSubLine: // top/left button + case SC_ScrollBarAddLine: // bottom/right button + default: + break; } ret = visualRect(scrollbarOption->direction, scrollBarRect, ret); } @@ -2344,37 +2349,37 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple const int y = frameThickness + spinbox->rect.y(); const int x = spinbox->rect.x() + spinbox->rect.width() - frameThickness - 2*buttonSize.width(); - + switch (scontrol) { - case SC_SpinBoxUp: - if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) - return QRect(); - ret = QRect(x, y, buttonWidth, buttonSize.height()); - break; - case SC_SpinBoxDown: - if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) - return QRect(); - ret = QRect(x+buttonSize.width(), y, buttonWidth, buttonSize.height()); - break; - case SC_SpinBoxEditField: - if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) - ret = QRect( - frameThickness, - frameThickness, - spinbox->rect.width() - 2*frameThickness, - spinbox->rect.height() - 2*frameThickness); - else - ret = QRect( - frameThickness, - frameThickness, - x - frameThickness, - spinbox->rect.height() - 2*frameThickness); - break; - case SC_SpinBoxFrame: - ret = spinbox->rect; - break; - default: - break; + case SC_SpinBoxUp: + if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) + return QRect(); + ret = QRect(x, y, buttonWidth, buttonSize.height()); + break; + case SC_SpinBoxDown: + if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) + return QRect(); + ret = QRect(x+buttonSize.width(), y, buttonWidth, buttonSize.height()); + break; + case SC_SpinBoxEditField: + if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) + ret = QRect( + frameThickness, + frameThickness, + spinbox->rect.width() - 2*frameThickness, + spinbox->rect.height() - 2*frameThickness); + else + ret = QRect( + frameThickness, + frameThickness, + x - frameThickness, + spinbox->rect.height() - 2*frameThickness); + break; + case SC_SpinBoxFrame: + ret = spinbox->rect; + break; + default: + break; } ret = visualRect(spinbox->direction, spinbox->rect, ret); } @@ -2388,7 +2393,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple // lets use spinbox frame here as well, as no combobox specific value available. const int frameThickness = cmb->frame ? pixelMetric(PM_SpinBoxFrameWidth, cmb, widget) : 0; const int buttonWidth = QS60StylePrivate::pixelMetric(QStyle::PM_ButtonIconSize); - int xposMod = (cmb->rect.x()) + width - buttonMargin - buttonWidth; + const int xposMod = (cmb->rect.x()) + width - buttonMargin - buttonWidth; const int ypos = cmb->rect.y(); QSize buttonSize; @@ -2417,26 +2422,26 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast(option)) { ret = QCommonStyle::subControlRect(control, option, scontrol, widget); switch (scontrol) { - case SC_GroupBoxCheckBox: //fallthrough - case SC_GroupBoxLabel: { - //slightly indent text and boxes, so that dialog border does not mess with them. - const int horizontalSpacing = - QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing); - ret.adjust(2,horizontalSpacing-3,0,0); - } - break; - case SC_GroupBoxFrame: { - const QRect textBox = subControlRect(control, option, SC_GroupBoxLabel, widget); - const int tbHeight = textBox.height(); - ret.translate(0, -ret.y()); - // include title to within the groupBox frame - ret.setHeight(ret.height()+tbHeight); - if (widget && ret.bottom() > widget->rect().bottom()) - ret.setBottom(widget->rect().bottom()); - } - break; - default: - break; + case SC_GroupBoxCheckBox: //fallthrough + case SC_GroupBoxLabel: { + //slightly indent text and boxes, so that dialog border does not mess with them. + const int horizontalSpacing = + QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing); + ret.adjust(2,horizontalSpacing-3,0,0); + } + break; + case SC_GroupBoxFrame: { + const QRect textBox = subControlRect(control, option, SC_GroupBoxLabel, widget); + const int tbHeight = textBox.height(); + ret.translate(0, -ret.y()); + // include title to within the groupBox frame + ret.setHeight(ret.height()+tbHeight); + if (widget && ret.bottom() > widget->rect().bottom()) + ret.setBottom(widget->rect().bottom()); + } + break; + default: + break; } } break; @@ -2454,7 +2459,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con // in S60 the input text box doesn't start from line Edit's TL, but // a bit indented. QRect lineEditRect = opt->rect; - int adjustment = opt->rect.height()>>2; + const int adjustment = opt->rect.height()>>2; lineEditRect.adjust(adjustment,0,0,0); ret = lineEditRect; } @@ -2526,7 +2531,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con } } else if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast(opt)) { const bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable; - int indicatorWidth = checkable ? + const int indicatorWidth = checkable ? pixelMetric(PM_ListViewIconSize, opt, widget) : pixelMetric(PM_SmallIconSize, opt, widget); ret = menuItem->rect; @@ -2546,11 +2551,10 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con // Make room for submenu indicator if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu){ // submenu indicator is very small, so lets halve the rect - indicatorWidth = indicatorWidth >> 1; if (menuItem->direction == Qt::LeftToRight) - ret.adjust(0,0,-indicatorWidth,0); + ret.adjust(0,0,-(indicatorWidth >> 1),0); else - ret.adjust(indicatorWidth,0,0,0); + ret.adjust((indicatorWidth >> 1),0,0,0); } } } @@ -2579,7 +2583,9 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con // Move rect and make it slightly smaller, so that // a) highlight border does not cross the rect // b) in s60 list checkbox is smaller than normal checkbox - ret.setRect(opt->rect.left()+3, opt->rect.top() + heightOffset, indicatorWidth-3, indicatorHeight-3); + //todo; magic three + ret.setRect(opt->rect.left()+3, opt->rect.top() + heightOffset, + indicatorWidth-3, indicatorHeight-3); } else { ret.setRect(opt->rect.right() - indicatorWidth - spacing, opt->rect.top() + heightOffset, indicatorWidth, indicatorHeight); @@ -2654,9 +2660,8 @@ void QS60Style::unpolish(QWidget *widget) #ifndef QT_NO_SCROLLBAR || qobject_cast(widget) #endif - ) { + ) widget->setAttribute(Qt::WA_OpaquePaintEvent); - } if (QS60StylePrivate::drawsOwnThemeBackground(widget)) { widget->setAttribute(Qt::WA_StyledBackground, false); @@ -2674,9 +2679,8 @@ void QS60Style::unpolish(QWidget *widget) widget->setAttribute(Qt::WA_StyledBackground, false); } - if (widget) { + if (widget) widget->setPalette(QPalette()); - } QCommonStyle::unpolish(widget); } @@ -2690,7 +2694,6 @@ void QS60Style::polish(QApplication *application) void QS60Style::unpolish(QApplication *application) { - Q_UNUSED(application) Q_D(QS60Style); const QPalette newPalette = QApplication::style()->standardPalette(); application->setPalette(newPalette); @@ -2717,7 +2720,9 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, QS60StyleEnums::SkinParts part; QS60StylePrivate::SkinElementFlags adjustedFlags; if (option) - adjustedFlags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled; + adjustedFlags = (option->state & State_Enabled) ? + QS60StylePrivate::SF_StateEnabled : + QS60StylePrivate::SF_StateDisabled; switch(standardIcon) { case QStyle::SP_MessageBoxWarning: diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 55e80b9..dbb98c5 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -77,8 +77,10 @@ enum TSupportRelease { ES60_3_1 = 0x0001, ES60_3_2 = 0x0002, ES60_5_0 = 0x0004, + ES60_5_1 = 0x0008, + ES60_5_2 = 0x0010, // Add all new releases here - ES60_AllReleases = ES60_3_1 | ES60_3_2 | ES60_5_0 + ES60_AllReleases = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 }; typedef struct { @@ -89,17 +91,6 @@ typedef struct { int newMinorSkinId; } partMapEntry; -enum TFallbackMbmFile { - EAvkonMbm = 0, - ELastMbm -}; - -typedef struct { - const QS60StyleEnums::SkinParts partID; - TFallbackMbmFile fallbackFileID; //to avoid putting large char strings to table, lets only have a mapping value - int fallbackGraphicID; -} fallbackMapEntry; - class QS60StyleModeSpecifics { public: @@ -644,7 +635,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL( Q_ASSERT(drawType != ENoDraw); const bool rotatedBy90or270 = (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest)); - TSize targetSize = + const TSize targetSize = rotatedBy90or270 ? TSize(size.height(), size.width()) : qt_QSize2TSize(size); MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); @@ -719,7 +710,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL(QS60StylePrivate::SkinFra const bool rotatedBy90or270 = (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest)); - TSize targetSize = + const TSize targetSize = rotatedBy90or270 ? TSize(size.height(), size.width()) : qt_QSize2TSize(size); MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); @@ -901,7 +892,7 @@ void QS60StyleModeSpecifics::checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBit QFont QS60StylePrivate::s60Font_specific( QS60StyleEnums::FontCategories fontCategory, int pointSize) { - enum TAknFontCategory aknFontCategory = EAknFontCategoryUndefined; + TAknFontCategory aknFontCategory = EAknFontCategoryUndefined; switch (fontCategory) { case QS60StyleEnums::FC_Primary: aknFontCategory = EAknFontCategoryPrimary; @@ -1176,8 +1167,8 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap if (displayMode != aTrgBitmap->DisplayMode()) User::Leave(KErrArgument); - TSize trgSize = aTrgBitmap->SizeInPixels(); - TSize srcSize = aSrcBitmap->SizeInPixels(); + const TSize trgSize = aTrgBitmap->SizeInPixels(); + const TSize srcSize = aSrcBitmap->SizeInPixels(); // calculate the valid drawing area TRect drawRect = aTrgRect; @@ -1213,14 +1204,14 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap const TInt drawWidth = drawRect.Width(); const TInt drawHeight = drawRect.Height(); - TRect offsetRect(aTrgRect.iTl, drawRect.iTl); + const TRect offsetRect(aTrgRect.iTl, drawRect.iTl); const TInt yPosOffset = ySkip * offsetRect.Height(); const TInt xPosOffset = xSkip * offsetRect.Width(); if ((displayMode == EGray256) || (displayMode == EColor256)) { - TInt srcScanLen8 = CFbsBitmap::ScanLineLength(srcSize.iWidth, + const TInt srcScanLen8 = CFbsBitmap::ScanLineLength(srcSize.iWidth, displayMode); - TInt trgScanLen8 = CFbsBitmap::ScanLineLength(trgSize.iWidth, + const TInt trgScanLen8 = CFbsBitmap::ScanLineLength(trgSize.iWidth, displayMode); TUint8* trgAddress8 = reinterpret_cast (trgAddress); @@ -1230,7 +1221,7 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap trgAddress8 += trgScanLen8 * drawRect.iTl.iY + drawRect.iTl.iX; for (TInt y = 0; y < drawHeight; y++) { - TUint8* srcAddress8 = reinterpret_cast (srcAddress) + const TUint8* srcAddress8 = reinterpret_cast (srcAddress) + (srcScanLen8 * (yPos >> 8)); TInt xPos = xPosOffset; @@ -1244,9 +1235,9 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap trgAddress8 += trgScanLen8 - drawWidth; } } else if (displayMode == EColor4K || displayMode == EColor64K) { - TInt srcScanLen16 = CFbsBitmap::ScanLineLength(srcSize.iWidth, + const TInt srcScanLen16 = CFbsBitmap::ScanLineLength(srcSize.iWidth, displayMode) >>1; - TInt trgScanLen16 = CFbsBitmap::ScanLineLength(trgSize.iWidth, + const TInt trgScanLen16 = CFbsBitmap::ScanLineLength(trgSize.iWidth, displayMode) >>1; TUint16* trgAddress16 = reinterpret_cast (trgAddress); @@ -1256,7 +1247,7 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap trgAddress16 += trgScanLen16 * drawRect.iTl.iY + drawRect.iTl.iX; for (TInt y = 0; y < drawHeight; y++) { - TUint16* srcAddress16 = reinterpret_cast (srcAddress) + const TUint16* srcAddress16 = reinterpret_cast (srcAddress) + (srcScanLen16 * (yPos >> 8)); TInt xPos = xPosOffset; @@ -1270,9 +1261,9 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap trgAddress16 += trgScanLen16 - drawWidth; } } else if (displayMode == EColor16MU || displayMode == EColor16MA) { - TInt srcScanLen32 = CFbsBitmap::ScanLineLength(srcSize.iWidth, + const TInt srcScanLen32 = CFbsBitmap::ScanLineLength(srcSize.iWidth, displayMode) >>2; - TInt trgScanLen32 = CFbsBitmap::ScanLineLength(trgSize.iWidth, + const TInt trgScanLen32 = CFbsBitmap::ScanLineLength(trgSize.iWidth, displayMode) >>2; TUint32* trgAddress32 = reinterpret_cast (trgAddress); @@ -1282,7 +1273,7 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap trgAddress32 += trgScanLen32 * drawRect.iTl.iY + drawRect.iTl.iX; for (TInt y = 0; y < drawHeight; y++) { - TUint32* srcAddress32 = reinterpret_cast (srcAddress) + const TUint32* srcAddress32 = reinterpret_cast (srcAddress) + (srcScanLen32 * (yPos >> 8)); TInt xPos = xPosOffset; @@ -1302,8 +1293,8 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap QSize QS60StylePrivate::screenSize() { - TSize mySize = QS60Data::screenDevice()->SizeInPixels(); - return QSize(mySize.iWidth, mySize.iHeight); + const TSize screenSize = QS60Data::screenDevice()->SizeInPixels(); + return QSize(screenSize.iWidth, screenSize.iHeight); } void QS60StyleModeSpecifics::colorGroupAndIndex( -- cgit v0.12 From d53a3282598b7bfa5c48627ffa0b04763cccfdf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 4 Jun 2009 12:19:03 +0300 Subject: S60Style: Missing constant --- src/gui/styles/qs60style.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 7db0992..e7ba1bb 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -146,6 +146,7 @@ static const int frameElementsCount = int(sizeof(QS60StylePrivate::m_frameElementsData)/sizeof(QS60StylePrivate::m_frameElementsData[0])); const int KNotFound = -909; +const double KTabFontMul = 0.72; QS60StylePrivate::~QS60StylePrivate() { -- cgit v0.12 From 422905e301394dfd23b59a09ac9a725803ddf4e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 4 Jun 2009 14:41:07 +0300 Subject: S60Style: Buildbreak fix. Remove problematic #ifdef line. --- src/gui/styles/qs60style.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index e7ba1bb..83f5a6b 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2012,7 +2012,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti #endif //QT_NO_SPINBOX case PE_FrameFocusRect: // Calendar widget and combox both do not use styled itemDelegate -#if not defined (QT_NO_CALENDARWIDGET) && not defined (QT_NO_COMBOBOX) if (!(widget && qobject_cast(widget->parent())) || qobject_cast(widget)) { // no focus selection for touch @@ -2041,7 +2040,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti painter->restore(); } } -#endif //!QT_NO_CALENDARWIDGET && !QT_NO_COMBOBOX break; case PE_Widget: if (QS60StylePrivate::drawsOwnThemeBackground(widget) -- cgit v0.12 From 2b6dda723b168b3379684bc89b128ea1e792eddf Mon Sep 17 00:00:00 2001 From: Iain Date: Thu, 4 Jun 2009 17:18:59 +0200 Subject: Correctly scope local variables in switch statement (for GCC 4.3) --- src/corelib/tools/qlocale_symbian.cpp | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index b58a5d5..c11a7b9 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -272,11 +272,14 @@ static QString s60ToQtFormat(const QString &sys_fmt) switch (c.unicode()) { case 'F': + { // locale indep mode on locale_indep_ordering = true; break; + } case '/': + { // date sep 0-3 ++i; if (i >= sys_fmt.size()) @@ -291,8 +294,10 @@ static QString s60ToQtFormat(const QString &sys_fmt) result += QChar(val); } break; + } case 'D': + { if (!locale_indep_ordering) break; @@ -302,8 +307,10 @@ static QString s60ToQtFormat(const QString &sys_fmt) result += QLatin1Char('d'); break; + } case 'M': + { if (!locale_indep_ordering) break; @@ -320,8 +327,10 @@ static QString s60ToQtFormat(const QString &sys_fmt) } break; + } case 'N': + { n_mode = true; if (!locale_indep_ordering) @@ -333,8 +342,10 @@ static QString s60ToQtFormat(const QString &sys_fmt) result += QLatin1String("MMM"); break; + } case 'Y': + { if (!locale_indep_ordering) break; @@ -344,16 +355,20 @@ static QString s60ToQtFormat(const QString &sys_fmt) result += QLatin1String("yy"); break; + } case 'E': + { if (!abbrev_next) result += QLatin1String("dddd"); else result += QLatin1String("ddd"); break; + } case ':': + { // timesep 0-3 ++i; if (i >= sys_fmt.size()) @@ -369,47 +384,60 @@ static QString s60ToQtFormat(const QString &sys_fmt) } break; + } case 'J': + { if (tf == ETime24 && !abbrev_next) result += QLatin1String("hh"); else result += QLatin1Char('h'); break; + } case 'H': + { if (!abbrev_next) result += QLatin1String("hh"); else result += QLatin1Char('h'); break; + } case 'I': + { result += QLatin1Char('h'); break; + } case 'T': + { if (!abbrev_next) result += QLatin1String("mm"); else result += QLatin1Char('m'); break; + } case 'S': + { if (!abbrev_next) result += QLatin1String("ss"); else result += QLatin1Char('s'); break; + } case 'B': + { // only done for 12h clock if (tf == ETime24) break; + } // fallthru to A case 'A': { @@ -445,6 +473,7 @@ static QString s60ToQtFormat(const QString &sys_fmt) break; case 'C': + { // six digits in s60, three digits in qt if (!abbrev_next) { result += QLatin1String("zzz"); @@ -468,6 +497,7 @@ static QString s60ToQtFormat(const QString &sys_fmt) } } break; + } // these cases fallthru case '1': @@ -475,6 +505,7 @@ static QString s60ToQtFormat(const QString &sys_fmt) case '3': case '4': case '5': + { // shouldn't parse these with %F if (locale_indep_ordering) @@ -503,17 +534,24 @@ static QString s60ToQtFormat(const QString &sys_fmt) result += QLatin1String(locale_dep[offset + (c.digitValue()-1)]); break; + } case '%': // fallthru percent + { // any junk gets copied as is + } default: + { result += c; break; + } case 'Z': // Qt doesn't support these :( case 'X': case 'W': + { break; + } } } else { // double any single quotes, don't begin escape -- cgit v0.12 From 9196781f93fd60e869fededc83e32168868632cb Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 4 Jun 2009 23:26:40 +0200 Subject: Loading fonts from other /resource/fonts folders than the one on Z: Order is 'soft to hard' W:, X: ... A:, Z: Duplicated font file names are ignored. That should imitate the font loading behaviour in the fbSrv. --- src/gui/text/qfontdatabase_s60.cpp | 44 ++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index ab9291f..416c3d1 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -55,6 +55,39 @@ QT_BEGIN_NAMESPACE +QFileInfoList alternativeFilePaths(const QString &path, const QStringList &nameFilters, + QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort, + bool uniqueFileNames = true) +{ + QFileInfoList result; + + // Prepare a 'soft to hard' drive list: W:, X: ... A:, Z: + QStringList driveStrings; + foreach (const QFileInfo &drive, QDir::drives()) + driveStrings.append(drive.absolutePath()); + driveStrings.sort(); + const QString zDriveString("Z:/"); + driveStrings.removeAll(zDriveString); + driveStrings.prepend(zDriveString); + + QStringList uniqueFileNameList; + for (int i = driveStrings.count() - 1; i >= 0; --i) { + const QDir dirOnDrive(driveStrings.at(i) + path); + const QFileInfoList entriesOnDrive = dirOnDrive.entryInfoList(nameFilters, filters, sort); + if (uniqueFileNames) { + foreach(const QFileInfo &entry, entriesOnDrive) { + if (!uniqueFileNameList.contains(entry.fileName())) { + uniqueFileNameList.append(entry.fileName()); + result.append(entry); + } + } + } else { + result.append(entriesOnDrive); + } + } + return result; +} + #if defined(QT_NO_FREETYPE) class QFontDatabaseS60StoreImplementation : public QFontDatabaseS60Store { @@ -77,10 +110,13 @@ QFontDatabaseS60StoreImplementation::QFontDatabaseS60StoreImplementation() m_store = CFontStore::NewL(m_heap); m_rasterizer = COpenFontRasterizer::NewL(TUid::Uid(0x101F7F5E)); m_store->InstallRasterizerL(m_rasterizer); - QDir dir(QDesktopServices::storageLocation(QDesktopServices::FontsLocation)); - dir.setNameFilters(QStringList() << QLatin1String("*.ttf") << QLatin1String("*.ccc")); - for (int i = 0; i < int(dir.count()); ++i) { - const QString fontFile = QDir::toNativeSeparators(dir.absoluteFilePath(dir[i])); + + QStringList filters; + filters.append(QString::fromLatin1("*.ttf")); + filters.append(QString::fromLatin1("*.ccc")); + const QFileInfoList fontFiles = alternativeFilePaths(QString::fromLatin1("resource\\Fonts"), filters); + foreach (const QFileInfo &fontFileInfo, fontFiles) { + const QString fontFile = QDir::toNativeSeparators(fontFileInfo.absoluteFilePath()); m_store->AddFileL(qt_QString2TPtrC(fontFile)); } } -- cgit v0.12 From 958b66dd60aac48909a5ba32282e088e68d9a9c7 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 5 Jun 2009 11:05:01 +1000 Subject: Set UID for QtScriptTools --- src/scripttools/scripttools.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/scripttools/scripttools.pro b/src/scripttools/scripttools.pro index faf0936a..5878db2 100644 --- a/src/scripttools/scripttools.pro +++ b/src/scripttools/scripttools.pro @@ -10,3 +10,5 @@ unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtScript include(../qbase.pri) include(debugging/debugging.pri) + +symbian:TARGET.UID3=0x2001E625 -- cgit v0.12 From 04b4e2254e59fcb8776044d5d627e7f0d8daeacf Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 5 Jun 2009 10:14:12 +0200 Subject: Turned off input methods on X11 when using certain hints. If any of those hints are present, complex input is not possible, so input methods should be turned off on X11. --- src/gui/inputmethod/qximinputcontext_x11.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/inputmethod/qximinputcontext_x11.cpp b/src/gui/inputmethod/qximinputcontext_x11.cpp index c320fb4..60ea15b 100644 --- a/src/gui/inputmethod/qximinputcontext_x11.cpp +++ b/src/gui/inputmethod/qximinputcontext_x11.cpp @@ -610,7 +610,7 @@ void QXIMInputContext::setFocusWidget(QWidget *w) QInputContext::setFocusWidget(w); - if (!w) + if (!w || w->inputMethodHints() & Qt::ImhExclusiveInputMask) return; ICData *data = ximData.value(w->effectiveWinId()); -- cgit v0.12