diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-07-12 22:10:36 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-07-12 22:10:36 (GMT) |
commit | e0f3449e2462cb86dd37b812b0a5f0834122139b (patch) | |
tree | 10affd7be894641a125c5876ecfc38007421aabb | |
parent | a7d4d0e522a120541d0273f577558820950d9dd3 (diff) | |
parent | cb9a45c3d2655b44a6b40c45540f9b96dcaf1119 (diff) | |
download | Qt-e0f3449e2462cb86dd37b812b0a5f0834122139b.zip Qt-e0f3449e2462cb86dd37b812b0a5f0834122139b.tar.gz Qt-e0f3449e2462cb86dd37b812b0a5f0834122139b.tar.bz2 |
Merge branch '4.7' of git://scm.dev.nokia.troll.no/qt/qt-water-team
* '4.7' of git://scm.dev.nokia.troll.no/qt/qt-water-team:
Remove broken link to Symbian.org documentation.
Check engine existence before increasing reference count
Keep reference count for cached font engines in QTextEngine
Optimize text layout.
Fix crash when app font is added
Backporting fix for QTBUG-18716
Fixing WINSCW compile error
-rw-r--r-- | doc/src/deployment/deployment.qdoc | 11 | ||||
-rw-r--r-- | doc/src/external-resources.qdoc | 5 | ||||
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_p.h | 1 | ||||
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 10 | ||||
-rw-r--r-- | src/gui/kernel/qt_s60_p.h | 2 | ||||
-rw-r--r-- | src/gui/text/qtextengine.cpp | 118 | ||||
-rw-r--r-- | src/gui/text/qtextengine_p.h | 21 | ||||
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 22 | ||||
-rw-r--r-- | src/plugins/bearer/symbian/symbianengine.cpp | 21 | ||||
-rw-r--r-- | src/plugins/bearer/symbian/symbianengine.h | 2 | ||||
-rw-r--r-- | src/s60installs/bwins/QtGuiu.def | 1 | ||||
-rw-r--r-- | src/s60installs/eabi/QtGuiu.def | 1 |
12 files changed, 144 insertions, 71 deletions
diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc index 74a34ee..d9b169c 100644 --- a/doc/src/deployment/deployment.qdoc +++ b/doc/src/deployment/deployment.qdoc @@ -1555,15 +1555,4 @@ For more information about creating a \c .sis file and installing it to device see also \l {The Symbian platform - Introduction to Qt#Installing your own applications}{here}. - - \section1 Further Reading - - This document aims to cover the common case for developers who want to - deploy Qt applications on devices using the Smart Installer. It does not - aim to cover every possible way of installing applications, Qt and other - dependencies on a device. - - A wider selection of deployment methods is described in the - \l{Deploying a Qt Application article} on the Symbian Foundation - Developer Wiki. */ diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index 04d7ccb..50e5a21 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -425,11 +425,6 @@ */ /*! - \externalpage http://developer.symbian.org/wiki/index.php/Deploying_a_Qt_Application - \title Deploying a Qt Application article -*/ - -/*! \externalpage http://www.ecma-international.org/publications/standards/Ecma-262.htm \title ECMAScript Language Specification */ diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 9fd2703..9857015 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -170,6 +170,7 @@ private: }; Q_GUI_EXPORT void qt_s60_setPartialScreenInputMode(bool enable); +Q_GUI_EXPORT void qt_s60_setPartialScreenAutomaticTranslation(bool enable); QT_END_NAMESPACE diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 567f83b..c3d293b 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -95,6 +95,11 @@ Q_GUI_EXPORT void qt_s60_setPartialScreenInputMode(bool enable) ic->update(); } +Q_GUI_EXPORT void qt_s60_setPartialScreenAutomaticTranslation(bool enable) +{ + S60->partial_keyboardAutoTranslation = enable; +} + QCoeFepInputContext::QCoeFepInputContext(QObject *parent) : QInputContext(parent), m_fepState(q_check_ptr(new CAknEdwinState)), // CBase derived object needs check on new @@ -612,12 +617,13 @@ void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget) widget->resize(widget->width(), splitViewRect.height() - windowTop); } - if (gv->scene()) { + if (gv->scene() && S60->partial_keyboardAutoTranslation) { const QRectF microFocusRect = gv->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF(); gv->ensureVisible(microFocusRect); } } else { - translateInputWidget(); + if (S60->partial_keyboardAutoTranslation) + translateInputWidget(); } if (alwaysResize) diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index fccb44d..35cea5f 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -153,6 +153,7 @@ public: int menuBeingConstructed : 1; int orientationSet : 1; int partial_keyboard : 1; + int partial_keyboardAutoTranslation : 1; int partialKeyboardOpen : 1; int handleStatusPaneResizeNotifications : 1; QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type @@ -343,6 +344,7 @@ inline QS60Data::QS60Data() menuBeingConstructed(0), orientationSet(0), partial_keyboard(0), + partial_keyboardAutoTranslation(1), partialKeyboardOpen(0), handleStatusPaneResizeNotifications(1), s60ApplicationFactory(0) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 9271f34..648f5c0 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1385,6 +1385,15 @@ void QTextEngine::shape(int item) const } } +static inline void releaseCachedFontEngine(QFontEngine *fontEngine) +{ + if (fontEngine) { + fontEngine->ref.deref(); + if (fontEngine->cache_count == 0 && fontEngine->ref == 0) + delete fontEngine; + } +} + void QTextEngine::invalidate() { freeMemory(); @@ -1392,6 +1401,10 @@ void QTextEngine::invalidate() maxWidth = 0; if (specialData) specialData->resolvedFormatIndices.clear(); + + releaseCachedFontEngine(feCache.prevFontEngine); + releaseCachedFontEngine(feCache.prevScaledFontEngine); + feCache.reset(); } void QTextEngine::clearLineData() @@ -1783,6 +1796,13 @@ QFont QTextEngine::font(const QScriptItem &si) const return font; } +QTextEngine::FontEngineCache::FontEngineCache() +{ + reset(); +} + +//we cache the previous results of this function, as calling it numerous times with the same effective +//input is common (and hard to cache at a higher level) QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFixed *descent, QFixed *leading) const { QFontEngine *engine = 0; @@ -1791,28 +1811,53 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix QFont font = fnt; if (hasFormats()) { - QTextCharFormat f = format(&si); - font = f.font(); - - if (block.docHandle() && block.docHandle()->layout()) { - // Make sure we get the right dpi on printers - QPaintDevice *pdev = block.docHandle()->layout()->paintDevice(); - if (pdev) - font = QFont(font, pdev); + if (feCache.prevFontEngine && feCache.prevPosition == si.position && feCache.prevLength == length(&si) && feCache.prevScript == script) { + engine = feCache.prevFontEngine; + scaledEngine = feCache.prevScaledFontEngine; } else { - font = font.resolve(fnt); - } - engine = font.d->engineForScript(script); - QTextCharFormat::VerticalAlignment valign = f.verticalAlignment(); - if (valign == QTextCharFormat::AlignSuperScript || valign == QTextCharFormat::AlignSubScript) { - if (font.pointSize() != -1) - font.setPointSize((font.pointSize() * 2) / 3); - else - font.setPixelSize((font.pixelSize() * 2) / 3); - scaledEngine = font.d->engineForScript(script); + QTextCharFormat f = format(&si); + font = f.font(); + + if (block.docHandle() && block.docHandle()->layout()) { + // Make sure we get the right dpi on printers + QPaintDevice *pdev = block.docHandle()->layout()->paintDevice(); + if (pdev) + font = QFont(font, pdev); + } else { + font = font.resolve(fnt); + } + engine = font.d->engineForScript(script); + QTextCharFormat::VerticalAlignment valign = f.verticalAlignment(); + if (valign == QTextCharFormat::AlignSuperScript || valign == QTextCharFormat::AlignSubScript) { + if (font.pointSize() != -1) + font.setPointSize((font.pointSize() * 2) / 3); + else + font.setPixelSize((font.pixelSize() * 2) / 3); + scaledEngine = font.d->engineForScript(script); + } + feCache.prevFontEngine = engine; + if (engine) + engine->ref.ref(); + feCache.prevScaledFontEngine = scaledEngine; + if (scaledEngine) + scaledEngine->ref.ref(); + feCache.prevScript = script; + feCache.prevPosition = si.position; + feCache.prevLength = length(&si); } } else { - engine = font.d->engineForScript(script); + if (feCache.prevFontEngine && feCache.prevScript == script && feCache.prevPosition == -1) + engine = feCache.prevFontEngine; + else { + engine = font.d->engineForScript(script); + feCache.prevFontEngine = engine; + if (engine) + engine->ref.ref(); + feCache.prevScript = script; + feCache.prevPosition = -1; + feCache.prevLength = -1; + feCache.prevScaledFontEngine = 0; + } } if (si.analysis.flags == QScriptAnalysis::SmallCaps) { @@ -2778,6 +2823,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; @@ -2785,13 +2846,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; } @@ -2800,18 +2858,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 09610ff..c920c7b 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -311,11 +311,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; @@ -556,6 +558,23 @@ public: mutable QScriptLineArray lines; + struct FontEngineCache { + FontEngineCache(); + mutable QFontEngine *prevFontEngine; + mutable QFontEngine *prevScaledFontEngine; + mutable int prevScript; + mutable int prevPosition; + mutable int prevLength; + inline void reset() { + prevFontEngine = 0; + prevScaledFontEngine = 0; + prevScript = -1; + prevPosition = -1; + prevLength = -1; + } + }; + mutable FontEngineCache feCache; + QString text; QFont fnt; QTextBlock block; diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 0fbf838..183bcea 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -386,6 +386,7 @@ QTextLayout::~QTextLayout() void QTextLayout::setFont(const QFont &font) { d->fnt = font; + d->feCache.reset(); } /*! @@ -518,6 +519,7 @@ void QTextLayout::setAdditionalFormats(const QList<FormatRange> &formatList) } if (d->block.docHandle()) d->block.docHandle()->documentChange(d->block.position(), d->block.length()); + d->feCache.reset(); } /*! @@ -1867,14 +1869,14 @@ void QTextLine::layout_helper(int maxGlyphs) lbh.currentPosition = qMax(line.from, current.position); end = current.position + eng->length(item); lbh.glyphs = eng->shapedGlyphs(¤t); + QFontEngine *fontEngine = eng->fontEngine(current); + if (lbh.fontEngine != fontEngine) { + lbh.fontEngine = fontEngine; + lbh.minimumRightBearing = qMin(QFixed(), + QFixed::fromReal(fontEngine->minRightBearing())); + } } const QScriptItem ¤t = eng->layoutData->items[item]; - QFontEngine *fontEngine = eng->fontEngine(current); - if (lbh.fontEngine != fontEngine) { - lbh.fontEngine = fontEngine; - lbh.minimumRightBearing = qMin(QFixed(), - QFixed::fromReal(fontEngine->minRightBearing())); - } lbh.tmpData.leading = qMax(lbh.tmpData.leading + lbh.tmpData.ascent, current.leading + current.ascent) - qMax(lbh.tmpData.ascent, @@ -2319,13 +2321,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/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 04edbb7..38ae0c8 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -104,15 +104,7 @@ void SymbianEngine::initialize() return; } - TRAP(error, { - iConnectionMonitor.ConnectL(); - CleanupClosePushL(iConnectionMonitor); -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - User::LeaveIfError(iConnectionMonitor.SetUintAttribute(EBearerIdAll, 0, KBearerGroupThreshold, 1)); -#endif - iConnectionMonitor.NotifyEventL(*this); - CleanupStack::Pop(); - }); + TRAP(error, StartConnectionMonitorNotifyL()); if (error != KErrNone) { iInitOk = false; return; @@ -148,6 +140,17 @@ void SymbianEngine::initialize() startCommsDatabaseNotifications(); } +void SymbianEngine::StartConnectionMonitorNotifyL() +{ + iConnectionMonitor.ConnectL(); + CleanupClosePushL(iConnectionMonitor); +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + User::LeaveIfError(iConnectionMonitor.SetUintAttribute(EBearerIdAll, 0, KBearerGroupThreshold, 1)); +#endif + iConnectionMonitor.NotifyEventL(*this); + CleanupStack::Pop(); +} + SymbianEngine::~SymbianEngine() { Cancel(); diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index 3b3a78a..7455d25 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -184,6 +184,8 @@ private: void startMonitoringIAPData(TUint32 aIapId); QNetworkConfigurationPrivatePointer dataByConnectionId(TUint aConnectionId); + void StartConnectionMonitorNotifyL(); + protected: // From CActive void RunL(); diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 9b70ee8..e9e58c8 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -13113,4 +13113,5 @@ EXPORTS ?hasBCM2727@QSymbianGraphicsSystemEx@@SA_NXZ @ 13112 NONAME ; bool QSymbianGraphicsSystemEx::hasBCM2727(void) ?constImageRef@QVolatileImage@@QBEABVQImage@@XZ @ 13113 NONAME ; class QImage const & QVolatileImage::constImageRef(void) const ?toVolatileImage@QPixmapData@@UBE?AVQVolatileImage@@XZ @ 13114 NONAME ; class QVolatileImage QPixmapData::toVolatileImage(void) const + ?qt_s60_setPartialScreenAutomaticTranslation@@YAX_N@Z @ 13115 NONAME ; void qt_s60_setPartialScreenAutomaticTranslation(bool) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 0f9442d..939398b 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12197,4 +12197,5 @@ EXPORTS _ZTV24QSymbianGraphicsSystemEx @ 12196 NONAME _ZNK11QPixmapData15toVolatileImageEv @ 12197 NONAME _ZNK14QVolatileImage13constImageRefEv @ 12198 NONAME + _Z43qt_s60_setPartialScreenAutomaticTranslationb @ 12199 NONAME |