From 779123b79cc27599f73a61b2f2055a32cc15230a Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Tue, 13 Apr 2010 17:37:06 +0200 Subject: Implement OpenVG buffer scrolling and enable it on Symbian. Add support for accelerated scrolling in the "direct" window surface implementation. Using vgCopyPixels(), the already rasterized content on the surface can be shifted to a new location such that only a portion of the suqsequent frame needs to be repainted instead of the entire frame. This only works when the "preserved" EGL swap behavior is enabled and the impact on performance is highly dependant on the specific hardware platform in use. Task-number: QT-2972 Reviewed-by: Rhys Weatherley --- doc/src/howtos/openvg.qdoc | 10 ++++++++++ doc/src/platforms/emb-openvg.qdocinc | 6 ++++++ src/openvg/openvg.pro | 2 +- src/openvg/qwindowsurface_vg.cpp | 5 ++++- src/openvg/qwindowsurface_vgegl.cpp | 27 +++++++++++++++++++++++++++ src/openvg/qwindowsurface_vgegl_p.h | 4 ++++ 6 files changed, 52 insertions(+), 2 deletions(-) diff --git a/doc/src/howtos/openvg.qdoc b/doc/src/howtos/openvg.qdoc index 9c805bb..f70ed54 100644 --- a/doc/src/howtos/openvg.qdoc +++ b/doc/src/howtos/openvg.qdoc @@ -295,6 +295,16 @@ Convolution, colorize, drop shadow, and blur filters are accelerated using OpenVG operations. + \section2 Scrolling + + By default, accelerated scrolling is not enabled because the impact on + performance is very much tied to the hardware platform. To enable + accelerated scrolling, you should ensure that QVG_BUFFER_SCROLLING is + defined when compiling the QtOpenVG module. + + You should only enable this feature if vgCopyPixels() is known to be + efficient on your hardware platform. + \section1 Known issues Performance of copying the contents of an OpenVG-rendered window to the diff --git a/doc/src/platforms/emb-openvg.qdocinc b/doc/src/platforms/emb-openvg.qdocinc index 37ccb9c..2f9cc21 100644 --- a/doc/src/platforms/emb-openvg.qdocinc +++ b/doc/src/platforms/emb-openvg.qdocinc @@ -259,6 +259,12 @@ at present. \o Convolution, colorize, drop shadow, and blur filters are accelerated using OpenVG operations. + \row + \o Scrolling + \o Accelerated scrolling is implemented but disabled by default +unless QVG_BUFFER_SCROLLING is defined. This should only be enabled on +OpenVG engines where vgCopyPixels() is known to be efficient. + \endtable \section2 Known issues diff --git a/src/openvg/openvg.pro b/src/openvg/openvg.pro index 3790492..883f0f3 100644 --- a/src/openvg/openvg.pro +++ b/src/openvg/openvg.pro @@ -33,7 +33,7 @@ contains(QT_CONFIG, egl) { qwindowsurface_vgegl.cpp } -symbian: DEFINES += QVG_RECREATE_ON_SIZE_CHANGE +symbian: DEFINES += QVG_RECREATE_ON_SIZE_CHANGE QVG_BUFFER_SCROLLING include(../qbase.pri) diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp index 83b0764..c19d5d1 100644 --- a/src/openvg/qwindowsurface_vg.cpp +++ b/src/openvg/qwindowsurface_vg.cpp @@ -57,6 +57,7 @@ QVGWindowSurface::QVGWindowSurface(QWidget *window) { // Create the default type of EGL window surface for windows. d_ptr = new QVGEGLWindowSurfaceDirect(this); + setStaticContentsSupport(d_ptr->supportsStaticContents()); } QVGWindowSurface::QVGWindowSurface @@ -89,7 +90,9 @@ void QVGWindowSurface::setGeometry(const QRect &rect) bool QVGWindowSurface::scroll(const QRegion &area, int dx, int dy) { - return QWindowSurface::scroll(area, dx, dy); + if (!d_ptr->scroll(window(), area, dx, dy)) + return QWindowSurface::scroll(area, dx, dy); + return true; } void QVGWindowSurface::beginPaint(const QRegion ®ion) diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index 46a905f..99b614b 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -758,6 +758,33 @@ void QVGEGLWindowSurfaceDirect::endPaint } } +bool QVGEGLWindowSurfaceDirect::supportsStaticContents() const +{ +#if defined(QVG_BUFFER_SCROLLING) && !defined(QVG_NO_PRESERVED_SWAP) + return true; +#else + return QVGEGLWindowSurfacePrivate::supportsStaticContents(); +#endif +} + +bool QVGEGLWindowSurfaceDirect::scroll(QWidget *widget, const QRegion& area, int dx, int dy) +{ +#ifdef QVG_BUFFER_SCROLLING + QEglContext *context = ensureContext(widget); + if (context) { + context->makeCurrent(windowSurface); + QRect scrollRect = area.boundingRect(); + int sx = scrollRect.x(); + int sy = size.height() - scrollRect.y() - scrollRect.height(); + vgSeti(VG_SCISSORING, VG_FALSE); + vgCopyPixels(sx + dx, sy - dy, sx, sy, scrollRect.width(), scrollRect.height()); + context->lazyDoneCurrent(); + return true; + } +#endif + return false; +} + QT_END_NAMESPACE #endif diff --git a/src/openvg/qwindowsurface_vgegl_p.h b/src/openvg/qwindowsurface_vgegl_p.h index aa0c648..892fd9d 100644 --- a/src/openvg/qwindowsurface_vgegl_p.h +++ b/src/openvg/qwindowsurface_vgegl_p.h @@ -77,6 +77,8 @@ public: (QWidget *widget, const QRegion& region, QImage *image = 0) = 0; virtual VGImage surfaceImage() const; virtual QSize surfaceSize() const = 0; + virtual bool supportsStaticContents() const { return false; } + virtual bool scroll(QWidget *, const QRegion&, int, int) { return false; } private: QVGPaintEngine *engine; @@ -128,6 +130,8 @@ public: void beginPaint(QWidget *widget); void endPaint(QWidget *widget, const QRegion& region, QImage *image); QSize surfaceSize() const { return size; } + bool supportsStaticContents() const; + bool scroll(QWidget *widget, const QRegion& area, int dx, int dy); protected: QEglContext *context; -- cgit v0.12 From 4d3d85e1a9de727329e8a8df3b572a778e2da6e2 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 14 Apr 2010 11:25:58 +0200 Subject: QFtp: Fix possible crash Task-number: QTBUG-7359 --- src/network/access/qftp.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index efeef4e..7f6df0a 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -2309,6 +2309,12 @@ void QFtpPrivate::_q_piFinished(const QString&) void QFtpPrivate::_q_piError(int errorCode, const QString &text) { Q_Q(QFtp); + + if (pending.isEmpty()) { + qWarning() << "QFtpPrivate::_q_piError was called without pending command!"; + return; + } + QFtpCommand *c = pending.first(); // non-fatal errors -- cgit v0.12 From 00f01532342713e4adae0ce8ccd332829acfeec0 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 14 Apr 2010 11:47:24 +0200 Subject: Improve test coverage of QtScript translation functions And fix two silly typos in the error messages. --- src/script/api/qscriptengine.cpp | 4 +-- tests/auto/qscriptengine/tst_qscriptengine.cpp | 42 ++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index ccd3e56..9bd98f1 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -663,7 +663,7 @@ JSC::JSValue JSC_HOST_CALL functionQsTranslate(JSC::ExecState *exec, JSC::JSObje else if (encStr == QLatin1String("UnicodeUTF8")) encoding = QCoreApplication::UnicodeUTF8; else - return JSC::throwError(exec, JSC::GeneralError, QString::fromLatin1("qsTranslate(): invalid encoding '%s'").arg(encStr)); + return JSC::throwError(exec, JSC::GeneralError, QString::fromLatin1("qsTranslate(): invalid encoding '%0'").arg(encStr)); } int n = -1; if (args.size() > 4) @@ -697,7 +697,7 @@ JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JS if ((args.size() > 1) && !args.at(1).isString()) return JSC::throwError(exec, JSC::GeneralError, "qsTr(): second argument (comment) must be a string"); if ((args.size() > 2) && !args.at(2).isNumber()) - return JSC::throwError(exec, JSC::GeneralError, "qsTranslate(): third argument (n) must be a number"); + return JSC::throwError(exec, JSC::GeneralError, "qsTr(): third argument (n) must be a number"); #ifndef QT_NO_QOBJECT QString context; // The first non-empty source URL in the call stack determines the translation context. diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index aa5c85d..674e502 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -155,6 +155,8 @@ private slots: void installTranslatorFunctions_data(); void installTranslatorFunctions(); void translateScript(); + void translateWithInvalidArgs_data(); + void translateWithInvalidArgs(); void functionScopes(); void nativeFunctionScopes(); void evaluateProgram(); @@ -4341,6 +4343,15 @@ void tst_QScriptEngine::translateScript() QCOMPARE(engine.evaluate("eval('qsTranslate(\\'FooContext\\', \\'Two\\')')", fileName).toString(), QString::fromLatin1("To")); QCOMPARE(engine.evaluate("eval('qsTranslate(\\'FooContext\\', \\'Goodbye\\')')", fileName).toString(), QString::fromLatin1("Farvel")); + QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'Goodbye', '', 'UnicodeUTF8')", fileName).toString(), QString::fromLatin1("Farvel")); + + QVERIFY(engine.evaluate("QT_TR_NOOP()").isUndefined()); + QCOMPARE(engine.evaluate("QT_TR_NOOP('One')").toString(), QString::fromLatin1("One")); + + QVERIFY(engine.evaluate("QT_TRANSLATE_NOOP()").isUndefined()); + QVERIFY(engine.evaluate("QT_TRANSLATE_NOOP('FooContext')").isUndefined()); + QCOMPARE(engine.evaluate("QT_TRANSLATE_NOOP('FooContext', 'Two')").toString(), QString::fromLatin1("Two")); + // Don't exist in translation QCOMPARE(engine.evaluate("qsTr('Three')", fileName).toString(), QString::fromLatin1("Three")); QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'So long')", fileName).toString(), QString::fromLatin1("So long")); @@ -4354,6 +4365,37 @@ void tst_QScriptEngine::translateScript() QCoreApplication::instance()->removeTranslator(&translator); } +void tst_QScriptEngine::translateWithInvalidArgs_data() +{ + QTest::addColumn("expression"); + QTest::addColumn("expectedError"); + + QTest::newRow("qsTr()") << "qsTr()" << "Error: qsTr() requires at least one argument"; + QTest::newRow("qsTr(123)") << "qsTr(123)" << "Error: qsTr(): first argument (text) must be a string"; + QTest::newRow("qsTr('foo', 123)") << "qsTr('foo', 123)" << "Error: qsTr(): second argument (comment) must be a string"; + QTest::newRow("qsTr('foo', 'bar', 'baz')") << "qsTr('foo', 'bar', 'baz')" << "Error: qsTr(): third argument (n) must be a number"; + QTest::newRow("qsTr('foo', 'bar', true)") << "qsTr('foo', 'bar', true)" << "Error: qsTr(): third argument (n) must be a number"; + + QTest::newRow("qsTranslate()") << "qsTranslate()" << "Error: qsTranslate() requires at least two arguments"; + QTest::newRow("qsTranslate('foo')") << "qsTranslate('foo')" << "Error: qsTranslate() requires at least two arguments"; + QTest::newRow("qsTranslate('foo', 123)") << "qsTranslate('foo', 123)" << "Error: qsTranslate(): second argument (text) must be a string"; + QTest::newRow("qsTranslate('foo', 'bar', 123)") << "qsTranslate('foo', 'bar', 123)" << "Error: qsTranslate(): third argument (comment) must be a string"; + QTest::newRow("qsTranslate('foo', 'bar', 'baz', 123)") << "qsTranslate('foo', 'bar', 'baz', 123)" << "Error: qsTranslate(): fourth argument (encoding) must be a string"; + QTest::newRow("qsTranslate('foo', 'bar', 'baz', 'zab', 'rab')") << "qsTranslate('foo', 'bar', 'baz', 'zab', 'rab')" << "Error: qsTranslate(): fifth argument (n) must be a number"; + QTest::newRow("qsTranslate('foo', 'bar', 'baz', 'zab', 123)") << "qsTranslate('foo', 'bar', 'baz', 'zab', 123)" << "Error: qsTranslate(): invalid encoding 'zab'"; +} + +void tst_QScriptEngine::translateWithInvalidArgs() +{ + QFETCH(QString, expression); + QFETCH(QString, expectedError); + QScriptEngine engine; + engine.installTranslatorFunctions(); + QScriptValue result = engine.evaluate(expression); + QVERIFY(result.isError()); + QCOMPARE(result.toString(), expectedError); +} + void tst_QScriptEngine::functionScopes() { QScriptEngine eng; -- cgit v0.12 From e4d03c6b56decd63035a7c46498dae2d2a483c09 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Wed, 14 Apr 2010 13:03:38 +0300 Subject: QS60Style: Sometimes progressbars do not animate Style removes every progressbar from animation list whenever *any* QWidget is hidden/shown. To ensure that the animation list is only tempered with possible animation supporting qwidgets, re-interpret cast them to QProgressBar. If this works, then clear the animation list. Task-number: QTBUG-9836 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 28cbc45..f154b2d 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -3313,8 +3313,10 @@ bool QS60Style::eventFilter(QObject *object, QEvent *event) break; case QEvent::Destroy: case QEvent::Hide: - d->stopAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim); - d->m_bars.removeAll(reinterpret_cast(object)); + if (QProgressBar *bar = reinterpret_cast(object)) { + d->stopAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim); + d->m_bars.removeAll(bar); + } break; default: break; -- cgit v0.12 From fcd009cd77f95106f4522103bab9aaf86109a17d Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 14 Apr 2010 11:28:09 +0200 Subject: QAbstractScrollArea StyleSheet: fix drawing of border with SH_ScrollView_FrameOnlyAroundContents - Since Qt 4.6.0, the frame is drawn by PE_Widget, but there we do not take in account the scrollbar for the case where SH_ScrollView_FrameOnlyAroundContents is true. - We also reserved too much space for the border, as we included the native border as well in the computation, so do not reserve additional space by setting PM_ScrollView_ScrollBarSpacing to 0 Task-number: QTBUG-9821 Reviewed-by: jbache --- src/gui/styles/qstylesheetstyle.cpp | 16 ++++++++++++++-- src/gui/widgets/qabstractscrollarea.cpp | 2 +- tests/auto/uiloader/baseline/css_scroll.ui | 14 ++++++++------ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index c550938..285a789 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -4242,8 +4242,15 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op if (const QAbstractScrollArea *sa = qobject_cast(w)) { const QAbstractScrollAreaPrivate *sap = sa->d_func(); rule.drawBackground(p, opt->rect, sap->contentsOffset()); - if (rule.hasBorder()) - rule.drawBorder(p, rule.borderRect(opt->rect)); + if (rule.hasBorder()) { + QRect brect = rule.borderRect(opt->rect); + if (styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, opt, w)) { + QRect r = brect.adjusted(0, 0, sa->verticalScrollBar()->isVisible() ? -sa->verticalScrollBar()->width() : 0, + sa->horizontalScrollBar()->isVisible() ? -sa->horizontalScrollBar()->height() : 0); + brect = QStyle::visualRect(opt->direction, brect, r); + } + rule.drawBorder(p, brect); + } break; } #endif @@ -4628,6 +4635,11 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const return msz.width() == -1 ? msz.height() : msz.width(); } break; + + case PM_ScrollView_ScrollBarSpacing: + if(!rule.hasNativeBorder() || rule.hasBox()) + return 0; + break; #endif // QT_NO_SCROLLBAR case PM_ProgressBarChunkWidth: diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index 1d496d5..73ec53e 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -394,7 +394,7 @@ void QAbstractScrollAreaPrivate::layoutChildren() if ((frameStyle != QFrame::NoFrame) && q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &opt, q)) { controlsRect = widgetRect; - const int extra = q->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing); + const int extra = q->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, &opt, q); const QPoint cornerExtra(needv ? extra : 0, needh ? extra : 0); QRect frameRect = widgetRect; frameRect.adjust(0, 0, -cornerOffset.x() - cornerExtra.x(), -cornerOffset.y() - cornerExtra.y()); diff --git a/tests/auto/uiloader/baseline/css_scroll.ui b/tests/auto/uiloader/baseline/css_scroll.ui index 0537ab0..6ac6886 100644 --- a/tests/auto/uiloader/baseline/css_scroll.ui +++ b/tests/auto/uiloader/baseline/css_scroll.ui @@ -14,8 +14,10 @@ Form - QScrollArea { background:red; } -QScrollArea .QWidget { background:transparent; } + QScrollArea { background:red; + border: 5px dashed blue; } +QScrollArea .QWidget { background:transparent; + border: 5px dotted green;} QScrollArea::corner { background:yellow; } @@ -111,10 +113,10 @@ QScrollArea::corner { background:yellow; } - -60 - -145 - 554 - 575 + 0 + 0 + 520 + 532 -- cgit v0.12 From 1c5c69b01659acc33bb49ffe4b078848b6a2a9de Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Wed, 14 Apr 2010 13:06:28 +0300 Subject: QS60Style: In a very short combobox, text is cut If QComboBox is very short, it is possible that the combobox text is cut. This is due to two reasons: 1) Style does not take into account text eliding (which should be preferred over clipping) 2) Clipping text rect is done with orginal text rect, before it is adjusted for borders, icons etc. Style is changed that it doesn't use clipping rect and uses text eliding. Task-number: QTBUG-9837 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index f154b2d..0ebfe39 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1372,14 +1372,13 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, optionComboBox.palette.setColor(QPalette::Inactive, QPalette::WindowText, optionComboBox.palette.text().color() ); QRect editRect = subControlRect(CC_ComboBox, comboBox, SC_ComboBoxEditField, widget); - painter->save(); - painter->setClipRect(editRect); + const int frameW = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget); if (!comboBox->currentIcon.isNull()) { - QIcon::Mode mode = comboBox->state & State_Enabled ? QIcon::Normal : QIcon::Disabled; - QPixmap pixmap = comboBox->currentIcon.pixmap(comboBox->iconSize, mode); + const QIcon::Mode mode = comboBox->state & State_Enabled ? QIcon::Normal : QIcon::Disabled; + const QPixmap pixmap = comboBox->currentIcon.pixmap(comboBox->iconSize, mode); QRect iconRect(editRect); - iconRect.setWidth(comboBox->iconSize.width() + 4); + iconRect.setWidth(comboBox->iconSize.width() + frameW); iconRect = alignedRect(comboBox->direction, Qt::AlignLeft | Qt::AlignVCenter, iconRect.size(), editRect); @@ -1388,17 +1387,19 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); if (comboBox->direction == Qt::RightToLeft) - editRect.translate(-4 - comboBox->iconSize.width(), 0); + editRect.setRight(editRect.right() - frameW - comboBox->iconSize.width()); else - editRect.translate(comboBox->iconSize.width() + 4, 0); + editRect.setLeft(comboBox->iconSize.width() + frameW); } if (!comboBox->currentText.isEmpty() && !comboBox->editable) { + const Qt::TextElideMode elideMode = (comboBox->direction == Qt::LeftToRight) ? Qt::ElideRight : Qt::ElideLeft; + const QString text = comboBox->fontMetrics.elidedText(comboBox->currentText, elideMode, editRect.width()); + QCommonStyle::drawItemText(painter, editRect.adjusted(QS60StylePrivate::pixelMetric(PM_FrameCornerWidth), 0, -1, 0), visualAlignment(comboBox->direction, Qt::AlignLeft | Qt::AlignVCenter), - comboBox->palette, comboBox->state & State_Enabled, comboBox->currentText); + comboBox->palette, comboBox->state & State_Enabled, text); } - painter->restore(); } break; #endif //QT_NO_COMBOBOX -- cgit v0.12 From 401aabde0d3da0e819a046f1eee47bb5f3a2d5d2 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Wed, 14 Apr 2010 13:11:10 +0300 Subject: QS60Style: HouseKeeping task Remove unnecessary comment. Added one @todo comment. Some whitespace corrections. Removed unnecessary QStyle scopes. Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 0ebfe39..27913cd 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1542,7 +1542,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); const int tabOverlap = QS60StylePrivate::pixelMetric(PM_TabBarTabOverlap) - borderThickness; - //todo: draw navi wipe behind tabbar - must be drawn with first draw if (skinElement==QS60StylePrivate::SE_TabBarTabEastInactive|| skinElement==QS60StylePrivate::SE_TabBarTabEastActive|| @@ -1646,7 +1645,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, painter->drawPixmap(tr.left() + tabOverlap, tr.center().y() - (tabIcon.height() >> 1), tabIcon); - tr.setLeft(tr.left() + iconSize.width() + 4); + tr.setLeft(tr.left() + iconSize.width() + 4); //todo: magic four } QCommonStyle::drawItemText(painter, tr, alignment, optionTab.palette, tab->state & State_Enabled, tab->text, QPalette::WindowText); @@ -1965,14 +1964,14 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, // We need to reduce the focus frame size if LayoutSpacing is smaller than FocusFrameMargin // Otherwise, we would overlay adjacent widgets. const int frameHeightReduction = - qMin(0, pixelMetric(QStyle::PM_LayoutVerticalSpacing) - - pixelMetric(QStyle::PM_FocusFrameVMargin)); + qMin(0, pixelMetric(PM_LayoutVerticalSpacing) + - pixelMetric(PM_FocusFrameVMargin)); const int frameWidthReduction = - qMin(0, pixelMetric(QStyle::PM_LayoutHorizontalSpacing) - - pixelMetric(QStyle::PM_FocusFrameHMargin)); + qMin(0, pixelMetric(PM_LayoutHorizontalSpacing) + - pixelMetric(PM_FocusFrameHMargin)); const int rounding = - qMin(pixelMetric(QStyle::PM_FocusFrameVMargin), - pixelMetric(QStyle::PM_LayoutVerticalSpacing)); + qMin(pixelMetric(PM_FocusFrameVMargin), + pixelMetric(PM_LayoutVerticalSpacing)); const QRect frameRect = option->rect.adjusted(-frameWidthReduction, -frameHeightReduction, frameWidthReduction, frameHeightReduction); @@ -2848,7 +2847,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con const int tabOverlapNoBorder = QS60StylePrivate::pixelMetric(PM_TabBarTabOverlap); const int tabOverlap = - tabOverlapNoBorder-QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); + tabOverlapNoBorder - QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); const QTabWidget *tab = qobject_cast(widget); int gain = (tab) ? tabOverlap * tab->count() : 0; switch (twf->shape) { @@ -2914,7 +2913,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con ret = QRect(); } else { if (menuItem->direction == Qt::RightToLeft) - ret.translate(ret.width()-indicatorWidth, 0); + ret.translate(ret.width() - indicatorWidth, 0); ret.setWidth(indicatorWidth); } } else { -- cgit v0.12 From aea71e2e02fa966842b094244bc3f5fc88f50f41 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 Apr 2010 12:56:33 +0200 Subject: Fix autotest failure: QIODevice::read() on a closed device must return -1 --- src/corelib/io/qiodevice.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index f83c142..f2cef4e1 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -755,6 +755,7 @@ qint64 QIODevice::bytesToWrite() const qint64 QIODevice::read(char *data, qint64 maxSize) { Q_D(QIODevice); + CHECK_READABLE(read, qint64(-1)); #if defined QIODEVICE_DEBUG printf("%p QIODevice::read(%p, %d), d->pos = %d, d->buffer.size() = %d\n", -- cgit v0.12 From f3a0bd8827f5d0de575b0f8c044b4bf65405b69c Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 14 Apr 2010 17:15:49 +0200 Subject: merge commit c638ddc70f6a8196f2c8b11808ab01510233a0ee from harfbuzz: commit c638ddc70f6a8196f2c8b11808ab01510233a0ee Author: Lars Knoll Date: Wed Apr 14 17:01:49 2010 +0200 Fix a bug in malayalam shaping See http://bugreports.qt.nokia.com/browse/QTBUG-1887. We were not finding the base character correctly in the case where the syllable contained a ZWJ. In addition, the indic OT specs require us to also apply the 'loca', 'cjct' and 'calt' features. They seem to be mostly unused by todays fonts, but we should better apply them anyways. Task-number: QTBUG-1887 Reviewed-by: Eskil --- src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp | 23 ++- .../harfbuzz/src/harfbuzz-shaper-private.h | 55 +++---- src/3rdparty/harfbuzz/tests/shaping/main.cpp | 165 ++++++++++++++++++--- .../qtextscriptengine/tst_qtextscriptengine.cpp | 2 + 4 files changed, 195 insertions(+), 50 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp index 3c9df93..4d8418b 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp @@ -1107,6 +1107,7 @@ static inline void splitMatra(unsigned short *reordered, int matra, int &len) #ifndef NO_OPENTYPE static const HB_OpenTypeFeature indic_features[] = { + { HB_MAKE_TAG('l', 'o', 'c', 'a'), LocaProperty }, { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, { HB_MAKE_TAG('i', 'n', 'i', 't'), InitProperty }, { HB_MAKE_TAG('n', 'u', 'k', 't'), NuktaProperty }, @@ -1115,12 +1116,14 @@ static const HB_OpenTypeFeature indic_features[] = { { HB_MAKE_TAG('b', 'l', 'w', 'f'), BelowFormProperty }, { HB_MAKE_TAG('h', 'a', 'l', 'f'), HalfFormProperty }, { HB_MAKE_TAG('p', 's', 't', 'f'), PostFormProperty }, + { HB_MAKE_TAG('c', 'j', 'c', 't'), ConjunctFormProperty }, { HB_MAKE_TAG('v', 'a', 't', 'u'), VattuProperty }, { HB_MAKE_TAG('p', 'r', 'e', 's'), PreSubstProperty }, { HB_MAKE_TAG('b', 'l', 'w', 's'), BelowSubstProperty }, { HB_MAKE_TAG('a', 'b', 'v', 's'), AboveSubstProperty }, { HB_MAKE_TAG('p', 's', 't', 's'), PostSubstProperty }, { HB_MAKE_TAG('h', 'a', 'l', 'n'), HalantProperty }, + { HB_MAKE_TAG('c', 'a', 'l', 't'), IndicCaltProperty }, { 0, 0 } }; #endif @@ -1148,6 +1151,8 @@ static QString propertiesToString(int properties) { QString res; properties = ~properties; + if (properties & LocaProperty) + res += "Loca "; if (properties & CcmpProperty) res += "Ccmp "; if (properties & InitProperty) @@ -1168,6 +1173,8 @@ static QString propertiesToString(int properties) res += "HalfForm "; if (properties & PostFormProperty) res += "PostForm "; + if (properties & ConjunctFormProperty) + res += "PostForm "; if (properties & VattuProperty) res += "Vattu "; if (properties & PreSubstProperty) @@ -1182,6 +1189,8 @@ static QString propertiesToString(int properties) res += "Halant "; if (properties & CligProperty) res += "Clig "; + if (properties & IndicCaltProperty) + res += "Calt "; return res; } #endif @@ -1296,10 +1305,15 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv } int skipped = 0; Position pos = Post; - for (i = len-1; i > base; i--) { + for (i = len-1; i >= base; i--) { if (position[i] != Consonant && (position[i] != Control || script == HB_Script_Kannada)) continue; + if (i < len-1 && position[i] == Control && position[i+1] == Consonant) { + base = i+1; + break; + } + Position charPosition = indic_position(uc[i]); if (pos == Post && charPosition == Post) { pos = Post; @@ -1545,16 +1559,20 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv // features we should always apply for (i = 0; i < len; ++i) - properties[i] = ~(CcmpProperty + properties[i] = ~(LocaProperty + | CcmpProperty | NuktaProperty | VattuProperty + | ConjunctFormProperty | PreSubstProperty | BelowSubstProperty | AboveSubstProperty | PostSubstProperty | HalantProperty + | IndicCaltProperty | PositioningProperties); + // Loca always applies // Ccmp always applies // Init if (item->item.pos == 0 @@ -1611,6 +1629,7 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv // abvs always applies // psts always applies // halant always applies + // calt always applies #ifdef INDIC_DEBUG // { diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h index 80bccf8..2fce7df 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h @@ -57,34 +57,37 @@ typedef enum } HB_CombiningClass; typedef enum { - CcmpProperty = 0x1, - InitProperty = 0x2, - IsolProperty = 0x4, - FinaProperty = 0x8, - MediProperty = 0x10, - RligProperty = 0x20, - CaltProperty = 0x40, - LigaProperty = 0x80, - DligProperty = 0x100, - CswhProperty = 0x200, - MsetProperty = 0x400, + LocaProperty = 0x1, + CcmpProperty = 0x2, + InitProperty = 0x4, + IsolProperty = 0x8, + FinaProperty = 0x10, + MediProperty = 0x20, + RligProperty = 0x40, + CaltProperty = 0x80, + LigaProperty = 0x100, + DligProperty = 0x200, + CswhProperty = 0x400, + MsetProperty = 0x800, /* used by indic and myanmar shaper */ - NuktaProperty = 0x4, - AkhantProperty = 0x8, - RephProperty = 0x10, - PreFormProperty = 0x20, - BelowFormProperty = 0x40, - AboveFormProperty = 0x80, - HalfFormProperty = 0x100, - PostFormProperty = 0x200, - VattuProperty = 0x400, - PreSubstProperty = 0x800, - BelowSubstProperty = 0x1000, - AboveSubstProperty = 0x2000, - PostSubstProperty = 0x4000, - HalantProperty = 0x8000, - CligProperty = 0x10000 + NuktaProperty = 0x8, + AkhantProperty = 0x10, + RephProperty = 0x20, + PreFormProperty = 0x40, + BelowFormProperty = 0x80, + AboveFormProperty = 0x100, + HalfFormProperty = 0x200, + PostFormProperty = 0x400, + ConjunctFormProperty = 0x800, + VattuProperty = 0x1000, + PreSubstProperty = 0x2000, + BelowSubstProperty = 0x4000, + AboveSubstProperty = 0x8000, + PostSubstProperty = 0x10000, + HalantProperty = 0x20000, + CligProperty = 0x40000, + IndicCaltProperty = 0x80000 } HB_OpenTypeProperty; diff --git a/src/3rdparty/harfbuzz/tests/shaping/main.cpp b/src/3rdparty/harfbuzz/tests/shaping/main.cpp index 827ac30..28f8e07 100644 --- a/src/3rdparty/harfbuzz/tests/shaping/main.cpp +++ b/src/3rdparty/harfbuzz/tests/shaping/main.cpp @@ -136,13 +136,13 @@ HB_Error hb_getPointInOutline(HB_Font font, HB_Glyph glyph, int flags, hb_uint32 return HB_Err_Ok; } -void hb_getGlyphMetrics(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics) +void hb_getGlyphMetrics(HB_Font, HB_Glyph, HB_GlyphMetrics *metrics) { // ### metrics->x = metrics->y = metrics->width = metrics->height = metrics->xOffset = metrics->yOffset = 0; } -HB_Fixed hb_getFontMetric(HB_Font font, HB_FontMetric metric) +HB_Fixed hb_getFontMetric(HB_Font, HB_FontMetric ) { return 0; // #### } @@ -169,6 +169,8 @@ public slots: void initTestCase(); void cleanupTestCase(); private slots: + void greek(); + void devanagari(); void bengali(); void gurmukhi(); @@ -203,18 +205,25 @@ void tst_QScriptEngine::cleanupTestCase() FT_Done_FreeType(freetype); } -struct ShapeTable { - unsigned short unicode[16]; - unsigned short glyphs[16]; +class Shaper +{ +public: + Shaper(FT_Face face, HB_Script script, const QString &str); + + HB_FontRec hbFont; + HB_ShaperItem shaper_item; + QVarLengthArray hb_glyphs; + QVarLengthArray hb_attributes; + QVarLengthArray hb_advances; + QVarLengthArray hb_offsets; + QVarLengthArray hb_logClusters; + }; -static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) +Shaper::Shaper(FT_Face face, HB_Script script, const QString &str) { - QString str = QString::fromUtf16( s->unicode ); - HB_Face hbFace = HB_NewFace(face, hb_getSFntTable); - HB_FontRec hbFont; hbFont.klass = &hb_fontClass; hbFont.userData = face; hbFont.x_ppem = face->size->metrics.x_ppem; @@ -222,7 +231,6 @@ static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) hbFont.x_scale = face->size->metrics.x_scale; hbFont.y_scale = face->size->metrics.y_scale; - HB_ShaperItem shaper_item; shaper_item.kerning_applied = false; shaper_item.string = reinterpret_cast(str.constData()); shaper_item.stringLength = str.length(); @@ -237,11 +245,6 @@ static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) shaper_item.glyphIndicesPresent = false; shaper_item.initialGlyphCount = 0; - QVarLengthArray hb_glyphs(shaper_item.num_glyphs); - QVarLengthArray hb_attributes(shaper_item.num_glyphs); - QVarLengthArray hb_advances(shaper_item.num_glyphs); - QVarLengthArray hb_offsets(shaper_item.num_glyphs); - QVarLengthArray hb_logClusters(shaper_item.num_glyphs); while (1) { hb_glyphs.resize(shaper_item.num_glyphs); @@ -263,10 +266,66 @@ static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) if (HB_ShapeItem(&shaper_item)) break; - } HB_FreeFace(hbFace); +} + + +static bool decomposedShaping(FT_Face face, HB_Script script, const QChar &ch) +{ + QString uc = QString().append(ch); + Shaper shaper(face, script, uc); + + uc = uc.normalized(QString::NormalizationForm_D); + Shaper decomposed(face, script, uc); + + if( shaper.shaper_item.num_glyphs != decomposed.shaper_item.num_glyphs ) + goto error; + + for (unsigned int i = 0; i < shaper.shaper_item.num_glyphs; ++i) { + if ((shaper.shaper_item.glyphs[i]&0xffffff) != (decomposed.shaper_item.glyphs[i]&0xffffff)) + goto error; + } + return true; + error: + QString str = ""; + int i = 0; + while (i < uc.length()) { + str += QString("%1 ").arg(uc[i].unicode(), 4, 16); + ++i; + } + qDebug("%s: decomposedShaping of char %4x failed\n decomposedString: %s\n nglyphs=%d, decomposed nglyphs %d", + face->family_name, + ch.unicode(), str.toLatin1().data(), + shaper.shaper_item.num_glyphs, + decomposed.shaper_item.num_glyphs); + + str = ""; + i = 0; + while (i < shaper.shaper_item.num_glyphs) { + str += QString("%1 ").arg(shaper.shaper_item.glyphs[i], 4, 16); + ++i; + } + qDebug(" composed glyph result = %s", str.toLatin1().constData()); + str = ""; + i = 0; + while (i < decomposed.shaper_item.num_glyphs) { + str += QString("%1 ").arg(decomposed.shaper_item.glyphs[i], 4, 16); + ++i; + } + qDebug(" decomposed glyph result = %s", str.toLatin1().constData()); + return false; +} + +struct ShapeTable { + unsigned short unicode[16]; + unsigned short glyphs[16]; +}; + +static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) +{ + Shaper shaper(face, script, QString::fromUtf16( s->unicode )); hb_uint32 nglyphs = 0; const unsigned short *g = s->glyphs; @@ -275,16 +334,16 @@ static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) g++; } - if( nglyphs != shaper_item.num_glyphs ) + if( nglyphs != shaper.shaper_item.num_glyphs ) goto error; for (hb_uint32 i = 0; i < nglyphs; ++i) { - if ((shaper_item.glyphs[i]&0xffffff) != s->glyphs[i]) + if ((shaper.shaper_item.glyphs[i]&0xffffff) != s->glyphs[i]) goto error; } return true; error: - str = ""; + QString str = ""; const unsigned short *uc = s->unicode; while (*uc) { str += QString("%1 ").arg(*uc, 4, 16); @@ -293,18 +352,78 @@ static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) qDebug("%s: shaping of string %s failed, nglyphs=%d, expected %d", face->family_name, str.toLatin1().constData(), - shaper_item.num_glyphs, nglyphs); + shaper.shaper_item.num_glyphs, nglyphs); str = ""; hb_uint32 i = 0; - while (i < shaper_item.num_glyphs) { - str += QString("%1 ").arg(shaper_item.glyphs[i], 4, 16); + while (i < shaper.shaper_item.num_glyphs) { + str += QString("%1 ").arg(shaper.shaper_item.glyphs[i], 4, 16); ++i; } qDebug(" glyph result = %s", str.toLatin1().constData()); return false; } + +void tst_QScriptEngine::greek() +{ + FT_Face face = loadFace("DejaVuSans.ttf"); + if (face) { + for (int uc = 0x1f00; uc <= 0x1fff; ++uc) { + QString str; + str.append(uc); + if (str.normalized(QString::NormalizationForm_D).normalized(QString::NormalizationForm_C) != str) { + //qDebug() << "skipping" << hex << uc; + continue; + } + if (uc == 0x1fc1 || uc == 0x1fed) + continue; + QVERIFY( decomposedShaping(face, HB_Script_Greek, QChar(uc)) ); + } + FT_Done_Face(face); + } else { + QSKIP("couln't find DejaVu Sans", SkipAll); + } + + + face = loadFace("SBL_grk.ttf"); + if (face) { + for (int uc = 0x1f00; uc <= 0x1fff; ++uc) { + QString str; + str.append(uc); + if (str.normalized(QString::NormalizationForm_D).normalized(QString::NormalizationForm_C) != str) { + //qDebug() << "skipping" << hex << uc; + continue; + } + if (uc == 0x1fc1 || uc == 0x1fed) + continue; + QVERIFY( decomposedShaping(face, HB_Script_Greek, QChar(uc)) ); + + } + + const ShapeTable shape_table [] = { + { { 0x3b1, 0x300, 0x313, 0x0 }, + { 0xb8, 0x3d3, 0x3c7, 0x0 } }, + { { 0x3b1, 0x313, 0x300, 0x0 }, + { 0xd4, 0x0 } }, + + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Greek) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find DejaVu Sans", SkipAll); + } +} + + void tst_QScriptEngine::devanagari() { { @@ -1011,6 +1130,8 @@ void tst_QScriptEngine::malayalam() { 0x3f8, 0x0 } }, { { 0xd2f, 0xd4d, 0xd15, 0xd4d, 0xd15, 0xd41, 0x0 }, { 0x2ff, 0x0 } }, + { { 0xd30, 0xd4d, 0x200d, 0xd35, 0xd4d, 0xd35, 0x0 }, + { 0xf3, 0x350, 0x0 } }, { {0}, {0} } }; diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp index 6de3f59..940e78d 100644 --- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp @@ -870,6 +870,8 @@ void tst_QTextScriptEngine::malayalam() { 0x3f8, 0x0 } }, { { 0xd2f, 0xd4d, 0xd15, 0xd4d, 0xd15, 0xd41, 0x0 }, { 0x2ff, 0x0 } }, + { { 0xd30, 0xd4d, 0x200d, 0xd35, 0xd4d, 0xd35, 0x0 }, + { 0xf3, 0x350, 0x0 } }, { {0}, {0} } }; -- cgit v0.12 From a3d6d4db2c12123873b809a9605b3ab50c740294 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 14 Apr 2010 18:22:35 +0200 Subject: QtScript: Fix call stack issue with qsTr() when JIT is enabled When the JIT is enabled, as well as JIT_OPTIMIZE_NATIVE_CALL defined, NativeFunctionWrapper is a typedef for JSFunction. This has the consequence that the native call frame will not be fully initialized by JIT-generated code (because it shouldn't have to); in particular, ExecState::codeBlock() is not set up. qsTr() relies on codeBlock() to return a sensible value, though, so it breaks this contract. By making qsTr a PrototypeFunction, the JIT will detect that the function call needs more elaborate setup, i.e. initialize codeBlock() as well. Reviewed-by: Olivier Goffart --- src/script/api/qscriptengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 9bd98f1..9ce0f7d 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -2939,7 +2939,7 @@ void QScriptEngine::installTranslatorFunctions(const QScriptValue &object) // unsigned attribs = JSC::DontEnum; JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 5, JSC::Identifier(exec, "qsTranslate"), QScript::functionQsTranslate)); JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 2, JSC::Identifier(exec, "QT_TRANSLATE_NOOP"), QScript::functionQsTranslateNoOp)); - JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 3, JSC::Identifier(exec, "qsTr"), QScript::functionQsTr)); + JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::PrototypeFunction(exec, glob->prototypeFunctionStructure(), 3, JSC::Identifier(exec, "qsTr"), QScript::functionQsTr)); JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec, "QT_TR_NOOP"), QScript::functionQsTrNoOp)); glob->stringPrototype()->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec, "arg"), QScript::stringProtoFuncArg)); -- cgit v0.12 From b84be32658f053a89e589ff66913213fb0d0b8e7 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 14 Apr 2010 12:15:43 +0200 Subject: QtScript: Add test for translation disambiguation --- tests/auto/qscriptengine/translatable.js | 2 ++ .../auto/qscriptengine/translations/translatable_la.qm | Bin 241 -> 315 bytes .../auto/qscriptengine/translations/translatable_la.ts | 6 ++++++ tests/auto/qscriptengine/tst_qscriptengine.cpp | 2 ++ 4 files changed, 10 insertions(+) diff --git a/tests/auto/qscriptengine/translatable.js b/tests/auto/qscriptengine/translatable.js index 0c948e7..30e139a 100644 --- a/tests/auto/qscriptengine/translatable.js +++ b/tests/auto/qscriptengine/translatable.js @@ -5,3 +5,5 @@ var greeting_strings = [ QT_TR_NOOP("Hello"), QT_TRANSLATE_NOOP("FooContext", "Goodbye") ]; + +qsTr("One", "not the same one"); diff --git a/tests/auto/qscriptengine/translations/translatable_la.qm b/tests/auto/qscriptengine/translations/translatable_la.qm index 03fcc52..301cc77 100644 Binary files a/tests/auto/qscriptengine/translations/translatable_la.qm and b/tests/auto/qscriptengine/translations/translatable_la.qm differ diff --git a/tests/auto/qscriptengine/translations/translatable_la.ts b/tests/auto/qscriptengine/translations/translatable_la.ts index 3f631de..4eed72d 100644 --- a/tests/auto/qscriptengine/translations/translatable_la.ts +++ b/tests/auto/qscriptengine/translations/translatable_la.ts @@ -27,6 +27,12 @@ Hallo + + One + not the same one + Enda en + + Goodbye Farvel diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 674e502..aa06bc9 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -4345,6 +4345,8 @@ void tst_QScriptEngine::translateScript() QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'Goodbye', '', 'UnicodeUTF8')", fileName).toString(), QString::fromLatin1("Farvel")); + QCOMPARE(engine.evaluate("qsTr('One', 'not the same one')", fileName).toString(), QString::fromLatin1("Enda en")); + QVERIFY(engine.evaluate("QT_TR_NOOP()").isUndefined()); QCOMPARE(engine.evaluate("QT_TR_NOOP('One')").toString(), QString::fromLatin1("One")); -- cgit v0.12 From 9415afbd2ca6a4b136ecdc4cb4936e15cc523229 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 14 Apr 2010 18:49:35 +0200 Subject: QtScript: Add tests for translation of multiple scripts Suggested by Olivier. --- tests/auto/qscriptengine/translatable2.js | 9 +++++ .../qscriptengine/translations/translatable_la.qm | Bin 315 -> 678 bytes .../qscriptengine/translations/translatable_la.ts | 32 +++++++++++++++++ tests/auto/qscriptengine/tst_qscriptengine.cpp | 40 +++++++++++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 tests/auto/qscriptengine/translatable2.js diff --git a/tests/auto/qscriptengine/translatable2.js b/tests/auto/qscriptengine/translatable2.js new file mode 100644 index 0000000..eee66f1 --- /dev/null +++ b/tests/auto/qscriptengine/translatable2.js @@ -0,0 +1,9 @@ +qsTr("Three"); +qsTranslate("BarContext", "Four"); + +var celebration_strings = [ + QT_TR_NOOP("Happy birthday!"), + QT_TRANSLATE_NOOP("BarContext", "Congratulations!") +]; + +qsTr("Three", "not the same three"); diff --git a/tests/auto/qscriptengine/translations/translatable_la.qm b/tests/auto/qscriptengine/translations/translatable_la.qm index 301cc77..703d0f1 100644 Binary files a/tests/auto/qscriptengine/translations/translatable_la.qm and b/tests/auto/qscriptengine/translations/translatable_la.qm differ diff --git a/tests/auto/qscriptengine/translations/translatable_la.ts b/tests/auto/qscriptengine/translations/translatable_la.ts index 4eed72d..1598f39 100644 --- a/tests/auto/qscriptengine/translations/translatable_la.ts +++ b/tests/auto/qscriptengine/translations/translatable_la.ts @@ -2,6 +2,19 @@ + BarContext + + + Four + Fire + + + + Congratulations! + Gratulerer! + + + FooContext @@ -37,4 +50,23 @@ Farvel + + translatable2 + + + Three + Tre + + + + Happy birthday! + Gratulerer med dagen! + + + + Three + not the same three + Tre andre + + diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index aa06bc9..5713f8e 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -4317,6 +4317,11 @@ void tst_QScriptEngine::installTranslatorFunctions() } } +static QScriptValue callQsTr(QScriptContext *ctx, QScriptEngine *eng) +{ + return eng->globalObject().property("qsTr").call(ctx->thisObject(), ctx->argumentsObject()); +} + void tst_QScriptEngine::translateScript() { QScriptEngine engine; @@ -4364,6 +4369,41 @@ void tst_QScriptEngine::translateScript() QCOMPARE(engine.globalObject().property("qsTr").call( QScriptValue(), QScriptValueList() << "One").toString(), QString::fromLatin1("One")); + // Translate strings from the second script (translatable2.js) + + QString fileName2 = QString::fromLatin1("translatable2.js"); + + QCOMPARE(engine.evaluate("qsTr('Three')", fileName2).toString(), QString::fromLatin1("Tre")); + QCOMPARE(engine.evaluate("qsTr('Happy birthday!')", fileName2).toString(), QString::fromLatin1("Gratulerer med dagen!")); + + // Not translated because translation is only in translatable.js + QCOMPARE(engine.evaluate("qsTr('One')", fileName2).toString(), QString::fromLatin1("One")); + QCOMPARE(engine.evaluate("(function() { return qsTr('One'); })()", fileName2).toString(), QString::fromLatin1("One")); + + // For qsTranslate() the filename shouldn't matter + QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'Two')", fileName2).toString(), QString::fromLatin1("To")); + QCOMPARE(engine.evaluate("qsTranslate('BarContext', 'Congratulations!')", fileName).toString(), QString::fromLatin1("Gratulerer!")); + + // qsTr() should use the innermost filename as context + engine.evaluate("function foo(s) { return bar(s); }", fileName); + engine.evaluate("function bar(s) { return qsTr(s); }", fileName2); + QCOMPARE(engine.evaluate("bar('Three')", fileName2).toString(), QString::fromLatin1("Tre")); + QCOMPARE(engine.evaluate("bar('Three')", fileName).toString(), QString::fromLatin1("Tre")); + QCOMPARE(engine.evaluate("bar('One')", fileName2).toString(), QString::fromLatin1("One")); + + engine.evaluate("function foo(s) { return bar(s); }", fileName2); + engine.evaluate("function bar(s) { return qsTr(s); }", fileName); + QCOMPARE(engine.evaluate("bar('Three')", fileName2).toString(), QString::fromLatin1("Three")); + QCOMPARE(engine.evaluate("bar('One')", fileName).toString(), QString::fromLatin1("En")); + QCOMPARE(engine.evaluate("bar('One')", fileName2).toString(), QString::fromLatin1("En")); + + // Calling qsTr() from a native function + engine.globalObject().setProperty("qsTrProxy", engine.newFunction(callQsTr)); + QCOMPARE(engine.evaluate("qsTrProxy('One')", fileName).toString(), QString::fromLatin1("En")); + QCOMPARE(engine.evaluate("qsTrProxy('One')", fileName2).toString(), QString::fromLatin1("One")); + QCOMPARE(engine.evaluate("qsTrProxy('Three')", fileName).toString(), QString::fromLatin1("Three")); + QCOMPARE(engine.evaluate("qsTrProxy('Three')", fileName2).toString(), QString::fromLatin1("Tre")); + QCoreApplication::instance()->removeTranslator(&translator); } -- cgit v0.12 From 840bcb0b56b5b96a81fe3d1d5d91e1477e0fa387 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 14 Apr 2010 21:25:38 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( be2489a618c909c4a82d927f9fff9d12feafeb30 ) Changes in WebKit/qt since the last update: * http://trac.webkit.org/changeset/50486 -- Allow a frame to go back to copy-on-scroll when it ceases being overlapped --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 17 +++++++++++++++++ src/3rdparty/webkit/WebCore/page/FrameView.cpp | 5 +++++ src/3rdparty/webkit/WebCore/page/FrameView.h | 1 + src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp | 2 +- 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 7c9ea04..8c93308 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - 14feb62c96ffe2c37e3e2fdac4e370fdbc76ef62 + be2489a618c909c4a82d927f9fff9d12feafeb30 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index b7e46c7..fa7e4f0 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,20 @@ +2009-11-03 Dan Bernstein + + Reviewed by Dave Hyatt. + + Allow a frame to go back to copy-on-scroll when it ceases being overlapped + + The code was not testing slow-scrolling frames for overlappedness, thinking the answer + would not matter. That is not the case if the only reason for the slow-scrolling is + being overlapped. + + * page/FrameView.cpp: + (WebCore::FrameView::useSlowRepaintsIfNotOverlapped): Added. Returns whether there is any + reason besides being overlapped that the frame would need to fully repaint on scroll. + * page/FrameView.h: + * rendering/RenderWidget.cpp: + (WebCore::RenderWidget::paint): Use useSlowRepaintsIfNotOverlapped(). + 2010-04-09 David Leong Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/page/FrameView.cpp b/src/3rdparty/webkit/WebCore/page/FrameView.cpp index 4c3a0ab..cc7d171 100644 --- a/src/3rdparty/webkit/WebCore/page/FrameView.cpp +++ b/src/3rdparty/webkit/WebCore/page/FrameView.cpp @@ -739,6 +739,11 @@ bool FrameView::useSlowRepaints() const return m_useSlowRepaints || m_slowRepaintObjectCount > 0 || (platformWidget() && m_fixedObjectCount > 0) || m_isOverlapped || !m_contentIsOpaque; } +bool FrameView::useSlowRepaintsIfNotOverlapped() const +{ + return m_useSlowRepaints || m_slowRepaintObjectCount > 0 || !m_contentIsOpaque; +} + void FrameView::setUseSlowRepaints() { m_useSlowRepaints = true; diff --git a/src/3rdparty/webkit/WebCore/page/FrameView.h b/src/3rdparty/webkit/WebCore/page/FrameView.h index 5243c02..ed1e6c6 100644 --- a/src/3rdparty/webkit/WebCore/page/FrameView.h +++ b/src/3rdparty/webkit/WebCore/page/FrameView.h @@ -212,6 +212,7 @@ private: friend class RenderWidget; bool useSlowRepaints() const; + bool useSlowRepaintsIfNotOverlapped() const; void applyOverflowToViewport(RenderObject*, ScrollbarMode& hMode, ScrollbarMode& vMode); diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp index 9af7137..ec23603 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp @@ -233,7 +233,7 @@ void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty) else m_widget->paint(paintInfo.context, paintInfo.rect); - if (m_widget->isFrameView() && paintInfo.overlapTestRequests && !static_cast(m_widget.get())->useSlowRepaints()) { + if (m_widget->isFrameView() && paintInfo.overlapTestRequests && !static_cast(m_widget.get())->useSlowRepaintsIfNotOverlapped()) { ASSERT(!paintInfo.overlapTestRequests->contains(this)); paintInfo.overlapTestRequests->set(this, m_widget->frameRect()); } -- cgit v0.12 From 53c139f4e42c182a07ebc589393b88e10077cacf Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 14 Apr 2010 20:42:37 +0100 Subject: Phonon MMF: fixed typo in trace statement This builds under RVCT 2.2 (although obviously the debug output will contain garbage), but causes a compiler error with RVCT 4. Reviewed-by: trustme --- src/3rdparty/phonon/mmf/videowidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/mmf/videowidget.cpp b/src/3rdparty/phonon/mmf/videowidget.cpp index 4ed9979..122094e 100644 --- a/src/3rdparty/phonon/mmf/videowidget.cpp +++ b/src/3rdparty/phonon/mmf/videowidget.cpp @@ -123,7 +123,7 @@ Phonon::VideoWidget::ScaleMode MMF::VideoWidget::scaleMode() const void MMF::VideoWidget::setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode) { TRACE_CONTEXT(VideoWidget::setScaleMode, EVideoApi); - TRACE("setScaleMode %d", setScaleMode); + TRACE("setScaleMode %d", scaleMode); m_videoOutput->setScaleMode(scaleMode); } -- cgit v0.12 From a484dd7cf655818aa849cf9dd002f76e137b3319 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 13 Apr 2010 16:22:33 +0100 Subject: tst_mediaobject: Removed compiler warnings Removed declaration of variables which are subsequently unused. Reviewed-by: Frans Englich --- tests/auto/mediaobject/tst_mediaobject.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/auto/mediaobject/tst_mediaobject.cpp b/tests/auto/mediaobject/tst_mediaobject.cpp index 5b0943e..e62bfd7 100644 --- a/tests/auto/mediaobject/tst_mediaobject.cpp +++ b/tests/auto/mediaobject/tst_mediaobject.cpp @@ -194,12 +194,6 @@ static qint32 castQVariantToInt32(const QVariant &variant) } static const char *const red = "\033[0;31m"; -static const char *const green = "\033[0;32m"; -static const char *const yellow = "\033[0;33m"; -static const char *const blue = "\033[0;34m"; -static const char *const purple = "\033[0;35m"; -static const char *const cyan = "\033[0;36m"; -static const char *const white = "\033[0;37m"; static const char *const normal = "\033[0m"; void tst_MediaObject::stateChanged(Phonon::State newstate, Phonon::State oldstate) -- cgit v0.12 From 57dddfe5036e256a9d2648c85fadb5abef31fb19 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 13 Apr 2010 16:25:14 +0100 Subject: tst_mediaobject: Removed compiler warnings Compiler warnings concerned unreachable code. Reviewed-by: Frans Englich --- tests/auto/mediaobject/qtesthelper.h | 1 - tests/auto/mediaobject/tst_mediaobject.cpp | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/auto/mediaobject/qtesthelper.h b/tests/auto/mediaobject/qtesthelper.h index f082296..39d5b91 100644 --- a/tests/auto/mediaobject/qtesthelper.h +++ b/tests/auto/mediaobject/qtesthelper.h @@ -215,7 +215,6 @@ namespace QTest default: return 0; } - return 0; } } // namespace QTest QT_END_NAMESPACE diff --git a/tests/auto/mediaobject/tst_mediaobject.cpp b/tests/auto/mediaobject/tst_mediaobject.cpp index e62bfd7..efb9132 100644 --- a/tests/auto/mediaobject/tst_mediaobject.cpp +++ b/tests/auto/mediaobject/tst_mediaobject.cpp @@ -209,9 +209,7 @@ void tst_MediaObject::testPlayFromResource() { #ifdef Q_OS_SYMBIAN QSKIP("Not implemented yet.", SkipAll); - return; -#endif - +#else QFile file(MEDIA_FILEPATH); MediaObject media; media.setCurrentSource(&file); @@ -223,6 +221,7 @@ void tst_MediaObject::testPlayFromResource() if (media.state() != Phonon::PlayingState) QTest::waitForSignal(&media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), 10000); QCOMPARE(media.state(), Phonon::PlayingState); +#endif } void tst_MediaObject::testPlayIllegalFile() -- cgit v0.12 From 0d12963c85fc116cd7283cd16ca0524f086f9d09 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 13 Apr 2010 17:51:31 +0100 Subject: tst_mediaobject: Ensure playSDP step cleanup is run This step previously did not guarantee that the m_media object would be left in StoppedState, which in turn meant that following test steps could fail. Task-number: QTBUG-9339 Reviewed-by: Frans Englich --- tests/auto/mediaobject/tst_mediaobject.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/auto/mediaobject/tst_mediaobject.cpp b/tests/auto/mediaobject/tst_mediaobject.cpp index efb9132..7f9f57d 100644 --- a/tests/auto/mediaobject/tst_mediaobject.cpp +++ b/tests/auto/mediaobject/tst_mediaobject.cpp @@ -572,13 +572,18 @@ void tst_MediaObject::playSDP() if (m_media->state() != Phonon::StoppedState) QTest::waitForSignal(m_media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), 10000); - // At this point we're in error state due to absent media, but it has now loaded the SDP: - QCOMPARE(m_media->errorString(), QString::fromLatin1("Buffering clip failed: Unknown error (-39)")); + // MediaObject should have loaded the SDP, but be in error state due to absent media + const bool stateMatch = (m_media->state() == Phonon::ErrorState); + const bool errorStringMatch = (m_media->errorString() == QString::fromLatin1("Buffering clip failed: Unknown error (-39)")); - // We cannot play the SDP, we can neither attempt to play it, because we - // won't get a state change from ErrorState to ErrorState, and hence block - // on a never occuring signal. + // Ensure that m_media is back in ground state prior to starting next test step m_media->setCurrentSource(oldSource); + if (m_media->state() != Phonon::StoppedState) + QTest::waitForSignal(m_media, SIGNAL(stateChanged(Phonon::State, Phonon::State))); + QCOMPARE(m_media->state(), Phonon::StoppedState); + + QVERIFY(stateMatch); + QVERIFY(errorStringMatch); #else QSKIP("Unsupported on this platform.", SkipAll); -- cgit v0.12 From 240cf56a6490bc05339cc05457c8bab3b5cab66c Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 14 Apr 2010 16:15:32 +0100 Subject: tst_mediaobject: Removed non-portable escape codes from output Test step was outputting ANSI escape codes in order to highlight certain text. These codes are not natively supported by Windows consoles, resulting in raw escape codes appearing in the output. Reviewed-by: Frans Englich --- tests/auto/mediaobject/tst_mediaobject.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/auto/mediaobject/tst_mediaobject.cpp b/tests/auto/mediaobject/tst_mediaobject.cpp index 7f9f57d..5328f63 100644 --- a/tests/auto/mediaobject/tst_mediaobject.cpp +++ b/tests/auto/mediaobject/tst_mediaobject.cpp @@ -193,16 +193,10 @@ static qint32 castQVariantToInt32(const QVariant &variant) return *reinterpret_cast(variant.constData()); } -static const char *const red = "\033[0;31m"; -static const char *const normal = "\033[0m"; - void tst_MediaObject::stateChanged(Phonon::State newstate, Phonon::State oldstate) { - if (newstate == Phonon::ErrorState) { - QWARN(QByteArray(QByteArray(red) + ".......................................................... ") + QByteArray(QTest::toString(oldstate)) + " to " + QByteArray(QTest::toString(newstate)) + normal); - } else { - //qDebug() << ".........................................................." << cyan << QTest::toString(oldstate) << "to" << QTest::toString(newstate) << normal; - } + if (newstate == Phonon::ErrorState) + QWARN(QByteArray(QByteArray(QTest::toString(oldstate)) + " to " + QByteArray(QTest::toString(newstate)))); } void tst_MediaObject::testPlayFromResource() -- cgit v0.12 From 151c2a2bd5e764555f32e6141024172e77788efd Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 14 Apr 2010 16:37:21 +0100 Subject: tst_mediaobject: ensure MediaObject is in StoppedState before each step Many of the steps in the tst_mediaobject suite (a) check that the MediaObject is in StoppedState at the start of the step and (b) call stopPlayback() at the end. If, however, a QTest check fails during the test, stopPlayback may not be called. This patch adds a call to MediaObject::stop() in the suite's init() function. This is a symptom of a wider problem with this test suite, namely that it re-uses a single instance of Phonon::MediaObject for all steps. Given the highly stateful nature of MediaObject, this can lead to test steps failing due to some state which was erroneously carried forward from an earlier step. While this test suite design may more faithfully represent real-world usage of Phonon, it makes tracking down the root causes of test failures needlessly difficult. Reviewed-by: Frans Englich --- tests/auto/mediaobject/tst_mediaobject.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/auto/mediaobject/tst_mediaobject.cpp b/tests/auto/mediaobject/tst_mediaobject.cpp index 5328f63..127b775 100644 --- a/tests/auto/mediaobject/tst_mediaobject.cpp +++ b/tests/auto/mediaobject/tst_mediaobject.cpp @@ -251,6 +251,13 @@ void tst_MediaObject::init() } m_stateChangedSignalSpy->clear(); } + + // Ensure that m_media is in StoppedState + if (m_media->state() != Phonon::StoppedState) { + m_media->stop(); + QTest::waitForSignal(m_media, SIGNAL(stateChanged(Phonon::State, Phonon::State))); + QCOMPARE(m_media->state(), Phonon::StoppedState); + } } void tst_MediaObject::cleanup() -- cgit v0.12 From 430718023edfe83b4e028d97c1a57fd0cdbbdace Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 13 Apr 2010 16:42:41 +0100 Subject: Phonon MMF: Removed compiler warning Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/videoplayer_dsa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp index d607f1d..fbd8397 100644 --- a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp +++ b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp @@ -296,7 +296,7 @@ bool MMF::DsaVideoPlayer::stopDirectScreenAccess() const bool dsaWasActive = m_dsaActive; if (m_dsaActive) { - TRAPD(err, m_player->StopDirectScreenAccessL()); + TRAP(err, m_player->StopDirectScreenAccessL()); if (KErrNone == err) m_dsaActive = false; else -- cgit v0.12 From 0fa644049f3a864df4c1ffa47efd16d7d0c81cf3 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 14 Apr 2010 12:14:32 +0100 Subject: Phonon MMF: Emit prefinishMarkReached(), finished() signals Fixes testPrefinishMark step in tst_mediaobject. Task-number: QTBUG-9339 Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 1 + src/3rdparty/phonon/mmf/mediaobject.cpp | 16 ++++++++++++++-- src/3rdparty/phonon/mmf/mediaobject.h | 3 +++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index 6356c21..a90131d 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -386,6 +386,7 @@ void MMF::AbstractMediaPlayer::playbackComplete(int error) } else { setError(tr("Playback complete"), error); + emit finished(); } } diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index ee459e6..f881da0 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -323,11 +323,11 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) connect(m_player.data(), SIGNAL(totalTimeChanged(qint64)), SIGNAL(totalTimeChanged(qint64))); connect(m_player.data(), SIGNAL(stateChanged(Phonon::State,Phonon::State)), SIGNAL(stateChanged(Phonon::State,Phonon::State))); connect(m_player.data(), SIGNAL(finished()), SIGNAL(finished())); - connect(m_player.data(), SIGNAL(tick(qint64)), SIGNAL(tick(qint64))); connect(m_player.data(), SIGNAL(bufferStatus(int)), SIGNAL(bufferStatus(int))); connect(m_player.data(), SIGNAL(metaDataChanged(QMultiMap)), SIGNAL(metaDataChanged(QMultiMap))); connect(m_player.data(), SIGNAL(aboutToFinish()), SIGNAL(aboutToFinish())); - connect(m_player.data(), SIGNAL(prefinishMarkReached(qint32)), SIGNAL(tick(qint32))); + connect(m_player.data(), SIGNAL(prefinishMarkReached(qint32)), SIGNAL(prefinishMarkReached(qint32))); + connect(m_player.data(), SIGNAL(prefinishMarkReached(qint32)), SLOT(handlePrefinishMarkReached(qint32))); // We need to call setError() after doing the connects, otherwise the // error won't be received. @@ -414,8 +414,20 @@ void MMF::MediaObject::switchToNextSource() m_nextSourceSet = false; switchToSource(m_nextSource); play(); + } else { + emit finished(); } } +//----------------------------------------------------------------------------- +// Other private functions +//----------------------------------------------------------------------------- + +void MMF::MediaObject::handlePrefinishMarkReached(qint32 time) +{ + emit tick(time); +} + + QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h index 62e0a0e..f15eb21 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.h +++ b/src/3rdparty/phonon/mmf/mediaobject.h @@ -107,6 +107,9 @@ Q_SIGNALS: void finished(); void tick(qint64 time); +private Q_SLOTS: + void handlePrefinishMarkReached(qint32); + private: void switchToSource(const MediaSource &source); void createPlayer(const MediaSource &source); -- cgit v0.12 From dc2d0315fc18fdbad7686adaf5f4886252fe0e5a Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 14 Apr 2010 10:54:44 +0100 Subject: Phonon MMF: Emit tick() signal Fixes testTickSignal step in tst_mediaobject. Task-number: QTBUG-9339 Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/mediaobject.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index f881da0..e1b921b 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -328,6 +328,7 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) connect(m_player.data(), SIGNAL(aboutToFinish()), SIGNAL(aboutToFinish())); connect(m_player.data(), SIGNAL(prefinishMarkReached(qint32)), SIGNAL(prefinishMarkReached(qint32))); connect(m_player.data(), SIGNAL(prefinishMarkReached(qint32)), SLOT(handlePrefinishMarkReached(qint32))); + connect(m_player.data(), SIGNAL(tick(qint64)), SIGNAL(tick(qint64))); // We need to call setError() after doing the connects, otherwise the // error won't be received. -- cgit v0.12 From 468a0b27f8706e7d40f7b1c07f0cc0b50a48971b Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 14 Apr 2010 14:03:35 +0100 Subject: Phonon MMF: Suppress intermediate stateChanged() signal If MediaObject::play() is called while the object is in LoadingState, playback will start once loading is completed. Previously, the Symbian backend at this point emitted two stateChanged signals - first to StoppedState and then to PlayingState. The testPlayOnFinish step in tst_mediaobject requires that only one state change occurs: directly from LoadingState to PlayingState. Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 20 +++++++++++++------- src/3rdparty/phonon/mmf/abstractmediaplayer.h | 4 +++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index a90131d..221443e 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -79,9 +79,7 @@ void MMF::AbstractMediaPlayer::play() case StoppedState: case PausedState: - doPlay(); - startPositionTimer(); - changeState(PlayingState); + startPlayback(); break; case PlayingState: @@ -441,6 +439,13 @@ void MMF::AbstractMediaPlayer::resetMarksIfRewound() m_aboutToFinishSent = false; } +void MMF::AbstractMediaPlayer::startPlayback() +{ + doPlay(); + startPositionTimer(); + changeState(PlayingState); +} + void MMF::AbstractMediaPlayer::bufferStatusTick() { emit MMF::AbstractPlayer::bufferStatus(bufferStatus()); @@ -453,9 +458,6 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState) const Phonon::State oldPhononState = phononState(privateState()); const Phonon::State newPhononState = phononState(newState); - // TODO: add some invariants to check that the transition is valid - AbstractPlayer::changeState(newState); - if (LoadingState == oldPhononState && StoppedState == newPhononState) { // Ensure initial volume is set on MMF API before starting playback doVolumeChanged(); @@ -465,8 +467,12 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState) if (m_playPending) { TRACE_0("play was called while loading; starting playback now"); m_playPending = false; - play(); + startPlayback(); + } else { + AbstractPlayer::changeState(newState); } + } else { + AbstractPlayer::changeState(newState); } } diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h index 308b5af..f8f86af 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h @@ -70,7 +70,8 @@ protected: virtual int openUrl(const QString& url) = 0; virtual int bufferStatus() const = 0; virtual void close() = 0; - virtual void changeState(PrivateState newState); + + void changeState(PrivateState newState); void updateMetaData(); virtual int numberOfMetaDataEntries() const = 0; @@ -93,6 +94,7 @@ private: void doVolumeChanged(); void emitMarksIfReached(qint64 position); void resetMarksIfRewound(); + void startPlayback(); private Q_SLOTS: void positionTick(); -- cgit v0.12 From 4f97cf29e5be9f34341dd99ad4bd8dd3d61b1441 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 14 Apr 2010 14:39:39 +0100 Subject: Phonon MMF: change to PausedState, not StoppedState when finished This behaviour is required by the testPauseOnFinish step in tst_mediaobject. Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index 221443e..ea2d536 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -375,7 +375,7 @@ void MMF::AbstractMediaPlayer::playbackComplete(int error) } if (KErrNone == error) { - changeState(StoppedState); + changeState(PausedState); // MediaObject::switchToNextSource deletes the current player, so we // call it via delayed slot invokation to ensure that this object does -- cgit v0.12 From 7e598398ec161e3fc5df98ea754bd637d0c1ba30 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 14 Apr 2010 16:03:50 +0100 Subject: Phonon MMF: calling pause() when in StoppedState triggers stateChanged() Previously, the MMF backend simply swallowed a call to pause() when in StoppedState. However, the stopToPause step in tst_mediaobject requires the backend to emit a stateChanged signal when this happens. Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 65 ++++++++++++++++++++----- src/3rdparty/phonon/mmf/abstractmediaplayer.h | 20 +++++--- src/3rdparty/phonon/mmf/abstractplayer.cpp | 2 +- src/3rdparty/phonon/mmf/abstractplayer.h | 2 +- src/3rdparty/phonon/mmf/abstractvideoplayer.cpp | 5 +- src/3rdparty/phonon/mmf/audioplayer.cpp | 6 +-- tests/auto/mediaobject/tst_mediaobject.cpp | 2 +- 7 files changed, 72 insertions(+), 30 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index ea2d536..7104ebd 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -48,7 +48,7 @@ MMF::AbstractMediaPlayer::AbstractMediaPlayer (MediaObject *parent, const AbstractPlayer *player) : AbstractPlayer(player) , m_parent(parent) - , m_playPending(false) + , m_pending(NothingPending) , m_positionTimer(new QTimer(this)) , m_bufferStatusTimer(new QTimer(this)) , m_mmfMaxVolume(NullMaxVolume) @@ -74,7 +74,7 @@ void MMF::AbstractMediaPlayer::play() break; case LoadingState: - m_playPending = true; + setPending(PlayPending); break; case StoppedState: @@ -101,14 +101,16 @@ void MMF::AbstractMediaPlayer::pause() TRACE_CONTEXT(AbstractMediaPlayer::pause, EAudioApi); TRACE_ENTRY("state %d", privateState()); - m_playPending = false; stopTimers(); switch (privateState()) { case GroundState: case LoadingState: - case PausedState: case StoppedState: + setPending(PausePending); + break; + + case PausedState: // Do nothing break; @@ -133,7 +135,7 @@ void MMF::AbstractMediaPlayer::stop() TRACE_CONTEXT(AbstractMediaPlayer::stop, EAudioApi); TRACE_ENTRY("state %d", privateState()); - m_playPending = false; + setPending(NothingPending); stopTimers(); switch (privateState()) { @@ -363,6 +365,18 @@ void MMF::AbstractMediaPlayer::maxVolumeChanged(int mmfMaxVolume) doVolumeChanged(); } +void MMF::AbstractMediaPlayer::loadingComplete(int error) +{ + Q_ASSERT(Phonon::LoadingState == state()); + + if (KErrNone == error) { + updateMetaData(); + changeState(StoppedState); + } else { + setError(tr("Loading clip failed"), error); + } +} + void MMF::AbstractMediaPlayer::playbackComplete(int error) { stopTimers(); @@ -439,6 +453,15 @@ void MMF::AbstractMediaPlayer::resetMarksIfRewound() m_aboutToFinishSent = false; } +void MMF::AbstractMediaPlayer::setPending(Pending pending) +{ + const Phonon::State oldState = state(); + m_pending = pending; + const Phonon::State newState = state(); + if (newState != oldState) + emit stateChanged(newState, oldState); +} + void MMF::AbstractMediaPlayer::startPlayback() { doPlay(); @@ -451,6 +474,18 @@ void MMF::AbstractMediaPlayer::bufferStatusTick() emit MMF::AbstractPlayer::bufferStatus(bufferStatus()); } +Phonon::State MMF::AbstractMediaPlayer::phononState(PrivateState state) const +{ + Phonon::State result = AbstractPlayer::phononState(state); + + if (PausePending == m_pending) { + Q_ASSERT(Phonon::StoppedState == result || Phonon::LoadingState == result); + result = Phonon::PausedState; + } + + return result; +} + void MMF::AbstractMediaPlayer::changeState(PrivateState newState) { TRACE_CONTEXT(AbstractMediaPlayer::changeState, EAudioInternal); @@ -462,15 +497,21 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState) // Ensure initial volume is set on MMF API before starting playback doVolumeChanged(); - // Check whether play() was called while clip was being loaded. If so, - // playback should be started now - if (m_playPending) { - TRACE_0("play was called while loading; starting playback now"); - m_playPending = false; - startPlayback(); - } else { + switch (m_pending) { + case NothingPending: AbstractPlayer::changeState(newState); + break; + + case PlayPending: + startPlayback(); + break; + + case PausePending: + AbstractPlayer::changeState(PausedState); + break; } + + setPending(NothingPending); } else { AbstractPlayer::changeState(newState); } diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h index f8f86af..23a8233 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h @@ -60,6 +60,8 @@ public: protected: // AbstractPlayer virtual void doSetTickInterval(qint32 interval); + virtual Phonon::State phononState(PrivateState state) const; + virtual void changeState(PrivateState newState); virtual void doPlay() = 0; virtual void doPause() = 0; @@ -71,8 +73,6 @@ protected: virtual int bufferStatus() const = 0; virtual void close() = 0; - void changeState(PrivateState newState); - void updateMetaData(); virtual int numberOfMetaDataEntries() const = 0; virtual QPair metaDataEntry(int index) const = 0; @@ -81,6 +81,7 @@ protected: void bufferingStarted(); void bufferingComplete(); void maxVolumeChanged(int maxVolume); + void loadingComplete(int error); void playbackComplete(int error); static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &); @@ -96,6 +97,14 @@ private: void resetMarksIfRewound(); void startPlayback(); + enum Pending { + NothingPending, + PausePending, + PlayPending + }; + + void setPending(Pending pending); + private Q_SLOTS: void positionTick(); void bufferStatusTick(); @@ -103,12 +112,7 @@ private Q_SLOTS: private: MediaObject *const m_parent; - /** - * This flag is set to true if play is called when the object is - * in a Loading state. Once loading is complete, playback will - * be started. - */ - bool m_playPending; + Pending m_pending; QScopedPointer m_positionTimer; diff --git a/src/3rdparty/phonon/mmf/abstractplayer.cpp b/src/3rdparty/phonon/mmf/abstractplayer.cpp index 421155b..8c3f5cb 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractplayer.cpp @@ -141,7 +141,7 @@ Phonon::State MMF::AbstractPlayer::phononState() const return phononState(m_state); } -Phonon::State MMF::AbstractPlayer::phononState(PrivateState state) +Phonon::State MMF::AbstractPlayer::phononState(PrivateState state) const { const Phonon::State phononState = GroundState == state diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h index 92bd87e..ab892f5 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.h +++ b/src/3rdparty/phonon/mmf/abstractplayer.h @@ -133,7 +133,7 @@ protected: /** * Converts PrivateState into the corresponding Phonon::State */ - static Phonon::State phononState(PrivateState state); + virtual Phonon::State phononState(PrivateState state) const; virtual void videoOutputChanged(); diff --git a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp index c2bcce0..2e0ab1c 100644 --- a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp @@ -268,11 +268,10 @@ void MMF::AbstractVideoPlayer::MvpuoPrepareComplete(TInt aError) handlePendingParametersChanged(); emit totalTimeChanged(totalTime()); - changeState(StoppedState); - } else { - setError(tr("Buffering clip failed"), err); } + loadingComplete(aError); + TRACE_EXIT_0(); } diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp index ee07229..77a0964 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.cpp +++ b/src/3rdparty/phonon/mmf/audioplayer.cpp @@ -203,12 +203,10 @@ void MMF::AudioPlayer::MapcInitComplete(TInt aError, maxVolumeChanged(m_player->MaxVolume()); m_totalTime = toMilliSeconds(m_player->Duration()); emit totalTimeChanged(m_totalTime); - updateMetaData(); - changeState(StoppedState); - } else { - setError(tr("Opening clip failed"), aError); } + loadingComplete(aError); + TRACE_EXIT_0(); } diff --git a/tests/auto/mediaobject/tst_mediaobject.cpp b/tests/auto/mediaobject/tst_mediaobject.cpp index 127b775..994057b 100644 --- a/tests/auto/mediaobject/tst_mediaobject.cpp +++ b/tests/auto/mediaobject/tst_mediaobject.cpp @@ -575,7 +575,7 @@ void tst_MediaObject::playSDP() // MediaObject should have loaded the SDP, but be in error state due to absent media const bool stateMatch = (m_media->state() == Phonon::ErrorState); - const bool errorStringMatch = (m_media->errorString() == QString::fromLatin1("Buffering clip failed: Unknown error (-39)")); + const bool errorStringMatch = (m_media->errorString() == QString::fromLatin1("Loading clip failed: Unknown error (-39)")); // Ensure that m_media is back in ground state prior to starting next test step m_media->setCurrentSource(oldSource); -- cgit v0.12 From 0c2f5376e921fa9badd87a3eb37d94868451248c Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 14 Apr 2010 19:31:22 +0100 Subject: Phonon MMF: fix state changes emitted during playlist handling This change is required by the testPlayBeforeFinish step in tst_mediaobject. This test starts playback of one track, then calls MediaObject::setCurrentSource() followed by MediaObject::play(). The step checks that the following stateChanged() signals are emitted by the MediaObject: 1. StoppedState (optionally) 2. LoadingState 3. BufferingState or PlayingState The state changes emitted by the Phonon MMF backend were: 1. PlayingState -> StoppedState 2. LoadingState -> PlayingState This patch fixes the discontinuity in state changes which occurred while processing a playlist. Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/abstractplayer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/3rdparty/phonon/mmf/abstractplayer.cpp b/src/3rdparty/phonon/mmf/abstractplayer.cpp index 8c3f5cb..77d7ae0 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractplayer.cpp @@ -48,6 +48,11 @@ MMF::AbstractPlayer::AbstractPlayer(const AbstractPlayer *player) m_tickInterval = player->m_tickInterval; m_transitionTime = player->m_transitionTime; m_prefinishMark = player->m_prefinishMark; + + // This is to prevent unwanted state transitions occurring as a result + // of MediaObject::switchToNextSource() during playlist playback. + if (StoppedState == player->m_state) + m_state = player->m_state; } } -- cgit v0.12 From 92ed8a1a049f60733ce15c4a5b79ed0fc389cfcd Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 14 Apr 2010 20:04:39 +0100 Subject: Phonon MMF: ensure initial volume is applied A recent change meant that, if the user set a volume level before loading a clip into the MediaObject, that initial volume level was not applied to the audio output. Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index 7104ebd..be2a568 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -494,15 +494,14 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState) const Phonon::State newPhononState = phononState(newState); if (LoadingState == oldPhononState && StoppedState == newPhononState) { - // Ensure initial volume is set on MMF API before starting playback - doVolumeChanged(); - switch (m_pending) { case NothingPending: AbstractPlayer::changeState(newState); break; case PlayPending: + changeState(PlayingState); // necessary in order to apply initial volume + doVolumeChanged(); startPlayback(); break; -- cgit v0.12 From 04c24781613a937c472c556391d738b6d563201d Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 14 Apr 2010 20:45:58 +0100 Subject: Phonon MMF: fixed crash during opening of video clip A crash was observed during opening a video clip, and was traced to dereferencing a null m_player pointer in DsaVideoPlayer::handleParametersChanged(), which is called during construction, but before createPlayer() has been called. This was reproducible using the following sequence: 1. Launch qmediaplayer 2. Play an audio clip 3. Open a video clip However, the following sequence worked as expected: 1. Launch qmediaplayer 2. Play a video clip 3. Play an audio clip 4. Play a video clip ... It is not clear which commit introduced this defect. Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/videoplayer_dsa.cpp | 60 +++++++++++++------------ src/3rdparty/phonon/mmf/videoplayer_surface.cpp | 55 +++++++++++------------ 2 files changed, 58 insertions(+), 57 deletions(-) diff --git a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp index fbd8397..1925471 100644 --- a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp +++ b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp @@ -226,38 +226,40 @@ void MMF::DsaVideoPlayer::handleParametersChanged(VideoParameters parameters) getDsaRegion(m_wsSession, *m_window); #endif - static const TBool antialias = ETrue; - int err = KErrNone; - - if (parameters & ScaleFactors) { - TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, - antialias)); - if(KErrNone != err) { - TRACE("SetScaleFactorL (1) err %d", err); - setError(tr("Video display error"), err); + if (m_player) { + static const TBool antialias = ETrue; + int err = KErrNone; + + if (parameters & ScaleFactors) { + TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, + antialias)); + if(KErrNone != err) { + TRACE("SetScaleFactorL (1) err %d", err); + setError(tr("Video display error"), err); + } } - } - if (KErrNone == err) { - if (parameters & WindowHandle || parameters & WindowScreenRect) { - TRAP(err, - m_player->SetDisplayWindowL(m_wsSession, m_screenDevice, - *m_window, - m_videoScreenRect, - m_videoScreenRect)); - } + if (KErrNone == err) { + if (parameters & WindowHandle || parameters & WindowScreenRect) { + TRAP(err, + m_player->SetDisplayWindowL(m_wsSession, m_screenDevice, + *m_window, + m_videoScreenRect, + m_videoScreenRect)); + } - if (KErrNone != err) { - TRACE("SetDisplayWindowL err %d", err); - setError(tr("Video display error"), err); - } else { - m_dsaActive = true; - if (parameters & ScaleFactors) { - TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, - antialias)); - if (KErrNone != err) { - TRACE("SetScaleFactorL (2) err %d", err); - setError(tr("Video display error"), err); + if (KErrNone != err) { + TRACE("SetDisplayWindowL err %d", err); + setError(tr("Video display error"), err); + } else { + m_dsaActive = true; + if (parameters & ScaleFactors) { + TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, + antialias)); + if (KErrNone != err) { + TRACE("SetScaleFactorL (2) err %d", err); + setError(tr("Video display error"), err); + } } } } diff --git a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp index 5f234e5..fda7342 100644 --- a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp +++ b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp @@ -104,44 +104,43 @@ void MMF::SurfaceVideoPlayer::handleVideoWindowChanged() void MMF::SurfaceVideoPlayer::handleParametersChanged(VideoParameters parameters) { - CVideoPlayerUtility2 *player = static_cast(m_player.data()); - - int err = KErrNone; - TRect rect; - if (m_videoOutput) { m_videoOutput->dump(); const QSize size = m_videoOutput->videoWindowSize(); rect.SetSize(TSize(size.width(), size.height())); } - if (parameters & WindowHandle) { - if (m_displayWindow) - player->RemoveDisplayWindow(*m_displayWindow); - - RWindow *window = static_cast(m_window); - if (window) { - window->SetBackgroundColor(TRgb(0, 0, 0, 255)); - TRAP(err, player->AddDisplayWindowL(m_wsSession, m_screenDevice, *window, rect, rect)); - if (KErrNone != err) { - setError(tr("Video display error"), err); - window = 0; + CVideoPlayerUtility2 *player = static_cast(m_player.data()); + if (player) { + int err = KErrNone; + if (parameters & WindowHandle) { + if (m_displayWindow) + player->RemoveDisplayWindow(*m_displayWindow); + + RWindow *window = static_cast(m_window); + if (window) { + window->SetBackgroundColor(TRgb(0, 0, 0, 255)); + TRAP(err, player->AddDisplayWindowL(m_wsSession, m_screenDevice, *window, rect, rect)); + if (KErrNone != err) { + setError(tr("Video display error"), err); + window = 0; + } } + m_displayWindow = window; } - m_displayWindow = window; - } - if (KErrNone == err) { - if (parameters & ScaleFactors) { - Q_ASSERT(m_displayWindow); - TRAP(err, player->SetVideoExtentL(*m_displayWindow, rect)); - if (KErrNone == err) - TRAP(err, player->SetWindowClipRectL(*m_displayWindow, rect)); - if (KErrNone == err) - TRAP(err, player->SetScaleFactorL(*m_displayWindow, m_scaleWidth, m_scaleHeight)); - if (KErrNone != err) - setError(tr("Video display error"), err); + if (KErrNone == err) { + if (parameters & ScaleFactors) { + Q_ASSERT(m_displayWindow); + TRAP(err, player->SetVideoExtentL(*m_displayWindow, rect)); + if (KErrNone == err) + TRAP(err, player->SetWindowClipRectL(*m_displayWindow, rect)); + if (KErrNone == err) + TRAP(err, player->SetScaleFactorL(*m_displayWindow, m_scaleWidth, m_scaleHeight)); + if (KErrNone != err) + setError(tr("Video display error"), err); + } } } } -- cgit v0.12 From 0ebc9a600af8188e7a9d3c2904d012c6289a515d Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Thu, 15 Apr 2010 08:09:40 +0100 Subject: Fixed compiler warning Reviewed-by: trustme --- src/multimedia/audio/qaudio_symbian_p.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/multimedia/audio/qaudio_symbian_p.cpp b/src/multimedia/audio/qaudio_symbian_p.cpp index 58e3745..afe98f5 100644 --- a/src/multimedia/audio/qaudio_symbian_p.cpp +++ b/src/multimedia/audio/qaudio_symbian_p.cpp @@ -315,7 +315,7 @@ bool isFormatSupported(const QAudioFormat &formatQt, TUint32 fourCC; bool result = false; - if (formatQt.codec() == "audio/pcm" && + if (formatQt.codec() == QString::fromAscii("audio/pcm") && formatQtToNative(formatQt, fourCC, formatNative)) { result = (formatNative.iRate & caps.caps().iRate) @@ -337,7 +337,7 @@ bool formatQtToNative(const QAudioFormat &inputFormat, TMMFMonoStereo outputChannels; TMMFSoundEncoding outputEncoding; - if (inputFormat.codec() == "audio/pcm") { + if (inputFormat.codec() == QString::fromAscii("audio/pcm")) { result = sampleRateQtToNative(inputFormat.frequency(), outputSampleRate) && channelsQtToNative(inputFormat.channels(), outputChannels) -- cgit v0.12 From e93dd08b675029388d810eeea45e5f005642fcc9 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 15 Apr 2010 10:39:27 +0300 Subject: Slider graphics does not look correct in N95 The upscaling of theme graphics fails, if the original rect is taller than upscaled graphics rect height. This makes the start and end parts of the graphics appear as shorter then they should be. Fixed by forcing the destrination rect height to be used after upscaling the graphics. Task-number: QTBUG-9854 Reviewed-by: Janne Anttila --- 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 27913cd..3259d82 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -548,6 +548,7 @@ void QS60StylePrivate::drawRow(QS60StyleEnums::SkinParts start, startEndSize.scale(rect.size(), Qt::KeepAspectRatio); QRect startRect = QRect(rect.topLeft(), startEndSize); + startRect.setHeight(rect.height()); QRect middleRect = rect; QRect endRect; -- cgit v0.12 From 9da13ea53aec6d841ba7f416531d6c52d4368df4 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Thu, 15 Apr 2010 10:41:18 +0200 Subject: Fixes tooltips for QGraphicsProxyWidget. Help event was not propagated to the widget. Also fixes tooltip value propagation when setting it on the proxy or on the widget. Autotest included. Task-number: QTBUG-5349 Reviewed-by: bnilsen --- src/gui/graphicsview/qgraphicsproxywidget.cpp | 31 +++++++ src/gui/graphicsview/qgraphicsproxywidget_p.h | 2 + src/gui/graphicsview/qgraphicsscene.cpp | 6 ++ src/gui/kernel/qtooltip.cpp | 4 +- .../tst_qgraphicsproxywidget.cpp | 99 +++++++++++++++++----- 5 files changed, 118 insertions(+), 24 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index 2132526..bdd41cd 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -897,6 +897,29 @@ bool QGraphicsProxyWidget::event(QEvent *event) } break; } +#ifndef QT_NO_TOOLTIP + case QEvent::GraphicsSceneHelp: { + // Propagate the help event (for tooltip) to the widget under mouse + if (d->lastWidgetUnderMouse) { + QGraphicsSceneHelpEvent *he = static_cast(event); + QPoint pos = d->mapToReceiver(mapFromScene(he->scenePos()), d->lastWidgetUnderMouse).toPoint(); + QHelpEvent e(QEvent::ToolTip, pos, he->screenPos()); + QApplication::sendEvent(d->lastWidgetUnderMouse, &e); + event->setAccepted(e.isAccepted()); + return e.isAccepted(); + } + break; + } + case QEvent::ToolTipChange: { + // Propagate tooltip change to the widget + if (!d->tooltipChangeMode) { + d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::ProxyToWidgetMode; + d->widget->setToolTip(toolTip()); + d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::NoMode; + } + break; + } +#endif default: break; } @@ -952,6 +975,14 @@ bool QGraphicsProxyWidget::eventFilter(QObject *object, QEvent *event) d->styleChangeMode = QGraphicsProxyWidgetPrivate::NoMode; } break; + case QEvent::ToolTipChange: + // Propagate tooltip change to the proxy. + if (!d->tooltipChangeMode) { + d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode; + setToolTip(d->widget->toolTip()); + d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::NoMode; + } + break; default: break; } diff --git a/src/gui/graphicsview/qgraphicsproxywidget_p.h b/src/gui/graphicsview/qgraphicsproxywidget_p.h index 8aed363..0e29a7e 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget_p.h +++ b/src/gui/graphicsview/qgraphicsproxywidget_p.h @@ -72,6 +72,7 @@ public: enabledChangeMode(NoMode), styleChangeMode(NoMode), paletteChangeMode(NoMode), + tooltipChangeMode(NoMode), focusFromWidgetToProxy(0) { } void init(); @@ -117,6 +118,7 @@ public: quint32 enabledChangeMode : 2; quint32 styleChangeMode : 2; quint32 paletteChangeMode : 2; + quint32 tooltipChangeMode : 2; quint32 focusFromWidgetToProxy : 1; quint32 proxyIsGivingFocus : 1; }; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 6581727..b368a82 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -3772,6 +3772,12 @@ void QGraphicsScene::helpEvent(QGraphicsSceneHelpEvent *helpEvent) QGraphicsItem *toolTipItem = 0; for (int i = 0; i < itemsAtPos.size(); ++i) { QGraphicsItem *tmp = itemsAtPos.at(i); + if (tmp->d_func()->isProxyWidget()) { + // if the item is a proxy widget, the event is forwarded to it + sendEvent(tmp, helpEvent); + if (helpEvent->isAccepted()) + return; + } if (!tmp->toolTip().isEmpty()) { toolTipItem = tmp; break; diff --git a/src/gui/kernel/qtooltip.cpp b/src/gui/kernel/qtooltip.cpp index 1343959..c8fcf45 100644 --- a/src/gui/kernel/qtooltip.cpp +++ b/src/gui/kernel/qtooltip.cpp @@ -168,9 +168,9 @@ QTipLabel *QTipLabel::instance = 0; QTipLabel::QTipLabel(const QString &text, QWidget *w) #ifndef QT_NO_STYLE_STYLESHEET - : QLabel(w, Qt::ToolTip), styleSheetParent(0), widget(0) + : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), styleSheetParent(0), widget(0) #else - : QLabel(w, Qt::ToolTip), widget(0) + : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), widget(0) #endif { delete instance; diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index e46709b..a5a039a 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -43,6 +43,7 @@ #include #include #include "../../shared/util.h" +#include #include // qSmartMin functions... #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) #include @@ -2582,33 +2583,87 @@ void tst_QGraphicsProxyWidget::changingCursor_basic() void tst_QGraphicsProxyWidget::tooltip_basic() { - // Confirm that mouse events are working properly by checking that - // when moving the mouse over a label with a tooptip the tooltip appears + QString toolTip = "Qt rocks!"; + QString toolTip2 = "Qt rocks even more!"; + + QPushButton *button = new QPushButton("button"); + QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget; + QGraphicsProxyWidgetPrivate *proxyd = static_cast(QGraphicsItemPrivate::get(proxy)); + proxy->setWidget(button); + proxyd->lastWidgetUnderMouse = button; // force widget under mouse + + QVERIFY(button->toolTip().isEmpty()); + QVERIFY(proxy->toolTip().isEmpty()); + // Check that setting the tooltip on the proxy also set it on the widget + proxy->setToolTip(toolTip); + QCOMPARE(proxy->toolTip(), toolTip); + QCOMPARE(button->toolTip(), toolTip); + // Check that setting the tooltip on the widget also set it on the proxy + button->setToolTip(toolTip2); + QCOMPARE(proxy->toolTip(), toolTip2); + QCOMPARE(button->toolTip(), toolTip2); + QGraphicsScene scene; + scene.addItem(proxy); + QGraphicsView view(&scene); + view.setFixedSize(200, 200); view.show(); + QTest::qWaitForWindowShown(&view); + { + QHelpEvent helpEvent(QEvent::ToolTip, view.viewport()->rect().topLeft(), + view.viewport()->mapToGlobal(view.viewport()->rect().topLeft())); + QApplication::sendEvent(view.viewport(), &helpEvent); + QTest::qWait(350); + + bool foundView = false; + bool foundTipLabel = false; + foreach (QWidget *widget, QApplication::topLevelWidgets()) { + if (widget == &view) + foundView = true; + if (widget->inherits("QTipLabel")) + foundTipLabel = true; + } + QVERIFY(foundView); + QVERIFY(!foundTipLabel); + } - QSKIP("Tooltips don't work yet", SkipAll); - - SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget; - QLabel *widget = new QLabel; - widget->setText("If it ain't tested it's broken"); - widget->setToolTip("When in doubt, test"); - proxy->setWidget(widget); - widget->show(); - scene.addItem(proxy); - QTest::qWait(125); - - // in - QTest::mouseMove(view.viewport(), view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); + { + QHelpEvent helpEvent(QEvent::ToolTip, view.mapFromScene(proxy->boundingRect().center()), + view.viewport()->mapToGlobal(view.mapFromScene(proxy->boundingRect().center()))); + QApplication::sendEvent(view.viewport(), &helpEvent); + QTest::qWait(350); + + bool foundView = false; + bool foundTipLabel = false; + foreach (QWidget *widget, QApplication::topLevelWidgets()) { + if (widget == &view) + foundView = true; + if (widget->inherits("QTipLabel")) + foundTipLabel = true; + } + QVERIFY(foundView); + QVERIFY(foundTipLabel); + } - QTRY_COMPARE(proxy->childItems().count(), 1); - QGraphicsProxyWidget *child = (QGraphicsProxyWidget*)(proxy->childItems())[0]; - QVERIFY(child->isWidget()); - QVERIFY(child->widget()); - QCOMPARE(child->widget()->parent(), static_cast(widget)); - QCOMPARE(child->widget()->x(), widget->x()); // ### ??? - QCOMPARE(child->widget()->y(), widget->y() + widget->height()); // ### ??? + { + QHelpEvent helpEvent(QEvent::ToolTip, view.viewport()->rect().topLeft(), + view.viewport()->mapToGlobal(view.viewport()->rect().topLeft())); + QApplication::sendEvent(view.viewport(), &helpEvent); + // Wait 350ms because the tooltip only hides after 300ms... + QTest::qWait(350); + + bool foundView = false; + bool foundTipLabel = false; + foreach (QWidget *widget, QApplication::topLevelWidgets()) { + if (widget == &view) + foundView = true; + if (widget->inherits("QTipLabel") && widget->isVisible()) + foundTipLabel = true; + } + QVERIFY(foundView); + QVERIFY(!foundTipLabel); + } } void tst_QGraphicsProxyWidget::childPos_data() -- cgit v0.12 From 6a78005ed2e2d29225e322d53bb422438c8f9935 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 15 Apr 2010 13:34:18 +0300 Subject: Slider graphics does not look correct in N95 (part2) The original fix for this, only fixed horizontal widgets. But the same issue can be reproduced also with vertical widgets. This latter fix replaces the orginal fix. Task-number: QTBUG-9854 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 3259d82..7587343 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -548,11 +548,11 @@ void QS60StylePrivate::drawRow(QS60StyleEnums::SkinParts start, startEndSize.scale(rect.size(), Qt::KeepAspectRatio); QRect startRect = QRect(rect.topLeft(), startEndSize); - startRect.setHeight(rect.height()); QRect middleRect = rect; QRect endRect; if (orientation == Qt::Horizontal) { + startRect.setHeight(rect.height()); 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); @@ -562,6 +562,7 @@ void QS60StylePrivate::drawRow(QS60StyleEnums::SkinParts start, endRect.adjust(overlap, 0, 0, 0); } } else { + startRect.setWidth(rect.width()); 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()); -- cgit v0.12 From 22df502bd5fcdb51bfcfa2e5d3f6fbf2d9fc3562 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 15 Apr 2010 13:37:40 +0300 Subject: Dialogs in landscape mode are not correctly positioned If AVKON is using a StaCon component (combined Status and Control Pane), then dialogs were incorrectly positioned. Native side, places dialogs shown with StaCon to right border, whereas the current implementation was placing them to left. Fixed, by asking from AVKON the rect for StaCon. If it is empty, then use the existing placement rules, otherwise place to the right border. Task-number: QTBUG-9910 Reviewed-by: Janne Anttila --- src/gui/dialogs/qdialog.cpp | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index 25ba016..8b40b52 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -904,26 +904,33 @@ bool QDialog::s60AdjustedPosition() } else { cbaHeight = qt_TSize2QSize(bgContainer->Size()).height(); } - p.setY(S60->screenHeightInPixels-height()-cbaHeight); + p.setY(S60->screenHeightInPixels - height() - cbaHeight); p.setX(0); } else { const int scrollbarWidth = style()->pixelMetric(QStyle::PM_ScrollBarExtent); - TRect cbaRect = TRect(); - AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, cbaRect); - AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); - switch (cbaLocation) { - case AknLayoutUtils::EAknCbaLocationBottom: - p.setY(S60->screenHeightInPixels - height()-cbaRect.Height()); - p.setX((S60->screenWidthInPixels - width())>>1); - break; - case AknLayoutUtils::EAknCbaLocationRight: - p.setY((S60->screenHeightInPixels - height())>>1); - p.setX(qMax(0,S60->screenWidthInPixels-width()-scrollbarWidth-cbaRect.Width())); - break; - case AknLayoutUtils::EAknCbaLocationLeft: - p.setY((S60->screenHeightInPixels - height())>>1); - p.setX(qMax(0,scrollbarWidth+cbaRect.Width())); - break; + TRect staConTopRect = TRect(); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, staConTopRect); + if (staConTopRect.IsEmpty()) { + TRect cbaRect = TRect(); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, cbaRect); + AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); + switch (cbaLocation) { + case AknLayoutUtils::EAknCbaLocationBottom: + p.setY(S60->screenHeightInPixels - height() - cbaRect.Height()); + p.setX((S60->screenWidthInPixels - width()) >> 1); + break; + case AknLayoutUtils::EAknCbaLocationRight: + p.setY((S60->screenHeightInPixels - height()) >> 1); + p.setX(qMax(0,S60->screenWidthInPixels - width() - scrollbarWidth - cbaRect.Width())); + break; + case AknLayoutUtils::EAknCbaLocationLeft: + p.setY((S60->screenHeightInPixels - height()) >> 1); + p.setX(qMax(0,scrollbarWidth + cbaRect.Width())); + break; + } + } else { + p.setY((S60->screenHeightInPixels - height()) >> 1); + p.setX(qMax(0,S60->screenWidthInPixels - width())); } } move(p); -- cgit v0.12 From a0b2992fe166bed4020e14fca9742ca3a7c9ae9e Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 15 Apr 2010 14:53:24 +0300 Subject: ComboBox popuplist is not correctly layouted in fullscreen mode This is partial fix to issue 9913. Now combobox popup is correctly positioned with AVKON StaCon (Combined Status and Control Pane). Popup is centered onscreen in this case. Task-number: QTBUG-9913 Reviewed-by: Janne Anttila --- src/gui/widgets/qcombobox.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 7d02e14..12b1c4a 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -76,6 +76,10 @@ #ifndef QT_NO_EFFECTS # include #endif +#if defined(Q_WS_S60) +#include "private/qt_s60_p.h" +#endif + QT_BEGIN_NAMESPACE QComboBoxPrivate::QComboBoxPrivate() @@ -2449,11 +2453,16 @@ void QComboBox::showPopup() // in portait, menu should be positioned above softkeys listRect.moveBottom(screen.bottom()); } else { - // landscape, menu should be at the right and horizontally centered + TRect staConTopRect = TRect(); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, staConTopRect); listRect.setWidth(listRect.height()); + //by default popup is centered on screen in landscape listRect.moveCenter(screen.center()); - (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : - listRect.setLeft(screen.left()); + if (staConTopRect.IsEmpty()) { + // landscape without stacon, menu should be at the right + (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : + listRect.setLeft(screen.left()); + } } #endif } else if (!boundToScreen || listRect.height() <= belowHeight) { @@ -2681,13 +2690,18 @@ void QComboBox::changeEvent(QEvent *e) // in portait, menu should be positioned above softkeys listRect.moveBottom(screen.bottom()); } else { - // landscape, menu should be at the right and horizontally centered + TRect staConTopRect = TRect(); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, staConTopRect); listRect.setWidth(listRect.height()); + //by default popup is centered on screen in landscape listRect.moveCenter(screen.center()); - (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : - listRect.setLeft(screen.left()); + if (staConTopRect.IsEmpty()) { + // landscape without stacon, menu should be at the right + (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : + listRect.setLeft(screen.left()); + } + d->container->setGeometry(listRect); } - d->container->setGeometry(listRect); } } #endif -- cgit v0.12 From 3fdf7e7a120b72819c5a0997ddb65951d4889813 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 15 Apr 2010 15:21:17 +0300 Subject: '#' gets inserted to editor when changing FEP modes This is regression in QCoeFepInputContext::commitCurrentString. Recent member variable removal broke the existing functionality. Fixed by removing the orphaned return-statement. Task-number: QTBUG-9867 Reviewed-by: Alessandro Portale --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 94036d0..b42e0ab 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -782,7 +782,6 @@ void QCoeFepInputContext::commitCurrentString(bool cancelFepTransaction) if (w->inputMethodQuery(Qt::ImCursorPosition).toInt() != m_cursorPos) longPress = 1; } - return; } QList attributes; -- cgit v0.12 From 0a93295aba1f5e80a03b095df68f22d0a805922f Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 15 Apr 2010 13:54:30 +0200 Subject: QNAM HTTP: Pipelining changes Re-wrote some code to improve pipelining efficiency. Greatly helps with combining into one TCP packet. Task-number: QTBUG-9894 Task-number: QT-3280 Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkconnection.cpp | 94 +++++++++++++--------- src/network/access/qhttpnetworkconnection_p.h | 1 + .../access/qhttpnetworkconnectionchannel.cpp | 7 +- .../tst_qhttpnetworkconnection.cpp | 2 +- 4 files changed, 61 insertions(+), 43 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index a887449..a6322a3 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -71,9 +71,11 @@ const int QHttpNetworkConnectionPrivate::defaultChannelCount = 3; const int QHttpNetworkConnectionPrivate::defaultChannelCount = 6; #endif -// the maximum amount of requests that might be pipelined into a socket -// from what was suggested, 3 seems to be OK +// The pipeline length. So there will be 4 requests in flight. const int QHttpNetworkConnectionPrivate::defaultPipelineLength = 3; +// Only re-fill the pipeline if there's defaultRePipelineLength slots free in the pipeline. +// This means that there are 2 requests in flight and 2 slots free that will be re-filled. +const int QHttpNetworkConnectionPrivate::defaultRePipelineLength = 2; QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt) @@ -487,54 +489,68 @@ void QHttpNetworkConnectionPrivate::fillPipeline(QAbstractSocket *socket) int i = indexOf(socket); - bool highPriorityQueueProcessingDone = false; - bool lowPriorityQueueProcessingDone = false; + if (! (defaultPipelineLength - channels[i].alreadyPipelinedRequests.length() >= 2)) { + return; + } - while (!highPriorityQueueProcessingDone && !lowPriorityQueueProcessingDone) { - // this loop runs once per request we intend to pipeline in. + if (channels[i].pipeliningSupported != QHttpNetworkConnectionChannel::PipeliningProbablySupported) + return; - if (channels[i].pipeliningSupported != QHttpNetworkConnectionChannel::PipeliningProbablySupported) - return; + // the current request that is in must already support pipelining + if (!channels[i].request.isPipeliningAllowed()) + return; - // the current request that is in must already support pipelining - if (!channels[i].request.isPipeliningAllowed()) - return; + // the current request must be a idempotent (right now we only check GET) + if (channels[i].request.operation() != QHttpNetworkRequest::Get) + return; - // the current request must be a idempotent (right now we only check GET) - if (channels[i].request.operation() != QHttpNetworkRequest::Get) - return; + // check if socket is connected + if (socket->state() != QAbstractSocket::ConnectedState) + return; - // check if socket is connected - if (socket->state() != QAbstractSocket::ConnectedState) - return; + // check for resendCurrent + if (channels[i].resendCurrent) + return; - // check for resendCurrent - if (channels[i].resendCurrent) - return; + // we do not like authentication stuff + // ### make sure to be OK with this in later releases + if (!channels[i].authenticator.isNull() || !channels[i].authenticator.user().isEmpty()) + return; + if (!channels[i].proxyAuthenticator.isNull() || !channels[i].proxyAuthenticator.user().isEmpty()) + return; + + // must be in ReadingState or WaitingState + if (! (channels[i].state == QHttpNetworkConnectionChannel::WaitingState + || channels[i].state == QHttpNetworkConnectionChannel::ReadingState)) + return; - // we do not like authentication stuff - // ### make sure to be OK with this in later releases - if (!channels[i].authenticator.isNull() || !channels[i].authenticator.user().isEmpty()) - return; - if (!channels[i].proxyAuthenticator.isNull() || !channels[i].proxyAuthenticator.user().isEmpty()) - return; - // check for pipeline length + //qDebug() << "QHttpNetworkConnectionPrivate::fillPipeline processing highPriorityQueue, size=" << highPriorityQueue.size() << " alreadyPipelined=" << channels[i].alreadyPipelinedRequests.length(); + int lengthBefore; + while (!highPriorityQueue.isEmpty()) { + lengthBefore = channels[i].alreadyPipelinedRequests.length(); + fillPipeline(highPriorityQueue, channels[i]); + if (channels[i].alreadyPipelinedRequests.length() >= defaultPipelineLength) return; - // must be in ReadingState or WaitingState - if (! (channels[i].state == QHttpNetworkConnectionChannel::WaitingState - || channels[i].state == QHttpNetworkConnectionChannel::ReadingState)) + if (lengthBefore == channels[i].alreadyPipelinedRequests.length()) + break; // did not process anything, now do the low prio queue + } + + //qDebug() << "QHttpNetworkConnectionPrivate::fillPipeline processing lowPriorityQueue, size=" << lowPriorityQueue.size() << " alreadyPipelined=" << channels[i].alreadyPipelinedRequests.length(); + while (!lowPriorityQueue.isEmpty()) { + lengthBefore = channels[i].alreadyPipelinedRequests.length(); + fillPipeline(lowPriorityQueue, channels[i]); + + if (channels[i].alreadyPipelinedRequests.length() >= defaultPipelineLength) return; - highPriorityQueueProcessingDone = fillPipeline(highPriorityQueue, channels[i]); - // not finished with highPriorityQueue? then loop again - if (!highPriorityQueueProcessingDone) - continue; - // highPriorityQueue was processed, now deal with the lowPriorityQueue - lowPriorityQueueProcessingDone = fillPipeline(lowPriorityQueue, channels[i]); + if (lengthBefore == channels[i].alreadyPipelinedRequests.length()) + break; // did not process anything } + + } // returns true when the processing of a queue has been done @@ -707,7 +723,6 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() // if this is not possible, error will be emitted and connection terminated if (!channels[i].resetUploadData()) continue; - channels[i].sendRequest(); } } @@ -747,8 +762,9 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() // return fast if there is nothing to pipeline if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty()) return; - for (int j = 0; j < channelCount; j++) - fillPipeline(channels[j].socket); + for (int i = 0; i < channelCount; i++) + if (channels[i].socket->state() == QAbstractSocket::ConnectedState) + fillPipeline(channels[i].socket); } void QHttpNetworkConnectionPrivate::_q_restartAuthPendingRequests() diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index 823774e..b5bd300 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -156,6 +156,7 @@ class QHttpNetworkConnectionPrivate : public QObjectPrivate public: static const int defaultChannelCount; static const int defaultPipelineLength; + static const int defaultRePipelineLength; QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt); QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName, quint16 port, bool encrypt); diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 83b7d4c..4c3dbe2 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -285,8 +285,8 @@ bool QHttpNetworkConnectionChannel::sendRequest() } // HTTP pipelining - connection->d_func()->fillPipeline(socket); - socket->flush(); + //connection->d_func()->fillPipeline(socket); + //socket->flush(); // ensure we try to receive a reply in all cases, even if _q_readyRead_ hat not been called // this is needed if the sends an reply before we have finished sending the request. In that @@ -661,7 +661,8 @@ void QHttpNetworkConnectionChannel::allDone() connection->d_func()->fillPipeline(socket); // continue reading - _q_receiveReply(); + //_q_receiveReply(); + // this was wrong, allDone gets called from that function anyway. } } else if (alreadyPipelinedRequests.isEmpty() && socket->bytesAvailable() > 0) { eatWhitespace(); diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index 35ebbd9..0b55390 100644 --- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -801,7 +801,7 @@ void tst_QHttpNetworkConnection::getMultiple_data() QTest::newRow("6 connections, no pipelining, 100 requests") << quint16(6) << false << 100; QTest::newRow("1 connection, no pipelining, 100 requests") << quint16(1) << false << 100; - QTest::newRow("6 connections, pipelining allowed, 100 requests") << quint16(2) << true << 100; + QTest::newRow("6 connections, pipelining allowed, 100 requests") << quint16(6) << true << 100; QTest::newRow("1 connection, pipelining allowed, 100 requests") << quint16(1) << true << 100; } -- cgit v0.12 From 0caad7dc081812fcc056d917288757b2e475ea05 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Thu, 15 Apr 2010 15:55:13 +0200 Subject: Fixes auto-test failure for 9da13ea53aec6d841ba7f416531d6c52d4368df4. --- .../qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index a5a039a..d5f63d3 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -2645,25 +2645,6 @@ void tst_QGraphicsProxyWidget::tooltip_basic() QVERIFY(foundView); QVERIFY(foundTipLabel); } - - { - QHelpEvent helpEvent(QEvent::ToolTip, view.viewport()->rect().topLeft(), - view.viewport()->mapToGlobal(view.viewport()->rect().topLeft())); - QApplication::sendEvent(view.viewport(), &helpEvent); - // Wait 350ms because the tooltip only hides after 300ms... - QTest::qWait(350); - - bool foundView = false; - bool foundTipLabel = false; - foreach (QWidget *widget, QApplication::topLevelWidgets()) { - if (widget == &view) - foundView = true; - if (widget->inherits("QTipLabel") && widget->isVisible()) - foundTipLabel = true; - } - QVERIFY(foundView); - QVERIFY(!foundTipLabel); - } } void tst_QGraphicsProxyWidget::childPos_data() -- cgit v0.12 From a7ded5708ce81a37404cc0db8de84521c2aa693d Mon Sep 17 00:00:00 2001 From: Iain Date: Thu, 15 Apr 2010 16:19:50 +0200 Subject: Symbol visibility fixes for RVCT4 on Symbian RVCT 4 is far more strict with regards to symbol visiblity that RVCT 2.2, and will hide symbols unless all references have default visibility in the object files. Update the various places in Qt code where the symbol visibility was set incorrectly for DLL-based platforms (those that use __declspec(dllimport) and (dllexport). Note: QtWebkit and QtScript are fixed in different commits. Task-number: QTBUG-9903 Reviewed-by: Jason Barron --- src/gui/graphicsview/qgraphicsproxywidget.cpp | 2 +- src/gui/image/qimage.cpp | 4 ++-- src/gui/image/qpaintengine_pic.cpp | 2 +- src/gui/image/qpicture.cpp | 4 ++-- src/gui/image/qpixmap_raster.cpp | 4 ++-- src/gui/image/qpixmapfilter.cpp | 2 +- src/gui/kernel/qapplication.cpp | 2 +- src/gui/kernel/qwhatsthis.cpp | 2 +- src/gui/painting/qbrush.cpp | 3 +-- src/gui/painting/qpaintbuffer.cpp | 4 ++-- src/gui/painting/qpaintengine_alpha.cpp | 4 ++-- src/gui/painting/qpaintengine_raster.cpp | 4 ++-- src/gui/painting/qpaintengineex.cpp | 2 +- src/gui/painting/qpdf.cpp | 2 +- src/gui/painting/qstroker.cpp | 2 +- src/gui/text/qfontdatabase.cpp | 2 +- src/gui/text/qfontmetrics.cpp | 2 +- src/gui/text/qtextdocument.cpp | 2 +- src/gui/text/qtextdocumentlayout.cpp | 2 +- src/gui/text/qtextengine.cpp | 4 ++-- src/gui/text/qtextimagehandler.cpp | 2 +- src/gui/widgets/qabstractbutton.cpp | 2 +- src/openvg/qpaintengine_vg.cpp | 8 ++++---- src/openvg/qpixmapdata_vg.cpp | 4 ++-- src/svg/qsvghandler.cpp | 2 +- src/xmlpatterns/data/qdecimal_p.h | 2 +- 26 files changed, 37 insertions(+), 38 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index 2132526..75007e6 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -189,7 +189,7 @@ QT_BEGIN_NAMESPACE */ extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); -extern bool qt_tab_all_widgets; +Q_GUI_EXPORT extern bool qt_tab_all_widgets; /*! \internal diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 5d2b4c0..d46f40e 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -118,8 +118,8 @@ const QVector *qt_image_colortable(const QImage &image) return &image.d->colortable; } -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); +Q_GUI_EXPORT extern int qt_defaultDpiX(); +Q_GUI_EXPORT extern int qt_defaultDpiY(); QBasicAtomicInt qimage_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1); diff --git a/src/gui/image/qpaintengine_pic.cpp b/src/gui/image/qpaintengine_pic.cpp index 1aeb524..e7f41e7 100644 --- a/src/gui/image/qpaintengine_pic.cpp +++ b/src/gui/image/qpaintengine_pic.cpp @@ -477,7 +477,7 @@ void QPicturePaintEngine::drawImage(const QRectF &r, const QImage &image, const writeCmdLength(pos, r, false); } -extern int qt_defaultDpi(); +Q_GUI_EXPORT extern int qt_defaultDpi(); void QPicturePaintEngine::drawTextItem(const QPointF &p , const QTextItem &ti) { diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index fb70e36..48d2de3 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -108,8 +108,8 @@ void qt_format_text(const QFont &fnt, const QRectF &_r, const char *qt_mfhdr_tag = "QPIC"; // header tag static const quint16 mfhdr_maj = 11; // major version # static const quint16 mfhdr_min = 0; // minor version # -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); +Q_GUI_EXPORT extern int qt_defaultDpiX(); +Q_GUI_EXPORT extern int qt_defaultDpiY(); /*! Constructs an empty picture. diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 0b1c18d..a440dcc 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -357,8 +357,8 @@ QPaintEngine* QRasterPixmapData::paintEngine() const return image.paintEngine(); } -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); +Q_GUI_EXPORT extern int qt_defaultDpiX(); +Q_GUI_EXPORT extern int qt_defaultDpiY(); int QRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const { diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index c605880..664d5d5 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -898,7 +898,7 @@ Q_GUI_EXPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, in expblur<12, 10, false>(blurImage, radius, quality, transposed); } -bool qt_scaleForTransform(const QTransform &transform, qreal *scale); +Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); /*! \internal diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index e480696..de74f53 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -138,7 +138,7 @@ static void initResources() QT_BEGIN_NAMESPACE -extern void qt_call_post_routines(); +Q_DECL_IMPORT extern void qt_call_post_routines(); int QApplicationPrivate::app_compile_version = 0x040000; //we don't know exactly, but it's at least 4.0.0 diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/gui/kernel/qwhatsthis.cpp index b877784..6181b62 100644 --- a/src/gui/kernel/qwhatsthis.cpp +++ b/src/gui/kernel/qwhatsthis.cpp @@ -143,7 +143,7 @@ QT_BEGIN_NAMESPACE \sa QToolTip */ -extern void qDeleteInEventHandler(QObject *o); +Q_DECL_IMPORT extern void qDeleteInEventHandler(QObject *o); class QWhatsThat : public QWidget { diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index fcfc44d..c0c73a2 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -160,8 +160,7 @@ static void qt_cleanup_brush_pattern_image_cache() qt_brushPatternImageCache()->cleanup(); } -Q_GUI_EXPORT -QImage qt_imageForBrush(int brushStyle, bool invert) +Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert) { return qt_brushPatternImageCache()->getImage(brushStyle, invert); } diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp index 2344c04..9fdb96c 100644 --- a/src/gui/painting/qpaintbuffer.cpp +++ b/src/gui/painting/qpaintbuffer.cpp @@ -52,8 +52,8 @@ QT_BEGIN_NAMESPACE -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); +Q_GUI_EXPORT extern int qt_defaultDpiX(); +Q_GUI_EXPORT extern int qt_defaultDpiY(); extern void qt_format_text(const QFont &font, const QRectF &_r, int tf, const QTextOption *option, const QString& str, QRectF *brect, int tabstops, int* tabarray, int tabarraylen, diff --git a/src/gui/painting/qpaintengine_alpha.cpp b/src/gui/painting/qpaintengine_alpha.cpp index 5a3c0cf..4b1c58d 100644 --- a/src/gui/painting/qpaintengine_alpha.cpp +++ b/src/gui/painting/qpaintengine_alpha.cpp @@ -93,8 +93,8 @@ bool QAlphaPaintEngine::begin(QPaintDevice *pdev) return true; } -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); +Q_GUI_EXPORT extern int qt_defaultDpiX(); +Q_GUI_EXPORT extern int qt_defaultDpiY(); bool QAlphaPaintEngine::end() { diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 3c2cc8c..975ebb0 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE -extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp +Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp #define qreal_to_fixed_26_6(f) (int(f * 64)) #define qt_swap_int(x, y) { int tmp = (x); (x) = (y); (y) = tmp; } @@ -4977,7 +4977,7 @@ void QSpanData::init(QRasterBuffer *rb, const QRasterPaintEngine *pe) clip = pe ? pe->d_func()->clip() : 0; } -extern QImage qt_imageForBrush(int brushStyle, bool invert); +Q_GUI_EXPORT extern QImage qt_imageForBrush(int brushStyle, bool invert); void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode) { diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 4f2fffa..d54c1ed 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -380,7 +380,7 @@ QPainterState *QPaintEngineEx::createState(QPainterState *orig) const return new QPainterState(orig); } -extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp +Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) { diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index dd516b1..ee8b078 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE -extern int qt_defaultDpi(); +Q_GUI_EXPORT extern int qt_defaultDpi(); #ifndef QT_NO_PRINTER diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp index 16e3c38..094d42e 100644 --- a/src/gui/painting/qstroker.cpp +++ b/src/gui/painting/qstroker.cpp @@ -825,7 +825,7 @@ qreal qt_t_for_arc_angle(qreal angle) return t; } -void qt_find_ellipse_coords(const QRectF &r, qreal angle, qreal length, +Q_GUI_EXPORT void qt_find_ellipse_coords(const QRectF &r, qreal angle, qreal length, QPointF* startPoint, QPointF *endPoint); /*! diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 6803120..ae5e9ca 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE #define SMOOTH_SCALABLE 0xffff -extern int qt_defaultDpiY(); // in qfont.cpp +Q_GUI_EXPORT extern int qt_defaultDpiY(); // in qfont.cpp bool qt_enable_test_font = false; diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 44a18de..e455bb4 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -63,7 +63,7 @@ extern void qt_format_text(const QFont& font, const QRectF &_r, int tf, const QString &text, QRectF *brect, int tabStops, int *tabArray, int tabArrayLen, QPainter *painter); -extern int qt_defaultDpi(); +Q_GUI_EXPORT extern int qt_defaultDpi(); /***************************************************************************** QFontMetrics member functions diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 21f3189..f5d322a 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -1631,7 +1631,7 @@ static void printPage(int index, QPainter *painter, const QTextDocument *doc, co painter->restore(); } -extern int qt_defaultDpi(); +Q_GUI_EXPORT extern int qt_defaultDpi(); /*! Prints the document to the given \a printer. The QPrinter must be diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index b45fcbb..f12bf0b 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -75,7 +75,7 @@ QT_BEGIN_NAMESPACE -extern int qt_defaultDpi(); +Q_GUI_EXPORT extern int qt_defaultDpi(); // ################ should probably add frameFormatChange notification! diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index eaa80d3..76eb340 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -856,7 +856,7 @@ void QTextEngine::shapeLine(const QScriptLine &line) } } -extern int qt_defaultDpiY(); // in qfont.cpp +Q_GUI_EXPORT extern int qt_defaultDpiY(); // in qfont.cpp void QTextEngine::shapeText(int item) const { @@ -2495,7 +2495,7 @@ void QTextEngine::splitItem(int item, int pos) const // qDebug("split at position %d itempos=%d", pos, item); } -extern int qt_defaultDpiY(); +Q_GUI_EXPORT extern int qt_defaultDpiY(); QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const { diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp index fa49a32..6733793 100644 --- a/src/gui/text/qtextimagehandler.cpp +++ b/src/gui/text/qtextimagehandler.cpp @@ -123,7 +123,7 @@ static QSize getPixmapSize(QTextDocument *doc, const QTextImageFormat &format) qreal scale = 1.0; QPaintDevice *pdev = doc->documentLayout()->paintDevice(); if (pdev) { - extern int qt_defaultDpi(); + Q_GUI_EXPORT extern int qt_defaultDpi(); if (pm.isNull()) pm = getPixmap(doc, format); if (!pm.isNull()) diff --git a/src/gui/widgets/qabstractbutton.cpp b/src/gui/widgets/qabstractbutton.cpp index 5ceb237..995d659 100644 --- a/src/gui/widgets/qabstractbutton.cpp +++ b/src/gui/widgets/qabstractbutton.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE #define AUTO_REPEAT_DELAY 300 #define AUTO_REPEAT_INTERVAL 100 -extern bool qt_tab_all_widgets; +Q_GUI_EXPORT extern bool qt_tab_all_widgets; /*! \class QAbstractButton diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index ebf34f5..96e0e86 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -75,8 +75,8 @@ QT_BEGIN_NAMESPACE #if !defined(QVG_NO_DRAW_GLYPHS) -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); +Q_DECL_IMPORT extern int qt_defaultDpiX(); +Q_DECL_IMPORT extern int qt_defaultDpiY(); class QVGPaintEnginePrivate; @@ -497,7 +497,7 @@ void QVGPaintEnginePrivate::setTransform vgLoadMatrix(mat); } -extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); +Q_DECL_IMPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) { @@ -975,7 +975,7 @@ VGPath QVGPaintEnginePrivate::roundedRectPath(const QRectF &rect, qreal xRadius, return vgpath; } -extern QImage qt_imageForBrush(int style, bool invert); +Q_DECL_IMPORT extern QImage qt_imageForBrush(int style, bool invert); static QImage colorizeBitmap(const QImage &image, const QColor &color) { diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 7efec2b..39c83d3 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -354,8 +354,8 @@ void QVGPixmapData::reclaimImages() destroyImages(); } -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); +Q_DECL_IMPORT extern int qt_defaultDpiX(); +Q_DECL_IMPORT extern int qt_defaultDpiY(); int QVGPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const { diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 926b04d..4cc8f41 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE static const char *qt_inherit_text = "inherit"; #define QT_INHERIT QLatin1String(qt_inherit_text) -double qstrtod(const char *s00, char const **se, bool *ok); +Q_DECL_IMPORT double qstrtod(const char *s00, char const **se, bool *ok); // ======== duplicated from qcolor_p diff --git a/src/xmlpatterns/data/qdecimal_p.h b/src/xmlpatterns/data/qdecimal_p.h index b746ff9..d17b647 100644 --- a/src/xmlpatterns/data/qdecimal_p.h +++ b/src/xmlpatterns/data/qdecimal_p.h @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE /** * Defined in QtCore's qlocale.cpp. */ -extern char *qdtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **resultp); +Q_DECL_IMPORT extern char *qdtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **resultp); namespace QPatternist { -- cgit v0.12 From b2271d364cdc26187e5f9113f4c1816f334e37a1 Mon Sep 17 00:00:00 2001 From: Iain Date: Thu, 15 Apr 2010 16:38:02 +0200 Subject: Symbol visibility fixes for RVCT4 on Symbian RVCT 4 is far more strict with regards to symbol visiblity that RVCT 2.2, and will hide symbols unless all references have default visibility in the object files. Update the various places in Qt code where the symbol visibility was set incorrectly for DLL-based platforms (those that use __declspec(dllimport) and (dllexport). Note: QtWebkit and other Qt modules are fixed in different commits. Task-number: QTBUG-9903 Reviewed-by: Jason Barron --- src/script/api/qscriptengine.cpp | 2 +- src/script/parser/qscriptlexer.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 9ce0f7d..f44f33d 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1603,7 +1603,7 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun, #ifndef QT_NO_REGEXP -extern QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax); +Q_DECL_IMPORT extern QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax); /*! Creates a QtScript object of class RegExp with the given diff --git a/src/script/parser/qscriptlexer.cpp b/src/script/parser/qscriptlexer.cpp index 38ad6ce..ca64776 100644 --- a/src/script/parser/qscriptlexer.cpp +++ b/src/script/parser/qscriptlexer.cpp @@ -31,7 +31,7 @@ QT_BEGIN_NAMESPACE -extern double qstrtod(const char *s00, char const **se, bool *ok); +Q_DECL_IMPORT extern double qstrtod(const char *s00, char const **se, bool *ok); #define shiftWindowsLineBreak() \ do { \ -- cgit v0.12 From 81837e43e3f966c1755e90eb65df6e3bad506ed7 Mon Sep 17 00:00:00 2001 From: Iain Date: Thu, 15 Apr 2010 16:41:58 +0200 Subject: Symbol visibility fixes for RVCT4 on Symbian RVCT 4 is far more strict with regards to symbol visiblity that RVCT 2.2, and will hide symbols unless all references have default visibility in the object files. Update the various places in Qt code where the symbol visibility was set incorrectly for DLL-based platforms (those that use __declspec(dllimport) and (dllexport). Note: Other Qt modules and QtScript are fixed in different commits. Task-number: QTBUG-9903 Reviewed-by: Jason Barron Janne Koskinen --- src/3rdparty/webkit/WebCore/page/qt/EventHandlerQt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/WebCore/page/qt/EventHandlerQt.cpp b/src/3rdparty/webkit/WebCore/page/qt/EventHandlerQt.cpp index 3425289..7563459 100644 --- a/src/3rdparty/webkit/WebCore/page/qt/EventHandlerQt.cpp +++ b/src/3rdparty/webkit/WebCore/page/qt/EventHandlerQt.cpp @@ -51,7 +51,7 @@ #include "NotImplemented.h" QT_BEGIN_NAMESPACE -extern Q_GUI_EXPORT bool qt_tab_all_widgets; // from qapplication.cpp +Q_DECL_IMPORT extern bool qt_tab_all_widgets; // from qapplication.cpp QT_END_NAMESPACE namespace WebCore { -- cgit v0.12 From 45ec585b46dc71de8a72e3bbc2401f50a2a42a8b Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 15 Apr 2010 17:13:50 +0200 Subject: QtScript: Add autotest for enumeration of QMetaObject properties The issue reported in QTBUG-3665 had been fixed since 4.6.0, but it went unnoticed that there had been a bug in the first place since there was no test for this behavior. --- .../qscriptextqobject/tst_qscriptextqobject.cpp | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp index b4ce561..fddab3f 100644 --- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp +++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp @@ -533,6 +533,7 @@ private slots: void objectDeleted(); void connectToDestroyedSignal(); void emitAfterReceiverDeleted(); + void enumerateMetaObject(); private: QScriptEngine *m_engine; @@ -3043,5 +3044,38 @@ void tst_QScriptExtQObject::emitAfterReceiverDeleted() } } +void tst_QScriptExtQObject::enumerateMetaObject() +{ + QScriptValue myClass = m_engine->newQMetaObject(m_myObject->metaObject(), m_engine->undefinedValue()); + + QStringList expectedNames; + expectedNames << "FooPolicy" << "BarPolicy" << "BazPolicy" + << "FooStrategy" << "BarStrategy" << "BazStrategy" + << "NoAbility" << "FooAbility" << "BarAbility" << "BazAbility" << "AllAbility"; + + for (int x = 0; x < 2; ++x) { + QSet actualNames; + if (x == 0) { + // From C++ + QScriptValueIterator it(myClass); + while (it.hasNext()) { + it.next(); + actualNames.insert(it.name()); + } + } else { + // From JS + m_engine->globalObject().setProperty("MyClass", myClass); + QScriptValue ret = m_engine->evaluate("a=[]; for (var p in MyClass) if (MyClass.hasOwnProperty(p)) a.push(p); a"); + QVERIFY(ret.isArray()); + QStringList strings = qscriptvalue_cast(ret); + for (int i = 0; i < strings.size(); ++i) + actualNames.insert(strings.at(i)); + } + QCOMPARE(actualNames.size(), expectedNames.size()); + for (int i = 0; i < expectedNames.size(); ++i) + QVERIFY(actualNames.contains(expectedNames.at(i))); + } +} + QTEST_MAIN(tst_QScriptExtQObject) #include "tst_qscriptextqobject.moc" -- cgit v0.12 From f62d8eb38d35d394aca01f9ec309a43525afb557 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 15 Apr 2010 17:22:27 +0200 Subject: Add translation context to qsTr() benchmark That's a more realistic case, since translations are usually tied to a physical script. --- tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp b/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp index 6c6f0b1..35e2f28 100644 --- a/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp +++ b/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp @@ -269,19 +269,22 @@ void tst_QScriptEngine::nativeCall() void tst_QScriptEngine::translation_data() { QTest::addColumn("text"); - QTest::newRow("no translation") << "\"hello world\""; - QTest::newRow("qsTr") << "qsTr(\"hello world\")"; - QTest::newRow("qsTranslate") << "qsTranslate(\"\", \"hello world\")"; + QTest::addColumn("fileName"); + QTest::newRow("no translation") << "\"hello world\"" << ""; + QTest::newRow("qsTr") << "qsTr(\"hello world\")" << ""; + QTest::newRow("qsTranslate") << "qsTranslate(\"\", \"hello world\")" << ""; + QTest::newRow("qsTr:script.js") << "qsTr(\"hello world\")" << "script.js"; } void tst_QScriptEngine::translation() { QFETCH(QString, text); + QFETCH(QString, fileName); QScriptEngine engine; engine.installTranslatorFunctions(); QBENCHMARK { - (void)engine.evaluate(text); + (void)engine.evaluate(text, fileName); } } -- cgit v0.12 From f14ae11e6731bd7416f45c3ef7ce464587862223 Mon Sep 17 00:00:00 2001 From: Iain Date: Thu, 15 Apr 2010 18:08:17 +0200 Subject: Update WebKit DEF files on Symbian Add/absent function with altered signature to BWINS DEF file. Correct ordinal numbering in EABI DEF file, it was broken and causing the build to fail. Reviewed-by: TrustMe --- src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def | 3 ++- src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def b/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def index 086e986..cc609e1 100644 --- a/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def +++ b/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def @@ -623,5 +623,6 @@ EXPORTS ?qt_networkAccessAllowed@@YAX_N@Z @ 622 NONAME ; void qt_networkAccessAllowed(bool) ?qt_resumeActiveDOMObjects@@YAXPAVQWebFrame@@@Z @ 623 NONAME ; void qt_resumeActiveDOMObjects(class QWebFrame *) ?qt_suspendActiveDOMObjects@@YAXPAVQWebFrame@@@Z @ 624 NONAME ; void qt_suspendActiveDOMObjects(class QWebFrame *) - ?qtwebkit_webframe_scrollRecursively@@YA_NPAVQWebFrame@@HH@Z @ 625 NONAME ; bool qtwebkit_webframe_scrollRecursively(class QWebFrame *, int, int) + ?qtwebkit_webframe_scrollRecursively@@YA_NPAVQWebFrame@@HH@Z @ 625 NONAME ABSENT ; bool qtwebkit_webframe_scrollRecursively(class QWebFrame *, int, int) + ?qtwebkit_webframe_scrollRecursively@@YAXPAVQWebFrame@@HHABVQPoint@@@Z @ 626 NONAME ; void qtwebkit_webframe_scrollRecursively(class QWebFrame *, int, int, class QPoint const &) diff --git a/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def b/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def index cfa8f7f..d244ad5 100644 --- a/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def +++ b/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def @@ -694,4 +694,4 @@ EXPORTS _Z25qt_resumeActiveDOMObjectsP9QWebFrame @ 693 NONAME _Z26qt_suspendActiveDOMObjectsP9QWebFrame @ 694 NONAME _Z35qtwebkit_webframe_scrollRecursivelyP9QWebFrameii @ 695 NONAME ABSENT - _Z35qtwebkit_webframe_scrollRecursivelyP9QWebFrameiiRK6QPoint @ 715 NONAME + _Z35qtwebkit_webframe_scrollRecursivelyP9QWebFrameiiRK6QPoint @ 696 NONAME -- cgit v0.12 From 0d20ec571767bd80d0b6d636a3a83f472a6dc653 Mon Sep 17 00:00:00 2001 From: Iain Date: Thu, 15 Apr 2010 20:00:52 +0200 Subject: Update EABI and BWINS DEF files for Symbian Reviewed-by: TrustMe --- src/s60installs/bwins/QtCoreu.def | 2 ++ src/s60installs/bwins/QtGuiu.def | 16 ++++++++++++++-- src/s60installs/bwins/QtNetworku.def | 2 ++ src/s60installs/bwins/QtOpenVGu.def | 4 ++++ src/s60installs/eabi/QtGuiu.def | 14 +++++++++++++- 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def index df10406..536129b 100644 --- a/src/s60installs/bwins/QtCoreu.def +++ b/src/s60installs/bwins/QtCoreu.def @@ -4417,4 +4417,6 @@ EXPORTS ?QBasicAtomicInt_testAndSetRelease@@YA_NPCHHH@Z @ 4416 NONAME ; bool QBasicAtomicInt_testAndSetRelease(int volatile *, int, int) ?QBasicAtomicInt_fetchAndStoreAcquire@@YAHPCHH@Z @ 4417 NONAME ; int QBasicAtomicInt_fetchAndStoreAcquire(int volatile *, int) ?QBasicAtomicInt_fetchAndAddAcquire@@YAHPCHH@Z @ 4418 NONAME ; int QBasicAtomicInt_fetchAndAddAcquire(int volatile *, int) + ?validCodecs@QTextCodec@@CA_NXZ @ 4419 NONAME ; bool QTextCodec::validCodecs(void) + ?clearHistory@QStateMachinePrivate@@QAEXXZ @ 4420 NONAME ; void QStateMachinePrivate::clearHistory(void) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 6a4f07b..dad9e6c 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -11922,7 +11922,7 @@ EXPORTS ?updateCachedClipPathFromSetPosHelper@QGraphicsItemPrivate@@QAEXABVQPointF@@@Z @ 11921 NONAME ABSENT ; void QGraphicsItemPrivate::updateCachedClipPathFromSetPosHelper(class QPointF const &) ?updateCell@QCalendarWidget@@IAEXABVQDate@@@Z @ 11922 NONAME ; void QCalendarWidget::updateCell(class QDate const &) ?updateCells@QCalendarWidget@@IAEXXZ @ 11923 NONAME ; void QCalendarWidget::updateCells(void) - ?updateDisplayText@QLineControl@@AAEXXZ @ 11924 NONAME ; void QLineControl::updateDisplayText(void) + ?updateDisplayText@QLineControl@@AAEXXZ @ 11924 NONAME ABSENT ; void QLineControl::updateDisplayText(void) ?updateEditorData@QAbstractItemView@@MAEXXZ @ 11925 NONAME ; void QAbstractItemView::updateEditorData(void) ?updateEditorGeometries@QAbstractItemView@@MAEXXZ @ 11926 NONAME ; void QAbstractItemView::updateEditorGeometries(void) ?updateEditorGeometry@QAbstractItemDelegate@@UBEXPAVQWidget@@ABVQStyleOptionViewItem@@ABVQModelIndex@@@Z @ 11927 NONAME ; void QAbstractItemDelegate::updateEditorGeometry(class QWidget *, class QStyleOptionViewItem const &, class QModelIndex const &) const @@ -12601,5 +12601,17 @@ EXPORTS ?setPixelFormat@QEglProperties@@QAEXW4Format@QImage@@@Z @ 12600 NONAME ABSENT ; void QEglProperties::setPixelFormat(enum QImage::Format) ?currentContext@QEglContext@@CAPAV1@W4API@QEgl@@@Z @ 12601 NONAME ABSENT ; class QEglContext * QEglContext::currentContext(enum QEgl::API) ?errorString@QEglContext@@SA?AVQString@@H@Z @ 12602 NONAME ABSENT ; class QString QEglContext::errorString(int) - ?removeAllApplicationFonts@QFontDatabase@@SA_NXZ @12603 ; NONAME ; bool QFontDatabase::removeAllApplicationFonts() + ?removeAllApplicationFonts@QFontDatabase@@SA_NXZ @ 12603 NONAME ; bool QFontDatabase::removeAllApplicationFonts() + ?display@QEglContext@@SAHXZ @ 12604 NONAME ABSENT ; int QEglContext::display(void) + ?clearFocusHelper@QGraphicsItemPrivate@@QAEX_N@Z @ 12605 NONAME ; void QGraphicsItemPrivate::clearFocusHelper(bool) + ?canKeypadNavigate@QWidgetPrivate@@SA_NW4Orientation@Qt@@@Z @ 12606 NONAME ; bool QWidgetPrivate::canKeypadNavigate(enum Qt::Orientation) + ?updateDisplayText@QLineControl@@AAEX_N@Z @ 12607 NONAME ; void QLineControl::updateDisplayText(bool) + ?isPixmapCached@QImagePixmapCleanupHooks@@SA_NABVQPixmap@@@Z @ 12608 NONAME ; bool QImagePixmapCleanupHooks::isPixmapCached(class QPixmap const &) + ?nativeDisplay@QEglContext@@CAHXZ @ 12609 NONAME ABSENT ; int QEglContext::nativeDisplay(void) + ?getGlyphBearings@QFontEngine@@UAEXIPAM0@Z @ 12610 NONAME ; void QFontEngine::getGlyphBearings(unsigned int, float *, float *) + ?inTabWidget@QWidgetPrivate@@SA_NPAVQWidget@@@Z @ 12611 NONAME ; bool QWidgetPrivate::inTabWidget(class QWidget *) + ?destroyContext@QEglContext@@QAEXXZ @ 12612 NONAME ABSENT ; void QEglContext::destroyContext(void) + ?isImageCached@QImagePixmapCleanupHooks@@SA_NABVQImage@@@Z @ 12613 NONAME ; bool QImagePixmapCleanupHooks::isImageCached(class QImage const &) + ?dpy@QEglContext@@0HA @ 12614 NONAME ; int QEglContext::dpy + ?setFocusHelper@QGraphicsItemPrivate@@QAEXW4FocusReason@Qt@@_N1@Z @ 12615 NONAME ; void QGraphicsItemPrivate::setFocusHelper(enum Qt::FocusReason, bool, bool) diff --git a/src/s60installs/bwins/QtNetworku.def b/src/s60installs/bwins/QtNetworku.def index 3d604fc..5b27fcf 100644 --- a/src/s60installs/bwins/QtNetworku.def +++ b/src/s60installs/bwins/QtNetworku.def @@ -962,4 +962,6 @@ EXPORTS ?staticMetaObject@QTcpServer@@2UQMetaObject@@B @ 961 NONAME ; struct QMetaObject const QTcpServer::staticMetaObject ?staticMetaObject@QUdpSocket@@2UQMetaObject@@B @ 962 NONAME ; struct QMetaObject const QUdpSocket::staticMetaObject ?staticMetaObject@QAbstractSocket@@2UQMetaObject@@B @ 963 NONAME ; struct QMetaObject const QAbstractSocket::staticMetaObject + ?qt_qhostinfo_clear_cache@@YAXXZ @ 964 NONAME ; void qt_qhostinfo_clear_cache(void) + ?qt_qhostinfo_lookup@@YA?AVQHostInfo@@ABVQString@@PAVQObject@@PBDPA_NPAH@Z @ 965 NONAME ; class QHostInfo qt_qhostinfo_lookup(class QString const &, class QObject *, char const *, bool *, int *) diff --git a/src/s60installs/bwins/QtOpenVGu.def b/src/s60installs/bwins/QtOpenVGu.def index 26ee862..56614ed 100644 --- a/src/s60installs/bwins/QtOpenVGu.def +++ b/src/s60installs/bwins/QtOpenVGu.def @@ -164,4 +164,8 @@ EXPORTS ?qt_vg_create_context@@YAPAVQEglContext@@PAVQPaintDevice@@H@Z @ 163 NONAME ; class QEglContext * qt_vg_create_context(class QPaintDevice *, int) ?reclaimImages@QVGPixmapData@@UAEXXZ @ 164 NONAME ; void QVGPixmapData::reclaimImages(void) ?hibernate@QVGPixmapData@@UAEXXZ @ 165 NONAME ; void QVGPixmapData::hibernate(void) + ?supportsStaticContents@QVGEGLWindowSurfaceDirect@@UBE_NXZ @ 166 NONAME ; bool QVGEGLWindowSurfaceDirect::supportsStaticContents(void) const + ?scroll@QVGEGLWindowSurfacePrivate@@UAE_NPAVQWidget@@ABVQRegion@@HH@Z @ 167 NONAME ; bool QVGEGLWindowSurfacePrivate::scroll(class QWidget *, class QRegion const &, int, int) + ?scroll@QVGEGLWindowSurfaceDirect@@UAE_NPAVQWidget@@ABVQRegion@@HH@Z @ 168 NONAME ; bool QVGEGLWindowSurfaceDirect::scroll(class QWidget *, class QRegion const &, int, int) + ?supportsStaticContents@QVGEGLWindowSurfacePrivate@@UBE_NXZ @ 169 NONAME ; bool QVGEGLWindowSurfacePrivate::supportsStaticContents(void) const diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index a3fc452..ac70e70 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -1818,7 +1818,7 @@ EXPORTS _ZN12QLineControl17_q_deleteSelectedEv @ 1817 NONAME _ZN12QLineControl17processMouseEventEP11QMouseEvent @ 1818 NONAME _ZN12QLineControl17resetInputContextEv @ 1819 NONAME - _ZN12QLineControl17updateDisplayTextEv @ 1820 NONAME + _ZN12QLineControl17updateDisplayTextEv @ 1820 NONAME ABSENT _ZN12QLineControl18displayTextChangedERK7QString @ 1821 NONAME _ZN12QLineControl18removeSelectedTextEv @ 1822 NONAME _ZN12QLineControl19_q_clipboardChangedEv @ 1823 NONAME @@ -11806,4 +11806,16 @@ EXPORTS _ZN9QS60Style10timerEventEP11QTimerEvent @ 11805 NONAME _ZN9QS60Style11eventFilterEP7QObjectP6QEvent @ 11806 NONAME _ZN13QFontDatabase25removeAllApplicationFontsEv @ 11807 NONAME + _ZN11QEglContext13nativeDisplayEv @ 11808 NONAME ABSENT + _ZN11QEglContext14destroyContextEv @ 11809 NONAME ABSENT + _ZN11QEglContext3dpyE @ 11810 NONAME DATA 4 ABSENT + _ZN11QEglContext7displayEv @ 11811 NONAME ABSENT + _ZN11QFontEngine16getGlyphBearingsEjPfS0_ @ 11812 NONAME + _ZN12QLineControl17updateDisplayTextEb @ 11813 NONAME + _ZN14QWidgetPrivate11inTabWidgetEP7QWidget @ 11814 NONAME + _ZN14QWidgetPrivate17canKeypadNavigateEN2Qt11OrientationE @ 11815 NONAME + _ZN20QGraphicsItemPrivate14setFocusHelperEN2Qt11FocusReasonEbb @ 11816 NONAME + _ZN20QGraphicsItemPrivate16clearFocusHelperEb @ 11817 NONAME + _ZN24QImagePixmapCleanupHooks13isImageCachedERK6QImage @ 11818 NONAME + _ZN24QImagePixmapCleanupHooks14isPixmapCachedERK7QPixmap @ 11819 NONAME -- cgit v0.12 From 32aadef3a6621843fe065c3a5f2834a528a7d6fb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 15 Apr 2010 20:59:20 +0200 Subject: remove pointless manual assignments from token type enum making the range discontiguous just makes the switch() jump table bigger or not applicable at all. --- tools/linguist/lupdate/cpp.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 2d5620e..66a079a 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -280,14 +280,14 @@ private: enum { Tok_Eof, Tok_class, Tok_friend, Tok_namespace, Tok_using, Tok_return, - Tok_tr = 10, Tok_trUtf8, Tok_translate, Tok_translateUtf8, Tok_trid, - Tok_Q_OBJECT = 20, Tok_Q_DECLARE_TR_FUNCTIONS, + Tok_tr, Tok_trUtf8, Tok_translate, Tok_translateUtf8, Tok_trid, + Tok_Q_OBJECT, Tok_Q_DECLARE_TR_FUNCTIONS, Tok_Ident, Tok_Comment, Tok_String, Tok_Arrow, Tok_Colon, Tok_ColonColon, Tok_Equals, - Tok_LeftBrace = 30, Tok_RightBrace, Tok_LeftParen, Tok_RightParen, Tok_Comma, Tok_Semicolon, - Tok_Null = 40, Tok_Integer, - Tok_QuotedInclude = 50, Tok_AngledInclude, - Tok_Other = 99 + Tok_LeftBrace, Tok_RightBrace, Tok_LeftParen, Tok_RightParen, Tok_Comma, Tok_Semicolon, + Tok_Null, Tok_Integer, + Tok_QuotedInclude, Tok_AngledInclude, + Tok_Other }; // Tokenizer state -- cgit v0.12 From 2c0f13ccfe750241eb7ddedf6412da380a146975 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 15 Apr 2010 21:12:34 +0200 Subject: make HashString and HashStringList objects smaller qHash(QString) has only 28 bits, so we can use the upper bits for flagging whether the hash is valid. size effect: LP32: align(4, 4 + 4 + 1) = 12 vs. align(4, 4 + 4) = 8 LP64: align(8, 8 + 8 + 1) = 24 vs. align(8, 8 + 8) = 16 P64: align(8, 8 + 4 + 1) = 16 vs. align(8, 8 + 4) = 16 --- tools/linguist/lupdate/cpp.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 66a079a..3422212 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -65,47 +65,44 @@ static QString MagicComment(QLatin1String("TRANSLATOR")); class HashString { public: - HashString() : m_hashed(false) {} - explicit HashString(const QString &str) : m_str(str), m_hashed(false) {} - void setValue(const QString &str) { m_str = str; m_hashed = false; } + HashString() : m_hash(0x80000000) {} + explicit HashString(const QString &str) : m_str(str), m_hash(0x80000000) {} + void setValue(const QString &str) { m_str = str; m_hash = 0x80000000; } const QString &value() const { return m_str; } bool operator==(const HashString &other) const { return m_str == other.m_str; } private: QString m_str; + // qHash() of a QString is only 28 bits wide, so we can use + // the highest bit(s) as the "hash valid" flag. mutable uint m_hash; - mutable bool m_hashed; friend uint qHash(const HashString &str); }; uint qHash(const HashString &str) { - if (!str.m_hashed) { - str.m_hashed = true; + if (str.m_hash & 0x80000000) str.m_hash = qHash(str.m_str); - } return str.m_hash; } class HashStringList { public: - explicit HashStringList(const QList &list) : m_list(list), m_hashed(false) {} + explicit HashStringList(const QList &list) : m_list(list), m_hash(0x80000000) {} const QList &value() const { return m_list; } bool operator==(const HashStringList &other) const { return m_list == other.m_list; } private: QList m_list; mutable uint m_hash; - mutable bool m_hashed; friend uint qHash(const HashStringList &list); }; uint qHash(const HashStringList &list) { - if (!list.m_hashed) { - list.m_hashed = true; + if (list.m_hash & 0x80000000) { uint hash = 0; foreach (const HashString &qs, list.m_list) { - hash ^= qHash(qs) ^ 0xa09df22f; - hash = (hash << 13) | (hash >> 19); + hash ^= qHash(qs) ^ 0x0ad9f526; + hash = ((hash << 13) & 0x0fffffff) | (hash >> 15); } list.m_hash = hash; } -- cgit v0.12 From d758d652e1b3950f9df6aa4c1bdef67ba9b88b15 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 15 Apr 2010 21:48:28 +0200 Subject: make QT_TR_NOOP work in static initializers do that by ignoring all equal signs and everything between and including brackets. this makes static initializers look effectively like function definitions, thus creating proper context. Task-number: QTBUG-9276 --- .../lupdate/testdata/good/parsecpp/main.cpp | 23 ++++++++++ .../testdata/good/parsecpp/project.ts.result | 17 +++++++ tools/linguist/lupdate/cpp.cpp | 53 +++++++++++++++++++--- 3 files changed, 87 insertions(+), 6 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp index 6e73d6d..0765bfc 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp @@ -252,3 +252,26 @@ class YetAnotherTest : QObject { //: This is a message without a source string QString test = qtTrId("yet_another_id"); + + + +// QTBUG-9276: context in static initializers +class Bogus : QObject { + Q_OBJECT + + static const char * const s_strings[]; +}; + +const char * const Bogus::s_strings[] = { + QT_TR_NOOP("this should be in Bogus") +}; + +const char * const Bogus::s_strings[SIZE] = { + QT_TR_NOOP("this should be in Bogus") +}; + +void bogosity() +{ + // no spaces here. test collateral damage from ignoring equal sign + Class::member=QObject::tr("just QObject"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result index 6d50c21..208191d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -26,6 +26,15 @@ backslashed \ stuff. + Bogus + + + + this should be in Bogus + + + + Dialog2 @@ -184,6 +193,14 @@ backslashed \ stuff. + QObject + + + just QObject + + + + QTranslator diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 3422212..4791450 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -212,13 +212,15 @@ public: private: struct IfdefState { IfdefState() {} - IfdefState(int _braceDepth, int _parenDepth) : + IfdefState(int _bracketDepth, int _braceDepth, int _parenDepth) : + bracketDepth(_bracketDepth), braceDepth(_braceDepth), parenDepth(_parenDepth), elseLine(-1) {} SavedState state; + int bracketDepth, bracketDepth1st; int braceDepth, braceDepth1st; int parenDepth, parenDepth1st; int elseLine; @@ -280,7 +282,7 @@ private: Tok_tr, Tok_trUtf8, Tok_translate, Tok_translateUtf8, Tok_trid, Tok_Q_OBJECT, Tok_Q_DECLARE_TR_FUNCTIONS, Tok_Ident, Tok_Comment, Tok_String, Tok_Arrow, Tok_Colon, Tok_ColonColon, - Tok_Equals, + Tok_Equals, Tok_LeftBracket, Tok_RightBracket, Tok_LeftBrace, Tok_RightBrace, Tok_LeftParen, Tok_RightParen, Tok_Comma, Tok_Semicolon, Tok_Null, Tok_Integer, Tok_QuotedInclude, Tok_AngledInclude, @@ -296,10 +298,12 @@ private: QString yyWord; qlonglong yyInteger; QStack yyIfdefStack; + int yyBracketDepth; int yyBraceDepth; int yyParenDepth; int yyLineNo; int yyCurLineNo; + int yyBracketLineNo; int yyBraceLineNo; int yyParenLineNo; @@ -336,9 +340,11 @@ CppParser::CppParser(ParseResults *_results) results = new ParseResults; directInclude = false; } + yyBracketDepth = 0; yyBraceDepth = 0; yyParenDepth = 0; yyCurLineNo = 1; + yyBracketLineNo = 1; yyBraceLineNo = 1; yyParenLineNo = 1; yyAtNewline = true; @@ -565,7 +571,7 @@ uint CppParser::getToken() yyCh = getChar(); if (yyCh == 'f') { // if, ifdef, ifndef - yyIfdefStack.push(IfdefState(yyBraceDepth, yyParenDepth)); + yyIfdefStack.push(IfdefState(yyBracketDepth, yyBraceDepth, yyParenDepth)); yyCh = getChar(); } else if (yyCh == 'n') { // include @@ -604,16 +610,20 @@ uint CppParser::getToken() if (!yyIfdefStack.isEmpty()) { IfdefState &is = yyIfdefStack.top(); if (is.elseLine != -1) { - if (yyBraceDepth != is.braceDepth1st || yyParenDepth != is.parenDepth1st) - qWarning("%s:%d: Parenthesis/brace mismatch between " + if (yyBracketDepth != is.bracketDepth1st + || yyBraceDepth != is.braceDepth1st + || yyParenDepth != is.parenDepth1st) + qWarning("%s:%d: Parenthesis/bracket/brace mismatch between " "#if and #else branches; using #if branch\n", qPrintable(yyFileName), is.elseLine); } else { + is.bracketDepth1st = yyBracketDepth; is.braceDepth1st = yyBraceDepth; is.parenDepth1st = yyParenDepth; saveState(&is.state); } is.elseLine = yyLineNo; + yyBracketDepth = is.bracketDepth; yyBraceDepth = is.braceDepth; yyParenDepth = is.parenDepth; } @@ -623,10 +633,13 @@ uint CppParser::getToken() if (!yyIfdefStack.isEmpty()) { IfdefState is = yyIfdefStack.pop(); if (is.elseLine != -1) { - if (yyBraceDepth != is.braceDepth1st || yyParenDepth != is.parenDepth1st) + if (yyBracketDepth != is.bracketDepth1st + || yyBraceDepth != is.braceDepth1st + || yyParenDepth != is.parenDepth1st) qWarning("%s:%d: Parenthesis/brace mismatch between " "#if and #else branches; using #if branch\n", qPrintable(yyFileName), is.elseLine); + yyBracketDepth = is.bracketDepth1st; yyBraceDepth = is.braceDepth1st; yyParenDepth = is.parenDepth1st; loadState(&is.state); @@ -899,6 +912,21 @@ uint CppParser::getToken() yyParenDepth--; yyCh = getChar(); return Tok_RightParen; + case '[': + if (yyBracketDepth == 0) + yyBracketLineNo = yyCurLineNo; + yyBracketDepth++; + yyCh = getChar(); + return Tok_LeftBracket; + case ']': + if (yyBracketDepth == 0) + qWarning("%s:%d: Excess closing bracket in C++ code" + " (or abuse of the C++ preprocessor)\n", + qPrintable(yyFileName), yyCurLineNo); + else + yyBracketDepth--; + yyCh = getChar(); + return Tok_RightBracket; case ',': yyCh = getChar(); return Tok_Comma; @@ -1534,6 +1562,12 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) yyCh = getChar(); yyTok = getToken(); while (yyTok != Tok_Eof) { + // these are array indexing operations. we ignore them entirely + // so they don't confuse our scoping of static initializers. + // we enter the loop by either reading a left bracket or by an + // #else popping the state. + while (yyBracketDepth) + yyTok = getToken(); //qDebug() << "TOKEN: " << yyTok; switch (yyTok) { case Tok_QuotedInclude: { @@ -2074,6 +2108,9 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) default: if (!yyParenDepth) prospectiveContext.clear(); + // fallthrough + case Tok_Equals: // for static initializers; other cases make no difference + case Tok_RightBracket: // ignoring indexing; same reason case_default: yyTok = getToken(); break; @@ -2088,6 +2125,10 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) qWarning("%s:%d: Unbalanced opening parenthesis in C++ code" " (or abuse of the C++ preprocessor)\n", qPrintable(yyFileName), yyParenLineNo); + else if (yyBracketDepth != 0) + qWarning("%s:%d: Unbalanced opening bracket in C++ code" + " (or abuse of the C++ preprocessor)\n", + qPrintable(yyFileName), yyBracketLineNo); } const ParseResults *CppParser::recordResults(bool isHeader) -- cgit v0.12 From b7e6c2835ad7b5f5564290c1140c1db59869d54e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 15 Apr 2010 22:12:18 +0200 Subject: create magic comment messages in "finished" state there is really no point in marking them "unfinished". later file rewrites would reset the state anyway. --- .../lupdate/testdata/good/parsecontexts/project.ts.result | 2 +- tools/linguist/lupdate/cpp.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result index 2f21de2..53d7a25 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result @@ -98,7 +98,7 @@ This is a comment to the translator. - + diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 4791450..db4bbca 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -2035,9 +2035,14 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) } else { context = comment.left(k); comment.remove(0, k + 1); - recordMessage(yyLineNo, context, QString(), comment, extracomment, - QString(), TranslatorMessage::ExtraData(), false, false); + TranslatorMessage msg( + transcode(context, false), QString(), + transcode(comment, false), QString(), + yyFileName, yyLineNo, QStringList(), + TranslatorMessage::Finished, false); + msg.setExtraComment(transcode(extracomment.simplified(), false)); extracomment.clear(); + tor->append(msg); tor->setExtras(extra); extra.clear(); } -- cgit v0.12 From d397b62f9cb560e772fb0ba78b6a0af6c7232e33 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 16 Apr 2010 10:20:01 +1000 Subject: Doc Update QObject documentation to match the Qt's Property System documentation. --- doc/src/snippets/code/src_corelib_kernel_qobject.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp index 2d86f8c..77c67ab 100644 --- a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp +++ b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp @@ -374,10 +374,13 @@ Q_PROPERTY(type name READ getFunction [WRITE setFunction] [RESET resetFunction] + [NOTIFY notifySignal] [DESIGNABLE bool] [SCRIPTABLE bool] [STORED bool] - [USER bool]) + [USER bool] + [CONSTANT] + [FINAL]) //! [36] -- cgit v0.12