From c7458326e1772bf3162d95c0b512c3ad2de94201 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 5 Oct 2009 15:10:59 +1000 Subject: Make it possible to implement engine-specific drop shadow filters It wasn't possible for the paint engine to override the drop shadow filter because QPixmapDropShadowFilter::draw() was not asking for an engine-specific filter object. Also, change the OpenVG filter to use vgGaussianBlur() instead of vgConvolve(), and draw the original image on top of the shadow. Task-number: QTBUG-4583 Reviewed-by: trustme (cherry picked from commit 3909d97e86d62fd94e149925b5f3111c8f391334) --- src/gui/image/qpixmapfilter.cpp | 10 ++++++++++ src/openvg/qpixmapfilter_vg.cpp | 44 ++++++++++++++++------------------------- src/openvg/qpixmapfilter_vg_p.h | 3 --- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index 749b8f3..df445db 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -1074,6 +1074,16 @@ void QPixmapDropShadowFilter::draw(QPainter *p, const QRectF &src) const { Q_D(const QPixmapDropShadowFilter); + QPixmapFilter *filter = p->paintEngine() && p->paintEngine()->isExtended() ? + static_cast(p->paintEngine())->pixmapFilter(type(), this) : 0; + QPixmapDropShadowFilter *dropShadowFilter = static_cast(filter); + if (dropShadowFilter) { + dropShadowFilter->setColor(d->color); + dropShadowFilter->setBlurRadius(d->blurFilter->radius()); + dropShadowFilter->setOffset(d->offset); + dropShadowFilter->draw(p, pos, px, src); + return; + } QImage tmp = src.isNull() ? px.toImage() : px.copy(src.toRect()).toImage(); QPainter tmpPainter(&tmp); diff --git a/src/openvg/qpixmapfilter_vg.cpp b/src/openvg/qpixmapfilter_vg.cpp index ca4db38..613f4ea 100644 --- a/src/openvg/qpixmapfilter_vg.cpp +++ b/src/openvg/qpixmapfilter_vg.cpp @@ -220,8 +220,6 @@ void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const QVGPixmapDropShadowFilter::QVGPixmapDropShadowFilter() : QPixmapDropShadowFilter(), - prevRadius(0.0f), - kernelSize(0), firstTime(true) { } @@ -290,41 +288,30 @@ void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, con // Blacken the source image. vgColorMatrix(tmpImage, srcImage, matrix[0]); - // Recompute the convolution kernel if the blur radius has changed. - qreal radius = blurRadius(); - if (radius != prevRadius || firstTime) { - prevRadius = radius; - int dim = 2 * qRound(radius) + 1; - int size = dim * dim; - VGshort f = VGshort(1024.0f / size); - kernel.resize(size); - for (int i = 0; i < size; ++i) - kernel[i] = f; - kernelSize = dim; - } + // Clamp the radius range. We divide by 2 because the OpenVG blur + // is "too blurry" compared to the default raster implementation. + VGfloat maxRadius = VGfloat(vgGeti(VG_MAX_GAUSSIAN_STD_DEVIATION)); + VGfloat radiusF = VGfloat(blurRadius()) / 2.0f; + if (radiusF < 0.001f) + radiusF = 0.001f; + else if (radiusF > maxRadius) + radiusF = maxRadius; - // Apply the convolution filter using the kernel. - VGfloat values[4]; - values[0] = 0.0f; - values[1] = 0.0f; - values[2] = 0.0f; - values[3] = 0.0f; - vgSetfv(VG_TILE_FILL_COLOR, 4, values); - vgConvolve(dstImage, tmpImage, - kernelSize, kernelSize, 0, 0, - kernel.constData(), 1.0f / 1024.0f, 0.0f, - VG_TILE_FILL); + // Blur the blackened source image. + vgGaussianBlur(dstImage, tmpImage, radiusF, radiusF, VG_TILE_PAD); firstTime = false; VGImage child = VG_INVALID_HANDLE; + QRect srect; if (srcRect.isNull() || (srcRect.topLeft().isNull() && srcRect.size() == size)) { child = dstImage; + srect = QRect(0, 0, size.width(), size.height()); } else { - QRect src = srcRect.toRect(); - child = vgChildImage(dstImage, src.x(), src.y(), src.width(), src.height()); + srect = srcRect.toRect(); + child = vgChildImage(dstImage, srect.x(), srect.y(), srect.width(), srect.height()); } qt_vg_drawVGImage(painter, dest + offset(), child); @@ -333,6 +320,9 @@ void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, con vgDestroyImage(child); vgDestroyImage(tmpImage); vgDestroyImage(dstImage); + + // Now draw the actual pixmap over the top. + painter->drawPixmap(dest, src, srect); } QVGPixmapBlurFilter::QVGPixmapBlurFilter(QObject *parent) diff --git a/src/openvg/qpixmapfilter_vg_p.h b/src/openvg/qpixmapfilter_vg_p.h index 8bd4f7e..58111ec 100644 --- a/src/openvg/qpixmapfilter_vg_p.h +++ b/src/openvg/qpixmapfilter_vg_p.h @@ -98,10 +98,7 @@ public: private: mutable VGfloat matrix[5][4]; mutable QColor prevColor; - mutable qreal prevRadius; - mutable int kernelSize; mutable bool firstTime; - mutable QVarLengthArray kernel; }; class Q_OPENVG_EXPORT QVGPixmapBlurFilter : public QPixmapBlurFilter -- cgit v0.12 From 251459d24af17d173937820e8f20ef30ed448f6f Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 5 Oct 2009 10:33:59 +0300 Subject: Fixed sharedmemory autotest build for RVCT. Without this fix we got the following error: "line 776: Error: #254: type name is not allowed" Reviewed-by: TrustMe (cherry picked from commit c488298d4c15fb39ef960bda19f28c9ea9b9054b) --- tests/auto/qsharedmemory/tst_qsharedmemory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp index c4ff76c..db86c06 100644 --- a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp +++ b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp @@ -773,7 +773,7 @@ void tst_QSharedMemory::simpleProcessProducerConsumer() delete consumers.takeFirst(); } QCOMPARE(consumerFailed, false); - QCOMPARE(failedProcesses, unsigned int (0)); + QCOMPARE(failedProcesses, (unsigned int)(0)); } QTEST_MAIN(tst_QSharedMemory) -- cgit v0.12 From 5850ba16e9905677af58461bb5efc7fcb43a976a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 5 Oct 2009 09:49:53 +0200 Subject: Compile on Visual Studio 2003 Don't add export declaration for the definition of the variable. Reviewed-by: Gunnar (cherry picked from commit 1aaa11708eb0f8281e6de2c4ea6f04e5d38813e0) --- src/corelib/kernel/qmath.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qmath.cpp b/src/corelib/kernel/qmath.cpp index 24bec4a..7c1e726 100644 --- a/src/corelib/kernel/qmath.cpp +++ b/src/corelib/kernel/qmath.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE -Q_CORE_EXPORT const qreal qt_sine_table[QT_SINE_TABLE_SIZE] = { +const qreal qt_sine_table[QT_SINE_TABLE_SIZE] = { 0.0, 0.024541228522912288, 0.049067674327418015, -- cgit v0.12 From a4245ded41a1710d1f6b140fde66af0b5121250d Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 5 Oct 2009 10:53:57 +0300 Subject: Fixed tst_qgraphicsitem.cpp compilation for Nokia X86 compiler. Nokia X86 compiler is not able to resolve correct templated qCompare functionfor derived types. So implicit casting does nto work corectly. I have tried to add template specilations for qCompare also, but then compiler complainf about unambiguous functions. The promlem for now is fixed by adding explicit cast to same type against which the comparuion is done. Reviewed-by: TrustMe (cherry picked from commit 7655e27047790d89f9af0132946ad5db5138e7bf) --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 9545198..e2e8c5f 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -7631,7 +7631,7 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem() QVERIFY(items.isEmpty()); items = scene.items(QPointF(80, 80)); QCOMPARE(items.size(), 1); - QCOMPARE(items.at(0), static_cast(item3)); + QCOMPARE(items.at(0), static_cast(item3)); item1->repaints = 0; item2->repaints = 0; @@ -7654,7 +7654,7 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem() QVERIFY(items.isEmpty()); items = scene.items(QPointF(80, 80)); QCOMPARE(items.size(), 1); - QCOMPARE(items.at(0), static_cast(item3)); + QCOMPARE(items.at(0), static_cast(item3)); } void tst_QGraphicsItem::focusProxy() @@ -8384,7 +8384,7 @@ void tst_QGraphicsItem::ensureDirtySceneTransform() QGraphicsView view(&scene); view.show(); QTest::qWaitForWindowShown(&view); - QTRY_COMPARE(QApplication::activeWindow(), &view); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(&view)); //We move the parent parent->move(); -- cgit v0.12 From b65da11b64615d558b007d4ebc821c435af24b0f Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 5 Oct 2009 10:01:44 +0200 Subject: Disable etched text on rich text labels When rendering etched text on disabled rich text labels we would previously draw distorted links. This is basically because anything that did not render with the text foreground role would be drawn twice as a shadow. Since there is no way to properly render this text etched we will rather disable it completely when the label uses rich text. Task-number: QTBUG-4543 Reviewed-by: Simon Hausmann (cherry picked from commit d1d661a1858e28befe5980c22009702f5ea82829) --- src/gui/widgets/qlabel.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp index 5ba0571..3d908a1 100644 --- a/src/gui/widgets/qlabel.cpp +++ b/src/gui/widgets/qlabel.cpp @@ -1000,8 +1000,10 @@ void QLabel::paintEvent(QPaintEvent *) d->ensureTextLayouted(); QAbstractTextDocumentLayout::PaintContext context; - - if (!isEnabled() && style->styleHint(QStyle::SH_EtchDisabledText, &opt, this)) { + if (!isEnabled() && !d->control && + // We cannot support etched for rich text controls because custom + // colors and links will override the light palette + style->styleHint(QStyle::SH_EtchDisabledText, &opt, this)) { context.palette = opt.palette; context.palette.setColor(QPalette::Text, context.palette.light().color()); painter.save(); -- cgit v0.12 From a1a1e5f064647dd012790126fd3281d59ca05d18 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Mon, 5 Oct 2009 10:20:38 +0200 Subject: Make QEventTransition works with QGraphicsObject. QStateMachine framework installs QObject event filters to catch events in order to triggers the proper transition. But installing a QObject event filter on a QGraphicsObject gives nothing because QGraphicsView events filters works differently. In order to make this works we now post events using QApplication::postEvent in addition to the QGraphicsView events. Reviewed-by:andreas (cherry picked from commit 10dba674d366260589f3b742e5b1b87ce9ddd47c) --- src/corelib/kernel/qcoreevent.h | 1 - src/gui/graphicsview/qgraphicsscene.cpp | 12 +++++++++++- src/gui/graphicsview/qgraphicswidget.cpp | 6 ------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index a039d32..d66cead 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -324,7 +324,6 @@ private: friend class QGraphicsView; friend class QGraphicsViewPrivate; friend class QGraphicsScenePrivate; - friend class QGraphicsWidget; }; class Q_CORE_EXPORT QTimerEvent : public QEvent diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 1226722..961f44f 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -254,6 +254,8 @@ QT_BEGIN_NAMESPACE +bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); + static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraphicsSceneMouseEvent *mouseEvent) { hover->setWidget(mouseEvent->widget()); @@ -1051,7 +1053,15 @@ bool QGraphicsScenePrivate::sendEvent(QGraphicsItem *item, QEvent *event) return false; if (filterDescendantEvent(item, event)) return false; - return (item && item->isEnabled() ? item->sceneEvent(event) : false); + if (!item || !item->isEnabled()) + return false; + if (QGraphicsObject *o = item->toGraphicsObject()) { + bool spont = event->spontaneous(); + if (spont ? qt_sendSpontaneousEvent(o, event) : QApplication::sendEvent(o, event)) + return true; + event->spont = spont; + } + return item->sceneEvent(event); } /*! diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 224f50b..7764157 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -168,8 +168,6 @@ QT_BEGIN_NAMESPACE \sa QGraphicsProxyWidget, QGraphicsItem, {Widgets and Layouts} */ -bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); - /*! Constructs a QGraphicsWidget instance. The optional \a parent argument is passed to QGraphicsItem's constructor. The optional \a wFlags argument @@ -1103,10 +1101,6 @@ QVariant QGraphicsWidget::propertyChange(const QString &propertyName, const QVar */ bool QGraphicsWidget::sceneEvent(QEvent *event) { - bool spont = event->spontaneous(); - if (spont ? qt_sendSpontaneousEvent(this, event) : QApplication::sendEvent(this, event)) - return true; - event->spont = spont; return QGraphicsItem::sceneEvent(event); } -- cgit v0.12 From 628946bb0912bd91f6936e87387792e068b19950 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 5 Oct 2009 11:12:59 +0200 Subject: Tooltip: reusing tooltips sometimes goes wrong We reuse tooltip whenever we can. But we forget to check if the format of the text changes inbetween (from html to plain). This causes the word wrap to fail sometimes. This change will fix that. Rev-By:MortenS (cherry picked from commit 80e47c92e0b4f506b2b57d0e58022903dc62ba3d) --- src/gui/kernel/qtooltip.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qtooltip.cpp b/src/gui/kernel/qtooltip.cpp index 2d0d209..4261808 100644 --- a/src/gui/kernel/qtooltip.cpp +++ b/src/gui/kernel/qtooltip.cpp @@ -183,7 +183,6 @@ QTipLabel::QTipLabel(const QString &text, QWidget *w) setFrameStyle(QFrame::NoFrame); setAlignment(Qt::AlignLeft); setIndent(1); - setWordWrap(Qt::mightBeRichText(text)); qApp->installEventFilter(this); setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0); setMouseTracking(true); @@ -208,6 +207,7 @@ void QTipLabel::reuseTip(const QString &text) } #endif + setWordWrap(Qt::mightBeRichText(text)); setText(text); QFontMetrics fm(font()); QSize extra(1, 0); -- cgit v0.12 From 314998dec983607a8af47ab247f2af40d81bb0db Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Mon, 5 Oct 2009 11:32:49 +0200 Subject: Doc fix. Reviewed-by:TrustMe (cherry picked from commit 144273fe9e2280f52f1dba0b5781a54f8b459d1e) --- src/gui/graphicsview/qsimplex_p.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/gui/graphicsview/qsimplex_p.cpp b/src/gui/graphicsview/qsimplex_p.cpp index 1ece8b1..00fc204 100644 --- a/src/gui/graphicsview/qsimplex_p.cpp +++ b/src/gui/graphicsview/qsimplex_p.cpp @@ -75,15 +75,24 @@ QT_BEGIN_NAMESPACE 3.c) Run simplex to optimize the original problem towards its optimal solution. */ +/*! + \internal +*/ QSimplex::QSimplex() : objective(0), rows(0), columns(0), firstArtificial(0), matrix(0) { } +/*! + \internal +*/ QSimplex::~QSimplex() { clearDataStructures(); } +/*! + \internal +*/ void QSimplex::clearDataStructures() { if (matrix == 0) @@ -312,11 +321,17 @@ void QSimplex::solveMaxHelper() while (iterate()) ; } +/*! + \internal +*/ void QSimplex::setObjective(QSimplexConstraint *newObjective) { objective = newObjective; } +/*! + \internal +*/ void QSimplex::clearRow(int rowIndex) { qreal *item = matrix + rowIndex * columns; @@ -324,6 +339,9 @@ void QSimplex::clearRow(int rowIndex) item[i] = 0.0; } +/*! + \internal +*/ void QSimplex::clearColumns(int first, int last) { for (int i = 0; i < rows; ++i) { @@ -333,6 +351,9 @@ void QSimplex::clearColumns(int first, int last) } } +/*! + \internal +*/ void QSimplex::dumpMatrix() { qDebug("---- Simplex Matrix ----\n"); @@ -352,6 +373,9 @@ void QSimplex::dumpMatrix() qDebug("------------------------\n"); } +/*! + \internal +*/ void QSimplex::combineRows(int toIndex, int fromIndex, qreal factor) { if (!factor) @@ -375,6 +399,9 @@ void QSimplex::combineRows(int toIndex, int fromIndex, qreal factor) } } +/*! + \internal +*/ int QSimplex::findPivotColumn() { qreal min = 0; @@ -429,6 +456,9 @@ int QSimplex::pivotRowForColumn(int column) return minIndex; } +/*! + \internal +*/ void QSimplex::reducedRowEchelon() { for (int i = 1; i < rows; ++i) { -- cgit v0.12 From 93f741bfe867b4644f4bb7d5bfc768273ed6f035 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 5 Oct 2009 11:32:10 +0200 Subject: fix creation of qws directory when app start preceeds qvfb Change authored by Rhys. Bug introduced by the change to allow user-specific cache and pipe directories. Reviewed-by: Jeremy (cherry picked from commit af1d916b86295543b8e20be79abf48453d9c55d0) --- src/gui/embedded/qvfbhdr.h | 2 +- src/gui/kernel/qapplication_qws.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/embedded/qvfbhdr.h b/src/gui/embedded/qvfbhdr.h index eff5fc2..73b13d3 100644 --- a/src/gui/embedded/qvfbhdr.h +++ b/src/gui/embedded/qvfbhdr.h @@ -70,7 +70,7 @@ QT_MODULE(Gui) .append("/qt_soundserver") #define QTE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ .append("/QtEmbedded") -#define QTE_PIPE_QVFB QTE_PIPE +#define QTE_PIPE_QVFB(DISPLAY) QTE_PIPE(DISPLAY) #else #define QT_VFB_DATADIR(DISPLAY) QString("%1/qtembedded-%2") \ .arg(QT_QWS_TEMP_DIR).arg(DISPLAY) diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index 634f23a..167beb2 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -232,6 +232,7 @@ QString qws_dataDir() // Get the filename of the pipe Qt for Embedded Linux uses for server/client comms Q_GUI_EXPORT QString qws_qtePipeFilename() { + qws_dataDir(); return QTE_PIPE(qws_display_id); } -- cgit v0.12 From a30f64e613aa5899b3c80206a2f0d55f3116357e Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Mon, 5 Oct 2009 11:02:24 +0200 Subject: Added autotest for qFastSin() and qFastCos(). Reviewed-by: Trond (cherry picked from commit a3e74ba189475d606f2a7a07f52591fd312a45c9) --- tests/auto/auto.pro | 1 + tests/auto/qmath/qmath.pro | 6 ++++ tests/auto/qmath/tst_qmath.cpp | 67 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 tests/auto/qmath/qmath.pro create mode 100644 tests/auto/qmath/tst_qmath.cpp diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 9321e19..f3ecdae 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -203,6 +203,7 @@ SUBDIRS += \ qmainwindow \ qmake \ qmap \ + qmath \ qmatrixnxn \ qmdiarea \ qmdisubwindow \ diff --git a/tests/auto/qmath/qmath.pro b/tests/auto/qmath/qmath.pro new file mode 100644 index 0000000..03134ee --- /dev/null +++ b/tests/auto/qmath/qmath.pro @@ -0,0 +1,6 @@ +load(qttest_p4) + +QT = core + +SOURCES += tst_qmath.cpp +QT = core diff --git a/tests/auto/qmath/tst_qmath.cpp b/tests/auto/qmath/tst_qmath.cpp new file mode 100644 index 0000000..efc7cfa --- /dev/null +++ b/tests/auto/qmath/tst_qmath.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +static const qreal PI = 3.14159265358979323846264338327950288; + +class tst_QMath : public QObject +{ + Q_OBJECT +private slots: + void fastSinCos(); +}; + +void tst_QMath::fastSinCos() +{ + // Test evenly spaced angles from 0 to 2pi radians. + const int LOOP_COUNT = 100000; + for (int i = 0; i < LOOP_COUNT; ++i) { + qreal angle = i * 2 * PI / (LOOP_COUNT - 1); + QVERIFY(qAbs(qSin(angle) - qFastSin(angle)) < 1e-5); + QVERIFY(qAbs(qCos(angle) - qFastCos(angle)) < 1e-5); + } +} + +QTEST_APPLESS_MAIN(tst_QMath) + +#include "tst_qmath.moc" -- cgit v0.12 From f17dc09850525392bb373f5eeb432db32b618adb Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 5 Oct 2009 12:36:32 +0300 Subject: Changed Qt package name in pkg and generated sis files for Symbian. It was decided on weekly telco that Symbian pkg and sis files can use plain Qt name, since it is already clear that user is installing "Qt for Symbian" version of Qt. Task-number: QT-772 Reviewed-by: Miikka Heikkinen (cherry picked from commit a3ef6e080980e242dd7703c48a628ad821549991) --- mkspecs/features/symbian/qt.prf | 8 ++++---- src/s60installs/s60installs.pro | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mkspecs/features/symbian/qt.prf b/mkspecs/features/symbian/qt.prf index 3b24355..0f5b08b 100644 --- a/mkspecs/features/symbian/qt.prf +++ b/mkspecs/features/symbian/qt.prf @@ -21,13 +21,13 @@ load(qt) # INCLUDEPATH = $$PREPEND_INCLUDEPATH $$INCLUDEPATH -# Add dependency to QtLibs package to all other projects besides QtLibs. -# Note: QtLibs with full capabilities has UID3 of 0x2001E61C, -# while self-signed version typically has temporary UID3 of 0xE001E61C. +# Add dependency to Qt package to all other projects besides Qt libs. +# Note: Qt libs with full capabilities has UID3 of 0x2001E61C, +# while self-signed version typically has temporary UID3 of 0xE001E61C. contains(CONFIG, qt):!contains(TARGET.UID3, 0x2001E61C):!contains(TARGET.UID3, 0xE001E61C) { default_deployment.pkg_prerules += \ "; Default dependency to Qt libraries" \ - "(0x2001E61C), $${QT_MAJOR_VERSION}, $${QT_MINOR_VERSION}, $${QT_PATCH_VERSION}, {\"QtLibs pre-release\"}" + "(0x2001E61C), $${QT_MAJOR_VERSION}, $${QT_MINOR_VERSION}, $${QT_PATCH_VERSION}, {\"Qt\"}" } isEmpty(TARGET.EPOCSTACKSIZE):TARGET.EPOCSTACKSIZE = 0x14000 diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index d21c524..3aef05e 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -7,7 +7,7 @@ symbian: { SUBDIRS= # WARNING: Changing TARGET name will break Symbian SISX upgrade functionality # DO NOT TOUCH TARGET VARIABLE IF YOU ARE NOT SURE WHAT YOU ARE DOING - TARGET = "Qt for S60" + TARGET = "Qt" TARGET.UID3 = 0x2001E61C VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} @@ -29,12 +29,12 @@ symbian: { "ELSEIF package(0x102752AE)" \ " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_2.dll\" - \"!:\\sys\\bin\\qts60plugin_3_2.dll\"" \ "ELSEIF package(0x102032BE)" \ - " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_1.dll\" - \"!:\\sys\\bin\\qts60plugin_3_1.dll\"" \ - "ELSE" \ + " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_1.dll\" - \"!:\\sys\\bin\\qts60plugin_3_1.dll\"" \ + "ELSE" \ " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"!:\\sys\\bin\\qts60plugin_5_0.dll\"" \ - "ENDIF" - qtlibraries.pkg_postrules += qts60plugindeployment - + "ENDIF" + qtlibraries.pkg_postrules += qts60plugindeployment + sqlitedeployment = \ "; EXISTS statement does not resolve !. Lets check the most common drives" \ "IF NOT EXISTS(\"c:\\sys\\bin\\sqlite3.dll\") AND NOT EXISTS(\"e:\\sys\\bin\\sqlite3.dll\") AND NOT EXISTS(\"z:\\sys\\bin\\sqlite3.dll\")" \ -- cgit v0.12 From e9a205a61f1c4a352e8a46d749b0a7984527e380 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 1 Oct 2009 11:29:34 +0200 Subject: Autotest: Don't run 15 and 35 threads on Windows CE. The device can't cope, so let's keep only the small thread count tests there. Reviewed-by: Trust Me (cherry picked from commit c5352705d933e76df6d40f01a5e6803bc4106b93) --- tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index fa63c4b..94c3aaa 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -1448,10 +1448,11 @@ void tst_QSharedPointer::threadStressTest_data() QTest::newRow("1+1") << 1 << 1; QTest::newRow("2+10") << 2 << 10; +#ifndef Q_OS_WINCE + // Windows CE cannot run this many threads QTest::newRow("5+10") << 5 << 10; QTest::newRow("5+30") << 5 << 30; -#ifndef Q_OS_WINCE QTest::newRow("100+100") << 100 << 100; #endif } -- cgit v0.12 From 6608061ac0235814ab9522fea84b1cf5366799c3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 1 Oct 2009 11:36:19 +0200 Subject: Autotest: disable the forwardDeclared1 test in WinSCW too. It also invokes the destructor directly, even on forward-declared types. That must be an ABI convention. This test isn't reliable. Reviewed-by: TrustMe (cherry picked from commit 1d01065f3c88701eeed8018c2125b0170d057b52) --- tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index 94c3aaa..58eaacb 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -308,7 +308,7 @@ extern int forwardDeclaredDestructorRunCount; void tst_QSharedPointer::forwardDeclaration1() { -#if defined(Q_CC_SUN) +#if defined(Q_CC_SUN) || defined(Q_CC_WINSCW) || defined(Q_CC_RVCT) QSKIP("This type of forward declaration is not valid with this compiler", SkipAll); #else externalForwardDeclaration(); -- cgit v0.12 From 377160bbe4a61b9b358120006c8a7b152618ae1c Mon Sep 17 00:00:00 2001 From: "Andre Moreira Magalhaes (andrunko)" Date: Wed, 30 Sep 2009 16:20:17 -0300 Subject: Added operator== for QDBusArgument. Reviewed-By: Thiago Macieira Merge-Request: 1657 (cherry picked from commit 429c7c6760c100685e9800b89fca7f0afd2d8abc) --- src/dbus/qdbusextratypes.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dbus/qdbusextratypes.h b/src/dbus/qdbusextratypes.h index c95537b..69dcc8a 100644 --- a/src/dbus/qdbusextratypes.h +++ b/src/dbus/qdbusextratypes.h @@ -174,6 +174,9 @@ inline QDBusVariant::QDBusVariant(const QVariant &dBusVariant) inline void QDBusVariant::setVariant(const QVariant &dBusVariant) { QVariant::operator=(dBusVariant); } +inline bool operator==(const QDBusVariant &v1, const QDBusVariant &v2) +{ return v1.variant() == v2.variant(); } + QT_END_NAMESPACE Q_DECLARE_METATYPE(QDBusVariant) -- cgit v0.12 From 136461523e1ff6f0266bec22b29f1cad3dc3d310 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 5 Oct 2009 11:49:54 +0200 Subject: Simplification and use of QGraphicsObject in sub-attas demo Reviewed-by: alexis (cherry picked from commit 32a9237c49fd126bee0cbe02c3c5bff5145a6e21) --- demos/sub-attaq/animationmanager.cpp | 6 +- demos/sub-attaq/boat.cpp | 92 ++++--------- demos/sub-attaq/boat.h | 12 +- demos/sub-attaq/boat_p.h | 50 ++----- demos/sub-attaq/bomb.cpp | 16 +-- demos/sub-attaq/bomb.h | 16 +-- demos/sub-attaq/custompropertyanimation.cpp | 108 --------------- demos/sub-attaq/custompropertyanimation.h | 114 ---------------- demos/sub-attaq/graphicsscene.cpp | 196 +++++++--------------------- demos/sub-attaq/graphicsscene.h | 13 +- demos/sub-attaq/mainwindow.cpp | 31 ++--- demos/sub-attaq/mainwindow.h | 1 - demos/sub-attaq/pixmapitem.cpp | 33 +++-- demos/sub-attaq/pixmapitem.h | 14 +- demos/sub-attaq/states.cpp | 39 ++---- demos/sub-attaq/states.h | 2 - demos/sub-attaq/sub-attaq.pro | 2 - demos/sub-attaq/submarine.cpp | 62 ++------- demos/sub-attaq/submarine.h | 11 +- demos/sub-attaq/submarine_p.h | 1 - demos/sub-attaq/torpedo.cpp | 20 +-- demos/sub-attaq/torpedo.h | 16 +-- 22 files changed, 181 insertions(+), 674 deletions(-) delete mode 100644 demos/sub-attaq/custompropertyanimation.cpp delete mode 100644 demos/sub-attaq/custompropertyanimation.h diff --git a/demos/sub-attaq/animationmanager.cpp b/demos/sub-attaq/animationmanager.cpp index 916dd21..eb5a125 100644 --- a/demos/sub-attaq/animationmanager.cpp +++ b/demos/sub-attaq/animationmanager.cpp @@ -77,16 +77,14 @@ void AnimationManager::unregisterAllAnimations() void AnimationManager::pauseAll() { - foreach (QAbstractAnimation* animation, animations) - { + foreach (QAbstractAnimation* animation, animations) { if (animation->state() == QAbstractAnimation::Running) animation->pause(); } } void AnimationManager::resumeAll() { - foreach (QAbstractAnimation* animation, animations) - { + foreach (QAbstractAnimation* animation, animations) { if (animation->state() == QAbstractAnimation::Paused) animation->resume(); } diff --git a/demos/sub-attaq/boat.cpp b/demos/sub-attaq/boat.cpp index 864a099..3b1bac7 100644 --- a/demos/sub-attaq/boat.cpp +++ b/demos/sub-attaq/boat.cpp @@ -46,7 +46,6 @@ #include "pixmapitem.h" #include "graphicsscene.h" #include "animationmanager.h" -#include "custompropertyanimation.h" #include "qanimationstate.h" //Qt @@ -60,79 +59,35 @@ static QAbstractAnimation *setupDestroyAnimation(Boat *boat) { QSequentialAnimationGroup *group = new QSequentialAnimationGroup(boat); -#if QT_VERSION >=0x040500 - PixmapItem *step1 = new PixmapItem(QString("explosion/boat/step1"),GraphicsScene::Big, boat); - step1->setZValue(6); - PixmapItem *step2 = new PixmapItem(QString("explosion/boat/step2"),GraphicsScene::Big, boat); - step2->setZValue(6); - PixmapItem *step3 = new PixmapItem(QString("explosion/boat/step3"),GraphicsScene::Big, boat); - step3->setZValue(6); - PixmapItem *step4 = new PixmapItem(QString("explosion/boat/step4"),GraphicsScene::Big, boat); - step4->setZValue(6); - step1->setOpacity(0); - step2->setOpacity(0); - step3->setOpacity(0); - step4->setOpacity(0); - CustomPropertyAnimation *anim1 = new CustomPropertyAnimation(boat); - anim1->setMemberFunctions((QGraphicsItem*)step1, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity); - anim1->setDuration(100); - anim1->setEndValue(1); - CustomPropertyAnimation *anim2 = new CustomPropertyAnimation(boat); - anim2->setMemberFunctions((QGraphicsItem*)step2, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity); - anim2->setDuration(100); - anim2->setEndValue(1); - CustomPropertyAnimation *anim3 = new CustomPropertyAnimation(boat); - anim3->setMemberFunctions((QGraphicsItem*)step3, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity); - anim3->setDuration(100); - anim3->setEndValue(1); - CustomPropertyAnimation *anim4 = new CustomPropertyAnimation(boat); - anim4->setMemberFunctions((QGraphicsItem*)step4, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity); - anim4->setDuration(100); - anim4->setEndValue(1); - CustomPropertyAnimation *anim5 = new CustomPropertyAnimation(boat); - anim5->setMemberFunctions((QGraphicsItem*)step1, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity); - anim5->setDuration(100); - anim5->setEndValue(0); - CustomPropertyAnimation *anim6 = new CustomPropertyAnimation(boat); - anim6->setMemberFunctions((QGraphicsItem*)step2, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity); - anim6->setDuration(100); - anim6->setEndValue(0); - CustomPropertyAnimation *anim7 = new CustomPropertyAnimation(boat); - anim7->setMemberFunctions((QGraphicsItem*)step3, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity); - anim7->setDuration(100); - anim7->setEndValue(0); - CustomPropertyAnimation *anim8 = new CustomPropertyAnimation(boat); - anim8->setMemberFunctions((QGraphicsItem*)step4, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity); - anim8->setDuration(100); - anim8->setEndValue(0); - group->addAnimation(anim1); - group->addAnimation(anim2); - group->addAnimation(anim3); - group->addAnimation(anim4); - group->addAnimation(anim5); - group->addAnimation(anim6); - group->addAnimation(anim7); - group->addAnimation(anim8); -#else - // work around for a bug where we don't transition if the duration is zero. - QtPauseAnimation *anim = new QtPauseAnimation(group); - anim->setDuration(1); - group->addAnimation(anim); -#endif + for (int i = 1; i <= 4; i++) { + PixmapItem *step = new PixmapItem(QString("explosion/boat/step%1").arg(i),GraphicsScene::Big, boat); + step->setZValue(6); + step->setOpacity(0); + + //fade-in + QPropertyAnimation *anim = new QPropertyAnimation(step, "opacity"); + anim->setEndValue(1); + anim->setDuration(100); + group->insertAnimationAt(i-1, anim); + + //and then fade-out + QPropertyAnimation *anim2 = new QPropertyAnimation(step, "opacity"); + anim2->setEndValue(0); + anim2->setDuration(100); + group->addAnimation(anim2); + } + AnimationManager::self()->registerAnimation(group); return group; } -Boat::Boat(QGraphicsItem * parent, Qt::WindowFlags wFlags) - : QGraphicsWidget(parent,wFlags), speed(0), bombsAlreadyLaunched(0), direction(Boat::None), movementAnimation(0) +Boat::Boat() : PixmapItem(QString("boat"), GraphicsScene::Big), + speed(0), bombsAlreadyLaunched(0), direction(Boat::None), movementAnimation(0) { - pixmapItem = new PixmapItem(QString("boat"),GraphicsScene::Big, this); setZValue(4); - setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsFocusable); - resize(pixmapItem->boundingRect().size()); + setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsFocusable); //The movement animation used to animate the boat movementAnimation = new QPropertyAnimation(this, "pos"); @@ -223,13 +178,13 @@ Boat::Boat(QGraphicsItem * parent, Qt::WindowFlags wFlags) destroyedState->setAnimation(destroyAnimation); //Play a nice animation when the boat is destroyed - moving->addTransition(this, SIGNAL(boatDestroyed()),destroyedState); + moving->addTransition(this, SIGNAL(boatDestroyed()), destroyedState); //Transition to final state when the destroyed animation is finished destroyedState->addTransition(destroyedState, SIGNAL(animationFinished()), final); //The machine has finished to be executed, then the boat is dead - connect(machine,SIGNAL(finished()),this, SIGNAL(boatExecutionFinished())); + connect(machine,SIGNAL(finished()), this, SIGNAL(boatExecutionFinished())); } @@ -255,7 +210,6 @@ void Boat::updateBoatMovement() } movementAnimation->stop(); - movementAnimation->setStartValue(pos()); if (direction == Boat::Left) { movementAnimation->setEndValue(QPointF(0,y())); diff --git a/demos/sub-attaq/boat.h b/demos/sub-attaq/boat.h index 0fe8ce4..0b4de1e 100644 --- a/demos/sub-attaq/boat.h +++ b/demos/sub-attaq/boat.h @@ -42,13 +42,8 @@ #ifndef __BOAT__H__ #define __BOAT__H__ -//Qt -#include -#include +#include "pixmapitem.h" -#include - -class PixmapItem; class Bomb; QT_BEGIN_NAMESPACE class QVariantAnimation; @@ -56,7 +51,7 @@ class QAbstractAnimation; class QStateMachine; QT_END_NAMESPACE -class Boat : public QGraphicsWidget +class Boat : public PixmapItem { Q_OBJECT public: @@ -66,7 +61,7 @@ public: Right }; enum { Type = UserType + 2 }; - Boat(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); + Boat(); void destroy(); void run(); void stop(); @@ -95,7 +90,6 @@ private: QVariantAnimation *movementAnimation; QAbstractAnimation *destroyAnimation; QStateMachine *machine; - PixmapItem *pixmapItem; }; #endif //__BOAT__H__ diff --git a/demos/sub-attaq/boat_p.h b/demos/sub-attaq/boat_p.h index 692702b..6eb52b6 100644 --- a/demos/sub-attaq/boat_p.h +++ b/demos/sub-attaq/boat_p.h @@ -67,22 +67,16 @@ static const int MAX_BOMB = 5; class KeyStopTransition : public QKeyEventTransition { public: - KeyStopTransition(Boat *boat, QEvent::Type type, int key) - : QKeyEventTransition(boat, type, key) + KeyStopTransition(Boat *b, QEvent::Type t, int k) + : QKeyEventTransition(b, t, k), boat(b), key(k) { - this->boat = boat; - this->key = key; } protected: virtual bool eventTest(QEvent *event) { - Q_UNUSED(event); if (!QKeyEventTransition::eventTest(event)) return false; - if (boat->currentSpeed() == 1) - return true; - else - return false; + return (boat->currentSpeed() == 1); } private: Boat * boat; @@ -93,23 +87,16 @@ private: class KeyMoveTransition : public QKeyEventTransition { public: - KeyMoveTransition(Boat *boat, QEvent::Type type, int key) - : QKeyEventTransition(boat, type, key) + KeyMoveTransition(Boat *b, QEvent::Type t, int k) + : QKeyEventTransition(b, t, k), boat(b), key(k) { - this->boat = boat; - this->key = key; } protected: virtual bool eventTest(QEvent *event) { - Q_UNUSED(event); if (!QKeyEventTransition::eventTest(event)) return false; - if (boat->currentSpeed() >= 0) - return true; - else - return false; - + return (boat->currentSpeed() >= 0); } void onTransition(QEvent *) { @@ -132,22 +119,16 @@ private: { public: KeyLaunchTransition(Boat *boat, QEvent::Type type, int key) - : QKeyEventTransition(boat, type, key) + : QKeyEventTransition(boat, type, key), boat(boat), key(key) { - this->boat = boat; - this->key = key; } protected: virtual bool eventTest(QEvent *event) { - Q_UNUSED(event); if (!QKeyEventTransition::eventTest(event)) return false; //We have enough bomb? - if (boat->bombsLaunched() < MAX_BOMB) - return true; - else - return false; + return (boat->bombsLaunched() < MAX_BOMB); } private: Boat * boat; @@ -158,9 +139,8 @@ private: class MoveStateRight : public QState { public: - MoveStateRight(Boat *boat,QState *parent = 0) : QState(parent) + MoveStateRight(Boat *boat,QState *parent = 0) : QState(parent), boat(boat) { - this->boat = boat; } protected: void onEntry(QEvent *) @@ -176,9 +156,8 @@ private: class MoveStateLeft : public QState { public: - MoveStateLeft(Boat *boat,QState *parent = 0) : QState(parent) + MoveStateLeft(Boat *boat,QState *parent = 0) : QState(parent), boat(boat) { - this->boat = boat; } protected: void onEntry(QEvent *) @@ -194,9 +173,8 @@ private: class StopState : public QState { public: - StopState(Boat *boat,QState *parent = 0) : QState(parent) + StopState(Boat *boat,QState *parent = 0) : QState(parent), boat(boat) { - this->boat = boat; } protected: void onEntry(QEvent *) @@ -213,9 +191,8 @@ private: class LaunchStateRight : public QState { public: - LaunchStateRight(Boat *boat,QState *parent = 0) : QState(parent) + LaunchStateRight(Boat *boat,QState *parent = 0) : QState(parent), boat(boat) { - this->boat = boat; } protected: void onEntry(QEvent *) @@ -235,9 +212,8 @@ private: class LaunchStateLeft : public QState { public: - LaunchStateLeft(Boat *boat,QState *parent = 0) : QState(parent) + LaunchStateLeft(Boat *boat,QState *parent = 0) : QState(parent), boat(boat) { - this->boat = boat; } protected: void onEntry(QEvent *) diff --git a/demos/sub-attaq/bomb.cpp b/demos/sub-attaq/bomb.cpp index d17024f..acc3475 100644 --- a/demos/sub-attaq/bomb.cpp +++ b/demos/sub-attaq/bomb.cpp @@ -52,19 +52,14 @@ #include #include -Bomb::Bomb(QGraphicsItem * parent, Qt::WindowFlags wFlags) - : QGraphicsWidget(parent,wFlags), launchAnimation(0) +Bomb::Bomb() : PixmapItem(QString("bomb"), GraphicsScene::Big) { - pixmapItem = new PixmapItem(QString("bomb"),GraphicsScene::Big, this); - setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - setFlags(QGraphicsItem::ItemIsMovable); setZValue(2); - resize(pixmapItem->boundingRect().size()); } void Bomb::launch(Bomb::Direction direction) { - launchAnimation = new QSequentialAnimationGroup(); + QSequentialAnimationGroup *launchAnimation = new QSequentialAnimationGroup; AnimationManager::self()->registerAnimation(launchAnimation); qreal delta = direction == Right ? 20 : - 20; QPropertyAnimation *anim = new QPropertyAnimation(this, "pos"); @@ -80,7 +75,7 @@ void Bomb::launch(Bomb::Direction direction) anim->setDuration(y()/2*60); launchAnimation->addAnimation(anim); connect(anim,SIGNAL(valueChanged(const QVariant &)),this,SLOT(onAnimationLaunchValueChanged(const QVariant &))); - + connect(this, SIGNAL(bombExploded()), launchAnimation, SLOT(stop())); //We setup the state machine of the bomb QStateMachine *machine = new QStateMachine(this); @@ -94,7 +89,7 @@ void Bomb::launch(Bomb::Direction direction) machine->setInitialState(launched); //### Add a nice animation when the bomb is destroyed - launched->addTransition(this, SIGNAL(bombExplosed()),final); + launched->addTransition(this, SIGNAL(bombExploded()),final); //If the animation is finished, then we move to the final state launched->addTransition(launched, SIGNAL(animationFinished()), final); @@ -119,6 +114,5 @@ void Bomb::onAnimationLaunchValueChanged(const QVariant &) void Bomb::destroy() { - launchAnimation->stop(); - emit bombExplosed(); + emit bombExploded(); } diff --git a/demos/sub-attaq/bomb.h b/demos/sub-attaq/bomb.h index f5b221c..ec059b5 100644 --- a/demos/sub-attaq/bomb.h +++ b/demos/sub-attaq/bomb.h @@ -42,13 +42,9 @@ #ifndef __BOMB__H__ #define __BOMB__H__ -//Qt -#include -#include +#include "pixmapitem.h" -class PixmapItem; - -class Bomb : public QGraphicsWidget +class Bomb : public PixmapItem { Q_OBJECT public: @@ -56,20 +52,16 @@ public: Left = 0, Right }; - Bomb(QGraphicsItem * parent = 0, Qt::WindowFlags wFlags = 0); + Bomb(); void launch(Direction direction); void destroy(); signals: - void bombExplosed(); + void bombExploded(); void bombExecutionFinished(); private slots: void onAnimationLaunchValueChanged(const QVariant &); - -private: - QAnimationGroup *launchAnimation; - PixmapItem *pixmapItem; }; #endif //__BOMB__H__ diff --git a/demos/sub-attaq/custompropertyanimation.cpp b/demos/sub-attaq/custompropertyanimation.cpp deleted file mode 100644 index 9b435f0..0000000 --- a/demos/sub-attaq/custompropertyanimation.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "custompropertyanimation.h" - -// Qt -#include - -CustomPropertyAnimation::CustomPropertyAnimation(QObject *parent) : - QVariantAnimation(parent), animProp(0) -{ -} - -CustomPropertyAnimation::~CustomPropertyAnimation() -{ -} - -void CustomPropertyAnimation::setProperty(AbstractProperty *_animProp) -{ - if (animProp == _animProp) - return; - delete animProp; - animProp = _animProp; -} - -/*! - \reimp - */ -void CustomPropertyAnimation::updateCurrentValue(const QVariant &value) -{ - if (!animProp || state() == QAbstractAnimation::Stopped) - return; - - animProp->write(value); -} - - -/*! - \reimp -*/ -void CustomPropertyAnimation::updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState) -{ - // Initialize start value - if (oldState == QAbstractAnimation::Stopped) { - if (!animProp) - return; - QVariant def = animProp->read(); - if (def.isValid()) { - const int t = def.userType(); - KeyValues values = keyValues(); - //this ensures that all the keyValues are of type t - for (int i = 0; i < values.count(); ++i) { - QVariantAnimation::KeyValue &pair = values[i]; - if (pair.second.userType() != t) - pair.second.convert(static_cast(t)); - } - //let's now update the key values - setKeyValues(values); - } - - if ((animProp && !startValue().isValid() && currentTime() == 0) - || (currentTime() == duration() && currentLoop() == (loopCount() - 1))) { - setStartValue(def); - } - } - - QVariantAnimation::updateState(oldState, newState); -} - -#include "moc_custompropertyanimation.cpp" diff --git a/demos/sub-attaq/custompropertyanimation.h b/demos/sub-attaq/custompropertyanimation.h deleted file mode 100644 index 0c97bf0..0000000 --- a/demos/sub-attaq/custompropertyanimation.h +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CUSTOMPROPERTYANIMATION_H -#define CUSTOMPROPERTYANIMATION_H - -#include - -QT_BEGIN_NAMESPACE -class QGraphicsItem; -QT_END_NAMESPACE - -struct AbstractProperty -{ - virtual QVariant read() const = 0; - virtual void write(const QVariant &value) = 0; -}; - - -class CustomPropertyAnimation : public QVariantAnimation -{ - Q_OBJECT - - template - class MemberFunctionProperty : public AbstractProperty - { - public: - typedef T (Target::*Getter)(void) const; - typedef void (Target::*Setter)(T2); - - MemberFunctionProperty(Target* target, Getter getter, Setter setter) - : m_target(target), m_getter(getter), m_setter(setter) {} - - virtual void write(const QVariant &value) - { - if (m_setter) (m_target->*m_setter)(qVariantValue(value)); - } - - virtual QVariant read() const - { - if (m_getter) return qVariantFromValue((m_target->*m_getter)()); - return QVariant(); - } - - private: - Target *m_target; - Getter m_getter; - Setter m_setter; - }; - -public: - CustomPropertyAnimation(QObject *parent = 0); - ~CustomPropertyAnimation(); - - template - void setMemberFunctions(Target* target, T (Target::*getter)() const, void (Target::*setter)(const T& )) - { - setProperty(new MemberFunctionProperty(target, getter, setter)); - } - - template - void setMemberFunctions(Target* target, T (Target::*getter)() const, void (Target::*setter)(T)) - { - setProperty(new MemberFunctionProperty(target, getter, setter)); - } - - void updateCurrentValue(const QVariant &value); - void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); - void setProperty(AbstractProperty *animProp); - -private: - Q_DISABLE_COPY(CustomPropertyAnimation); - AbstractProperty *animProp; -}; - -#endif // CUSTOMPROPERTYANIMATION_H diff --git a/demos/sub-attaq/graphicsscene.cpp b/demos/sub-attaq/graphicsscene.cpp index e5d7aad..812eadf 100644 --- a/demos/sub-attaq/graphicsscene.cpp +++ b/demos/sub-attaq/graphicsscene.cpp @@ -47,7 +47,6 @@ #include "torpedo.h" #include "bomb.h" #include "pixmapitem.h" -#include "custompropertyanimation.h" #include "animationmanager.h" #include "qanimationstate.h" #include "progressitem.h" @@ -68,39 +67,10 @@ #include #include -//helper function that creates an animation for position and inserts it into group -static CustomPropertyAnimation *addGraphicsItemPosAnimation(QSequentialAnimationGroup *group, - QGraphicsItem *item, const QPointF &endPos) -{ - CustomPropertyAnimation *ret = new CustomPropertyAnimation(group); - ret->setMemberFunctions(item, &QGraphicsItem::pos, &QGraphicsItem::setPos); - ret->setEndValue(endPos); - ret->setDuration(200); - ret->setEasingCurve(QEasingCurve::OutElastic); - group->addPause(50); - return ret; -} - -//helper function that creates an animation for opacity and inserts it into group -static void addGraphicsItemFadeoutAnimation(QAnimationGroup *group, QGraphicsItem *item) -{ -#if QT_VERSION >=0x040500 - CustomPropertyAnimation *anim = new CustomPropertyAnimation(group); - anim->setMemberFunctions(item, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity); - anim->setDuration(800); - anim->setEndValue(0); - anim->setEasingCurve(QEasingCurve::OutQuad); -#else - // work around for a bug where we don't transition if the duration is zero. - QtPauseAnimation *anim = new QtPauseAnimation(group); - anim->setDuration(1); -#endif -} - GraphicsScene::GraphicsScene(int x, int y, int width, int height, Mode mode) - : QGraphicsScene(x,y,width,height), mode(mode), newAction(0), quitAction(0), boat(0) + : QGraphicsScene(x , y, width, height), mode(mode), boat(new Boat) { - backgroundItem = new PixmapItem(QString("background"),mode); + PixmapItem *backgroundItem = new PixmapItem(QString("background"),mode); backgroundItem->setZValue(1); backgroundItem->setPos(0,0); addItem(backgroundItem); @@ -116,7 +86,6 @@ GraphicsScene::GraphicsScene(int x, int y, int width, int height, Mode mode) textInformationItem = new TextInformationItem(backgroundItem); textInformationItem->hide(); //We create the boat - boat = new Boat(); addItem(boat); boat->setPos(this->width()/2, sealLevel() - boat->size().height()); boat->hide(); @@ -130,28 +99,21 @@ GraphicsScene::GraphicsScene(int x, int y, int width, int height, Mode mode) while (!reader.atEnd()) { reader.readNext(); if (reader.tokenType() == QXmlStreamReader::StartElement) { - if (reader.name() == "submarine") - { + if (reader.name() == "submarine") { SubmarineDescription desc; desc.name = reader.attributes().value("name").toString(); desc.points = reader.attributes().value("points").toString().toInt(); desc.type = reader.attributes().value("type").toString().toInt(); submarinesData.append(desc); - } - if (reader.name() == "level") - { + } else if (reader.name() == "level") { currentLevel.id = reader.attributes().value("id").toString().toInt(); currentLevel.name = reader.attributes().value("name").toString(); + } else if (reader.name() == "subinstance") { + currentLevel.submarines.append(qMakePair(reader.attributes().value("type").toString().toInt(), reader.attributes().value("nb").toString().toInt())); } - if (reader.name() == "subinstance") - { - currentLevel.submarines.append(qMakePair(reader.attributes().value("type").toString().toInt(),reader.attributes().value("nb").toString().toInt())); - } - } - if (reader.tokenType() == QXmlStreamReader::EndElement) { - if (reader.name() == "level") - { - levelsData.insert(currentLevel.id,currentLevel); + } else if (reader.tokenType() == QXmlStreamReader::EndElement) { + if (reader.name() == "level") { + levelsData.insert(currentLevel.id, currentLevel); currentLevel.submarines.clear(); } } @@ -160,80 +122,52 @@ GraphicsScene::GraphicsScene(int x, int y, int width, int height, Mode mode) qreal GraphicsScene::sealLevel() const { - if (mode == Big) - return 220; - else - return 160; + return (mode == Big) ? 220 : 160; } -void GraphicsScene::setupScene(const QList &actions) +void GraphicsScene::setupScene(QAction *newAction, QAction *quitAction) { - newAction = actions.at(0); - quitAction = actions.at(1); - - QGraphicsItem *logo_s = addWelcomeItem(QPixmap(":/logo-s")); - QGraphicsItem *logo_u = addWelcomeItem(QPixmap(":/logo-u")); - QGraphicsItem *logo_b = addWelcomeItem(QPixmap(":/logo-b")); - QGraphicsItem *logo_dash = addWelcomeItem(QPixmap(":/logo-dash")); - QGraphicsItem *logo_a = addWelcomeItem(QPixmap(":/logo-a")); - QGraphicsItem *logo_t = addWelcomeItem(QPixmap(":/logo-t")); - QGraphicsItem *logo_t2 = addWelcomeItem(QPixmap(":/logo-t2")); - QGraphicsItem *logo_a2 = addWelcomeItem(QPixmap(":/logo-a2")); - QGraphicsItem *logo_q = addWelcomeItem(QPixmap(":/logo-q")); - QGraphicsItem *logo_excl = addWelcomeItem(QPixmap(":/logo-excl")); - logo_s->setZValue(3); - logo_u->setZValue(4); - logo_b->setZValue(5); - logo_dash->setZValue(6); - logo_a->setZValue(7); - logo_t->setZValue(8); - logo_t2->setZValue(9); - logo_a2->setZValue(10); - logo_q->setZValue(11); - logo_excl->setZValue(12); - logo_s->setPos(QPointF(-1000, -1000)); - logo_u->setPos(QPointF(-800, -1000)); - logo_b->setPos(QPointF(-600, -1000)); - logo_dash->setPos(QPointF(-400, -1000)); - logo_a->setPos(QPointF(1000, 2000)); - logo_t->setPos(QPointF(800, 2000)); - logo_t2->setPos(QPointF(600, 2000)); - logo_a2->setPos(QPointF(400, 2000)); - logo_q->setPos(QPointF(200, 2000)); - logo_excl->setPos(QPointF(0, 2000)); + static const int nLetters = 10; + static struct { + char *pix; + qreal initX, initY; + qreal destX, destY; + } logoData[nLetters] = { + {"s", -1000, -1000, 300, 150 }, + {"u", -800, -1000, 350, 150 }, + {"b", -600, -1000, 400, 120 }, + {"dash", -400, -1000, 460, 150 }, + {"a", 1000, 2000, 350, 250 }, + {"t", 800, 2000, 400, 250 }, + {"t2", 600, 2000, 430, 250 }, + {"a2", 400, 2000, 465, 250 }, + {"q", 200, 2000, 510, 250 }, + {"excl", 0, 2000, 570, 220 } }; QSequentialAnimationGroup * lettersGroupMoving = new QSequentialAnimationGroup(this); QParallelAnimationGroup * lettersGroupFading = new QParallelAnimationGroup(this); - //creation of the animations for moving letters - addGraphicsItemPosAnimation(lettersGroupMoving, logo_s, QPointF(300, 150)); - addGraphicsItemPosAnimation(lettersGroupMoving, logo_u, QPointF(350, 150)); - addGraphicsItemPosAnimation(lettersGroupMoving, logo_b, QPointF(400, 120)); - addGraphicsItemPosAnimation(lettersGroupMoving, logo_dash, QPointF(460, 150)); - addGraphicsItemPosAnimation(lettersGroupMoving, logo_a, QPointF(350, 250)); - addGraphicsItemPosAnimation(lettersGroupMoving, logo_t, QPointF(400, 250)); - addGraphicsItemPosAnimation(lettersGroupMoving, logo_t2, QPointF(430, 250)); - addGraphicsItemPosAnimation(lettersGroupMoving, logo_a2, QPointF(465, 250)); - addGraphicsItemPosAnimation(lettersGroupMoving, logo_q, QPointF(510, 250)); - addGraphicsItemPosAnimation(lettersGroupMoving, logo_excl, QPointF(570, 220)); - - //creation of the animations for fading out the letters - addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_s); - addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_u); - addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_b); - addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_dash); - addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_a); - addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_t); - addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_t2); - addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_a2); - addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_q); - addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_excl); - connect(lettersGroupFading, SIGNAL(finished()), this, SLOT(onIntroAnimationFinished())); + for (int i = 0; i < nLetters; ++i) { + PixmapItem *logo = new PixmapItem(QLatin1String(":/logo-") + logoData[i].pix, this); + logo->setPos(logoData[i].initX, logoData[i].initY); + logo->setZValue(i + 3); + //creation of the animations for moving letters + QPropertyAnimation *moveAnim = new QPropertyAnimation(logo, "pos", lettersGroupMoving); + moveAnim->setEndValue(QPointF(logoData[i].destX, logoData[i].destY)); + moveAnim->setDuration(200); + moveAnim->setEasingCurve(QEasingCurve::OutElastic); + lettersGroupMoving->addPause(50); + //creation of the animations for fading out the letters + QPropertyAnimation *fadeAnim = new QPropertyAnimation(logo, "opacity", lettersGroupFading); + fadeAnim->setDuration(800); + fadeAnim->setEndValue(0); + fadeAnim->setEasingCurve(QEasingCurve::OutQuad); + } QStateMachine *machine = new QStateMachine(this); //This state is when the player is playing - PlayState *gameState = new PlayState(this,machine); + PlayState *gameState = new PlayState(this, machine); //Final state QFinalState *final = new QFinalState(machine); @@ -263,7 +197,7 @@ void GraphicsScene::setupScene(const QList &actions) machine->start(); //We reach the final state, then we quit - connect(machine,SIGNAL(finished()),this, SLOT(onQuitGameTriggered())); + connect(machine, SIGNAL(finished()), qApp, SLOT(quit())); } void GraphicsScene::addItem(Bomb *bomb) @@ -292,16 +226,6 @@ void GraphicsScene::addItem(QGraphicsItem *item) QGraphicsScene::addItem(item); } -void GraphicsScene::mousePressEvent (QGraphicsSceneMouseEvent * event) -{ - event->ignore(); -} - -void GraphicsScene::onQuitGameTriggered() -{ - qApp->closeAllWindows(); -} - void GraphicsScene::onBombExecutionFinished() { Bomb *bomb = qobject_cast(sender()); @@ -322,32 +246,26 @@ void GraphicsScene::onSubMarineExecutionFinished() { SubMarine *submarine = qobject_cast(sender()); submarines.remove(submarine); - if (submarines.count() == 0) { + if (submarines.count() == 0) emit allSubMarineDestroyed(submarine->points()); - } else { + else emit subMarineDestroyed(submarine->points()); - } submarine->deleteLater(); } -int GraphicsScene::remainingSubMarines() const -{ - return submarines.count(); -} - void GraphicsScene::clearScene() { - foreach (SubMarine *sub,submarines) { + foreach (SubMarine *sub, submarines) { sub->destroy(); sub->deleteLater(); } - foreach (Torpedo *torpedo,torpedos) { + foreach (Torpedo *torpedo, torpedos) { torpedo->destroy(); torpedo->deleteLater(); } - foreach (Bomb *bomb,bombs) { + foreach (Bomb *bomb, bombs) { bomb->destroy(); bomb->deleteLater(); } @@ -361,17 +279,3 @@ void GraphicsScene::clearScene() boat->stop(); boat->hide(); } - -QGraphicsPixmapItem *GraphicsScene::addWelcomeItem(const QPixmap &pm) -{ - QGraphicsPixmapItem *item = addPixmap(pm); - welcomeItems << item; - return item; -} - -void GraphicsScene::onIntroAnimationFinished() -{ - qDeleteAll(welcomeItems); - welcomeItems.clear(); -} - diff --git a/demos/sub-attaq/graphicsscene.h b/demos/sub-attaq/graphicsscene.h index 7d7252d..ce2c91f 100644 --- a/demos/sub-attaq/graphicsscene.h +++ b/demos/sub-attaq/graphicsscene.h @@ -82,41 +82,30 @@ public: GraphicsScene(int x, int y, int width, int height, Mode mode = Big); qreal sealLevel() const; - void setupScene(const QList &actions); + void setupScene(QAction *newAction, QAction *quitAction); void addItem(Bomb *bomb); void addItem(Torpedo *torpedo); void addItem(SubMarine *submarine); void addItem(QGraphicsItem *item); - int remainingSubMarines() const; void clearScene(); - QGraphicsPixmapItem *addWelcomeItem(const QPixmap &pm); signals: void subMarineDestroyed(int); void allSubMarineDestroyed(int); -protected: - void mousePressEvent (QGraphicsSceneMouseEvent * event); - private slots: - void onQuitGameTriggered(); void onBombExecutionFinished(); void onTorpedoExecutionFinished(); void onSubMarineExecutionFinished(); - void onIntroAnimationFinished(); private: Mode mode; - PixmapItem *backgroundItem; ProgressItem *progressItem; TextInformationItem *textInformationItem; - QAction * newAction; - QAction * quitAction; Boat *boat; QSet submarines; QSet bombs; QSet torpedos; - QVector welcomeItems; QVector submarinesData; QHash levelsData; diff --git a/demos/sub-attaq/mainwindow.cpp b/demos/sub-attaq/mainwindow.cpp index 37129f8..45e5554 100644 --- a/demos/sub-attaq/mainwindow.cpp +++ b/demos/sub-attaq/mainwindow.cpp @@ -56,42 +56,27 @@ MainWindow::MainWindow() : QMainWindow(0) { - QMenuBar *menuBar = new QMenuBar; - QMenu *file = new QMenu(tr("&File"),menuBar); + QMenu *file = menuBar()->addMenu(tr("&File")); - QAction *newAction = new QAction(tr("New Game"),file); + QAction *newAction = file->addAction(tr("New Game")); newAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_N)); - file->addAction(newAction); - QAction *quitAction = new QAction(tr("Quit"),file); + QAction *quitAction = file->addAction(tr("Quit")); quitAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q)); - file->addAction(quitAction); - menuBar->addMenu(file); - setMenuBar(menuBar); - - QStringList list = QApplication::arguments(); - if (list.contains("-fullscreen")) { - scene = new GraphicsScene(0, 0, 750, 400,GraphicsScene::Small); + if (QApplication::arguments().contains("-fullscreen")) { + scene = new GraphicsScene(0, 0, 750, 400, GraphicsScene::Small); setWindowState(Qt::WindowFullScreen); } else { scene = new GraphicsScene(0, 0, 880, 630); layout()->setSizeConstraint(QLayout::SetFixedSize); } - view = new QGraphicsView(scene,this); + view = new QGraphicsView(scene, this); view->setAlignment(Qt::AlignLeft | Qt::AlignTop); - QList actions; - actions << newAction << quitAction; - scene->setupScene(actions); + scene->setupScene(newAction, quitAction); #ifndef QT_NO_OPENGL - view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); + view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); #endif setCentralWidget(view); - -} - -MainWindow::~MainWindow() -{ } - diff --git a/demos/sub-attaq/mainwindow.h b/demos/sub-attaq/mainwindow.h index d626ad7..12a7364 100644 --- a/demos/sub-attaq/mainwindow.h +++ b/demos/sub-attaq/mainwindow.h @@ -54,7 +54,6 @@ class MainWindow : public QMainWindow Q_OBJECT public: MainWindow(); - ~MainWindow(); private: GraphicsScene *scene; diff --git a/demos/sub-attaq/pixmapitem.cpp b/demos/sub-attaq/pixmapitem.cpp index 9abf745..fcc7ce9 100644 --- a/demos/sub-attaq/pixmapitem.cpp +++ b/demos/sub-attaq/pixmapitem.cpp @@ -43,17 +43,34 @@ #include "pixmapitem.h" //Qt -#include +#include -PixmapItem::PixmapItem(const QString &fileName,GraphicsScene::Mode mode, QGraphicsItem * parent) : QGraphicsPixmapItem(parent),name(fileName) +PixmapItem::PixmapItem(const QString &fileName,GraphicsScene::Mode mode, QGraphicsItem * parent) : QGraphicsObject(parent) { - loadPixmap(mode); + if (mode == GraphicsScene::Big) + pix = ":/big/" + fileName; + else + pix = ":/small/" + fileName; } -void PixmapItem::loadPixmap(GraphicsScene::Mode mode) +PixmapItem::PixmapItem(const QString &fileName, QGraphicsScene *scene) : QGraphicsObject(), pix(fileName) { - if (mode == GraphicsScene::Big) - setPixmap(":/big/" + name); - else - setPixmap(":/small/" + name); + scene->addItem(this); } + +QSizeF PixmapItem::size() const +{ + return pix.size(); +} + +QRectF PixmapItem::boundingRect() const +{ + return QRectF(QPointF(0, 0), pix.size()); +} + +void PixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) +{ + painter->drawPixmap(0, 0, pix); +} + + diff --git a/demos/sub-attaq/pixmapitem.h b/demos/sub-attaq/pixmapitem.h index b176215..57f831a 100644 --- a/demos/sub-attaq/pixmapitem.h +++ b/demos/sub-attaq/pixmapitem.h @@ -46,18 +46,18 @@ #include "graphicsscene.h" //Qt -#include +#include -class PixmapItem : public QGraphicsPixmapItem +class PixmapItem : public QGraphicsObject { public: PixmapItem(const QString &fileName, GraphicsScene::Mode mode, QGraphicsItem * parent = 0); - + PixmapItem(const QString &fileName, QGraphicsScene *scene); + QSizeF size() const; + QRectF boundingRect() const; + void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); private: - void loadPixmap(GraphicsScene::Mode mode); - - QString name; - QPixmap pixmap; + QPixmap pix; }; #endif //__PIXMAPITEM__H__ diff --git a/demos/sub-attaq/states.cpp b/demos/sub-attaq/states.cpp index 7443ae7..742095e 100644 --- a/demos/sub-attaq/states.cpp +++ b/demos/sub-attaq/states.cpp @@ -67,8 +67,7 @@ PlayState::PlayState(GraphicsScene *scene, QState *parent) PlayState::~PlayState() { - if (machine) - delete machine; + delete machine; } void PlayState::onEntry(QEvent *) @@ -169,7 +168,7 @@ void LevelState::initializeLevel() scene->boat->setCurrentDirection(Boat::None); scene->boat->setBombsLaunched(0); scene->boat->show(); - scene->setFocusItem(scene->boat,Qt::OtherFocusReason); + scene->setFocusItem(scene->boat, Qt::OtherFocusReason); scene->boat->run(); scene->progressItem->setScore(game->score); @@ -276,13 +275,8 @@ void WinState::onExit(QEvent *) } /** UpdateScore State */ -UpdateScoreState::UpdateScoreState(PlayState *game, QState *parent) : QState(parent) -{ - this->game = game; -} -void UpdateScoreState::onEntry(QEvent *e) +UpdateScoreState::UpdateScoreState(PlayState *g, QState *parent) : QState(parent), game(g) { - QState::onEntry(e); } /** Win transition */ @@ -297,12 +291,10 @@ bool UpdateScoreTransition::eventTest(QEvent *event) { if (!QSignalTransition::eventTest(event)) return false; - else { - QStateMachine::SignalEvent *se = static_cast(event); - game->score += se->arguments().at(0).toInt(); - scene->progressItem->setScore(game->score); - return true; - } + QStateMachine::SignalEvent *se = static_cast(event); + game->score += se->arguments().at(0).toInt(); + scene->progressItem->setScore(game->score); + return true; } /** Win transition */ @@ -317,12 +309,10 @@ bool WinTransition::eventTest(QEvent *event) { if (!QSignalTransition::eventTest(event)) return false; - else { - QStateMachine::SignalEvent *se = static_cast(event); - game->score += se->arguments().at(0).toInt(); - scene->progressItem->setScore(game->score); - return true; - } + QStateMachine::SignalEvent *se = static_cast(event); + game->score += se->arguments().at(0).toInt(); + scene->progressItem->setScore(game->score); + return true; } /** Space transition */ @@ -334,12 +324,7 @@ CustomSpaceTransition::CustomSpaceTransition(QWidget *widget, PlayState *game, Q bool CustomSpaceTransition::eventTest(QEvent *event) { - Q_UNUSED(event); if (!QKeyEventTransition::eventTest(event)) return false; - if (game->currentLevel != 0) - return true; - else - return false; - + return (game->currentLevel != 0); } diff --git a/demos/sub-attaq/states.h b/demos/sub-attaq/states.h index 9e78ae4..f588e5d 100644 --- a/demos/sub-attaq/states.h +++ b/demos/sub-attaq/states.h @@ -136,8 +136,6 @@ class UpdateScoreState : public QState { public: UpdateScoreState(PlayState *game, QState *parent); -protected: - void onEntry(QEvent *); private: QPropertyAnimation *scoreAnimation; PlayState *game; diff --git a/demos/sub-attaq/sub-attaq.pro b/demos/sub-attaq/sub-attaq.pro index 8677ff5..b5aa465 100644 --- a/demos/sub-attaq/sub-attaq.pro +++ b/demos/sub-attaq/sub-attaq.pro @@ -10,7 +10,6 @@ HEADERS += boat.h \ states.h \ boat_p.h \ submarine_p.h \ - custompropertyanimation.h \ qanimationstate.h \ progressitem.h \ textinformationitem.h @@ -24,7 +23,6 @@ SOURCES += boat.cpp \ graphicsscene.cpp \ animationmanager.cpp \ states.cpp \ - custompropertyanimation.cpp \ qanimationstate.cpp \ progressitem.cpp \ textinformationitem.cpp diff --git a/demos/sub-attaq/submarine.cpp b/demos/sub-attaq/submarine.cpp index 3d8490f..f71b81c 100644 --- a/demos/sub-attaq/submarine.cpp +++ b/demos/sub-attaq/submarine.cpp @@ -46,7 +46,6 @@ #include "pixmapitem.h" #include "graphicsscene.h" #include "animationmanager.h" -#include "custompropertyanimation.h" #include "qanimationstate.h" #include @@ -57,62 +56,27 @@ static QAbstractAnimation *setupDestroyAnimation(SubMarine *sub) { QSequentialAnimationGroup *group = new QSequentialAnimationGroup(sub); -#if QT_VERSION >=0x040500 - PixmapItem *step1 = new PixmapItem(QString("explosion/submarine/step1"),GraphicsScene::Big, sub); - step1->setZValue(6); - PixmapItem *step2 = new PixmapItem(QString("explosion/submarine/step2"),GraphicsScene::Big, sub); - step2->setZValue(6); - PixmapItem *step3 = new PixmapItem(QString("explosion/submarine/step3"),GraphicsScene::Big, sub); - step3->setZValue(6); - PixmapItem *step4 = new PixmapItem(QString("explosion/submarine/step4"),GraphicsScene::Big, sub); - step4->setZValue(6); - step1->setOpacity(0); - step2->setOpacity(0); - step3->setOpacity(0); - step4->setOpacity(0); - CustomPropertyAnimation *anim1 = new CustomPropertyAnimation(sub); - anim1->setMemberFunctions((QGraphicsItem*)step1, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity); - anim1->setDuration(100); - anim1->setEndValue(1); - CustomPropertyAnimation *anim2 = new CustomPropertyAnimation(sub); - anim2->setMemberFunctions((QGraphicsItem*)step2, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity); - anim2->setDuration(100); - anim2->setEndValue(1); - CustomPropertyAnimation *anim3 = new CustomPropertyAnimation(sub); - anim3->setMemberFunctions((QGraphicsItem*)step3, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity); - anim3->setDuration(100); - anim3->setEndValue(1); - CustomPropertyAnimation *anim4 = new CustomPropertyAnimation(sub); - anim4->setMemberFunctions((QGraphicsItem*)step4, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity); - anim4->setDuration(100); - anim4->setEndValue(1); - group->addAnimation(anim1); - group->addAnimation(anim2); - group->addAnimation(anim3); - group->addAnimation(anim4); -#else - // work around for a bug where we don't transition if the duration is zero. - QtPauseAnimation *anim = new QtPauseAnimation(group); - anim->setDuration(1); - group->addAnimation(anim); -#endif + for (int i = 1; i <= 4; ++i) { + PixmapItem *step = new PixmapItem(QString::fromLatin1("explosion/submarine/step%1").arg(i), GraphicsScene::Big, sub); + step->setZValue(6); + step->setOpacity(0); + QPropertyAnimation *anim = new QPropertyAnimation(step, "opacity", group); + anim->setDuration(100); + anim->setEndValue(1); + } AnimationManager::self()->registerAnimation(group); return group; } -SubMarine::SubMarine(int type, const QString &name, int points, QGraphicsItem * parent, Qt::WindowFlags wFlags) - : QGraphicsWidget(parent,wFlags), subType(type), subName(name), subPoints(points), speed(0), direction(SubMarine::None) +SubMarine::SubMarine(int type, const QString &name, int points) : PixmapItem(QString("submarine"), GraphicsScene::Big), + subType(type), subName(name), subPoints(points), speed(0), direction(SubMarine::None) { - pixmapItem = new PixmapItem(QString("submarine"),GraphicsScene::Big, this); - setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); setZValue(5); - setFlags(QGraphicsItem::ItemIsMovable); - resize(pixmapItem->boundingRect().width(),pixmapItem->boundingRect().height()); setTransformOriginPoint(boundingRect().center()); graphicsRotation = new QGraphicsRotation(this); - graphicsRotation->setAxis(QVector3D(0, 1, 0)); + graphicsRotation->setAxis(Qt::YAxis); graphicsRotation->setOrigin(QVector3D(size().width()/2, size().height()/2, 0)); QList r; r.append(graphicsRotation); @@ -163,7 +127,7 @@ SubMarine::SubMarine(int type, const QString &name, int points, QGraphicsItem * machine->start(); } -int SubMarine::points() +int SubMarine::points() const { return subPoints; } @@ -202,7 +166,7 @@ void SubMarine::launchTorpedo(int speed) Torpedo * torp = new Torpedo(); GraphicsScene *scene = static_cast(this->scene()); scene->addItem(torp); - torp->setPos(x(), y()); + torp->setPos(pos()); torp->setCurrentSpeed(speed); torp->launch(); } diff --git a/demos/sub-attaq/submarine.h b/demos/sub-attaq/submarine.h index 1a3d2e5..326a1c8 100644 --- a/demos/sub-attaq/submarine.h +++ b/demos/sub-attaq/submarine.h @@ -43,15 +43,13 @@ #define __SUBMARINE__H__ //Qt -#include -#include #include -class PixmapItem; +#include "pixmapitem.h" class Torpedo; -class SubMarine : public QGraphicsWidget +class SubMarine : public PixmapItem { Q_OBJECT public: @@ -61,9 +59,9 @@ public: Right }; enum { Type = UserType + 1 }; - SubMarine(int type, const QString &name, int points, QGraphicsItem * parent = 0, Qt::WindowFlags wFlags = 0); + SubMarine(int type, const QString &name, int points); - int points(); + int points() const; void setCurrentDirection(Movement direction); enum Movement currentDirection() const; @@ -89,7 +87,6 @@ private: int subPoints; int speed; Movement direction; - PixmapItem *pixmapItem; QGraphicsRotation *graphicsRotation; }; diff --git a/demos/sub-attaq/submarine_p.h b/demos/sub-attaq/submarine_p.h index fa7430b..64a0cf7 100644 --- a/demos/sub-attaq/submarine_p.h +++ b/demos/sub-attaq/submarine_p.h @@ -94,7 +94,6 @@ protected: movementAnimation->setEndValue(QPointF(submarine->scene()->width()-submarine->size().width(),submarine->y())); movementAnimation->setDuration((submarine->scene()->width()-submarine->size().width()-submarine->x())/submarine->currentSpeed()*12); } - movementAnimation->setStartValue(submarine->pos()); QAnimationState::onEntry(e); } diff --git a/demos/sub-attaq/torpedo.cpp b/demos/sub-attaq/torpedo.cpp index cce430d..95f88e6 100644 --- a/demos/sub-attaq/torpedo.cpp +++ b/demos/sub-attaq/torpedo.cpp @@ -51,24 +51,21 @@ #include #include -Torpedo::Torpedo(QGraphicsItem * parent, Qt::WindowFlags wFlags) - : QGraphicsWidget(parent,wFlags), currentSpeed(0), launchAnimation(0) +Torpedo::Torpedo() : PixmapItem(QString::fromLatin1("torpedo"),GraphicsScene::Big), + currentSpeed(0) { - pixmapItem = new PixmapItem(QString::fromLatin1("torpedo"),GraphicsScene::Big, this); setZValue(2); - setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - setFlags(QGraphicsItem::ItemIsMovable); - resize(pixmapItem->boundingRect().size()); } void Torpedo::launch() { - launchAnimation = new QPropertyAnimation(this, "pos"); + QPropertyAnimation *launchAnimation = new QPropertyAnimation(this, "pos"); AnimationManager::self()->registerAnimation(launchAnimation); launchAnimation->setEndValue(QPointF(x(),qobject_cast(scene())->sealLevel() - 15)); launchAnimation->setEasingCurve(QEasingCurve::InQuad); launchAnimation->setDuration(y()/currentSpeed*10); connect(launchAnimation,SIGNAL(valueChanged(const QVariant &)),this,SLOT(onAnimationLaunchValueChanged(const QVariant &))); + connect(this,SIGNAL(torpedoExploded()), launchAnimation, SLOT(stop())); //We setup the state machine of the torpedo QStateMachine *machine = new QStateMachine(this); @@ -83,7 +80,7 @@ void Torpedo::launch() machine->setInitialState(launched); //### Add a nice animation when the torpedo is destroyed - launched->addTransition(this, SIGNAL(torpedoExplosed()),final); + launched->addTransition(this, SIGNAL(torpedoExploded()),final); //If the animation is finished, then we move to the final state launched->addTransition(launched, SIGNAL(animationFinished()), final); @@ -106,15 +103,12 @@ void Torpedo::setCurrentSpeed(int speed) void Torpedo::onAnimationLaunchValueChanged(const QVariant &) { foreach (QGraphicsItem *item , collidingItems(Qt::IntersectsItemBoundingRect)) { - if (item->type() == Boat::Type) { - Boat *b = static_cast(item); + if (Boat *b = qgraphicsitem_cast(item)) b->destroy(); - } } } void Torpedo::destroy() { - launchAnimation->stop(); - emit torpedoExplosed(); + emit torpedoExploded(); } diff --git a/demos/sub-attaq/torpedo.h b/demos/sub-attaq/torpedo.h index 2e654f4..03f277d 100644 --- a/demos/sub-attaq/torpedo.h +++ b/demos/sub-attaq/torpedo.h @@ -42,25 +42,19 @@ #ifndef __TORPEDO__H__ #define __TORPEDO__H__ -//Qt -#include +#include "pixmapitem.h" -#include -#include - -class PixmapItem; - -class Torpedo : public QGraphicsWidget +class Torpedo : public PixmapItem { Q_OBJECT public: - Torpedo(QGraphicsItem * parent = 0, Qt::WindowFlags wFlags = 0); + Torpedo(); void launch(); void setCurrentSpeed(int speed); void destroy(); signals: - void torpedoExplosed(); + void torpedoExploded(); void torpedoExecutionFinished(); private slots: @@ -68,8 +62,6 @@ private slots: private: int currentSpeed; - PixmapItem *pixmapItem; - QVariantAnimation *launchAnimation; }; #endif //__TORPEDO__H__ -- cgit v0.12 From dfce16a317e4e606b517ff206bb7a410bad7e0ca Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 5 Oct 2009 11:53:38 +0200 Subject: QPropertyAnimation now uses QMetaObject::metacall instead of qt_metacall This allows the animations to work with the newly integrated dynamic metaobject Reviewed-by: Michael Brasser (cherry picked from commit e548c48513546199c848e6cb08a60e8eccdab2c5) --- src/corelib/animation/qpropertyanimation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index b64d7df..4742e54 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -132,9 +132,9 @@ void QPropertyAnimationPrivate::updateProperty(const QVariant &newValue) } if (newValue.userType() == propertyType) { - //no conversion is needed, we directly call the QObject::qt_metacall + //no conversion is needed, we directly call the QMetaObject::metacall void *data = const_cast(newValue.constData()); - targetValue->qt_metacall(QMetaObject::WriteProperty, propertyIndex, &data); + QMetaObject::metacall(targetValue, QMetaObject::WriteProperty, propertyIndex, &data); } else { targetValue->setProperty(propertyName.constData(), newValue); } -- cgit v0.12 From 0b3f1a313fb464741c987b188ab4169947d0eb78 Mon Sep 17 00:00:00 2001 From: Bernhard Rosenkraenzer Date: Mon, 5 Oct 2009 12:08:24 +0200 Subject: Adapt to libtiff 4.0 changes In libtiff 4.0, TIFF_VERSION has been replaced with TIFF_VERSION_CLASSIC (to indicate normal tiff support) and TIFF_VERSION_BIG (to indicate BigTIFF support) Merge-request: 1547 Reviewed-by: Thiago Macieira (cherry picked from commit 7ec805adeecb8d518c0eb01dad1c04ccea78b340) --- config.tests/unix/libtiff/libtiff.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config.tests/unix/libtiff/libtiff.cpp b/config.tests/unix/libtiff/libtiff.cpp index 2d4b2af..7d41f25 100644 --- a/config.tests/unix/libtiff/libtiff.cpp +++ b/config.tests/unix/libtiff/libtiff.cpp @@ -41,6 +41,11 @@ #include +#if !defined(TIFF_VERSION) && defined(TIFF_VERSION_CLASSIC) +// libtiff 4.0 splits it into TIFF_VERSION_CLASSIC and TIFF_VERSION_BIG +# define TIFF_VERSION TIFF_VERSION_CLASSIC +#endif + #if !defined(TIFF_VERSION) # error "Required libtiff not found" #elif TIFF_VERSION < 42 -- cgit v0.12 From b50966121c3de0328f810b176e549b63985d974a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 5 Oct 2009 12:10:28 +0200 Subject: Fix uninitialized read in QFormLayoutPrivate::setupVerticalLayoutData() Merge-request: 1541 Reviewed-by: Thiago Macieira (cherry picked from commit b0e6c5ca48c76fb17dca986e9e07adebde390e29) --- src/gui/kernel/qformlayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qformlayout.cpp b/src/gui/kernel/qformlayout.cpp index 6ceab07..3e5dadc 100644 --- a/src/gui/kernel/qformlayout.cpp +++ b/src/gui/kernel/qformlayout.cpp @@ -252,7 +252,7 @@ QFormLayoutPrivate::QFormLayoutPrivate() : fieldGrowthPolicy(DefaultFieldGrowthPolicy), rowWrapPolicy(DefaultRowWrapPolicy), has_hfw(false), dirty(true), sizesDirty(true), expandVertical(0), expandHorizontal(0), labelAlignment(0), formAlignment(0), - hfw_width(-1), hfw_sh_height(-1), min_width(-1), + layoutWidth(-1), hfw_width(-1), hfw_sh_height(-1), min_width(-1), sh_width(-1), thresh_width(QLAYOUTSIZE_MAX), hSpacing(-1), vSpacing(-1) { } -- cgit v0.12 From 9815de3fbdbca8bda881e939274b3133492933fb Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Mon, 5 Oct 2009 12:14:08 +0200 Subject: Exclude WebCore/jsc.pro and WebKit/qt/Plugins/ from 3rdparty/webkit Rubber-stamped by: Simon Hausmann (cherry picked from commit 5286a0211d9c76bf762c8041c1d596d8c9c9c08d) --- util/webkit/mkdist-javascriptcore | 1 + util/webkit/mkdist-webkit | 3 +++ 2 files changed, 4 insertions(+) diff --git a/util/webkit/mkdist-javascriptcore b/util/webkit/mkdist-javascriptcore index dc33f6c..07419ea 100755 --- a/util/webkit/mkdist-javascriptcore +++ b/util/webkit/mkdist-javascriptcore @@ -41,6 +41,7 @@ files_to_remove="" files_to_remove="$files_to_remove JavaScriptCore/AllInOneFile.cpp" files_to_remove="$files_to_remove JavaScriptCore/JavaScriptCoreSources.bkl" files_to_remove="$files_to_remove JavaScriptCore/jscore.bkl" +files_to_remove="$files_to_remove JavaScriptCore/jsc.pro" require_clean_work_tree() { # test if working tree is dirty diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit index 34a2ec7..9611d38 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -143,6 +143,8 @@ excluded_directories="$excluded_directories WebCore/storage/wince" excluded_directories="$excluded_directories WebCore/platform/wx" excluded_directories="$excluded_directories WebCore/platform/wince" +excluded_directories="$excluded_directories WebKit/qt/Plugins" + excluded_directories="$excluded_directories WebKit/gtk" excluded_directories="$excluded_directories WebKit/win" excluded_directories="$excluded_directories WebKit/wx" @@ -204,6 +206,7 @@ files_to_remove="$files_to_remove WebKit/qt/QGVLauncher/main.cpp" files_to_remove="$files_to_remove JavaScriptCore/AllInOneFile.cpp" files_to_remove="$files_to_remove JavaScriptCore/JavaScriptCoreSources.bkl" files_to_remove="$files_to_remove JavaScriptCore/jscore.bkl" +files_to_remove="$files_to_remove JavaScriptCore/jsc.pro" files_to_remove="$files_to_remove WebCore/wscript" files_to_remove="$files_to_remove WebCore/WebCore.ContextMenus.exp" -- cgit v0.12 From 22f88f83b86cd0c8d9fc5b1daef62ec68807a81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 5 Oct 2009 12:21:18 +0200 Subject: Made X11 QPixmap backend return proper pixmap in alphaChannel(). Reviewed-by: Gunnar (cherry picked from commit c1d24c6b87dcc4c6e2f6f258c0198fdb6b2795f0) --- src/gui/image/qpixmap_x11.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 6cde898..92a7e7d 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1252,8 +1252,11 @@ void QX11PixmapData::release() QPixmap QX11PixmapData::alphaChannel() const { - if (!hasAlphaChannel()) - return QPixmap(); + if (!hasAlphaChannel()) { + QPixmap pm(w, h); + pm.fill(Qt::white); + return pm; + } QImage im(toImage()); return QPixmap::fromImage(im.alphaChannel(), Qt::OrderedDither); } -- cgit v0.12 From a12c32a8331466ea6d8edac5fb15c696b88437e3 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 5 Oct 2009 12:53:04 +0200 Subject: Update systemclip based on the correct parameters Reviewed-by: Samuel (cherry picked from commit 7cb0dea6d991a4d9f4a66b699dc5b353812b168d) --- src/opengl/qpaintengine_opengl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index da490c0..3e4a8e7 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -2311,7 +2311,7 @@ void QOpenGLPaintEnginePrivate::updateDepthClip() void QOpenGLPaintEnginePrivate::systemStateChanged() { Q_Q(QOpenGLPaintEngine); - if (q->state()->hasClipping) + if (q->painter()->hasClipping()) q->updateClipRegion(q->painter()->clipRegion(), Qt::ReplaceClip); else q->updateClipRegion(QRegion(), Qt::NoClip); -- cgit v0.12 From 2831bdb96016a30f6a8cb0c00d82565468325019 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 2 Oct 2009 18:04:21 +0200 Subject: Doc: move new files into correct subdirectory. (cherry picked from commit 491a9879d349a67dbd5f00f1c0bb189fb92290e3) --- doc/src/exceptionsafety.qdoc | 156 ---------------- doc/src/howtos/exceptionsafety.qdoc | 156 ++++++++++++++++ doc/src/platforms/s60-introduction.qdoc | 151 ++++++++++++++++ doc/src/platforms/symbian-exceptionsafety.qdoc | 241 +++++++++++++++++++++++++ doc/src/s60-introduction.qdoc | 151 ---------------- doc/src/symbian-exceptionsafety.qdoc | 241 ------------------------- 6 files changed, 548 insertions(+), 548 deletions(-) delete mode 100644 doc/src/exceptionsafety.qdoc create mode 100644 doc/src/howtos/exceptionsafety.qdoc create mode 100644 doc/src/platforms/s60-introduction.qdoc create mode 100644 doc/src/platforms/symbian-exceptionsafety.qdoc delete mode 100644 doc/src/s60-introduction.qdoc delete mode 100644 doc/src/symbian-exceptionsafety.qdoc diff --git a/doc/src/exceptionsafety.qdoc b/doc/src/exceptionsafety.qdoc deleted file mode 100644 index b70df6b..0000000 --- a/doc/src/exceptionsafety.qdoc +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page exceptionsafety.html - \title Exception Safety - \ingroup architecture - \brief A guide to exception safety in Qt. - - \bold {Preliminary warning}: Exception safety is not feature complete! - Common cases should work, but classes might still leak or even crash. - - Qt itself will not throw exceptions. Instead, error codes are used. - In addition, some classes have user visible error messages, for example - \l QIODevice::errorString() or \l QSqlQuery::lastError(). - This has historical and practical reasons - turning on exceptions - can increase the library size by over 20%. - - The following sections describe Qt's behavior if exception support is - enabled at compile time. - - \tableofcontents - - \section1 Exception safe modules - - \section2 Containers - - Qt's \l{container classes} are generally exception neutral. They pass any - exception that happens within their contained type \c T to the user - while keeping their internal state valid. - - Example: - - \code - QList list; - ... - try { - list.append("hello"); - } catch (...) { - } - // list is safe to use - the exception did not affect it. - \endcode - - Exceptions to that rule are containers for types that can throw during assignment - or copy constructions. For those types, functions that modify the container as well as - returning a value, are unsafe to use: - - \code - MyType s = list.takeAt(2); - \endcode - - If an exception occurs during the assignment of \c s, the value at index 2 is already - removed from the container, but hasn't been assigned to \c s yet. It is lost - without chance of recovery. - - The correct way to write it: - - \code - MyType s = list.at(2); - list.removeAt(2); - \endcode - - If the assignment throws, the container still contains the value, no data loss occured. - - Note that implicitly shared Qt classes will not throw in their assignment - operators or copy constructors, so the limitation above does not apply. - - \section1 Out of Memory Handling - - Most desktop operating systems overcommit memory. This means that \c malloc() - or \c{operator new} return a valid pointer, even though there is not enough - memory available at allocation time. On such systems, no exception of type - \c std::bad_alloc is thrown. - - On all other operating systems, Qt will throw an exception of type std::bad_alloc - if any allocation fails. Allocations can fail if the system runs out of memory or - doesn't have enough continuous memory to allocate the requested size. - - Exceptions to that rule are documented. As an example, \l QImage::create() - returns false if not enough memory exists instead of throwing an exception. - - \section1 Recovering from exceptions - - Currently, the only supported use case for recovering from exceptions thrown - within Qt (for example due to out of memory) is to exit the event loop and do - some cleanup before exiting the application. - - Typical use case: - - \code - QApplication app(argc, argv); - ... - try { - app.exec(); - } catch (const std::bad_alloc &) { - // clean up here, e.g. save the session - // and close all config files. - - return 0; // exit the application - } - \endcode - - After an exception is thrown, the connection to the windowing server - might already be closed. It is not safe to call a GUI related function - after catching an exception. - - \section1 Platform-Specific Exception Handling - - \section2 Symbian (Qt for S60) - - The Symbian platform implements its own exception system that differs from the standard - C++ mechanism. When using Qt for S60, and especially when writing code to access Symbian - functionality directly, it may be necessary to know about the underlying implementation - and how it interacts with Qt. - - The \l{Exception Safety with Symbian} document shows how to use the facilities provided - by Qt to use exceptions as safely as possible. -*/ diff --git a/doc/src/howtos/exceptionsafety.qdoc b/doc/src/howtos/exceptionsafety.qdoc new file mode 100644 index 0000000..23bedf5 --- /dev/null +++ b/doc/src/howtos/exceptionsafety.qdoc @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page exceptionsafety.html + \title Exception Safety + \ingroup best-practices + \brief A guide to exception safety in Qt. + + \bold {Preliminary warning}: Exception safety is not feature complete! + Common cases should work, but classes might still leak or even crash. + + Qt itself will not throw exceptions. Instead, error codes are used. + In addition, some classes have user visible error messages, for example + \l QIODevice::errorString() or \l QSqlQuery::lastError(). + This has historical and practical reasons - turning on exceptions + can increase the library size by over 20%. + + The following sections describe Qt's behavior if exception support is + enabled at compile time. + + \tableofcontents + + \section1 Exception safe modules + + \section2 Containers + + Qt's \l{container classes} are generally exception neutral. They pass any + exception that happens within their contained type \c T to the user + while keeping their internal state valid. + + Example: + + \code + QList list; + ... + try { + list.append("hello"); + } catch (...) { + } + // list is safe to use - the exception did not affect it. + \endcode + + Exceptions to that rule are containers for types that can throw during assignment + or copy constructions. For those types, functions that modify the container as well as + returning a value, are unsafe to use: + + \code + MyType s = list.takeAt(2); + \endcode + + If an exception occurs during the assignment of \c s, the value at index 2 is already + removed from the container, but hasn't been assigned to \c s yet. It is lost + without chance of recovery. + + The correct way to write it: + + \code + MyType s = list.at(2); + list.removeAt(2); + \endcode + + If the assignment throws, the container still contains the value, no data loss occured. + + Note that implicitly shared Qt classes will not throw in their assignment + operators or copy constructors, so the limitation above does not apply. + + \section1 Out of Memory Handling + + Most desktop operating systems overcommit memory. This means that \c malloc() + or \c{operator new} return a valid pointer, even though there is not enough + memory available at allocation time. On such systems, no exception of type + \c std::bad_alloc is thrown. + + On all other operating systems, Qt will throw an exception of type std::bad_alloc + if any allocation fails. Allocations can fail if the system runs out of memory or + doesn't have enough continuous memory to allocate the requested size. + + Exceptions to that rule are documented. As an example, \l QImage::create() + returns false if not enough memory exists instead of throwing an exception. + + \section1 Recovering from exceptions + + Currently, the only supported use case for recovering from exceptions thrown + within Qt (for example due to out of memory) is to exit the event loop and do + some cleanup before exiting the application. + + Typical use case: + + \code + QApplication app(argc, argv); + ... + try { + app.exec(); + } catch (const std::bad_alloc &) { + // clean up here, e.g. save the session + // and close all config files. + + return 0; // exit the application + } + \endcode + + After an exception is thrown, the connection to the windowing server + might already be closed. It is not safe to call a GUI related function + after catching an exception. + + \section1 Platform-Specific Exception Handling + + \section2 Symbian (Qt for S60) + + The Symbian platform implements its own exception system that differs from the standard + C++ mechanism. When using Qt for S60, and especially when writing code to access Symbian + functionality directly, it may be necessary to know about the underlying implementation + and how it interacts with Qt. + + The \l{Exception Safety with Symbian} document shows how to use the facilities provided + by Qt to use exceptions as safely as possible. +*/ diff --git a/doc/src/platforms/s60-introduction.qdoc b/doc/src/platforms/s60-introduction.qdoc new file mode 100644 index 0000000..d0a1976 --- /dev/null +++ b/doc/src/platforms/s60-introduction.qdoc @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page s60-with-qt-introduction.html + + \title S60 - Introduction to using Qt + \brief An introduction to Qt for S60 developers. + \ingroup howto + \ingroup qts60 + + \tableofcontents + + \section1 Required tools + + See \l{Qt for S60 Requirements} to see what tools are required to use Qt for S60. + + \section1 Installing Qt and running demos + + Follow the instructions found in \l{Installing Qt on S60 using binary package} to learn how + to install Qt using binary package and how to build and run Qt demos. + + Follow the instructions found in \l{Installing Qt on S60} to learn how to install Qt using + using source package and how to build and run the Qt demos. + + \section1 Building your own applications + + If you are new to Qt development, have a look at \l{How to Learn Qt}. + In general, the difference between developing a + Qt application on S60 compared to any of the other platforms supported + by Qt is not that big. + + Once you have crated a \c .pro file for your project, generate the + Carbide specific \c Bld.inf and \c .mmp files this way: + + \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 0 + + For more information on how to use qmake have a look at the \l + {qmake Tutorial}. + + Now you can build the Qt on S60 application with standard build + tools. By default, running \c make will produce binaries for the + emulator. However, S60 comes with several alternative build targets, + as shown in the table below: + + \table + \row \o \c debug-winscw \o Build debug binaries for the emulator (default). + It is currently not possible to build release + binaries for the emulator. + \row \o \c debug-gcce \o Build debug binaries for hardware using GCCE. + \row \o \c release-gcce \o Build release binaries for hardware using GCCE. + \row \o \c debug-armv5 \o Build debug binaries for hardware using RVCT. + \row \o \c release-armv5 \o Build release binaries for hardware using RVCT. + \row \o \c run \o Run the emulator binaries from the build directory. + \row \o \c sis \o Create signed \c .sis file for project. + \endtable + + The following lines perform a debug build for the emulator + and deploy all the needed files: + + \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 1 + + To work on your project in Carbide, simply import the \c .pro file + by right clicking on the project explorer and executing "Import...". + + \section1 Installing your own applications + + To install your own applications on hardware, you need signed \c .sis file. + The signed \c .sis file can be created with \c make \c sis target. \c sis target + is only supported for executables or projects with \c DEPLOYMENT statements. + By default the \c sis target will create signed \c .sis file for last build + target. For example, the following sequence will generate the needed makefiles, + build the project for \c debug-winscw and \c release-armv5, and create + self-signed \c .sis file for \c release-armv5 target: + + \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 2 + + If you want to use different certificate information or override the default + target for \c .sis file creation you can use the environment variables as + shown in the table below: + + \table + \row \o \c QT_SIS_OPTIONS \o Options accepted by \c .sis creation. + -i, install the package right away using PC suite. + -c=, read certificate information from a file. + Execute \c{perl createpackage.pl} for more information + about options. + By default no otions are given. + \row \o \c QT_SIS_TARGET \o Target for which \c .sis file is created. + Accepted values are build targets listed in + previous table. By default last build target. + \row \o \c QT_SIS_CERTIFICATE \o The certificate file used for signing. + By default self-signed certificate. + \row \o \c QT_SIS_KEY \o The certificate's private key file. + By default key is associated to self-signed certificate. + \row \o \c QT_SIS_PASSPHRASE \o The certificate's private key file's passphrase. + By default empty. + \endtable + + For example: + + \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 4 + + The environment variables for \c make can also be given as parameters: + + \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 3 + + If you want to install the program immediately, make sure that the device + is connected to the computer in "PC Suite" mode, and run \c sis target + with the \c QT_SIS_OPTIONS=-i, like this: + + \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 5 +*/ diff --git a/doc/src/platforms/symbian-exceptionsafety.qdoc b/doc/src/platforms/symbian-exceptionsafety.qdoc new file mode 100644 index 0000000..88f4d03 --- /dev/null +++ b/doc/src/platforms/symbian-exceptionsafety.qdoc @@ -0,0 +1,241 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page symbianexceptionsafety.html + \title Exception Safety with Symbian + \ingroup qts60 + \brief A guide to integrating exception safety in Qt with Symbian. + + The following sections describe how Qt code can interoperate with Symbian's + exception safety system. + + \tableofcontents + + \section1 What the problem is + + Qt and Symbian have different exception systems. Qt works with standard C++ + exceptions, whereas Symbian has its TRAP/Leave/CleanupStack system. So, what would + happen if you mix the two systems? It could go wrong in a number of ways. + + Clean-up ordering would be different between the two. When Symbian code + leaves, the clean-up stack is cleaned up before anything else happens. After + that, the objects on the call stack would be cleaned up as with a normal + exception. So if there are any dependencies between stack-based and + objects owned by the clean-up stack, there could be problems due to this + ordering. + + Symbian's \c XLeaveException, which is used when Symbian implements leaves as + exceptions, is not derived from \c std::exception, so would not be caught in + Qt catch statements designed to catch \c std::exception. + + Qt's and standard C++'s \c std::exception derived exceptions result in program + termination if they fall back to a Symbian TRAP. + + These problems can be solved with barrier macros and helper functions that + will translate between the two exception systems. Use them, in Qt code, + whenever calling into or being called from Symbian code. + + \section1 Qt calls to Symbian + + When calling Symbian leaving functions from Qt code, we want to translate + Symbian leaves to standard C++ exceptions. The following help is provided: + + \list + \o \l qt_symbian_throwIfError() takes a Symbian + error code and throws an appropriate exception to represent it. + This will do nothing if the error code is not in fact an error. The + function is equivalent to Symbian's \c User::LeaveIfError. + \o \l q_check_ptr() takes a pointer and throws a std::bad_alloc + exception if it is 0, otherwise the pointer is returned. This can be + used to check the success of a non-throwing allocation, eg from + \c malloc(). The function is equivalent to Symbian's \c + User::LeaveIfNull. + \o \l QT_TRAP_THROWING() takes a Symbian leaving + code fragment f and runs it under a trap harness converting any resulting + error into an exception. + \o \c TRAP and \c TRAPD from the Symbian libraries can be used to convert + leaves to error codes. + \endlist + + \code + HBufC* buf=0; + // this will throw a std::bad_alloc because we've asked for too much memory + QT_TRAP_THROWING(buf = HBufC::NewL(100000000)); + + _LIT(KStr,"abc"); + TInt pos = KStr().Locate('c'); + // pos is a good value, >= 0, so no exception is thrown + qt_symbian_throwIfError(pos); + + pos = KStr().Locate('d'); + // pos == KErrNotFound, so this throws an exception + qt_symbian_throwIfError(pos); + + // we are asking for a lot of memory, HBufC::New may return NULL, so check it + HBufC *buffer = q_check_ptr(HBufC::New(1000000)); + \endcode + + \section2 Be careful with new and CBase + + When writing Qt code, \c new will normally throw a \c std::bad_alloc if the + allocation fails. However this may not happen if the object being created + has its own \c {operator new}. For example, CBase and derived classes have + their own \c {operator new} which returns 0 and the \c {new(ELeave)} + overload for a leaving \c {operator new}, neither of which does what we want. + When using 2-phase construction of CBase derived objects, use \c new and + \l q_check_ptr(). + + \oldcode + CFbsBitmap* fbsBitmap = new(ELeave) CFbsBitmap; + \newcode + CFbsBitmap* fbsBitmap = q_check_ptr(new CFbsBitmap); + \endcode + + \section1 Qt called from Symbian + + When Qt code is called from Symbian, we want to translate standard C++ + exceptions to Symbian leaves or error codes. The following help is + provided: + + \list + \o \l qt_symbian_exception2Error() - + this takes a standard exception and gives an appropriate Symbian + error code. If no mapping is known for the exception type, + \c KErrGeneral is returned. + \o \l qt_symbian_exception2LeaveL() - + this takes a standard exception and generates an appropriate Symbian + leave. + \o \l QT_TRYCATCH_ERROR() - this macro + takes the standard C++ code fragment \c f, catches any std::exceptions + thrown from it, and sets err to the corresponding Symbian error code. + err is set to \c KErrNone otherwise. + \o \l QT_TRYCATCH_LEAVING() - this macro takes the + standard C++ code fragment \c f, catches any std::exceptions thrown from + it, and throws a corresponding Symbian leave. + \endlist + + \code + TInt DoTickL() // called from an active object RunL, ie Symbian leaves expected + { + // without the translation to Symbian Leave, we get a USER:0 panic + QT_TRYCATCH_LEAVING({ + int* x = new int[100000000]; // compiled as Qt code, will throw std::bad_alloc + delete [] x; + }); + return 0; + } + \endcode + + \section1 Common sense things + + Try to minimise the interleaving of Symbian and Qt code, every switch + requires a barrier. Grouping the code styles in different blocks will + minimise the problems. For instance, examine the following code. + + \code + 1. TRAPD(err, m_playUtility = CMdaAudioPlayerUtility::NewL(*this); + 2. QString filepath = QFileInfo( m_sound->fileName() ).absoluteFilePath(); + 3. filepath = QDir::toNativeSeparators(filepath); + 4. m_playUtility->OpenFileL(qt_QString2TPtrC(filepath))); + \endcode + + Line 1 starts a Symbian leave handling block, which is good because it + also uses a Symbian leave generating function. + + Line 2 creates a \l QString, uses \l QFileInfo and various member functions. + These could all throw exceptions, which is not good inside a \c TRAP block. + + Line 3 is unclear as to whether it might throw an exception, but since + it's dealing with strings it probably does, again bad. + + Line 4 is tricky, it calls a leaving function which is ok within a \c TRAP, + but it also uses a helper function to convert string types. In this case + the helper function may cause an unwelcome exception. + + We could rewrite this with nested exception translations, but it's much + easier to refactor it. + + \code + QString filepath = QFileInfo( m_sound->fileName() ).absoluteFilePath(); + filepath = QDir::toNativeSeparators(filepath); + TPtrC filepathPtr(qt_QString2TPtrC(filepath)); + TRAPD(err, m_playUtility = CMdaAudioPlayerUtility::NewL(*this); + m_playUtility->OpenFileL(filepathPtr)); + \endcode + + Now the exception generating functions are separated from the leaving + functions. + + \section1 Advanced technique + When using Symbian APIs in Qt code, you may find that Symbian leaving + code and Qt exception throwing code are just too mixed up to have + them interoperate through barriers. In some circumstances you can allow + code to both leave and throw exceptions. But you must be aware of the + following issues: + + \list + \o Depending on whether a leave or exception is thrown, or a normal + exit happens, the cleanup order will vary. If the code leaves, + cleanup stack cleanup will happen first. On an exception however, + cleanup stack cleanup will happen last. + \o There must not be any destructor dependencies between different + code styles. That is, you must not have symbian objects using Qt + objects in their destructors, and vice versa. This is because the + cleanup order varies, and may result in objects being used after + they are deleted. + \o The cleanup stack must not refer to any stack based object. For + instance, in Symbian you may use \c CleanupClosePushL() to push + stack based R-classes onto the cleanup stack. However if the + stack has unwound due to an exception before the cleanup stack + cleanup happens, stack based objects will now be invalid. + Instead of using the cleanup stack, consider Symbian's new + \c LManagedHandle<> (or a custom cleanup object) to tie R-class + cleanup to the stack. + \o Mixed throwing code must be called within both a TRAP and a + try/catch harness. Standard exceptions must not propagate to + the TRAP and cleanup stack cleanup will only happen if a leave + is thrown, so the correct pattern is either \c {TRAPD(err, + QT_TRYCATCH_LEAVING( f ));} or \c {QT_TRAP_THROWING( + QT_TRYCATCH_LEAVING( f ));}, depending if you want an error + code or exception as a result. + \endlist +*/ diff --git a/doc/src/s60-introduction.qdoc b/doc/src/s60-introduction.qdoc deleted file mode 100644 index d0a1976..0000000 --- a/doc/src/s60-introduction.qdoc +++ /dev/null @@ -1,151 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page s60-with-qt-introduction.html - - \title S60 - Introduction to using Qt - \brief An introduction to Qt for S60 developers. - \ingroup howto - \ingroup qts60 - - \tableofcontents - - \section1 Required tools - - See \l{Qt for S60 Requirements} to see what tools are required to use Qt for S60. - - \section1 Installing Qt and running demos - - Follow the instructions found in \l{Installing Qt on S60 using binary package} to learn how - to install Qt using binary package and how to build and run Qt demos. - - Follow the instructions found in \l{Installing Qt on S60} to learn how to install Qt using - using source package and how to build and run the Qt demos. - - \section1 Building your own applications - - If you are new to Qt development, have a look at \l{How to Learn Qt}. - In general, the difference between developing a - Qt application on S60 compared to any of the other platforms supported - by Qt is not that big. - - Once you have crated a \c .pro file for your project, generate the - Carbide specific \c Bld.inf and \c .mmp files this way: - - \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 0 - - For more information on how to use qmake have a look at the \l - {qmake Tutorial}. - - Now you can build the Qt on S60 application with standard build - tools. By default, running \c make will produce binaries for the - emulator. However, S60 comes with several alternative build targets, - as shown in the table below: - - \table - \row \o \c debug-winscw \o Build debug binaries for the emulator (default). - It is currently not possible to build release - binaries for the emulator. - \row \o \c debug-gcce \o Build debug binaries for hardware using GCCE. - \row \o \c release-gcce \o Build release binaries for hardware using GCCE. - \row \o \c debug-armv5 \o Build debug binaries for hardware using RVCT. - \row \o \c release-armv5 \o Build release binaries for hardware using RVCT. - \row \o \c run \o Run the emulator binaries from the build directory. - \row \o \c sis \o Create signed \c .sis file for project. - \endtable - - The following lines perform a debug build for the emulator - and deploy all the needed files: - - \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 1 - - To work on your project in Carbide, simply import the \c .pro file - by right clicking on the project explorer and executing "Import...". - - \section1 Installing your own applications - - To install your own applications on hardware, you need signed \c .sis file. - The signed \c .sis file can be created with \c make \c sis target. \c sis target - is only supported for executables or projects with \c DEPLOYMENT statements. - By default the \c sis target will create signed \c .sis file for last build - target. For example, the following sequence will generate the needed makefiles, - build the project for \c debug-winscw and \c release-armv5, and create - self-signed \c .sis file for \c release-armv5 target: - - \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 2 - - If you want to use different certificate information or override the default - target for \c .sis file creation you can use the environment variables as - shown in the table below: - - \table - \row \o \c QT_SIS_OPTIONS \o Options accepted by \c .sis creation. - -i, install the package right away using PC suite. - -c=, read certificate information from a file. - Execute \c{perl createpackage.pl} for more information - about options. - By default no otions are given. - \row \o \c QT_SIS_TARGET \o Target for which \c .sis file is created. - Accepted values are build targets listed in - previous table. By default last build target. - \row \o \c QT_SIS_CERTIFICATE \o The certificate file used for signing. - By default self-signed certificate. - \row \o \c QT_SIS_KEY \o The certificate's private key file. - By default key is associated to self-signed certificate. - \row \o \c QT_SIS_PASSPHRASE \o The certificate's private key file's passphrase. - By default empty. - \endtable - - For example: - - \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 4 - - The environment variables for \c make can also be given as parameters: - - \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 3 - - If you want to install the program immediately, make sure that the device - is connected to the computer in "PC Suite" mode, and run \c sis target - with the \c QT_SIS_OPTIONS=-i, like this: - - \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 5 -*/ diff --git a/doc/src/symbian-exceptionsafety.qdoc b/doc/src/symbian-exceptionsafety.qdoc deleted file mode 100644 index 88f4d03..0000000 --- a/doc/src/symbian-exceptionsafety.qdoc +++ /dev/null @@ -1,241 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page symbianexceptionsafety.html - \title Exception Safety with Symbian - \ingroup qts60 - \brief A guide to integrating exception safety in Qt with Symbian. - - The following sections describe how Qt code can interoperate with Symbian's - exception safety system. - - \tableofcontents - - \section1 What the problem is - - Qt and Symbian have different exception systems. Qt works with standard C++ - exceptions, whereas Symbian has its TRAP/Leave/CleanupStack system. So, what would - happen if you mix the two systems? It could go wrong in a number of ways. - - Clean-up ordering would be different between the two. When Symbian code - leaves, the clean-up stack is cleaned up before anything else happens. After - that, the objects on the call stack would be cleaned up as with a normal - exception. So if there are any dependencies between stack-based and - objects owned by the clean-up stack, there could be problems due to this - ordering. - - Symbian's \c XLeaveException, which is used when Symbian implements leaves as - exceptions, is not derived from \c std::exception, so would not be caught in - Qt catch statements designed to catch \c std::exception. - - Qt's and standard C++'s \c std::exception derived exceptions result in program - termination if they fall back to a Symbian TRAP. - - These problems can be solved with barrier macros and helper functions that - will translate between the two exception systems. Use them, in Qt code, - whenever calling into or being called from Symbian code. - - \section1 Qt calls to Symbian - - When calling Symbian leaving functions from Qt code, we want to translate - Symbian leaves to standard C++ exceptions. The following help is provided: - - \list - \o \l qt_symbian_throwIfError() takes a Symbian - error code and throws an appropriate exception to represent it. - This will do nothing if the error code is not in fact an error. The - function is equivalent to Symbian's \c User::LeaveIfError. - \o \l q_check_ptr() takes a pointer and throws a std::bad_alloc - exception if it is 0, otherwise the pointer is returned. This can be - used to check the success of a non-throwing allocation, eg from - \c malloc(). The function is equivalent to Symbian's \c - User::LeaveIfNull. - \o \l QT_TRAP_THROWING() takes a Symbian leaving - code fragment f and runs it under a trap harness converting any resulting - error into an exception. - \o \c TRAP and \c TRAPD from the Symbian libraries can be used to convert - leaves to error codes. - \endlist - - \code - HBufC* buf=0; - // this will throw a std::bad_alloc because we've asked for too much memory - QT_TRAP_THROWING(buf = HBufC::NewL(100000000)); - - _LIT(KStr,"abc"); - TInt pos = KStr().Locate('c'); - // pos is a good value, >= 0, so no exception is thrown - qt_symbian_throwIfError(pos); - - pos = KStr().Locate('d'); - // pos == KErrNotFound, so this throws an exception - qt_symbian_throwIfError(pos); - - // we are asking for a lot of memory, HBufC::New may return NULL, so check it - HBufC *buffer = q_check_ptr(HBufC::New(1000000)); - \endcode - - \section2 Be careful with new and CBase - - When writing Qt code, \c new will normally throw a \c std::bad_alloc if the - allocation fails. However this may not happen if the object being created - has its own \c {operator new}. For example, CBase and derived classes have - their own \c {operator new} which returns 0 and the \c {new(ELeave)} - overload for a leaving \c {operator new}, neither of which does what we want. - When using 2-phase construction of CBase derived objects, use \c new and - \l q_check_ptr(). - - \oldcode - CFbsBitmap* fbsBitmap = new(ELeave) CFbsBitmap; - \newcode - CFbsBitmap* fbsBitmap = q_check_ptr(new CFbsBitmap); - \endcode - - \section1 Qt called from Symbian - - When Qt code is called from Symbian, we want to translate standard C++ - exceptions to Symbian leaves or error codes. The following help is - provided: - - \list - \o \l qt_symbian_exception2Error() - - this takes a standard exception and gives an appropriate Symbian - error code. If no mapping is known for the exception type, - \c KErrGeneral is returned. - \o \l qt_symbian_exception2LeaveL() - - this takes a standard exception and generates an appropriate Symbian - leave. - \o \l QT_TRYCATCH_ERROR() - this macro - takes the standard C++ code fragment \c f, catches any std::exceptions - thrown from it, and sets err to the corresponding Symbian error code. - err is set to \c KErrNone otherwise. - \o \l QT_TRYCATCH_LEAVING() - this macro takes the - standard C++ code fragment \c f, catches any std::exceptions thrown from - it, and throws a corresponding Symbian leave. - \endlist - - \code - TInt DoTickL() // called from an active object RunL, ie Symbian leaves expected - { - // without the translation to Symbian Leave, we get a USER:0 panic - QT_TRYCATCH_LEAVING({ - int* x = new int[100000000]; // compiled as Qt code, will throw std::bad_alloc - delete [] x; - }); - return 0; - } - \endcode - - \section1 Common sense things - - Try to minimise the interleaving of Symbian and Qt code, every switch - requires a barrier. Grouping the code styles in different blocks will - minimise the problems. For instance, examine the following code. - - \code - 1. TRAPD(err, m_playUtility = CMdaAudioPlayerUtility::NewL(*this); - 2. QString filepath = QFileInfo( m_sound->fileName() ).absoluteFilePath(); - 3. filepath = QDir::toNativeSeparators(filepath); - 4. m_playUtility->OpenFileL(qt_QString2TPtrC(filepath))); - \endcode - - Line 1 starts a Symbian leave handling block, which is good because it - also uses a Symbian leave generating function. - - Line 2 creates a \l QString, uses \l QFileInfo and various member functions. - These could all throw exceptions, which is not good inside a \c TRAP block. - - Line 3 is unclear as to whether it might throw an exception, but since - it's dealing with strings it probably does, again bad. - - Line 4 is tricky, it calls a leaving function which is ok within a \c TRAP, - but it also uses a helper function to convert string types. In this case - the helper function may cause an unwelcome exception. - - We could rewrite this with nested exception translations, but it's much - easier to refactor it. - - \code - QString filepath = QFileInfo( m_sound->fileName() ).absoluteFilePath(); - filepath = QDir::toNativeSeparators(filepath); - TPtrC filepathPtr(qt_QString2TPtrC(filepath)); - TRAPD(err, m_playUtility = CMdaAudioPlayerUtility::NewL(*this); - m_playUtility->OpenFileL(filepathPtr)); - \endcode - - Now the exception generating functions are separated from the leaving - functions. - - \section1 Advanced technique - When using Symbian APIs in Qt code, you may find that Symbian leaving - code and Qt exception throwing code are just too mixed up to have - them interoperate through barriers. In some circumstances you can allow - code to both leave and throw exceptions. But you must be aware of the - following issues: - - \list - \o Depending on whether a leave or exception is thrown, or a normal - exit happens, the cleanup order will vary. If the code leaves, - cleanup stack cleanup will happen first. On an exception however, - cleanup stack cleanup will happen last. - \o There must not be any destructor dependencies between different - code styles. That is, you must not have symbian objects using Qt - objects in their destructors, and vice versa. This is because the - cleanup order varies, and may result in objects being used after - they are deleted. - \o The cleanup stack must not refer to any stack based object. For - instance, in Symbian you may use \c CleanupClosePushL() to push - stack based R-classes onto the cleanup stack. However if the - stack has unwound due to an exception before the cleanup stack - cleanup happens, stack based objects will now be invalid. - Instead of using the cleanup stack, consider Symbian's new - \c LManagedHandle<> (or a custom cleanup object) to tie R-class - cleanup to the stack. - \o Mixed throwing code must be called within both a TRAP and a - try/catch harness. Standard exceptions must not propagate to - the TRAP and cleanup stack cleanup will only happen if a leave - is thrown, so the correct pattern is either \c {TRAPD(err, - QT_TRYCATCH_LEAVING( f ));} or \c {QT_TRAP_THROWING( - QT_TRYCATCH_LEAVING( f ));}, depending if you want an error - code or exception as a result. - \endlist -*/ -- cgit v0.12 From f22ba0345f04860f7ca936cc413bccdc77379b23 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 5 Oct 2009 13:40:36 +0200 Subject: Document Embedded Linux with X11 and Scratchbox environment as Tier 2. (cherry picked from commit b2ea3433f4a42e367fd0708f0198329754903086) --- doc/src/platforms/supported-platforms.qdoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/src/platforms/supported-platforms.qdoc b/doc/src/platforms/supported-platforms.qdoc index 65d335b..4c3929a 100644 --- a/doc/src/platforms/supported-platforms.qdoc +++ b/doc/src/platforms/supported-platforms.qdoc @@ -128,6 +128,8 @@ \o Intel Compiler \row \o Embedded Linux QWS (Mips, PowerPC) \o gcc (\l{http:\\www.codesourcery.com}{Codesourcery version)} + \row \o Embedded Linux X11 (ARM) + \o gcc (\l{http://www.scratchbox.org/}{Scratchbox)} \row \o Windows CE 6.0 (ARMv4i, x86, MIPS) \o MSVC 2008 WinCE 6.0 Professional \endtable -- cgit v0.12 From 52d7cc6ececeda3c264ab0a6294aa5000365dec0 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 5 Oct 2009 13:47:52 +0200 Subject: Updated JavaScriptCore from /home/khansen/dev/qtwebkit to jsc-for-qtscript-4.6-staging-05102009 ( 38c2b17366f24220d9ae0456a7cfe2ac78a9f91c ) Adapt src/script to src/3rdparty/javascriptcore changes (cherry picked from commit 502c7d324141fb48a902ef475b4fd2932dc859c5) --- .../javascriptcore/JavaScriptCore/ChangeLog | 579 +++++++++++++++++++++ .../JavaScriptCore/JavaScriptCore.pri | 10 +- .../JavaScriptCore/assembler/MacroAssemblerARM.cpp | 27 + .../JavaScriptCore/assembler/MacroAssemblerARM.h | 15 + .../JavaScriptCore/assembler/MacroAssemblerARMv7.h | 12 + .../assembler/MacroAssemblerX86Common.h | 10 + .../JavaScriptCore/bytecode/EvalCodeCache.h | 2 +- .../JavaScriptCore/bytecode/SamplingTool.cpp | 30 +- .../JavaScriptCore/bytecode/SamplingTool.h | 22 +- .../bytecompiler/BytecodeGenerator.cpp | 8 +- .../bytecompiler/BytecodeGenerator.h | 9 +- .../JavaScriptCore/debugger/Debugger.cpp | 2 +- .../JavaScriptCore/debugger/DebuggerCallFrame.cpp | 2 +- .../JavaScriptCore/interpreter/Interpreter.cpp | 4 + .../javascriptcore/JavaScriptCore/jit/JIT.cpp | 6 +- .../javascriptcore/JavaScriptCore/jit/JIT.h | 17 +- .../JavaScriptCore/jit/JITArithmetic.cpp | 263 +++++++--- .../javascriptcore/JavaScriptCore/jit/JITCall.cpp | 24 +- .../JavaScriptCore/jit/JITInlineMethods.h | 43 +- .../JavaScriptCore/jit/JITOpcodes.cpp | 113 ++-- .../JavaScriptCore/jit/JITPropertyAccess.cpp | 128 +++-- .../javascriptcore/JavaScriptCore/jit/JITStubs.cpp | 24 +- .../javascriptcore/JavaScriptCore/jit/JITStubs.h | 1 - src/3rdparty/javascriptcore/JavaScriptCore/jsc.cpp | 41 +- .../javascriptcore/JavaScriptCore/parser/Nodes.cpp | 8 - .../JavaScriptCore/runtime/ArrayPrototype.cpp | 51 +- .../JavaScriptCore/runtime/Collector.cpp | 8 +- .../JavaScriptCore/runtime/Completion.cpp | 4 +- .../JavaScriptCore/runtime/Executable.cpp | 2 +- .../JavaScriptCore/runtime/Executable.h | 58 ++- .../JavaScriptCore/runtime/JSArray.cpp | 121 ++--- .../JavaScriptCore/runtime/JSArray.h | 19 +- .../runtime/JSGlobalObjectFunctions.cpp | 2 +- .../JavaScriptCore/runtime/JSValue.cpp | 5 +- .../JavaScriptCore/runtime/JSValue.h | 18 +- .../JavaScriptCore/runtime/Structure.cpp | 3 +- .../JavaScriptCore/runtime/TimeoutChecker.cpp | 25 +- .../JavaScriptCore/wtf/Assertions.cpp | 4 + .../javascriptcore/JavaScriptCore/wtf/Assertions.h | 12 + .../JavaScriptCore/wtf/FastMalloc.cpp | 12 +- .../javascriptcore/JavaScriptCore/wtf/FastMalloc.h | 5 + .../javascriptcore/JavaScriptCore/wtf/Forward.h | 5 +- .../JavaScriptCore/wtf/HashCountedSet.h | 38 +- .../javascriptcore/JavaScriptCore/wtf/Platform.h | 5 + .../JavaScriptCore/wtf/RandomNumber.cpp | 17 + .../javascriptcore/JavaScriptCore/wtf/TCSpinLock.h | 7 + .../JavaScriptCore/wtf/ThreadingPthreads.cpp | 2 +- .../JavaScriptCore/yarr/RegexJIT.cpp | 4 +- src/3rdparty/javascriptcore/VERSION | 4 +- src/3rdparty/javascriptcore/WebKit.pri | 9 +- src/script/api/qscriptengine.cpp | 2 +- 51 files changed, 1347 insertions(+), 495 deletions(-) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog index 84a2935..9dc7916 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog +++ b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog @@ -1,3 +1,518 @@ +2009-10-02 Geoffrey Garen + + Reviewed by Sam Weinig. + + Removed the concept of a "fast access cutoff" in arrays, because it + punished some patterns of array access too much, and made things too + complex for inlining in some cases. + + 1.3% speedup on SunSpider. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emitSlow_op_get_by_val): + (JSC::JIT::emitSlow_op_put_by_val): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_get_by_val): + (JSC::JIT::emitSlow_op_get_by_val): + (JSC::JIT::emit_op_put_by_val): + (JSC::JIT::emitSlow_op_put_by_val): + * jit/JITStubs.cpp: + * jit/JITStubs.h: + (JSC::): Check m_vectorLength instead of m_fastAccessCutoff when + getting / putting from / to an array. Inline putting past the end of + the array. + + * runtime/JSArray.cpp: + (JSC::JSArray::JSArray): + (JSC::JSArray::getOwnPropertySlot): + (JSC::JSArray::getOwnPropertyDescriptor): + (JSC::JSArray::put): + (JSC::JSArray::putSlowCase): + (JSC::JSArray::deleteProperty): + (JSC::JSArray::getOwnPropertyNames): + (JSC::JSArray::increaseVectorLength): + (JSC::JSArray::setLength): + (JSC::JSArray::pop): + (JSC::JSArray::push): + (JSC::JSArray::sort): + (JSC::JSArray::fillArgList): + (JSC::JSArray::copyToRegisters): + (JSC::JSArray::compactForSorting): + (JSC::JSArray::checkConsistency): + * runtime/JSArray.h: + (JSC::JSArray::canGetIndex): + (JSC::JSArray::canSetIndex): + (JSC::JSArray::setIndex): + (JSC::JSArray::markChildrenDirect): Removed m_fastAccessCutoff, and + replaced with checks for JSValue() to detect reads and writes from / to + uninitialized parts of the array. + +2009-10-02 Jonni Rainisto + + Reviewed by Darin Adler. + + Math.random() gives too low values on Win32 when _CRT_RAND_S is not defined + https://bugs.webkit.org/show_bug.cgi?id=29956 + + * wtf/RandomNumber.cpp: + (WTF::randomNumber): Added PLATFORM(WIN_OS) to handle 15bit rand() + +2009-10-02 Geoffrey Garen + + Reviewed by Sam Weinig. + + Take one branch instead of two to test for JSValue(). + + 1.1% SunSpider speedup. + + * jit/JITCall.cpp: + (JSC::JIT::compileOpCall): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_to_jsnumber): + (JSC::JIT::emit_op_create_arguments): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emitSlow_op_get_by_val): + (JSC::JIT::emit_op_put_by_val): Test for the empty value tag, instead + of testing for the cell tag with a 0 payload. + + * runtime/JSValue.cpp: + (JSC::JSValue::description): Added support for dumping the new empty value, + and deleted values, in debug builds. + + * runtime/JSValue.h: + (JSC::JSValue::JSValue()): Construct JSValue() with the empty value tag. + + (JSC::JSValue::JSValue(JSCell*)): Convert null pointer to the empty value + tag, to avoid having two different c++ versions of null / empty. + + (JSC::JSValue::operator bool): Test for the empty value tag, instead + of testing for the cell tag with a 0 payload. + +2009-10-01 Zoltan Horvath + + Reviewed by Simon Hausmann. + + [Qt] Allow custom memory allocation control for the whole JavaScriptCore + https://bugs.webkit.org/show_bug.cgi?id=27029 + + Since in JavaScriptCore almost every class which has been instantiated by operator new is + inherited from FastAllocBase (bug #20422), we disable customizing global operator new for the Qt-port + when USE_SYSTEM_MALLOC=0. + + Add #include to FastMalloc.cpp because it's used by TCMalloc_PageHeap::scavengerThread(). + (It's needed for the functionality of TCmalloc.) + + Add TCSystemAlloc.cpp to JavaScriptCore.pri if USE_SYSTEM_MALLOC is disabled. + + * JavaScriptCore.pri: + * wtf/FastMalloc.cpp: + (WTF::sleep): + * wtf/FastMalloc.h: + +2009-09-30 Oliver Hunt + + Reviewed by Geoff Garen. + + Devirtualise array toString conversion + + Tweak the implementation of Array.prototype.toString to have a fast path + when acting on a true JSArray. + + * runtime/ArrayPrototype.cpp: + (JSC::arrayProtoFuncToString): + +2009-09-30 Csaba Osztrogonac + + Reviewed by Geoffrey Garen. + + Buildfix for platforms using JSVALUE32. + https://bugs.webkit.org/show_bug.cgi?id=29915 + + After http://trac.webkit.org/changeset/48905 the build broke in JSVALUE32 case. + Also removed unreachable code. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_add): + - Declaration of "OperandTypes types" moved before first use. + - Typos fixed: dst modified to result, regT2 added. + - Unreachable code removed. + (JSC::JIT::emitSlow_op_add): + - Missing declaration of "OperandTypes types" added. + +2009-09-30 Janne Koskinen + + Reviewed by Simon Hausmann. + + Fix CRASH() macro for Symbian build. + + * wtf/Assertions.h: Added missing } + +2009-09-29 Geoffrey Garen + + Reviewed by Sam Weinig. + + Standardized an optimization for adding non-numbers. + + SunSpider says maybe a tiny speedup. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_add): + (JSC::JIT::emitSlow_op_add): + +2009-09-29 Janne Koskinen + + Reviewed by David Kilzer. + + [Qt] Assert messages prints visible in Symbian + https://bugs.webkit.org/show_bug.cgi?id=29808 + + Asserts use vprintf to print the messages to stderr. + In Symbian Open C it is not possible to see stderr so + I routed the messages to stdout instead. + + * wtf/Assertions.cpp: + +2009-09-29 Janne Koskinen + + Reviewed by Darin Adler. + + [Qt] Symbian CRASH macro implementation + + Added Symbian specific crash macro that + stops to crash line if JIT debugging is used. + Additional differentiation of access violation + (KERN-EXEC 3) and CRASH panic. + + * wtf/Assertions.h: + +2009-09-28 Mark Rowe + + Reviewed by Gavin Barraclough. + + JavaScriptCore fails to mark registers when built for x86_64 using LLVM GCC. + + * runtime/Collector.cpp: + (JSC::Heap::markCurrentThreadConservatively): Force jmp_buf to use the appropriate alignment for a pointer + to ensure that we correctly interpret the contents of registers during marking. + +<<<<<<< HEAD:JavaScriptCore/ChangeLog +======= +2009-09-29 Geoffrey Garen + + Reviewed by Gavin Barraclough. + + Inlined a few math operations. + + ~1% SunSpider speedup. + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::compileBinaryArithOpSlowCase): + (JSC::JIT::emitSlow_op_add): + (JSC::JIT::emitSlow_op_mul): + (JSC::JIT::emit_op_sub): + (JSC::JIT::emitSlow_op_sub): Don't take a stub call when operating on + a constant int and a double. + +2009-09-28 Oliver Hunt + + Reviewed by Geoff Garen. + + Hard dependency on SSE2 instruction set with JIT + https://bugs.webkit.org/show_bug.cgi?id=29779 + + Add floating point support checks to op_jfalse and op_jtrue, and + fix the logic for the slow case of op_add + + * jit/JITArithmetic.cpp: + (JSC::JIT::emitSlow_op_add): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_jfalse): + (JSC::JIT::emit_op_jtrue): + +2009-09-28 Yaar Schnitman + + Reviewed by Dimitri Glazkov. + + Chromium port - recognize we are being built independently + of chromium and look for dependencies under webkit/chromium rather + than chromium/src. + + https://bugs.webkit.org/show_bug.cgi?id=29722 + + * JavaScriptCore.gyp/JavaScriptCore.gyp: + +2009-09-28 Jakub Wieczorek + + Reviewed by Simon Hausmann. + + [Qt] Implement XSLT support with QtXmlPatterns. + https://bugs.webkit.org/show_bug.cgi?id=28303 + + * wtf/Platform.h: Add a WTF_USE_QXMLQUERY #define. + +2009-09-28 Yongjun Zhang + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=28054 + + Use derefInNotNull() to work around winscw compiler forward declaration bug + regarding templated classes. + + The compiler bug is reported at + https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=9812. + + The change should be reverted when the above bug is fixed in winscw compiler. + + Add parenthesis around (RefPtr::*UnspecifiedBoolType) to make winscw compiler + work with the default UnSpecifiedBoolType() operator, which removes the winscw hack. + + * wtf/RefPtr.h: + (WTF::RefPtr::~RefPtr): + (WTF::RefPtr::clear): + (WTF::RefPtr::operator UnspecifiedBoolType): + +2009-09-28 Gabor Loki + + Reviewed by Simon Hausmann. + + Remove __clear_cache which is an internal function of GCC + https://bugs.webkit.org/show_bug.cgi?id=28886 + + Although __clear_cache is exported from GCC, this is an internal + function. GCC makes no promises about it. + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + +2009-09-28 Sam Weinig + + Reviewed by Oliver Hunt. + + Fix an absolute path to somewhere in Oliver's machine to a relative path + for derived JSONObject.lut.h. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2009-09-28 Joerg Bornemann + + Reviewed by Simon Hausmann. + + Add ARM version detection for Windows CE. + + * wtf/Platform.h: + +2009-09-26 Yongjun Zhang + + Reviewed by Simon Hausmann. + + Add MarkStackSymbian.cpp to build JavascriptCore for Symbian. + + Re-use Windows shrinkAllocation implementation because Symbian doesn't + support releasing part of memory region. + + Use fastMalloc and fastFree to implement allocateStack and releaseStack + for Symbian port. + + * JavaScriptCore.pri: + * runtime/MarkStack.h: + (JSC::MarkStack::MarkStackArray::shrinkAllocation): + * runtime/MarkStackSymbian.cpp: Added. + (JSC::MarkStack::initializePagesize): + (JSC::MarkStack::allocateStack): + (JSC::MarkStack::releaseStack): + +>>>>>>> 8e5ea20... Hard dependency on SSE2 instruction set with JIT:JavaScriptCore/ChangeLog +2009-09-25 Gabor Loki + + Reviewed by Gavin Barraclough. + + Fix unaligned data access in YARR_JIT on ARMv5 and below. + https://bugs.webkit.org/show_bug.cgi?id=29695 + + On ARMv5 and below all data access should be naturally aligned. + In the YARR_JIT there is a case when character pairs are + loaded from the input string, but this data access is not + naturally aligned. This fix introduces load32WithUnalignedHalfWords + and branch32WithUnalignedHalfWords functions which contain + naturally aligned memory loads - half word loads - on ARMv5 and below. + + * assembler/MacroAssemblerARM.cpp: + (JSC::MacroAssemblerARM::load32WithUnalignedHalfWords): + * assembler/MacroAssemblerARM.h: + (JSC::MacroAssemblerARM::load32WithUnalignedHalfWords): + (JSC::MacroAssemblerARM::branch32WithUnalignedHalfWords): + * assembler/MacroAssemblerARMv7.h: + (JSC::MacroAssemblerARMv7::load32WithUnalignedHalfWords): + (JSC::MacroAssemblerARMv7::branch32): + (JSC::MacroAssemblerARMv7::branch32WithUnalignedHalfWords): + * assembler/MacroAssemblerX86Common.h: + (JSC::MacroAssemblerX86Common::load32WithUnalignedHalfWords): + (JSC::MacroAssemblerX86Common::branch32WithUnalignedHalfWords): + * wtf/Platform.h: + * yarr/RegexJIT.cpp: + (JSC::Yarr::RegexGenerator::generatePatternCharacterPair): + +2009-09-24 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Division is needlessly slow in 64-bit + https://bugs.webkit.org/show_bug.cgi?id=29723 + + Add codegen for op_div on x86-64 + + * jit/JIT.cpp: + (JSC::JIT::privateCompileMainPass): + (JSC::JIT::privateCompileSlowCases): + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::compileBinaryArithOpSlowCase): + (JSC::JIT::emit_op_div): + (JSC::JIT::emitSlow_op_div): + * jit/JITInlineMethods.h: + (JSC::JIT::isOperandConstantImmediateDouble): + (JSC::JIT::addressFor): + (JSC::JIT::emitLoadDouble): + (JSC::JIT::emitLoadInt32ToDouble): + (JSC::JIT::emitJumpSlowCaseIfNotImmediateNumber): + +2009-09-24 Yong Li + + Reviewed by Adam Barth. + + Replace platform-dependent code with WTF::currentTime() + https://bugs.webkit.org/show_bug.cgi?id=29148 + + * jsc.cpp: + (StopWatch::start): + (StopWatch::stop): + (StopWatch::getElapsedMS): + * runtime/TimeoutChecker.cpp: + (JSC::getCPUTime): + +2009-09-24 Mark Rowe + + Reviewed by Gavin Barraclough. + + Fix FastMalloc to build with assertions enabled. + + * wtf/FastMalloc.cpp: + (WTF::TCMalloc_Central_FreeList::ReleaseToSpans): + * wtf/TCSpinLock.h: + (TCMalloc_SpinLock::IsHeld): + +2009-09-24 Mark Rowe + + Reviewed by Sam Weinig. + + FastMalloc scavenging thread should be named + + * wtf/FastMalloc.cpp: + (WTF::TCMalloc_PageHeap::scavengerThread): Set the thread name. + * wtf/Platform.h: Move the knowledge of whether pthread_setname_np exists to here as HAVE(PTHREAD_SETNAME_NP). + * wtf/ThreadingPthreads.cpp: + (WTF::setThreadNameInternal): Use HAVE(PTHREAD_SETNAME_NP). + +2009-09-24 Geoffrey Garen + + Suggested by Darin Adler. + + Removed some unnecessary parameter names. + + * wtf/HashCountedSet.h: + +2009-09-22 Oliver Hunt + + Reviewed by Geoff Garen. + + Code sampling builds are broken. + https://bugs.webkit.org/show_bug.cgi?id=29662 + + Fix build. + + * bytecode/EvalCodeCache.h: + (JSC::EvalCodeCache::get): + * bytecode/SamplingTool.cpp: + (JSC::ScriptSampleRecord::sample): + (JSC::SamplingTool::doRun): + (JSC::SamplingTool::notifyOfScope): + (JSC::compareScriptSampleRecords): + (JSC::SamplingTool::dump): + * bytecode/SamplingTool.h: + (JSC::ScriptSampleRecord::ScriptSampleRecord): + (JSC::ScriptSampleRecord::~ScriptSampleRecord): + (JSC::SamplingTool::SamplingTool): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): + (JSC::BytecodeGenerator::emitNewFunction): + (JSC::BytecodeGenerator::emitNewFunctionExpression): + * bytecompiler/BytecodeGenerator.h: + (JSC::BytecodeGenerator::makeFunction): + * debugger/Debugger.cpp: + (JSC::evaluateInGlobalCallFrame): + * debugger/DebuggerCallFrame.cpp: + (JSC::DebuggerCallFrame::evaluate): + * parser/Nodes.cpp: + (JSC::ScopeNode::ScopeNode): + * runtime/Completion.cpp: + (JSC::checkSyntax): + (JSC::evaluate): + * runtime/Executable.cpp: + (JSC::FunctionExecutable::fromGlobalCode): + * runtime/Executable.h: + (JSC::ScriptExecutable::ScriptExecutable): + (JSC::EvalExecutable::EvalExecutable): + (JSC::EvalExecutable::create): + (JSC::ProgramExecutable::ProgramExecutable): + (JSC::FunctionExecutable::create): + (JSC::FunctionExecutable::FunctionExecutable): + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::globalFuncEval): + +2009-09-22 Darin Adler + + Reviewed by Sam Weinig. + + * wtf/Forward.h: Added PassOwnPtr. + +2009-09-22 Simon Hausmann + + Unreviewed build fix for Windows CE < 5 + + Define WINCEBASIC to disable the IsDebuggerPresent() code in + wtf/Assertions.cpp. + + * JavaScriptCore.pri: + +2009-10-02 Tor Arne Vestbø + + Rubber-stamped by Simon Hausmann. + + Fix the Qt on Mac OS X build. + + * wtf/FastMalloc.cpp: + +2009-10-02 Jørgen Lind + + Reviewed by Simon Hausmann. + + Allow enabling and disabling of the JIT through a qmake variable. + + Qt's configure may set this variable through .qmake.cache if a + commandline option is given and/or the compile test for hwcap.h + failed/succeeded. + + * JavaScriptCore.pri: + +2009-09-23 Geoffrey Garen + + A piece of my last patch that I forgot. + + * wtf/HashCountedSet.h: + (WTF::::clear): Added HashCountedSet::clear. + 2009-09-24 Gabor Loki Reviewed by Gavin Barraclough. @@ -28,6 +543,70 @@ * jit/ExecutableAllocator.h: (JSC::ExecutableAllocator::cacheFlush): +2009-09-21 Oliver Hunt + + Reviewed by Geoff Garen. + + REGRESSION (r48582): Crash in StructureStubInfo::initPutByIdTransition when reloading trac.webkit.org + https://bugs.webkit.org/show_bug.cgi?id=29599 + + It is unsafe to attempt to cache new property transitions on + dictionaries of any type. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::tryCachePutByID): + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCachePutByID): + +2009-09-21 Oliver Hunt + + RS=Maciej Stachowiak. + + Re-land SNES fix with corrected assertion. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::resolveGlobal): + (JSC::Interpreter::tryCachePutByID): + (JSC::Interpreter::tryCacheGetByID): + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCachePutByID): + (JSC::JITThunks::tryCacheGetByID): + (JSC::DEFINE_STUB_FUNCTION): + * runtime/BatchedTransitionOptimizer.h: + (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer): + * runtime/JSObject.cpp: + (JSC::JSObject::removeDirect): + * runtime/Structure.cpp: + (JSC::Structure::Structure): + (JSC::Structure::getEnumerablePropertyNames): + (JSC::Structure::despecifyDictionaryFunction): + (JSC::Structure::addPropertyTransitionToExistingStructure): + (JSC::Structure::addPropertyTransition): + (JSC::Structure::removePropertyTransition): + (JSC::Structure::toDictionaryTransition): + (JSC::Structure::toCacheableDictionaryTransition): + (JSC::Structure::toUncacheableDictionaryTransition): + (JSC::Structure::fromDictionaryTransition): + (JSC::Structure::removePropertyWithoutTransition): + * runtime/Structure.h: + (JSC::Structure::isDictionary): + (JSC::Structure::isUncacheableDictionary): + (JSC::Structure::): + * runtime/StructureChain.cpp: + (JSC::StructureChain::isCacheable): + +2009-09-21 Adam Roben + + Revert r48573, as it caused many assertion failures + + * interpreter/Interpreter.cpp: + * jit/JITStubs.cpp: + * runtime/BatchedTransitionOptimizer.h: + * runtime/JSObject.cpp: + * runtime/Structure.cpp: + * runtime/Structure.h: + * runtime/StructureChain.cpp: + 2009-09-21 Gustavo Noronha Silva Unreviewed make dist build fix. Missing files. diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri index 965f3d6..5c1d518 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri @@ -36,7 +36,6 @@ GENERATED_SOURCES_DIR_SLASH = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP} win32-* { LIBS += -lwinmm } - contains(JAVASCRIPTCORE_JIT,yes): DEFINES+=ENABLE_JIT=1 contains(JAVASCRIPTCORE_JIT,no): DEFINES+=ENABLE_JIT=0 @@ -53,7 +52,10 @@ win32-* { } } -wince*: SOURCES += $$QT_SOURCE_TREE/src/3rdparty/ce-compat/ce_time.cpp +wince* { + SOURCES += $$QT_SOURCE_TREE/src/3rdparty/ce-compat/ce_time.cpp + DEFINES += WINCEBASIC +} include(pcre/pcre.pri) @@ -136,6 +138,10 @@ win32-*|wince* { runtime/MarkStackPosix.cpp } +!contains(DEFINES, USE_SYSTEM_MALLOC) { + SOURCES += wtf/TCSystemAlloc.cpp +} + # AllInOneFile.cpp helps gcc analize and optimize code # Other compilers may be able to do this at link time SOURCES += \ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.cpp index 43648c4..d726ecd 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.cpp @@ -62,6 +62,33 @@ static bool isVFPPresent() const bool MacroAssemblerARM::s_isVFPPresent = isVFPPresent(); +#if defined(ARM_REQUIRE_NATURAL_ALIGNMENT) && ARM_REQUIRE_NATURAL_ALIGNMENT +void MacroAssemblerARM::load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest) +{ + ARMWord op2; + + ASSERT(address.scale >= 0 && address.scale <= 3); + op2 = m_assembler.lsl(address.index, static_cast(address.scale)); + + if (address.offset >= 0 && address.offset + 0x2 <= 0xff) { + m_assembler.add_r(ARMRegisters::S0, address.base, op2); + m_assembler.ldrh_u(dest, ARMRegisters::S0, ARMAssembler::getOp2Byte(address.offset)); + m_assembler.ldrh_u(ARMRegisters::S0, ARMRegisters::S0, ARMAssembler::getOp2Byte(address.offset + 0x2)); + } else if (address.offset < 0 && address.offset >= -0xff) { + m_assembler.add_r(ARMRegisters::S0, address.base, op2); + m_assembler.ldrh_d(dest, ARMRegisters::S0, ARMAssembler::getOp2Byte(-address.offset)); + m_assembler.ldrh_d(ARMRegisters::S0, ARMRegisters::S0, ARMAssembler::getOp2Byte(-address.offset - 0x2)); + } else { + m_assembler.ldr_un_imm(ARMRegisters::S0, address.offset); + m_assembler.add_r(ARMRegisters::S0, ARMRegisters::S0, op2); + m_assembler.ldrh_r(dest, address.base, ARMRegisters::S0); + m_assembler.add_r(ARMRegisters::S0, ARMRegisters::S0, ARMAssembler::OP2_IMM | 0x2); + m_assembler.ldrh_r(ARMRegisters::S0, address.base, ARMRegisters::S0); + } + m_assembler.orr_r(dest, dest, m_assembler.lsl(ARMRegisters::S0, 16)); +} +#endif + } #endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.h b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.h index 0c696c9..aa8cbb0 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.h @@ -198,6 +198,15 @@ public: m_assembler.baseIndexTransfer32(true, dest, address.base, address.index, static_cast(address.scale), address.offset); } +#if defined(ARM_REQUIRE_NATURAL_ALIGNMENT) && ARM_REQUIRE_NATURAL_ALIGNMENT + void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest); +#else + void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest) + { + load32(address, dest); + } +#endif + DataLabel32 load32WithAddressOffsetPatch(Address address, RegisterID dest) { DataLabel32 dataLabel(this); @@ -364,6 +373,12 @@ public: return branch32(cond, ARMRegisters::S1, right); } + Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, Imm32 right) + { + load32WithUnalignedHalfWords(left, ARMRegisters::S1); + return branch32(cond, ARMRegisters::S1, right); + } + Jump branch16(Condition cond, BaseIndex left, RegisterID right) { UNUSED_PARAM(cond); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARMv7.h b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARMv7.h index 999056b..a549604 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARMv7.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARMv7.h @@ -375,6 +375,11 @@ public: load32(setupArmAddress(address), dest); } + void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest) + { + load32(setupArmAddress(address), dest); + } + void load32(void* address, RegisterID dest) { move(ImmPtr(address), addressTempRegister); @@ -717,6 +722,13 @@ public: return branch32(cond, addressTempRegister, right); } + Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, Imm32 right) + { + // use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/ + load32WithUnalignedHalfWords(left, addressTempRegister); + return branch32(cond, addressTempRegister, right); + } + Jump branch32(Condition cond, AbsoluteAddress left, RegisterID right) { load32(left.m_ptr, dataTempRegister); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86Common.h b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86Common.h index 61e0e17..5ebefa7 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86Common.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86Common.h @@ -306,6 +306,11 @@ public: m_assembler.movl_mr(address.offset, address.base, address.index, address.scale, dest); } + void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest) + { + load32(address, dest); + } + DataLabel32 load32WithAddressOffsetPatch(Address address, RegisterID dest) { m_assembler.movl_mr_disp32(address.offset, address.base, dest); @@ -604,6 +609,11 @@ public: return Jump(m_assembler.jCC(x86Condition(cond))); } + Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, Imm32 right) + { + return branch32(cond, left, right); + } + Jump branch16(Condition cond, BaseIndex left, RegisterID right) { m_assembler.cmpw_rm(right, left.offset, left.base, left.index, left.scale); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/EvalCodeCache.h b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/EvalCodeCache.h index 0e1fb1e..05834fc 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/EvalCodeCache.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/EvalCodeCache.h @@ -50,7 +50,7 @@ namespace JSC { evalExecutable = m_cacheMap.get(evalSource.rep()); if (!evalExecutable) { - evalExecutable = EvalExecutable::create(makeSource(evalSource)); + evalExecutable = EvalExecutable::create(exec, makeSource(evalSource)); exceptionValue = evalExecutable->compile(exec, scopeChain); if (exceptionValue) return 0; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.cpp index 8d0faa1..865c919 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.cpp @@ -157,7 +157,7 @@ void SamplingThread::stop() } -void ScopeSampleRecord::sample(CodeBlock* codeBlock, Instruction* vPC) +void ScriptSampleRecord::sample(CodeBlock* codeBlock, Instruction* vPC) { if (!m_samples) { m_size = codeBlock->instructions().size(); @@ -196,8 +196,8 @@ void SamplingTool::doRun() #if ENABLE(CODEBLOCK_SAMPLING) if (CodeBlock* codeBlock = sample.codeBlock()) { - MutexLocker locker(m_scopeSampleMapMutex); - ScopeSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerExecutable()); + MutexLocker locker(m_scriptSampleMapMutex); + ScriptSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerExecutable()); ASSERT(record); record->sample(codeBlock, sample.vPC()); } @@ -209,13 +209,13 @@ void SamplingTool::sample() s_samplingTool->doRun(); } -void SamplingTool::notifyOfScope(ScopeNode* scope) +void SamplingTool::notifyOfScope(ScriptExecutable* script) { #if ENABLE(CODEBLOCK_SAMPLING) - MutexLocker locker(m_scopeSampleMapMutex); - m_scopeSampleMap->set(scope, new ScopeSampleRecord(scope)); + MutexLocker locker(m_scriptSampleMapMutex); + m_scopeSampleMap->set(script, new ScriptSampleRecord(script)); #else - UNUSED_PARAM(scope); + UNUSED_PARAM(script); #endif } @@ -254,10 +254,10 @@ static int compareLineCountInfoSampling(const void* left, const void* right) return (leftLineCount->line > rightLineCount->line) ? 1 : (leftLineCount->line < rightLineCount->line) ? -1 : 0; } -static int compareScopeSampleRecords(const void* left, const void* right) +static int compareScriptSampleRecords(const void* left, const void* right) { - const ScopeSampleRecord* const leftValue = *static_cast(left); - const ScopeSampleRecord* const rightValue = *static_cast(right); + const ScriptSampleRecord* const leftValue = *static_cast(left); + const ScriptSampleRecord* const rightValue = *static_cast(right); return (leftValue->m_sampleCount < rightValue->m_sampleCount) ? 1 : (leftValue->m_sampleCount > rightValue->m_sampleCount) ? -1 : 0; } @@ -318,26 +318,26 @@ void SamplingTool::dump(ExecState* exec) // (3) Build and sort 'codeBlockSamples' array. int scopeCount = m_scopeSampleMap->size(); - Vector codeBlockSamples(scopeCount); - ScopeSampleRecordMap::iterator iter = m_scopeSampleMap->begin(); + Vector codeBlockSamples(scopeCount); + ScriptSampleRecordMap::iterator iter = m_scopeSampleMap->begin(); for (int i = 0; i < scopeCount; ++i, ++iter) codeBlockSamples[i] = iter->second; - qsort(codeBlockSamples.begin(), scopeCount, sizeof(ScopeSampleRecord*), compareScopeSampleRecords); + qsort(codeBlockSamples.begin(), scopeCount, sizeof(ScriptSampleRecord*), compareScriptSampleRecords); // (4) Print data from 'codeBlockSamples' array. printf("\nCodeBlock samples\n\n"); for (int i = 0; i < scopeCount; ++i) { - ScopeSampleRecord* record = codeBlockSamples[i]; + ScriptSampleRecord* record = codeBlockSamples[i]; CodeBlock* codeBlock = record->m_codeBlock; double blockPercent = (record->m_sampleCount * 100.0) / m_sampleCount; if (blockPercent >= 1) { //Instruction* code = codeBlock->instructions().begin(); - printf("#%d: %s:%d: %d / %lld (%.3f%%)\n", i + 1, record->m_scope->sourceURL().UTF8String().c_str(), codeBlock->lineNumberForBytecodeOffset(exec, 0), record->m_sampleCount, m_sampleCount, blockPercent); + printf("#%d: %s:%d: %d / %lld (%.3f%%)\n", i + 1, record->m_executable->sourceURL().UTF8String().c_str(), codeBlock->lineNumberForBytecodeOffset(exec, 0), record->m_sampleCount, m_sampleCount, blockPercent); if (i < 10) { HashMap lineCounts; codeBlock->dump(exec); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.h b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.h index 1a3f7cf..711b086 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.h @@ -38,6 +38,8 @@ namespace JSC { + class ScriptExecutable; + class SamplingFlags { friend class JIT; public: @@ -92,9 +94,9 @@ namespace JSC { class ScopeNode; struct Instruction; - struct ScopeSampleRecord { - ScopeSampleRecord(ScopeNode* scope) - : m_scope(scope) + struct ScriptSampleRecord { + ScriptSampleRecord(ScriptExecutable* executable) + : m_executable(executable) , m_codeBlock(0) , m_sampleCount(0) , m_opcodeSampleCount(0) @@ -103,7 +105,7 @@ namespace JSC { { } - ~ScopeSampleRecord() + ~ScriptSampleRecord() { if (m_samples) free(m_samples); @@ -111,7 +113,7 @@ namespace JSC { void sample(CodeBlock*, Instruction*); - RefPtr m_scope; + ScriptExecutable* m_executable; CodeBlock* m_codeBlock; int m_sampleCount; int m_opcodeSampleCount; @@ -119,7 +121,7 @@ namespace JSC { unsigned m_size; }; - typedef WTF::HashMap ScopeSampleRecordMap; + typedef WTF::HashMap ScriptSampleRecordMap; class SamplingThread { public: @@ -193,7 +195,7 @@ namespace JSC { , m_sampleCount(0) , m_opcodeSampleCount(0) #if ENABLE(CODEBLOCK_SAMPLING) - , m_scopeSampleMap(new ScopeSampleRecordMap()) + , m_scopeSampleMap(new ScriptSampleRecordMap()) #endif { memset(m_opcodeSamples, 0, sizeof(m_opcodeSamples)); @@ -210,7 +212,7 @@ namespace JSC { void setup(); void dump(ExecState*); - void notifyOfScope(ScopeNode* scope); + void notifyOfScope(ScriptExecutable* scope); void sample(CodeBlock* codeBlock, Instruction* vPC) { @@ -266,8 +268,8 @@ namespace JSC { unsigned m_opcodeSamplesInCTIFunctions[numOpcodeIDs]; #if ENABLE(CODEBLOCK_SAMPLING) - Mutex m_scopeSampleMapMutex; - OwnPtr m_scopeSampleMap; + Mutex m_scriptSampleMapMutex; + OwnPtr m_scopeSampleMap; #endif }; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 74bf4f8..10a1136 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -273,7 +273,7 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d } else { for (size_t i = 0; i < functionStack.size(); ++i) { FunctionBodyNode* function = functionStack[i]; - globalObject->putWithAttributes(exec, function->ident(), new (exec) JSFunction(exec, makeFunction(function), scopeChain.node()), DontDelete); + globalObject->putWithAttributes(exec, function->ident(), new (exec) JSFunction(exec, makeFunction(exec, function), scopeChain.node()), DontDelete); } for (size_t i = 0; i < varStack.size(); ++i) { if (globalObject->hasProperty(exec, *varStack[i].first)) @@ -399,7 +399,7 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const Debugger* debugge const DeclarationStacks::FunctionStack& functionStack = evalNode->functionStack(); for (size_t i = 0; i < functionStack.size(); ++i) - m_codeBlock->addFunctionDecl(makeFunction(functionStack[i])); + m_codeBlock->addFunctionDecl(makeFunction(m_globalData, functionStack[i])); const DeclarationStacks::VarStack& varStack = evalNode->varStack(); unsigned numVariables = varStack.size(); @@ -1316,7 +1316,7 @@ RegisterID* BytecodeGenerator::emitNewArray(RegisterID* dst, ElementNode* elemen RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FunctionBodyNode* function) { - unsigned index = m_codeBlock->addFunctionDecl(makeFunction(function)); + unsigned index = m_codeBlock->addFunctionDecl(makeFunction(m_globalData, function)); emitOpcode(op_new_func); instructions().append(dst->index()); @@ -1336,7 +1336,7 @@ RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp) RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNode* n) { FunctionBodyNode* function = n->body(); - unsigned index = m_codeBlock->addFunctionExpr(makeFunction(function)); + unsigned index = m_codeBlock->addFunctionExpr(makeFunction(m_globalData, function)); emitOpcode(op_new_func_exp); instructions().append(r0->index()); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.h index 935787c..f614f0b 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.h @@ -417,9 +417,14 @@ namespace JSC { RegisterID* addConstantValue(JSValue); unsigned addRegExp(RegExp*); - PassRefPtr makeFunction(FunctionBodyNode* body) + PassRefPtr makeFunction(ExecState* exec, FunctionBodyNode* body) { - return FunctionExecutable::create(body->ident(), body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); + return FunctionExecutable::create(exec, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); + } + + PassRefPtr makeFunction(JSGlobalData* globalData, FunctionBodyNode* body) + { + return FunctionExecutable::create(globalData, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); } Vector& instructions() { return m_codeBlock->instructions(); } diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.cpp index 61167d4..db02329 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.cpp @@ -100,7 +100,7 @@ JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSG { CallFrame* globalCallFrame = globalObject->globalExec(); - EvalExecutable eval(makeSource(script)); + EvalExecutable eval(globalCallFrame, makeSource(script)); JSObject* error = eval.compile(globalCallFrame, globalCallFrame->scopeChain()); if (error) return error; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/debugger/DebuggerCallFrame.cpp index 9c8ca2a..88b14e6 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/debugger/DebuggerCallFrame.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/debugger/DebuggerCallFrame.cpp @@ -79,7 +79,7 @@ JSValue DebuggerCallFrame::evaluate(const UString& script, JSValue& exception) c if (!m_callFrame->codeBlock()) return JSValue(); - EvalExecutable eval(makeSource(script)); + EvalExecutable eval(m_callFrame, makeSource(script)); JSObject* error = eval.compile(m_callFrame, m_callFrame->scopeChain()); if (error) return error; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp index 76c8510..4f00b2b 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp @@ -1026,6 +1026,10 @@ NEVER_INLINE void Interpreter::tryCachePutByID(CallFrame* callFrame, CodeBlock* // Structure transition, cache transition info if (slot.type() == PutPropertySlot::NewProperty) { + if (structure->isDictionary()) { + vPC[0] = getOpcode(op_put_by_id_generic); + return; + } vPC[0] = getOpcode(op_put_by_id_transition); vPC[4] = structure->previousID(); vPC[5] = structure; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.cpp index bf3a418..ea8434e 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.cpp @@ -195,7 +195,7 @@ void JIT::privateCompileMainPass() switch (m_interpreter->getOpcodeID(currentInstruction->u.opcode)) { DEFINE_BINARY_OP(op_del_by_val) -#if !USE(JSVALUE32_64) +#if USE(JSVALUE32) DEFINE_BINARY_OP(op_div) #endif DEFINE_BINARY_OP(op_in) @@ -230,7 +230,7 @@ void JIT::privateCompileMainPass() DEFINE_OP(op_create_arguments) DEFINE_OP(op_debug) DEFINE_OP(op_del_by_id) -#if USE(JSVALUE32_64) +#if !USE(JSVALUE32) DEFINE_OP(op_div) #endif DEFINE_OP(op_end) @@ -379,7 +379,7 @@ void JIT::privateCompileSlowCases() DEFINE_SLOWCASE_OP(op_construct) DEFINE_SLOWCASE_OP(op_construct_verify) DEFINE_SLOWCASE_OP(op_convert_this) -#if USE(JSVALUE32_64) +#if !USE(JSVALUE32) DEFINE_SLOWCASE_OP(op_div) #endif DEFINE_SLOWCASE_OP(op_eq) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.h b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.h index 5c58e9d..fcbc45e 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.h @@ -379,14 +379,18 @@ namespace JSC { enum CompileOpStrictEqType { OpStrictEq, OpNStrictEq }; void compileOpStrictEq(Instruction* instruction, CompileOpStrictEqType type); + bool isOperandConstantImmediateDouble(unsigned src); + + void emitLoadDouble(unsigned index, FPRegisterID value); + void emitLoadInt32ToDouble(unsigned index, FPRegisterID value); + + Address addressFor(unsigned index, RegisterID base = callFrameRegister); #if USE(JSVALUE32_64) Address tagFor(unsigned index, RegisterID base = callFrameRegister); Address payloadFor(unsigned index, RegisterID base = callFrameRegister); - Address addressFor(unsigned index, RegisterID base = callFrameRegister); bool getOperandConstantImmediateInt(unsigned op1, unsigned op2, unsigned& op, int32_t& constant); - bool isOperandConstantImmediateDouble(unsigned src); void emitLoadTag(unsigned index, RegisterID tag); void emitLoadPayload(unsigned index, RegisterID payload); @@ -394,8 +398,6 @@ namespace JSC { void emitLoad(const JSValue& v, RegisterID tag, RegisterID payload); void emitLoad(unsigned index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister); void emitLoad2(unsigned index1, RegisterID tag1, RegisterID payload1, unsigned index2, RegisterID tag2, RegisterID payload2); - void emitLoadDouble(unsigned index, FPRegisterID value); - void emitLoadInt32ToDouble(unsigned index, FPRegisterID value); void emitStore(unsigned index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister); void emitStore(unsigned index, const JSValue constant, RegisterID base = callFrameRegister); @@ -499,6 +501,7 @@ namespace JSC { JIT::Jump emitJumpIfNotImmediateInteger(RegisterID); JIT::Jump emitJumpIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID); void emitJumpSlowCaseIfNotImmediateInteger(RegisterID); + void emitJumpSlowCaseIfNotImmediateNumber(RegisterID); void emitJumpSlowCaseIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID); #if !USE(JSVALUE64) @@ -511,7 +514,11 @@ namespace JSC { void emitTagAsBoolImmediate(RegisterID reg); void compileBinaryArithOp(OpcodeID, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi); - void compileBinaryArithOpSlowCase(OpcodeID, Vector::iterator&, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi); +#if USE(JSVALUE64) + void compileBinaryArithOpSlowCase(OpcodeID, Vector::iterator&, unsigned dst, unsigned src1, unsigned src2, OperandTypes, bool op1HasImmediateIntFastCase, bool op2HasImmediateIntFastCase); +#else + void compileBinaryArithOpSlowCase(OpcodeID, Vector::iterator&, unsigned dst, unsigned src1, unsigned src2, OperandTypes); +#endif #if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) void compileGetByIdHotPath(int resultVReg, int baseVReg, Identifier* ident, unsigned propertyAccessInstructionIndex); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITArithmetic.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITArithmetic.cpp index 3be13cb..7afc1f2 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITArithmetic.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITArithmetic.cpp @@ -566,6 +566,14 @@ void JIT::emit_op_add(Instruction* currentInstruction) unsigned op2 = currentInstruction[3].u.operand; OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); + if (!types.first().mightBeNumber() || !types.second().mightBeNumber()) { + JITStubCall stubCall(this, cti_op_add); + stubCall.addArgument(op1); + stubCall.addArgument(op2); + stubCall.call(dst); + return; + } + JumpList notInt32Op1; JumpList notInt32Op2; @@ -630,19 +638,21 @@ void JIT::emitSlow_op_add(Instruction* currentInstruction, Vector unsigned op2 = currentInstruction[3].u.operand; OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); + if (!types.first().mightBeNumber() || !types.second().mightBeNumber()) + return; + unsigned op; int32_t constant; if (getOperandConstantImmediateInt(op1, op2, op, constant)) { linkSlowCase(iter); // overflow check - if (!supportsFloatingPoint()) { + if (!supportsFloatingPoint()) linkSlowCase(iter); // non-sse case - return; + else { + ResultType opType = op == op1 ? types.first() : types.second(); + if (!opType.definitelyIsNumber()) + linkSlowCase(iter); // double check } - - ResultType opType = op == op1 ? types.first() : types.second(); - if (!opType.definitelyIsNumber()) - linkSlowCase(iter); // double check } else { linkSlowCase(iter); // overflow check @@ -1932,55 +1942,87 @@ void JIT::compileBinaryArithOp(OpcodeID opcodeID, unsigned, unsigned op1, unsign emitFastArithIntToImmNoCheck(regT0, regT0); } -void JIT::compileBinaryArithOpSlowCase(OpcodeID opcodeID, Vector::iterator& iter, unsigned result, unsigned op1, unsigned, OperandTypes types) +void JIT::compileBinaryArithOpSlowCase(OpcodeID opcodeID, Vector::iterator& iter, unsigned result, unsigned op1, unsigned op2, OperandTypes types, bool op1HasImmediateIntFastCase, bool op2HasImmediateIntFastCase) { // We assume that subtracting TagTypeNumber is equivalent to adding DoubleEncodeOffset. COMPILE_ASSERT(((JSImmediate::TagTypeNumber + JSImmediate::DoubleEncodeOffset) == 0), TagTypeNumber_PLUS_DoubleEncodeOffset_EQUALS_0); - - Jump notImm1 = getSlowCase(iter); - Jump notImm2 = getSlowCase(iter); + + Jump notImm1; + Jump notImm2; + if (op1HasImmediateIntFastCase) { + notImm2 = getSlowCase(iter); + } else if (op2HasImmediateIntFastCase) { + notImm1 = getSlowCase(iter); + } else { + notImm1 = getSlowCase(iter); + notImm2 = getSlowCase(iter); + } linkSlowCase(iter); // Integer overflow case - we could handle this in JIT code, but this is likely rare. - if (opcodeID == op_mul) // op_mul has an extra slow case to handle 0 * negative number. + if (opcodeID == op_mul && !op1HasImmediateIntFastCase && !op2HasImmediateIntFastCase) // op_mul has an extra slow case to handle 0 * negative number. linkSlowCase(iter); emitGetVirtualRegister(op1, regT0); Label stubFunctionCall(this); JITStubCall stubCall(this, opcodeID == op_add ? cti_op_add : opcodeID == op_sub ? cti_op_sub : cti_op_mul); + if (op1HasImmediateIntFastCase || op2HasImmediateIntFastCase) { + emitGetVirtualRegister(op1, regT0); + emitGetVirtualRegister(op2, regT1); + } stubCall.addArgument(regT0); stubCall.addArgument(regT1); stubCall.call(result); Jump end = jump(); - // if we get here, eax is not an int32, edx not yet checked. - notImm1.link(this); - if (!types.first().definitelyIsNumber()) - emitJumpIfNotImmediateNumber(regT0).linkTo(stubFunctionCall, this); - if (!types.second().definitelyIsNumber()) - emitJumpIfNotImmediateNumber(regT1).linkTo(stubFunctionCall, this); - addPtr(tagTypeNumberRegister, regT0); - movePtrToDouble(regT0, fpRegT1); - Jump op2isDouble = emitJumpIfNotImmediateInteger(regT1); - convertInt32ToDouble(regT1, fpRegT2); - Jump op2wasInteger = jump(); - - // if we get here, eax IS an int32, edx is not. - notImm2.link(this); - if (!types.second().definitelyIsNumber()) - emitJumpIfNotImmediateNumber(regT1).linkTo(stubFunctionCall, this); - convertInt32ToDouble(regT0, fpRegT1); - op2isDouble.link(this); - addPtr(tagTypeNumberRegister, regT1); - movePtrToDouble(regT1, fpRegT2); - op2wasInteger.link(this); + if (op1HasImmediateIntFastCase) { + notImm2.link(this); + if (!types.second().definitelyIsNumber()) + emitJumpIfNotImmediateNumber(regT0).linkTo(stubFunctionCall, this); + emitGetVirtualRegister(op1, regT1); + convertInt32ToDouble(regT1, fpRegT1); + addPtr(tagTypeNumberRegister, regT0); + movePtrToDouble(regT0, fpRegT2); + } else if (op2HasImmediateIntFastCase) { + notImm1.link(this); + if (!types.first().definitelyIsNumber()) + emitJumpIfNotImmediateNumber(regT0).linkTo(stubFunctionCall, this); + emitGetVirtualRegister(op2, regT1); + convertInt32ToDouble(regT1, fpRegT1); + addPtr(tagTypeNumberRegister, regT0); + movePtrToDouble(regT0, fpRegT2); + } else { + // if we get here, eax is not an int32, edx not yet checked. + notImm1.link(this); + if (!types.first().definitelyIsNumber()) + emitJumpIfNotImmediateNumber(regT0).linkTo(stubFunctionCall, this); + if (!types.second().definitelyIsNumber()) + emitJumpIfNotImmediateNumber(regT1).linkTo(stubFunctionCall, this); + addPtr(tagTypeNumberRegister, regT0); + movePtrToDouble(regT0, fpRegT1); + Jump op2isDouble = emitJumpIfNotImmediateInteger(regT1); + convertInt32ToDouble(regT1, fpRegT2); + Jump op2wasInteger = jump(); + + // if we get here, eax IS an int32, edx is not. + notImm2.link(this); + if (!types.second().definitelyIsNumber()) + emitJumpIfNotImmediateNumber(regT1).linkTo(stubFunctionCall, this); + convertInt32ToDouble(regT0, fpRegT1); + op2isDouble.link(this); + addPtr(tagTypeNumberRegister, regT1); + movePtrToDouble(regT1, fpRegT2); + op2wasInteger.link(this); + } if (opcodeID == op_add) addDouble(fpRegT2, fpRegT1); else if (opcodeID == op_sub) subDouble(fpRegT2, fpRegT1); - else { - ASSERT(opcodeID == op_mul); + else if (opcodeID == op_mul) mulDouble(fpRegT2, fpRegT1); + else { + ASSERT(opcodeID == op_div); + divDouble(fpRegT2, fpRegT1); } moveDoubleToPtr(fpRegT1, regT0); subPtr(tagTypeNumberRegister, regT0); @@ -2025,16 +2067,14 @@ void JIT::emitSlow_op_add(Instruction* currentInstruction, Vector unsigned result = currentInstruction[1].u.operand; unsigned op1 = currentInstruction[2].u.operand; unsigned op2 = currentInstruction[3].u.operand; + OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); - if (isOperandConstantImmediateInt(op1) || isOperandConstantImmediateInt(op2)) { - linkSlowCase(iter); - linkSlowCase(iter); - JITStubCall stubCall(this, cti_op_add); - stubCall.addArgument(op1, regT2); - stubCall.addArgument(op2, regT2); - stubCall.call(result); - } else - compileBinaryArithOpSlowCase(op_add, iter, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand)); + if (!types.first().mightBeNumber() || !types.second().mightBeNumber()) + return; + + bool op1HasImmediateIntFastCase = isOperandConstantImmediateInt(op1); + bool op2HasImmediateIntFastCase = !op1HasImmediateIntFastCase && isOperandConstantImmediateInt(op2); + compileBinaryArithOpSlowCase(op_add, iter, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand), op1HasImmediateIntFastCase, op2HasImmediateIntFastCase); } void JIT::emit_op_mul(Instruction* currentInstruction) @@ -2069,17 +2109,106 @@ void JIT::emitSlow_op_mul(Instruction* currentInstruction, Vector unsigned op2 = currentInstruction[3].u.operand; OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); - if ((isOperandConstantImmediateInt(op1) && (getConstantOperandImmediateInt(op1) > 0)) - || (isOperandConstantImmediateInt(op2) && (getConstantOperandImmediateInt(op2) > 0))) { - linkSlowCase(iter); - linkSlowCase(iter); - // There is an extra slow case for (op1 * -N) or (-N * op2), to check for 0 since this should produce a result of -0. - JITStubCall stubCall(this, cti_op_mul); - stubCall.addArgument(op1, regT2); - stubCall.addArgument(op2, regT2); - stubCall.call(result); - } else - compileBinaryArithOpSlowCase(op_mul, iter, result, op1, op2, types); + bool op1HasImmediateIntFastCase = isOperandConstantImmediateInt(op1) && getConstantOperandImmediateInt(op1) > 0; + bool op2HasImmediateIntFastCase = !op1HasImmediateIntFastCase && isOperandConstantImmediateInt(op2) && getConstantOperandImmediateInt(op2) > 0; + compileBinaryArithOpSlowCase(op_mul, iter, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand), op1HasImmediateIntFastCase, op2HasImmediateIntFastCase); +} + +void JIT::emit_op_div(Instruction* currentInstruction) +{ + unsigned dst = currentInstruction[1].u.operand; + unsigned op1 = currentInstruction[2].u.operand; + unsigned op2 = currentInstruction[3].u.operand; + OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); + + if (isOperandConstantImmediateDouble(op1)) { + emitGetVirtualRegister(op1, regT0); + addPtr(tagTypeNumberRegister, regT0); + movePtrToDouble(regT0, fpRegT0); + } else if (isOperandConstantImmediateInt(op1)) { + emitLoadInt32ToDouble(op1, fpRegT0); + } else { + emitGetVirtualRegister(op1, regT0); + if (!types.first().definitelyIsNumber()) + emitJumpSlowCaseIfNotImmediateNumber(regT0); + Jump notInt = emitJumpIfNotImmediateInteger(regT0); + convertInt32ToDouble(regT0, fpRegT0); + Jump skipDoubleLoad = jump(); + notInt.link(this); + addPtr(tagTypeNumberRegister, regT0); + movePtrToDouble(regT0, fpRegT0); + skipDoubleLoad.link(this); + } + + if (isOperandConstantImmediateDouble(op2)) { + emitGetVirtualRegister(op2, regT1); + addPtr(tagTypeNumberRegister, regT1); + movePtrToDouble(regT1, fpRegT1); + } else if (isOperandConstantImmediateInt(op2)) { + emitLoadInt32ToDouble(op2, fpRegT1); + } else { + emitGetVirtualRegister(op2, regT1); + if (!types.second().definitelyIsNumber()) + emitJumpSlowCaseIfNotImmediateNumber(regT1); + Jump notInt = emitJumpIfNotImmediateInteger(regT1); + convertInt32ToDouble(regT1, fpRegT1); + Jump skipDoubleLoad = jump(); + notInt.link(this); + addPtr(tagTypeNumberRegister, regT1); + movePtrToDouble(regT1, fpRegT1); + skipDoubleLoad.link(this); + } + divDouble(fpRegT1, fpRegT0); + + JumpList doubleResult; + Jump end; + bool attemptIntConversion = (!isOperandConstantImmediateInt(op1) || getConstantOperand(op1).asInt32() > 1) && isOperandConstantImmediateInt(op2); + if (attemptIntConversion) { + m_assembler.cvttsd2si_rr(fpRegT0, regT0); + doubleResult.append(branchTest32(Zero, regT0)); + m_assembler.ucomisd_rr(fpRegT1, fpRegT0); + + doubleResult.append(m_assembler.jne()); + doubleResult.append(m_assembler.jp()); + emitFastArithIntToImmNoCheck(regT0, regT0); + end = jump(); + } + + // Double result. + doubleResult.link(this); + moveDoubleToPtr(fpRegT0, regT0); + subPtr(tagTypeNumberRegister, regT0); + + if (attemptIntConversion) + end.link(this); + emitPutVirtualRegister(dst, regT0); +} + +void JIT::emitSlow_op_div(Instruction* currentInstruction, Vector::iterator& iter) +{ + unsigned result = currentInstruction[1].u.operand; + unsigned op1 = currentInstruction[2].u.operand; + unsigned op2 = currentInstruction[3].u.operand; + OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); + if (types.first().definitelyIsNumber() && types.second().definitelyIsNumber()) { +#ifndef NDEBUG + breakpoint(); +#endif + return; + } + if (!isOperandConstantImmediateDouble(op1) && !isOperandConstantImmediateInt(op1)) { + if (!types.first().definitelyIsNumber()) + linkSlowCase(iter); + } + if (!isOperandConstantImmediateDouble(op2) && !isOperandConstantImmediateInt(op2)) { + if (!types.second().definitelyIsNumber()) + linkSlowCase(iter); + } + // There is an extra slow case for (op1 * -N) or (-N * op2), to check for 0 since this should produce a result of -0. + JITStubCall stubCall(this, cti_op_div); + stubCall.addArgument(op1, regT2); + stubCall.addArgument(op2, regT2); + stubCall.call(result); } void JIT::emit_op_sub(Instruction* currentInstruction) @@ -2090,7 +2219,6 @@ void JIT::emit_op_sub(Instruction* currentInstruction) OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); compileBinaryArithOp(op_sub, result, op1, op2, types); - emitPutVirtualRegister(result); } @@ -2101,7 +2229,7 @@ void JIT::emitSlow_op_sub(Instruction* currentInstruction, Vector unsigned op2 = currentInstruction[3].u.operand; OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); - compileBinaryArithOpSlowCase(op_sub, iter, result, op1, op2, types); + compileBinaryArithOpSlowCase(op_sub, iter, result, op1, op2, types, false, false); } #else // USE(JSVALUE64) @@ -2284,6 +2412,15 @@ void JIT::emit_op_add(Instruction* currentInstruction) unsigned result = currentInstruction[1].u.operand; unsigned op1 = currentInstruction[2].u.operand; unsigned op2 = currentInstruction[3].u.operand; + OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); + + if (!types.first().mightBeNumber() || !types.second().mightBeNumber()) { + JITStubCall stubCall(this, cti_op_add); + stubCall.addArgument(op1, regT2); + stubCall.addArgument(op2, regT2); + stubCall.call(result); + return; + } if (isOperandConstantImmediateInt(op1)) { emitGetVirtualRegister(op2, regT0); @@ -2298,15 +2435,7 @@ void JIT::emit_op_add(Instruction* currentInstruction) signExtend32ToPtr(regT0, regT0); emitPutVirtualRegister(result); } else { - OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); - if (types.first().mightBeNumber() && types.second().mightBeNumber()) - compileBinaryArithOp(op_add, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand)); - else { - JITStubCall stubCall(this, cti_op_add); - stubCall.addArgument(op1, regT2); - stubCall.addArgument(op2, regT2); - stubCall.call(result); - } + compileBinaryArithOp(op_add, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand)); } } @@ -2316,6 +2445,10 @@ void JIT::emitSlow_op_add(Instruction* currentInstruction, Vector unsigned op1 = currentInstruction[2].u.operand; unsigned op2 = currentInstruction[3].u.operand; + OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); + if (!types.first().mightBeNumber() || !types.second().mightBeNumber()) + return; + if (isOperandConstantImmediateInt(op1)) { Jump notImm = getSlowCase(iter); linkSlowCase(iter); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITCall.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITCall.cpp index 5bcde42..f4f6e62 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITCall.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITCall.cpp @@ -242,16 +242,14 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned) int argCount = instruction[3].u.operand; int registerOffset = instruction[4].u.operand; - Jump wasEval1; - Jump wasEval2; + Jump wasEval; if (opcodeID == op_call_eval) { JITStubCall stubCall(this, cti_op_call_eval); stubCall.addArgument(callee); stubCall.addArgument(JIT::Imm32(registerOffset)); stubCall.addArgument(JIT::Imm32(argCount)); stubCall.call(); - wasEval1 = branchTest32(NonZero, regT0); - wasEval2 = branch32(NotEqual, regT1, Imm32(JSValue::CellTag)); + wasEval = branch32(Equal, regT1, Imm32(JSValue::EmptyValueTag)); } emitLoad(callee, regT1, regT2); @@ -277,10 +275,8 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned) emitNakedCall(m_globalData->jitStubs.ctiVirtualCall()); - if (opcodeID == op_call_eval) { - wasEval1.link(this); - wasEval2.link(this); - } + if (opcodeID == op_call_eval) + wasEval.link(this); emitStore(dst, regT1, regT0);; @@ -312,16 +308,14 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca int argCount = instruction[3].u.operand; int registerOffset = instruction[4].u.operand; - Jump wasEval1; - Jump wasEval2; + Jump wasEval; if (opcodeID == op_call_eval) { JITStubCall stubCall(this, cti_op_call_eval); stubCall.addArgument(callee); stubCall.addArgument(JIT::Imm32(registerOffset)); stubCall.addArgument(JIT::Imm32(argCount)); stubCall.call(); - wasEval1 = branchTest32(NonZero, regT0); - wasEval2 = branch32(NotEqual, regT1, Imm32(JSValue::CellTag)); + wasEval = branch32(NotEqual, regT1, Imm32(JSValue::EmptyValueTag)); } emitLoad(callee, regT1, regT0); @@ -365,10 +359,8 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca // Call to the callee m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall(); - if (opcodeID == op_call_eval) { - wasEval1.link(this); - wasEval2.link(this); - } + if (opcodeID == op_call_eval) + wasEval.link(this); // Put the return value in dst. In the interpreter, op_ret does this. emitStore(dst, regT1, regT0); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITInlineMethods.h b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITInlineMethods.h index e69e273..f26457a 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITInlineMethods.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITInlineMethods.h @@ -65,6 +65,11 @@ ALWAYS_INLINE void JIT::emitGetJITStubArg(unsigned argumentNumber, RegisterID ds peek(dst, argumentStackOffset); } +ALWAYS_INLINE bool JIT::isOperandConstantImmediateDouble(unsigned src) +{ + return m_codeBlock->isConstantRegisterIndex(src) && getConstantOperand(src).isDouble(); +} + ALWAYS_INLINE JSValue JIT::getConstantOperand(unsigned src) { ASSERT(m_codeBlock->isConstantRegisterIndex(src)); @@ -305,6 +310,11 @@ ALWAYS_INLINE void JIT::sampleCodeBlock(CodeBlock* codeBlock) #endif #endif +inline JIT::Address JIT::addressFor(unsigned index, RegisterID base) +{ + return Address(base, (index * sizeof(Register))); +} + #if USE(JSVALUE32_64) inline JIT::Address JIT::tagFor(unsigned index, RegisterID base) @@ -317,11 +327,6 @@ inline JIT::Address JIT::payloadFor(unsigned index, RegisterID base) return Address(base, (index * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)); } -inline JIT::Address JIT::addressFor(unsigned index, RegisterID base) -{ - return Address(base, (index * sizeof(Register))); -} - inline void JIT::emitLoadTag(unsigned index, RegisterID tag) { RegisterID mappedTag; @@ -579,11 +584,6 @@ ALWAYS_INLINE bool JIT::getOperandConstantImmediateInt(unsigned op1, unsigned op return false; } -ALWAYS_INLINE bool JIT::isOperandConstantImmediateDouble(unsigned src) -{ - return m_codeBlock->isConstantRegisterIndex(src) && getConstantOperand(src).isDouble(); -} - /* Deprecated: Please use JITStubCall instead. */ ALWAYS_INLINE void JIT::emitPutJITStubArg(RegisterID tag, RegisterID payload, unsigned argumentNumber) @@ -732,6 +732,24 @@ ALWAYS_INLINE JIT::Jump JIT::emitJumpIfNotImmediateNumber(RegisterID reg) { return branchTestPtr(Zero, reg, tagTypeNumberRegister); } + +inline void JIT::emitLoadDouble(unsigned index, FPRegisterID value) +{ + if (m_codeBlock->isConstantRegisterIndex(index)) { + Register& inConstantPool = m_codeBlock->constantRegister(index); + loadDouble(&inConstantPool, value); + } else + loadDouble(addressFor(index), value); +} + +inline void JIT::emitLoadInt32ToDouble(unsigned index, FPRegisterID value) +{ + if (m_codeBlock->isConstantRegisterIndex(index)) { + Register& inConstantPool = m_codeBlock->constantRegister(index); + convertInt32ToDouble(AbsoluteAddress(&inConstantPool), value); + } else + convertInt32ToDouble(addressFor(index), value); +} #endif ALWAYS_INLINE JIT::Jump JIT::emitJumpIfImmediateInteger(RegisterID reg) @@ -769,6 +787,11 @@ ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotImmediateIntegers(RegisterID reg1, addSlowCase(emitJumpIfNotImmediateIntegers(reg1, reg2, scratch)); } +ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotImmediateNumber(RegisterID reg) +{ + addSlowCase(emitJumpIfNotImmediateNumber(reg)); +} + #if !USE(JSVALUE64) ALWAYS_INLINE void JIT::emitFastArithDeTagImmediate(RegisterID reg) { diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITOpcodes.cpp index 34debcb..b5f6597 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITOpcodes.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITOpcodes.cpp @@ -248,10 +248,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr* executable addPtr(Imm32(NativeCallFrameSize - sizeof(NativeFunctionCalleeSignature)), stackPointerRegister); // Check for an exception - // FIXME: Maybe we can optimize this comparison to JSValue(). move(ImmPtr(&globalData->exception), regT2); - Jump sawException1 = branch32(NotEqual, tagFor(0, regT2), Imm32(JSValue::CellTag)); - Jump sawException2 = branch32(NonZero, payloadFor(0, regT2), Imm32(0)); + Jump sawException = branch32(NotEqual, tagFor(0, regT2), Imm32(JSValue::EmptyValueTag)); // Grab the return address. emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT3); @@ -264,8 +262,7 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr* executable ret(); // Handle an exception - sawException1.link(this); - sawException2.link(this); + sawException.link(this); // Grab the return address. emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT1); move(ImmPtr(&globalData->exceptionLocation), regT2); @@ -794,14 +791,17 @@ void JIT::emit_op_jfalse(Instruction* currentInstruction) Jump isTrue2 = branch32(NotEqual, regT0, Imm32(0)); addJump(jump(), target + 2); - isNotInteger.link(this); + if (supportsFloatingPoint()) { + isNotInteger.link(this); - addSlowCase(branch32(Above, regT1, Imm32(JSValue::LowestTag))); + addSlowCase(branch32(Above, regT1, Imm32(JSValue::LowestTag))); + + zeroDouble(fpRegT0); + emitLoadDouble(cond, fpRegT1); + addJump(branchDouble(DoubleEqual, fpRegT0, fpRegT1), target + 2); + } else + addSlowCase(isNotInteger); - zeroDouble(fpRegT0); - emitLoadDouble(cond, fpRegT1); - addJump(branchDouble(DoubleEqual, fpRegT0, fpRegT1), target + 2); - isTrue.link(this); isTrue2.link(this); } @@ -832,14 +832,17 @@ void JIT::emit_op_jtrue(Instruction* currentInstruction) Jump isFalse2 = branch32(Equal, regT0, Imm32(0)); addJump(jump(), target + 2); - isNotInteger.link(this); + if (supportsFloatingPoint()) { + isNotInteger.link(this); - addSlowCase(branch32(Above, regT1, Imm32(JSValue::LowestTag))); + addSlowCase(branch32(Above, regT1, Imm32(JSValue::LowestTag))); + + zeroDouble(fpRegT0); + emitLoadDouble(cond, fpRegT1); + addJump(branchDouble(DoubleNotEqual, fpRegT0, fpRegT1), target + 2); + } else + addSlowCase(isNotInteger); - zeroDouble(fpRegT0); - emitLoadDouble(cond, fpRegT1); - addJump(branchDouble(DoubleNotEqual, fpRegT0, fpRegT1), target + 2); - isFalse.link(this); isFalse2.link(this); } @@ -1231,7 +1234,7 @@ void JIT::emit_op_to_jsnumber(Instruction* currentInstruction) emitLoad(src, regT1, regT0); Jump isInt32 = branch32(Equal, regT1, Imm32(JSValue::Int32Tag)); - addSlowCase(branch32(AboveOrEqual, regT1, Imm32(JSValue::DeletedValueTag))); + addSlowCase(branch32(AboveOrEqual, regT1, Imm32(JSValue::EmptyValueTag))); isInt32.link(this); if (src != dst) @@ -1381,8 +1384,7 @@ void JIT::emit_op_enter_with_activation(Instruction* currentInstruction) void JIT::emit_op_create_arguments(Instruction*) { - Jump argsNotCell = branch32(NotEqual, tagFor(RegisterFile::ArgumentsRegister, callFrameRegister), Imm32(JSValue::CellTag)); - Jump argsNotNull = branchTestPtr(NonZero, payloadFor(RegisterFile::ArgumentsRegister, callFrameRegister)); + Jump argsCreated = branch32(NotEqual, tagFor(RegisterFile::ArgumentsRegister, callFrameRegister), Imm32(JSValue::EmptyValueTag)); // If we get here the arguments pointer is a null cell - i.e. arguments need lazy creation. if (m_codeBlock->m_numParameters == 1) @@ -1390,8 +1392,7 @@ void JIT::emit_op_create_arguments(Instruction*) else JITStubCall(this, cti_op_create_arguments).call(); - argsNotCell.link(this); - argsNotNull.link(this); + argsCreated.link(this); } void JIT::emit_op_init_arguments(Instruction*) @@ -2707,32 +2708,20 @@ void JIT::emitSlow_op_to_primitive(Instruction* currentInstruction, Vector::iterator& iter) { - // The slow void JIT::emitSlow_that handles accesses to arrays (below) may jump back up to here. - Label beginGetByValSlow(this); + unsigned dst = currentInstruction[1].u.operand; + unsigned base = currentInstruction[2].u.operand; + unsigned property = currentInstruction[3].u.operand; - Jump notImm = getSlowCase(iter); - linkSlowCase(iter); - linkSlowCase(iter); - emitFastArithIntToImmNoCheck(regT1, regT1); + linkSlowCase(iter); // property int32 check + linkSlowCaseIfNotJSCell(iter, base); // base cell check + linkSlowCase(iter); // base array check + linkSlowCase(iter); // vector length check + linkSlowCase(iter); // empty value - notImm.link(this); JITStubCall stubCall(this, cti_op_get_by_val); - stubCall.addArgument(regT0); - stubCall.addArgument(regT1); - stubCall.call(currentInstruction[1].u.operand); - emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_get_by_val)); - - // This is slow void JIT::emitSlow_that handles accesses to arrays above the fast cut-off. - // First, check if this is an access to the vector - linkSlowCase(iter); - branch32(AboveOrEqual, regT1, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_vectorLength)), beginGetByValSlow); - - // okay, missed the fast region, but it is still in the vector. Get the value. - loadPtr(BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), regT2); - // Check whether the value loaded is zero; if so we need to return undefined. - branchTestPtr(Zero, regT2, beginGetByValSlow); - move(regT2, regT0); - emitPutVirtualRegister(currentInstruction[1].u.operand, regT0); + stubCall.addArgument(base, regT2); + stubCall.addArgument(property, regT2); + stubCall.call(dst); } void JIT::emitSlow_op_loop_if_less(Instruction* currentInstruction, Vector::iterator& iter) @@ -2789,30 +2778,20 @@ void JIT::emitSlow_op_loop_if_lesseq(Instruction* currentInstruction, Vector::iterator& iter) { - // Normal slow cases - either is not an immediate imm, or is an array. - Jump notImm = getSlowCase(iter); - linkSlowCase(iter); - linkSlowCase(iter); - emitFastArithIntToImmNoCheck(regT1, regT1); + unsigned base = currentInstruction[1].u.operand; + unsigned property = currentInstruction[2].u.operand; + unsigned value = currentInstruction[3].u.operand; - notImm.link(this); { - JITStubCall stubCall(this, cti_op_put_by_val); - stubCall.addArgument(regT0); - stubCall.addArgument(regT1); - stubCall.addArgument(currentInstruction[3].u.operand, regT2); - stubCall.call(); - emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_put_by_val)); - } + linkSlowCase(iter); // property int32 check + linkSlowCaseIfNotJSCell(iter, base); // base cell check + linkSlowCase(iter); // base not array check + linkSlowCase(iter); // in vector check - // slow cases for immediate int accesses to arrays - linkSlowCase(iter); - linkSlowCase(iter); { - JITStubCall stubCall(this, cti_op_put_by_val_array); - stubCall.addArgument(regT0); - stubCall.addArgument(regT1); - stubCall.addArgument(currentInstruction[3].u.operand, regT2); - stubCall.call(); - } + JITStubCall stubPutByValCall(this, cti_op_put_by_val); + stubPutByValCall.addArgument(regT0); + stubPutByValCall.addArgument(property, regT2); + stubPutByValCall.addArgument(value, regT2); + stubPutByValCall.call(); } void JIT::emitSlow_op_loop_if_true(Instruction* currentInstruction, Vector::iterator& iter) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITPropertyAccess.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITPropertyAccess.cpp index 08b3096..9edfd01 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITPropertyAccess.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITPropertyAccess.cpp @@ -273,11 +273,14 @@ void JIT::emit_op_get_by_val(Instruction* currentInstruction) addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag))); emitJumpSlowCaseIfNotJSCell(base, regT1); addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr))); - addSlowCase(branch32(AboveOrEqual, regT2, Address(regT0, OBJECT_OFFSETOF(JSArray, m_fastAccessCutoff)))); - loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT0); - load32(BaseIndex(regT0, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + 4), regT1); // tag - load32(BaseIndex(regT0, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), regT0); // payload + loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT3); + addSlowCase(branch32(AboveOrEqual, regT2, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength)))); + + load32(BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + 4), regT1); // tag + load32(BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), regT0); // payload + addSlowCase(branch32(Equal, regT1, Imm32(JSValue::EmptyValueTag))); + emitStore(dst, regT1, regT0); map(m_bytecodeIndex + OPCODE_LENGTH(op_get_by_val), dst, regT1, regT0); } @@ -288,35 +291,16 @@ void JIT::emitSlow_op_get_by_val(Instruction* currentInstruction, VectorjsArrayVPtr))); - loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT3); - - Jump inFastVector = branch32(Below, regT2, Address(regT0, OBJECT_OFFSETOF(JSArray, m_fastAccessCutoff))); + addSlowCase(branch32(AboveOrEqual, regT2, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength)))); - // Check if the access is within the vector. - addSlowCase(branch32(AboveOrEqual, regT2, Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_vectorLength)))); - - // This is a write to the slow part of the vector; first, we have to check if this would be the first write to this location. - // FIXME: should be able to handle initial write to array; increment the the number of items in the array, and potentially update fast access cutoff. - Jump skip = branch32(NotEqual, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + 4), Imm32(JSValue::CellTag)); - addSlowCase(branch32(Equal, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), Imm32(0))); - skip.link(this); + loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT3); - inFastVector.link(this); + Jump empty = branch32(Equal, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + 4), Imm32(JSValue::EmptyValueTag)); + Label storeResult(this); emitLoad(value, regT1, regT0); store32(regT0, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]))); // payload store32(regT1, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + 4)); // tag + Jump end = jump(); + + empty.link(this); + add32(Imm32(1), Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector))); + branch32(Below, regT2, Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length))).linkTo(storeResult, this); + + add32(Imm32(1), regT2, regT0); + store32(regT0, Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length))); + jump().linkTo(storeResult, this); + + end.link(this); } void JIT::emitSlow_op_put_by_val(Instruction* currentInstruction, Vector::iterator& iter) @@ -359,24 +346,13 @@ void JIT::emitSlow_op_put_by_val(Instruction* currentInstruction, VectorjsArrayVPtr))); - // This is an array; get the m_storage pointer into ecx, then check if the index is below the fast cutoff loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT2); - addSlowCase(branch32(AboveOrEqual, regT1, Address(regT0, OBJECT_OFFSETOF(JSArray, m_fastAccessCutoff)))); + addSlowCase(branch32(AboveOrEqual, regT1, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength)))); - // Get the value from the vector loadPtr(BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), regT0); - emitPutVirtualRegister(currentInstruction[1].u.operand); + addSlowCase(branchTestPtr(Zero, regT0)); + + emitPutVirtualRegister(dst); } void JIT::emit_op_put_by_val(Instruction* currentInstruction) { - emitGetVirtualRegisters(currentInstruction[1].u.operand, regT0, currentInstruction[2].u.operand, regT1); + unsigned base = currentInstruction[1].u.operand; + unsigned property = currentInstruction[2].u.operand; + unsigned value = currentInstruction[3].u.operand; + + emitGetVirtualRegisters(base, regT0, property, regT1); emitJumpSlowCaseIfNotImmediateInteger(regT1); #if USE(JSVALUE64) // See comment in op_get_by_val. @@ -993,23 +977,29 @@ void JIT::emit_op_put_by_val(Instruction* currentInstruction) #else emitFastArithImmToInt(regT1); #endif - emitJumpSlowCaseIfNotJSCell(regT0); + emitJumpSlowCaseIfNotJSCell(regT0, base); addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr))); + addSlowCase(branch32(AboveOrEqual, regT1, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength)))); - // This is an array; get the m_storage pointer into ecx, then check if the index is below the fast cutoff loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT2); - Jump inFastVector = branch32(Below, regT1, Address(regT0, OBJECT_OFFSETOF(JSArray, m_fastAccessCutoff))); - // No; oh well, check if the access if within the vector - if so, we may still be okay. - addSlowCase(branch32(AboveOrEqual, regT1, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_vectorLength)))); - // This is a write to the slow part of the vector; first, we have to check if this would be the first write to this location. - // FIXME: should be able to handle initial write to array; increment the the number of items in the array, and potentially update fast access cutoff. - addSlowCase(branchTestPtr(Zero, BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])))); + Jump empty = branchTestPtr(Zero, BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]))); - // All good - put the value into the array. - inFastVector.link(this); - emitGetVirtualRegister(currentInstruction[3].u.operand, regT0); + Label storeResult(this); + emitGetVirtualRegister(value, regT0); storePtr(regT0, BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]))); + Jump end = jump(); + + empty.link(this); + add32(Imm32(1), Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector))); + branch32(Below, regT1, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length))).linkTo(storeResult, this); + + move(regT1, regT0); + add32(Imm32(1), regT0); + store32(regT0, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length))); + jump().linkTo(storeResult, this); + + end.link(this); } void JIT::emit_op_put_by_index(Instruction* currentInstruction) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp index 08a4493..073b35a 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp @@ -730,7 +730,7 @@ NEVER_INLINE void JITThunks::tryCachePutByID(CallFrame* callFrame, CodeBlock* co // Structure transition, cache transition info if (slot.type() == PutPropertySlot::NewProperty) { StructureChain* prototypeChain = structure->prototypeChain(callFrame); - if (!prototypeChain->isCacheable()) { + if (!prototypeChain->isCacheable() || structure->isDictionary()) { ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_put_by_id_generic)); return; } @@ -1983,28 +1983,6 @@ DEFINE_STUB_FUNCTION(void, op_put_by_val) CHECK_FOR_EXCEPTION_AT_END(); } -DEFINE_STUB_FUNCTION(void, op_put_by_val_array) -{ - STUB_INIT_STACK_FRAME(stackFrame); - - CallFrame* callFrame = stackFrame.callFrame; - JSValue baseValue = stackFrame.args[0].jsValue(); - int i = stackFrame.args[1].int32(); - JSValue value = stackFrame.args[2].jsValue(); - - ASSERT(isJSArray(stackFrame.globalData, baseValue)); - - if (LIKELY(i >= 0)) - asArray(baseValue)->JSArray::put(callFrame, i, value); - else { - Identifier property(callFrame, UString::from(i)); - PutPropertySlot slot; - baseValue.put(callFrame, property, value, slot); - } - - CHECK_FOR_EXCEPTION_AT_END(); -} - DEFINE_STUB_FUNCTION(void, op_put_by_val_byte_array) { STUB_INIT_STACK_FRAME(stackFrame); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h index 3ae8f24..43975ff 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h @@ -349,7 +349,6 @@ extern "C" { void JIT_STUB cti_op_put_by_id_generic(STUB_ARGS_DECLARATION); void JIT_STUB cti_op_put_by_index(STUB_ARGS_DECLARATION); void JIT_STUB cti_op_put_by_val(STUB_ARGS_DECLARATION); - void JIT_STUB cti_op_put_by_val_array(STUB_ARGS_DECLARATION); void JIT_STUB cti_op_put_by_val_byte_array(STUB_ARGS_DECLARATION); void JIT_STUB cti_op_put_getter(STUB_ARGS_DECLARATION); void JIT_STUB cti_op_put_setter(STUB_ARGS_DECLARATION); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jsc.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jsc.cpp index 92b1e58..ee4e393 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jsc.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jsc.cpp @@ -24,6 +24,7 @@ #include "BytecodeGenerator.h" #include "Completion.h" +#include "CurrentTime.h" #include "InitializeThreading.h" #include "JSArray.h" #include "JSFunction.h" @@ -118,53 +119,23 @@ public: long getElapsedMS(); // call stop() first private: -#if PLATFORM(QT) - uint m_startTime; - uint m_stopTime; -#elif PLATFORM(WIN_OS) - DWORD m_startTime; - DWORD m_stopTime; -#else - // Windows does not have timeval, disabling this class for now (bug 7399) - timeval m_startTime; - timeval m_stopTime; -#endif + double m_startTime; + double m_stopTime; }; void StopWatch::start() { -#if PLATFORM(QT) - QDateTime t = QDateTime::currentDateTime(); - m_startTime = t.toTime_t() * 1000 + t.time().msec(); -#elif PLATFORM(WIN_OS) - m_startTime = timeGetTime(); -#else - gettimeofday(&m_startTime, 0); -#endif + m_startTime = currentTime(); } void StopWatch::stop() { -#if PLATFORM(QT) - QDateTime t = QDateTime::currentDateTime(); - m_stopTime = t.toTime_t() * 1000 + t.time().msec(); -#elif PLATFORM(WIN_OS) - m_stopTime = timeGetTime(); -#else - gettimeofday(&m_stopTime, 0); -#endif + m_stopTime = currentTime(); } long StopWatch::getElapsedMS() { -#if PLATFORM(WIN_OS) || PLATFORM(QT) - return m_stopTime - m_startTime; -#else - timeval elapsedTime; - timersub(&m_stopTime, &m_startTime, &elapsedTime); - - return elapsedTime.tv_sec * 1000 + lroundf(elapsedTime.tv_usec / 1000.0f); -#endif + return static_cast((m_stopTime - m_startTime) * 1000); } class GlobalObject : public JSGlobalObject { diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/parser/Nodes.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/parser/Nodes.cpp index 7170f73..89bbc11 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/parser/Nodes.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/parser/Nodes.cpp @@ -1899,10 +1899,6 @@ ScopeNode::ScopeNode(JSGlobalData* globalData) , ParserArenaRefCounted(globalData) , m_features(NoFeatures) { -#if ENABLE(CODEBLOCK_SAMPLING) - if (SamplingTool* sampler = globalData->interpreter->sampler()) - sampler->notifyOfScope(this); -#endif } ScopeNode::ScopeNode(JSGlobalData* globalData, const SourceCode& source, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, CodeFeatures features, int numConstants) @@ -1912,10 +1908,6 @@ ScopeNode::ScopeNode(JSGlobalData* globalData, const SourceCode& source, SourceE , m_features(features) , m_source(source) { -#if ENABLE(CODEBLOCK_SAMPLING) - if (SamplingTool* sampler = globalData->interpreter->sampler()) - sampler->notifyOfScope(this); -#endif } inline void ScopeNode::emitStatementsBytecode(BytecodeGenerator& generator, RegisterID* dst) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArrayPrototype.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArrayPrototype.cpp index e1b1f34..c453b22 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArrayPrototype.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArrayPrototype.cpp @@ -149,10 +149,11 @@ static void putProperty(ExecState* exec, JSObject* obj, const Identifier& proper JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.inherits(&JSArray::info)) + bool isRealArray = isJSArray(&exec->globalData(), thisValue); + if (!isRealArray && !thisValue.inherits(&JSArray::info)) return throwError(exec, TypeError); - JSObject* thisObj = asArray(thisValue); - + JSArray* thisObj = asArray(thisValue); + HashSet& arrayVisitedElements = exec->globalData().arrayVisitedElements; if (arrayVisitedElements.size() >= MaxSecondaryThreadReentryDepth) { if (!isMainThread() || arrayVisitedElements.size() >= MaxMainThreadReentryDepth) @@ -163,34 +164,48 @@ JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec, JSObject*, JSValue if (alreadyVisited) return jsEmptyString(exec); // return an empty string, avoiding infinite recursion. - Vector strBuffer; unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); + unsigned totalSize = length ? length - 1 : 0; + Vector, 256> strBuffer(length); for (unsigned k = 0; k < length; k++) { - if (k >= 1) - strBuffer.append(','); - if (!strBuffer.data()) { - JSObject* error = Error::create(exec, GeneralError, "Out of memory"); - exec->setException(error); - break; - } - - JSValue element = thisObj->get(exec, k); + JSValue element; + if (isRealArray && thisObj->canGetIndex(k)) + element = thisObj->getIndex(k); + else + element = thisObj->get(exec, k); + if (element.isUndefinedOrNull()) continue; - + UString str = element.toString(exec); - strBuffer.append(str.data(), str.size()); - + strBuffer[k] = str.rep(); + totalSize += str.size(); + if (!strBuffer.data()) { JSObject* error = Error::create(exec, GeneralError, "Out of memory"); exec->setException(error); } - + if (exec->hadException()) break; } arrayVisitedElements.remove(thisObj); - return jsString(exec, UString(strBuffer.data(), strBuffer.data() ? strBuffer.size() : 0)); + if (!totalSize) + return jsEmptyString(exec); + Vector buffer; + buffer.reserveCapacity(totalSize); + if (!buffer.data()) + return throwError(exec, GeneralError, "Out of memory"); + + for (unsigned i = 0; i < length; i++) { + if (i) + buffer.append(','); + if (RefPtr rep = strBuffer[i]) + buffer.append(rep->data(), rep->size()); + } + ASSERT(buffer.size() == totalSize); + unsigned finalSize = buffer.size(); + return jsString(exec, UString(buffer.releaseBuffer(), finalSize, false)); } JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp index 3784da8..1e717cb 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp @@ -843,10 +843,16 @@ void NEVER_INLINE Heap::markCurrentThreadConservativelyInternal(MarkStack& markS markConservatively(markStack, stackPointer, stackBase); } +#if COMPILER(GCC) +#define REGISTER_BUFFER_ALIGNMENT __attribute__ ((aligned (sizeof(void*)))) +#else +#define REGISTER_BUFFER_ALIGNMENT +#endif + void Heap::markCurrentThreadConservatively(MarkStack& markStack) { // setjmp forces volatile registers onto the stack - jmp_buf registers; + jmp_buf registers REGISTER_BUFFER_ALIGNMENT; #if COMPILER(MSVC) #pragma warning(push) #pragma warning(disable: 4611) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Completion.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Completion.cpp index b75a7a5..3ad467d 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Completion.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Completion.cpp @@ -41,7 +41,7 @@ Completion checkSyntax(ExecState* exec, const SourceCode& source) { JSLock lock(exec); - ProgramExecutable program(source); + ProgramExecutable program(exec, source); JSObject* error = program.checkSyntax(exec); if (error) return Completion(Throw, error); @@ -53,7 +53,7 @@ Completion evaluate(ExecState* exec, ScopeChain& scopeChain, const SourceCode& s { JSLock lock(exec); - ProgramExecutable program(source); + ProgramExecutable program(exec, source); JSObject* error = program.compile(exec, scopeChain.node()); if (error) return Completion(Throw, error); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.cpp index 5e79794..7586746 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.cpp @@ -259,7 +259,7 @@ PassRefPtr FunctionExecutable::fromGlobalCode(const Identifi FunctionBodyNode* body = static_cast(funcExpr)->body(); ASSERT(body); - return FunctionExecutable::create(functionName, body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); + return FunctionExecutable::create(&exec->globalData(), functionName, body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); } UString FunctionExecutable::paramString() const diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h index f3003dd..76764f9 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h @@ -27,7 +27,9 @@ #define Executable_h #include "JSFunction.h" +#include "Interpreter.h" #include "Nodes.h" +#include "SamplingTool.h" namespace JSC { @@ -102,11 +104,30 @@ namespace JSC { class ScriptExecutable : public ExecutableBase { public: - ScriptExecutable(const SourceCode& source) + ScriptExecutable(JSGlobalData* globalData, const SourceCode& source) : ExecutableBase(NUM_PARAMETERS_NOT_COMPILED) , m_source(source) , m_features(0) { +#if ENABLE(CODEBLOCK_SAMPLING) + if (SamplingTool* sampler = globalData->interpreter->sampler()) + sampler->notifyOfScope(this); +#else + UNUSED_PARAM(globalData); +#endif + } + + ScriptExecutable(ExecState* exec, const SourceCode& source) + : ExecutableBase(NUM_PARAMETERS_NOT_COMPILED) + , m_source(source) + , m_features(0) + { +#if ENABLE(CODEBLOCK_SAMPLING) + if (SamplingTool* sampler = exec->globalData().interpreter->sampler()) + sampler->notifyOfScope(this); +#else + UNUSED_PARAM(exec); +#endif } const SourceCode& source() { return m_source; } @@ -137,8 +158,8 @@ namespace JSC { class EvalExecutable : public ScriptExecutable { public: - EvalExecutable(const SourceCode& source) - : ScriptExecutable(source) + EvalExecutable(ExecState* exec, const SourceCode& source) + : ScriptExecutable(exec, source) , m_evalCodeBlock(0) { } @@ -157,7 +178,7 @@ namespace JSC { JSObject* compile(ExecState*, ScopeChainNode*); ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*); - static PassRefPtr create(const SourceCode& source) { return adoptRef(new EvalExecutable(source)); } + static PassRefPtr create(ExecState* exec, const SourceCode& source) { return adoptRef(new EvalExecutable(exec, source)); } private: EvalCodeBlock* m_evalCodeBlock; @@ -178,8 +199,8 @@ namespace JSC { class ProgramExecutable : public ScriptExecutable { public: - ProgramExecutable(const SourceCode& source) - : ScriptExecutable(source) + ProgramExecutable(ExecState* exec, const SourceCode& source) + : ScriptExecutable(exec, source) , m_programCodeBlock(0) { } @@ -221,9 +242,14 @@ namespace JSC { class FunctionExecutable : public ScriptExecutable { friend class JIT; public: - static PassRefPtr create(const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) + static PassRefPtr create(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) + { + return adoptRef(new FunctionExecutable(exec, name, source, forceUsesArguments, parameters, firstLine, lastLine)); + } + + static PassRefPtr create(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) { - return adoptRef(new FunctionExecutable(name, source, forceUsesArguments, parameters, firstLine, lastLine)); + return adoptRef(new FunctionExecutable(globalData, name, source, forceUsesArguments, parameters, firstLine, lastLine)); } ~FunctionExecutable(); @@ -264,8 +290,20 @@ namespace JSC { static PassRefPtr fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, int* errLine = 0, UString* errMsg = 0); private: - FunctionExecutable(const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) - : ScriptExecutable(source) + FunctionExecutable(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) + : ScriptExecutable(globalData, source) + , m_forceUsesArguments(forceUsesArguments) + , m_parameters(parameters) + , m_codeBlock(0) + , m_name(name) + , m_numVariables(0) + { + m_firstLine = firstLine; + m_lastLine = lastLine; + } + + FunctionExecutable(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) + : ScriptExecutable(exec, source) , m_forceUsesArguments(forceUsesArguments) , m_parameters(parameters) , m_codeBlock(0) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSArray.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSArray.cpp index 1a4402c..9e0ab59 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSArray.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSArray.cpp @@ -136,9 +136,7 @@ JSArray::JSArray(PassRefPtr structure) unsigned initialCapacity = 0; m_storage = static_cast(fastZeroedMalloc(storageSize(initialCapacity))); - m_storage->m_vectorLength = initialCapacity; - - m_fastAccessCutoff = 0; + m_vectorLength = initialCapacity; checkConsistency(); } @@ -150,7 +148,7 @@ JSArray::JSArray(PassRefPtr structure, unsigned initialLength) m_storage = static_cast(fastMalloc(storageSize(initialCapacity))); m_storage->m_length = initialLength; - m_storage->m_vectorLength = initialCapacity; + m_vectorLength = initialCapacity; m_storage->m_numValuesInVector = 0; m_storage->m_sparseValueMap = 0; m_storage->lazyCreationData = 0; @@ -159,8 +157,6 @@ JSArray::JSArray(PassRefPtr structure, unsigned initialLength) for (size_t i = 0; i < initialCapacity; ++i) vector[i] = JSValue(); - m_fastAccessCutoff = 0; - checkConsistency(); Heap::heap(this)->reportExtraMemoryCost(initialCapacity * sizeof(JSValue)); @@ -173,7 +169,7 @@ JSArray::JSArray(PassRefPtr structure, const ArgList& list) m_storage = static_cast(fastMalloc(storageSize(initialCapacity))); m_storage->m_length = initialCapacity; - m_storage->m_vectorLength = initialCapacity; + m_vectorLength = initialCapacity; m_storage->m_numValuesInVector = initialCapacity; m_storage->m_sparseValueMap = 0; @@ -182,8 +178,6 @@ JSArray::JSArray(PassRefPtr structure, const ArgList& list) for (ArgList::const_iterator it = list.begin(); it != end; ++it, ++i) m_storage->m_vector[i] = *it; - m_fastAccessCutoff = initialCapacity; - checkConsistency(); Heap::heap(this)->reportExtraMemoryCost(storageSize(initialCapacity)); @@ -207,7 +201,7 @@ bool JSArray::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot return false; } - if (i < storage->m_vectorLength) { + if (i < m_vectorLength) { JSValue& valueSlot = storage->m_vector[i]; if (valueSlot) { slot.setValueSlot(&valueSlot); @@ -253,8 +247,8 @@ bool JSArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& proper if (isArrayIndex) { if (i >= m_storage->m_length) return false; - if (i < m_storage->m_vectorLength) { - JSValue value = m_storage->m_vector[i]; + if (i < m_vectorLength) { + JSValue& value = m_storage->m_vector[i]; if (value) { descriptor.setDescriptor(value, 0); return true; @@ -305,7 +299,7 @@ void JSArray::put(ExecState* exec, unsigned i, JSValue value) m_storage->m_length = length; } - if (i < m_storage->m_vectorLength) { + if (i < m_vectorLength) { JSValue& valueSlot = m_storage->m_vector[i]; if (valueSlot) { valueSlot = value; @@ -313,8 +307,7 @@ void JSArray::put(ExecState* exec, unsigned i, JSValue value) return; } valueSlot = value; - if (++m_storage->m_numValuesInVector == m_storage->m_length) - m_fastAccessCutoff = m_storage->m_length; + ++m_storage->m_numValuesInVector; checkConsistency(); return; } @@ -352,8 +345,7 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu if (increaseVectorLength(i + 1)) { storage = m_storage; storage->m_vector[i] = value; - if (++storage->m_numValuesInVector == storage->m_length) - m_fastAccessCutoff = storage->m_length; + ++storage->m_numValuesInVector; checkConsistency(); } else throwOutOfMemoryError(exec); @@ -363,7 +355,7 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu // Decide how many values it would be best to move from the map. unsigned newNumValuesInVector = storage->m_numValuesInVector + 1; unsigned newVectorLength = increasedVectorLength(i + 1); - for (unsigned j = max(storage->m_vectorLength, MIN_SPARSE_ARRAY_INDEX); j < newVectorLength; ++j) + for (unsigned j = max(m_vectorLength, MIN_SPARSE_ARRAY_INDEX); j < newVectorLength; ++j) newNumValuesInVector += map->contains(j); if (i >= MIN_SPARSE_ARRAY_INDEX) newNumValuesInVector -= map->contains(i); @@ -386,7 +378,7 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu return; } - unsigned vectorLength = storage->m_vectorLength; + unsigned vectorLength = m_vectorLength; Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength)); @@ -404,7 +396,7 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu storage->m_vector[i] = value; - storage->m_vectorLength = newVectorLength; + m_vectorLength = newVectorLength; storage->m_numValuesInVector = newNumValuesInVector; m_storage = storage; @@ -431,7 +423,7 @@ bool JSArray::deleteProperty(ExecState* exec, unsigned i, bool checkDontDelete) ArrayStorage* storage = m_storage; - if (i < storage->m_vectorLength) { + if (i < m_vectorLength) { JSValue& valueSlot = storage->m_vector[i]; if (!valueSlot) { checkConsistency(); @@ -439,8 +431,6 @@ bool JSArray::deleteProperty(ExecState* exec, unsigned i, bool checkDontDelete) } valueSlot = JSValue(); --storage->m_numValuesInVector; - if (m_fastAccessCutoff > i) - m_fastAccessCutoff = i; checkConsistency(); return true; } @@ -472,7 +462,7 @@ void JSArray::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNa ArrayStorage* storage = m_storage; - unsigned usedVectorLength = min(storage->m_length, storage->m_vectorLength); + unsigned usedVectorLength = min(storage->m_length, m_vectorLength); for (unsigned i = 0; i < usedVectorLength; ++i) { if (storage->m_vector[i]) propertyNames.add(Identifier::from(exec, i)); @@ -494,7 +484,7 @@ bool JSArray::increaseVectorLength(unsigned newLength) ArrayStorage* storage = m_storage; - unsigned vectorLength = storage->m_vectorLength; + unsigned vectorLength = m_vectorLength; ASSERT(newLength > vectorLength); ASSERT(newLength <= MAX_STORAGE_VECTOR_INDEX); unsigned newVectorLength = increasedVectorLength(newLength); @@ -503,7 +493,7 @@ bool JSArray::increaseVectorLength(unsigned newLength) return false; Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength)); - storage->m_vectorLength = newVectorLength; + m_vectorLength = newVectorLength; for (unsigned i = vectorLength; i < newVectorLength; ++i) storage->m_vector[i] = JSValue(); @@ -521,10 +511,7 @@ void JSArray::setLength(unsigned newLength) unsigned length = m_storage->m_length; if (newLength < length) { - if (m_fastAccessCutoff > newLength) - m_fastAccessCutoff = newLength; - - unsigned usedVectorLength = min(length, storage->m_vectorLength); + unsigned usedVectorLength = min(length, m_vectorLength); for (unsigned i = newLength; i < usedVectorLength; ++i) { JSValue& valueSlot = storage->m_vector[i]; bool hadValue = valueSlot; @@ -563,20 +550,13 @@ JSValue JSArray::pop() JSValue result; - if (m_fastAccessCutoff > length) { - JSValue& valueSlot = m_storage->m_vector[length]; - result = valueSlot; - ASSERT(result); - valueSlot = JSValue(); - --m_storage->m_numValuesInVector; - m_fastAccessCutoff = length; - } else if (length < m_storage->m_vectorLength) { + if (length < m_vectorLength) { JSValue& valueSlot = m_storage->m_vector[length]; - result = valueSlot; - valueSlot = JSValue(); - if (result) + if (valueSlot) { --m_storage->m_numValuesInVector; - else + result = valueSlot; + valueSlot = JSValue(); + } else result = jsUndefined(); } else { result = jsUndefined(); @@ -604,11 +584,10 @@ void JSArray::push(ExecState* exec, JSValue value) { checkConsistency(); - if (m_storage->m_length < m_storage->m_vectorLength) { - ASSERT(!m_storage->m_vector[m_storage->m_length]); + if (m_storage->m_length < m_vectorLength) { m_storage->m_vector[m_storage->m_length] = value; - if (++m_storage->m_numValuesInVector == ++m_storage->m_length) - m_fastAccessCutoff = m_storage->m_length; + ++m_storage->m_numValuesInVector; + ++m_storage->m_length; checkConsistency(); return; } @@ -618,8 +597,8 @@ void JSArray::push(ExecState* exec, JSValue value) if (!map || map->isEmpty()) { if (increaseVectorLength(m_storage->m_length + 1)) { m_storage->m_vector[m_storage->m_length] = value; - if (++m_storage->m_numValuesInVector == ++m_storage->m_length) - m_fastAccessCutoff = m_storage->m_length; + ++m_storage->m_numValuesInVector; + ++m_storage->m_length; checkConsistency(); return; } @@ -837,7 +816,7 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType, if (!m_storage->m_length) return; - unsigned usedVectorLength = min(m_storage->m_length, m_storage->m_vectorLength); + unsigned usedVectorLength = min(m_storage->m_length, m_vectorLength); AVLTree tree; // Depth 44 is enough for 2^31 items tree.abstractor().m_exec = exec; @@ -886,7 +865,7 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType, if (SparseArrayValueMap* map = m_storage->m_sparseValueMap) { newUsedVectorLength += map->size(); - if (newUsedVectorLength > m_storage->m_vectorLength) { + if (newUsedVectorLength > m_vectorLength) { // Check that it is possible to allocate an array large enough to hold all the entries. if ((newUsedVectorLength > MAX_STORAGE_VECTOR_LENGTH) || !increaseVectorLength(newUsedVectorLength)) { throwOutOfMemoryError(exec); @@ -926,7 +905,6 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType, for (unsigned i = newUsedVectorLength; i < usedVectorLength; ++i) m_storage->m_vector[i] = JSValue(); - m_fastAccessCutoff = newUsedVectorLength; m_storage->m_numValuesInVector = newUsedVectorLength; checkConsistency(SortConsistencyCheck); @@ -934,10 +912,16 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType, void JSArray::fillArgList(ExecState* exec, MarkedArgumentBuffer& args) { - unsigned fastAccessLength = min(m_storage->m_length, m_fastAccessCutoff); + JSValue* vector = m_storage->m_vector; + unsigned vectorEnd = min(m_storage->m_length, m_vectorLength); unsigned i = 0; - for (; i < fastAccessLength; ++i) - args.append(getIndex(i)); + for (; i < vectorEnd; ++i) { + JSValue& v = vector[i]; + if (!v) + break; + args.append(v); + } + for (; i < m_storage->m_length; ++i) args.append(get(exec, i)); } @@ -946,12 +930,17 @@ void JSArray::copyToRegisters(ExecState* exec, Register* buffer, uint32_t maxSiz { ASSERT(m_storage->m_length == maxSize); UNUSED_PARAM(maxSize); - unsigned fastAccessLength = min(m_storage->m_length, m_fastAccessCutoff); + JSValue* vector = m_storage->m_vector; + unsigned vectorEnd = min(m_storage->m_length, m_vectorLength); unsigned i = 0; - for (; i < fastAccessLength; ++i) - buffer[i] = getIndex(i); - uint32_t size = m_storage->m_length; - for (; i < size; ++i) + for (; i < vectorEnd; ++i) { + JSValue& v = vector[i]; + if (!v) + break; + buffer[i] = v; + } + + for (; i < m_storage->m_length; ++i) buffer[i] = get(exec, i); } @@ -961,7 +950,7 @@ unsigned JSArray::compactForSorting() ArrayStorage* storage = m_storage; - unsigned usedVectorLength = min(m_storage->m_length, storage->m_vectorLength); + unsigned usedVectorLength = min(m_storage->m_length, m_vectorLength); unsigned numDefined = 0; unsigned numUndefined = 0; @@ -985,7 +974,7 @@ unsigned JSArray::compactForSorting() if (SparseArrayValueMap* map = storage->m_sparseValueMap) { newUsedVectorLength += map->size(); - if (newUsedVectorLength > storage->m_vectorLength) { + if (newUsedVectorLength > m_vectorLength) { // Check that it is possible to allocate an array large enough to hold all the entries - if not, // exception is thrown by caller. if ((newUsedVectorLength > MAX_STORAGE_VECTOR_LENGTH) || !increaseVectorLength(newUsedVectorLength)) @@ -1006,7 +995,6 @@ unsigned JSArray::compactForSorting() for (unsigned i = newUsedVectorLength; i < usedVectorLength; ++i) storage->m_vector[i] = JSValue(); - m_fastAccessCutoff = newUsedVectorLength; storage->m_numValuesInVector = newUsedVectorLength; checkConsistency(SortConsistencyCheck); @@ -1032,30 +1020,27 @@ void JSArray::checkConsistency(ConsistencyCheckType type) if (type == SortConsistencyCheck) ASSERT(!m_storage->m_sparseValueMap); - ASSERT(m_fastAccessCutoff <= m_storage->m_length); - ASSERT(m_fastAccessCutoff <= m_storage->m_numValuesInVector); - unsigned numValuesInVector = 0; - for (unsigned i = 0; i < m_storage->m_vectorLength; ++i) { + for (unsigned i = 0; i < m_vectorLength; ++i) { if (JSValue value = m_storage->m_vector[i]) { ASSERT(i < m_storage->m_length); if (type != DestructorConsistencyCheck) value->type(); // Likely to crash if the object was deallocated. ++numValuesInVector; } else { - ASSERT(i >= m_fastAccessCutoff); if (type == SortConsistencyCheck) ASSERT(i >= m_storage->m_numValuesInVector); } } ASSERT(numValuesInVector == m_storage->m_numValuesInVector); + ASSERT(numValuesInVector <= m_storage->m_length); if (m_storage->m_sparseValueMap) { SparseArrayValueMap::iterator end = m_storage->m_sparseValueMap->end(); for (SparseArrayValueMap::iterator it = m_storage->m_sparseValueMap->begin(); it != end; ++it) { unsigned index = it->first; ASSERT(index < m_storage->m_length); - ASSERT(index >= m_storage->m_vectorLength); + ASSERT(index >= m_vectorLength); ASSERT(index <= MAX_ARRAY_INDEX); ASSERT(it->second); if (type != DestructorConsistencyCheck) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSArray.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSArray.h index 37ed72b..2613991 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSArray.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSArray.h @@ -29,7 +29,6 @@ namespace JSC { struct ArrayStorage { unsigned m_length; - unsigned m_vectorLength; unsigned m_numValuesInVector; SparseArrayValueMap* m_sparseValueMap; void* lazyCreationData; // A JSArray subclass can use this to fill the vector lazily. @@ -63,18 +62,24 @@ namespace JSC { void push(ExecState*, JSValue); JSValue pop(); - bool canGetIndex(unsigned i) { return i < m_fastAccessCutoff; } + bool canGetIndex(unsigned i) { return i < m_vectorLength && m_storage->m_vector[i]; } JSValue getIndex(unsigned i) { ASSERT(canGetIndex(i)); return m_storage->m_vector[i]; } - bool canSetIndex(unsigned i) { return i < m_fastAccessCutoff; } - JSValue setIndex(unsigned i, JSValue v) + bool canSetIndex(unsigned i) { return i < m_vectorLength; } + void setIndex(unsigned i, JSValue v) { ASSERT(canSetIndex(i)); - return m_storage->m_vector[i] = v; + JSValue& x = m_storage->m_vector[i]; + if (!x) { + ++m_storage->m_numValuesInVector; + if (i >= m_storage->m_length) + m_storage->m_length = i + 1; + } + x = v; } void fillArgList(ExecState*, MarkedArgumentBuffer&); @@ -110,7 +115,7 @@ namespace JSC { enum ConsistencyCheckType { NormalConsistencyCheck, DestructorConsistencyCheck, SortConsistencyCheck }; void checkConsistency(ConsistencyCheckType = NormalConsistencyCheck); - unsigned m_fastAccessCutoff; + unsigned m_vectorLength; ArrayStorage* m_storage; }; @@ -144,7 +149,7 @@ namespace JSC { ArrayStorage* storage = m_storage; - unsigned usedVectorLength = std::min(storage->m_length, storage->m_vectorLength); + unsigned usedVectorLength = std::min(storage->m_length, m_vectorLength); markStack.appendValues(storage->m_vector, usedVectorLength, MayContainNullValues); if (SparseArrayValueMap* map = storage->m_sparseValueMap) { diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp index b11070f..5ded370 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp @@ -286,7 +286,7 @@ JSValue JSC_HOST_CALL globalFuncEval(ExecState* exec, JSObject* function, JSValu if (JSValue parsedObject = preparser.tryLiteralParse()) return parsedObject; - EvalExecutable eval(makeSource(s)); + EvalExecutable eval(exec, makeSource(s)); JSObject* error = eval.compile(exec, static_cast(unwrappedObject)->globalScopeChain().node()); if (error) return throwError(exec, error); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp index 39a4093..699c1cd 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp @@ -110,7 +110,10 @@ char* JSValue::description() { static const size_t size = 32; static char description[size]; - if (isInt32()) + + if (!*this) + snprintf(description, size, ""); + else if (isInt32()) snprintf(description, size, "Int32: %d", asInt32()); else if (isDouble()) snprintf(description, size, "Double: %lf", asDouble()); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h index 58e74b1..3c511d8 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h @@ -213,7 +213,8 @@ namespace JSC { enum { FalseTag = 0xfffffffc }; enum { NullTag = 0xfffffffb }; enum { UndefinedTag = 0xfffffffa }; - enum { DeletedValueTag = 0xfffffff9 }; + enum { EmptyValueTag = 0xfffffff9 }; + enum { DeletedValueTag = 0xfffffff8 }; enum { LowestTag = DeletedValueTag }; @@ -427,7 +428,7 @@ namespace JSC { inline JSValue::JSValue() { - u.asBits.tag = CellTag; + u.asBits.tag = EmptyValueTag; u.asBits.payload = 0; } @@ -463,19 +464,26 @@ namespace JSC { inline JSValue::JSValue(JSCell* ptr) { - u.asBits.tag = CellTag; + if (ptr) + u.asBits.tag = CellTag; + else + u.asBits.tag = EmptyValueTag; u.asBits.payload = reinterpret_cast(ptr); } inline JSValue::JSValue(const JSCell* ptr) { - u.asBits.tag = CellTag; + if (ptr) + u.asBits.tag = CellTag; + else + u.asBits.tag = EmptyValueTag; u.asBits.payload = reinterpret_cast(const_cast(ptr)); } inline JSValue::operator bool() const { - return u.asBits.payload || tag() != CellTag; + ASSERT(tag() != DeletedValueTag); + return tag() != EmptyValueTag; } inline bool JSValue::operator==(const JSValue& other) const diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp index f7bda9e..a509122 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp @@ -46,6 +46,7 @@ #define DO_PROPERTYMAP_CONSTENCY_CHECK 0 #endif +using namespace std; using namespace WTF; namespace JSC { @@ -555,7 +556,7 @@ PassRefPtr Structure::getterSetterTransition(Structure* structure) PassRefPtr Structure::toDictionaryTransition(Structure* structure, DictionaryKind kind) { - ASSERT(!structure->isDictionary()); + ASSERT(!structure->isUncacheableDictionary()); RefPtr transition = create(structure->m_prototype, structure->typeInfo()); transition->m_dictionaryKind = kind; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/TimeoutChecker.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/TimeoutChecker.cpp index d7fca33..0a8bbd3 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/TimeoutChecker.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/TimeoutChecker.cpp @@ -35,18 +35,10 @@ #if PLATFORM(DARWIN) #include -#endif - -#if HAVE(SYS_TIME_H) -#include -#endif - -#if PLATFORM(WIN_OS) +#elif PLATFORM(WIN_OS) #include -#endif - -#if PLATFORM(QT) -#include +#else +#include "CurrentTime.h" #endif using namespace std; @@ -75,14 +67,6 @@ static inline unsigned getCPUTime() time += info.system_time.seconds * 1000 + info.system_time.microseconds / 1000; return time; -#elif HAVE(SYS_TIME_H) - // FIXME: This should probably use getrusage with the RUSAGE_THREAD flag. - struct timeval tv; - gettimeofday(&tv, 0); - return tv.tv_sec * 1000 + tv.tv_usec / 1000; -#elif PLATFORM(QT) - QDateTime t = QDateTime::currentDateTime(); - return t.toTime_t() * 1000 + t.time().msec(); #elif PLATFORM(WIN_OS) union { FILETIME fileTime; @@ -97,7 +81,8 @@ static inline unsigned getCPUTime() return userTime.fileTimeAsLong / 10000 + kernelTime.fileTimeAsLong / 10000; #else -#error Platform does not have getCurrentTime function + // FIXME: We should return the time the current thread has spent executing. + return currentTime() * 1000; #endif } diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.cpp index 54daf23..5af1377 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.cpp @@ -108,7 +108,11 @@ static void vprintf_stderr_common(const char* format, va_list args) } while (size > 1024); } #endif +#if PLATFORM(SYMBIAN) + vfprintf(stdout, format, args); +#else vfprintf(stderr, format, args); +#endif } WTF_ATTRIBUTE_PRINTF(1, 2) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h index b68e70c..f529a62 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h @@ -50,6 +50,11 @@ #include #endif +#if PLATFORM(SYMBIAN) +#include +#include +#endif + #ifdef NDEBUG #define ASSERTIONS_DISABLED_DEFAULT 1 #else @@ -120,11 +125,18 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann /* CRASH -- gets us into the debugger or the crash reporter -- signals are ignored by the crash reporter so we must do better */ #ifndef CRASH +#if PLATFORM(SYMBIAN) +#define CRASH() do { \ + __DEBUGGER(); \ + User::Panic(_L("Webkit CRASH"),0); \ + } while(false) +#else #define CRASH() do { \ *(int *)(uintptr_t)0xbbadbeef = 0; \ ((void(*)())0)(); /* More reliable, but doesn't say BBADBEEF */ \ } while(false) #endif +#endif /* ASSERT, ASSERT_WITH_MESSAGE, ASSERT_NOT_REACHED */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp index afb0220..6cd8ef0 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp @@ -379,6 +379,9 @@ extern "C" const int jscore_fastmalloc_introspection = 0; #include #include #include +#if PLATFORM(UNIX) +#include +#endif #if COMPILER(MSVC) #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN @@ -391,6 +394,7 @@ extern "C" const int jscore_fastmalloc_introspection = 0; #if PLATFORM(DARWIN) #include "MallocZoneSupport.h" #include +#include #endif #ifndef PRIuS @@ -2274,7 +2278,7 @@ static inline TCMalloc_PageHeap* getPageHeap() #define pageheap getPageHeap() #if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY -#if PLATFORM(WIN) +#if PLATFORM(WIN_OS) static void sleep(unsigned seconds) { ::Sleep(seconds * 1000); @@ -2283,6 +2287,10 @@ static void sleep(unsigned seconds) void TCMalloc_PageHeap::scavengerThread() { +#if HAVE(PTHREAD_SETNAME_NP) + pthread_setname_np("JavaScriptCore: FastMalloc scavenger"); +#endif + while (1) { if (!shouldContinueScavenging()) { pthread_mutex_lock(&m_scavengeMutex); @@ -2388,7 +2396,7 @@ ALWAYS_INLINE void TCMalloc_Central_FreeList::ReleaseToSpans(void* object) { // The following check is expensive, so it is disabled by default if (false) { // Check that object does not occur in list - int got = 0; + unsigned got = 0; for (void* p = span->objects; p != NULL; p = *((void**) p)) { ASSERT(p != object); got++; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.h index b23e7b0..ca0961c 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.h @@ -213,6 +213,9 @@ using WTF::fastMallocAllow; // debug-only code to make sure we don't use the system malloc via the default operator // new by accident. +// We musn't customize the global operator new and delete for the Qt port. +#if !PLATFORM(QT) + WTF_PRIVATE_INLINE void* operator new(size_t size) { return fastMalloc(size); } WTF_PRIVATE_INLINE void* operator new(size_t size, const std::nothrow_t&) throw() { return fastMalloc(size); } WTF_PRIVATE_INLINE void operator delete(void* p) { fastFree(p); } @@ -224,4 +227,6 @@ WTF_PRIVATE_INLINE void operator delete[](void* p, const std::nothrow_t&) throw( #endif +#endif + #endif /* WTF_FastMalloc_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Forward.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Forward.h index 67dc3be..448de7d 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Forward.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Forward.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -27,6 +27,7 @@ namespace WTF { template class ListRefPtr; template class OwnArrayPtr; template class OwnPtr; + template class PassOwnPtr; template class PassRefPtr; template class RefPtr; template class Vector; @@ -35,9 +36,9 @@ namespace WTF { using WTF::ListRefPtr; using WTF::OwnArrayPtr; using WTF::OwnPtr; +using WTF::PassOwnPtr; using WTF::PassRefPtr; using WTF::RefPtr; using WTF::Vector; #endif // WTF_Forward_h - diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashCountedSet.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashCountedSet.h index 1a422d8..5fb6da8 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashCountedSet.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashCountedSet.h @@ -49,23 +49,28 @@ namespace WTF { const_iterator begin() const; const_iterator end() const; - iterator find(const ValueType& value); - const_iterator find(const ValueType& value) const; - bool contains(const ValueType& value) const; - unsigned count(const ValueType& value) const; + iterator find(const ValueType&); + const_iterator find(const ValueType&) const; + bool contains(const ValueType&) const; + unsigned count(const ValueType&) const; // increases the count if an equal value is already present // the return value is a pair of an interator to the new value's location, // and a bool that is true if an new entry was added - std::pair add(const ValueType &value); + std::pair add(const ValueType&); // reduces the count of the value, and removes it if count // goes down to zero - void remove(const ValueType& value); - void remove(iterator it); + void remove(const ValueType&); + void remove(iterator); - void clear(); - + // removes the value, regardless of its count + void clear(iterator); + void clear(const ValueType&); + + // clears the whole set + void clear(); + private: ImplType m_impl; }; @@ -166,6 +171,21 @@ namespace WTF { } template + inline void HashCountedSet::clear(const ValueType& value) + { + clear(find(value)); + } + + template + inline void HashCountedSet::clear(iterator it) + { + if (it == end()) + return; + + m_impl.remove(it); + } + + template inline void HashCountedSet::clear() { m_impl.clear(); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h index 39cafab..73212db 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h @@ -278,6 +278,10 @@ #undef ARM_ARCH_VERSION #define ARM_ARCH_VERSION 7 #endif +/* On ARMv5 and below the natural alignment is required. */ +#if !defined(ARM_REQUIRE_NATURAL_ALIGNMENT) && ARM_ARCH_VERSION <= 5 +#define ARM_REQUIRE_NATURAL_ALIGNMENT 1 +#endif /* Defines two pseudo-platforms for ARM and Thumb-2 instruction set. */ #if !defined(WTF_PLATFORM_ARM_TRADITIONAL) && !defined(WTF_PLATFORM_ARM_THUMB2) # if defined(thumb2) || defined(__thumb2__) @@ -560,6 +564,7 @@ #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !PLATFORM(IPHONE) #define HAVE_MADV_FREE_REUSE 1 #define HAVE_MADV_FREE 1 +#define HAVE_PTHREAD_SETNAME_NP 1 #endif #if PLATFORM(IPHONE) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/RandomNumber.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/RandomNumber.cpp index 0e6e208..52fb130 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/RandomNumber.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/RandomNumber.cpp @@ -82,6 +82,23 @@ double randomNumber() return static_cast(fullRandom)/static_cast(1LL << 53); #elif PLATFORM(WINCE) return genrand_res53(); +#elif PLATFORM(WIN_OS) + uint32_t part1 = rand() & (RAND_MAX - 1); + uint32_t part2 = rand() & (RAND_MAX - 1); + uint32_t part3 = rand() & (RAND_MAX - 1); + uint32_t part4 = rand() & (RAND_MAX - 1); + // rand only provides 15 bits on Win32 + uint64_t fullRandom = part1; + fullRandom <<= 15; + fullRandom |= part2; + fullRandom <<= 15; + fullRandom |= part3; + fullRandom <<= 15; + fullRandom |= part4; + + // Mask off the low 53bits + fullRandom &= (1LL << 53) - 1; + return static_cast(fullRandom)/static_cast(1LL << 53); #else uint32_t part1 = rand() & (RAND_MAX - 1); uint32_t part2 = rand() & (RAND_MAX - 1); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSpinLock.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSpinLock.h index ced2283..4cf30c2 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSpinLock.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSpinLock.h @@ -209,6 +209,13 @@ struct TCMalloc_SpinLock { inline void Unlock() { if (pthread_mutex_unlock(&private_lock_) != 0) CRASH(); } + bool IsHeld() { + if (pthread_mutex_trylock(&private_lock_)) + return true; + + Unlock(); + return false; + } }; #define SPINLOCK_INITIALIZER { PTHREAD_MUTEX_INITIALIZER } diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadingPthreads.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadingPthreads.cpp index c241bd9..e4fb419 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadingPthreads.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadingPthreads.cpp @@ -186,7 +186,7 @@ ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, con void setThreadNameInternal(const char* threadName) { -#if PLATFORM(DARWIN) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !PLATFORM(IPHONE) +#if HAVE(PTHREAD_SETNAME_NP) pthread_setname_np(threadName); #else UNUSED_PARAM(threadName); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.cpp index 4390b5b..d777424 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.cpp @@ -549,11 +549,11 @@ class RegexGenerator : private MacroAssembler { } if (mask) { - load32(BaseIndex(input, index, TimesTwo, state.inputOffset() * sizeof(UChar)), character); + load32WithUnalignedHalfWords(BaseIndex(input, index, TimesTwo, state.inputOffset() * sizeof(UChar)), character); or32(Imm32(mask), character); state.jumpToBacktrack(branch32(NotEqual, character, Imm32(chPair | mask)), this); } else - state.jumpToBacktrack(branch32(NotEqual, BaseIndex(input, index, TimesTwo, state.inputOffset() * sizeof(UChar)), Imm32(chPair)), this); + state.jumpToBacktrack(branch32WithUnalignedHalfWords(NotEqual, BaseIndex(input, index, TimesTwo, state.inputOffset() * sizeof(UChar)), Imm32(chPair)), this); } void generatePatternCharacterFixed(TermGenerationState& state) diff --git a/src/3rdparty/javascriptcore/VERSION b/src/3rdparty/javascriptcore/VERSION index 3d9c27c..3815dfb 100644 --- a/src/3rdparty/javascriptcore/VERSION +++ b/src/3rdparty/javascriptcore/VERSION @@ -4,8 +4,8 @@ This is a snapshot of JavaScriptCore from The commit imported was from the - jsc-for-qtscript-4.6-staging-01102009 branch/tag + jsc-for-qtscript-4.6-staging-05102009 branch/tag and has the sha1 checksum - 79e88e90aab6674098b6d73b1b41998117164499 + 38c2b17366f24220d9ae0456a7cfe2ac78a9f91c diff --git a/src/3rdparty/javascriptcore/WebKit.pri b/src/3rdparty/javascriptcore/WebKit.pri index fd918c9..f5276b3 100644 --- a/src/3rdparty/javascriptcore/WebKit.pri +++ b/src/3rdparty/javascriptcore/WebKit.pri @@ -31,7 +31,10 @@ building-libs { DEPENDPATH += $$PWD/WebKit/qt/Api } -DEFINES += USE_SYSTEM_MALLOC +!win32:!mac:!unix { + DEFINES += USE_SYSTEM_MALLOC +} + CONFIG(release, debug|release) { DEFINES += NDEBUG } @@ -48,7 +51,7 @@ symbian|*-armcc { RVCT_COMMON_CFLAGS = --gnu --diag_suppress 68,111,177,368,830,1293 RVCT_COMMON_CXXFLAGS = $$RVCT_COMMON_CFLAGS --no_parse_templates DEFINES *= QT_NO_UITOOLS -} +} *-armcc { QMAKE_CFLAGS += $$RVCT_COMMON_CFLAGS @@ -63,7 +66,7 @@ contains(DEFINES, QT_NO_UITOOLS): CONFIG -= uitools # Disable a few warnings on Windows. The warnings are also # disabled in WebKitLibraries/win/tools/vsprops/common.vsprops -win32-msvc*: QMAKE_CXXFLAGS += -wd4291 -wd4344 -wd4396 -wd4503 -wd4800 -wd4819 -wd4996 +win32-msvc*: QMAKE_CXXFLAGS += -wd4291 -wd4344 -wd4503 -wd4800 -wd4819 -wd4996 # # For builds inside Qt we interpret the output rule and the input of each extra compiler manually diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index fb14940..09042e1 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -2168,7 +2168,7 @@ QScriptValue QScriptEngine::evaluate(const QString &program, const QString &file exec->clearException(); JSC::DynamicGlobalObjectScope dynamicGlobalObjectScope(exec, exec->scopeChain()->globalObject()); - JSC::EvalExecutable executable(source); + JSC::EvalExecutable executable(exec, source); JSC::JSObject* error = executable.compile(exec, exec->scopeChain()); if (error) { exec->setException(error); -- cgit v0.12 From fd8fda4db4446e394db137ce572a9f2508d12bf2 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 5 Oct 2009 13:44:54 +0200 Subject: Fixed pixeldust in translucent toplevel proxy widgets on Mac Reviewed-by: Bjoern Erik Nilsen (cherry picked from commit 0ae8f0b63e6705790ad0bdb0f90644b557b5ac67) --- src/gui/kernel/qwidget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 2359812..4cbf762 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -5130,7 +5130,8 @@ void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset return; QPixmap pixmap(size); - if (!(renderFlags & QWidget::DrawWindowBackground)) + if (!(renderFlags & QWidget::DrawWindowBackground) + || !q->palette().brush(q->backgroundRole()).isOpaque()) pixmap.fill(Qt::transparent); q->render(&pixmap, QPoint(), toBePainted, renderFlags); @@ -11447,7 +11448,7 @@ QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction) const QRect targetCandidateRect = targetCandidate->rect().translated(targetCandidate->mapToGlobal(QPoint())); - // For focus proxies, the child widget handling the focus can have keypad navigation focus, + // For focus proxies, the child widget handling the focus can have keypad navigation focus, // but the owner of the proxy cannot. // Additionally, empty widgets should be ignored. if (targetCandidate->focusProxy() || targetCandidateRect.isEmpty()) -- cgit v0.12 From 105f17800e4a12e12d728f6f319ebbe9be7fd433 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 5 Oct 2009 14:13:53 +0200 Subject: QAbstractItemView: Make sure the view is updated when a delegate is set. The test tst_QListView::task254449_draggingItemToNegativeCoordinates was failing in cocoa because of this. (on, cocoa, the call to show was doing the first paintEvent) Reviewed-by: Thierry (cherry picked from commit e1fbf1e016cbbf203964f3606ee2a34afe33bbd7) --- src/gui/itemviews/qabstractitemview.cpp | 4 +++- tests/auto/qlistview/tst_qlistview.cpp | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 18cab13..27528de 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -751,7 +751,6 @@ void QAbstractItemView::setItemDelegate(QAbstractItemDelegate *delegate) } } - if (delegate) { if (d->delegateRefCount(delegate) == 0) { connect(delegate, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)), @@ -762,6 +761,7 @@ void QAbstractItemView::setItemDelegate(QAbstractItemDelegate *delegate) } } d->itemDelegate = delegate; + update(); } /*! @@ -826,6 +826,7 @@ void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate *de } d->rowDelegates.insert(row, delegate); } + update(); } /*! @@ -882,6 +883,7 @@ void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelega } d->columnDelegates.insert(column, delegate); } + update(); } /*! diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index d9cab02..cba1776 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -1617,6 +1617,8 @@ void tst_QListView::task254449_draggingItemToNegativeCoordinates() list.setModel(&model); list.setViewMode(QListView::IconMode); list.show(); + QTest::qWaitForWindowShown(&list); + class MyItemDelegate : public QStyledItemDelegate { public: @@ -1631,10 +1633,9 @@ void tst_QListView::task254449_draggingItemToNegativeCoordinates() mutable int numPaints; } delegate; list.setItemDelegate(&delegate); - delegate.numPaints = 0; - QTest::qWaitForWindowShown(&list); //makes sure the layout is done - QTRY_VERIFY(delegate.numPaints > 0); + QApplication::processEvents(); + QTRY_VERIFY(delegate.numPaints > 0); //makes sure the layout is done const QPoint topLeft(-6, 0); list.setPositionForIndex(topLeft, index); -- cgit v0.12 From 5f1728eb5a6b3e6654f75b4af0812eb3b800989f Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 5 Oct 2009 14:21:32 +0200 Subject: Stopped using bitfields for S60 and Symbian versions. There is no reason for it, since they will never overlap. Left a little space between numbers in case of patch releases. RevBy: Iain (cherry picked from commit 19a6d4245ca152758d8dbc7f7d9ee0f0654c04f7) --- src/corelib/global/qglobal.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index dcd4397..5720505 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1478,17 +1478,17 @@ public: #ifdef Q_OS_SYMBIAN enum SymbianVersion { SV_Unknown = 0x0000, - SV_9_2 = 0x0001, - SV_9_3 = 0x0002, - SV_9_4 = 0x0004 + SV_9_2 = 10, + SV_9_3 = 20, + SV_9_4 = 30 }; static SymbianVersion symbianVersion(); enum S60Version { - SV_S60_None = 0x0000, - SV_S60_Unknown = 0x0001, - SV_S60_3_1 = 0x0002, - SV_S60_3_2 = 0x0004, - SV_S60_5_0 = 0x0008 + SV_S60_None = 0, + SV_S60_Unknown = 1, + SV_S60_3_1 = 10, + SV_S60_3_2 = 20, + SV_S60_5_0 = 30 }; static S60Version s60Version(); #endif -- cgit v0.12 From 6ee7369737feba856e5f2b94f6fa02dce3e489f8 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 5 Oct 2009 14:33:08 +0200 Subject: doc: fix two errors in statemachine snippets (cherry picked from commit b73f1b3d88927b0c51c0624f67695cfd80167d38) --- doc/src/snippets/statemachine/main2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/snippets/statemachine/main2.cpp b/doc/src/snippets/statemachine/main2.cpp index d882400..2419dc2 100644 --- a/doc/src/snippets/statemachine/main2.cpp +++ b/doc/src/snippets/statemachine/main2.cpp @@ -57,7 +57,7 @@ int main(int argv, char **args) //![0] //![2] - s12>addTransition(quitButton, SIGNAL(clicked()), s12); + s12->addTransition(quitButton, SIGNAL(clicked()), s12); //![2] //![1] @@ -71,7 +71,7 @@ int main(int argv, char **args) QButton *interruptButton = new QPushButton("Interrupt Button"); //![3] - QHistoryState *s1h = s1->addHistoryState(); + QHistoryState *s1h = new QHistoryState(s1); QState *s3 = new QState(); s3->assignProperty(label, "text", "In s3"); -- cgit v0.12 From 4d1823e5a1e0f21dcf296700638db285376742da Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 5 Oct 2009 16:07:30 +0300 Subject: Fixes to qpixmapcache test cases, test case now adapts to cache_limit. The default cache_limit in different platforms have different value. For example in Symbian the default is currently 1024 KB where as for desktop platforms the default is 10 MB. The purpose of modified qpixmapcache test cases was to do operations until cache_limit was reached. This was achieved by hard coded 40000 iterations. However this hard-coded value is fargile for cache limit changes, and in addition it unnecessarily made the test exectuion to take very long time on platforms which had smaller cache limit. This patch changes the test so that number of expected items to fit in cache is calculated and then 1000 extra items is tried to put in cache to make sure limit is exceeded. Reviewed-by: Alexis Menard (cherry picked from commit bfe0e5c0d47780542b174dc96973920fba11c451) --- tests/auto/qpixmapcache/tst_qpixmapcache.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp index b487d74..9775d36 100644 --- a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp +++ b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp @@ -244,16 +244,23 @@ void tst_QPixmapCache::insert() QPixmap p2(10, 10); p2.fill(Qt::yellow); + // Calcuate estimated num of items what fits to cache + int estimatedNum = (1024 * QPixmapCache::cacheLimit()) + / ((p1.width() * p1.height() * p1.depth()) / 8); + + // Mare sure we will put enough items to reach the cache limit + const int numberOfKeys = estimatedNum + 1000; + // make sure it doesn't explode - for (int i = 0; i < 20000; ++i) + for (int i = 0; i < numberOfKeys; ++i) QPixmapCache::insert("0", p1); // ditto - for (int j = 0; j < 40000; ++j) + for (int j = 0; j < numberOfKeys; ++j) QPixmapCache::insert(QString::number(j), p1); int num = 0; - for (int k = 0; k < 40000; ++k) { + for (int k = 0; k < numberOfKeys; ++k) { if (QPixmapCache::find(QString::number(k))) ++num; } @@ -261,9 +268,6 @@ void tst_QPixmapCache::insert() if (QPixmapCache::find("0")) ++num; - int estimatedNum = (1024 * QPixmapCache::cacheLimit()) - / ((p1.width() * p1.height() * p1.depth()) / 8); - QVERIFY(num <= estimatedNum); QPixmap p3; QPixmapCache::insert("null", p3); @@ -281,11 +285,11 @@ void tst_QPixmapCache::insert() //The int part of the API // make sure it doesn't explode QList keys; - for (int i = 0; i < 40000; ++i) + for (int i = 0; i < numberOfKeys; ++i) keys.append(QPixmapCache::insert(p1)); num = 0; - for (int k = 0; k < 40000; ++k) { + for (int k = 0; k < numberOfKeys; ++k) { if (QPixmapCache::find(keys.at(k), &p2)) ++num; } @@ -393,7 +397,12 @@ void tst_QPixmapCache::clear() QPixmap p1(10, 10); p1.fill(Qt::red); - const int numberOfKeys = 40000; + // Calcuate estimated num of items what fits to cache + int estimatedNum = (1024 * QPixmapCache::cacheLimit()) + / ((p1.width() * p1.height() * p1.depth()) / 8); + + // Mare sure we will put enough items to reach the cache limit + const int numberOfKeys = estimatedNum + 1000; for (int i = 0; i < numberOfKeys; ++i) QVERIFY(QPixmapCache::find("x" + QString::number(i)) == 0); -- cgit v0.12 From b8b407a1f19d0521db93e7e5a7fbd03db7f6825c Mon Sep 17 00:00:00 2001 From: mae Date: Mon, 5 Oct 2009 15:07:10 +0200 Subject: Fix QKeySequence::DeleteEndOfWord and QKeySequence::DeleteStartOfWord QTextControl showed inconsistent behaviour with DeleteEndOfWord and DeleteStartOfWord when the cursor had a selection. With this patch, the commands will simply delete the existing selection, which is consistent behaviour with in other IDEs. Reviewed-by: Simon Hausmann (cherry picked from commit 6ce698050bbe9a4ec5198f1e08b94d51b8a6c9bd) --- src/gui/text/qtextcontrol.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 6def06e..db4c07c 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1223,11 +1223,13 @@ void QTextControlPrivate::keyPressEvent(QKeyEvent *e) cursor.deleteChar(); } else if (e == QKeySequence::DeleteEndOfWord) { - cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor); + if (!cursor.hasSelection()) + cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor); cursor.removeSelectedText(); } else if (e == QKeySequence::DeleteStartOfWord) { - cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor); + if (!cursor.hasSelection()) + cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor); cursor.removeSelectedText(); } else if (e == QKeySequence::DeleteEndOfLine) { -- cgit v0.12 From 7e89d6d5b98fddd62572f87d61f7137c9fca21f6 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Mon, 5 Oct 2009 14:55:50 +0200 Subject: Fixed noisy looking textures in Basic Drawing example with GL2 engine. When running the Basic Drawing example with the GL2 paint engine and antialiasing enabled, textures looked noisy. When antialiasing was enabled, the example translated the painter half a pixel to get sharp lines. This caused the textures to be sampled at texel corners. Without linear interpolation, sampling textures at texel corners is unpredictable. The fix is to not translate the painter. Reviewed-by: Gunnar (cherry picked from commit 30f413b74f883f7e3984dfe39d825aa6c5f16132) --- examples/painting/basicdrawing/renderarea.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/painting/basicdrawing/renderarea.cpp b/examples/painting/basicdrawing/renderarea.cpp index e8222af..4f07a2d 100644 --- a/examples/painting/basicdrawing/renderarea.cpp +++ b/examples/painting/basicdrawing/renderarea.cpp @@ -136,11 +136,9 @@ void RenderArea::paintEvent(QPaintEvent * /* event */) QPainter painter(this); painter.setPen(pen); painter.setBrush(brush); - if (antialiased) { + if (antialiased) painter.setRenderHint(QPainter::Antialiasing, true); //! [9] - painter.translate(+0.5, +0.5); - } //! [10] for (int x = 0; x < width(); x += 100) { @@ -202,6 +200,7 @@ void RenderArea::paintEvent(QPaintEvent * /* event */) } } + painter.setRenderHint(QPainter::Antialiasing, false); painter.setPen(palette().dark().color()); painter.setBrush(Qt::NoBrush); painter.drawRect(QRect(0, 0, width() - 1, height() - 1)); -- cgit v0.12 From 92b07d2b7054025a661a4c2de226d84a5be4d48f Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 5 Oct 2009 15:38:01 +0200 Subject: Updated JavaScriptCore from /home/khansen/dev/qtwebkit to jsc-for-qtscript-4.6-staging-05102009 ( ed678069ebd06579a26b4fb8cc944f06d6b0d55c ) (cherry picked from commit 3e574dc0d1b7b2ac351bdf077b86979c85de7972) --- src/3rdparty/javascriptcore/JavaScriptCore/jsc.pro | 31 ---------------------- src/3rdparty/javascriptcore/VERSION | 2 +- src/3rdparty/javascriptcore/WebKit.pri | 2 +- 3 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jsc.pro diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jsc.pro b/src/3rdparty/javascriptcore/JavaScriptCore/jsc.pro deleted file mode 100644 index ba880ff..0000000 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jsc.pro +++ /dev/null @@ -1,31 +0,0 @@ -TEMPLATE = app -TARGET = jsc -DESTDIR = . -SOURCES = jsc.cpp -QT -= gui -CONFIG -= app_bundle -CONFIG += building-libs -win32-*: CONFIG += console -win32-msvc*: CONFIG += exceptions_off stl_off - -include($$PWD/../WebKit.pri) - -CONFIG += link_pkgconfig - -QMAKE_RPATHDIR += $$OUTPUT_DIR/lib - -isEmpty(OUTPUT_DIR):OUTPUT_DIR=$$PWD/.. -CONFIG(debug, debug|release) { - OBJECTS_DIR = obj/debug -} else { # Release - OBJECTS_DIR = obj/release -} -OBJECTS_DIR_WTR = $$OBJECTS_DIR$${QMAKE_DIR_SEP} -include($$PWD/JavaScriptCore.pri) - -lessThan(QT_MINOR_VERSION, 4) { - DEFINES += QT_BEGIN_NAMESPACE="" QT_END_NAMESPACE="" -} - -*-g++*:QMAKE_CXXFLAGS_RELEASE -= -O2 -*-g++*:QMAKE_CXXFLAGS_RELEASE += -O3 diff --git a/src/3rdparty/javascriptcore/VERSION b/src/3rdparty/javascriptcore/VERSION index 3815dfb..8f2b739 100644 --- a/src/3rdparty/javascriptcore/VERSION +++ b/src/3rdparty/javascriptcore/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - 38c2b17366f24220d9ae0456a7cfe2ac78a9f91c + ed678069ebd06579a26b4fb8cc944f06d6b0d55c diff --git a/src/3rdparty/javascriptcore/WebKit.pri b/src/3rdparty/javascriptcore/WebKit.pri index f5276b3..8291f30 100644 --- a/src/3rdparty/javascriptcore/WebKit.pri +++ b/src/3rdparty/javascriptcore/WebKit.pri @@ -31,7 +31,7 @@ building-libs { DEPENDPATH += $$PWD/WebKit/qt/Api } -!win32:!mac:!unix { +!mac:!unix|symbian { DEFINES += USE_SYSTEM_MALLOC } -- cgit v0.12 From 79fb5a199c320e146700ca6af3016888520ab9ad Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 5 Oct 2009 15:43:45 +0200 Subject: Test fix on Mac (cherry picked from commit eda93b795b044542a4247a086e4c2eed454123e4) --- tests/auto/qlineedit/tst_qlineedit.cpp | 1 + tests/auto/qtreewidget/tst_qtreewidget.cpp | 1 + tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index 1417e69..8368114 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -3493,6 +3493,7 @@ void tst_QLineEdit::task241436_passwordEchoOnEditRestoreEchoMode() testWidget->setEchoMode(QLineEdit::PasswordEchoOnEdit); testWidget->setFocus(); + QApplication::setActiveWindow(testWidget); QTRY_VERIFY(testWidget->hasFocus()); QTest::keyPress(testWidget, '0'); diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index 4a74d96..11c4543 100644 --- a/tests/auto/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp @@ -468,6 +468,7 @@ void tst_QTreeWidget::editItem() QTest::ignoreMessage(QtWarningMsg, "edit: editing failed"); tree.editItem(item, col); QApplication::instance()->processEvents(); + QApplication::instance()->processEvents(); QLineEdit *editor = qFindChild(&tree); if (editor) { QVERIFY(item->flags() & Qt::ItemIsEditable); diff --git a/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro b/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro index 531e48b..bcc988a 100644 --- a/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro +++ b/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro @@ -14,7 +14,10 @@ if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { win32:PATTERNIST_SDK = $${PATTERNIST_SDK}d else: PATTERNIST_SDK = $${PATTERNIST_SDK}_debug } -LIBS += -l$$PATTERNIST_SDK -lQtXml + +LIBS += -l$$PATTERNIST_SDK + +QT += xml INCLUDEPATH += $$QT_SOURCE_TREE/tests/auto/xmlpatternsxqts/lib/ \ $$QT_BUILD_TREE/include/QtXmlPatterns/private \ -- cgit v0.12 From 85b71e4bae5ea4989c2c2ccf769b6f25ea631a4d Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 5 Oct 2009 16:09:17 +0200 Subject: Moved non-public functions out of public header file. RevBy: Trust me (cherry picked from commit c6e0bf67795768954bc2ac129f20dbb7243b2975) --- src/gui/widgets/qmenu.h | 8 -------- src/gui/widgets/qmenu_p.h | 5 +++++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/gui/widgets/qmenu.h b/src/gui/widgets/qmenu.h index 3d41727..0346a55 100644 --- a/src/gui/widgets/qmenu.h +++ b/src/gui/widgets/qmenu.h @@ -52,19 +52,11 @@ #endif QT_BEGIN_HEADER -#ifdef Q_WS_S60 - class CEikMenuPane; -#endif QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#ifdef Q_WS_S60 -void qt_symbian_show_toplevel(CEikMenuPane* menuPane); -void qt_symbian_show_submenu(CEikMenuPane* menuPane, int id); -#endif // Q_WS_S60 - #ifndef QT_NO_MENU class QMenuPrivate; diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index 2d5632e..ea1ab47 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -68,6 +68,11 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_MENU +#ifdef Q_WS_S60 +void qt_symbian_show_toplevel(CEikMenuPane* menuPane); +void qt_symbian_show_submenu(CEikMenuPane* menuPane, int id); +#endif // Q_WS_S60 + class QTornOffMenu; class QEventLoop; -- cgit v0.12 From 469fea6244d1c73e794f095b562c126d1f7b4d9d Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 5 Oct 2009 16:10:41 +0200 Subject: Fixed indentation. (cherry picked from commit 5e1fcb056a42abdfd04d7ca25f55de43dfdcc648) --- src/gui/widgets/qmenu_symbian.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 6fc4371..d3d3892 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -250,12 +250,12 @@ void QMenuBarPrivate::symbianCommands(int command) int size = nativeMenuBars.size(); for (int i = 0; i < nativeMenuBars.size(); ++i) { - SymbianMenuItem* menu = qt_symbian_find_menu_item(command, symbianMenus); - if (!menu) + SymbianMenuItem* menu = qt_symbian_find_menu_item(command, symbianMenus); + if (!menu) continue; emit nativeMenuBars.at(i)->triggered(menu->action); - menu->action->activate(QAction::Trigger); + menu->action->activate(QAction::Trigger); break; } } -- cgit v0.12 From 91475368d490cecd84e17f295a14e8e34ba381fb Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 5 Oct 2009 16:11:04 +0200 Subject: Added some comments. (cherry picked from commit 4754ebccb9848bff1cb11caab61f58ac2f441b3c) --- src/gui/widgets/qmenu_symbian.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index d3d3892..e0eb87e 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -397,7 +397,7 @@ void QMenuBarPrivate::QSymbianMenuBarPrivate::rebuild() contextMenuActionList.clear(); if (widgetWithContextMenu) { - contexMenuCommand = qt_symbian_menu_static_cmd_id; + contexMenuCommand = qt_symbian_menu_static_cmd_id; // Increased inside insertNativeMenuItems contextAction.setText(QMenuBar::tr("Actions")); contextMenuActionList.append(&contextAction); insertNativeMenuItems(contextMenuActionList); -- cgit v0.12 From 79b6b21eb72d60e7136c4ad5f4642bc1251b3b4a Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 5 Oct 2009 15:56:57 +0200 Subject: Fixed a crash in menus on Symbian. The reason for the crash was the following: When we make menu entries in Qt, we assign each item an arbitrary command ID. This is because Symbian usually puts the items in a resource file and refers to them by ID, but we need to be dynamic. These command IDs are also assigned to cascading menu items (sub menus). When we then get a callback in RestoreMenuL with one of submenu IDs, we used to ask Symbian to construct the menu items for them, but Symbian doesn't know about them. Fixed by avoiding call into S60 code if the ID belongs to Qt. Also put a cap on the number of menu items. It's very unlikely that anyone will reach it, but it's better to have an actual check. Task: QT-646 AutoTest: Manual testing went fine RevBy: mread (cherry picked from commit c4571223a0ebb2f00a6c29477d0a4a55ae3cd2b5) --- src/gui/s60framework/qs60mainappui.cpp | 21 ++++++++++----------- src/gui/widgets/qmenu_p.h | 2 ++ src/gui/widgets/qmenu_symbian.cpp | 12 +++++++----- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index 9e2333b..d8181f8 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -51,7 +51,9 @@ #include "qs60mainappui.h" #include #include -#include +#include +#include +#include QT_BEGIN_NAMESPACE @@ -226,17 +228,14 @@ void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane) */ void QS60MainAppUi::RestoreMenuL(CCoeControl* menuWindow, TInt resourceId, TMenuType menuType) { - if ((resourceId == R_QT_WRAPPERAPP_MENUBAR) || (resourceId == R_AVKON_MENUPANE_FEP_DEFAULT)) { - TResourceReader reader; - iCoeEnv->CreateResourceReaderLC(reader, resourceId); - menuWindow->ConstructFromResourceL(reader); - CleanupStack::PopAndDestroy(); + if (resourceId >= QT_SYMBIAN_FIRST_MENU_ITEM && resourceId <= QT_SYMBIAN_LAST_MENU_ITEM) { + if (menuType == EMenuPane) + DynInitMenuPaneL(resourceId, (CEikMenuPane*)menuWindow); + else + DynInitMenuBarL(resourceId, (CEikMenuBar*)menuWindow); + } else { + CAknAppUi::RestoreMenuL(menuWindow, resourceId, menuType); } - - if (menuType == EMenuPane) - DynInitMenuPaneL(resourceId, (CEikMenuPane*)menuWindow); - else - DynInitMenuBarL(resourceId, (CEikMenuBar*)menuWindow); } QT_END_NAMESPACE diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index ea1ab47..9c4f260 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -63,6 +63,8 @@ #ifdef Q_WS_S60 class CEikMenuPane; +#define QT_SYMBIAN_FIRST_MENU_ITEM 32000 +#define QT_SYMBIAN_LAST_MENU_ITEM 41999 // 10000 items ought to be enough for anybody... #endif QT_BEGIN_NAMESPACE diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index e0eb87e..c656ef8 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -66,8 +66,6 @@ QT_BEGIN_NAMESPACE typedef QMultiHash MenuBarHash; Q_GLOBAL_STATIC(MenuBarHash, menubars) -#define QT_FIRST_MENU_ITEM 32000 - struct SymbianMenuItem { int id; @@ -78,7 +76,7 @@ struct SymbianMenuItem static QList symbianMenus; static QList nativeMenuBars; -static uint qt_symbian_menu_static_cmd_id = QT_FIRST_MENU_ITEM; +static uint qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM; static QPointer widgetWithContextMenu; static QList contextMenuActionList; static QAction contextAction(0); @@ -145,6 +143,9 @@ static void qt_symbian_insert_action(QSymbianMenuAction* action, QListaction->isSeparator()) return; + Q_ASSERT_X(action->command <= QT_SYMBIAN_LAST_MENU_ITEM, "qt_symbian_insert_action", + "Too many menu actions"); + const int underlineShortCut = QApplication::style()->styleHint(QStyle::SH_UnderlineShortcut); QString iconText = action->action->iconText(); TPtrC menuItemText = qt_QString2TPtrC( underlineShortCut ? action->action->text() : iconText); @@ -213,7 +214,7 @@ static void rebuildMenu() if (w) { mb = menubars()->value(w); - qt_symbian_menu_static_cmd_id = QT_FIRST_MENU_ITEM; + qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM; deleteAll( &symbianMenus ); if (!mb) return; @@ -289,6 +290,7 @@ QMenuBarPrivate::QSymbianMenuBarPrivate::QSymbianMenuBarPrivate(QMenuBarPrivate QMenuBarPrivate::QSymbianMenuBarPrivate::~QSymbianMenuBarPrivate() { + qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM; deleteAll( &symbianMenus ); symbianMenus.clear(); d = 0; @@ -390,7 +392,7 @@ void QMenuBarPrivate::QSymbianMenuBarPrivate::insertNativeMenuItems(const QList< void QMenuBarPrivate::QSymbianMenuBarPrivate::rebuild() { contexMenuCommand = 0; - qt_symbian_menu_static_cmd_id = QT_FIRST_MENU_ITEM; + qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM; deleteAll( &symbianMenus ); if (d) insertNativeMenuItems(d->actions); -- cgit v0.12 From 1decaac044da42a6ccbf84898f0ded6d3b5c70d0 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Mon, 5 Oct 2009 16:06:20 +0200 Subject: use QTRY_VERIFY instead of qWait() in tst_QDialog::reject() This test already uses qWaitForWindowManager(), but on X11, reshowing a dialog can take long as the window manager has to do more work before remapping the window. we should give it more time (hence the change to QTRY_VERIFY) Reviewed-by: Rohan McGovern (cherry picked from commit d763b9a56c5f488a6a4187f6aa454405ab75d09b) --- tests/auto/qdialog/tst_qdialog.cpp | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/tests/auto/qdialog/tst_qdialog.cpp b/tests/auto/qdialog/tst_qdialog.cpp index dc6878d..e95bc53 100644 --- a/tests/auto/qdialog/tst_qdialog.cpp +++ b/tests/auto/qdialog/tst_qdialog.cpp @@ -50,6 +50,8 @@ #include #include +#include "../../shared/util.h" + Q_DECLARE_METATYPE(QSize) @@ -160,8 +162,8 @@ void tst_QDialog::initTestCase() void tst_QDialog::cleanupTestCase() { if (testWidget) { - delete testWidget; - testWidget = 0; + delete testWidget; + testWidget = 0; } } @@ -585,35 +587,27 @@ void tst_QDialog::reject() TestRejectDialog dialog; dialog.show(); QTest::qWaitForWindowShown(&dialog); - QTest::qWait(100); - QVERIFY(dialog.isVisible()); + QTRY_VERIFY(dialog.isVisible()); dialog.reject(); - QTest::qWait(100); - QVERIFY(!dialog.isVisible()); + QTRY_VERIFY(!dialog.isVisible()); QCOMPARE(dialog.called, 1); dialog.show(); QTest::qWaitForWindowShown(&dialog); - QTest::qWait(100); - - QVERIFY(dialog.isVisible()); + QTRY_VERIFY(dialog.isVisible()); QVERIFY(dialog.close()); - QTest::qWait(100); - QVERIFY(!dialog.isVisible()); + QTRY_VERIFY(!dialog.isVisible()); QCOMPARE(dialog.called, 2); dialog.cancelReject = true; dialog.show(); QTest::qWaitForWindowShown(&dialog); - QTest::qWait(100); - QVERIFY(dialog.isVisible()); + QTRY_VERIFY(dialog.isVisible()); dialog.reject(); - QTest::qWait(100); - QVERIFY(dialog.isVisible()); + QTRY_VERIFY(dialog.isVisible()); QCOMPARE(dialog.called, 3); QVERIFY(!dialog.close()); - QTest::qWait(100); - QVERIFY(dialog.isVisible()); + QTRY_VERIFY(dialog.isVisible()); QCOMPARE(dialog.called, 4); } -- cgit v0.12 From 8b7fb503e67ad43374df166cddde158a205b3981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 5 Oct 2009 15:36:38 +0200 Subject: Fixed bug in X11 paint engine causing source pixmap depth to change. Setting a pixmap brush when painting to a 32-bit target might cause the source pixmap to be converted to 32-bit. We should detach the pixmap if we need to convert it. Reviewed-by: Trond (cherry picked from commit 1210fa5b2d65895ad2be1f9ca7cae586e3b29dc1) --- src/gui/painting/qpaintengine_x11.cpp | 1 + tests/auto/qpixmap/tst_qpixmap.cpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index 4d2521a..59482c6 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -1402,6 +1402,7 @@ void QX11PaintEngine::updateBrush(const QBrush &brush, const QPointF &origin) mask |= GCTile; #ifndef QT_NO_XRENDER if (d->pdev_depth == 32 && d->brush_pm.depth() != 32) { + d->brush_pm.detach(); QX11PixmapData *brushData = static_cast(d->brush_pm.data.data()); brushData->convertToARGB32(); } diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 2568b94..36c1518 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -166,6 +166,8 @@ private slots: void fromImage_crash(); void fromData(); + + void preserveDepth(); }; static bool lenientCompare(const QPixmap &actual, const QPixmap &expected) @@ -1448,6 +1450,23 @@ void tst_QPixmap::task_246446() QVERIFY(pm.mask().isNull()); } +void tst_QPixmap::preserveDepth() +{ + QPixmap target(64, 64); + target.fill(Qt::transparent); + + QPixmap source(64, 64); + source.fill(Qt::white); + + int depth = source.depth(); + + QPainter painter(&target); + painter.setBrush(source); + painter.drawRect(target.rect()); + painter.end(); + + QCOMPARE(depth, source.depth()); +} QTEST_MAIN(tst_QPixmap) #include "tst_qpixmap.moc" -- cgit v0.12 From 8b17866f382b3c7c20746fad92fc810a89634b5a Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Mon, 5 Oct 2009 16:34:30 +0200 Subject: Fixed inheritence of whitespace mode in QtSvg. Task-number: QTBUG-4587 Reviewed-by: Tor Arne (cherry picked from commit a1fa0d50f9bebc7148cd21fa3c420d2ff0fe7d12) --- src/svg/qsvghandler.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 6d2a0f9..3ed918e 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -3569,20 +3569,16 @@ bool QSvgHandler::startElement(const QString &localName, * a lookup by the qualified name here, but this is namespace aware, since * the XML namespace can only be bound to prefix "xml." */ const QStringRef xmlSpace(attributes.value(QLatin1String("xml:space"))); - if(xmlSpace.isNull()) - { + if (xmlSpace.isNull()) { // This element has no xml:space attribute. - m_whitespaceMode.push(QSvgText::Default); - } - else if(xmlSpace == QLatin1String("preserve")) + m_whitespaceMode.push(m_whitespaceMode.isEmpty() ? QSvgText::Default : m_whitespaceMode.top()); + } else if (xmlSpace == QLatin1String("preserve")) { m_whitespaceMode.push(QSvgText::Preserve); - else if(xmlSpace == QLatin1String("default")) + } else if (xmlSpace == QLatin1String("default")) { m_whitespaceMode.push(QSvgText::Default); - else - { + } else { qWarning() << QString::fromLatin1("\"%1\" is an invalid value for attribute xml:space. " "Valid values are \"preserve\" and \"default\".").arg(xmlSpace.toString()); - m_whitespaceMode.push(QSvgText::Default); } -- cgit v0.12 From 5c402c2dc55faec5e2792902c17ba95c8306efef Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 5 Oct 2009 17:00:03 +0200 Subject: Added qtextcodec_p.h to the project file. Reviewed-by: trustme (cherry picked from commit 06aaf39be5cf341237f0eff85f277625ed732d7a) --- src/corelib/codecs/codecs.pri | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri index 724b18d..17f4d91 100644 --- a/src/corelib/codecs/codecs.pri +++ b/src/corelib/codecs/codecs.pri @@ -4,6 +4,7 @@ HEADERS += \ codecs/qisciicodec_p.h \ codecs/qlatincodec_p.h \ codecs/qsimplecodec_p.h \ + codecs/qtextcodec_p.h \ codecs/qtextcodec.h \ codecs/qtsciicodec_p.h \ codecs/qutfcodec_p.h \ -- cgit v0.12 From 643dddef914584110b8a081ab6b8b25a14ff8477 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 5 Oct 2009 16:48:58 +0200 Subject: Fix a compilation warning on Mac OS X The variable updatesEnabled is not used on Mac OS X. (cherry picked from commit fa5f70d3c93758cd8d2c24de73b2d3dc83fb56b8) --- src/gui/widgets/qcombobox.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 95ff4c1..b606538 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -2443,7 +2443,10 @@ void QComboBox::showPopup() } container->setGeometry(listRect); - bool updatesEnabled = container->updatesEnabled(); +#ifndef Q_WS_MAC + const bool updatesEnabled = container->updatesEnabled(); +#endif + #if defined(Q_WS_WIN) && !defined(QT_NO_EFFECTS) bool scrollDown = (listRect.topLeft() == below); if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo) -- cgit v0.12 From 56cb6ce833c4435b21030fc922e72db9c331fd98 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 5 Oct 2009 17:17:11 +0200 Subject: move doc next to implementation (cherry picked from commit c62d9f723347e448033bbb66b281b647166e89f4) --- src/corelib/codecs/qtextcodec.cpp | 43 ++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 4f0e13c..680fcd7 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -741,6 +741,26 @@ static void setup() setupLocaleMapper(); } +/*! + \enum QTextCodec::ConversionFlag + + \value DefaultConversion No flag is set. + \value ConvertInvalidToNull If this flag is set, each invalid input + character is output as a null character. + \value IgnoreHeader Ignore any Unicode byte-order mark and don't generate any. + + \omitvalue FreeFunction +*/ + +/*! + \fn QTextCodec::ConverterState::ConverterState(ConversionFlags flags) + + Constructs a ConverterState object initialized with the given \a flags. +*/ + +/*! + Destroys the ConverterState object. +*/ QTextCodec::ConverterState::~ConverterState() { if (flags & FreeFunction) @@ -883,29 +903,6 @@ QTextCodec::ConverterState::~ConverterState() */ /*! - \enum QTextCodec::ConversionFlag - - \value DefaultConversion No flag is set. - \value ConvertInvalidToNull If this flag is set, each invalid input - character is output as a null character. - \value IgnoreHeader Ignore any Unicode byte-order mark and don't generate any. - - \omitvalue FreeFunction -*/ - -/*! - \fn QTextCodec::ConverterState::ConverterState(ConversionFlags flags) - - Constructs a ConverterState object initialized with the given \a flags. -*/ - -/*! - \fn QTextCodec::ConverterState::~ConverterState() - - Destroys the ConverterState object. -*/ - -/*! \nonreentrant Constructs a QTextCodec, and gives it the highest precedence. The -- cgit v0.12 From 5a7ce43947627c563405dae1ca7cf9995861b0c8 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Mon, 5 Oct 2009 16:28:27 +0200 Subject: OpenSSL wrapping: compile when configured with -openssl-linked we were calling sk_pop_free from OpenSSL with a wrong signature. Reviewed-by: Olivier Goffart (cherry picked from commit b6313e00291a42e1e888a40b0c589ac5be497707) --- src/network/ssl/qsslcertificate.cpp | 4 ---- src/network/ssl/qsslsocket_openssl_symbols.cpp | 3 +-- src/network/ssl/qsslsocket_openssl_symbols_p.h | 3 +-- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 821d7c6..4bd6ff3 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -395,11 +395,7 @@ QMultiMap QSslCertificate::alternateSubje else if (genName->type == GEN_EMAIL) result.insert(QSsl::EmailEntry, altName); } -#if OPENSSL_VERSION_NUMBER >= 0x10000000L q_sk_pop_free((STACK*)altNames, reinterpret_cast(q_sk_free)); -#else - q_sk_pop_free((STACK*)altNames, q_sk_free); -#endif } return result; diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 0762752..12f41bd 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -144,13 +144,12 @@ DEFINEFUNC2(void, RAND_seed, const void *a, a, int b, b, return, DUMMYARG) DEFINEFUNC(int, RAND_status, void, DUMMYARG, return -1, return) DEFINEFUNC(void, RSA_free, RSA *a, a, return, DUMMYARG) DEFINEFUNC(int, sk_num, STACK *a, a, return -1, return) +DEFINEFUNC2(void, sk_pop_free, STACK *a, a, void (*b)(void*), b, return, DUMMYARG) #if OPENSSL_VERSION_NUMBER >= 0x10000000L DEFINEFUNC(void, sk_free, _STACK *a, a, return, DUMMYARG) -DEFINEFUNC2(void, sk_pop_free, STACK *a, a, void (*b)(void*), b, return, DUMMYARG) DEFINEFUNC2(void *, sk_value, STACK *a, a, int b, b, return 0, return) #else DEFINEFUNC(void, sk_free, STACK *a, a, return, DUMMYARG) -DEFINEFUNC2(void, sk_pop_free, STACK *a, a, void (*b)(STACK*), b, return, DUMMYARG) DEFINEFUNC2(char *, sk_value, STACK *a, a, int b, b, return 0, return) #endif DEFINEFUNC(int, SSL_accept, SSL *a, a, return -1, return) diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index 8d71caa..ae6618f 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -256,13 +256,12 @@ void q_RAND_seed(const void *a, int b); int q_RAND_status(); void q_RSA_free(RSA *a); int q_sk_num(STACK *a); +void q_sk_pop_free(STACK *a, void (*b)(void *)); #if OPENSSL_VERSION_NUMBER >= 0x10000000L void q_sk_free(_STACK *a); -void q_sk_pop_free(STACK *a, void (*b)(void *)); void * q_sk_value(STACK *a, int b); #else void q_sk_free(STACK *a); -void q_sk_pop_free(STACK *a, void (*b)(STACK *)); char * q_sk_value(STACK *a, int b); #endif int q_SSL_accept(SSL *a); -- cgit v0.12 From 7455011d91a31993fc3925a9b62716ad1ce76364 Mon Sep 17 00:00:00 2001 From: mae Date: Mon, 5 Oct 2009 18:20:40 +0200 Subject: Fix QPlainTextEdit pageUp/Down key handling in read-only mode QTextControl has two independent interaction flags TextEditable and TextSelectableByKeyboard, i.e. the latter can also apply in read-only mode. This used to be handled incorrectly in QPlainTextEdit. Reviewed-by: con (cherry picked from commit f38b88fa3d8ec4448c28044bf95c5c845a80d3f1) --- src/gui/widgets/qplaintextedit.cpp | 51 ++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index d519bfe..5d13c36 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -1578,7 +1578,35 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e) } #endif - if (!(d->control->textInteractionFlags() & Qt::TextEditable)) { +#ifndef QT_NO_SHORTCUT + + Qt::TextInteractionFlags tif = d->control->textInteractionFlags(); + + if (tif & Qt::TextSelectableByKeyboard){ + if (e == QKeySequence::SelectPreviousPage) { + e->accept(); + d->pageUpDown(QTextCursor::Up, QTextCursor::KeepAnchor); + return; + } else if (e ==QKeySequence::SelectNextPage) { + e->accept(); + d->pageUpDown(QTextCursor::Down, QTextCursor::KeepAnchor); + return; + } + } + if (tif & (Qt::TextSelectableByKeyboard | Qt::TextEditable)) { + if (e == QKeySequence::MoveToPreviousPage) { + e->accept(); + d->pageUpDown(QTextCursor::Up, QTextCursor::MoveAnchor); + return; + } else if (e == QKeySequence::MoveToNextPage) { + e->accept(); + d->pageUpDown(QTextCursor::Down, QTextCursor::MoveAnchor); + return; + } + } +#endif // QT_NO_SHORTCUT + + if (!(tif & Qt::TextEditable)) { switch (e->key()) { case Qt::Key_Space: e->accept(); @@ -1605,27 +1633,6 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e) return; } -#ifndef QT_NO_SHORTCUT - if (e == QKeySequence::MoveToPreviousPage) { - e->accept(); - d->pageUpDown(QTextCursor::Up, QTextCursor::MoveAnchor); - return; - } else if (e == QKeySequence::MoveToNextPage) { - e->accept(); - d->pageUpDown(QTextCursor::Down, QTextCursor::MoveAnchor); - return; - } else if (e == QKeySequence::SelectPreviousPage) { - e->accept(); - d->pageUpDown(QTextCursor::Up, QTextCursor::KeepAnchor); - return; - } else if (e ==QKeySequence::SelectNextPage) { - e->accept(); - d->pageUpDown(QTextCursor::Down, QTextCursor::KeepAnchor); - return; - } -#endif // QT_NO_SHORTCUT - - d->sendControlEvent(e); #ifdef QT_KEYPAD_NAVIGATION if (!e->isAccepted()) { -- cgit v0.12 From b464f8c1736e8120a8c434a962f81146180cd10c Mon Sep 17 00:00:00 2001 From: mae Date: Mon, 5 Oct 2009 18:30:35 +0200 Subject: Fix QTextEdit pageUp/Down key handling in read-only mode QTextControl has two independent interaction flags TextEditable and TextSelectableByKeyboard, i.e. the latter can also apply in read-only mode. This used to be handled incorrectly in QTextEdit. Reviewed-by: con (cherry picked from commit 45cd658c7dce650b12e2d0760e852ece1d8812fd) --- src/gui/widgets/qtextedit.cpp | 49 ++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index dc78fd5..b894aa8 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -1220,8 +1220,35 @@ void QTextEdit::keyPressEvent(QKeyEvent *e) break; } #endif +#ifndef QT_NO_SHORTCUT - if (!(d->control->textInteractionFlags() & Qt::TextEditable)) { + Qt::TextInteractionFlags tif = d->control->textInteractionFlags(); + + if (tif & Qt::TextSelectableByKeyboard){ + if (e == QKeySequence::SelectPreviousPage) { + e->accept(); + d->pageUpDown(QTextCursor::Up, QTextCursor::KeepAnchor); + return; + } else if (e ==QKeySequence::SelectNextPage) { + e->accept(); + d->pageUpDown(QTextCursor::Down, QTextCursor::KeepAnchor); + return; + } + } + if (tif & (Qt::TextSelectableByKeyboard | Qt::TextEditable)) { + if (e == QKeySequence::MoveToPreviousPage) { + e->accept(); + d->pageUpDown(QTextCursor::Up, QTextCursor::MoveAnchor); + return; + } else if (e == QKeySequence::MoveToNextPage) { + e->accept(); + d->pageUpDown(QTextCursor::Down, QTextCursor::MoveAnchor); + return; + } + } +#endif // QT_NO_SHORTCUT + + if (!(tif & Qt::TextEditable)) { switch (e->key()) { case Qt::Key_Space: e->accept(); @@ -1248,26 +1275,6 @@ void QTextEdit::keyPressEvent(QKeyEvent *e) return; } -#ifndef QT_NO_SHORTCUT - if (e == QKeySequence::MoveToPreviousPage) { - e->accept(); - d->pageUpDown(QTextCursor::Up, QTextCursor::MoveAnchor); - return; - } else if (e == QKeySequence::MoveToNextPage) { - e->accept(); - d->pageUpDown(QTextCursor::Down, QTextCursor::MoveAnchor); - return; - } else if (e == QKeySequence::SelectPreviousPage) { - e->accept(); - d->pageUpDown(QTextCursor::Up, QTextCursor::KeepAnchor); - return; - } else if (e ==QKeySequence::SelectNextPage) { - e->accept(); - d->pageUpDown(QTextCursor::Down, QTextCursor::KeepAnchor); - return; - } -#endif // QT_NO_SHORTCUT - { QTextCursor cursor = d->control->textCursor(); const QString text = e->text(); -- cgit v0.12 From d2a547714ab900d1c6e9a62e09ad082b64ab173b Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Mon, 5 Oct 2009 19:34:33 +0200 Subject: Test fix : Move the global test model to a dir that the test won't delete. (cherry picked from commit a3fc0c3b6a45864c845e3a25640b967dd34fa6fc) --- tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp index 2cc2558..29e4fe6 100644 --- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -795,6 +795,8 @@ void tst_QFileSystemModel::sort() model->sort(0, Qt::DescendingOrder); QVERIFY(idx.column() != 0); + model->setRootPath(QDir::homePath()); + QFETCH(bool, fileDialogMode); MyFriendFileSystemModel *myModel = new MyFriendFileSystemModel(); -- cgit v0.12 From d4b9dd763e69a831c169c33d1aa959a4e0b47bed Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 5 Oct 2009 19:41:06 +0200 Subject: Stabilize test on X11 (cherry picked from commit 8dbbff1dec967d043255e8cea2c4d32be3c1f9cd) --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 4 ++-- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 4 ++-- tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp | 4 ++-- tests/auto/qwidget/tst_qwidget.cpp | 5 ++--- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 69c4c92..9f2e4e7 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -2846,11 +2846,11 @@ void tst_QAccessibility::mdiSubWindowTest() { QMdiArea mdiArea; mdiArea.show(); + qApp->setActiveWindow(&mdiArea); #if defined(Q_WS_X11) qt_x11_wait_for_window_manager(&mdiArea); - QTest::qWait(100); + QTest::qWait(150); #endif - qApp->setActiveWindow(&mdiArea); bool isSubWindowsPlacedNextToEachOther = false; const int subWindowCount = 5; diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index e55dc9aa..8459331 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -1705,7 +1705,7 @@ void tst_QGraphicsScene::hoverEvents_parentChild() view.scale(1.7, 1.7); view.show(); QTest::qWaitForWindowShown(&view); - QTest::qWait(50); + QTest::qWait(70); QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove); mouseEvent.setScenePos(QPointF(-1000, -1000)); @@ -1726,7 +1726,7 @@ void tst_QGraphicsScene::hoverEvents_parentChild() qApp->processEvents(); // this posts updates from the scene to the view qApp->processEvents(); // which trigger a repaint here - QVERIFY(items.at(i)->isHovered); + QTRY_VERIFY(items.at(i)->isHovered); if (i < 14) QVERIFY(!items.at(i + 1)->isHovered); i += j ? 1 : -1; diff --git a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp index 2d70bef..8258e15 100644 --- a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp @@ -1650,7 +1650,7 @@ void tst_QMdiSubWindow::resizeTimer() QMdiSubWindow *subWindow = mdiArea.addSubWindow(new QWidget); mdiArea.show(); QTest::qWaitForWindowShown(&mdiArea); - QTest::qWait(250); + QTest::qWait(300); EventSpy timerEventSpy(subWindow, QEvent::Timer); @@ -1663,7 +1663,7 @@ void tst_QMdiSubWindow::resizeTimer() QTest::qWait(500); // Wait for timer events to occur. - QVERIFY(timerEventSpy.count() > 0); + QTRY_VERIFY(timerEventSpy.count() > 0); } void tst_QMdiSubWindow::fixedMinMaxSize() diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index b0a26c2..a4e5d88 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -9024,12 +9024,11 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&parent); #endif - QTest::qWait(100); + QTest::qWait(150); QCursor::setPos(child.mapToGlobal(QPoint(100, 100))); - QTest::qWait(100); // Make sure the cursor has entered the child. - QVERIFY(child.numEnterEvents > 0); + QTRY_VERIFY(child.numEnterEvents > 0); child.hide(); child.reset(); -- cgit v0.12 From 3066b0e55e578896005b4419b8ceff05570fa8ff Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 5 Oct 2009 19:43:13 +0200 Subject: Symbain crash fix for QPixmap->QImage conversion. In some cases the QImage, returned by QS60PixmapData::toImage() image an invalid pointer. That led to reproducable crashes on 3.1 Device and Emulator when starting a drag in the FridgeMagnets demo. Jani Hautakangas created this fix and I tested it on 3.1 Device and Emulator confirming that the crash is gone. Rev-By: Jani Hautakangas Rev-By: Alessandro Portale (cherry picked from commit 064674426ef0c446561b0c338441bb7d5ca091bf) --- src/gui/image/qpixmap_s60.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 326dd10..37b6438 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -664,7 +664,12 @@ void QS60PixmapData::setAlphaChannel(const QPixmap &alphaChannel) QImage QS60PixmapData::toImage() const { - return image; + QS60PixmapData *that = const_cast(this); + that->beginDataAccess(); + QImage copy = that->image.copy(); + that->endDataAccess(); + + return copy; } QPaintEngine* QS60PixmapData::paintEngine() const -- cgit v0.12 From 27a76032f4c0cf2e10fc8adfa1c84b24f9f9aae9 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 5 Oct 2009 19:44:44 +0200 Subject: Fixing Keypad Navigation on N95 devices HAL::Get(HALData::EPen, TInt& result) may set 'result' to 1 on some 3.1 systems (e.g. N95). But we know that S60 systems below 5.0 did not support touch. Let's use tahth knowledge and work-around that N95 HAL bug. Rev-By: Jani Hautakangas (cherry picked from commit 2d0c3bd0fac50d4e9f6c2d7d5e9c2fd8eee4d599) --- src/gui/kernel/qapplication_s60.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 807a17f..acd1041 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1032,6 +1032,11 @@ void qt_init(QApplicationPrivate * /* priv */, int) //Check if mouse interaction is supported (either EMouse=1 in the HAL, or EMachineUID is one of the phones known to support this) const TInt KMachineUidSamsungI8510 = 0x2000C51E; + // HAL::Get(HALData::EPen, TInt& result) may set 'result' to 1 on some 3.1 systems (e.g. N95). + // But we know that S60 systems below 5.0 did not support touch. + static const bool touchIsUnsupportedOnSystem = + QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 + || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2; TInt machineUID; TInt mouse; TInt touch; @@ -1043,7 +1048,7 @@ void qt_init(QApplicationPrivate * /* priv */, int) if (err != KErrNone) machineUID = 0; err = HAL::Get(HALData::EPen, touch); - if (err != KErrNone) + if (err != KErrNone || touchIsUnsupportedOnSystem) touch = 0; if (mouse || machineUID == KMachineUidSamsungI8510) { S60->hasTouchscreen = false; -- cgit v0.12 From fd0e49028644b86d264d4075b59141d2cffa01f9 Mon Sep 17 00:00:00 2001 From: Iain Date: Mon, 5 Oct 2009 20:38:27 +0200 Subject: Workaround for the problem with abld ignoring OPTION_REPLACE abld in the S60 SDKs has a bug where OPTION_REPLACE cannot be used to remove options from the command line (ie. replace them with nothing), so this workaround introduces a macro definition (that should never be used) as a harmless replacement option. Reviewed-by: Aleksandar Sasha Babic (cherry picked from commit 8cac1e7fe5bfda7e876d03d1407f616f89bd74f8) --- mkspecs/common/symbian/symbian.conf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 38e955a..1acfefe 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -106,7 +106,13 @@ QMAKE_STRIPFLAGS_LIB += --strip-unneeded load(qt_config) load(platform_paths) -MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA = "OPTION_REPLACE ARMCC --export_all_vtbl // don't use --export_all_vtbl" +symbian-abld { +# Versions of abld prior to Symbian^3 have a bug where you cannot remove something from the command line without replacing it +# Rather than figure out which version of abld we're using, we'll replace the command with a macro *that should never be used* + MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA = "OPTION_REPLACE ARMCC --export_all_vtbl -D__QT_NOEFFECTMACRO_DONOTUSE" +} else { + MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA = "OPTION_REPLACE ARMCC --export_all_vtbl // don't use --export_all_vtbl" +} MMP_RULES += PAGED MMP_RULES += $$MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA SYMBIAN_PLATFORMS = WINSCW GCCE ARMV5 ARMV6 -- cgit v0.12 From 4607bd88aa85eb5d7184d12698eff4710f86b0f7 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 5 Oct 2009 21:44:05 +0200 Subject: Stabilize tests on X11 (cherry picked from commit c7b091351d6fdf5fda5f38a94af24a395252249f) --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 8 +++----- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 12 +++++------- tests/auto/qlistview/tst_qlistview.cpp | 2 +- tests/auto/qwidget/tst_qwidget.cpp | 10 +++++----- tests/auto/qwindowsurface/tst_qwindowsurface.cpp | 9 ++++++--- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index e2e8c5f..edea6b8 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -6444,14 +6444,12 @@ void tst_QGraphicsItem::nestedClipping() QGraphicsView view(&scene); view.setOptimizationFlag(QGraphicsView::IndirectPainting); view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif - QTest::qWait(250); + QTest::qWaitForWindowShown(&view); + QTest::qWait(25); QList expected; expected << root << l1 << l2 << l3; - QCOMPARE(scene.drawnItems, expected); + QTRY_COMPARE(scene.drawnItems, expected); QImage image(200, 200, QImage::Format_ARGB32_Premultiplied); image.fill(0); diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 78fb4f3..921f7f8 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -2932,18 +2932,16 @@ void tst_QGraphicsView::task239729_noViewUpdate() view = new QGraphicsView(&scene); } - view->show(); - QTest::qWaitForWindowShown(view); - QTest::qWait(150); - EventSpy spy(view->viewport(), QEvent::Paint); QCOMPARE(spy.count(), 0); - QTest::qWait(100); - QCOMPARE(spy.count(), 0); + view->show(); + QTest::qWaitForWindowShown(view); + + QTRY_COMPARE(spy.count(), 1); scene.update(); QApplication::processEvents(); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.count(), 2); delete view; } diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index cba1776..7599ce6a06 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -1632,8 +1632,8 @@ void tst_QListView::task254449_draggingItemToNegativeCoordinates() mutable int numPaints; } delegate; - list.setItemDelegate(&delegate); delegate.numPaints = 0; + list.setItemDelegate(&delegate); QApplication::processEvents(); QTRY_VERIFY(delegate.numPaints > 0); //makes sure the layout is done diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index a4e5d88..92658a6 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -8176,7 +8176,7 @@ public: static bool firstTime = true; if (firstTime) - QTimer::singleShot(70, this, SLOT(resizeMe())); + QTimer::singleShot(150, this, SLOT(resizeMe())); firstTime = false; } @@ -8193,7 +8193,7 @@ void tst_QWidget::moveInResizeEvent() testWidget.setGeometry(50, 50, 200, 200); testWidget.show(); QTest::qWaitForWindowShown(&testWidget); - QTest::qWait(120); + QTest::qWait(160); QRect expectedGeometry(100,100, 100, 100); QTRY_COMPARE(testWidget.geometry(), expectedGeometry); @@ -8674,7 +8674,7 @@ void tst_QWidget::setClearAndResizeMask() // Mask child widget with a mask that is bigger than the rect child.setMask(QRegion(0, 0, 1000, 1000)); - QTest::qWait(10); + QTest::qWait(100); #ifdef Q_WS_MAC // Mac always issues a full update when calling setMask, and we cannot force it to not do so. QTRY_COMPARE(child.numPaintEvents, 1); @@ -8686,7 +8686,7 @@ void tst_QWidget::setClearAndResizeMask() // ...and the same applies when clearing the mask. child.clearMask(); - QTest::qWait(10); + QTest::qWait(100); #ifdef Q_WS_MAC // Mac always issues a full update when calling setMask, and we cannot force it to not do so. QTRY_VERIFY(child.numPaintEvents > 0); @@ -8711,7 +8711,7 @@ void tst_QWidget::setClearAndResizeMask() // Disable the size grip on the Mac; otherwise it'll be included when grabbing the window. resizeParent.setFixedSize(resizeParent.size()); resizeChild.show(); - QTest::qWait(30); + QTest::qWait(100); resizeChild.paintedRegion = QRegion(); QTimer::singleShot(100, &resizeChild, SLOT(shrinkMask())); diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp index 2490a65..25f0f07 100644 --- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp +++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp @@ -51,6 +51,9 @@ #include #include + +#include "../../shared/util.h" + class tst_QWindowSurface : public QObject { Q_OBJECT @@ -238,9 +241,9 @@ void tst_QWindowSurface::grabWidget() parentWidget.show(); QTest::qWaitForWindowShown(&parentWidget); - QTest::qWait(220); - - QPixmap parentPixmap = parentWidget.windowSurface()->grabWidget(&parentWidget); + QPixmap parentPixmap; + QTRY_COMPARE((parentPixmap = parentWidget.windowSurface()->grabWidget(&parentWidget)).size(), + QSize(300,300)); QPixmap childPixmap = childWidget.windowSurface()->grabWidget(&childWidget); QPixmap babyPixmap = babyWidget.windowSurface()->grabWidget(&babyWidget); QPixmap parentSubPixmap = parentWidget.windowSurface()->grabWidget(&parentWidget, QRect(25, 25, 100, 100)); -- cgit v0.12 From 0617d6c51f3c9c81e8347701b7088b4002e262e3 Mon Sep 17 00:00:00 2001 From: Martin Banky Date: Tue, 6 Oct 2009 08:26:00 +1000 Subject: Fixed QAudioDeviceInfoInternal::deviceList(QAudio::Mode mode) filtering If an audio device only supported Input or Output, it would not be added to the list of devices. Only devices that returned IOID == NULL would be added. Also, _m was not being used, and io was unneccessarily being cast to a QString. Merge-request: 1664 Reviewed-by: Kurt Korbatits (cherry picked from commit ba11343826229e983cb1d38811c8363d355e2e01) --- src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp | 26 ++++++++---------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index dc24875..55020a6 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -360,33 +360,30 @@ void QAudioDeviceInfoInternal::updateLists() QList QAudioDeviceInfoInternal::deviceList(QAudio::Mode mode) { - QAudio::Mode _m; QList devices; QByteArray filter; - QString dir; // Create a list of all current audio devices that support mode void **hints, **n; char *name, *descr, *io; if(snd_device_name_hint(-1, "pcm", &hints) < 0) { - qWarning()<<"no alsa devices available"; + qWarning() << "no alsa devices available"; return devices; } n = hints; + if(mode == QAudio::AudioInput) { + filter = "Input"; + } else { + filter = "Output"; + } + while (*n != NULL) { - _m = QAudio::AudioOutput; name = snd_device_name_get_hint(*n, "NAME"); descr = snd_device_name_get_hint(*n, "DESC"); io = snd_device_name_get_hint(*n, "IOID"); - dir = QString::fromUtf8(io); - if((name != NULL) && (descr != NULL) && ((io == NULL) || (dir.length() ==filter.length()))) { - if(dir.length() == 5) - _m = QAudio::AudioInput; - if(io == NULL) - _m = mode; - + if((name != NULL) && (descr != NULL) && ((io == NULL) || (io == filter))) { QString str = QLatin1String(name); if(str.contains(QLatin1String("default"))) { @@ -400,17 +397,12 @@ QList QAudioDeviceInfoInternal::deviceList(QAudio::Mode mode) free(descr); if(io != NULL) free(io); - n++; + ++n; } snd_device_name_free_hint(hints); if(devices.size() > 0) { devices.append("default"); - if(mode == QAudio::AudioInput) { - filter.append("Input"); - } else { - filter.append("Output"); - } } return devices; -- cgit v0.12 From 577d911dcd2db46a4b8a88ab2d4d466cf9e48e0a Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 6 Oct 2009 09:45:49 +1000 Subject: Implement the drop shadow filter for OpenGL Task-number: QTBUG-4583 Reviewed-by: trustme (cherry picked from commit 0bdb0d61d8eea356b1ac7d09ced6dee26d89ee8d) --- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 2 + src/opengl/qglpixmapfilter.cpp | 167 ++++++++++++++++++++- 2 files changed, 166 insertions(+), 3 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 4f42082..12123f3 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -278,6 +278,8 @@ public: QScopedPointer colorizeFilter; QScopedPointer blurFilter; QScopedPointer fastBlurFilter; + QScopedPointer dropShadowFilter; + QScopedPointer fastDropShadowFilter; }; QT_END_NAMESPACE diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 1ae3866..0603369 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -104,11 +104,12 @@ public: void setUniforms(QGLShaderProgram *program); + static QByteArray generateGaussianShader(int radius, bool dropShadow = false); + protected: bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const; private: - static QByteArray generateGaussianShader(int radius); mutable QSize m_textureSize; mutable bool m_horizontalBlur; @@ -118,6 +119,25 @@ private: mutable Qt::RenderHint m_hint; }; +class QGLPixmapDropShadowFilter : public QGLCustomShaderStage, public QGLPixmapFilter +{ +public: + QGLPixmapDropShadowFilter(Qt::RenderHint hint); + + void setUniforms(QGLShaderProgram *program); + +protected: + bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const; + +private: + mutable QSize m_textureSize; + mutable bool m_horizontalBlur; + + mutable bool m_haveCached; + mutable int m_cachedRadius; + mutable Qt::RenderHint m_hint; +}; + extern QGLWidget *qt_gl_share_widget(); QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *prototype) @@ -141,6 +161,18 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr return d->blurFilter.data(); } + case QPixmapFilter::DropShadowFilter: { + const QPixmapDropShadowFilter *proto = static_cast(prototype); + if (proto->blurRadius() <= 5) { + if (!d->fastDropShadowFilter) + d->fastDropShadowFilter.reset(new QGLPixmapDropShadowFilter(Qt::PerformanceHint)); + return d->fastDropShadowFilter.data(); + } + if (!d->dropShadowFilter) + d->dropShadowFilter.reset(new QGLPixmapDropShadowFilter(Qt::QualityHint)); + return d->dropShadowFilter.data(); + } + case QPixmapFilter::ConvolutionFilter: if (!d->convolutionFilter) d->convolutionFilter.reset(new QGLPixmapConvolutionFilter); @@ -279,6 +311,20 @@ static const char *qt_gl_blur_filter_fast = " return color * (1.0 / float(samples));" "}"; +static const char *qt_gl_drop_shadow_filter_fast = + "const int samples = 9;" + "uniform mediump vec2 delta;" + "uniform mediump vec4 shadowColor;" + "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords) {" + " mediump vec4 color = vec4(0.0, 0.0, 0.0, 0.0);" + " mediump float offset = (float(samples) - 1.0) / 2.0;" + " for (int i = 0; i < samples; i++) {" + " mediump vec2 coord = srcCoords + delta * (offset - float(i)) / offset;" + " color += texture2D(src, coord).a * shadowColor;" + " }" + " return color * (1.0 / float(samples));" + "}"; + QGLPixmapBlurFilter::QGLPixmapBlurFilter(Qt::RenderHint hint) : m_haveCached(false) , m_cachedRadius(5) @@ -380,7 +426,7 @@ static inline qreal gaussian(qreal dx, qreal sigma) return exp(-dx * dx / (2 * sigma * sigma)) / (Q_2PI * sigma * sigma); } -QByteArray QGLPixmapBlurFilter::generateGaussianShader(int radius) +QByteArray QGLPixmapBlurFilter::generateGaussianShader(int radius, bool dropShadow) { Q_ASSERT(radius >= 1); @@ -388,6 +434,8 @@ QByteArray QGLPixmapBlurFilter::generateGaussianShader(int radius) source.reserve(1000); source.append("uniform highp vec2 delta;\n"); + if (dropShadow) + source.append("uniform mediump vec4 shadowColor;\n"); source.append("lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords) {\n"); QVector sampleOffsets; @@ -444,7 +492,10 @@ QByteArray QGLPixmapBlurFilter::generateGaussianShader(int radius) source.append(coordinate); source.append(";\n"); - source.append(" sample += texture2D(src, coord)"); + if (dropShadow) + source.append(" sample += texture2D(src, coord).a * shadowColor"); + else + source.append(" sample += texture2D(src, coord)"); weightSum += weights.at(i); if (weights.at(i) != qreal(1)) { @@ -463,4 +514,114 @@ QByteArray QGLPixmapBlurFilter::generateGaussianShader(int radius) return source; } +QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter(Qt::RenderHint hint) + : m_haveCached(false) + , m_cachedRadius(5) + , m_hint(hint) +{ + if (hint == Qt::PerformanceHint) { + QGLPixmapDropShadowFilter *filter = const_cast(this); + filter->setSource(qt_gl_drop_shadow_filter_fast); + m_haveCached = true; + } +} + +bool QGLPixmapDropShadowFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const +{ + QGLPixmapDropShadowFilter *filter = const_cast(this); + + int radius = this->blurRadius(); + if (!m_haveCached || (m_hint == Qt::QualityHint && radius != m_cachedRadius)) { + // Only regenerate the shader from source if parameters have changed. + m_haveCached = true; + m_cachedRadius = radius; + filter->setSource(QGLPixmapBlurFilter::generateGaussianShader(radius, true)); + } + + QGLFramebufferObjectFormat format; + format.setInternalTextureFormat(GLenum(src.hasAlphaChannel() ? GL_RGBA : GL_RGB)); + QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(src.size(), format); + + if (!fbo) + return false; + + glBindTexture(GL_TEXTURE_2D, fbo->texture()); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glBindTexture(GL_TEXTURE_2D, 0); + + // prepare for updateUniforms + m_textureSize = src.size(); + + // horizontal pass, to pixmap + m_horizontalBlur = true; + + QPainter fboPainter(fbo); + + if (src.hasAlphaChannel()) { + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); + } + + // ensure GL_LINEAR filtering is used + fboPainter.setRenderHint(QPainter::SmoothPixmapTransform); + filter->setOnPainter(&fboPainter); + fboPainter.drawPixmap(0, 0, src); + filter->removeFromPainter(&fboPainter); + fboPainter.end(); + + QGL2PaintEngineEx *engine = static_cast(painter->paintEngine()); + + // vertical pass, to painter + m_horizontalBlur = false; + + painter->save(); + // ensure GL_LINEAR filtering is used + painter->setRenderHint(QPainter::SmoothPixmapTransform); + filter->setOnPainter(painter); + QPointF ofs = offset(); + engine->drawTexture(src.rect().translated(pos.x() + ofs.x(), pos.y() + ofs.y()), fbo->texture(), fbo->size(), src.rect().translated(0, fbo->height() - src.height())); + filter->removeFromPainter(painter); + painter->restore(); + + qgl_fbo_pool()->release(fbo); + + // Now draw the actual pixmap over the top. + painter->drawPixmap(pos, src, srcRect); + + return true; +} + +void QGLPixmapDropShadowFilter::setUniforms(QGLShaderProgram *program) +{ + QColor col = color(); + if (m_horizontalBlur) { + program->setUniformValue("shadowColor", 1.0f, 1.0f, 1.0f, 1.0f); + } else { + qreal alpha = col.alphaF(); + program->setUniformValue("shadowColor", col.redF() * alpha, + col.greenF() * alpha, + col.blueF() * alpha, + alpha); + } + if (m_hint == Qt::QualityHint) { + if (m_horizontalBlur) + program->setUniformValue("delta", 1.0 / m_textureSize.width(), 0.0); + else + program->setUniformValue("delta", 0.0, 1.0 / m_textureSize.height()); + } else { + // 1.4 is chosen to most closely match the blurriness of the gaussian blur + // at low radii + qreal blur = blurRadius() / 1.4f; + + if (m_horizontalBlur) + program->setUniformValue("delta", blur / m_textureSize.width(), 0.0); + else + program->setUniformValue("delta", 0.0, blur / m_textureSize.height()); + } +} + QT_END_NAMESPACE -- cgit v0.12 From be0d6cb54e4c16088dc48dd6301a73d738e274dd Mon Sep 17 00:00:00 2001 From: Bill King Date: Tue, 6 Oct 2009 11:41:39 +1000 Subject: Update documentation for setForwardOnly. (cherry picked from commit c768694764e8bc32a7152b80653eef564631452a) --- src/sql/kernel/qsqlquery.cpp | 9 +++++++-- src/sql/kernel/qsqlresult.cpp | 7 ++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp index dfe30e7..5125546 100644 --- a/src/sql/kernel/qsqlquery.cpp +++ b/src/sql/kernel/qsqlquery.cpp @@ -811,13 +811,18 @@ bool QSqlQuery::isForwardOnly() const Forward only mode can be (depending on the driver) more memory efficient since results do not need to be cached. It will also improve performance on some databases. For this to be true, you must - call \c setForwardMode() before the query is prepared or executed. + call \c setForwardOnly() before the query is prepared or executed. Note that the constructor that takes a query and a database may execute the query. Forward only mode is off by default. - \sa isForwardOnly(), next(), seek() + Setting forward only to false is a suggestion to the database engine, + which has the final say on whether a result set is forward only or + scrollable. isForwardOnly() will always return the correct status of + the result set. + + \sa isForwardOnly(), next(), seek(), QSqlResult::setForwardOnly() */ void QSqlQuery::setForwardOnly(bool forward) { diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp index 791b8a6..efca595 100644 --- a/src/sql/kernel/qsqlresult.cpp +++ b/src/sql/kernel/qsqlresult.cpp @@ -559,7 +559,12 @@ bool QSqlResult::isForwardOnly() const mode needs much less memory since results do not have to be cached. By default, this feature is disabled. - \sa isForwardOnly(), fetchNext() + Setting forward only to false is a suggestion to the database engine, + which has the final say on whether a result set is forward only or + scrollable. isForwardOnly() will always return the correct status of + the result set. + + \sa isForwardOnly(), fetchNext(), QSqlQuery::setForwardOnly() */ void QSqlResult::setForwardOnly(bool forward) { -- cgit v0.12 From 51683fcecfc0a02fc8dd99565a92197e6279dc3f Mon Sep 17 00:00:00 2001 From: Bill King Date: Tue, 6 Oct 2009 11:42:36 +1000 Subject: Add autotest for mysql savepoints. (cherry picked from commit 2420c3b6c728ed4c8a8efd4c93427932420c7368) --- tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 4175bef..c9c8f5e 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -157,6 +157,8 @@ private slots: void mysqlOdbc_unsignedIntegers(); void mysql_multiselect_data() { generic_data("QMYSQL"); } void mysql_multiselect(); // For task 144331 + void mysql_savepointtest_data() { generic_data("QMYSQL"); } + void mysql_savepointtest(); void accessOdbc_strings_data() { generic_data(); } void accessOdbc_strings(); @@ -2433,6 +2435,19 @@ void tst_QSqlDatabase::sqlStatementUseIsNull_189093() QCOMPARE(statment.count("IS NULL", Qt::CaseInsensitive), 2); } +void tst_QSqlDatabase::mysql_savepointtest() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + if ( db.driverName().startsWith( "QMYSQL" ) && tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 0 ).toInt()<5 ) + QSKIP( "Test requires MySQL >= 5.0", SkipSingle ); + + QSqlQuery q(db); + QVERIFY_SQL(q, exec("begin")); + QVERIFY_SQL(q, exec("insert into "+qTableName("qtest")+" VALUES (54, 'foo', 'foo', 54.54)")); + QVERIFY_SQL(q, exec("savepoint foo")); +} QTEST_MAIN(tst_QSqlDatabase) #include "tst_qsqldatabase.moc" -- cgit v0.12 From 10864830fd7302360034b47798a6174aa48b0256 Mon Sep 17 00:00:00 2001 From: Peter Yard Date: Tue, 6 Oct 2009 13:32:18 +1000 Subject: Added QT_VERSION_CHECK to docs. (cherry picked from commit d96392b83aab8b5b9bb5e951729dba938396e28b) --- src/corelib/global/qglobal.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 63e2891..742f4ec 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -955,6 +955,17 @@ QT_BEGIN_NAMESPACE */ /*! + \macro QT_VERSION_CHECK + \relates + + Turns the major, minor and patch numbers of a version into an + integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can + be compared with another similarly processed version id. + + \sa QT_VERSION +*/ + +/*! \macro QT_VERSION \relates -- cgit v0.12 From 7d01effe1adcc88ed90fa96cb32e9734d713554a Mon Sep 17 00:00:00 2001 From: Peter Yard Date: Tue, 6 Oct 2009 13:35:41 +1000 Subject: Add documentation for WA_DontShowOnScreen. (cherry picked from commit a5589d34ec38992d4cc58861183d58f6f20af861) --- src/corelib/global/qnamespace.qdoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 6f0b0ee..b7775bd 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -849,6 +849,9 @@ getter functions QWidget::isEnabled(). This is set/cleared by the Qt kernel. + \value WA_DontShowOnScreen Indicates that the widget is hidden or is + not a part of the viewable Desktop. + \omitvalue WA_DropSiteRegistered \omitvalue WA_ForceAcceptDrops -- cgit v0.12 From 7efd966267ef49a3d8145362e8456713f7b71052 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 6 Oct 2009 07:27:43 +0200 Subject: Print images with colortable using their colortable in PDF Reviewed-by: Trond (cherry picked from commit 0a90113262eab4e05bf73c0b69b1f5633a10e768) --- src/gui/painting/qprintengine_pdf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp index e73282f..4cccc91 100644 --- a/src/gui/painting/qprintengine_pdf.cpp +++ b/src/gui/painting/qprintengine_pdf.cpp @@ -534,7 +534,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n QImage image = img; QImage::Format format = image.format(); - if (image.depth() == 1 && *bitmap) { + if (image.depth() == 1 && *bitmap && img.colorTable().size() == 0) { if (format == QImage::Format_MonoLSB) image = image.convertToFormat(QImage::Format_Mono); format = QImage::Format_Mono; -- cgit v0.12 From ad446f355217368d55c0cc9c0e41e5e50025f4db Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Tue, 6 Oct 2009 16:00:48 +1000 Subject: Fix auto test for QSound; find test wav file. Reviewed-by: Bill King (cherry picked from commit 2a18238357e3442a2e9a6eb2fe8b9ff78704c174) --- tests/auto/qsound/qsound.pro | 6 +++++- tests/auto/qsound/tst_qsound.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/auto/qsound/qsound.pro b/tests/auto/qsound/qsound.pro index 75da2e6..c48d50d 100644 --- a/tests/auto/qsound/qsound.pro +++ b/tests/auto/qsound/qsound.pro @@ -4,4 +4,8 @@ SOURCES += tst_qsound.cpp wince*|symbian*: { deploy.sources += 4.wav DEPLOYMENT = deploy -} \ No newline at end of file + DEFINES += SRCDIR=\\\"\\\" +} else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" +} + diff --git a/tests/auto/qsound/tst_qsound.cpp b/tests/auto/qsound/tst_qsound.cpp index 76451e3..dd5f2ce 100644 --- a/tests/auto/qsound/tst_qsound.cpp +++ b/tests/auto/qsound/tst_qsound.cpp @@ -56,7 +56,7 @@ private slots: void tst_QSound::checkFinished() { - QSound sound("4.wav"); + QSound sound(SRCDIR"4.wav"); sound.setLoops(3); sound.play(); QTest::qWait(5000); -- cgit v0.12 From d8a781f278691c64a9bdad47480bf38603f3128a Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 6 Oct 2009 16:57:31 +1000 Subject: Remove incorrect statement from INSTALL file. The -prefix-install option is actually on by default and has no effect on any platform but Mac. Task-number: QTBUG-3029 Reviewed-by: Lincoln Ramsay (cherry picked from commit 180bdb06feed8c5fe08f88b9eb16b7676615851f) --- INSTALL | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/INSTALL b/INSTALL index 22e993a..092dea0 100644 --- a/INSTALL +++ b/INSTALL @@ -65,9 +65,7 @@ By default, Qt is configured for installation in the /usr/local/Trolltech/Qt-%VERSION% directory, but this can be - changed by using the -prefix option. Alternatively, the - -prefix-install option can be used to specify a "local" - installation within the source directory. + changed by using the -prefix option. cd /tmp/%DISTNAME% ./configure -- cgit v0.12 From 4838b5fc16cb6060c808021f62af27ec2180781b Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 6 Oct 2009 17:23:27 +1000 Subject: Q3PopupMenu constructor failed to call setObjectName Task-number: QTBUG-1087 Reviewed-by: Andreas (cherry picked from commit 231d8d7c02161e93b3a97a1bacb3c402f16e1fcb) --- src/qt3support/widgets/q3popupmenu.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qt3support/widgets/q3popupmenu.h b/src/qt3support/widgets/q3popupmenu.h index c8525bd..2af69d9 100644 --- a/src/qt3support/widgets/q3popupmenu.h +++ b/src/qt3support/widgets/q3popupmenu.h @@ -54,8 +54,8 @@ class Q_COMPAT_EXPORT Q3PopupMenu : public QMenu { Q_OBJECT public: - inline Q3PopupMenu(QWidget *parent = 0, const char * =0) : QMenu(parent) - { } + inline Q3PopupMenu(QWidget *parent = 0, const char *name = 0) : QMenu(parent) + { setObjectName(QLatin1String(name)); } inline int exec() { return findIdForAction(QMenu::exec()); } inline int exec(const QPoint & pos, int indexAtPoint = 0) { @@ -64,8 +64,8 @@ public: void setFrameRect(QRect) {} QRect frameRect() const { return QRect(); } - enum DummyFrame { Box, Sunken, Plain, Raised, MShadow, NoFrame, Panel, StyledPanel, - HLine, VLine, GroupBoxPanel, WinPanel, ToolBarPanel, MenuBarPanel, + enum DummyFrame { Box, Sunken, Plain, Raised, MShadow, NoFrame, Panel, StyledPanel, + HLine, VLine, GroupBoxPanel, WinPanel, ToolBarPanel, MenuBarPanel, PopupPanel, LineEditPanel, TabWidgetPanel, MShape }; void setFrameShadow(DummyFrame) {} DummyFrame frameShadow() const { return Plain; } @@ -75,10 +75,10 @@ public: int frameStyle() const { return 0; } int frameWidth() const { return 0; } void setLineWidth(int) {} - int lineWidth() const { return 0; } + int lineWidth() const { return 0; } void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); } - int margin() const - { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; } + int margin() const + { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; } void setMidLineWidth(int) {} int midLineWidth() const { return 0; } -- cgit v0.12 From 6b531891ae39d836dbbef0d961b9852a19c251a6 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 6 Oct 2009 09:19:08 +0200 Subject: Fix the pad navigator demo. QGraphicsWidget used to called setPosHelper where all the logic was. But since the new flag itemSendsGeometryChanges some part of the code inside setPosHelper move back to setPos. QGraphicsWidget was not updated after this change. It doesn't matter as it is but for QGraphicsProxyWidget which activate the flag itemSendsGeometryChanges it matters. ItemChange was never called so the proxy was never really moved. Task-number:QT-672 Reviewed-by:andreas (cherry picked from commit 3da33626c056169f5fadf94f12997180cb3a08b4) --- src/gui/graphicsview/qgraphicswidget.cpp | 2 +- tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 71 ++++++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 7764157..35a3c13 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -347,7 +347,7 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) // setPos triggers ItemPositionChange, which can adjust position wd->inSetGeometry = 1; - wd->setPosHelper(newGeom.topLeft()); + setPos(newGeom.topLeft()); wd->inSetGeometry = 0; newGeom.moveTopLeft(pos()); diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 0b73733..26021e0 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -157,6 +157,7 @@ private slots: void shortcutsDeletion(); void painterStateProtectionOnWindowFrame(); void ensureClipping(); + void widgetSendsGeometryChanges(); void respectHFW(); // Task fixes @@ -2562,6 +2563,76 @@ void tst_QGraphicsWidget::ensureClipping() QVERIFY(scene.drawnItems.contains(childitem)); } +class ItemChangeTester : public QGraphicsWidget +{ +public: + ItemChangeTester() + { setFlag(ItemSendsGeometryChanges); clear(); } + ItemChangeTester(QGraphicsItem *parent) : QGraphicsWidget(parent) + { setFlag(ItemSendsGeometryChanges); clear(); } + + void clear() + { + changes.clear(); + values.clear(); + oldValues.clear(); + } + QList changes; + QList values; + QList oldValues; +protected: + QVariant itemChange(GraphicsItemChange change, const QVariant &value) + { + changes << change; + values << value; + switch (change) { + case QGraphicsItem::ItemPositionChange: + oldValues << pos(); + break; + case QGraphicsItem::ItemPositionHasChanged: + break; + default: + break; + } + return value; + } +}; + +void tst_QGraphicsWidget::widgetSendsGeometryChanges() +{ + ItemChangeTester widget; + widget.setFlags(0); + widget.clear(); + + QPointF pos(10, 10); + widget.setPos(pos); + + QCOMPARE(widget.pos(), pos); + QCOMPARE(widget.changes.size(), 0); + + widget.setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); + QCOMPARE(widget.changes.size(), 2); + + widget.setPos(QPointF()); + QCOMPARE(widget.changes.size(), 4); + + QCOMPARE(widget.pos(), QPointF()); + + QRectF geometry(20, 20, 50, 50); + widget.setGeometry(geometry); + QCOMPARE(widget.changes.size(), 6); + + QCOMPARE(widget.geometry(), geometry); + + QCOMPARE(widget.changes, QList() + << QGraphicsItem::ItemFlagsChange + << QGraphicsItem::ItemFlagsHaveChanged + << QGraphicsItem::ItemPositionChange + << QGraphicsItem::ItemPositionHasChanged + << QGraphicsItem::ItemPositionChange + << QGraphicsItem::ItemPositionHasChanged); +} + class HFWWidget : public QGraphicsWidget { public: -- cgit v0.12 From f60b50f86e5d99de49497f5ead8a76207991cc4c Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 7 Oct 2009 12:18:17 +1000 Subject: fix tst_QAbstractItemView::task250754_fontChange for Windows CE We need to give Windows mobile some more time to handle all internal timer events. Otherwise QTreeView::updateScrollBars doesn't get called. Reviewed-by: mauricek (cherry picked from commit b1310cb8fcc4b48750f82502a7140f2ebb8a44c7) Conflicts: tests/auto/qabstractitemview/tst_qabstractitemview.cpp --- .../auto/qabstractitemview/tst_qabstractitemview.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp index be2d882..957a7da 100644 --- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp @@ -184,6 +184,10 @@ public: virtual ~tst_QAbstractItemView(); void basic_tests(TestView *view); +public slots: + void initTestCase(); + void cleanupTestCase(); + private slots: void getSetCheck(); void emptyModels_data(); @@ -320,6 +324,17 @@ tst_QAbstractItemView::~tst_QAbstractItemView() { } +void tst_QAbstractItemView::initTestCase() +{ +#ifdef Q_OS_WINCE_WM + qApp->setAutoMaximizeThreshold(-1); +#endif +} + +void tst_QAbstractItemView::cleanupTestCase() +{ +} + void tst_QAbstractItemView::emptyModels_data() { QTest::addColumn("viewType"); @@ -1198,16 +1213,12 @@ void tst_QAbstractItemView::task250754_fontChange() QFont font = tree.font(); font.setPointSize(5); tree.setFont(font); - QTest::qWait(30); - QTRY_VERIFY(!tree.verticalScrollBar()->isVisible()); font.setPointSize(45); tree.setFont(font); - QTest::qWait(30); //now with the huge items, the scrollbar must be visible QTRY_VERIFY(tree.verticalScrollBar()->isVisible()); - qApp->setStyleSheet(app_css); } -- cgit v0.12 From 54c5c60c8f5937690fa006f6fbee434259f25061 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 7 Oct 2009 12:25:17 +1000 Subject: tst_QCssParser::extractFontFamily fix Windows CE font deployment On Windows mobile we usually don't have the "Times New Roman" font. Thus we must deploy and register it, if its not available. Reviewed-by: mauricek (cherry picked from commit 7851cbd64d15d39a0e9cc99efa6c2d007c935ce9) Conflicts: tests/auto/qcssparser/qcssparser.pro --- tests/auto/qcssparser/qcssparser.pro | 6 ++++-- tests/auto/qcssparser/tst_qcssparser.cpp | 33 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/qcssparser/qcssparser.pro index ce1281f..674064f 100644 --- a/tests/auto/qcssparser/qcssparser.pro +++ b/tests/auto/qcssparser/qcssparser.pro @@ -3,7 +3,6 @@ SOURCES += tst_qcssparser.cpp QT += xml requires(contains(QT_CONFIG,private_tests)) - !symbian: { DEFINES += SRCDIR=\\\"$$PWD\\\" } @@ -11,5 +10,8 @@ requires(contains(QT_CONFIG,private_tests)) wince*|symbian: { addFiles.sources = testdata addFiles.path = . - DEPLOYMENT += addFiles + timesFont.sources = C:/Windows/Fonts/times.ttf + timesFont.path = . + DEPLOYMENT += addFiles timesFont } + diff --git a/tests/auto/qcssparser/tst_qcssparser.cpp b/tests/auto/qcssparser/tst_qcssparser.cpp index c7f50d4..150f131 100644 --- a/tests/auto/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/qcssparser/tst_qcssparser.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include #include +#if defined(Q_OS_WINCE) +#include +#endif //TESTED_CLASS=QCss //TESTED_FILES=gui/text/qcssparser.cpp gui/text/qcssparser_p.h @@ -49,6 +52,11 @@ class tst_QCssParser : public QObject { Q_OBJECT + +public slots: + void initTestCase(); + void cleanupTestCase(); + private slots: void scanner_data(); void scanner(); @@ -91,8 +99,33 @@ private slots: void extractBorder(); void noTextDecoration(); void quotedAndUnquotedIdentifiers(); + +private: +#if defined(Q_OS_WINCE) + int m_timesFontId; +#endif }; +void tst_QCssParser::initTestCase() +{ +#if defined(Q_OS_WINCE) + QFontDatabase fontDB; + m_timesFontId = -1; + if (!fontDB.families().contains("Times New Roman")) { + m_timesFontId = QFontDatabase::addApplicationFont("times.ttf"); + QVERIFY(m_timesFontId != -1); + } +#endif +} + +void tst_QCssParser::cleanupTestCase() +{ +#if defined(Q_OS_WINCE) + if (m_timesFontId != -1) + QFontDatabase::removeApplicationFont(m_timesFontId); +#endif +} + void tst_QCssParser::scanner_data() { QTest::addColumn("input"); -- cgit v0.12 From 45fd04ac1b0223b295e2e98b9a0959e6aa9a7f69 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 6 Oct 2009 09:55:12 +0200 Subject: Don't output redundant setPen command when reusing PS printer If you reused a printer to paint to several different files, the results would sometimes be different, as the subsequent runs would have redundant setPen commands in its output. This was because the simplePen flag was not reset to its initial value when reusing the print engine. Task-number: QTBUG-4479 Reviewed-by: Trond (cherry picked from commit 39dc3026d1da03d5fcf8e5c516fadd7e4ea8a861) --- src/gui/painting/qprintengine_ps.cpp | 1 + tests/auto/qprinter/tst_qprinter.cpp | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/gui/painting/qprintengine_ps.cpp b/src/gui/painting/qprintengine_ps.cpp index 772a30d..b740fbc 100644 --- a/src/gui/painting/qprintengine_ps.cpp +++ b/src/gui/painting/qprintengine_ps.cpp @@ -751,6 +751,7 @@ bool QPSPrintEngine::begin(QPaintDevice *pdev) d->boundingBox = QRect(); d->fontsUsed = ""; d->hugeDocument = false; + d->simplePen = false; setActive(true); d->printerState = QPrinter::Active; diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp index d6df94b..3c05d90 100644 --- a/tests/auto/qprinter/tst_qprinter.cpp +++ b/tests/auto/qprinter/tst_qprinter.cpp @@ -108,6 +108,8 @@ private slots: void testActualNumCopies(); + void taskQTBUG4497_reusePrinterOnDifferentFiles(); + private: }; @@ -971,5 +973,37 @@ void tst_QPrinter::testActualNumCopies() QCOMPARE(p.actualNumCopies(), 15); } +static void printPage(QPainter *painter) +{ + painter->setPen(QPen(Qt::black, 4)); + painter->drawRect(50, 60, 70, 80); +} + +void tst_QPrinter::taskQTBUG4497_reusePrinterOnDifferentFiles() +{ + QPrinter printer; + { + + printer.setOutputFileName("out1.ps"); + QPainter painter(&printer); + printPage(&painter); + + } + { + + printer.setOutputFileName("out2.ps"); + QPainter painter(&printer); + printPage(&painter); + + } + QFile file1("out1.ps"); + QVERIFY(file1.open(QIODevice::ReadOnly)); + + QFile file2("out2.ps"); + QVERIFY(file2.open(QIODevice::ReadOnly)); + + QCOMPARE(file1.readAll(), file2.readAll()); +} + QTEST_MAIN(tst_QPrinter) #include "tst_qprinter.moc" -- cgit v0.12 From fdb81b0f61652a0e2035b8822011d2be4ed2a0ce Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 6 Oct 2009 18:16:28 +1000 Subject: Fix typo in XmlPatterns license headers. Reviewed-by: Trust Me (cherry picked from commit 0fedc2d3066a17e8062ec5271d8e53475c5cc312) --- src/xmlpatterns/api/qabstractxmlpullprovider.cpp | 2 +- src/xmlpatterns/api/qabstractxmlpullprovider_p.h | 2 +- src/xmlpatterns/api/qpullbridge.cpp | 2 +- src/xmlpatterns/api/qpullbridge_p.h | 2 +- src/xmlpatterns/api/qxmlschema.cpp | 2 +- src/xmlpatterns/api/qxmlschema.h | 2 +- src/xmlpatterns/api/qxmlschema_p.cpp | 2 +- src/xmlpatterns/api/qxmlschema_p.h | 2 +- src/xmlpatterns/api/qxmlschemavalidator.cpp | 2 +- src/xmlpatterns/api/qxmlschemavalidator.h | 2 +- src/xmlpatterns/api/qxmlschemavalidator_p.h | 2 +- src/xmlpatterns/data/qcomparisonfactory.cpp | 2 +- src/xmlpatterns/data/qcomparisonfactory_p.h | 2 +- src/xmlpatterns/data/qvaluefactory.cpp | 2 +- src/xmlpatterns/data/qvaluefactory_p.h | 2 +- src/xmlpatterns/schema/qnamespacesupport.cpp | 2 +- src/xmlpatterns/schema/qnamespacesupport_p.h | 2 +- src/xmlpatterns/schema/qxsdalternative.cpp | 2 +- src/xmlpatterns/schema/qxsdalternative_p.h | 2 +- src/xmlpatterns/schema/qxsdannotated.cpp | 2 +- src/xmlpatterns/schema/qxsdannotated_p.h | 2 +- src/xmlpatterns/schema/qxsdannotation.cpp | 2 +- src/xmlpatterns/schema/qxsdannotation_p.h | 2 +- src/xmlpatterns/schema/qxsdapplicationinformation.cpp | 2 +- src/xmlpatterns/schema/qxsdapplicationinformation_p.h | 2 +- src/xmlpatterns/schema/qxsdassertion.cpp | 2 +- src/xmlpatterns/schema/qxsdassertion_p.h | 2 +- src/xmlpatterns/schema/qxsdattribute.cpp | 2 +- src/xmlpatterns/schema/qxsdattribute_p.h | 2 +- src/xmlpatterns/schema/qxsdattributegroup.cpp | 2 +- src/xmlpatterns/schema/qxsdattributegroup_p.h | 2 +- src/xmlpatterns/schema/qxsdattributereference.cpp | 2 +- src/xmlpatterns/schema/qxsdattributereference_p.h | 2 +- src/xmlpatterns/schema/qxsdattributeterm.cpp | 2 +- src/xmlpatterns/schema/qxsdattributeterm_p.h | 2 +- src/xmlpatterns/schema/qxsdattributeuse.cpp | 2 +- src/xmlpatterns/schema/qxsdattributeuse_p.h | 2 +- src/xmlpatterns/schema/qxsdcomplextype.cpp | 2 +- src/xmlpatterns/schema/qxsdcomplextype_p.h | 2 +- src/xmlpatterns/schema/qxsddocumentation.cpp | 2 +- src/xmlpatterns/schema/qxsddocumentation_p.h | 2 +- src/xmlpatterns/schema/qxsdelement.cpp | 2 +- src/xmlpatterns/schema/qxsdelement_p.h | 2 +- src/xmlpatterns/schema/qxsdfacet.cpp | 2 +- src/xmlpatterns/schema/qxsdfacet_p.h | 2 +- src/xmlpatterns/schema/qxsdidcache.cpp | 2 +- src/xmlpatterns/schema/qxsdidcache_p.h | 2 +- src/xmlpatterns/schema/qxsdidchelper.cpp | 2 +- src/xmlpatterns/schema/qxsdidchelper_p.h | 2 +- src/xmlpatterns/schema/qxsdidentityconstraint.cpp | 2 +- src/xmlpatterns/schema/qxsdidentityconstraint_p.h | 2 +- src/xmlpatterns/schema/qxsdinstancereader.cpp | 2 +- src/xmlpatterns/schema/qxsdinstancereader_p.h | 2 +- src/xmlpatterns/schema/qxsdmodelgroup.cpp | 2 +- src/xmlpatterns/schema/qxsdmodelgroup_p.h | 2 +- src/xmlpatterns/schema/qxsdnotation.cpp | 2 +- src/xmlpatterns/schema/qxsdnotation_p.h | 2 +- src/xmlpatterns/schema/qxsdparticle.cpp | 2 +- src/xmlpatterns/schema/qxsdparticle_p.h | 2 +- src/xmlpatterns/schema/qxsdparticlechecker.cpp | 2 +- src/xmlpatterns/schema/qxsdparticlechecker_p.h | 2 +- src/xmlpatterns/schema/qxsdreference.cpp | 2 +- src/xmlpatterns/schema/qxsdreference_p.h | 2 +- src/xmlpatterns/schema/qxsdschema.cpp | 2 +- src/xmlpatterns/schema/qxsdschema_p.h | 2 +- src/xmlpatterns/schema/qxsdschemachecker.cpp | 2 +- src/xmlpatterns/schema/qxsdschemachecker_helper.cpp | 2 +- src/xmlpatterns/schema/qxsdschemachecker_p.h | 2 +- src/xmlpatterns/schema/qxsdschemacontext.cpp | 2 +- src/xmlpatterns/schema/qxsdschemacontext_p.h | 2 +- src/xmlpatterns/schema/qxsdschemadebugger.cpp | 2 +- src/xmlpatterns/schema/qxsdschemadebugger_p.h | 2 +- src/xmlpatterns/schema/qxsdschemahelper.cpp | 2 +- src/xmlpatterns/schema/qxsdschemahelper_p.h | 2 +- src/xmlpatterns/schema/qxsdschemamerger.cpp | 2 +- src/xmlpatterns/schema/qxsdschemamerger_p.h | 2 +- src/xmlpatterns/schema/qxsdschemaparser_p.h | 2 +- src/xmlpatterns/schema/qxsdschemaparsercontext.cpp | 2 +- src/xmlpatterns/schema/qxsdschemaparsercontext_p.h | 2 +- src/xmlpatterns/schema/qxsdschemaresolver.cpp | 2 +- src/xmlpatterns/schema/qxsdschemaresolver_p.h | 2 +- src/xmlpatterns/schema/qxsdschematoken.cpp | 2 +- src/xmlpatterns/schema/qxsdschematoken_p.h | 2 +- src/xmlpatterns/schema/qxsdschematypesfactory.cpp | 2 +- src/xmlpatterns/schema/qxsdschematypesfactory_p.h | 2 +- src/xmlpatterns/schema/qxsdsimpletype.cpp | 2 +- src/xmlpatterns/schema/qxsdsimpletype_p.h | 2 +- src/xmlpatterns/schema/qxsdstatemachine.cpp | 2 +- src/xmlpatterns/schema/qxsdstatemachine_p.h | 2 +- src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp | 2 +- src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h | 2 +- src/xmlpatterns/schema/qxsdterm.cpp | 2 +- src/xmlpatterns/schema/qxsdterm_p.h | 2 +- src/xmlpatterns/schema/qxsdtypechecker.cpp | 2 +- src/xmlpatterns/schema/qxsdtypechecker_p.h | 2 +- src/xmlpatterns/schema/qxsduserschematype.cpp | 2 +- src/xmlpatterns/schema/qxsduserschematype_p.h | 2 +- src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp | 2 +- src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h | 2 +- src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp | 2 +- src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h | 2 +- src/xmlpatterns/schema/qxsdwildcard.cpp | 2 +- src/xmlpatterns/schema/qxsdwildcard_p.h | 2 +- src/xmlpatterns/schema/qxsdxpathexpression.cpp | 2 +- src/xmlpatterns/schema/qxsdxpathexpression_p.h | 2 +- src/xmlpatterns/schema/tokens.xml | 2 +- src/xmlpatterns/type/qnamedschemacomponent.cpp | 2 +- src/xmlpatterns/type/qnamedschemacomponent_p.h | 2 +- 108 files changed, 108 insertions(+), 108 deletions(-) diff --git a/src/xmlpatterns/api/qabstractxmlpullprovider.cpp b/src/xmlpatterns/api/qabstractxmlpullprovider.cpp index 83cf20f..6dbd50b 100644 --- a/src/xmlpatterns/api/qabstractxmlpullprovider.cpp +++ b/src/xmlpatterns/api/qabstractxmlpullprovider.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/api/qabstractxmlpullprovider_p.h b/src/xmlpatterns/api/qabstractxmlpullprovider_p.h index 1bf61d7..547bf4b 100644 --- a/src/xmlpatterns/api/qabstractxmlpullprovider_p.h +++ b/src/xmlpatterns/api/qabstractxmlpullprovider_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/api/qpullbridge.cpp b/src/xmlpatterns/api/qpullbridge.cpp index 9f96b5f..80dac38 100644 --- a/src/xmlpatterns/api/qpullbridge.cpp +++ b/src/xmlpatterns/api/qpullbridge.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/api/qpullbridge_p.h b/src/xmlpatterns/api/qpullbridge_p.h index 2d8be62..1553a3e 100644 --- a/src/xmlpatterns/api/qpullbridge_p.h +++ b/src/xmlpatterns/api/qpullbridge_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/api/qxmlschema.cpp b/src/xmlpatterns/api/qxmlschema.cpp index 5d4bd80..287cf11 100644 --- a/src/xmlpatterns/api/qxmlschema.cpp +++ b/src/xmlpatterns/api/qxmlschema.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/api/qxmlschema.h b/src/xmlpatterns/api/qxmlschema.h index 0e4972e..145f2dc 100644 --- a/src/xmlpatterns/api/qxmlschema.h +++ b/src/xmlpatterns/api/qxmlschema.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/api/qxmlschema_p.cpp b/src/xmlpatterns/api/qxmlschema_p.cpp index e2e725b..f5ed5c0 100644 --- a/src/xmlpatterns/api/qxmlschema_p.cpp +++ b/src/xmlpatterns/api/qxmlschema_p.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/api/qxmlschema_p.h b/src/xmlpatterns/api/qxmlschema_p.h index fd7a1a1..2376fe3 100644 --- a/src/xmlpatterns/api/qxmlschema_p.h +++ b/src/xmlpatterns/api/qxmlschema_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/api/qxmlschemavalidator.cpp b/src/xmlpatterns/api/qxmlschemavalidator.cpp index f7d7957..11e0417 100644 --- a/src/xmlpatterns/api/qxmlschemavalidator.cpp +++ b/src/xmlpatterns/api/qxmlschemavalidator.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/api/qxmlschemavalidator.h b/src/xmlpatterns/api/qxmlschemavalidator.h index e928193..7121d19 100644 --- a/src/xmlpatterns/api/qxmlschemavalidator.h +++ b/src/xmlpatterns/api/qxmlschemavalidator.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/api/qxmlschemavalidator_p.h b/src/xmlpatterns/api/qxmlschemavalidator_p.h index 6eb508d..fb9492a 100644 --- a/src/xmlpatterns/api/qxmlschemavalidator_p.h +++ b/src/xmlpatterns/api/qxmlschemavalidator_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/data/qcomparisonfactory.cpp b/src/xmlpatterns/data/qcomparisonfactory.cpp index f885004..66d72af 100644 --- a/src/xmlpatterns/data/qcomparisonfactory.cpp +++ b/src/xmlpatterns/data/qcomparisonfactory.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/data/qcomparisonfactory_p.h b/src/xmlpatterns/data/qcomparisonfactory_p.h index 2e73bbe..61f65b1 100644 --- a/src/xmlpatterns/data/qcomparisonfactory_p.h +++ b/src/xmlpatterns/data/qcomparisonfactory_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/data/qvaluefactory.cpp b/src/xmlpatterns/data/qvaluefactory.cpp index c75e6d3..bac53b2 100644 --- a/src/xmlpatterns/data/qvaluefactory.cpp +++ b/src/xmlpatterns/data/qvaluefactory.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/data/qvaluefactory_p.h b/src/xmlpatterns/data/qvaluefactory_p.h index c9ecd28..e383d27 100644 --- a/src/xmlpatterns/data/qvaluefactory_p.h +++ b/src/xmlpatterns/data/qvaluefactory_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qnamespacesupport.cpp b/src/xmlpatterns/schema/qnamespacesupport.cpp index ecd53e9..05b87e3 100644 --- a/src/xmlpatterns/schema/qnamespacesupport.cpp +++ b/src/xmlpatterns/schema/qnamespacesupport.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qnamespacesupport_p.h b/src/xmlpatterns/schema/qnamespacesupport_p.h index 3748894..2a2cb1e 100644 --- a/src/xmlpatterns/schema/qnamespacesupport_p.h +++ b/src/xmlpatterns/schema/qnamespacesupport_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdalternative.cpp b/src/xmlpatterns/schema/qxsdalternative.cpp index 8493efe..279a184 100644 --- a/src/xmlpatterns/schema/qxsdalternative.cpp +++ b/src/xmlpatterns/schema/qxsdalternative.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdalternative_p.h b/src/xmlpatterns/schema/qxsdalternative_p.h index 3e42a3b..f94f0ac 100644 --- a/src/xmlpatterns/schema/qxsdalternative_p.h +++ b/src/xmlpatterns/schema/qxsdalternative_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdannotated.cpp b/src/xmlpatterns/schema/qxsdannotated.cpp index 84575fc..151057d 100644 --- a/src/xmlpatterns/schema/qxsdannotated.cpp +++ b/src/xmlpatterns/schema/qxsdannotated.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdannotated_p.h b/src/xmlpatterns/schema/qxsdannotated_p.h index 8d0f872..f8d7fe1 100644 --- a/src/xmlpatterns/schema/qxsdannotated_p.h +++ b/src/xmlpatterns/schema/qxsdannotated_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdannotation.cpp b/src/xmlpatterns/schema/qxsdannotation.cpp index 13d40f9..9c76378 100644 --- a/src/xmlpatterns/schema/qxsdannotation.cpp +++ b/src/xmlpatterns/schema/qxsdannotation.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdannotation_p.h b/src/xmlpatterns/schema/qxsdannotation_p.h index db6785b..a8e2d55 100644 --- a/src/xmlpatterns/schema/qxsdannotation_p.h +++ b/src/xmlpatterns/schema/qxsdannotation_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdapplicationinformation.cpp b/src/xmlpatterns/schema/qxsdapplicationinformation.cpp index 19d1e06..45c6391 100644 --- a/src/xmlpatterns/schema/qxsdapplicationinformation.cpp +++ b/src/xmlpatterns/schema/qxsdapplicationinformation.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdapplicationinformation_p.h b/src/xmlpatterns/schema/qxsdapplicationinformation_p.h index eab3871..1a549cb 100644 --- a/src/xmlpatterns/schema/qxsdapplicationinformation_p.h +++ b/src/xmlpatterns/schema/qxsdapplicationinformation_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdassertion.cpp b/src/xmlpatterns/schema/qxsdassertion.cpp index e604203..2f2d8aa 100644 --- a/src/xmlpatterns/schema/qxsdassertion.cpp +++ b/src/xmlpatterns/schema/qxsdassertion.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdassertion_p.h b/src/xmlpatterns/schema/qxsdassertion_p.h index 4ba47d5..c511c85 100644 --- a/src/xmlpatterns/schema/qxsdassertion_p.h +++ b/src/xmlpatterns/schema/qxsdassertion_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdattribute.cpp b/src/xmlpatterns/schema/qxsdattribute.cpp index a61898e..68f9e3d 100644 --- a/src/xmlpatterns/schema/qxsdattribute.cpp +++ b/src/xmlpatterns/schema/qxsdattribute.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdattribute_p.h b/src/xmlpatterns/schema/qxsdattribute_p.h index aae690b..d64d335 100644 --- a/src/xmlpatterns/schema/qxsdattribute_p.h +++ b/src/xmlpatterns/schema/qxsdattribute_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdattributegroup.cpp b/src/xmlpatterns/schema/qxsdattributegroup.cpp index a9b8412..b0dbc8a 100644 --- a/src/xmlpatterns/schema/qxsdattributegroup.cpp +++ b/src/xmlpatterns/schema/qxsdattributegroup.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdattributegroup_p.h b/src/xmlpatterns/schema/qxsdattributegroup_p.h index 1cd28fa..0d76d53 100644 --- a/src/xmlpatterns/schema/qxsdattributegroup_p.h +++ b/src/xmlpatterns/schema/qxsdattributegroup_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdattributereference.cpp b/src/xmlpatterns/schema/qxsdattributereference.cpp index 97f0c6a..853705a 100644 --- a/src/xmlpatterns/schema/qxsdattributereference.cpp +++ b/src/xmlpatterns/schema/qxsdattributereference.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdattributereference_p.h b/src/xmlpatterns/schema/qxsdattributereference_p.h index 711031f..9c3ef80 100644 --- a/src/xmlpatterns/schema/qxsdattributereference_p.h +++ b/src/xmlpatterns/schema/qxsdattributereference_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdattributeterm.cpp b/src/xmlpatterns/schema/qxsdattributeterm.cpp index 08d3332..afed862 100644 --- a/src/xmlpatterns/schema/qxsdattributeterm.cpp +++ b/src/xmlpatterns/schema/qxsdattributeterm.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdattributeterm_p.h b/src/xmlpatterns/schema/qxsdattributeterm_p.h index f00df73..45f5402 100644 --- a/src/xmlpatterns/schema/qxsdattributeterm_p.h +++ b/src/xmlpatterns/schema/qxsdattributeterm_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdattributeuse.cpp b/src/xmlpatterns/schema/qxsdattributeuse.cpp index 7f0c66a..4055d48 100644 --- a/src/xmlpatterns/schema/qxsdattributeuse.cpp +++ b/src/xmlpatterns/schema/qxsdattributeuse.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdattributeuse_p.h b/src/xmlpatterns/schema/qxsdattributeuse_p.h index 5048a04..648620f 100644 --- a/src/xmlpatterns/schema/qxsdattributeuse_p.h +++ b/src/xmlpatterns/schema/qxsdattributeuse_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdcomplextype.cpp b/src/xmlpatterns/schema/qxsdcomplextype.cpp index 40f752a..42aeb60 100644 --- a/src/xmlpatterns/schema/qxsdcomplextype.cpp +++ b/src/xmlpatterns/schema/qxsdcomplextype.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdcomplextype_p.h b/src/xmlpatterns/schema/qxsdcomplextype_p.h index 5453b8b..d28d2fc 100644 --- a/src/xmlpatterns/schema/qxsdcomplextype_p.h +++ b/src/xmlpatterns/schema/qxsdcomplextype_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsddocumentation.cpp b/src/xmlpatterns/schema/qxsddocumentation.cpp index 8b7928d..de610b4 100644 --- a/src/xmlpatterns/schema/qxsddocumentation.cpp +++ b/src/xmlpatterns/schema/qxsddocumentation.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsddocumentation_p.h b/src/xmlpatterns/schema/qxsddocumentation_p.h index 2bd9bf4..cdccfd7 100644 --- a/src/xmlpatterns/schema/qxsddocumentation_p.h +++ b/src/xmlpatterns/schema/qxsddocumentation_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdelement.cpp b/src/xmlpatterns/schema/qxsdelement.cpp index c783421..1ebec06 100644 --- a/src/xmlpatterns/schema/qxsdelement.cpp +++ b/src/xmlpatterns/schema/qxsdelement.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdelement_p.h b/src/xmlpatterns/schema/qxsdelement_p.h index 9051722..93c5983 100644 --- a/src/xmlpatterns/schema/qxsdelement_p.h +++ b/src/xmlpatterns/schema/qxsdelement_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdfacet.cpp b/src/xmlpatterns/schema/qxsdfacet.cpp index d0148fd..80acc74 100644 --- a/src/xmlpatterns/schema/qxsdfacet.cpp +++ b/src/xmlpatterns/schema/qxsdfacet.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdfacet_p.h b/src/xmlpatterns/schema/qxsdfacet_p.h index 24a6114..349e211 100644 --- a/src/xmlpatterns/schema/qxsdfacet_p.h +++ b/src/xmlpatterns/schema/qxsdfacet_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdidcache.cpp b/src/xmlpatterns/schema/qxsdidcache.cpp index a52b597..cfca2e9 100644 --- a/src/xmlpatterns/schema/qxsdidcache.cpp +++ b/src/xmlpatterns/schema/qxsdidcache.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdidcache_p.h b/src/xmlpatterns/schema/qxsdidcache_p.h index caf9d4d..b24e4b7 100644 --- a/src/xmlpatterns/schema/qxsdidcache_p.h +++ b/src/xmlpatterns/schema/qxsdidcache_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdidchelper.cpp b/src/xmlpatterns/schema/qxsdidchelper.cpp index e814c25..7740929 100644 --- a/src/xmlpatterns/schema/qxsdidchelper.cpp +++ b/src/xmlpatterns/schema/qxsdidchelper.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdidchelper_p.h b/src/xmlpatterns/schema/qxsdidchelper_p.h index a88567e..f3a9bac 100644 --- a/src/xmlpatterns/schema/qxsdidchelper_p.h +++ b/src/xmlpatterns/schema/qxsdidchelper_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdidentityconstraint.cpp b/src/xmlpatterns/schema/qxsdidentityconstraint.cpp index 3f280dc..12f8446 100644 --- a/src/xmlpatterns/schema/qxsdidentityconstraint.cpp +++ b/src/xmlpatterns/schema/qxsdidentityconstraint.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdidentityconstraint_p.h b/src/xmlpatterns/schema/qxsdidentityconstraint_p.h index 5359340..a675ea0 100644 --- a/src/xmlpatterns/schema/qxsdidentityconstraint_p.h +++ b/src/xmlpatterns/schema/qxsdidentityconstraint_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdinstancereader.cpp b/src/xmlpatterns/schema/qxsdinstancereader.cpp index 969dc09..a7cb735 100644 --- a/src/xmlpatterns/schema/qxsdinstancereader.cpp +++ b/src/xmlpatterns/schema/qxsdinstancereader.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdinstancereader_p.h b/src/xmlpatterns/schema/qxsdinstancereader_p.h index dca6204..9c9fcd1 100644 --- a/src/xmlpatterns/schema/qxsdinstancereader_p.h +++ b/src/xmlpatterns/schema/qxsdinstancereader_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdmodelgroup.cpp b/src/xmlpatterns/schema/qxsdmodelgroup.cpp index af74dee..69e5fad 100644 --- a/src/xmlpatterns/schema/qxsdmodelgroup.cpp +++ b/src/xmlpatterns/schema/qxsdmodelgroup.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdmodelgroup_p.h b/src/xmlpatterns/schema/qxsdmodelgroup_p.h index 02e89d0..c4f54e5 100644 --- a/src/xmlpatterns/schema/qxsdmodelgroup_p.h +++ b/src/xmlpatterns/schema/qxsdmodelgroup_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdnotation.cpp b/src/xmlpatterns/schema/qxsdnotation.cpp index 32d480d..2cd27a4 100644 --- a/src/xmlpatterns/schema/qxsdnotation.cpp +++ b/src/xmlpatterns/schema/qxsdnotation.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdnotation_p.h b/src/xmlpatterns/schema/qxsdnotation_p.h index 7db4cbf..598392a 100644 --- a/src/xmlpatterns/schema/qxsdnotation_p.h +++ b/src/xmlpatterns/schema/qxsdnotation_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdparticle.cpp b/src/xmlpatterns/schema/qxsdparticle.cpp index 1b8d2b8..650524c 100644 --- a/src/xmlpatterns/schema/qxsdparticle.cpp +++ b/src/xmlpatterns/schema/qxsdparticle.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdparticle_p.h b/src/xmlpatterns/schema/qxsdparticle_p.h index a72acbb..4e6561e 100644 --- a/src/xmlpatterns/schema/qxsdparticle_p.h +++ b/src/xmlpatterns/schema/qxsdparticle_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdparticlechecker.cpp b/src/xmlpatterns/schema/qxsdparticlechecker.cpp index 3fdfb33..ef1d135 100644 --- a/src/xmlpatterns/schema/qxsdparticlechecker.cpp +++ b/src/xmlpatterns/schema/qxsdparticlechecker.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdparticlechecker_p.h b/src/xmlpatterns/schema/qxsdparticlechecker_p.h index 9ed7fd8..742f0d0 100644 --- a/src/xmlpatterns/schema/qxsdparticlechecker_p.h +++ b/src/xmlpatterns/schema/qxsdparticlechecker_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdreference.cpp b/src/xmlpatterns/schema/qxsdreference.cpp index 6a0fc37..d98a405 100644 --- a/src/xmlpatterns/schema/qxsdreference.cpp +++ b/src/xmlpatterns/schema/qxsdreference.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdreference_p.h b/src/xmlpatterns/schema/qxsdreference_p.h index bb37257..028d190 100644 --- a/src/xmlpatterns/schema/qxsdreference_p.h +++ b/src/xmlpatterns/schema/qxsdreference_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschema.cpp b/src/xmlpatterns/schema/qxsdschema.cpp index 7dc821d..cb766d1 100644 --- a/src/xmlpatterns/schema/qxsdschema.cpp +++ b/src/xmlpatterns/schema/qxsdschema.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschema_p.h b/src/xmlpatterns/schema/qxsdschema_p.h index 1bad61c..e63324e 100644 --- a/src/xmlpatterns/schema/qxsdschema_p.h +++ b/src/xmlpatterns/schema/qxsdschema_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemachecker.cpp b/src/xmlpatterns/schema/qxsdschemachecker.cpp index dde72f5..0d16940 100644 --- a/src/xmlpatterns/schema/qxsdschemachecker.cpp +++ b/src/xmlpatterns/schema/qxsdschemachecker.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemachecker_helper.cpp b/src/xmlpatterns/schema/qxsdschemachecker_helper.cpp index aec411f..3a44365 100644 --- a/src/xmlpatterns/schema/qxsdschemachecker_helper.cpp +++ b/src/xmlpatterns/schema/qxsdschemachecker_helper.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemachecker_p.h b/src/xmlpatterns/schema/qxsdschemachecker_p.h index aed95f5..b4966d9 100644 --- a/src/xmlpatterns/schema/qxsdschemachecker_p.h +++ b/src/xmlpatterns/schema/qxsdschemachecker_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemacontext.cpp b/src/xmlpatterns/schema/qxsdschemacontext.cpp index 61f0511..8e22632 100644 --- a/src/xmlpatterns/schema/qxsdschemacontext.cpp +++ b/src/xmlpatterns/schema/qxsdschemacontext.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemacontext_p.h b/src/xmlpatterns/schema/qxsdschemacontext_p.h index a49f1d7..6a04ba3 100644 --- a/src/xmlpatterns/schema/qxsdschemacontext_p.h +++ b/src/xmlpatterns/schema/qxsdschemacontext_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemadebugger.cpp b/src/xmlpatterns/schema/qxsdschemadebugger.cpp index f85b902..8ec7381 100644 --- a/src/xmlpatterns/schema/qxsdschemadebugger.cpp +++ b/src/xmlpatterns/schema/qxsdschemadebugger.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemadebugger_p.h b/src/xmlpatterns/schema/qxsdschemadebugger_p.h index cdf4bb5..2225b88 100644 --- a/src/xmlpatterns/schema/qxsdschemadebugger_p.h +++ b/src/xmlpatterns/schema/qxsdschemadebugger_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemahelper.cpp b/src/xmlpatterns/schema/qxsdschemahelper.cpp index a56f3ef..e9f32c2 100644 --- a/src/xmlpatterns/schema/qxsdschemahelper.cpp +++ b/src/xmlpatterns/schema/qxsdschemahelper.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemahelper_p.h b/src/xmlpatterns/schema/qxsdschemahelper_p.h index 680ceaa..410b224 100644 --- a/src/xmlpatterns/schema/qxsdschemahelper_p.h +++ b/src/xmlpatterns/schema/qxsdschemahelper_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemamerger.cpp b/src/xmlpatterns/schema/qxsdschemamerger.cpp index c1455b5..4ffcea3 100644 --- a/src/xmlpatterns/schema/qxsdschemamerger.cpp +++ b/src/xmlpatterns/schema/qxsdschemamerger.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemamerger_p.h b/src/xmlpatterns/schema/qxsdschemamerger_p.h index 3187596..599a08b 100644 --- a/src/xmlpatterns/schema/qxsdschemamerger_p.h +++ b/src/xmlpatterns/schema/qxsdschemamerger_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemaparser_p.h b/src/xmlpatterns/schema/qxsdschemaparser_p.h index 60c9d66..ad5e9ce 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser_p.h +++ b/src/xmlpatterns/schema/qxsdschemaparser_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemaparsercontext.cpp b/src/xmlpatterns/schema/qxsdschemaparsercontext.cpp index 4f28d26..381d4d0 100644 --- a/src/xmlpatterns/schema/qxsdschemaparsercontext.cpp +++ b/src/xmlpatterns/schema/qxsdschemaparsercontext.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemaparsercontext_p.h b/src/xmlpatterns/schema/qxsdschemaparsercontext_p.h index c42b165..19c516a 100644 --- a/src/xmlpatterns/schema/qxsdschemaparsercontext_p.h +++ b/src/xmlpatterns/schema/qxsdschemaparsercontext_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemaresolver.cpp b/src/xmlpatterns/schema/qxsdschemaresolver.cpp index 3ec598d..34eb12c 100644 --- a/src/xmlpatterns/schema/qxsdschemaresolver.cpp +++ b/src/xmlpatterns/schema/qxsdschemaresolver.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschemaresolver_p.h b/src/xmlpatterns/schema/qxsdschemaresolver_p.h index 3aee0d8..ef0154b 100644 --- a/src/xmlpatterns/schema/qxsdschemaresolver_p.h +++ b/src/xmlpatterns/schema/qxsdschemaresolver_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschematoken.cpp b/src/xmlpatterns/schema/qxsdschematoken.cpp index 0e98d46..a04f8ae 100644 --- a/src/xmlpatterns/schema/qxsdschematoken.cpp +++ b/src/xmlpatterns/schema/qxsdschematoken.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschematoken_p.h b/src/xmlpatterns/schema/qxsdschematoken_p.h index c20f9fe..fbf71f0 100644 --- a/src/xmlpatterns/schema/qxsdschematoken_p.h +++ b/src/xmlpatterns/schema/qxsdschematoken_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschematypesfactory.cpp b/src/xmlpatterns/schema/qxsdschematypesfactory.cpp index b9d3037..b5f319b 100644 --- a/src/xmlpatterns/schema/qxsdschematypesfactory.cpp +++ b/src/xmlpatterns/schema/qxsdschematypesfactory.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdschematypesfactory_p.h b/src/xmlpatterns/schema/qxsdschematypesfactory_p.h index 21ee31e..74ecc3c 100644 --- a/src/xmlpatterns/schema/qxsdschematypesfactory_p.h +++ b/src/xmlpatterns/schema/qxsdschematypesfactory_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdsimpletype.cpp b/src/xmlpatterns/schema/qxsdsimpletype.cpp index 699c056..6fd5658 100644 --- a/src/xmlpatterns/schema/qxsdsimpletype.cpp +++ b/src/xmlpatterns/schema/qxsdsimpletype.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdsimpletype_p.h b/src/xmlpatterns/schema/qxsdsimpletype_p.h index e6f9b87..6305fc7 100644 --- a/src/xmlpatterns/schema/qxsdsimpletype_p.h +++ b/src/xmlpatterns/schema/qxsdsimpletype_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdstatemachine.cpp b/src/xmlpatterns/schema/qxsdstatemachine.cpp index 08dfda9..85bc752 100644 --- a/src/xmlpatterns/schema/qxsdstatemachine.cpp +++ b/src/xmlpatterns/schema/qxsdstatemachine.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdstatemachine_p.h b/src/xmlpatterns/schema/qxsdstatemachine_p.h index 8cb08e9..e671499 100644 --- a/src/xmlpatterns/schema/qxsdstatemachine_p.h +++ b/src/xmlpatterns/schema/qxsdstatemachine_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp b/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp index 54ee06e..fed8a41 100644 --- a/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp +++ b/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h b/src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h index 31e5c2f..c17ca9b 100644 --- a/src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h +++ b/src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdterm.cpp b/src/xmlpatterns/schema/qxsdterm.cpp index 691d304..19af613 100644 --- a/src/xmlpatterns/schema/qxsdterm.cpp +++ b/src/xmlpatterns/schema/qxsdterm.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdterm_p.h b/src/xmlpatterns/schema/qxsdterm_p.h index ec63615..6b3f66a 100644 --- a/src/xmlpatterns/schema/qxsdterm_p.h +++ b/src/xmlpatterns/schema/qxsdterm_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdtypechecker.cpp b/src/xmlpatterns/schema/qxsdtypechecker.cpp index 4eb10dc..4bb03f5 100644 --- a/src/xmlpatterns/schema/qxsdtypechecker.cpp +++ b/src/xmlpatterns/schema/qxsdtypechecker.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdtypechecker_p.h b/src/xmlpatterns/schema/qxsdtypechecker_p.h index bb2df6d..ae90bdc 100644 --- a/src/xmlpatterns/schema/qxsdtypechecker_p.h +++ b/src/xmlpatterns/schema/qxsdtypechecker_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsduserschematype.cpp b/src/xmlpatterns/schema/qxsduserschematype.cpp index 1b48610..95892e1 100644 --- a/src/xmlpatterns/schema/qxsduserschematype.cpp +++ b/src/xmlpatterns/schema/qxsduserschematype.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsduserschematype_p.h b/src/xmlpatterns/schema/qxsduserschematype_p.h index 92e672e..72162d5 100644 --- a/src/xmlpatterns/schema/qxsduserschematype_p.h +++ b/src/xmlpatterns/schema/qxsduserschematype_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp index 8672338..3cbb6c1 100644 --- a/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp +++ b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h index 62ecba6..c502835 100644 --- a/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h +++ b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp index 7552c41..fda3548 100644 --- a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp +++ b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h b/src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h index 7a1754e..4dc736a 100644 --- a/src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h +++ b/src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdwildcard.cpp b/src/xmlpatterns/schema/qxsdwildcard.cpp index 55ada50..abf490e 100644 --- a/src/xmlpatterns/schema/qxsdwildcard.cpp +++ b/src/xmlpatterns/schema/qxsdwildcard.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdwildcard_p.h b/src/xmlpatterns/schema/qxsdwildcard_p.h index be1716b..8940f13 100644 --- a/src/xmlpatterns/schema/qxsdwildcard_p.h +++ b/src/xmlpatterns/schema/qxsdwildcard_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdxpathexpression.cpp b/src/xmlpatterns/schema/qxsdxpathexpression.cpp index 2ac0a39..d5b4f1a 100644 --- a/src/xmlpatterns/schema/qxsdxpathexpression.cpp +++ b/src/xmlpatterns/schema/qxsdxpathexpression.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/qxsdxpathexpression_p.h b/src/xmlpatterns/schema/qxsdxpathexpression_p.h index 24891c3..8685da5 100644 --- a/src/xmlpatterns/schema/qxsdxpathexpression_p.h +++ b/src/xmlpatterns/schema/qxsdxpathexpression_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/schema/tokens.xml b/src/xmlpatterns/schema/tokens.xml index df37e4a..b3b8e18 100644 --- a/src/xmlpatterns/schema/tokens.xml +++ b/src/xmlpatterns/schema/tokens.xml @@ -113,7 +113,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/type/qnamedschemacomponent.cpp b/src/xmlpatterns/type/qnamedschemacomponent.cpp index b0d832a..0edd593 100644 --- a/src/xmlpatterns/type/qnamedschemacomponent.cpp +++ b/src/xmlpatterns/type/qnamedschemacomponent.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/xmlpatterns/type/qnamedschemacomponent_p.h b/src/xmlpatterns/type/qnamedschemacomponent_p.h index ca3c775..2c8c6ce 100644 --- a/src/xmlpatterns/type/qnamedschemacomponent_p.h +++ b/src/xmlpatterns/type/qnamedschemacomponent_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns of the Qt Toolkit. +** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage -- cgit v0.12 From 0ce74f7a69bcf03de166378a5915624dc32752ac Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 5 Oct 2009 19:16:37 +0200 Subject: QScript: do not crash on PowerPC There is no 'this' register in the global context. The computation of the this register for the global context gives the 'codeBlock' register in the frame header. On Intel processor, a JSValue() is 0x0 when converted to a pointer, but this is not the case on PowerPC (it is 0xfffffff9) so it just crash later when acessing the code block. Solution: special condition for the global context when getting the 'this' object Reviewed-by: Kent Hansen (cherry picked from commit 37bd7a5711e57ea8c45ae75102ddee3ab905a0e5) --- src/script/api/qscriptengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 09042e1..3402190 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -805,7 +805,6 @@ QScriptEnginePrivate::QScriptEnginePrivate() JSC::JSGlobalObject *globalObject = new (globalData)QScript::GlobalObject(); JSC::ExecState* exec = globalObject->globalExec(); - *thisRegisterForFrame(exec) = JSC::JSValue(); scriptObjectStructure = QScriptObject::createStructure(globalObject->objectPrototype()); @@ -1079,12 +1078,13 @@ JSC::JSValue QScriptEnginePrivate::toUsableValue(JSC::JSValue value) /*! \internal Return the 'this' value for a given context - The result may be null for the global context */ JSC::JSValue QScriptEnginePrivate::thisForContext(JSC::ExecState *frame) { if (frame->codeBlock() != 0) { return frame->thisValue(); + } else if(frame == frame->lexicalGlobalObject()->globalExec()) { + return frame->globalThisValue(); } else { JSC::Register *thisRegister = thisRegisterForFrame(frame); return thisRegister->jsValue(); -- cgit v0.12 From 8e5a85fcbba6c9650030f9541eaab3ab02bd5088 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 6 Oct 2009 09:45:52 +0200 Subject: Fix tst_QFontDialog::setFont The font size was not respected because it is taken from the request which could only contains the pixel size. Reviewed-by: Richard (cherry picked from commit 146988463cc0d03be415aa8ff07031b6bcf27975) --- src/gui/dialogs/qfontdialog_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm index dacb54c..5b0983b 100644 --- a/src/gui/dialogs/qfontdialog_mac.mm +++ b/src/gui/dialogs/qfontdialog_mac.mm @@ -628,7 +628,7 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font) nsFont = [mgr fontWithFamily:qt_mac_QStringToNSString(font.family()) traits:mask weight:weight - size:font.pointSize()]; + size:QFontInfo(font).pointSize()]; } [mgr setSelectedFont:nsFont isMultiple:NO]; -- cgit v0.12 From 574d3be72c1a10c8977f8c2203728664e44434f4 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 6 Oct 2009 10:15:42 +0200 Subject: Stabilize tests on X11 (cherry picked from commit f18ea32865521e21f47ea2745181e0e70db0266f) --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 7 ++++--- tests/auto/qmdiarea/tst_qmdiarea.cpp | 2 +- tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp | 6 +++--- tests/auto/qtableview/tst_qtableview.cpp | 4 ++-- tests/auto/qwidget/tst_qwidget.cpp | 3 ++- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index edea6b8..e4eaf4e 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -7301,16 +7301,17 @@ void tst_QGraphicsItem::itemUsesExtendedStyleOption() rect->startTrack = false; view.show(); QTest::qWaitForWindowShown(&view); + QTest::qWait(60); rect->startTrack = true; rect->update(10, 10, 10, 10); - QTest::qWait(12); + QTest::qWait(60); rect->startTrack = false; rect->setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true); QVERIFY((rect->flags() & QGraphicsItem::ItemUsesExtendedStyleOption)); - QTest::qWait(12); + QTest::qWait(60); rect->startTrack = true; rect->update(10, 10, 10, 10); - QTest::qWait(12); + QTest::qWait(60); } void tst_QGraphicsItem::itemSendsGeometryChanges() diff --git a/tests/auto/qmdiarea/tst_qmdiarea.cpp b/tests/auto/qmdiarea/tst_qmdiarea.cpp index a5b3848..068d1fa 100644 --- a/tests/auto/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/qmdiarea/tst_qmdiarea.cpp @@ -1759,7 +1759,7 @@ void tst_QMdiArea::tileSubWindows() // Horizontal scroll bar. QScrollBar *hBar = workspace.horizontalScrollBar(); QCOMPARE(workspace.horizontalScrollBarPolicy(), Qt::ScrollBarAsNeeded); - QVERIFY(hBar->isVisible()); + QTRY_VERIFY(hBar->isVisible()); QCOMPARE(hBar->value(), 0); QCOMPARE(hBar->minimum(), 0); diff --git a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp index 8258e15..b556b87 100644 --- a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp @@ -1003,9 +1003,9 @@ void tst_QMdiSubWindow::setSystemMenu() mainWindow.setCentralWidget(mdiArea); mainWindow.menuBar(); mainWindow.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&mainWindow); -#endif + QTest::qWaitForWindowShown(&mainWindow); + QTest::qWait(60); + QTRY_VERIFY(subWindow->isVisible()); QPoint globalPopupPos; diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 09e1e87..deb0b71 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -2339,7 +2339,7 @@ void tst_QTableView::scrollTo() QSize forcedSize(columnWidth * 2, rowHeight * 2); view.resize(forcedSize); QTest::qWaitForWindowShown(&view); - QTest::qWait(0); + QTest::qWait(50); QTRY_COMPARE(view.size(), forcedSize); view.setModel(&model); @@ -2354,7 +2354,7 @@ void tst_QTableView::scrollTo() for (int c = 0; c < columnCount; ++c) view.setColumnWidth(c, columnWidth); - QTest::qWait(100); // ### needed to pass the test + QTest::qWait(150); // ### needed to pass the test view.horizontalScrollBar()->setValue(horizontalScroll); view.verticalScrollBar()->setValue(verticalScroll); diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 92658a6..5ab273c 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -9118,7 +9118,7 @@ void tst_QWidget::paintOutsidePaintEvent() widget.show(); QTest::qWaitForWindowShown(&widget); - QTest::qWait(20); + QTest::qWait(60); const QPixmap before = QPixmap::grabWindow(widget.winId()); @@ -9128,6 +9128,7 @@ void tst_QWidget::paintOutsidePaintEvent() painter.fillRect(child1.rect(), Qt::red); painter.end(); XSync(QX11Info::display(), false); // Flush output buffer. + QTest::qWait(60); const QPixmap after = QPixmap::grabWindow(widget.winId()); -- cgit v0.12 From 97760fc46216abeb96ef89b754e06c8010379954 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 6 Oct 2009 18:18:38 +1000 Subject: Fix typo in QtCore license headers. Reviewed-by: Trust Me (cherry picked from commit bec7a9cced7b69aef707bad4931fa4d3c35b37fa) --- src/corelib/arch/qatomic_symbian.h | 2 +- src/corelib/arch/symbian/qatomic_symbian.cpp | 2 +- src/corelib/io/qfilesystemwatcher_symbian.cpp | 2 +- src/corelib/io/qfilesystemwatcher_symbian_p.h | 2 +- src/corelib/io/qprocess_symbian.cpp | 2 +- src/corelib/kernel/qcore_symbian_p.cpp | 2 +- src/corelib/kernel/qcore_symbian_p.h | 2 +- src/corelib/kernel/qeventdispatcher_symbian.cpp | 2 +- src/corelib/kernel/qeventdispatcher_symbian_p.h | 2 +- src/corelib/kernel/qsharedmemory_symbian.cpp | 2 +- src/corelib/kernel/qsystemsemaphore_symbian.cpp | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/corelib/arch/qatomic_symbian.h b/src/corelib/arch/qatomic_symbian.h index 1f52a0e..5880120 100644 --- a/src/corelib/arch/qatomic_symbian.h +++ b/src/corelib/arch/qatomic_symbian.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/corelib/arch/symbian/qatomic_symbian.cpp b/src/corelib/arch/symbian/qatomic_symbian.cpp index 71bd145..8f02155 100644 --- a/src/corelib/arch/symbian/qatomic_symbian.cpp +++ b/src/corelib/arch/symbian/qatomic_symbian.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp index a07d084..d738c18 100644 --- a/src/corelib/io/qfilesystemwatcher_symbian.cpp +++ b/src/corelib/io/qfilesystemwatcher_symbian.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/corelib/io/qfilesystemwatcher_symbian_p.h b/src/corelib/io/qfilesystemwatcher_symbian_p.h index 456d18b..edba47c 100644 --- a/src/corelib/io/qfilesystemwatcher_symbian_p.h +++ b/src/corelib/io/qfilesystemwatcher_symbian_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp index d93cdba..f5de750 100644 --- a/src/corelib/io/qprocess_symbian.cpp +++ b/src/corelib/io/qprocess_symbian.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp index 4f23d21..8ca32e5 100644 --- a/src/corelib/kernel/qcore_symbian_p.cpp +++ b/src/corelib/kernel/qcore_symbian_p.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/corelib/kernel/qcore_symbian_p.h b/src/corelib/kernel/qcore_symbian_p.h index 56097bc..f86bfd3 100644 --- a/src/corelib/kernel/qcore_symbian_p.h +++ b/src/corelib/kernel/qcore_symbian_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 11a0da6..acbb7e4 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index fd0350d..c4107da 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/corelib/kernel/qsharedmemory_symbian.cpp b/src/corelib/kernel/qsharedmemory_symbian.cpp index a05e7b4..8a45d14 100644 --- a/src/corelib/kernel/qsharedmemory_symbian.cpp +++ b/src/corelib/kernel/qsharedmemory_symbian.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/corelib/kernel/qsystemsemaphore_symbian.cpp b/src/corelib/kernel/qsystemsemaphore_symbian.cpp index 31fd9e9..ad4b4f4 100644 --- a/src/corelib/kernel/qsystemsemaphore_symbian.cpp +++ b/src/corelib/kernel/qsystemsemaphore_symbian.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage -- cgit v0.12 From 4d976782c1cd5f1e526d212ad2a57f615a6e9b0c Mon Sep 17 00:00:00 2001 From: ninerider Date: Tue, 6 Oct 2009 10:21:57 +0200 Subject: Skipped enter/leave test for Windows CE Currently Windows has no proper cursor support. Reviewed-by: Thomas Hartmann (cherry picked from commit 1015ee9016f3a46bb05077a9eff83c8736b2541e) --- tests/auto/qwidget/tst_qwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 5ab273c..f8341c3 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -8990,6 +8990,9 @@ void tst_QWidget::syntheticEnterLeave() void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() { +#ifdef Q_OS_WINCE_WM + QSKIP("Windows Mobile has no proper cursor support", SkipAll); +#endif class SELParent : public QWidget { public: -- cgit v0.12 From 3e37395c10c15db20dff89afece0392aae4fd407 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 6 Oct 2009 10:30:05 +0200 Subject: Updated JavaScriptCore from /home/khansen/dev/qtwebkit to jsc-for-qtscript-4.6-staging-06102009 ( fc2005c87bbbb743eba96041210902fec821a1af ) (cherry picked from commit b7503346c1b7d245625b1b9e7cf7ae89a86467f0) --- src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp | 1 - src/3rdparty/javascriptcore/VERSION | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp index a509122..be817c3 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp @@ -46,7 +46,6 @@ #define DO_PROPERTYMAP_CONSTENCY_CHECK 0 #endif -using namespace std; using namespace WTF; namespace JSC { diff --git a/src/3rdparty/javascriptcore/VERSION b/src/3rdparty/javascriptcore/VERSION index 8f2b739..571d10f 100644 --- a/src/3rdparty/javascriptcore/VERSION +++ b/src/3rdparty/javascriptcore/VERSION @@ -4,8 +4,8 @@ This is a snapshot of JavaScriptCore from The commit imported was from the - jsc-for-qtscript-4.6-staging-05102009 branch/tag + jsc-for-qtscript-4.6-staging-06102009 branch/tag and has the sha1 checksum - ed678069ebd06579a26b4fb8cc944f06d6b0d55c + fc2005c87bbbb743eba96041210902fec821a1af -- cgit v0.12 From 2065122db7a12a133f082cb21582c9a853dddd2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 6 Oct 2009 10:40:04 +0200 Subject: Fixed the X11 error output from the demos/boxes demo. After we started caching the current context internally, it revealed an old bug: when a QGLWidget is reparented under X11, it will get a new window id, but its context will still be bound to the old window, so we need to rebind it. Reviewed-by: Samuel (cherry picked from commit 6d56096ba0f88e25efd77072f58804dd1f160c0a) --- src/opengl/qgl.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 7dbe642..3940a08 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -3781,6 +3781,11 @@ bool QGLWidget::event(QEvent *e) glFinish(); doneCurrent(); } else if (e->type() == QEvent::ParentChange) { + // if we've reparented a window that has the current context + // bound, we need to rebind that context to the new window id + if (d->glcx == QGLContext::currentContext()) + makeCurrent(); + if (d->glcx->d_func()->screen != d->xinfo.screen() || testAttribute(Qt::WA_TranslucentBackground)) { setContext(new QGLContext(d->glcx->requestedFormat(), this)); // ### recreating the overlay isn't supported atm -- cgit v0.12 From 5bab2186dd61a4cab97c81e4ce5a71a4e7acca07 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 6 Oct 2009 10:47:34 +0200 Subject: Partially revert e58293b3b, re-adding the #ifdef for Qt 4.7 (cherry picked from commit f1ea73bad48816222e192a95f8589493743f0c28) --- src/corelib/io/qdatastream.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h index 7cf22f2..f61a59c 100644 --- a/src/corelib/io/qdatastream.h +++ b/src/corelib/io/qdatastream.h @@ -85,6 +85,10 @@ public: Qt_4_4 = 10, Qt_4_5 = 11, Qt_4_6 = 12 +#if QT_VERSION >= 0x040700 +#error Add the datastream version for this Qt version + Qt_4_7 = Qt_4_6 +#endif }; enum ByteOrder { -- cgit v0.12 From 6dab18ed219aec5e83ee3feb1aa8e8f2df1fd3d7 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 6 Oct 2009 11:11:40 +0300 Subject: Increased tst_QSharedMemory::simpleProcessProducerConsumer timout. Test fails sometimes in Symbian OS due to fact that lackey has not finished it's task in given time. Increase timeout to same value as used in waitForStarted statement. Reviewed-by: TrustMe (cherry picked from commit 501d0fc639e7ec9b26a102eac857123d86215ccf) --- tests/auto/qsharedmemory/tst_qsharedmemory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp index db86c06..4ab3b0b 100644 --- a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp +++ b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp @@ -764,7 +764,7 @@ void tst_QSharedMemory::simpleProcessProducerConsumer() bool consumerFailed = false; while (!consumers.isEmpty()) { - consumers.first()->waitForFinished(1000); + consumers.first()->waitForFinished(2000); if (consumers.first()->state() == QProcess::Running || consumers.first()->exitStatus() != QProcess::NormalExit || consumers.first()->exitCode() != 0) { -- cgit v0.12 From 9a025e28a7b3d86070667c6d4fa10fe46cb0acee Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 6 Oct 2009 11:41:36 +0300 Subject: Decrease tst_QThreadOnce::multipleThreads test num of thread for Symbian In Symbian OS the maximum number of thread per process depends on stack size. With default 8KB stack size you can have 128 threads, with 16KB stack size you can have 64 threads etc. Since all qt threads nowadays have maximum stack size, we need to decrease the amount of threads in this test. Reviewed-by: TrustMe (cherry picked from commit 56087f7ffa0c64c34f55cf24a24d9337592b6c23) --- tests/auto/qthreadonce/tst_qthreadonce.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qthreadonce/tst_qthreadonce.cpp b/tests/auto/qthreadonce/tst_qthreadonce.cpp index a539a7f..2751e9d 100644 --- a/tests/auto/qthreadonce/tst_qthreadonce.cpp +++ b/tests/auto/qthreadonce/tst_qthreadonce.cpp @@ -134,7 +134,7 @@ void tst_QThreadOnce::sameThread() void tst_QThreadOnce::multipleThreads() { -#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS) +#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS) || defined(Q_OS_SYMBIAN) const int NumberOfThreads = 20; #else const int NumberOfThreads = 100; -- cgit v0.12 From c4c4cc81e714e765c448d805dfccc56ce0370dfa Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 6 Oct 2009 11:51:18 +0300 Subject: Unified and increased some lackey timeouts in systemsemaphore test. In Symbian OS some timeouts needs to be higher ones, in order to test complete correctly. Reviewed-by: Miikka Heikkinen (cherry picked from commit e6fdab148b207b6e0cf9279b4b82578d95f021a9) --- .../auto/qsystemsemaphore/tst_qsystemsemaphore.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/auto/qsystemsemaphore/tst_qsystemsemaphore.cpp b/tests/auto/qsystemsemaphore/tst_qsystemsemaphore.cpp index 6bfab15..44986fa 100644 --- a/tests/auto/qsystemsemaphore/tst_qsystemsemaphore.cpp +++ b/tests/auto/qsystemsemaphore/tst_qsystemsemaphore.cpp @@ -42,13 +42,12 @@ #include #include - //TESTED_CLASS= //TESTED_FILES= #define EXISTING_SHARE "existing" - #define LACKYLOC "../qsharedmemory/lackey" +#define LACKYWAITTIME 10000 class tst_QSystemSemaphore : public QObject { @@ -199,12 +198,12 @@ void tst_QSystemSemaphore::basicProcesses() release.setProcessChannelMode(QProcess::ForwardedChannels); acquire.start(LACKYLOC "/lackey", acquireArguments); - acquire.waitForFinished(5000); + acquire.waitForFinished(LACKYWAITTIME); QVERIFY(acquire.state() == QProcess::Running); acquire.kill(); release.start(LACKYLOC "/lackey", releaseArguments); - acquire.waitForFinished(5000); - release.waitForFinished(5000); + acquire.waitForFinished(LACKYWAITTIME); + release.waitForFinished(LACKYWAITTIME); QVERIFY(acquire.state() == QProcess::NotRunning); } @@ -259,13 +258,13 @@ void tst_QSystemSemaphore::undo() QProcess acquire; acquire.setProcessChannelMode(QProcess::ForwardedChannels); acquire.start(LACKYLOC "/lackey", acquireArguments); - acquire.waitForFinished(1000); + acquire.waitForFinished(LACKYWAITTIME); QVERIFY(acquire.state()== QProcess::NotRunning); // At process exit the kernel should auto undo acquire.start(LACKYLOC "/lackey", acquireArguments); - acquire.waitForFinished(1000); + acquire.waitForFinished(LACKYWAITTIME); QVERIFY(acquire.state()== QProcess::NotRunning); } @@ -285,17 +284,17 @@ void tst_QSystemSemaphore::initialValue() release.setProcessChannelMode(QProcess::ForwardedChannels); acquire.start(LACKYLOC "/lackey", acquireArguments); - acquire.waitForFinished(10000); + acquire.waitForFinished(LACKYWAITTIME); QVERIFY(acquire.state()== QProcess::NotRunning); acquire.start(LACKYLOC "/lackey", acquireArguments << "2"); - acquire.waitForFinished(1000); + acquire.waitForFinished(LACKYWAITTIME); QVERIFY(acquire.state()== QProcess::Running); acquire.kill(); release.start(LACKYLOC "/lackey", releaseArguments); - acquire.waitForFinished(10000); - release.waitForFinished(10000); + acquire.waitForFinished(LACKYWAITTIME); + release.waitForFinished(LACKYWAITTIME); QVERIFY(acquire.state()== QProcess::NotRunning); } QTEST_MAIN(tst_QSystemSemaphore) -- cgit v0.12 From 572a6b725b0af8027a767d73f7f96d496e7a1ca9 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 6 Oct 2009 10:59:49 +0200 Subject: Updated JavaScriptCore from /home/khansen/dev/qtwebkit to jsc-for-qtscript-4.6-staging-06102009 ( 32d226eb14d44f80e9ec96d4ca2c595181eeeca3 ) (cherry picked from commit 72f1e06aa6238f55729c4f3606d06ad7d37fe6df) --- src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog | 3 --- .../javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp | 10 +++++----- src/3rdparty/javascriptcore/VERSION | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog index 9dc7916..5fa56a7 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog +++ b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog @@ -195,8 +195,6 @@ (JSC::Heap::markCurrentThreadConservatively): Force jmp_buf to use the appropriate alignment for a pointer to ensure that we correctly interpret the contents of registers during marking. -<<<<<<< HEAD:JavaScriptCore/ChangeLog -======= 2009-09-29 Geoffrey Garen Reviewed by Gavin Barraclough. @@ -323,7 +321,6 @@ (JSC::MarkStack::allocateStack): (JSC::MarkStack::releaseStack): ->>>>>>> 8e5ea20... Hard dependency on SSE2 instruction set with JIT:JavaScriptCore/ChangeLog 2009-09-25 Gabor Loki Reviewed by Gavin Barraclough. diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp index 659bb0e..a43baa8 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp @@ -193,10 +193,10 @@ static void* TryMmap(size_t size, size_t *actual_size, size_t alignment) { // Return the unused memory to the system if (adjust > 0) { - munmap(reinterpret_cast(ptr), adjust); + munmap(reinterpret_cast(ptr), adjust); } if (adjust < extra) { - munmap(reinterpret_cast(ptr + adjust + size), extra - adjust); + munmap(reinterpret_cast(ptr + adjust + size), extra - adjust); } ptr += adjust; @@ -324,10 +324,10 @@ static void* TryDevMem(size_t size, size_t *actual_size, size_t alignment) { // Return the unused virtual memory to the system if (adjust > 0) { - munmap(reinterpret_cast(ptr), adjust); + munmap(reinterpret_cast(ptr), adjust); } if (adjust < extra) { - munmap(reinterpret_cast(ptr + adjust + size), extra - adjust); + munmap(reinterpret_cast(ptr + adjust + size), extra - adjust); } ptr += adjust; @@ -442,7 +442,7 @@ void TCMalloc_SystemRelease(void* start, size_t length) void TCMalloc_SystemRelease(void* start, size_t length) { - void* newAddress = mmap(start, length, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); + void* newAddress = mmap(reinterpret_cast(start), length, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); // If the mmap failed then that's ok, we just won't return the memory to the system. ASSERT_UNUSED(newAddress, newAddress == start || newAddress == reinterpret_cast(MAP_FAILED)); } diff --git a/src/3rdparty/javascriptcore/VERSION b/src/3rdparty/javascriptcore/VERSION index 571d10f..d75862d 100644 --- a/src/3rdparty/javascriptcore/VERSION +++ b/src/3rdparty/javascriptcore/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - fc2005c87bbbb743eba96041210902fec821a1af + 32d226eb14d44f80e9ec96d4ca2c595181eeeca3 -- cgit v0.12 From 130c11f50c0a1992f0a2fe5ff844191ee097c6f8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 6 Oct 2009 11:04:57 +0200 Subject: Autotest: disable the globalObjects test. We are not going to fix this in 4.5. I doubt we'll fix it in 4.6 either, so I'll reenable it for 4.7 only. (cherry picked from commit 7ed2e44c48ac625993cf33cdbb70f82b0a3cb1af) --- tests/auto/symbols/tst_symbols.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/symbols/tst_symbols.cpp b/tests/auto/symbols/tst_symbols.cpp index 87bd63b..6103ede 100644 --- a/tests/auto/symbols/tst_symbols.cpp +++ b/tests/auto/symbols/tst_symbols.cpp @@ -100,6 +100,7 @@ void tst_Symbols::globalObjects() #ifndef Q_OS_LINUX QSKIP("Linux-specific test", SkipAll); #endif + QSKIP("Test disabled, we're not fixing these issues in this Qt version", SkipAll); // these are regexps for global objects that are allowed in Qt QStringList whitelist = QStringList() -- cgit v0.12 From 44adc4509a6561ec89b3a169489f0936a17c32a9 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 6 Oct 2009 11:04:39 +0200 Subject: Prospective build fix for Solaris "Error: "static WTF::TCMalloc_PageHeap::runScavengerThread(void*)" is expected to return a value." (cherry picked from commit 9225889d8958e71c8683df752ff2207c11334c9a) --- src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp index 6cd8ef0..f2148d0 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp @@ -1431,7 +1431,7 @@ void TCMalloc_PageHeap::init() void* TCMalloc_PageHeap::runScavengerThread(void* context) { static_cast(context)->scavengerThread(); -#if COMPILER(MSVC) +#if COMPILER(MSVC) || PLATFORM(SOLARIS) // Without this, Visual Studio will complain that this method does not return a value. return 0; #endif -- cgit v0.12 From af9cb619c2357e07def6b5ee76e4d5950e17d45b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 6 Oct 2009 11:13:51 +0200 Subject: Autotest: add missing copyright attribution for tests copied from kurltest (cherry picked from commit 65a101502bb04ea95110ce6e12a3848c790eb7a1) --- tests/auto/qurl/tst_qurl.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index fb3cf0e..413d9d4 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -671,6 +671,26 @@ void tst_QUrl::setUrl() } /* + The tests below are copied from kdelibs/kdecore/tests/kurltest.cpp (an old version of) + + Copyright (c) 1999-2005 Waldo Bastian + Copyright (c) 2000-2005 David Faure + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ +/* ### File / directory specifics KURL u2( QCString("/home/dfaure/") ); -- cgit v0.12 From bae13dce935ed627c4ae5c165172d38b33d6fe1a Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 6 Oct 2009 11:19:40 +0200 Subject: QtScript: Another crash fix on PowerPC on 32bit PowerPC, the integer value and the pointer value are not in the same word leading to crash. So blindly casting between them lead to crashes. Use the new Register::withInt instead Reviewed-by: Kent Hansen (cherry picked from commit c8d2160f3aa9b6709874c9cf4a634a46728d6cc6) --- src/script/api/qscriptengine.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 3402190..863ac30 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1116,8 +1116,7 @@ uint QScriptEnginePrivate::contextFlags(JSC::ExecState *exec) void QScriptEnginePrivate::setContextFlags(JSC::ExecState *exec, uint flags) { Q_ASSERT(!exec->codeBlock()); - quintptr flag_ptr = flags; - exec->registers()[JSC::RegisterFile::ReturnValueRegister] = JSC::JSValue(reinterpret_cast(flag_ptr)); + exec->registers()[JSC::RegisterFile::ReturnValueRegister] = JSC::Register::withInt(flags); } -- cgit v0.12 From 3cd593ee216310b507a298e33e91ce0b292fde55 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 6 Oct 2009 11:40:12 +0200 Subject: Stabilize QWaitCondition test. Wait a little bit more for thread synchronization Reviewed-by: Brad (cherry picked from commit 7a8503d179e0f9afebb2ca57e824f1be61becf17) --- tests/auto/qwaitcondition/tst_qwaitcondition.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/qwaitcondition/tst_qwaitcondition.cpp b/tests/auto/qwaitcondition/tst_qwaitcondition.cpp index c2bbe22..f534f3b 100644 --- a/tests/auto/qwaitcondition/tst_qwaitcondition.cpp +++ b/tests/auto/qwaitcondition/tst_qwaitcondition.cpp @@ -491,7 +491,7 @@ void tst_QWaitCondition::wakeOne() for (int y = 0; y < ThreadCount; ++y) { if (thread_exited[y]) continue; - if (thread[y].wait(exited > 0 ? 1 : 1000)) { + if (thread[y].wait(exited > 0 ? 3 : 1000)) { thread_exited[y] = TRUE; ++exited; } @@ -535,7 +535,7 @@ void tst_QWaitCondition::wakeOne() for (int y = 0; y < ThreadCount; ++y) { if (thread_exited[y]) continue; - if (rwthread[y].wait(exited > 0 ? 1 : 1000)) { + if (rwthread[y].wait(exited > 0 ? 3 : 1000)) { thread_exited[y] = TRUE; ++exited; } @@ -587,7 +587,7 @@ void tst_QWaitCondition::wakeOne() for (int y = 0; y < ThreadCount; ++y) { if (thread_exited[y]) continue; - if (thread[y].wait(exited > 0 ? 1 : 1000)) { + if (thread[y].wait(exited > 0 ? 3 : 1000)) { thread_exited[y] = TRUE; ++exited; } @@ -633,7 +633,7 @@ void tst_QWaitCondition::wakeOne() for (int y = 0; y < ThreadCount; ++y) { if (thread_exited[y]) continue; - if (rwthread[y].wait(exited > 0 ? 1 : 1000)) { + if (rwthread[y].wait(exited > 0 ? 3 : 1000)) { thread_exited[y] = TRUE; ++exited; } -- cgit v0.12 From d4d79ffb8fa16bf2327ac8bc1e1b4acf9797fb37 Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 6 Oct 2009 11:33:39 +0200 Subject: Faster case-insensitive comparison to "file" in QUrl::toLocalFile Merge-Request: 1709 Reviewed-By: Thiago Macieira (cherry picked from commit 914cae63fd9045b8ac5877a974551f29eec24d72) --- src/corelib/io/qurl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index c9a4cf1..c6bb893 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -5941,7 +5941,7 @@ QString QUrl::toLocalFile() const QString tmp; QString ourPath = path(); - if (d->scheme.isEmpty() || d->scheme.toLower() == QLatin1String("file")) { + if (d->scheme.isEmpty() || QString::compare(d->scheme, QLatin1String("file"), Qt::CaseInsensitive) == 0) { // magic for shared drive on windows if (!d->host.isEmpty()) { -- cgit v0.12 From 735111d3e3d61cd93e35aba668c84dc8f8d79180 Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 6 Oct 2009 11:31:50 +0200 Subject: Fix regression in QUrl: IPv6 hosts should be lowercased like in Qt-4.5. Merge-Request: 1709 Reviewed-By: Thiago Macieira (cherry picked from commit 8c4eb2b62983ec09bdfb2bde2723df12ac4e00ef) --- src/corelib/io/qurl.cpp | 2 ++ tests/auto/qurl/tst_qurl.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index c6bb893..22d0019 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3384,6 +3384,8 @@ QString QUrlPrivate::canonicalHost() const const char *ptr = ba.constData(); if (!_IPLiteral(&ptr)) that->host.clear(); + else + that->host = host.toLower(); } else { that->host = qt_ACE_do(host, NormalizeAce); } diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index 413d9d4..8856792 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -2262,6 +2262,9 @@ void tst_QUrl::ipv6_2_data() QTest::newRow("[::ffff:129.144.52.38]") << QString("http://[::ffff:129.144.52.38]/cgi/test.cgi") << QString("http://[::ffff:129.144.52.38]/cgi/test.cgi"); + QTest::newRow("[::FFFF:129.144.52.38]") + << QString("http://[::FFFF:129.144.52.38]/cgi/test.cgi") + << QString("http://[::ffff:129.144.52.38]/cgi/test.cgi"); } void tst_QUrl::ipv6_2() -- cgit v0.12 From fff4fc598d506a213ff424874bb35dbc8bceb140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 6 Oct 2009 12:02:28 +0200 Subject: Build the demo-browser 32-bit on Mac since there's no 64-bit Flash Reviewed-by: Simon Hausmann (cherry picked from commit 1f47353f90f6e1a3122eee14b9011bdeb7c7a93f) --- demos/browser/browser.pro | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/demos/browser/browser.pro b/demos/browser/browser.pro index dab9387..f421c6a 100644 --- a/demos/browser/browser.pro +++ b/demos/browser/browser.pro @@ -80,6 +80,10 @@ mac { ICON = browser.icns QMAKE_INFO_PLIST = Info_mac.plist TARGET = Browser + + # No 64-bit Flash on Mac, so build the browser 32-bit + CONFIG -= x86_64 + CONFIG += x86 } wince*: { -- cgit v0.12 From 1c1c640c0cdb6b7638246587dfb5c8b6f63f6e2b Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 6 Oct 2009 12:09:14 +0200 Subject: statemachine: implement cloning of a whole bunch more GUI events Now using QEventTransition with almost any type of event will actually work, instead of causing an assert. (cherry picked from commit cadad3fdc7f6de95979f5b5be070da0853c46ba4) --- src/gui/statemachine/qguistatemachine.cpp | 344 ++++++++++--------------- tests/auto/qstatemachine/tst_qstatemachine.cpp | 27 ++ 2 files changed, 169 insertions(+), 202 deletions(-) diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/gui/statemachine/qguistatemachine.cpp index e9a0b78..5ff1164 100644 --- a/src/gui/statemachine/qguistatemachine.cpp +++ b/src/gui/statemachine/qguistatemachine.cpp @@ -90,52 +90,38 @@ static QEvent *cloneEvent(QEvent *e) case QEvent::Close: return new QCloseEvent(*static_cast(e)); case QEvent::Quit: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::ParentChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::ParentAboutToChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::ThreadChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::WindowActivate: case QEvent::WindowDeactivate: return new QEvent(*e); case QEvent::ShowToParent: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::HideToParent: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::Wheel: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QWheelEvent(*static_cast(e)); case QEvent::WindowTitleChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::WindowIconChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::ApplicationWindowIconChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::ApplicationFontChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::ApplicationLayoutDirectionChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::ApplicationPaletteChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::PaletteChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::Clipboard: Q_ASSERT_X(false, "cloneEvent()", "not implemented"); break; @@ -146,14 +132,11 @@ static QEvent *cloneEvent(QEvent *e) Q_ASSERT_X(false, "cloneEvent()", "not implemented"); break; case QEvent::SockAct: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::WinEventAct: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::DeferredDelete: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); #ifndef QT_NO_DRAGANDDROP case QEvent::DragEnter: return new QDragEnterEvent(*static_cast(e)); @@ -164,139 +147,99 @@ static QEvent *cloneEvent(QEvent *e) case QEvent::Drop: return new QDropEvent(*static_cast(e)); case QEvent::DragResponse: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QDragResponseEvent(*static_cast(e)); #endif case QEvent::ChildAdded: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QChildEvent(*static_cast(e)); case QEvent::ChildPolished: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QChildEvent(*static_cast(e)); #ifdef QT3_SUPPORT case QEvent::ChildInsertedRequest: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::ChildInserted: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QChildEvent(*static_cast(e)); case QEvent::LayoutHint: Q_ASSERT_X(false, "cloneEvent()", "not implemented"); break; #endif case QEvent::ChildRemoved: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QChildEvent(*static_cast(e)); case QEvent::ShowWindowRequest: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::PolishRequest: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::Polish: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::LayoutRequest: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::UpdateRequest: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::UpdateLater: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::EmbeddingControl: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::ActivateControl: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::DeactivateControl: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); + case QEvent::ContextMenu: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QContextMenuEvent(*static_cast(e)); case QEvent::InputMethod: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QInputMethodEvent(*static_cast(e)); case QEvent::AccessibilityPrepare: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::TabletMove: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QTabletEvent(*static_cast(e)); case QEvent::LocaleChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::LanguageChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::LayoutDirectionChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::Style: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::TabletPress: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QTabletEvent(*static_cast(e)); case QEvent::TabletRelease: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QTabletEvent(*static_cast(e)); case QEvent::OkRequest: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::HelpRequest: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::IconDrag: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QIconDragEvent(*static_cast(e)); case QEvent::FontChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::EnabledChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::ActivationChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::StyleChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::IconTextChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::ModifiedChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::MouseTrackingChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::WindowBlocked: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::WindowUnblocked: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::WindowStateChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QWindowStateChangeEvent(*static_cast(e)); case QEvent::ToolTip: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QHelpEvent(*static_cast(e)); case QEvent::WhatsThis: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QHelpEvent(*static_cast(e)); case QEvent::StatusTip: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QStatusTipEvent(*static_cast(e)); #ifndef QT_NO_ACTION case QEvent::ActionChanged: case QEvent::ActionAdded: @@ -304,15 +247,12 @@ static QEvent *cloneEvent(QEvent *e) return new QActionEvent(*static_cast(e)); #endif case QEvent::FileOpen: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QFileOpenEvent(*static_cast(e)); case QEvent::Shortcut: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QShortcutEvent(*static_cast(e)); case QEvent::ShortcutOverride: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QKeyEvent(*static_cast(e)); #ifdef QT3_SUPPORT case QEvent::Accel: @@ -324,43 +264,30 @@ static QEvent *cloneEvent(QEvent *e) #endif case QEvent::WhatsThisClicked: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QWhatsThisClickedEvent(*static_cast(e)); case QEvent::ToolBarChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QToolBarChangeEvent(*static_cast(e)); case QEvent::ApplicationActivate: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::ApplicationDeactivate: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::QueryWhatsThis: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QHelpEvent(*static_cast(e)); case QEvent::EnterWhatsThisMode: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::LeaveWhatsThisMode: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::ZOrderChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::HoverEnter: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; case QEvent::HoverLeave: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; case QEvent::HoverMove: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QHoverEvent(*static_cast(e)); case QEvent::AccessibilityHelp: Q_ASSERT_X(false, "cloneEvent()", "not implemented"); @@ -371,19 +298,15 @@ static QEvent *cloneEvent(QEvent *e) #ifdef QT_KEYPAD_NAVIGATION case QEvent::EnterEditFocus: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::LeaveEditFocus: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); #endif case QEvent::AcceptDropsChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::MenubarUpdated: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QMenubarUpdatedEvent(*static_cast(e)); case QEvent::ZeroTimerEvent: Q_ASSERT_X(false, "cloneEvent()", "not implemented"); @@ -426,80 +349,82 @@ static QEvent *cloneEvent(QEvent *e) } case QEvent::GraphicsSceneHoverEnter: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; case QEvent::GraphicsSceneHoverMove: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::GraphicsSceneHoverLeave: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + case QEvent::GraphicsSceneHoverLeave: { + QGraphicsSceneHoverEvent *he = static_cast(e); + QGraphicsSceneHoverEvent *he2 = new QGraphicsSceneHoverEvent(he->type()); + he2->setPos(he->pos()); + he2->setScenePos(he->scenePos()); + he2->setScreenPos(he->screenPos()); + he2->setLastPos(he->lastPos()); + he2->setLastScenePos(he->lastScenePos()); + he2->setLastScreenPos(he->lastScreenPos()); + he2->setModifiers(he->modifiers()); + return he2; + } case QEvent::GraphicsSceneHelp: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QHelpEvent(*static_cast(e)); case QEvent::GraphicsSceneDragEnter: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; case QEvent::GraphicsSceneDragMove: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; case QEvent::GraphicsSceneDragLeave: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::GraphicsSceneDrop: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::GraphicsSceneWheel: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + case QEvent::GraphicsSceneDrop: { + QGraphicsSceneDragDropEvent *dde = static_cast(e); + QGraphicsSceneDragDropEvent *dde2 = new QGraphicsSceneDragDropEvent(dde->type()); + dde2->setPos(dde->pos()); + dde2->setScenePos(dde->scenePos()); + dde2->setScreenPos(dde->screenPos()); + dde2->setButtons(dde->buttons()); + dde2->setModifiers(dde->modifiers()); + return dde2; + } + case QEvent::GraphicsSceneWheel: { + QGraphicsSceneWheelEvent *we = static_cast(e); + QGraphicsSceneWheelEvent *we2 = new QGraphicsSceneWheelEvent(we->type()); + we2->setPos(we->pos()); + we2->setScenePos(we->scenePos()); + we2->setScreenPos(we->screenPos()); + we2->setButtons(we->buttons()); + we2->setModifiers(we->modifiers()); + we2->setOrientation(we->orientation()); + return we2; + } #endif case QEvent::KeyboardLayoutChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::DynamicPropertyChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QDynamicPropertyChangeEvent(*static_cast(e)); case QEvent::TabletEnterProximity: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; case QEvent::TabletLeaveProximity: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QTabletEvent(*static_cast(e)); case QEvent::NonClientAreaMouseMove: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; case QEvent::NonClientAreaMouseButtonPress: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; case QEvent::NonClientAreaMouseButtonRelease: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; case QEvent::NonClientAreaMouseButtonDblClick: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QMouseEvent(*static_cast(e)); case QEvent::MacSizeChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::ContentsRectChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::MacGLWindowChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::FutureCallOut: Q_ASSERT_X(false, "cloneEvent()", "not implemented"); break; #ifndef QT_NO_GRAPHICSVIEW - case QEvent::GraphicsSceneResize: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + case QEvent::GraphicsSceneResize: { + QGraphicsSceneResizeEvent *re = static_cast(e); + QGraphicsSceneResizeEvent *re2 = new QGraphicsSceneResizeEvent(); + re2->setOldSize(re->oldSize()); + re2->setNewSize(re->newSize()); + return re2; + } case QEvent::GraphicsSceneMove: { QGraphicsSceneMoveEvent *me = static_cast(e); QGraphicsSceneMoveEvent *me2 = new QGraphicsSceneMoveEvent(); @@ -510,11 +435,9 @@ static QEvent *cloneEvent(QEvent *e) } #endif case QEvent::CursorChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::ToolTipChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; + return new QEvent(*e); case QEvent::NetworkReplyUpdated: Q_ASSERT_X(false, "cloneEvent()", "not implemented"); @@ -531,6 +454,23 @@ static QEvent *cloneEvent(QEvent *e) Q_ASSERT_X(false, "cloneEvent()", "not implemented"); break; #endif + + case QEvent::TouchBegin: + case QEvent::TouchUpdate: + case QEvent::TouchEnd: + return new QTouchEvent(*static_cast(e)); + + case QEvent::NativeGesture: + Q_ASSERT_X(false, "cloneEvent()", "not implemented"); + break; + + case QEvent::RequestSoftwareInputPanel: + case QEvent::CloseSoftwareInputPanel: + return new QEvent(*e); + + case QEvent::UpdateSoftKeys: + return new QEvent(*e); + case QEvent::User: case QEvent::MaxUser: Q_ASSERT_X(false, "cloneEvent()", "not implemented"); diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index b808f7f..1516346 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -42,6 +42,9 @@ #include #include #include +#include +#include +#include #include "qstatemachine.h" #include "qstate.h" @@ -127,6 +130,7 @@ private slots: void allSourceToTargetConfigurations(); void signalTransitions(); void eventTransitions(); + void graphicsSceneEventTransitions(); void historyStates(); void startAndStop(); void targetStateWithNoParent(); @@ -2426,6 +2430,29 @@ void tst_QStateMachine::eventTransitions() } } +void tst_QStateMachine::graphicsSceneEventTransitions() +{ + QGraphicsScene scene; + QGraphicsTextItem *textItem = scene.addText("foo"); + + QStateMachine machine; + QState *s1 = new QState(&machine); + QFinalState *s2 = new QFinalState(&machine); + QEventTransition *t = new QEventTransition(textItem, QEvent::GraphicsSceneMouseMove); + t->setTargetState(s2); + s1->addTransition(t); + machine.setInitialState(s1); + + QSignalSpy startedSpy(&machine, SIGNAL(started())); + QSignalSpy finishedSpy(&machine, SIGNAL(finished())); + machine.start(); + QTRY_COMPARE(startedSpy.count(), 1); + QVERIFY(finishedSpy.count() == 0); + QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove); + scene.sendEvent(textItem, &mouseEvent); + QTRY_COMPARE(finishedSpy.count(), 1); +} + void tst_QStateMachine::historyStates() { for (int x = 0; x < 2; ++x) { -- cgit v0.12 From 879a4e0c1f694b292a2b85cfb7140aed470de9a6 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 6 Oct 2009 11:59:32 +0200 Subject: Add GNOME implementation for native filesystem icons This adds some code to support native filesystem icons on GNOME. It works by resolving gnome libs and gnome-vfs dynamically, hence we are explicitly running it on GNOME only and not KDE. Even if it would work there as well. We are planning on adding this functionality to the platform plugin as well. Task-number: QTBUG-2195 Reviewed-by: joao (cherry picked from commit 3d2ef8ab18dcf0b772d2f6ddeb5cf5295ca09db6) --- src/gui/itemviews/qfileiconprovider.cpp | 15 +++++++++++++++ src/gui/styles/gtksymbols.cpp | 28 ++++++++++++++++++++++++++++ src/gui/styles/gtksymbols_p.h | 29 +++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp index 4abdef9..c78a49b 100644 --- a/src/gui/itemviews/qfileiconprovider.cpp +++ b/src/gui/itemviews/qfileiconprovider.cpp @@ -54,6 +54,12 @@ #elif defined(Q_WS_MAC) #include #endif + +#if defined(Q_WS_X11) && !defined(Q_NO_STYLE_GTK) +#include +#include +#endif + #include #ifndef SHGFI_ADDOVERLAYS @@ -378,6 +384,15 @@ QIcon QFileIconProviderPrivate::getMacIcon(const QFileInfo &fi) const QIcon QFileIconProvider::icon(const QFileInfo &info) const { Q_D(const QFileIconProvider); + +#if defined(Q_WS_X11) && !defined(QT_NO_STYLE_GTK) + if (X11->desktopEnvironment == DE_GNOME) { + QIcon gtkIcon = QGtk::getFilesystemIcon(info); + if (!gtkIcon.isNull()) + return gtkIcon; + } +#endif + #ifdef Q_WS_MAC QIcon retIcon = d->getMacIcon(info); if (!retIcon.isNull()) diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp index 1cb0ca4..d8f140f 100644 --- a/src/gui/styles/gtksymbols.cpp +++ b/src/gui/styles/gtksymbols.cpp @@ -58,6 +58,7 @@ #include #include #include +#include #include #include @@ -124,6 +125,7 @@ Ptr_gtk_progress_set_adjustment QGtk::gtk_progress_set_adjustment = 0; Ptr_gtk_range_set_adjustment QGtk::gtk_range_set_adjustment = 0; Ptr_gtk_range_set_inverted QGtk::gtk_range_set_inverted = 0; Ptr_gtk_icon_factory_lookup_default QGtk::gtk_icon_factory_lookup_default = 0; +Ptr_gtk_icon_theme_get_default QGtk::gtk_icon_theme_get_default = 0; Ptr_gtk_widget_style_get QGtk::gtk_widget_style_get = 0; Ptr_gtk_icon_set_render_icon QGtk::gtk_icon_set_render_icon = 0; Ptr_gtk_fixed_new QGtk::gtk_fixed_new = 0; @@ -196,6 +198,9 @@ Ptr_gconf_client_get_default QGtk::gconf_client_get_default = 0; Ptr_gconf_client_get_string QGtk::gconf_client_get_string = 0; Ptr_gconf_client_get_bool QGtk::gconf_client_get_bool = 0; +Ptr_gnome_icon_lookup_sync QGtk::gnome_icon_lookup_sync = 0; +Ptr_gnome_vfs_init QGtk::gnome_vfs_init = 0; + static QString classPath(GtkWidget *widget) { char* class_path; @@ -281,6 +286,7 @@ static void resolveGtk() QGtk::gtk_range_set_inverted = (Ptr_gtk_range_set_inverted)libgtk.resolve("gtk_range_set_inverted"); QGtk::gtk_container_add = (Ptr_gtk_container_add)libgtk.resolve("gtk_container_add"); QGtk::gtk_icon_factory_lookup_default = (Ptr_gtk_icon_factory_lookup_default)libgtk.resolve("gtk_icon_factory_lookup_default"); + QGtk::gtk_icon_theme_get_default = (Ptr_gtk_icon_theme_get_default)libgtk.resolve("gtk_icon_theme_get_default"); QGtk::gtk_widget_style_get = (Ptr_gtk_widget_style_get)libgtk.resolve("gtk_widget_style_get"); QGtk::gtk_icon_set_render_icon = (Ptr_gtk_icon_set_render_icon)libgtk.resolve("gtk_icon_set_render_icon"); QGtk::gtk_fixed_new = (Ptr_gtk_fixed_new)libgtk.resolve("gtk_fixed_new"); @@ -325,6 +331,9 @@ static void resolveGtk() QGtk::pango_font_description_get_weight = (Ptr_pango_font_description_get_weight)libgtk.resolve("pango_font_description_get_weight"); QGtk::pango_font_description_get_family = (Ptr_pango_font_description_get_family)libgtk.resolve("pango_font_description_get_family"); QGtk::pango_font_description_get_style = (Ptr_pango_font_description_get_style)libgtk.resolve("pango_font_description_get_style"); + + QGtk::gnome_icon_lookup_sync = (Ptr_gnome_icon_lookup_sync)QLibrary::resolve( QLS("gnomeui-2"), 0, "gnome_icon_lookup_sync"); + QGtk::gnome_vfs_init= (Ptr_gnome_vfs_init)QLibrary::resolve( QLS("gnomevfs-2"), 0, "gnome_vfs_init"); } void QGtk::cleanup_gtk_widgets() @@ -969,6 +978,25 @@ QString QGtk::saveFilename(QWidget *parent, const QString &caption, const QStrin return filename; } +QIcon QGtk::getFilesystemIcon(const QFileInfo &info) +{ + QIcon icon; + if (QGtk::gnome_vfs_init && QGtk::gnome_icon_lookup_sync) { + QGtk::gnome_vfs_init(); + GtkIconTheme *theme = QGtk::gtk_icon_theme_get_default(); + QString fileurl = QUrl::fromLocalFile(info.absoluteFilePath()); + char * icon_name = QGtk::gnome_icon_lookup_sync(theme, + NULL, + qPrintable(fileurl), + NULL, + GNOME_ICON_LOOKUP_FLAGS_NONE, + NULL); + return QIcon::fromTheme(icon_name); + g_free(icon_name); + } + return icon; +} + QT_END_NAMESPACE #endif // !defined(QT_NO_STYLE_GTK) diff --git a/src/gui/styles/gtksymbols_p.h b/src/gui/styles/gtksymbols_p.h index 4fb193d..313d948 100644 --- a/src/gui/styles/gtksymbols_p.h +++ b/src/gui/styles/gtksymbols_p.h @@ -121,6 +121,7 @@ typedef void (*Ptr_gtk_progress_set_adjustment)(GtkProgress *, GtkAdjustment *); typedef void (*Ptr_gtk_range_set_inverted)(GtkRange*, bool); typedef void (*Ptr_gtk_container_add)(GtkContainer *container, GtkWidget *widget); typedef GtkIconSet* (*Ptr_gtk_icon_factory_lookup_default) (const gchar*); +typedef GtkIconTheme* (*Ptr_gtk_icon_theme_get_default) (void); typedef void (*Ptr_gtk_widget_style_get)(GtkWidget *, const gchar *first_property_name, ...); typedef GtkTreeViewColumn* (*Ptr_gtk_tree_view_column_new)(void); typedef GtkWidget* (*Ptr_gtk_fixed_new)(void); @@ -195,6 +196,29 @@ typedef void (*Ptr_gdk_x11_window_set_user_time) (GdkWindow *window, guint32); typedef XID (*Ptr_gdk_x11_drawable_get_xid) (GdkDrawable *); typedef Display* (*Ptr_gdk_x11_drawable_get_xdisplay) ( GdkDrawable *); + +typedef enum { + GNOME_ICON_LOOKUP_FLAGS_NONE = 0, + GNOME_ICON_LOOKUP_FLAGS_EMBEDDING_TEXT = 1<<0, + GNOME_ICON_LOOKUP_FLAGS_SHOW_SMALL_IMAGES_AS_THEMSELVES = 1<<1, + GNOME_ICON_LOOKUP_FLAGS_ALLOW_SVG_AS_THEMSELVES = 1<<2 +} GnomeIconLookupFlags; + +typedef enum { + GNOME_ICON_LOOKUP_RESULT_FLAGS_NONE = 0, + GNOME_ICON_LOOKUP_RESULT_FLAGS_THUMBNAIL = 1<<0 +} GnomeIconLookupResultFlags; + +struct GnomeThumbnailFactory; +typedef gboolean (*Ptr_gnome_vfs_init) (void); +typedef char* (*Ptr_gnome_icon_lookup_sync) ( + GtkIconTheme *icon_theme, + GnomeThumbnailFactory *, + const char *file_uri, + const char *custom_icon, + GnomeIconLookupFlags flags, + GnomeIconLookupResultFlags *result); + QT_BEGIN_NAMESPACE class QGtk @@ -219,6 +243,7 @@ public: QString *selectedFilter, QFileDialog::Options options); static QString getGConfString(const QString &key, const QString &fallback = QString()); static bool getGConfBool(const QString &key, bool fallback = 0); + static QIcon getFilesystemIcon(const QFileInfo &); static Ptr_gtk_container_forall gtk_container_forall; static Ptr_gtk_init gtk_init; @@ -263,6 +288,7 @@ public: static Ptr_gtk_range_set_adjustment gtk_range_set_adjustment; static Ptr_gtk_range_set_inverted gtk_range_set_inverted; static Ptr_gtk_icon_factory_lookup_default gtk_icon_factory_lookup_default; + static Ptr_gtk_icon_theme_get_default gtk_icon_theme_get_default; static Ptr_gtk_widget_style_get gtk_widget_style_get; static Ptr_gtk_icon_set_render_icon gtk_icon_set_render_icon; static Ptr_gtk_fixed_new gtk_fixed_new; @@ -333,6 +359,9 @@ public: static Ptr_gconf_client_get_default gconf_client_get_default; static Ptr_gconf_client_get_string gconf_client_get_string; static Ptr_gconf_client_get_bool gconf_client_get_bool; + + static Ptr_gnome_icon_lookup_sync gnome_icon_lookup_sync; + static Ptr_gnome_vfs_init gnome_vfs_init; }; // Helper to ensure that we have polished all our gtk widgets -- cgit v0.12 From caa46056225705ced4faca57d75091a219b38279 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 6 Oct 2009 12:31:12 +0200 Subject: Add support for XFCE desktop integration XFCE essentially depends on gnome libraries and can use the same integration features we provide for GNOME. Hence we simply treat it as the GNOME desktop environment internally. We can now also use the DESKTOP_SESSION to reliably detect desktop environments since it has been properly standardized, instead of relying on window manager hacks for anything but a fallback. Task-number: QTBUG-4737 Reviewed-by: bhughes (cherry picked from commit 9956ef7fd66f5a0a2ebf9b810e5f6ffe3649cf20) --- src/gui/kernel/qapplication_x11.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index bbce438..e46a370 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -2256,8 +2256,13 @@ void qt_init(QApplicationPrivate *priv, int, unsigned long length, after; uchar *data = 0; - if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING), - 0, 1, False, AnyPropertyType, &type, &format, &length, + QString session = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION")); + if (session == QLatin1String("kde")) { + X11->desktopEnvironment = DE_KDE; + } else if (session == QLatin1String("gnome") || session == QLatin1String("xfce")) { + X11->desktopEnvironment = DE_GNOME; + } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING), + 0, 1, False, AnyPropertyType, &type, &format, &length, &after, &data) == Success && length) { // DTWM is running, meaning most likely CDE is running... X11->desktopEnvironment = DE_CDE; -- cgit v0.12 From 3be41abc842d02dbfe0aff7f190a3ca027653d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 6 Oct 2009 12:40:49 +0200 Subject: Only build demo-browser 32-bit if Qt was actually built 32-bit Also, add same trick for PPC Reviewed-by: MortenS (cherry picked from commit a6ed1f886d323d68001e3e1b50efe064073691ea) --- demos/browser/browser.pro | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/demos/browser/browser.pro b/demos/browser/browser.pro index f421c6a..6c5f005 100644 --- a/demos/browser/browser.pro +++ b/demos/browser/browser.pro @@ -82,8 +82,14 @@ mac { TARGET = Browser # No 64-bit Flash on Mac, so build the browser 32-bit - CONFIG -= x86_64 - CONFIG += x86 + contains(QT_CONFIG, x86) { + CONFIG -= x86_64 + CONFIG += x86 + } + contains(QT_CONFIG, ppc) { + CONFIG -= ppc64 + CONFIG += ppc + } } wince*: { -- cgit v0.12 From e0936308bbf30ce7db87e4f33cd7d92bb9591a88 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 6 Oct 2009 12:52:58 +0200 Subject: implement property getters&setters for setProperty(quint32) overload It's better that this works rather than asserts. Reviewed-by: Olivier Goffart (cherry picked from commit 13cf7c64acd1652bad90966e06464b35b84e9513) --- src/script/api/qscriptvalue.cpp | 6 ++++-- tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index f2716e4..92c987c 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -1738,7 +1738,7 @@ QScriptValue QScriptValue::property(quint32 arrayIndex, void QScriptValue::setProperty(quint32 arrayIndex, const QScriptValue &value, const PropertyFlags &flags) { - Q_D(const QScriptValue); + Q_D(QScriptValue); if (!d || !d->isObject()) return; if (value.engine() && (value.engine() != engine())) { @@ -1752,7 +1752,9 @@ void QScriptValue::setProperty(quint32 arrayIndex, const QScriptValue &value, JSC::asObject(d->jscValue)->deleteProperty(exec, arrayIndex, /*checkDontDelete=*/false); } else { if ((flags & QScriptValue::PropertyGetter) || (flags & QScriptValue::PropertySetter)) { - Q_ASSERT_X(false, Q_FUNC_INFO, "property getters and setters not implemented"); + // fall back to string-based setProperty(), since there is no + // JSC::JSObject::defineGetter(unsigned) + d->setProperty(JSC::Identifier::from(exec, arrayIndex), value, flags); } else { if (flags != QScriptValue::KeepExistingFlags) { // if (JSC::asObject(d->jscValue)->hasOwnProperty(exec, arrayIndex)) diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index 6b64e76..5636c54 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -87,6 +87,7 @@ private slots: void getSetPrototype(); void getSetScope(); void getSetProperty(); + void arrayElementGetterSetter(); void getSetData(); void getSetScriptClass(); void call(); @@ -2115,6 +2116,32 @@ void tst_QScriptValue::getSetProperty() QVERIFY(object.propertyFlags(foo) == 0); } +void tst_QScriptValue::arrayElementGetterSetter() +{ + QScriptEngine eng; + QScriptValue obj = eng.newObject(); + obj.setProperty(1, eng.newFunction(getterSetter), QScriptValue::PropertyGetter|QScriptValue::PropertySetter); + { + QScriptValue num(123); + obj.setProperty("x", num); + QScriptValue ret = obj.property(1); + QVERIFY(ret.isValid()); + QVERIFY(ret.equals(num)); + } + { + QScriptValue num(456); + obj.setProperty(1, num); + QScriptValue ret = obj.property(1); + QVERIFY(ret.isValid()); + QVERIFY(ret.equals(num)); + QVERIFY(ret.equals(obj.property("1"))); + } + QCOMPARE(obj.propertyFlags("1"), QScriptValue::PropertyGetter|QScriptValue::PropertySetter); + + obj.setProperty(1, QScriptValue(), QScriptValue::PropertyGetter|QScriptValue::PropertySetter); + QVERIFY(obj.propertyFlags("1") == 0); +} + void tst_QScriptValue::getSetPrototype() { QScriptEngine eng; -- cgit v0.12 From c1751ef8ee5d0bad4050538546b319d2e9e71a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 6 Oct 2009 12:59:49 +0200 Subject: doc: Fixed a qdoc command that was meant to add emphasis It was creating another list item. (cherry picked from commit 590b9b0e7587494e110cc3c498ff69ddab6f7520) --- src/gui/painting/qcolor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 62e08f3..d9b824b 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -514,7 +514,7 @@ QString QColor::name() const \i #RRRRGGGGBBBB \i A name from the list of colors defined in the list of \l{SVG color keyword names} provided by the World Wide Web Consortium; for example, "steelblue" or "gainsboro". - These color names work on all platforms. Note that these color names are \i not the + These color names work on all platforms. Note that these color names are \e not the same as defined by the Qt::GlobalColor enums, e.g. "green" and Qt::green does not refer to the same color. \i \c transparent - representing the absence of a color. -- cgit v0.12 From 012fe2f42f8a44d94f2b6c2091c322e21b20d2ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 6 Oct 2009 12:41:09 +0200 Subject: Optimized window surfaces on X11 by not setting clip in the common case. We don't need to set a clip when the flush only contains a single region. Not setting the clip gives us a slight performance boost. Reviewed-by: Trond (cherry picked from commit 6a061c1b66de4048222ef49c3d34c3e424e2a6c8) --- src/gui/painting/qwindowsurface_raster.cpp | 13 +++++++++---- src/gui/painting/qwindowsurface_x11.cpp | 5 ++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index 592b34c..5600948 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -140,7 +140,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi // Not ready for painting yet, bail out. This can happen in // QWidget::create_sys() - if (!d->image) + if (!d->image || rgn.numRects() == 0) return; #ifdef Q_WS_WIN @@ -203,9 +203,11 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi wrgn.translate(-wOffset); QRect wbr = wrgn.boundingRect(); - int num; - XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num); - XSetClipRectangles(X11->display, d_ptr->gc, 0, 0, rects, num, YXBanded); + if (wrgn.numRects() != 1) { + int num; + XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num); + XSetClipRectangles(X11->display, d_ptr->gc, 0, 0, rects, num, YXBanded); + } QRect br = rgn.boundingRect().translated(offset); #ifndef QT_NO_MITSHM @@ -230,6 +232,9 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi qt_x11_drawImage(br, wbr.topLeft(), src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), widget->x11Info().depth()); } } + + if (wrgn.numRects() != 1) + XSetClipMask(X11->display, d_ptr->gc, XNone); #endif // FALCON #ifdef Q_WS_MAC diff --git a/src/gui/painting/qwindowsurface_x11.cpp b/src/gui/painting/qwindowsurface_x11.cpp index 5e4433c..46c4c42 100644 --- a/src/gui/painting/qwindowsurface_x11.cpp +++ b/src/gui/painting/qwindowsurface_x11.cpp @@ -129,9 +129,12 @@ void QX11WindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint // qDebug() << "XSetClipRectangles"; // for (int i = 0; i < num; ++i) // qDebug() << ' ' << i << rects[i].x << rects[i].x << rects[i].y << rects[i].width << rects[i].height; - XSetClipRectangles(X11->display, gc, 0, 0, rects, num, YXBanded); + if (num != 1) + XSetClipRectangles(X11->display, gc, 0, 0, rects, num, YXBanded); XCopyArea(X11->display, d_ptr->device.handle(), widget->handle(), gc, br.x() + offset.x(), br.y() + offset.y(), br.width(), br.height(), wbr.x(), wbr.y()); + if (num != 1) + XSetClipMask(X11->display, gc, XNone); } void QX11WindowSurface::setGeometry(const QRect &rect) -- cgit v0.12 From cfd42f484cac007305b9422912ccf6094ffddb7c Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 5 Oct 2009 15:27:55 +0200 Subject: The threshold for system basic timers has changed on windows This breaks the animations in main window because dragging a dock widget when it is undocked creates another event loop and the Qt events are not processed any more. Reviewed-by: Trust Me (cherry picked from commit 9dcd06efae3e2d78ef402bf06e655e7e95550a39) --- src/corelib/animation/qabstractanimation.cpp | 6 +++--- src/corelib/kernel/qeventdispatcher_win.cpp | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 6bbd801..2769040 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -162,9 +162,9 @@ //on windows if you're currently dragging a widget an inner eventloop was started by the system //to make sure that this timer is getting fired, we need to make sure to use the system timers //that will send a WM_TIMER event. We do that by settings the timer interval to 11 - //It is 11 because QEventDispatcherWin32Private::registerTimer specifically checks if the interval - //is greater than 10 to determine if it should use a system timer (or the multimedia timer). -#define STARTSTOP_TIMER_DELAY 11 + //It is 16 because QEventDispatcherWin32Private::registerTimer specifically checks if the interval + //is greater than 11 to determine if it should use a system timer (or the multimedia timer). +#define STARTSTOP_TIMER_DELAY 16 #else #define STARTSTOP_TIMER_DELAY 0 #endif diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index aae351c..1e6402f 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -539,6 +539,10 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t) int ok = 0; + //in the animation api, we delay the start of the animation + //for the dock widgets, we need to use a system timer because dragging a native window + //makes Windows start its own event loop. + //So if this threshold changes, please change STARTSTOP_TIMER_DELAY in qabstractanimation.cpp accordingly. if (t->interval > 15 || !t->interval || !qtimeSetEvent) { ok = 1; if (!t->interval) // optimization for single-shot-zero-timer -- cgit v0.12 From 6403df30cc44fd4f4dd47dd2e03c32b5283391a9 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 6 Oct 2009 13:06:05 +0200 Subject: QParallelAnimationGroup: set the correct state for the animations There were cases (now covered by autotests) where the state of the animations could be wrong. Reviewed-by: janarve (cherry picked from commit 1f5afc4300d3d7e3063f4e2c80a280a5098717d1) --- src/corelib/animation/qparallelanimationgroup.cpp | 76 +++++++---- src/corelib/animation/qparallelanimationgroup_p.h | 2 + .../tst_qparallelanimationgroup.cpp | 146 ++++++++++++++++++++- 3 files changed, 194 insertions(+), 30 deletions(-) diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp index 5b7fd22..2812854 100644 --- a/src/corelib/animation/qparallelanimationgroup.cpp +++ b/src/corelib/animation/qparallelanimationgroup.cpp @@ -143,13 +143,14 @@ void QParallelAnimationGroup::updateCurrentTime(int currentTime) // simulate completion of the loop seeking backwards for (int i = 0; i < d->animations.size(); ++i) { QAbstractAnimation *animation = d->animations.at(i); + //we need to make sure the animation is in the right state + //and then rewind it + d->applyGroupState(animation); animation->setCurrentTime(0); animation->stop(); } } - bool timeFwd = ((d->currentLoop == d->lastLoop && currentTime >= d->lastCurrentTime) - || d->currentLoop > d->lastLoop); #ifdef QANIMATION_DEBUG qDebug("QParallellAnimationGroup %5d: setCurrentTime(%d), loop:%d, last:%d, timeFwd:%d, lastcurrent:%d, %d", __LINE__, d->currentTime, d->currentLoop, d->lastLoop, timeFwd, d->lastCurrentTime, state()); @@ -158,34 +159,19 @@ void QParallelAnimationGroup::updateCurrentTime(int currentTime) for (int i = 0; i < d->animations.size(); ++i) { QAbstractAnimation *animation = d->animations.at(i); const int dura = animation->totalDuration(); - if (dura == -1 && d->isUncontrolledAnimationFinished(animation)) - continue; - if (dura == -1 || (currentTime <= dura && dura != 0) - || (dura == 0 && d->currentLoop != d->lastLoop)) { - switch (state()) { - case Running: - animation->start(); - break; - case Paused: - animation->pause(); - break; - case Stopped: - default: - break; - } + //if the loopcount is bigger we should always start all animations + if (d->currentLoop > d->lastLoop + //if we're at the end of the animation, we need to start it if it wasn't already started in this loop + //this happens in Backward direction where not all animations are started at the same time + || d->shouldAnimationStart(animation, d->lastCurrentTime > dura /*startIfAtEnd*/)) { + d->applyGroupState(animation); } - if (dura <= 0) { - if (dura == -1) - animation->setCurrentTime(currentTime); - continue; + if (animation->state() == state()) { + animation->setCurrentTime(currentTime); + if (dura > 0 && currentTime > dura) + animation->stop(); } - - if ((timeFwd && d->lastCurrentTime <= dura) - || (!timeFwd && d->currentTime <= dura)) - animation->setCurrentTime(currentTime); - if (currentTime > dura) - animation->stop(); } d->lastLoop = d->currentLoop; d->lastCurrentTime = currentTime; @@ -208,7 +194,8 @@ void QParallelAnimationGroup::updateState(QAbstractAnimation::State oldState, break; case Paused: for (int i = 0; i < d->animations.size(); ++i) - d->animations.at(i)->pause(); + if (d->animations.at(i)->state() == Running) + d->animations.at(i)->pause(); break; case Running: d->connectUncontrolledAnimations(); @@ -217,7 +204,8 @@ void QParallelAnimationGroup::updateState(QAbstractAnimation::State oldState, if (oldState == Stopped) animation->stop(); animation->setDirection(d->direction); - animation->start(); + if (d->shouldAnimationStart(animation, oldState == Stopped)) + animation->start(); } break; } @@ -280,6 +268,36 @@ void QParallelAnimationGroupPrivate::connectUncontrolledAnimations() } } +bool QParallelAnimationGroupPrivate::shouldAnimationStart(QAbstractAnimation *animation, bool startIfAtEnd) const +{ + const int dura = animation->totalDuration(); + if (dura == -1) + return !isUncontrolledAnimationFinished(animation); + if (startIfAtEnd) + return currentTime <= dura; + if (direction == QAbstractAnimation::Forward) + return currentTime < dura; + else //direction == QAbstractAnimation::Backward + return currentTime && currentTime <= dura; +} + +void QParallelAnimationGroupPrivate::applyGroupState(QAbstractAnimation *animation) +{ + switch (state) + { + case QAbstractAnimation::Running: + animation->start(); + break; + case QAbstractAnimation::Paused: + animation->pause(); + break; + case QAbstractAnimation::Stopped: + default: + break; + } +} + + bool QParallelAnimationGroupPrivate::isUncontrolledAnimationFinished(QAbstractAnimation *anim) const { return uncontrolledFinishTime.value(anim, -1) >= 0; diff --git a/src/corelib/animation/qparallelanimationgroup_p.h b/src/corelib/animation/qparallelanimationgroup_p.h index 8e1fb34..fa0ef95 100644 --- a/src/corelib/animation/qparallelanimationgroup_p.h +++ b/src/corelib/animation/qparallelanimationgroup_p.h @@ -74,6 +74,8 @@ public: int lastLoop; int lastCurrentTime; + bool shouldAnimationStart(QAbstractAnimation *animation, bool startIfAtEnd) const; + void applyGroupState(QAbstractAnimation *animation); bool isUncontrolledAnimationFinished(QAbstractAnimation *anim) const; void connectUncontrolledAnimations(); void disconnectUncontrolledAnimations(); diff --git a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index acd23b0..8578d36 100644 --- a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -62,6 +62,7 @@ public Q_SLOTS: private slots: void construction(); void setCurrentTime(); + void stateChanged(); void clearGroup(); void propagateGroupUpdateToChildren(); void updateChildrenWithRunningGroup(); @@ -252,6 +253,112 @@ void tst_QParallelAnimationGroup::setCurrentTime() QCOMPARE(loopsForever->currentTime(), 1); } +void tst_QParallelAnimationGroup::stateChanged() +{ + //this ensures that the correct animations are started when starting the group + TestAnimation *anim1 = new TestAnimation; + TestAnimation *anim2 = new TestAnimation; + TestAnimation *anim3 = new TestAnimation; + TestAnimation *anim4 = new TestAnimation; + anim1->setDuration(1000); + anim2->setDuration(2000); + anim3->setDuration(3000); + anim4->setDuration(3000); + QParallelAnimationGroup group; + group.addAnimation(anim1); + group.addAnimation(anim2); + group.addAnimation(anim3); + group.addAnimation(anim4); + + QSignalSpy spy1(anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy spy2(anim2, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy spy3(anim3, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy spy4(anim4, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + + //first; let's start forward + group.start(); + //all the animations should be started + QCOMPARE(spy1.count(), 1); + QCOMPARE(qVariantValue(spy1.last().at(1)), TestAnimation::Running); + QCOMPARE(spy2.count(), 1); + QCOMPARE(qVariantValue(spy2.last().at(1)), TestAnimation::Running); + QCOMPARE(spy3.count(), 1); + QCOMPARE(qVariantValue(spy3.last().at(1)), TestAnimation::Running); + QCOMPARE(spy4.count(), 1); + QCOMPARE(qVariantValue(spy4.last().at(1)), TestAnimation::Running); + + group.setCurrentTime(1500); //anim1 should be finished + QCOMPARE(group.state(), QAnimationGroup::Running); + QCOMPARE(spy1.count(), 2); + QCOMPARE(qVariantValue(spy1.last().at(1)), TestAnimation::Stopped); + QCOMPARE(spy2.count(), 1); //no change + QCOMPARE(spy3.count(), 1); //no change + QCOMPARE(spy4.count(), 1); //no change + + group.setCurrentTime(2500); //anim2 should be finished + QCOMPARE(group.state(), QAnimationGroup::Running); + QCOMPARE(spy1.count(), 2); //no change + QCOMPARE(spy2.count(), 2); + QCOMPARE(qVariantValue(spy2.last().at(1)), TestAnimation::Stopped); + QCOMPARE(spy3.count(), 1); //no change + QCOMPARE(spy4.count(), 1); //no change + + group.setCurrentTime(3500); //everything should be finished + QCOMPARE(group.state(), QAnimationGroup::Stopped); + QCOMPARE(spy1.count(), 2); //no change + QCOMPARE(spy2.count(), 2); //no change + QCOMPARE(spy3.count(), 2); + QCOMPARE(qVariantValue(spy3.last().at(1)), TestAnimation::Stopped); + QCOMPARE(spy4.count(), 2); + QCOMPARE(qVariantValue(spy4.last().at(1)), TestAnimation::Stopped); + + //cleanup + spy1.clear(); + spy2.clear(); + spy3.clear(); + spy4.clear(); + + //now let's try to reverse that + group.setDirection(QAbstractAnimation::Backward); + group.start(); + + //only anim3 and anim4 should be started + QCOMPARE(group.state(), QAnimationGroup::Running); + QCOMPARE(spy1.count(), 0); + QCOMPARE(spy2.count(), 0); + QCOMPARE(spy3.count(), 1); + QCOMPARE(qVariantValue(spy3.last().at(1)), TestAnimation::Running); + QCOMPARE(spy4.count(), 1); + QCOMPARE(qVariantValue(spy4.last().at(1)), TestAnimation::Running); + + group.setCurrentTime(1500); //anim2 should be started + QCOMPARE(group.state(), QAnimationGroup::Running); + QCOMPARE(spy1.count(), 0); //no change + QCOMPARE(spy2.count(), 1); + QCOMPARE(qVariantValue(spy2.last().at(1)), TestAnimation::Running); + QCOMPARE(spy3.count(), 1); //no change + QCOMPARE(spy4.count(), 1); //no change + + group.setCurrentTime(500); //anim1 is finally also started + QCOMPARE(group.state(), QAnimationGroup::Running); + QCOMPARE(spy1.count(), 1); + QCOMPARE(qVariantValue(spy1.last().at(1)), TestAnimation::Running); + QCOMPARE(spy2.count(), 1); //no change + QCOMPARE(spy3.count(), 1); //no change + QCOMPARE(spy4.count(), 1); //no change + + group.setCurrentTime(0); //everything should be stopped + QCOMPARE(group.state(), QAnimationGroup::Stopped); + QCOMPARE(spy1.count(), 2); + QCOMPARE(qVariantValue(spy1.last().at(1)), TestAnimation::Stopped); + QCOMPARE(spy2.count(), 2); + QCOMPARE(qVariantValue(spy2.last().at(1)), TestAnimation::Stopped); + QCOMPARE(spy3.count(), 2); + QCOMPARE(qVariantValue(spy3.last().at(1)), TestAnimation::Stopped); + QCOMPARE(spy4.count(), 2); + QCOMPARE(qVariantValue(spy4.last().at(1)), TestAnimation::Stopped); +} + void tst_QParallelAnimationGroup::clearGroup() { QParallelAnimationGroup group; @@ -398,7 +505,7 @@ void tst_QParallelAnimationGroup::deleteChildrenWithRunningGroup() QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(anim1->state(), QAnimationGroup::Running); - QTest::qWait(50); + QTest::qWait(80); QVERIFY(group.currentTime() > 0); delete anim1; @@ -564,14 +671,23 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation() anim2.setEndValue(100); anim2.setDuration(100); + TestAnimation anim3; + anim3.setStartValue(0); + anim3.setEndValue(100); + anim3.setDuration(10); + QSignalSpy stateChangedSpy1(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); QSignalSpy finishedSpy1(&anim1, SIGNAL(finished())); QSignalSpy stateChangedSpy2(&anim2, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); QSignalSpy finishedSpy2(&anim2, SIGNAL(finished())); + QSignalSpy stateChangedSpy3(&anim3, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy finishedSpy3(&anim3, SIGNAL(finished())); + group.addAnimation(&anim1); group.addAnimation(&anim2); + group.addAnimation(&anim3); QCOMPARE(stateChangedSpy1.count(), 0); group.start(); QCOMPARE(stateChangedSpy1.count(), 2); @@ -586,9 +702,15 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation() QCOMPARE(qVariantValue(stateChangedSpy1.at(0).at(1)), QAnimationGroup::Running); + QCOMPARE(stateChangedSpy3.count(), 1); + QCOMPARE(finishedSpy3.count(), 0); + QCOMPARE(qVariantValue(stateChangedSpy3.at(0).at(1)), + QAnimationGroup::Running); + QCOMPARE(anim1.state(), QAnimationGroup::Stopped); QCOMPARE(anim2.state(), QAnimationGroup::Running); + QCOMPARE(anim3.state(), QAnimationGroup::Running); QCOMPARE(group.state(), QAnimationGroup::Running); @@ -596,19 +718,24 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation() group.setLoopCount(4); stateChangedSpy1.clear(); stateChangedSpy2.clear(); + stateChangedSpy3.clear(); group.start(); QCOMPARE(stateChangedSpy1.count(), 2); QCOMPARE(stateChangedSpy2.count(), 1); + QCOMPARE(stateChangedSpy3.count(), 1); group.setCurrentTime(50); QCOMPARE(stateChangedSpy1.count(), 2); QCOMPARE(stateChangedSpy2.count(), 1); + QCOMPARE(stateChangedSpy3.count(), 2); group.setCurrentTime(150); QCOMPARE(stateChangedSpy1.count(), 4); QCOMPARE(stateChangedSpy2.count(), 3); + QCOMPARE(stateChangedSpy3.count(), 4); group.setCurrentTime(50); QCOMPARE(stateChangedSpy1.count(), 6); QCOMPARE(stateChangedSpy2.count(), 5); + QCOMPARE(stateChangedSpy3.count(), 6); } @@ -863,6 +990,23 @@ void tst_QParallelAnimationGroup::pauseResume() QCOMPARE(anim->state(), QAnimationGroup::Running); QCOMPARE(anim->currentTime(), currentTime); QCOMPARE(spy.count(), 1); + + group.stop(); + spy.clear(); + new TestAnimation2(500, &group); + group.start(); + QCOMPARE(spy.count(), 1); //the animation should have been started + QCOMPARE(qVariantValue(spy.last().at(1)), TestAnimation::Running); + group.setCurrentTime(250); //end of first animation + QCOMPARE(spy.count(), 2); //the animation should have been stopped + QCOMPARE(qVariantValue(spy.last().at(1)), TestAnimation::Stopped); + group.pause(); + QCOMPARE(spy.count(), 2); //this shouldn't have changed + group.resume(); + QCOMPARE(spy.count(), 2); //this shouldn't have changed + + + } -- cgit v0.12 From 8c1510e0e864a315c131d43783ba7b3593a02dc1 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 6 Oct 2009 14:13:39 +0300 Subject: Changed wording on Symbian introduction doc. Executing "perl createpackage.pl" will only work in bin dir, so changed the wording a bit. Reviewed-by: Janne Anttila (cherry picked from commit 9c73671c3b917a2a6a22411fb17c46dfa5e21049) --- doc/src/platforms/s60-introduction.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/platforms/s60-introduction.qdoc b/doc/src/platforms/s60-introduction.qdoc index d0a1976..086ee52 100644 --- a/doc/src/platforms/s60-introduction.qdoc +++ b/doc/src/platforms/s60-introduction.qdoc @@ -121,8 +121,8 @@ \row \o \c QT_SIS_OPTIONS \o Options accepted by \c .sis creation. -i, install the package right away using PC suite. -c=, read certificate information from a file. - Execute \c{perl createpackage.pl} for more information - about options. + Execute \c{createpackage.pl} script without any + parameters for more information about options. By default no otions are given. \row \o \c QT_SIS_TARGET \o Target for which \c .sis file is created. Accepted values are build targets listed in -- cgit v0.12 From 57a8a9a9ed29cdbead23005c115fff44aad85205 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 6 Oct 2009 13:45:48 +0200 Subject: Corrected Qt logo colors. Replaced the poisonous green by the 'official' one. Took the RGB values from the logos availiable at: http://qt.nokia.com/about/logos-for-download Reviewed-By: TrustMe (cherry picked from commit a6bf8c28a8b8792167f6c93a08e871376651ba1a) --- src/s60installs/qt.svg | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/s60installs/qt.svg b/src/s60installs/qt.svg index 22cb204..6230ada 100644 --- a/src/s60installs/qt.svg +++ b/src/s60installs/qt.svg @@ -3,15 +3,15 @@ - - + + - - - + + + - - + + -- cgit v0.12 From 662d4e3d91e2d395bfc88dac012804b009e32195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 6 Oct 2009 13:46:13 +0200 Subject: Fixed an assert occuring on X11 when destroying QPixmaps under GL. The cleanup code for the QX11PixmapData was called incorrectly for QGLPixmapData. Reviewed-by: Samuel (cherry picked from commit cb368e06bea269422efcbdbe8136d424b6ff5052) --- src/opengl/qgl.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 3940a08..3f96d1c 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1654,8 +1654,10 @@ void QGLTextureCache::pixmapCleanupHook(QPixmap* pixmap) } #if defined(Q_WS_X11) QPixmapData *pd = pixmap->data_ptr().data(); - Q_ASSERT(pd->ref == 1); // Make sure reference counting isn't broken - QGLContextPrivate::destroyGlSurfaceForPixmap(pd); + if (pd->classId() == QPixmapData::X11Class) { + Q_ASSERT(pd->ref == 1); // Make sure reference counting isn't broken + QGLContextPrivate::destroyGlSurfaceForPixmap(pd); + } #endif } -- cgit v0.12 From 9e513e22ff33a0d6394cadff688e54fcb124bdec Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Mon, 28 Sep 2009 17:55:24 +0200 Subject: Small doclet fix Rev-By: Trust-Me (cherry picked from commit 6c14af1cdb02d1d6957ad23ec435e2b95dda5b4a) --- src/gui/text/qtextoption.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp index facc8dc..bdab3f2 100644 --- a/src/gui/text/qtextoption.cpp +++ b/src/gui/text/qtextoption.cpp @@ -345,9 +345,9 @@ QList QTextOption::tabs() const This enum holds the different types of tabulator - \value LeftTab, A left-tab - \value RightTab, A right-tab - \value CenterTab, A centered-tab + \value LeftTab A left-tab + \value RightTab A right-tab + \value CenterTab A centered-tab \value DelimiterTab A tab stopping at a certain delimiter-character */ -- cgit v0.12 From b60ba455588ddcfe1f4dc4b957fccdc942000ea2 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 25 Sep 2009 19:59:12 +0200 Subject: Span update after row and column insertion and removal in QTableView. The feature had not been implemented yet. Auto-test and benchmark included. As a bonus, single cell spans are no longer added to the span collection. Reviewed-by: Thierry Task-number: 245327 Task-number: QTBUG-3610 (cherry picked from commit 0d51611fa524091ddca3c6c11edb0eae8ffe3b02) --- src/gui/itemviews/qtableview.cpp | 404 +++++++++++++++++++++++++ src/gui/itemviews/qtableview.h | 4 + src/gui/itemviews/qtableview_p.h | 21 +- tests/auto/qtableview/tst_qtableview.cpp | 193 +++++++++++- tests/benchmarks/qtableview/tst_qtableview.cpp | 174 +++++++++++ 5 files changed, 792 insertions(+), 4 deletions(-) diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index f1ffaa6..15bd445 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -191,6 +191,359 @@ QList QSpanCollection::spansInRect(int x, int y, int w, return list.toList(); } +#undef DEBUG_SPAN_UPDATE + +#ifdef DEBUG_SPAN_UPDATE +QDebug operator<<(QDebug str, const QSpanCollection::Span &span) +{ + str << "(" << span.top() << "," << span.left() << "," << span.bottom() << "," << span.right() << ")"; + return str; +} +#endif + +/** \internal +* Updates the span collection after row insertion. +*/ +void QSpanCollection::updateInsertedRows(int start, int end) +{ +#ifdef DEBUG_SPAN_UPDATE + qDebug() << Q_FUNC_INFO; + qDebug() << start << end; + qDebug() << index; +#endif + if (spans.isEmpty()) + return; + + int delta = end - start + 1; +#ifdef DEBUG_SPAN_UPDATE + qDebug("Before"); +#endif + for (SpanList::iterator it = spans.begin(); it != spans.end(); ++it) { + Span *span = *it; +#ifdef DEBUG_SPAN_UPDATE + qDebug() << span << *span; +#endif + if (span->m_bottom < start) + continue; + if (span->m_top >= start) + span->m_top += delta; + span->m_bottom += delta; + } + +#ifdef DEBUG_SPAN_UPDATE + qDebug("After"); + foreach (QSpanCollection::Span *span, spans) + qDebug() << span << *span; +#endif + + for (Index::iterator it_y = index.begin(); it_y != index.end(); ) { + int y = -it_y.key(); + if (y < start) { + ++it_y; + continue; + } + + index.insert(-y - delta, it_y.value()); + it_y = index.erase(it_y); + } +#ifdef DEBUG_SPAN_UPDATE + qDebug() << index; +#endif +} + +/** \internal +* Updates the span collection after column insertion. +*/ +void QSpanCollection::updateInsertedColumns(int start, int end) +{ +#ifdef DEBUG_SPAN_UPDATE + qDebug() << Q_FUNC_INFO; + qDebug() << start << end; + qDebug() << index; +#endif + if (spans.isEmpty()) + return; + + int delta = end - start + 1; +#ifdef DEBUG_SPAN_UPDATE + qDebug("Before"); +#endif + for (SpanList::iterator it = spans.begin(); it != spans.end(); ++it) { + Span *span = *it; +#ifdef DEBUG_SPAN_UPDATE + qDebug() << span << *span; +#endif + if (span->m_right < start) + continue; + if (span->m_left >= start) + span->m_left += delta; + span->m_right += delta; + } + +#ifdef DEBUG_SPAN_UPDATE + qDebug("After"); + foreach (QSpanCollection::Span *span, spans) + qDebug() << span << *span; +#endif + + for (Index::iterator it_y = index.begin(); it_y != index.end(); ++it_y) { + SubIndex &subindex = it_y.value(); + for (SubIndex::iterator it = subindex.begin(); it != subindex.end(); ) { + int x = -it.key(); + if (x < start) { + ++it; + continue; + } + subindex.insert(-x - delta, it.value()); + it = subindex.erase(it); + } + } +#ifdef DEBUG_SPAN_UPDATE + qDebug() << index; +#endif +} + +/** \internal +* Cleans a subindex from to be deleted spans. The update argument is used +* to move the spans inside the subindex, in case their anchor changed. +* \return true if no span in this subindex starts at y, and should thus be deleted. +*/ +bool QSpanCollection::cleanSpanSubIndex(QSpanCollection::SubIndex &subindex, int y, bool update) +{ + if (subindex.isEmpty()) + return true; + + bool should_be_deleted = true; + SubIndex::iterator it = subindex.end(); + do { + --it; + int x = -it.key(); + Span *span = it.value(); + if (span->will_be_deleted) { + it = subindex.erase(it); + continue; + } + if (update && span->m_left != x) { + subindex.insert(-span->m_left, span); + it = subindex.erase(it); + } + if (should_be_deleted && span->m_top == y) + should_be_deleted = false; + } while (it != subindex.begin()); + + return should_be_deleted; +} + +/** \internal +* Updates the span collection after row removal. +*/ +void QSpanCollection::updateRemovedRows(int start, int end) +{ +#ifdef DEBUG_SPAN_UPDATE + qDebug() << Q_FUNC_INFO; + qDebug() << start << end; + qDebug() << index; +#endif + if (spans.isEmpty()) + return; + + SpanList spansToBeDeleted; + int delta = end - start + 1; +#ifdef DEBUG_SPAN_UPDATE + qDebug("Before"); +#endif + for (SpanList::iterator it = spans.begin(); it != spans.end(); ) { + Span *span = *it; +#ifdef DEBUG_SPAN_UPDATE + qDebug() << span << *span; +#endif + if (span->m_bottom < start) { + ++it; + continue; + } + if (span->m_top < start) { + if (span->m_bottom <= end) + span->m_bottom = start - 1; + else + span->m_bottom -= delta; + } else { + if (span->m_bottom > end) { + if (span->m_top <= end) + span->m_top = start; + else + span->m_top -= delta; + span->m_bottom -= delta; + } else { + span->will_be_deleted = true; + } + } + if (span->m_top == span->m_bottom && span->m_left == span->m_right) + span->will_be_deleted = true; + if (span->will_be_deleted) { + spansToBeDeleted.append(span); + it = spans.erase(it); + } else { + ++it; + } + } + +#ifdef DEBUG_SPAN_UPDATE + qDebug("After"); + foreach (QSpanCollection::Span *span, spans) + qDebug() << span << *span; +#endif + if (spans.isEmpty()) { + qDeleteAll(spansToBeDeleted); + index.clear(); + return; + } + + Index::iterator it_y = index.end(); + do { + --it_y; + int y = -it_y.key(); + SubIndex &subindex = it_y.value(); + if (y < start) { + if (cleanSpanSubIndex(subindex, y)) + it_y = index.erase(it_y); + } else if (y >= start && y <= end) { + bool span_at_start = false; + SubIndex spansToBeMoved; + for (SubIndex::iterator it = subindex.begin(); it != subindex.end(); ++it) { + Span *span = it.value(); + if (span->will_be_deleted) + continue; + if (!span_at_start && span->m_top == start) + span_at_start = true; + spansToBeMoved.insert(it.key(), span); + } + + if (y == start && span_at_start) + subindex.clear(); + else + it_y = index.erase(it_y); + + if (span_at_start) { + Index::iterator it_start; + if (y == start) + it_start = it_y; + else { + it_start = index.find(-start); + if (it_start == index.end()) + it_start = index.insert(-start, SubIndex()); + } + SubIndex &start_subindex = it_start.value(); + for (SubIndex::iterator it = spansToBeMoved.begin(); it != spansToBeMoved.end(); ++it) + start_subindex.insert(it.key(), it.value()); + } + } else { + if (y == end + 1) { + Index::iterator it_top = index.find(-y + delta); + if (it_top == index.end()) + it_top = index.insert(-y + delta, SubIndex()); + for (SubIndex::iterator it = subindex.begin(); it != subindex.end(); ) { + Span *span = it.value(); + if (!span->will_be_deleted) + it_top.value().insert(it.key(), span); + ++it; + } + } else { + index.insert(-y + delta, subindex); + } + it_y = index.erase(it_y); + } + } while (it_y != index.begin()); + +#ifdef DEBUG_SPAN_UPDATE + qDebug() << index; + qDebug("Deleted"); + foreach (QSpanCollection::Span *span, spansToBeDeleted) + qDebug() << span << *span; +#endif + qDeleteAll(spansToBeDeleted); +} + +/** \internal +* Updates the span collection after column removal. +*/ +void QSpanCollection::updateRemovedColumns(int start, int end) +{ +#ifdef DEBUG_SPAN_UPDATE + qDebug() << Q_FUNC_INFO; + qDebug() << start << end; + qDebug() << index; +#endif + if (spans.isEmpty()) + return; + + SpanList toBeDeleted; + int delta = end - start + 1; +#ifdef DEBUG_SPAN_UPDATE + qDebug("Before"); +#endif + for (SpanList::iterator it = spans.begin(); it != spans.end(); ) { + Span *span = *it; +#ifdef DEBUG_SPAN_UPDATE + qDebug() << span << *span; +#endif + if (span->m_right < start) { + ++it; + continue; + } + if (span->m_left < start) { + if (span->m_right <= end) + span->m_right = start - 1; + else + span->m_right -= delta; + } else { + if (span->m_right > end) { + if (span->m_left <= end) + span->m_left = start; + else + span->m_left -= delta; + span->m_right -= delta; + } else { + span->will_be_deleted = true; + } + } + if (span->m_top == span->m_bottom && span->m_left == span->m_right) + span->will_be_deleted = true; + if (span->will_be_deleted) { + toBeDeleted.append(span); + it = spans.erase(it); + } else { + ++it; + } + } + +#ifdef DEBUG_SPAN_UPDATE + qDebug("After"); + foreach (QSpanCollection::Span *span, spans) + qDebug() << span << *span; +#endif + if (spans.isEmpty()) { + qDeleteAll(toBeDeleted); + index.clear(); + return; + } + + for (Index::iterator it_y = index.begin(); it_y != index.end(); ) { + int y = -it_y.key(); + if (cleanSpanSubIndex(it_y.value(), y, true)) + it_y = index.erase(it_y); + else + ++it_y; + } + +#ifdef DEBUG_SPAN_UPDATE + qDebug() << index; + qDebug("Deleted"); + foreach (QSpanCollection::Span *span, toBeDeleted) + qDebug() << span << *span; +#endif + qDeleteAll(toBeDeleted); +} + class QTableCornerButton : public QAbstractButton { Q_OBJECT @@ -299,6 +652,9 @@ void QTableViewPrivate::setSpan(int row, int column, int rowSpan, int columnSpan sp->m_right = column + columnSpan - 1; spans.updateSpan(sp, old_height); return; + } else if (rowSpan == 1 && columnSpan == 1) { + qWarning() << "QTableView::setSpan: single cell span won't be added"; + return; } sp = new QSpanCollection::Span(row, column, rowSpan, columnSpan); spans.addSpan(sp); @@ -460,6 +816,46 @@ void QTableViewPrivate::drawAndClipSpans(const QRegion &area, QPainter *painter, /*! \internal + Updates spans after row insertion. +*/ +void QTableViewPrivate::_q_updateSpanInsertedRows(const QModelIndex &parent, int start, int end) +{ + Q_UNUSED(parent) + spans.updateInsertedRows(start, end); +} + +/*! + \internal + Updates spans after column insertion. +*/ +void QTableViewPrivate::_q_updateSpanInsertedColumns(const QModelIndex &parent, int start, int end) +{ + Q_UNUSED(parent) + spans.updateInsertedColumns(start, end); +} + +/*! + \internal + Updates spans after row removal. +*/ +void QTableViewPrivate::_q_updateSpanRemovedRows(const QModelIndex &parent, int start, int end) +{ + Q_UNUSED(parent) + spans.updateRemovedRows(start, end); +} + +/*! + \internal + Updates spans after column removal. +*/ +void QTableViewPrivate::_q_updateSpanRemovedColumns(const QModelIndex &parent, int start, int end) +{ + Q_UNUSED(parent) + spans.updateRemovedColumns(start, end); +} + +/*! + \internal Draws a table cell. */ void QTableViewPrivate::drawCell(QPainter *painter, const QStyleOptionViewItemV4 &option, const QModelIndex &index) @@ -629,6 +1025,14 @@ QTableView::~QTableView() void QTableView::setModel(QAbstractItemModel *model) { Q_D(QTableView); + connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(_q_updateSpanInsertedRows(QModelIndex,int,int))); + connect(model, SIGNAL(columnsInserted(QModelIndex,int,int)), + this, SLOT(_q_updateSpanInsertedColumns(QModelIndex,int,int))); + connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(_q_updateSpanRemovedRows(QModelIndex,int,int))); + connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)), + this, SLOT(_q_updateSpanRemovedColumns(QModelIndex,int,int))); d->verticalHeader->setModel(model); d->horizontalHeader->setModel(model); QAbstractItemView::setModel(model); diff --git a/src/gui/itemviews/qtableview.h b/src/gui/itemviews/qtableview.h index a08d6a9..541c419 100644 --- a/src/gui/itemviews/qtableview.h +++ b/src/gui/itemviews/qtableview.h @@ -182,6 +182,10 @@ private: Q_DISABLE_COPY(QTableView) Q_PRIVATE_SLOT(d_func(), void _q_selectRow(int)) Q_PRIVATE_SLOT(d_func(), void _q_selectColumn(int)) + Q_PRIVATE_SLOT(d_func(), void _q_updateSpanInsertedRows(QModelIndex,int,int)) + Q_PRIVATE_SLOT(d_func(), void _q_updateSpanInsertedColumns(QModelIndex,int,int)) + Q_PRIVATE_SLOT(d_func(), void _q_updateSpanRemovedRows(QModelIndex,int,int)) + Q_PRIVATE_SLOT(d_func(), void _q_updateSpanRemovedColumns(QModelIndex,int,int)) }; #endif // QT_NO_TABLEVIEW diff --git a/src/gui/itemviews/qtableview_p.h b/src/gui/itemviews/qtableview_p.h index 36a3ece..c785bd7 100644 --- a/src/gui/itemviews/qtableview_p.h +++ b/src/gui/itemviews/qtableview_p.h @@ -54,6 +54,7 @@ // #include +#include #include #include #include @@ -82,10 +83,11 @@ public: int m_left; int m_bottom; int m_right; + bool will_be_deleted; Span() - : m_top(-1), m_left(-1), m_bottom(-1), m_right(-1) { } + : m_top(-1), m_left(-1), m_bottom(-1), m_right(-1), will_be_deleted(false) { } Span(int row, int column, int rowCount, int columnCount) - : m_top(row), m_left(column), m_bottom(row+rowCount-1), m_right(column+columnCount-1) { } + : m_top(row), m_left(column), m_bottom(row+rowCount-1), m_right(column+columnCount-1), will_be_deleted(false) { } inline int top() const { return m_top; } inline int left() const { return m_left; } inline int bottom() const { return m_bottom; } @@ -105,12 +107,20 @@ public: void clear(); QList spansInRect(int x, int y, int w, int h) const; - QList spans; //lists of all spans + void updateInsertedRows(int start, int end); + void updateInsertedColumns(int start, int end); + void updateRemovedRows(int start, int end); + void updateRemovedColumns(int start, int end); + + typedef QLinkedList SpanList; + SpanList spans; //lists of all spans private: //the indexes are negative so the QMap::lowerBound do what i need. typedef QMap SubIndex; typedef QMap Index; Index index; + + bool cleanSpanSubIndex(SubIndex &subindex, int end, bool update = false); }; Q_DECLARE_TYPEINFO ( QSpanCollection::Span, Q_MOVABLE_TYPE); @@ -227,6 +237,11 @@ public: void selectRow(int row, bool anchor); void selectColumn(int column, bool anchor); + + void _q_updateSpanInsertedRows(const QModelIndex &parent, int start, int end); + void _q_updateSpanInsertedColumns(const QModelIndex &parent, int start, int end); + void _q_updateSpanRemovedRows(const QModelIndex &parent, int start, int end); + void _q_updateSpanRemovedColumns(const QModelIndex &parent, int start, int end); }; QT_END_NAMESPACE diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index deb0b71..4bf7c2e 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -164,6 +164,10 @@ private slots: void span(); void spans(); void spans_data(); + void spansAfterRowInsertion(); + void spansAfterColumnInsertion(); + void spansAfterRowRemoval(); + void spansAfterColumnRemoval(); void checkHeaderReset(); void checkHeaderMinSize(); @@ -268,6 +272,28 @@ public: return QVariant(); } + bool insertRows(int start, int count, const QModelIndex &parent = QModelIndex()) + { + if (start < 0 || start > row_count) + return false; + + beginInsertRows(parent, start, start + count - 1); + row_count += count; + endInsertRows(); + return true; + } + + bool removeRows(int start, int count, const QModelIndex &parent = QModelIndex()) + { + if (start < 0 || start >= row_count || row_count < count) + return false; + + beginRemoveRows(parent, start, start + count - 1); + row_count -= count; + endRemoveRows(); + return true; + } + void removeLastRow() { beginRemoveRows(QModelIndex(), row_count - 1, row_count - 1); @@ -282,6 +308,28 @@ public: endRemoveRows(); } + bool insertColumns(int start, int count, const QModelIndex &parent = QModelIndex()) + { + if (start < 0 || start > column_count) + return false; + + beginInsertColumns(parent, start, start + count - 1); + column_count += count; + endInsertColumns(); + return true; + } + + bool removeColumns(int start, int count, const QModelIndex &parent = QModelIndex()) + { + if (start < 0 || start >= column_count || column_count < count) + return false; + + beginRemoveColumns(parent, start, start + count - 1); + column_count -= count; + endRemoveColumns(); + return true; + } + void removeLastColumn() { beginRemoveColumns(QModelIndex(), column_count - 1, column_count - 1); @@ -2608,7 +2656,7 @@ void tst_QTableView::span_data() << -1 << -1 << 6 << 6 << 3 << 3 - << 3 << 3 + << 2 << 3 << true; } @@ -2797,6 +2845,149 @@ void tst_QTableView::spans() QCOMPARE(view.rowSpan(pos.x(), pos.y()), expectedRowSpan); } +void tst_QTableView::spansAfterRowInsertion() +{ + QtTestTableModel model(10, 10); + QtTestTableView view; + view.setModel(&model); + view.setSpan(3, 3, 3, 3); + view.show(); + QTest::qWait(50); + + // Insertion before the span only shifts the span. + view.model()->insertRows(0, 2); + QCOMPARE(view.rowSpan(3, 3), 1); + QCOMPARE(view.columnSpan(3, 3), 1); + QCOMPARE(view.rowSpan(5, 3), 3); + QCOMPARE(view.columnSpan(5, 3), 3); + + // Insertion happens before the given row, so it only shifts the span also. + view.model()->insertRows(5, 2); + QCOMPARE(view.rowSpan(5, 3), 1); + QCOMPARE(view.columnSpan(5, 3), 1); + QCOMPARE(view.rowSpan(7, 3), 3); + QCOMPARE(view.columnSpan(7, 3), 3); + + // Insertion inside the span expands it. + view.model()->insertRows(8, 2); + QCOMPARE(view.rowSpan(7, 3), 5); + QCOMPARE(view.columnSpan(7, 3), 3); + + // Insertion after the span does nothing to it. + view.model()->insertRows(12, 2); + QCOMPARE(view.rowSpan(7, 3), 5); + QCOMPARE(view.columnSpan(7, 3), 3); +} + +void tst_QTableView::spansAfterColumnInsertion() +{ + QtTestTableModel model(10, 10); + QtTestTableView view; + view.setModel(&model); + view.setSpan(3, 3, 3, 3); + view.show(); + QTest::qWait(50); + + // Insertion before the span only shifts the span. + view.model()->insertColumns(0, 2); + QCOMPARE(view.rowSpan(3, 3), 1); + QCOMPARE(view.columnSpan(3, 3), 1); + QCOMPARE(view.rowSpan(3, 5), 3); + QCOMPARE(view.columnSpan(3, 5), 3); + + // Insertion happens before the given column, so it only shifts the span also. + view.model()->insertColumns(5, 2); + QCOMPARE(view.rowSpan(3, 5), 1); + QCOMPARE(view.columnSpan(3, 5), 1); + QCOMPARE(view.rowSpan(3, 7), 3); + QCOMPARE(view.columnSpan(3, 7), 3); + + // Insertion inside the span expands it. + view.model()->insertColumns(8, 2); + QCOMPARE(view.rowSpan(3, 7), 3); + QCOMPARE(view.columnSpan(3, 7), 5); + + // Insertion after the span does nothing to it. + view.model()->insertColumns(12, 2); + QCOMPARE(view.rowSpan(3, 7), 3); + QCOMPARE(view.columnSpan(3, 7), 5); +} + +void tst_QTableView::spansAfterRowRemoval() +{ + QtTestTableModel model(10, 10); + QtTestTableView view; + view.setModel(&model); + + QList spans; + spans << QRect(0, 1, 1, 2) + << QRect(1, 2, 1, 2) + << QRect(2, 2, 1, 5) + << QRect(2, 8, 1, 2) + << QRect(3, 4, 1, 2) + << QRect(4, 4, 1, 4) + << QRect(5, 6, 1, 3) + << QRect(6, 7, 1, 3); + foreach (QRect span, spans) + view.setSpan(span.top(), span.left(), span.height(), span.width()); + + view.show(); + QTest::qWait(100); + view.model()->removeRows(3, 3); + + QList expectedSpans; + expectedSpans << QRect(0, 1, 1, 2) + << QRect(1, 2, 1, 1) + << QRect(2, 2, 1, 2) + << QRect(2, 5, 1, 2) + << QRect(3, 4, 1, 1) + << QRect(4, 3, 1, 2) + << QRect(5, 3, 1, 3) + << QRect(6, 4, 1, 3); + foreach (QRect span, expectedSpans) { + QCOMPARE(view.columnSpan(span.top(), span.left()), span.width()); + QCOMPARE(view.rowSpan(span.top(), span.left()), span.height()); + } +} + +void tst_QTableView::spansAfterColumnRemoval() +{ + QtTestTableModel model(10, 10); + QtTestTableView view; + view.setModel(&model); + + // Same set as above just swapping columns and rows. + QList spans; + spans << QRect(0, 1, 1, 2) + << QRect(1, 2, 1, 2) + << QRect(2, 2, 1, 5) + << QRect(2, 8, 1, 2) + << QRect(3, 4, 1, 2) + << QRect(4, 4, 1, 4) + << QRect(5, 6, 1, 3) + << QRect(6, 7, 1, 3); + foreach (QRect span, spans) + view.setSpan(span.left(), span.top(), span.width(), span.height()); + + view.show(); + QTest::qWait(100); + view.model()->removeColumns(3, 3); + + QList expectedSpans; + expectedSpans << QRect(0, 1, 1, 2) + << QRect(1, 2, 1, 1) + << QRect(2, 2, 1, 2) + << QRect(2, 5, 1, 2) + << QRect(3, 4, 1, 1) + << QRect(4, 3, 1, 2) + << QRect(5, 3, 1, 3) + << QRect(6, 4, 1, 3); + foreach (QRect span, expectedSpans) { + QCOMPARE(view.columnSpan(span.left(), span.top()), span.height()); + QCOMPARE(view.rowSpan(span.left(), span.top()), span.width()); + } +} + class Model : public QAbstractTableModel { Q_OBJECT diff --git a/tests/benchmarks/qtableview/tst_qtableview.cpp b/tests/benchmarks/qtableview/tst_qtableview.cpp index deeba3f..7247a23 100644 --- a/tests/benchmarks/qtableview/tst_qtableview.cpp +++ b/tests/benchmarks/qtableview/tst_qtableview.cpp @@ -75,6 +75,50 @@ public: return QVariant(); } + bool insertRows(int start, int count, const QModelIndex &parent = QModelIndex()) + { + if (start < 0 || start > row_count) + return false; + + beginInsertRows(parent, start, start + count - 1); + row_count += count; + endInsertRows(); + return true; + } + + bool removeRows(int start, int count, const QModelIndex &parent = QModelIndex()) + { + if (start < 0 || start >= row_count || row_count < count) + return false; + + beginRemoveRows(parent, start, start + count - 1); + row_count -= count; + endRemoveRows(); + return true; + } + + bool insertColumns(int start, int count, const QModelIndex &parent = QModelIndex()) + { + if (start < 0 || start > column_count) + return false; + + beginInsertColumns(parent, start, start + count - 1); + column_count += count; + endInsertColumns(); + return true; + } + + bool removeColumns(int start, int count, const QModelIndex &parent = QModelIndex()) + { + if (start < 0 || start >= column_count || column_count < count) + return false; + + beginRemoveColumns(parent, start, start + count - 1); + column_count -= count; + endRemoveColumns(); + return true; + } + int row_count; int column_count; }; @@ -99,6 +143,14 @@ private slots: void spanDraw(); void spanSelectColumn(); void spanSelectAll(); + void rowInsertion_data(); + void rowInsertion(); + void rowRemoval_data(); + void rowRemoval(); + void columnInsertion_data(); + void columnInsertion(); + void columnRemoval_data(); + void columnRemoval(); private: static inline void spanInit_helper(QTableView *); }; @@ -189,5 +241,127 @@ void tst_QTableView::spanSelectColumn() } } +typedef QVector SpanList; +Q_DECLARE_METATYPE(SpanList) + +void spansData() +{ + QTest::addColumn("spans"); + + QTest::newRow("Without spans") + << SpanList(); + + QTest::newRow("With spans") + << (SpanList() + << QRect(0, 1, 1, 2) + << QRect(1, 2, 1, 2) + << QRect(2, 2, 1, 5) + << QRect(2, 8, 1, 2) + << QRect(3, 4, 1, 2) + << QRect(4, 4, 1, 4) + << QRect(5, 6, 1, 3) + << QRect(6, 7, 1, 3)); +} + +void tst_QTableView::rowInsertion_data() +{ + spansData(); +} + +void tst_QTableView::rowInsertion() +{ + QFETCH(SpanList, spans); + + QtTestTableModel model(10, 10); + QTableView view; + view.setModel(&model); + + foreach (QRect span, spans) + view.setSpan(span.top(), span.left(), span.height(), span.width()); + view.show(); + QTest::qWait(50); + + QBENCHMARK_ONCE { + view.model()->insertRows(0, 2); + view.model()->insertRows(5, 2); + view.model()->insertRows(8, 2); + view.model()->insertRows(12, 2); + } +} + +void tst_QTableView::rowRemoval_data() +{ + spansData(); +} + +void tst_QTableView::rowRemoval() +{ + QFETCH(SpanList, spans); + + QtTestTableModel model(10, 10); + QTableView view; + view.setModel(&model); + + foreach (QRect span, spans) + view.setSpan(span.top(), span.left(), span.height(), span.width()); + view.show(); + QTest::qWait(50); + + QBENCHMARK_ONCE { + view.model()->removeRows(3, 3); + } +} + +void tst_QTableView::columnInsertion_data() +{ + spansData(); +} + +void tst_QTableView::columnInsertion() +{ + QFETCH(SpanList, spans); + + QtTestTableModel model(10, 10); + QTableView view; + view.setModel(&model); + + // Same set as for rowInsertion, just swapping columns and rows. + foreach (QRect span, spans) + view.setSpan(span.left(), span.top(), span.width(), span.height()); + view.show(); + QTest::qWait(50); + + QBENCHMARK_ONCE { + view.model()->insertColumns(0, 2); + view.model()->insertColumns(5, 2); + view.model()->insertColumns(8, 2); + view.model()->insertColumns(12, 2); + } +} + +void tst_QTableView::columnRemoval_data() +{ + spansData(); +} + +void tst_QTableView::columnRemoval() +{ + QFETCH(SpanList, spans); + + QtTestTableModel model(10, 10); + QTableView view; + view.setModel(&model); + + // Same set as for rowRemoval, just swapping columns and rows. + foreach (QRect span, spans) + view.setSpan(span.left(), span.top(), span.width(), span.height()); + view.show(); + QTest::qWait(50); + + QBENCHMARK_ONCE { + view.model()->removeColumns(3, 3); + } +} + QTEST_MAIN(tst_QTableView) #include "tst_qtableview.moc" -- cgit v0.12 From 622d615043c3ef4ab0bd547c0e65617580755532 Mon Sep 17 00:00:00 2001 From: ninerider Date: Tue, 6 Oct 2009 14:23:46 +0200 Subject: Numerical issues on Windows CE caused some image comparisons to fail. On Windows CE and possibly Symbian some filtering and blending functions of the SVG renderer will alter different pixels in two otherwise apparently identical images. Until this is not addressed in the renderers an exact image comparison is not alsways successful. Reviewed-by: banana joe (cherry picked from commit ba4c0b0048bab894047bc363ef7f7a3e12ef4d02) --- tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp index e1b5a41..c95d86c 100644 --- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp +++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp @@ -1294,10 +1294,17 @@ void tst_QSvgRenderer::testUseElement() p.begin(&images[i]); renderer.render(&p); p.end(); + if (i < 4 && i != 0) { QCOMPARE(images[0], images[i]); } else if (i > 4 && i < 7) { - QCOMPARE(images[4], images[i]); + if (sizeof(qreal) != sizeof(float)) + { + // These images use blending functions which due to numerical + // issues on Windows CE and likes differ in very few pixels. + // For this reason an exact comparison will fail. + QCOMPARE(images[4], images[i]); + } } else if (i > 7) { QCOMPARE(images[8], images[i]); } -- cgit v0.12 From cafa66b24879a648ef520e41e0e8ed6a11dcabc1 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 6 Oct 2009 14:26:58 +0200 Subject: Fix crash in QPlainTextEdit when using large fonts When using very large fonts, sometimes the scrollbar of the QPlainTextEdit will allow you to do scroll down past the end of the document, in which case the currentBlock in hitTest() is inValid() which caused an assert in currentBlock.next(). Task-number: QT-938 Reviewed-by: mae (cherry picked from commit d824af2348d11a7f364a1046a704268830f35f13) --- src/gui/widgets/qplaintextedit.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 5d13c36..2ed6cd7 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -519,6 +519,9 @@ QTextBlock QPlainTextEditControl::firstVisibleBlock() const int QPlainTextEditControl::hitTest(const QPointF &point, Qt::HitTestAccuracy ) const { int currentBlockNumber = topBlock; QTextBlock currentBlock = document()->findBlockByNumber(currentBlockNumber); + if (!currentBlock.isValid()) + return -1; + QPlainTextDocumentLayout *documentLayout = qobject_cast(document()->documentLayout()); Q_ASSERT(documentLayout); -- cgit v0.12 From e55607d3722c744641f8894ed1fa06b647538ba8 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 5 Oct 2009 17:08:29 +0200 Subject: tst_qnetworkreply: Add ioPostToHttpsUploadProgress Add a currently failing testcase. Related to task 261806 and others. Reviewed-by: Peter Hartmann (cherry picked from commit 6bbe0f3105fb8ec70aeb0952bec671b72b9f5400) --- tests/auto/qnetworkreply/certs/server.key | 15 ++++ tests/auto/qnetworkreply/certs/server.pem | 24 ++++++ tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 104 +++++++++++++++++++++++++ 3 files changed, 143 insertions(+) create mode 100644 tests/auto/qnetworkreply/certs/server.key create mode 100644 tests/auto/qnetworkreply/certs/server.pem diff --git a/tests/auto/qnetworkreply/certs/server.key b/tests/auto/qnetworkreply/certs/server.key new file mode 100644 index 0000000..9d1664d --- /dev/null +++ b/tests/auto/qnetworkreply/certs/server.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQCnyKBKxBkFG2a6MuLS8RxvF4LkOS4BUZDbBDQyESHCDW9Z2FOQ +VD+Dj6nTs9XuGpuArsMlyV6lr0tgBaqg0ZEBH8oEg+NYHJkyRYRwclgDmEpji0H1 +CEnSkQJga+Rk/t2gqnQI6TRMkV8SPTdNVCytf1uYYDYCjDv2RfMnapuUnQIDAQAB +AoGANFzLkanTeSGNFM0uttBipFT9F4a00dqHz6JnO7zXAT26I5r8sU1pqQBb6uLz +/+Qz5Zwk8RUAQcsMRgJetuPQUb0JZjF6Duv24hNazqXBCu7AZzUenjafwmKC/8ri +KpX3fTwqzfzi//FKGgbXQ80yykSSliDL3kn/drATxsLCgQECQQDXhEFWLJ0vVZ1s +1Ekf+3NITE+DR16X+LQ4W6vyEHAjTbaNWtcTKdAWLA2l6N4WAAPYSi6awm+zMxx4 +VomVTsjdAkEAx0z+e7natLeFcrrq8pbU+wa6SAP1VfhQWKitxL1e7u/QO90NCpxE +oQYKzMkmmpOOFjQwEMAy1dvFMbm4LHlewQJAC/ksDBaUcQHHqjktCtrUb8rVjAyW +A8lscckeB2fEYyG5J6dJVaY4ClNOOs5yMDS2Afk1F6H/xKvtQ/5CzInA/QJATDub +K+BPU8jO9q+gpuIi3VIZdupssVGmCgObVCHLakG4uO04y9IyPhV9lA9tALtoIf4c +VIvv5fWGXBrZ48kZAQJBAJmVCdzQxd9LZI5vxijUCj5EI4e+x5DRqVUvyP8KCZrC +AiNyoDP85T+hBZaSXK3aYGpVwelyj3bvo1GrTNwNWLw= +-----END RSA PRIVATE KEY----- diff --git a/tests/auto/qnetworkreply/certs/server.pem b/tests/auto/qnetworkreply/certs/server.pem new file mode 100644 index 0000000..67eb495 --- /dev/null +++ b/tests/auto/qnetworkreply/certs/server.pem @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIIEEzCCAvugAwIBAgIBADANBgkqhkiG9w0BAQUFADCBnDELMAkGA1UEBhMCTk8x +DTALBgNVBAgTBE9zbG8xEDAOBgNVBAcTB055ZGFsZW4xFjAUBgNVBAoTDVRyb2xs +dGVjaCBBU0ExFDASBgNVBAsTC0RldmVsb3BtZW50MRcwFQYDVQQDEw5mbHVrZS50 +cm9sbC5ubzElMCMGCSqGSIb3DQEJARYWYWhhbnNzZW5AdHJvbGx0ZWNoLmNvbTAe +Fw0wNzEyMDQwMTEwMzJaFw0zNTA0MjEwMTEwMzJaMGMxCzAJBgNVBAYTAk5PMQ0w +CwYDVQQIEwRPc2xvMRYwFAYDVQQKEw1Ucm9sbHRlY2ggQVNBMRQwEgYDVQQLEwtE +ZXZlbG9wbWVudDEXMBUGA1UEAxMOZmx1a2UudHJvbGwubm8wgZ8wDQYJKoZIhvcN +AQEBBQADgY0AMIGJAoGBAKfIoErEGQUbZroy4tLxHG8XguQ5LgFRkNsENDIRIcIN +b1nYU5BUP4OPqdOz1e4am4CuwyXJXqWvS2AFqqDRkQEfygSD41gcmTJFhHByWAOY +SmOLQfUISdKRAmBr5GT+3aCqdAjpNEyRXxI9N01ULK1/W5hgNgKMO/ZF8ydqm5Sd +AgMBAAGjggEaMIIBFjAJBgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh1PcGVuU1NM +IEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUIYUEPSMBZuX3nxqEJIqv +Cnn05awwgbsGA1UdIwSBszCBsKGBoqSBnzCBnDELMAkGA1UEBhMCTk8xDTALBgNV +BAgTBE9zbG8xEDAOBgNVBAcTB055ZGFsZW4xFjAUBgNVBAoTDVRyb2xsdGVjaCBB +U0ExFDASBgNVBAsTC0RldmVsb3BtZW50MRcwFQYDVQQDEw5mbHVrZS50cm9sbC5u +bzElMCMGCSqGSIb3DQEJARYWYWhhbnNzZW5AdHJvbGx0ZWNoLmNvbYIJAI6otOiR +t1QuMA0GCSqGSIb3DQEBBQUAA4IBAQBtV1/RBUPwYgXsKnGl3BkI8sSmvbsl2cqJ +AQ7kzx/BjMgkGDVTWXvAQ7Qy5piypu8VBQtIX+GgDJepoXfYNRgwvKmP07dUx/Gp +nl3mGb/2PFsr2OQ+YhiIi9Mk4UCbDOYpFmKr6gUkcDaqVZPvAoEbIxCiBOtWlXX8 ++JSxXULFPzZEhV06LpBGiqK5b4euDBVAGTGQ/Dslu67xZhMNhZDZSTSP8l35ettN +XSf2dp01jAamTKOxsrZvHdejAP1y657qRKGvITR9x0LiSZEZi8CtuoKAqHFw9DUx +kWOEIJXpYK9ki8z/PYp2dD3IVW3kjsMrHOhCGK6f5mucNAbsavLD +-----END CERTIFICATE----- diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 578ab29..7863b4e 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -258,6 +258,7 @@ private Q_SLOTS: void httpConnectionCount(); #ifndef QT_NO_OPENSSL + void ioPostToHttpsUploadProgress(); void ignoreSslErrorsList_data(); void ignoreSslErrorsList(); void ignoreSslErrorsListWithSlot_data(); @@ -3099,6 +3100,109 @@ void tst_QNetworkReply::ioPostToHttpNoBufferFlag() QCOMPARE(reply->error(), QNetworkReply::ContentReSendError); } +#ifndef QT_NO_OPENSSL +class SslServer : public QTcpServer { + Q_OBJECT +public: + SslServer() : socket(0) {}; + void incomingConnection(int socketDescriptor) { + QSslSocket *serverSocket = new QSslSocket; + serverSocket->setParent(this); + + if (serverSocket->setSocketDescriptor(socketDescriptor)) { + connect(serverSocket, SIGNAL(encrypted()), this, SLOT(encryptedSlot())); + serverSocket->setProtocol(QSsl::AnyProtocol); + connect(serverSocket, SIGNAL(sslErrors(const QList&)), serverSocket, SLOT(ignoreSslErrors())); + serverSocket->setLocalCertificate (SRCDIR "/certs/server.pem"); + serverSocket->setPrivateKey (SRCDIR "/certs/server.key"); + serverSocket->startServerEncryption(); + } else { + delete serverSocket; + } + } +signals: + void newEncryptedConnection(); +public slots: + void encryptedSlot() { + socket = (QSslSocket*) sender(); + emit newEncryptedConnection(); + } +public: + QSslSocket *socket; +}; + +// very similar to ioPostToHttpUploadProgress but for SSL +void tst_QNetworkReply::ioPostToHttpsUploadProgress() +{ + QFile sourceFile(SRCDIR "/bigfile"); + QVERIFY(sourceFile.open(QIODevice::ReadOnly)); + + // emulate a minimal https server + SslServer server; + server.listen(QHostAddress(QHostAddress::LocalHost), 0); + + // create the request + QUrl url = QUrl(QString("https://127.0.0.1:%1/").arg(server.serverPort())); + QNetworkRequest request(url); + QNetworkReplyPtr reply = manager.post(request, &sourceFile); + QSignalSpy spy(reply, SIGNAL(uploadProgress(qint64,qint64))); + connect(&server, SIGNAL(newEncryptedConnection()), &QTestEventLoop::instance(), SLOT(exitLoop())); + connect(reply, SIGNAL(sslErrors(const QList&)), reply, SLOT(ignoreSslErrors())); + + // get the request started and the incoming socket connected + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + QTcpSocket *incomingSocket = server.socket; + QVERIFY(incomingSocket); + disconnect(&server, SIGNAL(newEncryptedConnection()), &QTestEventLoop::instance(), SLOT(exitLoop())); + + + incomingSocket->setReadBufferSize(1*1024); + QTestEventLoop::instance().enterLoop(2); + // some progress should have been made + QList args = spy.last(); + qDebug() << "tst_QNetworkReply::ioPostToHttpsUploadProgress" + << args.at(0).toLongLong() + << sourceFile.size() + << spy.size(); + QVERIFY(!args.isEmpty()); + QVERIFY(args.at(0).toLongLong() > 0); + // FIXME this is where it messes up + + QEXPECT_FAIL("", "Either the readBufferSize of QSslSocket is broken or we do upload too much. Hm.", Abort); + QVERIFY(args.at(0).toLongLong() != sourceFile.size()); + + incomingSocket->setReadBufferSize(32*1024); + incomingSocket->read(16*1024); + QTestEventLoop::instance().enterLoop(2); + // some more progress than before + QList args2 = spy.last(); + QVERIFY(!args2.isEmpty()); + QVERIFY(args2.at(0).toLongLong() > args.at(0).toLongLong()); + + // set the read buffer to unlimited + incomingSocket->setReadBufferSize(0); + QTestEventLoop::instance().enterLoop(10); + // progress should be finished + QList args3 = spy.last(); + QVERIFY(!args3.isEmpty()); + QVERIFY(args3.at(0).toLongLong() > args2.at(0).toLongLong()); + QCOMPARE(args3.at(0).toLongLong(), args3.at(1).toLongLong()); + QCOMPARE(args3.at(0).toLongLong(), sourceFile.size()); + + // after sending this, the QNAM should emit finished() + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + incomingSocket->write("HTTP/1.0 200 OK\r\n"); + incomingSocket->write("Content-Length: 0\r\n"); + incomingSocket->write("\r\n"); + QTestEventLoop::instance().enterLoop(10); + // not timeouted -> finished() was emitted + QVERIFY(!QTestEventLoop::instance().timeout()); + + incomingSocket->close(); + server.close(); +} +#endif void tst_QNetworkReply::ioPostToHttpUploadProgress() { -- cgit v0.12 From 4dcc1c93c397ecbed6eebebd99e56e6b18ae8633 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 6 Oct 2009 11:08:42 +0200 Subject: tst_QGraphicsLinearLayout::layoutDirection fixed for Windows mobile This test depends on a layout spacing set to 6. The Windows mobile style has layout spacing 8. Reviewed-by: mauricek (cherry picked from commit ad52b10726aa72c253e220c06d3c7c76ef76366e) --- tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 4e46819..4f28df4 100644 --- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -1370,6 +1370,8 @@ void tst_QGraphicsLinearLayout::layoutDirection() QGraphicsWidget *window = new QGraphicsWidget(0, Qt::Window); QGraphicsLinearLayout *layout = new QGraphicsLinearLayout; layout->setContentsMargins(1, 2, 3, 4); + layout->setSpacing(6); + RectWidget *w1 = new RectWidget; w1->setPreferredSize(20, 20); w1->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); -- cgit v0.12 From 5430688f93425cdc14507fefbc98de40e5f75da7 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 6 Oct 2009 11:38:02 +0200 Subject: tst_QGraphicsView::task245469_itemsAtPointWithClip Windows mobile fix We must make sure that the graphics view scene is centered to make this test work. On Windows mobile, the widget was too wide and the scene wasn't centered. Reviewed-by: thartman (cherry picked from commit 1627b135a7ec37862d7e3764fd545e75ca38bfd7) --- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 921f7f8..df3ebef 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -2977,6 +2977,7 @@ void tst_QGraphicsView::task245469_itemsAtPointWithClip() parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape); QGraphicsView view(&scene); + view.resize(150,150); view.rotate(90); view.show(); QTest::qWaitForWindowShown(&view); -- cgit v0.12 From ddd5cf293a5636202b905efc880615e5c34bf1b3 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 6 Oct 2009 14:53:15 +0200 Subject: QAbstractSocket::setSocketOption: Make const reference After 4.6 API review. Reviewed-by: Volker Hilsheimer (cherry picked from commit f83ae188edb09a94b25b962c8a8b793180d22b67) --- src/network/socket/qabstractsocket.cpp | 2 +- src/network/socket/qabstractsocket.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 675e88a..86ccef2 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1576,7 +1576,7 @@ bool QAbstractSocket::setSocketDescriptor(int socketDescriptor, SocketState sock \sa socketOption() \since 4.6 */ -void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, QVariant value) +void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value) { if (!d_func()->socketEngine) return; diff --git a/src/network/socket/qabstractsocket.h b/src/network/socket/qabstractsocket.h index 4a7763f..5d94a01 100644 --- a/src/network/socket/qabstractsocket.h +++ b/src/network/socket/qabstractsocket.h @@ -154,8 +154,8 @@ public: OpenMode openMode = ReadWrite); // ### Qt 5: Make virtual? - void setSocketOption(QAbstractSocket::SocketOption o, QVariant v); - QVariant socketOption(QAbstractSocket::SocketOption o); + void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value); + QVariant socketOption(QAbstractSocket::SocketOption option); SocketType socketType() const; SocketState state() const; -- cgit v0.12 From 1f65d0b78eac03f0e6e4242a0d93c81ae5430485 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 6 Oct 2009 15:06:16 +0200 Subject: compile without QT3SUPPORT Reviewed-by: thartman (cherry picked from commit 971adae01406f71ed9f0bb9cb2be5eddc259e77e) --- src/gui/statemachine/qguistatemachine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/gui/statemachine/qguistatemachine.cpp index 5ff1164..1de5ffa 100644 --- a/src/gui/statemachine/qguistatemachine.cpp +++ b/src/gui/statemachine/qguistatemachine.cpp @@ -305,8 +305,10 @@ static QEvent *cloneEvent(QEvent *e) case QEvent::AcceptDropsChange: return new QEvent(*e); +#ifdef QT3_SUPPORT case QEvent::MenubarUpdated: return new QMenubarUpdatedEvent(*static_cast(e)); +#endif case QEvent::ZeroTimerEvent: Q_ASSERT_X(false, "cloneEvent()", "not implemented"); -- cgit v0.12 From c7721a0de7378860e6d763ba489750b7c31c095b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 2 Oct 2009 12:38:16 +0200 Subject: Fixed bug in GL 2 engine when using beginNativePainting. Need to set shader manager to dirty in case we change the shader program using native calls. Reviewed-by: Trond (cherry picked from commit 283670c8fbdda2898879066c7e14d3b0cb5ef442) --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 073f7db..7cd5aa4 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -762,6 +762,8 @@ void QGL2PaintEngineEx::beginNativePainting() d->dirtyStencilRegion = QRect(0, 0, d->width, d->height); d->resetGLState(); + d->shaderManager->setDirty(); + d->needsSync = true; } -- cgit v0.12 From 93796d0b20fdbef51a0ec0a6e4a8e7c44425262c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 2 Oct 2009 13:18:52 +0200 Subject: Fixed some projective transform rendering bugs on qreal=float platforms. We should set the near clip slightly higher when qreal is float to avoid numerical precision problems. Reviewed-by: Trond (cherry picked from commit addc0cbdbe21da27f7ad9f0ee05a16e24afa392d) --- src/gui/painting/qtransform.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index abe9e5e..8118450 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE -#define Q_NEAR_CLIP 0.000001 +#define Q_NEAR_CLIP (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001) #ifdef MAP # undef MAP -- cgit v0.12 From ac8530959c95889c3a1717cacfc935d2038fc741 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 6 Oct 2009 15:21:01 +0200 Subject: add missing include Necessary since the SignalEvent class was moved to qstatemachine.h. (cherry picked from commit cbc2508fc8cb0f16a061f778f777f8363640fcc8) --- src/corelib/statemachine/qstatemachine.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h index 321a05c..13b6fe2 100644 --- a/src/corelib/statemachine/qstatemachine.h +++ b/src/corelib/statemachine/qstatemachine.h @@ -48,6 +48,7 @@ #include #include #include +#include QT_BEGIN_HEADER -- cgit v0.12 From bfe30dec4a1ba6a924076ea4c035c0c57d62583f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 25 Sep 2009 17:12:42 +0200 Subject: Fixed missing stencil buffer clear when scissor testing is disabled. (cherry picked from commit e8a3b49d6d42b213fd4fd55837f6180935a8a603) --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 7cd5aa4..242d02d 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1645,7 +1645,9 @@ void QGL2PaintEngineExPrivate::updateDepthScissorTest() else glDisable(GL_DEPTH_TEST); -#ifndef QT_GL_NO_SCISSOR_TEST +#ifdef QT_GL_NO_SCISSOR_TEST + currentScissorBounds = QRect(0, 0, width, height); +#else QRect bounds = q->state()->rectangleClip; if (!q->state()->clipEnabled) { if (use_system_clip) -- cgit v0.12 From a351cc0334709a4b16bf9ddfe00524ea9ec2524a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 25 Sep 2009 17:02:53 +0200 Subject: Moved maxDepth out of state object and got rid of unused state members. (cherry picked from commit 6372c2865ab6924127b78f968bdd41f8d3f9c637) --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 19 ++++++++----------- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 4 +--- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 242d02d..197c7a9 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1796,21 +1796,21 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) case Qt::IntersectClip: state()->rectangleClip = state()->rectangleClip.intersected(pathRect); d->updateDepthScissorTest(); - ++state()->maxDepth; - d->writeClip(path, state()->maxDepth); - state()->currentDepth = state()->maxDepth - 1; + ++d->maxDepth; + d->writeClip(path, d->maxDepth); + state()->currentDepth = d->maxDepth - 1; state()->depthTestEnabled = true; break; case Qt::UniteClip: { #ifndef QT_GL_NO_SCISSOR_TEST if (state()->rectangleClip.isValid()) { - ++state()->maxDepth; + d->maxDepth; QPainterPath path; path.addRect(state()->rectangleClip); // flush the existing clip rectangle to the depth buffer - d->writeClip(qtVectorPathForPath(state()->matrix.inverted().map(path)), state()->maxDepth); + d->writeClip(qtVectorPathForPath(state()->matrix.inverted().map(path)), d->maxDepth); } QRect oldRectangleClip = state()->rectangleClip; @@ -1831,9 +1831,9 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) #endif glDepthFunc(GL_ALWAYS); // now write the clip path - d->writeClip(path, state()->maxDepth); + d->writeClip(path, d->maxDepth); state()->canRestoreClip = false; - state()->currentDepth = state()->maxDepth - 1; + state()->currentDepth = d->maxDepth - 1; state()->depthTestEnabled = true; break; } @@ -1874,7 +1874,7 @@ void QGL2PaintEngineExPrivate::systemStateChanged() q->state()->needsDepthBufferClear = true; q->state()->currentDepth = 1; - q->state()->maxDepth = 4; + maxDepth = 4; q->state()->rectangleClip = use_system_clip ? systemClip.boundingRect() : QRect(0, 0, width, height); updateDepthScissorTest(); @@ -1945,7 +1945,6 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state) d->updateDepthScissorTest(); glDepthMask(false); glDepthFunc(GL_LESS); - s->maxDepth = old_state->maxDepth; } else { d->regenerateDepthClip(); } @@ -1981,7 +1980,6 @@ QOpenGL2PaintEngineState::QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &oth depthTestEnabled = other.depthTestEnabled; scissorTestEnabled = other.scissorTestEnabled; currentDepth = other.currentDepth; - maxDepth = other.maxDepth; canRestoreClip = other.canRestoreClip; rectangleClip = other.rectangleClip; } @@ -1991,7 +1989,6 @@ QOpenGL2PaintEngineState::QOpenGL2PaintEngineState() needsDepthBufferClear = true; depthTestEnabled = false; currentDepth = 1; - maxDepth = 4; canRestoreClip = true; } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 12123f3..189d5be 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -83,16 +83,13 @@ public: ~QOpenGL2PaintEngineState(); bool needsDepthBufferClear; - qreal depthBufferClearValue; bool depthTestEnabled; bool scissorTestEnabled; - uint maxDepth; uint currentDepth; bool canRestoreClip; QRect rectangleClip; - bool hasRectangleClip; }; class Q_OPENGL_EXPORT QGL2PaintEngineEx : public QPaintEngineEx @@ -226,6 +223,7 @@ public: QRegion dirtyStencilRegion; QRect currentScissorBounds; + uint maxDepth; const QBrush* currentBrush; // May not be the state's brush! -- cgit v0.12 From bf65e5cbdcc28fd19f8432feb1a92c96b56a9027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 25 Sep 2009 17:22:48 +0200 Subject: Refactored GL 2 engine UniteClip to always increase max depth. (cherry picked from commit af8ff76bf25b6b4d01d89bea42baab65ed7e09ea) --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 197c7a9..17b4808 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1802,10 +1802,8 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) state()->depthTestEnabled = true; break; case Qt::UniteClip: { -#ifndef QT_GL_NO_SCISSOR_TEST + ++d->maxDepth; if (state()->rectangleClip.isValid()) { - d->maxDepth; - QPainterPath path; path.addRect(state()->rectangleClip); @@ -1813,6 +1811,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) d->writeClip(qtVectorPathForPath(state()->matrix.inverted().map(path)), d->maxDepth); } +#ifndef QT_GL_NO_SCISSOR_TEST QRect oldRectangleClip = state()->rectangleClip; state()->rectangleClip = state()->rectangleClip.united(pathRect); -- cgit v0.12 From 792e60ceafcd030c5d248d0edff83e1041c6476b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 25 Sep 2009 17:20:50 +0200 Subject: Made GL 2 paint engine waste less bits in clipping algorithm. (cherry picked from commit aaf695a3fad8d84f3d9483a573732350445d453a) --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 17b4808..c0959ae 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1710,7 +1710,7 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint depth) updateMatrix(); if (q->state()->needsDepthBufferClear) { glDepthMask(true); - glClearDepth(rawDepth(2)); + glClearDepth(rawDepth(1)); glClear(GL_DEPTH_BUFFER_BIT); q->state()->needsDepthBufferClear = false; glDepthMask(false); @@ -1872,8 +1872,8 @@ void QGL2PaintEngineExPrivate::systemStateChanged() q->state()->depthTestEnabled = false; q->state()->needsDepthBufferClear = true; - q->state()->currentDepth = 1; - maxDepth = 4; + q->state()->currentDepth = 0; + maxDepth = 1; q->state()->rectangleClip = use_system_clip ? systemClip.boundingRect() : QRect(0, 0, width, height); updateDepthScissorTest(); @@ -1901,7 +1901,7 @@ void QGL2PaintEngineExPrivate::systemStateChanged() path.addRegion(systemClip); glDepthFunc(GL_ALWAYS); - writeClip(qtVectorPathForPath(q->state()->matrix.inverted().map(path)), 2); + writeClip(qtVectorPathForPath(q->state()->matrix.inverted().map(path)), 1); glDepthFunc(GL_LESS); glEnable(GL_DEPTH_TEST); @@ -1987,7 +1987,6 @@ QOpenGL2PaintEngineState::QOpenGL2PaintEngineState() { needsDepthBufferClear = true; depthTestEnabled = false; - currentDepth = 1; canRestoreClip = true; } -- cgit v0.12 From e84187d0b5dea4997d683d004bd37863f7a5f2ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 25 Sep 2009 17:30:56 +0200 Subject: Switched to using GL_LEQUAL instead of GL_LESS in GL 2 engine. (cherry picked from commit 2f268b40b290c4513d2d06b75ad681b5550eeaa8) --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index c0959ae..602754c 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -774,6 +774,7 @@ void QGL2PaintEngineExPrivate::resetGLState() glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); glDepthMask(true); + glDepthFunc(GL_LESS); glClearDepth(1); } @@ -1565,7 +1566,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) if (!d->inRenderText) { glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); - glDepthFunc(GL_LESS); + glDepthFunc(GL_LEQUAL); glDepthMask(false); } @@ -1631,7 +1632,7 @@ void QGL2PaintEngineEx::ensureActive() d->transferMode(BrushDrawingMode); glViewport(0, 0, d->width, d->height); glDepthMask(false); - glDepthFunc(GL_LESS); + glDepthFunc(GL_LEQUAL); d->needsSync = false; setState(state()); } @@ -1693,7 +1694,7 @@ void QGL2PaintEngineEx::clipEnabledChanged() d->regenerateDepthClip(); } else { if (d->use_system_clip) { - state()->currentDepth = 0; + state()->currentDepth = 1; } else { state()->depthTestEnabled = false; } @@ -1785,7 +1786,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) case Qt::NoClip: if (d->use_system_clip) { state()->depthTestEnabled = true; - state()->currentDepth = 0; + state()->currentDepth = 1; } else { state()->depthTestEnabled = false; } @@ -1798,7 +1799,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) d->updateDepthScissorTest(); ++d->maxDepth; d->writeClip(path, d->maxDepth); - state()->currentDepth = d->maxDepth - 1; + state()->currentDepth = d->maxDepth; state()->depthTestEnabled = true; break; case Qt::UniteClip: { @@ -1832,7 +1833,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) // now write the clip path d->writeClip(path, d->maxDepth); state()->canRestoreClip = false; - state()->currentDepth = d->maxDepth - 1; + state()->currentDepth = d->maxDepth; state()->depthTestEnabled = true; break; } @@ -1840,7 +1841,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) break; } - glDepthFunc(GL_LESS); + glDepthFunc(GL_LEQUAL); if (state()->depthTestEnabled) { glEnable(GL_DEPTH_TEST); d->simpleShaderDepthUniformDirty = true; @@ -1872,7 +1873,7 @@ void QGL2PaintEngineExPrivate::systemStateChanged() q->state()->depthTestEnabled = false; q->state()->needsDepthBufferClear = true; - q->state()->currentDepth = 0; + q->state()->currentDepth = 1; maxDepth = 1; q->state()->rectangleClip = use_system_clip ? systemClip.boundingRect() : QRect(0, 0, width, height); @@ -1902,7 +1903,7 @@ void QGL2PaintEngineExPrivate::systemStateChanged() glDepthFunc(GL_ALWAYS); writeClip(qtVectorPathForPath(q->state()->matrix.inverted().map(path)), 1); - glDepthFunc(GL_LESS); + glDepthFunc(GL_LEQUAL); glEnable(GL_DEPTH_TEST); q->state()->depthTestEnabled = true; @@ -1943,7 +1944,7 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state) if (old_state && old_state != s && old_state->canRestoreClip) { d->updateDepthScissorTest(); glDepthMask(false); - glDepthFunc(GL_LESS); + glDepthFunc(GL_LEQUAL); } else { d->regenerateDepthClip(); } -- cgit v0.12 From 7f27fbe6aa78e30b7716659a0e9534f3ab7fefd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 25 Sep 2009 17:36:46 +0200 Subject: Renamed GL 2 engine variables to be clip buffer agnostic. (cherry picked from commit e8c73ac916ce5cb0492c1d1ba817e59b8df34158) --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 90 +++++++++++----------- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 14 ++-- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 602754c..7eb9afc 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -276,7 +276,7 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo); glViewport(0, 0, pex->width, pex->height); - pex->updateDepthScissorTest(); + pex->updateClipScissorTest(); #ifndef QT_OPENGL_ES_2 if (pex->inRenderText) @@ -404,7 +404,7 @@ void QGL2PaintEngineExPrivate::useSimpleShader() } if (simpleShaderDepthUniformDirty) { - shaderManager->simpleProgram()->setUniformValue("depth", normalizedDeviceDepth(q->state()->currentDepth)); + shaderManager->simpleProgram()->setUniformValue("depth", normalizedDeviceDepth(q->state()->currentClip)); simpleShaderDepthUniformDirty = false; } } @@ -1018,7 +1018,7 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) } if (depthUniformDirty) { - shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), normalizedDeviceDepth(q->state()->currentDepth)); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), normalizedDeviceDepth(q->state()->currentClip)); depthUniformDirty = false; } @@ -1638,10 +1638,10 @@ void QGL2PaintEngineEx::ensureActive() } } -void QGL2PaintEngineExPrivate::updateDepthScissorTest() +void QGL2PaintEngineExPrivate::updateClipScissorTest() { Q_Q(QGL2PaintEngineEx); - if (q->state()->depthTestEnabled) + if (q->state()->clipTestEnabled) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST); @@ -1691,29 +1691,29 @@ void QGL2PaintEngineEx::clipEnabledChanged() d->depthUniformDirty = true; if (painter()->hasClipping()) { - d->regenerateDepthClip(); + d->regenerateClip(); } else { if (d->use_system_clip) { - state()->currentDepth = 1; + state()->currentClip = 1; } else { - state()->depthTestEnabled = false; + state()->clipTestEnabled = false; } - d->updateDepthScissorTest(); + d->updateClipScissorTest(); } } -void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint depth) +void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value) { transferMode(BrushDrawingMode); if (matrixDirty) updateMatrix(); - if (q->state()->needsDepthBufferClear) { + if (q->state()->needsClipBufferClear) { glDepthMask(true); glClearDepth(rawDepth(1)); glClear(GL_DEPTH_BUFFER_BIT); - q->state()->needsDepthBufferClear = false; + q->state()->needsClipBufferClear = false; glDepthMask(false); } @@ -1733,7 +1733,7 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint depth) glColorMask(false, false, false, false); glDepthMask(true); - shaderManager->simpleProgram()->setUniformValue("depth", normalizedDeviceDepth(depth)); + shaderManager->simpleProgram()->setUniformValue("depth", normalizedDeviceDepth(value)); simpleShaderDepthUniformDirty = true; glEnable(GL_DEPTH_TEST); @@ -1774,7 +1774,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) if (state()->matrix.type() <= QTransform::TxScale) { state()->rectangleClip = state()->rectangleClip.intersected(state()->matrix.mapRect(rect).toRect()); - d->updateDepthScissorTest(); + d->updateClipScissorTest(); return; } } @@ -1785,38 +1785,38 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) switch (op) { case Qt::NoClip: if (d->use_system_clip) { - state()->depthTestEnabled = true; - state()->currentDepth = 1; + state()->clipTestEnabled = true; + state()->currentClip = 1; } else { - state()->depthTestEnabled = false; + state()->clipTestEnabled = false; } state()->rectangleClip = QRect(0, 0, d->width, d->height); state()->canRestoreClip = false; - d->updateDepthScissorTest(); + d->updateClipScissorTest(); break; case Qt::IntersectClip: state()->rectangleClip = state()->rectangleClip.intersected(pathRect); - d->updateDepthScissorTest(); - ++d->maxDepth; - d->writeClip(path, d->maxDepth); - state()->currentDepth = d->maxDepth; - state()->depthTestEnabled = true; + d->updateClipScissorTest(); + ++d->maxClip; + d->writeClip(path, d->maxClip); + state()->currentClip = d->maxClip; + state()->clipTestEnabled = true; break; case Qt::UniteClip: { - ++d->maxDepth; + ++d->maxClip; if (state()->rectangleClip.isValid()) { QPainterPath path; path.addRect(state()->rectangleClip); // flush the existing clip rectangle to the depth buffer - d->writeClip(qtVectorPathForPath(state()->matrix.inverted().map(path)), d->maxDepth); + d->writeClip(qtVectorPathForPath(state()->matrix.inverted().map(path)), d->maxClip); } #ifndef QT_GL_NO_SCISSOR_TEST QRect oldRectangleClip = state()->rectangleClip; state()->rectangleClip = state()->rectangleClip.united(pathRect); - d->updateDepthScissorTest(); + d->updateClipScissorTest(); QRegion extendRegion = QRegion(state()->rectangleClip) - oldRectangleClip; @@ -1831,10 +1831,10 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) #endif glDepthFunc(GL_ALWAYS); // now write the clip path - d->writeClip(path, d->maxDepth); + d->writeClip(path, d->maxClip); state()->canRestoreClip = false; - state()->currentDepth = d->maxDepth; - state()->depthTestEnabled = true; + state()->currentClip = d->maxClip; + state()->clipTestEnabled = true; break; } default: @@ -1842,14 +1842,14 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) } glDepthFunc(GL_LEQUAL); - if (state()->depthTestEnabled) { + if (state()->clipTestEnabled) { glEnable(GL_DEPTH_TEST); d->simpleShaderDepthUniformDirty = true; d->depthUniformDirty = true; } } -void QGL2PaintEngineExPrivate::regenerateDepthClip() +void QGL2PaintEngineExPrivate::regenerateClip() { systemStateChanged(); replayClipOperations(); @@ -1870,14 +1870,14 @@ void QGL2PaintEngineExPrivate::systemStateChanged() } } - q->state()->depthTestEnabled = false; - q->state()->needsDepthBufferClear = true; + q->state()->clipTestEnabled = false; + q->state()->needsClipBufferClear = true; - q->state()->currentDepth = 1; - maxDepth = 1; + q->state()->currentClip = 1; + maxClip = 1; q->state()->rectangleClip = use_system_clip ? systemClip.boundingRect() : QRect(0, 0, width, height); - updateDepthScissorTest(); + updateClipScissorTest(); if (use_system_clip) { #ifndef QT_GL_NO_SCISSOR_TEST @@ -1891,7 +1891,7 @@ void QGL2PaintEngineExPrivate::systemStateChanged() return; } #endif - q->state()->needsDepthBufferClear = false; + q->state()->needsClipBufferClear = false; glDepthMask(true); @@ -1906,7 +1906,7 @@ void QGL2PaintEngineExPrivate::systemStateChanged() glDepthFunc(GL_LEQUAL); glEnable(GL_DEPTH_TEST); - q->state()->depthTestEnabled = true; + q->state()->clipTestEnabled = true; simpleShaderDepthUniformDirty = true; depthUniformDirty = true; @@ -1942,11 +1942,11 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state) d->shaderManager->setDirty(); if (old_state && old_state != s && old_state->canRestoreClip) { - d->updateDepthScissorTest(); + d->updateClipScissorTest(); glDepthMask(false); glDepthFunc(GL_LEQUAL); } else { - d->regenerateDepthClip(); + d->regenerateClip(); } } @@ -1976,18 +1976,18 @@ void QGL2PaintEngineEx::setRenderTextActive(bool active) QOpenGL2PaintEngineState::QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &other) : QPainterState(other) { - needsDepthBufferClear = other.needsDepthBufferClear; - depthTestEnabled = other.depthTestEnabled; + needsClipBufferClear = other.needsClipBufferClear; + clipTestEnabled = other.clipTestEnabled; scissorTestEnabled = other.scissorTestEnabled; - currentDepth = other.currentDepth; + currentClip = other.currentClip; canRestoreClip = other.canRestoreClip; rectangleClip = other.rectangleClip; } QOpenGL2PaintEngineState::QOpenGL2PaintEngineState() { - needsDepthBufferClear = true; - depthTestEnabled = false; + needsClipBufferClear = true; + clipTestEnabled = false; canRestoreClip = true; } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 189d5be..fc61905 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -82,11 +82,11 @@ public: QOpenGL2PaintEngineState(); ~QOpenGL2PaintEngineState(); - bool needsDepthBufferClear; + bool needsClipBufferClear; - bool depthTestEnabled; + bool clipTestEnabled; bool scissorTestEnabled; - uint currentDepth; + uint currentClip; bool canRestoreClip; QRect rectangleClip; @@ -223,7 +223,7 @@ public: QRegion dirtyStencilRegion; QRect currentScissorBounds; - uint maxDepth; + uint maxClip; const QBrush* currentBrush; // May not be the state's brush! @@ -240,10 +240,10 @@ public: QGLEngineShaderManager* shaderManager; - void writeClip(const QVectorPath &path, uint depth); - void updateDepthScissorTest(); + void writeClip(const QVectorPath &path, uint value); + void updateClipScissorTest(); void setScissor(const QRect &rect); - void regenerateDepthClip(); + void regenerateClip(); void systemStateChanged(); uint use_system_clip : 1; -- cgit v0.12 From e1dfa019ca04c00a6567b8038c25556235540d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 28 Sep 2009 10:24:09 +0200 Subject: Got rid of some redundant state changes regarding GL depth state. (cherry picked from commit a815840a7f2272b128de4a52497626c49373c8c9) --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 23 +++++++++------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 7eb9afc..b7f9e2c 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1566,8 +1566,6 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) if (!d->inRenderText) { glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); - glDepthFunc(GL_LEQUAL); - glDepthMask(false); } #if !defined(QT_OPENGL_ES_2) @@ -1631,8 +1629,6 @@ void QGL2PaintEngineEx::ensureActive() if (d->needsSync) { d->transferMode(BrushDrawingMode); glViewport(0, 0, d->width, d->height); - glDepthMask(false); - glDepthFunc(GL_LEQUAL); d->needsSync = false; setState(state()); } @@ -1714,18 +1710,23 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value) glClearDepth(rawDepth(1)); glClear(GL_DEPTH_BUFFER_BIT); q->state()->needsClipBufferClear = false; - glDepthMask(false); } + glDepthMask(false); + if (path.isEmpty()) return; glDisable(GL_BLEND); - glDepthMask(false); vertexCoordinateArray.clear(); vertexCoordinateArray.addPath(path, inverseScale); + if (q->state()->clipTestEnabled) + glDepthFunc(GL_LEQUAL); + else + glDepthFunc(GL_ALWAYS); + glDepthMask(GL_FALSE); fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); @@ -1746,6 +1747,7 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value) composite(vertexCoordinateArray.boundingRect()); glDisable(GL_STENCIL_TEST); + glDepthFunc(GL_LEQUAL); glStencilMask(0); glColorMask(true, true, true, true); @@ -1812,6 +1814,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) d->writeClip(qtVectorPathForPath(state()->matrix.inverted().map(path)), d->maxClip); } + state()->clipTestEnabled = false; #ifndef QT_GL_NO_SCISSOR_TEST QRect oldRectangleClip = state()->rectangleClip; @@ -1820,7 +1823,6 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) QRegion extendRegion = QRegion(state()->rectangleClip) - oldRectangleClip; - glDepthFunc(GL_ALWAYS); if (!extendRegion.isEmpty()) { QPainterPath extendPath; extendPath.addRegion(extendRegion); @@ -1829,7 +1831,6 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) d->writeClip(qtVectorPathForPath(state()->matrix.inverted().map(extendPath)), 0); } #endif - glDepthFunc(GL_ALWAYS); // now write the clip path d->writeClip(path, d->maxClip); state()->canRestoreClip = false; @@ -1841,9 +1842,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) break; } - glDepthFunc(GL_LEQUAL); if (state()->clipTestEnabled) { - glEnable(GL_DEPTH_TEST); d->simpleShaderDepthUniformDirty = true; d->depthUniformDirty = true; } @@ -1901,11 +1900,8 @@ void QGL2PaintEngineExPrivate::systemStateChanged() QPainterPath path; path.addRegion(systemClip); - glDepthFunc(GL_ALWAYS); writeClip(qtVectorPathForPath(q->state()->matrix.inverted().map(path)), 1); - glDepthFunc(GL_LEQUAL); - glEnable(GL_DEPTH_TEST); q->state()->clipTestEnabled = true; simpleShaderDepthUniformDirty = true; @@ -1943,7 +1939,6 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state) if (old_state && old_state != s && old_state->canRestoreClip) { d->updateClipScissorTest(); - glDepthMask(false); glDepthFunc(GL_LEQUAL); } else { d->regenerateClip(); -- cgit v0.12 From b4d751f565e84227a16021fcbc4fc7c700293662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 28 Sep 2009 10:31:46 +0200 Subject: Moved GL 2 clip clearing code into a common function. (cherry picked from commit 6d17e09c274803d324e8a8db579aaafaefaab33f) --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 28 +++++++++++----------- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 1 + 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index b7f9e2c..13f0079 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1699,25 +1699,30 @@ void QGL2PaintEngineEx::clipEnabledChanged() } } +void QGL2PaintEngineExPrivate::clearClip(uint value) +{ + glDepthMask(true); + glClearDepth(rawDepth(value)); + glClear(GL_DEPTH_BUFFER_BIT); + glDepthMask(false); + + q->state()->needsClipBufferClear = false; +} + void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value) { transferMode(BrushDrawingMode); if (matrixDirty) updateMatrix(); - if (q->state()->needsClipBufferClear) { - glDepthMask(true); - glClearDepth(rawDepth(1)); - glClear(GL_DEPTH_BUFFER_BIT); - q->state()->needsClipBufferClear = false; - } - - glDepthMask(false); + if (q->state()->needsClipBufferClear) + clearClip(1); if (path.isEmpty()) return; glDisable(GL_BLEND); + glDepthMask(false); vertexCoordinateArray.clear(); vertexCoordinateArray.addPath(path, inverseScale); @@ -1890,12 +1895,7 @@ void QGL2PaintEngineExPrivate::systemStateChanged() return; } #endif - q->state()->needsClipBufferClear = false; - - glDepthMask(true); - - glClearDepth(0); - glClear(GL_DEPTH_BUFFER_BIT); + clearClip(0); QPainterPath path; path.addRegion(systemClip); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index fc61905..dd5f4fc 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -240,6 +240,7 @@ public: QGLEngineShaderManager* shaderManager; + void clearClip(uint value); void writeClip(const QVectorPath &path, uint value); void updateClipScissorTest(); void setScissor(const QRect &rect); -- cgit v0.12 From 0972f9e19b4d07300fe98a802591341ea3e973f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 6 Oct 2009 15:38:54 +0200 Subject: Switched to using stencil instead of depth buffer for clipping. Based on Aaron Kennedy's patch. All tests are green, but when enabling scissoring UniteClip seems to be broken atm. (cherry picked from commit 6b623c04060d274c048c0d4c6dbc5a90d1c31604) --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 277 +++++++++++++-------- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 17 +- 2 files changed, 173 insertions(+), 121 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 13f0079..0af8e71 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -87,6 +87,7 @@ QT_BEGIN_NAMESPACE //#define QT_GL_NO_SCISSOR_TEST +static const GLuint GL_STENCIL_HIGH_BIT = 0x80; static const GLuint QT_BRUSH_TEXTURE_UNIT = 0; static const GLuint QT_IMAGE_TEXTURE_UNIT = 0; //Can be the same as brush texture unit static const GLuint QT_MASK_TEXTURE_UNIT = 1; @@ -227,6 +228,7 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) glPushAttrib(GL_ENABLE_BIT | GL_VIEWPORT_BIT | GL_SCISSOR_BIT); #endif + glDisable(GL_STENCIL_TEST); glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); glDisable(GL_BLEND); @@ -402,11 +404,6 @@ void QGL2PaintEngineExPrivate::useSimpleShader() shaderManager->simpleProgram()->setUniformValue("pmvMatrix", pmvMatrix); simpleShaderMatrixUniformDirty = false; } - - if (simpleShaderDepthUniformDirty) { - shaderManager->simpleProgram()->setUniformValue("depth", normalizedDeviceDepth(q->state()->currentClip)); - simpleShaderDepthUniformDirty = false; - } } void QGL2PaintEngineExPrivate::updateBrushTexture() @@ -771,6 +768,7 @@ void QGL2PaintEngineExPrivate::resetGLState() { glDisable(GL_BLEND); glActiveTexture(GL_TEXTURE0); + glDisable(GL_STENCIL_TEST); glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); glDepthMask(true); @@ -895,10 +893,10 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); // Stencil the brush onto the dest buffer - glStencilFunc(GL_NOTEQUAL, 0, 0xFFFF); // Pass if stencil buff value != 0 - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); + glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT, GL_STENCIL_HIGH_BIT); // Pass if stencil buff value != 0 + glStencilOp(GL_KEEP, GL_ZERO, GL_ZERO); + glStencilMask(GL_STENCIL_HIGH_BIT); - glEnable(GL_STENCIL_TEST); prepareForDraw(currentBrush->isOpaque()); #ifndef QT_OPENGL_ES_2 @@ -906,58 +904,137 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), zValueForRenderText()); #endif composite(vertexCoordinateArray.boundingRect()); - glDisable(GL_STENCIL_TEST); - glStencilMask(0); + + updateClipScissorTest(); } } void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(QGL2PEXVertexArray& vertexArray, bool useWindingFill) { +#ifndef QT_OPENGL_ES_2 + if (inRenderText) { + glPushAttrib(GL_ENABLE_BIT); + glDisable(GL_DEPTH_TEST); + } +#endif + // qDebug("QGL2PaintEngineExPrivate::fillStencilWithVertexArray()"); - glStencilMask(0xFFFF); // Enable stencil writes + glStencilMask(0xffff); // Enable stencil writes if (dirtyStencilRegion.intersects(currentScissorBounds)) { - // Clear the stencil buffer to zeros - glDisable(GL_STENCIL_TEST); + QVector clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects(); glClearStencil(0); // Clear to zero - glClear(GL_STENCIL_BUFFER_BIT); + for (int i = 0; i < clearRegion.size(); ++i) { +#ifndef QT_GL_NO_SCISSOR_TEST + setScissor(clearRegion.at(i)); +#endif + glClear(GL_STENCIL_BUFFER_BIT); + } + dirtyStencilRegion -= currentScissorBounds; + +#ifndef QT_GL_NO_SCISSOR_TEST + updateClipScissorTest(); +#endif } glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // Disable color writes - glStencilFunc(GL_ALWAYS, 0, 0xFFFF); // Always pass the stencil test + useSimpleShader(); + glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d - // Setup the stencil op: if (useWindingFill) { - glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_INCR_WRAP); // Inc. for front-facing triangle - glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_DECR_WRAP); //Dec. for back-facing "holes" - } else - glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit + if (q->state()->clipTestEnabled) { + glStencilFunc(GL_LEQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); + glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + composite(vertexArray.boundingRect()); - // No point in using a fancy gradient shader for writing into the stencil buffer! - useSimpleShader(); - - glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d - glDisable(GL_BLEND); + glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT, GL_STENCIL_HIGH_BIT); + } else { + glStencilFunc(GL_ALWAYS, 0, 0xffff); + glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO); + composite(vertexArray.boundingRect()); + } -#ifndef QT_OPENGL_ES_2 - if (inRenderText) { - glPushAttrib(GL_ENABLE_BIT); - glDisable(GL_DEPTH_TEST); + // Inc. for front-facing triangle + glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_INCR_WRAP, GL_INCR_WRAP); + //Dec. for back-facing "holes" + glStencilOpSeparate(GL_BACK, GL_KEEP, GL_DECR_WRAP, GL_DECR_WRAP); + glStencilMask(~GL_STENCIL_HIGH_BIT); + drawVertexArrays(vertexArray, GL_TRIANGLE_FAN); + + if (q->state()->clipTestEnabled) { + // clear high bit of stencil outside of path + glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); + glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); + glStencilMask(GL_STENCIL_HIGH_BIT); + composite(vertexArray.boundingRect()); + // reset lower bits of stencil inside path to current clip + glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, GL_STENCIL_HIGH_BIT); + glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + glStencilMask(~GL_STENCIL_HIGH_BIT); + composite(vertexArray.boundingRect()); + } else { + // set high bit of stencil inside path + glStencilFunc(GL_NOTEQUAL, 0, 0xffff); + glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); + glStencilMask(GL_STENCIL_HIGH_BIT); + composite(vertexArray.boundingRect()); + } + } else { + glStencilMask(GL_STENCIL_HIGH_BIT); + glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit + drawVertexArrays(vertexArray, GL_TRIANGLE_FAN); } -#endif - // Draw the vertecies into the stencil buffer: - drawVertexArrays(vertexArray, GL_TRIANGLE_FAN); + // Enable color writes & disable stencil writes + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); #ifndef QT_OPENGL_ES_2 if (inRenderText) glPopAttrib(); #endif - // Enable color writes & disable stencil writes +} + +/* + If the maximum value in the stencil buffer is GL_STENCIL_HIGH_BIT - 1, + restore the stencil buffer to a pristine state. The current clip region + is set to 1, and the rest to 0. +*/ +void QGL2PaintEngineExPrivate::resetClipIfNeeded() +{ + if (maxClip != (GL_STENCIL_HIGH_BIT - 1)) + return; + + Q_Q(QGL2PaintEngineEx); + + useSimpleShader(); + glEnable(GL_STENCIL_TEST); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + + QRectF bounds = q->state()->matrix.inverted().mapRect(QRectF(0, 0, width, height)); + QGLRect rect(bounds.left(), bounds.top(), bounds.right(), bounds.bottom()); + + // Set high bit on clip region + glStencilFunc(GL_LEQUAL, q->state()->currentClip, 0xffff); + glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); + glStencilMask(GL_STENCIL_HIGH_BIT); + composite(rect); + + // Reset clipping to 1 and everything else to zero + glStencilFunc(GL_NOTEQUAL, 0x01, GL_STENCIL_HIGH_BIT); + glStencilOp(GL_ZERO, GL_REPLACE, GL_REPLACE); + glStencilMask(0xFFFF); + composite(rect); + + q->state()->currentClip = 1; + q->state()->canRestoreClip = false; + + maxClip = 1; + + glStencilMask(0x0); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } @@ -1005,7 +1082,6 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) // The shader program has changed so mark all uniforms as dirty: brushUniformsDirty = true; shaderMatrixUniformDirty = true; - depthUniformDirty = true; opacityUniformDirty = true; } @@ -1017,11 +1093,6 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) shaderMatrixUniformDirty = false; } - if (depthUniformDirty) { - shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), normalizedDeviceDepth(q->state()->currentClip)); - depthUniformDirty = false; - } - if (opacityMode == QGLEngineShaderManager::UniformOpacity && opacityUniformDirty) { shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::GlobalOpacity), (GLfloat)q->state()->opacity); opacityUniformDirty = false; @@ -1542,8 +1613,6 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) d->brushUniformsDirty = true; d->matrixDirty = true; d->compositionModeDirty = true; - d->simpleShaderDepthUniformDirty = true; - d->depthUniformDirty = true; d->opacityUniformDirty = true; d->needsSync = true; d->use_system_clip = !systemClip().isEmpty(); @@ -1564,6 +1633,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) d->shaderManager = new QGLEngineShaderManager(d->ctx); if (!d->inRenderText) { + glDisable(GL_STENCIL_TEST); glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); } @@ -1637,10 +1707,13 @@ void QGL2PaintEngineEx::ensureActive() void QGL2PaintEngineExPrivate::updateClipScissorTest() { Q_Q(QGL2PaintEngineEx); - if (q->state()->clipTestEnabled) - glEnable(GL_DEPTH_TEST); - else - glDisable(GL_DEPTH_TEST); + if (q->state()->clipTestEnabled) { + glEnable(GL_STENCIL_TEST); + glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); + } else { + glDisable(GL_STENCIL_TEST); + glStencilFunc(GL_ALWAYS, 0, 0xffff); + } #ifdef QT_GL_NO_SCISSOR_TEST currentScissorBounds = QRect(0, 0, width, height); @@ -1683,28 +1756,20 @@ void QGL2PaintEngineEx::clipEnabledChanged() { Q_D(QGL2PaintEngineEx); - d->simpleShaderDepthUniformDirty = true; - d->depthUniformDirty = true; - - if (painter()->hasClipping()) { + if (painter()->hasClipping()) d->regenerateClip(); - } else { - if (d->use_system_clip) { - state()->currentClip = 1; - } else { - state()->clipTestEnabled = false; - } - - d->updateClipScissorTest(); - } + else + d->systemStateChanged(); } void QGL2PaintEngineExPrivate::clearClip(uint value) { - glDepthMask(true); - glClearDepth(rawDepth(value)); - glClear(GL_DEPTH_BUFFER_BIT); - glDepthMask(false); + dirtyStencilRegion -= currentScissorBounds; + + glStencilMask(0xffff); + glClearStencil(value); + glClear(GL_STENCIL_BUFFER_BIT); + glStencilMask(0x0); q->state()->needsClipBufferClear = false; } @@ -1715,48 +1780,57 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value) if (matrixDirty) updateMatrix(); + + const bool singlePass = !path.hasWindingFill() + && (((q->state()->currentClip == maxClip - 1) && q->state()->clipTestEnabled) + || q->state()->needsClipBufferClear); + const uint referenceClipValue = q->state()->needsClipBufferClear ? 1 : q->state()->currentClip; + if (q->state()->needsClipBufferClear) clearClip(1); - if (path.isEmpty()) + if (path.isEmpty()) { + glEnable(GL_STENCIL_TEST); + glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT); return; + } - glDisable(GL_BLEND); - glDepthMask(false); + if (q->state()->clipTestEnabled) + glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); + else + glStencilFunc(GL_ALWAYS, 0, 0xffff); vertexCoordinateArray.clear(); vertexCoordinateArray.addPath(path, inverseScale); - if (q->state()->clipTestEnabled) - glDepthFunc(GL_LEQUAL); - else - glDepthFunc(GL_ALWAYS); - - glDepthMask(GL_FALSE); - fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); + if (!singlePass) + fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); - // Stencil the clip onto the clip buffer glColorMask(false, false, false, false); - glDepthMask(true); + glEnable(GL_STENCIL_TEST); + useSimpleShader(); - shaderManager->simpleProgram()->setUniformValue("depth", normalizedDeviceDepth(value)); - simpleShaderDepthUniformDirty = true; + if (singlePass) { + // Under these conditions we can set the new stencil value in a single + // pass, by using the current value and the "new value" as the toggles - glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_ALWAYS); + glStencilFunc(GL_LEQUAL, referenceClipValue, ~GL_STENCIL_HIGH_BIT); + glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); + glStencilMask(value ^ referenceClipValue); - glStencilFunc(GL_NOTEQUAL, 0, 0xFFFF); // Pass if stencil buff value != 0 - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); + drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN); + } else { + glStencilFunc(GL_NOTEQUAL, value, GL_STENCIL_HIGH_BIT); + glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + glStencilMask(0xffff); - glEnable(GL_STENCIL_TEST); - composite(vertexCoordinateArray.boundingRect()); - glDisable(GL_STENCIL_TEST); + composite(vertexCoordinateArray.boundingRect()); + } - glDepthFunc(GL_LEQUAL); + glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT); glStencilMask(0); glColorMask(true, true, true, true); - glDepthMask(false); } void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) @@ -1804,12 +1878,14 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) case Qt::IntersectClip: state()->rectangleClip = state()->rectangleClip.intersected(pathRect); d->updateClipScissorTest(); + d->resetClipIfNeeded(); ++d->maxClip; d->writeClip(path, d->maxClip); state()->currentClip = d->maxClip; state()->clipTestEnabled = true; break; case Qt::UniteClip: { + d->resetClipIfNeeded(); ++d->maxClip; if (state()->rectangleClip.isValid()) { QPainterPath path; @@ -1846,11 +1922,6 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) default: break; } - - if (state()->clipTestEnabled) { - d->simpleShaderDepthUniformDirty = true; - d->depthUniformDirty = true; - } } void QGL2PaintEngineExPrivate::regenerateClip() @@ -1883,29 +1954,25 @@ void QGL2PaintEngineExPrivate::systemStateChanged() q->state()->rectangleClip = use_system_clip ? systemClip.boundingRect() : QRect(0, 0, width, height); updateClipScissorTest(); - if (use_system_clip) { + if (systemClip.numRects() == 1) { + if (systemClip.boundingRect() == QRect(0, 0, width, height)) + use_system_clip = false; #ifndef QT_GL_NO_SCISSOR_TEST - if (systemClip.numRects() == 1) { - if (q->state()->rectangleClip == QRect(0, 0, width, height)) { - use_system_clip = false; - } else { - simpleShaderDepthUniformDirty = true; - depthUniformDirty = true; - } - return; - } + // scissoring takes care of the system clip + return; #endif + } + + if (use_system_clip) { clearClip(0); QPainterPath path; path.addRegion(systemClip); + q->state()->currentClip = 0; writeClip(qtVectorPathForPath(q->state()->matrix.inverted().map(path)), 1); - + q->state()->currentClip = 1; q->state()->clipTestEnabled = true; - - simpleShaderDepthUniformDirty = true; - depthUniformDirty = true; } } @@ -1929,8 +1996,6 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state) d->matrixDirty = true; d->compositionModeDirty = true; - d->simpleShaderDepthUniformDirty = true; - d->depthUniformDirty = true; d->simpleShaderMatrixUniformDirty = true; d->shaderMatrixUniformDirty = true; d->opacityUniformDirty = true; diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index dd5f4fc..bfc6a3f 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -217,8 +217,6 @@ public: bool brushUniformsDirty; bool simpleShaderMatrixUniformDirty; bool shaderMatrixUniformDirty; - bool depthUniformDirty; - bool simpleShaderDepthUniformDirty; bool opacityUniformDirty; QRegion dirtyStencilRegion; @@ -242,25 +240,14 @@ public: void clearClip(uint value); void writeClip(const QVectorPath &path, uint value); + void resetClipIfNeeded(); + void updateClipScissorTest(); void setScissor(const QRect &rect); void regenerateClip(); void systemStateChanged(); uint use_system_clip : 1; - static inline GLfloat rawDepth(uint depth) - { - // assume at least 16 bits in the depth buffer, and - // use 2^15 depth levels to be safe with regard to - // rounding issues etc - return depth * (1.0f / GLfloat((1 << 15) - 1)); - } - - static inline GLfloat normalizedDeviceDepth(uint depth) - { - return 2.0f * rawDepth(depth) - 1.0f; - } - uint location(QGLEngineShaderManager::Uniform uniform) { return shaderManager->getUniformLocation(uniform); -- cgit v0.12 From 2ec1b27e49638d494d1a0bb5983a64d05eebb64a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 28 Sep 2009 18:37:15 +0200 Subject: Added convex polygon optimization to QGL2PaintEngineExPrivate::fill(). (cherry picked from commit d846af0de2ee2b3b76f81f2c0fd3ccceb645b511) --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 0af8e71..70d1ae9 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -876,16 +876,15 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) if (path.shape() == QVectorPath::RectangleHint) { QGLRect rect(points[0].x(), points[0].y(), points[2].x(), points[2].y()); prepareForDraw(currentBrush->isOpaque()); - composite(rect); - } - else if (path.shape() == QVectorPath::EllipseHint) { + } else if (path.shape() == QVectorPath::EllipseHint + || path.shape() == QVectorPath::ConvexPolygonHint) + { vertexCoordinateArray.clear(); vertexCoordinateArray.addPath(path, inverseScale); prepareForDraw(currentBrush->isOpaque()); drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN); - } - else { + } else { // The path is too complicated & needs the stencil technique vertexCoordinateArray.clear(); vertexCoordinateArray.addPath(path, inverseScale); -- cgit v0.12 From 0926616ab27b82a16dc05e92fbe81b545dce33b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 29 Sep 2009 09:03:19 +0200 Subject: Made depth tested renderText() work after stencil clipping change. Also we should force Raster_A8 glyph format in renderText(). (cherry picked from commit 9dbcdc00239abbaf899f04fc5ecc2bdb885ad08d) --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 70d1ae9..ab38c24 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -912,13 +912,6 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(QGL2PEXVertexArray& vertexArray, bool useWindingFill) { -#ifndef QT_OPENGL_ES_2 - if (inRenderText) { - glPushAttrib(GL_ENABLE_BIT); - glDisable(GL_DEPTH_TEST); - } -#endif - // qDebug("QGL2PaintEngineExPrivate::fillStencilWithVertexArray()"); glStencilMask(0xffff); // Enable stencil writes @@ -943,6 +936,13 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(QGL2PEXVertexArray& ve useSimpleShader(); glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d +#ifndef QT_OPENGL_ES_2 + if (inRenderText) { + glPushAttrib(GL_ENABLE_BIT); + glDisable(GL_DEPTH_TEST); + } +#endif + if (useWindingFill) { if (q->state()->clipTestEnabled) { glStencilFunc(GL_LEQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); @@ -1331,6 +1331,9 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat) : d->glyphCacheType; + if (d->inRenderText) + glyphType = QFontEngineGlyphCache::Raster_A8; + if (glyphType == QFontEngineGlyphCache::Raster_RGBMask && state()->composition_mode != QPainter::CompositionMode_Source && state()->composition_mode != QPainter::CompositionMode_SourceOver) -- cgit v0.12 From 9047e5ad08d0185dec73d8ee1928a952989a9a61 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Tue, 6 Oct 2009 14:55:52 +0200 Subject: Fixing the compile bug for Symbian when using ARMV5 Explicit destructor was needed by compiler. Reviewed-by: Thiago Macieira (cherry picked from commit 15e2ecda958868b5c372bcd59cba8065c086581e) --- src/network/access/qnetworkaccessmanager.cpp | 4 ++++ src/network/access/qnetworkaccessmanager_p.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 7ca1659..439d564 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -981,6 +981,10 @@ void QNetworkAccessManagerPrivate::clearCache(QNetworkAccessManager *manager) manager->d_func()->objectCache.clear(); } +QNetworkAccessManagerPrivate::~QNetworkAccessManagerPrivate() +{ +} + QT_END_NAMESPACE #include "moc_qnetworkaccessmanager.cpp" diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 96a49cc..3bd83c4 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -76,6 +76,7 @@ public: #endif cookieJarCreated(false) { } + ~QNetworkAccessManagerPrivate(); void _q_replyFinished(); void _q_replySslErrors(const QList &errors); -- cgit v0.12 From 444172c5a82ad584b7e466f12d27f49daf182992 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 6 Oct 2009 15:56:34 +0200 Subject: tst_qhttpnetworkconnection: Some more checks Some more checks (test still passes) Reviewed-by: TrustMe (cherry picked from commit 7cbcf8e8ef91636de1727d5bd6294a9f07c66804) --- .../tst_qhttpnetworkconnection.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index 6036a14..7aab6de 100644 --- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -899,9 +899,21 @@ void tst_QHttpNetworkConnection::getMultipleWithPipeliningAndMultiplePriorities( } while (finishedCount != replies.length()); - // redundant - for (int i = 0; i < replies.length(); i++) + int pipelinedCount = 0; + for (int i = 0; i < replies.length(); i++) { QVERIFY(replies.at(i)->isFinished()); + QVERIFY (!(replies.at(i)->request().isPipeliningAllowed() == false + && replies.at(i)->isPipeliningUsed())); + + if (replies.at(i)->isPipeliningUsed()) + pipelinedCount++; + } + + // We allow pipelining for every 2nd,3rd,4th,6th,8th,9th,10th etc request. + // Assume that half of the requests had been pipelined. + // (this is a very relaxed condition, when last measured 79 of 100 + // requests had been pipelined) + QVERIFY(pipelinedCount >= requestCount / 2); qDebug() << "===" << stopWatch.elapsed() << "msec ==="; -- cgit v0.12 From 955b581c8aca60d16837a994de5fa43e0f178d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 5 Oct 2009 16:45:38 +0200 Subject: Needed to set ENABLE_YARR_JIT to not compile MacroAssembler.cpp Reviewed-by:Simon Hausmann (cherry picked from commit 8037c03174124bc136900c88254d118ab48b010f) --- src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri | 10 ++++++++-- src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri index 5c1d518..2330de1 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri @@ -36,8 +36,14 @@ GENERATED_SOURCES_DIR_SLASH = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP} win32-* { LIBS += -lwinmm } -contains(JAVASCRIPTCORE_JIT,yes): DEFINES+=ENABLE_JIT=1 -contains(JAVASCRIPTCORE_JIT,no): DEFINES+=ENABLE_JIT=0 +contains(JAVASCRIPTCORE_JIT,yes) { + DEFINES+=ENABLE_JIT=1 + DEFINES+=ENABLE_YARR_JIT=1 +} +contains(JAVASCRIPTCORE_JIT,no) { + DEFINES+=ENABLE_JIT=0 + DEFINES+=ENABLE_YARR_JIT=0 +} # In debug mode JIT disabled until crash fixed win32-* { diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri index d8b6f4b..2b08980 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri @@ -36,8 +36,14 @@ GENERATED_SOURCES_DIR_SLASH = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP} win32-* { LIBS += -lwinmm } -contains(JAVASCRIPTCORE_JIT,yes): DEFINES+=ENABLE_JIT=1 -contains(JAVASCRIPTCORE_JIT,no): DEFINES+=ENABLE_JIT=0 +contains(JAVASCRIPTCORE_JIT,yes) { + DEFINES+=ENABLE_JIT=1 + DEFINES+=ENABLE_YARR_JIT=1 +} +contains(JAVASCRIPTCORE_JIT,no) { + DEFINES+=ENABLE_JIT=0 + DEFINES+=ENABLE_YARR_JIT=0 +} # In debug mode JIT disabled until crash fixed win32-* { -- cgit v0.12 From 1c466daff4560bb287b9ae688f21d933f34a902c Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 6 Oct 2009 16:07:40 +0200 Subject: add test for QT-2270 (cherry picked from commit 56187037e3fe46800bfa670197a149121f00573e) --- tests/auto/qscriptcontext/tst_qscriptcontext.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp index b193d67..89f8a5cf 100644 --- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp +++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp @@ -83,6 +83,7 @@ private slots: void argumentsObjectInNative(); void jsActivationObject(); void qobjectAsActivationObject(); + void parentContextCallee_QT2270(); }; tst_QScriptContext::tst_QScriptContext() @@ -1222,5 +1223,21 @@ void tst_QScriptContext::qobjectAsActivationObject() } } +static QScriptValue getParentContextCallee(QScriptContext *ctx, QScriptEngine *) +{ + return ctx->parentContext()->callee(); +} + +void tst_QScriptContext::parentContextCallee_QT2270() +{ + QScriptEngine engine; + engine.globalObject().setProperty("getParentContextCallee", engine.newFunction(getParentContextCallee)); + QScriptValue fun = engine.evaluate("(function() { return getParentContextCallee(); })"); + QVERIFY(fun.isFunction()); + QScriptValue callee = fun.call(); + QEXPECT_FAIL("", "QT-2270: Incorrect parentContext() returned for native call", Abort); + QVERIFY(callee.equals(fun)); +} + QTEST_MAIN(tst_QScriptContext) #include "tst_qscriptcontext.moc" -- cgit v0.12 From c7ebbfeed10ad2e1508582a42290e31cb8205b76 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 6 Oct 2009 16:12:11 +0200 Subject: Build fix. (cherry picked from commit c81b79080eb8f0c956c97fc80d5118baf7703df4) --- src/gui/styles/gtksymbols.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp index d8f140f..a77d9b6 100644 --- a/src/gui/styles/gtksymbols.cpp +++ b/src/gui/styles/gtksymbols.cpp @@ -984,7 +984,7 @@ QIcon QGtk::getFilesystemIcon(const QFileInfo &info) if (QGtk::gnome_vfs_init && QGtk::gnome_icon_lookup_sync) { QGtk::gnome_vfs_init(); GtkIconTheme *theme = QGtk::gtk_icon_theme_get_default(); - QString fileurl = QUrl::fromLocalFile(info.absoluteFilePath()); + QString fileurl = QUrl::fromLocalFile(info.absoluteFilePath()).toString(); char * icon_name = QGtk::gnome_icon_lookup_sync(theme, NULL, qPrintable(fileurl), -- cgit v0.12 From 137d200704b31e3488fc9580e936eb17e9dc9793 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 6 Oct 2009 16:24:06 +0200 Subject: tst_qnetworkreply: httpConnectionCount test improvements Reviewed-by: TrustMe (cherry picked from commit 85b17ee0222d96bbd93f758ac3b2bd3139c76ec8) --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 7863b4e..7adb67f 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -3993,10 +3993,14 @@ void tst_QNetworkReply::httpConnectionCount() QTime time; time.start(); - while(pendingConnectionCount != 6) { - QCoreApplication::instance()->processEvents(); - while (server.nextPendingConnection()) + while(pendingConnectionCount <= 20) { + QTestEventLoop::instance().enterLoop(1); + QTcpSocket *socket = server.nextPendingConnection(); + while (socket != 0) { pendingConnectionCount++; + socket->setParent(&server); + socket = server.nextPendingConnection(); + } // at max. wait 10 sec if (time.elapsed() > 10000) -- cgit v0.12 From 559ed56d3036418470682ed8cc662f26373ee868 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Tue, 6 Oct 2009 16:07:10 +0200 Subject: Fix crash related to audio equalizer. The constructor initializer relied on member variables. Task-number: QTBUG-4689 (cherry picked from commit 54645071fad98b46a44d88b50095dc21ff63fff6) --- src/3rdparty/phonon/mmf/audioequalizer.cpp | 28 +++++++++++++--------------- src/3rdparty/phonon/mmf/audioequalizer.h | 3 +-- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index c691e1e..7cc9bc7 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -36,18 +36,16 @@ void AudioEqualizer::parameterChanged(const int pid, { // There is no way to return an error from this function, so we just // have to trap and ignore exceptions. - TRAP_IGNORE(eq()->SetBandLevelL(pid, value.toInt())); + TRAP_IGNORE(static_cast(m_effect.data())->SetBandLevelL(pid, value.toInt())); } bool AudioEqualizer::activateOn(CPlayerType *player) { - m_effect.reset(CAudioEqualizer::NewL(*player)); - return true; -} + CAudioEqualizer *ptr = 0; + QT_TRAP_THROWING(ptr = CAudioEqualizer::NewL(*player)); + m_effect.reset(ptr); -CAudioEqualizer *AudioEqualizer::eq() const -{ - return static_cast(m_effect.data()); + return true; } QList AudioEqualizer::createParams() @@ -57,18 +55,21 @@ QList AudioEqualizer::createParams() // We temporarily create an AudioPlayer, and run the effect on it, so // we can extract the readonly data we need. AudioPlayer dummyPlayer; - activateOn(dummyPlayer.player()); + + CAudioEqualizer *eqPtr = 0; + QT_TRAP_THROWING(eqPtr = CAudioEqualizer::NewL(*dummyPlayer.player());) + QScopedPointer e(eqPtr); TInt32 dbMin; TInt32 dbMax; - eq()->DbLevelLimits(dbMin, dbMax); + e->DbLevelLimits(dbMin, dbMax); - const int bandCount = eq()->NumberOfBands(); + const int bandCount = e->NumberOfBands(); for (int i = 0; i < bandCount; ++i) { - const qint32 hz = eq()->CenterFrequency(i); + const qint32 hz = e->CenterFrequency(i); - const qint32 defVol = eq()->BandLevel(i); + const qint32 defVol = e->BandLevel(i); retval.append(EffectParameter(i, tr("Frequency band, %1 Hz").arg(hz), @@ -80,10 +81,7 @@ QList AudioEqualizer::createParams() QString())); } - m_effect.reset(); - return retval; } QT_END_NAMESPACE - diff --git a/src/3rdparty/phonon/mmf/audioequalizer.h b/src/3rdparty/phonon/mmf/audioequalizer.h index 6415411..d4c8165 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.h +++ b/src/3rdparty/phonon/mmf/audioequalizer.h @@ -49,8 +49,7 @@ protected: virtual bool activateOn(CPlayerType *player); private: - inline CAudioEqualizer *eq() const; - QList createParams(); + static QList createParams(); QScopedPointer m_bassBoost; }; } -- cgit v0.12 From 18f16007e20d223a7c0464190d7323fc1e6acb94 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 6 Oct 2009 16:51:18 +0200 Subject: Better compile fix. Reviewed-by:Thiago (cherry picked from commit 493eb0264c095c62b6573789225a22cadf946348) --- src/gui/styles/gtksymbols.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp index a77d9b6..d62f717 100644 --- a/src/gui/styles/gtksymbols.cpp +++ b/src/gui/styles/gtksymbols.cpp @@ -984,7 +984,7 @@ QIcon QGtk::getFilesystemIcon(const QFileInfo &info) if (QGtk::gnome_vfs_init && QGtk::gnome_icon_lookup_sync) { QGtk::gnome_vfs_init(); GtkIconTheme *theme = QGtk::gtk_icon_theme_get_default(); - QString fileurl = QUrl::fromLocalFile(info.absoluteFilePath()).toString(); + QString fileurl = QUrl::fromLocalFile(info.absoluteFilePath()).toEncoded(); char * icon_name = QGtk::gnome_icon_lookup_sync(theme, NULL, qPrintable(fileurl), -- cgit v0.12 From 228cb95786d3362467ac9870dafd9e1d1df20480 Mon Sep 17 00:00:00 2001 From: Espen Riskedal Date: Tue, 6 Oct 2009 16:53:17 +0200 Subject: Removed ICON for apps and demos except fluidlauncher and desktopservices mifconv can't always handle absolute paths to the .svg specified, so for now we don't use absolute paths, and fix it later. Task-number: QTBUG-4693 Reviewed-by: Shane Kearns (cherry picked from commit fa35247d31bd35d72c307f4a6a231400aade0c0b) --- demos/embedded/fluidlauncher/fluidlauncher.pro | 29 ++------------------------ demos/symbianpkgrules.pri | 2 -- examples/symbianpkgrules.pri | 2 -- 3 files changed, 2 insertions(+), 31 deletions(-) diff --git a/demos/embedded/fluidlauncher/fluidlauncher.pro b/demos/embedded/fluidlauncher/fluidlauncher.pro index d677e9d..f2abde6 100644 --- a/demos/embedded/fluidlauncher/fluidlauncher.pro +++ b/demos/embedded/fluidlauncher/fluidlauncher.pro @@ -59,7 +59,7 @@ symbian { load(data_caging_paths) TARGET.UID3 = 0xA000A641 - ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg + ICON = ../../../src/s60installs/qt.svg executables.sources = \ styledemo.exe \ @@ -126,21 +126,7 @@ symbian { mifs.sources = \ $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000A641.mif \ #fluidlauncher - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000A63F.mif \ #styledemo - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000A63D.mif \ #deform - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000A63E.mif \ #pathstroke - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000C607.mif \ #wiggly - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000A648.mif \ #ftp - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000C60A.mif \ #saxbookmarks - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000C611.mif \ #desktopservices - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000C610.mif \ #fridgemagnets - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000C612.mif \ #drilldown - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000CF6B.mif \ #softkeys - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000CF76.mif \ #raycasting - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000CF73.mif \ #flickable - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000CF72.mif \ #digiflip - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000CF75.mif \ #lightmaps - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000CF74.mif #flightinfo + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000C611.mif #desktopservices mifs.path = $$APP_RESOURCE_DIR contains(QT_CONFIG, svg) { @@ -155,33 +141,22 @@ symbian { resource.sources += \ $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/embeddedsvgviewer.rsc \ $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/weatherinfo.rsc - - mifs.sources += \ - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000A640.mif \ #embeddedsvgviewer - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000CF77.mif #weatherinfo - } contains(QT_CONFIG, webkit) { executables.sources += anomaly.exe reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/anomaly_reg.rsc resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/anomaly.rsc - mifs.sources += \ - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000CF71.mif #anomaly } contains(QT_CONFIG, phonon) { executables.sources += qmediaplayer.exe resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/qmediaplayer.rsc - mifs.sources += \ - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000C613.mif #qmediaplayer } contains(QT_CONFIG, script) { executables.sources += context2d.exe reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/context2d_reg.rsc resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/context2d.rsc - mifs.sources += \ - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000C608.mif #context2d } files.sources = $$PWD/screenshots $$PWD/slides diff --git a/demos/symbianpkgrules.pri b/demos/symbianpkgrules.pri index cf52cb3..7e6852b 100644 --- a/demos/symbianpkgrules.pri +++ b/demos/symbianpkgrules.pri @@ -11,5 +11,3 @@ vendorinfo = \ " " default_deployment.pkg_prerules += vendorinfo - -!isEmpty(TARGET.UID3):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg diff --git a/examples/symbianpkgrules.pri b/examples/symbianpkgrules.pri index 069a16e..59c5480 100644 --- a/examples/symbianpkgrules.pri +++ b/examples/symbianpkgrules.pri @@ -11,5 +11,3 @@ vendorinfo = \ " " default_deployment.pkg_prerules += vendorinfo - -!isEmpty(TARGET.UID3):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg -- cgit v0.12 From e217acd793f6ebefaba8534e2a2e50ded203da9c Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 6 Oct 2009 16:46:43 +0200 Subject: QScriptContext::parentContext: don't skip unessecary frames Calling QScriptValue::call doesn't create a fake frame. We can detect a real fake frame as it does not have a callee. Task-number: QT-2270 Reviewed-by: Kent Hansen (cherry picked from commit 96b047f0f27674ee402ab3624dbb906346ac1847) --- src/script/api/qscriptengine.cpp | 2 +- tests/auto/qscriptcontext/tst_qscriptcontext.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 863ac30..b1f36be 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -993,7 +993,7 @@ void QScriptEnginePrivate::setDefaultPrototype(int metaTypeId, JSC::JSValue prot QScriptContext *QScriptEnginePrivate::contextForFrame(JSC::ExecState *frame) { - if (frame && frame->callerFrame()->hasHostCallFrameFlag() + if (frame && frame->callerFrame()->hasHostCallFrameFlag() && !frame->callee() && frame->callerFrame()->removeHostCallFrameFlag() == QScript::scriptEngineFromExec(frame)->globalExec()) { //skip the "fake" context created in Interpreter::execute. frame = frame->callerFrame()->removeHostCallFrameFlag(); diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp index 89f8a5cf..a0af214 100644 --- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp +++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp @@ -1235,7 +1235,6 @@ void tst_QScriptContext::parentContextCallee_QT2270() QScriptValue fun = engine.evaluate("(function() { return getParentContextCallee(); })"); QVERIFY(fun.isFunction()); QScriptValue callee = fun.call(); - QEXPECT_FAIL("", "QT-2270: Incorrect parentContext() returned for native call", Abort); QVERIFY(callee.equals(fun)); } -- cgit v0.12 From 75f4584bd73b6361e36edaff8fb90a90add52a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 29 Sep 2009 11:00:57 +0200 Subject: Changed GL 2 engine render text implementation to use glDepthRange(). This frees all the current dependencies on the depth uniform. (cherry picked from commit 27c2df52128e32c785239dbc9322a4b7beb0078c) --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 41 ++++++++++++++-------- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 5 ++- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index ab38c24..859ffe1 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -898,11 +898,14 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) prepareForDraw(currentBrush->isOpaque()); -#ifndef QT_OPENGL_ES_2 if (inRenderText) - shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), zValueForRenderText()); -#endif + prepareDepthRangeForRenderText(); + composite(vertexCoordinateArray.boundingRect()); + + if (inRenderText) + restoreDepthRangeForRenderText(); + glStencilMask(0); updateClipScissorTest(); @@ -1138,7 +1141,7 @@ void QGL2PaintEngineExPrivate::drawVertexArrays(QGL2PEXVertexArray& vertexArray, glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR); } -float QGL2PaintEngineExPrivate::zValueForRenderText() const +void QGL2PaintEngineExPrivate::prepareDepthRangeForRenderText() { #ifndef QT_OPENGL_ES_2 // Get the z translation value from the model view matrix and @@ -1146,9 +1149,19 @@ float QGL2PaintEngineExPrivate::zValueForRenderText() const // and z-far = 1, which is used in QGLWidget::renderText() GLdouble model[4][4]; glGetDoublev(GL_MODELVIEW_MATRIX, &model[0][0]); - return -2 * model[3][2] - 1; -#else - return 0; + float deviceZ = -2 * model[3][2] - 1; + + glGetFloatv(GL_DEPTH_RANGE, depthRange); + float windowZ = depthRange[0] + (deviceZ + 1) * 0.5 * (depthRange[1] - depthRange[0]); + + glDepthRange(windowZ, windowZ); +#endif +} + +void QGL2PaintEngineExPrivate::restoreDepthRangeForRenderText() +{ +#ifndef QT_OPENGL_ES_2 + glDepthRange(depthRange[0], depthRange[1]); #endif } @@ -1406,6 +1419,9 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly QBrush pensBrush = q->state()->pen.brush(); setBrush(&pensBrush); + if (inRenderText) + prepareDepthRangeForRenderText(); + if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { // Subpixel antialiasing without gamma correction @@ -1458,10 +1474,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly glBindTexture(GL_TEXTURE_2D, cache->texture()); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, false); -#ifndef QT_OPENGL_ES_2 - if (inRenderText) - shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), zValueForRenderText()); -#endif shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::MaskTexture), QT_MASK_TEXTURE_UNIT); glDrawArrays(GL_TRIANGLES, 0, 6 * glyphs.size()); @@ -1492,12 +1504,11 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly glBindTexture(GL_TEXTURE_2D, cache->texture()); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, false); -#ifndef QT_OPENGL_ES_2 - if (inRenderText) - shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), zValueForRenderText()); -#endif shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::MaskTexture), QT_MASK_TEXTURE_UNIT); glDrawArrays(GL_TRIANGLES, 0, 6 * glyphs.size()); + + if (inRenderText) + restoreDepthRangeForRenderText(); } void QGL2PaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index bfc6a3f..662911f 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -197,7 +197,8 @@ public: inline void useSimpleShader(); - float zValueForRenderText() const; + void prepareDepthRangeForRenderText(); + void restoreDepthRangeForRenderText(); static QGLEngineShaderManager* shaderManagerForEngine(QGL2PaintEngineEx *engine) { return engine->d_func()->shaderManager; } @@ -258,6 +259,8 @@ public: bool needsSync; bool inRenderText; + GLfloat depthRange[2]; + float textureInvertedY; QScopedPointer convolutionFilter; -- cgit v0.12 From e5948fdb892810b5b783ceb4205a1eacd2a89a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 29 Sep 2009 09:42:02 +0200 Subject: Optimized restore() in GL 2 paint engine. Keep track of what state actually changed so we don't have to set all the uniforms as dirty etc. Reviewed-by: Trond (cherry picked from commit 092c773b95b1f126d36ab7c918fb098ddad6cae3) --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 50 ++++++++++++++++------ .../gl2paintengineex/qpaintengineex_opengl2_p.h | 15 ++++--- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 859ffe1..5875124 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1224,6 +1224,7 @@ void QGL2PaintEngineEx::opacityChanged() { // qDebug("QGL2PaintEngineEx::opacityChanged()"); Q_D(QGL2PaintEngineEx); + state()->opacityChanged = true; Q_ASSERT(d->shaderManager); d->brushUniformsDirty = true; @@ -1234,11 +1235,14 @@ void QGL2PaintEngineEx::compositionModeChanged() { // qDebug("QGL2PaintEngineEx::compositionModeChanged()"); Q_D(QGL2PaintEngineEx); + state()->compositionModeChanged = true; d->compositionModeDirty = true; } void QGL2PaintEngineEx::renderHintsChanged() { + state()->renderHintsChanged = true; + #if !defined(QT_OPENGL_ES_2) if ((state()->renderHints & QPainter::Antialiasing) || (state()->renderHints & QPainter::HighQualityAntialiasing)) @@ -1257,6 +1261,7 @@ void QGL2PaintEngineEx::transformChanged() { Q_D(QGL2PaintEngineEx); d->matrixDirty = true; + state()->matrixChanged = true; } @@ -1713,6 +1718,7 @@ void QGL2PaintEngineEx::ensureActive() d->transferMode(BrushDrawingMode); glViewport(0, 0, d->width, d->height); d->needsSync = false; + d->shaderManager->setDirty(); setState(state()); } } @@ -1769,6 +1775,8 @@ void QGL2PaintEngineEx::clipEnabledChanged() { Q_D(QGL2PaintEngineEx); + state()->clipChanged = true; + if (painter()->hasClipping()) d->regenerateClip(); else @@ -1851,6 +1859,8 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) // qDebug("QGL2PaintEngineEx::clip()"); Q_D(QGL2PaintEngineEx); + state()->clipChanged = true; + ensureActive(); if (op == Qt::ReplaceClip) { @@ -1947,6 +1957,8 @@ void QGL2PaintEngineExPrivate::systemStateChanged() { Q_Q(QGL2PaintEngineEx); + q->state()->clipChanged = true; + if (systemClip.isEmpty()) { use_system_clip = false; } else { @@ -2005,21 +2017,28 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state) return; } - renderHintsChanged(); + if (old_state == s || s->renderHintsChanged) + renderHintsChanged(); - d->matrixDirty = true; - d->compositionModeDirty = true; - d->simpleShaderMatrixUniformDirty = true; - d->shaderMatrixUniformDirty = true; - d->opacityUniformDirty = true; + if (old_state == s || s->matrixChanged) { + d->matrixDirty = true; + d->simpleShaderMatrixUniformDirty = true; + d->shaderMatrixUniformDirty = true; + } - d->shaderManager->setDirty(); + if (old_state == s || s->compositionModeChanged) + d->compositionModeDirty = true; - if (old_state && old_state != s && old_state->canRestoreClip) { - d->updateClipScissorTest(); - glDepthFunc(GL_LEQUAL); - } else { - d->regenerateClip(); + if (old_state == s || s->opacityChanged) + d->opacityUniformDirty = true; + + if (old_state == s || s->clipChanged) { + if (old_state && old_state != s && old_state->canRestoreClip) { + d->updateClipScissorTest(); + glDepthFunc(GL_LEQUAL); + } else { + d->regenerateClip(); + } } } @@ -2036,6 +2055,12 @@ QPainterState *QGL2PaintEngineEx::createState(QPainterState *orig) const else s = new QOpenGL2PaintEngineState(*static_cast(orig)); + s->matrixChanged = false; + s->compositionModeChanged = false; + s->opacityChanged = false; + s->renderHintsChanged = false; + s->clipChanged = false; + d->last_created_state = s; return s; } @@ -2051,7 +2076,6 @@ QOpenGL2PaintEngineState::QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &oth { needsClipBufferClear = other.needsClipBufferClear; clipTestEnabled = other.clipTestEnabled; - scissorTestEnabled = other.scissorTestEnabled; currentClip = other.currentClip; canRestoreClip = other.canRestoreClip; rectangleClip = other.rectangleClip; diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 662911f..28c972e 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -82,13 +82,16 @@ public: QOpenGL2PaintEngineState(); ~QOpenGL2PaintEngineState(); - bool needsClipBufferClear; + uint needsClipBufferClear : 1; + uint clipTestEnabled : 1; + uint canRestoreClip : 1; + uint matrixChanged : 1; + uint compositionModeChanged : 1; + uint opacityChanged : 1; + uint renderHintsChanged : 1; + uint clipChanged : 1; + uint currentClip : 8; - bool clipTestEnabled; - bool scissorTestEnabled; - uint currentClip; - - bool canRestoreClip; QRect rectangleClip; }; -- cgit v0.12 From dab2fdd3b3ac147ff251102b20dc0dca3a97bb92 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 6 Oct 2009 18:05:17 +0200 Subject: Prevent OK key being processed twice in file dialog (keypad navigation) All key events were being explicitly ignored by the file dialog when key navigation is enabled, and it doesn't have edit focus. When a file is opened by pressing the OK key, there is no edit focus after returning from accept() and the OK key can propagate outside the modal dialog. This causes the parent widget to receive and act upon the OK key as well which makes problems - e.g. in QTBUG-4724, recursive menu activation Task-number: QTBUG-4724 Reviewed-by: Alessandro Portale (cherry picked from commit 28cdb974cce58111a19e8691f4dd929a5c9f74ea) --- src/gui/dialogs/qfiledialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index eb5fed0..eab842f 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -3149,7 +3149,7 @@ void QFileDialogListView::keyPressEvent(QKeyEvent *e) QListView::keyPressEvent(e); } #ifdef QT_KEYPAD_NAVIGATION - if ((QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder + else if ((QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder || QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) && !hasEditFocus()) { e->ignore(); -- cgit v0.12 From c79aff03f9f4660110ae5e38281d50ff86433ba6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 6 Oct 2009 20:46:39 +0200 Subject: API review: change function name to setUseSystemConfiguration. Requested-By: Volker Hilsheimer (cherry picked from commit ffeb69003a9c676064cdf7ec099a02c2fbcf2ad3) --- src/network/kernel/qnetworkproxy.cpp | 4 ++-- src/network/kernel/qnetworkproxy.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index 7f40134..2d5c74f 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -1166,12 +1166,12 @@ QNetworkProxyFactory::~QNetworkProxyFactory() sets an application-wide proxy factory. For this reason, this method is mutually exclusive with setApplicationProxyFactory: calling setApplicationProxyFactory overrides the use of the system-wide proxy, - and calling setUseSystemConfigurationEnabled overrides any + and calling setUseSystemConfiguration overrides any application proxy or proxy factory that was previously set. \since 4.6 */ -void QNetworkProxyFactory::setUseSystemConfigurationEnabled(bool enable) +void QNetworkProxyFactory::setUseSystemConfiguration(bool enable) { if (enable) { setApplicationProxyFactory(new QSystemConfigurationProxyFactory); diff --git a/src/network/kernel/qnetworkproxy.h b/src/network/kernel/qnetworkproxy.h index 6357c64..68bd6fd 100644 --- a/src/network/kernel/qnetworkproxy.h +++ b/src/network/kernel/qnetworkproxy.h @@ -171,7 +171,7 @@ public: virtual QList queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery()) = 0; - static void setUseSystemConfigurationEnabled(bool enable); + static void setUseSystemConfiguration(bool enable); static void setApplicationProxyFactory(QNetworkProxyFactory *factory); static QList proxyForQuery(const QNetworkProxyQuery &query); static QList systemProxyForQuery(const QNetworkProxyQuery &query = QNetworkProxyQuery()); -- cgit v0.12 From d6e41c42b790774a7c29566edc849efaa2e37f73 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 6 Oct 2009 20:47:52 +0200 Subject: Autotest: use port 12346 instead of 1, to ensure that it's not a firewall issue Also check if we're not timing out instead of being able to fail. (cherry picked from commit 9cf618492d1c89b489bf7e52e45c9577f9d52c1c) --- tests/auto/networkselftest/tst_networkselftest.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp index 4e60101..083eee3 100644 --- a/tests/auto/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/networkselftest/tst_networkselftest.cpp @@ -357,10 +357,15 @@ void tst_NetworkSelfTest::dnsResolution() void tst_NetworkSelfTest::serverReachability() { - // check that we get a proper error connecting to port 1 + // check that we get a proper error connecting to port 12346 QTcpSocket socket; - socket.connectToHost(QtNetworkSettings::serverName(), 1); + socket.connectToHost(QtNetworkSettings::serverName(), 12346); + + QTime timer; + timer.start(); socket.waitForConnected(10000); + QVERIFY2(timer.elapsed() < 9900, "Connection to closed port timed out instead of refusing, something is wrong"); + QVERIFY2(socket.state() == QAbstractSocket::UnconnectedState, "Socket connected unexpectedly!"); QVERIFY2(socket.error() == QAbstractSocket::ConnectionRefusedError, QString("Could not reach server: %1").arg(socket.errorString()).toLocal8Bit()); -- cgit v0.12 From c6bd9f0fbc254e723b4afbfb4222bb4e31f63a9d Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 7 Oct 2009 13:09:38 +1000 Subject: Autotest: add a few more tests, with IP address and actual hostname (cherry picked from commit d47b7e6d0adcd675ba9da11818b3fa9acc3caff5) Conflicts: tests/auto/networkselftest/tst_networkselftest.cpp --- tests/auto/networkselftest/tst_networkselftest.cpp | 77 ++++++++++++++++++++-- 1 file changed, 73 insertions(+), 4 deletions(-) diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp index 083eee3..d58402b 100644 --- a/tests/auto/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/networkselftest/tst_networkselftest.cpp @@ -54,10 +54,13 @@ class tst_NetworkSelfTest: public QObject { Q_OBJECT + QHostAddress cachedIpAddress; public: tst_NetworkSelfTest(); virtual ~tst_NetworkSelfTest(); + QHostAddress serverIpAddress(); + private slots: void hostTest(); void dnsResolution_data(); @@ -325,6 +328,16 @@ tst_NetworkSelfTest::~tst_NetworkSelfTest() { } +QHostAddress tst_NetworkSelfTest::serverIpAddress() +{ + if (cachedIpAddress.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol) { + // need resolving + QHostInfo resolved = QHostInfo::fromName(QtNetworkSettings::serverName()); + cachedIpAddress = resolved.addresses().first(); + } + return cachedIpAddress; +} + void tst_NetworkSelfTest::hostTest() { // this is a localhost self-test @@ -353,6 +366,9 @@ void tst_NetworkSelfTest::dnsResolution() QHostInfo resolved = QHostInfo::fromName(hostName); QVERIFY2(resolved.error() == QHostInfo::NoError, QString("Failed to resolve hostname %1: %2").arg(hostName, resolved.errorString()).toLocal8Bit()); + QVERIFY2(resolved.addresses().size() > 0, "Got 0 addresses for server IP"); + + cachedIpAddress = resolved.addresses().first(); } void tst_NetworkSelfTest::serverReachability() @@ -521,7 +537,18 @@ void tst_NetworkSelfTest::httpsServer() void tst_NetworkSelfTest::httpProxy() { netChat(3128, QList() - // proxy GET + // proxy GET by IP + << Chat::send("GET http://" + serverIpAddress().toString().toLatin1() + "/ HTTP/1.0\r\n" + "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" + "Proxy-connection: close\r\n" + "\r\n") + << Chat::expect("HTTP/1.") + << Chat::discardUntil(" ") + << Chat::expect("200 ") + << Chat::DiscardUntilDisconnect + + // proxy GET by hostname + << Chat::Reconnect << Chat::send("GET http://" + QtNetworkSettings::serverName().toLatin1() + "/ HTTP/1.0\r\n" "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" "Proxy-connection: close\r\n" @@ -531,7 +558,17 @@ void tst_NetworkSelfTest::httpProxy() << Chat::expect("200 ") << Chat::DiscardUntilDisconnect - // proxy CONNECT + // proxy CONNECT by IP + << Chat::Reconnect + << Chat::send("CONNECT " + serverIpAddress().toString().toLatin1() + ":21 HTTP/1.0\r\n" + "\r\n") + << Chat::expect("HTTP/1.") + << Chat::discardUntil(" ") + << Chat::expect("200 ") + << Chat::discardUntil("\r\n\r\n") + << ftpChat() + + // proxy CONNECT by hostname << Chat::Reconnect << Chat::send("CONNECT " + QtNetworkSettings::serverName().toLatin1() + ":21 HTTP/1.0\r\n" "\r\n") @@ -539,7 +576,8 @@ void tst_NetworkSelfTest::httpProxy() << Chat::discardUntil(" ") << Chat::expect("200 ") << Chat::discardUntil("\r\n\r\n") - << ftpChat()); + << ftpChat() + ); } void tst_NetworkSelfTest::httpProxyBasicAuth() @@ -596,11 +634,22 @@ static const char handshakeAuthPassword[] = "\5\1\2\1\12qsockstest\10password"; static const char handshakeOkPasswdAuth[] = "\5\2\1\0"; static const char handshakeAuthNotOk[] = "\5\377"; static const char connect1[] = "\5\1\0\1\177\0\0\1\0\25"; // Connect IPv4 127.0.0.1 port 21 +static const char connect1a[] = "\5\1\0\1"; // just "Connect to IPv4" +static const char connect1b[] = "\0\25"; // just "port 21" static const char connect2[] = "\5\1\0\3\11localhost\0\25"; // Connect hostname localhost 21 +static const char connect2a[] = "\5\1\0\3"; // just "Connect to hostname" static const char connected[] = "\5\0\0"; +#define QBA(x) (QByteArray::fromRawData(x, -1 + sizeof(x))) + void tst_NetworkSelfTest::socks5Proxy() { + union { + char buf[4]; + quint32 data; + } ip4Address; + ip4Address.data = qToBigEndian(serverIpAddress().toIPv4Address()); + netChat(1080, QList() // IP address connection << Chat::send(QByteArray(handshakeNoAuth, -1 + sizeof handshakeNoAuth)) @@ -611,7 +660,17 @@ void tst_NetworkSelfTest::socks5Proxy() << Chat::skipBytes(6) // the server's local address and port << ftpChat() - // hostname connection + // connect by IP + << Chat::Reconnect + << Chat::send(QByteArray(handshakeNoAuth, -1 + sizeof handshakeNoAuth)) + << Chat::expect(QByteArray(handshakeOkNoAuth, -1 + sizeof handshakeOkNoAuth)) + << Chat::send(QBA(connect1a) + QByteArray::fromRawData(ip4Address.buf, 4) + QBA(connect1b)) + << Chat::expect(QByteArray(connected, -1 + sizeof connected)) + << Chat::expect("\1") // IPv4 address following + << Chat::skipBytes(6) // the server's local address and port + << ftpChat() + + // connect to "localhost" by hostname << Chat::Reconnect << Chat::send(QByteArray(handshakeNoAuth, -1 + sizeof handshakeNoAuth)) << Chat::expect(QByteArray(handshakeOkNoAuth, -1 + sizeof handshakeOkNoAuth)) @@ -620,6 +679,16 @@ void tst_NetworkSelfTest::socks5Proxy() << Chat::expect("\1") // IPv4 address following << Chat::skipBytes(6) // the server's local address and port << ftpChat() + + // connect to server by its official name + << Chat::Reconnect + << Chat::send(QByteArray(handshakeNoAuth, -1 + sizeof handshakeNoAuth)) + << Chat::expect(QByteArray(handshakeOkNoAuth, -1 + sizeof handshakeOkNoAuth)) + << Chat::send(QBA(connect2a) + char(QtNetworkSettings::serverName().size()) + QtNetworkSettings::serverName().toLatin1() + QBA(connect1b)) + << Chat::expect(QByteArray(connected, -1 + sizeof connected)) + << Chat::expect("\1") // IPv4 address following + << Chat::skipBytes(6) // the server's local address and port + << ftpChat() ); } -- cgit v0.12 From 49f1dcec6639e2f2069c0994a351457b5b333ce0 Mon Sep 17 00:00:00 2001 From: Iain Date: Tue, 6 Oct 2009 21:34:10 +0200 Subject: Update EABI DEF files for Symbian OS Reviewed-by: TrustMe (cherry picked from commit 2d2b4e8a77a30449d8b4ebc88979b3aff45a8222) --- src/s60installs/eabi/QtCoreu.def | 60 ++++++++++++--------- src/s60installs/eabi/QtGuiu.def | 105 +++++++++++++++++++++++++++++++++--- src/s60installs/eabi/QtNetworku.def | 4 +- src/s60installs/eabi/QtScriptu.def | 26 ++++++--- src/s60installs/eabi/QtSqlu.def | 2 +- 5 files changed, 157 insertions(+), 40 deletions(-) diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index d795a62..dda89fd 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -3206,11 +3206,11 @@ EXPORTS _ZN12QEasingCurveD1Ev @ 3205 NONAME _ZN12QEasingCurveD2Ev @ 3206 NONAME _ZN12QEasingCurveaSERKS_ @ 3207 NONAME - _ZN12QSignalEventC1EP7QObjectiRK5QListI8QVariantE @ 3208 NONAME - _ZN12QSignalEventC2EP7QObjectiRK5QListI8QVariantE @ 3209 NONAME - _ZN12QSignalEventD0Ev @ 3210 NONAME - _ZN12QSignalEventD1Ev @ 3211 NONAME - _ZN12QSignalEventD2Ev @ 3212 NONAME + _ZN12QSignalEventC1EP7QObjectiRK5QListI8QVariantE @ 3208 NONAME ABSENT + _ZN12QSignalEventC2EP7QObjectiRK5QListI8QVariantE @ 3209 NONAME ABSENT + _ZN12QSignalEventD0Ev @ 3210 NONAME ABSENT + _ZN12QSignalEventD1Ev @ 3211 NONAME ABSENT + _ZN12QSignalEventD2Ev @ 3212 NONAME ABSENT _ZN13QHistoryState11qt_metacallEN11QMetaObject4CallEiPPv @ 3213 NONAME _ZN13QHistoryState11qt_metacastEPKc @ 3214 NONAME _ZN13QHistoryState14setHistoryTypeENS_11HistoryTypeE @ 3215 NONAME @@ -3234,7 +3234,7 @@ EXPORTS _ZN13QStateMachine12endMicrostepEP6QEvent @ 3233 NONAME _ZN13QStateMachine14beginMicrostepEP6QEvent @ 3234 NONAME _ZN13QStateMachine16staticMetaObjectE @ 3235 NONAME DATA 16 - _ZN13QStateMachine17postInternalEventEP6QEvent @ 3236 NONAME + _ZN13QStateMachine17postInternalEventEP6QEvent @ 3236 NONAME ABSENT _ZN13QStateMachine19addDefaultAnimationEP18QAbstractAnimation @ 3237 NONAME _ZN13QStateMachine20endSelectTransitionsEP6QEvent @ 3238 NONAME _ZN13QStateMachine20setAnimationsEnabledEb @ 3239 NONAME @@ -3249,7 +3249,7 @@ EXPORTS _ZN13QStateMachine7startedEv @ 3248 NONAME _ZN13QStateMachine7stoppedEv @ 3249 NONAME _ZN13QStateMachine8addStateEP14QAbstractState @ 3250 NONAME - _ZN13QStateMachine9postEventEP6QEventi @ 3251 NONAME + _ZN13QStateMachine9postEventEP6QEventi @ 3251 NONAME ABSENT _ZN13QStateMachineC1EP7QObject @ 3252 NONAME _ZN13QStateMachineC1ER20QStateMachinePrivateP7QObject @ 3253 NONAME _ZN13QStateMachineC2EP7QObject @ 3254 NONAME @@ -3265,11 +3265,11 @@ EXPORTS _ZN13QStatePrivateD1Ev @ 3264 NONAME _ZN13QStatePrivateD2Ev @ 3265 NONAME _ZN13QUnifiedTimer8instanceEv @ 3266 NONAME - _ZN13QWrappedEventC1EP7QObjectP6QEvent @ 3267 NONAME - _ZN13QWrappedEventC2EP7QObjectP6QEvent @ 3268 NONAME - _ZN13QWrappedEventD0Ev @ 3269 NONAME - _ZN13QWrappedEventD1Ev @ 3270 NONAME - _ZN13QWrappedEventD2Ev @ 3271 NONAME + _ZN13QWrappedEventC1EP7QObjectP6QEvent @ 3267 NONAME ABSENT + _ZN13QWrappedEventC2EP7QObjectP6QEvent @ 3268 NONAME ABSENT + _ZN13QWrappedEventD0Ev @ 3269 NONAME ABSENT + _ZN13QWrappedEventD1Ev @ 3270 NONAME ABSENT + _ZN13QWrappedEventD2Ev @ 3271 NONAME ABSENT _ZN14QAbstractState11qt_metacallEN11QMetaObject4CallEiPPv @ 3272 NONAME _ZN14QAbstractState11qt_metacastEPKc @ 3273 NONAME _ZN14QAbstractState16staticMetaObjectE @ 3274 NONAME DATA 16 @@ -3299,7 +3299,7 @@ EXPORTS _ZN15QPauseAnimation11qt_metacastEPKc @ 3298 NONAME _ZN15QPauseAnimation11setDurationEi @ 3299 NONAME _ZN15QPauseAnimation16staticMetaObjectE @ 3300 NONAME DATA 16 - _ZN15QPauseAnimation17updateCurrentTimeEi @ 3301 NONAME ABSENT + _ZN15QPauseAnimation17updateCurrentTimeEi @ 3301 NONAME _ZN15QPauseAnimation5eventEP6QEvent @ 3302 NONAME _ZN15QPauseAnimationC1EP7QObject @ 3303 NONAME _ZN15QPauseAnimationC1EiP7QObject @ 3304 NONAME @@ -3361,7 +3361,7 @@ EXPORTS _ZN17QVariantAnimation13setStartValueERK8QVariant @ 3360 NONAME _ZN17QVariantAnimation14setEasingCurveERK12QEasingCurve @ 3361 NONAME _ZN17QVariantAnimation16staticMetaObjectE @ 3362 NONAME DATA 16 - _ZN17QVariantAnimation17updateCurrentTimeEi @ 3363 NONAME ABSENT + _ZN17QVariantAnimation17updateCurrentTimeEi @ 3363 NONAME _ZN17QVariantAnimation20registerInterpolatorEPF8QVariantPKvS2_fEi @ 3364 NONAME _ZN17QVariantAnimation5eventEP6QEvent @ 3365 NONAME _ZN17QVariantAnimationC2EP7QObject @ 3366 NONAME @@ -3430,7 +3430,7 @@ EXPORTS _ZN20QStateMachinePrivate14isDescendantOfEPK14QAbstractStateS2_ @ 3429 NONAME _ZN20QStateMachinePrivate15applyPropertiesERK5QListIP19QAbstractTransitionERKS0_IP14QAbstractStateESA_ @ 3430 NONAME _ZN20QStateMachinePrivate15properAncestorsEPK14QAbstractStatePK6QState @ 3431 NONAME - _ZN20QStateMachinePrivate15scheduleProcessEv @ 3432 NONAME + _ZN20QStateMachinePrivate15scheduleProcessEv @ 3432 NONAME ABSENT _ZN20QStateMachinePrivate16addStatesToEnterEP14QAbstractStateP6QStateR4QSetIS1_ES6_ @ 3433 NONAME _ZN20QStateMachinePrivate16removeStartStateEv @ 3434 NONAME _ZN20QStateMachinePrivate17stateExitLessThanEP14QAbstractStateS1_ @ 3435 NONAME @@ -3470,7 +3470,7 @@ EXPORTS _ZN23QParallelAnimationGroup11updateStateEN18QAbstractAnimation5StateES1_ @ 3469 NONAME _ZN23QParallelAnimationGroup15updateDirectionEN18QAbstractAnimation9DirectionE @ 3470 NONAME _ZN23QParallelAnimationGroup16staticMetaObjectE @ 3471 NONAME DATA 16 - _ZN23QParallelAnimationGroup17updateCurrentTimeEi @ 3472 NONAME ABSENT + _ZN23QParallelAnimationGroup17updateCurrentTimeEi @ 3472 NONAME _ZN23QParallelAnimationGroup5eventEP6QEvent @ 3473 NONAME _ZN23QParallelAnimationGroupC1EP7QObject @ 3474 NONAME _ZN23QParallelAnimationGroupC1ER30QParallelAnimationGroupPrivateP7QObject @ 3475 NONAME @@ -3498,7 +3498,7 @@ EXPORTS _ZN25QSequentialAnimationGroup13insertPauseAtEii @ 3497 NONAME _ZN25QSequentialAnimationGroup15updateDirectionEN18QAbstractAnimation9DirectionE @ 3498 NONAME _ZN25QSequentialAnimationGroup16staticMetaObjectE @ 3499 NONAME DATA 16 - _ZN25QSequentialAnimationGroup17updateCurrentTimeEi @ 3500 NONAME ABSENT + _ZN25QSequentialAnimationGroup17updateCurrentTimeEi @ 3500 NONAME _ZN25QSequentialAnimationGroup23currentAnimationChangedEP18QAbstractAnimation @ 3501 NONAME _ZN25QSequentialAnimationGroup5eventEP6QEvent @ 3502 NONAME _ZN25QSequentialAnimationGroup8addPauseEi @ 3503 NONAME @@ -3648,11 +3648,11 @@ EXPORTS _ZNK8QVariant7toFloatEPb @ 3647 NONAME _ZNK9QTimeLine11easingCurveEv @ 3648 NONAME _ZTI11QFinalState @ 3649 NONAME - _ZTI12QSignalEvent @ 3650 NONAME + _ZTI12QSignalEvent @ 3650 NONAME ABSENT _ZTI13QHistoryState @ 3651 NONAME _ZTI13QStateMachine @ 3652 NONAME _ZTI13QStatePrivate @ 3653 NONAME - _ZTI13QWrappedEvent @ 3654 NONAME + _ZTI13QWrappedEvent @ 3654 NONAME ABSENT _ZTI14QAbstractState @ 3655 NONAME _ZTI15QAnimationGroup @ 3656 NONAME _ZTI15QPauseAnimation @ 3657 NONAME @@ -3671,11 +3671,11 @@ EXPORTS _ZTI26QAbstractTransitionPrivate @ 3670 NONAME _ZTI6QState @ 3671 NONAME _ZTV11QFinalState @ 3672 NONAME - _ZTV12QSignalEvent @ 3673 NONAME + _ZTV12QSignalEvent @ 3673 NONAME ABSENT _ZTV13QHistoryState @ 3674 NONAME _ZTV13QStateMachine @ 3675 NONAME _ZTV13QStatePrivate @ 3676 NONAME - _ZTV13QWrappedEvent @ 3677 NONAME + _ZTV13QWrappedEvent @ 3677 NONAME ABSENT _ZTV14QAbstractState @ 3678 NONAME _ZTV15QAnimationGroup @ 3679 NONAME _ZTV15QPauseAnimation @ 3680 NONAME @@ -3820,8 +3820,18 @@ EXPORTS _ZTV37QNonContiguousByteDeviceByteArrayImpl @ 3819 NONAME ABSENT ; ## _ZTV38QNonContiguousByteDeviceRingBufferImpl @ 3820 NONAME ABSENT ; ## _Zls6QDebugRK8QMargins @ 3821 NONAME - _ZN15QPauseAnimation17updateCurrentTimeEv @ 3822 NONAME - _ZN17QVariantAnimation17updateCurrentTimeEv @ 3823 NONAME - _ZN23QParallelAnimationGroup17updateCurrentTimeEv @ 3824 NONAME - _ZN25QSequentialAnimationGroup17updateCurrentTimeEv @ 3825 NONAME + _ZN15QPauseAnimation17updateCurrentTimeEv @ 3822 NONAME ABSENT + _ZN17QVariantAnimation17updateCurrentTimeEv @ 3823 NONAME ABSENT + _ZN23QParallelAnimationGroup17updateCurrentTimeEv @ 3824 NONAME ABSENT + _ZN25QSequentialAnimationGroup17updateCurrentTimeEv @ 3825 NONAME ABSENT + _ZN11QDataStream25setFloatingPointPrecisionENS_22FloatingPointPrecisionE @ 3826 NONAME + _ZN13QStateMachine16postDelayedEventEP6QEventi @ 3827 NONAME + _ZN13QStateMachine18cancelDelayedEventEi @ 3828 NONAME + _ZN13QStateMachine9postEventEP6QEventNS_13EventPriorityE @ 3829 NONAME + _ZN20QStateMachinePrivate13processEventsENS_19EventProcessingModeE @ 3830 NONAME + _ZN20QStateMachinePrivate19handleFilteredEventEP7QObjectP6QEvent @ 3831 NONAME + _ZN20QStateMachinePrivate22cancelAllDelayedEventsEv @ 3832 NONAME + _ZN4QUrl13fromUserInputERK7QString @ 3833 NONAME + _ZNK11QDataStream22floatingPointPrecisionEv @ 3834 NONAME + qt_sine_table @ 3835 NONAME DATA 1024 diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index aad8b68..581d3bc 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -11631,7 +11631,7 @@ EXPORTS qt_pixmap_cleanup_hook @ 11630 NONAME DATA 4 qt_pixmap_cleanup_hook_64 @ 11631 NONAME DATA 4 qt_tab_all_widgets @ 11632 NONAME DATA 1 - _Z17qDrawBorderPixmapP8QPainterRK5QRectRK8QMarginsRK7QPixmapS3_S6_RK10QTileRules @ 11633 NONAME + _Z17qDrawBorderPixmapP8QPainterRK5QRectRK8QMarginsRK7QPixmapS3_S6_RK10QTileRules @ 11633 NONAME ABSENT _Z17qHasPixmapTextureRK6QBrush @ 11634 NONAME _Z22qt_setQtEnableTestFontb @ 11635 NONAME _Z25qt_translateRawTouchEventP7QWidgetN11QTouchEvent10DeviceTypeERK5QListINS1_10TouchPointEE @ 11636 NONAME @@ -11824,7 +11824,7 @@ EXPORTS _ZN14QPaintEngineExC2Ev @ 11823 NONAME _ZN14QWidgetPrivate10allWidgetsE @ 11824 NONAME DATA 4 _ZN14QWidgetPrivate13setWSGeometryEbRK5QRect @ 11825 NONAME - _ZN14QWidgetPrivate33handleSymbianDeferredFocusChangedEv @ 11826 NONAME + _ZN14QWidgetPrivate33handleSymbianDeferredFocusChangedEv @ 11826 NONAME ABSENT _ZN15QDockAreaLayout13separatorMoveERK5QListIiERK6QPointS6_ @ 11827 NONAME _ZN15QDockAreaLayout4infoERK5QListIiE @ 11828 NONAME _ZN15QDockAreaLayout4itemERK5QListIiE @ 11829 NONAME @@ -12984,9 +12984,9 @@ EXPORTS _ZN16QS60MainDocumentD0Ev @ 12983 NONAME _ZN16QS60MainDocumentD1Ev @ 12984 NONAME _ZN16QS60MainDocumentD2Ev @ 12985 NONAME - _ZN17QPixmapBlurFilter11setBlurHintENS_8BlurHintE @ 12986 NONAME - _ZN19QGraphicsBlurEffect11setBlurHintENS_8BlurHintE @ 12987 NONAME - _ZN19QGraphicsBlurEffect15blurHintChangedENS_8BlurHintE @ 12988 NONAME + _ZN17QPixmapBlurFilter11setBlurHintENS_8BlurHintE @ 12986 NONAME ABSENT + _ZN19QGraphicsBlurEffect11setBlurHintENS_8BlurHintE @ 12987 NONAME ABSENT + _ZN19QGraphicsBlurEffect15blurHintChangedENS_8BlurHintE @ 12988 NONAME ABSENT _ZN19QS60MainApplication15CreateDocumentLEv @ 12989 NONAME _ZN19QS60MainApplicationC1Ev @ 12990 NONAME _ZN19QS60MainApplicationC2Ev @ 12991 NONAME @@ -13001,7 +13001,7 @@ EXPORTS _ZNK19QGraphicsBlurEffect8blurHintEv @ 13000 NONAME _ZNK19QS60MainApplication16ResourceFileNameEv @ 13001 NONAME _ZNK19QS60MainApplication9AppDllUidEv @ 13002 NONAME - _ZNK21QGraphicsAnchorLayout12hasConflictsEv @ 13003 NONAME + _ZNK21QGraphicsAnchorLayout12hasConflictsEv @ 13003 NONAME ABSENT _ZNK7QPixmap17toSymbianRSgImageEv @ 13004 NONAME _ZTI15QSoftKeyManager @ 13005 NONAME _ZTV15QSoftKeyManager @ 13006 NONAME @@ -13009,4 +13009,97 @@ EXPORTS _ZThn24_N13QS60MainAppUi15DynInitMenuBarLEiP11CEikMenuBar @ 13008 NONAME _ZThn24_N13QS60MainAppUi16DynInitMenuPaneLEiP12CEikMenuPane @ 13009 NONAME _ZThn88_N13QS60MainAppUi26HandleStatusPaneSizeChangeEv @ 13010 NONAME + _Z12qDrawPixmapsP8QPainterPKN12QDrawPixmaps4DataEiRK7QPixmap6QFlagsINS1_11DrawingHintEE @ 13011 NONAME + _Z17qDrawBorderPixmapP8QPainterRK5QRectRK8QMarginsRK7QPixmapS3_S6_RK10QTileRules6QFlagsIN17QDrawBorderPixmap11DrawingHintEE @ 13012 NONAME + _ZN10QImageData6createEPhiiiN6QImage6FormatEb @ 13013 NONAME + _ZN10QImageData6createERK5QSizeN6QImage6FormatEi @ 13014 NONAME + _ZN10QImageDataC1Ev @ 13015 NONAME + _ZN10QImageDataC2Ev @ 13016 NONAME + _ZN10QImageDataD1Ev @ 13017 NONAME + _ZN10QImageDataD2Ev @ 13018 NONAME + _ZN13QGraphicsItem11stackBeforeEPKS_ @ 13019 NONAME + _ZN13QGraphicsItem16setPanelModalityENS_13PanelModalityE @ 13020 NONAME + _ZN14QPaintEngineEx11drawPixmapsEPKN12QDrawPixmaps4DataEiRK7QPixmap6QFlagsINS0_11DrawingHintEE @ 13021 NONAME + _ZN14QWidgetPrivate21activateSymbianWindowEv @ 13022 NONAME + _ZN17QAbstractItemView20setDefaultDropActionEN2Qt10DropActionE @ 13023 NONAME + _ZN17QPixmapBlurFilter11setBlurHintEN2Qt10RenderHintE @ 13024 NONAME + _ZN19QApplicationPrivate16load_testabilityE @ 13025 NONAME DATA 1 + _ZN19QGraphicsBlurEffect11setBlurHintEN2Qt10RenderHintE @ 13026 NONAME + _ZN19QGraphicsBlurEffect15blurHintChangedEN2Qt10RenderHintE @ 13027 NONAME + _ZN20QGraphicsBloomEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 13028 NONAME + _ZN20QGraphicsBloomEffect11qt_metacastEPKc @ 13029 NONAME + _ZN20QGraphicsBloomEffect11setBlurHintEN2Qt10RenderHintE @ 13030 NONAME + _ZN20QGraphicsBloomEffect11setStrengthEf @ 13031 NONAME + _ZN20QGraphicsBloomEffect13setBlurRadiusEi @ 13032 NONAME + _ZN20QGraphicsBloomEffect13setBrightnessEi @ 13033 NONAME + _ZN20QGraphicsBloomEffect15blurHintChangedEN2Qt10RenderHintE @ 13034 NONAME + _ZN20QGraphicsBloomEffect15strengthChangedEf @ 13035 NONAME + _ZN20QGraphicsBloomEffect16staticMetaObjectE @ 13036 NONAME DATA 16 + _ZN20QGraphicsBloomEffect17blurRadiusChangedEi @ 13037 NONAME + _ZN20QGraphicsBloomEffect17brightnessChangedEi @ 13038 NONAME + _ZN20QGraphicsBloomEffect19getStaticMetaObjectEv @ 13039 NONAME + _ZN20QGraphicsBloomEffect4drawEP8QPainterP21QGraphicsEffectSource @ 13040 NONAME + _ZN20QGraphicsBloomEffectC1EP7QObject @ 13041 NONAME + _ZN20QGraphicsBloomEffectC2EP7QObject @ 13042 NONAME + _ZN20QGraphicsBloomEffectD0Ev @ 13043 NONAME + _ZN20QGraphicsBloomEffectD1Ev @ 13044 NONAME + _ZN20QGraphicsBloomEffectD2Ev @ 13045 NONAME + _ZN20QGraphicsItemPrivate28ensureSequentialSiblingIndexEv @ 13046 NONAME + _ZN28QGraphicsAnchorLayoutPrivate11solveMinMaxE5QListIP18QSimplexConstraintE9GraphPathPfS5_ @ 13047 NONAME + _ZN28QGraphicsAnchorLayoutPrivate12oppositeEdgeEN2Qt11AnchorPointE @ 13048 NONAME + _ZN28QGraphicsAnchorLayoutPrivate12removeAnchorEP12AnchorVertexS1_ @ 13049 NONAME + _ZN28QGraphicsAnchorLayoutPrivate12removeVertexEP19QGraphicsLayoutItemN2Qt11AnchorPointE @ 13050 NONAME + _ZN28QGraphicsAnchorLayoutPrivate13getGraphPartsENS_11OrientationE @ 13051 NONAME + _ZN28QGraphicsAnchorLayoutPrivate13removeAnchorsEP19QGraphicsLayoutItem @ 13052 NONAME + _ZN28QGraphicsAnchorLayoutPrivate13setAnchorSizeEP10AnchorDataPKf @ 13053 NONAME + _ZN28QGraphicsAnchorLayoutPrivate13simplifyGraphENS_11OrientationE @ 13054 NONAME + _ZN28QGraphicsAnchorLayoutPrivate14solvePreferredE5QListIP18QSimplexConstraintE @ 13055 NONAME + _ZN28QGraphicsAnchorLayoutPrivate15calculateGraphsENS_11OrientationE @ 13056 NONAME + _ZN28QGraphicsAnchorLayoutPrivate15calculateGraphsEv @ 13057 NONAME + _ZN28QGraphicsAnchorLayoutPrivate15createItemEdgesEP19QGraphicsLayoutItem @ 13058 NONAME + _ZN28QGraphicsAnchorLayoutPrivate15edgeOrientationEN2Qt11AnchorPointE @ 13059 NONAME + _ZN28QGraphicsAnchorLayoutPrivate15interpolateEdgeEP12AnchorVertexP10AnchorDataNS_11OrientationE @ 13060 NONAME + _ZN28QGraphicsAnchorLayoutPrivate16addAnchor_helperEP19QGraphicsLayoutItemN2Qt11AnchorPointES1_S3_P10AnchorData @ 13061 NONAME + _ZN28QGraphicsAnchorLayoutPrivate17addInternalVertexEP19QGraphicsLayoutItemN2Qt11AnchorPointE @ 13062 NONAME + _ZN28QGraphicsAnchorLayoutPrivate17createLayoutEdgesEv @ 13063 NONAME + _ZN28QGraphicsAnchorLayoutPrivate17deleteLayoutEdgesEv @ 13064 NONAME + _ZN28QGraphicsAnchorLayoutPrivate18setItemsGeometriesERK6QRectF @ 13065 NONAME + _ZN28QGraphicsAnchorLayoutPrivate19createCenterAnchorsEP19QGraphicsLayoutItemN2Qt11AnchorPointE @ 13066 NONAME + _ZN28QGraphicsAnchorLayoutPrivate19removeAnchor_helperEP12AnchorVertexS1_ @ 13067 NONAME + _ZN28QGraphicsAnchorLayoutPrivate19removeCenterAnchorsEP19QGraphicsLayoutItemN2Qt11AnchorPointEb @ 13068 NONAME + _ZN28QGraphicsAnchorLayoutPrivate20constraintsFromPathsENS_11OrientationE @ 13069 NONAME + _ZN28QGraphicsAnchorLayoutPrivate20correctEdgeDirectionERP19QGraphicsLayoutItemRN2Qt11AnchorPointES2_S5_ @ 13070 NONAME + _ZN28QGraphicsAnchorLayoutPrivate20removeInternalVertexEP19QGraphicsLayoutItemN2Qt11AnchorPointE @ 13071 NONAME + _ZN28QGraphicsAnchorLayoutPrivate22restoreSimplifiedGraphENS_11OrientationE @ 13072 NONAME + _ZN28QGraphicsAnchorLayoutPrivate22simplifyGraphIterationENS_11OrientationE @ 13073 NONAME + _ZN28QGraphicsAnchorLayoutPrivate23removeCenterConstraintsEP19QGraphicsLayoutItemNS_11OrientationE @ 13074 NONAME + _ZN28QGraphicsAnchorLayoutPrivate23setupEdgesInterpolationENS_11OrientationE @ 13075 NONAME + _ZN28QGraphicsAnchorLayoutPrivate24calculateVertexPositionsENS_11OrientationE @ 13076 NONAME + _ZN28QGraphicsAnchorLayoutPrivate24constraintsFromSizeHintsERK5QListIP10AnchorDataE @ 13077 NONAME + _ZN28QGraphicsAnchorLayoutPrivate24interpolateParallelEdgesEP12AnchorVertexP18ParallelAnchorDataNS_11OrientationE @ 13078 NONAME + _ZN28QGraphicsAnchorLayoutPrivate26interpolateSequentialEdgesEP12AnchorVertexP20SequentialAnchorDataNS_11OrientationE @ 13079 NONAME + _ZN28QGraphicsAnchorLayoutPrivate27setAnchorSizeHintsFromItemsENS_11OrientationE @ 13080 NONAME + _ZN28QGraphicsAnchorLayoutPrivate9addAnchorEP19QGraphicsLayoutItemN2Qt11AnchorPointES1_S3_Pf @ 13081 NONAME + _ZN28QGraphicsAnchorLayoutPrivate9findPathsENS_11OrientationE @ 13082 NONAME + _ZN28QGraphicsAnchorLayoutPrivate9getAnchorEP19QGraphicsLayoutItemN2Qt11AnchorPointES1_S3_ @ 13083 NONAME + _ZN28QGraphicsAnchorLayoutPrivateC1Ev @ 13084 NONAME + _ZN28QGraphicsAnchorLayoutPrivateC2Ev @ 13085 NONAME + _ZNK10QImageData19checkForAlphaPixelsEv @ 13086 NONAME + _ZNK10QImageData9doImageIOEPK6QImageP12QImageWriteri @ 13087 NONAME + _ZNK13QGraphicsItem13panelModalityEv @ 13088 NONAME + _ZNK13QGraphicsItem21isBlockedByModalPanelEPPS_ @ 13089 NONAME + _ZNK17QAbstractItemView17defaultDropActionEv @ 13090 NONAME + _ZNK20QGraphicsBloomEffect10blurRadiusEv @ 13091 NONAME + _ZNK20QGraphicsBloomEffect10brightnessEv @ 13092 NONAME + _ZNK20QGraphicsBloomEffect10metaObjectEv @ 13093 NONAME + _ZNK20QGraphicsBloomEffect15boundingRectForERK6QRectF @ 13094 NONAME + _ZNK20QGraphicsBloomEffect8blurHintEv @ 13095 NONAME + _ZNK20QGraphicsBloomEffect8strengthEv @ 13096 NONAME + _ZNK28QGraphicsAnchorLayoutPrivate10anchorSizeEPK10AnchorDataPfS3_S3_ @ 13097 NONAME + _ZNK28QGraphicsAnchorLayoutPrivate12hasConflictsEv @ 13098 NONAME + _ZNK28QGraphicsAnchorLayoutPrivate16effectiveSpacingENS_11OrientationE @ 13099 NONAME + _ZTI20QGraphicsBloomEffect @ 13100 NONAME + _ZTI28QGraphicsAnchorLayoutPrivate @ 13101 NONAME + _ZTV20QGraphicsBloomEffect @ 13102 NONAME + _ZTV28QGraphicsAnchorLayoutPrivate @ 13103 NONAME diff --git a/src/s60installs/eabi/QtNetworku.def b/src/s60installs/eabi/QtNetworku.def index 5188872..ab4562c 100644 --- a/src/s60installs/eabi/QtNetworku.def +++ b/src/s60installs/eabi/QtNetworku.def @@ -1353,7 +1353,7 @@ EXPORTS _ZN10QSslSocket22connectToHostEncryptedERK7QStringtS2_6QFlagsIN9QIODevice12OpenModeFlagEE @ 1352 NONAME _ZN13QNetworkReply15ignoreSslErrorsERK5QListI9QSslErrorE @ 1353 NONAME _ZN15QAbstractSocket12socketOptionENS_12SocketOptionE @ 1354 NONAME - _ZN15QAbstractSocket15setSocketOptionENS_12SocketOptionE8QVariant @ 1355 NONAME + _ZN15QAbstractSocket15setSocketOptionENS_12SocketOptionERK8QVariant @ 1355 NONAME _ZN17QHttpNetworkReply15ignoreSslErrorsERK5QListI9QSslErrorE @ 1356 NONAME _ZN17QHttpNetworkReply16dataSendProgressExx @ 1357 NONAME _ZN17QHttpNetworkReply7readAnyEv @ 1358 NONAME @@ -1379,7 +1379,7 @@ EXPORTS _ZN19QHttpNetworkRequest20setPipeliningAllowedEb @ 1378 NONAME _ZN19QNativeSocketEngine19getStaticMetaObjectEv @ 1379 NONAME _ZN19QSocks5SocketEngine19getStaticMetaObjectEv @ 1380 NONAME - _ZN20QNetworkProxyFactory32setUseSystemConfigurationEnabledEb @ 1381 NONAME + _ZN20QNetworkProxyFactory25setUseSystemConfigurationEb @ 1381 NONAME _ZN21QAbstractNetworkCache19getStaticMetaObjectEv @ 1382 NONAME _ZN21QAbstractSocketEngine19getStaticMetaObjectEv @ 1383 NONAME _ZN21QNetworkAccessManager19getStaticMetaObjectEv @ 1384 NONAME diff --git a/src/s60installs/eabi/QtScriptu.def b/src/s60installs/eabi/QtScriptu.def index 40d3577..cca0a2a 100644 --- a/src/s60installs/eabi/QtScriptu.def +++ b/src/s60installs/eabi/QtScriptu.def @@ -1,6 +1,6 @@ EXPORTS _Z14qScriptConnectP7QObjectPKcRK12QScriptValueS5_ @ 1 NONAME - _Z14qt_scriptToXmlRK7QStringi @ 2 NONAME + _Z14qt_scriptToXmlRK7QStringi @ 2 NONAME ABSENT _Z17qScriptDisconnectP7QObjectPKcRK12QScriptValueS5_ @ 3 NONAME _ZN11QScriptableC1Ev @ 4 NONAME _ZN11QScriptableC2Ev @ 5 NONAME @@ -189,11 +189,11 @@ EXPORTS _ZN24QScriptSyntaxCheckResultD1Ev @ 188 NONAME _ZN24QScriptSyntaxCheckResultD2Ev @ 189 NONAME _ZN24QScriptSyntaxCheckResultaSERKS_ @ 190 NONAME - _ZN25QScriptEngineAgentPrivateC1Ev @ 191 NONAME - _ZN25QScriptEngineAgentPrivateC2Ev @ 192 NONAME - _ZN25QScriptEngineAgentPrivateD0Ev @ 193 NONAME - _ZN25QScriptEngineAgentPrivateD1Ev @ 194 NONAME - _ZN25QScriptEngineAgentPrivateD2Ev @ 195 NONAME + _ZN25QScriptEngineAgentPrivateC1Ev @ 191 NONAME ABSENT + _ZN25QScriptEngineAgentPrivateC2Ev @ 192 NONAME ABSENT + _ZN25QScriptEngineAgentPrivateD0Ev @ 193 NONAME ABSENT + _ZN25QScriptEngineAgentPrivateD1Ev @ 194 NONAME ABSENT + _ZN25QScriptEngineAgentPrivateD2Ev @ 195 NONAME ABSENT _ZN28QScriptClassPropertyIteratorC2ERK12QScriptValue @ 196 NONAME _ZN28QScriptClassPropertyIteratorC2ERK12QScriptValueR35QScriptClassPropertyIteratorPrivate @ 197 NONAME _ZN28QScriptClassPropertyIteratorD0Ev @ 198 NONAME @@ -586,4 +586,18 @@ EXPORTS _ZThn8_N22QScriptExtensionPluginD1Ev @ 585 NONAME _ZlsR11QDataStreamRK18QScriptContextInfo @ 586 NONAME _ZrsR11QDataStreamR18QScriptContextInfo @ 587 NONAME + _Z22qt_script_isJITEnabledv @ 588 NONAME + _ZN12QScriptValueC1EP19QScriptValuePrivate @ 589 NONAME + _ZN12QScriptValueC2EP19QScriptValuePrivate @ 590 NONAME + _ZN13QScriptEngine19getStaticMetaObjectEv @ 591 NONAME + _ZN22QScriptExtensionPlugin19getStaticMetaObjectEv @ 592 NONAME + _ZN25QScriptEngineAgentPrivate11atStatementERKN5QTJSC17DebuggerCallFrameEiii @ 593 NONAME + _ZN25QScriptEngineAgentPrivate11returnEventERKN5QTJSC17DebuggerCallFrameEii @ 594 NONAME + _ZN25QScriptEngineAgentPrivate12evaluateStopERKN5QTJSC7JSValueEi @ 595 NONAME + _ZN25QScriptEngineAgentPrivate12functionExitERKN5QTJSC7JSValueEi @ 596 NONAME + _ZN25QScriptEngineAgentPrivate14exceptionCatchERKN5QTJSC17DebuggerCallFrameEi @ 597 NONAME + _ZN25QScriptEngineAgentPrivate14exceptionThrowERKN5QTJSC17DebuggerCallFrameEib @ 598 NONAME + _ZN25QScriptEngineAgentPrivate18didReachBreakpointERKN5QTJSC17DebuggerCallFrameEiii @ 599 NONAME + _ZN25QScriptEngineAgentPrivate6attachEv @ 600 NONAME + _ZN25QScriptEngineAgentPrivate6detachEv @ 601 NONAME diff --git a/src/s60installs/eabi/QtSqlu.def b/src/s60installs/eabi/QtSqlu.def index 99f0d00..4d4791a 100644 --- a/src/s60installs/eabi/QtSqlu.def +++ b/src/s60installs/eabi/QtSqlu.def @@ -236,7 +236,7 @@ EXPORTS _ZN9QSqlFieldC1ERKS_ @ 235 NONAME _ZN9QSqlFieldC1Ev @ 236 NONAME ABSENT _ZN9QSqlFieldC2ERK7QString @ 237 NONAME ABSENT - _ZN9QSqlFieldC2ERK7QStringN8QVariant4TypeE @ 238 NONAME ABSENT + _ZN9QSqlFieldC2ERK7QStringN8QVariant4TypeE @ 238 NONAME _ZN9QSqlFieldC2ERKS_ @ 239 NONAME _ZN9QSqlFieldC2Ev @ 240 NONAME ABSENT _ZN9QSqlFieldD1Ev @ 241 NONAME -- cgit v0.12 From 2884599eff16ff7beffce41346776ae4b120301a Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Wed, 7 Oct 2009 08:40:14 +1000 Subject: Fixed thread lockup in win32 backend for QAudioOutput. -Was not closing the WaveOut on cleanup, fixed. -Was emitting signal in critical section, fixed. Reviewed-by:Bill King (cherry picked from commit 3865912d4a6c31a4981e1831e2af8d59f3eb4ac0) --- src/multimedia/audio/qaudiooutput_win32_p.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index ef4bf0e..2c4a1c2 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -189,7 +189,6 @@ void QAudioOutputPrivate::stop() { if(deviceState == QAudio::StopState) return; - deviceState = QAudio::StopState; close(); if(!pullMode && audioSource) { delete audioSource; @@ -465,13 +464,15 @@ bool QAudioOutputPrivate::deviceReady() } else if(l == 0) { bytesAvailable = bytesFree(); + int check = 0; EnterCriticalSection(&waveOutCriticalSection); - if(waveFreeBlockCount == buffer_size/period_size) { + check = waveFreeBlockCount; + LeaveCriticalSection(&waveOutCriticalSection); + if(check == buffer_size/period_size) { errorState = QAudio::UnderrunError; deviceState = QAudio::IdleState; emit stateChanged(deviceState); } - LeaveCriticalSection(&waveOutCriticalSection); } else if(l < 0) { bytesAvailable = bytesFree(); -- cgit v0.12 From 6e908ad7e5f0cc1b33393baa8c9cab04cdc793a8 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 7 Oct 2009 15:18:50 +1000 Subject: Fix build error introduced in change ffeb6900. Change ffeb6900 renamed a function but didn't rename all the calls. Reviewed-by: Trust Me (cherry picked from commit 8b7e766aa42739df8998ec9c1e94087b965ac87b) --- examples/webkit/fancybrowser/mainwindow.cpp | 2 +- examples/webkit/googlechat/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp index 2adfa20..a3293b8 100644 --- a/examples/webkit/fancybrowser/mainwindow.cpp +++ b/examples/webkit/fancybrowser/mainwindow.cpp @@ -56,7 +56,7 @@ MainWindow::MainWindow() file.close(); //! [1] - QNetworkProxyFactory::setUseSystemConfigurationEnabled(true); + QNetworkProxyFactory::setUseSystemConfiguration(true); //! [2] view = new QWebView(this); diff --git a/examples/webkit/googlechat/main.cpp b/examples/webkit/googlechat/main.cpp index fd08114..6b5e11f 100644 --- a/examples/webkit/googlechat/main.cpp +++ b/examples/webkit/googlechat/main.cpp @@ -47,7 +47,7 @@ int main(int argc, char * argv[]) { QApplication app(argc, argv); - QNetworkProxyFactory::setUseSystemConfigurationEnabled(true); + QNetworkProxyFactory::setUseSystemConfiguration(true); GoogleChat *chat = new GoogleChat; chat->show(); -- cgit v0.12 From 185581e0f0377c77f4cda07aa544d84e27271a2b Mon Sep 17 00:00:00 2001 From: Iain Date: Mon, 5 Oct 2009 13:14:55 +0200 Subject: Update self-signed certificate for Symbian, since the old one expired New certificate for using for self-signing. Updated some organisational details, gave this one a 10 year validity rather than a 1 year validity. Same private key as before. Reviewed-by: axis (cherry picked from commit 53ea5e98eab90ee9e3ae23e3b67e8993e6c2b31c) --- src/s60installs/selfsigned.cer | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/s60installs/selfsigned.cer b/src/s60installs/selfsigned.cer index af72449..95c94d5 100644 --- a/src/s60installs/selfsigned.cer +++ b/src/s60installs/selfsigned.cer @@ -1,10 +1,12 @@ -----BEGIN CERTIFICATE----- -MIIDFTCCAtOgAwIBAgIBADALBgcqhkjOOAQDBQAwcDELMAkGA1UEBhMCTk8xDjAM -BgNVBAoTBU5va2lhMRQwEgYDVQQLEwtRdCBTb2Z0d2FyZTEOMAwGA1UEAxMFVHJv -bGwxKzApBgkqhkiG9w0BCQEWHHF0czYwLWZlZWRiYWNrQHRyb2xsdGVjaC5jb20w -HhcNMDgxMDAzMTMwNDM1WhcNMDkxMDAzMTMwNDM1WjBwMQswCQYDVQQGEwJOTzEO -MAwGA1UEChMFTm9raWExFDASBgNVBAsTC1F0IFNvZnR3YXJlMQ4wDAYDVQQDEwVU -cm9sbDErMCkGCSqGSIb3DQEJARYccXRzNjAtZmVlZGJhY2tAdHJvbGx0ZWNoLmNv +MIIDczCCAzOgAwIBAgIBATAJBgcqhkjOOAQDMIGgMTAwLgYDVQQDEycoc2VsZi1z +aWduZWQpIFF0IERldmVsb3BtZW50IEZyYW1ld29ya3MxIjAgBgNVBAsTGVF0IERl +dmVsb3BtZW50IEZyYW1ld29ya3MxDjAMBgNVBAoTBU5va2lhMQswCQYDVQQGEwJO +TzErMCkGCSqGSIb3DQEJARYccXRzNjAtZmVlZGJhY2tAdHJvbGx0ZWNoLmNvbTAe +Fw0wOTEwMDUxMTExMTdaFw0xOTEwMDMxMTExMTdaMIGgMTAwLgYDVQQDEycoc2Vs +Zi1zaWduZWQpIFF0IERldmVsb3BtZW50IEZyYW1ld29ya3MxIjAgBgNVBAsTGVF0 +IERldmVsb3BtZW50IEZyYW1ld29ya3MxDjAMBgNVBAoTBU5va2lhMQswCQYDVQQG +EwJOTzErMCkGCSqGSIb3DQEJARYccXRzNjAtZmVlZGJhY2tAdHJvbGx0ZWNoLmNv bTCCAbYwggErBgcqhkjOOAQBMIIBHgKBgQC7OyI3lyV06OqahpbeEa5p9ucmoBxV n6YKvBjliPNMhQe7Di1Igv63rllQPqABv1Qu1YJc5CPiF4dSSQ/R7XjKEQqPZY4A PZooTKWVCs+e3Yo2HWaZYRks/euvcqvEOqmkZ2RUccaTb1T+b2et0vphFmlVYXPx @@ -14,6 +16,6 @@ taqAVb9V2DrDHx3s0gSQmS5BNK2KThZCNOgj3YT4GRIZR4L6gqDBS5dkWLrwFUfC l6Hw9tizQR4EO4HgjEnMSxzXDzsDgYQAAoGAJH/tVAEb1boQKTt5eHRI/zCtw4ab Vtw7jHMzqQ+m921izJyzz5AJCVjtu6a1bLnW09i9oFIZ7bYs+Cd+qRgac2cVkX4x xmMXuAgw03VMf3vEbK2M2+BkjpUGrfoST5XG/eJbno6Tp1BGvYd88ZLt3gXBPnqi -2QpMaOGqMED4mWkwCwYHKoZIzjgEAwUAAy8AMCwCFGCSlB1FYaBiIAuirrAACZzi -p2jnAhQ/hlJjpxOgF7Z5RZCNAhz6HNhZ3g== +2QpMaOGqMED4mWkwCQYHKoZIzjgEAwMvADAsAhQSh0SkUWPDv9enEQqkKCfjDu7H +xAIUft1Qc3eFaoW+ki69TgptZnkki6M= -----END CERTIFICATE----- -- cgit v0.12 From 1363a329c96f90c8e2b33ac7c74374795459b6ed Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 5 Oct 2009 13:30:32 +0300 Subject: Doc update related to Qt package name for Symbian (a3ef6e08). Task-number: QT-772 Reviewed-by: TrustMe (cherry picked from commit 2fe4f4a98e1c0b727ee9fa9d168d726a9dcb36d7) --- doc/src/getting-started/installation.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 539c1d5..2ace8de 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -520,7 +520,7 @@ in the \l{Qt for S60 Requirements} document. We've included a subset of the Qt demos in this package for you to try out. An excellent starting point is the "fluidlauncher" demo. To run the demo on a real device, you first have to install - \c{qt_for_s60.sis} and \c{fluidlauncher.sis} found in the Qt installation + \c{qt.sis} and \c{fluidlauncher.sis} found in the Qt installation directory. Begin by connecting your phone using the USB cable and selecting "PC Suite mode". In Windows Explorer right click on the \c{.sis} files and select "Install with Nokia Application Installer" -- cgit v0.12 From c90c1a982642e80a021ef08ad8b7c73545267d26 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Wed, 7 Oct 2009 13:25:32 +0200 Subject: Revert "There's no need to include qstringmatcher.h in qstringlist.h" Source-incompatible change This reverts commit 8714892977269591bb9b348c6eb549a7f2c45cbc. Rev-by: Trustme (cherry picked from commit 136f866f405a60ddbc48e4c666a0fec484f24717) --- src/corelib/tools/qstringlist.cpp | 1 - src/corelib/tools/qstringlist.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index f5b2a59..ce39b47 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -41,7 +41,6 @@ #include #include -#include QT_BEGIN_NAMESPACE diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index c959209..2a2a1d7 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -47,6 +47,7 @@ #include #include #include +#include #ifdef QT_INCLUDE_COMPAT #include #endif -- cgit v0.12 From 43fe0d1e73366f5b29930c0f9ddef959729dca66 Mon Sep 17 00:00:00 2001 From: Janne Koskinen Date: Tue, 6 Oct 2009 15:27:30 +0000 Subject: 2009-10-06 Janne Koskinen Reviewed by Simon Hausmann. [Qt] don't enable input methods on Symbian by default. https://bugs.webkit.org/show_bug.cgi?id=30117 If input methods are enabled Symbian FEP will be launched on every pointer event making webpage navigation impossible with QWebView. * Api/qwebview.cpp: (QWebView::QWebView): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49188 268f45cc-cd09-0410-ab3c-d52691b4dbfc (cherry picked from commit 9c23f571341811b07606db79dd4a4d44ff98acc1) --- src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp | 2 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index 3c5f89f..882f3d7 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -198,7 +198,7 @@ QWebView::QWebView(QWidget *parent) { d = new QWebViewPrivate(this); -#if !defined(Q_WS_QWS) +#if !defined(Q_WS_QWS) && !defined(Q_OS_SYMBIAN) setAttribute(Qt::WA_InputMethodEnabled); #endif diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index fd2768c..99ddaa5 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,16 @@ +2009-10-06 Janne Koskinen + + Reviewed by Simon Hausmann. + + [Qt] don't enable input methods on Symbian by default. + https://bugs.webkit.org/show_bug.cgi?id=30117 + + If input methods are enabled Symbian FEP will be launched on every + pointer event making webpage navigation impossible with QWebView. + + * Api/qwebview.cpp: + (QWebView::QWebView): + 2009-10-01 Simon Hausmann Reviewed by Tor Arne Vestbø. -- cgit v0.12 From 00db2d0b1f069a1e1a71b3f1175dfb0dff71cae1 Mon Sep 17 00:00:00 2001 From: Janne Koskinen Date: Wed, 7 Oct 2009 10:58:16 +0000 Subject: 2009-10-07 Janne Koskinen Reviewed by Simon Hausmann. [Qt] Symbian SBSv2 .data segment adress fix https://bugs.webkit.org/show_bug.cgi?id=30157 RO-section in qtwebkit.dll exceeds allocated space in SBSv2. Move RW-section base address to start from 0x800000 instead of the toolchain default 0x400000 * WebCore.pro: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49239 268f45cc-cd09-0410-ab3c-d52691b4dbfc (cherry picked from commit d73ea9d00fec200b2dd6de5e4c8f298caffa4aca) --- src/3rdparty/webkit/WebCore/ChangeLog | 12 ++++++++++++ src/3rdparty/webkit/WebCore/WebCore.pro | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index aacc3dc..4f7dd4f 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,15 @@ +2009-10-07 Janne Koskinen + + Reviewed by Simon Hausmann. + + [Qt] Symbian SBSv2 .data segment adress fix + https://bugs.webkit.org/show_bug.cgi?id=30157 + + RO-section in qtwebkit.dll exceeds allocated space in SBSv2. Move RW-section + base address to start from 0x800000 instead of the toolchain default 0x400000 + + * WebCore.pro: + 2009-09-29 Dave Hyatt Reviewed by Jon Honeycutt. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index bc22b7a..1c39bb8 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -13,6 +13,9 @@ symbian: { TARGET.UID3 = 0x200267C2 } +# RO-section in qtwebkit.dll exceeds allocated space in SBSv2. Move RW-section +# base address to start from 0x800000 instead of the toolchain default 0x400000. +symbian-sbsv2: MMP_RULES += "LINKEROPTION armcc --rw-base 0x800000" include($$PWD/../WebKit.pri) -- cgit v0.12 From cf07c93a83a64be1590b6bdddb46f7cafb6fcf05 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 6 Oct 2009 17:05:50 +0200 Subject: Fixed a crash bug on S60 SDK 3.1. The crash was caused by the image data not being locked before being accessed. Also avoided an unnecessary detach copy by making the image variable a reference. RevBy: Jani Hautakangas Task: QTBUG-4705 AutoTest: QWidget passed (cherry picked from commit 330dc1e5895a8950615a9bbf26154f5387b023b1) --- src/gui/painting/qwindowsurface_s60.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 664ad48..dc4e43b 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -85,7 +85,9 @@ QS60WindowSurface::~QS60WindowSurface() void QS60WindowSurface::beginPaint(const QRegion &rgn) { if (!qt_widget_private(window())->isOpaque) { - QImage image = static_cast(d_ptr->device.data_ptr().data())->image; + QS60PixmapData *pixmapData = static_cast(d_ptr->device.data_ptr().data()); + pixmapData->beginDataAccess(); + QImage &image = pixmapData->image; QRgb *data = reinterpret_cast(image.bits()); const int row_stride = image.bytesPerLine() / 4; @@ -103,6 +105,7 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn) row += row_stride; } } + pixmapData->endDataAccess(); } } -- cgit v0.12 From 5a5a4368fdd984aeaf830e6a3af3584fa84838f7 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 7 Oct 2009 12:16:04 +0200 Subject: Fixed initialization of the system locale on Symbian. Made it thread-safe and actually make sure that we don't initialize the data several times. Reviewed-by: axis (cherry picked from commit 0418d438d1c1acfe2c95ee748c1e7c84a0ee8837) --- src/corelib/tools/qlocale_symbian.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index 931fbb4..1660e95 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include "private/qcore_symbian_p.h" @@ -773,8 +774,8 @@ static QLocale::MeasurementSystem symbianMeasurementSystem() QLocale QSystemLocale::fallbackLocale() const { // load system data before query calls - static bool initDone = false; - if (!initDone) { + static QBasicAtomicInt initDone = Q_BASIC_ATOMIC_INITIALIZER(0); + if (initDone.testAndSetRelaxed(0, 1)) { _s60Locale.LoadSystemSettings(); // Initialize platform version dependent function pointers @@ -794,7 +795,12 @@ QLocale QSystemLocale::fallbackLocale() const ptrGetLongDateFormatSpec = &defaultFormatSpec; if (!ptrGetShortDateFormatSpec) ptrGetShortDateFormatSpec = &defaultFormatSpec; + bool ret = initDone.testAndSetRelease(1, 2); + Q_ASSERT(ret); + Q_UNUSED(ret); } + while(initDone != 2) + QThread::yieldCurrentThread(); TLanguage lang = User::Language(); QString locale = QLatin1String(qt_symbianLocaleName(lang)); -- cgit v0.12 From 4c80a588825f55c3b8f10a90d692b3295b31c941 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Wed, 7 Oct 2009 14:10:26 +0200 Subject: mediaplayer: crash in settings dialog. The MediaPlayer requires that an output device is available. Task-number: QTBUG-4755 Reviewed-by: Gareth Stockwell (cherry picked from commit 16e21cb0beb0e5f5189048b95d1cb74ae0c0702a) --- src/3rdparty/phonon/mmf/audiooutput.cpp | 26 +++++++++++++++++++------- src/3rdparty/phonon/mmf/audiooutput.h | 13 +++++++++---- src/3rdparty/phonon/mmf/backend.cpp | 18 ++++++++++++++---- 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/src/3rdparty/phonon/mmf/audiooutput.cpp b/src/3rdparty/phonon/mmf/audiooutput.cpp index 58e2f5e..5a00f60 100644 --- a/src/3rdparty/phonon/mmf/audiooutput.cpp +++ b/src/3rdparty/phonon/mmf/audiooutput.cpp @@ -18,6 +18,8 @@ along with this library. If not, see . #include +#include + #include "audiooutput.h" #include "defs.h" #include "mediaobject.h" @@ -74,16 +76,13 @@ void MMF::AudioOutput::setVolume(qreal volume) int MMF::AudioOutput::outputDevice() const { - return 0; -} - -bool MMF::AudioOutput::setOutputDevice(int) -{ - return true; + return AudioOutputDeviceID; } -bool MMF::AudioOutput::setOutputDevice(const Phonon::AudioOutputDevice &) +bool MMF::AudioOutput::setOutputDevice(int index) { + Q_ASSERT_X(index == AudioOutputDeviceID, Q_FUNC_INFO, + "We only support one output device, with id 0"); return true; } @@ -101,4 +100,17 @@ bool MMF::AudioOutput::activateOnMediaObject(MediaObject *mo) return true; } +QHash MMF::AudioOutput::audioOutputDescription(int index) +{ + if (index == AudioOutputDeviceID) { + QHash retval; + + retval.insert("name", QCoreApplication::translate("Phonon::MMF", "Audio Output")); + retval.insert("description", QCoreApplication::translate("Phonon::MMF", "The audio output device")); + retval.insert("available", true); + + return retval; + } +} + QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/audiooutput.h b/src/3rdparty/phonon/mmf/audiooutput.h index 0a962a9..d0ba086 100644 --- a/src/3rdparty/phonon/mmf/audiooutput.h +++ b/src/3rdparty/phonon/mmf/audiooutput.h @@ -19,6 +19,8 @@ along with this library. If not, see . #ifndef PHONON_MMF_AUDIOOUTPUT_H #define PHONON_MMF_AUDIOOUTPUT_H +#include + #include "mmf_medianode.h" #include @@ -65,10 +67,12 @@ public: */ virtual bool setOutputDevice(int); - /** - * Has no effect. - */ - virtual bool setOutputDevice(const Phonon::AudioOutputDevice &); + static QHash audioOutputDescription(int index); + + enum Constants + { + AudioOutputDeviceID = 0 + }; protected: virtual bool activateOnMediaObject(MediaObject *mo); @@ -78,6 +82,7 @@ Q_SIGNALS: void audioDeviceFailed(); private: + void setVolumeObserver(VolumeObserver* observer); qreal m_volume; diff --git a/src/3rdparty/phonon/mmf/backend.cpp b/src/3rdparty/phonon/mmf/backend.cpp index be43f46..f542ec9 100644 --- a/src/3rdparty/phonon/mmf/backend.cpp +++ b/src/3rdparty/phonon/mmf/backend.cpp @@ -107,6 +107,12 @@ QList Backend::objectDescriptionIndexes(ObjectDescriptionType type) const { case EffectType: retval.append(EffectFactory::effectIndexes()); + break; + case AudioOutputDeviceType: + // We only have one possible output device, but we need at least + // one. + retval.append(AudioOutput::AudioOutputDeviceID); + break; default: ; } @@ -119,10 +125,14 @@ QHash Backend::objectDescriptionProperties(ObjectDescripti { TRACE_CONTEXT(Backend::connectNodes, EBackend); - if (type == EffectType) - return EffectFactory::audioEffectDescriptions(AbstractAudioEffect::Type(index)); - else - return QHash(); + switch (type) { + case EffectType: + return EffectFactory::audioEffectDescriptions(AbstractAudioEffect::Type(index)); + case AudioOutputDeviceType: + return AudioOutput::audioOutputDescription(index); + default: + return QHash(); + } } bool Backend::startConnectionChange(QSet) -- cgit v0.12 From c757e2d46ed0ab6ff3611752c2126dafdae4a04c Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Thu, 8 Oct 2009 12:11:32 +0200 Subject: Fix compile errors on mingw (The version supplied with Qt 4.5) Added the missing defines Reviewed-by: Denis (cherry picked from commit 1040ba2fd850196234424f769e28d513a6eb0948) --- src/gui/dialogs/qprintdialog_win.cpp | 7 +++++++ src/gui/inputmethod/qwininputcontext_p.h | 13 +++++++++++++ src/gui/kernel/qapplication_win.cpp | 5 ++++- src/gui/util/qdesktopservices_win.cpp | 5 +++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog_win.cpp index f66c27f..843c4e2 100644 --- a/src/gui/dialogs/qprintdialog_win.cpp +++ b/src/gui/dialogs/qprintdialog_win.cpp @@ -52,6 +52,13 @@ #include #include +#if defined(Q_CC_MINGW) && !defined(PD_NOCURRENTPAGE) +#define PD_NOCURRENTPAGE 0x00800000 +#define PD_RESULT_PRINT 1 +#define PD_RESULT_APPLY 2 +#define START_PAGE_GENERAL 0XFFFFFFFF +#endif + QT_BEGIN_NAMESPACE extern void qt_win_eatMouseMove(); diff --git a/src/gui/inputmethod/qwininputcontext_p.h b/src/gui/inputmethod/qwininputcontext_p.h index 39d50fd..dd0490d 100644 --- a/src/gui/inputmethod/qwininputcontext_p.h +++ b/src/gui/inputmethod/qwininputcontext_p.h @@ -56,6 +56,19 @@ #include "QtGui/qinputcontext.h" #include "QtCore/qt_windows.h" +#if defined(Q_CC_MINGW) && !defined(IMR_RECONVERTSTRING) +typedef struct tagRECONVERTSTRING { + DWORD dwSize; + DWORD dwVersion; + DWORD dwStrLen; + DWORD dwStrOffset; + DWORD dwCompStrLen; + DWORD dwCompStrOffset; + DWORD dwTargetStrLen; + DWORD dwTargetStrOffset; +} RECONVERTSTRING, *PRECONVERTSTRING; +#endif + QT_BEGIN_NAMESPACE class QWinInputContext : public QInputContext diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 44f82b6..270562f 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -171,10 +171,13 @@ typedef struct tagTOUCHINPUT #include #endif +#ifndef IMR_RECONVERTSTRING +#define IMR_RECONVERTSTRING 4 +#endif + #ifndef IMR_CONFIRMRECONVERTSTRING #define IMR_CONFIRMRECONVERTSTRING 0x0005 #endif - QT_BEGIN_NAMESPACE #ifdef Q_WS_WINCE diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp index 9ae3a15..c1ab5b8 100644 --- a/src/gui/util/qdesktopservices_win.cpp +++ b/src/gui/util/qdesktopservices_win.cpp @@ -58,6 +58,11 @@ # endif #endif +#if defined(Q_CC_MINGW) && !defined(CSIDL_MYMUSIC) +#define CSIDL_MYMUSIC 13 +#define CSIDL_MYVIDEO 14 +#endif + #ifndef QT_NO_DESKTOPSERVICES QT_BEGIN_NAMESPACE -- cgit v0.12 From de36243273661c5844d417793f02c8db4a5b5da9 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 7 Oct 2009 16:51:52 +0100 Subject: Simplified handling of native window information in VideoPlayer Now retrieve RWsSession and CScreenDevice from CCoeEnv::Static() once (at construction), instead of at every call to getNativeWindowSystemHandles(). Collapsed m_screenRect and m_clipRect into a single m_rect member, since the two rectangles are always identical anyway. Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/mmf_videoplayer.cpp | 110 +++++++++++++--------------- src/3rdparty/phonon/mmf/mmf_videoplayer.h | 9 +-- 2 files changed, 55 insertions(+), 64 deletions(-) diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index c7fa791..0d051ca 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -45,8 +45,8 @@ using namespace Phonon::MMF; //----------------------------------------------------------------------------- MMF::VideoPlayer::VideoPlayer() - : m_wsSession(0) - , m_screenDevice(0) + : m_wsSession(CCoeEnv::Static()->WsSession()) + , m_screenDevice(*CCoeEnv::Static()->ScreenDevice()) , m_window(0) , m_totalTime(0) , m_mmfOutputChangePending(false) @@ -56,8 +56,8 @@ MMF::VideoPlayer::VideoPlayer() MMF::VideoPlayer::VideoPlayer(const AbstractPlayer& player) : AbstractMediaPlayer(player) - , m_wsSession(0) - , m_screenDevice(0) + , m_wsSession(CCoeEnv::Static()->WsSession()) + , m_screenDevice(*CCoeEnv::Static()->ScreenDevice()) , m_window(0) , m_totalTime(0) , m_mmfOutputChangePending(false) @@ -86,21 +86,20 @@ void MMF::VideoPlayer::construct() // clipping region will be set to empty and the video will not be // visible. If this is the case, we should set m_mmfOutputChangePending // and respond to future showEvents from the videoOutput widget. - - TRAPD(err, - m_player.reset(CVideoPlayerUtility::NewL - ( - *this, - priority, preference, - *m_wsSession, *m_screenDevice, - *m_window, - m_windowRect, m_clipRect - )) - ); - if (KErrNone != err) { + TRAPD(err, + m_player.reset(CVideoPlayerUtility::NewL + ( + *this, + priority, preference, + m_wsSession, m_screenDevice, + *m_window, + m_rect, m_rect + )) + ); + + if (KErrNone != err) changeState(ErrorState); - } TRACE_EXIT_0(); } @@ -381,20 +380,20 @@ void MMF::VideoPlayer::updateMmfOutput() // need to call SetDisplayWindowL, and this is checked in // MvpuoPrepareComplete, at which point the MMF controller has been // loaded. - getNativeWindowSystemHandles(); - -// DEBUGGING *** DO NOT INTEGRATE *** -getDsaRegion(*m_wsSession, *m_window); + +#ifdef _DEBUG + getDsaRegion(m_wsSession, *m_window); +#endif TRAPD(err, - m_player->SetDisplayWindowL - ( - *m_wsSession, *m_screenDevice, - *m_window, - m_windowRect, m_clipRect - ) - ); + m_player->SetDisplayWindowL + ( + m_wsSession, m_screenDevice, + *m_window, + m_rect, m_rect + ) + ); if (KErrNone != err) { TRACE("SetDisplayWindowL error %d", err); @@ -440,44 +439,37 @@ void MMF::VideoPlayer::getNativeWindowSystemHandles() // Get top-level window control = QApplication::activeWindow()->effectiveWinId(); - CCoeEnv* const coeEnv = control->ControlEnv(); - m_wsSession = &(coeEnv->WsSession()); - m_screenDevice = coeEnv->ScreenDevice(); - m_window = control->DrawableWindow(); - #ifdef _DEBUG if(m_videoOutput) { - QScopedPointer dumper(new ObjectDump::QDumper); - dumper->setPrefix("Phonon::MMF"); // to aid searchability of logs - ObjectDump::addDefaultAnnotators(*dumper); - TRACE_0("Dumping VideoOutput:"); - dumper->dumpObject(*m_videoOutput); + QScopedPointer dumper(new ObjectDump::QDumper); + dumper->setPrefix("Phonon::MMF"); // to aid searchability of logs + ObjectDump::addDefaultAnnotators(*dumper); + TRACE_0("Dumping VideoOutput:"); + dumper->dumpObject(*m_videoOutput); } else { - TRACE_0("m_videoOutput is null - dumping top-level control info:"); - TRACE("control %08x", control); - TRACE("control.parent %08x", control->Parent()); - TRACE("control.isVisible %d", control->IsVisible()); - TRACE("control.rect %d,%d %dx%d", - control->Position().iX, control->Position().iY, - control->Size().iWidth, control->Size().iHeight); - TRACE("control.ownsWindow %d", control->OwnsWindow()); + TRACE_0("m_videoOutput is null - dumping top-level control info:"); + TRACE("control %08x", control); + TRACE("control.parent %08x", control->Parent()); + TRACE("control.isVisible %d", control->IsVisible()); + TRACE("control.rect %d,%d %dx%d", + control->Position().iX, control->Position().iY, + control->Size().iWidth, control->Size().iHeight); + TRACE("control.ownsWindow %d", control->OwnsWindow()); } #endif - m_windowRect = TRect( - control->DrawableWindow()->AbsPosition(), - control->DrawableWindow()->Size()); - m_clipRect = m_windowRect; - - TRACE("windowRect %d %d - %d %d", - m_windowRect.iTl.iX, m_windowRect.iTl.iY, - m_windowRect.iBr.iX, m_windowRect.iBr.iY); - TRACE("clipRect %d %d - %d %d", - m_clipRect.iTl.iX, m_clipRect.iTl.iY, - m_clipRect.iBr.iX, m_clipRect.iBr.iY); - - TRACE_EXIT_0(); + RWindowBase *const window = control->DrawableWindow(); + const TRect rect(window->AbsPosition(), window->Size()); + + TRACE("rect %d %d - %d %d", + rect.iTl.iX, rect.iTl.iY, + rect.iBr.iX, rect.iBr.iY); + + if(window != m_window || rect != m_rect) { + m_window = window; + m_rect = rect; + } } diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.h b/src/3rdparty/phonon/mmf/mmf_videoplayer.h index ee3650a..29e0839 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.h +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.h @@ -88,12 +88,11 @@ private: QScopedPointer m_player; // Not owned - RWsSession* m_wsSession; - CWsScreenDevice* m_screenDevice; + RWsSession& m_wsSession; + CWsScreenDevice& m_screenDevice; RWindowBase* m_window; - TRect m_windowRect; - TRect m_clipRect; - + TRect m_rect; + QSize m_frameSize; qint64 m_totalTime; -- cgit v0.12 From 37e34f7132298da5519f7f0466f91ed2670a1ac8 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 7 Oct 2009 17:04:44 +0100 Subject: Preventing unnecessary calls to CVideoPlayerUtility::SetDisplayWindowL getNativeWindowSystemHandles now checks the window handle and screen rectangle against the previous value; SetDisplayWindowL is only called if the window and/or screen rectangle have changed. This allows videoOutputRegionChanged to be called 'speculatively' - i.e. in response to Qt events which may or may not reflect a change in the underlying window system - with only actual window system events getting propagated into the MMF. The reason for this change is that SetDisplayWindowL results in the current DSA session (owned by CVideoPlayerUtility) being torn down and a new one set up. This in turn requires handshaking with the window server, and may be slow. Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/mmf_videoplayer.cpp | 40 ++++++++++++++++++----------- src/3rdparty/phonon/mmf/mmf_videoplayer.h | 8 +++--- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index 0d051ca..251a3b9 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -76,6 +76,7 @@ void MMF::VideoPlayer::construct() const TInt priority = 0; const TMdaPriorityPreference preference = EMdaPriorityPreferenceNone; + // Ignore return value - first call must always return true getNativeWindowSystemHandles(); // TODO: is this the correct way to handle errors which occur when @@ -326,14 +327,16 @@ void MMF::VideoPlayer::videoOutputRegionChanged() TRACE_CONTEXT(VideoPlayer::videoOutputRegionChanged, EVideoInternal); TRACE_ENTRY("state %d", state()); - getNativeWindowSystemHandles(); + const bool changed = getNativeWindowSystemHandles(); // See comment in updateMmfOutput - if(state() == LoadingState) - m_mmfOutputChangePending = true; - else - updateMmfOutput(); - + if(changed) { + if(state() == LoadingState) + m_mmfOutputChangePending = true; + else + updateMmfOutput(); + } + TRACE_EXIT_0(); } @@ -358,29 +361,31 @@ void getDsaRegion(RWsSession &session, const RWindowBase &window) err = dsa.Request(region, ao.Status(), window); ao.SetActive(); dsa.Close(); - ao.Cancel(); + ao.Cancel(); if(region) { qDebug() << "Phonon::MMF::getDsaRegion count" << region->Count(); for(int i=0; iCount(); ++i) { const TRect& rect = region->RectangleList()[i]; - qDebug() << "Phonon::MMF::getDsaRegion rect" << rect.iTl.iX << rect.iTl.iY << rect.iBr.iX << rect.iBr.iY; + qDebug() << "Phonon::MMF::getDsaRegion rect" + << rect.iTl.iX << rect.iTl.iY << rect.iBr.iX << rect.iBr.iY; } region->Close(); } } +#endif // _DEBUG + void MMF::VideoPlayer::updateMmfOutput() { TRACE_CONTEXT(VideoPlayer::updateMmfOutput, EVideoInternal); TRACE_ENTRY_0(); - - // Calling SetDisplayWindowL is a no-op unless the MMF controller has + + // Calling SetDisplayWindowL is a no-op unless the MMF controller has // been loaded, so we shouldn't do it. Instead, the // m_mmfOutputChangePending flag is used to record the fact that we - // need to call SetDisplayWindowL, and this is checked in + // need to call SetDisplayWindowL, and this is checked in // MvpuoPrepareComplete, at which point the MMF controller has been // loaded. - getNativeWindowSystemHandles(); #ifdef _DEBUG getDsaRegion(m_wsSession, *m_window); @@ -425,13 +430,13 @@ void MMF::VideoPlayer::videoOutputChanged() TRACE_EXIT_0(); } -void MMF::VideoPlayer::getNativeWindowSystemHandles() +bool MMF::VideoPlayer::getNativeWindowSystemHandles() { TRACE_CONTEXT(VideoPlayer::getNativeWindowSystemHandles, EVideoInternal); TRACE_ENTRY_0(); - + CCoeControl *control = 0; - + if(m_videoOutput) // Create native window control = m_videoOutput->winId(); @@ -466,10 +471,15 @@ void MMF::VideoPlayer::getNativeWindowSystemHandles() rect.iTl.iX, rect.iTl.iY, rect.iBr.iX, rect.iBr.iY); + bool changed = false; + if(window != m_window || rect != m_rect) { m_window = window; m_rect = rect; + changed = true; } + + TRACE_RETURN("changed %d", changed); } diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.h b/src/3rdparty/phonon/mmf/mmf_videoplayer.h index 29e0839..d3e148a 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.h +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.h @@ -80,10 +80,12 @@ private: // AbstractPlayer virtual void videoOutputChanged(); - - void getNativeWindowSystemHandles(); + + // Returns true if handles have changed + bool getNativeWindowSystemHandles(); + void updateMmfOutput(); - + private: QScopedPointer m_player; -- cgit v0.12 From 8fa32c467549d346024f4bd6b4518c7012a5cf55 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 7 Oct 2009 17:11:07 +0100 Subject: Modified getDsaRegion to be compiled only in debug builds Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/mmf_videoplayer.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index 251a3b9..fdb7ff4 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -340,7 +340,13 @@ void MMF::VideoPlayer::videoOutputRegionChanged() TRACE_EXIT_0(); } -// DEBUGGING *** DO NOT INTEGRATE *** + +#ifdef _DEBUG + +// The following code is for debugging problems related to video visibility. It allows +// the VideoPlayer instance to query the window server in order to determine the +// DSA drawing region for the video window. + class CDummyAO : public CActive { public: @@ -351,7 +357,6 @@ public: void SetActive() { CActive::SetActive(); } }; -// DEBUGGING *** DO NOT INTEGRATE *** void getDsaRegion(RWsSession &session, const RWindowBase &window) { RDirectScreenAccess dsa(session); @@ -404,9 +409,9 @@ void MMF::VideoPlayer::updateMmfOutput() TRACE("SetDisplayWindowL error %d", err); setError(NormalError); } - + m_mmfOutputChangePending = false; - + TRACE_EXIT_0(); } -- cgit v0.12 From 7b4c917811f48328502ae4cd2a676a6f2d4f7a6b Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 7 Oct 2009 17:13:19 +0100 Subject: Added ObjectDump annotator which prints Symbian-specific internal widget flags Reviewed-by: Frans Englich --- .../mmf/mmfphonondebug/objectdump_symbian.cpp | 30 ++++++++++++++++++++++ .../phonon/mmf/mmfphonondebug/objectdump_symbian.h | 10 ++++++++ 2 files changed, 40 insertions(+) diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp index 5ae10f9..8557e90 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp @@ -21,6 +21,8 @@ along with this library. If not, see . #include #include "objectdump_symbian.h" +#include // to access QWExtra + QT_BEGIN_NAMESPACE namespace ObjectDump @@ -28,6 +30,32 @@ namespace ObjectDump namespace Symbian { +QList QAnnotatorWidget::annotation(const QObject& object) +{ + QList result; + + const QWidget* widget = qobject_cast(&object); + if(widget) { + + const QWExtra* extra = qt_widget_private(const_cast(widget))->extraData(); + + if(extra) { + + QByteArray array; + QTextStream stream(&array); + + stream << "widget (Symbian): "; + stream << "activated " << extra->activated << ' '; + stream << "disableBlit " << extra->disableBlit << ' '; + + stream.flush(); + result.append(array); + } + } + + return result; +} + QList QAnnotatorControl::annotation(const QObject& object) { QList result; @@ -121,12 +149,14 @@ QList QAnnotatorWindow::annotation(const QObject& object) void addDefaultAnnotators_sys(QDumper& dumper) { + dumper.addAnnotator(new Symbian::QAnnotatorWidget); dumper.addAnnotator(new Symbian::QAnnotatorControl); dumper.addAnnotator(new Symbian::QAnnotatorWindow); } void addDefaultAnnotators_sys(QVisitor& visitor) { + visitor.addAnnotator(new Symbian::QAnnotatorWidget); visitor.addAnnotator(new Symbian::QAnnotatorControl); visitor.addAnnotator(new Symbian::QAnnotatorWindow); } diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h index 26ab308..563c862 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h @@ -29,6 +29,16 @@ namespace Symbian { /** + * Annotator which returns Symbian-specific widget information + */ +class QAnnotatorWidget : public QAnnotator +{ + Q_OBJECT +public: + QList annotation(const QObject& object); +}; + +/** * Annotator which returns control information */ class QAnnotatorControl : public QAnnotator -- cgit v0.12 From 252c3f9800444fc0e8f011ab0bf245d413acdb4d Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 7 Oct 2009 17:14:25 +0100 Subject: Modified ObjectDump annotator for Symbian window information This prevents a crash when applied to controls which are non-window owning Reviewed-by: Frans Englich --- .../mmf/mmfphonondebug/objectdump_symbian.cpp | 70 +++++++++++----------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp index 8557e90..2fceb62 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp @@ -59,89 +59,89 @@ QList QAnnotatorWidget::annotation(const QObject& object) QList QAnnotatorControl::annotation(const QObject& object) { QList result; - + const QWidget* widget = qobject_cast(&object); if(widget) { - + const CCoeControl* control = widget->effectiveWinId(); if(control) { - + QByteArray array; QTextStream stream(&array); - + stream << "control: " << control << ' '; stream << "parent " << control->Parent() << ' '; - + if(control->IsVisible()) stream << "visible "; else stream << "invisible "; - + stream << control->Position().iX << ',' << control->Position().iY << ' '; stream << control->Size().iWidth << 'x' << control->Size().iHeight; - + if(control->OwnsWindow()) stream << " ownsWindow "; - + stream.flush(); result.append(array); } } - + return result; } QList QAnnotatorWindow::annotation(const QObject& object) { QList result; - + const QWidget* widget = qobject_cast(&object); if(widget) { - + const CCoeControl* control = widget->effectiveWinId(); - if(control) { - - RDrawableWindow& window = *(control->DrawableWindow()); - + RDrawableWindow *window = 0; + + if(control && (window = control->DrawableWindow())) { + QByteArray array; QTextStream stream(&array); - + stream << "window: "; - + // ClientHandle() is available first in 5.0. #if !defined(__SERIES60_31__) && !defined(__S60_32__) if (QSysInfo::s60Version() > QSysInfo::SV_S60_3_2) // Client-side window handle // Cast to a void pointer so that log output is in hexadecimal format. - stream << "cli " << reinterpret_cast(window.ClientHandle()) << ' '; + stream << "cli " << reinterpret_cast(window->ClientHandle()) << ' '; #endif // Server-side address of CWsWindow object // This is useful for correlation with the window tree dumped by the window // server (see RWsSession::LogCommand). // Cast to a void pointer so that log output is in hexadecimal format. - stream << "srv " << reinterpret_cast(window.WsHandle()) << ' '; - - stream << "group " << window.WindowGroupId() << ' '; - + stream << "srv " << reinterpret_cast(window->WsHandle()) << ' '; + + stream << "group " << window->WindowGroupId() << ' '; + // Client-side handle to the parent window. - // Cast to a void pointer so that log output is in hexadecimal format. - stream << "parent " << reinterpret_cast(window.Parent()) << ' '; - - stream << window.Position().iX << ',' << window.Position().iY << ' '; - stream << '(' << window.AbsPosition().iX << ',' << window.AbsPosition().iY << ") "; - stream << window.Size().iWidth << 'x' << window.Size().iHeight << ' '; - - const TDisplayMode displayMode = window.DisplayMode(); + // Cast to a void pointer so that log output is in hexadecimal format. + stream << "parent " << reinterpret_cast(window->Parent()) << ' '; + + stream << window->Position().iX << ',' << window->Position().iY << ' '; + stream << '(' << window->AbsPosition().iX << ',' << window->AbsPosition().iY << ") "; + stream << window->Size().iWidth << 'x' << window->Size().iHeight << ' '; + + const TDisplayMode displayMode = window->DisplayMode(); stream << "mode " << displayMode << ' '; - - stream << "ord " << window.OrdinalPosition(); - + + stream << "ord " << window->OrdinalPosition(); + stream.flush(); result.append(array); - } + } } - + return result; } -- cgit v0.12 From 23cbcae5c847342d69e593cae5406ce8344b7030 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 7 Oct 2009 17:20:58 +0100 Subject: Refactored event-handling code in video widget Moved common code into videoOutputRegionChanged() Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/videooutput.cpp | 25 +++++++++++++------------ src/3rdparty/phonon/mmf/videooutput.h | 3 ++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp index 041b0a8..691c144 100644 --- a/src/3rdparty/phonon/mmf/videooutput.cpp +++ b/src/3rdparty/phonon/mmf/videooutput.cpp @@ -64,7 +64,7 @@ MMF::VideoOutput::VideoOutput(QWidget* parent) qt_widget_private(this)->extraData()->disableBlit = true; dump(); - + TRACE_EXIT_0(); } @@ -123,9 +123,7 @@ void MMF::VideoOutput::paintEvent(QPaintEvent* event) TRACE("regions %d", event->region().numRects()); TRACE("type %d", event->type()); - dump(); - - // Do not paint anything + // Do nothing } void MMF::VideoOutput::resizeEvent(QResizeEvent* event) @@ -135,10 +133,7 @@ void MMF::VideoOutput::resizeEvent(QResizeEvent* event) event->oldSize().width(), event->oldSize().height(), event->size().width(), event->size().height()); - QWidget::resizeEvent(event); - - if (m_observer) - m_observer->videoOutputRegionChanged(); + videoOutputRegionChanged(); } void MMF::VideoOutput::moveEvent(QMoveEvent* event) @@ -148,10 +143,9 @@ void MMF::VideoOutput::moveEvent(QMoveEvent* event) event->oldPos().x(), event->oldPos().y(), event->pos().x(), event->pos().y()); - QWidget::moveEvent(event); + videoOutputRegionChanged(); +} - if (m_observer) - m_observer->videoOutputRegionChanged(); } @@ -159,7 +153,14 @@ void MMF::VideoOutput::moveEvent(QMoveEvent* event) // Private functions //----------------------------------------------------------------------------- -void VideoOutput::dump() const +void MMF::VideoOutput::videoOutputRegionChanged() +{ + dump(); + if (m_observer) + m_observer->videoOutputRegionChanged(); +} + +void MMF::VideoOutput::dump() const { #ifdef _DEBUG TRACE_CONTEXT(VideoOutput::dump, EVideoInternal); diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h index 639a5ed..3e58509 100644 --- a/src/3rdparty/phonon/mmf/videooutput.h +++ b/src/3rdparty/phonon/mmf/videooutput.h @@ -52,7 +52,8 @@ protected: private: void dump() const; - + void videoOutputRegionChanged(); + private: QSize m_frameSize; -- cgit v0.12 From dda32cb904430e225566b047004b93c7be8ecca9 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 7 Oct 2009 17:22:21 +0100 Subject: Reformatting to comply with Qt code style Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/mmf_videoplayer.cpp | 16 ++++++++-------- src/3rdparty/phonon/mmf/mmf_videoplayer.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index fdb7ff4..6d7e0ed 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -81,9 +81,9 @@ void MMF::VideoPlayer::construct() // TODO: is this the correct way to handle errors which occur when // creating a Symbian object in the constructor of a Qt object? - - // TODO: check whether videoOutput is visible? If not, then the - // corresponding window will not be active, meaning that the + + // TODO: check whether videoOutput is visible? If not, then the + // corresponding window will not be active, meaning that the // clipping region will be set to empty and the video will not be // visible. If this is the case, we should set m_mmfOutputChangePending // and respond to future showEvents from the videoOutput widget. @@ -120,13 +120,13 @@ MMF::VideoPlayer::~VideoPlayer() void MMF::VideoPlayer::doPlay() { TRACE_CONTEXT(VideoPlayer::doPlay, EVideoApi); - + // See comment in updateMmfOutput if(m_mmfOutputChangePending) { TRACE_0("MMF output change pending - pushing now"); updateMmfOutput(); } - + m_player->Play(); } @@ -149,7 +149,7 @@ void MMF::VideoPlayer::doStop() void MMF::VideoPlayer::doSeek(qint64 ms) { TRACE_CONTEXT(VideoPlayer::doSeek, EVideoApi); - + bool wasPlaying = false; if(state() == PlayingState) { // The call to SetPositionL does not have any effect if playback is @@ -258,8 +258,8 @@ void MMF::VideoPlayer::MvpuoPrepareComplete(TInt aError) if(m_mmfOutputChangePending) { TRACE_0("MMF output change pending - pushing now"); updateMmfOutput(); - } - + } + emit totalTimeChanged(totalTime()); changeState(StoppedState); } else { diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.h b/src/3rdparty/phonon/mmf/mmf_videoplayer.h index d3e148a..8072404 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.h +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.h @@ -99,7 +99,7 @@ private: qint64 m_totalTime; bool m_mmfOutputChangePending; - + }; } -- cgit v0.12 From 9371ae3ff036a622f578023377cfcacbc733b804 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 7 Oct 2009 17:30:47 +0100 Subject: Modified reparenting to correctly deal with native child widgets Both reparenting and modification of window flags are done by calling QWidget::setParent. If either the parent changes, or a non-top-level widget becomes top-level (as a result of OR-ing Qt::Window into its window flags), a new native window ID is created for the widget. The Symbian implementation of setParent_sys had a flaw which manifested itself in the following situation: 1. We start with a native widget X, and its child Y, which is also native. There exist parent-child relationships between the associated CCoeControl instances, and the native windows (represented by RWindow handles). 2. X gets a new native window created as a result of a call to setParent. 3. QWidgetPrivate::reparentChildren calls SetParent on Y's control, to re-establish the parent-child relationship. The problem is that the window owned by Y's control now has no parent, so if we try to re-size the widget, the window server panics the client thread (WSERV-52). Because Symbian does not allow existing windows to be re-parented, and nor does it allow a window-owning control to re-create a new window, the only way to provide Y's window with a parent is to destroy the control and create a new one, passing in X's new window to the CCoeControl::CreateWindowL function. The changes made are as follows: a) QWidgetPrivate::reparentChildren is therefore modified to call create_sys, with destroyOldWindow set to true. b) QWidgetPrivate::create_sys is modified to take account of the value of this flag in all cases. (Previously it only did so if a new WId was passed in by the caller). c) The call to setWinId is delayed until the control and window are fully initialized. This is to allow us to emit a new event, WinIdChanged, from setWinId, in order to inform the widget that its winId has changed. d) QWidgetPrivate::activateSymbianWindow is modified in order to support this change of call ordering. Note that QWidgetPrivate::create_sys requires some re-factoring in order to remove the redundancy between the top-level and child widget cases. Task-number: QTBUG-4664 Reviewed-by: axis --- src/gui/kernel/qwidget_p.h | 2 +- src/gui/kernel/qwidget_s60.cpp | 69 ++++++++++++++++++++++++++++-------------- 2 files changed, 48 insertions(+), 23 deletions(-) diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index c06ef73..a4cc0da 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -294,7 +294,7 @@ public: void setMask_sys(const QRegion &); #ifdef Q_OS_SYMBIAN void setSoftKeys_sys(const QList &softkeys); - void activateSymbianWindow(); + void activateSymbianWindow(WId wid = 0); #endif void raise_sys(); diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 3328cee..5527cc8 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -318,8 +318,6 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de bool desktop = (type == Qt::Desktop); //bool tool = (type == Qt::Tool || type == Qt::Drawer); - WId id = 0; - if (popup) flags |= Qt::WindowStaysOnTopHint; // a popup stays on top @@ -341,13 +339,10 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de data.crect.setSize(QSize(width, height)); } - CCoeControl *destroyw = 0; + CCoeControl *const destroyw = destroyOldWindow ? data.winid : 0; createExtra(); if (window) { - if (destroyOldWindow) - destroyw = data.winid; - id = window; setWinId(window); TRect tr = window->Rect(); data.crect.setRect(tr.iTl.iX, tr.iTl.iY, tr.Width(), tr.Height()); @@ -355,10 +350,15 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de } else if (topLevel) { if (!q->testAttribute(Qt::WA_Moved) && !q->testAttribute(Qt::WA_DontShowOnScreen)) data.crect.moveTopLeft(QPoint(clientRect.iTl.iX, clientRect.iTl.iY)); - QSymbianControl *control= q_check_ptr(new QSymbianControl(q)); - id = (WId)control; - setWinId(id); - QT_TRAP_THROWING(control->ConstructL(true,desktop)); + + QScopedPointer control( q_check_ptr(new QSymbianControl(q)) ); + QT_TRAP_THROWING(control->ConstructL(true, desktop)); + + // Symbian windows are always created in an inactive state + // We perform this assignment for the case where the window is being re-created + // as aa result of a call to setParent_sys, on either this widget or one of its + // ancestors. + extra->activated = 0; if (!desktop) { TInt stackingFlags; @@ -368,7 +368,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de stackingFlags = ECoeStackFlagStandard; } control->MakeVisible(false); - QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags)); + QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control.data(), ECoeStackPriorityDefault, stackingFlags)); // Avoid keyboard focus to a hidden window. control->setFocusSafely(false); @@ -391,11 +391,22 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de int x, y, w, h; data.crect.getRect(&x, &y, &w, &h); control->SetRect(TRect(TPoint(x, y), TSize(w, h))); + + // We wait until the control is fully constructed before calling setWinId, because + // this generates a WinIdChanged event. + setWinId(control.take()); + } else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create native child widget - QSymbianControl *control = new QSymbianControl(q); - setWinId(control); + + QScopedPointer control( q_check_ptr(new QSymbianControl(q)) ); QT_TRAP_THROWING(control->ConstructL(!parentWidget)); + // Symbian windows are always created in an inactive state + // We perform this assignment for the case where the window is being re-created + // as aa result of a call to setParent_sys, on either this widget or one of its + // ancestors. + extra->activated = 0; + TInt stackingFlags; if ((q->windowType() & Qt::Popup) == Qt::Popup) { stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; @@ -403,7 +414,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de stackingFlags = ECoeStackFlagStandard; } control->MakeVisible(false); - QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags)); + QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control.data(), ECoeStackPriorityDefault, stackingFlags)); // Avoid keyboard focus to a hidden window. control->setFocusSafely(false); @@ -418,7 +429,11 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de | EPointerFilterMove | EPointerFilterDrag, 0); if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) - activateSymbianWindow(); + activateSymbianWindow(control.data()); + + // We wait until the control is fully constructed before calling setWinId, because + // this generates a WinIdChanged event. + setWinId(control.take()); } if (destroyw) { @@ -434,7 +449,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de void QWidgetPrivate::show_sys() { Q_Q(QWidget); - + if (q->testAttribute(Qt::WA_OutsideWSRange)) return; @@ -468,7 +483,7 @@ void QWidgetPrivate::show_sys() invalidateBuffer(q->rect()); } -void QWidgetPrivate::activateSymbianWindow() +void QWidgetPrivate::activateSymbianWindow(WId wid) { Q_Q(QWidget); @@ -476,8 +491,12 @@ void QWidgetPrivate::activateSymbianWindow() Q_ASSERT(q->testAttribute(Qt::WA_Mapped)); Q_ASSERT(!extra->activated); - WId id = q->internalWinId(); - QT_TRAP_THROWING(id->ActivateL()); + if(!wid) + wid = q->internalWinId(); + + Q_ASSERT(wid); + + QT_TRAP_THROWING(wid->ActivateL()); extra->activated = 1; } @@ -566,8 +585,14 @@ void QWidgetPrivate::reparentChildren() w->d_func()->invalidateBuffer(w->rect()); WId parent = q->effectiveWinId(); WId child = w->effectiveWinId(); - if (parent != child) - child->SetParent(parent); + if (parent != child) { + // Child widget is native. Because Symbian windows cannot be + // re-parented, we must re-create the window. + const WId window = 0; + const bool initializeWindow = false; + const bool destroyOldWindow = true; + w->d_func()->create_sys(window, initializeWindow, destroyOldWindow); + } // ### TODO: We probably also need to update the component array here w->d_func()->reparentChildren(); } else { @@ -1253,7 +1278,7 @@ void QWidget::grabMouse() WId id = effectiveWinId(); id->SetPointerCapture(true); QWidgetPrivate::mouseGrabber = this; - + #ifndef QT_NO_CURSOR QApplication::setOverrideCursor(cursor()); #endif -- cgit v0.12 From a8e2a457bb7d2fc377c1c65b6a4172974919e055 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 7 Oct 2009 17:56:23 +0100 Subject: Added a new event type, WinIdChange. This is sent to a native widget when its window system identifer has changed. This is motivated by the fact that, on Symbian, the native window system identifier may change in situations other than a change of parent widget. Specifically, calling QWidget::setParent, passing in the widget's existing parent, but OR-in Qt::Window into the window flags, causes a new native window handle to be created. Furthermore, because of the fact that Symbian does not allow existing windows to be reparented, any descendents of the original widget which are also native, must also be given new window system handles. Note that setWinId does not send a WinIdChange event if the incoming winId is zero. This is because setWinId(0) is only called in two situations: 1. During native widget destruction 2. During re-creation of the winId for a native widget Task-number: QTBUG-4664 Reviewed-by: Bjoern Erik Nilsen --- src/corelib/kernel/qcoreevent.cpp | 1 + src/corelib/kernel/qcoreevent.h | 2 ++ src/gui/kernel/qwidget.cpp | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 744e6a9..44a354b 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -228,6 +228,7 @@ QT_BEGIN_NAMESPACE \value TouchBegin Beginning of a sequence of touch-screen and/or track-pad events (QTouchEvent) \value TouchUpdate Touch-screen event (QTouchEvent) \value TouchEnd End of touch-event sequence (QTouchEvent) + \value WinIdChange The window system identifer for this native widget has changed User events should have values between \c User and \c{MaxUser}: diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index d66cead..99280d3 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -283,6 +283,8 @@ public: UpdateSoftKeys = 201, // Internal for compressing soft key updates + WinIdChange = 203, + // 512 reserved for Qt Jambi's MetaCall event // 513 reserved for Qt Jambi's DeleteOnMainThread event diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 4cbf762..7c11c00 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1502,6 +1502,8 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier mapper->remove(data.winid); } + const WId oldWinId = data.winid; + data.winid = id; #if defined(Q_WS_X11) hd = id; // X11: hd == ident @@ -1509,6 +1511,16 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier if (mapper && id && !userDesktopWidget) { mapper->insert(data.winid, q); } + + if(oldWinId != id) { + // Do not emit an event when the old winId is destroyed. This only + // happens (a) during widget destruction, and (b) immediately prior + // to creation of a new winId, for example as a result of re-parenting. + if(id != 0) { + QEvent e(QEvent::WinIdChange); + QCoreApplication::sendEvent(q, &e); + } + } } void QWidgetPrivate::createTLExtra() @@ -2227,8 +2239,8 @@ QWidget *QWidget::find(WId id) against. If Qt is using Carbon, the {WId} is actually an HIViewRef. If Qt is using Cocoa, {WId} is a pointer to an NSView. - \note We recommend that you do not store this value as it is likely to - change at run-time. + This value may change at run-time. An event with type QEvent::WinIdChange + will be sent to the widget following a change in window system identifier. \sa find() */ -- cgit v0.12 From 1e46018e8e3252c2e28b76ab9e24298a69a75d62 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 7 Oct 2009 18:01:25 +0100 Subject: Modified video widget to respond to WinIdChange events Task-number: QTBUG-4664 Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/videooutput.cpp | 11 +++++++++++ src/3rdparty/phonon/mmf/videooutput.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp index 691c144..0541612 100644 --- a/src/3rdparty/phonon/mmf/videooutput.cpp +++ b/src/3rdparty/phonon/mmf/videooutput.cpp @@ -146,6 +146,17 @@ void MMF::VideoOutput::moveEvent(QMoveEvent* event) videoOutputRegionChanged(); } +bool MMF::VideoOutput::event(QEvent* event) +{ + TRACE_CONTEXT(VideoOutput::event, EVideoInternal); + + if(event->type() == QEvent::WinIdChange) { + TRACE_0("WinIdChange"); + videoOutputRegionChanged(); + return true; + } + else + return QWidget::event(event); } diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h index 3e58509..7bc0b52 100644 --- a/src/3rdparty/phonon/mmf/videooutput.h +++ b/src/3rdparty/phonon/mmf/videooutput.h @@ -49,6 +49,7 @@ protected: void paintEvent(QPaintEvent* event); void resizeEvent(QResizeEvent* event); void moveEvent(QMoveEvent* event); + bool event(QEvent* event); private: void dump() const; -- cgit v0.12 From 02fbfdbdd01430e4843b470f1a6fd14e00a4583c Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Thu, 8 Oct 2009 09:35:03 +0100 Subject: Updated qwidget winId auto-tests 1. Added a new test step, winIdChangeEvent, to test that QWidget::setWinId correctly sends WinIdChange events. 2. The persistentWinId test step check the following assertion: re-parenting a native widget causes its own winId to change, but not those of its (native) descendents. This assertion is not true for Symbian, so this test step has been replaced, on Symbian, by reparentCausesChildWinIdChange, which checks the inverse assumption, i.e. that the native descendents' winIds also change. Reviewed-by: Bjoern Erik Nilsen --- tests/auto/qwidget/tst_qwidget.cpp | 144 +++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index f8341c3..055de51 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -239,7 +239,12 @@ private slots: void setFixedSize(); void ensureCreated(); + void winIdChangeEvent(); +#ifdef Q_OS_SYMBIAN + void reparentCausesChildWinIdChange(); +#else void persistentWinId(); +#endif void qobject_castInDestroyedSlot(); void showHideEvent_data(); @@ -4348,6 +4353,144 @@ void tst_QWidget::ensureCreated() } } +class WinIdChangeWidget : public QWidget { +public: + WinIdChangeWidget(QWidget *p = 0) + : QWidget(p) + , m_winIdChangeEventCount(0) + { + + } +protected: + bool event(QEvent *e){ + if(e->type() == QEvent::WinIdChange) + ++m_winIdChangeEventCount; + else + return QWidget::event(e); + } +public: + int m_winIdChangeEventCount; +}; + +void tst_QWidget::winIdChangeEvent() +{ + { + // Transforming an alien widget into a native widget + WinIdChangeWidget widget; + const WId winIdBefore = widget.internalWinId(); + const WId winIdAfter = widget.winId(); + QVERIFY(winIdBefore != winIdAfter); + QCOMPARE(widget.m_winIdChangeEventCount, 1); + } + + { + // Changing parent of a native widget + QWidget parent1, parent2; + WinIdChangeWidget child(&parent1); + const WId winIdBefore = child.winId(); + QCOMPARE(child.m_winIdChangeEventCount, 1); + child.setParent(&parent2); + const WId winIdAfter = child.internalWinId(); +#ifdef Q_OS_SYMBIAN + QVERIFY(winIdBefore != winIdAfter); + QCOMPARE(child.m_winIdChangeEventCount, 2); +#else + QCOMPARE(winIdBefore, winIdAfter); + QCOMPARE(child.m_winIdChangeEventCount, 1); +#endif + } + + { + // Changing parent of an alien widget + QWidget parent1, parent2; + WinIdChangeWidget child(&parent1); + const WId winIdBefore = child.internalWinId(); + child.setParent(&parent2); + const WId winIdAfter = child.internalWinId(); + QCOMPARE(winIdBefore, winIdAfter); + QCOMPARE(child.m_winIdChangeEventCount, 0); + } + + { + // Making native child widget into a top-level window + QWidget parent; + WinIdChangeWidget child(&parent); + child.winId(); + const WId winIdBefore = child.internalWinId(); + QCOMPARE(child.m_winIdChangeEventCount, 1); + const Qt::WindowFlags flags = child.windowFlags(); + child.setWindowFlags(flags | Qt::Window); + const WId winIdAfter = child.internalWinId(); + QVERIFY(winIdBefore != winIdAfter); + QCOMPARE(child.m_winIdChangeEventCount, 2); + } +} + +#ifdef Q_OS_SYMBIAN +void tst_QWidget::reparentCausesChildWinIdChange() +{ + QWidget *parent = new QWidget; + QWidget *w1 = new QWidget; + QWidget *w2 = new QWidget; + QWidget *w3 = new QWidget; + w1->setParent(parent); + w2->setParent(w1); + w3->setParent(w2); + + WId winId1 = w1->winId(); + WId winId2 = w2->winId(); + WId winId3 = w3->winId(); + + // reparenting causes winIds of the widget being reparented, and all of its children, to change + w1->setParent(0); + QVERIFY(w1->winId() != winId1); + winId1 = w1->winId(); + QVERIFY(w2->winId() != winId2); + winId2 = w2->winId(); + QVERIFY(w3->winId() != winId3); + winId3 = w3->winId(); + + w1->setParent(parent); + QVERIFY(w1->winId() != winId1); + winId1 = w1->winId(); + QVERIFY(w2->winId() != winId2); + winId2 = w2->winId(); + QVERIFY(w3->winId() != winId3); + winId3 = w3->winId(); + + w2->setParent(0); + QVERIFY(w2->winId() != winId2); + winId2 = w2->winId(); + QVERIFY(w3->winId() != winId3); + winId3 = w3->winId(); + + w2->setParent(parent); + QVERIFY(w2->winId() != winId2); + winId2 = w2->winId(); + QVERIFY(w3->winId() != winId3); + winId3 = w3->winId(); + + w2->setParent(w1); + QVERIFY(w2->winId() != winId2); + winId2 = w2->winId(); + QVERIFY(w3->winId() != winId3); + winId3 = w3->winId(); + + w3->setParent(0); + QVERIFY(w3->winId() != winId3); + winId3 = w3->winId(); + + w3->setParent(w1); + QVERIFY(w3->winId() != winId3); + winId3 = w3->winId(); + + w3->setParent(w2); + QVERIFY(w3->winId() != winId3); + winId3 = w3->winId(); + + delete parent; +} +#else void tst_QWidget::persistentWinId() { QWidget *parent = new QWidget; @@ -4404,6 +4547,7 @@ void tst_QWidget::persistentWinId() delete parent; } +#endif // Q_OS_SYMBIAN class ShowHideEventWidget : public QWidget { -- cgit v0.12 From 3554c42d0ca0c325769b8c4817ecc118e1e2fa63 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 9 Oct 2009 14:38:56 +0200 Subject: Doc: update known issues page (a little). (cherry picked from commit 21a84b26028ec7f44c9c5c69fa17528e77e17174) --- doc/src/getting-started/known-issues.qdoc | 140 +++++++++++++----------------- 1 file changed, 62 insertions(+), 78 deletions(-) diff --git a/doc/src/getting-started/known-issues.qdoc b/doc/src/getting-started/known-issues.qdoc index 6f8eb66..40ac1c7 100644 --- a/doc/src/getting-started/known-issues.qdoc +++ b/doc/src/getting-started/known-issues.qdoc @@ -45,20 +45,72 @@ \ingroup platform-specific \brief A summary of known issues in Qt %VERSION% at the time of release. - An up-to-date list of known issues with Qt %VERSION% can be found via the - \l{Task Tracker} on the Qt website which provides additional information - about known issues and tasks related to Qt. + This page documents known problems with the packaging and installation in + Qt %VERSION%, as well as issues with third party software that we have + not been able to work around. For a list of such issues in previous Qt + versions refer to this page in the respective documentation. - \section1 General Issues + For a list list of known bugs in Qt %VERSION%, see the \l{Task Tracker} + on the Qt website. - When running Qt applications on Windows or with \c{-graphicssystem raster}, - any process that triggers a QWidget::update() from within a destructor - might result in a crash. + \section1 Installation Issues + \section2 Building the Source Package on Windows 7 + + \list + \o When building Qt 4.5.0 with Windows 7, the build fails with an error + message regarding failing to embed manifest. This a known issue with + Windows 7, explained in the Windows 7 SDK Beta + \l{http://download.microsoft.com/download/8/8/0/8808A472-6450-4723-9C87-977069714B27/ReleaseNotes.Htm} + {release notes}. A workaround for this issue is to patch the + \bold{embed_manifest_exe.prf} file with the following: + + \code + diff --git a/mkspecs/features/win32/embed_manifest_exe.prf b/mkspecs/features/win32/embed_manifest_exe.prf + index e1747f1..05f116e 100644 + --- a/mkspecs/features/win32/embed_manifest_exe.prf + +++ b/mkspecs/features/win32/embed_manifest_exe.prf + @@ -8,4 +8,9 @@ if(win32-msvc2005|win32-msvc2008):!equals(TEMPLATE_PREFIX, "vc"):equals(TEMPLATE + QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(OBJECTS_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.ma + nifest\" -outputresource:$(DESTDIR_TARGET);1$$escape_expand(\n\t)) + QMAKE_POST_LINK += $$QMAKE_PREV_POST_LINK + QMAKE_CLEAN += \"$$replace(OBJECTS_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" + + isEmpty(RC_FILE) { + + system("echo.>$$replace(OUT_PWD,/,\\)\\$$replace(OBJECTS_DIR,/,\\)\\Windows7WorkAround.rc") + + RC_FILE = $$replace(OUT_PWD,/,\\)\\$$replace(OBJECTS_DIR,/,\\)\\Windows7WorkAround.rc + + } + + + } + \endcode + + \section2 Installing the Source Package on Unix systems + + \o If you download a Zip source package, you will need to convert + Windows-style line endings (CR/LF) to Unix-style line-endings (LF) when + you uncompress the package. To do this, give the "-a" option when you + run the "unzip' command. + + If you fail to supply the "-a" option when unzipping the package, you + will see the following error message when you attempt to execute the + configure command: + "bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory" + \endlist + + \section2 Installing on Mac OS X 10.6 "Snow Leopard" + \list + \o Performing a new install of the Qt 4.6 beta on Snow Leopard + triggers a bug in the installer that causes the install to fail. + Updating an existing Qt installation works fine. + + There are two workarounds, either disable spotlight for the target + drive during the install, or do a custom install where you deselect + documentation and examples. Run the installer again as a full + install to get the documentation and examples installed. + \endlist \section1 Issues with Third Party Software - \section2 X11 Hardware Support + \section2 X11 \list \o There is a bug in the 169.xx NVIDIA drivers on certain GeForce 8 series @@ -76,7 +128,7 @@ of the drivers. \endlist - \section2 Windows Hardware Support + \section2 Windows \list \o When using version 6.14.11.6921 of the NVIDIA drivers for the GeForce @@ -85,43 +137,6 @@ applications that use OpenGL. This problem can be worked around by reducing the level of graphics acceleration provided by the driver, or by disabling hardware acceleration completely. - \endlist - - \section2 Windows Software Issues - - \list - - \o When building Qt 4.5.0 with Windows 7, the build fails with an error - message regarding failing to embed manifest. This a known issue with - Windows 7, explained in the Windows 7 SDK Beta - \l{http://download.microsoft.com/download/8/8/0/8808A472-6450-4723-9C87-977069714B27/ReleaseNotes.Htm} - {release notes}. A workaround for this issue is to patch the - \bold{embed_manifest_exe.prf} file with the following: - - \code - diff --git a/mkspecs/features/win32/embed_manifest_exe.prf b/mkspecs/features/win32/embed_manifest_exe.prf - index e1747f1..05f116e 100644 - --- a/mkspecs/features/win32/embed_manifest_exe.prf - +++ b/mkspecs/features/win32/embed_manifest_exe.prf - @@ -8,4 +8,9 @@ if(win32-msvc2005|win32-msvc2008):!equals(TEMPLATE_PREFIX, "vc"):equals(TEMPLATE - QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(OBJECTS_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.ma - nifest\" -outputresource:$(DESTDIR_TARGET);1$$escape_expand(\n\t)) - QMAKE_POST_LINK += $$QMAKE_PREV_POST_LINK - QMAKE_CLEAN += \"$$replace(OBJECTS_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" - + isEmpty(RC_FILE) { - + system("echo.>$$replace(OUT_PWD,/,\\)\\$$replace(OBJECTS_DIR,/,\\)\\Windows7WorkAround.rc") - + RC_FILE = $$replace(OUT_PWD,/,\\)\\$$replace(OBJECTS_DIR,/,\\)\\Windows7WorkAround.rc - + } - + - } - \endcode - - \o Under certain circumstances Visual Studio Integration v1.4.0 will not - be able to install the integration for Visual Studio 2005 on Windows - Vista. An error message states that .NET Framework v2.0 Service Pack 1 - is not installed. This is due to a problem with the built-in - installation of this on Windows Vista. This issue can be fixed by - installing .NET Framework version 3.5. \o With NVIDIA GeForce 7950 GT (driver version 6.14.11.7824), a fullscreen QGLWidget flickers when child widgets are shown/hidden. The workaround @@ -133,42 +148,11 @@ \endlist - - \section2 Mac OS X Software Support + \section2 Mac OS X \list \o If a sheet is opened for a given window, clicking the title bar of that window will cause it to flash. This behavior has been reported to Apple (bug number 5827676). \endlist - - - \section2 Installing source packages on Unix systems - - \list - \o If you download a Zip source package, you will need to convert - Windows-style line endings (CR/LF) to Unix-style line-endings (LF) when - you uncompress the package. To do this, give the "-a" option when you - run the "unzip' command. - - If you fail to supply the "-a" option when unzipping the package, you - will see the following error message when you attempt to execute the - configure command: - "bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory" - \endlist - - - \section2 Running evaluation packages on Windows XP - - \list - \o If running the qt-win-eval-%VERSION%-vs2008.exe package on a Windows XP - system, you may encounter the following error message: - "The application failed to start because the application configuration - is incorrect. Reinstalling the application may fix this problem.". - - This error occurs because the version of the CRT component on the - system is incorrect. Visual Studio 2008 requires CRT90 while Windows - XP comes with CRT80. To solve this problem, please install the 2008 CRT - redistributable package from Microsoft. - \endlist */ -- cgit v0.12 From 9e3bbc70ef6bd383435bf8d46165050a87f05d55 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Fri, 9 Oct 2009 15:50:16 +0200 Subject: Fixed bug where calling fill on pixmap with active painter would crash. Calling QPixmap::fill() on a pixmap may in some cases cause the painter's paint engine pointer to become stale. A subsequent call to the painter would therefore crash. Now, QPixmap::fill() will print a warning and return in those cases. I also added a warning in the documentation of QPixmap::fill(). Task-number: QTBUG-2832 Reviewed-by: Trond --- src/gui/image/qpixmap.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 558ae54..8133cc0 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -947,6 +947,9 @@ bool QPixmap::doImageIO(QImageWriter *writer, int quality) const /*! Fills the pixmap with the given \a color. + The effect of this function is undefined when the pixmap is + being painted on. + \sa {QPixmap#Pixmap Transformations}{Pixmap Transformations} */ @@ -955,6 +958,13 @@ void QPixmap::fill(const QColor &color) if (isNull()) return; + // Some people are probably already calling fill while a painter is active, so to not break + // their programs, only print a warning and return when the fill operation could cause a crash. + if (paintingActive() && (color.alpha() != 255) && !hasAlphaChannel()) { + qWarning("QPixmap::fill: Cannot fill while pixmap is being painted on"); + return; + } + detach(); data->fill(color); } -- cgit v0.12 From 2876de7746cacd32d7a3e5e479ccbfd8a1ec1480 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Oct 2009 12:26:29 +0200 Subject: Changing S60 to Symbian in the Docs Changing names to Symbian platform Task-number: QT-2268 Rev-by: Espen Riskedal (cherry picked from commit dac817b8d3bbcfcad34295f134dfafbf0a26c23f) --- doc/src/development/qmake-manual.qdoc | 87 ++++++++++++++++--------------- doc/src/getting-started/installation.qdoc | 48 +++++++++-------- doc/src/howtos/appicon.qdoc | 4 +- doc/src/platforms/qt-embedded.qdoc | 7 +-- doc/src/platforms/s60-introduction.qdoc | 27 +++++----- 5 files changed, 91 insertions(+), 82 deletions(-) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index f2cae5b..87132cc 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -920,7 +920,7 @@ {deployment guide for Windows}. - \section1 S60 + \section1 Symbian platform Features specific to this platform include handling of static data, capabilities, stack and heap size, compiler specific options, and unique @@ -940,7 +940,7 @@ \section2 Stack and heap size - Symbian uses predefined sizes for stacks and heaps. If an + The Symbian platform uses predefined sizes for stacks and heaps. If an application exceeds either limit, it may crash or fail to complete its task. Crashes that seem to have no reason can often be traced back to insufficient stack and/or heap sizes. @@ -1095,7 +1095,7 @@ \target BLD_INF_RULES \section1 BLD_INF_RULES - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Generic \c bld.inf file content can be specified with \c BLD_INF_RULES variables. The section of \c bld.inf file where each rule goes is appended to @@ -1288,7 +1288,7 @@ The build process for bundles is also influenced by the contents of the \l{#QMAKE_BUNDLE_DATA}{QMAKE_BUNDLE_DATA} variable. - These options only have an effect on Symbian: + These options only have an effect on the Symbian platform: \table 95% \header \o Option \o Description @@ -1345,7 +1345,7 @@ \target DEPLOYMENT \section1 DEPLOYMENT - \e {This is only used on Windows CE and Symbian.} + \e {This is only used on Windows CE and the Symbian platform.} Specifies which additional files will be deployed. Deployment means the transfer of files from the development system to the target device or @@ -1363,8 +1363,8 @@ The default deployment target path for Windows CE is \c{%CSIDL_PROGRAM_FILES%\target}, which usually gets expanded to - \c{\Program Files\target}. For Symbian, the default target is the application - private directory on the drive it is installed to. + \c{\Program Files\target}. For the Symbian platform, the default target +is the application private directory on the drive it is installed to. It is also possible to specify multiple \c sources to be deployed on target \c paths. In addition, different variables can be used for @@ -1375,10 +1375,10 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 29 \note In Windows CE all linked Qt libraries will be deployed to the path - specified by \c{myFiles.path}. In Symbian all libraries and executables + specified by \c{myFiles.path}. On Symbian platform all libraries and executables will always be deployed to the \\sys\\bin of the installation drive. - Since the Symbian build system automatically moves binaries to certain + Since the Symbian platform build system automatically moves binaries to certain directories under the epoc32 directory, custom plugins, executables or dynamically loadable libraries need special handling. When deploying extra executables or dynamically loadable libraries, the target path @@ -1393,13 +1393,13 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 128 - In Symbian, generic PKG file content can also be specified with this + On the Symbian platform, generic PKG file content can also be specified with this variable. You can use either \c pkg_prerules or \c pkg_postrules to pass raw data to PKG file. The strings in \c pkg_prerules are added before package-body and \c pkg_postrules after. The strings defined in \c pkg_postrules or \c pkg_prerules are not parsed by qmake, so they should be in a format understood by Symbian package generation tools. - Please consult Symbian documentation for correct syntax. + Please consult the Symbian platform documentation for correct syntax. For example, to deploy DLL and add a new dependency: @@ -1424,7 +1424,7 @@ override languages statement, you must override also package-header statement and all other statements which are language specific. - In Symbian, the \c default_deployment item specifies + On the Symbian platform, the \c default_deployment item specifies default platform dependencies. It can be overwritten if a more restrictive set is needed - e.g. if a specific device is required to run the application. @@ -1436,7 +1436,7 @@ \target DEPLOYMENT_PLUGIN \section1 DEPLOYMENT_PLUGIN - \e {This is only used on Windows CE and Symbian.} + \e {This is only used on Windows CE and the Symbian platform.} This variable specifies the Qt plugins that will be deployed. All plugins available in Qt can be explicitly deployed to the device. See @@ -1446,9 +1446,9 @@ If the application depends on plugins, these plugins have to be specified manually. - \note In Symbian, all plugins supported by this variable will be deployed - by default with Qt libraries, so generally using this variable is not - needed. + \note On the Symbian platform, all plugins supported by this variable +will be deployed by default with Qt libraries, so generally using this +variable is not needed. For example: @@ -1556,7 +1556,7 @@ \target ICON \section1 ICON - This variable is used only in MAC and S60 to set the application icon. + This variable is used only in MAC and the Symbian platform to set the application icon. Please see \l{Setting the Application Icon}{the application icon documentation} for more information. @@ -1623,10 +1623,10 @@ This variable contains a list of libraries to be linked into the project. You can use the Unix \c -l (library) and -L (library path) flags and qmake - will do the correct thing with these libraries on Windows and Symbian - (namely this means passing the full path of the library to the linker). The - only limitation to this is the library must exist, for qmake to find which - directory a \c -l lib lives in. + will do the correct thing with these libraries on Windows and the + Symbian platform (namely this means passing the full path of the library to + the linker). The only limitation to this is the library must exist, for + qmake to find which directory a \c -l lib lives in. For example: @@ -1647,7 +1647,8 @@ explicitly specify the library to be used by including the \c{.lib} file name suffix. - \bold{Note:} On S60, the build system makes a distinction between shared and + \bold{Note:} On the Symbian platform, the build system makes a +distinction between shared and static libraries. In most cases, qmake will figure out which library you are refering to, but in some cases you may have to specify it explicitly to get the expected behavior. This typically happens if you are building a @@ -1693,7 +1694,7 @@ \target MMP_RULES \section1 MMP_RULES - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Generic MMP file content can be specified with this variable. @@ -2013,8 +2014,9 @@ the \c QMAKE_CXXFLAGS_DEBUG and \c QMAKE_CXXFLAGS_RELEASE variables, respectively. - \bold{Note:} On S60, this variable can be used to pass architecture specific - options to each compiler in the Symbian build system. For example: + \bold{Note:} On the Symbian platform, this variable can be used to pass +architecture specific options to each compiler in the Symbian build system. +For example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 131 @@ -2812,7 +2814,7 @@ \target RSS_RULES \section1 RSS_RULES - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Generic RSS file content can be specified with this variable. The syntax is similar to \c MMP_RULES and \c BLD_INF_RULES. @@ -2832,10 +2834,12 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 145 - This example will install the application to MyFolder in S60 application - shell. In addition it will make the application to be launched in background. + This example will install the application to MyFolder in the Symbian + platform application shell. In addition it will make the application to + be launched in background. - For detailed list of possible RSS statements, please refer to Symbian OS help. + For detailed list of possible RSS statements, please refer to the + Symbian platform help. \note You should not use \c RSS_RULES variable to set the following RSS statements: @@ -2848,7 +2852,7 @@ \target S60_VERSION \section1 S60_VERSION - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Contains the version number of the underlying S60 SDK; e.g. "5.0". @@ -2918,7 +2922,7 @@ \target TARGET.CAPABILITY \section1 TARGET.CAPABILITY - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies which platform capabilities the application should have. For more information, please refer to the S60 SDK documentation. @@ -2926,7 +2930,7 @@ \target TARGET.EPOCALLOWDLLDATA \section1 TARGET.EPOCALLOWDLLDATA - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies whether static data should be allowed in the application. Symbian disallows this by default in order to save memory. To use it, set this to 1. @@ -2934,7 +2938,7 @@ \target TARGET.EPOCHEAPSIZE \section1 TARGET.EPOCHEAPSIZE - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies the minimum and maximum heap size of the application. The program will refuse to run if the minimum size is not available when it starts. For @@ -2945,7 +2949,7 @@ \target TARGET.EPOCSTACKSIZE \section1 TARGET.EPOCSTACKSIZE - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies the maximum stack size of the application. For example: @@ -2954,7 +2958,7 @@ \target TARGET.SID \section1 TARGET.SID - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies which secure identifier to use for the target application or library. For more information, see the S60 SDK documentation. @@ -2962,7 +2966,7 @@ \target TARGET.UID2 \section1 TARGET.UID2 - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies which unique identifier 2 to use for the target application or library. If this variable is not specified, it defaults to the same value @@ -2971,7 +2975,7 @@ \target TARGET.UID3 \section1 TARGET.UID3 - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies which unique identifier 3 to use for the target application or library. If this variable is not specified, a UID3 suitable for development @@ -2982,7 +2986,7 @@ \target TARGET.VID \section1 TARGET.VID - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies which vendor identifier to use for the target application or library. For more information, see the S60 SDK documentation. @@ -3862,9 +3866,10 @@ \o Indicates that the output should not be added to the list of objects to be linked in. \endtable - \note Symbian specific: Generating objects to be linked in is not supported in Symbian, - so either the \c CONFIG option \c no_link or variable \c variable_out - should always be defined for extra compilers. + \note Symbian platform specific: Generating objects to be linked in is + not supported on the Symbian platform, so either the \c CONFIG option + \c no_link or variable \c variable_out should always be defined for + extra compilers. */ diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 2ace8de..366a906 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -497,14 +497,14 @@ in the \l{Qt for Windows CE Requirements} document. We hope you will enjoy using Qt. Good luck! */ -/*! \page install-S60-installer.html +/*! \page install-Symbian-installer.html -\title Installing Qt on S60 using binary package +\title Installing Qt on the Symbian platform using binary package \ingroup qts60 -\brief How to install Qt on S60 using the binary package. +\brief How to install Qt on the Symbian platform using the binary package. -\note Qt for S60 has some requirements that are given in more detail -in the \l{Qt for S60 Requirements} document. +\note Qt for Symbian platform has some requirements that are given in more detail +in the \l{Qt for Symbian platform Requirements} document. \list 1 @@ -527,7 +527,7 @@ in the \l{Qt for S60 Requirements} document. and follow the instructions. To run the demos and examples on the emulator, you need to build them first. - Open the "Qt for S60 Command Prompt" from the Start menu and type: + Open the "Qt for Symbian platform Command Prompt" from the Start menu and type: \snippet doc/src/snippets/code/doc_src_installation.qdoc 25 @@ -536,27 +536,29 @@ in the \l{Qt for S60 Requirements} document. \snippet doc/src/snippets/code/doc_src_installation.qdoc 27 - For more information about building and running Qt programs on S60, - see \l{S60 - Introduction to using Qt}. + For more information about building and running Qt programs on the +Symbian platform, + see \l{Symbian platform - Introduction to using Qt}. We hope you will enjoy using Qt. \endlist */ -/*! \page install-S60.html +/*! \page install-Symbian.html -\title Installing Qt on S60 +\title Installing Qt on the Symbian platform \ingroup installation \ingroup qts60 -\brief How to install Qt on S60 +\brief How to install Qt for the Symbian platform -\note Qt for S60 has some requirements that are given in more detail -in the \l{Qt for S60 Requirements} document. +\note Qt for the Symbian platform has some requirements that are given in more detail +in the \l{Qt for Symbian platform Requirements} document. -\note \bold {This document describes how to install and configure Qt for S60 from scratch. +\note \bold {This document describes how to install and configure Qt for +the Symbian platform from scratch. If you are using pre-built binaries, follow the instructions -\l{Installing Qt on S60 using binary package}{here}.} +\l{Installing Qt on the Symbian platform using binary package}{here}.} \list 1 @@ -586,7 +588,7 @@ If you are using pre-built binaries, follow the instructions \o Configure Qt - To configure Qt for S60, do: + To configure Qt for the Symbian platform, do: \snippet doc/src/snippets/code/doc_src_installation.qdoc 23 to build the tools using MinGW, and the libraries using abld. @@ -633,8 +635,8 @@ If you are using pre-built binaries, follow the instructions \snippet doc/src/snippets/code/doc_src_installation.qdoc 27 - For more information about building and running Qt programs on S60, - see \l{S60 - Introduction to using Qt}. + For more information about building and running Qt programs on the +Symbian platform, see \l{Symbian platform - Introduction to using Qt}. We hope you will enjoy using Qt. @@ -669,7 +671,7 @@ If you are using pre-built binaries, follow the instructions \list \o \l{Qt for Embedded Linux Requirements} \o \l{Qt for Mac OS X Requirements} - \o \l{Qt for S60 Requirements} + \o \l{Qt for Symbian platform Requirements} \o \l{Qt for Windows CE Requirements} \o \l{Qt for Windows Requirements} \o \l{Qt for X11 Requirements} @@ -953,13 +955,13 @@ If you are using pre-built binaries, follow the instructions */ /*! - \page requirements-s60.html - \title Qt for S60 Requirements + \page requirements-symbian.html + \title Qt for Symbian platform Requirements \ingroup installation - \brief Setting up the S60 environment for Qt. + \brief Setting up the Symbian platform environment for Qt. \previouspage General Qt Requirements - Qt for S60 requires the following software installed on your development PC: + Qt for Symbian platform requires the following software installed on your development PC: \list \o \l{http://www.mingw.org/}{MinGW 3.4.5 or higher}, or another windows compiler to build the tools. \o \l{http://www.forum.nokia.com/main/resources/tools_and_sdks/carbide_cpp/}{Carbide.c++ v2.0.0 or higher} diff --git a/doc/src/howtos/appicon.qdoc b/doc/src/howtos/appicon.qdoc index ece2dcf..4108c11 100644 --- a/doc/src/howtos/appicon.qdoc +++ b/doc/src/howtos/appicon.qdoc @@ -213,9 +213,9 @@ The GNOME developer website is at \l{http://developer.gnome.org/}. - \section1 Setting the Application Icon on S60 platforms + \section1 Setting the Application Icon on the Symbian platform - In order to set the application icon for S60 applications, you need + In order to set the application icon for Symbian platform applications, you need an SVG-T icon. For information on how to create SVG-T compliant icons, please refer to \l{http://wiki.forum.nokia.com/index.php/How_to_create_application_icon(SVG)_in_S60_3rd_edition/} diff --git a/doc/src/platforms/qt-embedded.qdoc b/doc/src/platforms/qt-embedded.qdoc index 0b2c2ac..c39a967 100644 --- a/doc/src/platforms/qt-embedded.qdoc +++ b/doc/src/platforms/qt-embedded.qdoc @@ -54,7 +54,7 @@ Currently, three embedded platforms are supported by Qt: \table 90% - \header \o Embedded Linux \o Windows CE \o S60 + \header \o Embedded Linux \o Windows CE \o Symbian platform \row \o \l{Qt for Embedded Linux} is designed to be used on Linux devices without X11 or existing graphical environments. This flavor of @@ -67,8 +67,9 @@ Applications use the appropriate style for the embedded environment and use native features, such as menus, to conform to the native style guidelines. - \o \l{S60 - Introduction to using Qt}{Qt for S60} is used to create - applications running in existing S60 environments. + \o \l{Symbian platform - Introduction to using Qt}{Qt for the Symbian +platform} is used to create + applications running in existing Symbian platform environments. Applications use the appropriate style for the embedded environment and use native features, such as menus, to conform to the native style guidelines. diff --git a/doc/src/platforms/s60-introduction.qdoc b/doc/src/platforms/s60-introduction.qdoc index 086ee52..d145a82 100644 --- a/doc/src/platforms/s60-introduction.qdoc +++ b/doc/src/platforms/s60-introduction.qdoc @@ -40,10 +40,10 @@ ****************************************************************************/ /*! - \page s60-with-qt-introduction.html + \page symbian-with-qt-introduction.html - \title S60 - Introduction to using Qt - \brief An introduction to Qt for S60 developers. + \title Symbian platform - Introduction to using Qt + \brief An introduction to Qt for Symbian platform developers. \ingroup howto \ingroup qts60 @@ -51,21 +51,22 @@ \section1 Required tools - See \l{Qt for S60 Requirements} to see what tools are required to use Qt for S60. + See \l{Qt for Symbian platform Requirements} to see what tools are +required to use Qt for Symbian platform. \section1 Installing Qt and running demos - Follow the instructions found in \l{Installing Qt on S60 using binary package} to learn how + Follow the instructions found in \l{Installing Qt on the Symbian platform using binary package} to learn how to install Qt using binary package and how to build and run Qt demos. - Follow the instructions found in \l{Installing Qt on S60} to learn how to install Qt using + Follow the instructions found in \l{Installing Qt on the Symbian platform} to learn how to install Qt using using source package and how to build and run the Qt demos. \section1 Building your own applications If you are new to Qt development, have a look at \l{How to Learn Qt}. In general, the difference between developing a - Qt application on S60 compared to any of the other platforms supported + Qt application on the Symbian platform compared to any of the other platforms supported by Qt is not that big. Once you have crated a \c .pro file for your project, generate the @@ -76,10 +77,10 @@ For more information on how to use qmake have a look at the \l {qmake Tutorial}. - Now you can build the Qt on S60 application with standard build - tools. By default, running \c make will produce binaries for the - emulator. However, S60 comes with several alternative build targets, - as shown in the table below: + Now you can build the Qt for the Symbian platform application with +standard build tools. By default, running \c make will produce binaries for +the emulator. However, the Symbian platform comes with several alternative +build targets, as shown in the table below: \table \row \o \c debug-winscw \o Build debug binaries for the emulator (default). @@ -121,8 +122,8 @@ \row \o \c QT_SIS_OPTIONS \o Options accepted by \c .sis creation. -i, install the package right away using PC suite. -c=, read certificate information from a file. - Execute \c{createpackage.pl} script without any - parameters for more information about options. + Execute \c{perl createpackage.pl} for more information + about options. By default no otions are given. \row \o \c QT_SIS_TARGET \o Target for which \c .sis file is created. Accepted values are build targets listed in -- cgit v0.12 From 3a7e4bc692d5d470645f16d5064b19895f4d8674 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Oct 2009 12:27:37 +0200 Subject: Changing S60 to Symbian in the Docs Changing names to Symbian platform Task-number: QT-2268 Rev-by: Espen Riskedal (cherry picked from commit 7d75f1427f80df87b728baa8c7f63f7a7762d280) --- doc/src/images/qt-embedded-architecture.png | Bin 22388 -> 8511 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/doc/src/images/qt-embedded-architecture.png b/doc/src/images/qt-embedded-architecture.png index d3f8edc..20b3e7f 100644 Binary files a/doc/src/images/qt-embedded-architecture.png and b/doc/src/images/qt-embedded-architecture.png differ -- cgit v0.12 From 79bbdba36c647726cd484350270e61453f3ef374 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 9 Oct 2009 15:11:26 +0300 Subject: Fixed miscellaneous minor problems with Symbian docs. Reviewed-by: Espen Riskedal (cherry picked from commit d66df793b88f9ba924a1fefcec325d7c04af3ac3) --- doc/src/howtos/exceptionsafety.qdoc | 8 ++++---- doc/src/platforms/platform-notes.qdoc | 4 +++- doc/src/platforms/s60-introduction.qdoc | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/src/howtos/exceptionsafety.qdoc b/doc/src/howtos/exceptionsafety.qdoc index 23bedf5..fa1427b 100644 --- a/doc/src/howtos/exceptionsafety.qdoc +++ b/doc/src/howtos/exceptionsafety.qdoc @@ -144,12 +144,12 @@ \section1 Platform-Specific Exception Handling - \section2 Symbian (Qt for S60) + \section2 The Symbian platform The Symbian platform implements its own exception system that differs from the standard - C++ mechanism. When using Qt for S60, and especially when writing code to access Symbian - functionality directly, it may be necessary to know about the underlying implementation - and how it interacts with Qt. + C++ mechanism. When using Qt for Symbian platform, and especially when writing code to + access Symbian functionality directly, it may be necessary to know about the underlying + implementation and how it interacts with Qt. The \l{Exception Safety with Symbian} document shows how to use the facilities provided by Qt to use exceptions as safely as possible. diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index 5be66f8..9896b08 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -67,6 +67,8 @@ \tableofcontents{1 Platform Notes - Windows} \o \l{Platform Notes - Mac OS X} \tableofcontents{1 Platform Notes - Mac OS X} + \o \l{Platform Notes - Symbian} + \tableofcontents{1 Platform Notes - Symbian} \o \l{Platform Notes - Embedded Linux} \tableofcontents{1 Platform Notes - Embedded Linux} \o \l{Platform Notes - Windows CE} @@ -409,7 +411,7 @@ to run on. More information about the combinations of platforms and compilers supported by Qt can be found on the \l{Supported Platforms} page. - For information about mixing exceptions with symbian leaves, + For information about mixing exceptions with Symbian leaves, see \l{Exception Safety with Symbian} \section1 Multimedia and Phonon Support diff --git a/doc/src/platforms/s60-introduction.qdoc b/doc/src/platforms/s60-introduction.qdoc index d145a82..d27eb39 100644 --- a/doc/src/platforms/s60-introduction.qdoc +++ b/doc/src/platforms/s60-introduction.qdoc @@ -122,8 +122,8 @@ build targets, as shown in the table below: \row \o \c QT_SIS_OPTIONS \o Options accepted by \c .sis creation. -i, install the package right away using PC suite. -c=, read certificate information from a file. - Execute \c{perl createpackage.pl} for more information - about options. + Execute \c{createpackage.pl} script without any + parameters for more information about options. By default no otions are given. \row \o \c QT_SIS_TARGET \o Target for which \c .sis file is created. Accepted values are build targets listed in -- cgit v0.12 From b8e372801ae87c0c2fb5ab574928a046f685c10e Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 9 Oct 2009 16:16:20 +0300 Subject: Changed several S60 references to Symbian references in docs. Reviewed-by: Janne Koskinen (cherry picked from commit 37253e2c1c6a8b1dede8f261fb40d8442008f6d8) --- doc/src/development/qmake-manual.qdoc | 18 ++++++++---------- doc/src/getting-started/installation.qdoc | 12 ++++++------ doc/src/qt4-intro.qdoc | 2 +- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 87132cc..d040d3d 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -952,7 +952,7 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 130 - The default values depend on the version of the S60 SDK you're using. + The default values depend on the version of the Symbian SDK you're using. \section2 Compiler specific options @@ -983,8 +983,7 @@ an official UID, please contact Nokia. Both \c SID and \c VID default to empty values. For more information about unique identifiers and their meaning for - Symbian applications, please refer to the - \l{http://www.symbian.com/developer/techlib/v9.2docs/doc_source/ToolsAndUtilities/BuildTools/UsingUids.guide.html}{respective S60 SDK documentation}. + Symbian applications, please refer to the Symbian SDK documentation. \section2 Capabilities @@ -1000,8 +999,7 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 134 - For more information about capabilities, please refer to the - \l{http://www.symbian.com/developer/techlib/v9.2docs/doc_source/guide/platsecsdk/index.html}{respective S60 SDK documentation}. + For more information about capabilities, please refer to the Symbian SDK documentation. */ /*! @@ -2925,7 +2923,7 @@ For example: \e {This is only used on the Symbian platform.} Specifies which platform capabilities the application should have. For more - information, please refer to the S60 SDK documentation. + information, please refer to the Symbian SDK documentation. \target TARGET.EPOCALLOWDLLDATA \section1 TARGET.EPOCALLOWDLLDATA @@ -2961,7 +2959,7 @@ For example: \e {This is only used on the Symbian platform.} Specifies which secure identifier to use for the target application or - library. For more information, see the S60 SDK documentation. + library. For more information, see the Symbian SDK documentation. \target TARGET.UID2 \section1 TARGET.UID2 @@ -2970,7 +2968,7 @@ For example: Specifies which unique identifier 2 to use for the target application or library. If this variable is not specified, it defaults to the same value - as TARGET.UID3. For more information, see the S60 SDK documentation. + as TARGET.UID3. For more information, see the Symbian SDK documentation. \target TARGET.UID3 \section1 TARGET.UID3 @@ -2981,7 +2979,7 @@ For example: library. If this variable is not specified, a UID3 suitable for development and debugging will be generated automatically. However, applications being released should always define this variable. For more information, see the - S60 SDK documentation. + Symbian SDK documentation. \target TARGET.VID \section1 TARGET.VID @@ -2989,7 +2987,7 @@ For example: \e {This is only used on the Symbian platform.} Specifies which vendor identifier to use for the target application or - library. For more information, see the S60 SDK documentation. + library. For more information, see the Symbian SDK documentation. \section1 TARGET_EXT diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 366a906..8269552 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -510,9 +510,9 @@ in the \l{Qt for Symbian platform Requirements} document. \o Install Qt - Run \c{qt-s60-%VERSION%.exe} and follow the instructions. + Run \c{qt-symbian-opensource-%VERSION%.exe} and follow the instructions. - \note Qt must be installed on the same drive as the S60 SDK you are + \note Qt must be installed on the same drive as the Symbian SDK you are using, and the install path must not contain any spaces. \o Running Qt demos @@ -567,7 +567,7 @@ If you are using pre-built binaries, follow the instructions Uncompress the package into the directory you want Qt installed, e.g. \c{C:\Qt\%VERSION%}. - \note Qt must be installed on the same drive as the S60 SDK you are + \note Qt must be installed on the same drive as the Symbian SDK you are using, and the install path must not contain any spaces. \o Environment variables @@ -582,7 +582,7 @@ If you are using pre-built binaries, follow the instructions On Windows the PATH can be extended by navigating to "Control Panel->System->Advanced->Environment variables". - In addition, you must configure the environment for use with the S60 + In addition, you must configure the environment for use with the Symbian emulator. This is done by locating the Carbide.c++ submenu on the Start menu, and choosing "Configure environment for WINSCW command line". @@ -972,13 +972,13 @@ Symbian platform, see \l{Symbian platform - Introduction to using Qt}. \endlist \o \l{http://www.forum.nokia.com/main/resources/tools_and_sdks/S60SDK/}{S60 Platform SDK 3rd Edition FP1 or higher} \o \l{http://www.forum.nokia.com/main/resources/technologies/openc_cpp/}{Open C/C++ v1.6.0 or higher}. - Install this to all S60 SDKs you plan to use Qt with. + Install this to all Symbian SDKs you plan to use Qt with. \o Building Qt libraries requires \l{http://www.arm.com/products/DevTools/RVCT.html}{RVCT} 2.2 [build 686] or later, which is not available free of charge. \endlist Running Qt on real device requires the following packages to be installed on your device. - The packages can be found in the S60 SDK where you installed Open C/C++: + The packages can be found in the Symbian SDK where you installed Open C/C++: \list \o \c{nokia_plugin\openc\s60opencsis\pips_s60_.sis} \o \c{nokia_plugin\openc\s60opencsis\openc_ssl_s60_.sis} diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index 6224cd4..d63d0eb 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -488,7 +488,7 @@ Qt 4.6 is the first release to include support for the Symbian platform, with integration into the S60 framework. The port to Symbian and S60 provides all functionality required to develop - rich end-user applications for devices running Symbian 3.1 and + rich end-user applications for devices running S60 3.1 and later. \section1 Animation Framework -- cgit v0.12 From 408803ec1ab89582c0ca853f1fc2058131278f6a Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 9 Oct 2009 16:24:55 +0300 Subject: Fixed documentation links in README.s60 Task-number: QTBUG-4806 Reviewed-by: Janne Koskinen (cherry picked from commit 07456fc966504c18465d80b988038b009349a0fa) --- README.s60 | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.s60 b/README.s60 index f9d7aaf..2137135 100644 --- a/README.s60 +++ b/README.s60 @@ -5,16 +5,16 @@ this pre-release you can make advanced graphical applications and utilize TCP/IP connections. More specifically, these modules are now available for S60: -QtCore - http://doc.trolltech.com/4.6/qtcore.html -QtGui - http://doc.trolltech.com/4.6/qtgui.html -QtNetwork - http://doc.trolltech.com/4.6/qtnetwork.html -QtScript - http://doc.trolltech.com/4.6/qtscript.html -QtSql - http://doc.trolltech.com/4.6/qtsql.html -QtSvg - http://doc.trolltech.com/4.6/qtsvg.html -QtTest - http://doc.trolltech.com/4.6/qttest.html -QtWebKit - http://doc.trolltech.com/4.6/qtwebkit.html -QtXml - http://doc.trolltech.com/4.6/qtxml.html -Phonon - http://doc.trolltech.com/4.6/phonon-module.html +QtCore - http://doc.trolltech.com/4.6-snapshot/qtcore.html +QtGui - http://doc.trolltech.com/4.6-snapshot/qtgui.html +QtNetwork - http://doc.trolltech.com/4.6-snapshot/qtnetwork.html +QtScript - http://doc.trolltech.com/4.6-snapshot/qtscript.html +QtSql - http://doc.trolltech.com/4.6-snapshot/qtsql.html +QtSvg - http://doc.trolltech.com/4.6-snapshot/qtsvg.html +QtTest - http://doc.trolltech.com/4.6-snapshot/qttest.html +QtWebKit - http://doc.trolltech.com/4.6-snapshot/qtwebkit.html +QtXml - http://doc.trolltech.com/4.6-snapshot/qtxml.html +Phonon - http://doc.trolltech.com/4.6-snapshot/phonon-module.html INSTALLING Qt @@ -23,7 +23,7 @@ Follow the instructions in the INSTALL file. REFERENCE DOCUMENTATION The Qt reference documentation is available locally in Qt's doc/html -directory or at http://doc.trolltech.com/4.6/index.html +directory or at http://doc.trolltech.com/4.6-snapshot/index.html SUPPORTED PLATFORMS -- cgit v0.12 From be6290e695329974b946d064ceb2cd9fa2ad5f57 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 8 Oct 2009 21:20:22 +0200 Subject: Color role with higher contrast for focusrect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Low-risk, high value change. Beta worthy! As much as QPalette::Highlight sounds like a suitable color role for drawing a focus rect... It simply did not work well with a lot of S60 themes (e.g. the default N95 theme). QPalette::Text is a better candidate, since the S60 themes promise a good contrast of text on background graphics. Reviewed-By: Sami Merilä (cherry picked from commit a35c52abe95f224af062550e4954f7cbefca1bd8) --- src/gui/styles/qs60style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 6bdb79e..465492d 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1865,7 +1865,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, painter->save(); painter->setRenderHint(QPainter::Antialiasing); painter->setOpacity(opacity); - painter->setPen(QPen(option->palette.color(QPalette::Highlight), penWidth)); + painter->setPen(QPen(option->palette.color(QPalette::Text), penWidth)); painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius); painter->restore(); } -- cgit v0.12 From 53c265f7c35c613de71c336ed95b04da30c8b602 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 9 Oct 2009 19:09:09 +0200 Subject: A new implementation of the Gesture API. Implemented gestures using gesture events and separate QGesture/QGestureRecognizer classes. Reviewed-by: trustme --- examples/gestures/imageviewer/imageviewer.pro | 13 +- examples/gestures/imageviewer/imagewidget.cpp | 80 ++- examples/gestures/imageviewer/imagewidget.h | 15 +- .../gestures/imageviewer/tapandholdgesture.cpp | 155 ----- examples/gestures/imageviewer/tapandholdgesture.h | 74 -- src/corelib/global/qnamespace.h | 29 +- src/corelib/global/qnamespace.qdoc | 2 - src/corelib/kernel/qcoreevent.cpp | 2 + src/corelib/kernel/qcoreevent.h | 4 + src/gui/graphicsview/qgraphicsitem.cpp | 9 + src/gui/graphicsview/qgraphicsitem.h | 4 + src/gui/graphicsview/qgraphicsitem_p.h | 1 + src/gui/graphicsview/qgraphicsscene.cpp | 11 +- src/gui/graphicsview/qgraphicsscene.h | 1 + src/gui/kernel/kernel.pri | 15 +- src/gui/kernel/qapplication.cpp | 89 +++ src/gui/kernel/qapplication.h | 5 + src/gui/kernel/qapplication_p.h | 22 +- src/gui/kernel/qapplication_win.cpp | 39 +- src/gui/kernel/qevent.cpp | 74 ++ src/gui/kernel/qevent.h | 34 + src/gui/kernel/qgesture.cpp | 428 ++++++------ src/gui/kernel/qgesture.h | 153 +++- src/gui/kernel/qgesture_p.h | 76 +- src/gui/kernel/qgesturemanager.cpp | 453 ++++++++++++ src/gui/kernel/qgesturemanager_p.h | 125 ++++ src/gui/kernel/qgesturerecognizer.cpp | 71 ++ src/gui/kernel/qgesturerecognizer.h | 93 +++ src/gui/kernel/qstandardgestures.cpp | 775 +++------------------ src/gui/kernel/qstandardgestures.h | 174 ----- src/gui/kernel/qstandardgestures_p.h | 77 +- src/gui/kernel/qwidget.cpp | 11 + src/gui/kernel/qwidget.h | 5 +- src/gui/kernel/qwidget_p.h | 4 + src/gui/kernel/qwidget_win.cpp | 29 +- .../kernel/qwinnativepangesturerecognizer_win.cpp | 124 ++++ .../kernel/qwinnativepangesturerecognizer_win_p.h | 73 ++ src/gui/widgets/qabstractscrollarea.cpp | 56 +- src/gui/widgets/qabstractscrollarea.h | 4 - src/gui/widgets/qabstractscrollarea_p.h | 3 - src/gui/widgets/qplaintextedit.cpp | 55 +- src/gui/widgets/qplaintextedit.h | 4 - src/gui/widgets/qplaintextedit_p.h | 5 - tests/auto/auto.pro | 3 +- tests/auto/gestures/gestures.pro | 5 + tests/auto/gestures/tst_gestures.cpp | 625 +++++++++++++++++ tests/manual/gestures/graphicsview/gestures.cpp | 90 +++ tests/manual/gestures/graphicsview/gestures.h | 37 + .../manual/gestures/graphicsview/graphicsview.pro | 17 + tests/manual/gestures/graphicsview/imageitem.cpp | 52 ++ tests/manual/gestures/graphicsview/imageitem.h | 36 + tests/manual/gestures/graphicsview/main.cpp | 187 +++++ .../graphicsview/mousepangesturerecognizer.cpp | 95 +++ .../graphicsview/mousepangesturerecognizer.h | 57 ++ tests/manual/gestures/pinch/main.cpp | 68 -- tests/manual/gestures/pinch/pinch.pro | 4 - tests/manual/gestures/pinch/pinch.qrc | 5 - tests/manual/gestures/pinch/pinchwidget.cpp | 118 ---- tests/manual/gestures/pinch/pinchwidget.h | 78 --- tests/manual/gestures/pinch/qt-logo.png | Bin 13923 -> 0 bytes tests/manual/gestures/scrollarea/main.cpp | 188 +++++ .../scrollarea/mousepangesturerecognizer.cpp | 94 +++ .../scrollarea/mousepangesturerecognizer.h | 57 ++ tests/manual/gestures/scrollarea/scrollarea.pro | 3 + tests/manual/gestures/twopanwidgets/main.cpp | 135 ---- .../gestures/twopanwidgets/twopanwidgets.pro | 1 - 66 files changed, 3437 insertions(+), 1994 deletions(-) delete mode 100644 examples/gestures/imageviewer/tapandholdgesture.cpp delete mode 100644 examples/gestures/imageviewer/tapandholdgesture.h create mode 100644 src/gui/kernel/qgesturemanager.cpp create mode 100644 src/gui/kernel/qgesturemanager_p.h create mode 100644 src/gui/kernel/qgesturerecognizer.cpp create mode 100644 src/gui/kernel/qgesturerecognizer.h delete mode 100644 src/gui/kernel/qstandardgestures.h create mode 100644 src/gui/kernel/qwinnativepangesturerecognizer_win.cpp create mode 100644 src/gui/kernel/qwinnativepangesturerecognizer_win_p.h create mode 100644 tests/auto/gestures/gestures.pro create mode 100644 tests/auto/gestures/tst_gestures.cpp create mode 100644 tests/manual/gestures/graphicsview/gestures.cpp create mode 100644 tests/manual/gestures/graphicsview/gestures.h create mode 100644 tests/manual/gestures/graphicsview/graphicsview.pro create mode 100644 tests/manual/gestures/graphicsview/imageitem.cpp create mode 100644 tests/manual/gestures/graphicsview/imageitem.h create mode 100644 tests/manual/gestures/graphicsview/main.cpp create mode 100644 tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp create mode 100644 tests/manual/gestures/graphicsview/mousepangesturerecognizer.h delete mode 100644 tests/manual/gestures/pinch/main.cpp delete mode 100644 tests/manual/gestures/pinch/pinch.pro delete mode 100644 tests/manual/gestures/pinch/pinch.qrc delete mode 100644 tests/manual/gestures/pinch/pinchwidget.cpp delete mode 100644 tests/manual/gestures/pinch/pinchwidget.h delete mode 100644 tests/manual/gestures/pinch/qt-logo.png create mode 100644 tests/manual/gestures/scrollarea/main.cpp create mode 100644 tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp create mode 100644 tests/manual/gestures/scrollarea/mousepangesturerecognizer.h create mode 100644 tests/manual/gestures/scrollarea/scrollarea.pro delete mode 100644 tests/manual/gestures/twopanwidgets/main.cpp delete mode 100644 tests/manual/gestures/twopanwidgets/twopanwidgets.pro diff --git a/examples/gestures/imageviewer/imageviewer.pro b/examples/gestures/imageviewer/imageviewer.pro index 124175e..68c1f1c 100644 --- a/examples/gestures/imageviewer/imageviewer.pro +++ b/examples/gestures/imageviewer/imageviewer.pro @@ -1,11 +1,14 @@ -HEADERS += imagewidget.h \ - tapandholdgesture.h +HEADERS += imagewidget.h SOURCES += imagewidget.cpp \ - tapandholdgesture.cpp \ main.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS imageviewer.pro +sources.files = $$SOURCES \ + $$HEADERS \ + $$RESOURCES \ + $$FORMS \ + imageviewer.pro sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer -INSTALLS += target sources +INSTALLS += target \ + sources diff --git a/examples/gestures/imageviewer/imagewidget.cpp b/examples/gestures/imageviewer/imagewidget.cpp index 3489b5b..5633942 100644 --- a/examples/gestures/imageviewer/imagewidget.cpp +++ b/examples/gestures/imageviewer/imagewidget.cpp @@ -59,24 +59,16 @@ ImageWidget::ImageWidget(QWidget *parent) setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_NoSystemBackground); - QGesture *panGesture = new QPanGesture(this); - connect(panGesture, SIGNAL(started()), this, SLOT(panTriggered())); - connect(panGesture, SIGNAL(finished()), this, SLOT(panTriggered())); - connect(panGesture, SIGNAL(canceled()), this, SLOT(panTriggered())); - connect(panGesture, SIGNAL(triggered()), this, SLOT(panTriggered())); - - QGesture *pinchGesture = new QPinchGesture(this); - connect(pinchGesture, SIGNAL(started()), this, SLOT(pinchTriggered())); - connect(pinchGesture, SIGNAL(finished()), this, SLOT(pinchTriggered())); - connect(pinchGesture, SIGNAL(canceled()), this, SLOT(pinchTriggered())); - connect(pinchGesture, SIGNAL(triggered()), this, SLOT(pinchTriggered())); - -//! [construct swipe gesture] - QGesture *swipeGesture = new QSwipeGesture(this); -//! [construct swipe gesture] -//! [connect swipe gesture] - connect(swipeGesture, SIGNAL(triggered()), this, SLOT(swipeTriggered())); -//! [connect swipe gesture] + grabGesture(Qt::PanGesture); + grabGesture(Qt::PinchGesture); + grabGesture(Qt::SwipeGesture); +} + +bool ImageWidget::event(QEvent *event) +{ + if (event->type() == QEvent::Gesture) + return gestureEvent(static_cast(event)); + return QWidget::event(event); } void ImageWidget::paintEvent(QPaintEvent*) @@ -106,11 +98,25 @@ void ImageWidget::mouseDoubleClickEvent(QMouseEvent *) update(); } -void ImageWidget::panTriggered() +bool ImageWidget::gestureEvent(QGestureEvent *event) +{ + if (QGesture *pan = event->gesture(Qt::PanGesture)) { + panTriggered(static_cast(pan)); + return true; + } else if (QGesture *pinch = event->gesture(Qt::PinchGesture)) { + pinchTriggered(static_cast(pan)); + return true; + } else if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) { + swipeTriggered(static_cast(pan)); + return true; + } + return false; +} + +void ImageWidget::panTriggered(QPanGesture *gesture) { - QPanGesture *pg = qobject_cast(sender()); #ifndef QT_NO_CURSOR - switch (pg->state()) { + switch (gesture->state()) { case Qt::GestureStarted: case Qt::GestureUpdated: setCursor(Qt::SizeAllCursor); @@ -119,33 +125,37 @@ void ImageWidget::panTriggered() setCursor(Qt::ArrowCursor); } #endif - horizontalOffset += pg->lastOffset().width(); - verticalOffset += pg->lastOffset().height(); + QSizeF lastOffset = gesture->property("lastOffset").toSizeF(); + horizontalOffset += lastOffset.width(); + verticalOffset += lastOffset.height(); update(); } -void ImageWidget::pinchTriggered() +void ImageWidget::pinchTriggered(QPinchGesture *gesture) { - QPinchGesture *pg = qobject_cast(sender()); - if (pg->whatChanged() & QPinchGesture::RotationAngleChanged) - rotationAngle += pg->rotationAngle() - pg->lastRotationAngle(); - if (pg->whatChanged() & QPinchGesture::ScaleFactorChanged) - scaleFactor += pg->scaleFactor() - pg->lastScaleFactor(); + QPinchGesture::WhatChanged whatChanged = gesture->property("whatChanged").value(); + if (whatChanged & QPinchGesture::RotationAngleChanged) { + qreal value = gesture->property("rotationAngle").toReal(); + qreal lastValue = gesture->property("lastRotationAngle").toReal(); + rotationAngle += value - lastValue; + } + if (whatChanged & QPinchGesture::ScaleFactorChanged) { + qreal value = gesture->property("scaleFactor").toReal(); + qreal lastValue = gesture->property("lastScaleFactor").toReal(); + scaleFactor += value - lastValue; + } update(); } -//! [swipe slot start] -void ImageWidget::swipeTriggered() +void ImageWidget::swipeTriggered(QSwipeGesture *gesture) { - QSwipeGesture *pg = qobject_cast(sender()); - if (pg->horizontalDirection() == QSwipeGesture::Left - || pg->verticalDirection() == QSwipeGesture::Up) + if (gesture->horizontalDirection() == QSwipeGesture::Left + || gesture->verticalDirection() == QSwipeGesture::Up) goPrevImage(); else goNextImage(); update(); } -//! [swipe slot start] void ImageWidget::resizeEvent(QResizeEvent*) { diff --git a/examples/gestures/imageviewer/imagewidget.h b/examples/gestures/imageviewer/imagewidget.h index 2a1bfca..e05a67a 100644 --- a/examples/gestures/imageviewer/imagewidget.h +++ b/examples/gestures/imageviewer/imagewidget.h @@ -46,6 +46,11 @@ #include #include +class QGestureEvent; +class QPanGesture; +class QPinchGesture; +class QSwipeGesture; + class ImageWidget : public QWidget { Q_OBJECT @@ -56,14 +61,16 @@ public: void openDirectory(const QString &path); protected: + bool event(QEvent*); + bool gestureEvent(QGestureEvent*); void paintEvent(QPaintEvent*); void resizeEvent(QResizeEvent*); void mouseDoubleClickEvent(QMouseEvent*); -private slots: - void panTriggered(); - void pinchTriggered(); - void swipeTriggered(); +private: + void panTriggered(QPanGesture*); + void pinchTriggered(QPinchGesture*); + void swipeTriggered(QSwipeGesture*); private: void updateImage(); diff --git a/examples/gestures/imageviewer/tapandholdgesture.cpp b/examples/gestures/imageviewer/tapandholdgesture.cpp deleted file mode 100644 index a10c192..0000000 --- a/examples/gestures/imageviewer/tapandholdgesture.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "tapandholdgesture.h" - -#include - -// #define TAPANDHOLD_USING_MOUSE - -/*! - \class TapAndHoldGesture - \since 4.6 - - \brief The TapAndHoldGesture class represents a Tap-and-Hold gesture, - providing additional information. -*/ - -const int TapAndHoldGesture::iterationCount = 40; -const int TapAndHoldGesture::iterationTimeout = 50; - -/*! - Creates a new Tap and Hold gesture handler object and marks it as a child - of \a parent. - - On some platforms like Windows there is a system-wide tap and hold gesture - that cannot be overriden, hence the gesture might never trigger and default - context menu will be shown instead. -*/ -TapAndHoldGesture::TapAndHoldGesture(QWidget *parent) - : QGesture(parent), iteration(0) -{ -} - -/*! \internal */ -bool TapAndHoldGesture::filterEvent(QEvent *event) -{ - const QTouchEvent *ev = static_cast(event); - switch (event->type()) { - case QEvent::TouchBegin: { - if (timer.isActive()) - timer.stop(); - timer.start(TapAndHoldGesture::iterationTimeout, this); - const QPoint p = ev->touchPoints().at(0).pos().toPoint(); - position = p; - break; - } - case QEvent::TouchUpdate: - if (ev->touchPoints().size() == 1) { - const QPoint startPos = ev->touchPoints().at(0).startPos().toPoint(); - const QPoint pos = ev->touchPoints().at(0).pos().toPoint(); - if ((startPos - pos).manhattanLength() > 15) - reset(); - } else { - reset(); - } - break; - case QEvent::TouchEnd: - reset(); - break; -#ifdef TAPANDHOLD_USING_MOUSE - case QEvent::MouseButtonPress: { - if (timer.isActive()) - timer.stop(); - timer.start(TapAndHoldGesture::iterationTimeout, this); - const QPoint p = static_cast(event)->pos(); - position = startPosition = p; - break; - } - case QEvent::MouseMove: { - const QPoint startPos = startPosition; - const QPoint pos = static_cast(event)->pos(); - if ((startPos - pos).manhattanLength() > 15) - reset(); - break; - } - case QEvent::MouseButtonRelease: - reset(); - break; -#endif // TAPANDHOLD_USING_MOUSE - default: - break; - } - return false; -} - -/*! \internal */ -void TapAndHoldGesture::timerEvent(QTimerEvent *event) -{ - if (event->timerId() != timer.timerId()) - return; - if (iteration == TapAndHoldGesture::iterationCount) { - timer.stop(); - updateState(Qt::GestureFinished); - } else { - updateState(Qt::GestureUpdated); - } - ++iteration; -} - -/*! \internal */ -void TapAndHoldGesture::reset() -{ - timer.stop(); - iteration = 0; - position = startPosition = QPoint(); - updateState(Qt::NoGesture); -} - -/*! - \property TapAndHoldGesture::pos - - \brief The position of the gesture. -*/ -QPoint TapAndHoldGesture::pos() const -{ - return position; -} diff --git a/examples/gestures/imageviewer/tapandholdgesture.h b/examples/gestures/imageviewer/tapandholdgesture.h deleted file mode 100644 index 682342e..0000000 --- a/examples/gestures/imageviewer/tapandholdgesture.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TAPANDHOLDGESTURE_H -#define TAPANDHOLDGESTURE_H - -#include -#include -#include - -class TapAndHoldGesture : public QGesture -{ - Q_OBJECT - Q_PROPERTY(QPoint pos READ pos) - -public: - TapAndHoldGesture(QWidget *parent); - - bool filterEvent(QEvent *event); - void reset(); - - QPoint pos() const; - -protected: - void timerEvent(QTimerEvent *event); - -private: - QBasicTimer timer; - int iteration; - QPoint position; - QPoint startPosition; - static const int iterationCount; - static const int iterationTimeout; -}; - -#endif // TAPANDHOLDGESTURE_H diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 9d76dcc..eea7532 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -501,8 +501,6 @@ public: WA_WState_AcceptedTouchBeginEvent = 122, WA_TouchPadAcceptSingleTouchEvents = 123, - WA_DontUseStandardGestures = 124, - // Add new attributes before this line WA_AttributeCount }; @@ -1615,9 +1613,29 @@ public: enum GestureState { NoGesture, - GestureStarted = 1, - GestureUpdated = 2, - GestureFinished = 3 + GestureStarted = 1, + GestureUpdated = 2, + GestureFinished = 3, + GestureCanceled = 4 + }; + + enum GestureType + { + TapGesture = 1, + TapAndHoldGesture = 2, + PanGesture = 3, + PinchGesture = 4, + SwipeGesture = 5, + + CustomGesture = 0x0100, + + LastGestureType = ~0u + }; + + enum GestureContext + { + WidgetGesture = WidgetShortcut, + WidgetWithChildrenGesture = WidgetWithChildrenShortcut, }; enum NavigationMode @@ -1638,7 +1656,6 @@ public: ; #endif - Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::MouseButtons) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::Orientations) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::KeyboardModifiers) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index b7775bd..ca766db 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1219,8 +1219,6 @@ \value WA_TouchPadAcceptSingleTouchEvents Allows touchpad single touch events to be sent to the widget. - \value WA_DontUseStandardGestures Disables standard gestures on Qt widgets. - \omitvalue WA_SetLayoutDirection \omitvalue WA_InputMethodTransparent \omitvalue WA_WState_CompressKeys diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 744e6a9..5883042 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -228,6 +228,8 @@ QT_BEGIN_NAMESPACE \value TouchBegin Beginning of a sequence of touch-screen and/or track-pad events (QTouchEvent) \value TouchUpdate Touch-screen event (QTouchEvent) \value TouchEnd End of touch-event sequence (QTouchEvent) + \value Gesture A gesture was triggered (QGestureEvent) + \value GestureOverride A gesture override was triggered (QGestureEvent) User events should have values between \c User and \c{MaxUser}: diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index d66cead..ee1e1b9 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -283,6 +283,9 @@ public: UpdateSoftKeys = 201, // Internal for compressing soft key updates + Gesture = 198, + GestureOverride = 202, + // 512 reserved for Qt Jambi's MetaCall event // 513 reserved for Qt Jambi's DeleteOnMainThread event @@ -324,6 +327,7 @@ private: friend class QGraphicsView; friend class QGraphicsViewPrivate; friend class QGraphicsScenePrivate; + friend class QGestureManager; }; class Q_CORE_EXPORT QTimerEvent : public QEvent diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 3069733..81bbb5c 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -663,6 +663,8 @@ #include #endif +#include + #include QT_BEGIN_NAMESPACE @@ -7285,6 +7287,13 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent QGraphicsItem::d_ptr->isObject = true; } +void QGraphicsObject::grabGesture(Qt::GestureType type, Qt::GestureContext context) +{ + QGraphicsItemPrivate * const d = QGraphicsItem::d_func(); + d->gestureContext.insert(type, context); + (void)QGestureManager::instance(); // create a gesture manager +} + /*! \property QGraphicsObject::parent \brief the parent of the item diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index e6e324a..2665235 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -464,6 +464,7 @@ private: friend class QGraphicsSceneBspTree; friend class QGraphicsView; friend class QGraphicsViewPrivate; + friend class QGraphicsObject; friend class QGraphicsWidget; friend class QGraphicsWidgetPrivate; friend class QGraphicsProxyWidgetPrivate; @@ -473,6 +474,7 @@ private: friend class QGraphicsSceneBspTreeIndexPrivate; friend class QGraphicsItemEffectSourcePrivate; friend class QGraphicsTransformPrivate; + friend class QGestureManager; friend class ::tst_QGraphicsItem; friend bool qt_closestLeaf(const QGraphicsItem *, const QGraphicsItem *); friend bool qt_closestItemFirst(const QGraphicsItem *, const QGraphicsItem *); @@ -553,6 +555,8 @@ public: using QObject::children; #endif + void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::WidgetWithChildrenGesture); + Q_SIGNALS: void parentChanged(); void opacityChanged(); diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 51bfea1..6550362 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -450,6 +450,7 @@ public: QGraphicsItem *focusScopeItem; Qt::InputMethodHints imHints; QGraphicsItem::PanelModality panelModality; + QMap gestureContext; // Packed 32 bits quint32 acceptedMouseButtons : 5; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 961f44f..0f33a66 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5475,11 +5475,11 @@ void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent) } if (itemsNeedingEvents.isEmpty()) { - sceneTouchEvent->ignore(); + sceneTouchEvent->accept(); return; } - bool acceptSceneTouchEvent = false; + bool ignoreSceneTouchEvent = true; QHash::ConstIterator it = itemsNeedingEvents.constBegin(); const QHash::ConstIterator end = itemsNeedingEvents.constEnd(); for (; it != end; ++it) { @@ -5522,19 +5522,20 @@ void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent) item->d_ptr->acceptedTouchBeginEvent = true; bool res = sendTouchBeginEvent(item, &touchEvent) && touchEvent.isAccepted(); - acceptSceneTouchEvent = acceptSceneTouchEvent || res; + if (!res) + ignoreSceneTouchEvent = false; break; } default: if (item->d_ptr->acceptedTouchBeginEvent) { updateTouchPointsForItem(item, &touchEvent); (void) sendEvent(item, &touchEvent); - acceptSceneTouchEvent = true; + ignoreSceneTouchEvent = false; } break; } } - sceneTouchEvent->setAccepted(acceptSceneTouchEvent); + sceneTouchEvent->setAccepted(ignoreSceneTouchEvent); } bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEvent *touchEvent) diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index ba47530..d6d48d7 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -311,6 +311,7 @@ private: friend class QGraphicsSceneBspTreeIndex; friend class QGraphicsSceneBspTreeIndexPrivate; friend class QGraphicsItemEffectSourcePrivate; + friend class QGesture; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsScene::SceneLayers) diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 7cde384..31fce6a 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -45,8 +45,9 @@ HEADERS += \ kernel/qkeymapper_p.h \ kernel/qgesture.h \ kernel/qgesture_p.h \ - kernel/qstandardgestures.h \ - kernel/qstandardgestures_p.h \ + kernel/qstandardgestures_p.h \ + kernel/qgesturerecognizer.h \ + kernel/qgesturemanager_p.h \ kernel/qsoftkeymanager_p.h SOURCES += \ @@ -78,12 +79,17 @@ SOURCES += \ kernel/qwidgetaction.cpp \ kernel/qkeymapper.cpp \ kernel/qgesture.cpp \ - kernel/qstandardgestures.cpp \ + kernel/qstandardgestures.cpp \ + kernel/qgesturerecognizer.cpp \ + kernel/qgesturemanager.cpp \ kernel/qsoftkeymanager.cpp win32 { DEFINES += QT_NO_DIRECTDRAW + HEADERS += \ + kernel/qwinnativepangesturerecognizer_win_p.h + SOURCES += \ kernel/qapplication_win.cpp \ kernel/qclipboard_win.cpp \ @@ -94,7 +100,8 @@ win32 { kernel/qsound_win.cpp \ kernel/qwidget_win.cpp \ kernel/qole_win.cpp \ - kernel/qkeymapper_win.cpp + kernel/qkeymapper_win.cpp \ + kernel/qwinnativepangesturerecognizer_win.cpp !contains(DEFINES, QT_NO_DIRECTDRAW):LIBS += ddraw.lib } diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 044fedd..af653bf 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -97,6 +97,9 @@ #include "qapplication.h" +#include "qgesture.h" +#include "private/qgesturemanager_p.h" + #ifndef QT_NO_LIBRARY #include "qlibrary.h" #endif @@ -152,6 +155,14 @@ bool QApplicationPrivate::autoSipEnabled = false; bool QApplicationPrivate::autoSipEnabled = true; #endif +QGestureManager* QGestureManager::instance() +{ + QApplicationPrivate *d = qApp->d_func(); + if (!d->gestureManager) + d->gestureManager = new QGestureManager(qApp); + return d->gestureManager; +} + QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::Type type) : QCoreApplicationPrivate(argc, argv) { @@ -175,6 +186,8 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T directPainters = 0; #endif + gestureManager = 0; + if (!self) self = this; } @@ -3658,6 +3671,13 @@ bool QApplication::notify(QObject *receiver, QEvent *e) #endif // !QT_NO_WHEELEVENT || !QT_NO_TABLETEVENT } + // walk through parents and check for gestures + if (d->gestureManager) { + if (d->gestureManager->filterEvent(receiver, e)) + return true; + } + + // User input and window activation makes tooltips sleep switch (e->type()) { case QEvent::Wheel: @@ -4159,6 +4179,65 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } break; } + case QEvent::Gesture: + case QEvent::GestureOverride: + { + if (receiver->isWidgetType()) { + QWidget *w = static_cast(receiver); + QGestureEvent *gestureEvent = static_cast(e); + QList allGestures = gestureEvent->allGestures(); + + bool eventAccepted = gestureEvent->isAccepted(); + bool wasAccepted = eventAccepted; + while (w) { + // send only gestures the widget expects + QList gestures; + QWidgetPrivate *wd = w->d_func(); + for (int i = 0; i < allGestures.size();) { + QGesture *g = allGestures.at(i); + Qt::GestureType type = g->gestureType(); + if (wd->gestureContext.contains(type)) { + allGestures.removeAt(i); + gestures.append(g); + gestureEvent->setAccepted(g, false); + } else { + ++i; + } + } + if (!gestures.isEmpty()) { + QGestureEvent ge(gestures); + ge.t = gestureEvent->t; + ge.spont = gestureEvent->spont; + ge.m_accept = wasAccepted; + res = d->notify_helper(w, &ge); + gestureEvent->spont = false; + eventAccepted = ge.isAccepted(); + if (res && eventAccepted) + break; + if (!eventAccepted) { + // ### two ways to ignore the event/gesture + + // if the whole event wasn't accepted, put back those + // gestures that were not accepted. + for (int i = 0; i < gestures.size(); ++i) { + QGesture *g = gestures.at(i); + if (!ge.isAccepted(g)) + allGestures.append(g); + } + } + } + if (allGestures.isEmpty()) + break; + if (w->isWindow()) + break; + w = w->parentWidget(); + } + gestureEvent->m_accept = eventAccepted; + } else { + res = d->notify_helper(receiver, e); + } + break; + } default: res = d->notify_helper(receiver, e); break; @@ -5566,6 +5645,16 @@ Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints); } +Qt::GestureType QApplication::registerGestureRecognizer(QGestureRecognizer *recognizer) +{ + return QGestureManager::instance()->registerGestureRecognizer(recognizer); +} + +void QApplication::unregisterGestureRecognizer(Qt::GestureType type) +{ + QGestureManager::instance()->unregisterGestureRecognizer(type); +} + QT_END_NAMESPACE #include "moc_qapplication.cpp" diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 5f21a56..12b398d 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -86,6 +86,7 @@ class QDecoration; class QApplication; class QApplicationPrivate; +class QGestureRecognizer; #if defined(qApp) #undef qApp #endif @@ -289,6 +290,9 @@ public: static Qt::NavigationMode navigationMode(); #endif + Qt::GestureType registerGestureRecognizer(QGestureRecognizer *recognizer); + void unregisterGestureRecognizer(Qt::GestureType type); + Q_SIGNALS: void lastWindowClosed(); void focusChanged(QWidget *old, QWidget *now); @@ -400,6 +404,7 @@ private: friend class QDirectPainter; friend class QDirectPainterPrivate; #endif + friend class QGestureManager; #if defined(Q_WS_MAC) || defined(Q_WS_X11) Q_PRIVATE_SLOT(d_func(), void _q_alertTimeOut()) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 6036196..79e958f 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -83,8 +83,8 @@ class QGraphicsSystem; class QInputContext; class QObject; class QWidget; -class QGestureManager; class QSocketNotifier; +class QGestureManager; extern bool qt_is_gui_used; #ifndef QT_NO_CLIPBOARD @@ -265,20 +265,6 @@ typedef struct tagGESTURECONFIG #endif // Q_WS_WIN -class QPanGesture; -class QPinchGesture; -class QSwipeGesture; - -struct QStandardGestures -{ - QPanGesture *pan; - QPinchGesture *pinch; - QSwipeGesture *swipe; - - QStandardGestures() : pan(0), pinch(0), swipe(0) { } -}; - - class QScopedLoopLevelCounter { QThreadData *threadData; @@ -523,6 +509,8 @@ public: void sendSyntheticEnterLeave(QWidget *widget); #endif + QGestureManager *gestureManager; + QMap widgetForTouchPointId; QMap appCurrentTouchPoints; static void updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent); @@ -537,9 +525,6 @@ public: QTouchEvent::DeviceType deviceType, const QList &touchPoints); - typedef QMap WidgetStandardGesturesMap; - WidgetStandardGesturesMap widgetGestures; - #if defined(Q_WS_WIN) static PtrRegisterTouchWindow RegisterTouchWindow; static PtrGetTouchInputInfo GetTouchInputInfo; @@ -556,7 +541,6 @@ public: PtrBeginPanningFeedback BeginPanningFeedback; PtrUpdatePanningFeedback UpdatePanningFeedback; PtrEndPanningFeedback EndPanningFeedback; - QWidget *gestureWidget; #endif #ifdef QT_RX71_MULTITOUCH diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 270562f..540f0a2 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -92,8 +92,6 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c #include #include #include "qevent_p.h" -#include "qstandardgestures.h" -#include "qstandardgestures_p.h" //#define ALIEN_DEBUG @@ -854,7 +852,6 @@ void qt_init(QApplicationPrivate *priv, int) (PtrEndPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"), "EndPanningFeedback"); #endif - priv->gestureWidget = 0; } /***************************************************************************** @@ -2499,24 +2496,24 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam if (qAppPriv->GetGestureInfo) bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi); if (bResult) { - if (gi.dwID == GID_BEGIN) { - // find the alien widget for the gesture position. - // This might not be accurate as the position is the center - // point of two fingers for multi-finger gestures. - QPoint pt(gi.ptsLocation.x, gi.ptsLocation.y); - QWidget *w = widget->childAt(widget->mapFromGlobal(pt)); - qAppPriv->gestureWidget = w ? w : widget; - } - if (qAppPriv->gestureWidget) - static_cast(qAppPriv->gestureWidget)->translateGestureEvent(msg, gi); - if (qAppPriv->CloseGestureInfoHandle) - qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam); - if (gi.dwID == GID_END) - qAppPriv->gestureWidget = 0; - } else { - DWORD dwErr = GetLastError(); - if (dwErr > 0) - qWarning() << "translateGestureEvent: error = " << dwErr; +// if (gi.dwID == GID_BEGIN) { +// // find the alien widget for the gesture position. +// // This might not be accurate as the position is the center +// // point of two fingers for multi-finger gestures. +// QPoint pt(gi.ptsLocation.x, gi.ptsLocation.y); +// QWidget *w = widget->childAt(widget->mapFromGlobal(pt)); +// qAppPriv->gestureWidget = w ? w : widget; +// } +// if (qAppPriv->gestureWidget) +// static_cast(qAppPriv->gestureWidget)->translateGestureEvent(msg, gi); +// if (qAppPriv->CloseGestureInfoHandle) +// qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam); +// if (gi.dwID == GID_END) +// qAppPriv->gestureWidget = 0; +// } else { +// DWORD dwErr = GetLastError(); +// if (dwErr > 0) +// qWarning() << "translateGestureEvent: error = " << dwErr; } result = true; break; diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 7b9cc9a..4316714 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -49,6 +49,8 @@ #include "qmime.h" #include "qdnd_p.h" #include "qevent_p.h" +#include "qgesture.h" +#include "qgesture_p.h" QT_BEGIN_NAMESPACE @@ -3357,6 +3359,9 @@ QDebug operator<<(QDebug dbg, const QEvent *e) { case QEvent::ChildRemoved: n = n ? n : "ChildRemoved"; dbg.nospace() << "QChildEvent(" << n << ", " << (static_cast(e))->child(); return dbg.space(); + case QEvent::Gesture: + n = "Gesture"; + break; default: dbg.nospace() << "QEvent(" << (const void *)e << ", type = " << e->type() << ')'; return dbg.space(); @@ -4186,4 +4191,73 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T return *this; } +/*! + \class QGestureEvent + \since 4.6 + \ingroup events + + \brief The QGestureEvent class provides the description of triggered + gestures. + + The QGestureEvent class contains a list of gestures that are being executed + right now (\l{QGestureEvent::}{activeGestures()}) and a list of gestures + that are \l{QGestureEvent::canceledGestures}{cancelled} (a gesture might be + cancelled because the window lost focus, or because of timeout, etc). + + \sa QGesture +*/ + +/*! + Creates new QGestureEvent containing a list of \a gestures. +*/ +QGestureEvent::QGestureEvent(const QList &gestures) + : QEvent(QEvent::Gesture), gestures_(gestures) +{ +} + +QList QGestureEvent::allGestures() const +{ + return gestures_; +} + +QGesture* QGestureEvent::gesture(Qt::GestureType type) +{ + for(int i = 0; i < gestures_.size(); ++i) + if (gestures_.at(i)->gestureType() == type) + return gestures_.at(i); + return 0; +} + +QList QGestureEvent::activeGestures() const +{ + return gestures_; +} + +QList QGestureEvent::canceledGestures() const +{ + return gestures_; +} + +void QGestureEvent::setAccepted(QGesture *gesture, bool value) +{ + setAccepted(false); + if (gesture) + gesture->d_func()->accept = value; +} + +void QGestureEvent::accept(QGesture *gesture) +{ + setAccepted(gesture, true); +} + +void QGestureEvent::ignore(QGesture *gesture) +{ + setAccepted(gesture, false); +} + +bool QGestureEvent::isAccepted(QGesture *gesture) const +{ + return gesture ? gesture->d_func()->accept : false; +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 4396766..224b479 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -819,6 +819,40 @@ protected: friend class QApplicationPrivate; }; +class QGesture; +class Q_GUI_EXPORT QGestureEvent : public QEvent +{ +public: + QGestureEvent(const QList &gestures); + + QList allGestures() const; + QGesture *gesture(Qt::GestureType type); + + QList activeGestures() const; + QList canceledGestures() const; + +#ifdef Q_NO_USING_KEYWORD + inline void setAccepted(bool accepted) { QEvent::setAccepted(accepted); } + inline bool isAccepted() const { return QEvent::isAccepted(); } + + inline void accept() { QEvent::accept(); } + inline void ignore() { QEvent::ignore(); } +#else + using QEvent::setAccepted; + using QEvent::isAccepted; + using QEvent::accept; + using QEvent::ignore; +#endif + + void setAccepted(QGesture *, bool); + void accept(QGesture *); + void ignore(QGesture *); + bool isAccepted(QGesture *) const; + +private: + QList gestures_; +}; + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 237ce46..bb74aec 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -40,274 +40,290 @@ ****************************************************************************/ #include "qgesture.h" -#include -#include "qgraphicsitem.h" +#include "private/qgesture_p.h" QT_BEGIN_NAMESPACE + /*! + \class QGesture + \since 4.6 -class QEventFilterProxyGraphicsItem : public QGraphicsItem -{ -public: - QEventFilterProxyGraphicsItem(QGesture *g) - : gesture(g) - { - } - bool sceneEventFilter(QGraphicsItem *, QEvent *event) - { - return gesture ? gesture->filterEvent(event) : false; - } - QRectF boundingRect() const { return QRectF(); } - void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) { } + \brief The QGesture class represents a gesture, containing all + properties that describe a gesture. -private: - QGesture *gesture; -}; + The widget receives a QGestureEvent with a list of QGesture + objects that represent gestures that are occuring on it. The class + has a list of properties that can be queried by the user to get + some gesture-specific arguments (i.e. position of the tap in the + DoubleTap gesture). -/*! - \class QGesture - \since 4.6 - \preliminary - - \brief The QGesture class is the base class for implementing custom - gestures. - - This class represents both an object that recognizes a gesture out of a set - of input events (a gesture recognizer), and a gesture object itself that - can be used to get extended information about the triggered gesture. - - The class has a list of properties that can be queried by the user to get - some gesture-specific parameters (for example, an offset of a Pan gesture). - - Usually gesture recognizer implements a state machine, storing its state - internally in the recognizer object. The recognizer receives input events - through the \l{QGesture::}{filterEvent()} virtual function and decides - whether the event should change the state of the recognizer by emitting an - appropriate signal. - - Input events should be either fed to the recognizer one by one with a - filterEvent() function, or the gesture recognizer should be attached to an - object it filters events for by specifying it as a parent object. The - QGesture object installs itself as an event filter to the parent object - automatically, the unsetObject() function should be used to remove an event - filter from the parent object. To make a - gesture that operates on a QGraphicsItem, both the appropriate QGraphicsView - should be passed as a parent object and setGraphicsItem() functions should - be used to attach a gesture to a graphics item. - - This is a base class, to create a custom gesture type, you should subclass - it and implement its pure virtual functions. - - \sa QPanGesture + When creating custom gesture recognizers, they might add new + properties to the gesture object, or custom gesture developers + might subclass the QGesture objects to provide some extended + information. + + \sa QGestureEvent, QGestureRecognizer */ -/*! \fn bool QGesture::filterEvent(QEvent *event) +QGesture::QGesture(Qt::GestureType type, QObject *parent) + : QObject(*new QGesturePrivate, parent) +{ + d_func()->gestureType = type; +} - Parses input \a event and emits a signal when detects a gesture. +QGesture::QGesture(QObject *parent) + : QObject(*new QGesturePrivate, parent) +{ + d_func()->gestureType = Qt::CustomGesture; +} - In your reimplementation of this function, if you want to filter the \a - event out, i.e. stop it being handled further, return true; otherwise - return false; +QGesture::QGesture(QGesturePrivate &dd, Qt::GestureType type, QObject *parent) + : QObject(dd, parent) +{ + d_func()->gestureType = type; +} - This is a pure virtual function that needs to be implemented in subclasses. -*/ +QGesture::~QGesture() +{ +} -/*! \fn void QGesture::started() +Qt::GestureType QGesture::gestureType() const +{ + return d_func()->gestureType; +} - The signal is emitted when the gesture is started. Extended information - about the gesture is contained in the signal sender object. +Qt::GestureState QGesture::state() const +{ + return d_func()->state; +} - In addition to started(), a triggered() signal should also be emitted. -*/ +QObject* QGesture::targetObject() const +{ + return d_func()->targetObject; +} -/*! \fn void QGesture::triggered() +void QGesture::setTargetObject(QObject *value) +{ + d_func()->targetObject = value; +} - The signal is emitted when the gesture is detected. Extended information - about the gesture is contained in the signal sender object. -*/ +QPointF QGesture::hotSpot() const +{ + return d_func()->hotSpot; +} -/*! \fn void QGesture::finished() +void QGesture::setHotSpot(const QPointF &value) +{ + Q_D(QGesture); + d->hotSpot = value; + d->isHotSpotSet = true; +} - The signal is emitted when the gesture is finished. Extended information - about the gesture is contained in the signal sender object. -*/ +bool QGesture::hasHotSpot() const +{ + return d_func()->isHotSpotSet; +} -/*! \fn void QGesture::canceled() +void QGesture::unsetHotSpot() +{ + d_func()->isHotSpotSet = false; +} - The signal is emitted when the gesture is canceled, for example the - reset() function is called while the gesture was in the process of - emitting a triggered() signal. Extended information about the - gesture is contained in the sender object. -*/ +// QPanGesture -/*! - Creates a new gesture handler object and marks it as a child of \a - parent. \a gestureTarget is the object that the gesture will watch - for events. +QPanGesture::QPanGesture(QObject *parent) + : QGesture(*new QPanGesturePrivate, Qt::PanGesture, parent) +{ - The \a parent object is also the default event source for the - gesture, meaning that the gesture installs itself as an event filter - for the \a parent. +} - \sa setGraphicsItem() -*/ -QGesture::QGesture(QObject *gestureTarget, QObject *parent) - : QObject(*new QGesturePrivate, parent) +QSizeF QPanGesture::totalOffset() const { - setGestureTarget(gestureTarget); + return d_func()->totalOffset; } -/*! \internal - */ -QGesture::QGesture(QGesturePrivate &dd, QObject *gestureTarget, QObject *parent) - : QObject(dd, parent) +QSizeF QPanGesture::lastOffset() const { - setGestureTarget(gestureTarget); + return d_func()->lastOffset; } -/*! - Destroys the gesture object. -*/ -QGesture::~QGesture() +QSizeF QPanGesture::offset() const { + return d_func()->offset; } -/*! - \property QGesture::gestureTarget +qreal QPanGesture::acceleration() const +{ + return d_func()->acceleration; +} - Gesture target is the object that the gesture will watch for events. - Typically this means that the gesture installs an event filter on the - target object. -*/ -void QGesture::setGestureTarget(QObject *object) + +void QPanGesture::setTotalOffset(const QSizeF &value) { - d_func()->setupGestureTarget(object); + d_func()->totalOffset = value; } -QObject* QGesture::gestureTarget() const +void QPanGesture::setLastOffset(const QSizeF &value) { - return d_func()->gestureTarget; + d_func()->lastOffset = value; } -void QGesturePrivate::setupGestureTarget(QObject *object) +void QPanGesture::setOffset(const QSizeF &value) { - Q_Q(QGesture); - if (gestureTarget) - gestureTarget->removeEventFilter(q); - if (object) - object->installEventFilter(q); - gestureTarget = object; + d_func()->offset = value; } -/*! \internal - */ -bool QGesture::eventFilter(QObject *receiver, QEvent *event) +void QPanGesture::setAcceleration(qreal value) { - Q_D(QGesture); - if (d->graphicsItem && receiver == parent()) - return false; - return filterEvent(event); + d_func()->acceleration = value; } -/*! - \property QGesture::state +// QPinchGesture - \brief The current state of the gesture. -*/ +QPinchGesture::QPinchGesture(QObject *parent) + : QGesture(*new QPinchGesturePrivate, Qt::PinchGesture, parent) +{ -/*! - Returns the gesture recognition state. - */ -Qt::GestureState QGesture::state() const +} + +QPinchGesture::WhatChanged QPinchGesture::whatChanged() const { - return d_func()->state; + return d_func()->whatChanged; } -/*! - Sets this gesture's recognition state to \a state and emits appropriate - signals. +void QPinchGesture::setWhatChanged(QPinchGesture::WhatChanged value) +{ + d_func()->whatChanged = value; +} - This functions emits the signals according to the old state and the new - \a state, and it should be called after all the internal properties have been - initialized. - \sa started(), triggered(), finished(), canceled() - */ -void QGesture::updateState(Qt::GestureState state) +QPointF QPinchGesture::startCenterPoint() const { - Q_D(QGesture); - if (d->state == state) { - if (state == Qt::GestureUpdated) - emit triggered(); - return; - } - const Qt::GestureState oldState = d->state; - if (state != Qt::NoGesture && oldState > state) { - // comparing the state as ints: state should only be changed from - // started to (optionally) updated and to finished. - d->state = state; - qWarning("QGesture::updateState: incorrect new state"); - return; - } - if (oldState == Qt::NoGesture) { - d->state = Qt::GestureStarted; - emit started(); - } - d->state = state; - if (state == Qt::GestureUpdated) - emit triggered(); - else if (state == Qt::GestureFinished) - emit finished(); - else if (state == Qt::NoGesture) - emit canceled(); - - if (state == Qt::GestureFinished) { - // gesture is finished, so we reset the internal state. - d->state = Qt::NoGesture; - } -} - -/*! - Sets the \a graphicsItem the gesture is filtering events for. - - The gesture will install an event filter to the \a graphicsItem and - redirect them to the filterEvent() function. - - \sa graphicsItem() -*/ -void QGesture::setGraphicsItem(QGraphicsItem *graphicsItem) + return d_func()->startCenterPoint; +} + +QPointF QPinchGesture::lastCenterPoint() const { - Q_D(QGesture); - if (d->graphicsItem && d->eventFilterProxyGraphicsItem) - d->graphicsItem->removeSceneEventFilter(d->eventFilterProxyGraphicsItem); - d->graphicsItem = graphicsItem; - if (!d->eventFilterProxyGraphicsItem) - d->eventFilterProxyGraphicsItem = new QEventFilterProxyGraphicsItem(this); - if (graphicsItem) - graphicsItem->installSceneEventFilter(d->eventFilterProxyGraphicsItem); + return d_func()->lastCenterPoint; } -/*! - Returns the graphics item the gesture is filtering events for. +QPointF QPinchGesture::centerPoint() const +{ + return d_func()->centerPoint; +} - \sa setGraphicsItem() -*/ -QGraphicsItem* QGesture::graphicsItem() const +void QPinchGesture::setStartCenterPoint(const QPointF &value) { - return d_func()->graphicsItem; + d_func()->startCenterPoint = value; } -/*! \fn void QGesture::reset() +void QPinchGesture::setLastCenterPoint(const QPointF &value) +{ + d_func()->lastCenterPoint = value; +} - Resets the internal state of the gesture. This function might be called by - the filterEvent() implementation in a derived class, or by the user to - cancel a gesture. The base class implementation calls - updateState(Qt::NoGesture) which emits the canceled() - signal if the state() of the gesture indicated it was active. -*/ -void QGesture::reset() +void QPinchGesture::setCenterPoint(const QPointF &value) +{ + d_func()->centerPoint = value; +} + + +qreal QPinchGesture::totalScaleFactor() const +{ + return d_func()->totalScaleFactor; +} + +qreal QPinchGesture::lastScaleFactor() const +{ + return d_func()->lastScaleFactor; +} + +qreal QPinchGesture::scaleFactor() const +{ + return d_func()->scaleFactor; +} + +void QPinchGesture::setTotalScaleFactor(qreal value) +{ + d_func()->totalScaleFactor = value; +} + +void QPinchGesture::setLastScaleFactor(qreal value) +{ + d_func()->lastScaleFactor = value; +} + +void QPinchGesture::setScaleFactor(qreal value) +{ + d_func()->scaleFactor = value; +} + + +qreal QPinchGesture::totalRotationAngle() const +{ + return d_func()->totalRotationAngle; +} + +qreal QPinchGesture::lastRotationAngle() const +{ + return d_func()->lastRotationAngle; +} + +qreal QPinchGesture::rotationAngle() const +{ + return d_func()->rotationAngle; +} + +void QPinchGesture::setTotalRotationAngle(qreal value) +{ + d_func()->totalRotationAngle = value; +} + +void QPinchGesture::setLastRotationAngle(qreal value) +{ + d_func()->lastRotationAngle = value; +} + +void QPinchGesture::setRotationAngle(qreal value) +{ + d_func()->rotationAngle = value; +} + +// QSwipeGesture + +QSwipeGesture::QSwipeGesture(QObject *parent) + : QGesture(*new QSwipeGesturePrivate, Qt::SwipeGesture, parent) +{ +} + +QSwipeGesture::SwipeDirection QSwipeGesture::horizontalDirection() const +{ + return d_func()->horizontalDirection; +} + +QSwipeGesture::SwipeDirection QSwipeGesture::verticalDirection() const +{ + return d_func()->verticalDirection; +} + +void QSwipeGesture::setHorizontalDirection(QSwipeGesture::SwipeDirection value) +{ + d_func()->horizontalDirection = value; +} + +void QSwipeGesture::setVerticalDirection(QSwipeGesture::SwipeDirection value) +{ + d_func()->verticalDirection = value; +} + +qreal QSwipeGesture::swipeAngle() const +{ + return d_func()->swipeAngle; +} + +void QSwipeGesture::setSwipeAngle(qreal value) { - updateState(Qt::NoGesture); + d_func()->swipeAngle = value; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index 440565e..b37120f 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -55,7 +55,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class QGraphicsItem; +Q_DECLARE_METATYPE(Qt::GestureState) + class QGesturePrivate; class Q_GUI_EXPORT QGesture : public QObject { @@ -63,37 +64,149 @@ class Q_GUI_EXPORT QGesture : public QObject Q_DECLARE_PRIVATE(QGesture) Q_PROPERTY(Qt::GestureState state READ state) - Q_PROPERTY(QObject* gestureTarget READ gestureTarget WRITE setGestureTarget) + Q_PROPERTY(Qt::GestureType gestureType READ gestureType) + Q_PROPERTY(QPointF hotSpot READ hotSpot WRITE setHotSpot RESET unsetHotSpot) + Q_PROPERTY(bool hasHotSpot READ hasHotSpot) + Q_PROPERTY(QObject* targetObject READ targetObject WRITE setTargetObject) public: - explicit QGesture(QObject *gestureTarget = 0, QObject *parent = 0); + explicit QGesture(Qt::GestureType type = Qt::CustomGesture, QObject *parent = 0); + explicit QGesture(QObject *parent); ~QGesture(); - virtual bool filterEvent(QEvent *event) = 0; + Qt::GestureType gestureType() const; - void setGestureTarget(QObject *object); - QObject* gestureTarget() const; + Qt::GestureState state() const; - void setGraphicsItem(QGraphicsItem *); - QGraphicsItem *graphicsItem() const; + QObject *targetObject() const; + void setTargetObject(QObject *value); - Qt::GestureState state() const; + QPointF hotSpot() const; + void setHotSpot(const QPointF &value); + bool hasHotSpot() const; + void unsetHotSpot(); protected: - QGesture(QGesturePrivate &dd, QObject *gestureTarget, QObject *parent); - bool eventFilter(QObject*, QEvent*); + QGesture(QGesturePrivate &dd, Qt::GestureType type, QObject *parent); - virtual void reset(); - void updateState(Qt::GestureState state); +private: + friend class QGestureEvent; + friend class QGestureRecognizer; + friend class QGestureManager; +}; -Q_SIGNALS: - void started(); - void triggered(); - void finished(); - void canceled(); +class QPanGesturePrivate; +class Q_GUI_EXPORT QPanGesture : public QGesture +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QPanGesture) -private: - friend class QWidget; + Q_PROPERTY(QSizeF totalOffset READ totalOffset WRITE setTotalOffset) + Q_PROPERTY(QSizeF lastOffset READ lastOffset WRITE setLastOffset) + Q_PROPERTY(QSizeF offset READ offset WRITE setOffset) + Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration) + +public: + QPanGesture(QObject *parent = 0); + + QSizeF totalOffset() const; + QSizeF lastOffset() const; + QSizeF offset() const; + qreal acceleration() const; + + void setTotalOffset(const QSizeF &value); + void setLastOffset(const QSizeF &value); + void setOffset(const QSizeF &value); + void setAcceleration(qreal value); + + friend class QPanGestureRecognizer; + friend class QWinNativePanGestureRecognizer; +}; + +class QPinchGesturePrivate; +class Q_GUI_EXPORT QPinchGesture : public QGesture +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QPinchGesture) + +public: + enum WhatChange { + ScaleFactorChanged = 0x1, + RotationAngleChanged = 0x2, + CenterPointChanged = 0x4 + }; + Q_DECLARE_FLAGS(WhatChanged, WhatChange) + + Q_PROPERTY(WhatChanged whatChanged READ whatChanged WRITE setWhatChanged) + + Q_PROPERTY(qreal totalScaleFactor READ totalScaleFactor WRITE setTotalScaleFactor) + Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor WRITE setLastScaleFactor) + Q_PROPERTY(qreal scaleFactor READ scaleFactor WRITE setScaleFactor) + + Q_PROPERTY(qreal totalRotationAngle READ totalRotationAngle WRITE setTotalRotationAngle) + Q_PROPERTY(qreal lastRotationAngle READ lastRotationAngle WRITE setLastRotationAngle) + Q_PROPERTY(qreal rotationAngle READ rotationAngle WRITE setRotationAngle) + + Q_PROPERTY(QPointF startCenterPoint READ startCenterPoint WRITE setStartCenterPoint) + Q_PROPERTY(QPointF lastCenterPoint READ lastCenterPoint WRITE setLastCenterPoint) + Q_PROPERTY(QPointF centerPoint READ centerPoint WRITE setCenterPoint) + +public: + QPinchGesture(QObject *parent = 0); + + WhatChanged whatChanged() const; + void setWhatChanged(WhatChanged value); + + QPointF startCenterPoint() const; + QPointF lastCenterPoint() const; + QPointF centerPoint() const; + void setStartCenterPoint(const QPointF &value); + void setLastCenterPoint(const QPointF &value); + void setCenterPoint(const QPointF &value); + + qreal totalScaleFactor() const; + qreal lastScaleFactor() const; + qreal scaleFactor() const; + void setTotalScaleFactor(qreal value); + void setLastScaleFactor(qreal value); + void setScaleFactor(qreal value); + + qreal totalRotationAngle() const; + qreal lastRotationAngle() const; + qreal rotationAngle() const; + void setTotalRotationAngle(qreal value); + void setLastRotationAngle(qreal value); + void setRotationAngle(qreal value); + + friend class QPinchGestureRecognizer; +}; + +Q_DECLARE_METATYPE(QPinchGesture::WhatChanged) + +class QSwipeGesturePrivate; +class Q_GUI_EXPORT QSwipeGesture : public QGesture +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QSwipeGesture) + Q_ENUMS(SwipeDirection) + + Q_PROPERTY(SwipeDirection horizontalDirection READ horizontalDirection WRITE setHorizontalDirection) + Q_PROPERTY(SwipeDirection verticalDirection READ verticalDirection WRITE setVerticalDirection) + Q_PROPERTY(qreal swipeAngle READ swipeAngle WRITE setSwipeAngle) + +public: + enum SwipeDirection { NoDirection, Left, Right, Up, Down }; + QSwipeGesture(QObject *parent = 0); + + SwipeDirection horizontalDirection() const; + SwipeDirection verticalDirection() const; + void setHorizontalDirection(SwipeDirection value); + void setVerticalDirection(SwipeDirection value); + + qreal swipeAngle() const; + void setSwipeAngle(qreal value); + + friend class QSwipeGestureRecognizer; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index 52e399f..7f69a4e 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -61,29 +61,83 @@ QT_BEGIN_NAMESPACE -class QObject; -class QGraphicsItem; class QGesturePrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QGesture) public: QGesturePrivate() - : gestureTarget(0), graphicsItem(0), eventFilterProxyGraphicsItem(0), - state(Qt::NoGesture), implicitGesture(false) + : gestureType(Qt::CustomGesture), state(Qt::NoGesture), isHotSpotSet(false), + targetObject(0), accept(true) { } - virtual void setupGestureTarget(QObject *o); + Qt::GestureType gestureType; + Qt::GestureState state; + QPointF hotSpot; + bool isHotSpotSet; + QObject *targetObject; + bool accept; +}; - QPointer gestureTarget; - QGraphicsItem *graphicsItem; - QGraphicsItem *eventFilterProxyGraphicsItem; +class QPanGesturePrivate : public QGesturePrivate +{ + Q_DECLARE_PUBLIC(QPanGesture) - Qt::GestureState state; +public: + QPanGesturePrivate() + : acceleration(0) + { + } + + QSizeF totalOffset; + QSizeF lastOffset; + QSizeF offset; + QPoint lastPosition; + qreal acceleration; +}; + +class QPinchGesturePrivate : public QGesturePrivate +{ + Q_DECLARE_PUBLIC(QPinchGesture) + +public: + QPinchGesturePrivate() + : whatChanged(0), totalScaleFactor(0), lastScaleFactor(0), scaleFactor(0), + totalRotationAngle(0), lastRotationAngle(0), rotationAngle(0) + { + } + + QPinchGesture::WhatChanged whatChanged; + + QPointF startCenterPoint; + QPointF lastCenterPoint; + QPointF centerPoint; + + qreal totalScaleFactor; + qreal lastScaleFactor; + qreal scaleFactor; + + qreal totalRotationAngle; + qreal lastRotationAngle; + qreal rotationAngle; +}; + +class QSwipeGesturePrivate : public QGesturePrivate +{ + Q_DECLARE_PUBLIC(QSwipeGesture) + +public: + QSwipeGesturePrivate() + : horizontalDirection(QSwipeGesture::NoDirection), + verticalDirection(QSwipeGesture::NoDirection), + swipeAngle(0) + { + } - // the flag specifies if the gesture was created implicitely by Qt. - bool implicitGesture; + QSwipeGesture::SwipeDirection horizontalDirection; + QSwipeGesture::SwipeDirection verticalDirection; + qreal swipeAngle; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp new file mode 100644 index 0000000..000f44f --- /dev/null +++ b/src/gui/kernel/qgesturemanager.cpp @@ -0,0 +1,453 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "private/qgesturemanager_p.h" +#include "private/qstandardgestures_p.h" +#include "private/qwidget_p.h" +#include "private/qgesture_p.h" +#include "private/qgraphicsitem_p.h" +#include "qgesture.h" +#include "qevent.h" +#include "qgraphicsitem.h" + +#include "qdebug.h" + +// #define GESTURE_DEBUG +#ifndef GESTURE_DEBUG +# define DEBUG if (0) qDebug +#else +# define DEBUG qDebug +#endif + +QT_BEGIN_NAMESPACE + +QGestureManager::QGestureManager(QObject *parent) + : QObject(parent), state(NotGesture), lastCustomGestureId(0) +{ + qRegisterMetaType(); + + registerGestureRecognizer(new QPanGestureRecognizer); +} + +QGestureManager::~QGestureManager() +{ + +} + +Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *recognizer) +{ + QGesture *dummy = recognizer->createGesture(0); + if (!dummy) { + qWarning("QGestureManager::registerGestureRecognizer: the recognizer doesn't provide gesture object"); + return Qt::GestureType(0); + } + Qt::GestureType type = dummy->gestureType(); + if (type == Qt::CustomGesture) { + // generate a new custom gesture id + ++lastCustomGestureId; + type = Qt::GestureType(Qt::CustomGesture + lastCustomGestureId); + } + recognizers.insertMulti(type, recognizer); + delete dummy; + return type; +} + +void QGestureManager::unregisterGestureRecognizer(Qt::GestureType) +{ + +} + +QGesture* QGestureManager::getState(QObject *object, Qt::GestureType type) +{ + // if the widget is being deleted we should be carefull and not to + // create a new state, as it will create QWeakPointer which doesnt work + // from the destructor. + if (object->isWidgetType()) { + if (static_cast(object)->d_func()->data.in_destructor) + return 0; + } + + QWeakPointer state = objectGestures.value(QGestureManager::ObjectGesture(object, type)); + if (!state) { + QGestureRecognizer *recognizer = recognizers.value(type); + if (recognizer) { + state = recognizer->createGesture(object); + if (!state) + return 0; + if (state.data()->gestureType() == Qt::CustomGesture) { + // if the recognizer didn't fill in the gesture type, then this + // is a custom gesture with autogenerated it and we fill it. + state.data()->d_func()->gestureType = type; + } + objectGestures.insert(QGestureManager::ObjectGesture(object, type), state); + gestureToRecognizer[state.data()] = recognizer; + } + } + return state.data(); +} + +bool QGestureManager::filterEvent(QObject *receiver, QEvent *event) +{ + QSet triggeredGestures; + QSet finishedGestures; + QSet newMaybeGestures; + QSet canceledGestures; + QSet notGestures; + + QGraphicsObject *graphicsObject = qobject_cast(receiver); + if (receiver->isWidgetType() || graphicsObject) { + QMap contexts; + if (receiver->isWidgetType()) { + QWidget *w = static_cast(receiver); + if (!w->d_func()->gestureContext.isEmpty()) { + typedef QMap::const_iterator ContextIterator; + for(ContextIterator it = w->d_func()->gestureContext.begin(), + e = w->d_func()->gestureContext.end(); it != e; ++it) { + contexts.insertMulti(w, it.key()); + } + } + // find all gesture contexts for the widget tree + w = w->parentWidget(); + while (w) + { + typedef QMap::const_iterator ContextIterator; + for (ContextIterator it = w->d_func()->gestureContext.begin(), + e = w->d_func()->gestureContext.end(); it != e; ++it) { + if (it.value() == Qt::WidgetWithChildrenGesture) + contexts.insertMulti(w, it.key()); + } + w = w->parentWidget(); + } + } else { + QGraphicsObject *item = graphicsObject; + if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) { + typedef QMap::const_iterator ContextIterator; + for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), + e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { + contexts.insertMulti(item, it.key()); + } + } + // find all gesture contexts for the widget tree + item = item->parentObject(); + while (item) + { + typedef QMap::const_iterator ContextIterator; + for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), + e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { + if (it.value() == Qt::WidgetWithChildrenGesture) + contexts.insertMulti(item, it.key()); + } + item = item->parentObject(); + } + } + // filter the event through recognizers + typedef QMap::const_iterator ContextIterator; + for (ContextIterator cit = contexts.begin(), ce = contexts.end(); cit != ce; ++cit) { + Qt::GestureType gestureType = cit.value(); + QMap::const_iterator + rit = recognizers.lowerBound(gestureType), + re = recognizers.upperBound(gestureType); + for (; rit != re; ++rit) { + QGestureRecognizer *recognizer = rit.value(); + QObject *target = cit.key(); + QGesture *state = getState(target, gestureType); + if (!state) + continue; + QGestureRecognizer::Result result = recognizer->filterEvent(state, target, event); + QGestureRecognizer::Result type = result & QGestureRecognizer::ResultState_Mask; + if (type == QGestureRecognizer::GestureTriggered) { + DEBUG() << "QGestureManager: gesture triggered: " << state; + triggeredGestures << state; + } else if (type == QGestureRecognizer::GestureFinished) { + DEBUG() << "QGestureManager: gesture finished: " << state; + finishedGestures << state; + } else if (type == QGestureRecognizer::MaybeGesture) { + DEBUG() << "QGestureManager: maybe gesture: " << state; + newMaybeGestures << state; + } else if (type == QGestureRecognizer::NotGesture) { + DEBUG() << "QGestureManager: not gesture: " << state; + notGestures << state; + } else if (type == QGestureRecognizer::Ignore) { + DEBUG() << "QGestureManager: gesture ignored the event: " << state; + } else { + DEBUG() << "QGestureManager: hm, lets assume the recognizer ignored the event: " << state; + } + if (result & QGestureRecognizer::ConsumeEventHint) { + DEBUG() << "QGestureManager: we were asked to consume the event: " << state; + //TODO: consume events if asked + } + } + } + } else if (QGesture *state = qobject_cast(receiver)) { + if (QGestureRecognizer *recognizer = gestureToRecognizer.value(state)) { + QGestureRecognizer::Result result = recognizer->filterEvent(state, state, event); + QGestureRecognizer::Result type = result & QGestureRecognizer::ResultState_Mask; + if (type == QGestureRecognizer::GestureTriggered) { + DEBUG() << "QGestureManager: gesture triggered: " << state; + triggeredGestures << state; + } else if (type == QGestureRecognizer::GestureFinished) { + DEBUG() << "QGestureManager: gesture finished: " << state; + finishedGestures << state; + } else if (type == QGestureRecognizer::MaybeGesture) { + DEBUG() << "QGestureManager: maybe gesture: " << state; + newMaybeGestures << state; + } else if (type == QGestureRecognizer::NotGesture) { + DEBUG() << "QGestureManager: not gesture: " << state; + notGestures << state; + } else if (type == QGestureRecognizer::Ignore) { + DEBUG() << "QGestureManager: gesture ignored the event: " << state; + } else { + DEBUG() << "QGestureManager: hm, lets assume the recognizer ignored the event: " << state; + } + } + } else { + return false; + } + + QSet startedGestures = triggeredGestures - activeGestures; + triggeredGestures &= activeGestures; + + // check if a running gesture switched back to maybe state + QSet activeToMaybeGestures = activeGestures & newMaybeGestures; + + // check if a running gesture switched back to not gesture state, i.e. were canceled + QSet activeToCancelGestures = activeGestures & notGestures; + canceledGestures += activeToCancelGestures; + + // start timers for new gestures in maybe state + foreach (QGesture *state, newMaybeGestures) { + QBasicTimer &timer = maybeGestures[state]; + if (!timer.isActive()) + timer.start(3000, this); + } + // kill timers for gestures that were in maybe state + QSet notMaybeGestures = (startedGestures | triggeredGestures | finishedGestures | canceledGestures | notGestures); + foreach(QGesture *gesture, notMaybeGestures) { + QMap::iterator it = + maybeGestures.find(gesture); + if (it != maybeGestures.end()) { + it.value().stop(); + maybeGestures.erase(it); + } + } + + Q_ASSERT((startedGestures & finishedGestures).isEmpty()); + Q_ASSERT((startedGestures & newMaybeGestures).isEmpty()); + Q_ASSERT((startedGestures & canceledGestures).isEmpty()); + Q_ASSERT((finishedGestures & newMaybeGestures).isEmpty()); + Q_ASSERT((finishedGestures & canceledGestures).isEmpty()); + Q_ASSERT((canceledGestures & newMaybeGestures).isEmpty()); + + QSet notStarted = finishedGestures - activeGestures; + if (!notStarted.isEmpty()) { + // there are some gestures that claim to be finished, but never started. + qWarning("QGestureManager::filterEvent: some gestures were finished even though they've never started"); + finishedGestures -= notStarted; + } + + activeGestures += startedGestures; + // sanity check: all triggered gestures should already be in active gestures list + Q_ASSERT((activeGestures & triggeredGestures).size() == triggeredGestures.size()); + activeGestures -= finishedGestures; + activeGestures -= activeToMaybeGestures; + activeGestures -= canceledGestures; + + // set the proper gesture state on each gesture + foreach (QGesture *gesture, startedGestures) + gesture->d_func()->state = Qt::GestureStarted; + foreach (QGesture *gesture, triggeredGestures) + gesture->d_func()->state = Qt::GestureUpdated; + foreach (QGesture *gesture, finishedGestures) + gesture->d_func()->state = Qt::GestureFinished; + foreach (QGesture *gesture, canceledGestures) + gesture->d_func()->state = Qt::GestureCanceled; + foreach (QGesture *gesture, activeToMaybeGestures) + gesture->d_func()->state = Qt::GestureFinished; + + if (!activeGestures.isEmpty() || !maybeGestures.isEmpty() || + !startedGestures.isEmpty() || !triggeredGestures.isEmpty() || + !finishedGestures.isEmpty() || !canceledGestures.isEmpty()) { + DEBUG() << "QGestureManager::filterEvent:" + << "\n\tactiveGestures:" << activeGestures + << "\n\tmaybeGestures:" << maybeGestures.keys() + << "\n\tstarted:" << startedGestures + << "\n\ttriggered:" << triggeredGestures + << "\n\tfinished:" << finishedGestures + << "\n\tcanceled:" << canceledGestures; + } + + deliverEvents(startedGestures+triggeredGestures+finishedGestures+canceledGestures, receiver); + + // reset gestures that ended + QSet endedGestures = finishedGestures + canceledGestures; + foreach (QGesture *gesture, endedGestures) { + if (QGestureRecognizer *recognizer = gestureToRecognizer.value(gesture, 0)) { + recognizer->reset(gesture); + } + gestureTargets.remove(gesture); + } + return false; +} + +void QGestureManager::deliverEvents(const QSet &gestures, QObject *lastReceiver) +{ + if (gestures.isEmpty()) + return; + + // group gestures by widgets + typedef QMap > GesturesPerReceiver; + GesturesPerReceiver groupedGestures; + // for conflicted gestures the key is always the innermost widget (i.e. the child) + GesturesPerReceiver conflictedGestures; + QMultiHash objectGestures; + + foreach (QGesture *gesture, gestures) { + QObject *target = gestureTargets.value(gesture, 0); + if (!target) { + Q_ASSERT(gesture->state() == Qt::GestureStarted); + if (gesture->hasHotSpot()) { + // guess the target using the hotspot of the gesture + QPoint pt = gesture->hotSpot().toPoint(); + if (!pt.isNull()) { + if (QWidget *w = qApp->topLevelAt(pt)) + target = w->childAt(w->mapFromGlobal(pt)); + } + } + if (!target) { + target = gesture->targetObject(); + if (!target) + target = lastReceiver; + } + } + if (target) { + gestureTargets.insert(gesture, target); + if (target->isWidgetType()) + objectGestures.insert(target, gesture); + groupedGestures[target].append(gesture); + } else { + qWarning() << "QGestureManager::deliverEvent: could not find the target for gesture" + << gesture->gestureType(); + } + } + + typedef QMultiHash::const_iterator ObjectGesturesIterator; + for (ObjectGesturesIterator it = objectGestures.begin(), e = objectGestures.end(); it != e; ++it) { + QObject *object1 = it.key(); + QWidget *widget1 = qobject_cast(object1); + QGraphicsObject *item1 = qobject_cast(object1); + QGesture *gesture1 = it.value(); + ObjectGesturesIterator cit = it; + for (++cit; cit != e; ++cit) { + QObject *object2 = cit.key(); + QWidget *widget2 = qobject_cast(object2); + QGraphicsObject *item2 = qobject_cast(object2); + QGesture *gesture2 = cit.value(); + // TODO: ugly, rewrite this. + if ((widget1 && widget2 && widget2->isAncestorOf(widget1)) || + (item1 && item2 && item2->isAncestorOf(item1))) { + groupedGestures[object2].removeOne(gesture2); + groupedGestures[object1].removeOne(gesture1); + conflictedGestures[object1].append(gesture1); + } else if ((widget1 && widget2 && widget1->isAncestorOf(widget2)) || + (item1 && item2 && item1->isAncestorOf(item2))) { + groupedGestures[object2].removeOne(gesture2); + groupedGestures[object1].removeOne(gesture1); + conflictedGestures[object2].append(gesture2); + } + } + } + + DEBUG() << "deliverEvents: conflicted =" << conflictedGestures.values() + << " grouped =" << groupedGestures.values(); + + // if there are conflicting gestures, send the GestureOverride event + for (GesturesPerReceiver::const_iterator it = conflictedGestures.begin(), + e = conflictedGestures.end(); it != e; ++it) { + DEBUG() << "QGestureManager::deliverEvents: sending GestureOverride to" + << it.key() + << " gestures:" << it.value(); + QGestureEvent event(it.value()); + event.t = QEvent::GestureOverride; + event.ignore(); + QApplication::sendEvent(it.key(), &event); + if (!event.isAccepted()) { + // nobody accepted the GestureOverride, put it back to deliver to + // the closest context (i.e. to the inner-most widget). + DEBUG() <<" override was not accepted"; + groupedGestures[it.key()].append(it.value()); + } + } + + for (GesturesPerReceiver::const_iterator it = groupedGestures.begin(), + e = groupedGestures.end(); it != e; ++it) { + if (!it.value().isEmpty()) { + DEBUG() << "QGestureManager::deliverEvents: sending to" << it.key() + << " gestures:" << it.value(); + QGestureEvent event(it.value()); + QApplication::sendEvent(it.key(), &event); + } + } +} + +void QGestureManager::timerEvent(QTimerEvent *event) +{ + QMap::iterator it = maybeGestures.begin(), + e = maybeGestures.end(); + for (; it != e; ) { + QBasicTimer &timer = it.value(); + Q_ASSERT(timer.isActive()); + if (timer.timerId() == event->timerId()) { + timer.stop(); + QGesture *gesture = it.key(); + it = maybeGestures.erase(it); + DEBUG() << "QGestureManager::timerEvent: gesture stopped due to timeout:" << gesture; + QGestureRecognizer *recognizer = gestureToRecognizer.value(gesture, 0); + if (recognizer) + recognizer->reset(gesture); + } else { + ++it; + } + } +} + +QT_END_NAMESPACE + +#include "moc_qgesturemanager_p.cpp" diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h new file mode 100644 index 0000000..c61819f --- /dev/null +++ b/src/gui/kernel/qgesturemanager_p.h @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGESTUREMANAGER_P_H +#define QGESTUREMANAGER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qobject.h" +#include "qbasictimer.h" +#include "private/qwidget_p.h" +#include "qgesturerecognizer.h" + +QT_BEGIN_NAMESPACE + +class QBasicTimer; +class QGestureManager : public QObject +{ + Q_OBJECT +public: + QGestureManager(QObject *parent); + ~QGestureManager(); + + Qt::GestureType registerGestureRecognizer(QGestureRecognizer *recognizer); + void unregisterGestureRecognizer(Qt::GestureType type); + + bool filterEvent(QObject *receiver, QEvent *event); + + // declared in qapplication.cpp + static QGestureManager* instance(); + +protected: + void timerEvent(QTimerEvent *event); + +private: + QMultiMap recognizers; + + QSet activeGestures; + QMap maybeGestures; + + enum State { + Gesture, + NotGesture, + MaybeGesture // this means timers are up and waiting for some + // more events, and input events are handled by + // gesture recognizer explicitely + } state; + + struct ObjectGesture + { + QWeakPointer object; + Qt::GestureType gesture; + + ObjectGesture(QObject *o, const Qt::GestureType &g) : object(o), gesture(g) { } + inline bool operator<(const ObjectGesture& rhs) const + { + if (object.data() < rhs.object.data()) + return true; + if (object == rhs.object) + return gesture < rhs.gesture; + return false; + } + }; + + QMap > objectGestures; + QMap gestureToRecognizer; + + QHash gestureTargets; + + int lastCustomGestureId; + + QGesture *getState(QObject *widget, Qt::GestureType gesture); + void deliverEvents(const QSet &gestures, QObject *lastReceiver); +}; + +QT_END_NAMESPACE + +#endif // QGESTUREMANAGER_P_H diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp new file mode 100644 index 0000000..590f09e --- /dev/null +++ b/src/gui/kernel/qgesturerecognizer.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgesturerecognizer.h" + +#include "private/qgesture_p.h" + +QT_BEGIN_NAMESPACE + +QGestureRecognizer::QGestureRecognizer() +{ +} + +QGestureRecognizer::~QGestureRecognizer() +{ +} + +QGesture *QGestureRecognizer::createGesture(QObject *) +{ + return new QGesture; +} + +void QGestureRecognizer::reset(QGesture *state) +{ + if (state) { + QGesturePrivate *d = state->d_func(); + d->state = Qt::NoGesture; + d->hotSpot = QPointF(); + d->targetObject = 0; + } +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesturerecognizer.h b/src/gui/kernel/qgesturerecognizer.h new file mode 100644 index 0000000..c85afd2 --- /dev/null +++ b/src/gui/kernel/qgesturerecognizer.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGESTURERECOGNIZER_H +#define QGESTURERECOGNIZER_H + +#include "qglobal.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QObject; +class QEvent; +class QGesture; +class Q_GUI_EXPORT QGestureRecognizer +{ +public: + enum ResultFlags + { + Ignore = 0x0001, + NotGesture = 0x0002, + MaybeGesture = 0x0004, + GestureTriggered = 0x0008, // Gesture started or updated + GestureFinished = 0x0010, + + ResultState_Mask = 0x00ff, + + ConsumeEventHint = 0x0100, + // StoreEventHint = 0x0200, + // ReplayStoredEventsHint = 0x0400, + // DiscardStoredEventsHint = 0x0800, + + ResultHint_Mask = 0xff00 + }; + Q_DECLARE_FLAGS(Result, ResultFlags) + + QGestureRecognizer(); + virtual ~QGestureRecognizer(); + + virtual QGesture *createGesture(QObject *target); + virtual QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event) = 0; + + virtual void reset(QGesture *state); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QGestureRecognizer::Result) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGESTURERECOGNIZER_H diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index 3cfb987..dfc3499 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -39,174 +39,45 @@ ** ****************************************************************************/ -#include "qstandardgestures.h" #include "qstandardgestures_p.h" - -#include -#include -#include -#include -#include -#include +#include "qgesture.h" +#include "qgesture_p.h" +#include "qevent.h" +#include "qwidget.h" QT_BEGIN_NAMESPACE -#ifdef Q_WS_WIN -QWidgetPrivate *qt_widget_private(QWidget *widget); -#endif - -/*! - \class QPanGesture - \preliminary - \since 4.6 - - \brief The QPanGesture class represents a Pan gesture, - providing additional information related to panning. -*/ - -/*! - \enum QSwipeGesture::SwipeDirection - \brief This enum specifies the direction of the swipe gesture. - - \value NoDirection - \value Left - \value Right - \value Up - \value Down -*/ - -/*! - Creates a new pan gesture handler object and marks it as a child of - \a parent. The pan gesture handler watches \a gestureTarget for its - events. - - On some platform like Windows it's necessary to provide a non-null - widget as \a parent to get native gesture support. -*/ -QPanGesture::QPanGesture(QWidget *gestureTarget, QObject *parent) - : QGesture(*new QPanGesturePrivate, gestureTarget, parent) +QPanGestureRecognizer::QPanGestureRecognizer() { - setObjectName(QLatin1String("QPanGesture")); -} - -void QPanGesturePrivate::setupGestureTarget(QObject *newGestureTarget) -{ - Q_Q(QPanGesture); - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - - if (gestureTarget && gestureTarget->isWidgetType()) { - QWidget *w = static_cast(gestureTarget.data()); - if (qAppPriv->widgetGestures[w].pan == q) - qAppPriv->widgetGestures[w].pan = 0; -#if defined(Q_WS_WIN) - qt_widget_private(w)->winSetupGestures(); -#elif defined(Q_WS_MAC) - w->setAttribute(Qt::WA_AcceptTouchEvents, false); - w->setAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents, false); -#endif - } - - if (newGestureTarget && newGestureTarget->isWidgetType()) { - QWidget *w = static_cast(newGestureTarget); - qAppPriv->widgetGestures[w].pan = q; -#if defined(Q_WS_WIN) - qt_widget_private(w)->winSetupGestures(); -#elif defined(Q_WS_MAC) - w->setAttribute(Qt::WA_AcceptTouchEvents); - w->setAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents); -#endif - } - QGesturePrivate::setupGestureTarget(newGestureTarget); -} - -/*! \internal */ -bool QPanGesture::event(QEvent *event) -{ -#if defined(QT_MAC_USE_COCOA) - Q_D(QPanGesture); - if (event->type() == QEvent::Timer) { - const QTimerEvent *te = static_cast(event); - if (te->timerId() == d->singleTouchPanTimer.timerId()) { - d->singleTouchPanTimer.stop(); - updateState(Qt::GestureStarted); - } - } -#endif - - return QObject::event(event); } -bool QPanGesture::eventFilter(QObject *receiver, QEvent *event) +QGesture *QPanGestureRecognizer::createGesture(QObject *target) { - Q_D(QPanGesture); - - if (d->implicitGesture && d->gestureTarget && d->gestureTarget->isWidgetType() && - static_cast(d->gestureTarget.data())->testAttribute(Qt::WA_DontUseStandardGestures)) - return false; - -#ifdef Q_WS_WIN - if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) { - QNativeGestureEvent *ev = static_cast(event); - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - QApplicationPrivate::WidgetStandardGesturesMap::iterator it; - it = qAppPriv->widgetGestures.find(static_cast(receiver)); - if (it == qAppPriv->widgetGestures.end()) - return false; - if (this != it.value().pan) - return false; - Qt::GestureState nextState = Qt::NoGesture; - switch(ev->gestureType) { - case QNativeGestureEvent::GestureBegin: - // next we might receive the first gesture update event, so we - // prepare for it. - d->state = Qt::NoGesture; - return false; - case QNativeGestureEvent::Pan: - nextState = Qt::GestureUpdated; - event->accept(); - break; - case QNativeGestureEvent::GestureEnd: - if (state() == Qt::NoGesture) - return false; // some other gesture has ended - nextState = Qt::GestureFinished; - break; - default: - return false; - } - if (state() == Qt::NoGesture) { - d->lastOffset = d->totalOffset = d->offset = QSize(); - } else { - d->lastOffset = d->offset; - d->offset = QSize(ev->position.x() - d->lastPosition.x(), - ev->position.y() - d->lastPosition.y()); - d->totalOffset += d->offset; - } - d->lastPosition = ev->position; - updateState(nextState); - return true; + if (target && target->isWidgetType()) { + static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); } -#endif - return QGesture::eventFilter(receiver, event); + return new QPanGesture; } -/*! \internal */ -bool QPanGesture::filterEvent(QEvent *event) +QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) { - Q_D(QPanGesture); + QPanGesture *q = static_cast(state); + QPanGesturePrivate *d = q->d_func(); - if (d->implicitGesture && d->gestureTarget && d->gestureTarget->isWidgetType() && - static_cast(d->gestureTarget.data())->testAttribute(Qt::WA_DontUseStandardGestures)) - return false; - -#if defined(Q_WS_WIN) const QTouchEvent *ev = static_cast(event); - if (event->type() == QEvent::TouchBegin) { + QGestureRecognizer::Result result; + + switch (event->type()) { + case QEvent::TouchBegin: { + result = QGestureRecognizer::MaybeGesture; QTouchEvent::TouchPoint p = ev->touchPoints().at(0); d->lastPosition = p.pos().toPoint(); d->lastOffset = d->totalOffset = d->offset = QSize(); - } else if (event->type() == QEvent::TouchEnd) { - if (state() != Qt::NoGesture) { + break; + } + case QEvent::TouchEnd: { + if (q->state() != Qt::NoGesture) { if (ev->touchPoints().size() == 2) { QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0); QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1); @@ -216,11 +87,14 @@ bool QPanGesture::filterEvent(QEvent *event) p1.pos().y() - p1.lastPos().y() + p2.pos().y() - p2.lastPos().y()) / 2; d->totalOffset += d->offset; } - updateState(Qt::GestureFinished); + result = QGestureRecognizer::GestureFinished; + } else { + result = QGestureRecognizer::NotGesture; } - reset(); - } else if (event->type() == QEvent::TouchUpdate) { - if (ev->touchPoints().size() == 2) { + break; + } + case QEvent::TouchUpdate: { + if (ev->touchPoints().size() >= 2) { QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0); QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1); d->lastOffset = d->offset; @@ -230,10 +104,60 @@ bool QPanGesture::filterEvent(QEvent *event) d->totalOffset += d->offset; if (d->totalOffset.width() > 10 || d->totalOffset.height() > 10 || d->totalOffset.width() < -10 || d->totalOffset.height() < -10) { - updateState(Qt::GestureUpdated); + result = QGestureRecognizer::GestureTriggered; + } else { + result = QGestureRecognizer::MaybeGesture; } } + break; + } + case QEvent::MouseButtonPress: + case QEvent::MouseMove: + case QEvent::MouseButtonRelease: + result = QGestureRecognizer::Ignore; + break; + default: + result = QGestureRecognizer::Ignore; + break; + } + return result; +} + +void QPanGestureRecognizer::reset(QGesture *state) +{ + QPanGesture *pan = static_cast(state); + QPanGesturePrivate *d = pan->d_func(); + + d->totalOffset = d->lastOffset = d->offset = QSizeF(); + d->lastPosition = QPoint(); + d->acceleration = 0; + +//#if defined(QT_MAC_USE_COCOA) +// d->singleTouchPanTimer.stop(); +// d->prevMousePos = QPointF(0, 0); +//#endif + + QGestureRecognizer::reset(state); +} + +/*! \internal */ +/* +bool QPanGestureRecognizer::event(QEvent *event) +{ +#if defined(QT_MAC_USE_COCOA) + Q_D(QPanGesture); + if (event->type() == QEvent::Timer) { + const QTimerEvent *te = static_cast(event); + if (te->timerId() == d->singleTouchPanTimer.timerId()) { + d->singleTouchPanTimer.stop(); + updateState(Qt::GestureStarted); + } } +#endif + + bool consume = false; + +#if defined(Q_WS_WIN) #elif defined(QT_MAC_USE_COCOA) // The following implements single touch // panning on Mac: @@ -244,16 +168,25 @@ bool QPanGesture::filterEvent(QEvent *event) switch (event->type()) { case QEvent::TouchBegin: { if (ev->touchPoints().size() == 1) { + d->delayManager->setEnabled(true); + consume = d->delayManager->append(d->gestureTarget, *event); d->lastPosition = QCursor::pos(); d->singleTouchPanTimer.start(panBeginDelay, this); } break;} case QEvent::TouchEnd: { - if (state() != Qt::NoGesture) + d->delayManager->setEnabled(false); + if (state() != Qt::NoGesture) { updateState(Qt::GestureFinished); + consume = true; + d->delayManager->clear(); + } else { + d->delayManager->replay(); + } reset(); break;} case QEvent::TouchUpdate: { + consume = d->delayManager->append(d->gestureTarget, *event); if (ev->touchPoints().size() == 1) { if (state() == Qt::NoGesture) { // INVARIANT: The singleTouchTimer has still not fired. @@ -261,11 +194,15 @@ bool QPanGesture::filterEvent(QEvent *event) // the starting point that it makes sense to cancel: const QPointF startPos = ev->touchPoints().at(0).startPos().toPoint(); const QPointF p = ev->touchPoints().at(0).pos().toPoint(); - if ((startPos - p).manhattanLength() > panBeginRadius) + if ((startPos - p).manhattanLength() > panBeginRadius) { + d->delayManager->replay(); + consume = false; reset(); - else + } else { d->lastPosition = QCursor::pos(); + } } else { + d->delayManager->clear(); QPointF mousePos = QCursor::pos(); QPointF dist = mousePos - d->lastPosition; d->lastPosition = mousePos; @@ -275,527 +212,25 @@ bool QPanGesture::filterEvent(QEvent *event) updateState(Qt::GestureUpdated); } } else if (state() == Qt::NoGesture) { + d->delayManager->replay(); + consume = false; reset(); } break;} + case QEvent::MouseButtonPress: + case QEvent::MouseMove: + case QEvent::MouseButtonRelease: + if (d->delayManager->isEnabled()) + consume = d->delayManager->append(d->gestureTarget, *event); + break; default: return false; } #else Q_UNUSED(event); #endif - return false; -} - -/*! \internal */ -void QPanGesture::reset() -{ - Q_D(QPanGesture); - d->lastOffset = d->totalOffset = d->offset = QSize(0, 0); - d->lastPosition = QPoint(0, 0); - -#if defined(QT_MAC_USE_COCOA) - d->singleTouchPanTimer.stop(); - d->prevMousePos = QPointF(0, 0); -#endif - - QGesture::reset(); -} - -/*! - \property QPanGesture::totalOffset - - Specifies a total pan offset since the start of the gesture. -*/ -QSizeF QPanGesture::totalOffset() const -{ - Q_D(const QPanGesture); - return d->totalOffset; -} - -/*! - \property QPanGesture::lastOffset - - Specifies a pan offset the last time the gesture was triggered. -*/ -QSizeF QPanGesture::lastOffset() const -{ - Q_D(const QPanGesture); - return d->lastOffset; -} - -/*! - \property QPanGesture::offset - - Specifies the current pan offset since the last time the gesture was - triggered. -*/ -QSizeF QPanGesture::offset() const -{ - Q_D(const QPanGesture); - return d->offset; -} - -////////////////////////////////////////////////////////////////////////////// - -/*! - \class QPinchGesture - \preliminary - \since 4.6 - - \brief The QPinchGesture class represents a Pinch gesture, - providing additional information related to zooming and/or rotation. -*/ - -/*! - Creates a new Pinch gesture handler object and marks it as a child - of \a parent. The pan gesture handler watches \a gestureTarget for its - events. - - On some platform like Windows it's necessary to provide a non-null - widget as \a parent to get native gesture support. -*/ -QPinchGesture::QPinchGesture(QWidget *gestureTarget, QObject *parent) - : QGesture(*new QPinchGesturePrivate, gestureTarget, parent) -{ - setObjectName(QLatin1String("QPinchGesture")); -} - -void QPinchGesturePrivate::setupGestureTarget(QObject *newGestureTarget) -{ - Q_Q(QPinchGesture); - if (gestureTarget && gestureTarget->isWidgetType()) { - QWidget *w = static_cast(gestureTarget.data()); - QApplicationPrivate::instance()->widgetGestures[w].pinch = 0; -#ifdef Q_WS_WIN - qt_widget_private(w)->winSetupGestures(); -#endif - } - - if (newGestureTarget && newGestureTarget->isWidgetType()) { - QWidget *w = static_cast(newGestureTarget); - QApplicationPrivate::instance()->widgetGestures[w].pinch = q; -#ifdef Q_WS_WIN - qt_widget_private(w)->winSetupGestures(); -#endif - } - QGesturePrivate::setupGestureTarget(newGestureTarget); -} - -/*! \internal */ -bool QPinchGesture::event(QEvent *event) -{ - return QObject::event(event); -} - -bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event) -{ - Q_D(QPinchGesture); - - if (d->implicitGesture && d->gestureTarget && d->gestureTarget->isWidgetType() && - static_cast(d->gestureTarget.data())->testAttribute(Qt::WA_DontUseStandardGestures)) - return false; - -#if defined(Q_WS_WIN) || defined(Q_WS_MAC) - if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) { - QNativeGestureEvent *ev = static_cast(event); -#if defined(Q_WS_WIN) - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - QApplicationPrivate::WidgetStandardGesturesMap::iterator it; - it = qAppPriv->widgetGestures.find(static_cast(receiver)); - if (it == qAppPriv->widgetGestures.end()) - return false; - if (this != it.value().pinch) - return false; -#endif - Qt::GestureState nextState = Qt::NoGesture; - - switch(ev->gestureType) { - case QNativeGestureEvent::GestureBegin: - // next we might receive the first gesture update event, so we - // prepare for it. - d->state = Qt::NoGesture; - d->changes = 0; - d->totalScaleFactor = d->scaleFactor = d->lastScaleFactor = 1.; - d->totalRotationAngle = d->rotationAngle = d->lastRotationAngle = 0.; - d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPointF(); -#if defined(Q_WS_WIN) - d->initialDistance = 0; - d->lastSequenceId = ev->sequenceId; -#endif - return false; - case QNativeGestureEvent::Rotate: { - d->lastScaleFactor = d->scaleFactor; - d->lastRotationAngle = d->rotationAngle; -#if defined(Q_WS_MAC) - d->rotationAngle += ev->percentage; - nextState = Qt::GestureUpdated; -#elif defined(Q_WS_WIN) - // This is a workaround for an issue with the native rotation - // gesture on Windows 7. For some reason the rotation angle in the - // first WM_GESTURE message in a sequence contains value that is - // off a little bit and causes the rotating item to "jump", so - // we just ignore the first WM_GESTURE in every sequence. - bool windowsRotateWorkaround = false; - if (!d->lastSequenceId) { - windowsRotateWorkaround = true; - d->lastSequenceId = ev->sequenceId; - } - if (d->lastSequenceId > 0 && d->lastSequenceId != (ulong)-1 && ev->sequenceId != d->lastSequenceId) { - // this is the first WM_GESTURE message in a sequence. - d->totalRotationAngle += d->rotationAngle; - windowsRotateWorkaround = true; - // a magic value to mark that the next WM_GESTURE message is - // the second message in a sequence and we should clear the - // lastRotationAngle - d->lastSequenceId = (ulong)-1; - } - if (!windowsRotateWorkaround) { - d->rotationAngle = -1 * GID_ROTATE_ANGLE_FROM_ARGUMENT(ev->argument) * 180. / M_PI; - if (d->lastSequenceId == (ulong)-1) { - // a special case since we need to set the lastRotationAngle to - // rotationAngle when the first WM_GESTURE is received in each - // sequence. - d->lastRotationAngle = d->rotationAngle; - } - d->lastSequenceId = ev->sequenceId; - } - if (!windowsRotateWorkaround) - nextState = Qt::GestureUpdated; -#endif - d->changes = QPinchGesture::RotationAngleChanged; - event->accept(); - break; - } - case QNativeGestureEvent::Zoom: - d->lastRotationAngle = d->rotationAngle; - d->lastScaleFactor = d->scaleFactor; -#if defined(Q_WS_WIN) - if (d->initialDistance != 0) { - int distance = int(qint64(ev->argument)); - if (d->lastSequenceId && ev->sequenceId != d->lastSequenceId) { - d->totalScaleFactor *= d->scaleFactor; - d->initialDistance = int(qint64(ev->argument)); - d->lastScaleFactor = d->scaleFactor = (qreal) distance / d->initialDistance; - } else { - d->scaleFactor = (qreal) distance / d->initialDistance; - } - d->lastSequenceId = ev->sequenceId; - } else { - d->initialDistance = int(qint64(ev->argument)); - } -#elif defined(Q_WS_MAC) - d->scaleFactor += ev->percentage; -#endif - nextState = Qt::GestureUpdated; - d->changes = QPinchGesture::ScaleFactorChanged; - event->accept(); - break; - case QNativeGestureEvent::GestureEnd: - if (state() == Qt::NoGesture) - return false; // some other gesture has ended - nextState = Qt::GestureFinished; - break; - default: - return false; - } - if (d->startCenterPoint.isNull()) - d->startCenterPoint = d->centerPoint; - d->lastCenterPoint = d->centerPoint; - d->centerPoint = static_cast(receiver)->mapFromGlobal(ev->position); - if (d->lastCenterPoint != d->centerPoint) - d->changes |= QPinchGesture::CenterPointChanged; - updateState(nextState); - return true; - } -#endif - return QGesture::eventFilter(receiver, event); -} - - -/*! \internal */ -bool QPinchGesture::filterEvent(QEvent *event) -{ - Q_D(QPinchGesture); - - if (d->implicitGesture && d->gestureTarget && d->gestureTarget->isWidgetType() && - static_cast(d->gestureTarget.data())->testAttribute(Qt::WA_DontUseStandardGestures)) - return false; - - Q_UNUSED(event); - return false; -} - -/*! \internal */ -void QPinchGesture::reset() -{ - Q_D(QPinchGesture); - d->changes = 0; - d->totalScaleFactor = d->scaleFactor = d->lastScaleFactor = 1.; - d->totalRotationAngle = d->rotationAngle = d->lastRotationAngle = 0.; - d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPointF(); - QGesture::reset(); -} - -/*! \enum QPinchGesture::WhatChange - \value ScaleFactorChanged - \value RotationAngleChanged - \value CenterPointChanged -*/ - -/*! - \property QPinchGesture::whatChanged - - Specifies which values were changed in the gesture. -*/ -QPinchGesture::WhatChanged QPinchGesture::whatChanged() const -{ - return d_func()->changes; -} - -/*! - \property QPinchGesture::totalScaleFactor - - Specifies a total scale factor of the pinch gesture since the gesture - started. -*/ -qreal QPinchGesture::totalScaleFactor() const -{ - Q_D(const QPinchGesture); - return d->totalScaleFactor * d->scaleFactor; -} - -/*! - \property QPinchGesture::scaleFactor - - Specifies a scale factor of the pinch gesture. - - If the gesture consists of several pinch sequences (i.e. zoom and rotate - sequences), then this property specifies the scale factor in the current - sequence. When pinching changes the rotation angle only, the value of this - property is 1. -*/ -qreal QPinchGesture::scaleFactor() const -{ - return d_func()->scaleFactor; -} - -/*! - \property QPinchGesture::lastScaleFactor - - Specifies a previous scale factor of the pinch gesture. -*/ -qreal QPinchGesture::lastScaleFactor() const -{ - return d_func()->lastScaleFactor; -} - -/*! - \property QPinchGesture::totalRotationAngle - - Specifies a total rotation angle of the gesture since the gesture started. - - The angle is specified in degrees. -*/ -qreal QPinchGesture::totalRotationAngle() const -{ - Q_D(const QPinchGesture); - return d->totalRotationAngle + d->rotationAngle; -} - -/*! - \property QPinchGesture::rotationAngle - - Specifies a rotation angle of the gesture. - - If the gesture consists of several pinch sequences (i.e. zoom and rotate - sequences), then this property specifies the rotation angle in the current - sequence. When pinching changes the scale factor only, the value of this - property is 0. - - The angle is specified in degrees. -*/ -qreal QPinchGesture::rotationAngle() const -{ - return d_func()->rotationAngle; -} - -/*! - \property QPinchGesture::lastRotationAngle - - Specifies a previous rotation angle of the gesture. - - The angle is specified in degrees. -*/ -qreal QPinchGesture::lastRotationAngle() const -{ - return d_func()->lastRotationAngle; -} - -/*! - \property QPinchGesture::centerPoint - - Specifies a center point of the gesture. The point can be used as a center - point that the object is rotated around. -*/ -QPointF QPinchGesture::centerPoint() const -{ - return d_func()->centerPoint; -} - -/*! - \property QPinchGesture::lastCenterPoint - - Specifies a previous center point of the gesture. -*/ -QPointF QPinchGesture::lastCenterPoint() const -{ - return d_func()->lastCenterPoint; -} - -/*! - \property QPinchGesture::startCenterPoint - - Specifies an initial center point of the gesture. Difference between the - startCenterPoint and the centerPoint is the distance at which pinching - fingers has shifted. -*/ -QPointF QPinchGesture::startCenterPoint() const -{ - return d_func()->startCenterPoint; -} - -////////////////////////////////////////////////////////////////////////////// - -/*! - \class QSwipeGesture - \preliminary - \since 4.6 - - \brief The QSwipeGesture class represents a swipe gesture, - providing additional information related to swiping. -*/ - -/*! - Creates a new Swipe gesture handler object and marks it as a - child of \a parent. The swipe gesture handler watches \a - gestureTarget for its events. - - On some platform like Windows it's necessary to provide a non-null - widget as \a parent to get native gesture support. -*/ -QSwipeGesture::QSwipeGesture(QWidget *gestureTarget, QObject *parent) - : QGesture(*new QSwipeGesturePrivate, gestureTarget, parent) -{ - setObjectName(QLatin1String("QSwipeGesture")); -} - -void QSwipeGesturePrivate::setupGestureTarget(QObject *newGestureTarget) -{ - Q_Q(QSwipeGesture); - if (gestureTarget && gestureTarget->isWidgetType()) { - QWidget *w = static_cast(gestureTarget.data()); - QApplicationPrivate::instance()->widgetGestures[w].swipe = 0; -#if defined(Q_WS_WIN) - qt_widget_private(w)->winSetupGestures(); -#endif - } - - if (newGestureTarget && newGestureTarget->isWidgetType()) { - QWidget *w = static_cast(newGestureTarget); - QApplicationPrivate::instance()->widgetGestures[w].swipe = q; -#if defined(Q_WS_WIN) - qt_widget_private(w)->winSetupGestures(); -#endif - } - QGesturePrivate::setupGestureTarget(newGestureTarget); -} - -/*! - \property QSwipeGesture::swipeAngle - - Holds the angle of the swipe gesture, 0..360. -*/ -qreal QSwipeGesture::swipeAngle() const -{ - Q_D(const QSwipeGesture); - return d->swipeAngle; -} - -/*! - \property QSwipeGesture::horizontalDirection - - Holds the direction for the horizontal component of the swipe - gesture, SwipeDirection::Left or SwipeDirection::Right. - SwipeDirection::NoDirection if there is no horizontal - component to the swipe gesture. -*/ -QSwipeGesture::SwipeDirection QSwipeGesture::horizontalDirection() const -{ - Q_D(const QSwipeGesture); - if (d->swipeAngle < 0 || d->swipeAngle == 90 || d->swipeAngle == 270) - return QSwipeGesture::NoDirection; - else if (d->swipeAngle < 90 || d->swipeAngle > 270) - return QSwipeGesture::Right; - else - return QSwipeGesture::Left; -} - - -/*! - \property QSwipeGesture::verticalDirection - - Holds the direction for the vertical component of the swipe - gesture, SwipeDirection::Down or SwipeDirection::Up. - SwipeDirection::NoDirection if there is no vertical - component to the swipe gesture. -*/ -QSwipeGesture::SwipeDirection QSwipeGesture::verticalDirection() const -{ - Q_D(const QSwipeGesture); - if (d->swipeAngle <= 0 || d->swipeAngle == 180) - return QSwipeGesture::NoDirection; - else if (d->swipeAngle < 180) - return QSwipeGesture::Up; - else - return QSwipeGesture::Down; -} - -bool QSwipeGesture::eventFilter(QObject *receiver, QEvent *event) -{ - Q_D(QSwipeGesture); - if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) { - QNativeGestureEvent *ev = static_cast(event); - switch (ev->gestureType) { - case QNativeGestureEvent::Swipe: - d->swipeAngle = ev->angle; - updateState(Qt::GestureStarted); - updateState(Qt::GestureUpdated); - updateState(Qt::GestureFinished); - break; - default: - return false; - } - return true; - } - return QGesture::eventFilter(receiver, event); -} - -/*! \internal */ -bool QSwipeGesture::filterEvent(QEvent *) -{ - return false; -} - -/*! \internal */ -void QSwipeGesture::reset() -{ - Q_D(QSwipeGesture); - d->swipeAngle = -1; - QGesture::reset(); + return QGestureRecognizer::Ignore; } + */ QT_END_NAMESPACE - -#include "moc_qstandardgestures.cpp" - diff --git a/src/gui/kernel/qstandardgestures.h b/src/gui/kernel/qstandardgestures.h deleted file mode 100644 index 9e8291b..0000000 --- a/src/gui/kernel/qstandardgestures.h +++ /dev/null @@ -1,174 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSTANDARDGESTURES_H -#define QSTANDARDGESTURES_H - -#include -#include - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QPanGesturePrivate; -class Q_GUI_EXPORT QPanGesture : public QGesture -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QPanGesture) - - Q_PROPERTY(QSizeF totalOffset READ totalOffset) - Q_PROPERTY(QSizeF lastOffset READ lastOffset) - Q_PROPERTY(QSizeF offset READ offset) - -public: - QPanGesture(QWidget *gestureTarget, QObject *parent = 0); - - bool filterEvent(QEvent *event); - - QSizeF totalOffset() const; - QSizeF lastOffset() const; - QSizeF offset() const; - -protected: - void reset(); - -private: - bool event(QEvent *event); - bool eventFilter(QObject *receiver, QEvent *event); - - friend class QWidget; - friend class QAbstractScrollAreaPrivate; -}; - -class QPinchGesturePrivate; -class Q_GUI_EXPORT QPinchGesture : public QGesture -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QPinchGesture) - -public: - enum WhatChange { - ScaleFactorChanged = 0x1, - RotationAngleChanged = 0x2, - CenterPointChanged = 0x4 - }; - Q_DECLARE_FLAGS(WhatChanged, WhatChange) - - Q_PROPERTY(WhatChanged whatChanged READ whatChanged) - - Q_PROPERTY(qreal totalScaleFactor READ totalScaleFactor) - Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor) - Q_PROPERTY(qreal scaleFactor READ scaleFactor) - - Q_PROPERTY(qreal totalRotationAngle READ totalRotationAngle) - Q_PROPERTY(qreal lastRotationAngle READ lastRotationAngle) - Q_PROPERTY(qreal rotationAngle READ rotationAngle) - - Q_PROPERTY(QPointF startCenterPoint READ startCenterPoint) - Q_PROPERTY(QPointF lastCenterPoint READ lastCenterPoint) - Q_PROPERTY(QPointF centerPoint READ centerPoint) - -public: - - QPinchGesture(QWidget *gestureTarget, QObject *parent = 0); - - bool filterEvent(QEvent *event); - void reset(); - - WhatChanged whatChanged() const; - - QPointF startCenterPoint() const; - QPointF lastCenterPoint() const; - QPointF centerPoint() const; - - qreal totalScaleFactor() const; - qreal lastScaleFactor() const; - qreal scaleFactor() const; - - qreal totalRotationAngle() const; - qreal lastRotationAngle() const; - qreal rotationAngle() const; - -private: - bool event(QEvent *event); - bool eventFilter(QObject *receiver, QEvent *event); - - friend class QWidget; -}; - -class QSwipeGesturePrivate; -class Q_GUI_EXPORT QSwipeGesture : public QGesture -{ - Q_OBJECT - Q_ENUMS(SwipeDirection) - - Q_PROPERTY(SwipeDirection horizontalDirection READ horizontalDirection) - Q_PROPERTY(SwipeDirection verticalDirection READ verticalDirection) - Q_PROPERTY(qreal swipeAngle READ swipeAngle) - - Q_DECLARE_PRIVATE(QSwipeGesture) - -public: - enum SwipeDirection { NoDirection, Left, Right, Up, Down }; - QSwipeGesture(QWidget *gestureTarget, QObject *parent = 0); - - bool filterEvent(QEvent *event); - void reset(); - - SwipeDirection horizontalDirection() const; - SwipeDirection verticalDirection() const; - qreal swipeAngle() const; - -private: - bool eventFilter(QObject *receiver, QEvent *event); - - friend class QWidget; -}; -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QSTANDARDGESTURES_H diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h index 79aadfd..fec5c2f 100644 --- a/src/gui/kernel/qstandardgestures_p.h +++ b/src/gui/kernel/qstandardgestures_p.h @@ -53,83 +53,20 @@ // We mean it. // -#include "qevent.h" -#include "qbasictimer.h" -#include "qdebug.h" - -#include "qgesture.h" -#include "qgesture_p.h" - -#include "qstandardgestures.h" -#include "qbasictimer.h" +#include "qgesturerecognizer.h" +#include "private/qgesture_p.h" QT_BEGIN_NAMESPACE -class QPanGesturePrivate : public QGesturePrivate -{ - Q_DECLARE_PUBLIC(QPanGesture) - -public: - void setupGestureTarget(QObject *o); - - QSizeF totalOffset; - QSizeF lastOffset; - QSizeF offset; - QPointF lastPosition; - -#if defined(QT_MAC_USE_COCOA) - QBasicTimer singleTouchPanTimer; - QPointF prevMousePos; -#endif -}; - -class QPinchGesturePrivate : public QGesturePrivate +class QPanGestureRecognizer : public QGestureRecognizer { - Q_DECLARE_PUBLIC(QPinchGesture) - public: - QPinchGesturePrivate() - : changes(0), totalScaleFactor(0.), lastScaleFactor(0.), scaleFactor(0.), - totalRotationAngle(0.), lastRotationAngle(0.), rotationAngle(0.) -#ifdef Q_WS_WIN - ,initialDistance(0), lastSequenceId(0) -#endif - { - } + QPanGestureRecognizer(); - void setupGestureTarget(QObject *o); - - QPinchGesture::WhatChanged changes; - - qreal totalScaleFactor; // total scale factor, excluding the current sequence. - qreal lastScaleFactor; - qreal scaleFactor; // scale factor in the current sequence. - - qreal totalRotationAngle; // total rotation angle, excluding the current sequence. - qreal lastRotationAngle; - qreal rotationAngle; // rotation angle in the current sequence. - - QPointF startCenterPoint; - QPointF lastCenterPoint; - QPointF centerPoint; -#ifdef Q_WS_WIN - int initialDistance; - ulong lastSequenceId; -#endif -}; - -class QSwipeGesturePrivate : public QGesturePrivate -{ - Q_DECLARE_PUBLIC(QSwipeGesture) - -public: - QSwipeGesturePrivate() - : swipeAngle(-1) - { - } + QGesture *createGesture(QObject *target); - void setupGestureTarget(QObject *o); - qreal swipeAngle; + QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + void reset(QGesture *state); }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 4cbf762..e6fa55a 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -115,6 +115,7 @@ #include "private/qevent_p.h" #include "private/qgraphicssystem_p.h" +#include "private/qgesturemanager_p.h" // widget/widget data creation count //#define QWIDGET_EXTRA_DEBUG @@ -8333,6 +8334,9 @@ bool QWidget::event(QEvent *event) (void) QApplication::sendEvent(this, &mouseEvent); break; } + case QEvent::Gesture: + event->ignore(); + break; #ifndef QT_NO_PROPERTIES case QEvent::DynamicPropertyChange: { const QByteArray &propName = static_cast(event)->propertyName(); @@ -11669,6 +11673,13 @@ QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const Synonym for QList. */ +void QWidget::grabGesture(Qt::GestureType type, Qt::GestureContext context) +{ + Q_D(QWidget); + d->gestureContext.insert(type, context); + (void)QGestureManager::instance(); // create a gesture manager +} + QT_END_NAMESPACE #include "moc_qwidget.cpp" diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 76418af..3501c6e 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -96,7 +96,6 @@ class QIcon; class QWindowSurface; class QLocale; class QGraphicsProxyWidget; -class QGestureManager; class QGraphicsEffect; #if defined(Q_WS_X11) class QX11Info; @@ -355,6 +354,8 @@ public: QGraphicsEffect *graphicsEffect() const; void setGraphicsEffect(QGraphicsEffect *effect); + void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::WidgetWithChildrenGesture); + public Q_SLOTS: void setWindowTitle(const QString &); #ifndef QT_NO_STYLE_STYLESHEET @@ -737,6 +738,8 @@ private: friend class QGraphicsProxyWidgetPrivate; friend class QStyleSheetStyle; friend struct QWidgetExceptionCleaner; + friend class QGestureManager; + friend class QWinNativePanGestureRecognizer; #ifdef Q_WS_MAC friend class QCoreGraphicsPaintEnginePrivate; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index c06ef73..a549740 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -64,6 +64,8 @@ #include "QtGui/qapplication.h" #include +#include + #ifdef Q_WS_WIN #include "QtCore/qt_windows.h" #include @@ -578,6 +580,7 @@ public: #ifndef QT_NO_ACTION QList actions; #endif + QMap gestureContext; // Bit fields. uint high_attributes[3]; // the low ones are in QWidget::widget_attributes @@ -604,6 +607,7 @@ public: bool isBackgroundInherited() const; #elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN uint noPaintOnScreen : 1; // see qwidget_win.cpp ::paintEngine() + uint nativeGesturePanEnabled : 1; bool shouldShowMaximizeButton(); void winUpdateIsOpaque(); diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index a0982f4..2b11bec 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -2029,11 +2029,6 @@ void QWidgetPrivate::winSetupGestures() if (!q || !q->isVisible()) return; QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - QApplicationPrivate::WidgetStandardGesturesMap::const_iterator it = - qAppPriv->widgetGestures.find(q); - if (it == qAppPriv->widgetGestures.end()) - return; - const QStandardGestures &gestures = it.value(); WId winid = q->effectiveWinId(); bool needh = false; @@ -2052,10 +2047,10 @@ void QWidgetPrivate::winSetupGestures() singleFingerPanEnabled = asa->d_func()->singleFingerPanEnabled; } if (winid && qAppPriv->SetGestureConfig) { - GESTURECONFIG gc[3]; + GESTURECONFIG gc[1]; memset(gc, 0, sizeof(gc)); gc[0].dwID = GID_PAN; - if (gestures.pan) { + if (nativeGesturePanEnabled) { gc[0].dwWant = GC_PAN; if (needv && singleFingerPanEnabled) gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY; @@ -2069,16 +2064,16 @@ void QWidgetPrivate::winSetupGestures() gc[0].dwBlock = GC_PAN; } - gc[1].dwID = GID_ZOOM; - if (gestures.pinch) - gc[1].dwWant = GC_ZOOM; - else - gc[1].dwBlock = GC_ZOOM; - gc[2].dwID = GID_ROTATE; - if (gestures.pinch) - gc[2].dwWant = GC_ROTATE; - else - gc[2].dwBlock = GC_ROTATE; +// gc[1].dwID = GID_ZOOM; +// if (gestures.pinch) +// gc[1].dwWant = GC_ZOOM; +// else +// gc[1].dwBlock = GC_ZOOM; +// gc[2].dwID = GID_ROTATE; +// if (gestures.pinch) +// gc[2].dwWant = GC_ROTATE; +// else +// gc[2].dwBlock = GC_ROTATE; qAppPriv->SetGestureConfig(winid, 0, sizeof(gc)/sizeof(gc[0]), gc, sizeof(gc[0])); } diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp new file mode 100644 index 0000000..4619594 --- /dev/null +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "private/qwinnativepangesturerecognizer_win_p.h" + +#include "qevent.h" +#include "qgraphicsitem.h" +#include "qgesture.h" + +#include "private/qgesture_p.h" +#include "private/qevent_p.h" +#include "private/qapplication_p.h" +#include "private/qwidget_p.h" + +QT_BEGIN_NAMESPACE + +QWinNativePanGestureRecognizer::QWinNativePanGestureRecognizer() +{ +} + +QGesture* QWinNativePanGestureRecognizer::createGesture(QObject *target) const +{ + if (!target) + return new QPanGesture; // a special case + if (qobject_cast(target)) + return 0; + if (!target->isWidgetType()) + return 0; + + QWidget *q = static_cast(target); + QWidgetPrivate *d = q->d_func(); + d->nativeGesturePanEnabled = true; + d->winSetupGestures(); + + return new QPanGesture; +} + +QGestureRecognizer::Result QWinNativePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +{ + QPanGesture *q = static_cast(state); + QPanGesturePrivate *d = q->d_func(); + + QGestureRecognizer::Result result = QGestureRecognizer::Ignore; + if (event->type() == QEvent::NativeGesture) { + QNativeGestureEvent *ev = static_cast(event); + switch(ev->gestureType) { + case QNativeGestureEvent::GestureBegin: + break; + case QNativeGestureEvent::Pan: + result = QGestureRecognizer::GestureTriggered; + event->accept(); + break; + case QNativeGestureEvent::GestureEnd: + if (q->state() == Qt::NoGesture) + return QGestureRecognizer::Ignore; // some other gesture has ended + result = QGestureRecognizer::GestureFinished; + break; + default: + return QGestureRecognizer::Ignore; + } + if (q->state() == Qt::NoGesture) { + d->lastOffset = d->totalOffset = d->offset = QSize(); + } else { + d->lastOffset = d->offset; + d->offset = QSize(ev->position.x() - d->lastPosition.x(), + ev->position.y() - d->lastPosition.y()); + d->totalOffset += d->offset; + } + d->lastPosition = ev->position; + } + return result; +} + +void QWinNativePanGestureRecognizer::reset(QGesture *state) +{ + QPanGesture *pan = static_cast(state); + QPanGesturePrivate *d = pan->d_func(); + + d->totalOffset = d->lastOffset = d->offset = QSizeF(); + d->lastPosition = QPoint(); + d->acceleration = 0; + + QGestureRecognizer::reset(state); +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h new file mode 100644 index 0000000..a1e8511 --- /dev/null +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINNATIVEPANGESTURERECOGNIZER_WIN_P_H +#define QWINNATIVEPANGESTURERECOGNIZER_WIN_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +QT_BEGIN_NAMESPACE + +class QWinNativePanGestureRecognizer : public QGestureRecognizer +{ +public: + QWinNativePanGestureRecognizer(); + + QGesture* createGesture(QObject *target) const; + + QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + void reset(QGesture *state); +}; + +QT_END_NAMESPACE + +#endif // QWINNATIVEPANGESTURERECOGNIZER_WIN_P_H diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index d8702cf..0896256 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -52,11 +52,6 @@ #include "qboxlayout.h" #include "qpainter.h" -#ifdef Q_WS_WIN -#include "qstandardgestures.h" -#include -#endif - #include "qabstractscrollarea_p.h" #include @@ -165,7 +160,7 @@ QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate() viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0), xoffset(0), yoffset(0), viewportFilter(0) #ifdef Q_WS_WIN - , panGesture(0), singleFingerPanEnabled(false) + , singleFingerPanEnabled(false) #endif { } @@ -298,14 +293,6 @@ void QAbstractScrollAreaPrivate::init() q->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); layoutChildren(); - -#ifdef Q_WS_WIN - panGesture = new QPanGesture(viewport, q); - panGesture->d_func()->implicitGesture = true; - QObject::connect(panGesture, SIGNAL(started()), q, SLOT(_q_gestureTriggered())); - QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered())); - QObject::connect(panGesture, SIGNAL(finished()), q, SLOT(_q_gestureTriggered())); -#endif // Q_WS_WIN } #ifdef Q_WS_WIN @@ -556,9 +543,6 @@ void QAbstractScrollArea::setViewport(QWidget *widget) if (isVisible()) d->viewport->show(); QMetaObject::invokeMethod(this, "setupViewport", Q_ARG(QWidget *, widget)); -#ifdef Q_WS_WIN - d->panGesture->setGestureTarget(widget); -#endif delete oldViewport; } } @@ -1351,26 +1335,24 @@ void QAbstractScrollArea::setupViewport(QWidget *viewport) Q_UNUSED(viewport); } -#ifdef Q_WS_WIN -void QAbstractScrollAreaPrivate::_q_gestureTriggered() -{ - Q_Q(QAbstractScrollArea); - QPanGesture *g = qobject_cast(q->sender()); - if (!g) - return; - QScrollBar *hBar = q->horizontalScrollBar(); - QScrollBar *vBar = q->verticalScrollBar(); - QSizeF delta = g->lastOffset(); - if (!delta.isNull()) { - if (QApplication::isRightToLeft()) - delta.rwidth() *= -1; - int newX = hBar->value() - delta.width(); - int newY = vBar->value() - delta.height(); - hbar->setValue(newX); - vbar->setValue(newY); - } -} -#endif +//void QAbstractScrollAreaPrivate::_q_gestureTriggered() +//{ +// Q_Q(QAbstractScrollArea); +// QPanGesture *g = qobject_cast(q->sender()); +// if (!g) +// return; +// QScrollBar *hBar = q->horizontalScrollBar(); +// QScrollBar *vBar = q->verticalScrollBar(); +// QSizeF delta = g->lastOffset(); +// if (!delta.isNull()) { +// if (QApplication::isRightToLeft()) +// delta.rwidth() *= -1; +// int newX = hBar->value() - delta.width(); +// int newY = vBar->value() - delta.height(); +// hbar->setValue(newX); +// vbar->setValue(newY); +// } +//} QT_END_NAMESPACE diff --git a/src/gui/widgets/qabstractscrollarea.h b/src/gui/widgets/qabstractscrollarea.h index 3773477..b3a1861 100644 --- a/src/gui/widgets/qabstractscrollarea.h +++ b/src/gui/widgets/qabstractscrollarea.h @@ -129,10 +129,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_vslide(int)) Q_PRIVATE_SLOT(d_func(), void _q_showOrHideScrollBars()) -#ifdef Q_WS_WIN - Q_PRIVATE_SLOT(d_func(), void _q_gestureTriggered()) -#endif - friend class QStyleSheetStyle; friend class QWidgetPrivate; }; diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h index 0bb2851..bfb8917 100644 --- a/src/gui/widgets/qabstractscrollarea_p.h +++ b/src/gui/widgets/qabstractscrollarea_p.h @@ -60,7 +60,6 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_SCROLLAREA -class QPanGesture; class QScrollBar; class QAbstractScrollAreaScrollBarContainer; class Q_AUTOTEST_EXPORT QAbstractScrollAreaPrivate: public QFramePrivate @@ -102,8 +101,6 @@ public: QScopedPointer viewportFilter; #ifdef Q_WS_WIN - QPanGesture *panGesture; - virtual void _q_gestureTriggered(); bool singleFingerPanEnabled; void setSingleFingerPanEnabled(bool on = true); #endif diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 2ed6cd7..22438bf 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -65,11 +65,6 @@ #include #include #include - -#ifdef Q_WS_WIN -#include -#endif - #include #ifndef QT_NO_TEXTEDIT @@ -2937,33 +2932,29 @@ QAbstractTextDocumentLayout::PaintContext QPlainTextEdit::getPaintContext() cons (\a available is true) or unavailable (\a available is false). */ -#ifdef Q_WS_WIN - -void QPlainTextEditPrivate::_q_gestureTriggered() -{ - Q_Q(QPlainTextEdit); - QPanGesture *g = qobject_cast(q->sender()); - if (!g) - return; - QScrollBar *hBar = q->horizontalScrollBar(); - QScrollBar *vBar = q->verticalScrollBar(); - if (g->state() == Qt::GestureStarted) - originalOffsetY = vBar->value(); - QSizeF totalOffset = g->totalOffset(); - if (!totalOffset.isNull()) { - if (QApplication::isRightToLeft()) - totalOffset.rwidth() *= -1; - // QPlainTextEdit scrolls by lines only in vertical direction - QFontMetrics fm(q->document()->defaultFont()); - int lineHeight = fm.height(); - int newX = hBar->value() - g->lastOffset().width(); - int newY = originalOffsetY - totalOffset.height()/lineHeight; - hbar->setValue(newX); - vbar->setValue(newY); - } -} - -#endif +//void QPlainTextEditPrivate::_q_gestureTriggered() +//{ +// Q_Q(QPlainTextEdit); +// QPanGesture *g = qobject_cast(q->sender()); +// if (!g) +// return; +// QScrollBar *hBar = q->horizontalScrollBar(); +// QScrollBar *vBar = q->verticalScrollBar(); +// if (g->state() == Qt::GestureStarted) +// originalOffsetY = vBar->value(); +// QSizeF totalOffset = g->totalOffset(); +// if (!totalOffset.isNull()) { +// if (QApplication::isRightToLeft()) +// totalOffset.rwidth() *= -1; +// // QPlainTextEdit scrolls by lines only in vertical direction +// QFontMetrics fm(q->document()->defaultFont()); +// int lineHeight = fm.height(); +// int newX = hBar->value() - g->lastOffset().width(); +// int newY = originalOffsetY - totalOffset.height()/lineHeight; +// hbar->setValue(newX); +// vbar->setValue(newY); +// } +//} QT_END_NAMESPACE diff --git a/src/gui/widgets/qplaintextedit.h b/src/gui/widgets/qplaintextedit.h index 1d6881b..60aed1d 100644 --- a/src/gui/widgets/qplaintextedit.h +++ b/src/gui/widgets/qplaintextedit.h @@ -270,10 +270,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_verticalScrollbarActionTriggered(int)) Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged()) -#ifdef Q_WS_WIN - Q_PRIVATE_SLOT(d_func(), void _q_gestureTriggered()) -#endif - friend class QPlainTextEditControl; }; diff --git a/src/gui/widgets/qplaintextedit_p.h b/src/gui/widgets/qplaintextedit_p.h index 5fe6f4d..7adf403 100644 --- a/src/gui/widgets/qplaintextedit_p.h +++ b/src/gui/widgets/qplaintextedit_p.h @@ -72,7 +72,6 @@ class QMimeData; class QPlainTextEdit; class ExtraArea; -class QPanGesture; class QPlainTextEditControl : public QTextControl { @@ -179,10 +178,6 @@ public: void _q_modificationChanged(bool); int originalOffsetY; - -#ifdef Q_WS_WIN - void _q_gestureTriggered(); -#endif }; QT_END_NAMESPACE diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index f3ecdae..9bc1d5c 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -398,7 +398,8 @@ SUBDIRS += \ selftests \ symbols \ qrand \ - utf8 + utf8 \ + gestures !wince*:SUBDIRS += $$Q3SUBDIRS diff --git a/tests/auto/gestures/gestures.pro b/tests/auto/gestures/gestures.pro new file mode 100644 index 0000000..da5610f --- /dev/null +++ b/tests/auto/gestures/gestures.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +SOURCES += tst_gestures.cpp + + + diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp new file mode 100644 index 0000000..0a6caff --- /dev/null +++ b/tests/auto/gestures/tst_gestures.cpp @@ -0,0 +1,625 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include +#include "../../shared/util.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +//TESTED_CLASS= +//TESTED_FILES= + +class CustomGesture : public QGesture +{ + Q_OBJECT +public: + static Qt::GestureType GestureType; + + CustomGesture(QObject *parent = 0) + : QGesture(parent), target(0), serial(0) + { + } + + QObject *target; + int serial; + + static const int SerialMaybeThreshold; + static const int SerialStartedThreshold; + static const int SerialFinishedThreshold; +}; +Qt::GestureType CustomGesture::GestureType = Qt::CustomGesture; +const int CustomGesture::SerialMaybeThreshold = 1; +const int CustomGesture::SerialStartedThreshold = 3; +const int CustomGesture::SerialFinishedThreshold = 6; + +class CustomEvent : public QEvent +{ +public: + static int EventType; + + CustomEvent(int serial_ = 0) + : QEvent(QEvent::Type(CustomEvent::EventType)), + serial(serial_), targetObject(0) + { + } + + int serial; + QObject *targetObject; + QPoint hotSpot; +}; +int CustomEvent::EventType = 0; + +class CustomGestureRecognizer : public QGestureRecognizer +{ +public: + CustomGestureRecognizer() + { + CustomEvent::EventType = QEvent::registerEventType(); + eventsCounter = 0; + } + + QGesture* createGesture(QObject *) + { + return new CustomGesture; + } + + QGestureRecognizer::Result filterEvent(QGesture *state, QObject*, QEvent *event) + { + if (event->type() == CustomEvent::EventType) { + QGestureRecognizer::Result result = QGestureRecognizer::ConsumeEventHint; + CustomGesture *g = static_cast(state); + CustomEvent *e = static_cast(event); + g->serial = e->serial; + g->setTargetObject(e->targetObject); + g->setHotSpot(e->hotSpot); + ++eventsCounter; + if (g->serial >= CustomGesture::SerialFinishedThreshold) + result |= QGestureRecognizer::GestureFinished; + else if (g->serial >= CustomGesture::SerialStartedThreshold) + result |= QGestureRecognizer::GestureTriggered; + else if (g->serial >= CustomGesture::SerialMaybeThreshold) + result |= QGestureRecognizer::MaybeGesture; + else + result = QGestureRecognizer::NotGesture; + return result; + } + return QGestureRecognizer::Ignore; + } + + void reset(QGesture *state) + { + CustomGesture *g = static_cast(state); + g->serial = 0; + QGestureRecognizer::reset(state); + } + + int eventsCounter; + QString name; +}; + +class GestureWidget : public QWidget +{ + Q_OBJECT +public: + GestureWidget(const char *name = 0) + { + if (name) + setObjectName(QLatin1String(name)); + reset(); + acceptGestureOverride = false; + } + void reset() + { + customEventsReceived = 0; + gestureEventsReceived = 0; + gestureOverrideEventsReceived = 0; + events.clear(); + overrideEvents.clear(); + } + + int customEventsReceived; + int gestureEventsReceived; + int gestureOverrideEventsReceived; + struct Events + { + QList all; + QList started; + QList updated; + QList finished; + QList canceled; + + void clear() + { + all.clear(); + started.clear(); + updated.clear(); + finished.clear(); + canceled.clear(); + } + } events, overrideEvents; + + bool acceptGestureOverride; + +protected: + bool event(QEvent *event) + { + Events *eventsPtr = 0; + if (event->type() == QEvent::Gesture) { + ++gestureEventsReceived; + eventsPtr = &events; + } else if (event->type() == QEvent::GestureOverride) { + ++gestureOverrideEventsReceived; + eventsPtr = &overrideEvents; + if (acceptGestureOverride) + event->accept(); + } + if (eventsPtr) { + QGestureEvent *e = static_cast(event); + QList gestures = e->allGestures(); + foreach(QGesture *g, gestures) { + eventsPtr->all << g->gestureType(); + switch(g->state()) { + case Qt::GestureStarted: + eventsPtr->started << g->gestureType(); + break; + case Qt::GestureUpdated: + eventsPtr->updated << g->gestureType(); + break; + case Qt::GestureFinished: + eventsPtr->finished << g->gestureType(); + break; + case Qt::GestureCanceled: + eventsPtr->canceled << g->gestureType(); + break; + default: + Q_ASSERT(false); + } + } + } else if (event->type() == CustomEvent::EventType) { + ++customEventsReceived; + } else { + return QWidget::event(event); + } + return true; + } +}; + +static void sendCustomGesture(QObject *object) +{ + CustomEvent ev; + ev.targetObject = object; + for (int i = CustomGesture::SerialMaybeThreshold; + i <= CustomGesture::SerialFinishedThreshold; ++i) { + ev.serial = i; + QApplication::sendEvent(object, &ev); + } +} + +class tst_Gestures : public QObject +{ +Q_OBJECT + +public: + tst_Gestures(); + virtual ~tst_Gestures(); + +public slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +private slots: + void customGesture(); + void autoCancelingGestures(); + void gestureOverChild(); + void multipleWidgetOnlyGestureInTree(); + void conflictingGestures(); + void finishedWithoutStarted(); + void unknownGesture(); + void graphicsItemGesture(); +}; + +tst_Gestures::tst_Gestures() +{ +} + +tst_Gestures::~tst_Gestures() +{ +} + +void tst_Gestures::initTestCase() +{ + CustomGesture::GestureType = qApp->registerGestureRecognizer(new CustomGestureRecognizer); + QVERIFY(CustomGesture::GestureType != Qt::GestureType(0)); + QVERIFY(CustomGesture::GestureType != Qt::CustomGesture); +} + +void tst_Gestures::cleanupTestCase() +{ +} + +void tst_Gestures::init() +{ +} + +void tst_Gestures::cleanup() +{ +} + +void tst_Gestures::customGesture() +{ + GestureWidget widget; + widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + sendCustomGesture(&widget); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; + QCOMPARE(widget.customEventsReceived, TotalCustomEventsCount); + QCOMPARE(widget.gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(widget.gestureOverrideEventsReceived, 0); + QCOMPARE(widget.events.all.size(), TotalGestureEventsCount); + for(int i = 0; i < widget.events.all.size(); ++i) + QCOMPARE(widget.events.all.at(i), CustomGesture::GestureType); + QCOMPARE(widget.events.started.size(), 1); + QCOMPARE(widget.events.updated.size(), TotalGestureEventsCount - 2); + QCOMPARE(widget.events.finished.size(), 1); + QCOMPARE(widget.events.canceled.size(), 0); +} + +void tst_Gestures::autoCancelingGestures() +{ + GestureWidget widget; + widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + // send partial gesture. The gesture will be in the "maybe" state, but will + // never get enough events to fire, so Qt will have to kill it. + CustomEvent ev; + for (int i = CustomGesture::SerialMaybeThreshold; + i < CustomGesture::SerialStartedThreshold; ++i) { + ev.serial = i; + QApplication::sendEvent(&widget, &ev); + } + // wait long enough so the gesture manager will cancel the gesture + QTest::qWait(5000); + QCOMPARE(widget.customEventsReceived, CustomGesture::SerialStartedThreshold - CustomGesture::SerialMaybeThreshold); + QCOMPARE(widget.gestureEventsReceived, 0); + QCOMPARE(widget.gestureOverrideEventsReceived, 0); + QCOMPARE(widget.events.all.size(), 0); +} + +void tst_Gestures::gestureOverChild() +{ + GestureWidget widget("widget"); + QVBoxLayout *l = new QVBoxLayout(&widget); + GestureWidget *child = new GestureWidget("child"); + l->addWidget(child); + + widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + + sendCustomGesture(child); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; + + QCOMPARE(child->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(widget.customEventsReceived, 0); + QCOMPARE(child->gestureEventsReceived, 0); + QCOMPARE(child->gestureOverrideEventsReceived, 0); + QCOMPARE(widget.gestureEventsReceived, 0); + QCOMPARE(widget.gestureOverrideEventsReceived, 0); + + // enable gestures over the children + widget.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + + widget.reset(); + child->reset(); + + sendCustomGesture(child); + + QCOMPARE(child->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(widget.customEventsReceived, 0); + + QCOMPARE(child->gestureEventsReceived, 0); + QCOMPARE(child->gestureOverrideEventsReceived, 0); + QCOMPARE(widget.gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(widget.gestureOverrideEventsReceived, 0); + for(int i = 0; i < widget.events.all.size(); ++i) + QCOMPARE(widget.events.all.at(i), CustomGesture::GestureType); + QCOMPARE(widget.events.started.size(), 1); + QCOMPARE(widget.events.updated.size(), TotalGestureEventsCount - 2); + QCOMPARE(widget.events.finished.size(), 1); + QCOMPARE(widget.events.canceled.size(), 0); +} + +void tst_Gestures::multipleWidgetOnlyGestureInTree() +{ + GestureWidget parent("parent"); + QVBoxLayout *l = new QVBoxLayout(&parent); + GestureWidget *child = new GestureWidget("child"); + l->addWidget(child); + + parent.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + child->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; + + // sending events to the child and making sure there is no conflict + sendCustomGesture(child); + + QCOMPARE(child->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(parent.customEventsReceived, 0); + QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(child->gestureOverrideEventsReceived, 0); + QCOMPARE(parent.gestureEventsReceived, 0); + QCOMPARE(parent.gestureOverrideEventsReceived, 0); + + parent.reset(); + child->reset(); + + // same for the parent widget + sendCustomGesture(&parent); + + QCOMPARE(child->customEventsReceived, 0); + QCOMPARE(parent.customEventsReceived, TotalCustomEventsCount); + QCOMPARE(child->gestureEventsReceived, 0); + QCOMPARE(child->gestureOverrideEventsReceived, 0); + QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(parent.gestureOverrideEventsReceived, 0); +} + +void tst_Gestures::conflictingGestures() +{ + GestureWidget parent("parent"); + QVBoxLayout *l = new QVBoxLayout(&parent); + GestureWidget *child = new GestureWidget("child"); + l->addWidget(child); + + parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + child->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + + // child accepts the override, parent will not receive anything + parent.acceptGestureOverride = false; + child->acceptGestureOverride = true; + + // sending events to the child and making sure there is no conflict + sendCustomGesture(child); + + QCOMPARE(child->gestureOverrideEventsReceived, TotalGestureEventsCount); + QCOMPARE(child->gestureEventsReceived, 0); + QCOMPARE(parent.gestureOverrideEventsReceived, 0); + QCOMPARE(parent.gestureEventsReceived, 0); + + parent.reset(); + child->reset(); + + // parent accepts the override + parent.acceptGestureOverride = true; + child->acceptGestureOverride = false; + + // sending events to the child and making sure there is no conflict + sendCustomGesture(child); + + QCOMPARE(child->gestureOverrideEventsReceived, TotalGestureEventsCount); + QCOMPARE(child->gestureEventsReceived, 0); + QCOMPARE(parent.gestureOverrideEventsReceived, TotalGestureEventsCount); + QCOMPARE(parent.gestureEventsReceived, 0); + + parent.reset(); + child->reset(); + + // nobody accepts the override, we will send normal events to the closest context (to the child) + parent.acceptGestureOverride = false; + child->acceptGestureOverride = false; + + // sending events to the child and making sure there is no conflict + sendCustomGesture(child); + + QCOMPARE(child->gestureOverrideEventsReceived, TotalGestureEventsCount); + QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(parent.gestureOverrideEventsReceived, TotalGestureEventsCount); + QCOMPARE(parent.gestureEventsReceived, 0); +} + +void tst_Gestures::finishedWithoutStarted() +{ + GestureWidget widget; + widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + // the gesture will claim it finished, but it was never started. + CustomEvent ev; + QTest::ignoreMessage(QtWarningMsg, "QGestureManager::filterEvent: some gestures were finished even though they've never started"); + for (int i = CustomGesture::SerialFinishedThreshold; + i < CustomGesture::SerialFinishedThreshold+1; ++i) { + ev.serial = i; + QApplication::sendEvent(&widget, &ev); + } + + QCOMPARE(widget.gestureEventsReceived, 0); + QCOMPARE(widget.gestureOverrideEventsReceived, 0); +} + +void tst_Gestures::unknownGesture() +{ + GestureWidget widget; + widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(Qt::CustomGesture, Qt::WidgetGesture); + widget.grabGesture(Qt::GestureType(Qt::PanGesture+512), Qt::WidgetGesture); + + sendCustomGesture(&widget); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + + QCOMPARE(widget.gestureEventsReceived, TotalGestureEventsCount); +} + +class GestureItem : public QGraphicsObject +{ +public: + GestureItem() + { + size = QRectF(0, 0, 100, 100); + customEventsReceived = 0; + gestureEventsReceived = 0; + gestureOverrideEventsReceived = 0; + events.clear(); + overrideEvents.clear(); + acceptGestureOverride = false; + } + + int customEventsReceived; + int gestureEventsReceived; + int gestureOverrideEventsReceived; + struct Events + { + QList all; + QList started; + QList updated; + QList finished; + QList canceled; + + void clear() + { + all.clear(); + started.clear(); + updated.clear(); + finished.clear(); + canceled.clear(); + } + } events, overrideEvents; + + bool acceptGestureOverride; + + QRectF size; + +protected: + QRectF boundingRect() const + { + return size; + } + void paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) + { + p->fillRect(boundingRect(), Qt::blue); + } + + bool event(QEvent *event) + { + Events *eventsPtr = 0; + if (event->type() == QEvent::Gesture) { + ++gestureEventsReceived; + eventsPtr = &events; + } else if (event->type() == QEvent::GestureOverride) { + ++gestureOverrideEventsReceived; + eventsPtr = &overrideEvents; + if (acceptGestureOverride) + event->accept(); + } + if (eventsPtr) { + QGestureEvent *e = static_cast(event); + QList gestures = e->allGestures(); + foreach(QGesture *g, gestures) { + eventsPtr->all << g->gestureType(); + switch(g->state()) { + case Qt::GestureStarted: + eventsPtr->started << g->gestureType(); + break; + case Qt::GestureUpdated: + eventsPtr->updated << g->gestureType(); + break; + case Qt::GestureFinished: + eventsPtr->finished << g->gestureType(); + break; + case Qt::GestureCanceled: + eventsPtr->canceled << g->gestureType(); + break; + default: + Q_ASSERT(false); + } + } + } else if (event->type() == CustomEvent::EventType) { + ++customEventsReceived; + } else { + return QGraphicsObject::event(event); + } + return true; + } +}; + +void tst_Gestures::graphicsItemGesture() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + + GestureItem *item = new GestureItem; + scene.addItem(item); + item->setPos(100, 100); + + item->grabGesture(CustomGesture::GestureType); + + sendCustomGesture(item); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; + + QCOMPARE(item->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(item->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item->gestureOverrideEventsReceived, 0); + QCOMPARE(item->events.all.size(), TotalGestureEventsCount); + for(int i = 0; i < item->events.all.size(); ++i) + QCOMPARE(item->events.all.at(i), CustomGesture::GestureType); + QCOMPARE(item->events.started.size(), 1); + QCOMPARE(item->events.updated.size(), TotalGestureEventsCount - 2); + QCOMPARE(item->events.finished.size(), 1); + QCOMPARE(item->events.canceled.size(), 0); +} + +QTEST_MAIN(tst_Gestures) +#include "tst_gestures.moc" diff --git a/tests/manual/gestures/graphicsview/gestures.cpp b/tests/manual/gestures/graphicsview/gestures.cpp new file mode 100644 index 0000000..c888aa1 --- /dev/null +++ b/tests/manual/gestures/graphicsview/gestures.cpp @@ -0,0 +1,90 @@ +#include "gestures.h" + +#include + +Qt::GestureType ThreeFingerSlideGesture::Type = Qt::CustomGesture; + +QGesture *ThreeFingerSlideGestureRecognizer::createGesture(QObject *) +{ + return new ThreeFingerSlideGesture; +} + +QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +{ + ThreeFingerSlideGesture *d = static_cast(state); + QGestureRecognizer::Result result; + switch (event->type()) { + case QEvent::TouchBegin: + result = QGestureRecognizer::MaybeGesture; + case QEvent::TouchEnd: + if (d->gestureFired) + result = QGestureRecognizer::GestureFinished; + else + result = QGestureRecognizer::NotGesture; + case QEvent::TouchUpdate: + if (d->state() != Qt::NoGesture) { + QTouchEvent *ev = static_cast(event); + if (ev->touchPoints().size() == 3) { + d->gestureFired = true; + result = QGestureRecognizer::GestureTriggered; + } else { + result = QGestureRecognizer::MaybeGesture; + for (int i = 0; i < ev->touchPoints().size(); ++i) { + const QTouchEvent::TouchPoint &pt = ev->touchPoints().at(i); + const int distance = (pt.pos().toPoint() - pt.startPos().toPoint()).manhattanLength(); + if (distance > 20) { + result = QGestureRecognizer::NotGesture; + } + } + } + } else { + result = QGestureRecognizer::NotGesture; + } + + break; + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseMove: + if (d->state() != Qt::NoGesture) + result = QGestureRecognizer::Ignore; + else + result = QGestureRecognizer::NotGesture; + break; + default: + result = QGestureRecognizer::Ignore; + break; + } + return result; +} + +void ThreeFingerSlideGestureRecognizer::reset(QGesture *state) +{ + static_cast(state)->gestureFired = false; + QGestureRecognizer::reset(state); +} + + +QGesture *RotateGestureRecognizer::createGesture(QObject *) +{ + return new QGesture; +} + +QGestureRecognizer::Result RotateGestureRecognizer::filterEvent(QGesture *, QObject *, QEvent *event) +{ + switch (event->type()) { + case QEvent::TouchBegin: + case QEvent::TouchEnd: + case QEvent::TouchUpdate: + break; + default: + break; + } + return QGestureRecognizer::Ignore; +} + +void RotateGestureRecognizer::reset(QGesture *state) +{ + QGestureRecognizer::reset(state); +} + +#include "moc_gestures.cpp" diff --git a/tests/manual/gestures/graphicsview/gestures.h b/tests/manual/gestures/graphicsview/gestures.h new file mode 100644 index 0000000..630a7ef --- /dev/null +++ b/tests/manual/gestures/graphicsview/gestures.h @@ -0,0 +1,37 @@ +#ifndef GESTURE_H +#define GESTURE_H + +#include +#include + +class ThreeFingerSlideGesture : public QGesture +{ + Q_OBJECT +public: + static Qt::GestureType Type; + + ThreeFingerSlideGesture(QObject *parent = 0) : QGesture(parent) { } + + bool gestureFired; +}; + +class ThreeFingerSlideGestureRecognizer : public QGestureRecognizer +{ +private: + QGesture* createGesture(QObject *target); + QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + void reset(QGesture *state); +}; + +class RotateGestureRecognizer : public QGestureRecognizer +{ +public: + RotateGestureRecognizer(); + +private: + QGesture* createGesture(QObject *target); + QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + void reset(QGesture *state); +}; + +#endif // GESTURE_H diff --git a/tests/manual/gestures/graphicsview/graphicsview.pro b/tests/manual/gestures/graphicsview/graphicsview.pro new file mode 100644 index 0000000..a40c323 --- /dev/null +++ b/tests/manual/gestures/graphicsview/graphicsview.pro @@ -0,0 +1,17 @@ +# ##################################################################### +# Automatically generated by qmake (2.01a) Mon Sep 7 13:26:43 2009 +# ##################################################################### +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += main.cpp \ + imageitem.cpp \ + gestures.cpp \ + mousepangesturerecognizer.cpp + +HEADERS += imageitem.h \ + gestures.h \ + mousepangesturerecognizer.h diff --git a/tests/manual/gestures/graphicsview/imageitem.cpp b/tests/manual/gestures/graphicsview/imageitem.cpp new file mode 100644 index 0000000..d6f406c --- /dev/null +++ b/tests/manual/gestures/graphicsview/imageitem.cpp @@ -0,0 +1,52 @@ +#include "imageitem.h" +#include "gestures.h" + +#include +#include + +ImageItem::ImageItem(const QImage &image) +{ + setImage(image); +} + +void ImageItem::setImage(const QImage &image) +{ + image_ = image; + pixmap_ = QPixmap::fromImage(image.scaled(400, 400, Qt::KeepAspectRatio)); + update(); +} + +QImage ImageItem::image() const +{ + return image_; +} + +QRectF ImageItem::boundingRect() const +{ + const QSize size = pixmap_.size(); + return QRectF(0, 0, size.width(), size.height()); +} + +void ImageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem*, QWidget*) +{ + painter->drawPixmap(0, 0, pixmap_); +} + + +GestureImageItem::GestureImageItem(const QImage &image) + : ImageItem(image) +{ + grabGesture(Qt::PanGesture); + grabGesture(ThreeFingerSlideGesture::Type); +} + +bool GestureImageItem::event(QEvent *event) +{ + if (event->type() == QEvent::Gesture) { + qDebug("gestureimageitem: gesture triggered"); + return true; + } + return ImageItem::event(event); +} + +#include "moc_imageitem.cpp" diff --git a/tests/manual/gestures/graphicsview/imageitem.h b/tests/manual/gestures/graphicsview/imageitem.h new file mode 100644 index 0000000..ad0e397 --- /dev/null +++ b/tests/manual/gestures/graphicsview/imageitem.h @@ -0,0 +1,36 @@ +#ifndef IMAGEITEM_H +#define IMAGEITEM_H + +#include +#include +#include +#include + +class ImageItem : public QGraphicsObject +{ + Q_OBJECT +public: + ImageItem(const QImage &image); + void setImage(const QImage &image); + QImage image() const; + QRectF boundingRect() const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + +private: + QImage image_; + QPixmap pixmap_; + QTransform transform; +}; + +class GestureImageItem : public ImageItem +{ + Q_OBJECT + +public: + GestureImageItem(const QImage &image); + +protected: + bool event(QEvent *event); +}; + +#endif // IMAGEITEM_H diff --git a/tests/manual/gestures/graphicsview/main.cpp b/tests/manual/gestures/graphicsview/main.cpp new file mode 100644 index 0000000..1db5614 --- /dev/null +++ b/tests/manual/gestures/graphicsview/main.cpp @@ -0,0 +1,187 @@ +#include + +#include "imageitem.h" +#include "gestures.h" +#include "mousepangesturerecognizer.h" + +class GraphicsView : public QGraphicsView +{ +public: + GraphicsView(QGraphicsScene *scene, QWidget *parent = 0) + : QGraphicsView(scene, parent) + { + } +protected: + bool viewportEvent(QEvent *event) + { + if (event->type() == QEvent::Gesture) { + QGestureEvent *ge = static_cast(event); + if (QPanGesture *pan = static_cast(ge->gesture(Qt::PanGesture))) { + switch (pan->state()) { + case Qt::GestureStarted: qDebug("view: Pan: started"); break; + case Qt::GestureFinished: qDebug("view: Pan: finished"); break; + case Qt::GestureCanceled: qDebug("view: Pan: canceled"); break; + case Qt::GestureUpdated: break; + default: qDebug("view: Pan: "); break; + } + + const QSizeF offset = pan->offset(); + QScrollBar *vbar = verticalScrollBar(); + QScrollBar *hbar = horizontalScrollBar(); + vbar->setValue(vbar->value() - offset.height()); + hbar->setValue(hbar->value() - offset.width()); + ge->accept(pan); + return true; + } + } + return QGraphicsView::viewportEvent(event); + } +}; + +class StandardGestures : public QWidget +{ +public: + StandardGestures(QWidget *parent = 0) + : QWidget(parent) + { + scene = new QGraphicsScene(this); + scene->setSceneRect(-2000, -2000, 4000, 4000); + view = new QGraphicsView(scene, 0); + QVBoxLayout *l = new QVBoxLayout(this); + l->addWidget(view); + } + + QGraphicsScene *scene; + QGraphicsView *view; +}; + +class GlobalViewGestures : public QWidget +{ + Q_OBJECT +public: + GlobalViewGestures(QWidget *parent = 0) + : QWidget(parent) + { + scene = new QGraphicsScene(this); + scene->setSceneRect(-2000, -2000, 4000, 4000); + view = new GraphicsView(scene, 0); + view->viewport()->grabGesture(Qt::PanGesture); + view->viewport()->grabGesture(ThreeFingerSlideGesture::Type); + QVBoxLayout *l = new QVBoxLayout(this); + l->addWidget(view); + } + + QGraphicsScene *scene; + QGraphicsView *view; +}; + +class GraphicsItemGestures : public QWidget +{ + Q_OBJECT +public: + GraphicsItemGestures(QWidget *parent = 0) + : QWidget(parent) + { + scene = new QGraphicsScene(this); + scene->setSceneRect(-2000, -2000, 4000, 4000); + view = new QGraphicsView(scene, 0); + QVBoxLayout *l = new QVBoxLayout(this); + l->addWidget(view); + } + + QGraphicsScene *scene; + QGraphicsView *view; +}; + +class MainWindow : public QMainWindow +{ +public: + MainWindow(); + + void setDirectory(const QString &path); + +private: + QTabWidget *tabWidget; + StandardGestures *standardGestures; + GlobalViewGestures *globalViewGestures; + GraphicsItemGestures *graphicsItemGestures; +}; + +MainWindow::MainWindow() +{ + (void)qApp->registerGestureRecognizer(new MousePanGestureRecognizer); + ThreeFingerSlideGesture::Type = qApp->registerGestureRecognizer(new ThreeFingerSlideGestureRecognizer); + + tabWidget = new QTabWidget; + + standardGestures = new StandardGestures; + tabWidget->addTab(standardGestures, "Standard gestures"); + + globalViewGestures = new GlobalViewGestures; + tabWidget->addTab(globalViewGestures , "Global gestures"); + + graphicsItemGestures = new GraphicsItemGestures; + tabWidget->addTab(graphicsItemGestures, "Graphics item gestures"); + + setCentralWidget(tabWidget); +} + +void MainWindow::setDirectory(const QString &path) +{ + QDir dir(path); + QStringList files = dir.entryList(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot); + foreach(const QString &file, files) { + QImageReader img(path + QLatin1String("/")+file); + QImage image = img.read(); + if (!image.isNull()) { + { + ImageItem *item = new ImageItem(image); + item->setPos(0, 0); + item->setFlags(QGraphicsItem::ItemIsMovable); + standardGestures->scene->addItem(item); + } + { + ImageItem *item = new ImageItem(image); + item->setPos(0, 0); + item->setFlags(QGraphicsItem::ItemIsMovable); + globalViewGestures->scene->addItem(item); + } + { + GestureImageItem *item = new GestureImageItem(image); + item->setPos(0, 0); + item->setFlags(QGraphicsItem::ItemIsMovable); + graphicsItemGestures->scene->addItem(item); + } + } + } + + { + QList items = standardGestures->scene->items(); + if (!items.isEmpty()) + standardGestures->view->ensureVisible(items.at(0)); + } + { + QList items = globalViewGestures->scene->items(); + if (!items.isEmpty()) + globalViewGestures->view->ensureVisible(items.at(0)); + } + { + QList items = graphicsItemGestures->scene->items(); + if (!items.isEmpty()) + graphicsItemGestures->view->ensureVisible(items.at(0)); + } +} + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + MainWindow window; + if (QApplication::arguments().size() > 1) + window.setDirectory(QApplication::arguments().at(1)); + else + window.setDirectory(QFileDialog::getExistingDirectory(0, "Select image folder")); + window.show(); + return app.exec(); +} + +#include "main.moc" diff --git a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp new file mode 100644 index 0000000..f89f247 --- /dev/null +++ b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mousepangesturerecognizer.h" + +#include +#include +#include + +MousePanGestureRecognizer::MousePanGestureRecognizer() +{ +} + +QGesture* MousePanGestureRecognizer::createGesture(QObject *) +{ + return new QPanGesture; +} + +QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +{ + QPanGesture *g = static_cast(state); + QMouseEvent *me = static_cast(event); + if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick + || event->type() == QEvent::GraphicsSceneMousePress || event->type() == QEvent::GraphicsSceneMouseDoubleClick) { + g->setHotSpot(me->globalPos()); + g->setProperty("lastPos", me->globalPos()); + g->setProperty("pressed", QVariant::fromValue(true)); + return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + } else if (event->type() == QEvent::MouseMove || event->type() == QEvent::GraphicsSceneMouseMove) { + if (g->property("pressed").toBool()) { + QPoint pos = me->globalPos(); + QPoint lastPos = g->property("lastPos").toPoint(); + g->setLastOffset(g->offset()); + lastPos = pos - lastPos; + g->setOffset(QSizeF(lastPos.x(), lastPos.y())); + g->setTotalOffset(g->totalOffset() + QSizeF(lastPos.x(), lastPos.y())); + g->setProperty("lastPos", pos); + return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + } + return QGestureRecognizer::NotGesture; + } else if (event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::GraphicsSceneMouseRelease) { + return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint; + } + return QGestureRecognizer::Ignore; +} + +void MousePanGestureRecognizer::reset(QGesture *state) +{ + QPanGesture *g = static_cast(state); + g->setTotalOffset(QSizeF()); + g->setLastOffset(QSizeF()); + g->setOffset(QSizeF()); + g->setAcceleration(0); + g->setProperty("lastPos", QVariant()); + g->setProperty("pressed", QVariant::fromValue(false)); + QGestureRecognizer::reset(state); +} diff --git a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h new file mode 100644 index 0000000..e31799e --- /dev/null +++ b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOUSEPANGESTURERECOGNIZER_H +#define MOUSEPANGESTURERECOGNIZER_H + +#include + +class MousePanGestureRecognizer : public QGestureRecognizer +{ +public: + MousePanGestureRecognizer(); + + QGesture* createGesture(QObject *target); + QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + void reset(QGesture *state); +}; + +#endif // MOUSEPANGESTURERECOGNIZER_H diff --git a/tests/manual/gestures/pinch/main.cpp b/tests/manual/gestures/pinch/main.cpp deleted file mode 100644 index 4d9c14c..0000000 --- a/tests/manual/gestures/pinch/main.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "pinchwidget.h" - -class MainWindow : public QWidget -{ -public: - MainWindow(); -}; - -MainWindow::MainWindow() -{ - QVBoxLayout *l = new QVBoxLayout(this); - QPushButton *btn = new QPushButton(QLatin1String("AcceptTouchEvents")); - l->addWidget(btn); - QImage image(":/images/qt-logo.png"); - PinchWidget *w = new PinchWidget(image); - l->addWidget(w); - connect(btn, SIGNAL(clicked()), w, SLOT(acceptTouchEvents())); -} - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - MainWindow w; - w.show(); - return app.exec(); -} diff --git a/tests/manual/gestures/pinch/pinch.pro b/tests/manual/gestures/pinch/pinch.pro deleted file mode 100644 index d1f28cc..0000000 --- a/tests/manual/gestures/pinch/pinch.pro +++ /dev/null @@ -1,4 +0,0 @@ -SOURCES = main.cpp \ - pinchwidget.cpp -HEADERS += pinchwidget.h -RESOURCES += pinch.qrc diff --git a/tests/manual/gestures/pinch/pinch.qrc b/tests/manual/gestures/pinch/pinch.qrc deleted file mode 100644 index 0be9ba1..0000000 --- a/tests/manual/gestures/pinch/pinch.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - qt-logo.png - - diff --git a/tests/manual/gestures/pinch/pinchwidget.cpp b/tests/manual/gestures/pinch/pinchwidget.cpp deleted file mode 100644 index e93c8b5..0000000 --- a/tests/manual/gestures/pinch/pinchwidget.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "pinchwidget.h" - -#include -#include -#include -#include -#include -#include - -PinchWidget::PinchWidget(const QImage &image, QWidget *parent) - : QWidget(parent) -{ - setMinimumSize(100,100); - this->image = image; - pan = new QPanGesture(this); - connect(pan, SIGNAL(triggered()), this, SLOT(onPanTriggered())); - connect(pan, SIGNAL(finished()), this, SLOT(onPanFinished())); - pinch = new QPinchGesture(this); - connect(pinch, SIGNAL(triggered()), this, SLOT(onPinchTriggered())); - connect(pinch, SIGNAL(finished()), this, SLOT(onPinchFinished())); -} - -QSize PinchWidget::sizeHint() const -{ - return image.size()*1.5; -} - -void PinchWidget::paintEvent(QPaintEvent *) -{ - QPainter p(this); - QTransform t = worldTransform * currentPanTransform * currentPinchTransform; - p.setTransform(t); - QPoint center = QPoint(width()/2, height()/2); - QPoint size = QPoint(image.width()/2, image.height()/2); - p.translate(center - size); - p.drawImage(QPoint(0,0), image); -} - -void PinchWidget::acceptTouchEvents() -{ - setAttribute(Qt::WA_AcceptTouchEvents); - if (QWidget *w = qobject_cast(sender())) - w->setEnabled(false); -} - -void PinchWidget::onPanTriggered() -{ - currentPanTransform = QTransform() - .translate(pan->totalOffset().width(), - pan->totalOffset().height()); - update(); -} - -void PinchWidget::onPanFinished() -{ - worldTransform *= currentPanTransform; - currentPanTransform.reset(); - update(); -} - -void PinchWidget::onPinchTriggered() -{ - QPoint transformCenter = worldTransform.map(QPoint(width()/2, height()/2)); - currentPinchTransform = QTransform() - .translate(transformCenter.x(), transformCenter.y()) - .scale(pinch->totalScaleFactor(), pinch->totalScaleFactor()) - .rotate(pinch->totalRotationAngle()) - .translate(-transformCenter.x(), -transformCenter.y()); - update(); -} - -void PinchWidget::onPinchFinished() -{ - worldTransform *= currentPinchTransform; - currentPinchTransform.reset(); - update(); -} diff --git a/tests/manual/gestures/pinch/pinchwidget.h b/tests/manual/gestures/pinch/pinchwidget.h deleted file mode 100644 index 7628ffc..0000000 --- a/tests/manual/gestures/pinch/pinchwidget.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PINCHWIDGET_H -#define PINCHWIDGET_H - -#include -#include - -class QPanGesture; -class QPinchGesture; - -class PinchWidget : public QWidget -{ - Q_OBJECT -public: - PinchWidget(const QImage &image, QWidget *parent = 0); - -private Q_SLOTS: - void acceptTouchEvents(); - void onPanTriggered(); - void onPanFinished(); - void onPinchTriggered(); - void onPinchFinished(); - -private: - void paintEvent(QPaintEvent *); - QSize sizeHint() const; - - QImage image; - - QPanGesture *pan; - QPinchGesture *pinch; - - QTransform worldTransform; - QTransform currentPanTransform; - QTransform currentPinchTransform; -}; - -#endif // PINCHWIDGET_H diff --git a/tests/manual/gestures/pinch/qt-logo.png b/tests/manual/gestures/pinch/qt-logo.png deleted file mode 100644 index 7d3e97e..0000000 Binary files a/tests/manual/gestures/pinch/qt-logo.png and /dev/null differ diff --git a/tests/manual/gestures/scrollarea/main.cpp b/tests/manual/gestures/scrollarea/main.cpp new file mode 100644 index 0000000..e2fa4d3 --- /dev/null +++ b/tests/manual/gestures/scrollarea/main.cpp @@ -0,0 +1,188 @@ +#include + +#include "mousepangesturerecognizer.h" + +class ScrollArea : public QScrollArea +{ + Q_OBJECT +public: + ScrollArea(QWidget *parent = 0) + : QScrollArea(parent), outside(false) + { + viewport()->grabGesture(Qt::PanGesture); + } + +protected: + bool viewportEvent(QEvent *event) + { + if (event->type() == QEvent::Gesture) { + gestureEvent(static_cast(event)); + return true; + } else if (event->type() == QEvent::GestureOverride) { + QGestureEvent *ge = static_cast(event); + if (QPanGesture *pan = static_cast(ge->gesture(Qt::PanGesture))) + if (pan->state() == Qt::GestureStarted) { + outside = false; + } + } + return QScrollArea::viewportEvent(event); + } + void gestureEvent(QGestureEvent *event) + { + QPanGesture *pan = static_cast(event->gesture(Qt::PanGesture)); + if (pan) { + switch(pan->state()) { + case Qt::GestureStarted: qDebug("area: Pan: started"); break; + case Qt::GestureFinished: qDebug("area: Pan: finished"); break; + case Qt::GestureCanceled: qDebug("area: Pan: canceled"); break; + case Qt::GestureUpdated: break; + default: qDebug("area: Pan: "); break; + } + + if (pan->state() == Qt::GestureStarted) + outside = false; + event->ignore(); + event->ignore(pan); + if (outside) + return; + + const QSizeF offset = pan->offset(); + const QSizeF totalOffset = pan->totalOffset(); + QScrollBar *vbar = verticalScrollBar(); + QScrollBar *hbar = horizontalScrollBar(); + + if ((vbar->value() == vbar->minimum() && totalOffset.height() > 10) || + (vbar->value() == vbar->maximum() && totalOffset.height() < -10)) { + outside = true; + return; + } + if ((hbar->value() == hbar->minimum() && totalOffset.width() > 10) || + (hbar->value() == hbar->maximum() && totalOffset.width() < -10)) { + outside = true; + return; + } + vbar->setValue(vbar->value() - offset.height()); + hbar->setValue(hbar->value() - offset.width()); + event->accept(pan); + } + } + +private: + bool outside; +}; + +class Slider : public QSlider +{ +public: + Slider(Qt::Orientation orientation, QWidget *parent = 0) + : QSlider(orientation, parent) + { + grabGesture(Qt::PanGesture); + } +protected: + bool event(QEvent *event) + { + if (event->type() == QEvent::Gesture) { + gestureEvent(static_cast(event)); + return true; + } + return QSlider::event(event); + } + void gestureEvent(QGestureEvent *event) + { + QPanGesture *pan = static_cast(event->gesture(Qt::PanGesture)); + if (pan) { + switch (pan->state()) { + case Qt::GestureStarted: qDebug("slider: Pan: started"); break; + case Qt::GestureFinished: qDebug("slider: Pan: finished"); break; + case Qt::GestureCanceled: qDebug("slider: Pan: canceled"); break; + case Qt::GestureUpdated: break; + default: qDebug("slider: Pan: "); break; + } + + if (pan->state() == Qt::GestureStarted) + outside = false; + event->ignore(); + event->ignore(pan); + if (outside) + return; + const QSizeF offset = pan->offset(); + const QSizeF totalOffset = pan->totalOffset(); + if (orientation() == Qt::Horizontal) { + if ((value() == minimum() && totalOffset.width() < -10) || + (value() == maximum() && totalOffset.width() > 10)) { + outside = true; + return; + } + if (totalOffset.height() < 40 && totalOffset.height() > -40) { + setValue(value() + offset.width()); + event->accept(pan); + } else { + outside = true; + } + } else if (orientation() == Qt::Vertical) { + if ((value() == maximum() && totalOffset.height() < -10) || + (value() == minimum() && totalOffset.height() > 10)) { + outside = true; + return; + } + if (totalOffset.width() < 40 && totalOffset.width() > -40) { + setValue(value() - offset.height()); + event->accept(pan); + } else { + outside = true; + } + } + } + } +private: + bool outside; +}; + +class MainWindow : public QMainWindow +{ +public: + MainWindow() + { + rootScrollArea = new ScrollArea; + setCentralWidget(rootScrollArea); + + QWidget *root = new QWidget; + root->setFixedSize(3000, 3000); + rootScrollArea->setWidget(root); + + Slider *verticalSlider = new Slider(Qt::Vertical, root); + verticalSlider ->move(650, 1100); + Slider *horizontalSlider = new Slider(Qt::Horizontal, root); + horizontalSlider ->move(600, 1000); + + childScrollArea = new ScrollArea(root); + childScrollArea->move(500, 500); + QWidget *w = new QWidget; + w->setMinimumWidth(400); + QVBoxLayout *l = new QVBoxLayout(w); + l->setMargin(20); + for (int i = 0; i < 100; ++i) { + QWidget *w = new QWidget; + QHBoxLayout *ll = new QHBoxLayout(w); + ll->addWidget(new QLabel(QString("Label %1").arg(i))); + ll->addWidget(new QPushButton(QString("Button %1").arg(i))); + l->addWidget(w); + } + childScrollArea->setWidget(w); + } +private: + ScrollArea *rootScrollArea; + ScrollArea *childScrollArea; +}; + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + app.registerGestureRecognizer(new MousePanGestureRecognizer); + MainWindow w; + w.show(); + return app.exec(); +} + +#include "main.moc" diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp new file mode 100644 index 0000000..6e2171c --- /dev/null +++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mousepangesturerecognizer.h" + +#include +#include +#include + +MousePanGestureRecognizer::MousePanGestureRecognizer() +{ +} + +QGesture* MousePanGestureRecognizer::createGesture(QObject *) const +{ + return new QPanGesture; +} + +QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +{ + QPanGesture *g = static_cast(state); + QMouseEvent *me = static_cast(event); + if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick) { + g->setHotSpot(me->globalPos()); + g->setProperty("lastPos", me->globalPos()); + g->setProperty("pressed", QVariant::fromValue(true)); + return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + } else if (event->type() == QEvent::MouseMove) { + if (g->property("pressed").toBool()) { + QPoint pos = me->globalPos(); + QPoint lastPos = g->property("lastPos").toPoint(); + g->setLastOffset(g->offset()); + lastPos = pos - lastPos; + g->setOffset(QSizeF(lastPos.x(), lastPos.y())); + g->setTotalOffset(g->totalOffset() + QSizeF(lastPos.x(), lastPos.y())); + g->setProperty("lastPos", pos); + return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + } + return QGestureRecognizer::NotGesture; + } else if (event->type() == QEvent::MouseButtonRelease) { + return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint; + } + return QGestureRecognizer::Ignore; +} + +void MousePanGestureRecognizer::reset(QGesture *state) +{ + QPanGesture *g = static_cast(state); + g->setTotalOffset(QSizeF()); + g->setLastOffset(QSizeF()); + g->setOffset(QSizeF()); + g->setAcceleration(0); + g->setProperty("lastPos", QVariant()); + g->setProperty("pressed", QVariant::fromValue(false)); + QGestureRecognizer::reset(state); +} diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h new file mode 100644 index 0000000..f6df289 --- /dev/null +++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOUSEPANGESTURERECOGNIZER_H +#define MOUSEPANGESTURERECOGNIZER_H + +#include + +class MousePanGestureRecognizer : public QGestureRecognizer +{ +public: + MousePanGestureRecognizer(); + + QGesture* createGesture(QObject *target) const; + QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + void reset(QGesture *state); +}; + +#endif // MOUSEPANGESTURERECOGNIZER_H diff --git a/tests/manual/gestures/scrollarea/scrollarea.pro b/tests/manual/gestures/scrollarea/scrollarea.pro new file mode 100644 index 0000000..554810e --- /dev/null +++ b/tests/manual/gestures/scrollarea/scrollarea.pro @@ -0,0 +1,3 @@ +SOURCES = main.cpp \ + mousepangesturerecognizer.cpp +HEADERS += mousepangesturerecognizer.h diff --git a/tests/manual/gestures/twopanwidgets/main.cpp b/tests/manual/gestures/twopanwidgets/main.cpp deleted file mode 100644 index 20a35fc..0000000 --- a/tests/manual/gestures/twopanwidgets/main.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -static const char text[] = - "Hello world! This is just a lot of text with to make sure scrollbar appear"; - -class TextEdit : public QTextEdit -{ - Q_OBJECT -public Q_SLOTS: - void acceptTouch() - { - viewport()->setAttribute(Qt::WA_AcceptTouchEvents); - if (QWidget *w = qobject_cast(sender())) - w->setEnabled(false); - } -}; - -class PlainTextEdit : public QPlainTextEdit -{ - Q_OBJECT -public Q_SLOTS: - void acceptTouch() - { - viewport()->setAttribute(Qt::WA_AcceptTouchEvents); - if (QWidget *w = qobject_cast(sender())) - w->setEnabled(false); - } -}; - -class MainWindow : public QMainWindow -{ -public: - MainWindow(); -}; - -MainWindow::MainWindow() -{ - QTabWidget *tw = new QTabWidget; - setCentralWidget(tw); - { - QWidget *tab = new QWidget; - QGridLayout *layout = new QGridLayout(tab); - QTextEdit *edit1 = new TextEdit; - QTextEdit *edit2 = new TextEdit; - QString text1 = QString(text).replace(' ', '\n'); - for (int i = 0; i < 5; ++i) text1 += text1; - QString text2 = QString(text); - for (int i = 0; i < 5; ++i) text2 += text2; - edit1->setPlainText(text1); - edit2->setPlainText(text2); - edit2->setWordWrapMode(QTextOption::NoWrap); - QPushButton *btn1 = new QPushButton(QLatin1String("AcceptTouchEvents")); - connect(btn1, SIGNAL(clicked()), edit1, SLOT(acceptTouch())); - QPushButton *btn2 = new QPushButton(QLatin1String("AcceptTouchEvents")); - connect(btn2, SIGNAL(clicked()), edit2, SLOT(acceptTouch())); - layout->addWidget(btn1, 0, 0); - layout->addWidget(btn2, 0, 1); - layout->addWidget(edit1, 1, 0); - layout->addWidget(edit2, 1, 1); - tw->addTab(tab, QLatin1String("QTextEdit")); - } - { - QWidget *tab = new QWidget; - QGridLayout *layout = new QGridLayout(tab); - QPlainTextEdit *edit1 = new PlainTextEdit; - QPlainTextEdit *edit2 = new PlainTextEdit; - QString text1 = QString(text).replace(' ', '\n'); - for (int i = 0; i < 5; ++i) text1 += text1; - QString text2 = QString(text); - for (int i = 0; i < 5; ++i) text2 += text2; - edit1->setPlainText(text1); - edit2->setPlainText(text2); - edit2->setWordWrapMode(QTextOption::NoWrap); - QPushButton *btn1 = new QPushButton(QLatin1String("AcceptTouchEvents")); - connect(btn1, SIGNAL(clicked()), edit1, SLOT(acceptTouch())); - QPushButton *btn2 = new QPushButton(QLatin1String("AcceptTouchEvents")); - connect(btn2, SIGNAL(clicked()), edit2, SLOT(acceptTouch())); - layout->addWidget(btn1, 0, 0); - layout->addWidget(btn2, 0, 1); - layout->addWidget(edit1, 1, 0); - layout->addWidget(edit2, 1, 1); - tw->addTab(tab, QLatin1String("QPlainTextEdit")); - } -} - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - MainWindow window; - window.show(); - return app.exec(); -} - -#include "main.moc" diff --git a/tests/manual/gestures/twopanwidgets/twopanwidgets.pro b/tests/manual/gestures/twopanwidgets/twopanwidgets.pro deleted file mode 100644 index 5254077..0000000 --- a/tests/manual/gestures/twopanwidgets/twopanwidgets.pro +++ /dev/null @@ -1 +0,0 @@ -SOURCES = main.cpp \ No newline at end of file -- cgit v0.12 From 1fb2cc6241d715a641dd6bee48eb9bcafaf558b1 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Fri, 9 Oct 2009 18:39:40 +0200 Subject: Workaround for softkeys not working in modal dialogs on S60 5.0 Set the softkey container window to be selectable even when pointer is grabbed (via window server setting) Task-number: QT-2203 Reviewed-by: Espen Riskedal (cherry picked from commit 6ce22194f16ce8e2586e3787560de051064d7787) --- src/gui/kernel/qsoftkeymanager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 265f971..88cc7ae 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -201,6 +201,7 @@ bool QSoftKeyManager::event(QEvent *e) void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList &softkeys) { CEikButtonGroupContainer* nativeContainer = S60->buttonGroupContainer(); + nativeContainer->DrawableWindow()->SetPointerCapturePriority(1); //keep softkeys available in modal dialog QT_TRAP_THROWING(nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS)); int position = -1; -- cgit v0.12 From 0d231c32cc7670d356d486b13648cb5bd471ffef Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Mon, 12 Oct 2009 13:44:14 +0200 Subject: Fix a crash in cocoa when a QMessageBox is destroyed from dropEvent() The gobal variable which stores the current mouse event can be updated before dragImage() call(blocking) is finished. So make a local copy of the information required by the QDragManager::drag(). Task-number: QTBUG-4814 Reviewed-by: MortenS --- src/gui/kernel/qcocoaview_mac.mm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 9eca29d..286eb31 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1277,29 +1277,29 @@ Qt::DropAction QDragManager::drag(QDrag *o) // convert the image to NSImage. NSImage *image = (NSImage *)qt_mac_create_nsimage(pix); [image retain]; - DnDParams *dndParams = [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]; + DnDParams dndParams = *[QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]; // save supported actions - [dndParams->view setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)]; - NSPoint imageLoc = {dndParams->localPoint.x - hotspot.x(), - dndParams->localPoint.y + pix.height() - hotspot.y()}; + [dndParams.view setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)]; + NSPoint imageLoc = {dndParams.localPoint.x - hotspot.x(), + dndParams.localPoint.y + pix.height() - hotspot.y()}; NSSize mouseOffset = {0.0, 0.0}; NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; - NSPoint windowPoint = [dndParams->theEvent locationInWindow]; + NSPoint windowPoint = [dndParams.theEvent locationInWindow]; dragPrivate()->executed_action = Qt::ActionMask; // do the drag - [dndParams->view retain]; - [dndParams->view dragImage:image + [dndParams.view retain]; + [dndParams.view dragImage:image at:imageLoc offset:mouseOffset - event:dndParams->theEvent + event:dndParams.theEvent pasteboard:pboard - source:dndParams->view + source:dndParams.view slideBack:YES]; - [dndParams->view release]; + [dndParams.view release]; [image release]; dragPrivate()->executed_action = Qt::IgnoreAction; object = 0; - Qt::DropAction performedAction(qt_mac_mapNSDragOperation(dndParams->performedAction)); + Qt::DropAction performedAction(qt_mac_mapNSDragOperation(dndParams.performedAction)); // do post drag processing, if required. if(performedAction != Qt::IgnoreAction) { // check if the receiver points us to a file location. -- cgit v0.12 From 7b61fbf03e170a7da37d5f57ed4053aae719ec7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 9 Oct 2009 12:33:03 +0200 Subject: Fixed bug on X11 with WA_TranslucentBackground and native child widgets. The native child widgets need to inherit the parent's visual in order to have a translucent background as well. Reviewed-by: Trond --- src/gui/kernel/qwidget_x11.cpp | 71 +++++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 25 deletions(-) diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 283dfb2..663178f 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -518,14 +518,18 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO if (!window) initializeWindow = true; + QX11Info *parentXinfo = parentWidget ? &parentWidget->d_func()->xinfo : 0; + if (desktop && qt_x11_create_desktop_on_screen >= 0 && qt_x11_create_desktop_on_screen != xinfo.screen()) { // desktop on a certain screen other than the default requested QX11InfoData *xd = &X11->screens[qt_x11_create_desktop_on_screen]; xinfo.setX11Data(xd); - } else if (parentWidget && parentWidget->d_func()->xinfo.screen() != xinfo.screen()) { - xinfo = parentWidget->d_func()->xinfo; + } else if (parentXinfo && (parentXinfo->screen() != xinfo.screen() + || parentXinfo->visual() != xinfo.visual())) + { + xinfo = *parentXinfo; } //get display, screen number, root window and desktop geometry for @@ -920,6 +924,43 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO #endif } +static void qt_x11_recreateWidget(QWidget *widget) +{ + if (widget->inherits("QGLWidget")) { + // We send QGLWidgets a ParentChange event which causes them to + // recreate their GL context, which in turn causes them to choose + // their visual again. Now that WA_TranslucentBackground is set, + // QGLContext::chooseVisual will select an ARGB visual. + QEvent e(QEvent::ParentChange); + QApplication::sendEvent(widget, &e); + } else { + // For regular widgets, reparent them with their parent which + // also triggers a recreation of the native window + QPoint pos = widget->pos(); + bool visible = widget->isVisible(); + if (visible) + widget->hide(); + + widget->setParent(widget->parentWidget(), widget->windowFlags()); + widget->move(pos); + if (visible) + widget->show(); + } +} + +static void qt_x11_recreateNativeWidgetsRecursive(QWidget *widget) +{ + if (widget->testAttribute(Qt::WA_NativeWindow)) + qt_x11_recreateWidget(widget); + + const QObjectList &children = widget->children(); + for (int i = 0; i < children.size(); ++i) { + QWidget *child = qobject_cast(children.at(i)); + if (child) + qt_x11_recreateNativeWidgetsRecursive(child); + } +} + void QWidgetPrivate::x11UpdateIsOpaque() { #ifndef QT_NO_XRENDER @@ -930,29 +971,9 @@ void QWidgetPrivate::x11UpdateIsOpaque() bool topLevel = (data.window_flags & Qt::Window); int screen = xinfo.screen(); if (topLevel && X11->use_xrender - && X11->argbVisuals[screen] && xinfo.depth() != 32) { - - if (q->inherits("QGLWidget")) { - // We send QGLWidgets a ParentChange event which causes them to - // recreate their GL context, which in turn causes them to choose - // their visual again. Now that WA_TranslucentBackground is set, - // QGLContext::chooseVisual will select an ARGB visual. - QEvent e(QEvent::ParentChange); - QApplication::sendEvent(q, &e); - } - else { - // For regular widgets, reparent them with their parent which - // also triggers a recreation of the native window - QPoint pos = q->pos(); - bool visible = q->isVisible(); - if (visible) - q->hide(); - - q->setParent(q->parentWidget(), q->windowFlags()); - q->move(pos); - if (visible) - q->show(); - } + && X11->argbVisuals[screen] && xinfo.depth() != 32) + { + qt_x11_recreateNativeWidgetsRecursive(q); } #endif } -- cgit v0.12 From 96bf551ec168e9b0d1a7c0892c4f809149c6ec51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 9 Oct 2009 15:04:05 +0200 Subject: Fixed documentation of QPixmap::x11Info() to not talk about widgets. Reviewed-by: Trond --- src/gui/image/qpixmap.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 8133cc0..5c8a1f9 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1673,10 +1673,10 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) identifies the contents of the QPixmap object. The x11Info() function returns information about the configuration - of the X display used to display the widget. The - x11PictureHandle() function returns the X11 Picture handle of the - pixmap for XRender support. Note that the two latter functions are - only available on x11. + of the X display used by the screen to which the pixmap currently + belongs. The x11PictureHandle() function returns the X11 Picture + handle of the pixmap for XRender support. Note that the two latter + functions are only available on x11. \endtable @@ -2094,7 +2094,7 @@ QPixmapData* QPixmap::pixmapData() const /*! \fn const QX11Info &QPixmap::x11Info() const \bold{X11 only:} Returns information about the configuration of - the X display used to display the widget. + the X display used by the screen to which the pixmap currently belongs. \warning This function is only available on X11. -- cgit v0.12 From e5954bba5bb1f88a847570d4790d0cef64f92209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 12 Oct 2009 15:48:50 +0200 Subject: Fixed bug when using QGLWidgets in -graphicssystem opengl We need to make sure that the FBO is bound in a valid context. Reviewed-by: Tom --- src/opengl/qglframebufferobject.cpp | 17 +++++++++++++++++ src/opengl/qglframebufferobject_p.h | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 5585208..9674cfb 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -331,8 +331,22 @@ void QGLFBOGLPaintDevice::setFBO(QGLFramebufferObject* f, } } +QGLContext *QGLFBOGLPaintDevice::context() const +{ + QGLContext *fboContext = const_cast(fbo->d_ptr->fbo_guard.context()); + QGLContext *currentContext = const_cast(QGLContext::currentContext()); + + if (QGLContextPrivate::contextGroup(fboContext) == QGLContextPrivate::contextGroup(currentContext)) + return currentContext; + else + return fboContext; +} + void QGLFBOGLPaintDevice::ensureActiveTarget() { + if (QGLContext::currentContext() != context()) + context()->makeCurrent(); + QGLContext* ctx = const_cast(QGLContext::currentContext()); Q_ASSERT(ctx); const GLuint fboId = fbo->d_func()->fbo(); @@ -344,6 +358,9 @@ void QGLFBOGLPaintDevice::ensureActiveTarget() void QGLFBOGLPaintDevice::beginPaint() { + if (QGLContext::currentContext() != context()) + context()->makeCurrent(); + // We let QFBO track the previously bound FBO rather than doing it // ourselves here. This has the advantage that begin/release & bind/end // work as expected. diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index 055a752..43d4a41 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -109,7 +109,7 @@ class QGLFBOGLPaintDevice : public QGLPaintDevice public: virtual QPaintEngine* paintEngine() const {return fbo->paintEngine();} virtual QSize size() const {return fbo->size();} - virtual QGLContext* context() const {return const_cast(QGLContext::currentContext());} + virtual QGLContext* context() const; virtual QGLFormat format() const {return fboFormat;} virtual void ensureActiveTarget(); virtual void beginPaint(); -- cgit v0.12 From 33ed3d0bacddce214a43be60eb6481903e753a88 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 13 Oct 2009 10:18:59 +0200 Subject: Work around broken ATI X1600 drivers on Mac OS X The GLSL implementation messes up return values from functions so that all our srcPixel()'s become black and several matrices are off. We don't want to rewrite the shader code to fit an "ancient" graphics card, so we simply fall back to the GL 1 engine. Reviewed-by: Trond --- src/opengl/qgl.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 3f96d1c..8aef8b4 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -150,7 +150,25 @@ QGLSignalProxy *QGLSignalProxy::instance() class QGLEngineSelector { public: - QGLEngineSelector() : engineType(QPaintEngine::MaxUser) { } + QGLEngineSelector() : engineType(QPaintEngine::MaxUser) + { +#ifdef Q_WS_MAC + // The ATI X1600 driver for Mac OS X does not support return + // values from functions in GLSL. Since working around this in + // the GL2 engine would require a big, ugly rewrite, we're + // falling back to the GL 1 engine.. + QGLWidget *tmp = 0; + if (!QGLContext::currentContext()) { + tmp = new QGLWidget(); + tmp->makeCurrent(); + } + if (strstr((char *) glGetString(GL_RENDERER), "X1600")) + setPreferredPaintEngine(QPaintEngine::OpenGL); + if (tmp) + delete tmp; +#endif + + } void setPreferredPaintEngine(QPaintEngine::Type type) { if (type == QPaintEngine::OpenGL || type == QPaintEngine::OpenGL2) -- cgit v0.12 From 0baa15e68c7b2e009c1f81f81148939725c216c8 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 13 Oct 2009 10:08:27 +0200 Subject: Fix regression while updating items in itemview. geometry() is in parent coordinate. We want the coordinate in viewport coordinate. There is an offset (the header geometry) between the two. So the first item was not refreshed. (Regression because of e5b32fbe0efc8 and a54c18e27bbb) Reviewed-by: Gabriel Reviewed-by: Alexis Task-number: QTBUG-4849 --- src/gui/itemviews/qabstractitemview.cpp | 2 +- tests/auto/qtreewidget/tst_qtreewidget.cpp | 39 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 6722e3a..a8c7f8b 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2913,7 +2913,7 @@ void QAbstractItemView::update(const QModelIndex &index) //this test is important for peformance reason //For example in dataChanged we simply update all the cells without checking //it can be a major bottleneck to update rects that aren't even part of the viewport - if (d->viewport->geometry().intersects(rect)) + if (d->viewport->rect().intersects(rect)) d->viewport->update(rect); } } diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index d4fd1e3..3fcbdd6 100644 --- a/tests/auto/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp @@ -49,6 +49,9 @@ #include #include #include +#include + +#include "../../shared/util.h" //TESTED_CLASS= @@ -160,6 +163,7 @@ private slots: void task217309(); void setCurrentItemExpandsParent(); void task239150_editorWidth(); + void setTextUpdate(); public slots: void itemSelectionChanged(); @@ -3023,6 +3027,41 @@ void tst_QTreeWidget::task239150_editorWidth() +void tst_QTreeWidget::setTextUpdate() +{ + QTreeWidget treeWidget; + treeWidget.setColumnCount(2); + + class MyItemDelegate : public QStyledItemDelegate + { + public: + MyItemDelegate() : numPaints(0) { } + void paint(QPainter *painter, + const QStyleOptionViewItem &option, const QModelIndex &index) const + { + numPaints++; + QStyledItemDelegate::paint(painter, option, index); + } + + mutable int numPaints; + } delegate; + + treeWidget.setItemDelegate(&delegate); + treeWidget.show(); + QStringList strList; + strList << "variable1" << "0"; + QTreeWidgetItem *item = new QTreeWidgetItem(strList); + treeWidget.insertTopLevelItem(0, item); + QTest::qWait(50); + QTRY_VERIFY(delegate.numPaints > 0); + delegate.numPaints = 0; + + item->setText(1, "42"); + QApplication::processEvents(); + QTRY_VERIFY(delegate.numPaints > 0); +} + + QTEST_MAIN(tst_QTreeWidget) #include "tst_qtreewidget.moc" -- cgit v0.12 From c4bb0bd645e25bb68e9ac29f0dcc53566b148be9 Mon Sep 17 00:00:00 2001 From: gunnar Date: Fri, 9 Oct 2009 19:39:17 +0200 Subject: Make QStrokerOps, QStroker and QDashStroker properly modular --- src/gui/painting/qstroker.cpp | 39 ++++++++++++++++++++++++++++++++------- src/gui/painting/qstroker_p.h | 7 ++++++- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp index 9063945..c57b3c1 100644 --- a/src/gui/painting/qstroker.cpp +++ b/src/gui/painting/qstroker.cpp @@ -969,13 +969,31 @@ QPointF qt_curves_for_arc(const QRectF &rect, qreal startAngle, qreal sweepLengt } +static inline void qdashstroker_moveTo(qfixed x, qfixed y, void *data) { + ((QStroker *) data)->moveTo(x, y); +} + +static inline void qdashstroker_lineTo(qfixed x, qfixed y, void *data) { + ((QStroker *) data)->lineTo(x, y); +} + +static inline void qdashstroker_cubicTo(qfixed, qfixed, qfixed, qfixed, qfixed, qfixed, void *) { + Q_ASSERT(0); +// ((QStroker *) data)->cubicTo(c1x, c1y, c2x, c2y, ex, ey); +} + + /******************************************************************************* * QDashStroker members */ QDashStroker::QDashStroker(QStroker *stroker) - : m_stroker(stroker), m_dashOffset(0) + : m_stroker(stroker), m_dashOffset(0), m_stroke_width(1), m_miter_limit(1) { - + if (m_stroker) { + setMoveToHook(qdashstroker_moveTo); + setLineToHook(qdashstroker_lineTo); + setCubicToHook(qdashstroker_cubicTo); + } } QVector QDashStroker::patternForStyle(Qt::PenStyle style) @@ -1012,10 +1030,16 @@ void QDashStroker::processCurrentSubpath() int dashCount = qMin(m_dashPattern.size(), 32); qfixed dashes[32]; + if (m_stroker) { + m_customData = m_stroker; + m_stroke_width = m_stroker->strokeWidth(); + m_miter_limit = m_stroker->miterLimit(); + } + qreal longestLength = 0; qreal sumLength = 0; for (int i=0; istrokeWidth(); + dashes[i] = qMax(m_dashPattern.at(i), qreal(0)) * m_stroke_width; sumLength += dashes[i]; if (dashes[i] > longestLength) longestLength = dashes[i]; @@ -1031,7 +1055,7 @@ void QDashStroker::processCurrentSubpath() int idash = 0; // Index to current dash qreal pos = 0; // The position on the curve, 0 <= pos <= path.length qreal elen = 0; // element length - qreal doffset = m_dashOffset * m_stroker->strokeWidth(); + qreal doffset = m_dashOffset * m_stroke_width; // make sure doffset is in range [0..sumLength) doffset -= qFloor(doffset / sumLength) * sumLength; @@ -1056,7 +1080,7 @@ void QDashStroker::processCurrentSubpath() qfixed2d line_to_pos; // Pad to avoid clipping the borders of thick pens. - qfixed padding = qt_real_to_fixed(qMax(m_stroker->strokeWidth(), m_stroker->miterLimit()) * longestLength); + qfixed padding = qt_real_to_fixed(qMax(m_stroke_width, m_miter_limit) * longestLength); qfixed2d clip_tl = { qt_real_to_fixed(m_clip_rect.left()) - padding, qt_real_to_fixed(m_clip_rect.top()) - padding }; qfixed2d clip_br = { qt_real_to_fixed(m_clip_rect.right()) + padding , @@ -1108,7 +1132,7 @@ void QDashStroker::processCurrentSubpath() // continue the current dash, without starting a // new subpath. if (!has_offset || !hasMoveTo) { - m_stroker->moveTo(move_to_pos.x, move_to_pos.y); + emitMoveTo(move_to_pos.x, move_to_pos.y); hasMoveTo = true; } @@ -1120,7 +1144,7 @@ void QDashStroker::processCurrentSubpath() || (line_to_pos.x > clip_tl.x && line_to_pos.x < clip_br.x && line_to_pos.y > clip_tl.y && line_to_pos.y < clip_br.y)) { - m_stroker->lineTo(line_to_pos.x, line_to_pos.y); + emitLineTo(line_to_pos.x, line_to_pos.y); } } else { move_to_pos.x = qt_real_to_fixed(p2.x()); @@ -1134,6 +1158,7 @@ void QDashStroker::processCurrentSubpath() estart = estop; prev = e; } + } QT_END_NAMESPACE diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h index d33eeb4..b78288c 100644 --- a/src/gui/painting/qstroker_p.h +++ b/src/gui/painting/qstroker_p.h @@ -171,7 +171,6 @@ protected: QRectF m_clip_rect; -private: void *m_customData; qStrokerMoveToHook m_moveTo; qStrokerLineToHook m_lineTo; @@ -258,12 +257,18 @@ public: virtual void begin(void *data); virtual void end(); + inline void setStrokeWidth(qreal width) { m_stroke_width = width; } + inline void setMiterLimit(qreal limit) { m_miter_limit = limit; } + protected: virtual void processCurrentSubpath(); QStroker *m_stroker; QVector m_dashPattern; qreal m_dashOffset; + + qreal m_stroke_width; + qreal m_miter_limit; }; -- cgit v0.12 From 3ca0529f18849e44de01dac620905ecdb28c3ce8 Mon Sep 17 00:00:00 2001 From: gunnar Date: Fri, 9 Oct 2009 19:39:17 +0200 Subject: Make QStrokerOps, QStroker and QDashStroker properly modular --- src/gui/painting/qstroker_p.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h index b78288c..a10ebd9 100644 --- a/src/gui/painting/qstroker_p.h +++ b/src/gui/painting/qstroker_p.h @@ -366,16 +366,16 @@ inline void QStroker::emitCubicTo(qfixed c1x, qfixed c1y, */ inline void QDashStroker::begin(void *data) { - Q_ASSERT(m_stroker); - m_stroker->begin(data); + if (m_stroker) + m_stroker->begin(data); QStrokerOps::begin(data); } inline void QDashStroker::end() { - Q_ASSERT(m_stroker); QStrokerOps::end(); - m_stroker->end(); + if (m_stroker) + m_stroker->end(); } QT_END_NAMESPACE -- cgit v0.12 From b7142463c738cc1a0540fe456002fe94e7f5a894 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 13 Oct 2009 14:53:19 +0100 Subject: Modified QSymbianControl::setFocusSafely to set last focused control to zero only if currently focused Reviewed-by: axis --- src/gui/kernel/qapplication_s60.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index acd1041..b1706af 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -948,7 +948,8 @@ void QSymbianControl::setFocusSafely(bool focus) S60->appUi()->RemoveFromStack(this); QT_TRAP_THROWING(S60->appUi()->AddToStackL(this, ECoeStackPriorityDefault, ECoeStackFlagStandard)); - lastFocusedControl = 0; + if(this == lastFocusedControl) + lastFocusedControl = 0; this->SetFocus(false); } } -- cgit v0.12 From 4b73217ceea55cb77eee550e039f8ec7ad566d80 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 13 Oct 2009 14:56:33 +0200 Subject: Fixed bug where bitmaps were painted black instead of in pen colour. penData and the pen painter state were not in sync when drawing bitmaps in the raster paint engine. Adding calls to ensurePen() fixed the bug. Task-number: QTBUG-4210 Reviewed-by: Trond --- src/gui/painting/qpaintengine_raster.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 6037bd5..995f0ac 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2376,6 +2376,7 @@ void QRasterPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pixmap) Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); if (s->matrix.type() <= QTransform::TxTranslate) { + ensurePen(); drawBitmap(pos + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); } else { drawImage(pos, d->rasterBuffer->colorizeBitmap(image, s->pen.color())); @@ -2389,6 +2390,7 @@ void QRasterPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pixmap) Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); if (s->matrix.type() <= QTransform::TxTranslate) { + ensurePen(); drawBitmap(pos + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); } else { drawImage(pos, d->rasterBuffer->colorizeBitmap(image, s->pen.color())); -- cgit v0.12 From 15d44ea32164a1205bef7938da331457054f8df4 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Tue, 13 Oct 2009 15:43:56 +0200 Subject: crash fix on WinCE without gesture support dd9d8693 added some checks causing SetGestureConfig to not be initialized to 0. Thus it gets derefenced and causes crashes on all WinCE applications. Reviewed-by: denis Reviewed-by: ninerider (cherry picked from commit fa4d78a580fb4deb0c2c5de253b3b18a4ad18ab3) --- src/gui/kernel/qapplication_win.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 540f0a2..5bb25fa 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -819,13 +819,16 @@ void qt_init(QApplicationPrivate *priv, int) priv->GetGestureInfo = 0; priv->GetGestureExtraArgs = 0; + priv->CloseGestureInfoHandle = 0; + priv->SetGestureConfig = 0; + priv->GetGestureConfig = 0; + priv->BeginPanningFeedback = 0; + priv->UpdatePanningFeedback = 0; + priv->EndPanningFeedback = 0; #if defined(Q_WS_WINCE_WM) && defined(QT_WINCE_GESTURES) priv->GetGestureInfo = (PtrGetGestureInfo) &TKGetGestureInfo; priv->GetGestureExtraArgs = (PtrGetGestureExtraArgs) &TKGetGestureExtraArguments; - priv->CloseGestureInfoHandle = (PtrCloseGestureInfoHandle) 0; - priv->SetGestureConfig = (PtrSetGestureConfig) 0; - priv->GetGestureConfig = (PtrGetGestureConfig) 0; #elif !defined(Q_WS_WINCE) priv->GetGestureInfo = (PtrGetGestureInfo)QLibrary::resolve(QLatin1String("user32"), -- cgit v0.12 From 27fdeb7be980b2a390e413ce6e93bae12626f185 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 13 Oct 2009 11:34:27 +0200 Subject: Re-applying commit ee0a43fee20cc398b505eb65218ebed56dfc8f39 by Simon Hausmann Fix crash of QtScript on Mac OS X When compiling on 10.4 but running on 10.5 the flags passed to vm_map cause it to crash. For now fall back to the use of mmap() as allocator instead. Reviewed-by: Kent Hansen (cherry picked from commit 6b8ac349b9a477863a8c8388dcc0658f3284bc54) --- src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp index 474d7bf..01e36c4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp @@ -240,7 +240,9 @@ void Heap::destroy() template NEVER_INLINE CollectorBlock* Heap::allocateBlock() { -#if PLATFORM(DARWIN) + // Disable the use of vm_map for the Qt build on Darwin, because when compiled on 10.4 + // it crashes on 10.5 +#if PLATFORM(DARWIN) && !PLATFORM(QT) vm_address_t address = 0; // FIXME: tag the region as a JavaScriptCore heap when we get a registered VM tag: . vm_map(current_task(), &address, BLOCK_SIZE, BLOCK_OFFSET_MASK, VM_FLAGS_ANYWHERE | VM_TAG_FOR_COLLECTOR_MEMORY, MEMORY_OBJECT_NULL, 0, FALSE, VM_PROT_DEFAULT, VM_PROT_DEFAULT, VM_INHERIT_DEFAULT); @@ -332,7 +334,9 @@ NEVER_INLINE void Heap::freeBlock(size_t block) NEVER_INLINE void Heap::freeBlock(CollectorBlock* block) { -#if PLATFORM(DARWIN) + // Disable the use of vm_deallocate for the Qt build on Darwin, because when compiled on 10.4 + // it crashes on 10.5 +#if PLATFORM(DARWIN) && !PLATFORM(QT) vm_deallocate(current_task(), reinterpret_cast(block), BLOCK_SIZE); #elif PLATFORM(SYMBIAN) userChunk->Free(reinterpret_cast(block)); -- cgit v0.12 From c59eff45ef16cae014e71a9a22b88a65bf0f343c Mon Sep 17 00:00:00 2001 From: Jesper Thomschutz Date: Tue, 13 Oct 2009 17:03:50 +0200 Subject: Add known issues wiki to docs. Reviewed-by: Jason McDonald (cherry picked from commit 1ac2f104b7ab97f99a2b249b14bc5129588dbe46) --- doc/src/getting-started/known-issues.qdoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/src/getting-started/known-issues.qdoc b/doc/src/getting-started/known-issues.qdoc index 40ac1c7..0b63423 100644 --- a/doc/src/getting-started/known-issues.qdoc +++ b/doc/src/getting-started/known-issues.qdoc @@ -53,6 +53,10 @@ For a list list of known bugs in Qt %VERSION%, see the \l{Task Tracker} on the Qt website. + An overview of known issues may also be found at: + \l{http://qt.gitorious.org/qt/pages/Qt460BetaKnownIssues} + {Known Issues Wiki}. + \section1 Installation Issues \section2 Building the Source Package on Windows 7 -- cgit v0.12 From ca5b49a2ec0ee9d7030b8d03b561717addd3441f Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 13 Oct 2009 10:18:59 +0200 Subject: Work around broken ATI X1600 drivers on Mac OS X The GLSL implementation messes up return values from functions so that all our srcPixel()'s become black and several matrices are off. We don't want to rewrite the shader code to fit an "ancient" graphics card, so we simply fall back to the GL 1 engine. Reviewed-by: Trond (cherry picked from commit 33ed3d0bacddce214a43be60eb6481903e753a88) (cherry picked from commit bd94c6df873ab196e537f5a49b57c86ccd66ad90) --- src/opengl/qgl.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 3f96d1c..8aef8b4 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -150,7 +150,25 @@ QGLSignalProxy *QGLSignalProxy::instance() class QGLEngineSelector { public: - QGLEngineSelector() : engineType(QPaintEngine::MaxUser) { } + QGLEngineSelector() : engineType(QPaintEngine::MaxUser) + { +#ifdef Q_WS_MAC + // The ATI X1600 driver for Mac OS X does not support return + // values from functions in GLSL. Since working around this in + // the GL2 engine would require a big, ugly rewrite, we're + // falling back to the GL 1 engine.. + QGLWidget *tmp = 0; + if (!QGLContext::currentContext()) { + tmp = new QGLWidget(); + tmp->makeCurrent(); + } + if (strstr((char *) glGetString(GL_RENDERER), "X1600")) + setPreferredPaintEngine(QPaintEngine::OpenGL); + if (tmp) + delete tmp; +#endif + + } void setPreferredPaintEngine(QPaintEngine::Type type) { if (type == QPaintEngine::OpenGL || type == QPaintEngine::OpenGL2) -- cgit v0.12 From 8e709c4a3b8c1b843a662111e23076f8a02b2735 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 13 Oct 2009 16:51:53 +0200 Subject: Fixed handling of brush origin in the OpenGL paint engines. Fixed the OpenGL paint engines so that the brush origin is applied correctly and for all brushes just like in the raster paint engine. Task-number: QTBUG-2676 Reviewed-by: Trond --- src/gui/painting/qpainter.cpp | 3 +-- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 10 +++++----- src/opengl/qpaintengine_opengl.cpp | 15 ++++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index f271af9..155eefe 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2051,8 +2051,7 @@ QPoint QPainter::brushOrigin() const Sets the brush origin to \a position. The brush origin specifies the (0, 0) coordinate of the painter's - brush. This setting only applies to pattern brushes and pixmap - brushes. + brush. Note that while the brushOrigin() was necessary to adopt the parent's background for a widget in Qt 3, this is no longer the diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index ab02c69..d7ce604 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -469,8 +469,6 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() QPointF translationPoint; if (style <= Qt::DiagCrossPattern) { - translationPoint = q->state()->brushOrigin; - QColor col = qt_premultiplyColor(currentBrush->color(), (GLfloat)q->state()->opacity); shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); @@ -528,8 +526,6 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); } else if (style == Qt::TexturePattern) { - translationPoint = q->state()->brushOrigin; - const QPixmap& texPixmap = currentBrush->texture(); if (qHasPixmapTexture(*currentBrush) && currentBrush->texture().isQBitmap()) { @@ -546,9 +542,13 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() else qWarning("QGL2PaintEngineEx: Unimplemented fill style"); + const QPointF &brushOrigin = q->state()->brushOrigin; + QTransform matrix = q->state()->matrix; + matrix.translate(brushOrigin.x(), brushOrigin.y()); + QTransform translate(1, 0, 0, 1, -translationPoint.x(), -translationPoint.y()); QTransform gl_to_qt(1, 0, 0, -1, 0, height); - QTransform inv_matrix = gl_to_qt * (brushQTransform * q->state()->matrix).inverted() * translate; + QTransform inv_matrix = gl_to_qt * (brushQTransform * matrix).inverted() * translate; shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BrushTransform), inv_matrix); shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BrushTexture), QT_BRUSH_TEXTURE_UNIT); diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 3e4a8e7..fc1695d 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -1596,7 +1596,8 @@ void QOpenGLPaintEnginePrivate::updateGradient(const QBrush &brush, const QRectF qreal realRadius = g->radius(); QTransform translate(1, 0, 0, 1, -realFocal.x(), -realFocal.y()); QTransform gl_to_qt(1, 0, 0, -1, 0, pdev->height()); - QTransform inv_matrix = gl_to_qt * matrix.inverted() * brush.transform().inverted() * translate; + QTransform m = QTransform(matrix).translate(brush_origin.x(), brush_origin.y()); + QTransform inv_matrix = gl_to_qt * (brush.transform() * m).inverted() * translate; setInvMatrixData(inv_matrix); @@ -1609,7 +1610,8 @@ void QOpenGLPaintEnginePrivate::updateGradient(const QBrush &brush, const QRectF QPointF realCenter = g->center(); QTransform translate(1, 0, 0, 1, -realCenter.x(), -realCenter.y()); QTransform gl_to_qt(1, 0, 0, -1, 0, pdev->height()); - QTransform inv_matrix = gl_to_qt * matrix.inverted() * brush.transform().inverted() * translate; + QTransform m = QTransform(matrix).translate(brush_origin.x(), brush_origin.y()); + QTransform inv_matrix = gl_to_qt * (brush.transform() * m).inverted() * translate; setInvMatrixData(inv_matrix); @@ -1621,8 +1623,8 @@ void QOpenGLPaintEnginePrivate::updateGradient(const QBrush &brush, const QRectF QPointF realFinal = g->finalStop(); QTransform translate(1, 0, 0, 1, -realStart.x(), -realStart.y()); QTransform gl_to_qt(1, 0, 0, -1, 0, pdev->height()); - - QTransform inv_matrix = gl_to_qt * matrix.inverted() * brush.transform().inverted() * translate; + QTransform m = QTransform(matrix).translate(brush_origin.x(), brush_origin.y()); + QTransform inv_matrix = gl_to_qt * (brush.transform() * m).inverted() * translate; setInvMatrixData(inv_matrix); @@ -1633,10 +1635,9 @@ void QOpenGLPaintEnginePrivate::updateGradient(const QBrush &brush, const QRectF linear_data[2] = 1.0f / (l.x() * l.x() + l.y() * l.y()); } else if (style != Qt::SolidPattern) { - QTransform translate(1, 0, 0, 1, brush_origin.x(), brush_origin.y()); QTransform gl_to_qt(1, 0, 0, -1, 0, pdev->height()); - - QTransform inv_matrix = gl_to_qt * matrix.inverted() * brush.transform().inverted() * translate; + QTransform m = QTransform(matrix).translate(brush_origin.x(), brush_origin.y()); + QTransform inv_matrix = gl_to_qt * (brush.transform() * m).inverted(); setInvMatrixData(inv_matrix); } -- cgit v0.12 From 42a67d48d8772b91f59c4141b278a46d402d4276 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Wed, 14 Oct 2009 10:36:36 +0200 Subject: Fixed upside down brush patterns in the OpenGL paint engines. Task-number: QTBUG-2222 Reviewed-by: Gunnar --- src/opengl/gl2paintengineex/qglengineshadersource_p.h | 1 - src/opengl/util/pattern_brush.glsl | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h index 6712bf6..3eef808 100644 --- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h @@ -131,7 +131,6 @@ static const char* const qglslPositionWithPatternBrushVertexShader = "\ gl_Position.xy = gl_Position.xy * invertedHTexCoordsZ; \ gl_Position.w = invertedHTexCoordsZ; \ patternTexCoords.xy = (hTexCoords.xy * 0.125) * invertedHTexCoordsZ; \ - patternTexCoords.y = -patternTexCoords.y; \ }"; static const char* const qglslAffinePositionWithPatternBrushVertexShader diff --git a/src/opengl/util/pattern_brush.glsl b/src/opengl/util/pattern_brush.glsl index e070449..ac139b2 100644 --- a/src/opengl/util/pattern_brush.glsl +++ b/src/opengl/util/pattern_brush.glsl @@ -17,8 +17,6 @@ vec4 brush() coords *= inv_brush_texture_size; - coords.y = -coords.y; - float alpha = texture2D(brush_texture, coords).r; return gl_Color * alpha; -- cgit v0.12 From 5f7d9f9efe78fa7e537c32177c1b66a76fffddde Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 14 Oct 2009 10:39:17 +0200 Subject: updated fragment programs after changes to .glsl files --- src/opengl/util/fragmentprograms_p.h | 246 +++++++++++++++-------------------- 1 file changed, 105 insertions(+), 141 deletions(-) diff --git a/src/opengl/util/fragmentprograms_p.h b/src/opengl/util/fragmentprograms_p.h index 340023c..f61f275 100644 --- a/src/opengl/util/fragmentprograms_p.h +++ b/src/opengl/util/fragmentprograms_p.h @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #ifndef FRAGMENTPROGRAMS_P_H #define FRAGMENTPROGRAMS_P_H @@ -5929,7 +5930,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.z;\n" "MUL R1.xy, R0.zwzw, c[0];\n" - "MOV R1.y, -R1;\n" "MUL R0.xy, fragment.position, c[7];\n" "TEX R0, R0, texture[0], 2D;\n" "TEX R1.x, R1, texture[2], 2D;\n" @@ -5970,7 +5970,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.z;\n" "MUL R1.xy, R0.zwzw, c[0];\n" - "MOV R1.y, -R1;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" "TEX R1.x, R1, texture[2], 2D;\n" @@ -6004,7 +6003,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "MOV R0.y, -R0;\n" "TEX R1.x, R0, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[5];\n" "ADD R3.xy, fragment.position, c[6];\n" @@ -6035,7 +6033,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "MOV R0.y, -R0;\n" "TEX R1.x, R0, texture[2], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R0.xy, fragment.position, c[5];\n" @@ -6081,9 +6078,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "MOV R0.w, -R0.y;\n" - "MOV R0.z, R0.x;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" "TEX R1.x, R0.zwzw, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" @@ -6119,9 +6114,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "MOV R0.w, -R0.y;\n" - "MOV R0.z, R0.x;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" "TEX R1.x, R0.zwzw, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" @@ -6159,13 +6152,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "MOV R0.y, -R0;\n" "TEX R0.x, R0, texture[2], 2D;\n" "MUL R1, fragment.color.primary, R0.x;\n" "MAX R0.x, R1.w, c[8].y;\n" "RCP R0.x, R0.x;\n" - "MAD R0.xyz, -R1, R0.x, c[8].x;\n" - "MAX R2.xyz, R0, c[8].y;\n" + "MAD R2.xyz, -R1, R0.x, c[8].x;\n" + "MAX R2.xyz, R2, c[8].y;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" "ADD R2.w, -R1, c[8].x;\n" @@ -6209,9 +6201,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "MOV R0.w, -R0.y;\n" - "MOV R0.z, R0.x;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" "TEX R1.x, R0.zwzw, texture[2], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R0.xy, fragment.position, c[5];\n" @@ -6261,7 +6251,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "MOV R0.y, -R0;\n" "TEX R1.x, R0, texture[2], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R0.xy, fragment.position, c[5];\n" @@ -6306,47 +6295,46 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R1.xyz, R0, c[3];\n" - "RCP R0.z, R1.z;\n" - "MUL R1.xy, R1, R0.z;\n" - "MUL R1.xy, R1, c[0];\n" - "MOV R1.y, -R1;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.z, R0.w, c[8].y;\n" - "RCP R2.w, R1.z;\n" - "MUL R2.xyz, R0, R2.w;\n" - "MUL R6.xyz, -R2, c[9].x;\n" - "MAD R3.xyz, -R0, R2.w, c[8].x;\n" - "TEX R1.x, R1, texture[2], 2D;\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MAD R4.xyz, R1, c[8].z, -R1.w;\n" - "MUL R5.xyz, R3, R4;\n" - "MAD R3.xyz, -R3, R4, R1.w;\n" - "ADD R6.xyz, R6, c[8].w;\n" - "MAD R5.xyz, -R5, R6, R1.w;\n" - "RSQ R2.x, R2.x;\n" - "RSQ R2.z, R2.z;\n" - "RSQ R2.y, R2.y;\n" - "MUL R5.xyz, R0, R5;\n" - "MUL R3.xyz, R0, R3;\n" - "ADD R2.w, -R0, c[8].x;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R0.w, R2, -R0;\n" - "MUL R2.xyz, R2, R4;\n" - "MAD R2.xyz, R1.w, R0, R2;\n" - "ADD R6.xyz, R2, -R5;\n" + "MAX R1.x, R0.w, c[8].y;\n" + "RCP R2.w, R1.x;\n" + "MUL R1.xyz, R0, R2.w;\n" + "RSQ R1.w, R1.x;\n" + "RCP R2.x, R1.w;\n" + "RSQ R1.w, R1.y;\n" + "RCP R2.y, R1.w;\n" + "MUL R3.xyz, fragment.position.y, c[2];\n" + "MAD R3.xyz, fragment.position.x, c[1], R3;\n" + "ADD R3.xyz, R3, c[3];\n" + "RCP R2.z, R3.z;\n" + "MUL R3.xy, R3, R2.z;\n" + "MUL R3.xy, R3, c[0];\n" + "RSQ R1.w, R1.z;\n" + "RCP R2.z, R1.w;\n" + "MAD R6.xyz, R0.w, R2, -R0;\n" + "MUL R2.xyz, -R1, c[9].x;\n" + "ADD R5.xyz, R2, c[8].w;\n" + "MAD R2.xyz, -R0, R2.w, c[8].x;\n" + "TEX R3.x, R3, texture[2], 2D;\n" + "MUL R1, fragment.color.primary, R3.x;\n" + "MAD R3.xyz, R1, c[8].z, -R1.w;\n" + "MUL R4.xyz, R2, R3;\n" + "MAD R4.xyz, -R4, R5, R1.w;\n" + "MAD R2.xyz, -R2, R3, R1.w;\n" + "MUL R5.xyz, R6, R3;\n" + "MUL R4.xyz, R0, R4;\n" + "MAD R5.xyz, R1.w, R0, R5;\n" + "ADD R6.xyz, R5, -R4;\n" + "MUL R5.xyz, R0, c[9].x;\n" + "SGE R3.xyz, R5, R0.w;\n" + "MAD R3.xyz, R3, R6, R4;\n" + "MUL R2.xyz, R0, R2;\n" "MUL R4.xyz, R1, c[8].z;\n" - "MUL R2.xyz, R0, c[9].x;\n" - "SGE R2.xyz, R2, R0.w;\n" - "MAD R2.xyz, R2, R6, R5;\n" "SGE R4.xyz, R4, R1.w;\n" - "ADD R2.xyz, R2, -R3;\n" - "MAD R2.xyz, R4, R2, R3;\n" + "ADD R3.xyz, R3, -R2;\n" + "MAD R2.xyz, R4, R3, R2;\n" + "ADD R2.w, -R0, c[8].x;\n" "MAD R1.xyz, R1, R2.w, R2;\n" "ADD R2.x, -R1.w, c[8];\n" "MAD R2.xyz, R0, R2.x, R1;\n" @@ -6374,9 +6362,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "MOV R0.w, -R0.y;\n" - "MOV R0.z, R0.x;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" "TEX R1.x, R0.zwzw, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" @@ -6410,9 +6396,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "MOV R0.w, -R0.y;\n" - "MOV R0.z, R0.x;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" "TEX R1.x, R0.zwzw, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" @@ -6450,7 +6434,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.z;\n" "MUL R1.xy, R0.zwzw, c[0];\n" - "MOV R1.y, -R1;\n" "MUL R0.xy, fragment.position, c[6];\n" "TEX R0, R0, texture[0], 2D;\n" "MUL R2.xyz, R0, c[4].y;\n" @@ -6485,7 +6468,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.z;\n" "MUL R1.xy, R0.zwzw, c[0];\n" - "MOV R1.y, -R1;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" "TEX R1.x, R1, texture[1], 2D;\n" @@ -6511,9 +6493,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "MOV R0.w, -R0.y;\n" - "MOV R0.z, R0.x;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" "TEX R1.x, R0.zwzw, texture[1], 2D;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" @@ -6537,7 +6517,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "MOV R0.y, -R0;\n" "TEX R1.x, R0, texture[1], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R0.xy, fragment.position, c[4];\n" @@ -6577,9 +6556,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "MOV R0.w, -R0.y;\n" - "MOV R0.z, R0.x;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" "TEX R1.x, R0.zwzw, texture[1], 2D;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" @@ -6609,9 +6586,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "MOV R0.w, -R0.y;\n" - "MOV R0.z, R0.x;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" "TEX R1.x, R0.zwzw, texture[1], 2D;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" @@ -6642,31 +6617,30 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "MOV R0.y, -R0;\n" "TEX R0.x, R0, texture[1], 2D;\n" "MUL R1, fragment.color.primary, R0.x;\n" "MAX R0.x, R1.w, c[5].y;\n" "RCP R0.x, R0.x;\n" - "MAD R0.xyz, -R1, R0.x, c[5].x;\n" - "MAX R2.xyz, R0, c[5].y;\n" + "MAD R3.xyz, -R1, R0.x, c[5].x;\n" + "MAX R3.xyz, R3, c[5].y;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" - "ADD R2.w, -R1, c[5].x;\n" - "MUL R3.xyz, R0, R2.w;\n" + "ADD R2.x, -R1.w, c[5];\n" + "MUL R2.xyz, R0, R2.x;\n" "ADD R2.w, -R0, c[5].x;\n" - "MAD R3.xyz, R1, R2.w, R3;\n" + "MAD R2.xyz, R1, R2.w, R2;\n" "MUL R0.xyz, R1.w, R0;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R0, R2, R3;\n" + "RCP R3.x, R3.x;\n" + "RCP R3.y, R3.y;\n" + "RCP R3.z, R3.z;\n" + "MAD R3.xyz, R0, R3, R2;\n" "MAD R0.xyz, R1, R0.w, R0;\n" - "MAD R3.xyz, R1.w, R0.w, R3;\n" + "MAD R2.xyz, R1.w, R0.w, R2;\n" "MUL R2.w, R1, R0;\n" "ADD R1.x, R1.w, R0.w;\n" - "ADD R3.xyz, R3, -R2;\n" + "ADD R2.xyz, R2, -R3;\n" "SGE R0.xyz, R0, R2.w;\n" - "MAD result.color.xyz, R0, R3, R2;\n" + "MAD result.color.xyz, R0, R2, R3;\n" "MAD result.color.w, -R1, R0, R1.x;\n" "END\n" ; @@ -6686,9 +6660,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "MOV R0.w, -R0.y;\n" - "MOV R0.z, R0.x;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" "TEX R1.x, R0.zwzw, texture[1], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R0.xy, fragment.position, c[4];\n" @@ -6732,7 +6704,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "MOV R0.y, -R0;\n" "TEX R1.x, R0, texture[1], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R0.xy, fragment.position, c[4];\n" @@ -6743,19 +6714,19 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R2.xyz, R2, R3;\n" "MUL R2.xyz, R2, c[5].x;\n" "MAD R2.xyz, R1.w, R0.w, -R2;\n" + "MAD R2.xyz, R1, R2.w, R2;\n" "MUL R4.xyz, R1, R2.w;\n" "MUL R3.xyz, R1, R0;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "ADD R2.w, -R1, c[5].y;\n" "MUL R1.xyz, R1, c[5].x;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" + "ADD R2.w, -R1, c[5].y;\n" "MAD R3.xyz, R3, c[5].x, R4;\n" - "MAD R0.xyz, R0, R2.w, R3;\n" - "ADD R2.w, R1, R0;\n" - "ADD R2.xyz, R2, -R0;\n" + "MAD R3.xyz, R0, R2.w, R3;\n" + "MAD R0.xyz, R0, R2.w, R2;\n" + "ADD R2.x, R1.w, R0.w;\n" + "ADD R0.xyz, R0, -R3;\n" "SGE R1.xyz, R1, R1.w;\n" - "MAD result.color.xyz, R1, R2, R0;\n" - "MAD result.color.w, -R1, R0, R2;\n" + "MAD result.color.xyz, R1, R0, R3;\n" + "MAD result.color.w, -R1, R0, R2.x;\n" "END\n" ; @@ -6771,46 +6742,45 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R1.xyz, R0, c[3];\n" - "RCP R0.z, R1.z;\n" - "MUL R1.xy, R1, R0.z;\n" - "MUL R1.xy, R1, c[0];\n" - "MOV R1.y, -R1;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.z, R0.w, c[5].y;\n" - "RCP R2.w, R1.z;\n" - "MUL R2.xyz, R0, R2.w;\n" - "MUL R6.xyz, -R2, c[6].x;\n" - "MAD R3.xyz, -R0, R2.w, c[5].x;\n" - "TEX R1.x, R1, texture[1], 2D;\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MAD R4.xyz, R1, c[5].z, -R1.w;\n" - "MUL R5.xyz, R3, R4;\n" - "MAD R3.xyz, -R3, R4, R1.w;\n" - "ADD R6.xyz, R6, c[5].w;\n" - "MAD R5.xyz, -R5, R6, R1.w;\n" - "RSQ R2.x, R2.x;\n" - "RSQ R2.z, R2.z;\n" - "RSQ R2.y, R2.y;\n" - "MUL R5.xyz, R0, R5;\n" - "MUL R3.xyz, R0, R3;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R0.w, R2, -R0;\n" - "MUL R2.xyz, R2, R4;\n" - "MAD R2.xyz, R1.w, R0, R2;\n" - "ADD R6.xyz, R2, -R5;\n" + "MAX R1.x, R0.w, c[5].y;\n" + "RCP R2.w, R1.x;\n" + "MUL R1.xyz, R0, R2.w;\n" + "RSQ R1.w, R1.x;\n" + "RCP R2.x, R1.w;\n" + "RSQ R1.w, R1.y;\n" + "RCP R2.y, R1.w;\n" + "MUL R3.xyz, fragment.position.y, c[2];\n" + "MAD R3.xyz, fragment.position.x, c[1], R3;\n" + "ADD R3.xyz, R3, c[3];\n" + "RCP R2.z, R3.z;\n" + "MUL R3.xy, R3, R2.z;\n" + "MUL R3.xy, R3, c[0];\n" + "RSQ R1.w, R1.z;\n" + "RCP R2.z, R1.w;\n" + "MAD R6.xyz, R0.w, R2, -R0;\n" + "MUL R2.xyz, -R1, c[6].x;\n" + "ADD R5.xyz, R2, c[5].w;\n" + "MAD R2.xyz, -R0, R2.w, c[5].x;\n" + "TEX R3.x, R3, texture[1], 2D;\n" + "MUL R1, fragment.color.primary, R3.x;\n" + "MAD R3.xyz, R1, c[5].z, -R1.w;\n" + "MUL R4.xyz, R2, R3;\n" + "MAD R4.xyz, -R4, R5, R1.w;\n" + "MUL R5.xyz, R6, R3;\n" + "MAD R2.xyz, -R2, R3, R1.w;\n" + "MUL R4.xyz, R0, R4;\n" + "MAD R5.xyz, R1.w, R0, R5;\n" + "ADD R6.xyz, R5, -R4;\n" + "MUL R5.xyz, R0, c[6].x;\n" + "SGE R3.xyz, R5, R0.w;\n" + "MAD R3.xyz, R3, R6, R4;\n" + "MUL R2.xyz, R0, R2;\n" "MUL R4.xyz, R1, c[5].z;\n" - "MUL R2.xyz, R0, c[6].x;\n" - "SGE R2.xyz, R2, R0.w;\n" - "MAD R2.xyz, R2, R6, R5;\n" - "ADD R2.xyz, R2, -R3;\n" + "ADD R3.xyz, R3, -R2;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R2.xyz, R4, R2, R3;\n" + "MAD R2.xyz, R4, R3, R2;\n" "ADD R2.w, -R0, c[5].x;\n" "MAD R1.xyz, R1, R2.w, R2;\n" "ADD R2.x, R1.w, R0.w;\n" @@ -6833,9 +6803,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "MOV R0.w, -R0.y;\n" - "MOV R0.z, R0.x;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" "TEX R1.x, R0.zwzw, texture[1], 2D;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" @@ -6863,9 +6831,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "MOV R0.w, -R0.y;\n" - "MOV R0.z, R0.x;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" "TEX R1.x, R0.zwzw, texture[1], 2D;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" @@ -6894,7 +6860,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R1.z;\n" "MUL R0.zw, R1.xyxy, R0.z;\n" "MUL R1.xy, R0.zwzw, c[0];\n" - "MOV R1.y, -R1;\n" "ADD R0.xy, fragment.position, c[5];\n" "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" @@ -6915,7 +6880,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "MOV R0.y, -R0;\n" "TEX R0.x, R0, texture[0], 2D;\n" "MUL result.color, fragment.color.primary, R0.x;\n" "END\n" -- cgit v0.12 From 252fa3d8fa159791a0762a3e02c1594a34a104af Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 14 Oct 2009 10:39:05 +0200 Subject: QNAM HTTP Code: Backport a fix related to aborting replies Backport af71faf8cb2c9cbf34c408b81ce7ae1ef6c6403e from 4.6 to 4.5. Task-number: 261999 Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkconnection.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index aef1258..d747345 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -954,7 +954,10 @@ void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply) for (int i = 0; i < channelCount; ++i) { if (channels[i].reply == reply) { channels[i].reply = 0; - if (reply->d_func()->connectionCloseEnabled()) + // if HTTP mandates we should close + // or the reply is not finished yet, e.g. it was aborted + // we have to close that connection + if (reply->d_func()->connectionCloseEnabled() || !reply->isFinished()) closeChannel(i); QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); return; -- cgit v0.12 From 73bf8967c604054baaa9f80640f44dc82e5d7220 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Wed, 14 Oct 2009 11:56:11 +0200 Subject: Bump heap and stack size for Phonon plugins. This is required by the Helix plugin. As discussed with Dallas team/Fu Liz. Reviewed-by: Shane Kearns --- mkspecs/features/qt.prf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 2b2a42c..7f7d882 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -163,6 +163,11 @@ for(QTLIB, $$list($$lower($$unique(QT)))) { INCLUDEPATH += $$QMAKE_INCDIR_QT/phonon_compat/phonon INCLUDEPATH += $$QMAKE_INCDIR_QT/phonon_compat INCLUDEPATH += $$QMAKE_INCDIR_QT/phonon/Phonon + + # The Helix backend requires this. Since we can't let a plugin set it, + # we bump the values for all Symbian Phonon plugins. + symbian:isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x040000 0x1600000 + } else:isEqual(QTLIB, webkit):qlib = QtWebKit else:isEqual(QTLIB, multimedia):qlib = QtMultimedia else:message("Unknown QT: $$QTLIB"):qlib = -- cgit v0.12 From 997dbe14d8bd4f370a7c972b594b5bc12e80f027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 13 Oct 2009 14:44:54 +0200 Subject: Fixed wrong use of graphics effects for pixmap graphics items. The blur, drop shadow, and bloom graphics effects are scale dependent, since they have radius and offset (in the case of drop shadow) parameters that are specified in device coordinates. Thus, we can't apply the effect in logical coordinates and scale up, and need to always use the device coordinate path for these effects. The opacity and grayscale effects still use the logical coordinate optimization. Reviewed-by: Gunnar Sletta --- src/gui/effects/qgraphicseffect.cpp | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index ee01fdc..01df46d 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -893,15 +893,8 @@ void QGraphicsBlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source) return; } - QPoint offset; - if (source->isPixmap()) { - // No point in drawing in device coordinates (pixmap will be scaled anyways). - const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); - d->filter->draw(painter, offset, pixmap); - return; - } - // Draw pixmap in device coordinates to avoid pixmap scaling. + QPoint offset; const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); QTransform restoreTransform = painter->worldTransform(); painter->setWorldTransform(QTransform()); @@ -1084,15 +1077,8 @@ void QGraphicsDropShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *s return; } - QPoint offset; - if (source->isPixmap()) { - // No point in drawing in device coordinates (pixmap will be scaled anyways). - const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); - d->filter->draw(painter, offset, pixmap); - return; - } - // Draw pixmap in device coordinates to avoid pixmap scaling. + QPoint offset; const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); QTransform restoreTransform = painter->worldTransform(); painter->setWorldTransform(QTransform()); @@ -1486,10 +1472,8 @@ void QGraphicsBloomEffect::draw(QPainter *painter, QGraphicsEffectSource *source return; } - const Qt::CoordinateSystem system = source->isPixmap() - ? Qt::LogicalCoordinates : Qt::DeviceCoordinates; QPoint offset; - QPixmap pixmap = source->pixmap(system, &offset); + QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); QImage result = pixmap.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied); // Blur. @@ -1514,14 +1498,10 @@ void QGraphicsBloomEffect::draw(QPainter *painter, QGraphicsEffectSource *source compPainter.drawImage(0, 0, overlay); compPainter.end(); - if (system == Qt::DeviceCoordinates) { - QTransform restoreTransform = painter->worldTransform(); - painter->setWorldTransform(QTransform()); - painter->drawImage(offset, result); - painter->setWorldTransform(restoreTransform); - } else { - painter->drawImage(offset, result); - } + QTransform restoreTransform = painter->worldTransform(); + painter->setWorldTransform(QTransform()); + painter->drawImage(offset, result); + painter->setWorldTransform(restoreTransform); } QT_END_NAMESPACE -- cgit v0.12 From d310f7c710ecb331a9689861f0551eabd38e946e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 13 Oct 2009 17:01:54 +0200 Subject: Added QPixmapData::createCompatiblePixmapData() used by QPixmap::copy(). QPixmap::copy() now returns a pixmap with the same pixmap backend. Reviewed-by: Gunnar Sletta --- src/gui/image/qpixmap.cpp | 8 +------- src/gui/image/qpixmap_mac.cpp | 5 +++++ src/gui/image/qpixmap_mac_p.h | 2 ++ src/gui/image/qpixmap_raster.cpp | 5 +++++ src/gui/image/qpixmap_raster_p.h | 2 ++ src/gui/image/qpixmap_x11.cpp | 5 +++++ src/gui/image/qpixmap_x11_p.h | 2 ++ src/gui/image/qpixmapdata.cpp | 13 +++++++++++++ src/gui/image/qpixmapdata_p.h | 4 +++- src/opengl/qpixmapdata_gl.cpp | 5 +++++ src/opengl/qpixmapdata_gl_p.h | 2 ++ src/openvg/qpixmapdata_vg.cpp | 5 +++++ src/openvg/qpixmapdata_vg_p.h | 2 ++ 13 files changed, 52 insertions(+), 8 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 5c8a1f9..c03a364 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -361,13 +361,7 @@ QPixmap QPixmap::copy(const QRect &rect) const const QRect r = rect.isEmpty() ? QRect(0, 0, width(), height()) : rect; - QPixmapData *d; - QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem(); - if (gs) - d = gs->createPixmapData(data->pixelType()); - else - d = QGraphicsSystem::createDefaultPixmapData(data->pixelType()); - + QPixmapData *d = data->createCompatiblePixmapData(); d->copy(data.data(), r); return QPixmap(d); } diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index de532fd..afa6f83 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -166,6 +166,11 @@ QMacPixmapData::QMacPixmapData(PixelType type) { } +QPixmapData *QMacPixmapData::createCompatiblePixmapData() const +{ + return new QMacPixmapData(pixelType()); +} + #define BEST_BYTE_ALIGNMENT 16 #define COMPTUE_BEST_BYTES_PER_ROW(bpr) \ (((bpr) + (BEST_BYTE_ALIGNMENT - 1)) & ~(BEST_BYTE_ALIGNMENT - 1)) diff --git a/src/gui/image/qpixmap_mac_p.h b/src/gui/image/qpixmap_mac_p.h index 528dd1f..a3fb95f 100644 --- a/src/gui/image/qpixmap_mac_p.h +++ b/src/gui/image/qpixmap_mac_p.h @@ -65,6 +65,8 @@ public: QMacPixmapData(PixelType type); ~QMacPixmapData(); + QPixmapData *createCompatiblePixmapData() const; + void resize(int width, int height); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); void copy(const QPixmapData *data, const QRect &rect); diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index ad68b07..3667e5b 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -64,6 +64,11 @@ QRasterPixmapData::~QRasterPixmapData() { } +QPixmapData *QRasterPixmapData::createCompatiblePixmapData() const +{ + return new QRasterPixmapData(pixelType()); +} + void QRasterPixmapData::resize(int width, int height) { QImage::Format format; diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h index da0405e..1553940 100644 --- a/src/gui/image/qpixmap_raster_p.h +++ b/src/gui/image/qpixmap_raster_p.h @@ -68,6 +68,8 @@ public: QRasterPixmapData(PixelType type); ~QRasterPixmapData(); + QPixmapData *createCompatiblePixmapData() const; + void resize(int width, int height); void fromFile(const QString &filename, Qt::ImageConversionFlags flags); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 74543a0..ea9eff9 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -319,6 +319,11 @@ QX11PixmapData::QX11PixmapData(PixelType type) { } +QPixmapData *QX11PixmapData::createCompatiblePixmapData() const +{ + return new QX11PixmapData(pixelType()); +} + void QX11PixmapData::resize(int width, int height) { setSerialNumber(++qt_pixmap_serial); diff --git a/src/gui/image/qpixmap_x11_p.h b/src/gui/image/qpixmap_x11_p.h index e34e690..2d6672d 100644 --- a/src/gui/image/qpixmap_x11_p.h +++ b/src/gui/image/qpixmap_x11_p.h @@ -71,6 +71,8 @@ public: // Qt::ImageConversionFlags flags); ~QX11PixmapData(); + QPixmapData *createCompatiblePixmapData() const; + void resize(int width, int height); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); void copy(const QPixmapData *data, const QRect &rect); diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index 93fc2eb..1ad1f02 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -43,6 +43,8 @@ #include #include #include +#include +#include QT_BEGIN_NAMESPACE @@ -67,6 +69,17 @@ QPixmapData::~QPixmapData() { } +QPixmapData *QPixmapData::createCompatiblePixmapData() const +{ + QPixmapData *d; + QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); + if (gs) + d = gs->createPixmapData(pixelType()); + else + d = QGraphicsSystem::createDefaultPixmapData(pixelType()); + return d; +} + static QImage makeBitmapCompliantIfNeeded(QPixmapData *d, const QImage &image, Qt::ImageConversionFlags flags) { if (d->pixelType() == QPixmapData::BitmapType) { diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index c26fba3..2f4f201 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -75,9 +75,11 @@ public: enum ClassId { RasterClass, X11Class, MacClass, DirectFBClass, OpenGLClass, OpenVGClass, CustomClass = 1024 }; - QPixmapData(PixelType pixelpType, int classId); + QPixmapData(PixelType pixelType, int classId); virtual ~QPixmapData(); + virtual QPixmapData *createCompatiblePixmapData() const; + virtual void resize(int width, int height) = 0; virtual void fromImage(const QImage &image, Qt::ImageConversionFlags flags) = 0; diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index cbb310b..3a657f1 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -240,6 +240,11 @@ QGLPixmapData::~QGLPixmapData() } } +QPixmapData *QGLPixmapData::createCompatiblePixmapData() const +{ + return new QGLPixmapData(pixelType()); +} + bool QGLPixmapData::isValid() const { return w > 0 && h > 0; diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h index f67a7c2..6190d38 100644 --- a/src/opengl/qpixmapdata_gl_p.h +++ b/src/opengl/qpixmapdata_gl_p.h @@ -101,6 +101,8 @@ public: QGLPixmapData(PixelType type); ~QGLPixmapData(); + QPixmapData *createCompatiblePixmapData() const; + // Re-implemented from QPixmapData: void resize(int width, int height); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 2003f3b..f86e116 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -101,6 +101,11 @@ QVGPixmapData::~QVGPixmapData() #endif } +QPixmapData *QVGPixmapData::createCompatiblePixmapData() const +{ + return new QVGPixmapData(pixelType()); +} + bool QVGPixmapData::isValid() const { return (w > 0 && h > 0); diff --git a/src/openvg/qpixmapdata_vg_p.h b/src/openvg/qpixmapdata_vg_p.h index 99115df..f552c7b 100644 --- a/src/openvg/qpixmapdata_vg_p.h +++ b/src/openvg/qpixmapdata_vg_p.h @@ -72,6 +72,8 @@ public: QVGPixmapData(PixelType type); ~QVGPixmapData(); + QPixmapData *createCompatiblePixmapData() const; + // Is this pixmap valid (i.e. non-zero in size)? bool isValid() const; -- cgit v0.12 From ebe1ff6107cf26ae262961e12ab1eb2917648c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 13 Oct 2009 17:07:30 +0200 Subject: Added qt_toRasterPixmap functions. Similar to the existing qt_toX11Pixmap, this lets us explicitly create pixmaps with the raster pixmap backend. Reviewed-by: Gunnar Sletta --- src/gui/image/qpixmap_raster.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 3667e5b..fc76dc3 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -55,6 +55,29 @@ QT_BEGIN_NAMESPACE const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; +QPixmap qt_toRasterPixmap(const QImage &image) +{ + QPixmapData *data = + new QRasterPixmapData(image.depth() == 1 + ? QPixmapData::BitmapType + : QPixmapData::PixmapType); + + data->fromImage(image, Qt::AutoColor); + + return QPixmap(data); +} + +QPixmap qt_toRasterPixmap(const QPixmap &pixmap) +{ + if (pixmap.isNull()) + return QPixmap(); + + if (QPixmap(pixmap).data_ptr()->classId() == QPixmapData::RasterClass) + return pixmap; + + return qt_toRasterPixmap(pixmap.toImage()); +} + QRasterPixmapData::QRasterPixmapData(PixelType type) : QPixmapData(type, RasterClass) { -- cgit v0.12 From 111558d709d7d55318bdf3de99442f26e246fcdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 13 Oct 2009 18:18:56 +0200 Subject: Optimized bloom graphics effect implementation. Avoid doing so many conversions by operating on raster pixmaps, and by using INV_PREMUL/PREMUL instead of converting to ARGB32. Reviewed-by: Gunnar Sletta --- src/gui/effects/qgraphicseffect.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 01df46d..42845cc 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -105,6 +105,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -1461,6 +1462,8 @@ void QGraphicsBloomEffect::setStrength(qreal strength) The \a strength parameter holds the effect's new strength. */ +extern QPixmap qt_toRasterPixmap(const QPixmap &pixmap); + /*! \reimp */ @@ -1473,26 +1476,27 @@ void QGraphicsBloomEffect::draw(QPainter *painter, QGraphicsEffectSource *source } QPoint offset; - QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); - QImage result = pixmap.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied); + QPixmap pixmap = qt_toRasterPixmap(source->pixmap(Qt::DeviceCoordinates, &offset)); // Blur. - QPainter blurPainter(&pixmap); + QImage overlay(pixmap.size(), QImage::Format_ARGB32_Premultiplied); + overlay.fill(0); + + QPainter blurPainter(&overlay); d->blurFilter.draw(&blurPainter, QPointF(), pixmap); blurPainter.end(); // Brighten. - QImage overlay = pixmap.toImage().convertToFormat(QImage::Format_ARGB32); const int numBits = overlay.width() * overlay.height(); QRgb *bits = reinterpret_cast(overlay.bits()); for (int i = 0; i < numBits; ++i) { - const QRgb bit = bits[i]; - bits[i] = qRgba(d->colorTable[qRed(bit)], d->colorTable[qGreen(bit)], - d->colorTable[qBlue(bit)], qAlpha(bit)); + const QRgb pixel = INV_PREMUL(bits[i]); + bits[i] = PREMUL(qRgba(d->colorTable[qRed(pixel)], d->colorTable[qGreen(pixel)], + d->colorTable[qBlue(pixel)], qAlpha(pixel))); } // Composite. - QPainter compPainter(&result); + QPainter compPainter(&pixmap); compPainter.setCompositionMode(QPainter::CompositionMode_Overlay); compPainter.setOpacity(d->strength); compPainter.drawImage(0, 0, overlay); @@ -1500,7 +1504,7 @@ void QGraphicsBloomEffect::draw(QPainter *painter, QGraphicsEffectSource *source QTransform restoreTransform = painter->worldTransform(); painter->setWorldTransform(QTransform()); - painter->drawImage(offset, result); + painter->drawImage(offset, pixmap); painter->setWorldTransform(restoreTransform); } -- cgit v0.12 From 33d2bd641fd031d1a4e38198bf50538344a4ccdb Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Wed, 14 Oct 2009 17:22:57 +0200 Subject: Cleaned up OpenGL1 paint engine GLSL code. Fixed warnings about int->float and float->vecN conversions. Removed unused shader files. Reviewed-by: Trond --- src/opengl/util/composition_mode_colorburn.glsl | 4 +- src/opengl/util/composition_mode_colordodge.glsl | 4 +- src/opengl/util/composition_mode_darken.glsl | 2 +- src/opengl/util/composition_mode_difference.glsl | 2 +- src/opengl/util/composition_mode_exclusion.glsl | 2 +- src/opengl/util/composition_mode_hardlight.glsl | 6 +- src/opengl/util/composition_mode_lighten.glsl | 2 +- src/opengl/util/composition_mode_multiply.glsl | 2 +- src/opengl/util/composition_mode_overlay.glsl | 6 +- src/opengl/util/composition_mode_softlight.glsl | 10 +- src/opengl/util/conical_brush.glsl | 2 +- src/opengl/util/ellipse.glsl | 6 - src/opengl/util/ellipse_aa.glsl | 56 +- src/opengl/util/ellipse_aa_copy.glsl | 11 - src/opengl/util/ellipse_aa_radial.glsl | 24 - src/opengl/util/ellipse_functions.glsl | 63 - src/opengl/util/fragmentprograms_p.h | 1851 +++++++++++----------- src/opengl/util/masks.conf | 1 - src/opengl/util/simple_porter_duff.glsl | 6 +- src/opengl/util/trap_exact_aa.glsl | 12 +- 20 files changed, 1009 insertions(+), 1063 deletions(-) delete mode 100644 src/opengl/util/ellipse.glsl delete mode 100644 src/opengl/util/ellipse_aa_copy.glsl delete mode 100644 src/opengl/util/ellipse_aa_radial.glsl delete mode 100644 src/opengl/util/ellipse_functions.glsl diff --git a/src/opengl/util/composition_mode_colorburn.glsl b/src/opengl/util/composition_mode_colorburn.glsl index a5a153f..c913b97 100644 --- a/src/opengl/util/composition_mode_colorburn.glsl +++ b/src/opengl/util/composition_mode_colorburn.glsl @@ -5,8 +5,8 @@ vec4 composite(vec4 src, vec4 dst) { vec4 result; - result.rgb = mix(src.rgb * (1 - dst.a) + dst.rgb * (1 - src.a), - src.a * (src.rgb * dst.a + dst.rgb * src.a - src.a * dst.a) / max(src.rgb, 0.00001) + src.rgb * (1 - dst.a) + dst.rgb * (1 - src.a), + result.rgb = mix(src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a), + src.a * (src.rgb * dst.a + dst.rgb * src.a - src.a * dst.a) / max(src.rgb, 0.00001) + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a), step(src.a * dst.a, src.rgb * dst.a + dst.rgb * src.a)); result.a = src.a + dst.a - src.a * dst.a; return result; diff --git a/src/opengl/util/composition_mode_colordodge.glsl b/src/opengl/util/composition_mode_colordodge.glsl index c194441..b75e83c 100644 --- a/src/opengl/util/composition_mode_colordodge.glsl +++ b/src/opengl/util/composition_mode_colordodge.glsl @@ -5,8 +5,8 @@ vec4 composite(vec4 src, vec4 dst) { vec4 result; - vec3 temp = src.rgb * (1 - dst.a) + dst.rgb * (1 - src.a); - result.rgb = mix(dst.rgb * src.a / max(1 - src.rgb / max(src.a, 0.000001), 0.000001) + temp, + vec3 temp = src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); + result.rgb = mix(dst.rgb * src.a / max(1.0 - src.rgb / max(src.a, 0.000001), 0.000001) + temp, src.a * dst.a + temp, step(src.a * dst.a, src.rgb * dst.a + dst.rgb * src.a)); diff --git a/src/opengl/util/composition_mode_darken.glsl b/src/opengl/util/composition_mode_darken.glsl index c1e83fd..8bbb82b 100644 --- a/src/opengl/util/composition_mode_darken.glsl +++ b/src/opengl/util/composition_mode_darken.glsl @@ -3,7 +3,7 @@ vec4 composite(vec4 src, vec4 dst) { vec4 result; - result.rgb = min(src.rgb * dst.a, dst.rgb * src.a) + src.rgb * (1 - dst.a) + dst.rgb * (1 - src.a); + result.rgb = min(src.rgb * dst.a, dst.rgb * src.a) + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); result.a = src.a + dst.a - src.a * dst.a; return result; } diff --git a/src/opengl/util/composition_mode_difference.glsl b/src/opengl/util/composition_mode_difference.glsl index ca13ce7..3c46ec7 100644 --- a/src/opengl/util/composition_mode_difference.glsl +++ b/src/opengl/util/composition_mode_difference.glsl @@ -3,7 +3,7 @@ vec4 composite(vec4 src, vec4 dst) { vec4 result; - result.rgb = src.rgb + dst.rgb - 2 * min(src.rgb * dst.a, dst.rgb * src.a); + result.rgb = src.rgb + dst.rgb - 2.0 * min(src.rgb * dst.a, dst.rgb * src.a); result.a = src.a + dst.a - src.a * dst.a; return result; } diff --git a/src/opengl/util/composition_mode_exclusion.glsl b/src/opengl/util/composition_mode_exclusion.glsl index ccd1183..59c2da9 100644 --- a/src/opengl/util/composition_mode_exclusion.glsl +++ b/src/opengl/util/composition_mode_exclusion.glsl @@ -3,7 +3,7 @@ vec4 composite(vec4 src, vec4 dst) { vec4 result; - result.rgb = (src.rgb * dst.a + dst.rgb * src.a - 2 * src.rgb * dst.rgb) + src.rgb * (1 - dst.a) + dst.rgb * (1 - src.a); + result.rgb = (src.rgb * dst.a + dst.rgb * src.a - 2.0 * src.rgb * dst.rgb) + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); result.a = src.a + dst.a - src.a * dst.a; return result; } diff --git a/src/opengl/util/composition_mode_hardlight.glsl b/src/opengl/util/composition_mode_hardlight.glsl index 9dd4de3..4ea3550 100644 --- a/src/opengl/util/composition_mode_hardlight.glsl +++ b/src/opengl/util/composition_mode_hardlight.glsl @@ -5,9 +5,9 @@ vec4 composite(vec4 src, vec4 dst) { vec4 result; - result.rgb = mix(2 * src.rgb * dst.rgb + src.rgb * (1 - dst.a) + dst.rgb * (1 - src.a), - src.a * dst.a - 2 * (dst.a - dst.rgb) * (src.a - src.rgb) + src.rgb * (1 - dst.a) + dst.rgb * (1 - src.a), - step(src.a, 2 * src.rgb)); + result.rgb = mix(2.0 * src.rgb * dst.rgb + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a), + src.a * dst.a - 2.0 * (dst.a - dst.rgb) * (src.a - src.rgb) + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a), + step(src.a, 2.0 * src.rgb)); result.a = src.a + dst.a - src.a * dst.a; return result; diff --git a/src/opengl/util/composition_mode_lighten.glsl b/src/opengl/util/composition_mode_lighten.glsl index 1fbd27a..13ef507 100644 --- a/src/opengl/util/composition_mode_lighten.glsl +++ b/src/opengl/util/composition_mode_lighten.glsl @@ -3,7 +3,7 @@ vec4 composite(vec4 src, vec4 dst) { vec4 result; - result.rgb = max(src.rgb * dst.a, dst.rgb * src.a) + src.rgb * (1 - dst.a) + dst.rgb * (1 - src.a); + result.rgb = max(src.rgb * dst.a, dst.rgb * src.a) + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); result.a = src.a + dst.a - src.a * dst.a; return result; } diff --git a/src/opengl/util/composition_mode_multiply.glsl b/src/opengl/util/composition_mode_multiply.glsl index 268345a..f90b7f0 100644 --- a/src/opengl/util/composition_mode_multiply.glsl +++ b/src/opengl/util/composition_mode_multiply.glsl @@ -3,7 +3,7 @@ vec4 composite(vec4 src, vec4 dst) { vec4 result; - result.rgb = src.rgb * dst.rgb + src.rgb * (1 - dst.a) + dst.rgb * (1 - src.a); + result.rgb = src.rgb * dst.rgb + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); result.a = src.a + dst.a - src.a * dst.a; return result; } diff --git a/src/opengl/util/composition_mode_overlay.glsl b/src/opengl/util/composition_mode_overlay.glsl index a9b7226..f621bde 100644 --- a/src/opengl/util/composition_mode_overlay.glsl +++ b/src/opengl/util/composition_mode_overlay.glsl @@ -5,9 +5,9 @@ vec4 composite(vec4 src, vec4 dst) { vec4 result; - result.rgb = mix(2 * src.rgb * dst.rgb + src.rgb * (1 - dst.a) + dst.rgb * (1 - src.a), - src.a * dst.a - 2 * (dst.a - dst.rgb) * (src.a - src.rgb) + src.rgb * (1 - dst.a) + dst.rgb * (1 - src.a), - step(dst.a, 2 * dst.rgb)); + result.rgb = mix(2.0 * src.rgb * dst.rgb + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a), + src.a * dst.a - 2.0 * (dst.a - dst.rgb) * (src.a - src.rgb) + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a), + step(dst.a, 2.0 * dst.rgb)); result.a = src.a + dst.a - src.a * dst.a; return result; } diff --git a/src/opengl/util/composition_mode_softlight.glsl b/src/opengl/util/composition_mode_softlight.glsl index 0237827..4777b74 100644 --- a/src/opengl/util/composition_mode_softlight.glsl +++ b/src/opengl/util/composition_mode_softlight.glsl @@ -8,11 +8,11 @@ vec4 composite(vec4 src, vec4 dst) { vec4 result; float da = max(dst.a, 0.00001); - result.rgb = mix(dst.rgb * (src.a - (1 - dst.rgb / da) * (2 * src.rgb - src.a)), - mix(dst.rgb * (src.a - (1 - dst.rgb / da) * (2 * src.rgb - src.a) * (3 - 8 * dst.rgb / da)), - (dst.rgb * src.a + (sqrt(dst.rgb / da) * dst.a - dst.rgb) * (2 * src.rgb - src.a)), - step(dst.a, 8 * dst.rgb)), - step(src.a, 2 * src.rgb)) + src.rgb * (1 - dst.a) + dst.rgb * (1 - src.a); + result.rgb = mix(dst.rgb * (src.a - (1.0 - dst.rgb / da) * (2.0 * src.rgb - src.a)), + mix(dst.rgb * (src.a - (1.0 - dst.rgb / da) * (2.0 * src.rgb - src.a) * (3.0 - 8.0 * dst.rgb / da)), + (dst.rgb * src.a + (sqrt(dst.rgb / da) * dst.a - dst.rgb) * (2.0 * src.rgb - src.a)), + step(dst.a, 8.0 * dst.rgb)), + step(src.a, 2.0 * src.rgb)) + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); result.a = src.a + dst.a - src.a * dst.a; return result; } diff --git a/src/opengl/util/conical_brush.glsl b/src/opengl/util/conical_brush.glsl index 83ee2f5..b3ec1d7 100644 --- a/src/opengl/util/conical_brush.glsl +++ b/src/opengl/util/conical_brush.glsl @@ -20,7 +20,7 @@ vec4 brush() /* float val = fmod((atan2(-A.y, A.x) + angle) / (2.0 * M_PI), 1); */ if (abs(A.y) == abs(A.x)) A.y += 0.002; - float t = (atan2(-A.y, A.x) + angle) / (2.0 * M_PI); + float t = (atan(-A.y, A.x) + angle) / (2.0 * M_PI); float val = t - floor(t); return texture1D(palette, val); } diff --git a/src/opengl/util/ellipse.glsl b/src/opengl/util/ellipse.glsl deleted file mode 100644 index 860ae77..0000000 --- a/src/opengl/util/ellipse.glsl +++ /dev/null @@ -1,6 +0,0 @@ -#include "ellipse_functions.glsl" - -void main() -{ - gl_FragColor = ellipse(); -} diff --git a/src/opengl/util/ellipse_aa.glsl b/src/opengl/util/ellipse_aa.glsl index f7a6454..257e3bb 100644 --- a/src/opengl/util/ellipse_aa.glsl +++ b/src/opengl/util/ellipse_aa.glsl @@ -1,6 +1,58 @@ -#include "ellipse_functions.glsl" +uniform vec3 inv_matrix_m0; +uniform vec3 inv_matrix_m1; +uniform vec3 inv_matrix_m2; + +uniform vec2 ellipse_offset; + +// ellipse equation + +// s^2/a^2 + t^2/b^2 = 1 +// +// implicit equation: +// g(s,t) = 1 - s^2/r_s^2 - t^2/r_t^2 + +// distance from ellipse: +// grad = [dg/dx dg/dy] +// d(s, t) ~= g(s, t) / |grad| + +// dg/dx = dg/ds * ds/dx + dg/dt * dt/dx +// dg/dy = dg/ds * ds/dy + dg/dt * dt/dy + +float ellipse_aa() +{ + mat3 mat; + + mat[0] = inv_matrix_m0; + mat[1] = inv_matrix_m1; + mat[2] = inv_matrix_m2; + + vec3 hcoords = mat * vec3(gl_FragCoord.xy + ellipse_offset, 1); + float inv_w = 1.0 / hcoords.z; + vec2 st = hcoords.xy * inv_w; + + vec4 xy = vec4(mat[0].xy, mat[1].xy); + vec2 h = vec2(mat[0].z, mat[1].z); + + vec4 dstdxy = (xy.xzyw - h.xyxy * st.xxyy) * inv_w; + + //dstdxy.x = (mat[0].x - mat[0].z * st.x) * inv_w; // ds/dx + //dstdxy.y = (mat[1].x - mat[1].z * st.x) * inv_w; // ds/dy + //dstdxy.z = (mat[0].y - mat[0].z * st.y) * inv_w; // dt/dx + //dstdxy.w = (mat[1].y - mat[1].z * st.y) * inv_w; // dt/dy + + vec2 inv_r = gl_TexCoord[0].xy; + vec2 n = st * inv_r; + float g = 1.0 - dot(n, n); + + vec2 dgdst = -2.0 * n * inv_r; + + vec2 grad = vec2(dot(dgdst, dstdxy.xz), + dot(dgdst, dstdxy.yw)); + + return smoothstep(-0.5, 0.5, g * inversesqrt(dot(grad, grad))); +} void main() { - gl_FragColor = ellipse_aa(); + gl_FragColor = ellipse_aa().xxxx; } diff --git a/src/opengl/util/ellipse_aa_copy.glsl b/src/opengl/util/ellipse_aa_copy.glsl deleted file mode 100644 index 5372f58..0000000 --- a/src/opengl/util/ellipse_aa_copy.glsl +++ /dev/null @@ -1,11 +0,0 @@ -uniform vec2 r; // r_x and r_y - -uniform sampler2D texture; -uniform vec2 inv_texture_size; - -#include "ellipse_functions.glsl" - -void main() -{ - gl_FragColor = ellipse_aa() * texture2D(texture, gl_FragCoord.xy * inv_texture_size); -} diff --git a/src/opengl/util/ellipse_aa_radial.glsl b/src/opengl/util/ellipse_aa_radial.glsl deleted file mode 100644 index 0878f99..0000000 --- a/src/opengl/util/ellipse_aa_radial.glsl +++ /dev/null @@ -1,24 +0,0 @@ -#include "ellipse_functions.glsl" - -uniform sampler1D palette; -uniform vec2 fmp; -uniform float fmp2_m_radius2; -uniform vec4 inv_matrix; -uniform vec2 inv_matrix_offset; - -void main() -{ - // float2 A = frag_coord.xy;//mul(inv_matrix, frag_coord.xy) + inv_matrix_offset; - mat2 mat; - mat[0][0] = inv_matrix.x; - mat[0][1] = inv_matrix.y; - mat[1][0] = inv_matrix.z; - mat[1][1] = inv_matrix.w; - vec2 A = gl_FragCoord.xy * mat + inv_matrix_offset; - vec2 B = fmp; - float a = fmp2_m_radius2; - float b = 2.0*dot(A, B); - float c = -dot(A, A); - float val = (-b + sqrt(b*b - 4.0*a*c)) / (2.0*a); - gl_FragColor = texture1D(palette, val) * ellipse_aa(); -} diff --git a/src/opengl/util/ellipse_functions.glsl b/src/opengl/util/ellipse_functions.glsl deleted file mode 100644 index eed18e8..0000000 --- a/src/opengl/util/ellipse_functions.glsl +++ /dev/null @@ -1,63 +0,0 @@ -uniform vec3 inv_matrix_m0; -uniform vec3 inv_matrix_m1; -uniform vec3 inv_matrix_m2; - -uniform vec2 ellipse_offset; - -float ellipse() -{ - vec2 st = gl_TexCoord[0].st; - - if (dot(st, st) > 1) - discard; - - return 1.0; -} - -// ellipse equation - -// s^2/a^2 + t^2/b^2 = 1 -// -// implicit equation: -// g(s,t) = 1 - s^2/r_s^2 - t^2/r_t^2 - -// distance from ellipse: -// grad = [dg/dx dg/dy] -// d(s, t) ~= g(s, t) / |grad| - -// dg/dx = dg/ds * ds/dx + dg/dt * dt/dx -// dg/dy = dg/ds * ds/dy + dg/dt * dt/dy - -float ellipse_aa() -{ - mat3 mat; - - mat[0] = inv_matrix_m0; - mat[1] = inv_matrix_m1; - mat[2] = inv_matrix_m2; - - vec3 hcoords = mat * vec3(gl_FragCoord.xy + ellipse_offset, 1); - float inv_w = 1.0 / hcoords.z; - vec2 st = hcoords.xy * inv_w; - - vec4 xy = vec4(mat[0].xy, mat[1].xy); - vec2 h = vec2(mat[0].z, mat[1].z); - - vec4 dstdxy = (xy.xzyw - h.xyxy * st.xxyy) * inv_w; - - //dstdxy.x = (mat[0].x - mat[0].z * st.x) * inv_w; // ds/dx - //dstdxy.y = (mat[1].x - mat[1].z * st.x) * inv_w; // ds/dy - //dstdxy.z = (mat[0].y - mat[0].z * st.y) * inv_w; // dt/dx - //dstdxy.w = (mat[1].y - mat[1].z * st.y) * inv_w; // dt/dy - - vec2 inv_r = gl_TexCoord[0].xy; - vec2 n = st * inv_r; - float g = 1.0 - dot(n, n); - - vec2 dgdst = -2.0 * n * inv_r; - - vec2 grad = vec2(dot(dgdst, dstdxy.xz), - dot(dgdst, dstdxy.yw)); - - return smoothstep(-0.5, 0.5, g * inversesqrt(dot(grad, grad))); -} diff --git a/src/opengl/util/fragmentprograms_p.h b/src/opengl/util/fragmentprograms_p.h index f61f275..89cd182 100644 --- a/src/opengl/util/fragmentprograms_p.h +++ b/src/opengl/util/fragmentprograms_p.h @@ -132,58 +132,57 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_MASK_TRAPEZOID_AA = "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "ADD R4.x, fragment.position, c[0];\n" + "ADD R3.z, fragment.position.x, c[0].x;\n" "ADD R0.y, fragment.position, -c[0].x;\n" - "MAX R3.w, fragment.texcoord[0].y, R0.y;\n" + "MAX R4.x, fragment.texcoord[0].y, R0.y;\n" "ADD R0.x, fragment.position.y, c[0];\n" - "MIN R3.z, R0.x, fragment.texcoord[0].x;\n" + "MIN R3.w, R0.x, fragment.texcoord[0].x;\n" "ADD R2.z, fragment.position.x, -c[0].x;\n" - "MOV R0.yw, R3.w;\n" - "MOV R0.xz, R3.z;\n" - "MAD R1, fragment.texcoord[1].xxzz, R0, fragment.texcoord[1].yyww;\n" - "MAD R1.zw, fragment.position.x, c[0].y, -R1;\n" - "MOV R0.z, R1.x;\n" - "MOV R0.w, R1.z;\n" - "MOV R0.y, R1.w;\n" - "MOV R0.x, R1.y;\n" - "MIN R2.xy, R0.zwzw, R0;\n" - "SGE R1.xy, R0, R0.zwzw;\n" - "ADD R1.zw, -fragment.texcoord[0], -fragment.texcoord[0];\n" - "MAX R0.xy, R0.zwzw, R0;\n" - "MAD R3.xy, R1, R1.zwzw, fragment.texcoord[0].zwzw;\n" - "MOV R2.w, R4.x;\n" - "ADD R1, -R2.xxyy, R2.zwzw;\n" - "MAD R1, R1, R3.xxyy, R3.w;\n" - "ADD R3.xy, R1.ywzw, R1.xzzw;\n" - "ADD R4.zw, R3.z, -R1.xyxz;\n" - "ADD R1.zw, -R3.w, R1.xyyw;\n" - "ADD R1.xy, R4.x, -R2;\n" - "MUL R1.xy, R1, R1.zwzw;\n" - "MAD R3.xy, -R3, c[0].x, R3.z;\n" - "ADD R2.w, R4.x, -R2.z;\n" - "MUL R0.zw, R3.xyxy, R2.w;\n" - "ADD R2.w, R3.z, -R3;\n" - "ADD R3.xy, -R2.z, R0;\n" + "MOV R2.w, R3.z;\n" + "MOV R0.yw, R4.x;\n" + "MOV R0.xz, R3.w;\n" + "MAD R0, fragment.texcoord[1].xxzz, R0, fragment.texcoord[1].yyww;\n" + "MAD R0.zw, fragment.position.x, c[0].y, -R0;\n" + "MOV R2.x, R0;\n" + "MOV R2.y, R0.z;\n" + "MOV R1.w, R0;\n" + "MOV R1.z, R0.y;\n" + "MIN R1.xy, R2, R1.zwzw;\n" + "SGE R0.xy, R1.zwzw, R2;\n" + "ADD R0.zw, -fragment.texcoord[0], -fragment.texcoord[0];\n" + "MAD R3.xy, R0, R0.zwzw, fragment.texcoord[0].zwzw;\n" + "ADD R0, -R1.xxyy, R2.zwzw;\n" + "MAD R0, R0, R3.xxyy, R4.x;\n" + "ADD R3.xy, R0.ywzw, R0.xzzw;\n" + "ADD R4.zw, R3.w, -R0.xyxz;\n" + "ADD R0.zw, -R4.x, R0.xyyw;\n" + "ADD R0.xy, R3.z, -R1;\n" + "MAX R1.zw, R2.xyxy, R1;\n" + "MUL R0.xy, R0, R0.zwzw;\n" + "MAD R3.xy, -R3, c[0].x, R3.w;\n" + "ADD R2.w, R3.z, -R2.z;\n" + "MUL R2.xy, R3, R2.w;\n" + "ADD R2.w, R3, -R4.x;\n" + "ADD R3.xy, -R2.z, R1.zwzw;\n" "MUL R3.xy, R4.zwzw, R3;\n" - "ADD R4.zw, R2.xyxy, R0.xyxy;\n" - "MAD R1.zw, R4, c[0].x, -R2.z;\n" - "MAD R1.xy, -R1, c[0].x, R2.w;\n" - "MAD R4.zw, R2.w, R1, -R1.xyxy;\n" - "SGE R1.zw, R4.x, R0.xyxy;\n" - "MAD R3.xy, R3, c[0].x, -R0.zwzw;\n" - "MAD R1.xy, R1.zwzw, R4.zwzw, R1;\n" - "MAD R0.zw, R1, R3.xyxy, R0;\n" - "ADD R1.zw, R0, -R1.xyxy;\n" - "SGE R0.zw, R2.z, R2.xyxy;\n" - "MAD R0.zw, R0, R1, R1.xyxy;\n" - "ADD R0.zw, -R2.w, R0;\n" - "SGE R1.xy, R4.x, R2;\n" - "MAD R0.zw, R1.xyxy, R0, R2.w;\n" - "SGE R0.xy, R0, R2.z;\n" - "MUL R0.xy, R0.zwzw, R0;\n" - "ADD R0.x, R2.w, -R0;\n" - "SGE R0.z, R3, R3.w;\n" - "ADD R0.x, R0, -R0.y;\n" + "ADD R4.zw, R1.xyxy, R1;\n" + "MAD R0.zw, R4, c[0].x, -R2.z;\n" + "MAD R0.xy, -R0, c[0].x, R2.w;\n" + "MAD R4.zw, R0, R2.w, -R0.xyxy;\n" + "SGE R0.zw, R3.z, R1;\n" + "MAD R0.xy, R0.zwzw, R4.zwzw, R0;\n" + "MAD R3.xy, R3, c[0].x, -R2;\n" + "MAD R0.zw, R0, R3.xyxy, R2.xyxy;\n" + "ADD R2.xy, R0.zwzw, -R0;\n" + "SGE R0.zw, R2.z, R1.xyxy;\n" + "MAD R0.xy, R0.zwzw, R2, R0;\n" + "SGE R0.zw, R1, R2.z;\n" + "ADD R0.xy, R0, -R2.w;\n" + "SGE R1.xy, R3.z, R1;\n" + "MAD R0.xy, R1, R0, R2.w;\n" + "MAD R0.x, -R0, R0.z, R2.w;\n" + "SGE R0.z, R3.w, R4.x;\n" + "MAD R0.x, -R0.y, R0.w, R0;\n" "MUL result.color, R0.x, R0.z;\n" "END\n" ; @@ -201,27 +200,27 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_MASK_ELLIPSE_AA = "MAD R0.xyz, R0.x, c[0], R1;\n" "ADD R0.xyz, R0, c[2];\n" "RCP R2.z, R0.z;\n" - "MUL R1.zw, R0.xyxy, R2.z;\n" - "MUL R2.xy, R1.zwzw, fragment.texcoord[0];\n" - "MOV R1.x, c[0].z;\n" - "MOV R1.y, c[1].z;\n" - "MOV R0.xy, c[0];\n" - "MOV R0.zw, c[1].xyxy;\n" - "MAD R0, R1.zzww, -R1.xyxy, R0.xzyw;\n" + "MUL R0.zw, R0.xyxy, R2.z;\n" + "MUL R2.xy, R0.zwzw, fragment.texcoord[0];\n" + "MOV R1.xy, c[0];\n" + "MOV R1.zw, c[1].xyxy;\n" + "MOV R0.x, c[0].z;\n" + "MOV R0.y, c[1].z;\n" + "MAD R0, R0.zzww, -R0.xyxy, R1.xzyw;\n" "MUL R1.xy, R2, fragment.texcoord[0];\n" "MUL R0, R2.z, R0;\n" "MUL R1.xy, R1, c[4].x;\n" "MUL R1.zw, R1.xyxy, R0.xyxz;\n" - "MUL R0.xy, R1, R0.ywzw;\n" - "ADD R0.w, R0.x, R0.y;\n" - "MUL R0.xy, R2, R2;\n" - "ADD R0.x, R0, R0.y;\n" - "ADD R0.z, R1, R1.w;\n" - "MUL R0.zw, R0, R0;\n" + "MUL R0.zw, R1.xyxy, R0.xyyw;\n" "ADD R0.y, R0.z, R0.w;\n" - "RSQ R0.y, R0.y;\n" - "ADD R0.x, -R0, c[4].y;\n" - "MAD_SAT R0.x, R0.y, R0, -c[4].z;\n" + "ADD R0.x, R1.z, R1.w;\n" + "MUL R0.xy, R0, R0;\n" + "ADD R0.x, R0, R0.y;\n" + "MUL R0.zw, R2.xyxy, R2.xyxy;\n" + "ADD R0.z, R0, R0.w;\n" + "ADD R0.y, -R0.z, c[4];\n" + "RSQ R0.x, R0.x;\n" + "MAD_SAT R0.x, R0, R0.y, -c[4].z;\n" "MUL R0.y, -R0.x, c[4].w;\n" "ADD R0.y, R0, c[5].x;\n" "MUL R0.x, R0, R0;\n" @@ -408,13 +407,13 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "TEMP R3;\n" "MUL R0.xy, fragment.position, c[1];\n" "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.y, -fragment.color.primary.w, c[4].x;\n" - "MAX R1.x, fragment.color.primary.w, c[4].y;\n" - "MUL R2.xyz, R0, R1.y;\n" + "ADD R1.x, -fragment.color.primary.w, c[4];\n" + "MAX R1.y, fragment.color.primary.w, c[4];\n" + "MUL R2.xyz, R0, R1.x;\n" "ADD R1.w, -R0, c[4].x;\n" "MAD R3.xyz, fragment.color.primary, R1.w, R2;\n" - "RCP R1.x, R1.x;\n" - "MAD R1.xyz, -fragment.color.primary, R1.x, c[4].x;\n" + "RCP R1.y, R1.y;\n" + "MAD R1.xyz, -fragment.color.primary, R1.y, c[4].x;\n" "MAX R1.xyz, R1, c[4].y;\n" "MUL R2.xyz, fragment.color.primary.w, R0;\n" "MUL R1.w, fragment.color.primary, R0;\n" @@ -520,8 +519,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..3],\n" - " { 1, 9.9999997e-006, 2, 3 },\n" - " { 8 } };\n" + " { 1, 2, 9.9999997e-006, 8 },\n" + " { 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -530,39 +529,39 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "TEMP R5;\n" "MUL R0.xy, fragment.position, c[1];\n" "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.x, R0.w, c[4].y;\n" + "MAX R1.x, R0.w, c[4].z;\n" "RCP R1.w, R1.x;\n" - "MUL R2.xyz, R0, R1.w;\n" - "MUL R1.xyz, -R2, c[5].x;\n" - "RSQ R2.w, R2.x;\n" - "ADD R4.xyz, R1, c[4].w;\n" + "MUL R1.xyz, R0, R1.w;\n" + "MUL R4.xyz, -R1, c[4].w;\n" + "RSQ R2.x, R1.x;\n" + "RSQ R2.z, R1.z;\n" + "RSQ R2.y, R1.y;\n" "MAD R1.xyz, -R0, R1.w, c[4].x;\n" - "RSQ R2.z, R2.z;\n" - "RSQ R2.y, R2.y;\n" - "RCP R2.x, R2.w;\n" + "RCP R2.x, R2.x;\n" "RCP R2.z, R2.z;\n" "RCP R2.y, R2.y;\n" - "MAD R5.xyz, R0.w, R2, -R0;\n" - "MAD R2.xyz, fragment.color.primary, c[4].z, -fragment.color.primary.w;\n" - "MUL R3.xyz, R1, R2;\n" - "MAD R3.xyz, -R3, R4, fragment.color.primary.w;\n" - "MUL R4.xyz, R5, R2;\n" + "MAD R3.xyz, R0.w, R2, -R0;\n" + "MAD R2.xyz, fragment.color.primary, c[4].y, -fragment.color.primary.w;\n" + "MUL R3.xyz, R2, R3;\n" + "ADD R5.xyz, R4, c[5].x;\n" + "MUL R4.xyz, R1, R2;\n" "MAD R1.xyz, -R1, R2, fragment.color.primary.w;\n" - "MUL R3.xyz, R0, R3;\n" - "MAD R4.xyz, fragment.color.primary.w, R0, R4;\n" - "ADD R5.xyz, R4, -R3;\n" - "MUL R4.xyz, R0, c[5].x;\n" - "SGE R2.xyz, R4, R0.w;\n" - "MAD R2.xyz, R2, R5, R3;\n" + "MUL R2.xyz, fragment.color.primary, c[4].y;\n" + "MAD R5.xyz, -R4, R5, fragment.color.primary.w;\n" + "MAD R3.xyz, fragment.color.primary.w, R0, R3;\n" + "MAD R4.xyz, -R0, R5, R3;\n" + "MUL R3.xyz, R0, c[4].w;\n" + "MUL R5.xyz, R0, R5;\n" + "SGE R3.xyz, R3, R0.w;\n" + "MAD R3.xyz, R3, R4, R5;\n" + "MAD R3.xyz, -R0, R1, R3;\n" "MUL R1.xyz, R0, R1;\n" - "MUL R3.xyz, fragment.color.primary, c[4].z;\n" - "ADD R2.xyz, R2, -R1;\n" - "SGE R3.xyz, R3, fragment.color.primary.w;\n" - "MAD R1.xyz, R3, R2, R1;\n" - "ADD R1.w, -R0, c[4].x;\n" - "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" - "ADD R1.w, -fragment.color.primary, c[4].x;\n" - "MAD R2.xyz, R0, R1.w, R1;\n" + "SGE R2.xyz, R2, fragment.color.primary.w;\n" + "MAD R2.xyz, R2, R3, R1;\n" + "ADD R1.x, -R0.w, c[4];\n" + "MAD R2.xyz, fragment.color.primary, R1.x, R2;\n" + "ADD R1.x, -fragment.color.primary.w, c[4];\n" + "MAD R2.xyz, R0, R1.x, R2;\n" "ADD R1.z, fragment.color.primary.w, R0.w;\n" "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" "ADD R1.xy, fragment.position, c[2];\n" @@ -862,8 +861,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[3] = { program.local[0],\n" - " { 1, 9.9999997e-006, 2, 3 },\n" - " { 8 } };\n" + " { 1, 2, 9.9999997e-006, 8 },\n" + " { 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -872,41 +871,41 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "TEMP R5;\n" "MUL R0.xy, fragment.position, c[0];\n" "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.x, R0.w, c[1].y;\n" + "MAX R1.x, R0.w, c[1].z;\n" "RCP R1.w, R1.x;\n" - "MUL R2.xyz, R0, R1.w;\n" - "MUL R1.xyz, -R2, c[2].x;\n" - "ADD R4.xyz, R1, c[1].w;\n" - "MAD R1.xyz, -R0, R1.w, c[1].x;\n" - "RSQ R2.w, R2.x;\n" - "RSQ R2.z, R2.z;\n" - "RSQ R2.y, R2.y;\n" - "RCP R2.x, R2.w;\n" + "MUL R1.xyz, R0, R1.w;\n" + "MUL R4.xyz, -R1, c[1].w;\n" + "RSQ R2.x, R1.x;\n" + "RSQ R2.z, R1.z;\n" + "RSQ R2.y, R1.y;\n" + "RCP R2.x, R2.x;\n" "RCP R2.z, R2.z;\n" "RCP R2.y, R2.y;\n" - "MAD R5.xyz, R0.w, R2, -R0;\n" - "MAD R2.xyz, fragment.color.primary, c[1].z, -fragment.color.primary.w;\n" - "MUL R3.xyz, R1, R2;\n" - "MAD R3.xyz, -R3, R4, fragment.color.primary.w;\n" - "MUL R4.xyz, R5, R2;\n" + "MAD R3.xyz, R0.w, R2, -R0;\n" + "MAD R2.xyz, fragment.color.primary, c[1].y, -fragment.color.primary.w;\n" + "MUL R3.xyz, R2, R3;\n" + "MAD R3.xyz, fragment.color.primary.w, R0, R3;\n" + "MAD R1.xyz, -R0, R1.w, c[1].x;\n" + "ADD R5.xyz, R4, c[2].x;\n" + "MUL R4.xyz, R1, R2;\n" "MAD R1.xyz, -R1, R2, fragment.color.primary.w;\n" - "MUL R3.xyz, R0, R3;\n" - "MAD R4.xyz, fragment.color.primary.w, R0, R4;\n" - "ADD R5.xyz, R4, -R3;\n" - "MUL R4.xyz, R0, c[2].x;\n" - "SGE R2.xyz, R4, R0.w;\n" - "MAD R2.xyz, R2, R5, R3;\n" + "MAD R5.xyz, -R4, R5, fragment.color.primary.w;\n" + "MAD R4.xyz, -R0, R5, R3;\n" + "MUL R3.xyz, R0, c[1].w;\n" + "MUL R2.xyz, fragment.color.primary, c[1].y;\n" + "MUL R5.xyz, R0, R5;\n" + "SGE R3.xyz, R3, R0.w;\n" + "MAD R3.xyz, R3, R4, R5;\n" + "MAD R3.xyz, -R0, R1, R3;\n" "MUL R1.xyz, R0, R1;\n" - "MUL R3.xyz, fragment.color.primary, c[1].z;\n" - "ADD R2.xyz, R2, -R1;\n" - "SGE R3.xyz, R3, fragment.color.primary.w;\n" - "MAD R1.xyz, R3, R2, R1;\n" - "ADD R1.w, -R0, c[1].x;\n" - "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" - "ADD R1.w, fragment.color.primary, R0;\n" - "ADD R2.x, -fragment.color.primary.w, c[1];\n" - "MAD result.color.xyz, R0, R2.x, R1;\n" - "MAD result.color.w, -fragment.color.primary, R0, R1;\n" + "SGE R2.xyz, R2, fragment.color.primary.w;\n" + "MAD R2.xyz, R2, R3, R1;\n" + "ADD R1.x, -R0.w, c[1];\n" + "MAD R2.xyz, fragment.color.primary, R1.x, R2;\n" + "ADD R1.x, fragment.color.primary.w, R0.w;\n" + "ADD R1.y, -fragment.color.primary.w, c[1].x;\n" + "MAD result.color.xyz, R0, R1.y, R2;\n" + "MAD result.color.w, -fragment.color.primary, R0, R1.x;\n" "END\n" ; @@ -1086,18 +1085,18 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "ADD R0.z, R0, R0.w;\n" "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" + "MUL R0.y, R0.x, c[9].x;\n" + "MOV R0.x, c[9];\n" "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.z, R0, c[9].y;\n" + "MAD R0.z, R0.y, R0.y, -R0;\n" "ADD R3.xy, fragment.position, c[7];\n" - "MUL R0.y, R0.z, c[9];\n" - "MUL R0.x, R0, c[9];\n" - "MAD R0.z, R0.x, R0.x, -R0.y;\n" - "MOV R0.y, c[9].x;\n" + "MUL R0.w, R0.x, c[1].x;\n" "RSQ R0.z, R0.z;\n" - "RCP R0.z, R0.z;\n" - "MUL R0.y, R0, c[1].x;\n" - "ADD R0.x, -R0, R0.z;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, R0.x, R0.y;\n" + "RCP R0.x, R0.z;\n" + "RCP R0.z, R0.w;\n" + "ADD R0.x, -R0.y, R0;\n" + "MUL R0.z, R0.x, R0;\n" "TEX R1, R0.z, texture[2], 1D;\n" "MUL R0.xy, fragment.position, c[6];\n" "TEX R0, R0, texture[0], 2D;\n" @@ -1126,24 +1125,24 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" + "MUL R0.y, R0.x, c[9].x;\n" + "MOV R0.x, c[9];\n" "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.z, R0, c[9].y;\n" + "MAD R0.z, R0.y, R0.y, -R0;\n" "MUL R1.xy, fragment.position, c[6];\n" "TEX R1, R1, texture[0], 2D;\n" - "MUL R0.y, R0.z, c[9];\n" - "MUL R0.x, R0, c[9];\n" - "MAD R0.z, R0.x, R0.x, -R0.y;\n" - "MOV R0.y, c[9].x;\n" + "MUL R0.w, R0.x, c[1].x;\n" "RSQ R0.z, R0.z;\n" - "RCP R0.z, R0.z;\n" - "MUL R0.y, R0, c[1].x;\n" - "ADD R0.x, -R0, R0.z;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.x, R0, R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" + "RCP R0.x, R0.z;\n" "ADD R2.w, -R1, c[9].z;\n" + "RCP R0.z, R0.w;\n" + "ADD R0.x, -R0.y, R0;\n" + "MUL R0.x, R0, R0.z;\n" + "TEX R0, R0, texture[2], 1D;\n" "ADD R3.xyz, R0.w, -R0;\n" "ADD R2.xyz, R1.w, -R1;\n" "MUL R2.xyz, R2, R3;\n" @@ -1284,20 +1283,20 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" + "MUL R0.y, R0.x, c[9].x;\n" + "MOV R0.x, c[9];\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[9];\n" - "MUL R0.x, R0, c[9];\n" - "MAD R0.z, R0.x, R0.x, -R0.y;\n" - "MOV R0.y, c[9].x;\n" + "MUL R0.z, R0, c[9].y;\n" + "MAD R0.z, R0.y, R0.y, -R0;\n" + "MUL R0.w, R0.x, c[1].x;\n" "RSQ R0.z, R0.z;\n" - "RCP R0.z, R0.z;\n" - "MUL R0.y, R0, c[1].x;\n" - "ADD R0.x, -R0, R0.z;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.x, R0, R0.y;\n" + "RCP R0.x, R0.z;\n" + "RCP R0.z, R0.w;\n" + "ADD R0.x, -R0.y, R0;\n" + "MUL R0.x, R0, R0.z;\n" "TEX R0, R0, texture[2], 1D;\n" "MAX R1.x, R0.w, c[9].w;\n" "RCP R1.x, R1.x;\n" @@ -1351,17 +1350,17 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[9];\n" - "MUL R0.x, R0, c[9];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.z, R0.y;\n" + "MUL R0.y, R0.x, c[9].x;\n" + "MUL R0.z, R0, c[9].y;\n" + "MAD R0.x, R0.y, R0.y, -R0.z;\n" + "RSQ R0.z, R0.x;\n" + "MOV R0.x, c[9];\n" + "MUL R0.w, R0.x, c[1].x;\n" "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0, R0.z;\n" + "ADD R0.x, -R0.y, R0.z;\n" + "RCP R0.y, R0.w;\n" "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.y, c[9].x;\n" - "MUL R0.y, R0, c[1].x;\n" - "RCP R0.y, R0.y;\n" "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[2], 1D;\n" "MUL R2.xyz, R0.w, R1;\n" @@ -1409,24 +1408,24 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" + "MUL R0.y, R0.x, c[9].x;\n" + "MOV R0.x, c[9];\n" "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.z, R0, c[9].y;\n" + "MAD R0.z, R0.y, R0.y, -R0;\n" "MUL R1.xy, fragment.position, c[6];\n" "TEX R1, R1, texture[0], 2D;\n" - "MUL R0.y, R0.z, c[9];\n" - "MUL R0.x, R0, c[9];\n" - "MAD R0.z, R0.x, R0.x, -R0.y;\n" - "MOV R0.y, c[9].x;\n" + "MUL R0.w, R0.x, c[1].x;\n" "RSQ R0.z, R0.z;\n" - "RCP R0.z, R0.z;\n" - "MUL R0.y, R0, c[1].x;\n" - "ADD R0.x, -R0, R0.z;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.x, R0, R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" + "RCP R0.x, R0.z;\n" "ADD R2.w, -R1, c[9].z;\n" + "RCP R0.z, R0.w;\n" + "ADD R0.x, -R0.y, R0;\n" + "MUL R0.x, R0, R0.z;\n" + "TEX R0, R0, texture[2], 1D;\n" "ADD R3.xyz, R0.w, -R0;\n" "ADD R2.xyz, R1.w, -R1;\n" "MUL R2.xyz, R2, R3;\n" @@ -1458,7 +1457,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "!!ARBfp1.0\n" "PARAM c[11] = { program.local[0..8],\n" " { 2, 4, 1, 9.9999997e-006 },\n" - " { 3, 8 } };\n" + " { 8, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -1470,65 +1469,65 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MAD R0.xyz, fragment.position.x, c[2], R0;\n" "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" + "MUL R1.xy, fragment.position, c[6];\n" + "TEX R1, R1, texture[0], 2D;\n" + "MAX R0.w, R1, c[9];\n" + "RCP R2.w, R0.w;\n" + "MUL R5.xyz, R1, R2.w;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" + "MUL R0.y, R0.x, c[9].x;\n" + "MOV R0.x, c[9];\n" + "RSQ R2.x, R5.x;\n" + "RSQ R2.z, R5.z;\n" + "RSQ R2.y, R5.y;\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[9];\n" - "MUL R0.x, R0, c[9];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[9].x;\n" - "MUL R1.y, R0.z, c[1].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "ADD R1.x, -R0, R0.y;\n" - "RCP R1.y, R1.y;\n" - "MUL R0.xy, fragment.position, c[6];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.z, R0.w, c[9].w;\n" - "RCP R2.w, R1.z;\n" - "MUL R2.xyz, R0, R2.w;\n" - "MAD R6.xyz, -R2, c[10].y, c[10].x;\n" - "MAD R3.xyz, -R0, R2.w, c[9].z;\n" - "RSQ R2.w, R2.x;\n" - "RCP R2.x, R2.w;\n" - "MUL R1.x, R1, R1.y;\n" - "TEX R1, R1, texture[2], 1D;\n" - "MAD R4.xyz, R1, c[9].x, -R1.w;\n" - "MUL R5.xyz, R3, R4;\n" - "MAD R5.xyz, -R5, R6, R1.w;\n" - "MAD R3.xyz, -R3, R4, R1.w;\n" - "RSQ R2.z, R2.z;\n" - "RSQ R2.y, R2.y;\n" - "MUL R5.xyz, R0, R5;\n" - "MUL R3.xyz, R0, R3;\n" - "ADD R2.w, -R0, c[9].z;\n" + "MUL R0.z, R0, c[9].y;\n" + "MAD R0.z, R0.y, R0.y, -R0;\n" + "MUL R0.w, R0.x, c[1].x;\n" + "RSQ R0.z, R0.z;\n" + "RCP R0.x, R0.z;\n" + "RCP R0.z, R0.w;\n" + "ADD R0.x, -R0.y, R0;\n" + "MUL R0.x, R0, R0.z;\n" + "TEX R0, R0, texture[2], 1D;\n" + "MAD R3.xyz, R0, c[9].x, -R0.w;\n" + "MAD R6.xyz, -R5, c[10].x, c[10].y;\n" + "RCP R2.x, R2.x;\n" "RCP R2.z, R2.z;\n" "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R0.w, R2, -R0;\n" - "MUL R2.xyz, R2, R4;\n" - "MAD R2.xyz, R1.w, R0, R2;\n" - "ADD R6.xyz, R2, -R5;\n" - "MUL R4.xyz, R1, c[9].x;\n" - "MUL R2.xyz, R0, c[10].y;\n" - "SGE R2.xyz, R2, R0.w;\n" - "MAD R2.xyz, R2, R6, R5;\n" + "MAD R2.xyz, R1.w, R2, -R1;\n" + "MUL R2.xyz, R3, R2;\n" + "MAD R4.xyz, R0.w, R1, R2;\n" + "MAD R2.xyz, -R1, R2.w, c[9].z;\n" + "MUL R5.xyz, R2, R3;\n" + "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R5.xyz, -R1, R6, R4;\n" + "MAD R2.xyz, -R2, R3, R0.w;\n" + "MUL R3.xyz, R0, c[9].x;\n" + "MUL R4.xyz, R1, c[10].x;\n" + "SGE R3.xyz, R3, R0.w;\n" + "ADD R2.w, -R1, c[9].z;\n" + "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "ADD R2.xyz, R2, -R3;\n" - "MAD R2.xyz, R4, R2, R3;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[9].z;\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[7];\n" - "MUL R1.xy, R1, c[5];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[8];\n" - "MAD result.color, R1.x, R2, R0;\n" + "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, -R1, R2, R4;\n" + "MUL R2.xyz, R1, R2;\n" + "MAD R2.xyz, R3, R4, R2;\n" + "MAD R2.xyz, R0, R2.w, R2;\n" + "ADD R0.x, -R0.w, c[9].z;\n" + "MAD R2.xyz, R1, R0.x, R2;\n" + "ADD R0.z, R0.w, R1.w;\n" + "MAD R2.w, -R0, R1, R0.z;\n" + "ADD R0.xy, fragment.position, c[7];\n" + "MUL R0.xy, R0, c[5];\n" + "TEX R0, R0, texture[1], 2D;\n" + "ADD R2, R2, -R1;\n" + "DP4 R0.x, R0, c[8];\n" + "MAD result.color, R0.x, R2, R1;\n" "END\n" ; @@ -1643,23 +1642,23 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[8];\n" - "MUL R0.x, R0, c[8];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.z, R0.y;\n" - "ADD R0.x, -R0, R0.z;\n" + "MUL R0.y, R0.x, c[8].x;\n" + "MUL R0.z, R0, c[8].y;\n" + "MAD R0.x, R0.y, R0.y, -R0.z;\n" + "RSQ R0.x, R0.x;\n" + "RCP R0.z, R0.x;\n" + "ADD R0.y, -R0, R0.z;\n" "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" "MUL R2.xyz, R1, c[5].y;\n" - "MOV R0.y, c[8].x;\n" - "MUL R0.y, R0, c[1].x;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.x, R0, R0.y;\n" + "MOV R0.x, c[8];\n" + "MUL R0.x, R0, c[1];\n" + "RCP R0.x, R0.x;\n" + "MUL R0.x, R0.y, R0;\n" "TEX R0, R0, texture[1], 1D;\n" "MUL R3.xyz, R0.w, R2;\n" "MUL R2.xyz, R0, c[5].x;\n" @@ -1690,22 +1689,22 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[6];\n" - "MUL R0.x, R0, c[6];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.z, R0.y;\n" - "ADD R0.x, -R0, R0.z;\n" + "MUL R0.y, R0.x, c[6].x;\n" + "MUL R0.z, R0, c[6].y;\n" + "MAD R0.x, R0.y, R0.y, -R0.z;\n" + "RSQ R0.x, R0.x;\n" + "RCP R0.z, R0.x;\n" + "ADD R0.y, -R0, R0.z;\n" "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.y, c[6].x;\n" - "MUL R0.y, R0, c[1].x;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.x, R0, R0.y;\n" + "MOV R0.x, c[6];\n" + "MUL R0.x, R0, c[1];\n" + "RCP R0.x, R0.x;\n" + "MUL R0.x, R0.y, R0;\n" "TEX R0, R0, texture[1], 1D;\n" "ADD R2.x, -R1.w, c[6].z;\n" "MUL R2.xyz, R0, R2.x;\n" @@ -1734,16 +1733,16 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[6];\n" - "MUL R0.x, R0, c[6];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.z, R0.y;\n" + "MUL R0.y, R0.x, c[6].x;\n" + "MUL R0.z, R0, c[6].y;\n" + "MAD R0.x, R0.y, R0.y, -R0.z;\n" + "RSQ R0.z, R0.x;\n" + "MOV R0.x, c[6];\n" + "MUL R0.w, R0.x, c[1].x;\n" "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0, R0.z;\n" + "ADD R0.x, -R0.y, R0.z;\n" + "RCP R0.y, R0.w;\n" "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "MOV R0.y, c[6].x;\n" - "MUL R0.y, R0, c[1].x;\n" - "RCP R0.y, R0.y;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" @@ -1766,27 +1765,27 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" + "MUL R0.y, R0.x, c[6].x;\n" + "MOV R0.x, c[6];\n" "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.z, R0, c[6].y;\n" + "MAD R0.z, R0.y, R0.y, -R0;\n" "MUL R1.xy, fragment.position, c[5];\n" "TEX R1, R1, texture[0], 2D;\n" - "MUL R0.y, R0.z, c[6];\n" - "MUL R0.x, R0, c[6];\n" - "MAD R0.z, R0.x, R0.x, -R0.y;\n" - "MOV R0.y, c[6].x;\n" + "MUL R0.w, R0.x, c[1].x;\n" "RSQ R0.z, R0.z;\n" - "RCP R0.z, R0.z;\n" - "MUL R0.y, R0, c[1].x;\n" - "ADD R0.x, -R0, R0.z;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.x, R0, R0.y;\n" + "RCP R0.x, R0.z;\n" + "ADD R2.w, -R1, c[6].z;\n" + "RCP R0.z, R0.w;\n" + "ADD R0.x, -R0.y, R0;\n" + "MUL R0.x, R0, R0.z;\n" "TEX R0, R0, texture[1], 1D;\n" "ADD R3.xyz, R0.w, -R0;\n" "ADD R2.xyz, R1.w, -R1;\n" "MUL R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[6].z;\n" "MUL R2.xyz, R2, c[6].x;\n" "MAD R2.xyz, R0.w, R1.w, -R2;\n" "MAD R2.xyz, R0, R2.w, R2;\n" @@ -1823,17 +1822,17 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[6];\n" - "MUL R0.x, R0, c[6];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.z, R0.y;\n" + "MUL R0.y, R0.x, c[6].x;\n" + "MUL R0.z, R0, c[6].y;\n" + "MAD R0.x, R0.y, R0.y, -R0.z;\n" + "RSQ R0.z, R0.x;\n" + "MOV R0.x, c[6];\n" + "MUL R0.w, R0.x, c[1].x;\n" "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0, R0.z;\n" + "ADD R0.x, -R0.y, R0.z;\n" + "RCP R0.y, R0.w;\n" "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.y, c[6].x;\n" - "MUL R0.y, R0, c[1].x;\n" - "RCP R0.y, R0.y;\n" "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" "MUL R2.xyz, R0, R1.w;\n" @@ -1866,17 +1865,17 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[6];\n" - "MUL R0.x, R0, c[6];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.z, R0.y;\n" + "MUL R0.y, R0.x, c[6].x;\n" + "MUL R0.z, R0, c[6].y;\n" + "MAD R0.x, R0.y, R0.y, -R0.z;\n" + "RSQ R0.z, R0.x;\n" + "MOV R0.x, c[6];\n" + "MUL R0.w, R0.x, c[1].x;\n" "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0, R0.z;\n" + "ADD R0.x, -R0.y, R0.z;\n" + "RCP R0.y, R0.w;\n" "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.y, c[6].x;\n" - "MUL R0.y, R0, c[1].x;\n" - "RCP R0.y, R0.y;\n" "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" "MUL R2.xyz, R0, R1.w;\n" @@ -1905,20 +1904,20 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" + "MUL R0.y, R0.x, c[6].x;\n" + "MOV R0.x, c[6];\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[6];\n" - "MUL R0.x, R0, c[6];\n" - "MAD R0.z, R0.x, R0.x, -R0.y;\n" - "MOV R0.y, c[6].x;\n" + "MUL R0.z, R0, c[6].y;\n" + "MAD R0.z, R0.y, R0.y, -R0;\n" + "MUL R0.w, R0.x, c[1].x;\n" "RSQ R0.z, R0.z;\n" - "RCP R0.z, R0.z;\n" - "MUL R0.y, R0, c[1].x;\n" - "ADD R0.x, -R0, R0.z;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.x, R0, R0.y;\n" + "RCP R0.x, R0.z;\n" + "RCP R0.z, R0.w;\n" + "ADD R0.x, -R0.y, R0;\n" + "MUL R0.x, R0, R0.z;\n" "TEX R0, R0, texture[1], 1D;\n" "MAX R1.x, R0.w, c[6].w;\n" "RCP R1.x, R1.x;\n" @@ -1966,17 +1965,17 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[6];\n" - "MUL R0.x, R0, c[6];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.z, R0.y;\n" + "MUL R0.y, R0.x, c[6].x;\n" + "MUL R0.z, R0, c[6].y;\n" + "MAD R0.x, R0.y, R0.y, -R0.z;\n" + "RSQ R0.z, R0.x;\n" + "MOV R0.x, c[6];\n" + "MUL R0.w, R0.x, c[1].x;\n" "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0, R0.z;\n" + "ADD R0.x, -R0.y, R0.z;\n" + "RCP R0.y, R0.w;\n" "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.y, c[6].x;\n" - "MUL R0.y, R0, c[1].x;\n" - "RCP R0.y, R0.y;\n" "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" "MUL R2.xyz, R0.w, R1;\n" @@ -2018,24 +2017,24 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" + "MUL R0.y, R0.x, c[6].x;\n" + "MOV R0.x, c[6];\n" "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.z, R0, c[6].y;\n" + "MAD R0.z, R0.y, R0.y, -R0;\n" "MUL R1.xy, fragment.position, c[5];\n" "TEX R1, R1, texture[0], 2D;\n" - "MUL R0.y, R0.z, c[6];\n" - "MUL R0.x, R0, c[6];\n" - "MAD R0.z, R0.x, R0.x, -R0.y;\n" - "MOV R0.y, c[6].x;\n" + "MUL R0.w, R0.x, c[1].x;\n" "RSQ R0.z, R0.z;\n" - "RCP R0.z, R0.z;\n" - "MUL R0.y, R0, c[1].x;\n" - "ADD R0.x, -R0, R0.z;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.x, R0, R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" + "RCP R0.x, R0.z;\n" "ADD R2.w, -R1, c[6].z;\n" + "RCP R0.z, R0.w;\n" + "ADD R0.x, -R0.y, R0;\n" + "MUL R0.x, R0, R0.z;\n" + "TEX R0, R0, texture[1], 1D;\n" "ADD R3.xyz, R0.w, -R0;\n" "ADD R2.xyz, R1.w, -R1;\n" "MUL R2.xyz, R2, R3;\n" @@ -2061,7 +2060,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "!!ARBfp1.0\n" "PARAM c[8] = { program.local[0..5],\n" " { 2, 4, 1, 9.9999997e-006 },\n" - " { 3, 8 } };\n" + " { 8, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2073,59 +2072,59 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MAD R0.xyz, fragment.position.x, c[2], R0;\n" "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" + "MUL R1.xy, fragment.position, c[5];\n" + "TEX R1, R1, texture[0], 2D;\n" + "MAX R0.w, R1, c[6];\n" + "RCP R2.w, R0.w;\n" + "MUL R5.xyz, R1, R2.w;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" + "MUL R0.y, R0.x, c[6].x;\n" + "MOV R0.x, c[6];\n" + "RSQ R2.x, R5.x;\n" + "RSQ R2.z, R5.z;\n" + "RSQ R2.y, R5.y;\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[6];\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[6];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "MAX R0.z, R1.w, c[6].w;\n" - "RCP R2.w, R0.z;\n" - "MUL R2.xyz, R1, R2.w;\n" - "MAD R6.xyz, -R2, c[7].y, c[7].x;\n" - "MAD R3.xyz, -R1, R2.w, c[6].z;\n" - "RSQ R2.w, R2.x;\n" - "RCP R2.x, R2.w;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "ADD R0.x, -R0, R0.y;\n" - "MOV R0.y, c[6].x;\n" - "MUL R0.y, R0, c[1].x;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.x, R0, R0.y;\n" + "MUL R0.z, R0, c[6].y;\n" + "MAD R0.z, R0.y, R0.y, -R0;\n" + "MUL R0.w, R0.x, c[1].x;\n" + "RSQ R0.z, R0.z;\n" + "RCP R0.x, R0.z;\n" + "RCP R0.z, R0.w;\n" + "ADD R0.x, -R0.y, R0;\n" + "MUL R0.x, R0, R0.z;\n" "TEX R0, R0, texture[1], 1D;\n" - "MAD R4.xyz, R0, c[6].x, -R0.w;\n" - "MUL R5.xyz, R3, R4;\n" - "MAD R5.xyz, -R5, R6, R0.w;\n" - "MAD R3.xyz, -R3, R4, R0.w;\n" - "RSQ R2.z, R2.z;\n" - "RSQ R2.y, R2.y;\n" - "MUL R5.xyz, R1, R5;\n" - "MUL R3.xyz, R1, R3;\n" + "MAD R3.xyz, R0, c[6].x, -R0.w;\n" + "MAD R6.xyz, -R5, c[7].x, c[7].y;\n" + "RCP R2.x, R2.x;\n" "RCP R2.z, R2.z;\n" "RCP R2.y, R2.y;\n" "MAD R2.xyz, R1.w, R2, -R1;\n" - "MUL R2.xyz, R2, R4;\n" - "MAD R2.xyz, R0.w, R1, R2;\n" - "ADD R6.xyz, R2, -R5;\n" - "MUL R4.xyz, R0, c[6].x;\n" - "MUL R2.xyz, R1, c[7].y;\n" - "SGE R2.xyz, R2, R1.w;\n" - "MAD R2.xyz, R2, R6, R5;\n" - "ADD R2.xyz, R2, -R3;\n" - "SGE R4.xyz, R4, R0.w;\n" - "MAD R2.xyz, R4, R2, R3;\n" + "MUL R2.xyz, R3, R2;\n" + "MAD R4.xyz, R0.w, R1, R2;\n" + "MAD R2.xyz, -R1, R2.w, c[6].z;\n" + "MUL R5.xyz, R2, R3;\n" + "MAD R2.xyz, -R2, R3, R0.w;\n" + "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R5.xyz, -R1, R6, R4;\n" + "MUL R3.xyz, R0, c[6].x;\n" + "MUL R4.xyz, R1, c[7].x;\n" + "MUL R6.xyz, R1, R6;\n" + "SGE R4.xyz, R4, R1.w;\n" + "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, -R1, R2, R4;\n" + "MUL R2.xyz, R1, R2;\n" + "SGE R3.xyz, R3, R0.w;\n" + "MAD R2.xyz, R3, R4, R2;\n" "ADD R2.w, -R1, c[6].z;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[6].z;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" + "MAD R2.xyz, R0, R2.w, R2;\n" + "ADD R0.x, R0.w, R1.w;\n" + "ADD R0.y, -R0.w, c[6].z;\n" + "MAD result.color.xyz, R1, R0.y, R2;\n" + "MAD result.color.w, -R0, R1, R0.x;\n" "END\n" ; @@ -2147,16 +2146,16 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[6];\n" - "MUL R0.x, R0, c[6];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.z, R0.y;\n" + "MUL R0.y, R0.x, c[6].x;\n" + "MUL R0.z, R0, c[6].y;\n" + "MAD R0.x, R0.y, R0.y, -R0.z;\n" + "RSQ R0.z, R0.x;\n" + "MOV R0.x, c[6];\n" + "MUL R0.w, R0.x, c[1].x;\n" "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0, R0.z;\n" + "ADD R0.x, -R0.y, R0.z;\n" + "RCP R0.y, R0.w;\n" "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "MOV R0.y, c[6].x;\n" - "MUL R0.y, R0, c[1].x;\n" - "RCP R0.y, R0.y;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" @@ -2188,17 +2187,17 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[6];\n" - "MUL R0.x, R0, c[6];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.z, R0.y;\n" + "MUL R0.y, R0.x, c[6].x;\n" + "MUL R0.z, R0, c[6].y;\n" + "MAD R0.x, R0.y, R0.y, -R0.z;\n" + "RSQ R0.z, R0.x;\n" + "MOV R0.x, c[6];\n" + "MUL R0.w, R0.x, c[1].x;\n" "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0, R0.z;\n" + "ADD R0.x, -R0.y, R0.z;\n" + "RCP R0.y, R0.w;\n" "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.y, c[6].x;\n" - "MUL R0.y, R0, c[1].x;\n" - "RCP R0.y, R0.y;\n" "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" "MUL R2.xyz, R0.w, R1;\n" @@ -2226,8 +2225,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" "MUL R0.z, -R0, c[1].x;\n" "MUL R0.y, R0.z, c[8];\n" @@ -2236,12 +2235,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "RSQ R0.y, R0.y;\n" "RCP R0.y, R0.y;\n" "ADD R1.x, -R0, R0.y;\n" - "MOV R0.z, c[8].x;\n" - "MUL R0.z, R0, c[1].x;\n" - "RCP R1.y, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" + "MOV R0.x, c[8];\n" + "MUL R0.x, R0, c[1];\n" + "RCP R1.y, R0.x;\n" + "ADD R0.zw, fragment.position.xyxy, c[6].xyxy;\n" + "MUL R0.zw, R0, c[5].xyxy;\n" + "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1.x, R1, R1.y;\n" "DP4 R1.y, R0, c[7];\n" "TEX R0, R1, texture[1], 1D;\n" @@ -2261,19 +2260,19 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" "ADD R0.z, R0, R0.w;\n" + "ADD R0.x, R0, R0.y;\n" "MUL R0.z, -R0, c[1].x;\n" "MUL R0.y, R0.z, c[5];\n" "MUL R0.x, R0, c[5];\n" "MAD R0.z, R0.x, R0.x, -R0.y;\n" "MOV R0.y, c[5].x;\n" "RSQ R0.z, R0.z;\n" - "MUL R0.y, R0, c[1].x;\n" - "RCP R0.z, R0.z;\n" - "RCP R0.y, R0.y;\n" - "ADD R0.x, -R0, R0.z;\n" - "MUL R0.x, R0, R0.y;\n" + "MUL R0.w, R0.y, c[1].x;\n" + "RCP R0.y, R0.z;\n" + "RCP R0.z, R0.w;\n" + "ADD R0.x, -R0, R0.y;\n" + "MUL R0.x, R0, R0.z;\n" "TEX result.color, R0, texture[0], 1D;\n" "END\n" ; @@ -2281,9 +2280,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SIMPLE_PORTER_DUFF = "!!ARBfp1.0\n" "PARAM c[13] = { program.local[0..9],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565, 1 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2350,9 +2349,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_MULTIPLY = "!!ARBfp1.0\n" "PARAM c[11] = { program.local[0..7],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565, 1 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2411,9 +2410,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SCREEN = "!!ARBfp1.0\n" "PARAM c[11] = { program.local[0..7],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2468,9 +2467,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_OVERLAY = "!!ARBfp1.0\n" "PARAM c[11] = { program.local[0..7],\n" - " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" - " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" - " { 3.1415927, 0.15915494, 2, 1 } };\n" + " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" + " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" + " { 3.141593, 0.15915494, 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2543,9 +2542,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DARKEN = "!!ARBfp1.0\n" "PARAM c[11] = { program.local[0..7],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565, 1 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2607,9 +2606,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_LIGHTEN = "!!ARBfp1.0\n" "PARAM c[11] = { program.local[0..7],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565, 1 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2671,9 +2670,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORDODGE = "!!ARBfp1.0\n" "PARAM c[11] = { program.local[0..7],\n" - " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" - " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" - " { 3.1415927, 0.15915494, 1, 1e-006 } };\n" + " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" + " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" + " { 3.141593, 0.15915494, 1, 1e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2748,9 +2747,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORBURN = "!!ARBfp1.0\n" "PARAM c[11] = { program.local[0..7],\n" - " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" - " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" - " { 3.1415927, 0.15915494, 1, 9.9999997e-006 } };\n" + " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" + " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" + " { 3.141593, 0.15915494, 1, 9.9999997e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2762,16 +2761,16 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" + "ABS R0.w, R0.x;\n" + "ABS R0.z, R0.y;\n" + "ADD R0.z, R0, -R0.w;\n" "ADD R1.x, R0.y, c[8];\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" + "ABS R0.z, R0;\n" + "CMP R0.y, -R0.z, R0, R1.x;\n" + "ABS R0.z, -R0.y;\n" + "MAX R1.x, R0.w, R0.z;\n" "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" + "MIN R1.x, R0.w, R0.z;\n" "MUL R1.x, R1, R1.y;\n" "MUL R1.y, R1.x, R1.x;\n" "MAD R1.z, R1.y, c[8].y, c[8];\n" @@ -2780,8 +2779,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "MAD R1.z, R1, R1.y, -c[9].y;\n" "MAD R1.y, R1.z, R1, c[9].z;\n" "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" "ADD R1.y, -R1.x, c[9].w;\n" + "ADD R0.z, -R0.w, R0;\n" "CMP R0.z, -R0, R1.y, R1.x;\n" "ADD R0.w, -R0.z, c[10].x;\n" "CMP R0.x, R0, R0.w, R0.z;\n" @@ -2826,9 +2825,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_HARDLIGHT = "!!ARBfp1.0\n" "PARAM c[11] = { program.local[0..7],\n" - " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" - " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" - " { 3.1415927, 0.15915494, 2, 1 } };\n" + " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" + " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" + " { 3.141593, 0.15915494, 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2901,10 +2900,10 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[12] = { program.local[0..7],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565, 1, 9.9999997e-006 },\n" - " { 2, 3, 8 } };\n" + " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" + " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" + " { 3.141593, 0.15915494, 1, 2 },\n" + " { 9.9999997e-006, 8, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2917,86 +2916,86 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[8].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" + "ABS R0.w, R0.x;\n" + "ABS R0.z, R0.y;\n" + "ADD R0.z, R0, -R0.w;\n" + "ADD R1.x, R0.y, c[8];\n" + "ABS R0.z, R0;\n" + "CMP R0.y, -R0.z, R0, R1.x;\n" + "ABS R0.z, -R0.y;\n" + "MAX R1.x, R0.w, R0.z;\n" "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" + "MIN R1.x, R0.w, R0.z;\n" "MUL R1.x, R1, R1.y;\n" "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[9].x, c[9].y;\n" - "MAD R1.z, R1, R1.y, -c[9];\n" - "MAD R1.z, R1, R1.y, c[9].w;\n" - "MAD R1.z, R1, R1.y, -c[10].x;\n" - "MAD R1.y, R1.z, R1, c[10];\n" + "MAD R1.z, R1.y, c[8].y, c[8];\n" + "MAD R1.z, R1, R1.y, -c[8].w;\n" + "MAD R1.z, R1, R1.y, c[9].x;\n" + "MAD R1.z, R1, R1.y, -c[9].y;\n" + "MAD R1.y, R1.z, R1, c[9].z;\n" "MUL R1.x, R1.y, R1;\n" - "ADD R1.y, -R1.x, c[8].w;\n" - "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[9].w;\n" + "ADD R0.z, -R0.w, R0;\n" "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[8].z;\n" + "ADD R0.w, -R0.z, c[10].x;\n" "CMP R0.x, R0, R0.w, R0.z;\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" "CMP R0.x, -R0.y, -R0, R0;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MAX R0.y, R1.w, c[11].x;\n" + "RCP R2.w, R0.y;\n" + "MUL R5.xyz, R1, R2.w;\n" + "RSQ R2.x, R5.x;\n" + "RSQ R2.z, R5.z;\n" + "RSQ R2.y, R5.y;\n" "ADD R0.x, R0, c[0];\n" - "MUL R1.x, R0, c[8];\n" - "FLR R1.y, R1.x;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MAX R2.x, R0.w, c[10].w;\n" - "RCP R2.w, R2.x;\n" - "MUL R2.xyz, R0, R2.w;\n" - "MAD R6.xyz, -R2, c[11].z, c[11].y;\n" - "MAD R3.xyz, -R0, R2.w, c[10].z;\n" - "RSQ R2.w, R2.x;\n" - "RCP R2.x, R2.w;\n" - "ADD R1.x, R1, -R1.y;\n" - "TEX R1, R1, texture[2], 1D;\n" - "MAD R4.xyz, R1, c[11].x, -R1.w;\n" - "MUL R5.xyz, R3, R4;\n" - "MAD R5.xyz, -R5, R6, R1.w;\n" - "MAD R3.xyz, -R3, R4, R1.w;\n" - "RSQ R2.z, R2.z;\n" - "RSQ R2.y, R2.y;\n" - "MUL R5.xyz, R0, R5;\n" - "MUL R3.xyz, R0, R3;\n" - "ADD R2.w, -R0, c[10].z;\n" + "MUL R0.x, R0, c[10].y;\n" + "FLR R0.y, R0.x;\n" + "ADD R0.x, R0, -R0.y;\n" + "TEX R0, R0, texture[2], 1D;\n" + "MAD R3.xyz, R0, c[10].w, -R0.w;\n" + "MAD R6.xyz, -R5, c[11].y, c[11].z;\n" + "RCP R2.x, R2.x;\n" "RCP R2.z, R2.z;\n" "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R0.w, R2, -R0;\n" - "MUL R2.xyz, R2, R4;\n" - "MAD R2.xyz, R1.w, R0, R2;\n" - "ADD R6.xyz, R2, -R5;\n" - "MUL R4.xyz, R1, c[11].x;\n" - "MUL R2.xyz, R0, c[11].z;\n" - "SGE R2.xyz, R2, R0.w;\n" - "MAD R2.xyz, R2, R6, R5;\n" + "MAD R2.xyz, R1.w, R2, -R1;\n" + "MUL R2.xyz, R3, R2;\n" + "MAD R4.xyz, R0.w, R1, R2;\n" + "MAD R2.xyz, -R1, R2.w, c[10].z;\n" + "MUL R5.xyz, R2, R3;\n" + "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R5.xyz, -R1, R6, R4;\n" + "MAD R2.xyz, -R2, R3, R0.w;\n" + "MUL R3.xyz, R0, c[10].w;\n" + "MUL R4.xyz, R1, c[11].y;\n" + "SGE R3.xyz, R3, R0.w;\n" + "ADD R2.w, -R1, c[10].z;\n" + "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "ADD R2.xyz, R2, -R3;\n" - "MAD R2.xyz, R4, R2, R3;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[10].z;\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" + "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, -R1, R2, R4;\n" + "MUL R2.xyz, R1, R2;\n" + "MAD R2.xyz, R3, R4, R2;\n" + "MAD R2.xyz, R0, R2.w, R2;\n" + "ADD R0.x, -R0.w, c[10].z;\n" + "MAD R2.xyz, R1, R0.x, R2;\n" + "ADD R0.z, R0.w, R1.w;\n" + "MAD R2.w, -R0, R1, R0.z;\n" + "ADD R0.xy, fragment.position, c[6];\n" + "MUL R0.xy, R0, c[4];\n" + "TEX R0, R0, texture[1], 2D;\n" + "ADD R2, R2, -R1;\n" + "DP4 R0.x, R0, c[7];\n" + "MAD result.color, R0.x, R2, R1;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DIFFERENCE = "!!ARBfp1.0\n" "PARAM c[11] = { program.local[0..7],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565, 2 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3056,9 +3055,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_EXCLUSION = "!!ARBfp1.0\n" "PARAM c[11] = { program.local[0..7],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565, 2, 1 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559, 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3121,9 +3120,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK = "!!ARBfp1.0\n" "PARAM c[10] = { program.local[0..6],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565, 1 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3184,9 +3183,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_MULTIPLY_NOMASK = "!!ARBfp1.0\n" "PARAM c[8] = { program.local[0..4],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565, 1 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3239,9 +3238,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SCREEN_NOMASK = "!!ARBfp1.0\n" "PARAM c[8] = { program.local[0..4],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3289,9 +3288,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_OVERLAY_NOMASK = "!!ARBfp1.0\n" "PARAM c[8] = { program.local[0..4],\n" - " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" - " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" - " { 3.1415927, 0.15915494, 2, 1 } };\n" + " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" + " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" + " { 3.141593, 0.15915494, 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3357,9 +3356,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DARKEN_NOMASK = "!!ARBfp1.0\n" "PARAM c[8] = { program.local[0..4],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565, 1 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3415,9 +3414,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_LIGHTEN_NOMASK = "!!ARBfp1.0\n" "PARAM c[8] = { program.local[0..4],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565, 1 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3473,9 +3472,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORDODGE_NOMASK = "!!ARBfp1.0\n" "PARAM c[8] = { program.local[0..4],\n" - " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" - " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" - " { 3.1415927, 0.15915494, 1, 1e-006 } };\n" + " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" + " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" + " { 3.141593, 0.15915494, 1, 1e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3543,9 +3542,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORBURN_NOMASK = "!!ARBfp1.0\n" "PARAM c[8] = { program.local[0..4],\n" - " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" - " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" - " { 3.1415927, 0.15915494, 1, 9.9999997e-006 } };\n" + " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" + " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" + " { 3.141593, 0.15915494, 1, 9.9999997e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3557,16 +3556,16 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" + "ABS R0.w, R0.x;\n" + "ABS R0.z, R0.y;\n" + "ADD R0.z, R0, -R0.w;\n" "ADD R1.x, R0.y, c[5];\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" + "ABS R0.z, R0;\n" + "CMP R0.y, -R0.z, R0, R1.x;\n" + "ABS R0.z, -R0.y;\n" + "MAX R1.x, R0.w, R0.z;\n" "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" + "MIN R1.x, R0.w, R0.z;\n" "MUL R1.x, R1, R1.y;\n" "MUL R1.y, R1.x, R1.x;\n" "MAD R1.z, R1.y, c[5].y, c[5];\n" @@ -3575,8 +3574,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "MAD R1.z, R1, R1.y, -c[6].y;\n" "MAD R1.y, R1.z, R1, c[6].z;\n" "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" "ADD R1.y, -R1.x, c[6].w;\n" + "ADD R0.z, -R0.w, R0;\n" "CMP R0.z, -R0, R1.y, R1.x;\n" "ADD R0.w, -R0.z, c[7].x;\n" "CMP R0.x, R0, R0.w, R0.z;\n" @@ -3615,9 +3614,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_HARDLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[8] = { program.local[0..4],\n" - " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" - " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" - " { 3.1415927, 0.15915494, 2, 1 } };\n" + " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" + " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" + " { 3.141593, 0.15915494, 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3684,10 +3683,10 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..4],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565, 1, 9.9999997e-006 },\n" - " { 2, 3, 8 } };\n" + " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" + " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" + " { 3.141593, 0.15915494, 1, 2 },\n" + " { 9.9999997e-006, 8, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3700,80 +3699,80 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[5].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" + "ABS R0.w, R0.x;\n" + "ABS R0.z, R0.y;\n" + "ADD R0.z, R0, -R0.w;\n" + "ADD R1.x, R0.y, c[5];\n" + "ABS R0.z, R0;\n" + "CMP R0.y, -R0.z, R0, R1.x;\n" + "ABS R0.z, -R0.y;\n" + "MAX R1.x, R0.w, R0.z;\n" "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" + "MIN R1.x, R0.w, R0.z;\n" "MUL R1.x, R1, R1.y;\n" "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[6].x, c[6].y;\n" - "MAD R1.z, R1, R1.y, -c[6];\n" - "MAD R1.z, R1, R1.y, c[6].w;\n" - "MAD R1.z, R1, R1.y, -c[7].x;\n" - "MAD R1.y, R1.z, R1, c[7];\n" + "MAD R1.z, R1.y, c[5].y, c[5];\n" + "MAD R1.z, R1, R1.y, -c[5].w;\n" + "MAD R1.z, R1, R1.y, c[6].x;\n" + "MAD R1.z, R1, R1.y, -c[6].y;\n" + "MAD R1.y, R1.z, R1, c[6].z;\n" "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" - "ADD R1.y, -R1.x, c[5].w;\n" + "ADD R1.y, -R1.x, c[6].w;\n" + "ADD R0.z, -R0.w, R0;\n" "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[5].z;\n" + "ADD R0.w, -R0.z, c[7].x;\n" "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MAX R2.x, R1.w, c[7].w;\n" - "RCP R2.w, R2.x;\n" - "MUL R2.xyz, R1, R2.w;\n" - "MAD R6.xyz, -R2, c[8].z, c[8].y;\n" - "MAD R3.xyz, -R1, R2.w, c[7].z;\n" - "RSQ R2.w, R2.x;\n" - "RCP R2.x, R2.w;\n" + "MAX R0.y, R1.w, c[8].x;\n" + "RCP R2.w, R0.y;\n" + "MUL R5.xyz, R1, R2.w;\n" + "RSQ R2.x, R5.x;\n" + "RSQ R2.z, R5.z;\n" + "RSQ R2.y, R5.y;\n" "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[5];\n" + "MUL R0.x, R0, c[7].y;\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "MAD R4.xyz, R0, c[8].x, -R0.w;\n" - "MUL R5.xyz, R3, R4;\n" - "MAD R5.xyz, -R5, R6, R0.w;\n" - "MAD R3.xyz, -R3, R4, R0.w;\n" - "RSQ R2.z, R2.z;\n" - "RSQ R2.y, R2.y;\n" - "MUL R5.xyz, R1, R5;\n" - "MUL R3.xyz, R1, R3;\n" + "MAD R3.xyz, R0, c[7].w, -R0.w;\n" + "MAD R6.xyz, -R5, c[8].y, c[8].z;\n" + "RCP R2.x, R2.x;\n" "RCP R2.z, R2.z;\n" "RCP R2.y, R2.y;\n" "MAD R2.xyz, R1.w, R2, -R1;\n" - "MUL R2.xyz, R2, R4;\n" - "MAD R2.xyz, R0.w, R1, R2;\n" - "ADD R6.xyz, R2, -R5;\n" - "MUL R4.xyz, R0, c[8].x;\n" - "MUL R2.xyz, R1, c[8].z;\n" - "SGE R2.xyz, R2, R1.w;\n" - "MAD R2.xyz, R2, R6, R5;\n" - "ADD R2.xyz, R2, -R3;\n" - "SGE R4.xyz, R4, R0.w;\n" - "MAD R2.xyz, R4, R2, R3;\n" + "MUL R2.xyz, R3, R2;\n" + "MAD R4.xyz, R0.w, R1, R2;\n" + "MAD R2.xyz, -R1, R2.w, c[7].z;\n" + "MUL R5.xyz, R2, R3;\n" + "MAD R2.xyz, -R2, R3, R0.w;\n" + "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R5.xyz, -R1, R6, R4;\n" + "MUL R3.xyz, R0, c[7].w;\n" + "MUL R4.xyz, R1, c[8].y;\n" + "MUL R6.xyz, R1, R6;\n" + "SGE R4.xyz, R4, R1.w;\n" + "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, -R1, R2, R4;\n" + "MUL R2.xyz, R1, R2;\n" + "SGE R3.xyz, R3, R0.w;\n" + "MAD R2.xyz, R3, R4, R2;\n" "ADD R2.w, -R1, c[7].z;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[7].z;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" + "MAD R2.xyz, R0, R2.w, R2;\n" + "ADD R0.x, R0.w, R1.w;\n" + "ADD R0.y, -R0.w, c[7].z;\n" + "MAD result.color.xyz, R1, R0.y, R2;\n" + "MAD result.color.w, -R0, R1, R0.x;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DIFFERENCE_NOMASK = "!!ARBfp1.0\n" "PARAM c[8] = { program.local[0..4],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565, 2 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3827,9 +3826,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_EXCLUSION_NOMASK = "!!ARBfp1.0\n" "PARAM c[8] = { program.local[0..4],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565, 2, 1 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559, 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3886,9 +3885,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODE_BLEND_MODE_MASK = "!!ARBfp1.0\n" "PARAM c[10] = { program.local[0..6],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559 } };\n" "TEMP R0;\n" "TEMP R1;\n" "MUL R0.xyz, fragment.position.y, c[2];\n" @@ -3920,11 +3919,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "ADD R0.w, -R0.z, c[7].z;\n" "CMP R0.x, R0, R0.w, R0.z;\n" "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.z, R0.x, c[0].x;\n" - "MUL R1.x, R0.z, c[7];\n" + "ADD R0.x, R0, c[0];\n" + "MUL R1.x, R0, c[7];\n" "FLR R1.y, R1.x;\n" - "ADD R0.xy, fragment.position, c[5];\n" - "MUL R0.xy, R0, c[4];\n" + "ADD R0.zw, fragment.position.xyxy, c[5].xyxy;\n" + "MUL R0.xy, R0.zwzw, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" "ADD R1.x, R1, -R1.y;\n" "DP4 R1.y, R0, c[6];\n" @@ -3936,9 +3935,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODE_BLEND_MODE_NOMASK = "!!ARBfp1.0\n" "PARAM c[7] = { program.local[0..3],\n" - " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" - " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" - " { 0.33299461, 0.99999565 } };\n" + " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" + " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" + " { 0.33299461, 0.99999559 } };\n" "TEMP R0;\n" "TEMP R1;\n" "MUL R0.xyz, fragment.position.y, c[2];\n" @@ -4357,8 +4356,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[10] = { program.local[0..7],\n" - " { 1, 9.9999997e-006, 2, 3 },\n" - " { 8 } };\n" + " { 1, 2, 9.9999997e-006, 8 },\n" + " { 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -4366,58 +4365,58 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R2.xyz, fragment.position.y, c[2];\n" - "MAD R3.xyz, fragment.position.x, c[1], R2;\n" "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.x, R0.w, c[8].y;\n" - "RCP R2.w, R1.x;\n" - "MUL R1.xyz, R0, R2.w;\n" - "RSQ R1.w, R1.x;\n" - "RSQ R2.y, R1.y;\n" - "ADD R3.xyz, R3, c[3];\n" - "RCP R2.x, R1.w;\n" - "RCP R1.w, R3.z;\n" - "MUL R3.xy, R3, R1.w;\n" - "RSQ R1.w, R1.z;\n" - "RCP R2.z, R1.w;\n" - "RCP R2.y, R2.y;\n" - "MAD R6.xyz, R0.w, R2, -R0;\n" - "MUL R2.xyz, -R1, c[9].x;\n" - "ADD R5.xyz, R2, c[8].w;\n" - "MAD R2.xyz, -R0, R2.w, c[8].x;\n" - "MUL R3.xy, R3, c[0];\n" - "ADD R1.w, R3.x, R3.y;\n" - "MUL R1.w, R1, c[0].z;\n" - "TEX R1, R1.w, texture[2], 1D;\n" - "MAD R3.xyz, R1, c[8].z, -R1.w;\n" - "MUL R4.xyz, R2, R3;\n" - "MAD R4.xyz, -R4, R5, R1.w;\n" - "MAD R2.xyz, -R2, R3, R1.w;\n" - "MUL R5.xyz, R6, R3;\n" - "MUL R4.xyz, R0, R4;\n" - "MAD R5.xyz, R1.w, R0, R5;\n" - "ADD R6.xyz, R5, -R4;\n" - "MUL R5.xyz, R0, c[9].x;\n" - "SGE R3.xyz, R5, R0.w;\n" - "MAD R3.xyz, R3, R6, R4;\n" - "MUL R2.xyz, R0, R2;\n" - "MUL R4.xyz, R1, c[8].z;\n" + "TEX R1, R0, texture[0], 2D;\n" + "MAX R0.w, R1, c[8].z;\n" + "RCP R2.w, R0.w;\n" + "MUL R2.xyz, R1, R2.w;\n" + "RSQ R0.w, R2.x;\n" + "MUL R5.xyz, -R2, c[8].w;\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" + "RCP R0.z, R0.z;\n" + "MUL R0.xy, R0, R0.z;\n" + "MUL R0.xy, R0, c[0];\n" + "ADD R0.x, R0, R0.y;\n" + "RSQ R0.z, R2.y;\n" + "RSQ R0.y, R2.z;\n" + "MAD R2.xyz, -R1, R2.w, c[8].x;\n" + "RCP R3.x, R0.w;\n" + "RCP R3.y, R0.z;\n" + "RCP R3.z, R0.y;\n" + "MUL R0.x, R0, c[0].z;\n" + "TEX R0, R0, texture[2], 1D;\n" + "MAD R4.xyz, R1.w, R3, -R1;\n" + "MAD R3.xyz, R0, c[8].y, -R0.w;\n" + "MUL R4.xyz, R3, R4;\n" + "ADD R6.xyz, R5, c[9].x;\n" + "MUL R5.xyz, R2, R3;\n" + "MAD R2.xyz, -R2, R3, R0.w;\n" + "MUL R3.xyz, R0, c[8].y;\n" + "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R4.xyz, R0.w, R1, R4;\n" + "MAD R5.xyz, -R1, R6, R4;\n" + "MUL R4.xyz, R1, c[8].w;\n" + "SGE R3.xyz, R3, R0.w;\n" + "ADD R2.w, -R1, c[8].x;\n" + "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "ADD R3.xyz, R3, -R2;\n" - "MAD R2.xyz, R4, R3, R2;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" + "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, -R1, R2, R4;\n" + "MUL R2.xyz, R1, R2;\n" + "MAD R2.xyz, R3, R4, R2;\n" + "MAD R2.xyz, R0, R2.w, R2;\n" + "ADD R0.x, -R0.w, c[8];\n" + "MAD R2.xyz, R1, R0.x, R2;\n" + "ADD R0.z, R0.w, R1.w;\n" + "MAD R2.w, -R0, R1, R0.z;\n" + "ADD R0.xy, fragment.position, c[6];\n" + "MUL R0.xy, R0, c[4];\n" + "TEX R0, R0, texture[1], 2D;\n" + "ADD R2, R2, -R1;\n" + "DP4 R0.x, R0, c[7];\n" + "MAD result.color, R0.x, R2, R1;\n" "END\n" ; @@ -4816,8 +4815,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[7] = { program.local[0..4],\n" - " { 1, 9.9999997e-006, 2, 3 },\n" - " { 8 } };\n" + " { 1, 2, 9.9999997e-006, 8 },\n" + " { 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -4825,52 +4824,52 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R2.xyz, fragment.position.y, c[2];\n" - "MAD R3.xyz, fragment.position.x, c[1], R2;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R1, R0, texture[0], 2D;\n" - "MAX R0.x, R1.w, c[5].y;\n" - "RCP R2.w, R0.x;\n" - "MUL R0.xyz, R1, R2.w;\n" - "RSQ R0.w, R0.x;\n" - "RSQ R2.y, R0.y;\n" - "ADD R3.xyz, R3, c[3];\n" - "RCP R2.x, R0.w;\n" - "RCP R0.w, R3.z;\n" - "MUL R3.xy, R3, R0.w;\n" - "RSQ R0.w, R0.z;\n" - "RCP R2.z, R0.w;\n" - "RCP R2.y, R2.y;\n" - "MAD R6.xyz, R1.w, R2, -R1;\n" - "MUL R2.xyz, -R0, c[6].x;\n" - "ADD R5.xyz, R2, c[5].w;\n" + "MAX R0.w, R1, c[5].z;\n" + "RCP R2.w, R0.w;\n" + "MUL R2.xyz, R1, R2.w;\n" + "RSQ R0.w, R2.x;\n" + "MUL R5.xyz, -R2, c[5].w;\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" + "RCP R0.z, R0.z;\n" + "MUL R0.xy, R0, R0.z;\n" + "MUL R0.xy, R0, c[0];\n" + "ADD R0.x, R0, R0.y;\n" + "RSQ R0.z, R2.y;\n" + "RSQ R0.y, R2.z;\n" "MAD R2.xyz, -R1, R2.w, c[5].x;\n" - "MUL R3.xy, R3, c[0];\n" - "ADD R0.w, R3.x, R3.y;\n" - "MUL R0.w, R0, c[0].z;\n" - "TEX R0, R0.w, texture[1], 1D;\n" - "MAD R3.xyz, R0, c[5].z, -R0.w;\n" - "MUL R4.xyz, R2, R3;\n" - "MAD R4.xyz, -R4, R5, R0.w;\n" - "MUL R5.xyz, R6, R3;\n" + "RCP R3.x, R0.w;\n" + "RCP R3.y, R0.z;\n" + "RCP R3.z, R0.y;\n" + "MUL R0.x, R0, c[0].z;\n" + "TEX R0, R0, texture[1], 1D;\n" + "MAD R4.xyz, R1.w, R3, -R1;\n" + "MAD R3.xyz, R0, c[5].y, -R0.w;\n" + "MUL R4.xyz, R3, R4;\n" + "ADD R6.xyz, R5, c[6].x;\n" + "MUL R5.xyz, R2, R3;\n" "MAD R2.xyz, -R2, R3, R0.w;\n" - "MUL R4.xyz, R1, R4;\n" - "MAD R5.xyz, R0.w, R1, R5;\n" - "ADD R6.xyz, R5, -R4;\n" - "MUL R5.xyz, R1, c[6].x;\n" - "SGE R3.xyz, R5, R1.w;\n" - "MAD R3.xyz, R3, R6, R4;\n" + "MUL R3.xyz, R0, c[5].y;\n" + "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R4.xyz, R0.w, R1, R4;\n" + "MAD R5.xyz, -R1, R6, R4;\n" + "MUL R4.xyz, R1, c[5].w;\n" + "MUL R6.xyz, R1, R6;\n" + "SGE R4.xyz, R4, R1.w;\n" + "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, -R1, R2, R4;\n" "MUL R2.xyz, R1, R2;\n" - "MUL R4.xyz, R0, c[5].z;\n" - "ADD R3.xyz, R3, -R2;\n" - "SGE R4.xyz, R4, R0.w;\n" - "MAD R2.xyz, R4, R3, R2;\n" + "SGE R3.xyz, R3, R0.w;\n" + "MAD R2.xyz, R3, R4, R2;\n" "ADD R2.w, -R1, c[5].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[5].x;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" + "MAD R2.xyz, R0, R2.w, R2;\n" + "ADD R0.x, R0.w, R1.w;\n" + "ADD R0.y, -R0.w, c[5].x;\n" + "MAD result.color.xyz, R1, R0.y, R2;\n" + "MAD result.color.w, -R0, R1, R0.x;\n" "END\n" ; @@ -5334,8 +5333,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[10] = { program.local[0..7],\n" - " { 1, 9.9999997e-006, 2, 3 },\n" - " { 8 } };\n" + " { 1, 2, 9.9999997e-006, 8 },\n" + " { 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -5344,55 +5343,55 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R5;\n" "TEMP R6;\n" "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.x, R0.w, c[8].y;\n" - "RCP R2.w, R1.x;\n" - "MUL R1.xyz, R0, R2.w;\n" - "RSQ R1.w, R1.x;\n" - "RCP R2.x, R1.w;\n" - "RSQ R1.w, R1.y;\n" - "RSQ R2.z, R1.z;\n" - "MUL R3.xyz, fragment.position.y, c[2];\n" - "MAD R3.xyz, fragment.position.x, c[1], R3;\n" - "ADD R3.xyz, R3, c[3];\n" - "RCP R2.y, R1.w;\n" - "RCP R1.w, R3.z;\n" - "MUL R3.xy, R3, R1.w;\n" - "RCP R2.z, R2.z;\n" - "MAD R6.xyz, R0.w, R2, -R0;\n" - "MUL R2.xyz, -R1, c[9].x;\n" - "ADD R5.xyz, R2, c[8].w;\n" - "MAD R2.xyz, -R0, R2.w, c[8].x;\n" - "MUL R3.xy, R3, c[0];\n" - "TEX R1, R3, texture[2], 2D;\n" - "MAD R3.xyz, R1, c[8].z, -R1.w;\n" - "MUL R4.xyz, R2, R3;\n" - "MAD R4.xyz, -R4, R5, R1.w;\n" - "MAD R2.xyz, -R2, R3, R1.w;\n" - "MUL R5.xyz, R6, R3;\n" - "MUL R4.xyz, R0, R4;\n" - "MAD R5.xyz, R1.w, R0, R5;\n" - "ADD R6.xyz, R5, -R4;\n" - "MUL R5.xyz, R0, c[9].x;\n" - "SGE R3.xyz, R5, R0.w;\n" - "MAD R3.xyz, R3, R6, R4;\n" - "MUL R2.xyz, R0, R2;\n" - "MUL R4.xyz, R1, c[8].z;\n" + "TEX R1, R0, texture[0], 2D;\n" + "MAX R0.x, R1.w, c[8].z;\n" + "RCP R2.w, R0.x;\n" + "MUL R2.xyz, R1, R2.w;\n" + "RSQ R0.w, R2.x;\n" + "RCP R3.x, R0.w;\n" + "RSQ R0.w, R2.y;\n" + "MUL R5.xyz, -R2, c[8].w;\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" + "RCP R0.z, R0.z;\n" + "MUL R0.xy, R0, R0.z;\n" + "RSQ R0.z, R2.z;\n" + "MAD R2.xyz, -R1, R2.w, c[8].x;\n" + "RCP R3.y, R0.w;\n" + "RCP R3.z, R0.z;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R0, R0, texture[2], 2D;\n" + "MAD R4.xyz, R1.w, R3, -R1;\n" + "MAD R3.xyz, R0, c[8].y, -R0.w;\n" + "MUL R4.xyz, R3, R4;\n" + "ADD R6.xyz, R5, c[9].x;\n" + "MUL R5.xyz, R2, R3;\n" + "MAD R2.xyz, -R2, R3, R0.w;\n" + "MUL R3.xyz, R0, c[8].y;\n" + "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R4.xyz, R0.w, R1, R4;\n" + "MAD R5.xyz, -R1, R6, R4;\n" + "MUL R4.xyz, R1, c[8].w;\n" + "SGE R3.xyz, R3, R0.w;\n" + "ADD R2.w, -R1, c[8].x;\n" + "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "ADD R3.xyz, R3, -R2;\n" - "MAD R2.xyz, R4, R3, R2;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" + "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, -R1, R2, R4;\n" + "MUL R2.xyz, R1, R2;\n" + "MAD R2.xyz, R3, R4, R2;\n" + "MAD R2.xyz, R0, R2.w, R2;\n" + "ADD R0.x, -R0.w, c[8];\n" + "MAD R2.xyz, R1, R0.x, R2;\n" + "ADD R0.z, R0.w, R1.w;\n" + "MAD R2.w, -R0, R1, R0.z;\n" + "ADD R0.xy, fragment.position, c[6];\n" + "MUL R0.xy, R0, c[4];\n" + "TEX R0, R0, texture[1], 2D;\n" + "ADD R2, R2, -R1;\n" + "DP4 R0.x, R0, c[7];\n" + "MAD result.color, R0.x, R2, R1;\n" "END\n" ; @@ -5476,10 +5475,10 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "MUL R0.xyz, fragment.position.y, c[2];\n" "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" - "RCP R1.x, R0.z;\n" - "MUL R0.xy, R0, R1.x;\n" - "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" + "RCP R0.z, R0.z;\n" + "MUL R0.xy, R0, R0.z;\n" + "MUL R1.xy, fragment.position, c[6];\n" + "TEX R1, R1, texture[0], 2D;\n" "MUL R2.xyz, R1, c[4].y;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" @@ -5509,10 +5508,10 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "MUL R0.xyz, fragment.position.y, c[2];\n" "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" - "RCP R1.x, R0.z;\n" - "MUL R0.xy, R0, R1.x;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" + "RCP R0.z, R0.z;\n" + "MUL R0.xy, R0, R0.z;\n" + "MUL R1.xy, fragment.position, c[4];\n" + "TEX R1, R1, texture[0], 2D;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2.x, -R1.w, c[5];\n" @@ -5769,8 +5768,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[7] = { program.local[0..4],\n" - " { 1, 9.9999997e-006, 2, 3 },\n" - " { 8 } };\n" + " { 1, 2, 9.9999997e-006, 8 },\n" + " { 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -5780,48 +5779,48 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R6;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R1, R0, texture[0], 2D;\n" - "MAX R0.x, R1.w, c[5].y;\n" + "MAX R0.x, R1.w, c[5].z;\n" "RCP R2.w, R0.x;\n" - "MUL R0.xyz, R1, R2.w;\n" - "RSQ R0.w, R0.x;\n" - "RCP R2.x, R0.w;\n" - "RSQ R0.w, R0.y;\n" - "RSQ R2.z, R0.z;\n" - "MUL R3.xyz, fragment.position.y, c[2];\n" - "MAD R3.xyz, fragment.position.x, c[1], R3;\n" - "ADD R3.xyz, R3, c[3];\n" - "RCP R2.y, R0.w;\n" - "RCP R0.w, R3.z;\n" - "MUL R3.xy, R3, R0.w;\n" - "RCP R2.z, R2.z;\n" - "MAD R6.xyz, R1.w, R2, -R1;\n" - "MUL R2.xyz, -R0, c[6].x;\n" - "ADD R5.xyz, R2, c[5].w;\n" + "MUL R2.xyz, R1, R2.w;\n" + "RSQ R0.w, R2.x;\n" + "RCP R3.x, R0.w;\n" + "RSQ R0.w, R2.y;\n" + "MUL R5.xyz, -R2, c[5].w;\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" + "RCP R0.z, R0.z;\n" + "MUL R0.xy, R0, R0.z;\n" + "RSQ R0.z, R2.z;\n" "MAD R2.xyz, -R1, R2.w, c[5].x;\n" - "MUL R3.xy, R3, c[0];\n" - "TEX R0, R3, texture[1], 2D;\n" - "MAD R3.xyz, R0, c[5].z, -R0.w;\n" - "MUL R4.xyz, R2, R3;\n" - "MAD R4.xyz, -R4, R5, R0.w;\n" - "MUL R5.xyz, R6, R3;\n" + "RCP R3.y, R0.w;\n" + "RCP R3.z, R0.z;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R0, R0, texture[1], 2D;\n" + "MAD R4.xyz, R1.w, R3, -R1;\n" + "MAD R3.xyz, R0, c[5].y, -R0.w;\n" + "MUL R4.xyz, R3, R4;\n" + "ADD R6.xyz, R5, c[6].x;\n" + "MUL R5.xyz, R2, R3;\n" "MAD R2.xyz, -R2, R3, R0.w;\n" - "MUL R4.xyz, R1, R4;\n" - "MAD R5.xyz, R0.w, R1, R5;\n" - "ADD R6.xyz, R5, -R4;\n" - "MUL R5.xyz, R1, c[6].x;\n" - "SGE R3.xyz, R5, R1.w;\n" - "MAD R3.xyz, R3, R6, R4;\n" + "MUL R3.xyz, R0, c[5].y;\n" + "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R4.xyz, R0.w, R1, R4;\n" + "MAD R5.xyz, -R1, R6, R4;\n" + "MUL R4.xyz, R1, c[5].w;\n" + "MUL R6.xyz, R1, R6;\n" + "SGE R4.xyz, R4, R1.w;\n" + "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, -R1, R2, R4;\n" "MUL R2.xyz, R1, R2;\n" - "MUL R4.xyz, R0, c[5].z;\n" - "ADD R3.xyz, R3, -R2;\n" - "SGE R4.xyz, R4, R0.w;\n" - "MAD R2.xyz, R4, R3, R2;\n" + "SGE R3.xyz, R3, R0.w;\n" + "MAD R2.xyz, R3, R4, R2;\n" "ADD R2.w, -R1, c[5].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[5].x;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" + "MAD R2.xyz, R0, R2.w, R2;\n" + "ADD R0.x, R0.w, R1.w;\n" + "ADD R0.y, -R0.w, c[5].x;\n" + "MAD result.color.xyz, R1, R0.y, R2;\n" + "MAD result.color.w, -R0, R1, R0.x;\n" "END\n" ; @@ -6033,10 +6032,10 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[2], 2D;\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" + "TEX R0.x, R0, texture[2], 2D;\n" + "MUL R1, fragment.color.primary, R0.x;\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" + "TEX R0, R0.zwzw, texture[0], 2D;\n" "ADD R2.w, -R0, c[8].y;\n" "ADD R3.xyz, R1.w, -R1;\n" "ADD R2.xyz, R0.w, -R0;\n" @@ -6201,11 +6200,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[2], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[2], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" + "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R2.xyz, R1.w, R0;\n" "MAD R3.xyz, R1, R0.w, R2;\n" "MAD R2.xyz, -R1.w, R0.w, R3;\n" @@ -6251,10 +6250,10 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[2], 2D;\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" + "TEX R0.x, R0, texture[2], 2D;\n" + "MUL R1, fragment.color.primary, R0.x;\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" + "TEX R0, R0.zwzw, texture[0], 2D;\n" "ADD R2.w, -R0, c[8].y;\n" "ADD R3.xyz, R1.w, -R1;\n" "ADD R2.xyz, R0.w, -R0;\n" @@ -6286,8 +6285,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[10] = { program.local[0..7],\n" - " { 1, 9.9999997e-006, 2, 3 },\n" - " { 8 } };\n" + " { 1, 2, 9.9999997e-006, 8 },\n" + " { 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6297,47 +6296,47 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R6;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.x, R0.w, c[8].y;\n" + "MAX R1.x, R0.w, c[8].z;\n" "RCP R2.w, R1.x;\n" - "MUL R1.xyz, R0, R2.w;\n" - "RSQ R1.w, R1.x;\n" - "RCP R2.x, R1.w;\n" - "RSQ R1.w, R1.y;\n" - "RCP R2.y, R1.w;\n" - "MUL R3.xyz, fragment.position.y, c[2];\n" - "MAD R3.xyz, fragment.position.x, c[1], R3;\n" - "ADD R3.xyz, R3, c[3];\n" - "RCP R2.z, R3.z;\n" - "MUL R3.xy, R3, R2.z;\n" - "MUL R3.xy, R3, c[0];\n" - "RSQ R1.w, R1.z;\n" - "RCP R2.z, R1.w;\n" - "MAD R6.xyz, R0.w, R2, -R0;\n" - "MUL R2.xyz, -R1, c[9].x;\n" - "ADD R5.xyz, R2, c[8].w;\n" + "MUL R2.xyz, R0, R2.w;\n" + "RSQ R1.w, R2.x;\n" + "RCP R3.x, R1.w;\n" + "RSQ R1.w, R2.y;\n" + "MUL R5.xyz, -R2, c[8].w;\n" + "MUL R1.xyz, fragment.position.y, c[2];\n" + "MAD R1.xyz, fragment.position.x, c[1], R1;\n" + "ADD R1.xyz, R1, c[3];\n" + "RCP R1.z, R1.z;\n" + "MUL R1.xy, R1, R1.z;\n" + "RSQ R1.z, R2.z;\n" + "MUL R1.xy, R1, c[0];\n" "MAD R2.xyz, -R0, R2.w, c[8].x;\n" - "TEX R3.x, R3, texture[2], 2D;\n" - "MUL R1, fragment.color.primary, R3.x;\n" - "MAD R3.xyz, R1, c[8].z, -R1.w;\n" - "MUL R4.xyz, R2, R3;\n" - "MAD R4.xyz, -R4, R5, R1.w;\n" + "RCP R3.y, R1.w;\n" + "RCP R3.z, R1.z;\n" + "TEX R1.x, R1, texture[2], 2D;\n" + "MUL R1, fragment.color.primary, R1.x;\n" + "MAD R4.xyz, R0.w, R3, -R0;\n" + "MAD R3.xyz, R1, c[8].y, -R1.w;\n" + "MUL R4.xyz, R3, R4;\n" + "ADD R6.xyz, R5, c[9].x;\n" + "MUL R5.xyz, R2, R3;\n" "MAD R2.xyz, -R2, R3, R1.w;\n" - "MUL R5.xyz, R6, R3;\n" - "MUL R4.xyz, R0, R4;\n" - "MAD R5.xyz, R1.w, R0, R5;\n" - "ADD R6.xyz, R5, -R4;\n" - "MUL R5.xyz, R0, c[9].x;\n" - "SGE R3.xyz, R5, R0.w;\n" - "MAD R3.xyz, R3, R6, R4;\n" - "MUL R2.xyz, R0, R2;\n" - "MUL R4.xyz, R1, c[8].z;\n" - "SGE R4.xyz, R4, R1.w;\n" - "ADD R3.xyz, R3, -R2;\n" - "MAD R2.xyz, R4, R3, R2;\n" + "MUL R3.xyz, R1, c[8].y;\n" + "MAD R6.xyz, -R5, R6, R1.w;\n" + "MAD R4.xyz, R1.w, R0, R4;\n" + "MAD R5.xyz, -R0, R6, R4;\n" + "MUL R4.xyz, R0, c[8].w;\n" + "SGE R3.xyz, R3, R1.w;\n" "ADD R2.w, -R0, c[8].x;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MAD R2.xyz, R0, R2.x, R1;\n" + "MUL R6.xyz, R0, R6;\n" + "SGE R4.xyz, R4, R0.w;\n" + "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, -R0, R2, R4;\n" + "MUL R2.xyz, R0, R2;\n" + "MAD R2.xyz, R3, R4, R2;\n" + "MAD R2.xyz, R1, R2.w, R2;\n" + "ADD R1.x, -R1.w, c[8];\n" + "MAD R2.xyz, R0, R1.x, R2;\n" "ADD R1.z, R1.w, R0.w;\n" "MAD R2.w, -R1, R0, R1.z;\n" "ADD R1.xy, fragment.position, c[6];\n" @@ -6432,10 +6431,10 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.z;\n" - "MUL R1.xy, R0.zwzw, c[0];\n" - "MUL R0.xy, fragment.position, c[6];\n" - "TEX R0, R0, texture[0], 2D;\n" + "MUL R0.xy, R0, R0.z;\n" + "MUL R1.xy, R0, c[0];\n" + "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" + "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R2.xyz, R0, c[4].y;\n" "TEX R1.x, R1, texture[1], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" @@ -6466,10 +6465,10 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.z;\n" - "MUL R1.xy, R0.zwzw, c[0];\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" + "MUL R0.xy, R0, R0.z;\n" + "MUL R1.xy, R0, c[0];\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R0, R0.zwzw, texture[0], 2D;\n" "TEX R1.x, R1, texture[1], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "ADD R2.x, -R0.w, c[5];\n" @@ -6493,10 +6492,10 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[1], 2D;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[1], 2D;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "ADD R2, R1, R0;\n" "MAD result.color, -R1, R0, R2;\n" @@ -6517,10 +6516,10 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" + "TEX R0.x, R0, texture[1], 2D;\n" + "MUL R1, fragment.color.primary, R0.x;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R0, R0.zwzw, texture[0], 2D;\n" "ADD R3.xyz, R1.w, -R1;\n" "ADD R2.xyz, R0.w, -R0;\n" "MUL R2.xyz, R2, R3;\n" @@ -6556,10 +6555,10 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[1], 2D;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[1], 2D;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R2.xyz, R1, R0.w;\n" "MUL R3.xyz, R1.w, R0;\n" @@ -6586,10 +6585,10 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[1], 2D;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[1], 2D;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R2.xyz, R1, R0.w;\n" "MUL R3.xyz, R1.w, R0;\n" @@ -6660,11 +6659,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[1], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[1], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R2.xyz, R1.w, R0;\n" "MAD R3.xyz, R1, R0.w, R2;\n" "ADD R2.w, -R0, c[5].x;\n" @@ -6704,10 +6703,10 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" + "TEX R0.x, R0, texture[1], 2D;\n" + "MUL R1, fragment.color.primary, R0.x;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R0, R0.zwzw, texture[0], 2D;\n" "ADD R2.w, -R0, c[5].y;\n" "ADD R3.xyz, R1.w, -R1;\n" "ADD R2.xyz, R0.w, -R0;\n" @@ -6733,8 +6732,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[7] = { program.local[0..4],\n" - " { 1, 9.9999997e-006, 2, 3 },\n" - " { 8 } };\n" + " { 1, 2, 9.9999997e-006, 8 },\n" + " { 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6744,49 +6743,49 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R6;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.x, R0.w, c[5].y;\n" + "MAX R1.x, R0.w, c[5].z;\n" "RCP R2.w, R1.x;\n" - "MUL R1.xyz, R0, R2.w;\n" - "RSQ R1.w, R1.x;\n" - "RCP R2.x, R1.w;\n" - "RSQ R1.w, R1.y;\n" - "RCP R2.y, R1.w;\n" - "MUL R3.xyz, fragment.position.y, c[2];\n" - "MAD R3.xyz, fragment.position.x, c[1], R3;\n" - "ADD R3.xyz, R3, c[3];\n" - "RCP R2.z, R3.z;\n" - "MUL R3.xy, R3, R2.z;\n" - "MUL R3.xy, R3, c[0];\n" - "RSQ R1.w, R1.z;\n" - "RCP R2.z, R1.w;\n" - "MAD R6.xyz, R0.w, R2, -R0;\n" - "MUL R2.xyz, -R1, c[6].x;\n" - "ADD R5.xyz, R2, c[5].w;\n" + "MUL R2.xyz, R0, R2.w;\n" + "RSQ R1.w, R2.x;\n" + "RCP R3.x, R1.w;\n" + "RSQ R1.w, R2.y;\n" + "MUL R5.xyz, -R2, c[5].w;\n" + "MUL R1.xyz, fragment.position.y, c[2];\n" + "MAD R1.xyz, fragment.position.x, c[1], R1;\n" + "ADD R1.xyz, R1, c[3];\n" + "RCP R1.z, R1.z;\n" + "MUL R1.xy, R1, R1.z;\n" + "RSQ R1.z, R2.z;\n" + "MUL R1.xy, R1, c[0];\n" "MAD R2.xyz, -R0, R2.w, c[5].x;\n" - "TEX R3.x, R3, texture[1], 2D;\n" - "MUL R1, fragment.color.primary, R3.x;\n" - "MAD R3.xyz, R1, c[5].z, -R1.w;\n" - "MUL R4.xyz, R2, R3;\n" - "MAD R4.xyz, -R4, R5, R1.w;\n" - "MUL R5.xyz, R6, R3;\n" + "RCP R3.y, R1.w;\n" + "RCP R3.z, R1.z;\n" + "TEX R1.x, R1, texture[1], 2D;\n" + "MUL R1, fragment.color.primary, R1.x;\n" + "MAD R4.xyz, R0.w, R3, -R0;\n" + "MAD R3.xyz, R1, c[5].y, -R1.w;\n" + "MUL R4.xyz, R3, R4;\n" + "ADD R6.xyz, R5, c[6].x;\n" + "MUL R5.xyz, R2, R3;\n" "MAD R2.xyz, -R2, R3, R1.w;\n" - "MUL R4.xyz, R0, R4;\n" - "MAD R5.xyz, R1.w, R0, R5;\n" - "ADD R6.xyz, R5, -R4;\n" - "MUL R5.xyz, R0, c[6].x;\n" - "SGE R3.xyz, R5, R0.w;\n" - "MAD R3.xyz, R3, R6, R4;\n" + "MUL R3.xyz, R1, c[5].y;\n" + "MAD R6.xyz, -R5, R6, R1.w;\n" + "MAD R4.xyz, R1.w, R0, R4;\n" + "MAD R5.xyz, -R0, R6, R4;\n" + "MUL R4.xyz, R0, c[5].w;\n" + "MUL R6.xyz, R0, R6;\n" + "SGE R4.xyz, R4, R0.w;\n" + "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, -R0, R2, R4;\n" "MUL R2.xyz, R0, R2;\n" - "MUL R4.xyz, R1, c[5].z;\n" - "ADD R3.xyz, R3, -R2;\n" - "SGE R4.xyz, R4, R1.w;\n" - "MAD R2.xyz, R4, R3, R2;\n" + "SGE R3.xyz, R3, R1.w;\n" + "MAD R2.xyz, R3, R4, R2;\n" "ADD R2.w, -R0, c[5].x;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, R1.w, R0.w;\n" - "ADD R2.y, -R1.w, c[5].x;\n" - "MAD result.color.xyz, R0, R2.y, R1;\n" - "MAD result.color.w, -R1, R0, R2.x;\n" + "MAD R2.xyz, R1, R2.w, R2;\n" + "ADD R1.x, R1.w, R0.w;\n" + "ADD R1.y, -R1.w, c[5].x;\n" + "MAD result.color.xyz, R0, R1.y, R2;\n" + "MAD result.color.w, -R1, R0, R1.x;\n" "END\n" ; @@ -6803,10 +6802,10 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[1], 2D;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[1], 2D;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R3.xyz, R1.w, R0;\n" "MUL R2.xyz, R1, R0.w;\n" @@ -6831,10 +6830,10 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[1], 2D;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[1], 2D;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R2.xyz, R1.w, R0;\n" "MAD R3.xyz, R1, R0.w, R2;\n" @@ -6864,9 +6863,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" "TEX R1.x, R1, texture[1], 2D;\n" - "DP4 R0.x, R0, c[6];\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL result.color, R1, R0.x;\n" + "DP4 R1.y, R0, c[6];\n" + "MUL R0, fragment.color.primary, R1.x;\n" + "MUL result.color, R0, R1.y;\n" "END\n" ; diff --git a/src/opengl/util/masks.conf b/src/opengl/util/masks.conf index 733ac81..d853d0b 100644 --- a/src/opengl/util/masks.conf +++ b/src/opengl/util/masks.conf @@ -1,3 +1,2 @@ FRAGMENT_PROGRAM_MASK_TRAPEZOID_AA trap_exact_aa.glsl FRAGMENT_PROGRAM_MASK_ELLIPSE_AA ellipse_aa.glsl -#FRAGMENT_PROGRAM_MASK_ELLIPSE ellipse.glsl diff --git a/src/opengl/util/simple_porter_duff.glsl b/src/opengl/util/simple_porter_duff.glsl index 83aef48..4cb0599 100644 --- a/src/opengl/util/simple_porter_duff.glsl +++ b/src/opengl/util/simple_porter_duff.glsl @@ -7,10 +7,10 @@ vec4 composite(vec4 src, vec4 dst) result.xyz = porterduff_ab.x * src.xyz * dst.a + porterduff_ab.y * dst.xyz * src.a - + porterduff_xyz.y * src.xyz * (1 - dst.a) - + porterduff_xyz.z * dst.xyz * (1 - src.a); + + porterduff_xyz.y * src.xyz * (1.0 - dst.a) + + porterduff_xyz.z * dst.xyz * (1.0 - src.a); - result.a = dot(porterduff_xyz, vec3(src.a * dst.a, src.a * (1 - dst.a), dst.a * (1 - src.a))); + result.a = dot(porterduff_xyz, vec3(src.a * dst.a, src.a * (1.0 - dst.a), dst.a * (1.0 - src.a))); return result; } diff --git a/src/opengl/util/trap_exact_aa.glsl b/src/opengl/util/trap_exact_aa.glsl index b96f87d..1637f43 100644 --- a/src/opengl/util/trap_exact_aa.glsl +++ b/src/opengl/util/trap_exact_aa.glsl @@ -14,7 +14,7 @@ float quad_aa() vec2 invA = gl_TexCoord[0].zw; // transform right line to left to be able to use same calculations for both - vecX.zw = 2 * gl_FragCoord.x - vecX.zw; + vecX.zw = 2.0 * gl_FragCoord.x - vecX.zw; vec2 topX = vec2(vecX.x, vecX.z); vec2 bottomX = vec2(vecX.y, vecX.w); @@ -33,18 +33,18 @@ float quad_aa() vec2 temp = mix(area - 0.5 * (right - bottomXTemp) * (intersectY.yw - bottom), // left < bottom < right < top (0.5 * (topXTemp + bottomXTemp) - left) * area, // left < bottom < top < right - step(topXTemp, right)); + step(topXTemp, right.xx)); vec2 excluded = 0.5 * (top - intersectY.xz) * (topXTemp - left); // bottom < left < top < right excluded = mix((top - 0.5 * (intersectY.yw + intersectY.xz)) * (right - left), // bottom < left < right < top - excluded, step(topXTemp, right)); + excluded, step(topXTemp, right.xx)); excluded = mix(temp, // left < bottom < right (see calculation of temp) - excluded, step(bottomXTemp, left)); + excluded, step(bottomXTemp, left.xx)); excluded = mix(vec2(area, area), // right < bottom < top - excluded, step(bottomXTemp, right)); + excluded, step(bottomXTemp, right.xx)); excluded *= step(left, topXTemp); @@ -53,6 +53,6 @@ float quad_aa() void main() { - gl_FragColor = quad_aa(); + gl_FragColor = quad_aa().xxxx; } -- cgit v0.12 From d109954578b4948706577dfffb7bde139678370a Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Wed, 14 Oct 2009 17:29:01 +0200 Subject: Fixed the GLSL-to-assembly code generator to output enums correctly. Fixed the output of enums such that the last item in the enum is not followed by comma. Changed the output of the license to say that the file is part of the QtOpenGL module, not the test suite. Reviewed-by: Trond --- src/opengl/util/generator.cpp | 53 ++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/src/opengl/util/generator.cpp b/src/opengl/util/generator.cpp index 62d19ff..0202fe1 100644 --- a/src/opengl/util/generator.cpp +++ b/src/opengl/util/generator.cpp @@ -54,6 +54,8 @@ QT_BEGIN_NAMESPACE QT_USE_NAMESPACE +#define TAB " " + typedef QPair QStringPair; QString readSourceFile(const QString &sourceFile, bool fragmentProgram = false) @@ -243,6 +245,30 @@ QString trimmed(QString source) return result; } +void writeVariablesEnum(QTextStream &out, const char *name, const QSet &s) +{ + out << "enum " << name << " {"; + QSet::const_iterator it = s.begin(); + if (it != s.end()) { + out << "\n" TAB "VAR_" << it->toUpper(); + for (++it; it != s.end(); ++it) + out << ",\n" TAB "VAR_" << it->toUpper(); + } + out << "\n};\n\n"; +} + +void writeTypesEnum(QTextStream &out, const char *name, const QList &s) +{ + out << "enum " << name << " {"; + QList::const_iterator it = s.begin(); + if (it != s.end()) { + out << "\n" TAB << it->first; + for (++it; it != s.end(); ++it) + out << ",\n" TAB << it->first; + } + out << "\n};\n\n"; +} + void writeIncludeFile(const QSet &variables, const QList &brushes, const QList &compositionModes, @@ -257,7 +283,7 @@ void writeIncludeFile(const QSet &variables, QTextStream out(&includeFile); - QLatin1String tab(" "); + QLatin1String tab(TAB); out << "/****************************************************************************\n" "**\n" @@ -265,7 +291,7 @@ void writeIncludeFile(const QSet &variables, "** All rights reserved.\n" "** Contact: Nokia Corporation (qt-info@nokia.com)\n" "**\n" - "** This file is part of the test suite of the Qt Toolkit.\n" + "** This file is part of the QtOpenGL module of the Qt Toolkit.\n" "**\n" "** $QT_BEGIN_LICENSE:LGPL$\n" "** No Commercial Usage\n" @@ -315,25 +341,10 @@ void writeIncludeFile(const QSet &variables, "//\n" "\n"; - out << "enum FragmentVariable {\n"; - foreach (QString str, variables) - out << tab << "VAR_" << str.toUpper() << ",\n"; - out << "};\n\n"; - - out << "enum FragmentBrushType {\n"; - foreach (QStringPair brush, brushes) - out << tab << brush.first << ",\n"; - out << "};\n\n"; - - out << "enum FragmentCompositionModeType {\n"; - foreach (QStringPair mode, compositionModes) - out << tab << mode.first << ",\n"; - out << "};\n\n"; - - out << "enum FragmentMaskType {\n"; - foreach (QStringPair mask, masks) - out << tab << mask.first << ",\n"; - out << "};\n\n"; + writeVariablesEnum(out, "FragmentVariable", variables); + writeTypesEnum(out, "FragmentBrushType", brushes); + writeTypesEnum(out, "FragmentCompositionModeType", compositionModes); + writeTypesEnum(out, "FragmentMaskType", masks); out << "static const unsigned int num_fragment_variables = " << variables.size() << ";\n\n"; out << "static const unsigned int num_fragment_brushes = " << brushes.size() << ";\n"; -- cgit v0.12 From 93eb7c1378d97978fbe415f532e341de0138f4fe Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 15 Oct 2009 10:44:27 +1000 Subject: Back-port several OpenGL/ES fixes from 4.6 to 4.5 8ee6d090d45198fb2530849236c97f014666b7e4: fix EGL_SAMPLES b125af1b298d694c332f56deebe4755d0c985d5d: memory leak of EGLSurface's ef8d9fa7091b0d45fe15aae43b8f1c47547cb16d: double-destroy of pbuffer 73d9dced8298dfad7bc72607146e81e96fffb6d4: suppress pbuffer warnings Reviewed-by: Donald Carr --- src/opengl/qgl_egl.cpp | 2 +- src/opengl/qgl_qws.cpp | 2 ++ src/opengl/qglpixelbuffer_egl.cpp | 15 +++++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 7e91c35..348a677 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -74,7 +74,7 @@ void qt_egl_set_format(QEglProperties& props, int deviceType, const QGLFormat& f props.setValue(EGL_STENCIL_SIZE, f.stencilBufferSize() == -1 ? 1 : f.stencilBufferSize()); if (f.sampleBuffers()) { props.setValue(EGL_SAMPLE_BUFFERS, 1); - props.setValue(EGL_SAMPLES, f.samples()); + props.setValue(EGL_SAMPLES, f.samples() == -1 ? 1 : f.samples()); } else { props.setValue(EGL_SAMPLE_BUFFERS, 0); } diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp index b842426..4058b66 100644 --- a/src/opengl/qgl_qws.cpp +++ b/src/opengl/qgl_qws.cpp @@ -187,6 +187,8 @@ void QGLContext::reset() d->cleanup(); doneCurrent(); if (d->eglContext) { + if (d->eglContext->surface() != EGL_NO_SURFACE) + eglDestroySurface(d->eglContext->display(), d->eglContext->surface()); delete d->eglContext; d->eglContext = 0; } diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp index b2f16c1..fbe6c36 100644 --- a/src/opengl/qglpixelbuffer_egl.cpp +++ b/src/opengl/qglpixelbuffer_egl.cpp @@ -152,7 +152,7 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge bool QGLPixelBufferPrivate::cleanup() { - eglDestroySurface(QEglContext::defaultDisplay(0), pbuf); + // No need to destroy "pbuf" here - it is done in QGLContext::reset(). return true; } @@ -203,13 +203,20 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const bool QGLPixelBuffer::hasOpenGLPbuffers() { // See if we have at least 1 configuration that matches the default format. - QEglContext ctx; - if (!ctx.openDisplay(0)) + EGLDisplay dpy = QEglContext::defaultDisplay(0); + if (dpy == EGL_NO_DISPLAY) return false; QEglProperties configProps; qt_egl_set_format(configProps, QInternal::Pbuffer, QGLFormat::defaultFormat()); configProps.setRenderableType(QEglContext::OpenGL); - return ctx.chooseConfig(configProps, QEglContext::BestPixelFormat); + do { + EGLConfig cfg = 0; + EGLint matching = 0; + if (eglChooseConfig(dpy, configProps.properties(), + &cfg, 1, &matching) && matching > 0) + return true; + } while (configProps.reduceConfiguration()); + return false; } QT_END_NAMESPACE -- cgit v0.12 From 4f2fecbdb852028bd191fa63aa66527107672dc7 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 15 Oct 2009 10:50:57 +1000 Subject: Remove the surface holder from the PowerVR screen driver The PvrEglSurfaceHolder is a hold-over from Qtopia that isn't needed any more and was never very stable anyway. Reviewed-by: trustme Back port of f613b0170d0fe806378779472315d0bbdc1aada9 --- .../powervr/pvreglscreen/pvreglscreen.cpp | 128 ++------------------- .../gfxdrivers/powervr/pvreglscreen/pvreglscreen.h | 19 --- .../powervr/pvreglscreen/pvreglwindowsurface.cpp | 8 +- .../powervr/pvreglscreen/pvreglwindowsurface.h | 4 +- 4 files changed, 11 insertions(+), 148 deletions(-) diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp index cb453d7..6696672 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp @@ -60,17 +60,20 @@ PvrEglScreen::PvrEglScreen(int displayId) ttyfd = -1; doGraphicsMode = true; oldKdMode = KD_TEXT; - if (QWSServer::instance()) - holder = new PvrEglSurfaceHolder(); - else - holder = 0; + + // Make sure that the EGL layer is initialized and the drivers loaded. + EGLDisplay dpy = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); + if (!eglInitialize(dpy, 0, 0)) + qWarning("Could not initialize EGL display - are the drivers loaded?"); + + // Make sure that screen 0 is initialized. + pvrQwsScreenWindow(0); } PvrEglScreen::~PvrEglScreen() { if (fd >= 0) ::close(fd); - delete holder; } bool PvrEglScreen::initDevice() @@ -194,7 +197,7 @@ QWSWindowSurface* PvrEglScreen::createSurface(QWidget *widget) const QWSWindowSurface* PvrEglScreen::createSurface(const QString &key) const { if (key == QLatin1String("PvrEgl")) - return new PvrEglWindowSurface(holder); + return new PvrEglWindowSurface(); return QScreen::createSurface(key); } @@ -275,116 +278,3 @@ bool PvrEglScreenSurfaceFunctions::createNativeWindow(QWidget *widget, EGLNative *native = (EGLNativeWindowType)(nsurface->nativeDrawable()); return true; } - -// The PowerVR engine on the device needs to allocate about 2Mb of -// contiguous physical memory to manage drawing into a surface. -// -// The problem is that once Qtopia begins its startup sequence, -// it allocates enough memory to severely fragment the physical -// address space on the device. This leaves the PowerVR engine -// unable to allocate the necessary contiguous physical memory -// when an EGL surface is created. -// -// A solution to this is to pre-allocate a dummy surface early -// in the startup sequence before memory becomes fragmented, -// reserving it for any future EGL applications to use. -// -// However, the PowerVR engine has problems managing multiple -// surfaces concurrently, and so real EGL applications end up -// with unacceptably slow frame rates unless the dummy surface -// is destroyed while the real EGL applications are running. -// -// In summary, we need to try to ensure that there is always at -// least one EGL surface active at any given time to reserve the -// memory but destroy the temporary surface when a real surface -// is using the device. That is the purpose of PvrEglSurfaceHolder. - -PvrEglSurfaceHolder::PvrEglSurfaceHolder(QObject *parent) - : QObject(parent) -{ - numRealSurfaces = 0; - - PvrQwsRect rect; - rect.x = 0; - rect.y = 0; - rect.width = 16; - rect.height = 16; - tempSurface = pvrQwsCreateWindow(0, -1, &rect); - - dpy = EGL_NO_DISPLAY; - config = 0; - surface = EGL_NO_SURFACE; - - dpy = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); - if (!eglInitialize(dpy, 0, 0)) { - qWarning("Could not initialize EGL display - are the drivers loaded?"); - dpy = EGL_NO_DISPLAY; - return; - } - - EGLint attribList[16]; - int temp = 0; - attribList[temp++] = EGL_LEVEL; // Framebuffer level 0 - attribList[temp++] = 0; - attribList[temp++] = EGL_SURFACE_TYPE; - attribList[temp++] = EGL_WINDOW_BIT; - attribList[temp++] = EGL_NONE; - - EGLint numConfigs = 0; - if (!eglChooseConfig(dpy, attribList, &config, 1, &numConfigs) || numConfigs != 1) { - qWarning("Could not find a matching a EGL configuration"); - eglTerminate(dpy); - dpy = EGL_NO_DISPLAY; - return; - } - - surface = eglCreateWindowSurface - (dpy, config, (EGLNativeWindowType)(-1), NULL); - if (surface == EGL_NO_SURFACE) - qWarning("Could not create the temporary EGL surface"); -} - -PvrEglSurfaceHolder::~PvrEglSurfaceHolder() -{ - if (surface != EGL_NO_SURFACE) - eglDestroySurface(dpy, surface); - if (dpy != EGL_NO_DISPLAY) - eglTerminate(dpy); - if (tempSurface) - pvrQwsDestroyDrawable(tempSurface); -} - -// Add a real EGL surface to the system. -void PvrEglSurfaceHolder::addSurface() -{ - ++numRealSurfaces; - if (numRealSurfaces == 1) { - // Destroy the temporary surface while some other application - // is making use of the EGL sub-system for 3D rendering. - if (surface != EGL_NO_SURFACE) { - eglDestroySurface(dpy, surface); - surface = EGL_NO_SURFACE; - } - } -} - -// Remove an actual EGL surface from the system. -void PvrEglSurfaceHolder::removeSurface() -{ - if (numRealSurfaces > 0) { - --numRealSurfaces; - if (numRealSurfaces == 0) { - // The last real EGL surface has been destroyed, so re-create - // the temporary surface. There is a race condition here in - // that Qtopia could allocate a lot of memory just after - // the real EGL surface is destroyed but before we could - // create the temporary surface again. - if (surface == EGL_NO_SURFACE && dpy != EGL_NO_DISPLAY) { - surface = eglCreateWindowSurface - (dpy, config, (EGLNativeWindowType)(-1), NULL); - if (surface == EGL_NO_SURFACE) - qWarning("Could not re-create the temporary EGL surface"); - } - } - } -} diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h index 1c79f8e..8bf42c7 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h @@ -59,24 +59,6 @@ private: int displayId; }; -class PvrEglSurfaceHolder : public QObject -{ - Q_OBJECT -public: - PvrEglSurfaceHolder(QObject *parent=0); - ~PvrEglSurfaceHolder(); - - void addSurface(); - void removeSurface(); - -private: - int numRealSurfaces; - PvrQwsDrawable *tempSurface; - EGLDisplay dpy; - EGLConfig config; - EGLSurface surface; -}; - class PvrEglScreen : public QGLScreen { public: @@ -105,7 +87,6 @@ private: int fd; int ttyfd, oldKdMode; - PvrEglSurfaceHolder *holder; QString ttyDevice; bool doGraphicsMode; }; diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp index 09c0ace..2c5ac21 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp @@ -53,7 +53,6 @@ PvrEglWindowSurface::PvrEglWindowSurface this->widget = widget; this->screen = screen; - this->holder = 0; this->pdevice = 0; QPoint pos = offset(widget); @@ -78,7 +77,7 @@ PvrEglWindowSurface::PvrEglWindowSurface drawable = pvrQwsCreateWindow(screenNum, (long)widget, &pvrRect); } -PvrEglWindowSurface::PvrEglWindowSurface(PvrEglSurfaceHolder *holder) +PvrEglWindowSurface::PvrEglWindowSurface() : QWSGLWindowSurface() { setSurfaceFlags(QWSWindowSurface::Opaque); @@ -86,9 +85,6 @@ PvrEglWindowSurface::PvrEglWindowSurface(PvrEglSurfaceHolder *holder) widget = 0; screen = 0; pdevice = 0; - - this->holder = holder; - holder->addSurface(); } PvrEglWindowSurface::~PvrEglWindowSurface() @@ -100,8 +96,6 @@ PvrEglWindowSurface::~PvrEglWindowSurface() if (drawable && pvrQwsReleaseWindow(drawable)) pvrQwsDestroyDrawable(drawable); - if (holder) - holder->removeSurface(); delete pdevice; } diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h index 0da3653..58a5fb2 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h @@ -46,13 +46,12 @@ #include "pvrqwsdrawable.h" class QScreen; -class PvrEglSurfaceHolder; class PvrEglWindowSurface : public QWSGLWindowSurface { public: PvrEglWindowSurface(QWidget *widget, QScreen *screen, int screenNum); - PvrEglWindowSurface(PvrEglSurfaceHolder *holder); + PvrEglWindowSurface(); ~PvrEglWindowSurface(); QString key() const { return QLatin1String("PvrEgl"); } @@ -78,7 +77,6 @@ private: QWidget *widget; PvrQwsDrawable *drawable; QScreen *screen; - PvrEglSurfaceHolder *holder; QPaintDevice *pdevice; }; -- cgit v0.12 From e49d92f620313c0921ece291548a8a9c6a809586 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 15 Oct 2009 13:12:52 +1000 Subject: customshader won't work on OpenGL/ES 1.1 so disable for those platforms Reviewed-by: trustme --- examples/effects/effects.pro | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/effects/effects.pro b/examples/effects/effects.pro index 01fa293..2dec8d5 100644 --- a/examples/effects/effects.pro +++ b/examples/effects/effects.pro @@ -5,7 +5,11 @@ SUBDIRS = \ lighting \ fademessage -contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2):SUBDIRS += customshader +!contains(QT_CONFIG, opengles1):!contains(QT_CONFIG, opengles1cl) { + contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) { + SUBDIRS += customshader + } +} # install target.path = $$[QT_INSTALL_EXAMPLES]/effects -- cgit v0.12 From 03c587f510f2a5f9126b53a0c3913ac06bb86c79 Mon Sep 17 00:00:00 2001 From: Stian Sandvik Thomassen Date: Thu, 15 Oct 2009 13:31:39 +1000 Subject: Removed assertion from QComboBox::removeItem() Made QComboBox::removeItem() do nothing instead of asserting if index is out of range. Reviewed-by: Andy Shaw --- src/gui/widgets/qcombobox.cpp | 5 ++++- tests/auto/qcombobox/tst_qcombobox.cpp | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index b606538..0e888d6 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -2174,11 +2174,14 @@ void QComboBox::insertSeparator(int index) /*! Removes the item at the given \a index from the combobox. This will update the current index if the index is removed. + + This function does nothing if \a index is out of range. */ void QComboBox::removeItem(int index) { - Q_ASSERT(index >= 0 && index < count()); Q_D(QComboBox); + if (index < 0 || index >= count()) + return; d->model->removeRows(index, 1, d->root); } diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index e76f0f7..0d3469d 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -151,6 +151,7 @@ private slots: void subControlRectsWithOffset_data(); void subControlRectsWithOffset(); void task260974_menuItemRectangleForComboBoxPopup(); + void removeItem(); protected slots: void onEditTextChanged( const QString &newString ); @@ -2398,5 +2399,22 @@ void tst_QComboBox::task260974_menuItemRectangleForComboBoxPopup() #endif } +void tst_QComboBox::removeItem() +{ + QComboBox cb; + cb.removeItem(-1); + cb.removeItem(1); + cb.removeItem(0); + QCOMPARE(cb.count(), 0); + + cb.addItem("foo"); + cb.removeItem(-1); + QCOMPARE(cb.count(), 1); + cb.removeItem(1); + QCOMPARE(cb.count(), 1); + cb.removeItem(0); + QCOMPARE(cb.count(), 0); +} + QTEST_MAIN(tst_QComboBox) #include "tst_qcombobox.moc" -- cgit v0.12 From 162dd5b9360a362a78e77387ed92c49934201a32 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Thu, 15 Oct 2009 12:26:03 +1000 Subject: Change the frame rate property to a qreal from a QPair rational While a rational number is a common way to represent a frame rate, QPair isn't a proper numeric type meaning it can't be used as anything more than an identifer for an exact frame rate without being converted to a real, or extending it to a proper rational type. Rev by: Justin McPherson --- src/multimedia/video/qvideosurfaceformat.cpp | 51 +++++++--------------- src/multimedia/video/qvideosurfaceformat.h | 8 +--- .../tst_qvideosurfaceformat.cpp | 39 ++++++----------- 3 files changed, 30 insertions(+), 68 deletions(-) diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp index 2b0de96..e6ef8f3 100644 --- a/src/multimedia/video/qvideosurfaceformat.cpp +++ b/src/multimedia/video/qvideosurfaceformat.cpp @@ -58,7 +58,7 @@ public: , scanLineDirection(QVideoSurfaceFormat::TopToBottom) , pixelAspectRatio(1, 1) , yuvColorSpace(QVideoSurfaceFormat::YCbCr_Undefined) - , frameRate(0, 0) + , frameRate(0.0) { } @@ -73,7 +73,7 @@ public: , pixelAspectRatio(1, 1) , yuvColorSpace(QVideoSurfaceFormat::YCbCr_Undefined) , viewport(QPoint(0, 0), size) - , frameRate(0, 0) + , frameRate(0.0) { } @@ -100,7 +100,7 @@ public: && frameSize == other.frameSize && pixelAspectRatio == other.pixelAspectRatio && viewport == other.viewport - && frameRate == other.frameRate + && frameRatesEqual(frameRate, other.frameRate) && yuvColorSpace == other.yuvColorSpace && propertyNames.count() == other.propertyNames.count()) { for (int i = 0; i < propertyNames.count(); ++i) { @@ -115,6 +115,11 @@ public: } } + inline static bool frameRatesEqual(qreal r1, qreal r2) + { + return qAbs(r1 - r2) <= 0.00001 * qMin(qAbs(r1), qAbs(r2)); + } + QVideoFrame::PixelFormat pixelFormat; QAbstractVideoBuffer::HandleType handleType; QVideoSurfaceFormat::Direction scanLineDirection; @@ -122,7 +127,7 @@ public: QSize pixelAspectRatio; QVideoSurfaceFormat::YuvColorSpace yuvColorSpace; QRect viewport; - QVideoSurfaceFormat::FrameRate frameRate; + qreal frameRate; QList propertyNames; QList propertyValues; }; @@ -201,15 +206,6 @@ public: The full range Y'CbCr color space used in JPEG files. */ - -/*! - \typedef QVideoSurfaceFormat::FrameRate - - A pair of integers representing the frame rate of a video stream. - - The first number is the numerator and the second the denominator. -*/ - /*! Constructs a null video stream format. */ @@ -415,41 +411,24 @@ void QVideoSurfaceFormat::setScanLineDirection(Direction direction) } /*! - Returns the frame rate of a video stream. - - The frame rate is a rational number represented by a pair of integers. - The first integer is the numerator and the second the denominator. + Returns the frame rate of a video stream in frames per second. */ -QVideoSurfaceFormat::FrameRate QVideoSurfaceFormat::frameRate() const +qreal QVideoSurfaceFormat::frameRate() const { return d->frameRate; } /*! - Sets the frame \a rate of a video stream. - - The frame rate is a rational number represented by a pair of integers. - The first integer is the numerator and the second the denominator. + Sets the frame \a rate of a video stream in frames per second. */ -void QVideoSurfaceFormat::setFrameRate(const FrameRate &rate) +void QVideoSurfaceFormat::setFrameRate(qreal rate) { d->frameRate = rate; } /*! - \overload - - Sets the \a numerator and \a denominator of the frame rate of a video stream. -*/ - -void QVideoSurfaceFormat::setFrameRate(int numerator, int denominator) -{ - d->frameRate = qMakePair(numerator, denominator); -} - -/*! Returns a video stream's pixel aspect ratio. */ @@ -599,8 +578,8 @@ void QVideoSurfaceFormat::setProperty(const char *name, const QVariant &value) if (qVariantCanConvert(value)) d->scanLineDirection = qvariant_cast(value); } else if (qstrcmp(name, "frameRate") == 0) { - if (qVariantCanConvert(value)) - d->frameRate = qvariant_cast(value); + if (qVariantCanConvert(value)) + d->frameRate = qvariant_cast(value); } else if (qstrcmp(name, "pixelAspectRatio") == 0) { if (qVariantCanConvert(value)) d->pixelAspectRatio = qvariant_cast(value); diff --git a/src/multimedia/video/qvideosurfaceformat.h b/src/multimedia/video/qvideosurfaceformat.h index b3005bd..1f4a5cb 100644 --- a/src/multimedia/video/qvideosurfaceformat.h +++ b/src/multimedia/video/qvideosurfaceformat.h @@ -87,8 +87,6 @@ public: #endif }; - typedef QPair FrameRate; - QVideoSurfaceFormat(); QVideoSurfaceFormat( const QSize &size, @@ -120,9 +118,8 @@ public: Direction scanLineDirection() const; void setScanLineDirection(Direction direction); - FrameRate frameRate() const; - void setFrameRate(const FrameRate &rate); - void setFrameRate(int numerator, int denominator = 1); + qreal frameRate() const; + void setFrameRate(qreal rate); QSize pixelAspectRatio() const; void setPixelAspectRatio(const QSize &ratio); @@ -147,7 +144,6 @@ Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoSurfaceFormat &); QT_END_NAMESPACE -Q_DECLARE_METATYPE(QVideoSurfaceFormat::FrameRate) Q_DECLARE_METATYPE(QVideoSurfaceFormat::Direction) Q_DECLARE_METATYPE(QVideoSurfaceFormat::YuvColorSpace) diff --git a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp b/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp index bc6fe68..9623e80 100644 --- a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp +++ b/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp @@ -120,7 +120,7 @@ void tst_QVideoSurfaceFormat::constructNull() QCOMPARE(format.frameHeight(), -1); QCOMPARE(format.viewport(), QRect()); QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom); - QCOMPARE(format.frameRate(), QVideoSurfaceFormat::FrameRate()); + QCOMPARE(format.frameRate(), 0.0); QCOMPARE(format.pixelAspectRatio(), QSize(1, 1)); QCOMPARE(format.yuvColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined); } @@ -159,7 +159,7 @@ void tst_QVideoSurfaceFormat::construct() QCOMPARE(format.frameHeight(), frameSize.height()); QCOMPARE(format.viewport(), viewport); QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom); - QCOMPARE(format.frameRate(), QVideoSurfaceFormat::FrameRate()); + QCOMPARE(format.frameRate(), 0.0); QCOMPARE(format.pixelAspectRatio(), QSize(1, 1)); QCOMPARE(format.yuvColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined); } @@ -315,21 +315,21 @@ void tst_QVideoSurfaceFormat::scanLineDirection() void tst_QVideoSurfaceFormat::frameRate_data() { - QTest::addColumn("frameRate"); + QTest::addColumn("frameRate"); QTest::newRow("null") - << QVideoSurfaceFormat::FrameRate(0, 0); + << 0.0; QTest::newRow("1/1") - << QVideoSurfaceFormat::FrameRate(1, 1); + << 1.0; QTest::newRow("24/1") - << QVideoSurfaceFormat::FrameRate(24, 1); + << 24.0; QTest::newRow("15/2") - << QVideoSurfaceFormat::FrameRate(15, 2); + << 7.5; } void tst_QVideoSurfaceFormat::frameRate() { - QFETCH(QVideoSurfaceFormat::FrameRate, frameRate); + QFETCH(qreal, frameRate); { QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32); @@ -337,29 +337,16 @@ void tst_QVideoSurfaceFormat::frameRate() format.setFrameRate(frameRate); QCOMPARE(format.frameRate(), frameRate); - QCOMPARE(qvariant_cast(format.property("frameRate")), - frameRate); - } - { - QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32); - - format.setFrameRate(frameRate.first, frameRate.second); - - QCOMPARE(format.frameRate(), frameRate); - QCOMPARE( - qvariant_cast(format.property("frameRate")), - frameRate); + QCOMPARE(qvariant_cast(format.property("frameRate")), frameRate); } { QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32); format.setFrameRate(frameRate); - format.setProperty( - "frameRate", qVariantFromValue(frameRate)); + format.setProperty("frameRate", frameRate); QCOMPARE(format.frameRate(), frameRate); - QCOMPARE(qvariant_cast(format.property("frameRate")), - frameRate); + QCOMPARE(qvariant_cast(format.property("frameRate")), frameRate); } } @@ -609,13 +596,13 @@ void tst_QVideoSurfaceFormat::compare() QCOMPARE(format1 == format2, true); QCOMPARE(format1 != format2, false); - format1.setFrameRate(QVideoSurfaceFormat::FrameRate(15, 2)); + format1.setFrameRate(7.5); // Not equal frame rate differs. QCOMPARE(format1 == format2, false); QCOMPARE(format1 != format2, true); - format2.setFrameRate(15, 2); + format2.setFrameRate(7.50001); // Equal. QCOMPARE(format1 == format2, true); -- cgit v0.12 From f4ad1cc44e3a25d0089d39cdf16820d9fbb2e050 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 15 Oct 2009 14:34:46 +1000 Subject: Centralize all GL paint engine creations into qt_qgl_paint_engine() The qt_qgl_paint_engine() function was being used by QWS, but there's no reason why it can't be used by other platforms too. This should also fix ES 2.0 paint engine support under QWS, which was stubbed out. Reviewed-by: Sarah Smith Reviewed-by: Gunnar --- src/opengl/qgl.cpp | 22 ++++++++-------------- src/opengl/qgl_p.h | 4 +--- src/opengl/qglpaintdevice_qws.cpp | 4 ---- src/opengl/qwindowsurface_gl.cpp | 12 +----------- 4 files changed, 10 insertions(+), 32 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 8aef8b4..5e00b11 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4735,16 +4735,19 @@ Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_gl_2_engine) Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_gl_engine) #endif -#ifdef Q_WS_QWS Q_OPENGL_EXPORT QPaintEngine* qt_qgl_paint_engine() { -#if !defined(QT_OPENGL_ES_2) +#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL) return qt_gl_engine(); +#elif defined(QT_OPENGL_ES_2) + return qt_gl_2_engine(); #else - return 0; // XXX + if (qt_gl_preferGL2Engine()) + return qt_gl_2_engine(); + else + return qt_gl_engine(); #endif } -#endif /*! \internal @@ -4754,16 +4757,7 @@ Q_OPENGL_EXPORT QPaintEngine* qt_qgl_paint_engine() */ QPaintEngine *QGLWidget::paintEngine() const { -#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL) - return qt_gl_engine(); -#elif defined(QT_OPENGL_ES_2) - return qt_gl_2_engine(); -#else - if (qt_gl_preferGL2Engine()) - return qt_gl_2_engine(); - else - return qt_gl_engine(); -#endif + return qt_qgl_paint_engine(); } #ifdef QT3_SUPPORT diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 8d4f673..129e7f7 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -505,9 +505,7 @@ private: }; -#ifdef Q_WS_QWS -extern QPaintEngine* qt_qgl_paint_engine(); -#endif +extern Q_OPENGL_EXPORT QPaintEngine* qt_qgl_paint_engine(); bool qt_gl_preferGL2Engine(); diff --git a/src/opengl/qglpaintdevice_qws.cpp b/src/opengl/qglpaintdevice_qws.cpp index 600efa6..8c2f27d 100644 --- a/src/opengl/qglpaintdevice_qws.cpp +++ b/src/opengl/qglpaintdevice_qws.cpp @@ -72,11 +72,7 @@ QWSGLPaintDevice::~QWSGLPaintDevice() QPaintEngine* QWSGLPaintDevice::paintEngine() const { -#if !defined(QT_OPENGL_ES_2) return qt_qgl_paint_engine(); -#else - return 0; // XXX -#endif } int QWSGLPaintDevice::metric(PaintDeviceMetric m) const diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 7f8577a..b341243 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -283,19 +283,9 @@ int QGLWindowSurfaceGLPaintDevice::metric(PaintDeviceMetric m) const return d->q_ptr->window()->metric(m); } -Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_gl_window_surface_2_engine) - -#if !defined (QT_OPENGL_ES_2) -Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_gl_window_surface_engine) -#endif - QPaintEngine *QGLWindowSurfaceGLPaintDevice::paintEngine() const { -#if !defined(QT_OPENGL_ES_2) - if (!qt_gl_preferGL2Engine()) - return qt_gl_window_surface_engine(); -#endif - return qt_gl_window_surface_2_engine(); + return qt_qgl_paint_engine(); } QGLWindowSurface::QGLWindowSurface(QWidget *window) -- cgit v0.12 From 8b568a5afd24ecb343b7508bf6b27b27af59b226 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 15 Oct 2009 16:26:19 +1000 Subject: qt_paint_device_metric() for fetching metrics Custom window surfaces, graphics systems, and Qt/Embedded screen drivers often need to access QPaintDevice::metric(), but it is protected. Hence the growing number of friends in QWidget and QImage. The qt_paint_device_metric() function provides a more future-proof approach that doesn't require lots of friends. Reviewed-by: Gunnar --- src/gui/kernel/qwidget.h | 3 --- src/gui/painting/qpaintdevice.cpp | 5 +++++ src/gui/painting/qpaintdevice.h | 1 + src/gui/painting/qpaintengine_raster.cpp | 9 +-------- src/opengl/qglpaintdevice_qws.cpp | 9 +-------- src/opengl/qwindowsurface_gl.cpp | 2 +- src/openvg/qwindowsurface_vg.cpp | 2 +- .../graphicssystems/shivavg/shivavgwindowsurface.cpp | 14 +------------- 8 files changed, 11 insertions(+), 34 deletions(-) diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 3501c6e..3cc3093 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -726,14 +726,11 @@ private: friend class QGLContext; friend class QGLWidget; friend class QGLWindowSurface; - friend class QGLWindowSurfaceGLPaintDevice; - friend class QVGWindowSurface; friend class QX11PaintEngine; friend class QWin32PaintEngine; friend class QShortcutPrivate; friend class QShortcutMap; friend class QWindowSurface; - friend class QD3DWindowSurface; friend class QGraphicsProxyWidget; friend class QGraphicsProxyWidgetPrivate; friend class QStyleSheetStyle; diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp index 95c0b44..6114938 100644 --- a/src/gui/painting/qpaintdevice.cpp +++ b/src/gui/painting/qpaintdevice.cpp @@ -65,4 +65,9 @@ int QPaintDevice::metric(PaintDeviceMetric) const return 0; } +Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, QPaintDevice::PaintDeviceMetric metric) +{ + return device->metric(metric); +} + QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h index 92aa3cb..c8e86b8 100644 --- a/src/gui/painting/qpaintdevice.h +++ b/src/gui/painting/qpaintdevice.h @@ -137,6 +137,7 @@ public: friend class QPainter; friend class QFontEngineMac; friend class QX11PaintEngine; + friend Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, PaintDeviceMetric metric); }; #ifdef QT3_SUPPORT diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 6037bd5..240403d 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -4213,13 +4213,6 @@ void QRasterBuffer::prepare(QCustomRasterPaintDevice *device) drawHelper = qDrawHelper + format; } -class MetricAccessor : public QWidget { -public: - int metric(PaintDeviceMetric m) { - return QWidget::metric(m); - } -}; - int QCustomRasterPaintDevice::metric(PaintDeviceMetric m) const { switch (m) { @@ -4231,7 +4224,7 @@ int QCustomRasterPaintDevice::metric(PaintDeviceMetric m) const break; } - return (static_cast(widget)->metric(m)); + return qt_paint_device_metric(widget, m); } int QCustomRasterPaintDevice::bytesPerLine() const diff --git a/src/opengl/qglpaintdevice_qws.cpp b/src/opengl/qglpaintdevice_qws.cpp index 8c2f27d..1512278 100644 --- a/src/opengl/qglpaintdevice_qws.cpp +++ b/src/opengl/qglpaintdevice_qws.cpp @@ -52,13 +52,6 @@ public: QWidget *widget; }; -class QMetricAccessor : public QWidget { -public: - int metric(PaintDeviceMetric m) { - return QWidget::metric(m); - } -}; - QWSGLPaintDevice::QWSGLPaintDevice(QWidget *widget) : d_ptr(new QWSGLPaintDevicePrivate) { @@ -80,7 +73,7 @@ int QWSGLPaintDevice::metric(PaintDeviceMetric m) const Q_D(const QWSGLPaintDevice); Q_ASSERT(d->widget); - return ((QMetricAccessor *) d->widget)->metric(m); + return qt_paint_device_metric(d->widget, m); } QWSGLWindowSurface* QWSGLPaintDevice::windowSurface() const diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index b341243..df84a76 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -280,7 +280,7 @@ QGLContext* QGLWindowSurfaceGLPaintDevice::context() const int QGLWindowSurfaceGLPaintDevice::metric(PaintDeviceMetric m) const { - return d->q_ptr->window()->metric(m); + return qt_paint_device_metric(d->q_ptr->window(), m); } QPaintEngine *QGLWindowSurfaceGLPaintDevice::paintEngine() const diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp index 6cc2e27..661e06a 100644 --- a/src/openvg/qwindowsurface_vg.cpp +++ b/src/openvg/qwindowsurface_vg.cpp @@ -111,7 +111,7 @@ QPaintEngine *QVGWindowSurface::paintEngine() const int QVGWindowSurface::metric(PaintDeviceMetric met) const { - return window()->metric(met); + return qt_paint_device_metric(window(), met); } QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp b/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp index df623ba..955aa55 100644 --- a/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp +++ b/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp @@ -350,21 +350,9 @@ QPaintEngine *ShivaVGWindowSurface::paintEngine() const return d_ptr->engine; } -// We need to get access to QWidget::metric() from ShivaVGWindowSurface::metric, -// but it is not a friend of QWidget. To get around this, we create a -// fake QX11PaintEngine class, which is a friend. -class QX11PaintEngine -{ -public: - static int metric(const QWidget *widget, QPaintDevice::PaintDeviceMetric met) - { - return widget->metric(met); - } -}; - int ShivaVGWindowSurface::metric(PaintDeviceMetric met) const { - return QX11PaintEngine::metric(window(), met); + return qt_paint_device_metric(window(), met); } QT_END_NAMESPACE -- cgit v0.12 From 144294922df5a6782d96cd134a5e690c5262c408 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 15 Oct 2009 16:54:07 +1000 Subject: Remove qdocconf files for the old mac-specific source package. These files are not used for the qt-everywhere source packages, and the platform-specific source packages are no longer needed. Reviewed-by: Trust Me --- tools/qdoc3/test/qt-api-only-with-xcode.qdocconf | 29 ---------------------- tools/qdoc3/test/qt-build-docs-with-xcode.qdocconf | 3 --- tools/qdoc3/test/qt-with-xcode.qdocconf | 3 --- 3 files changed, 35 deletions(-) delete mode 100644 tools/qdoc3/test/qt-api-only-with-xcode.qdocconf delete mode 100644 tools/qdoc3/test/qt-build-docs-with-xcode.qdocconf delete mode 100644 tools/qdoc3/test/qt-with-xcode.qdocconf diff --git a/tools/qdoc3/test/qt-api-only-with-xcode.qdocconf b/tools/qdoc3/test/qt-api-only-with-xcode.qdocconf deleted file mode 100644 index 0d78cda..0000000 --- a/tools/qdoc3/test/qt-api-only-with-xcode.qdocconf +++ /dev/null @@ -1,29 +0,0 @@ -include(qt-build-docs-with-xcode.qdocconf) - -# Ensures that the generated index contains a URL that can be used by the -# tools documentation (assistant.qdocconf, designer.qdocconf, linguist.qdocconf, -# qmake.qdocconf). - -url = ./ - -# Ensures that the documentation for the tools is not included in the generated -# .qhp file. - -qhp.Qt.excluded = $QT_SOURCE_TREE/doc/src/development/assistant-manual.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/simpletextviewer.qdoc \ - $QT_SOURCE_TREE/doc/src/development/designer-manual.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/calculatorbuilder.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/calculatorform.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/customwidgetplugin.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/taskmenuextension.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/containerextension.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/worldtimeclockbuilder.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/worldtimeclockplugin.qdoc \ - $QT_SOURCE_TREE/doc/src/internationalization/linguist-manual.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/hellotr.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/arrowpad.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/trollprint.qdoc \ - $QT_SOURCE_TREE/doc/src/development/qmake-manual.qdoc - -outputdir = $QT_BUILD_TREE/doc-build/html-qt -base = file:$QT_BUILD_TREE/doc-build/html-qt diff --git a/tools/qdoc3/test/qt-build-docs-with-xcode.qdocconf b/tools/qdoc3/test/qt-build-docs-with-xcode.qdocconf deleted file mode 100644 index e4be476..0000000 --- a/tools/qdoc3/test/qt-build-docs-with-xcode.qdocconf +++ /dev/null @@ -1,3 +0,0 @@ -include( qt-build-docs.qdocconf ) - -HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/qt-with-xcode.qdocconf b/tools/qdoc3/test/qt-with-xcode.qdocconf deleted file mode 100644 index 932f6d9..0000000 --- a/tools/qdoc3/test/qt-with-xcode.qdocconf +++ /dev/null @@ -1,3 +0,0 @@ -include( qt.qdocconf ) - -HTML.generatemacrefs = "true" -- cgit v0.12 From 90aef55f03990960fff581339513c1918c7de36f Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 15 Oct 2009 17:13:08 +1000 Subject: Signal for an update when the cursor is visible The bug against QFxTextInput is actually due to a bug in QLineControl. Task-number: QT-2319 Reviewed-by: Martin Jones --- src/gui/widgets/qlinecontrol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 5930540..7f9ff82 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1290,7 +1290,7 @@ void QLineControl::setCursorBlinkPeriod(int msec) m_blinkStatus = 1; } else { m_blinkTimer = 0; - if (m_blinkStatus == 0) + if (m_blinkStatus == 1) emit updateNeeded(inputMask().isEmpty() ? cursorRect() : QRect()); } m_blinkPeriod = msec; -- cgit v0.12 From 376a5a845ba6d19751a58ea79a8d5701c4ba4d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 15 Oct 2009 09:58:29 +0200 Subject: Compile on Carbon. ifdef out QCocoaPrintPanelDelegate. --- src/gui/dialogs/qprintdialog_mac.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/dialogs/qprintdialog_mac.mm b/src/gui/dialogs/qprintdialog_mac.mm index 667fc40..56a065a 100644 --- a/src/gui/dialogs/qprintdialog_mac.mm +++ b/src/gui/dialogs/qprintdialog_mac.mm @@ -122,6 +122,8 @@ QT_END_NAMESPACE QT_USE_NAMESPACE +#ifdef QT_MAC_USE_COCOA + @class QCocoaPrintPanelDelegate; @interface QCocoaPrintPanelDelegate : NSObject { @@ -197,6 +199,8 @@ QT_USE_NAMESPACE } @end +#endif + QT_BEGIN_NAMESPACE extern void macStartInterceptWindowTitle(QWidget *window); -- cgit v0.12 From 9a3cdecc11e8dabaf2390eaab2c71e64f6521e69 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 15 Oct 2009 10:13:27 +0200 Subject: Compile There's no implicit conversion from QPixmap to QImage Reviewed-by: Gunnar --- src/gui/effects/qgraphicseffect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 42845cc..91641b0 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -1504,7 +1504,7 @@ void QGraphicsBloomEffect::draw(QPainter *painter, QGraphicsEffectSource *source QTransform restoreTransform = painter->worldTransform(); painter->setWorldTransform(QTransform()); - painter->drawImage(offset, pixmap); + painter->drawPixmap(offset, pixmap); painter->setWorldTransform(restoreTransform); } -- cgit v0.12 From d83761cf3ddd301545ebd9981b9d0547e636e3b4 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Thu, 15 Oct 2009 10:33:25 +0200 Subject: Fixed bitmap brushes and tiled bitmaps in the OpenGL1 paint engine. Fixed drawing of bitmap brushes and tiled bitmaps so that they are painted with the brush colour or pen colour instead of black. Reviewed-by: Trond --- src/opengl/qpaintengine_opengl.cpp | 14 ++- src/opengl/util/fragmentprograms_p.h | 208 ++++++++++++++++++++--------------- src/opengl/util/pattern_brush.glsl | 2 +- 3 files changed, 132 insertions(+), 92 deletions(-) diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index fc1695d..1a586d3 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -1222,7 +1222,7 @@ inline void QOpenGLPaintEnginePrivate::setGradientOps(const QBrush &brush, const fragment_brush = FRAGMENT_PROGRAM_BRUSH_CONICAL; else if (current_style == Qt::SolidPattern) fragment_brush = FRAGMENT_PROGRAM_BRUSH_SOLID; - else if (current_style == Qt::TexturePattern) + else if (current_style == Qt::TexturePattern && !brush.texture().isQBitmap()) fragment_brush = FRAGMENT_PROGRAM_BRUSH_TEXTURE; else fragment_brush = FRAGMENT_PROGRAM_BRUSH_PATTERN; @@ -4311,6 +4311,16 @@ void QOpenGLPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QR void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &offset) { Q_D(QOpenGLPaintEngine); + if (pm.depth() == 1) { + QPixmap tpx(pm.size()); + tpx.fill(Qt::transparent); + QPainter p(&tpx); + p.setPen(d->cpen); + p.drawPixmap(0, 0, pm); + p.end(); + drawTiledPixmap(r, tpx, offset); + return; + } QImage scaled; const int sz = d->max_texture_size; @@ -5207,7 +5217,7 @@ void QOpenGLPaintEnginePrivate::composite(GLuint primitive, const q_vertexType * device->context()->d_func()->bindTexture(cbrush.textureImage(), GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); else - device->context()->d_func()->bindTexture(qt_imageForBrush(current_style, true), + device->context()->d_func()->bindTexture(qt_imageForBrush(current_style, false), GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); diff --git a/src/opengl/util/fragmentprograms_p.h b/src/opengl/util/fragmentprograms_p.h index 89cd182..9154c6e 100644 --- a/src/opengl/util/fragmentprograms_p.h +++ b/src/opengl/util/fragmentprograms_p.h @@ -5927,11 +5927,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.z;\n" - "MUL R1.xy, R0.zwzw, c[0];\n" + "MUL R0.xy, R0, R0.z;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" + "TEX R1.x, R0.zwzw, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[7];\n" "TEX R0, R0, texture[0], 2D;\n" - "TEX R1.x, R1, texture[2], 2D;\n" + "ADD R1.x, -R1, c[10];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R2.xyz, R0, c[4].y;\n" "MUL R3.xyz, R1.w, R2;\n" @@ -5967,11 +5968,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.z;\n" - "MUL R1.xy, R0.zwzw, c[0];\n" + "MUL R0.xy, R0, R0.z;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" + "TEX R1.x, R0.zwzw, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" - "TEX R1.x, R1, texture[2], 2D;\n" + "ADD R1.x, -R1, c[8];\n" "MUL R1, fragment.color.primary, R1.x;\n" "ADD R2.x, -R0.w, c[8];\n" "MUL R2.xyz, R1, R2.x;\n" @@ -5991,7 +5993,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SCREEN = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..7] };\n" + "PARAM c[9] = { program.local[0..7],\n" + " { 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6002,11 +6005,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[2], 2D;\n" - "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0.x, R0, texture[2], 2D;\n" + "ADD R0.z, -R0.x, c[8].x;\n" "ADD R3.xy, fragment.position, c[6];\n" + "MUL R1, fragment.color.primary, R0.z;\n" + "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" - "MUL R1, fragment.color.primary, R1.x;\n" "ADD R2, R1, R0;\n" "MAD R2, -R1, R0, R2;\n" "MUL R3.xy, R3, c[4];\n" @@ -6020,7 +6024,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_OVERLAY = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 2, 1 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6033,23 +6037,24 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0.x, R0, texture[2], 2D;\n" + "ADD R0.x, -R0, c[8];\n" "MUL R1, fragment.color.primary, R0.x;\n" "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" - "ADD R2.w, -R0, c[8].y;\n" + "ADD R2.w, -R0, c[8].x;\n" "ADD R3.xyz, R1.w, -R1;\n" "ADD R2.xyz, R0.w, -R0;\n" "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[8].x;\n" + "MUL R2.xyz, R2, c[8].y;\n" "MAD R2.xyz, R1.w, R0.w, -R2;\n" "MUL R4.xyz, R1, R2.w;\n" "MUL R3.xyz, R1, R0;\n" "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8].y;\n" - "MAD R3.xyz, R3, c[8].x, R4;\n" + "ADD R2.x, -R1.w, c[8];\n" + "MAD R3.xyz, R3, c[8].y, R4;\n" "MAD R3.xyz, R0, R2.x, R3;\n" "MAD R1.xyz, R0, R2.x, R1;\n" - "MUL R2.xyz, R0, c[8].x;\n" + "MUL R2.xyz, R0, c[8].y;\n" "ADD R1.xyz, R1, -R3;\n" "SGE R2.xyz, R2, R0.w;\n" "MAD R2.xyz, R2, R1, R3;\n" @@ -6077,10 +6082,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[2], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" + "ADD R1.x, -R1, c[8];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R3.xyz, R1.w, R0;\n" "MUL R2.xyz, R1, R0.w;\n" @@ -6113,10 +6119,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[2], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" + "ADD R1.x, -R1, c[8];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R3.xyz, R1.w, R0;\n" "MUL R2.xyz, R1, R0.w;\n" @@ -6152,6 +6159,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0.x, R0, texture[2], 2D;\n" + "ADD R0.x, -R0, c[8];\n" "MUL R1, fragment.color.primary, R0.x;\n" "MAX R0.x, R1.w, c[8].y;\n" "RCP R0.x, R0.x;\n" @@ -6201,7 +6209,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[2], 2D;\n" + "TEX R0.x, R0, texture[2], 2D;\n" + "ADD R1.x, -R0, c[8];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" @@ -6238,7 +6247,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_HARDLIGHT = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 2, 1 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6251,21 +6260,22 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0.x, R0, texture[2], 2D;\n" + "ADD R0.x, -R0, c[8];\n" "MUL R1, fragment.color.primary, R0.x;\n" "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" - "ADD R2.w, -R0, c[8].y;\n" + "ADD R2.w, -R0, c[8].x;\n" "ADD R3.xyz, R1.w, -R1;\n" "ADD R2.xyz, R0.w, -R0;\n" "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[8].x;\n" + "MUL R2.xyz, R2, c[8].y;\n" "MAD R2.xyz, R1.w, R0.w, -R2;\n" "MUL R4.xyz, R1, R2.w;\n" "MAD R2.xyz, R1, R2.w, R2;\n" "MUL R3.xyz, R1, R0;\n" - "ADD R2.w, -R1, c[8].y;\n" - "MAD R3.xyz, R3, c[8].x, R4;\n" - "MUL R1.xyz, R1, c[8].x;\n" + "ADD R2.w, -R1, c[8].x;\n" + "MAD R3.xyz, R3, c[8].y, R4;\n" + "MUL R1.xyz, R1, c[8].y;\n" "SGE R1.xyz, R1, R1.w;\n" "MAD R3.xyz, R0, R2.w, R3;\n" "MAD R2.xyz, R0, R2.w, R2;\n" @@ -6296,24 +6306,25 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R6;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.x, R0.w, c[8].z;\n" - "RCP R2.w, R1.x;\n" + "MAX R1.w, R0, c[8].z;\n" + "RCP R2.w, R1.w;\n" "MUL R2.xyz, R0, R2.w;\n" "RSQ R1.w, R2.x;\n" - "RCP R3.x, R1.w;\n" - "RSQ R1.w, R2.y;\n" "MUL R5.xyz, -R2, c[8].w;\n" "MUL R1.xyz, fragment.position.y, c[2];\n" "MAD R1.xyz, fragment.position.x, c[1], R1;\n" "ADD R1.xyz, R1, c[3];\n" "RCP R1.z, R1.z;\n" "MUL R1.xy, R1, R1.z;\n" - "RSQ R1.z, R2.z;\n" "MUL R1.xy, R1, c[0];\n" - "MAD R2.xyz, -R0, R2.w, c[8].x;\n" - "RCP R3.y, R1.w;\n" - "RCP R3.z, R1.z;\n" "TEX R1.x, R1, texture[2], 2D;\n" + "RSQ R1.z, R2.y;\n" + "RSQ R1.y, R2.z;\n" + "MAD R2.xyz, -R0, R2.w, c[8].x;\n" + "RCP R3.x, R1.w;\n" + "RCP R3.y, R1.z;\n" + "RCP R3.z, R1.y;\n" + "ADD R1.x, -R1, c[8];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MAD R4.xyz, R0.w, R3, -R0;\n" "MAD R3.xyz, R1, c[8].y, -R1.w;\n" @@ -6351,7 +6362,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_DIFFERENCE = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 2 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6361,16 +6372,17 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[2], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[5];\n" + "ADD R1.x, -R1, c[8];\n" "TEX R0, R0, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "ADD R2.xyz, R1, R0;\n" "MUL R3.xyz, R1.w, R0;\n" "MUL R1.xyz, R1, R0.w;\n" "MIN R1.xyz, R1, R3;\n" - "MAD R2.xyz, -R1, c[8].x, R2;\n" + "MAD R2.xyz, -R1, c[8].y, R2;\n" "ADD R1.z, R1.w, R0.w;\n" "MAD R2.w, -R1, R0, R1.z;\n" "ADD R1.xy, fragment.position, c[6];\n" @@ -6385,7 +6397,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_EXCLUSION = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 2, 1 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6395,18 +6407,19 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[2], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" + "ADD R1.x, -R1, c[8];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R2.xyz, R1.w, R0;\n" "MAD R3.xyz, R1, R0.w, R2;\n" "MUL R2.xyz, R1, R0;\n" - "MAD R2.xyz, -R2, c[8].x, R3;\n" - "ADD R2.w, -R0, c[8].y;\n" + "MAD R2.xyz, -R2, c[8].y, R3;\n" + "ADD R2.w, -R0, c[8].x;\n" "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8].y;\n" + "ADD R2.x, -R1.w, c[8];\n" "MAD R2.xyz, R0, R2.x, R1;\n" "ADD R1.z, R1.w, R0.w;\n" "MAD R2.w, -R1, R0, R1.z;\n" @@ -6432,11 +6445,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R1.xy, R0, c[0];\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[1], 2D;\n" "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R2.xyz, R0, c[4].y;\n" - "TEX R1.x, R1, texture[1], 2D;\n" + "ADD R1.x, -R1, c[7];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R3.xyz, R1.w, R2;\n" "MUL R2.xyz, R1, c[4].x;\n" @@ -6466,10 +6480,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R1.xy, R0, c[0];\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[1], 2D;\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" - "TEX R1.x, R1, texture[1], 2D;\n" + "ADD R1.x, -R1, c[5];\n" "MUL R1, fragment.color.primary, R1.x;\n" "ADD R2.x, -R0.w, c[5];\n" "MUL R2.xyz, R1, R2.x;\n" @@ -6483,7 +6498,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SCREEN_NOMASK = "!!ARBfp1.0\n" - "PARAM c[5] = { program.local[0..4] };\n" + "PARAM c[6] = { program.local[0..4],\n" + " { 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6493,7 +6509,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R1.x, -R0, c[5];\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" @@ -6505,7 +6522,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_OVERLAY_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 2, 1 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6517,23 +6534,24 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R0.x, -R0, c[5];\n" "MUL R1, fragment.color.primary, R0.x;\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" "ADD R3.xyz, R1.w, -R1;\n" "ADD R2.xyz, R0.w, -R0;\n" "MUL R2.xyz, R2, R3;\n" - "ADD R2.w, -R0, c[5].y;\n" - "MUL R2.xyz, R2, c[5].x;\n" + "ADD R2.w, -R0, c[5].x;\n" + "MUL R2.xyz, R2, c[5].y;\n" "MAD R2.xyz, R1.w, R0.w, -R2;\n" "MAD R2.xyz, R1, R2.w, R2;\n" "MUL R3.xyz, R1, R2.w;\n" "MUL R1.xyz, R1, R0;\n" - "ADD R2.w, -R1, c[5].y;\n" - "MAD R1.xyz, R1, c[5].x, R3;\n" + "ADD R2.w, -R1, c[5].x;\n" + "MAD R1.xyz, R1, c[5].y, R3;\n" "MAD R1.xyz, R0, R2.w, R1;\n" "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R0.xyz, R0, c[5].x;\n" + "MUL R0.xyz, R0, c[5].y;\n" "ADD R2.w, R1, R0;\n" "ADD R2.xyz, R2, -R1;\n" "SGE R0.xyz, R0, R0.w;\n" @@ -6556,7 +6574,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R1.x, -R0, c[5];\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" @@ -6586,7 +6605,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R1.x, -R0, c[5];\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" @@ -6617,6 +6637,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R0.x, -R0, c[5];\n" "MUL R1, fragment.color.primary, R0.x;\n" "MAX R0.x, R1.w, c[5].y;\n" "RCP R0.x, R0.x;\n" @@ -6660,7 +6681,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R1.x, -R0, c[5];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" @@ -6691,7 +6713,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_HARDLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 2, 1 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6704,21 +6726,22 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R0.x, -R0, c[5];\n" "MUL R1, fragment.color.primary, R0.x;\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" - "ADD R2.w, -R0, c[5].y;\n" + "ADD R2.w, -R0, c[5].x;\n" "ADD R3.xyz, R1.w, -R1;\n" "ADD R2.xyz, R0.w, -R0;\n" "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[5].x;\n" + "MUL R2.xyz, R2, c[5].y;\n" "MAD R2.xyz, R1.w, R0.w, -R2;\n" "MAD R2.xyz, R1, R2.w, R2;\n" "MUL R4.xyz, R1, R2.w;\n" "MUL R3.xyz, R1, R0;\n" - "MUL R1.xyz, R1, c[5].x;\n" - "ADD R2.w, -R1, c[5].y;\n" - "MAD R3.xyz, R3, c[5].x, R4;\n" + "MUL R1.xyz, R1, c[5].y;\n" + "ADD R2.w, -R1, c[5].x;\n" + "MAD R3.xyz, R3, c[5].y, R4;\n" "MAD R3.xyz, R0, R2.w, R3;\n" "MAD R0.xyz, R0, R2.w, R2;\n" "ADD R2.x, R1.w, R0.w;\n" @@ -6743,24 +6766,25 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R6;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.x, R0.w, c[5].z;\n" - "RCP R2.w, R1.x;\n" + "MAX R1.w, R0, c[5].z;\n" + "RCP R2.w, R1.w;\n" "MUL R2.xyz, R0, R2.w;\n" "RSQ R1.w, R2.x;\n" - "RCP R3.x, R1.w;\n" - "RSQ R1.w, R2.y;\n" "MUL R5.xyz, -R2, c[5].w;\n" "MUL R1.xyz, fragment.position.y, c[2];\n" "MAD R1.xyz, fragment.position.x, c[1], R1;\n" "ADD R1.xyz, R1, c[3];\n" "RCP R1.z, R1.z;\n" "MUL R1.xy, R1, R1.z;\n" - "RSQ R1.z, R2.z;\n" "MUL R1.xy, R1, c[0];\n" - "MAD R2.xyz, -R0, R2.w, c[5].x;\n" - "RCP R3.y, R1.w;\n" - "RCP R3.z, R1.z;\n" "TEX R1.x, R1, texture[1], 2D;\n" + "RSQ R1.z, R2.y;\n" + "RSQ R1.y, R2.z;\n" + "MAD R2.xyz, -R0, R2.w, c[5].x;\n" + "RCP R3.x, R1.w;\n" + "RCP R3.y, R1.z;\n" + "RCP R3.z, R1.y;\n" + "ADD R1.x, -R1, c[5];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MAD R4.xyz, R0.w, R3, -R0;\n" "MAD R3.xyz, R1, c[5].y, -R1.w;\n" @@ -6792,7 +6816,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_DIFFERENCE_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 2 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6803,7 +6827,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R1.x, -R0, c[5];\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" @@ -6812,7 +6837,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R1, R0;\n" "MIN R2.xyz, R2, R3;\n" "ADD R1.x, R1.w, R0.w;\n" - "MAD result.color.xyz, -R2, c[5].x, R0;\n" + "MAD result.color.xyz, -R2, c[5].y, R0;\n" "MAD result.color.w, -R1, R0, R1.x;\n" "END\n" ; @@ -6820,7 +6845,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_EXCLUSION_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 2, 1 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6831,18 +6856,19 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R1.x, -R0, c[5];\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R2.xyz, R1.w, R0;\n" "MAD R3.xyz, R1, R0.w, R2;\n" "MUL R2.xyz, R1, R0;\n" - "MAD R2.xyz, -R2, c[5].x, R3;\n" - "ADD R2.w, -R0, c[5].y;\n" + "MAD R2.xyz, -R2, c[5].y, R3;\n" + "ADD R2.w, -R0, c[5].x;\n" "MAD R1.xyz, R1, R2.w, R2;\n" "ADD R2.x, R1.w, R0.w;\n" - "ADD R2.y, -R1.w, c[5];\n" + "ADD R2.y, -R1.w, c[5].x;\n" "MAD result.color.xyz, R0, R2.y, R1;\n" "MAD result.color.w, -R1, R0, R2.x;\n" "END\n" @@ -6850,20 +6876,22 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODE_BLEND_MODE_MASK = "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..6] };\n" + "PARAM c[8] = { program.local[0..6],\n" + " { 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "MUL R0.xyz, fragment.position.y, c[2];\n" "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R1.xyz, R0, c[3];\n" - "RCP R0.z, R1.z;\n" - "MUL R0.zw, R1.xyxy, R0.z;\n" - "MUL R1.xy, R0.zwzw, c[0];\n" + "ADD R0.xyz, R0, c[3];\n" + "RCP R0.z, R0.z;\n" + "MUL R0.zw, R0.xyxy, R0.z;\n" + "MUL R0.zw, R0, c[0].xyxy;\n" + "TEX R1.x, R0.zwzw, texture[1], 2D;\n" "ADD R0.xy, fragment.position, c[5];\n" "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" - "TEX R1.x, R1, texture[1], 2D;\n" "DP4 R1.y, R0, c[6];\n" + "ADD R1.x, -R1, c[7];\n" "MUL R0, fragment.color.primary, R1.x;\n" "MUL result.color, R0, R1.y;\n" "END\n" @@ -6871,7 +6899,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODE_BLEND_MODE_NOMASK = "!!ARBfp1.0\n" - "PARAM c[4] = { program.local[0..3] };\n" + "PARAM c[5] = { program.local[0..3],\n" + " { 1 } };\n" "TEMP R0;\n" "MUL R0.xyz, fragment.position.y, c[2];\n" "MAD R0.xyz, fragment.position.x, c[1], R0;\n" @@ -6880,6 +6909,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0.x, R0, texture[0], 2D;\n" + "ADD R0.x, -R0, c[4];\n" "MUL result.color, fragment.color.primary, R0.x;\n" "END\n" ; diff --git a/src/opengl/util/pattern_brush.glsl b/src/opengl/util/pattern_brush.glsl index ac139b2..31702b8 100644 --- a/src/opengl/util/pattern_brush.glsl +++ b/src/opengl/util/pattern_brush.glsl @@ -17,7 +17,7 @@ vec4 brush() coords *= inv_brush_texture_size; - float alpha = texture2D(brush_texture, coords).r; + float alpha = 1.0 - texture2D(brush_texture, coords).r; return gl_Color * alpha; } -- cgit v0.12 From 6c694eaae2b40be57c3292f43e085893095d9722 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 14 Oct 2009 13:18:18 +0100 Subject: When reparenting native widget, delayed deletion of Symbian control until control returns to the event loop. This is necessary because reparenting can be triggered from the context of a control's event handler. If reparenting causes that control to be deleted, a crash can result. Task-number: QTBUG-4664 Reviewed-by: axis --- src/gui/kernel/qapplication_s60.cpp | 5 +++++ src/gui/kernel/qwidget.cpp | 7 +++++++ src/gui/kernel/qwidget.h | 3 +++ src/gui/kernel/qwidget_p.h | 1 + src/gui/kernel/qwidget_s60.cpp | 13 ++++++++++++- 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index b1706af..1a8aae0 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1122,6 +1122,11 @@ void qt_init(QApplicationPrivate * /* priv */, int) ; } */ + + // Register WId with the metatype system. This is to enable + // QWidgetPrivate::create_sys to used delayed slot invokation in order + // to destroy WId objects during reparenting. + qRegisterMetaType("WId"); } /***************************************************************************** diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 7c11c00..7c9356e 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -11994,3 +11994,10 @@ void QWidget::clearMask() XRender extension is not supported on the X11 display, or if the handle could not be created. */ + +#ifdef Q_OS_SYMBIAN +void QWidgetPrivate::_q_delayedDestroy(WId winId) +{ + delete winId; +} +#endif diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 76418af..e7daf9f 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -773,6 +773,9 @@ private: private: Q_DISABLE_COPY(QWidget) Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden()) +#ifdef Q_OS_SYMBIAN + Q_PRIVATE_SLOT(d_func(), void _q_delayedDestroy(WId winId)) +#endif QWidgetData *data; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index a4cc0da..c7b8d42 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -295,6 +295,7 @@ public: #ifdef Q_OS_SYMBIAN void setSoftKeys_sys(const QList &softkeys); void activateSymbianWindow(WId wid = 0); + void _q_delayedDestroy(WId winId); #endif void raise_sys(); diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 5527cc8..c3686b3 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -56,6 +56,12 @@ #include #endif +// This is necessary in order to be able to perform delayed invokation on slots +// which take arguments of type WId. One example is +// QWidgetPrivate::_q_delayedDestroy, which is used to delay destruction of +// CCoeControl objects until after the CONE event handler has finished running. +Q_DECLARE_METATYPE(WId) + QT_BEGIN_NAMESPACE extern bool qt_nograb(); @@ -438,7 +444,12 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de if (destroyw) { destroyw->ControlEnv()->AppUi()->RemoveFromStack(destroyw); - CBase::Delete(destroyw); + + // Delay deletion of the control in case this function is called in the + // context of a CONE event handler such as + // CCoeControl::ProcessPointerEventL + QMetaObject::invokeMethod(q, "_q_delayedDestroy", + Qt::QueuedConnection, Q_ARG(WId, destroyw)); } if (q->testAttribute(Qt::WA_AcceptTouchEvents)) -- cgit v0.12 From 342a1233df813f00df475b713fa1c6252ee4dcd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 15 Oct 2009 10:46:59 +0200 Subject: Fixed buggy bitmap drawing in GL 2 engine on X11. Don't use texture_from_pixmap extension for QBitmaps. Reviewed-by: Tom --- src/opengl/qgl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 8aef8b4..1be2073 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2352,7 +2352,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, #if defined(Q_WS_X11) // Try to use texture_from_pixmap - if (pd->classId() == QPixmapData::X11Class) { + if (pd->classId() == QPixmapData::X11Class && pd->pixelType() == QPixmapData::PixmapType) { texture = bindTextureFromNativePixmap(pd, key, options); if (texture) { texture->options |= QGLContext::MemoryManagedBindOption; -- cgit v0.12 From ae33eb787a8b0ff9b04f02b9c18bad0bf6736b7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 14 Oct 2009 15:50:44 +0200 Subject: Optimized raster drop shadow filter to only blur alpha channel. Reviewed-by: Gunnar --- src/gui/image/qpixmapfilter.cpp | 51 ++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index df445db..9fcf776 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -591,7 +591,7 @@ QRectF QPixmapBlurFilter::boundingRectFor(const QRectF &rect) const // Blur the image according to the blur radius // Based on exponential blur algorithm by Jani Huhtanen // (maximum radius is set to 16) -static QImage blurred(const QImage& image, const QRect& rect, int radius) +static QImage blurred(const QImage& image, const QRect& rect, int radius, bool alphaOnly = false) { int tab[] = { 14, 10, 8, 6, 5, 5, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 }; int alpha = (radius < 1) ? 16 : (radius > 17) ? 1 : tab[radius-1]; @@ -606,47 +606,53 @@ static QImage blurred(const QImage& image, const QRect& rect, int radius) int rgba[4]; unsigned char* p; + int i1 = 0; + int i2 = 3; + + if (alphaOnly) + i1 = i2 = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3); + for (int col = c1; col <= c2; col++) { p = result.scanLine(r1) + col * 4; - for (int i = 0; i < 4; i++) + for (int i = i1; i <= i2; i++) rgba[i] = p[i] << 4; p += bpl; for (int j = r1; j < r2; j++, p += bpl) - for (int i = 0; i < 4; i++) + for (int i = i1; i <= i2; i++) p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4; } for (int row = r1; row <= r2; row++) { p = result.scanLine(row) + c1 * 4; - for (int i = 0; i < 4; i++) + for (int i = i1; i <= i2; i++) rgba[i] = p[i] << 4; p += 4; for (int j = c1; j < c2; j++, p += 4) - for (int i = 0; i < 4; i++) + for (int i = i1; i <= i2; i++) p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4; } for (int col = c1; col <= c2; col++) { p = result.scanLine(r2) + col * 4; - for (int i = 0; i < 4; i++) + for (int i = i1; i <= i2; i++) rgba[i] = p[i] << 4; p -= bpl; for (int j = r1; j < r2; j++, p -= bpl) - for (int i = 0; i < 4; i++) + for (int i = i1; i <= i2; i++) p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4; } for (int row = r1; row <= r2; row++) { p = result.scanLine(row) + c2 * 4; - for (int i = 0; i < 4; i++) + for (int i = i1; i <= i2; i++) rgba[i] = p[i] << 4; p -= 4; for (int j = c1; j < c2; j++, p -= 4) - for (int i = 0; i < 4; i++) + for (int i = i1; i <= i2; i++) p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4; } @@ -892,11 +898,11 @@ class QPixmapDropShadowFilterPrivate : public QPixmapFilterPrivate { public: QPixmapDropShadowFilterPrivate() - : offset(8, 8), color(63, 63, 63, 180), blurFilter(new QPixmapBlurFilter) {} + : offset(8, 8), color(63, 63, 63, 180), radius(1) {} QPointF offset; QColor color; - QPixmapBlurFilter *blurFilter; + int radius; }; /*! @@ -940,8 +946,6 @@ public: QPixmapDropShadowFilter::QPixmapDropShadowFilter(QObject *parent) : QPixmapFilter(*new QPixmapDropShadowFilterPrivate, DropShadowFilter, parent) { - Q_D(QPixmapDropShadowFilter); - d->blurFilter->setRadius(1); } /*! @@ -951,8 +955,6 @@ QPixmapDropShadowFilter::QPixmapDropShadowFilter(QObject *parent) */ QPixmapDropShadowFilter::~QPixmapDropShadowFilter() { - Q_D(QPixmapDropShadowFilter); - delete d->blurFilter; } /*! @@ -967,7 +969,7 @@ QPixmapDropShadowFilter::~QPixmapDropShadowFilter() int QPixmapDropShadowFilter::blurRadius() const { Q_D(const QPixmapDropShadowFilter); - return d->blurFilter->radius(); + return d->radius; } /*! @@ -982,7 +984,7 @@ int QPixmapDropShadowFilter::blurRadius() const void QPixmapDropShadowFilter::setBlurRadius(int radius) { Q_D(QPixmapDropShadowFilter); - d->blurFilter->setRadius(radius); + d->radius = radius; } /*! @@ -1056,7 +1058,7 @@ QRectF QPixmapDropShadowFilter::boundingRectFor(const QRectF &rect) const { Q_D(const QPixmapDropShadowFilter); - const qreal delta = qreal(d->blurFilter->radius() * 2); + const qreal delta = qreal(d->radius * 2); qreal x1 = qMin(rect.left(), rect.left() + d->offset.x() - delta); qreal y1 = qMin(rect.top(), rect.top() + d->offset.y() - delta); qreal x2 = qMax(rect.right(), rect.right() + d->offset.x() + delta); @@ -1079,24 +1081,25 @@ void QPixmapDropShadowFilter::draw(QPainter *p, QPixmapDropShadowFilter *dropShadowFilter = static_cast(filter); if (dropShadowFilter) { dropShadowFilter->setColor(d->color); - dropShadowFilter->setBlurRadius(d->blurFilter->radius()); + dropShadowFilter->setBlurRadius(d->radius); dropShadowFilter->setOffset(d->offset); dropShadowFilter->draw(p, pos, px, src); return; } - QImage tmp = src.isNull() ? px.toImage() : px.copy(src.toRect()).toImage(); - QPainter tmpPainter(&tmp); + QImage tmp = src.isNull() ? px.toImage() : px.copy(src.toAlignedRect()).toImage(); + + // blur the alpha channel + tmp = blurred(tmp, tmp.rect(), d->radius, true); // blacken the image... + QPainter tmpPainter(&tmp); tmpPainter.setCompositionMode(QPainter::CompositionMode_SourceIn); tmpPainter.fillRect(0, 0, tmp.width(), tmp.height(), d->color); tmpPainter.end(); - const QPixmap pixTmp = QPixmap::fromImage(tmp); - // draw the blurred drop shadow... - d->blurFilter->draw(p, pos + d->offset, pixTmp); + p->drawImage(pos + d->offset, tmp); // Draw the actual pixmap... p->drawPixmap(pos, px, src); -- cgit v0.12 From 1c4b7e282b54bc39f5e3af96363973f0ec9c8cb9 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Thu, 15 Oct 2009 11:20:58 +0200 Subject: Remove trailing whitespace. --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 2 +- src/3rdparty/phonon/mmf/abstractplayer.h | 6 +- src/3rdparty/phonon/mmf/mediaobject.cpp | 2 +- .../phonon/mmf/mmfphonondebug/objectdump.cpp | 118 ++++++++++----------- .../phonon/mmf/mmfphonondebug/objectdump.h | 30 +++--- .../phonon/mmf/mmfphonondebug/objecttree.cpp | 20 ++-- .../phonon/mmf/mmfphonondebug/objecttree.h | 38 +++---- 7 files changed, 108 insertions(+), 108 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index 2fdb092..4c9d1a5 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -381,7 +381,7 @@ 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) { diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h index ec39ab1..08558cf 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.h +++ b/src/3rdparty/phonon/mmf/abstractplayer.h @@ -87,7 +87,7 @@ public: // VolumeObserver virtual void volumeChanged(qreal volume); - + void setVideoOutput(VideoOutput* videoOutput); /** @@ -146,9 +146,9 @@ private: protected: // Not owned VideoOutput* m_videoOutput; - + qreal m_volume; - + private: PrivateState m_state; Phonon::ErrorType m_error; diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index 76db5cb..29ac2df 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -112,7 +112,7 @@ MMF::MediaType MMF::MediaObject::fileMediaType MediaType result = MediaTypeUnknown; if (openRecognizer()) { - + const QHBufC fileNameSymbian(QDir::toNativeSeparators(fileName)); m_file.Close(); diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp index ef2b81c..c5d066e 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp @@ -36,7 +36,7 @@ namespace ObjectDump QAnnotator::~QAnnotator() { - + } @@ -45,53 +45,53 @@ QAnnotator::~QAnnotator() //----------------------------------------------------------------------------- QList QAnnotatorBasic::annotation(const QObject& object) -{ +{ QList result; - + QByteArray array; QTextStream stream(&array); - + stream << '[' << &object << ']'; stream << ' '; stream << object.metaObject()->className(); - + if(object.objectName() != "") stream << " \"" << object.objectName() << '"'; - + if(object.isWidgetType()) stream << " isWidget"; - + stream.flush(); result.append(array); return result; } QList QAnnotatorWidget::annotation(const QObject& object) -{ +{ QList result; - + const QWidget* widget = qobject_cast(&object); if(widget) { - + QByteArray array; QTextStream stream(&array); - + stream << "widget: "; - + if(widget->isVisible()) stream << "visible "; else stream << "invisible "; - + stream << widget->x() << ',' << widget->y() << ' '; stream << widget->size().width() << 'x'<< widget->size().height() << ' '; - + stream << "hint " << widget->sizeHint().width() << 'x' << widget->sizeHint().height(); - + stream.flush(); result.append(array); } - + return result; } @@ -105,12 +105,12 @@ class QDumperBase public: QDumperBase(); ~QDumperBase(); - + void setPrefix(const QString& prefix); void addAnnotator(QAnnotator* annotator); - + protected: - QByteArray m_prefix; + QByteArray m_prefix; QList m_annotators; }; @@ -139,7 +139,7 @@ void QDumperBase::addAnnotator(QAnnotator* annotator) // Protect against an exception occurring during QList::append QScopedPointer holder(annotator); m_annotators.append(annotator); - holder.take(); + holder.take(); } @@ -148,13 +148,13 @@ void QDumperBase::addAnnotator(QAnnotator* annotator) //----------------------------------------------------------------------------- class QDumperPrivate : public QDumperBase -{ +{ public: QDumperPrivate(); ~QDumperPrivate(); void dumpObject(const QObject& object); - + }; @@ -206,27 +206,27 @@ void QDumper::addAnnotator(QAnnotator* annotator) } void QDumper::dumpObject(const QObject& object) -{ +{ d_func()->dumpObject(object); } - + //----------------------------------------------------------------------------- // QVisitor //----------------------------------------------------------------------------- class QVisitorPrivate : public QDumperBase -{ +{ public: QVisitorPrivate(); ~QVisitorPrivate(); - + void setIndent(unsigned indent); - + void visitNode(const QObject& object); void visitComplete(); -private: +private: class Node { public: @@ -235,24 +235,24 @@ private: QList m_annotation; QList m_children; - + typedef QList::const_iterator child_iterator; }; - + private: Node* findNode(const QObject* object) const; QByteArray branchBuffer(const QList& branches, bool isNodeLine, bool isLastChild) const; void dumpRecursive(const Node& node, QList branches, bool isLastChild); void dumpNode(const Node& node, const QList& branches, bool isLastChild); - + private: unsigned m_indent; - + QScopedPointer m_root; - + // Hash table used to associate internal nodes with QObjects typedef QHash Hash; - Hash m_hash; + Hash m_hash; }; static const unsigned DefaultIndent = 2; @@ -274,19 +274,19 @@ void QVisitorPrivate::setIndent(unsigned indent) } // Builds up a mirror of the object tree, rooted in m_root, with each node -// storing annotations generated by +// storing annotations generated by void QVisitorPrivate::visitNode(const QObject& object) -{ +{ QObject* const objectParent = object.parent(); Node* const nodeParent = objectParent ? findNode(objectParent) : 0; // Create a new node and store in scoped pointer for exception safety Node* node = new Node; QScopedPointer nodePtr(node); - + // Associate node with QObject m_hash.insert(&object, node); - + // Insert node into internal tree if(nodeParent) { @@ -297,7 +297,7 @@ void QVisitorPrivate::visitNode(const QObject& object) Q_ASSERT(m_root.isNull()); m_root.reset(nodePtr.take()); } - + // Generate and store annotations QAnnotator* annotator; foreach(annotator, m_annotators) @@ -322,13 +322,13 @@ QByteArray QVisitorPrivate::branchBuffer (const QList& branches, bool isNodeLine, bool isLastChild) const { const int depth = branches.count(); - + const QByteArray indent(m_indent, ' '); const QByteArray horiz(m_indent, '-'); QByteArray buffer; QTextStream stream(&buffer); - + for (int i=0; i branches, bool isLastChild) -{ +{ dumpNode(node, branches, isLastChild); - + // Recurse down tree const Node::child_iterator begin = node.m_children.begin(); const Node::child_iterator end = node.m_children.end(); for(Node::child_iterator i = begin; end != i; ++i) { - + isLastChild = (end == i + 1); - + if(begin == i) branches.push_back(!isLastChild); else branches.back() = !isLastChild; - + static const bool isNodeLine = false; const QByteArray buffer = branchBuffer(branches, isNodeLine, false); qDebug() << buffer.constData(); - + dumpRecursive(**i, branches, isLastChild); } } void QVisitorPrivate::dumpNode (const Node& node, const QList& branches, bool isLastChild) -{ +{ const QList::const_iterator begin = node.m_annotation.begin(), end = node.m_annotation.end(); - + if(begin == end) { // No annotations - just dump the object pointer const bool isNodeLine = true; @@ -408,7 +408,7 @@ void QVisitorPrivate::dumpNode QVisitorPrivate::Node::Node() { - + } QVisitorPrivate::Node::~Node() @@ -453,7 +453,7 @@ void QVisitor::visitPrepare() } void QVisitor::visitNode(const QObject& object) -{ +{ d_func()->visitNode(object); } @@ -474,7 +474,7 @@ void addDefaultAnnotators(QDumper& dumper) { dumper.addAnnotator(new QAnnotatorBasic); dumper.addAnnotator(new QAnnotatorWidget); - + // Add platform-specific annotators addDefaultAnnotators_sys(dumper); } @@ -483,7 +483,7 @@ void addDefaultAnnotators(QVisitor& visitor) { visitor.addAnnotator(new QAnnotatorBasic); visitor.addAnnotator(new QAnnotatorWidget); - + // Add platform-specific annotators addDefaultAnnotators_sys(visitor); } @@ -492,7 +492,7 @@ void dumpTreeFromRoot(const QObject& root, QVisitor& visitor) { // Set up iteration range ObjectTree::DepthFirstConstIterator begin(root), end; - + // Invoke generic visitor algorithm ObjectTree::visit(begin, end, visitor); } @@ -505,7 +505,7 @@ void dumpTreeFromLeaf(const QObject& leaf, QVisitor& visitor) { root = root->parent(); } - + dumpTreeFromRoot(*root, visitor); } @@ -513,7 +513,7 @@ void dumpAncestors(const QObject& leaf, QVisitor& visitor) { // Set up iteration range ObjectTree::AncestorConstIterator begin(leaf), end; - + // Invoke generic visitor algorithm ObjectTree::visit(begin, end, visitor); } diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h index cbd9bea..e94b3ac 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h @@ -32,7 +32,7 @@ namespace ObjectDump { /** - * Abstract base for annotator classes invoked by QVisitor. + * Abstract base for annotator classes invoked by QVisitor. */ class OBJECTDUMP_EXPORT QAnnotator : public QObject { @@ -72,29 +72,29 @@ class OBJECTDUMP_EXPORT QDumper : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QDumper) - + public: QDumper(); ~QDumper(); - + /** * Specify a prefix, to be printed on each line of output. */ void setPrefix(const QString& prefix); - + /** * Takes ownership of annotator. */ void addAnnotator(QAnnotator* annotator); - + /** * Invoke each annotator on the object and write to debug output. */ void dumpObject(const QObject& object); - + private: QScopedPointer d_ptr; - + }; @@ -107,36 +107,36 @@ class OBJECTDUMP_EXPORT QVisitor : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QVisitor) - + public: QVisitor(); ~QVisitor(); - + /** * Specify a prefix, to be printed on each line of output. */ void setPrefix(const QString& prefix); - + /** * Set number of spaces by which each level of the tree is indented. */ void setIndent(unsigned indent); - + /** * Called by the visitor algorithm before starting the visit. */ void visitPrepare(); - + /** * Called by the visitor algorithm as each node is visited. */ void visitNode(const QObject& object); - + /** * Called by the visitor algorithm when the visit is complete. */ void visitComplete(); - + /** * Takes ownership of annotator. */ @@ -144,7 +144,7 @@ public: private: QScopedPointer d_ptr; - + }; diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp index 5053b2d..bc61435 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp @@ -28,38 +28,38 @@ namespace ObjectTree DepthFirstConstIterator::DepthFirstConstIterator() : m_pointee(0) { - + } DepthFirstConstIterator::DepthFirstConstIterator (const QObject& root) : m_pointee(&root) { - + } - + DepthFirstConstIterator& DepthFirstConstIterator::operator++() { const QObjectList& children = m_pointee->children(); - + if (children.count() == 0) { backtrack(); } else { m_history.push(0); - m_pointee = children.first(); + m_pointee = children.first(); } - + return *this; } void DepthFirstConstIterator::backtrack() -{ +{ if (m_history.count()) { const int index = m_history.top(); m_history.pop(); - + const QObjectList& siblings = m_pointee->parent()->children(); if (siblings.count() > index + 1) { m_history.push(index + 1); @@ -70,7 +70,7 @@ void DepthFirstConstIterator::backtrack() backtrack(); } } - else { + else { // Reached end of search m_pointee = 0; } @@ -80,7 +80,7 @@ void DepthFirstConstIterator::backtrack() AncestorConstIterator::AncestorConstIterator() { - + } AncestorConstIterator::AncestorConstIterator(const QObject& leaf) diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h index f2729fa..6eb6076 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h @@ -34,24 +34,24 @@ namespace ObjectTree */ class OBJECTDUMP_EXPORT DepthFirstConstIterator { -public: +public: DepthFirstConstIterator(); DepthFirstConstIterator(const QObject& root); - + DepthFirstConstIterator& operator++(); - + inline bool operator==(const DepthFirstConstIterator& other) const { return other.m_pointee == m_pointee; } - + inline bool operator!=(const DepthFirstConstIterator& other) const { return other.m_pointee != m_pointee; } - + inline const QObject* operator->() const { return m_pointee; } inline const QObject& operator*() const { return *m_pointee; } - + private: void backtrack(); - + private: const QObject* m_pointee; QStack m_history; @@ -62,40 +62,40 @@ private: */ class OBJECTDUMP_EXPORT AncestorConstIterator { -public: +public: AncestorConstIterator(); AncestorConstIterator(const QObject& root); - + inline AncestorConstIterator& operator++() { m_ancestors.pop(); return *this; } - + inline bool operator==(const AncestorConstIterator& other) const { return other.m_ancestors == m_ancestors; } - + inline bool operator!=(const AncestorConstIterator& other) const { return other.m_ancestors != m_ancestors; } - + inline const QObject* operator->() const { return m_ancestors.top(); } inline const QObject& operator*() const { return *m_ancestors.top(); } - + private: QStack m_ancestors; - + }; /** * Generic algorithm for visiting nodes in an object tree. Nodes in the * tree are visited in a const context, therefore they are not modified * by this algorithm. - * + * * Visitor must provide functions with the following signatures: - * + * * Called before visit begins * void visitPrepare() - * + * * Called on each node visited * void visitNode(const QObject& object) - * + * * Called when visit is complete * void visitComplete() */ @@ -103,7 +103,7 @@ template void visit(Iterator begin, Iterator end, Visitor& visitor) { visitor.visitPrepare(); - + for( ; begin != end; ++begin) visitor.visitNode(*begin); -- cgit v0.12 From 3f1f0210cefaa3523c8d2cd5ead4bdbd5d92a68a Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Thu, 15 Oct 2009 11:28:21 +0200 Subject: Use QT_NO_DEBUG, not _DEBUG. --- src/3rdparty/phonon/mmf/mmf_videoplayer.cpp | 8 ++++---- src/3rdparty/phonon/mmf/utils.cpp | 2 +- src/3rdparty/phonon/mmf/utils.h | 4 ++-- src/3rdparty/phonon/mmf/videooutput.cpp | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index 6d7e0ed..53bbb77 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -27,7 +27,7 @@ along with this library. If not, see . #include "mmf_videoplayer.h" #include "utils.h" -#ifdef _DEBUG +#ifndef QT_NO_DEBUG #include "objectdump.h" #endif @@ -341,7 +341,7 @@ void MMF::VideoPlayer::videoOutputRegionChanged() } -#ifdef _DEBUG +#ifndef QT_NO_DEBUG // The following code is for debugging problems related to video visibility. It allows // the VideoPlayer instance to query the window server in order to determine the @@ -392,7 +392,7 @@ void MMF::VideoPlayer::updateMmfOutput() // MvpuoPrepareComplete, at which point the MMF controller has been // loaded. -#ifdef _DEBUG +#ifndef QT_NO_DEBUG getDsaRegion(m_wsSession, *m_window); #endif @@ -449,7 +449,7 @@ bool MMF::VideoPlayer::getNativeWindowSystemHandles() // Get top-level window control = QApplication::activeWindow()->effectiveWinId(); -#ifdef _DEBUG +#ifndef QT_NO_DEBUG if(m_videoOutput) { QScopedPointer dumper(new ObjectDump::QDumper); dumper->setPrefix("Phonon::MMF"); // to aid searchability of logs diff --git a/src/3rdparty/phonon/mmf/utils.cpp b/src/3rdparty/phonon/mmf/utils.cpp index 2f5b68f..607f938 100644 --- a/src/3rdparty/phonon/mmf/utils.cpp +++ b/src/3rdparty/phonon/mmf/utils.cpp @@ -62,7 +62,7 @@ MMF::MediaType MMF::Utils::mimeTypeToMediaType(const TDesC& mimeType) } -#ifdef _DEBUG +#ifndef QT_NO_DEBUG #include #include diff --git a/src/3rdparty/phonon/mmf/utils.h b/src/3rdparty/phonon/mmf/utils.h index 38964d0..727abb0 100644 --- a/src/3rdparty/phonon/mmf/utils.h +++ b/src/3rdparty/phonon/mmf/utils.h @@ -54,7 +54,7 @@ void panic(PanicCode code); */ MediaType mimeTypeToMediaType(const TDesC& mimeType); -#ifdef _DEBUG +#ifndef QT_NO_DEBUG /** * Retrieve color of specified pixel from the screen. */ @@ -138,7 +138,7 @@ public: #define _TRACE_MODULE Phonon::MMF // Macros available for use by implementation code -#ifdef _DEBUG +#ifndef QT_NO_DEBUG #define TRACE_CONTEXT(_fn, _cat) const ::Phonon::MMF::TTraceContext _tc((TText*)L ## #_fn, (TUint)this, _cat); #define TRACE_ENTRY_0() { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "+ Phonon::MMF::%s [0x%08x]"), _tc.iFunction, _tc.iAddr); } #define TRACE_ENTRY(string, args...) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "+ Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); } diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp index 0541612..13d00f5 100644 --- a/src/3rdparty/phonon/mmf/videooutput.cpp +++ b/src/3rdparty/phonon/mmf/videooutput.cpp @@ -20,7 +20,7 @@ along with this library. If not, see . #include "videooutput.h" #include "videooutputobserver.h" -#ifdef _DEBUG +#ifndef QT_NO_DEBUG #include "objectdump.h" #endif @@ -173,7 +173,7 @@ void MMF::VideoOutput::videoOutputRegionChanged() void MMF::VideoOutput::dump() const { -#ifdef _DEBUG +#ifndef QT_NO_DEBUG TRACE_CONTEXT(VideoOutput::dump, EVideoInternal); QScopedPointer visitor(new ObjectDump::QVisitor); visitor->setPrefix("Phonon::MMF"); // to aid searchability of logs -- cgit v0.12 From 104adfdb63ec3bfe0afafea5278c45ebb873065d Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Thu, 15 Oct 2009 11:31:11 +0200 Subject: sed -i -e 's/if(/if (/g' `find -name "*.cpp" -or -name "*.h" -or -name "*.pro"` --- src/3rdparty/phonon/mmf/audioplayer.cpp | 4 ++-- src/3rdparty/phonon/mmf/mmf_videoplayer.cpp | 28 +++++++++++----------- .../phonon/mmf/mmfphonondebug/objectdump.cpp | 22 ++++++++--------- .../mmf/mmfphonondebug/objectdump_symbian.cpp | 16 ++++++------- src/3rdparty/phonon/mmf/utils.cpp | 4 ++-- src/3rdparty/phonon/mmf/utils.h | 14 +++++------ src/3rdparty/phonon/mmf/videooutput.cpp | 2 +- 7 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp index ceaf305..1d259a8 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.cpp +++ b/src/3rdparty/phonon/mmf/audioplayer.cpp @@ -213,8 +213,8 @@ void MMF::AudioPlayer::MapcPlayComplete(TInt aError) } /* - if(aError == KErrNone) { - if(m_nextSource.type() == MediaSource::Empty) { + if (aError == KErrNone) { + if (m_nextSource.type() == MediaSource::Empty) { emit finished(); } else { setSource(m_nextSource); diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index 53bbb77..c05afae 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -70,7 +70,7 @@ void MMF::VideoPlayer::construct() TRACE_CONTEXT(VideoPlayer::VideoPlayer, EVideoApi); TRACE_ENTRY_0(); - if(m_videoOutput) + if (m_videoOutput) m_videoOutput->setObserver(this); const TInt priority = 0; @@ -122,7 +122,7 @@ void MMF::VideoPlayer::doPlay() TRACE_CONTEXT(VideoPlayer::doPlay, EVideoApi); // See comment in updateMmfOutput - if(m_mmfOutputChangePending) { + if (m_mmfOutputChangePending) { TRACE_0("MMF output change pending - pushing now"); updateMmfOutput(); } @@ -151,7 +151,7 @@ void MMF::VideoPlayer::doSeek(qint64 ms) TRACE_CONTEXT(VideoPlayer::doSeek, EVideoApi); bool wasPlaying = false; - if(state() == PlayingState) { + if (state() == PlayingState) { // The call to SetPositionL does not have any effect if playback is // ongoing, so we pause before seeking. doPause(); @@ -160,8 +160,8 @@ void MMF::VideoPlayer::doSeek(qint64 ms) TRAPD(err, m_player->SetPositionL(TTimeIntervalMicroSeconds(ms * 1000))); - if(KErrNone == err) { - if(wasPlaying) + if (KErrNone == err) { + if (wasPlaying) doPlay(); } else { @@ -251,11 +251,11 @@ void MMF::VideoPlayer::MvpuoPrepareComplete(TInt aError) if (KErrNone == err) { maxVolumeChanged(m_player->MaxVolume()); - if(m_videoOutput) + if (m_videoOutput) m_videoOutput->setFrameSize(m_frameSize); // See comment in updateMmfOutput - if(m_mmfOutputChangePending) { + if (m_mmfOutputChangePending) { TRACE_0("MMF output change pending - pushing now"); updateMmfOutput(); } @@ -330,8 +330,8 @@ void MMF::VideoPlayer::videoOutputRegionChanged() const bool changed = getNativeWindowSystemHandles(); // See comment in updateMmfOutput - if(changed) { - if(state() == LoadingState) + if (changed) { + if (state() == LoadingState) m_mmfOutputChangePending = true; else updateMmfOutput(); @@ -367,7 +367,7 @@ void getDsaRegion(RWsSession &session, const RWindowBase &window) ao.SetActive(); dsa.Close(); ao.Cancel(); - if(region) { + if (region) { qDebug() << "Phonon::MMF::getDsaRegion count" << region->Count(); for(int i=0; iCount(); ++i) { const TRect& rect = region->RectangleList()[i]; @@ -425,7 +425,7 @@ void MMF::VideoPlayer::videoOutputChanged() TRACE_CONTEXT(VideoPlayer::videoOutputChanged, EVideoInternal); TRACE_ENTRY_0(); - if(m_videoOutput) { + if (m_videoOutput) { m_videoOutput->setObserver(this); m_videoOutput->setFrameSize(m_frameSize); } @@ -442,7 +442,7 @@ bool MMF::VideoPlayer::getNativeWindowSystemHandles() CCoeControl *control = 0; - if(m_videoOutput) + if (m_videoOutput) // Create native window control = m_videoOutput->winId(); else @@ -450,7 +450,7 @@ bool MMF::VideoPlayer::getNativeWindowSystemHandles() control = QApplication::activeWindow()->effectiveWinId(); #ifndef QT_NO_DEBUG - if(m_videoOutput) { + if (m_videoOutput) { QScopedPointer dumper(new ObjectDump::QDumper); dumper->setPrefix("Phonon::MMF"); // to aid searchability of logs ObjectDump::addDefaultAnnotators(*dumper); @@ -478,7 +478,7 @@ bool MMF::VideoPlayer::getNativeWindowSystemHandles() bool changed = false; - if(window != m_window || rect != m_rect) { + if (window != m_window || rect != m_rect) { m_window = window; m_rect = rect; changed = true; diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp index c5d066e..2629d74 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp @@ -55,10 +55,10 @@ QList QAnnotatorBasic::annotation(const QObject& object) stream << ' '; stream << object.metaObject()->className(); - if(object.objectName() != "") + if (object.objectName() != "") stream << " \"" << object.objectName() << '"'; - if(object.isWidgetType()) + if (object.isWidgetType()) stream << " isWidget"; stream.flush(); @@ -71,14 +71,14 @@ QList QAnnotatorWidget::annotation(const QObject& object) QList result; const QWidget* widget = qobject_cast(&object); - if(widget) { + if (widget) { QByteArray array; QTextStream stream(&array); stream << "widget: "; - if(widget->isVisible()) + if (widget->isVisible()) stream << "visible "; else stream << "invisible "; @@ -288,7 +288,7 @@ void QVisitorPrivate::visitNode(const QObject& object) m_hash.insert(&object, node); // Insert node into internal tree - if(nodeParent) + if (nodeParent) { nodeParent->m_children.append(nodePtr.take()); } @@ -330,18 +330,18 @@ QByteArray QVisitorPrivate::branchBuffer QTextStream stream(&buffer); for (int i=0; i::const_iterator begin = node.m_annotation.begin(), end = node.m_annotation.end(); - if(begin == end) { + if (begin == end) { // No annotations - just dump the object pointer const bool isNodeLine = true; QByteArray buffer = branchBuffer(branches, isNodeLine, isLastChild); diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp index 2fceb62..8d582a7 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp @@ -35,11 +35,11 @@ QList QAnnotatorWidget::annotation(const QObject& object) QList result; const QWidget* widget = qobject_cast(&object); - if(widget) { + if (widget) { const QWExtra* extra = qt_widget_private(const_cast(widget))->extraData(); - if(extra) { + if (extra) { QByteArray array; QTextStream stream(&array); @@ -61,10 +61,10 @@ QList QAnnotatorControl::annotation(const QObject& object) QList result; const QWidget* widget = qobject_cast(&object); - if(widget) { + if (widget) { const CCoeControl* control = widget->effectiveWinId(); - if(control) { + if (control) { QByteArray array; QTextStream stream(&array); @@ -72,7 +72,7 @@ QList QAnnotatorControl::annotation(const QObject& object) stream << "control: " << control << ' '; stream << "parent " << control->Parent() << ' '; - if(control->IsVisible()) + if (control->IsVisible()) stream << "visible "; else stream << "invisible "; @@ -80,7 +80,7 @@ QList QAnnotatorControl::annotation(const QObject& object) stream << control->Position().iX << ',' << control->Position().iY << ' '; stream << control->Size().iWidth << 'x' << control->Size().iHeight; - if(control->OwnsWindow()) + if (control->OwnsWindow()) stream << " ownsWindow "; stream.flush(); @@ -96,12 +96,12 @@ QList QAnnotatorWindow::annotation(const QObject& object) QList result; const QWidget* widget = qobject_cast(&object); - if(widget) { + if (widget) { const CCoeControl* control = widget->effectiveWinId(); RDrawableWindow *window = 0; - if(control && (window = control->DrawableWindow())) { + if (control && (window = control->DrawableWindow())) { QByteArray array; QTextStream stream(&array); diff --git a/src/3rdparty/phonon/mmf/utils.cpp b/src/3rdparty/phonon/mmf/utils.cpp index 607f938..bc1c424 100644 --- a/src/3rdparty/phonon/mmf/utils.cpp +++ b/src/3rdparty/phonon/mmf/utils.cpp @@ -111,7 +111,7 @@ QColor MMF::Utils::getScreenPixel(const QPoint& pos) TScreenInfo info; TRAPD(err, getScreenInfoL(info)); QColor pixel; - if(err == KErrNone and pos.x() < info.width and pos.y() < info.height) + if (err == KErrNone and pos.x() < info.width and pos.y() < info.height) { const int bytesPerPixel = info.bpp / 8; Q_ASSERT(bytesPerPixel >= 3); @@ -129,7 +129,7 @@ QColor MMF::Utils::getScreenPixel(const QPoint& pos) pixel.setGreen(*ptr++); pixel.setRed(*ptr++); - if(bytesPerPixel == 4) + if (bytesPerPixel == 4) pixel.setAlpha(*ptr++); } return pixel; diff --git a/src/3rdparty/phonon/mmf/utils.h b/src/3rdparty/phonon/mmf/utils.h index 727abb0..7e363e8 100644 --- a/src/3rdparty/phonon/mmf/utils.h +++ b/src/3rdparty/phonon/mmf/utils.h @@ -140,14 +140,14 @@ public: // Macros available for use by implementation code #ifndef QT_NO_DEBUG #define TRACE_CONTEXT(_fn, _cat) const ::Phonon::MMF::TTraceContext _tc((TText*)L ## #_fn, (TUint)this, _cat); -#define TRACE_ENTRY_0() { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "+ Phonon::MMF::%s [0x%08x]"), _tc.iFunction, _tc.iAddr); } -#define TRACE_ENTRY(string, args...) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "+ Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); } -#define TRACE_EXIT_0() { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "- Phonon::MMF::%s [0x%08x]"), _tc.iFunction, _tc.iAddr); } -#define TRACE_EXIT(string, args...) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "- Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); } -#define TRACE_RETURN(string, result) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "r Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, result); } return result; +#define TRACE_ENTRY_0() { if (_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "+ Phonon::MMF::%s [0x%08x]"), _tc.iFunction, _tc.iAddr); } +#define TRACE_ENTRY(string, args...) { if (_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "+ Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); } +#define TRACE_EXIT_0() { if (_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "- Phonon::MMF::%s [0x%08x]"), _tc.iFunction, _tc.iAddr); } +#define TRACE_EXIT(string, args...) { if (_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "- Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); } +#define TRACE_RETURN(string, result) { if (_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "r Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, result); } return result; #define TRACE_PANIC(code) { _TRACE_PRINT(_TRACE_TEXT(L ## "! Phonon::MMF::%s [0x%08x] panic %d"), _tc.iFunction, _tc.iAddr, code); } Utils::panic(code); -#define TRACE_0(string) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## " Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr); } -#define TRACE(string, args...) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## " Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); } +#define TRACE_0(string) { if (_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## " Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr); } +#define TRACE(string, args...) { if (_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## " Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); } #else #define TRACE_CONTEXT(_fn, _cat) #define TRACE_ENTRY_0() diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp index 13d00f5..9c1118c 100644 --- a/src/3rdparty/phonon/mmf/videooutput.cpp +++ b/src/3rdparty/phonon/mmf/videooutput.cpp @@ -150,7 +150,7 @@ bool MMF::VideoOutput::event(QEvent* event) { TRACE_CONTEXT(VideoOutput::event, EVideoInternal); - if(event->type() == QEvent::WinIdChange) { + if (event->type() == QEvent::WinIdChange) { TRACE_0("WinIdChange"); videoOutputRegionChanged(); return true; -- cgit v0.12 From 572e3c9e04a265998b5b7dea4237828186be6f17 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Thu, 15 Oct 2009 11:32:13 +0200 Subject: sed -i -e 's/for(/for (/g' `find -name "*.cpp" -or -name "*.h" -or -name "*.pro"` --- src/3rdparty/phonon/mmf/mmf_videoplayer.cpp | 2 +- src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp | 4 ++-- src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h | 2 +- src/3rdparty/phonon/mmf/utils.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index c05afae..6694a9a 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -369,7 +369,7 @@ void getDsaRegion(RWsSession &session, const RWindowBase &window) ao.Cancel(); if (region) { qDebug() << "Phonon::MMF::getDsaRegion count" << region->Count(); - for(int i=0; iCount(); ++i) { + for (int i=0; iCount(); ++i) { const TRect& rect = region->RectangleList()[i]; qDebug() << "Phonon::MMF::getDsaRegion rect" << rect.iTl.iX << rect.iTl.iY << rect.iBr.iX << rect.iBr.iY; diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp index 2629d74..9add439 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp @@ -363,7 +363,7 @@ void QVisitorPrivate::dumpRecursive // Recurse down tree const Node::child_iterator begin = node.m_children.begin(); const Node::child_iterator end = node.m_children.end(); - for(Node::child_iterator i = begin; end != i; ++i) { + for (Node::child_iterator i = begin; end != i; ++i) { isLastChild = (end == i + 1); @@ -394,7 +394,7 @@ void QVisitorPrivate::dumpNode } else { // Dump annotations - for(QList::const_iterator i = begin; end != i; ++i) { + for (QList::const_iterator i = begin; end != i; ++i) { const bool isNodeLine = (begin == i); QByteArray buffer = branchBuffer(branches, isNodeLine, isLastChild); buffer.append(*i); diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h index 6eb6076..98bdf14 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h @@ -104,7 +104,7 @@ void visit(Iterator begin, Iterator end, Visitor& visitor) { visitor.visitPrepare(); - for( ; begin != end; ++begin) + for ( ; begin != end; ++begin) visitor.visitNode(*begin); visitor.visitComplete(); diff --git a/src/3rdparty/phonon/mmf/utils.cpp b/src/3rdparty/phonon/mmf/utils.cpp index bc1c424..58d1ece 100644 --- a/src/3rdparty/phonon/mmf/utils.cpp +++ b/src/3rdparty/phonon/mmf/utils.cpp @@ -138,7 +138,7 @@ QColor MMF::Utils::getScreenPixel(const QPoint& pos) // Debugging: for debugging video visibility void MMF::Utils::dumpScreenPixelSample() { - for(int i=0; i<20; ++i) { + for (int i=0; i<20; ++i) { const QPoint pos(i*10, i*10); const QColor pixel = Utils::getScreenPixel(pos); RDebug::Printf( -- cgit v0.12 From 428c56a3a622df3f9164c3e52b729877bc679585 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 15 Oct 2009 11:32:55 +0200 Subject: doc: Clarified when setDefaultFormat() is ignored by constructors. Task-number: QTBUG-4443 --- src/corelib/io/qsettings.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 1fd2165..a1c9833 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2565,8 +2565,9 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, Example: \snippet doc/src/snippets/code/src_corelib_io_qsettings.cpp 10 - The scope is QSettings::UserScope and the format is - QSettings::NativeFormat. + The scope is set to QSettings::UserScope, and the format is + set to QSettings::NativeFormat (i.e. calling setDefaultFormat() + before calling this constructor has no effect). \sa setDefaultFormat(), {Fallback Mechanism} */ @@ -2583,11 +2584,12 @@ QSettings::QSettings(const QString &organization, const QString &application, QO If \a scope is QSettings::UserScope, the QSettings object searches user-specific settings first, before it searches system-wide - settings as a fallback. If \a scope is - QSettings::SystemScope, the QSettings object ignores user-specific - settings and provides access to system-wide settings. + settings as a fallback. If \a scope is QSettings::SystemScope, the + QSettings object ignores user-specific settings and provides + access to system-wide settings. - The storage format is QSettings::NativeFormat. + The storage format is set to QSettings::NativeFormat (i.e. calling + setDefaultFormat() before calling this constructor has no effect). If no application name is given, the QSettings object will only access the organization-wide \l{Fallback Mechanism}{locations}. @@ -2668,6 +2670,8 @@ QSettings::QSettings(const QString &fileName, Format format, QObject *parent) The scope is QSettings::UserScope and the format is defaultFormat() (QSettings::NativeFormat by default). + Use setDefaultFormat() before calling this constructor + to change the default format used by this constructor. The code @@ -3352,10 +3356,12 @@ QVariant QSettings::value(const QString &key, const QVariant &defaultValue) cons /*! \since 4.4 - Sets the default file format to the given \a format, used for storing - settings for the QSettings(QObject *) constructor. + Sets the default file format to the given \a format, which is used + for storing settings for the QSettings(QObject *) constructor. - If no default format is set, QSettings::NativeFormat is used. + If no default format is set, QSettings::NativeFormat is used. See + the documentation for the QSettings constructor you are using to + see if that constructor will ignore this function. \sa format() */ -- cgit v0.12 From 9935ad5366463429ed4aa9b8db03c4605586f866 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Thu, 15 Oct 2009 11:37:45 +0200 Subject: Replace tabs with whitespace. sed -i -e 's/\t/ /g' `find -name "*.cpp" -or -name "*.h" -or -name "*.pro"` --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 30 ++++----- src/3rdparty/phonon/mmf/mmf_medianode.cpp | 2 +- src/3rdparty/phonon/mmf/mmf_videoplayer.cpp | 72 +++++++++++----------- .../mmf/mmfphonondebug/objectdump_symbian.cpp | 6 +- src/3rdparty/phonon/mmf/videooutput.cpp | 20 +++--- 5 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index 4c9d1a5..af2c31e 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -376,20 +376,20 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState) setState(newState); if ( - LoadingState == oldPhononState - and StoppedState == newPhononState - ) { - // 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; - play(); - } - } + LoadingState == oldPhononState + and StoppedState == newPhononState + ) { + // 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; + play(); + } + } TRACE_EXIT_0(); } @@ -400,7 +400,7 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState) void MMF::AbstractMediaPlayer::tick() { - // For the MWC compiler, we need to qualify the base class. + // For the MWC compiler, we need to qualify the base class. emit MMF::AbstractPlayer::tick(currentTime()); } diff --git a/src/3rdparty/phonon/mmf/mmf_medianode.cpp b/src/3rdparty/phonon/mmf/mmf_medianode.cpp index b60d6f4..253c5e7 100644 --- a/src/3rdparty/phonon/mmf/mmf_medianode.cpp +++ b/src/3rdparty/phonon/mmf/mmf_medianode.cpp @@ -74,7 +74,7 @@ bool MMF::MediaNode::applyNodesOnMediaObject(MediaNode *) // data(length of the graph) which typically is very small. // First, we go to the very beginning of the graph. - MMF::MediaNode *current = this; + MMF::MediaNode *current = this; do { MediaNode *const candidate = current->source(); if (candidate) diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index 6694a9a..a93aca0 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -16,7 +16,7 @@ along with this library. If not, see . */ -#include // for QApplication::activeWindow +#include // for QApplication::activeWindow #include #include #include @@ -71,7 +71,7 @@ void MMF::VideoPlayer::construct() TRACE_ENTRY_0(); if (m_videoOutput) - m_videoOutput->setObserver(this); + m_videoOutput->setObserver(this); const TInt priority = 0; const TMdaPriorityPreference preference = EMdaPriorityPreferenceNone; @@ -152,17 +152,17 @@ void MMF::VideoPlayer::doSeek(qint64 ms) bool wasPlaying = false; if (state() == PlayingState) { - // The call to SetPositionL does not have any effect if playback is - // ongoing, so we pause before seeking. - doPause(); - wasPlaying = true; + // The call to SetPositionL does not have any effect if playback is + // ongoing, so we pause before seeking. + doPause(); + wasPlaying = true; } TRAPD(err, m_player->SetPositionL(TTimeIntervalMicroSeconds(ms * 1000))); if (KErrNone == err) { - if (wasPlaying) - doPlay(); + if (wasPlaying) + doPlay(); } else { TRACE("SetPositionL error %d", err); @@ -252,7 +252,7 @@ void MMF::VideoPlayer::MvpuoPrepareComplete(TInt aError) maxVolumeChanged(m_player->MaxVolume()); if (m_videoOutput) - m_videoOutput->setFrameSize(m_frameSize); + m_videoOutput->setFrameSize(m_frameSize); // See comment in updateMmfOutput if (m_mmfOutputChangePending) { @@ -350,32 +350,32 @@ void MMF::VideoPlayer::videoOutputRegionChanged() class CDummyAO : public CActive { public: - CDummyAO() : CActive(CActive::EPriorityStandard) { CActiveScheduler::Add(this); } - void RunL() { } - void DoCancel() { } - TRequestStatus& Status() { return iStatus; } - void SetActive() { CActive::SetActive(); } + CDummyAO() : CActive(CActive::EPriorityStandard) { CActiveScheduler::Add(this); } + void RunL() { } + void DoCancel() { } + TRequestStatus& Status() { return iStatus; } + void SetActive() { CActive::SetActive(); } }; void getDsaRegion(RWsSession &session, const RWindowBase &window) { - RDirectScreenAccess dsa(session); - TInt err = dsa.Construct(); - CDummyAO ao; - RRegion* region; - err = dsa.Request(region, ao.Status(), window); - ao.SetActive(); - dsa.Close(); - ao.Cancel(); - if (region) { - qDebug() << "Phonon::MMF::getDsaRegion count" << region->Count(); - for (int i=0; iCount(); ++i) { - const TRect& rect = region->RectangleList()[i]; - qDebug() << "Phonon::MMF::getDsaRegion rect" + RDirectScreenAccess dsa(session); + TInt err = dsa.Construct(); + CDummyAO ao; + RRegion* region; + err = dsa.Request(region, ao.Status(), window); + ao.SetActive(); + dsa.Close(); + ao.Cancel(); + if (region) { + qDebug() << "Phonon::MMF::getDsaRegion count" << region->Count(); + for (int i=0; iCount(); ++i) { + const TRect& rect = region->RectangleList()[i]; + qDebug() << "Phonon::MMF::getDsaRegion rect" << rect.iTl.iX << rect.iTl.iY << rect.iBr.iX << rect.iBr.iY; - } - region->Close(); - } + } + region->Close(); + } } #endif // _DEBUG @@ -426,8 +426,8 @@ void MMF::VideoPlayer::videoOutputChanged() TRACE_ENTRY_0(); if (m_videoOutput) { - m_videoOutput->setObserver(this); - m_videoOutput->setFrameSize(m_frameSize); + m_videoOutput->setObserver(this); + m_videoOutput->setFrameSize(m_frameSize); } videoOutputRegionChanged(); @@ -443,11 +443,11 @@ bool MMF::VideoPlayer::getNativeWindowSystemHandles() CCoeControl *control = 0; if (m_videoOutput) - // Create native window - control = m_videoOutput->winId(); + // Create native window + control = m_videoOutput->winId(); else - // Get top-level window - control = QApplication::activeWindow()->effectiveWinId(); + // Get top-level window + control = QApplication::activeWindow()->effectiveWinId(); #ifndef QT_NO_DEBUG if (m_videoOutput) { diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp index 8d582a7..03220a7 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp @@ -111,9 +111,9 @@ QList QAnnotatorWindow::annotation(const QObject& object) // ClientHandle() is available first in 5.0. #if !defined(__SERIES60_31__) && !defined(__S60_32__) if (QSysInfo::s60Version() > QSysInfo::SV_S60_3_2) - // Client-side window handle - // Cast to a void pointer so that log output is in hexadecimal format. - stream << "cli " << reinterpret_cast(window->ClientHandle()) << ' '; + // Client-side window handle + // Cast to a void pointer so that log output is in hexadecimal format. + stream << "cli " << reinterpret_cast(window->ClientHandle()) << ' '; #endif // Server-side address of CWsWindow object diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp index 9c1118c..f0393a7 100644 --- a/src/3rdparty/phonon/mmf/videooutput.cpp +++ b/src/3rdparty/phonon/mmf/videooutput.cpp @@ -52,16 +52,16 @@ MMF::VideoOutput::VideoOutput(QWidget* parent) TRACE_ENTRY("parent 0x%08x", parent); setPalette(QPalette(Qt::black)); - setAttribute(Qt::WA_OpaquePaintEvent, true); - setAttribute(Qt::WA_NoSystemBackground, true); - setAutoFillBackground(false); - - // Causes QSymbianControl::Draw not to BitBlt this widget's region of the - // backing store. Since the backing store is (by default) a 16MU bitmap, - // blitting it results in this widget's screen region in the final - // framebuffer having opaque alpha values. This in turn causes the video - // to be invisible when running on the target device. - qt_widget_private(this)->extraData()->disableBlit = true; + setAttribute(Qt::WA_OpaquePaintEvent, true); + setAttribute(Qt::WA_NoSystemBackground, true); + setAutoFillBackground(false); + + // Causes QSymbianControl::Draw not to BitBlt this widget's region of the + // backing store. Since the backing store is (by default) a 16MU bitmap, + // blitting it results in this widget's screen region in the final + // framebuffer having opaque alpha values. This in turn causes the video + // to be invisible when running on the target device. + qt_widget_private(this)->extraData()->disableBlit = true; dump(); -- cgit v0.12 From ac0fe3babf0c0b6f634af98b24dbeaae1453f11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 15 Oct 2009 12:20:16 +0200 Subject: Added explicit qualification of static functions to fix xlC compilation. It seems static inline functions need to be fully qualified when called from inside a template function. Task-number: QTBUG-3368 Reviewed-by: Gunnar Sletta --- src/gui/painting/qrasterizer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index 66d0c9d..b602690 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -310,7 +310,7 @@ struct QBoolToType template void qScanConvert(QScanConverter &d, T allVertical) { - qSort(d.m_lines.data(), d.m_lines.data() + d.m_lines.size(), topOrder); + qSort(d.m_lines.data(), d.m_lines.data() + d.m_lines.size(), QT_PREPEND_NAMESPACE(topOrder)); int line = 0; for (int y = d.m_lines.first().top; y <= d.m_bottom; ++y) { for (; line < d.m_lines.size() && d.m_lines.at(line).top == y; ++line) { @@ -319,7 +319,7 @@ void qScanConvert(QScanConverter &d, T allVertical) QScanConverter::Line *l = &d.m_lines.at(line); d.m_active.resize(d.m_active.size() + 1); int j; - for (j = d.m_active.size() - 2; j >= 0 && xOrder(l, d.m_active.at(j)); --j) + for (j = d.m_active.size() - 2; j >= 0 && QT_PREPEND_NAMESPACE(xOrder)(l, d.m_active.at(j)); --j) d.m_active.at(j+1) = d.m_active.at(j); d.m_active.at(j+1) = l; } else { @@ -334,7 +334,7 @@ void qScanConvert(QScanConverter &d, T allVertical) for (int i = 1; i < numActive; ++i) { QScanConverter::Line *l = d.m_active.at(i); int j; - for (j = i-1; j >= 0 && xOrder(l, d.m_active.at(j)); --j) + for (j = i-1; j >= 0 && QT_PREPEND_NAMESPACE(xOrder)(l, d.m_active.at(j)); --j) d.m_active.at(j+1) = d.m_active.at(j); d.m_active.at(j+1) = l; } -- cgit v0.12 From 0f3e7310de5b3ca8cfd2ec5da4e408fb638926d8 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 15 Oct 2009 12:40:46 +0200 Subject: fix compilation with namespaces --- src/gui/kernel/qgesture.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index 0034819..02eb526 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -51,12 +51,12 @@ QT_BEGIN_HEADER +Q_DECLARE_METATYPE(Qt::GestureState) + QT_BEGIN_NAMESPACE QT_MODULE(Gui) -Q_DECLARE_METATYPE(Qt::GestureState) - class QGesturePrivate; class Q_GUI_EXPORT QGesture : public QObject { @@ -180,8 +180,12 @@ public: friend class QPinchGestureRecognizer; }; +QT_END_NAMESPACE + Q_DECLARE_METATYPE(QPinchGesture::WhatChanged) +QT_BEGIN_NAMESPACE + class QSwipeGesturePrivate; class Q_GUI_EXPORT QSwipeGesture : public QGesture { -- cgit v0.12 From c0380b7805921446c30a560f0ffd01d0323fa797 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 15 Oct 2009 13:00:52 +0200 Subject: Fix pointer grab issues in S60 Did the long awaited "refactor me" in QSymbianControl::HandlePointerEvent Pointer is grabbed by MousePress, and released by MouseRelease - unless already globally grabbed. Pointer events are routed to the widget that grabbed the mouse. Task-number: QTBUG-4695 Task-number: QTBUG-4674 Reviewed-by: axis --- src/gui/kernel/qapplication_s60.cpp | 144 ++++++++++++++++++++++-------------- 1 file changed, 88 insertions(+), 56 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 6d50e55..f3b64ca 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -464,12 +464,47 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) QT_TRYCATCH_LEAVING(HandlePointerEvent(pEvent)); } +typedef QPair Event; + +/* + * Helper function called by HandlePointerEvent - separated to keep that function readable + */ +static void generateEnterLeaveEvents(QList &events, QWidget *widgetUnderPointer, + QPoint globalPos, Qt::MouseButton button, Qt::KeyboardModifiers modifiers) +{ + //moved to another widget, create enter and leave events + if (S60->lastPointerEventTarget) { + QMouseEvent mEventLeave(QEvent::Leave, S60->lastPointerEventTarget->mapFromGlobal( + S60->lastCursorPos), S60->lastCursorPos, button, QApplicationPrivate::mouse_buttons, + modifiers); + events.append(Event(S60->lastPointerEventTarget, mEventLeave)); + } + if (widgetUnderPointer) { + QMouseEvent mEventEnter(QEvent::Enter, widgetUnderPointer->mapFromGlobal(globalPos), + globalPos, button, QApplicationPrivate::mouse_buttons, modifiers); + + events.append(Event(widgetUnderPointer, mEventEnter)); +#ifndef QT_NO_CURSOR + S60->curWin = widgetUnderPointer->effectiveWinId(); + if (!QApplication::overrideCursor()) { +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + if (S60->brokenPointerCursors) + qt_symbian_set_pointer_sprite(widgetUnderPointer->cursor()); + else +#endif + qt_symbian_setWindowCursor(widgetUnderPointer->cursor(), S60->curWin); + } +#endif + } +} + + void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent) { - //### refactor me, getting too complex QMouseEvent::Type type; Qt::MouseButton button; mapS60MouseEventTypeToQt(&type, &button, &pEvent); + Qt::KeyboardModifiers modifiers = mapToQtModifiers(pEvent.iModifiers); if (m_previousEventLongTap) if (type == QEvent::MouseButtonRelease){ @@ -481,79 +516,76 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent) return; // store events for later sending/saving - QWidget *alienWidget; - typedef QPair Event; QList events; QPoint widgetPos = QPoint(pEvent.iPosition.iX, pEvent.iPosition.iY); TPoint controlScreenPos = PositionRelativeToScreen(); QPoint globalPos = QPoint(controlScreenPos.iX, controlScreenPos.iY) + widgetPos; - if (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick || type == QEvent::MouseMove) - { - // get the widget where the event happened - alienWidget = qwidget->childAt(widgetPos); - if (!alienWidget) - alienWidget = qwidget; - S60->mousePressTarget = alienWidget; + // widgets interested in the event + QWidget *widgetUnderPointer = qwidget->childAt(widgetPos); + if (!widgetUnderPointer) + widgetUnderPointer = qwidget; //i.e. this container widget + + QWidget *widgetWithMouseGrab = QWidget::mouseGrabber(); + + // handle auto grab of pointer when pressing / releasing + if (!widgetWithMouseGrab && type == QEvent::MouseButtonPress) { + //if previously auto-grabbed, generate a fake mouse release (platform bug: mouse release event was lost) + if (S60->mousePressTarget) { + QMouseEvent mEvent(QEvent::MouseButtonRelease, S60->mousePressTarget->mapFromGlobal(globalPos), globalPos, + button, QApplicationPrivate::mouse_buttons, modifiers); + events.append(Event(S60->mousePressTarget,mEvent)); + } + //auto grab the mouse + widgetWithMouseGrab = S60->mousePressTarget = widgetUnderPointer; + widgetWithMouseGrab->grabMouse(); + } + if (widgetWithMouseGrab && widgetWithMouseGrab == S60->mousePressTarget && type == QEvent::MouseButtonRelease) { + //release the auto grab - note this release event still goes to the autograb widget + S60->mousePressTarget = 0; + widgetWithMouseGrab->releaseMouse(); } - alienWidget = S60->mousePressTarget; + QWidget *widgetToReceiveMouseEvent; + if (widgetWithMouseGrab) + widgetToReceiveMouseEvent = widgetWithMouseGrab; + else + widgetToReceiveMouseEvent = widgetUnderPointer; - if (alienWidget != S60->lastPointerEventTarget) - if (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick || type == QEvent::MouseMove) - { - //moved to another widget, create enter and leave events - if (S60->lastPointerEventTarget) - { - QMouseEvent mEventLeave(QEvent::Leave, S60->lastPointerEventTarget->mapFromGlobal(S60->lastCursorPos), S60->lastCursorPos, - button, QApplicationPrivate::mouse_buttons, mapToQtModifiers(pEvent.iModifiers)); - events.append(Event(S60->lastPointerEventTarget,mEventLeave)); - } - if (alienWidget) { - QMouseEvent mEventEnter(QEvent::Enter, alienWidget->mapFromGlobal(globalPos), - globalPos, button, QApplicationPrivate::mouse_buttons, mapToQtModifiers( - pEvent.iModifiers)); + //queue QEvent::Enter and QEvent::Leave, if the pointer has moved + if (widgetUnderPointer != S60->lastPointerEventTarget && (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick || type == QEvent::MouseMove)) + generateEnterLeaveEvents(events, widgetUnderPointer, globalPos, button, modifiers); - events.append(Event(alienWidget, mEventEnter)); -#ifndef QT_NO_CURSOR - S60->curWin = alienWidget->effectiveWinId(); - if (!QApplication::overrideCursor()) { -#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS - if (S60->brokenPointerCursors) - qt_symbian_set_pointer_sprite(alienWidget->cursor()); - else -#endif - qt_symbian_setWindowCursor(alienWidget->cursor(), S60->curWin); - } -#endif - } - } + //save global state S60->lastCursorPos = globalPos; + S60->lastPointerEventPos = widgetPos; + S60->lastPointerEventTarget = widgetUnderPointer; + #if !defined(QT_NO_CURSOR) && !defined(Q_SYMBIAN_FIXED_POINTER_CURSORS) if (S60->brokenPointerCursors) qt_symbian_move_cursor_sprite(); #endif - S60->lastPointerEventPos = widgetPos; - S60->lastPointerEventTarget = alienWidget; - if (alienWidget) - { - QMouseEvent mEvent(type, alienWidget->mapFromGlobal(globalPos), globalPos, - button, QApplicationPrivate::mouse_buttons, mapToQtModifiers(pEvent.iModifiers)); - events.append(Event(alienWidget,mEvent)); - QEventDispatcherS60 *dispatcher; - // It is theoretically possible for someone to install a different event dispatcher. - if ((dispatcher = qobject_cast(alienWidget->d_func()->threadData->eventDispatcher)) != 0) { - if (dispatcher->excludeUserInputEvents()) { - for (int i=0;i < events.count();++i) - { - Event next = events[i]; - dispatcher->saveInputEvent(this, next.first, new QMouseEvent(next.second)); - } - return; + + //queue this event. + Q_ASSERT(widgetToReceiveMouseEvent); + QMouseEvent mEvent(type, widgetToReceiveMouseEvent->mapFromGlobal(globalPos), globalPos, + button, QApplicationPrivate::mouse_buttons, modifiers); + events.append(Event(widgetToReceiveMouseEvent,mEvent)); + QEventDispatcherS60 *dispatcher; + // It is theoretically possible for someone to install a different event dispatcher. + if ((dispatcher = qobject_cast(widgetToReceiveMouseEvent->d_func()->threadData->eventDispatcher)) != 0) { + if (dispatcher->excludeUserInputEvents()) { + for (int i=0;i < events.count();++i) + { + Event next = events[i]; + dispatcher->saveInputEvent(this, next.first, new QMouseEvent(next.second)); } + return; } } + + //send events in the queue for (int i=0;i < events.count();++i) { Event next = events[i]; -- cgit v0.12 From 449eae92ce603bf4134bfec820fedc334934de73 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 15 Oct 2009 13:26:03 +0200 Subject: compile fix with namepaces --- examples/gestures/imageviewer/imagewidget.h | 2 ++ examples/opengl/pbuffers/cube.h | 2 ++ examples/opengl/pbuffers/glwidget.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/examples/gestures/imageviewer/imagewidget.h b/examples/gestures/imageviewer/imagewidget.h index e05a67a..7b91fbf 100644 --- a/examples/gestures/imageviewer/imagewidget.h +++ b/examples/gestures/imageviewer/imagewidget.h @@ -46,10 +46,12 @@ #include #include +QT_BEGIN_NAMESPACE class QGestureEvent; class QPanGesture; class QPinchGesture; class QSwipeGesture; +QT_END_NAMESPACE class ImageWidget : public QWidget { diff --git a/examples/opengl/pbuffers/cube.h b/examples/opengl/pbuffers/cube.h index c882f1f..f17299f 100644 --- a/examples/opengl/pbuffers/cube.h +++ b/examples/opengl/pbuffers/cube.h @@ -48,7 +48,9 @@ #include #include +QT_BEGIN_NAMESPACE class QPropertyAnimation; +QT_END_NAMESPACE class Geometry { diff --git a/examples/opengl/pbuffers/glwidget.h b/examples/opengl/pbuffers/glwidget.h index c019abe..1b46bfd 100644 --- a/examples/opengl/pbuffers/glwidget.h +++ b/examples/opengl/pbuffers/glwidget.h @@ -47,7 +47,9 @@ class Geometry; class Cube; class Tile; +QT_BEGIN_NAMESPACE class QGLPixelBuffer; +QT_END_NAMESPACE class GLWidget : public QGLWidget { -- cgit v0.12 From aaef78412021c2e02aa7c6aa355a09634a6fd549 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 14 Oct 2009 17:49:11 +0200 Subject: QNAM HTTP Code: Proceed POSTing on encryptedBytesWritten() ... not only on bytesWritten() Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkconnectionchannel.cpp | 12 ++++++++++++ src/network/access/qhttpnetworkconnectionchannel_p.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 81fac57..6962ab3 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -105,6 +105,9 @@ void QHttpNetworkConnectionChannel::init() QObject::connect(sslSocket, SIGNAL(sslErrors(const QList&)), this, SLOT(_q_sslErrors(const QList&)), Qt::DirectConnection); + QObject::connect(sslSocket, SIGNAL(encryptedBytesWritten(qint64)), + this, SLOT(_q_encryptedBytesWritten(qint64)), + Qt::DirectConnection); } #endif } @@ -881,6 +884,15 @@ void QHttpNetworkConnectionChannel::_q_sslErrors(const QList &errors) //QNetworkReply::NetworkError errorCode = QNetworkReply::ProtocolFailure; emit connection->sslErrors(errors); } + +void QHttpNetworkConnectionChannel::_q_encryptedBytesWritten(qint64 bytes) +{ + Q_UNUSED(bytes); + // bytes have been written to the socket. write even more of them :) + if (isSocketWriting()) + sendRequest(); + // otherwise we do nothing +} #endif QT_END_NAMESPACE diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h index 1d1153e..127a431 100644 --- a/src/network/access/qhttpnetworkconnectionchannel_p.h +++ b/src/network/access/qhttpnetworkconnectionchannel_p.h @@ -180,6 +180,7 @@ public: #ifndef QT_NO_OPENSSL void _q_encrypted(); // start sending request (https) void _q_sslErrors(const QList &errors); // ssl errors from the socket + void _q_encryptedBytesWritten(qint64 bytes); // proceed sending #endif }; -- cgit v0.12 From 8af395611e6aa07c2de7b8d48c21cd8ced74087c Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 15 Oct 2009 13:32:29 +0200 Subject: Made Mac Cocoa use the input method hints when deciding on IM. New behavior is to turn them off when inputting numbers or hidden text, which is the way it was in Qt 4.5. Task: QT-1938 Task: QT-2257 RevBy: Prasanth Ullattil --- src/gui/kernel/qcocoaview_mac.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index b1c5fc5..cc1376f 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1066,7 +1066,10 @@ extern "C" { sendToPopup = true; } - if (widgetToGetKey->testAttribute(Qt::WA_InputMethodEnabled)) { + if (widgetToGetKey->testAttribute(Qt::WA_InputMethodEnabled) + && !(widgetToGetKey->inputMethodHints() & Qt::ImhDigitsOnly + || widgetToGetKey->inputMethodHints() & Qt::ImhFormattedNumbersOnly + || widgetToGetKey->inputMethodHints() & Qt::ImhHiddenText)) { [qt_mac_nativeview_for(widgetToGetKey) interpretKeyEvents:[NSArray arrayWithObject: theEvent]]; } if (sendKeyEvents && !composing) { -- cgit v0.12 From f13ddaf06eeef9231dc8974c158652e966731013 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 15 Oct 2009 14:16:15 +0200 Subject: QSslSocket: Documentation enhancement Clarify about bytesWritten() and encryptedBytesWritten() Reviewed-by: David Boddie --- src/network/ssl/qsslsocket.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 0e9cb4f..a5732fb 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -149,6 +149,13 @@ This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (\l{http://www.openssl.org/}). + \note Be aware of the difference between the bytesWritten() signal and + the encryptedBytesWritten() signal. For a QTcpSocket, bytesWritten() + will get emitted as soon as data has been written to the TCP socket. + For a QSslSocket, bytesWritten() will get emitted when the data + is being encrypted and encryptedBytesWritten() + will get emitted as soon as data has been written to the TCP socket. + \sa QSslCertificate, QSslCipher, QSslError */ -- cgit v0.12 From aa24e2390124707db6720c148ff7e1d4edad795d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 15 Oct 2009 13:50:50 +0200 Subject: doc: Changed \reimp to \internal because base class version is. Task-number: QTBUG-4599 --- src/qt3support/widgets/q3combobox.cpp | 3 ++- src/qt3support/widgets/q3toolbar.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qt3support/widgets/q3combobox.cpp b/src/qt3support/widgets/q3combobox.cpp index 9e7fd77..2aee4ac 100644 --- a/src/qt3support/widgets/q3combobox.cpp +++ b/src/qt3support/widgets/q3combobox.cpp @@ -2234,7 +2234,8 @@ bool Q3ComboBox::autoCompletion() const return d->useCompletion; } -/*!\reimp +/*! + \internal */ void Q3ComboBox::styleChange( QStyle& s ) { diff --git a/src/qt3support/widgets/q3toolbar.cpp b/src/qt3support/widgets/q3toolbar.cpp index dbe3afd..00ff47b 100644 --- a/src/qt3support/widgets/q3toolbar.cpp +++ b/src/qt3support/widgets/q3toolbar.cpp @@ -422,7 +422,7 @@ void Q3ToolBar::addSeparator() } /*! - \internal + \internal */ void Q3ToolBar::styleChange(QStyle &oldStyle) -- cgit v0.12 From 2eb373a68367a6511e12d60034e920345431bcc8 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Thu, 15 Oct 2009 14:47:35 +0200 Subject: Some sub menus are disabled in Cocoa The commit faec535829a0e454a6784b0c5c37cb63e7da8f73 introduced this bug. Since we can add a submenu to the same supermenu, we should consider it before disabling the submenu who already have a supermenu. Reviewed-by: MortenS --- src/gui/widgets/qmenu_mac.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 354161d..c3b954f 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -1413,7 +1413,7 @@ QMenuPrivate::QMacMenuPrivate::syncAction(QMacMenuAction *action) SetMenuItemProperty(data.submenuHandle, 0, kMenuCreatorQt, kMenuPropertyCausedQWidget, sizeof(caused), &caused); #else NSMenu *subMenu = static_cast(action->action->menu()->macMenu()); - if ([subMenu supermenu] != nil) { + if ([subMenu supermenu] && [subMenu supermenu] != [item menu]) { // The menu is already a sub-menu of another one. Cocoa will throw an exception, // in such cases. For the time being, a new QMenu with same set of actions is the // only workaround. @@ -1686,7 +1686,7 @@ QMenuBarPrivate::QMacMenuBarPrivate::syncAction(QMacMenuAction *action) GetMenuItemProperty(action->menu, 0, kMenuCreatorQt, kMenuPropertyQWidget, sizeof(caused), 0, &caused); SetMenuItemProperty(submenu, 0, kMenuCreatorQt, kMenuPropertyCausedQWidget, sizeof(caused), &caused); #else - if ([submenu supermenu] != nil) + if ([submenu supermenu] && [submenu supermenu] != [item menu]) return; else [item setSubmenu:submenu]; -- cgit v0.12 From 5d8a1b95ceece54177c1bf8f8b855498d64c4118 Mon Sep 17 00:00:00 2001 From: ninerider Date: Thu, 15 Oct 2009 15:09:32 +0200 Subject: Default section size is taken instead of some fixed value Test failed on different styles such as Windows Mobile. Reviewed-by: Ossi --- tests/auto/qheaderview/tst_qheaderview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp index 920231d..3286768 100644 --- a/tests/auto/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/qheaderview/tst_qheaderview.cpp @@ -1836,7 +1836,7 @@ void tst_QHeaderView::preserveHiddenSectionWidth() model.insertRow(1); view.showSection(2); QCOMPARE(view.sectionSize(0), 100); - QCOMPARE(view.sectionSize(1), 30); + QCOMPARE(view.sectionSize(1), view.defaultSectionSize()); QCOMPARE(view.sectionSize(2), 50); } -- cgit v0.12 From 0ff40995a804709fc9f638fb86a3068990f79ab6 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 15 Oct 2009 16:12:41 +0300 Subject: Removed Symbian exemption from adding QtUiTools to browser demo. The exemption was originally added to make the demo compile when QtUiTools was not yet compiled for Symbian. Task-number: QT-1018 Reviewed-by: Janne Anttila --- demos/browser/browser.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/browser/browser.pro b/demos/browser/browser.pro index 6c5f005..a42aa60 100644 --- a/demos/browser/browser.pro +++ b/demos/browser/browser.pro @@ -3,7 +3,7 @@ TARGET = browser QT += webkit network CONFIG += qt warn_on -contains(QT_BUILD_PARTS, tools):!symbian:!embedded: CONFIG += uitools +contains(QT_BUILD_PARTS, tools):!embedded: CONFIG += uitools else: DEFINES += QT_NO_UITOOLS release:DEFINES+=QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT -- cgit v0.12 From 53a0caa5c3b4e2ae9cd496c82f3d033614b1384d Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 15 Oct 2009 16:27:10 +0200 Subject: Small fixes in Polish translation --- translations/designer_pl.ts | 2 +- translations/linguist_pl.ts | 16 ++++++++-------- translations/qt_pl.ts | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/translations/designer_pl.ts b/translations/designer_pl.ts index 001b54a..0c196d8 100644 --- a/translations/designer_pl.ts +++ b/translations/designer_pl.ts @@ -4709,7 +4709,7 @@ Czy chcesz nadpisać szablon? The file "%1" has changed outside Designer. Do you want to reload it? - Plik "%1" zmienił się na zewnątrz Designera. Czy chcesz go ponownie załadować? + Plik "%1" zmienił się na zewnątrz Designera. Czy chcesz go ponownie załadować? diff --git a/translations/linguist_pl.ts b/translations/linguist_pl.ts index 93b3a1d..b59ebc3 100644 --- a/translations/linguist_pl.ts +++ b/translations/linguist_pl.ts @@ -1511,32 +1511,32 @@ Wszystkie pliki (*) Russian - Rosyjskie + rosyjski German - Niemieckie + niemiecki Japanese - Japońskie + japoński French - Francuskie + francuski Polish - Polskie + polski Chinese - Chińskie + chiński @@ -1581,7 +1581,7 @@ Wszystkie pliki (*) %1 translation (%2) - %1 tłumaczenie (%2) + Tłumaczenie na język %1 (%2) @@ -1591,7 +1591,7 @@ Wszystkie pliki (*) %1 translation - %1 tłumaczenie + Tłumaczenie na język %1 diff --git a/translations/qt_pl.ts b/translations/qt_pl.ts index 8afb485..424fd31 100644 --- a/translations/qt_pl.ts +++ b/translations/qt_pl.ts @@ -8513,12 +8513,12 @@ Proszę wybrać inną nazwę pliku. Circular inheritance of base type %1. - Zapętlenie w dziedziczeniu podstawowego typu %1. + Cykliczne dziedziczenie podstawowego typu %1. Circular inheritance of union %1. - Zapętlenie w dziedziczeniu unii %1. + Cykliczne dziedziczenie unii %1. @@ -9143,7 +9143,7 @@ Proszę wybrać inną nazwę pliku. Fixed value constraint of element %1 differs from value constraint in base particle. - Ostateczne ograniczenie wartości elementu %1 różni się od ograniczenia wartości w podstawowym elemencie. + Ograniczenie stałej wartości elementu %1 różni się od ograniczenia wartości w podstawowym elemencie. @@ -9793,7 +9793,7 @@ Proszę wybrać inną nazwę pliku. Fixed value constrained not allowed if element is nillable. - Ograniczenie sztywnej wartości jest niedozwolone gdy element jest zerowalny. + Ograniczenie stałej wartości jest niedozwolone gdy element jest zerowalny. @@ -9842,7 +9842,7 @@ Proszę wybrać inną nazwę pliku. Element %1 can not contain other elements, as it has a fixed content. - Element %1 nie może zawierać innych elementów ponieważ posiada on sztywną zawartość. + Element %1 nie może zawierać innych elementów ponieważ posiada on stałą zawartość. -- cgit v0.12 From a38dcd522e05514a8caeeee7d01b05ec6af23fe1 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Thu, 15 Oct 2009 16:19:42 +0200 Subject: Fixed QPainter::begin() so that it fails gracefully. Fixed QPainter::begin() so that if it fails, it can still be used on other paint devices without causing an assert. Autotest included. I also made begin() fail on images with the QImage::Format_Indexed8 format and added warnings in the documentation since painting on such images is not supported. Reviewed-by: Trond --- src/gui/image/qimage.cpp | 3 ++ src/gui/painting/qpainter.cpp | 61 +++++++++++++++++++----------------- tests/auto/qpainter/tst_qpainter.cpp | 40 +++++++++++++++++++++++ 3 files changed, 75 insertions(+), 29 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 9048387..21ab40c 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -377,6 +377,9 @@ bool QImageData::checkForAlphaPixels() const \note If you would like to load QImage objects in a static build of Qt, refer to the \l{How To Create Qt Plugins#Static Plugins}{Plugin HowTo}. + \warning Painting on a QImage with the format + QImage::Format_Indexed8 is not supported. + \tableofcontents \section1 Reading and Writing Image Files diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 155eefe..cddad7d 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1608,9 +1608,21 @@ void QPainter::restore() \warning A paint device can only be painted by one painter at a time. + \warning Painting on a QImage with the format + QImage::Format_Indexed8 is not supported. + \sa end(), QPainter() */ +static inline void qt_cleanup_painter_state(QPainterPrivate *d) +{ + d->states.clear(); + delete d->state; + d->state = 0; + d->engine = 0; + d->device = 0; +} + bool QPainter::begin(QPaintDevice *pd) { Q_ASSERT(pd); @@ -1656,15 +1668,21 @@ bool QPainter::begin(QPaintDevice *pd) printf("QPainter::begin(), device=%p, type=%d\n", pd, pd->devType()); #endif - - d->device = pd; if (pd->devType() == QInternal::Pixmap) static_cast(pd)->detach(); else if (pd->devType() == QInternal::Image) static_cast(pd)->detach(); d->engine = pd->paintEngine(); - d->extended = d->engine && d->engine->isExtended() ? static_cast(d->engine) : 0; + + if (!d->engine) { + qWarning("QPainter::begin: Paint device returned engine == 0, type: %d", pd->devType()); + return false; + } + + d->device = pd; + + d->extended = d->engine->isExtended() ? static_cast(d->engine) : 0; if (d->emulationEngine) d->emulationEngine->real_engine = d->extended; @@ -1677,11 +1695,6 @@ bool QPainter::begin(QPaintDevice *pd) d->state->redirectionMatrix.translate(-redirectionOffset.x(), -redirectionOffset.y()); d->state->brushOrigin = QPointF(); - if (!d->engine) { - qWarning("QPainter::begin: Paint device returned engine == 0, type: %d", pd->devType()); - return false; - } - // Slip a painter state into the engine before we do any other operations if (d->extended) d->extended->setState(d->state); @@ -1700,8 +1713,7 @@ bool QPainter::begin(QPaintDevice *pd) && !paintOutsidePaintEvent && !inPaintEvent) { qWarning("QPainter::begin: Widget painting can only begin as a " "result of a paintEvent"); - d->engine = 0; - d->device = 0; + qt_cleanup_painter_state(d); return false; } @@ -1719,8 +1731,7 @@ bool QPainter::begin(QPaintDevice *pd) Q_ASSERT(pm); if (pm->isNull()) { qWarning("QPainter::begin: Cannot paint on a null pixmap"); - d->engine = 0; - d->device = 0; + qt_cleanup_painter_state(d); return false; } @@ -1736,8 +1747,12 @@ bool QPainter::begin(QPaintDevice *pd) Q_ASSERT(img); if (img->isNull()) { qWarning("QPainter::begin: Cannot paint on a null image"); - d->engine = 0; - d->device = 0; + qt_cleanup_painter_state(d); + return false; + } else if (img->format() == QImage::Format_Indexed8) { + // Painting on indexed8 images is not supported. + qWarning("QPainter::begin: Cannot paint on an image with the QImage::Format_Indexed8 format"); + qt_cleanup_painter_state(d); return false; } if (img->depth() == 1) { @@ -1760,12 +1775,8 @@ bool QPainter::begin(QPaintDevice *pd) if (d->engine->isActive()) { end(); } else { - d->states.clear(); - delete d->state; - d->state = 0; + qt_cleanup_painter_state(d); } - d->engine = 0; - d->device = 0; return false; } else { d->engine->setActive(begun); @@ -1828,10 +1839,7 @@ bool QPainter::end() if (!d->engine) { qWarning("QPainter::end: Painter not active, aborted"); - d->states.clear(); - delete d->state; - d->state = 0; - d->device = 0; + qt_cleanup_painter_state(d); return false; } @@ -1862,8 +1870,6 @@ bool QPainter::end() delete d->engine; } - d->engine = 0; - if (d->emulationEngine) { delete d->emulationEngine; d->emulationEngine = 0; @@ -1873,11 +1879,8 @@ bool QPainter::end() d->extended = 0; } - d->states.clear(); - delete d->state; - d->state = 0; + qt_cleanup_painter_state(d); - d->device = 0; return ended; } diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 9515d87..2231287 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -238,6 +238,8 @@ private slots: void taskQT4444_dontOverflowDashOffset(); + void painterBegin(); + private: void fillData(); QColor baseColor( int k, int intensity=255 ); @@ -4312,5 +4314,43 @@ void tst_QPainter::taskQT4444_dontOverflowDashOffset() QVERIFY(true); // Don't crash } +void tst_QPainter::painterBegin() +{ + QImage nullImage; + QImage indexed8Image(16, 16, QImage::Format_Indexed8); + QImage rgb32Image(16, 16, QImage::Format_RGB32); + QImage argb32Image(16, 16, QImage::Format_ARGB32_Premultiplied); + + QPainter p; + + // Painting on null image should fail. + QVERIFY(!p.begin(&nullImage)); + + // Check that the painter is not messed up by using it on another image. + QVERIFY(p.begin(&rgb32Image)); + QVERIFY(p.end()); + + // If painting on indexed8 image fails, the painter state should still be OK. + if (p.begin(&indexed8Image)) + QVERIFY(p.end()); + QVERIFY(p.begin(&rgb32Image)); + QVERIFY(p.end()); + + // Try opening a painter on the two different images. + QVERIFY(p.begin(&rgb32Image)); + QVERIFY(!p.begin(&argb32Image)); + QVERIFY(p.end()); + + // Try opening two painters on the same image. + QVERIFY(p.begin(&rgb32Image)); + QPainter q; + QVERIFY(!q.begin(&rgb32Image)); + QVERIFY(!q.end()); + QVERIFY(p.end()); + + // Try ending an inactive painter. + QVERIFY(!p.end()); +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" -- cgit v0.12 From 8d1d511a51aa26b4d86f4cc83e1eed194441469f Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Thu, 15 Oct 2009 17:08:03 +0200 Subject: Fix themed icon loader on DEs other than KDE and Gnome. Make sure that we at least try to load an icon via the "hicolor" theme. Reviewed-by: Olivier Goffart --- src/gui/image/qiconloader.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 5412e11..e7620bd 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -78,6 +78,8 @@ static QString fallbackTheme() return X11->desktopVersion >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg"); + } else { + return QLatin1String("hicolor"); } #endif return QString(); -- cgit v0.12 From 08554b7e8e58c685879881b17bdf65c5f4594c3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 15 Oct 2009 16:57:50 +0200 Subject: Fixed tst_QPixmap test failures with GL pixmap backend. Fixes test failures in fill() and setGetMask(). Reviewed-by: Trond --- src/opengl/qpixmapdata_gl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 3a657f1..ba4663f 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -426,6 +426,10 @@ QImage QGLPixmapData::fillImage(const QColor &color) const if (pixelType() == BitmapType) { img = QImage(w, h, QImage::Format_MonoLSB); + img.setNumColors(2); + img.setColor(0, QColor(Qt::color0).rgba()); + img.setColor(1, QColor(Qt::color1).rgba()); + if (color == Qt::color1) img.fill(1); else -- cgit v0.12 From b5106b1b99a749653c58719c333411b9ce374b67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 15 Oct 2009 16:42:10 +0200 Subject: Optimized QPixmap::fill for GL backend when pixmap is used as is. When QGLPixmapData is bound after a fill(), without being painted on in the mean-time, it's cheaper to directly generate a source image than to go through convertToGLFormat(), since all the pixels in the image will have the same value. Reviewed-by: Trond --- src/opengl/qgl.cpp | 46 +++++++++++++++++++++++++------------------ src/opengl/qpixmapdata_gl.cpp | 22 +++++++++++++++------ 2 files changed, 43 insertions(+), 25 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 1be2073..a8b136d 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1978,6 +1978,32 @@ GLuint QGLContext::bindTexture(const QString &fileName) return tx_id; } +static inline QRgb qt_gl_convertToGLFormatHelper(QRgb src_pixel, GLenum texture_format) +{ + if (texture_format == GL_BGRA) { + if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { + return ((src_pixel << 24) & 0xff000000) + | ((src_pixel >> 24) & 0x000000ff) + | ((src_pixel << 8) & 0x00ff0000) + | ((src_pixel >> 8) & 0x0000ff00); + } else { + return src_pixel; + } + } else { // GL_RGBA + if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { + return (src_pixel << 8) | ((src_pixel >> 24) & 0xff); + } else { + return ((src_pixel << 16) & 0xff0000) + | ((src_pixel >> 16) & 0xff) + | (src_pixel & 0xff00ff00); + } + } +} + +QRgb qt_gl_convertToGLFormat(QRgb src_pixel, GLenum texture_format) +{ + return qt_gl_convertToGLFormatHelper(src_pixel, texture_format); +} static void convertToGLFormatHelper(QImage &dst, const QImage &img, GLenum texture_format) { @@ -2006,25 +2032,7 @@ static void convertToGLFormatHelper(QImage &dst, const QImage &img, GLenum textu const uint *src = (const quint32 *) (srcPixels - (srcy >> 16) * sbpl); int srcx = basex; for (int x=0; x> 16]; - if (texture_format == GL_BGRA) { - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - dest[x] = ((src_pixel << 24) & 0xff000000) - | ((src_pixel >> 24) & 0x000000ff) - | ((src_pixel << 8) & 0x00ff0000) - | ((src_pixel >> 8) & 0x0000ff00); - } else { - dest[x] = src_pixel; - } - } else { // GL_RGBA - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - dest[x] = (src_pixel << 8) | ((src_pixel >> 24) & 0xff); - } else { - dest[x] = ((src_pixel << 16) & 0xff0000) - | ((src_pixel >> 16) & 0xff) - | (src_pixel & 0xff00ff00); - } - } + dest[x] = qt_gl_convertToGLFormatHelper(src[srcx >> 16], texture_format); srcx += ix; } dest = (quint32 *)(((uchar *) dest) + dbpl); diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index ba4663f..83ebece 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -568,6 +568,7 @@ QPaintEngine* QGLPixmapData::paintEngine() const return m_source.paintEngine(); } +extern QRgb qt_gl_convertToGLFormat(QRgb src_pixel, GLenum texture_format); // If copyBack is true, bind will copy the contents of the render // FBO to the texture (which is not bound to the texture, as it's @@ -577,17 +578,26 @@ GLuint QGLPixmapData::bind(bool copyBack) const if (m_renderFbo && copyBack) { copyBackFromRenderFbo(true); } else { - if (m_hasFillColor) { - m_dirty = true; - m_source = QImage(w, h, QImage::Format_ARGB32_Premultiplied); - m_source.fill(PREMUL(m_fillColor.rgba())); - m_hasFillColor = false; - } ensureCreated(); } GLuint id = m_texture.id; glBindTexture(GL_TEXTURE_2D, id); + + if (m_hasFillColor) { + if (!useFramebufferObjects()) { + m_source = QImage(w, h, QImage::Format_ARGB32_Premultiplied); + m_source.fill(PREMUL(m_fillColor.rgba())); + } + + m_hasFillColor = false; + + GLenum format = qt_gl_preferredTextureFormat(); + QImage tx(w, h, QImage::Format_ARGB32_Premultiplied); + tx.fill(qt_gl_convertToGLFormat(m_fillColor.rgba(), format)); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, format, GL_UNSIGNED_BYTE, tx.bits()); + } + return id; } -- cgit v0.12 From 739a36b3e86d6c112bc1720ec92a61433c48ee80 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Thu, 15 Oct 2009 08:15:34 -0700 Subject: Fix a problem with QDirectFBScreen::instance If using a proxy screen QScreen::instance() will not return a QDirectFBScreen but rather a QProxyScreen. This patch lets QDirectFBScreen::instance hold its own pointer. Reviewed-by: Jervey Kong --- src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 11 +++++++++++ src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 7 +------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 0f7a6de..00eeebd 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -99,8 +99,11 @@ public: qint64 cursorImageKey; QDirectFBScreen *q; + static QDirectFBScreen *instance; }; +QDirectFBScreen *QDirectFBScreenPrivate::instance = 0; + QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr) : QWSGraphicsSystem(qptr), dfb(0), flipFlags(DSFLIP_NONE), directFBFlags(QDirectFBScreen::NoFlags), alphaPixmapFormat(QImage::Format_Invalid), @@ -802,13 +805,21 @@ void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty) QDirectFBScreen::QDirectFBScreen(int display_id) : QScreen(display_id, DirectFBClass), d_ptr(new QDirectFBScreenPrivate(this)) { + QDirectFBScreenPrivate::instance = this; } QDirectFBScreen::~QDirectFBScreen() { + if (QDirectFBScreenPrivate::instance == this) + QDirectFBScreenPrivate::instance = 0; delete d_ptr; } +QDirectFBScreen *QDirectFBScreen::instance() +{ + return QDirectFBScreenPrivate::instance; +} + int QDirectFBScreen::depth(DFBSurfacePixelFormat format) { switch (format) { diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 5e8c5c6..437f1ae 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -163,12 +163,7 @@ public: QWSWindowSurface *createSurface(QWidget *widget) const; QWSWindowSurface *createSurface(const QString &key) const; - static inline QDirectFBScreen *instance() { - QScreen *inst = QScreen::instance(); - Q_ASSERT(!inst || inst->classId() == QScreen::DirectFBClass); - return static_cast(inst); - } - + static QDirectFBScreen *instance(); void waitIdle(); IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const; #ifdef QT_DIRECTFB_SUBSURFACE -- cgit v0.12 From 563b9362dbdedadb773ae45d6fa672f2c75463d9 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Thu, 15 Oct 2009 17:50:57 +0200 Subject: Sub-attaq : Don't let user move the boat with the mouse. Reviewed-by:TrustMe --- demos/sub-attaq/boat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/sub-attaq/boat.cpp b/demos/sub-attaq/boat.cpp index 3b1bac7..cb40329 100644 --- a/demos/sub-attaq/boat.cpp +++ b/demos/sub-attaq/boat.cpp @@ -87,7 +87,7 @@ Boat::Boat() : PixmapItem(QString("boat"), GraphicsScene::Big), speed(0), bombsAlreadyLaunched(0), direction(Boat::None), movementAnimation(0) { setZValue(4); - setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsFocusable); + setFlags(QGraphicsItem::ItemIsFocusable); //The movement animation used to animate the boat movementAnimation = new QPropertyAnimation(this, "pos"); -- cgit v0.12 From fd2049b3e318e28a10c18fe344de54820ef9ea40 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Thu, 15 Oct 2009 09:01:41 -0700 Subject: Make QT_DIRECTFB_SUBSURFACE an opt-in option Previously you had to define QT_NO_DIRECTFB_SUBSURFACE to prevent Qt from using subsurfaces for locked surfaces. Now make the default be QT_NO_DIRECTFB_SUBSURFACE and rather allow people to define QT_DIRECTFB_SUBSURFACE to use this option. Reviewed-by: Donald Carr --- src/gui/embedded/directfb.pri | 2 +- src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/embedded/directfb.pri b/src/gui/embedded/directfb.pri index fa4dd68..84253b5 100644 --- a/src/gui/embedded/directfb.pri +++ b/src/gui/embedded/directfb.pri @@ -1,7 +1,7 @@ # These defines might be necessary if your DirectFB driver doesn't # support all of the DirectFB API. # -#DEFINES += QT_NO_DIRECTFB_SUBSURFACE +#DEFINES += QT_DIRECTFB_SUBSURFACE #DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR #DEFINES += QT_NO_DIRECTFB_IMAGEPROVIDER #DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 437f1ae..0520cdc 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -54,8 +54,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#if !defined QT_NO_DIRECTFB_SUBSURFACE && !defined QT_DIRECTFB_SUBSURFACE -#define QT_DIRECTFB_SUBSURFACE +#if !defined QT_DIRECTFB_SUBSURFACE && !defined QT_NO_DIRECTFB_SUBSURFACE +#define QT_NO_DIRECTFB_SUBSURFACE #endif #if !defined QT_NO_DIRECTFB_LAYER && !defined QT_DIRECTFB_LAYER #define QT_DIRECTFB_LAYER -- cgit v0.12 From 307a12d9e2a5ec302e44d29c5ba5ca4cf0f7ebff Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Thu, 15 Oct 2009 18:37:13 +0200 Subject: Use the fallback icon theme name, if the system icon theme name can not be determined. This restores the behavior from before the the gui plugin merge. Reviewed-by: Olivier Goffart --- src/gui/image/qiconloader.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index e7620bd..46c5431 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -89,6 +89,8 @@ QIconLoader::QIconLoader() : m_themeKey(1), m_supportsSvg(false) { m_systemTheme = qt_guiPlatformPlugin()->systemIconThemeName(); + if (m_systemTheme.isEmpty()) + m_systemTheme = fallbackTheme(); QFactoryLoader iconFactoryLoader(QIconEngineFactoryInterfaceV2_iid, QLatin1String("/iconengines"), @@ -109,6 +111,8 @@ void QIconLoader::updateSystemTheme() // Only change if this is not explicitly set by the user if (m_userTheme.isEmpty()) { QString theme = qt_guiPlatformPlugin()->systemIconThemeName(); + if (theme.isEmpty()) + theme = fallbackTheme(); if (theme != m_systemTheme) { m_systemTheme = theme; invalidateKey(); -- cgit v0.12 From cdd181ddff47be15d396d05ca41d1ca11f8705fc Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Thu, 15 Oct 2009 15:03:16 -0700 Subject: Don't trust layer when using window_as_cursor When using QT_DIRECTFB_WINDOW_AS_CURSOR it's likely that the layer doesn't properly support the mouse. Seeing as one might still very well have layer support for windows I can't tie the event parsing solely to NO_DIRECTFB_LAYER. Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp index 8662df6..57b1950 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp @@ -207,7 +207,7 @@ void QDirectFBMouseHandlerPrivate::readMouseData() int wheel = 0; if (input.type == DIET_AXISMOTION) { -#ifdef QT_NO_DIRECTFB_LAYER +#if defined(QT_NO_DIRECTFB_LAYER) || defined(QT_DIRECTFB_WINDOW_AS_CURSOR) if (input.flags & DIEF_AXISABS) { switch (input.axis) { case DIAI_X: x = input.axisabs; break; -- cgit v0.12 From e7bd71fadbf4cd54e86616eda5dcd404b10c08c3 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 16 Oct 2009 08:45:46 +1000 Subject: Remove unnecessary QWSGLPaintDevice now that we have QGLPaintDevice Reviewed-by: Tom --- src/opengl/opengl.pro | 4 +- src/opengl/qgl.cpp | 1 - src/opengl/qglpaintdevice_p.h | 2 +- src/opengl/qglpaintdevice_qws.cpp | 85 ------------------------------------ src/opengl/qglpaintdevice_qws_p.h | 86 ------------------------------------- src/opengl/qglwindowsurface_qws.cpp | 1 - src/opengl/qpaintengine_opengl.cpp | 1 - 7 files changed, 2 insertions(+), 178 deletions(-) delete mode 100644 src/opengl/qglpaintdevice_qws.cpp delete mode 100644 src/opengl/qglpaintdevice_qws_p.h diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index d434725..e561932 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -126,14 +126,12 @@ wince*: { embedded { SOURCES += qgl_qws.cpp \ - qglpaintdevice_qws.cpp \ qglpixelbuffer_egl.cpp \ qglscreen_qws.cpp \ qglwindowsurface_qws.cpp \ qgl_egl.cpp - HEADERS += qglpaintdevice_qws_p.h \ - qglscreen_qws.h \ + HEADERS += qglscreen_qws.h \ qglwindowsurface_qws_p.h \ qgl_egl_p.h diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 5e00b11..0d00f59 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -76,7 +76,6 @@ #endif #ifdef Q_WS_QWS -#include #include #endif diff --git a/src/opengl/qglpaintdevice_p.h b/src/opengl/qglpaintdevice_p.h index 1e7ba8d..63ba5da 100644 --- a/src/opengl/qglpaintdevice_p.h +++ b/src/opengl/qglpaintdevice_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE -class QGLPaintDevice : public QPaintDevice +class Q_OPENGL_EXPORT QGLPaintDevice : public QPaintDevice { public: QGLPaintDevice(); diff --git a/src/opengl/qglpaintdevice_qws.cpp b/src/opengl/qglpaintdevice_qws.cpp deleted file mode 100644 index 1512278..0000000 --- a/src/opengl/qglpaintdevice_qws.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QWSGLPaintDevicePrivate -{ -public: - QWidget *widget; -}; - -QWSGLPaintDevice::QWSGLPaintDevice(QWidget *widget) : - d_ptr(new QWSGLPaintDevicePrivate) -{ - Q_D(QWSGLPaintDevice); - d->widget = widget; -} - -QWSGLPaintDevice::~QWSGLPaintDevice() -{ -} - -QPaintEngine* QWSGLPaintDevice::paintEngine() const -{ - return qt_qgl_paint_engine(); -} - -int QWSGLPaintDevice::metric(PaintDeviceMetric m) const -{ - Q_D(const QWSGLPaintDevice); - Q_ASSERT(d->widget); - - return qt_paint_device_metric(d->widget, m); -} - -QWSGLWindowSurface* QWSGLPaintDevice::windowSurface() const -{ - Q_D(const QWSGLPaintDevice); - return static_cast(d->widget->windowSurface()); -} - -QT_END_NAMESPACE diff --git a/src/opengl/qglpaintdevice_qws_p.h b/src/opengl/qglpaintdevice_qws_p.h deleted file mode 100644 index 6dc9d31..0000000 --- a/src/opengl/qglpaintdevice_qws_p.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWSGLPAINTDEVICE_GL_P_H -#define QWSGLPAINTDEVICE_GL_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of the QGLWindowSurface class. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -class QWidget; -class QWSGLWindowSurface; -class QWSGLPaintDevicePrivate; - -class Q_OPENGL_EXPORT QWSGLPaintDevice : public QPaintDevice -{ - Q_DECLARE_PRIVATE(QWSGLPaintDevice) -public: - QWSGLPaintDevice(QWidget *widget); - ~QWSGLPaintDevice(); - - QPaintEngine *paintEngine() const; - - int metric(PaintDeviceMetric m) const; - - QWSGLWindowSurface *windowSurface() const; - -private: - friend class QWSGLWindowSurface; - QScopedPointer d_ptr; -}; - - -QT_END_NAMESPACE - -#endif // QWSGLPAINTDEVICE_GL_P_H diff --git a/src/opengl/qglwindowsurface_qws.cpp b/src/opengl/qglwindowsurface_qws.cpp index 6bf3257..5041cb9 100644 --- a/src/opengl/qglwindowsurface_qws.cpp +++ b/src/opengl/qglwindowsurface_qws.cpp @@ -43,7 +43,6 @@ #include #include #include "private/qglwindowsurface_qws_p.h" -#include "private/qglpaintdevice_qws_p.h" #include "private/qpaintengine_opengl_p.h" QT_BEGIN_NAMESPACE diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 3e4a8e7..1a11476 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -66,7 +66,6 @@ #include "util/fragmentprograms_p.h" #ifdef Q_WS_QWS -#include "private/qglpaintdevice_qws_p.h" #include "private/qglwindowsurface_qws_p.h" #include "qwsmanager_qws.h" #include "private/qwsmanager_p.h" -- cgit v0.12 From 35298949b75c1f9876e4031f184cdc106df2a5da Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Thu, 15 Oct 2009 15:27:14 -0700 Subject: Allow setting DFBDisplayLayer background color We already have an option for setting the background color of the primary surface when running with NO_WM. Reuse the same option for allowing users to set the background color of the primary layer. Also fix the regexp. Reviewed-by: Donald Carr --- .../gfxdrivers/directfb/qdirectfbscreen.cpp | 66 +++++++++++++++++++--- 1 file changed, 59 insertions(+), 7 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 00eeebd..449bc0d 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -1061,6 +1061,26 @@ static inline bool setIntOption(const QStringList &arguments, const QString &var return false; } +static inline QColor colorFromName(const QString &name) +{ + QRegExp rx("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])"); + rx.setCaseSensitivity(Qt::CaseInsensitive); + if (rx.exactMatch(name)) { + Q_ASSERT(rx.numCaptures() == 4); + int ints[4]; + int i; + for (i=0; i<4; ++i) { + bool ok; + ints[i] = rx.cap(i + 1).toUInt(&ok, 16); + if (!ok || ints[i] > 255) + break; + } + if (i == 4) + return QColor(ints[0], ints[1], ints[2], ints[3]); + } + return QColor(name); +} + bool QDirectFBScreen::connect(const QString &displaySpec) { DFBResult result = DFB_OK; @@ -1293,18 +1313,50 @@ bool QDirectFBScreen::connect(const QString &displaySpec) #endif #ifdef QT_DIRECTFB_WM surface->Release(surface); + QColor backgroundColor; #else - QRegExp backgroundColorRegExp(QLatin1String("bgcolor=?(.+)")); + QColor &backgroundColor = d_ptr->backgroundColor; +#endif + + QRegExp backgroundColorRegExp(QLatin1String("bgcolor=(.+)")); backgroundColorRegExp.setCaseSensitivity(Qt::CaseInsensitive); if (displayArgs.indexOf(backgroundColorRegExp) != -1) { - d_ptr->backgroundColor.setNamedColor(backgroundColorRegExp.cap(1)); + backgroundColor = colorFromName(backgroundColorRegExp.cap(1)); } - if (!d_ptr->backgroundColor.isValid()) - d_ptr->backgroundColor = Qt::green; - d_ptr->primarySurface->Clear(d_ptr->primarySurface, d_ptr->backgroundColor.red(), - d_ptr->backgroundColor.green(), d_ptr->backgroundColor.blue(), - d_ptr->backgroundColor.alpha()); +#ifdef QT_NO_DIRECTFB_WM + if (!backgroundColor.isValid()) + backgroundColor = Qt::green; + d_ptr->primarySurface->Clear(d_ptr->primarySurface, backgroundColor.red(), + backgroundColor.green(), backgroundColor.blue(), + backgroundColor.alpha()); d_ptr->primarySurface->Flip(d_ptr->primarySurface, 0, d_ptr->flipFlags); +#else + if (backgroundColor.isValid()) { + DFBResult result = d_ptr->dfbLayer->SetCooperativeLevel(d_ptr->dfbLayer, DLSCL_ADMINISTRATIVE); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen::connect " + "Unable to set cooperative level", result); + } + result = d_ptr->dfbLayer->SetBackgroundColor(d_ptr->dfbLayer, backgroundColor.red(), backgroundColor.green(), + backgroundColor.blue(), backgroundColor.alpha()); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::connect: " + "Unable to set background color", result); + } + + result = d_ptr->dfbLayer->SetBackgroundMode(d_ptr->dfbLayer, DLBM_COLOR); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::connect: " + "Unable to set background mode", result); + } + + result = d_ptr->dfbLayer->SetCooperativeLevel(d_ptr->dfbLayer, DLSCL_SHARED); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen::connect " + "Unable to set cooperative level", result); + } + + } #endif return true; -- cgit v0.12 From 077f9711f0b9174ef9e9ffa7022aa06a9b3fc867 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Thu, 15 Oct 2009 14:40:33 +1000 Subject: Move audio and video examples into the common multimedia directory. Brings the video examples into multimedia directory, and removes the audio sub-directory so the directory structure is in line with the other example categories. Task-number: QT-667 Reviewed-by: Kurt Korbatits --- demos/qtdemo/xml/examples.xml | 2 +- doc/src/examples/audiodevices.qdoc | 2 +- doc/src/examples/audioinput.qdoc | 2 +- doc/src/examples/audiooutput.qdoc | 2 +- doc/src/examples/videographicsitem.qdoc | 2 +- doc/src/examples/videowidget.qdoc | 30 +-- doc/src/getting-started/examples.qdoc | 10 +- examples/examples.pro | 3 +- examples/multimedia/audio/audio.pro | 10 - .../multimedia/audio/audiodevices/audiodevices.cpp | 274 ------------------- .../multimedia/audio/audiodevices/audiodevices.h | 78 ------ .../multimedia/audio/audiodevices/audiodevices.pro | 17 -- .../audio/audiodevices/audiodevicesbase.ui | 233 ---------------- examples/multimedia/audio/audiodevices/main.cpp | 55 ---- .../multimedia/audio/audioinput/audioinput.cpp | 296 --------------------- examples/multimedia/audio/audioinput/audioinput.h | 124 --------- .../multimedia/audio/audioinput/audioinput.pro | 16 -- examples/multimedia/audio/audioinput/main.cpp | 55 ---- .../multimedia/audio/audiooutput/audiooutput.cpp | 270 ------------------- .../multimedia/audio/audiooutput/audiooutput.h | 110 -------- .../multimedia/audio/audiooutput/audiooutput.pro | 16 -- examples/multimedia/audio/audiooutput/main.cpp | 56 ---- examples/multimedia/audiodevices/audiodevices.cpp | 274 +++++++++++++++++++ examples/multimedia/audiodevices/audiodevices.h | 78 ++++++ examples/multimedia/audiodevices/audiodevices.pro | 17 ++ .../multimedia/audiodevices/audiodevicesbase.ui | 233 ++++++++++++++++ examples/multimedia/audiodevices/main.cpp | 55 ++++ examples/multimedia/audioinput/audioinput.cpp | 296 +++++++++++++++++++++ examples/multimedia/audioinput/audioinput.h | 124 +++++++++ examples/multimedia/audioinput/audioinput.pro | 16 ++ examples/multimedia/audioinput/main.cpp | 55 ++++ examples/multimedia/audiooutput/audiooutput.cpp | 270 +++++++++++++++++++ examples/multimedia/audiooutput/audiooutput.h | 110 ++++++++ examples/multimedia/audiooutput/audiooutput.pro | 16 ++ examples/multimedia/audiooutput/main.cpp | 56 ++++ examples/multimedia/multimedia.pro | 14 +- examples/multimedia/videographicsitem/main.cpp | 55 ++++ .../videographicsitem/videographicsitem.pro | 21 ++ .../multimedia/videographicsitem/videoitem.cpp | 144 ++++++++++ examples/multimedia/videographicsitem/videoitem.h | 79 ++++++ .../multimedia/videographicsitem/videoplayer.cpp | 210 +++++++++++++++ .../multimedia/videographicsitem/videoplayer.h | 86 ++++++ examples/multimedia/videowidget/main.cpp | 54 ++++ examples/multimedia/videowidget/videoplayer.cpp | 183 +++++++++++++ examples/multimedia/videowidget/videoplayer.h | 79 ++++++ examples/multimedia/videowidget/videowidget.cpp | 114 ++++++++ examples/multimedia/videowidget/videowidget.h | 76 ++++++ examples/multimedia/videowidget/videowidget.pro | 25 ++ .../multimedia/videowidget/videowidgetsurface.cpp | 175 ++++++++++++ .../multimedia/videowidget/videowidgetsurface.h | 81 ++++++ examples/video/video.pro | 6 - examples/video/videographicsitem/main.cpp | 55 ---- .../video/videographicsitem/videographicsitem.pro | 21 -- examples/video/videographicsitem/videoitem.cpp | 144 ---------- examples/video/videographicsitem/videoitem.h | 79 ------ examples/video/videographicsitem/videoplayer.cpp | 210 --------------- examples/video/videographicsitem/videoplayer.h | 86 ------ examples/video/videowidget/main.cpp | 54 ---- examples/video/videowidget/videoplayer.cpp | 183 ------------- examples/video/videowidget/videoplayer.h | 79 ------ examples/video/videowidget/videowidget.cpp | 114 -------- examples/video/videowidget/videowidget.h | 76 ------ examples/video/videowidget/videowidget.pro | 19 -- examples/video/videowidget/videowidgetsurface.cpp | 175 ------------ examples/video/videowidget/videowidgetsurface.h | 81 ------ 65 files changed, 3020 insertions(+), 3021 deletions(-) delete mode 100644 examples/multimedia/audio/audio.pro delete mode 100644 examples/multimedia/audio/audiodevices/audiodevices.cpp delete mode 100644 examples/multimedia/audio/audiodevices/audiodevices.h delete mode 100644 examples/multimedia/audio/audiodevices/audiodevices.pro delete mode 100644 examples/multimedia/audio/audiodevices/audiodevicesbase.ui delete mode 100644 examples/multimedia/audio/audiodevices/main.cpp delete mode 100644 examples/multimedia/audio/audioinput/audioinput.cpp delete mode 100644 examples/multimedia/audio/audioinput/audioinput.h delete mode 100644 examples/multimedia/audio/audioinput/audioinput.pro delete mode 100644 examples/multimedia/audio/audioinput/main.cpp delete mode 100644 examples/multimedia/audio/audiooutput/audiooutput.cpp delete mode 100644 examples/multimedia/audio/audiooutput/audiooutput.h delete mode 100644 examples/multimedia/audio/audiooutput/audiooutput.pro delete mode 100644 examples/multimedia/audio/audiooutput/main.cpp create mode 100644 examples/multimedia/audiodevices/audiodevices.cpp create mode 100644 examples/multimedia/audiodevices/audiodevices.h create mode 100644 examples/multimedia/audiodevices/audiodevices.pro create mode 100644 examples/multimedia/audiodevices/audiodevicesbase.ui create mode 100644 examples/multimedia/audiodevices/main.cpp create mode 100644 examples/multimedia/audioinput/audioinput.cpp create mode 100644 examples/multimedia/audioinput/audioinput.h create mode 100644 examples/multimedia/audioinput/audioinput.pro create mode 100644 examples/multimedia/audioinput/main.cpp create mode 100644 examples/multimedia/audiooutput/audiooutput.cpp create mode 100644 examples/multimedia/audiooutput/audiooutput.h create mode 100644 examples/multimedia/audiooutput/audiooutput.pro create mode 100644 examples/multimedia/audiooutput/main.cpp create mode 100644 examples/multimedia/videographicsitem/main.cpp create mode 100644 examples/multimedia/videographicsitem/videographicsitem.pro create mode 100644 examples/multimedia/videographicsitem/videoitem.cpp create mode 100644 examples/multimedia/videographicsitem/videoitem.h create mode 100644 examples/multimedia/videographicsitem/videoplayer.cpp create mode 100644 examples/multimedia/videographicsitem/videoplayer.h create mode 100644 examples/multimedia/videowidget/main.cpp create mode 100644 examples/multimedia/videowidget/videoplayer.cpp create mode 100644 examples/multimedia/videowidget/videoplayer.h create mode 100644 examples/multimedia/videowidget/videowidget.cpp create mode 100644 examples/multimedia/videowidget/videowidget.h create mode 100644 examples/multimedia/videowidget/videowidget.pro create mode 100644 examples/multimedia/videowidget/videowidgetsurface.cpp create mode 100644 examples/multimedia/videowidget/videowidgetsurface.h delete mode 100644 examples/video/video.pro delete mode 100644 examples/video/videographicsitem/main.cpp delete mode 100644 examples/video/videographicsitem/videographicsitem.pro delete mode 100644 examples/video/videographicsitem/videoitem.cpp delete mode 100644 examples/video/videographicsitem/videoitem.h delete mode 100644 examples/video/videographicsitem/videoplayer.cpp delete mode 100644 examples/video/videographicsitem/videoplayer.h delete mode 100644 examples/video/videowidget/main.cpp delete mode 100644 examples/video/videowidget/videoplayer.cpp delete mode 100644 examples/video/videowidget/videoplayer.h delete mode 100644 examples/video/videowidget/videowidget.cpp delete mode 100644 examples/video/videowidget/videowidget.h delete mode 100644 examples/video/videowidget/videowidget.pro delete mode 100644 examples/video/videowidget/videowidgetsurface.cpp delete mode 100644 examples/video/videowidget/videowidgetsurface.h diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml index 2c31484..83bd200 100644 --- a/demos/qtdemo/xml/examples.xml +++ b/demos/qtdemo/xml/examples.xml @@ -154,7 +154,7 @@ - + diff --git a/doc/src/examples/audiodevices.qdoc b/doc/src/examples/audiodevices.qdoc index 0d0932e..1505846 100644 --- a/doc/src/examples/audiodevices.qdoc +++ b/doc/src/examples/audiodevices.qdoc @@ -40,7 +40,7 @@ ****************************************************************************/ /*! - \example multimedia/audio/audiodevices + \example multimedia/audiodevices \title Audio Devices Example The Audio Devices example demonstrates the basic use of QAudioDeviceInfo class diff --git a/doc/src/examples/audioinput.qdoc b/doc/src/examples/audioinput.qdoc index ac44d75..8553e92 100644 --- a/doc/src/examples/audioinput.qdoc +++ b/doc/src/examples/audioinput.qdoc @@ -40,7 +40,7 @@ ****************************************************************************/ /*! - \example multimedia/audio/audioinput + \example multimedia/audioinput \title AudioInput Example The Audio Input example demonstrates the basic use of QAudioInput class diff --git a/doc/src/examples/audiooutput.qdoc b/doc/src/examples/audiooutput.qdoc index 2ed6ce4..58b8ea9 100644 --- a/doc/src/examples/audiooutput.qdoc +++ b/doc/src/examples/audiooutput.qdoc @@ -40,7 +40,7 @@ ****************************************************************************/ /*! - \example multimedia/audio/audiooutput + \example multimedia/audiooutput \title Audio Output Example The Audio Output example demonstrates the basic use of the QAudioOutput class diff --git a/doc/src/examples/videographicsitem.qdoc b/doc/src/examples/videographicsitem.qdoc index ce24f09..e1cb6ed 100644 --- a/doc/src/examples/videographicsitem.qdoc +++ b/doc/src/examples/videographicsitem.qdoc @@ -40,7 +40,7 @@ ****************************************************************************/ /*! - \example video/videographicsitem + \example multimedia/videographicsitem \title Video Graphics Item Example The Video Graphics Item example shows how to implement a QGraphicsItem that displays video on a diff --git a/doc/src/examples/videowidget.qdoc b/doc/src/examples/videowidget.qdoc index 1b214d2..4223c1f 100644 --- a/doc/src/examples/videowidget.qdoc +++ b/doc/src/examples/videowidget.qdoc @@ -40,7 +40,7 @@ ****************************************************************************/ /*! - \example video/videowidget + \example multimedia/videowidget \title Video Widget Example The Video Widget example shows how to implement a video widget using @@ -50,7 +50,7 @@ \section1 VideoWidgetSurface Class Definition - \snippet examples/video/videowidget/videowidgetsurface.h 0 + \snippet examples/multimedia/videowidget/videowidgetsurface.h 0 The VideoWidgetSurface class inherits QAbstractVideoSurface and paints video frames on a QWidget. This is a separate class to VideoWidget as both @@ -62,7 +62,7 @@ \section1 VideoWidgetSurface Class Implementation - \snippet examples/video/videowidget/videowidgetsurface.cpp 0 + \snippet examples/multimedia/videowidget/videowidgetsurface.cpp 0 From the supportedPixelFormats() function we return a list of pixel formats the surface can paint. The order of the list hints at which formats are @@ -74,7 +74,7 @@ return any pixel formats if handleType is not QAbstractVideoBuffer::NoHandle. - \snippet examples/video/videowidget/videowidgetsurface.cpp 1 + \snippet examples/multimedia/videowidget/videowidgetsurface.cpp 1 In isFormatSupported() we test if the frame type of a surface format maps to a valid QImage format, that the frame size is not empty, and the handle @@ -85,7 +85,7 @@ that the size is not empty so a reimplementation wasn't strictly necessary in this case. - \snippet examples/video/videowidget/videowidgetsurface.cpp 2 + \snippet examples/multimedia/videowidget/videowidgetsurface.cpp 2 To start our surface we'll extract the image format and size from the selected video format and save it for use in the paint() function. If the @@ -94,7 +94,7 @@ by calling QAbstractVideoSurface::start(). Finally since the video size may have changed we'll trigger an update of the widget, and video geometry. - \snippet examples/video/videowidget/videowidgetsurface.cpp 5 + \snippet examples/multimedia/videowidget/videowidgetsurface.cpp 5 The updateVideoRect() function calculates the region within the widget the video occupies. The \l {QVideoSurfaceFormat::sizeHint()}{size hint} of the @@ -105,7 +105,7 @@ size in the center of the widget. Otherwise we shrink the size maintaining the aspect ratio so that it does fit. - \snippet examples/video/videowidget/videowidgetsurface.cpp 4 + \snippet examples/multimedia/videowidget/videowidgetsurface.cpp 4 We can't paint from outside a paint event, so when a new frame is received in present() we save a reference to it and force an immediate repaint of @@ -118,7 +118,7 @@ \l {QAbstractVideoSurface::UnsupportedFormatError}{UnsupportedFormatError} on our surface and stop it immediately. - \snippet examples/video/videowidget/videowidgetsurface.cpp 6 + \snippet examples/multimedia/videowidget/videowidgetsurface.cpp 6 The paint() function is called by the video widget to paint the current video frame. Before we draw the frame first we'll check the format for @@ -128,7 +128,7 @@ construct a new QImage from the current video frame, and draw it to the the widget. - \snippet examples/video/videowidget/videowidgetsurface.cpp 3 + \snippet examples/multimedia/videowidget/videowidgetsurface.cpp 3 When the surface is stopped we need to release the current frame and invalidate the video region. Then we confirm the surface has been @@ -141,7 +141,7 @@ The VideoWidget class uses the VideoWidgetSurface class to implement a video widget. - \snippet examples/video/videowidget/videowidget.h 0 + \snippet examples/multimedia/videowidget/videowidget.h 0 The VideoWidget QWidget implementation is minimal with just the sizeHint(), paintEvent(), and resizeEvent() functions in addition to the constructor, @@ -149,7 +149,7 @@ \section1 VideoWidget Class Implementation - \snippet examples/video/videowidget/videowidget.cpp 0 + \snippet examples/multimedia/videowidget/videowidget.cpp 0 In the VideoWidget constructor we set some flags to speed up re-paints a little. Setting the Qt::WA_NoSystemBackground flag and disabling automatic @@ -162,17 +162,17 @@ Finally we construct an instance of the VideoWidgetSurface class. - \snippet examples/video/videowidget/videowidget.cpp 1 + \snippet examples/multimedia/videowidget/videowidget.cpp 1 In the destructor we simply delete the VideoWidgetSurface instance. - \snippet examples/video/videowidget/videowidget.cpp 2 + \snippet examples/multimedia/videowidget/videowidget.cpp 2 We get the size hint for the widget from the video format of the surface which is calculated from viewport and pixel aspect ratio of the video format. - \snippet examples/video/videowidget/videowidget.cpp 3 + \snippet examples/multimedia/videowidget/videowidget.cpp 3 When the video widget receives a paint event we first check if the surface is started, if not then we simply fill the widget with the background @@ -180,7 +180,7 @@ by the paint region, before calling paint on the video surface to draw the current frame. - \snippet examples/video/videowidget/videowidget.cpp 4 + \snippet examples/multimedia/videowidget/videowidget.cpp 4 The resizeEvent() function is reimplemented to trigger an update of the video region when the widget is resized. diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index d72f816..d6ade22 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -806,16 +806,16 @@ Audio API in Qt applications. \list - \o \l{multimedia/audio/audiodevices}{Audio Devices} - \o \l{multimedia/audio/audiooutput}{Audio Output} - \o \l{multimedia/audio/audioinput}{Audio Input} + \o \l{multimedia/audiodevices}{Audio Devices} + \o \l{multimedia/audiooutput}{Audio Output} + \o \l{multimedia/audioinput}{Audio Input} \endlist \section1 Video Output \list - \o \l{video/videowidget}{Video Widget}\raisedaster - \o \l{video/videographicsitem}{Video Graphics Item} + \o \l{multimedia/videowidget}{Video Widget}\raisedaster + \o \l{multimedia/videographicsitem}{Video Graphics Item} \endlist \section1 Phonon diff --git a/examples/examples.pro b/examples/examples.pro index 7acd67b..d11e36b 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -39,8 +39,7 @@ symbian: SUBDIRS = \ xml contains(QT_CONFIG, multimedia) { - SUBDIRS += video - !static: SUBDIRS += multimedia + SUBDIRS += multimedia } contains(QT_CONFIG, script): SUBDIRS += script diff --git a/examples/multimedia/audio/audio.pro b/examples/multimedia/audio/audio.pro deleted file mode 100644 index c64bb34..0000000 --- a/examples/multimedia/audio/audio.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = audioinput \ - audiooutput \ - audiodevices - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS audio.pro README -sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio -INSTALLS += target sources diff --git a/examples/multimedia/audio/audiodevices/audiodevices.cpp b/examples/multimedia/audio/audiodevices/audiodevices.cpp deleted file mode 100644 index 4198605..0000000 --- a/examples/multimedia/audio/audiodevices/audiodevices.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include -#include - -#include "audiodevices.h" - -AudioDevicesBase::AudioDevicesBase( QMainWindow *parent, Qt::WFlags f ) -{ - Q_UNUSED(parent) - Q_UNUSED(f) - setupUi( this ); -} - -AudioDevicesBase::~AudioDevicesBase() {} - - -AudioTest::AudioTest( QMainWindow *parent, Qt::WFlags f ) - : AudioDevicesBase( parent, f ) -{ - nearestFreq->setDisabled(true); - nearestChannel->setDisabled(true); - nearestCodec->setDisabled(true); - nearestSampleSize->setDisabled(true); - nearestSampleType->setDisabled(true); - nearestEndian->setDisabled(true); - logOutput->setDisabled(true); - - mode = QAudio::AudioOutput; - modeBox->addItem("Input"); - modeBox->addItem("Output"); - - connect(testButton,SIGNAL(clicked()),SLOT(test())); - connect(modeBox,SIGNAL(activated(int)),SLOT(modeChanged(int))); - connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int))); - connect(frequencyBox,SIGNAL(activated(int)),SLOT(freqChanged(int))); - connect(channelsBox,SIGNAL(activated(int)),SLOT(channelChanged(int))); - connect(codecsBox,SIGNAL(activated(int)),SLOT(codecChanged(int))); - connect(sampleSizesBox,SIGNAL(activated(int)),SLOT(sampleSizeChanged(int))); - connect(sampleTypesBox,SIGNAL(activated(int)),SLOT(sampleTypeChanged(int))); - connect(endianBox,SIGNAL(activated(int)),SLOT(endianChanged(int))); - - modeBox->setCurrentIndex(0); - modeChanged(0); - deviceBox->setCurrentIndex(0); - deviceChanged(0); -} - -AudioTest::~AudioTest() -{ -} - -void AudioTest::test() -{ - // tries to set all the settings picked. - logOutput->clear(); - logOutput->append("NOTE: an invalid codec audio/test exists for testing, to get a fail condition."); - - if (!deviceInfo.isNull()) { - if (deviceInfo.isFormatSupported(settings)) { - logOutput->append("Success"); - nearestFreq->setText(""); - nearestChannel->setText(""); - nearestCodec->setText(""); - nearestSampleSize->setText(""); - nearestSampleType->setText(""); - nearestEndian->setText(""); - } else { - QAudioFormat nearest = deviceInfo.nearestFormat(settings); - logOutput->append(tr("Failed")); - nearestFreq->setText(QString("%1").arg(nearest.frequency())); - nearestChannel->setText(QString("%1").arg(nearest.channels())); - nearestCodec->setText(nearest.codec()); - nearestSampleSize->setText(QString("%1").arg(nearest.sampleSize())); - - switch(nearest.sampleType()) { - case QAudioFormat::SignedInt: - nearestSampleType->setText("SignedInt"); - break; - case QAudioFormat::UnSignedInt: - nearestSampleType->setText("UnSignedInt"); - break; - case QAudioFormat::Float: - nearestSampleType->setText("Float"); - break; - case QAudioFormat::Unknown: - nearestSampleType->setText("Unknown"); - } - switch(nearest.byteOrder()) { - case QAudioFormat::LittleEndian: - nearestEndian->setText("LittleEndian"); - break; - case QAudioFormat::BigEndian: - nearestEndian->setText("BigEndian"); - } - } - } - else - logOutput->append("No Device"); -} - -void AudioTest::modeChanged(int idx) -{ - // mode has changed - if(idx == 0) - mode=QAudio::AudioInput; - else - mode=QAudio::AudioOutput; - - deviceBox->clear(); - foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::deviceList(mode)) - deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo)); -} - -void AudioTest::deviceChanged(int idx) -{ - if (deviceBox->count() == 0) - return; - - // device has changed - deviceInfo = deviceBox->itemData(idx).value(); - - frequencyBox->clear(); - QList freqz = deviceInfo.supportedFrequencies(); - for(int i = 0; i < freqz.size(); ++i) - frequencyBox->addItem(QString("%1").arg(freqz.at(i))); - if(freqz.size()) - settings.setFrequency(freqz.at(0)); - - channelsBox->clear(); - QList chz = deviceInfo.supportedChannels(); - for(int i = 0; i < chz.size(); ++i) - channelsBox->addItem(QString("%1").arg(chz.at(i))); - if(chz.size()) - settings.setChannels(chz.at(0)); - - codecsBox->clear(); - QStringList codecz = deviceInfo.supportedCodecs(); - for(int i = 0; i < codecz.size(); ++i) - codecsBox->addItem(QString("%1").arg(codecz.at(i))); - if(codecz.size()) - settings.setCodec(codecz.at(0)); - // Add false to create failed condition! - codecsBox->addItem("audio/test"); - - sampleSizesBox->clear(); - QList sampleSizez = deviceInfo.supportedSampleSizes(); - for(int i = 0; i < sampleSizez.size(); ++i) - sampleSizesBox->addItem(QString("%1").arg(sampleSizez.at(i))); - if(sampleSizez.size()) - settings.setSampleSize(sampleSizez.at(0)); - - sampleTypesBox->clear(); - QList sampleTypez = deviceInfo.supportedSampleTypes(); - for(int i = 0; i < sampleTypez.size(); ++i) { - switch(sampleTypez.at(i)) { - case QAudioFormat::SignedInt: - sampleTypesBox->addItem("SignedInt"); - break; - case QAudioFormat::UnSignedInt: - sampleTypesBox->addItem("UnSignedInt"); - break; - case QAudioFormat::Float: - sampleTypesBox->addItem("Float"); - break; - case QAudioFormat::Unknown: - sampleTypesBox->addItem("Unknown"); - } - if(sampleTypez.size()) - settings.setSampleType(sampleTypez.at(0)); - } - - endianBox->clear(); - QList endianz = deviceInfo.supportedByteOrders(); - for(int i = 0; i < endianz.size(); ++i) { - switch(endianz.at(i)) { - case QAudioFormat::LittleEndian: - endianBox->addItem("Little Endian"); - break; - case QAudioFormat::BigEndian: - endianBox->addItem("Big Endian"); - break; - } - } - if(endianz.size()) - settings.setByteOrder(endianz.at(0)); -} - -void AudioTest::freqChanged(int idx) -{ - // freq has changed - settings.setFrequency(frequencyBox->itemText(idx).toInt()); -} - -void AudioTest::channelChanged(int idx) -{ - settings.setChannels(channelsBox->itemText(idx).toInt()); -} - -void AudioTest::codecChanged(int idx) -{ - settings.setCodec(codecsBox->itemText(idx)); -} - -void AudioTest::sampleSizeChanged(int idx) -{ - settings.setSampleSize(sampleSizesBox->itemText(idx).toInt()); -} - -void AudioTest::sampleTypeChanged(int idx) -{ - switch(sampleTypesBox->itemText(idx).toInt()) { - case QAudioFormat::SignedInt: - settings.setSampleType(QAudioFormat::SignedInt); - break; - case QAudioFormat::UnSignedInt: - settings.setSampleType(QAudioFormat::UnSignedInt); - break; - case QAudioFormat::Float: - settings.setSampleType(QAudioFormat::Float); - } -} - -void AudioTest::endianChanged(int idx) -{ - switch(endianBox->itemText(idx).toInt()) { - case QAudioFormat::LittleEndian: - settings.setByteOrder(QAudioFormat::LittleEndian); - break; - case QAudioFormat::BigEndian: - settings.setByteOrder(QAudioFormat::BigEndian); - } -} - diff --git a/examples/multimedia/audio/audiodevices/audiodevices.h b/examples/multimedia/audio/audiodevices/audiodevices.h deleted file mode 100644 index 5fe5547..0000000 --- a/examples/multimedia/audio/audiodevices/audiodevices.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include -#include -#include - -#include "ui_audiodevicesbase.h" - -class AudioDevicesBase : public QMainWindow, public Ui::AudioDevicesBase -{ -public: - AudioDevicesBase( QMainWindow *parent = 0, Qt::WFlags f = 0 ); - virtual ~AudioDevicesBase(); -}; - -class AudioTest : public AudioDevicesBase -{ - Q_OBJECT -public: - AudioTest( QMainWindow *parent = 0, Qt::WFlags f = 0 ); - virtual ~AudioTest(); - - QAudioDeviceInfo deviceInfo; - QAudioFormat settings; - QAudio::Mode mode; - -private slots: - void modeChanged(int idx); - void deviceChanged(int idx); - void freqChanged(int idx); - void channelChanged(int idx); - void codecChanged(int idx); - void sampleSizeChanged(int idx); - void sampleTypeChanged(int idx); - void endianChanged(int idx); - void test(); -}; - diff --git a/examples/multimedia/audio/audiodevices/audiodevices.pro b/examples/multimedia/audio/audiodevices/audiodevices.pro deleted file mode 100644 index 173aa8f..0000000 --- a/examples/multimedia/audio/audiodevices/audiodevices.pro +++ /dev/null @@ -1,17 +0,0 @@ -HEADERS = audiodevices.h -SOURCES = audiodevices.cpp \ - main.cpp -FORMS += audiodevicesbase.ui - -QT += multimedia - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiodevices -sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audiodevices.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiodevices -INSTALLS += target sources - -symbian { - TARGET.UID3 = 0xA000D7BE - include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -} diff --git a/examples/multimedia/audio/audiodevices/audiodevicesbase.ui b/examples/multimedia/audio/audiodevices/audiodevicesbase.ui deleted file mode 100644 index 5207338..0000000 --- a/examples/multimedia/audio/audiodevices/audiodevicesbase.ui +++ /dev/null @@ -1,233 +0,0 @@ - - - AudioDevicesBase - - - - 0 - 0 - 504 - 702 - - - - AudioDevicesBase - - - - - - - - - - 1 - 0 - - - - Device - - - - - - - Mode - - - - - - - - - - - - - QFrame::Panel - - - QFrame::Raised - - - Actual Settings - - - Qt::AlignCenter - - - - - - - QFrame::Panel - - - QFrame::Raised - - - Nearest Settings - - - Qt::AlignCenter - - - - - - - Frequency - - - - - - - Frequency - - - - - - - - - - - - - Channels - - - - - - - Channel - - - - - - - - - - - - - Codecs - - - - - - - Codec - - - - - - - - - - - - - SampleSize - - - - - - - SampleSize - - - - - - - - - - - - - SampleType - - - - - - - SampleType - - - - - - - - - - - - - Endianess - - - - - - - Endianess - - - - - - - - - - - - - - 0 - 40 - - - - - - - - Test - - - - - - - - - - - 0 - 0 - 504 - 19 - - - - - - - - diff --git a/examples/multimedia/audio/audiodevices/main.cpp b/examples/multimedia/audio/audiodevices/main.cpp deleted file mode 100644 index d5ddd4f..0000000 --- a/examples/multimedia/audio/audiodevices/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "audiodevices.h" - -int main(int argv, char **args) -{ - QApplication app(argv, args); - app.setApplicationName("Audio Device Test"); - - AudioTest audio; - audio.show(); - - return app.exec(); -} diff --git a/examples/multimedia/audio/audioinput/audioinput.cpp b/examples/multimedia/audio/audioinput/audioinput.cpp deleted file mode 100644 index 05723ae..0000000 --- a/examples/multimedia/audio/audioinput/audioinput.cpp +++ /dev/null @@ -1,296 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include -#include -#include - -#include -#include -#include "audioinput.h" - -#define BUFFER_SIZE 4096 - -AudioInfo::AudioInfo(QObject* parent, QAudioInput* device) - :QIODevice( parent ) -{ - input = device; - - m_maxValue = 0; -} - -AudioInfo::~AudioInfo() -{ -} - -void AudioInfo::start() -{ - open(QIODevice::WriteOnly); -} - -void AudioInfo::stop() -{ - close(); -} - -qint64 AudioInfo::readData(char *data, qint64 maxlen) -{ - Q_UNUSED(data) - Q_UNUSED(maxlen) - - return 0; -} - -qint64 AudioInfo::writeData(const char *data, qint64 len) -{ - int samples = len/2; // 2 bytes per sample - int maxAmp = 32768; // max for S16 samples - bool clipping = false; - - m_maxValue = 0; - - qint16* s = (qint16*)data; - - // sample format is S16LE, only! - - for(int i=0;i m_maxValue) m_maxValue = abs(sample); - } - // check for clipping - if(m_maxValue>=(maxAmp-1)) clipping = true; - - float value = ((float)m_maxValue/(float)maxAmp); - if(clipping) m_maxValue = 100; - else m_maxValue = (int)(value*100); - - emit update(); - - return len; -} - -int AudioInfo::LinearMax() -{ - return m_maxValue; -} - -RenderArea::RenderArea(QWidget *parent) - : QWidget(parent) -{ - setBackgroundRole(QPalette::Base); - setAutoFillBackground(true); - - level = 0; - setMinimumHeight(30); - setMinimumWidth(200); -} - -void RenderArea::paintEvent(QPaintEvent * /* event */) -{ - QPainter painter(this); - - painter.setPen(Qt::black); - painter.drawRect(QRect(painter.viewport().left()+10, painter.viewport().top()+10, - painter.viewport().right()-20, painter.viewport().bottom()-20)); - - if(level == 0) - return; - - painter.setPen(Qt::red); - - int pos = ((painter.viewport().right()-20)-(painter.viewport().left()+11))*level/100; - int x1,y1,x2,y2; - for(int i=0;i<10;i++) { - x1 = painter.viewport().left()+11; - y1 = painter.viewport().top()+10+i; - x2 = painter.viewport().left()+20+pos; - y2 = painter.viewport().top()+10+i; - if(x2 < painter.viewport().left()+10) - x2 = painter.viewport().left()+10; - - painter.drawLine(QPoint(x1,y1),QPoint(x2,y2)); - } -} - -void RenderArea::setLevel(int value) -{ - level = value; - repaint(); -} - - -InputTest::InputTest() -{ - QWidget *window = new QWidget; - QVBoxLayout* layout = new QVBoxLayout; - - canvas = new RenderArea; - layout->addWidget(canvas); - - deviceBox = new QComboBox(this); - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); - for(int i = 0; i < devices.size(); ++i) { - deviceBox->addItem(devices.at(i).deviceName(), qVariantFromValue(devices.at(i))); - } - connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int))); - layout->addWidget(deviceBox); - - button = new QPushButton(this); - button->setText(tr("Click for Push Mode")); - connect(button,SIGNAL(clicked()),SLOT(toggleMode())); - layout->addWidget(button); - - button2 = new QPushButton(this); - button2->setText(tr("Click To Suspend")); - connect(button2,SIGNAL(clicked()),SLOT(toggleSuspend())); - layout->addWidget(button2); - - window->setLayout(layout); - setCentralWidget(window); - window->show(); - - buffer = new char[BUFFER_SIZE]; - - pullMode = true; - - // AudioInfo class only supports mono S16LE samples! - format.setFrequency(8000); - format.setChannels(1); - format.setSampleSize(16); - format.setSampleType(QAudioFormat::SignedInt); - format.setByteOrder(QAudioFormat::LittleEndian); - format.setCodec("audio/pcm"); - - audioInput = new QAudioInput(format,this); - connect(audioInput,SIGNAL(notify()),SLOT(status())); - connect(audioInput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); - audioinfo = new AudioInfo(this,audioInput); - connect(audioinfo,SIGNAL(update()),SLOT(refreshDisplay())); - audioinfo->start(); - audioInput->start(audioinfo); -} - -InputTest::~InputTest() {} - -void InputTest::status() -{ - qWarning()<<"bytesReady = "<bytesReady()<<" bytes, clock = "<clock()<<"ms, totalTime = "<totalTime()/1000<<"ms"; -} - -void InputTest::readMore() -{ - if(!audioInput) - return; - qint64 len = audioInput->bytesReady(); - if(len > 4096) - len = 4096; - qint64 l = input->read(buffer,len); - if(l > 0) { - audioinfo->write(buffer,l); - } -} - -void InputTest::toggleMode() -{ - // Change bewteen pull and push modes - audioInput->stop(); - - if (pullMode) { - button->setText(tr("Click for Pull Mode")); - input = audioInput->start(0); - connect(input,SIGNAL(readyRead()),SLOT(readMore())); - pullMode = false; - } else { - button->setText(tr("Click for Push Mode")); - pullMode = true; - audioInput->start(audioinfo); - } -} - -void InputTest::toggleSuspend() -{ - // toggle suspend/resume - if(audioInput->state() == QAudio::SuspendState) { - qWarning()<<"status: Suspended, resume()"; - audioInput->resume(); - button2->setText("Click To Suspend"); - } else if (audioInput->state() == QAudio::ActiveState) { - qWarning()<<"status: Active, suspend()"; - audioInput->suspend(); - button2->setText("Click To Resume"); - } else if (audioInput->state() == QAudio::StopState) { - qWarning()<<"status: Stopped, resume()"; - audioInput->resume(); - button2->setText("Click To Suspend"); - } else if (audioInput->state() == QAudio::IdleState) { - qWarning()<<"status: IdleState"; - } -} - -void InputTest::state(QAudio::State state) -{ - qWarning()<<" state="<setLevel(audioinfo->LinearMax()); - canvas->repaint(); -} - -void InputTest::deviceChanged(int idx) -{ - audioinfo->stop(); - audioInput->stop(); - audioInput->disconnect(this); - delete audioInput; - - device = deviceBox->itemData(idx).value(); - audioInput = new QAudioInput(device, format, this); - connect(audioInput,SIGNAL(notify()),SLOT(status())); - connect(audioInput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); - audioinfo->start(); - audioInput->start(audioinfo); -} diff --git a/examples/multimedia/audio/audioinput/audioinput.h b/examples/multimedia/audio/audioinput/audioinput.h deleted file mode 100644 index 14e1bac..0000000 --- a/examples/multimedia/audio/audioinput/audioinput.h +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include - -#include - -class AudioInfo : public QIODevice -{ - Q_OBJECT -public: - AudioInfo(QObject* parent, QAudioInput* device); - ~AudioInfo(); - - void start(); - void stop(); - - int LinearMax(); - - qint64 readData(char *data, qint64 maxlen); - qint64 writeData(const char *data, qint64 len); - - QAudioInput* input; - -private: - int m_maxValue; - -signals: - void update(); -}; - - -class RenderArea : public QWidget -{ - Q_OBJECT - -public: - RenderArea(QWidget *parent = 0); - - void setLevel(int value); - -protected: - void paintEvent(QPaintEvent *event); - -private: - int level; - QPixmap pixmap; -}; - -class InputTest : public QMainWindow -{ - Q_OBJECT -public: - InputTest(); - ~InputTest(); - - QAudioDeviceInfo device; - QAudioFormat format; - QAudioInput* audioInput; - AudioInfo* audioinfo; - QIODevice* input; - RenderArea* canvas; - - bool pullMode; - - QPushButton* button; - QPushButton* button2; - QComboBox* deviceBox; - - char* buffer; - -private slots: - void refreshDisplay(); - void status(); - void readMore(); - void toggleMode(); - void toggleSuspend(); - void state(QAudio::State s); - void deviceChanged(int idx); -}; - diff --git a/examples/multimedia/audio/audioinput/audioinput.pro b/examples/multimedia/audio/audioinput/audioinput.pro deleted file mode 100644 index 0d6198d..0000000 --- a/examples/multimedia/audio/audioinput/audioinput.pro +++ /dev/null @@ -1,16 +0,0 @@ -HEADERS = audioinput.h -SOURCES = audioinput.cpp \ - main.cpp - -QT += multimedia - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audioinput -sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audioinput.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audioinput -INSTALLS += target sources - -symbian { - TARGET.UID3 = 0xA000D7BF - include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -} diff --git a/examples/multimedia/audio/audioinput/main.cpp b/examples/multimedia/audio/audioinput/main.cpp deleted file mode 100644 index d7e9c6c..0000000 --- a/examples/multimedia/audio/audioinput/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "audioinput.h" - -int main(int argv, char **args) -{ - QApplication app(argv, args); - app.setApplicationName("Audio Input Test"); - - InputTest input; - input.show(); - - return app.exec(); -} diff --git a/examples/multimedia/audio/audiooutput/audiooutput.cpp b/examples/multimedia/audio/audiooutput/audiooutput.cpp deleted file mode 100644 index 9e532cd..0000000 --- a/examples/multimedia/audio/audiooutput/audiooutput.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include -#include -#include "audiooutput.h" - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -#define SECONDS 1 -#define FREQ 600 -#define SYSTEM_FREQ 44100 - -Generator::Generator(QObject *parent) - :QIODevice( parent ) -{ - finished = false; - buffer = new char[SECONDS*SYSTEM_FREQ*4+1000]; - t=buffer; - len=fillData(t,FREQ,SECONDS); /* mono FREQHz sine */ - pos = 0; - total = len; -} - -Generator::~Generator() -{ - delete [] buffer; -} - -void Generator::start() -{ - open(QIODevice::ReadOnly); -} - -void Generator::stop() -{ - close(); -} - -int Generator::putShort(char *t, unsigned int value) -{ - *(unsigned char *)(t++)=value&255; - *(unsigned char *)(t)=(value/256)&255; - return 2; -} - -int Generator::fillData(char *start, int frequency, int seconds) -{ - int i, len=0; - int value; - for(i=0; i 16384) - len = 16384; - - if(len < (SECONDS*SYSTEM_FREQ*2)-pos) { - // Normal - memcpy(data,t+pos,len); - pos+=len; - return len; - } else { - // Whats left and reset to start - qint64 left = (SECONDS*SYSTEM_FREQ*2)-pos; - memcpy(data,t+pos,left); - pos=0; - return left; - } -} - -qint64 Generator::writeData(const char *data, qint64 len) -{ - Q_UNUSED(data); - Q_UNUSED(len); - - return 0; -} - -AudioTest::AudioTest() -{ - QWidget *window = new QWidget; - QVBoxLayout* layout = new QVBoxLayout; - - deviceBox = new QComboBox(this); - foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::deviceList(QAudio::AudioOutput)) - deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo)); - connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int))); - layout->addWidget(deviceBox); - - button = new QPushButton(this); - button->setText(tr("Click for Push Mode")); - connect(button,SIGNAL(clicked()),SLOT(toggle())); - layout->addWidget(button); - - button2 = new QPushButton(this); - button2->setText(tr("Click To Suspend")); - connect(button2,SIGNAL(clicked()),SLOT(togglePlay())); - layout->addWidget(button2); - - window->setLayout(layout); - setCentralWidget(window); - window->show(); - - buffer = new char[BUFFER_SIZE]; - - gen = new Generator(this); - - pullMode = true; - - timer = new QTimer(this); - connect(timer,SIGNAL(timeout()),SLOT(writeMore())); - - gen->start(); - - settings.setFrequency(SYSTEM_FREQ); - settings.setChannels(1); - settings.setSampleSize(16); - settings.setCodec("audio/pcm"); - settings.setByteOrder(QAudioFormat::LittleEndian); - settings.setSampleType(QAudioFormat::SignedInt); - audioOutput = new QAudioOutput(settings,this); - connect(audioOutput,SIGNAL(notify()),SLOT(status())); - connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); - - audioOutput->start(gen); -} - -AudioTest::~AudioTest() -{ - delete [] buffer; -} - -void AudioTest::deviceChanged(int idx) -{ - timer->stop(); - gen->stop(); - audioOutput->stop(); - audioOutput->disconnect(this); - delete audioOutput; - - device = deviceBox->itemData(idx).value(); - audioOutput = new QAudioOutput(device,settings,this); - connect(audioOutput,SIGNAL(notify()),SLOT(status())); - connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); - gen->start(); - audioOutput->start(gen); -} - -void AudioTest::status() -{ - qWarning()<<"byteFree = "<bytesFree()<<" bytes, clock = "<clock()<<"ms, totalTime = "<totalTime()/1000<<"ms"; -} - -void AudioTest::writeMore() -{ - if(!audioOutput) - return; - - if(audioOutput->state() == QAudio::StopState) - return; - - int l; - int out; - - int chunks = audioOutput->bytesFree()/audioOutput->periodSize(); - while(chunks) { - l = gen->read(buffer,audioOutput->periodSize()); - if(l > 0) - out = output->write(buffer,l); - if(l != audioOutput->periodSize()) - break; - chunks--; - } -} - -void AudioTest::toggle() -{ - // Change between pull and push modes - - timer->stop(); - audioOutput->stop(); - - if (pullMode) { - button->setText("Click for Pull Mode"); - output = audioOutput->start(0); - pullMode = false; - timer->start(20); - } else { - button->setText("Click for Push Mode"); - pullMode = true; - audioOutput->start(gen); - } -} - -void AudioTest::togglePlay() -{ - // toggle suspend/resume - if(audioOutput->state() == QAudio::SuspendState) { - qWarning()<<"status: Suspended, resume()"; - audioOutput->resume(); - button2->setText("Click To Suspend"); - } else if (audioOutput->state() == QAudio::ActiveState) { - qWarning()<<"status: Active, suspend()"; - audioOutput->suspend(); - button2->setText("Click To Resume"); - } else if (audioOutput->state() == QAudio::StopState) { - qWarning()<<"status: Stopped, resume()"; - audioOutput->resume(); - button2->setText("Click To Suspend"); - } else if (audioOutput->state() == QAudio::IdleState) { - qWarning()<<"status: IdleState"; - } -} - -void AudioTest::state(QAudio::State state) -{ - qWarning()<<" state="< - -#define BUFFER_SIZE 32768 - -#include -#include -#include -#include -#include -#include - -#include - -class Generator : public QIODevice -{ - Q_OBJECT -public: - Generator(QObject *parent); - ~Generator(); - - void start(); - void stop(); - - char *t; - int len; - int pos; - int total; - char *buffer; - bool finished; - int chunk_size; - - qint64 readData(char *data, qint64 maxlen); - qint64 writeData(const char *data, qint64 len); - -private: - int putShort(char *t, unsigned int value); - int fillData(char *start, int frequency, int seconds); -}; - -class AudioTest : public QMainWindow -{ - Q_OBJECT -public: - AudioTest(); - ~AudioTest(); - - QAudioDeviceInfo device; - Generator* gen; - QAudioOutput* audioOutput; - QIODevice* output; - QTimer* timer; - QAudioFormat settings; - - bool pullMode; - char* buffer; - - QPushButton* button; - QPushButton* button2; - QComboBox* deviceBox; - -private slots: - void status(); - void writeMore(); - void toggle(); - void togglePlay(); - void state(QAudio::State s); - void deviceChanged(int idx); -}; - diff --git a/examples/multimedia/audio/audiooutput/audiooutput.pro b/examples/multimedia/audio/audiooutput/audiooutput.pro deleted file mode 100644 index b43763c..0000000 --- a/examples/multimedia/audio/audiooutput/audiooutput.pro +++ /dev/null @@ -1,16 +0,0 @@ -HEADERS = audiooutput.h -SOURCES = audiooutput.cpp \ - main.cpp - -QT += multimedia - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiooutput -sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audiooutput.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiooutput -INSTALLS += target sources - -symbian { - TARGET.UID3 = 0xA000D7C0 - include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -} diff --git a/examples/multimedia/audio/audiooutput/main.cpp b/examples/multimedia/audio/audiooutput/main.cpp deleted file mode 100644 index 79ec99e..0000000 --- a/examples/multimedia/audio/audiooutput/main.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include - -#include "audiooutput.h" - -int main(int argv, char **args) -{ - QApplication app(argv, args); - app.setApplicationName("Audio Output Test"); - - AudioTest audio; - audio.show(); - - return app.exec(); -} diff --git a/examples/multimedia/audiodevices/audiodevices.cpp b/examples/multimedia/audiodevices/audiodevices.cpp new file mode 100644 index 0000000..4198605 --- /dev/null +++ b/examples/multimedia/audiodevices/audiodevices.cpp @@ -0,0 +1,274 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include +#include + +#include "audiodevices.h" + +AudioDevicesBase::AudioDevicesBase( QMainWindow *parent, Qt::WFlags f ) +{ + Q_UNUSED(parent) + Q_UNUSED(f) + setupUi( this ); +} + +AudioDevicesBase::~AudioDevicesBase() {} + + +AudioTest::AudioTest( QMainWindow *parent, Qt::WFlags f ) + : AudioDevicesBase( parent, f ) +{ + nearestFreq->setDisabled(true); + nearestChannel->setDisabled(true); + nearestCodec->setDisabled(true); + nearestSampleSize->setDisabled(true); + nearestSampleType->setDisabled(true); + nearestEndian->setDisabled(true); + logOutput->setDisabled(true); + + mode = QAudio::AudioOutput; + modeBox->addItem("Input"); + modeBox->addItem("Output"); + + connect(testButton,SIGNAL(clicked()),SLOT(test())); + connect(modeBox,SIGNAL(activated(int)),SLOT(modeChanged(int))); + connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int))); + connect(frequencyBox,SIGNAL(activated(int)),SLOT(freqChanged(int))); + connect(channelsBox,SIGNAL(activated(int)),SLOT(channelChanged(int))); + connect(codecsBox,SIGNAL(activated(int)),SLOT(codecChanged(int))); + connect(sampleSizesBox,SIGNAL(activated(int)),SLOT(sampleSizeChanged(int))); + connect(sampleTypesBox,SIGNAL(activated(int)),SLOT(sampleTypeChanged(int))); + connect(endianBox,SIGNAL(activated(int)),SLOT(endianChanged(int))); + + modeBox->setCurrentIndex(0); + modeChanged(0); + deviceBox->setCurrentIndex(0); + deviceChanged(0); +} + +AudioTest::~AudioTest() +{ +} + +void AudioTest::test() +{ + // tries to set all the settings picked. + logOutput->clear(); + logOutput->append("NOTE: an invalid codec audio/test exists for testing, to get a fail condition."); + + if (!deviceInfo.isNull()) { + if (deviceInfo.isFormatSupported(settings)) { + logOutput->append("Success"); + nearestFreq->setText(""); + nearestChannel->setText(""); + nearestCodec->setText(""); + nearestSampleSize->setText(""); + nearestSampleType->setText(""); + nearestEndian->setText(""); + } else { + QAudioFormat nearest = deviceInfo.nearestFormat(settings); + logOutput->append(tr("Failed")); + nearestFreq->setText(QString("%1").arg(nearest.frequency())); + nearestChannel->setText(QString("%1").arg(nearest.channels())); + nearestCodec->setText(nearest.codec()); + nearestSampleSize->setText(QString("%1").arg(nearest.sampleSize())); + + switch(nearest.sampleType()) { + case QAudioFormat::SignedInt: + nearestSampleType->setText("SignedInt"); + break; + case QAudioFormat::UnSignedInt: + nearestSampleType->setText("UnSignedInt"); + break; + case QAudioFormat::Float: + nearestSampleType->setText("Float"); + break; + case QAudioFormat::Unknown: + nearestSampleType->setText("Unknown"); + } + switch(nearest.byteOrder()) { + case QAudioFormat::LittleEndian: + nearestEndian->setText("LittleEndian"); + break; + case QAudioFormat::BigEndian: + nearestEndian->setText("BigEndian"); + } + } + } + else + logOutput->append("No Device"); +} + +void AudioTest::modeChanged(int idx) +{ + // mode has changed + if(idx == 0) + mode=QAudio::AudioInput; + else + mode=QAudio::AudioOutput; + + deviceBox->clear(); + foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::deviceList(mode)) + deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo)); +} + +void AudioTest::deviceChanged(int idx) +{ + if (deviceBox->count() == 0) + return; + + // device has changed + deviceInfo = deviceBox->itemData(idx).value(); + + frequencyBox->clear(); + QList freqz = deviceInfo.supportedFrequencies(); + for(int i = 0; i < freqz.size(); ++i) + frequencyBox->addItem(QString("%1").arg(freqz.at(i))); + if(freqz.size()) + settings.setFrequency(freqz.at(0)); + + channelsBox->clear(); + QList chz = deviceInfo.supportedChannels(); + for(int i = 0; i < chz.size(); ++i) + channelsBox->addItem(QString("%1").arg(chz.at(i))); + if(chz.size()) + settings.setChannels(chz.at(0)); + + codecsBox->clear(); + QStringList codecz = deviceInfo.supportedCodecs(); + for(int i = 0; i < codecz.size(); ++i) + codecsBox->addItem(QString("%1").arg(codecz.at(i))); + if(codecz.size()) + settings.setCodec(codecz.at(0)); + // Add false to create failed condition! + codecsBox->addItem("audio/test"); + + sampleSizesBox->clear(); + QList sampleSizez = deviceInfo.supportedSampleSizes(); + for(int i = 0; i < sampleSizez.size(); ++i) + sampleSizesBox->addItem(QString("%1").arg(sampleSizez.at(i))); + if(sampleSizez.size()) + settings.setSampleSize(sampleSizez.at(0)); + + sampleTypesBox->clear(); + QList sampleTypez = deviceInfo.supportedSampleTypes(); + for(int i = 0; i < sampleTypez.size(); ++i) { + switch(sampleTypez.at(i)) { + case QAudioFormat::SignedInt: + sampleTypesBox->addItem("SignedInt"); + break; + case QAudioFormat::UnSignedInt: + sampleTypesBox->addItem("UnSignedInt"); + break; + case QAudioFormat::Float: + sampleTypesBox->addItem("Float"); + break; + case QAudioFormat::Unknown: + sampleTypesBox->addItem("Unknown"); + } + if(sampleTypez.size()) + settings.setSampleType(sampleTypez.at(0)); + } + + endianBox->clear(); + QList endianz = deviceInfo.supportedByteOrders(); + for(int i = 0; i < endianz.size(); ++i) { + switch(endianz.at(i)) { + case QAudioFormat::LittleEndian: + endianBox->addItem("Little Endian"); + break; + case QAudioFormat::BigEndian: + endianBox->addItem("Big Endian"); + break; + } + } + if(endianz.size()) + settings.setByteOrder(endianz.at(0)); +} + +void AudioTest::freqChanged(int idx) +{ + // freq has changed + settings.setFrequency(frequencyBox->itemText(idx).toInt()); +} + +void AudioTest::channelChanged(int idx) +{ + settings.setChannels(channelsBox->itemText(idx).toInt()); +} + +void AudioTest::codecChanged(int idx) +{ + settings.setCodec(codecsBox->itemText(idx)); +} + +void AudioTest::sampleSizeChanged(int idx) +{ + settings.setSampleSize(sampleSizesBox->itemText(idx).toInt()); +} + +void AudioTest::sampleTypeChanged(int idx) +{ + switch(sampleTypesBox->itemText(idx).toInt()) { + case QAudioFormat::SignedInt: + settings.setSampleType(QAudioFormat::SignedInt); + break; + case QAudioFormat::UnSignedInt: + settings.setSampleType(QAudioFormat::UnSignedInt); + break; + case QAudioFormat::Float: + settings.setSampleType(QAudioFormat::Float); + } +} + +void AudioTest::endianChanged(int idx) +{ + switch(endianBox->itemText(idx).toInt()) { + case QAudioFormat::LittleEndian: + settings.setByteOrder(QAudioFormat::LittleEndian); + break; + case QAudioFormat::BigEndian: + settings.setByteOrder(QAudioFormat::BigEndian); + } +} + diff --git a/examples/multimedia/audiodevices/audiodevices.h b/examples/multimedia/audiodevices/audiodevices.h new file mode 100644 index 0000000..5fe5547 --- /dev/null +++ b/examples/multimedia/audiodevices/audiodevices.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include +#include +#include + +#include "ui_audiodevicesbase.h" + +class AudioDevicesBase : public QMainWindow, public Ui::AudioDevicesBase +{ +public: + AudioDevicesBase( QMainWindow *parent = 0, Qt::WFlags f = 0 ); + virtual ~AudioDevicesBase(); +}; + +class AudioTest : public AudioDevicesBase +{ + Q_OBJECT +public: + AudioTest( QMainWindow *parent = 0, Qt::WFlags f = 0 ); + virtual ~AudioTest(); + + QAudioDeviceInfo deviceInfo; + QAudioFormat settings; + QAudio::Mode mode; + +private slots: + void modeChanged(int idx); + void deviceChanged(int idx); + void freqChanged(int idx); + void channelChanged(int idx); + void codecChanged(int idx); + void sampleSizeChanged(int idx); + void sampleTypeChanged(int idx); + void endianChanged(int idx); + void test(); +}; + diff --git a/examples/multimedia/audiodevices/audiodevices.pro b/examples/multimedia/audiodevices/audiodevices.pro new file mode 100644 index 0000000..232da09 --- /dev/null +++ b/examples/multimedia/audiodevices/audiodevices.pro @@ -0,0 +1,17 @@ +HEADERS = audiodevices.h +SOURCES = audiodevices.cpp \ + main.cpp +FORMS += audiodevicesbase.ui + +QT += multimedia + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiodevices +sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audiodevices.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiodevices +INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000D7BE + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/multimedia/audiodevices/audiodevicesbase.ui b/examples/multimedia/audiodevices/audiodevicesbase.ui new file mode 100644 index 0000000..5207338 --- /dev/null +++ b/examples/multimedia/audiodevices/audiodevicesbase.ui @@ -0,0 +1,233 @@ + + + AudioDevicesBase + + + + 0 + 0 + 504 + 702 + + + + AudioDevicesBase + + + + + + + + + + 1 + 0 + + + + Device + + + + + + + Mode + + + + + + + + + + + + + QFrame::Panel + + + QFrame::Raised + + + Actual Settings + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Raised + + + Nearest Settings + + + Qt::AlignCenter + + + + + + + Frequency + + + + + + + Frequency + + + + + + + + + + + + + Channels + + + + + + + Channel + + + + + + + + + + + + + Codecs + + + + + + + Codec + + + + + + + + + + + + + SampleSize + + + + + + + SampleSize + + + + + + + + + + + + + SampleType + + + + + + + SampleType + + + + + + + + + + + + + Endianess + + + + + + + Endianess + + + + + + + + + + + + + + 0 + 40 + + + + + + + + Test + + + + + + + + + + + 0 + 0 + 504 + 19 + + + + + + + + diff --git a/examples/multimedia/audiodevices/main.cpp b/examples/multimedia/audiodevices/main.cpp new file mode 100644 index 0000000..d5ddd4f --- /dev/null +++ b/examples/multimedia/audiodevices/main.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "audiodevices.h" + +int main(int argv, char **args) +{ + QApplication app(argv, args); + app.setApplicationName("Audio Device Test"); + + AudioTest audio; + audio.show(); + + return app.exec(); +} diff --git a/examples/multimedia/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp new file mode 100644 index 0000000..05723ae --- /dev/null +++ b/examples/multimedia/audioinput/audioinput.cpp @@ -0,0 +1,296 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include +#include +#include + +#include +#include +#include "audioinput.h" + +#define BUFFER_SIZE 4096 + +AudioInfo::AudioInfo(QObject* parent, QAudioInput* device) + :QIODevice( parent ) +{ + input = device; + + m_maxValue = 0; +} + +AudioInfo::~AudioInfo() +{ +} + +void AudioInfo::start() +{ + open(QIODevice::WriteOnly); +} + +void AudioInfo::stop() +{ + close(); +} + +qint64 AudioInfo::readData(char *data, qint64 maxlen) +{ + Q_UNUSED(data) + Q_UNUSED(maxlen) + + return 0; +} + +qint64 AudioInfo::writeData(const char *data, qint64 len) +{ + int samples = len/2; // 2 bytes per sample + int maxAmp = 32768; // max for S16 samples + bool clipping = false; + + m_maxValue = 0; + + qint16* s = (qint16*)data; + + // sample format is S16LE, only! + + for(int i=0;i m_maxValue) m_maxValue = abs(sample); + } + // check for clipping + if(m_maxValue>=(maxAmp-1)) clipping = true; + + float value = ((float)m_maxValue/(float)maxAmp); + if(clipping) m_maxValue = 100; + else m_maxValue = (int)(value*100); + + emit update(); + + return len; +} + +int AudioInfo::LinearMax() +{ + return m_maxValue; +} + +RenderArea::RenderArea(QWidget *parent) + : QWidget(parent) +{ + setBackgroundRole(QPalette::Base); + setAutoFillBackground(true); + + level = 0; + setMinimumHeight(30); + setMinimumWidth(200); +} + +void RenderArea::paintEvent(QPaintEvent * /* event */) +{ + QPainter painter(this); + + painter.setPen(Qt::black); + painter.drawRect(QRect(painter.viewport().left()+10, painter.viewport().top()+10, + painter.viewport().right()-20, painter.viewport().bottom()-20)); + + if(level == 0) + return; + + painter.setPen(Qt::red); + + int pos = ((painter.viewport().right()-20)-(painter.viewport().left()+11))*level/100; + int x1,y1,x2,y2; + for(int i=0;i<10;i++) { + x1 = painter.viewport().left()+11; + y1 = painter.viewport().top()+10+i; + x2 = painter.viewport().left()+20+pos; + y2 = painter.viewport().top()+10+i; + if(x2 < painter.viewport().left()+10) + x2 = painter.viewport().left()+10; + + painter.drawLine(QPoint(x1,y1),QPoint(x2,y2)); + } +} + +void RenderArea::setLevel(int value) +{ + level = value; + repaint(); +} + + +InputTest::InputTest() +{ + QWidget *window = new QWidget; + QVBoxLayout* layout = new QVBoxLayout; + + canvas = new RenderArea; + layout->addWidget(canvas); + + deviceBox = new QComboBox(this); + QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); + for(int i = 0; i < devices.size(); ++i) { + deviceBox->addItem(devices.at(i).deviceName(), qVariantFromValue(devices.at(i))); + } + connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int))); + layout->addWidget(deviceBox); + + button = new QPushButton(this); + button->setText(tr("Click for Push Mode")); + connect(button,SIGNAL(clicked()),SLOT(toggleMode())); + layout->addWidget(button); + + button2 = new QPushButton(this); + button2->setText(tr("Click To Suspend")); + connect(button2,SIGNAL(clicked()),SLOT(toggleSuspend())); + layout->addWidget(button2); + + window->setLayout(layout); + setCentralWidget(window); + window->show(); + + buffer = new char[BUFFER_SIZE]; + + pullMode = true; + + // AudioInfo class only supports mono S16LE samples! + format.setFrequency(8000); + format.setChannels(1); + format.setSampleSize(16); + format.setSampleType(QAudioFormat::SignedInt); + format.setByteOrder(QAudioFormat::LittleEndian); + format.setCodec("audio/pcm"); + + audioInput = new QAudioInput(format,this); + connect(audioInput,SIGNAL(notify()),SLOT(status())); + connect(audioInput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); + audioinfo = new AudioInfo(this,audioInput); + connect(audioinfo,SIGNAL(update()),SLOT(refreshDisplay())); + audioinfo->start(); + audioInput->start(audioinfo); +} + +InputTest::~InputTest() {} + +void InputTest::status() +{ + qWarning()<<"bytesReady = "<bytesReady()<<" bytes, clock = "<clock()<<"ms, totalTime = "<totalTime()/1000<<"ms"; +} + +void InputTest::readMore() +{ + if(!audioInput) + return; + qint64 len = audioInput->bytesReady(); + if(len > 4096) + len = 4096; + qint64 l = input->read(buffer,len); + if(l > 0) { + audioinfo->write(buffer,l); + } +} + +void InputTest::toggleMode() +{ + // Change bewteen pull and push modes + audioInput->stop(); + + if (pullMode) { + button->setText(tr("Click for Pull Mode")); + input = audioInput->start(0); + connect(input,SIGNAL(readyRead()),SLOT(readMore())); + pullMode = false; + } else { + button->setText(tr("Click for Push Mode")); + pullMode = true; + audioInput->start(audioinfo); + } +} + +void InputTest::toggleSuspend() +{ + // toggle suspend/resume + if(audioInput->state() == QAudio::SuspendState) { + qWarning()<<"status: Suspended, resume()"; + audioInput->resume(); + button2->setText("Click To Suspend"); + } else if (audioInput->state() == QAudio::ActiveState) { + qWarning()<<"status: Active, suspend()"; + audioInput->suspend(); + button2->setText("Click To Resume"); + } else if (audioInput->state() == QAudio::StopState) { + qWarning()<<"status: Stopped, resume()"; + audioInput->resume(); + button2->setText("Click To Suspend"); + } else if (audioInput->state() == QAudio::IdleState) { + qWarning()<<"status: IdleState"; + } +} + +void InputTest::state(QAudio::State state) +{ + qWarning()<<" state="<setLevel(audioinfo->LinearMax()); + canvas->repaint(); +} + +void InputTest::deviceChanged(int idx) +{ + audioinfo->stop(); + audioInput->stop(); + audioInput->disconnect(this); + delete audioInput; + + device = deviceBox->itemData(idx).value(); + audioInput = new QAudioInput(device, format, this); + connect(audioInput,SIGNAL(notify()),SLOT(status())); + connect(audioInput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); + audioinfo->start(); + audioInput->start(audioinfo); +} diff --git a/examples/multimedia/audioinput/audioinput.h b/examples/multimedia/audioinput/audioinput.h new file mode 100644 index 0000000..14e1bac --- /dev/null +++ b/examples/multimedia/audioinput/audioinput.h @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include + +class AudioInfo : public QIODevice +{ + Q_OBJECT +public: + AudioInfo(QObject* parent, QAudioInput* device); + ~AudioInfo(); + + void start(); + void stop(); + + int LinearMax(); + + qint64 readData(char *data, qint64 maxlen); + qint64 writeData(const char *data, qint64 len); + + QAudioInput* input; + +private: + int m_maxValue; + +signals: + void update(); +}; + + +class RenderArea : public QWidget +{ + Q_OBJECT + +public: + RenderArea(QWidget *parent = 0); + + void setLevel(int value); + +protected: + void paintEvent(QPaintEvent *event); + +private: + int level; + QPixmap pixmap; +}; + +class InputTest : public QMainWindow +{ + Q_OBJECT +public: + InputTest(); + ~InputTest(); + + QAudioDeviceInfo device; + QAudioFormat format; + QAudioInput* audioInput; + AudioInfo* audioinfo; + QIODevice* input; + RenderArea* canvas; + + bool pullMode; + + QPushButton* button; + QPushButton* button2; + QComboBox* deviceBox; + + char* buffer; + +private slots: + void refreshDisplay(); + void status(); + void readMore(); + void toggleMode(); + void toggleSuspend(); + void state(QAudio::State s); + void deviceChanged(int idx); +}; + diff --git a/examples/multimedia/audioinput/audioinput.pro b/examples/multimedia/audioinput/audioinput.pro new file mode 100644 index 0000000..a54d452 --- /dev/null +++ b/examples/multimedia/audioinput/audioinput.pro @@ -0,0 +1,16 @@ +HEADERS = audioinput.h +SOURCES = audioinput.cpp \ + main.cpp + +QT += multimedia + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audioinput +sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audioinput.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audioinput +INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000D7BF + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/multimedia/audioinput/main.cpp b/examples/multimedia/audioinput/main.cpp new file mode 100644 index 0000000..d7e9c6c --- /dev/null +++ b/examples/multimedia/audioinput/main.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "audioinput.h" + +int main(int argv, char **args) +{ + QApplication app(argv, args); + app.setApplicationName("Audio Input Test"); + + InputTest input; + input.show(); + + return app.exec(); +} diff --git a/examples/multimedia/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp new file mode 100644 index 0000000..9e532cd --- /dev/null +++ b/examples/multimedia/audiooutput/audiooutput.cpp @@ -0,0 +1,270 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include +#include +#include "audiooutput.h" + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +#define SECONDS 1 +#define FREQ 600 +#define SYSTEM_FREQ 44100 + +Generator::Generator(QObject *parent) + :QIODevice( parent ) +{ + finished = false; + buffer = new char[SECONDS*SYSTEM_FREQ*4+1000]; + t=buffer; + len=fillData(t,FREQ,SECONDS); /* mono FREQHz sine */ + pos = 0; + total = len; +} + +Generator::~Generator() +{ + delete [] buffer; +} + +void Generator::start() +{ + open(QIODevice::ReadOnly); +} + +void Generator::stop() +{ + close(); +} + +int Generator::putShort(char *t, unsigned int value) +{ + *(unsigned char *)(t++)=value&255; + *(unsigned char *)(t)=(value/256)&255; + return 2; +} + +int Generator::fillData(char *start, int frequency, int seconds) +{ + int i, len=0; + int value; + for(i=0; i 16384) + len = 16384; + + if(len < (SECONDS*SYSTEM_FREQ*2)-pos) { + // Normal + memcpy(data,t+pos,len); + pos+=len; + return len; + } else { + // Whats left and reset to start + qint64 left = (SECONDS*SYSTEM_FREQ*2)-pos; + memcpy(data,t+pos,left); + pos=0; + return left; + } +} + +qint64 Generator::writeData(const char *data, qint64 len) +{ + Q_UNUSED(data); + Q_UNUSED(len); + + return 0; +} + +AudioTest::AudioTest() +{ + QWidget *window = new QWidget; + QVBoxLayout* layout = new QVBoxLayout; + + deviceBox = new QComboBox(this); + foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::deviceList(QAudio::AudioOutput)) + deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo)); + connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int))); + layout->addWidget(deviceBox); + + button = new QPushButton(this); + button->setText(tr("Click for Push Mode")); + connect(button,SIGNAL(clicked()),SLOT(toggle())); + layout->addWidget(button); + + button2 = new QPushButton(this); + button2->setText(tr("Click To Suspend")); + connect(button2,SIGNAL(clicked()),SLOT(togglePlay())); + layout->addWidget(button2); + + window->setLayout(layout); + setCentralWidget(window); + window->show(); + + buffer = new char[BUFFER_SIZE]; + + gen = new Generator(this); + + pullMode = true; + + timer = new QTimer(this); + connect(timer,SIGNAL(timeout()),SLOT(writeMore())); + + gen->start(); + + settings.setFrequency(SYSTEM_FREQ); + settings.setChannels(1); + settings.setSampleSize(16); + settings.setCodec("audio/pcm"); + settings.setByteOrder(QAudioFormat::LittleEndian); + settings.setSampleType(QAudioFormat::SignedInt); + audioOutput = new QAudioOutput(settings,this); + connect(audioOutput,SIGNAL(notify()),SLOT(status())); + connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); + + audioOutput->start(gen); +} + +AudioTest::~AudioTest() +{ + delete [] buffer; +} + +void AudioTest::deviceChanged(int idx) +{ + timer->stop(); + gen->stop(); + audioOutput->stop(); + audioOutput->disconnect(this); + delete audioOutput; + + device = deviceBox->itemData(idx).value(); + audioOutput = new QAudioOutput(device,settings,this); + connect(audioOutput,SIGNAL(notify()),SLOT(status())); + connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); + gen->start(); + audioOutput->start(gen); +} + +void AudioTest::status() +{ + qWarning()<<"byteFree = "<bytesFree()<<" bytes, clock = "<clock()<<"ms, totalTime = "<totalTime()/1000<<"ms"; +} + +void AudioTest::writeMore() +{ + if(!audioOutput) + return; + + if(audioOutput->state() == QAudio::StopState) + return; + + int l; + int out; + + int chunks = audioOutput->bytesFree()/audioOutput->periodSize(); + while(chunks) { + l = gen->read(buffer,audioOutput->periodSize()); + if(l > 0) + out = output->write(buffer,l); + if(l != audioOutput->periodSize()) + break; + chunks--; + } +} + +void AudioTest::toggle() +{ + // Change between pull and push modes + + timer->stop(); + audioOutput->stop(); + + if (pullMode) { + button->setText("Click for Pull Mode"); + output = audioOutput->start(0); + pullMode = false; + timer->start(20); + } else { + button->setText("Click for Push Mode"); + pullMode = true; + audioOutput->start(gen); + } +} + +void AudioTest::togglePlay() +{ + // toggle suspend/resume + if(audioOutput->state() == QAudio::SuspendState) { + qWarning()<<"status: Suspended, resume()"; + audioOutput->resume(); + button2->setText("Click To Suspend"); + } else if (audioOutput->state() == QAudio::ActiveState) { + qWarning()<<"status: Active, suspend()"; + audioOutput->suspend(); + button2->setText("Click To Resume"); + } else if (audioOutput->state() == QAudio::StopState) { + qWarning()<<"status: Stopped, resume()"; + audioOutput->resume(); + button2->setText("Click To Suspend"); + } else if (audioOutput->state() == QAudio::IdleState) { + qWarning()<<"status: IdleState"; + } +} + +void AudioTest::state(QAudio::State state) +{ + qWarning()<<" state="< + +#define BUFFER_SIZE 32768 + +#include +#include +#include +#include +#include +#include + +#include + +class Generator : public QIODevice +{ + Q_OBJECT +public: + Generator(QObject *parent); + ~Generator(); + + void start(); + void stop(); + + char *t; + int len; + int pos; + int total; + char *buffer; + bool finished; + int chunk_size; + + qint64 readData(char *data, qint64 maxlen); + qint64 writeData(const char *data, qint64 len); + +private: + int putShort(char *t, unsigned int value); + int fillData(char *start, int frequency, int seconds); +}; + +class AudioTest : public QMainWindow +{ + Q_OBJECT +public: + AudioTest(); + ~AudioTest(); + + QAudioDeviceInfo device; + Generator* gen; + QAudioOutput* audioOutput; + QIODevice* output; + QTimer* timer; + QAudioFormat settings; + + bool pullMode; + char* buffer; + + QPushButton* button; + QPushButton* button2; + QComboBox* deviceBox; + +private slots: + void status(); + void writeMore(); + void toggle(); + void togglePlay(); + void state(QAudio::State s); + void deviceChanged(int idx); +}; + diff --git a/examples/multimedia/audiooutput/audiooutput.pro b/examples/multimedia/audiooutput/audiooutput.pro new file mode 100644 index 0000000..26f68fe --- /dev/null +++ b/examples/multimedia/audiooutput/audiooutput.pro @@ -0,0 +1,16 @@ +HEADERS = audiooutput.h +SOURCES = audiooutput.cpp \ + main.cpp + +QT += multimedia + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiooutput +sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audiooutput.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiooutput +INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000D7C0 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/multimedia/audiooutput/main.cpp b/examples/multimedia/audiooutput/main.cpp new file mode 100644 index 0000000..79ec99e --- /dev/null +++ b/examples/multimedia/audiooutput/main.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include + +#include "audiooutput.h" + +int main(int argv, char **args) +{ + QApplication app(argv, args); + app.setApplicationName("Audio Output Test"); + + AudioTest audio; + audio.show(); + + return app.exec(); +} diff --git a/examples/multimedia/multimedia.pro b/examples/multimedia/multimedia.pro index ac78b15..4a764f2 100644 --- a/examples/multimedia/multimedia.pro +++ b/examples/multimedia/multimedia.pro @@ -1,5 +1,15 @@ -TEMPLATE = subdirs -SUBDIRS = audio +TEMPLATE = subdirs + +!static { + SUBDIRS += \ + audiodevices \ + audioinput \ + audiooutput +} + +SUBDIRS += \ + videographicsitem \ + videowidget # install target.path = $$[QT_INSTALL_EXAMPLES]/multimedia diff --git a/examples/multimedia/videographicsitem/main.cpp b/examples/multimedia/videographicsitem/main.cpp new file mode 100644 index 0000000..3bf4c6d --- /dev/null +++ b/examples/multimedia/videographicsitem/main.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "videoplayer.h" + +#include + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + VideoPlayer player; + player.show(); + + return app.exec(); +} + diff --git a/examples/multimedia/videographicsitem/videographicsitem.pro b/examples/multimedia/videographicsitem/videographicsitem.pro new file mode 100644 index 0000000..7c118cc --- /dev/null +++ b/examples/multimedia/videographicsitem/videographicsitem.pro @@ -0,0 +1,21 @@ +QT += multimedia + +contains(QT_CONFIG, opengl): QT += opengl + +HEADERS += videoplayer.h \ + videoitem.h + +SOURCES += main.cpp \ + videoplayer.cpp \ + videoitem.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videographicsitem +sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png images +sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videographicsitem +INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000D7C2 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/multimedia/videographicsitem/videoitem.cpp b/examples/multimedia/videographicsitem/videoitem.cpp new file mode 100644 index 0000000..c95e335 --- /dev/null +++ b/examples/multimedia/videographicsitem/videoitem.cpp @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "videoitem.h" + +#include + +VideoItem::VideoItem(QGraphicsItem *parent) + : QGraphicsItem(parent) + , imageFormat(QImage::Format_Invalid) + , framePainted(false) +{ +} + +VideoItem::~VideoItem() +{ +} + +QRectF VideoItem::boundingRect() const +{ + return QRectF(QPointF(0,0), surfaceFormat().sizeHint()); +} + +void VideoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + Q_UNUSED(option); + Q_UNUSED(widget); + + if (currentFrame.map(QAbstractVideoBuffer::ReadOnly)) { + const QTransform oldTransform = painter->transform(); + + if (surfaceFormat().scanLineDirection() == QVideoSurfaceFormat::BottomToTop) { + painter->scale(1, -1); + painter->translate(0, -boundingRect().height()); + } + + painter->drawImage(boundingRect(), QImage( + currentFrame.bits(), + imageSize.width(), + imageSize.height(), + imageFormat)); + + painter->setTransform(oldTransform); + + framePainted = true; + + currentFrame.unmap(); + } +} + +QList VideoItem::supportedPixelFormats( + QAbstractVideoBuffer::HandleType handleType) const +{ + if (handleType == QAbstractVideoBuffer::NoHandle) { + return QList() + << QVideoFrame::Format_RGB32 + << QVideoFrame::Format_ARGB32 + << QVideoFrame::Format_ARGB32_Premultiplied + << QVideoFrame::Format_RGB565 + << QVideoFrame::Format_RGB555; + } else { + return QList(); + } +} + +bool VideoItem::start(const QVideoSurfaceFormat &format) +{ + if (isFormatSupported(format)) { + imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat()); + imageSize = format.frameSize(); + framePainted = true; + + QAbstractVideoSurface::start(format); + + prepareGeometryChange(); + + return true; + } else { + return false; + } +} + +void VideoItem::stop() +{ + currentFrame = QVideoFrame(); + framePainted = false; + + QAbstractVideoSurface::stop(); +} + +bool VideoItem::present(const QVideoFrame &frame) +{ + if (!framePainted) { + if (!isStarted()) + setError(StoppedError); + + return false; + } else { + currentFrame = frame; + framePainted = false; + + update(); + + return true; + } +} diff --git a/examples/multimedia/videographicsitem/videoitem.h b/examples/multimedia/videographicsitem/videoitem.h new file mode 100644 index 0000000..96f578a --- /dev/null +++ b/examples/multimedia/videographicsitem/videoitem.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef VIDEOITEM_H +#define VIDEOITEM_H + +#include +#include + +class VideoItem + : public QAbstractVideoSurface, + public QGraphicsItem +{ + Q_OBJECT + Q_INTERFACES(QGraphicsItem) +public: + explicit VideoItem(QGraphicsItem *parentItem = 0); + ~VideoItem(); + + QRectF boundingRect() const; + void paint( + QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + + //video surface + QList supportedPixelFormats( + QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const; + + bool start(const QVideoSurfaceFormat &format); + void stop(); + bool present(const QVideoFrame &frame); + +private: + QImage::Format imageFormat; + QSize imageSize; + + QVideoFrame currentFrame; + bool framePainted; +}; + +#endif + diff --git a/examples/multimedia/videographicsitem/videoplayer.cpp b/examples/multimedia/videographicsitem/videoplayer.cpp new file mode 100644 index 0000000..83644db --- /dev/null +++ b/examples/multimedia/videographicsitem/videoplayer.cpp @@ -0,0 +1,210 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "videoplayer.h" +#include "videoitem.h" + +#include + +#ifndef QT_NO_OPENGL +# include +#endif + +VideoPlayer::VideoPlayer(QWidget *parent, Qt::WindowFlags flags) + : QWidget(parent, flags) + , videoItem(0) + , playButton(0) + , positionSlider(0) +{ + connect(&movie, SIGNAL(stateChanged(QMovie::MovieState)), + this, SLOT(movieStateChanged(QMovie::MovieState))); + connect(&movie, SIGNAL(frameChanged(int)), + this, SLOT(frameChanged(int))); + + videoItem = new VideoItem; + + QGraphicsScene *scene = new QGraphicsScene(this); + QGraphicsView *graphicsView = new QGraphicsView(scene); + +#ifndef QT_NO_OPENGL + graphicsView->setViewport(new QGLWidget); +#endif + + scene->addItem(videoItem); + + QSlider *rotateSlider = new QSlider(Qt::Horizontal); + rotateSlider->setRange(-180, 180); + rotateSlider->setValue(0); + + connect(rotateSlider, SIGNAL(valueChanged(int)), + this, SLOT(rotateVideo(int))); + + QAbstractButton *openButton = new QPushButton(tr("Open...")); + connect(openButton, SIGNAL(clicked()), this, SLOT(openFile())); + + playButton = new QPushButton; + playButton->setEnabled(false); + playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); + + connect(playButton, SIGNAL(clicked()), + this, SLOT(play())); + + positionSlider = new QSlider(Qt::Horizontal); + positionSlider->setRange(0, 0); + + connect(positionSlider, SIGNAL(sliderMoved(int)), + this, SLOT(setPosition(int))); + + connect(&movie, SIGNAL(frameChanged(int)), + positionSlider, SLOT(setValue(int))); + + QBoxLayout *controlLayout = new QHBoxLayout; + controlLayout->setMargin(0); + controlLayout->addWidget(openButton); + controlLayout->addWidget(playButton); + controlLayout->addWidget(positionSlider); + + QBoxLayout *layout = new QVBoxLayout; + layout->addWidget(graphicsView); + layout->addWidget(rotateSlider); + layout->addLayout(controlLayout); + + setLayout(layout); +} + +VideoPlayer::~VideoPlayer() +{ +} + +void VideoPlayer::openFile() +{ + QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie")); + + if (!fileName.isEmpty()) { + if (videoItem->isStarted()) + videoItem->stop(); + + movie.setFileName(fileName); + + playButton->setEnabled(true); + positionSlider->setMaximum(movie.frameCount()); + + movie.jumpToFrame(0); + } +} + +void VideoPlayer::play() +{ + switch(movie.state()) { + case QMovie::NotRunning: + movie.start(); + break; + case QMovie::Paused: + movie.setPaused(false); + break; + case QMovie::Running: + movie.setPaused(true); + break; + } +} + +void VideoPlayer::movieStateChanged(QMovie::MovieState state) +{ + switch(state) { + case QMovie::NotRunning: + case QMovie::Paused: + playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); + break; + case QMovie::Running: + playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPause)); + break; + } +} + +void VideoPlayer::frameChanged(int frame) +{ + if (!presentImage(movie.currentImage())) { + movie.stop(); + playButton->setEnabled(false); + positionSlider->setMaximum(0); + } else { + positionSlider->setValue(frame); + } +} + +void VideoPlayer::setPosition(int frame) +{ + movie.jumpToFrame(frame); +} + +void VideoPlayer::rotateVideo(int angle) +{ + //rotate around the center of video element + qreal x = videoItem->boundingRect().width() / 2.0; + qreal y = videoItem->boundingRect().height() / 2.0; + videoItem->setTransform(QTransform().translate(x, y).rotate(angle).translate(-x, -y)); +} + +bool VideoPlayer::presentImage(const QImage &image) +{ + QVideoFrame frame(image); + + if (!frame.isValid()) + return false; + + QVideoSurfaceFormat currentFormat = videoItem->surfaceFormat(); + + if (frame.pixelFormat() != currentFormat.pixelFormat() + || frame.size() != currentFormat.frameSize()) { + QVideoSurfaceFormat format(frame.size(), frame.pixelFormat()); + + if (!videoItem->start(format)) + return false; + } + + if (!videoItem->present(frame)) { + videoItem->stop(); + + return false; + } else { + return true; + } +} diff --git a/examples/multimedia/videographicsitem/videoplayer.h b/examples/multimedia/videographicsitem/videoplayer.h new file mode 100644 index 0000000..8e73e4c --- /dev/null +++ b/examples/multimedia/videographicsitem/videoplayer.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef VIDEOPLAYER_H +#define VIDEOPLAYER_H + +#include +#include + +QT_BEGIN_NAMESPACE +class QAbstractButton; +class QAbstractVideoSurface; +class QSlider; +QT_END_NAMESPACE + + +class VideoItem; + +class VideoPlayer : public QWidget +{ + Q_OBJECT +public: + VideoPlayer(QWidget *parent = 0, Qt::WindowFlags flags = 0); + ~VideoPlayer(); + + QSize sizeHint() const { return QSize(800, 600); } + +public slots: + void openFile(); + void play(); + +private slots: + void movieStateChanged(QMovie::MovieState state); + void frameChanged(int frame); + void setPosition(int frame); + void rotateVideo(int angle); + +private: + bool presentImage(const QImage &image); + + QMovie movie; + VideoItem *videoItem; + QAbstractButton *playButton; + QSlider *positionSlider; +}; + +#endif + diff --git a/examples/multimedia/videowidget/main.cpp b/examples/multimedia/videowidget/main.cpp new file mode 100644 index 0000000..f5edf73 --- /dev/null +++ b/examples/multimedia/videowidget/main.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "videoplayer.h" + +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + VideoPlayer player; + player.show(); + + return app.exec(); +} diff --git a/examples/multimedia/videowidget/videoplayer.cpp b/examples/multimedia/videowidget/videoplayer.cpp new file mode 100644 index 0000000..ed24714 --- /dev/null +++ b/examples/multimedia/videowidget/videoplayer.cpp @@ -0,0 +1,183 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "videoplayer.h" + +#include "videowidget.h" + +#include + +VideoPlayer::VideoPlayer(QWidget *parent) + : QWidget(parent) + , surface(0) + , playButton(0) + , positionSlider(0) +{ + connect(&movie, SIGNAL(stateChanged(QMovie::MovieState)), + this, SLOT(movieStateChanged(QMovie::MovieState))); + connect(&movie, SIGNAL(frameChanged(int)), + this, SLOT(frameChanged(int))); + + VideoWidget *videoWidget = new VideoWidget; + surface = videoWidget->videoSurface(); + + QAbstractButton *openButton = new QPushButton(tr("Open...")); + connect(openButton, SIGNAL(clicked()), this, SLOT(openFile())); + + playButton = new QPushButton; + playButton->setEnabled(false); + playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); + + connect(playButton, SIGNAL(clicked()), + this, SLOT(play())); + + positionSlider = new QSlider(Qt::Horizontal); + positionSlider->setRange(0, 0); + + connect(positionSlider, SIGNAL(sliderMoved(int)), + this, SLOT(setPosition(int))); + + connect(&movie, SIGNAL(frameChanged(int)), + positionSlider, SLOT(setValue(int))); + + QBoxLayout *controlLayout = new QHBoxLayout; + controlLayout->setMargin(0); + controlLayout->addWidget(openButton); + controlLayout->addWidget(playButton); + controlLayout->addWidget(positionSlider); + + QBoxLayout *layout = new QVBoxLayout; + layout->addWidget(videoWidget); + layout->addLayout(controlLayout); + + setLayout(layout); +} + +VideoPlayer::~VideoPlayer() +{ +} + +void VideoPlayer::openFile() +{ + QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie")); + + if (!fileName.isEmpty()) { + if (surface->isStarted()) + surface->stop(); + + movie.setFileName(fileName); + + playButton->setEnabled(true); + positionSlider->setMaximum(movie.frameCount()); + + movie.jumpToFrame(0); + } +} + +void VideoPlayer::play() +{ + switch(movie.state()) { + case QMovie::NotRunning: + movie.start(); + break; + case QMovie::Paused: + movie.setPaused(false); + break; + case QMovie::Running: + movie.setPaused(true); + break; + } +} + +void VideoPlayer::movieStateChanged(QMovie::MovieState state) +{ + switch(state) { + case QMovie::NotRunning: + case QMovie::Paused: + playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); + break; + case QMovie::Running: + playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPause)); + break; + } +} + +void VideoPlayer::frameChanged(int frame) +{ + if (!presentImage(movie.currentImage())) { + movie.stop(); + playButton->setEnabled(false); + positionSlider->setMaximum(0); + } else { + positionSlider->setValue(frame); + } +} + +void VideoPlayer::setPosition(int frame) +{ + movie.jumpToFrame(frame); +} + +bool VideoPlayer::presentImage(const QImage &image) +{ + QVideoFrame frame(image); + + if (!frame.isValid()) + return false; + + QVideoSurfaceFormat currentFormat = surface->surfaceFormat(); + + if (frame.pixelFormat() != currentFormat.pixelFormat() + || frame.size() != currentFormat.frameSize()) { + QVideoSurfaceFormat format(frame.size(), frame.pixelFormat()); + + if (!surface->start(format)) + return false; + } + + if (!surface->present(frame)) { + surface->stop(); + + return false; + } else { + return true; + } +} diff --git a/examples/multimedia/videowidget/videoplayer.h b/examples/multimedia/videowidget/videoplayer.h new file mode 100644 index 0000000..6547415 --- /dev/null +++ b/examples/multimedia/videowidget/videoplayer.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef VIDEOPLAYER_H +#define VIDEOPLAYER_H + +#include +#include + +QT_BEGIN_NAMESPACE +class QAbstractButton; +class QAbstractVideoSurface; +class QSlider; +QT_END_NAMESPACE + +class VideoPlayer : public QWidget +{ + Q_OBJECT +public: + VideoPlayer(QWidget *parent = 0); + ~VideoPlayer(); + +public slots: + void openFile(); + void play(); + +private slots: + void movieStateChanged(QMovie::MovieState state); + void frameChanged(int frame); + void setPosition(int frame); + +private: + bool presentImage(const QImage &image); + + QMovie movie; + QAbstractVideoSurface *surface; + QAbstractButton *playButton; + QSlider *positionSlider; +}; + +#endif diff --git a/examples/multimedia/videowidget/videowidget.cpp b/examples/multimedia/videowidget/videowidget.cpp new file mode 100644 index 0000000..80688e1 --- /dev/null +++ b/examples/multimedia/videowidget/videowidget.cpp @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "videowidget.h" + +#include "videowidgetsurface.h" + +#include + +//! [0] +VideoWidget::VideoWidget(QWidget *parent) + : QWidget(parent) + , surface(0) +{ + setAutoFillBackground(false); + setAttribute(Qt::WA_NoSystemBackground, true); + setAttribute(Qt::WA_PaintOnScreen, true); + + QPalette palette = this->palette(); + palette.setColor(QPalette::Background, Qt::black); + setPalette(palette); + + setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + + surface = new VideoWidgetSurface(this); +} +//! [0] + +//! [1] +VideoWidget::~VideoWidget() +{ + delete surface; +} +//! [1] + +//! [2] +QSize VideoWidget::sizeHint() const +{ + return surface->surfaceFormat().sizeHint(); +} +//! [2] + + +//! [3] +void VideoWidget::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + + if (surface->isStarted()) { + const QRect videoRect = surface->videoRect(); + + if (!videoRect.contains(event->rect())) { + QRegion region = event->region(); + region.subtract(videoRect); + + QBrush brush = palette().background(); + + foreach (const QRect &rect, region.rects()) + painter.fillRect(rect, brush); + } + + surface->paint(&painter); + } else { + painter.fillRect(event->rect(), palette().background()); + } +} +//! [3] + +//! [4] +void VideoWidget::resizeEvent(QResizeEvent *event) +{ + QWidget::resizeEvent(event); + + surface->updateVideoRect(); +} +//! [4] diff --git a/examples/multimedia/videowidget/videowidget.h b/examples/multimedia/videowidget/videowidget.h new file mode 100644 index 0000000..8c343bf --- /dev/null +++ b/examples/multimedia/videowidget/videowidget.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef VIDEOWIDGET_H +#define VIDEOWIDGET_H + +#include "videowidgetsurface.h" + +#include + +QT_BEGIN_NAMESPACE +class QAbstractVideoSurface; +QT_END_NAMESPACE + +class VideoWidgetSurface; + +//! [0] +class VideoWidget : public QWidget +{ + Q_OBJECT +public: + VideoWidget(QWidget *parent = 0); + ~VideoWidget(); + + QAbstractVideoSurface *videoSurface() const { return surface; } + + QSize sizeHint() const; + +protected: + void paintEvent(QPaintEvent *event); + void resizeEvent(QResizeEvent *event); + +private: + VideoWidgetSurface *surface; +}; +//! [0] + +#endif diff --git a/examples/multimedia/videowidget/videowidget.pro b/examples/multimedia/videowidget/videowidget.pro new file mode 100644 index 0000000..3f93745 --- /dev/null +++ b/examples/multimedia/videowidget/videowidget.pro @@ -0,0 +1,25 @@ +TEMPLATE = app + +QT += multimedia + +HEADERS = \ + videoplayer.h \ + videowidget.h \ + videowidgetsurface.h + +SOURCES = \ + main.cpp \ + videoplayer.cpp \ + videowidget.cpp \ + videowidgetsurface.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videowidget +sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png images +sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videowidget +INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000D7C3 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/multimedia/videowidget/videowidgetsurface.cpp b/examples/multimedia/videowidget/videowidgetsurface.cpp new file mode 100644 index 0000000..ec9b8b5 --- /dev/null +++ b/examples/multimedia/videowidget/videowidgetsurface.cpp @@ -0,0 +1,175 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "videowidgetsurface.h" + +#include + +VideoWidgetSurface::VideoWidgetSurface(QWidget *widget, QObject *parent) + : QAbstractVideoSurface(parent) + , widget(widget) + , imageFormat(QImage::Format_Invalid) +{ +} + +//! [0] +QList VideoWidgetSurface::supportedPixelFormats( + QAbstractVideoBuffer::HandleType handleType) const +{ + if (handleType == QAbstractVideoBuffer::NoHandle) { + return QList() + << QVideoFrame::Format_RGB32 + << QVideoFrame::Format_ARGB32 + << QVideoFrame::Format_ARGB32_Premultiplied + << QVideoFrame::Format_RGB565 + << QVideoFrame::Format_RGB555; + } else { + return QList(); + } +} +//! [0] + +//! [1] +bool VideoWidgetSurface::isFormatSupported( + const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const +{ + Q_UNUSED(similar); + + const QImage::Format imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat()); + const QSize size = format.frameSize(); + + return imageFormat != QImage::Format_Invalid + && !size.isEmpty() + && format.handleType() == QAbstractVideoBuffer::NoHandle; +} +//! [1] + +//! [2] +bool VideoWidgetSurface::start(const QVideoSurfaceFormat &format) +{ + const QImage::Format imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat()); + const QSize size = format.frameSize(); + + if (imageFormat != QImage::Format_Invalid && !size.isEmpty()) { + this->imageFormat = imageFormat; + imageSize = size; + sourceRect = format.viewport(); + + QAbstractVideoSurface::start(format); + + widget->updateGeometry(); + updateVideoRect(); + + return true; + } else { + return false; + } +} +//! [2] + +//! [3] +void VideoWidgetSurface::stop() +{ + currentFrame = QVideoFrame(); + targetRect = QRect(); + + QAbstractVideoSurface::stop(); + + widget->update(); +} +//! [3] + +//! [4] +bool VideoWidgetSurface::present(const QVideoFrame &frame) +{ + if (surfaceFormat().pixelFormat() != frame.pixelFormat() + || surfaceFormat().frameSize() != frame.size()) { + setError(IncorrectFormatError); + stop(); + + return false; + } else { + currentFrame = frame; + + widget->repaint(targetRect); + + return true; + } +} +//! [4] + +//! [5] +void VideoWidgetSurface::updateVideoRect() +{ + QSize size = surfaceFormat().sizeHint(); + size.scale(widget->size().boundedTo(size), Qt::KeepAspectRatio); + + targetRect = QRect(QPoint(0, 0), size); + targetRect.moveCenter(widget->rect().center()); +} +//! [5] + +//! [6] +void VideoWidgetSurface::paint(QPainter *painter) +{ + if (currentFrame.map(QAbstractVideoBuffer::ReadOnly)) { + const QTransform oldTransform = painter->transform(); + + if (surfaceFormat().scanLineDirection() == QVideoSurfaceFormat::BottomToTop) { + painter->scale(1, -1); + painter->translate(0, -widget->height()); + } + + QImage image( + currentFrame.bits(), + currentFrame.width(), + currentFrame.height(), + currentFrame.bytesPerLine(), + imageFormat); + + painter->drawImage(targetRect, image, sourceRect); + + painter->setTransform(oldTransform); + + currentFrame.unmap(); + } +} +//! [6] diff --git a/examples/multimedia/videowidget/videowidgetsurface.h b/examples/multimedia/videowidget/videowidgetsurface.h new file mode 100644 index 0000000..83439d3 --- /dev/null +++ b/examples/multimedia/videowidget/videowidgetsurface.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef VIDEOWIDGETSURFACE_H +#define VIDEOWIDGETSURFACE_H + +#include +#include +#include +#include + +//! [0] +class VideoWidgetSurface : public QAbstractVideoSurface +{ + Q_OBJECT +public: + VideoWidgetSurface(QWidget *widget, QObject *parent = 0); + + QList supportedPixelFormats( + QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const; + bool isFormatSupported(const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const; + + bool start(const QVideoSurfaceFormat &format); + void stop(); + + bool present(const QVideoFrame &frame); + + QRect videoRect() const { return targetRect; } + void updateVideoRect(); + + void paint(QPainter *painter); + +private: + QWidget *widget; + QImage::Format imageFormat; + QRect targetRect; + QSize imageSize; + QRect sourceRect; + QVideoFrame currentFrame; +}; +//! [0] + +#endif diff --git a/examples/video/video.pro b/examples/video/video.pro deleted file mode 100644 index f0b63b6..0000000 --- a/examples/video/video.pro +++ /dev/null @@ -1,6 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += \ - videographicsitem \ - videowidget - diff --git a/examples/video/videographicsitem/main.cpp b/examples/video/videographicsitem/main.cpp deleted file mode 100644 index 3bf4c6d..0000000 --- a/examples/video/videographicsitem/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "videoplayer.h" - -#include - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - VideoPlayer player; - player.show(); - - return app.exec(); -} - diff --git a/examples/video/videographicsitem/videographicsitem.pro b/examples/video/videographicsitem/videographicsitem.pro deleted file mode 100644 index d79c3fb..0000000 --- a/examples/video/videographicsitem/videographicsitem.pro +++ /dev/null @@ -1,21 +0,0 @@ -QT += multimedia - -contains(QT_CONFIG, opengl): QT += opengl - -HEADERS += videoplayer.h \ - videoitem.h - -SOURCES += main.cpp \ - videoplayer.cpp \ - videoitem.cpp - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/video/videographicsitem -sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png images -sources.path = $$[QT_INSTALL_EXAMPLES]/video/videographicsitem -INSTALLS += target sources - -symbian { - TARGET.UID3 = 0xA000D7C2 - include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -} diff --git a/examples/video/videographicsitem/videoitem.cpp b/examples/video/videographicsitem/videoitem.cpp deleted file mode 100644 index c95e335..0000000 --- a/examples/video/videographicsitem/videoitem.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "videoitem.h" - -#include - -VideoItem::VideoItem(QGraphicsItem *parent) - : QGraphicsItem(parent) - , imageFormat(QImage::Format_Invalid) - , framePainted(false) -{ -} - -VideoItem::~VideoItem() -{ -} - -QRectF VideoItem::boundingRect() const -{ - return QRectF(QPointF(0,0), surfaceFormat().sizeHint()); -} - -void VideoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - if (currentFrame.map(QAbstractVideoBuffer::ReadOnly)) { - const QTransform oldTransform = painter->transform(); - - if (surfaceFormat().scanLineDirection() == QVideoSurfaceFormat::BottomToTop) { - painter->scale(1, -1); - painter->translate(0, -boundingRect().height()); - } - - painter->drawImage(boundingRect(), QImage( - currentFrame.bits(), - imageSize.width(), - imageSize.height(), - imageFormat)); - - painter->setTransform(oldTransform); - - framePainted = true; - - currentFrame.unmap(); - } -} - -QList VideoItem::supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType) const -{ - if (handleType == QAbstractVideoBuffer::NoHandle) { - return QList() - << QVideoFrame::Format_RGB32 - << QVideoFrame::Format_ARGB32 - << QVideoFrame::Format_ARGB32_Premultiplied - << QVideoFrame::Format_RGB565 - << QVideoFrame::Format_RGB555; - } else { - return QList(); - } -} - -bool VideoItem::start(const QVideoSurfaceFormat &format) -{ - if (isFormatSupported(format)) { - imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat()); - imageSize = format.frameSize(); - framePainted = true; - - QAbstractVideoSurface::start(format); - - prepareGeometryChange(); - - return true; - } else { - return false; - } -} - -void VideoItem::stop() -{ - currentFrame = QVideoFrame(); - framePainted = false; - - QAbstractVideoSurface::stop(); -} - -bool VideoItem::present(const QVideoFrame &frame) -{ - if (!framePainted) { - if (!isStarted()) - setError(StoppedError); - - return false; - } else { - currentFrame = frame; - framePainted = false; - - update(); - - return true; - } -} diff --git a/examples/video/videographicsitem/videoitem.h b/examples/video/videographicsitem/videoitem.h deleted file mode 100644 index 96f578a..0000000 --- a/examples/video/videographicsitem/videoitem.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef VIDEOITEM_H -#define VIDEOITEM_H - -#include -#include - -class VideoItem - : public QAbstractVideoSurface, - public QGraphicsItem -{ - Q_OBJECT - Q_INTERFACES(QGraphicsItem) -public: - explicit VideoItem(QGraphicsItem *parentItem = 0); - ~VideoItem(); - - QRectF boundingRect() const; - void paint( - QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); - - //video surface - QList supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const; - - bool start(const QVideoSurfaceFormat &format); - void stop(); - bool present(const QVideoFrame &frame); - -private: - QImage::Format imageFormat; - QSize imageSize; - - QVideoFrame currentFrame; - bool framePainted; -}; - -#endif - diff --git a/examples/video/videographicsitem/videoplayer.cpp b/examples/video/videographicsitem/videoplayer.cpp deleted file mode 100644 index 83644db..0000000 --- a/examples/video/videographicsitem/videoplayer.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "videoplayer.h" -#include "videoitem.h" - -#include - -#ifndef QT_NO_OPENGL -# include -#endif - -VideoPlayer::VideoPlayer(QWidget *parent, Qt::WindowFlags flags) - : QWidget(parent, flags) - , videoItem(0) - , playButton(0) - , positionSlider(0) -{ - connect(&movie, SIGNAL(stateChanged(QMovie::MovieState)), - this, SLOT(movieStateChanged(QMovie::MovieState))); - connect(&movie, SIGNAL(frameChanged(int)), - this, SLOT(frameChanged(int))); - - videoItem = new VideoItem; - - QGraphicsScene *scene = new QGraphicsScene(this); - QGraphicsView *graphicsView = new QGraphicsView(scene); - -#ifndef QT_NO_OPENGL - graphicsView->setViewport(new QGLWidget); -#endif - - scene->addItem(videoItem); - - QSlider *rotateSlider = new QSlider(Qt::Horizontal); - rotateSlider->setRange(-180, 180); - rotateSlider->setValue(0); - - connect(rotateSlider, SIGNAL(valueChanged(int)), - this, SLOT(rotateVideo(int))); - - QAbstractButton *openButton = new QPushButton(tr("Open...")); - connect(openButton, SIGNAL(clicked()), this, SLOT(openFile())); - - playButton = new QPushButton; - playButton->setEnabled(false); - playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); - - connect(playButton, SIGNAL(clicked()), - this, SLOT(play())); - - positionSlider = new QSlider(Qt::Horizontal); - positionSlider->setRange(0, 0); - - connect(positionSlider, SIGNAL(sliderMoved(int)), - this, SLOT(setPosition(int))); - - connect(&movie, SIGNAL(frameChanged(int)), - positionSlider, SLOT(setValue(int))); - - QBoxLayout *controlLayout = new QHBoxLayout; - controlLayout->setMargin(0); - controlLayout->addWidget(openButton); - controlLayout->addWidget(playButton); - controlLayout->addWidget(positionSlider); - - QBoxLayout *layout = new QVBoxLayout; - layout->addWidget(graphicsView); - layout->addWidget(rotateSlider); - layout->addLayout(controlLayout); - - setLayout(layout); -} - -VideoPlayer::~VideoPlayer() -{ -} - -void VideoPlayer::openFile() -{ - QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie")); - - if (!fileName.isEmpty()) { - if (videoItem->isStarted()) - videoItem->stop(); - - movie.setFileName(fileName); - - playButton->setEnabled(true); - positionSlider->setMaximum(movie.frameCount()); - - movie.jumpToFrame(0); - } -} - -void VideoPlayer::play() -{ - switch(movie.state()) { - case QMovie::NotRunning: - movie.start(); - break; - case QMovie::Paused: - movie.setPaused(false); - break; - case QMovie::Running: - movie.setPaused(true); - break; - } -} - -void VideoPlayer::movieStateChanged(QMovie::MovieState state) -{ - switch(state) { - case QMovie::NotRunning: - case QMovie::Paused: - playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); - break; - case QMovie::Running: - playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPause)); - break; - } -} - -void VideoPlayer::frameChanged(int frame) -{ - if (!presentImage(movie.currentImage())) { - movie.stop(); - playButton->setEnabled(false); - positionSlider->setMaximum(0); - } else { - positionSlider->setValue(frame); - } -} - -void VideoPlayer::setPosition(int frame) -{ - movie.jumpToFrame(frame); -} - -void VideoPlayer::rotateVideo(int angle) -{ - //rotate around the center of video element - qreal x = videoItem->boundingRect().width() / 2.0; - qreal y = videoItem->boundingRect().height() / 2.0; - videoItem->setTransform(QTransform().translate(x, y).rotate(angle).translate(-x, -y)); -} - -bool VideoPlayer::presentImage(const QImage &image) -{ - QVideoFrame frame(image); - - if (!frame.isValid()) - return false; - - QVideoSurfaceFormat currentFormat = videoItem->surfaceFormat(); - - if (frame.pixelFormat() != currentFormat.pixelFormat() - || frame.size() != currentFormat.frameSize()) { - QVideoSurfaceFormat format(frame.size(), frame.pixelFormat()); - - if (!videoItem->start(format)) - return false; - } - - if (!videoItem->present(frame)) { - videoItem->stop(); - - return false; - } else { - return true; - } -} diff --git a/examples/video/videographicsitem/videoplayer.h b/examples/video/videographicsitem/videoplayer.h deleted file mode 100644 index 8e73e4c..0000000 --- a/examples/video/videographicsitem/videoplayer.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef VIDEOPLAYER_H -#define VIDEOPLAYER_H - -#include -#include - -QT_BEGIN_NAMESPACE -class QAbstractButton; -class QAbstractVideoSurface; -class QSlider; -QT_END_NAMESPACE - - -class VideoItem; - -class VideoPlayer : public QWidget -{ - Q_OBJECT -public: - VideoPlayer(QWidget *parent = 0, Qt::WindowFlags flags = 0); - ~VideoPlayer(); - - QSize sizeHint() const { return QSize(800, 600); } - -public slots: - void openFile(); - void play(); - -private slots: - void movieStateChanged(QMovie::MovieState state); - void frameChanged(int frame); - void setPosition(int frame); - void rotateVideo(int angle); - -private: - bool presentImage(const QImage &image); - - QMovie movie; - VideoItem *videoItem; - QAbstractButton *playButton; - QSlider *positionSlider; -}; - -#endif - diff --git a/examples/video/videowidget/main.cpp b/examples/video/videowidget/main.cpp deleted file mode 100644 index f5edf73..0000000 --- a/examples/video/videowidget/main.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "videoplayer.h" - -#include - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - VideoPlayer player; - player.show(); - - return app.exec(); -} diff --git a/examples/video/videowidget/videoplayer.cpp b/examples/video/videowidget/videoplayer.cpp deleted file mode 100644 index ed24714..0000000 --- a/examples/video/videowidget/videoplayer.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "videoplayer.h" - -#include "videowidget.h" - -#include - -VideoPlayer::VideoPlayer(QWidget *parent) - : QWidget(parent) - , surface(0) - , playButton(0) - , positionSlider(0) -{ - connect(&movie, SIGNAL(stateChanged(QMovie::MovieState)), - this, SLOT(movieStateChanged(QMovie::MovieState))); - connect(&movie, SIGNAL(frameChanged(int)), - this, SLOT(frameChanged(int))); - - VideoWidget *videoWidget = new VideoWidget; - surface = videoWidget->videoSurface(); - - QAbstractButton *openButton = new QPushButton(tr("Open...")); - connect(openButton, SIGNAL(clicked()), this, SLOT(openFile())); - - playButton = new QPushButton; - playButton->setEnabled(false); - playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); - - connect(playButton, SIGNAL(clicked()), - this, SLOT(play())); - - positionSlider = new QSlider(Qt::Horizontal); - positionSlider->setRange(0, 0); - - connect(positionSlider, SIGNAL(sliderMoved(int)), - this, SLOT(setPosition(int))); - - connect(&movie, SIGNAL(frameChanged(int)), - positionSlider, SLOT(setValue(int))); - - QBoxLayout *controlLayout = new QHBoxLayout; - controlLayout->setMargin(0); - controlLayout->addWidget(openButton); - controlLayout->addWidget(playButton); - controlLayout->addWidget(positionSlider); - - QBoxLayout *layout = new QVBoxLayout; - layout->addWidget(videoWidget); - layout->addLayout(controlLayout); - - setLayout(layout); -} - -VideoPlayer::~VideoPlayer() -{ -} - -void VideoPlayer::openFile() -{ - QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie")); - - if (!fileName.isEmpty()) { - if (surface->isStarted()) - surface->stop(); - - movie.setFileName(fileName); - - playButton->setEnabled(true); - positionSlider->setMaximum(movie.frameCount()); - - movie.jumpToFrame(0); - } -} - -void VideoPlayer::play() -{ - switch(movie.state()) { - case QMovie::NotRunning: - movie.start(); - break; - case QMovie::Paused: - movie.setPaused(false); - break; - case QMovie::Running: - movie.setPaused(true); - break; - } -} - -void VideoPlayer::movieStateChanged(QMovie::MovieState state) -{ - switch(state) { - case QMovie::NotRunning: - case QMovie::Paused: - playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); - break; - case QMovie::Running: - playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPause)); - break; - } -} - -void VideoPlayer::frameChanged(int frame) -{ - if (!presentImage(movie.currentImage())) { - movie.stop(); - playButton->setEnabled(false); - positionSlider->setMaximum(0); - } else { - positionSlider->setValue(frame); - } -} - -void VideoPlayer::setPosition(int frame) -{ - movie.jumpToFrame(frame); -} - -bool VideoPlayer::presentImage(const QImage &image) -{ - QVideoFrame frame(image); - - if (!frame.isValid()) - return false; - - QVideoSurfaceFormat currentFormat = surface->surfaceFormat(); - - if (frame.pixelFormat() != currentFormat.pixelFormat() - || frame.size() != currentFormat.frameSize()) { - QVideoSurfaceFormat format(frame.size(), frame.pixelFormat()); - - if (!surface->start(format)) - return false; - } - - if (!surface->present(frame)) { - surface->stop(); - - return false; - } else { - return true; - } -} diff --git a/examples/video/videowidget/videoplayer.h b/examples/video/videowidget/videoplayer.h deleted file mode 100644 index 6547415..0000000 --- a/examples/video/videowidget/videoplayer.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef VIDEOPLAYER_H -#define VIDEOPLAYER_H - -#include -#include - -QT_BEGIN_NAMESPACE -class QAbstractButton; -class QAbstractVideoSurface; -class QSlider; -QT_END_NAMESPACE - -class VideoPlayer : public QWidget -{ - Q_OBJECT -public: - VideoPlayer(QWidget *parent = 0); - ~VideoPlayer(); - -public slots: - void openFile(); - void play(); - -private slots: - void movieStateChanged(QMovie::MovieState state); - void frameChanged(int frame); - void setPosition(int frame); - -private: - bool presentImage(const QImage &image); - - QMovie movie; - QAbstractVideoSurface *surface; - QAbstractButton *playButton; - QSlider *positionSlider; -}; - -#endif diff --git a/examples/video/videowidget/videowidget.cpp b/examples/video/videowidget/videowidget.cpp deleted file mode 100644 index 80688e1..0000000 --- a/examples/video/videowidget/videowidget.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "videowidget.h" - -#include "videowidgetsurface.h" - -#include - -//! [0] -VideoWidget::VideoWidget(QWidget *parent) - : QWidget(parent) - , surface(0) -{ - setAutoFillBackground(false); - setAttribute(Qt::WA_NoSystemBackground, true); - setAttribute(Qt::WA_PaintOnScreen, true); - - QPalette palette = this->palette(); - palette.setColor(QPalette::Background, Qt::black); - setPalette(palette); - - setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - - surface = new VideoWidgetSurface(this); -} -//! [0] - -//! [1] -VideoWidget::~VideoWidget() -{ - delete surface; -} -//! [1] - -//! [2] -QSize VideoWidget::sizeHint() const -{ - return surface->surfaceFormat().sizeHint(); -} -//! [2] - - -//! [3] -void VideoWidget::paintEvent(QPaintEvent *event) -{ - QPainter painter(this); - - if (surface->isStarted()) { - const QRect videoRect = surface->videoRect(); - - if (!videoRect.contains(event->rect())) { - QRegion region = event->region(); - region.subtract(videoRect); - - QBrush brush = palette().background(); - - foreach (const QRect &rect, region.rects()) - painter.fillRect(rect, brush); - } - - surface->paint(&painter); - } else { - painter.fillRect(event->rect(), palette().background()); - } -} -//! [3] - -//! [4] -void VideoWidget::resizeEvent(QResizeEvent *event) -{ - QWidget::resizeEvent(event); - - surface->updateVideoRect(); -} -//! [4] diff --git a/examples/video/videowidget/videowidget.h b/examples/video/videowidget/videowidget.h deleted file mode 100644 index 8c343bf..0000000 --- a/examples/video/videowidget/videowidget.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef VIDEOWIDGET_H -#define VIDEOWIDGET_H - -#include "videowidgetsurface.h" - -#include - -QT_BEGIN_NAMESPACE -class QAbstractVideoSurface; -QT_END_NAMESPACE - -class VideoWidgetSurface; - -//! [0] -class VideoWidget : public QWidget -{ - Q_OBJECT -public: - VideoWidget(QWidget *parent = 0); - ~VideoWidget(); - - QAbstractVideoSurface *videoSurface() const { return surface; } - - QSize sizeHint() const; - -protected: - void paintEvent(QPaintEvent *event); - void resizeEvent(QResizeEvent *event); - -private: - VideoWidgetSurface *surface; -}; -//! [0] - -#endif diff --git a/examples/video/videowidget/videowidget.pro b/examples/video/videowidget/videowidget.pro deleted file mode 100644 index 4a1d717..0000000 --- a/examples/video/videowidget/videowidget.pro +++ /dev/null @@ -1,19 +0,0 @@ -TEMPLATE = app - -QT += multimedia - -HEADERS = \ - videoplayer.h \ - videowidget.h \ - videowidgetsurface.h - -SOURCES = \ - main.cpp \ - videoplayer.cpp \ - videowidget.cpp \ - videowidgetsurface.cpp - -symbian { - TARGET.UID3 = 0xA000D7C3 - include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -} diff --git a/examples/video/videowidget/videowidgetsurface.cpp b/examples/video/videowidget/videowidgetsurface.cpp deleted file mode 100644 index ec9b8b5..0000000 --- a/examples/video/videowidget/videowidgetsurface.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "videowidgetsurface.h" - -#include - -VideoWidgetSurface::VideoWidgetSurface(QWidget *widget, QObject *parent) - : QAbstractVideoSurface(parent) - , widget(widget) - , imageFormat(QImage::Format_Invalid) -{ -} - -//! [0] -QList VideoWidgetSurface::supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType) const -{ - if (handleType == QAbstractVideoBuffer::NoHandle) { - return QList() - << QVideoFrame::Format_RGB32 - << QVideoFrame::Format_ARGB32 - << QVideoFrame::Format_ARGB32_Premultiplied - << QVideoFrame::Format_RGB565 - << QVideoFrame::Format_RGB555; - } else { - return QList(); - } -} -//! [0] - -//! [1] -bool VideoWidgetSurface::isFormatSupported( - const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const -{ - Q_UNUSED(similar); - - const QImage::Format imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat()); - const QSize size = format.frameSize(); - - return imageFormat != QImage::Format_Invalid - && !size.isEmpty() - && format.handleType() == QAbstractVideoBuffer::NoHandle; -} -//! [1] - -//! [2] -bool VideoWidgetSurface::start(const QVideoSurfaceFormat &format) -{ - const QImage::Format imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat()); - const QSize size = format.frameSize(); - - if (imageFormat != QImage::Format_Invalid && !size.isEmpty()) { - this->imageFormat = imageFormat; - imageSize = size; - sourceRect = format.viewport(); - - QAbstractVideoSurface::start(format); - - widget->updateGeometry(); - updateVideoRect(); - - return true; - } else { - return false; - } -} -//! [2] - -//! [3] -void VideoWidgetSurface::stop() -{ - currentFrame = QVideoFrame(); - targetRect = QRect(); - - QAbstractVideoSurface::stop(); - - widget->update(); -} -//! [3] - -//! [4] -bool VideoWidgetSurface::present(const QVideoFrame &frame) -{ - if (surfaceFormat().pixelFormat() != frame.pixelFormat() - || surfaceFormat().frameSize() != frame.size()) { - setError(IncorrectFormatError); - stop(); - - return false; - } else { - currentFrame = frame; - - widget->repaint(targetRect); - - return true; - } -} -//! [4] - -//! [5] -void VideoWidgetSurface::updateVideoRect() -{ - QSize size = surfaceFormat().sizeHint(); - size.scale(widget->size().boundedTo(size), Qt::KeepAspectRatio); - - targetRect = QRect(QPoint(0, 0), size); - targetRect.moveCenter(widget->rect().center()); -} -//! [5] - -//! [6] -void VideoWidgetSurface::paint(QPainter *painter) -{ - if (currentFrame.map(QAbstractVideoBuffer::ReadOnly)) { - const QTransform oldTransform = painter->transform(); - - if (surfaceFormat().scanLineDirection() == QVideoSurfaceFormat::BottomToTop) { - painter->scale(1, -1); - painter->translate(0, -widget->height()); - } - - QImage image( - currentFrame.bits(), - currentFrame.width(), - currentFrame.height(), - currentFrame.bytesPerLine(), - imageFormat); - - painter->drawImage(targetRect, image, sourceRect); - - painter->setTransform(oldTransform); - - currentFrame.unmap(); - } -} -//! [6] diff --git a/examples/video/videowidget/videowidgetsurface.h b/examples/video/videowidget/videowidgetsurface.h deleted file mode 100644 index 83439d3..0000000 --- a/examples/video/videowidget/videowidgetsurface.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef VIDEOWIDGETSURFACE_H -#define VIDEOWIDGETSURFACE_H - -#include -#include -#include -#include - -//! [0] -class VideoWidgetSurface : public QAbstractVideoSurface -{ - Q_OBJECT -public: - VideoWidgetSurface(QWidget *widget, QObject *parent = 0); - - QList supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const; - bool isFormatSupported(const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const; - - bool start(const QVideoSurfaceFormat &format); - void stop(); - - bool present(const QVideoFrame &frame); - - QRect videoRect() const { return targetRect; } - void updateVideoRect(); - - void paint(QPainter *painter); - -private: - QWidget *widget; - QImage::Format imageFormat; - QRect targetRect; - QSize imageSize; - QRect sourceRect; - QVideoFrame currentFrame; -}; -//! [0] - -#endif -- cgit v0.12 From 46616a79db9ab11ce726243f12615a478a4c368a Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 16 Oct 2009 12:22:10 +1000 Subject: Implement the strength parameter for OpenVG colorize filters Task-number: QT-2016 Reviewed-by: trustme --- src/openvg/qpaintengine_vg.cpp | 3 -- src/openvg/qpixmapfilter_vg.cpp | 86 +++++++++++++++++++---------------------- src/openvg/qpixmapfilter_vg_p.h | 5 --- 3 files changed, 40 insertions(+), 54 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index e0c99d7..fdd61ea 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -3328,9 +3328,6 @@ QPixmapFilter *QVGPaintEngine::pixmapFilter(int type, const QPixmapFilter *proto d->convolutionFilter.reset(new QVGPixmapConvolutionFilter); return d->convolutionFilter.data(); case QPixmapFilter::ColorizeFilter: - // Strength parameter does not work with current implementation. - if ((static_cast(prototype))->strength() != 1.0f) - break; if (!d->colorizeFilter) d->colorizeFilter.reset(new QVGPixmapColorizeFilter); return d->colorizeFilter.data(); diff --git a/src/openvg/qpixmapfilter_vg.cpp b/src/openvg/qpixmapfilter_vg.cpp index 613f4ea..3305bbb 100644 --- a/src/openvg/qpixmapfilter_vg.cpp +++ b/src/openvg/qpixmapfilter_vg.cpp @@ -123,8 +123,7 @@ void QVGPixmapConvolutionFilter::draw } QVGPixmapColorizeFilter::QVGPixmapColorizeFilter() - : QPixmapColorizeFilter(), - firstTime(true) + : QPixmapColorizeFilter() { } @@ -136,7 +135,7 @@ void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const { if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { // The pixmap data is not an instance of QVGPixmapData, so fall - // back to the default convolution filter implementation. + // back to the default colorize filter implementation. QPixmapColorizeFilter::draw(painter, dest, src, srcRect); return; } @@ -154,50 +153,45 @@ void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const if (dstImage == VG_INVALID_HANDLE) return; - // Recompute the color matrix if the color has changed. + // Determine the weights for the matrix from the color and strength. QColor c = color(); - if (c != prevColor || firstTime) { - prevColor = c; - - // Determine the weights for the matrix from the color. - VGfloat weights[3]; - VGfloat invweights[3]; - VGfloat alpha = c.alphaF(); - weights[0] = c.redF() * alpha; - weights[1] = c.greenF() * alpha; - weights[2] = c.blueF() * alpha; - invweights[0] = 1.0f - weights[0]; - invweights[1] = 1.0f - weights[1]; - invweights[2] = 1.0f - weights[2]; - - // Grayscale weights. - static const VGfloat redGray = 11.0f / 32.0f; - static const VGfloat greenGray = 16.0f / 32.0f; - static const VGfloat blueGray = 1.0f - (redGray + greenGray); - - matrix[0][0] = redGray * invweights[0]; - matrix[0][1] = redGray * invweights[1]; - matrix[0][2] = redGray * invweights[2]; - matrix[0][3] = 0.0f; - matrix[1][0] = greenGray * invweights[0]; - matrix[1][1] = greenGray * invweights[1]; - matrix[1][2] = greenGray * invweights[2]; - matrix[1][3] = 0.0f; - matrix[2][0] = blueGray * invweights[0]; - matrix[2][1] = blueGray * invweights[1]; - matrix[2][2] = blueGray * invweights[2]; - matrix[2][3] = 0.0f; - matrix[3][0] = 0.0f; - matrix[3][1] = 0.0f; - matrix[3][2] = 0.0f; - matrix[3][3] = 1.0f; - matrix[4][0] = weights[0]; - matrix[4][1] = weights[1]; - matrix[4][2] = weights[2]; - matrix[4][3] = 0.0f; - } - - firstTime = false; + VGfloat strength = this->strength(); + VGfloat weights[3]; + VGfloat invweights[3]; + VGfloat alpha = c.alphaF(); + weights[0] = c.redF() * alpha; + weights[1] = c.greenF() * alpha; + weights[2] = c.blueF() * alpha; + invweights[0] = (1.0f - weights[0]) * strength; + invweights[1] = (1.0f - weights[1]) * strength; + invweights[2] = (1.0f - weights[2]) * strength; + + // Grayscale weights. + static const VGfloat redGray = 11.0f / 32.0f; + static const VGfloat greenGray = 16.0f / 32.0f; + static const VGfloat blueGray = 1.0f - (redGray + greenGray); + + VGfloat matrix[5][4]; + matrix[0][0] = redGray * invweights[0] + (1.0f - strength); + matrix[0][1] = redGray * invweights[1]; + matrix[0][2] = redGray * invweights[2]; + matrix[0][3] = 0.0f; + matrix[1][0] = greenGray * invweights[0]; + matrix[1][1] = greenGray * invweights[1] + (1.0f - strength); + matrix[1][2] = greenGray * invweights[2]; + matrix[1][3] = 0.0f; + matrix[2][0] = blueGray * invweights[0]; + matrix[2][1] = blueGray * invweights[1]; + matrix[2][2] = blueGray * invweights[2] + (1.0f - strength); + matrix[2][3] = 0.0f; + matrix[3][0] = 0.0f; + matrix[3][1] = 0.0f; + matrix[3][2] = 0.0f; + matrix[3][3] = 1.0f; + matrix[4][0] = weights[0] * strength; + matrix[4][1] = weights[1] * strength; + matrix[4][2] = weights[2] * strength; + matrix[4][3] = 0.0f; vgColorMatrix(dstImage, srcImage, matrix[0]); diff --git a/src/openvg/qpixmapfilter_vg_p.h b/src/openvg/qpixmapfilter_vg_p.h index 58111ec..f79b6c2 100644 --- a/src/openvg/qpixmapfilter_vg_p.h +++ b/src/openvg/qpixmapfilter_vg_p.h @@ -79,11 +79,6 @@ public: ~QVGPixmapColorizeFilter(); void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const; - -private: - mutable VGfloat matrix[5][4]; - mutable QColor prevColor; - mutable bool firstTime; }; class Q_OPENVG_EXPORT QVGPixmapDropShadowFilter : public QPixmapDropShadowFilter -- cgit v0.12 From 8ca1bd6fccb080808331f9de056d3915a60917fb Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 16 Oct 2009 12:36:19 +1000 Subject: qdoc: OpenVG supports the blur filter too --- doc/src/howtos/openvg.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/howtos/openvg.qdoc b/doc/src/howtos/openvg.qdoc index 42d2357..5de2e22 100644 --- a/doc/src/howtos/openvg.qdoc +++ b/doc/src/howtos/openvg.qdoc @@ -292,8 +292,8 @@ \section2 Pixmap filters - Convolution, colorize, and drop shadow filters are accelerated using - OpenVG operations. + Convolution, colorize, drop shadow, and blur filters are accelerated + using OpenVG operations. \section1 Known issues -- cgit v0.12 From 8e4fa6e87f74cfb3457e8270a361cf30ca7d3593 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 16 Oct 2009 14:48:59 +1000 Subject: Recognize transformed screens when looking for a QGLScreen If the QWS_DISPLAY is specified as "Transformed:powervr:...", then we will encounter QScreen::TransformedClass rather than QScreen::ProxyClass when searching for the QGLScreen. This change makes the code search for both. Task-number: QT-2261 Reviewed-by: Sarah Smith --- src/gui/egl/qegl_qws.cpp | 3 ++- src/opengl/qgl_qws.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/egl/qegl_qws.cpp b/src/gui/egl/qegl_qws.cpp index 590b666..df1179a 100644 --- a/src/gui/egl/qegl_qws.cpp +++ b/src/gui/egl/qegl_qws.cpp @@ -83,7 +83,8 @@ static QScreen *screenForDevice(QPaintDevice *device) screenNumber = 0; screen = screen->subScreens()[screenNumber]; } - while (screen->classId() == QScreen::ProxyClass) { + while (screen->classId() == QScreen::ProxyClass || + screen->classId() == QScreen::TransformedClass) { screen = static_cast(screen)->screen(); } return screen; diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp index bb23ace..5e59975 100644 --- a/src/opengl/qgl_qws.cpp +++ b/src/opengl/qgl_qws.cpp @@ -73,7 +73,8 @@ static QGLScreen *glScreenForDevice(QPaintDevice *device) screenNumber = 0; screen = screen->subScreens()[screenNumber]; } - while (screen->classId() == QScreen::ProxyClass) { + while (screen->classId() == QScreen::ProxyClass || + screen->classId() == QScreen::TransformedClass) { screen = static_cast(screen)->screen(); } if (screen->classId() == QScreen::GLClass) -- cgit v0.12 From fbe6a9aaae0c6de017af08150678bf2001284178 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 16 Oct 2009 14:48:59 +1000 Subject: Recognize transformed screens when looking for a QGLScreen If the QWS_DISPLAY is specified as "Transformed:powervr:...", then we will encounter QScreen::TransformedClass rather than QScreen::ProxyClass when searching for the QGLScreen. This change makes the code search for both. Task-number: QT-2261 Reviewed-by: Sarah Smith Back port of 8e4fa6e87f74cfb3457e8270a361cf30ca7d3593 --- src/opengl/qegl_qws.cpp | 3 ++- src/opengl/qgl_qws.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/opengl/qegl_qws.cpp b/src/opengl/qegl_qws.cpp index 8d1c8b0..f0433bb 100644 --- a/src/opengl/qegl_qws.cpp +++ b/src/opengl/qegl_qws.cpp @@ -65,7 +65,8 @@ static QGLScreen *glScreenForDevice(QPaintDevice *device) screenNumber = 0; screen = screen->subScreens()[screenNumber]; } - while (screen->classId() == QScreen::ProxyClass) { + while (screen->classId() == QScreen::ProxyClass || + screen->classId() == QScreen::TransformedClass) { screen = static_cast(screen)->screen(); } if (screen->classId() == QScreen::GLClass) diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp index 4058b66..dd578b2 100644 --- a/src/opengl/qgl_qws.cpp +++ b/src/opengl/qgl_qws.cpp @@ -72,7 +72,8 @@ static QGLScreen *glScreenForDevice(QPaintDevice *device) screenNumber = 0; screen = screen->subScreens()[screenNumber]; } - while (screen->classId() == QScreen::ProxyClass) { + while (screen->classId() == QScreen::ProxyClass || + screen->classId() == QScreen::TransformedClass) { screen = static_cast(screen)->screen(); } if (screen->classId() == QScreen::GLClass) -- cgit v0.12 From 75719e4e06882825fe056935d782b4153bf0ac5b Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 16 Oct 2009 16:45:55 +1000 Subject: Make screen rotation work properly with the PowerVR screen driver Task-number: QT-2261 Reviewed-by: Tom --- .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c | 10 ++++ .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h | 3 + .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h | 1 + .../gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c | 14 ++++- src/plugins/gfxdrivers/powervr/README | 5 ++ .../powervr/pvreglscreen/pvreglscreen.cpp | 67 +++++++++++++++++++++- .../gfxdrivers/powervr/pvreglscreen/pvreglscreen.h | 9 ++- .../powervr/pvreglscreen/pvreglwindowsurface.cpp | 54 ++++++++++++++++- .../powervr/pvreglscreen/pvreglwindowsurface.h | 8 ++- 9 files changed, 162 insertions(+), 9 deletions(-) diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c index ac9dc8d..c1b655a 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c @@ -617,6 +617,16 @@ void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect) *rect = drawable->rect; } +void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle) +{ + if (drawable->rotationAngle != angle) { + drawable->rotationAngle = angle; + + /* Force the buffers to be recreated if the rotation angle changes */ + pvrQwsInvalidateBuffers(drawable); + } +} + int pvrQwsGetStride(PvrQwsDrawable *drawable) { if (drawable->backBuffersValid) diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h index 952ff6f..b9e035f 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h @@ -126,6 +126,9 @@ void pvrQwsSetGeometry(PvrQwsDrawable *drawable, const PvrQwsRect *rect); /* Get the current geometry for a drawable */ void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect); +/* Set the rotation angle in degrees */ +void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle); + /* Get the line stride for a drawable. Returns zero if the buffers are not allocated or have been invalidated */ int pvrQwsGetStride(PvrQwsDrawable *drawable); diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h index cf80a90..dcd4e4f 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h @@ -114,6 +114,7 @@ struct _PvrQwsDrawable int isFullScreen; int strideBytes; int stridePixels; + int rotationAngle; PvrQwsSwapFunction swapFunction; void *userData; PvrQwsDrawable *nextWinId; diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c index 253f39f..28b2251 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c @@ -132,6 +132,16 @@ static WSEGLError wseglCloseDisplay(WSEGLDisplayHandle display) return WSEGL_SUCCESS; } +static WSEGLRotationAngle wseglRotationValue(int degrees) +{ + switch (degrees) { + case 90: return WSEGL_ROTATE_90; + case 180: return WSEGL_ROTATE_180; + case 270: return WSEGL_ROTATE_270; + default: return WSEGL_ROTATE_0; + } +} + /* Create the WSEGL drawable version of a native window */ static WSEGLError wseglCreateWindowDrawable (WSEGLDisplayHandle display, WSEGLConfig *config, @@ -152,7 +162,7 @@ static WSEGLError wseglCreateWindowDrawable *drawable = (WSEGLDrawableHandle)screen; if (!pvrQwsAllocBuffers(screen)) return WSEGL_OUT_OF_MEMORY; - *rotationAngle = WSEGL_ROTATE_0; + *rotationAngle = wseglRotationValue(screen->rotationAngle); return WSEGL_SUCCESS; } @@ -163,7 +173,7 @@ static WSEGLError wseglCreateWindowDrawable /* The drawable is ready to go */ *drawable = (WSEGLDrawableHandle)draw; - *rotationAngle = WSEGL_ROTATE_0; + *rotationAngle = wseglRotationValue(draw->rotationAngle); if (!pvrQwsAllocBuffers(draw)) return WSEGL_OUT_OF_MEMORY; return WSEGL_SUCCESS; diff --git a/src/plugins/gfxdrivers/powervr/README b/src/plugins/gfxdrivers/powervr/README index 4dce87f..322a6b2 100644 --- a/src/plugins/gfxdrivers/powervr/README +++ b/src/plugins/gfxdrivers/powervr/README @@ -51,6 +51,11 @@ on the device with: hellogl_es -qws +The driver also supports screen rotation if Qt is configured with the +-qt-gfx-transformed option and the QWS_DISPLAY variable is wrapped in a +"Transformed" declaration: + + Transformed:powervr:mmWidth40:mmHeight54:Rot90:0 Know Issues: * A QGLWidget may not have window decorations if it is a top-level window. diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp index 61f2225..1dec9ea 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp @@ -44,6 +44,9 @@ #include "pvrqwsdrawable_p.h" #include #include +#ifndef QT_NO_QWS_TRANSFORMED +#include +#endif #include #include #include @@ -62,6 +65,7 @@ PvrEglScreen::PvrEglScreen(int displayId) ttyfd = -1; doGraphicsMode = true; oldKdMode = KD_TEXT; + parent = 0; // Make sure that the EGL layer is initialized and the drivers loaded. EGLDisplay dpy = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); @@ -192,7 +196,7 @@ bool PvrEglScreen::hasOpenGL() QWSWindowSurface* PvrEglScreen::createSurface(QWidget *widget) const { if (qobject_cast(widget)) - return new PvrEglWindowSurface(widget, (QScreen *)this, displayId); + return new PvrEglWindowSurface(widget, (PvrEglScreen *)this, displayId); return QScreen::createSurface(widget); } @@ -206,6 +210,67 @@ QWSWindowSurface* PvrEglScreen::createSurface(const QString &key) const } //![1] +#ifndef QT_NO_QWS_TRANSFORMED + +static const QScreen *parentScreen + (const QScreen *current, const QScreen *lookingFor) +{ + if (!current) + return 0; + switch (current->classId()) { + case QScreen::ProxyClass: + case QScreen::TransformedClass: { + const QScreen *child = + static_cast(current)->screen(); + if (child == lookingFor) + return current; + else + return parentScreen(child, lookingFor); + } + // Not reached. + + case QScreen::MultiClass: { + QList screens = current->subScreens(); + foreach (QScreen *screen, screens) { + if (screen == lookingFor) + return current; + const QScreen *parent = parentScreen(screen, lookingFor); + if (parent) + return parent; + } + } + break; + + default: break; + } + return 0; +} + +int PvrEglScreen::transformation() const +{ + // We need to search for our parent screen, which is assumed to be + // "Transformed". If it isn't, then there is no transformation. + // There is no direct method to get the parent screen so we need + // to search every screen until we find ourselves. + if (!parent && qt_screen != this) + parent = parentScreen(qt_screen, this); + if (!parent) + return 0; + if (parent->classId() != QScreen::TransformedClass) + return 0; + return 90 * static_cast(parent) + ->transformation(); +} + +#else + +int PvrEglScreen::transformation() const +{ + return 0; +} + +#endif + void PvrEglScreen::sync() { // Put code here to synchronize 2D and 3D operations if necessary. diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h index 8bf42c7..5769e70 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h @@ -46,16 +46,18 @@ #include #include "pvrqwsdrawable.h" +class PvrEglScreen; + class PvrEglScreenSurfaceFunctions : public QGLScreenSurfaceFunctions { public: - PvrEglScreenSurfaceFunctions(QScreen *s, int screenNum) + PvrEglScreenSurfaceFunctions(PvrEglScreen *s, int screenNum) : screen(s), displayId(screenNum) {} bool createNativeWindow(QWidget *widget, EGLNativeWindowType *native); private: - QScreen *screen; + PvrEglScreen *screen; int displayId; }; @@ -80,6 +82,8 @@ public: QWSWindowSurface* createSurface(QWidget *widget) const; QWSWindowSurface* createSurface(const QString &key) const; + int transformation() const; + private: void sync(); void openTty(); @@ -89,6 +93,7 @@ private: int ttyfd, oldKdMode; QString ttyDevice; bool doGraphicsMode; + mutable const QScreen *parent; }; #endif diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp index 2c5ac21..4a3787f 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp @@ -46,7 +46,7 @@ #include PvrEglWindowSurface::PvrEglWindowSurface - (QWidget *widget, QScreen *screen, int screenNum) + (QWidget *widget, PvrEglScreen *screen, int screenNum) : QWSGLWindowSurface(widget) { setSurfaceFlags(QWSWindowSurface::Opaque); @@ -63,6 +63,7 @@ PvrEglWindowSurface::PvrEglWindowSurface pvrRect.y = pos.y(); pvrRect.width = size.width(); pvrRect.height = size.height(); + transformRects(&pvrRect, 1); // Try to recover a previous PvrQwsDrawable object for the widget // if there is one. This can happen when a PvrEglWindowSurface @@ -75,6 +76,7 @@ PvrEglWindowSurface::PvrEglWindowSurface pvrQwsSetGeometry(drawable, &pvrRect); else drawable = pvrQwsCreateWindow(screenNum, (long)widget, &pvrRect); + pvrQwsSetRotation(drawable, screen->transformation()); } PvrEglWindowSurface::PvrEglWindowSurface() @@ -113,7 +115,9 @@ void PvrEglWindowSurface::setGeometry(const QRect &rect) pvrRect.y = rect.y(); pvrRect.width = rect.width(); pvrRect.height = rect.height(); + transformRects(&pvrRect, 1); pvrQwsSetGeometry(drawable, &pvrRect); + pvrQwsSetRotation(drawable, screen->transformation()); } QWSGLWindowSurface::setGeometry(rect); } @@ -127,7 +131,9 @@ bool PvrEglWindowSurface::move(const QPoint &offset) pvrRect.y = rect.y(); pvrRect.width = rect.width(); pvrRect.height = rect.height(); + transformRects(&pvrRect, 1); pvrQwsSetGeometry(drawable, &pvrRect); + pvrQwsSetRotation(drawable, screen->transformation()); } return QWSGLWindowSurface::move(offset); } @@ -200,7 +206,9 @@ void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id) pvrRect.y = rect.y(); pvrRect.width = rect.width(); pvrRect.height = rect.height(); + transformRects(&pvrRect, 1); pvrQwsSetVisibleRegion(drawable, &pvrRect, 1); + pvrQwsSetRotation(drawable, screen->transformation()); if (!pvrQwsSwapBuffers(drawable, 1)) screen->solidFill(QColor(0, 0, 0), region); } else { @@ -213,9 +221,53 @@ void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id) pvrRects[index].width = rect.width(); pvrRects[index].height = rect.height(); } + transformRects(pvrRects, rects.size()); pvrQwsSetVisibleRegion(drawable, pvrRects, rects.size()); + pvrQwsSetRotation(drawable, screen->transformation()); if (!pvrQwsSwapBuffers(drawable, 1)) screen->solidFill(QColor(0, 0, 0), region); delete [] pvrRects; } } + +void PvrEglWindowSurface::transformRects(PvrQwsRect *rects, int count) const +{ + switch (screen->transformation()) { + case 0: break; + + case 90: + { + for (int index = 0; index < count; ++index) { + int x = rects[index].y; + int y = screen->height() - (rects[index].x + rects[index].width); + rects[index].x = x; + rects[index].y = y; + qSwap(rects[index].width, rects[index].height); + } + } + break; + + case 180: + { + for (int index = 0; index < count; ++index) { + int x = screen->width() - (rects[index].x + rects[index].width); + int y = screen->height() - (rects[index].y + rects[index].height); + rects[index].x = x; + rects[index].y = y; + } + } + break; + + case 270: + { + for (int index = 0; index < count; ++index) { + int x = screen->width() - (rects[index].y + rects[index].height); + int y = rects[index].x; + rects[index].x = x; + rects[index].y = y; + qSwap(rects[index].width, rects[index].height); + } + } + break; + } +} diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h index 58a5fb2..b0a161c 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h @@ -45,12 +45,12 @@ #include #include "pvrqwsdrawable.h" -class QScreen; +class PvrEglScreen; class PvrEglWindowSurface : public QWSGLWindowSurface { public: - PvrEglWindowSurface(QWidget *widget, QScreen *screen, int screenNum); + PvrEglWindowSurface(QWidget *widget, PvrEglScreen *screen, int screenNum); PvrEglWindowSurface(); ~PvrEglWindowSurface(); @@ -76,8 +76,10 @@ public: private: QWidget *widget; PvrQwsDrawable *drawable; - QScreen *screen; + PvrEglScreen *screen; QPaintDevice *pdevice; + + void transformRects(PvrQwsRect *rects, int count) const; }; #endif -- cgit v0.12 From 43b39e75e88f7765f5203019a8e371677d69abf1 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 16 Oct 2009 10:10:03 +0300 Subject: Corrected QT_BUILD_PARTS handling for Symbian in projects.pro. Changed QT_BUILD_PARTS to be set in projects.pro only when it's empty also in Symbian, since configure now correctly sets it in .qmake.cache. Task-number: QT-1018 Reviewed-by: Janne Koskinen --- projects.pro | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/projects.pro b/projects.pro index 2a6a956..aa1eb71 100644 --- a/projects.pro +++ b/projects.pro @@ -8,7 +8,11 @@ TEMPLATE = subdirs cross_compile: CONFIG += nostrip isEmpty(QT_BUILD_PARTS) { #defaults - QT_BUILD_PARTS = libs tools examples demos docs translations + symbian { + QT_BUILD_PARTS = libs tools examples demos + } else { + QT_BUILD_PARTS = libs tools examples demos docs translations + } } else { #make sure the order makes sense contains(QT_BUILD_PARTS, translations) { QT_BUILD_PARTS -= translations @@ -28,10 +32,6 @@ isEmpty(QT_BUILD_PARTS) { #defaults } } -symbian { - QT_BUILD_PARTS = libs tools examples demos -} - #process the projects for(PROJECT, $$list($$lower($$unique(QT_BUILD_PARTS)))) { isEqual(PROJECT, tools) { -- cgit v0.12 From 0175a0c4a5aff3294891cdbed95a06fa9a658417 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 16 Oct 2009 11:28:14 +0300 Subject: Fixed uitools.prf to include QtUiTools.lib statically in Symbian Using just -lQtUiTools instead of -lQtUiTools.lib will make qmake attempt to autodetect whether or not the lib is static or dynamic, which will not work since QtUiTools is not necessarily yet built. Task-number: QT-1018 Reviewed-by: Janne Koskinen --- mkspecs/features/uitools.prf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/uitools.prf b/mkspecs/features/uitools.prf index 6eba066..2d14b04 100644 --- a/mkspecs/features/uitools.prf +++ b/mkspecs/features/uitools.prf @@ -2,7 +2,9 @@ QT += xml qt:load(qt) # Include the correct version of the UiLoader library -QTUITOOLS_LINKAGE = -lQtUiTools +symbian: QTUITOOLS_LINKAGE = -lQtUiTools.lib +else: QTUITOOLS_LINKAGE = -lQtUiTools + CONFIG(debug, debug|release) { mac: QTUITOOLS_LINKAGE = -lQtUiTools_debug win32: QTUITOOLS_LINKAGE = -lQtUiToolsd -- cgit v0.12 From 13987aea1672149ff2ebcfde33cc611db7548923 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Fri, 16 Oct 2009 10:46:11 +0200 Subject: Networking documentation: Small improvement Task-number: 262144 Reviewed-by: TrustMe --- src/network/access/qnetworkaccessmanager.cpp | 3 ++- src/network/access/qnetworkreply.cpp | 3 ++- src/network/access/qnetworkrequest.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 439d564..b1160aa 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -95,9 +95,10 @@ static void ensureInitialized() /*! \class QNetworkAccessManager \brief The QNetworkAccessManager class allows the application to - post network requests and receive replies + send network requests and receive replies \since 4.4 + \ingroup network \inmodule QtNetwork \reentrant diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index 4eb53bf..9ab4057 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -59,9 +59,10 @@ QNetworkReplyPrivate::QNetworkReplyPrivate() \class QNetworkReply \since 4.4 \brief The QNetworkReply class contains the data and headers for a request - posted with QNetworkAccessManager + sent with QNetworkAccessManager \reentrant + \ingroup network \inmodule QtNetwork The QNetworkReply class contains the data and meta data related to diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 33bc57b..86195c6 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE /*! \class QNetworkRequest - \brief The QNetworkRequest class holds one request to be sent with the Network Access API. + \brief The QNetworkRequest class holds a request to be sent with QNetworkAccessManager. \since 4.4 \ingroup network -- cgit v0.12 From 93c7ab5a2b10481e4f10a6477379d8157ae5f7b0 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 16 Oct 2009 10:47:58 +0200 Subject: doc: Fixed the wording in some \brief commands. --- src/gui/s60framework/qs60mainappui.cpp | 2 +- src/gui/s60framework/qs60maindocument.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index 611ca59..e630253 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE /*! \class QS60MainAppUi \since 4.6 - \brief Helper class for S60 migration + \brief The QS60MainAppUi class is a helper class for S60 migration. \warning This class is provided only to get access to S60 specific functionality in the application framework classes. It is not diff --git a/src/gui/s60framework/qs60maindocument.cpp b/src/gui/s60framework/qs60maindocument.cpp index 54df17e..7405784 100644 --- a/src/gui/s60framework/qs60maindocument.cpp +++ b/src/gui/s60framework/qs60maindocument.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE /*! \class QS60MainDocument \since 4.6 - \brief Helper class for S60 migration + \brief The QS60MainDocument class is a helper class for S60 migration. \warning This class is provided only to get access to S60 specific functionality in the application framework classes. It is not -- cgit v0.12 From e7a92a1b9ff31cf036982bee1221d7e7cb3aea6a Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 15 Oct 2009 16:35:45 +0200 Subject: QNetworkProxyFactory: Never return empty list on windows Task-number: Salesforce 00062670 Reviewed-by: Thiago --- src/network/kernel/qnetworkproxy_win.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index f0fff2f..2100215 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -398,7 +398,12 @@ QList QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro if (isBypassed(query.peerHostName(), sp->proxyBypass)) return sp->defaultResult; - return parseServerList(query, sp->proxyServerList); + QList result = parseServerList(query, sp->proxyServerList); + // In some cases, this was empty. See SF task 00062670 + if (result.isEmpty()) + return sp->defaultResult; + + return result; } #else // !UNICODE -- cgit v0.12 From 2e1811d128c29b4e9fb01790d5a1f7a01b8f395c Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 16 Oct 2009 11:56:09 +0200 Subject: Fixed `-debug' option to cetest deploying release DLLs. cetest was processing .pro files without build_pass set. That's wrong, as it means the qmake logic is set up for generating the debug-and-release glue project instead of the real project. Until commit 75b41faff44a1488d88eca6e910d4b617cb42221, it didn't matter. After that commit, cetest would always try to deploy release versions of Qt DLLs even when run with `-debug'. Reviewed-by: joerg --- tools/qtestlib/wince/cetest/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/qtestlib/wince/cetest/main.cpp b/tools/qtestlib/wince/cetest/main.cpp index 9df70e7..e00c0e7 100644 --- a/tools/qtestlib/wince/cetest/main.cpp +++ b/tools/qtestlib/wince/cetest/main.cpp @@ -237,6 +237,8 @@ int main(int argc, char **argv) debugOutput(QString::fromLatin1("Using Project File:").append(proFile),1); } + Option::before_user_vars.append("CONFIG+=build_pass"); + // read target and deployment rules int qmakeArgc = 1; char* qmakeArgv[] = { "qmake.exe" }; -- cgit v0.12 From 8172a2cfcdb5508196ca2c7c56ab79890fc50a13 Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 16 Oct 2009 11:55:10 +0200 Subject: Removed unnecessary include from a public header file. Task: QT-2265 RevBy: Janne Anttila Compiles on all three Symbian compilers. Strictly speaking GCCE wasn't able to link QtGui, but that seemed to be unrelated to this change. --- src/corelib/global/qnamespace.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index ad4bc55..f28f94e 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -44,10 +44,6 @@ #include -#ifdef Q_OS_SYMBIAN -# include -#endif - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -- cgit v0.12 From d186d527cd43df3aa453c9ad3ab7507d7f37f790 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 16 Oct 2009 12:58:04 +0200 Subject: build: Removed alternative definition for ADP_DOCS_QDOCCONF_FILE It used a qdocconf file that no longer exists; something for xcode. --- doc/doc.pri | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/doc/doc.pri b/doc/doc.pri index 9105fbb..d4fdcd8 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -19,11 +19,7 @@ $$unixstyle { QDOC = cd $$QT_SOURCE_TREE/tools/qdoc3/test && set QT_BUILD_TREE=$$QT_BUILD_TREE&& set QT_SOURCE_TREE=$$QT_SOURCE_TREE&& $$QT_BUILD_TREE/bin/qdoc3.exe $$DOCS_GENERATION_DEFINES QDOC = $$replace(QDOC, "/", "\\") } -macx { - ADP_DOCS_QDOCCONF_FILE = qt-build-docs-with-xcode.qdocconf -} else { - ADP_DOCS_QDOCCONF_FILE = qt-build-docs.qdocconf -} +ADP_DOCS_QDOCCONF_FILE = qt-build-docs.qdocconf QT_DOCUMENTATION = ($$QDOC qt-api-only.qdocconf assistant.qdocconf designer.qdocconf \ linguist.qdocconf qmake.qdocconf) && \ (cd $$QT_BUILD_TREE && \ -- cgit v0.12 From 2849e21a59a93714defc023a09b185f93cf1e712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 16 Oct 2009 13:04:13 +0200 Subject: Fixed a crash in the tst_qgl test. QGLFramebuffer::isBound() would crash if it was called when there wasn't a current context bound. Reviewed-by: Kim --- src/opengl/qglframebufferobject.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 9674cfb..4fb8629 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -1204,7 +1204,8 @@ QGLFramebufferObject::Attachment QGLFramebufferObject::attachment() const bool QGLFramebufferObject::isBound() const { Q_D(const QGLFramebufferObject); - return QGLContext::currentContext()->d_ptr->current_fbo == d->fbo(); + const QGLContext *current = QGLContext::currentContext(); + return current ? current->d_ptr->current_fbo == d->fbo() : false; } /*! -- cgit v0.12 From bfa428f7d32b2fa56a6839200cd9b301fd97e217 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 16 Oct 2009 13:41:22 +0200 Subject: doc: Corrected typo. --- src/gui/graphicsview/qgraphicsscene.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 0773559..a624b10 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5297,7 +5297,7 @@ void QGraphicsScene::setActivePanel(QGraphicsItem *item) /*! \since 4.4 - Returns the current active window, or 0 if there is no window is currently + Returns the current active window, or 0 if no window is currently active. \sa QGraphicsScene::setActiveWindow() -- cgit v0.12 From 0f8bff1970d4b0f10e98ce7d6ab341620f4ce76b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 16 Oct 2009 14:30:39 +0200 Subject: doc: Changed Trolltech to Nokia --- src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index b06b93a..41067f1 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -137,7 +137,7 @@ void QWebViewPrivate::_q_pageDestroyed() It can be used in various applications to display web content live from the Internet. - The image below shows QWebView previewed in \QD with the Trolltech website. + The image below shows QWebView previewed in \QD with a Nokia website. \image qwebview-url.png -- cgit v0.12 From 25f4ccc3a9de2e4610974540f88c331238218c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Fri, 16 Oct 2009 15:45:18 +0300 Subject: Softkeys remain disabled if action owning action widget is enabled Softkeys have a QAction that is related to some action widget. The initial state of the action was set according the state of action widget (enabled/disabled). Now, if action widget's state changes, the softkey's action remain in the initial state. This was fixed by removing the enable/disable from the QAction and instead use the real state of action widget when handling the command of softkey. Task-number: QTBUG-4619 Reviewed-by: Janne Anttila --- src/gui/dialogs/qerrormessage.cpp | 13 +++++++------ src/gui/dialogs/qprogressdialog.cpp | 2 +- src/gui/dialogs/qwizard.cpp | 2 +- src/gui/kernel/qsoftkeymanager.cpp | 6 +++--- src/gui/widgets/qdialogbuttonbox.cpp | 3 +-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/gui/dialogs/qerrormessage.cpp b/src/gui/dialogs/qerrormessage.cpp index 436ef94..762936a 100644 --- a/src/gui/dialogs/qerrormessage.cpp +++ b/src/gui/dialogs/qerrormessage.cpp @@ -245,12 +245,6 @@ QErrorMessage::QErrorMessage(QWidget * parent) Q_D(QErrorMessage); QGridLayout * grid = new QGridLayout(this); d->icon = new QLabel(this); -#ifdef QT_SOFTKEYS_ENABLED - d->okAction = new QAction(this); - d->okAction->setSoftKeyRole(QAction::PositiveSoftKey); - connect(d->okAction, SIGNAL(triggered()), this, SLOT(accept())); - addAction(d->okAction); -#endif #ifndef QT_NO_MESSAGEBOX d->icon->setPixmap(QMessageBox::standardIcon(QMessageBox::Information)); d->icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop); @@ -262,6 +256,13 @@ QErrorMessage::QErrorMessage(QWidget * parent) d->again->setChecked(true); grid->addWidget(d->again, 1, 1, Qt::AlignTop); d->ok = new QPushButton(this); +#ifdef QT_SOFTKEYS_ENABLED + d->okAction = new QAction(d->ok); + d->okAction->setSoftKeyRole(QAction::PositiveSoftKey); + connect(d->okAction, SIGNAL(triggered()), this, SLOT(accept())); + addAction(d->okAction); +#endif + #if defined(Q_WS_WINCE) || defined(Q_WS_S60) d->ok->setFixedSize(0,0); diff --git a/src/gui/dialogs/qprogressdialog.cpp b/src/gui/dialogs/qprogressdialog.cpp index 5fb10bf..f5024bb 100644 --- a/src/gui/dialogs/qprogressdialog.cpp +++ b/src/gui/dialogs/qprogressdialog.cpp @@ -453,7 +453,7 @@ void QProgressDialog::setCancelButton(QPushButton *cancelButton) cancelButton->show(); #else { - d->cancelAction = new QAction(cancelButton->text(), this); + d->cancelAction = new QAction(cancelButton->text(), cancelButton); d->cancelAction->setSoftKeyRole(QAction::NegativeSoftKey); connect(d->cancelAction, SIGNAL(triggered()), this, SIGNAL(canceled())); addAction(d->cancelAction); diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp index 0f6d353..0102e25 100644 --- a/src/gui/dialogs/qwizard.cpp +++ b/src/gui/dialogs/qwizard.cpp @@ -1340,7 +1340,7 @@ bool QWizardPrivate::ensureButton(QWizard::WizardButton which) const pushButton->setText(buttonDefaultText(wizStyle, which, this)); #ifdef QT_SOFTKEYS_ENABLED - QAction *softKey = new QAction(pushButton->text(), antiFlickerWidget); + QAction *softKey = new QAction(pushButton->text(), pushButton); QAction::SoftKeyRole softKeyRole; switch(which) { case QWizard::NextButton: diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 1214f08..6116a5e 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -125,7 +125,6 @@ QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *act break; } action->setSoftKeyRole(softKeyRole); - action->setEnabled(actionWidget->isEnabled()); return action; } @@ -210,7 +209,7 @@ void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList &softkeys) for (int index = 0; index < softkeys.count(); index++) { const QAction* softKeyAction = softkeys.at(index); switch (softKeyAction->softKeyRole()) { - // Positive Actions go on LSK + // Positive Actions on the LSK case QAction::PositiveSoftKey: position = 0; break; @@ -253,7 +252,8 @@ bool QSoftKeyManager::handleCommand(int command) QAction *action = softKeys.at(i); if (action->softKeyRole() != QAction::NoSoftKey) { if (j == index) { - if (action->isEnabled()) { + QWidget *parent = action->parentWidget(); + if (parent && parent->isEnabled()) { action->activate(QAction::Trigger); return true; } diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp index 280ca63..10f8db8 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/gui/widgets/qdialogbuttonbox.cpp @@ -560,7 +560,7 @@ QAction* QDialogButtonBoxPrivate::createSoftKey(QAbstractButton *button, QDialog Q_Q(QDialogButtonBox); QAction::SoftKeyRole softkeyRole; - QAction *action = new QAction(button->text(), q); + QAction *action = new QAction(button->text(), button); switch (role) { case ApplyRole: @@ -581,7 +581,6 @@ QAction* QDialogButtonBoxPrivate::createSoftKey(QAbstractButton *button, QDialog } QObject::connect(action, SIGNAL(triggered()), button, SIGNAL(clicked())); action->setSoftKeyRole(softkeyRole); - action->setEnabled(button->isEnabled()); return action; } #endif -- cgit v0.12 From 06d1c12c24c38b0cd8822b1faf2694c7331f75cb Mon Sep 17 00:00:00 2001 From: Liang QI Date: Fri, 16 Oct 2009 16:20:31 +0200 Subject: Fix tst_QMenu on Symbian. For tst_QMenu::activeSubMenuPosition, QS60Style::pixelMetric(QStyle::PM_SubMenuOverlap) is different with other styles. For tst_QMenu::menuSizeHint, Softkey actions are not widgets and have no geometry. For tst_QMenu::task258920_mouseBorder, QS60Style::styleHint(QStyle::SH_Menu_MouseTracking) is false. RevBy: Shane Kearns RevBy: axis --- tests/auto/qmenu/tst_qmenu.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 4eb149f..f12fa92 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -675,7 +675,13 @@ void tst_QMenu::activeSubMenuPosition() #ifdef Q_OS_WINCE_WM QSKIP("Not true for Windows Mobile Soft Keys", SkipSingle); #endif + +#ifdef Q_OS_SYMBIAN + // On Symbian, QS60Style::pixelMetric(QStyle::PM_SubMenuOverlap) is different with other styles. + QVERIFY(sub->pos().x() < main->pos().x()); +#else QVERIFY(sub->pos().x() > main->pos().x()); +#endif QCOMPARE(sub->activeAction(), subAction); } @@ -778,6 +784,11 @@ void tst_QMenu::menuSizeHint() int maxWidth =0; QRect result; foreach(QAction *action, menu.actions()) { +#ifdef QT_SOFTKEYS_ENABLED + // Softkey actions are not widgets and have no geometry. + if (menu.actionGeometry(action).topLeft() == QPoint(0,0)) + continue; +#endif maxWidth = qMax(maxWidth, menu.actionGeometry(action).width()); result |= menu.actionGeometry(action); QCOMPARE(result.x(), left + hmargin + panelWidth); @@ -816,6 +827,9 @@ void tst_QMenu::task258920_mouseBorder() QSKIP("Mouse move related signals for Windows Mobile unavailable", SkipAll); #endif Menu258920 menu; + // On Symbian, styleHint(QStyle::SH_Menu_MouseTracking) in QS60Style is false. + // For other styles which inherit from QWindowsStyle, the value is true. + menu.setMouseTracking(true); QAction *action = menu.addAction("test"); menu.popup(QApplication::desktop()->availableGeometry().center()); -- cgit v0.12 From 0dd237d05a865c51ad59f4e9f61b194659e32814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 16 Oct 2009 16:29:11 +0200 Subject: Fixed a crash in tst_qpainter on SPARC w/gcc. This test works with the native Sun compiler for some reason, and the problem is an unaligned read of 16 bits, which is a problem on several other architectures. Reviewed-by: Kim --- src/gui/painting/qblendfunctions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index 89adaf5..f8dd424 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -374,9 +374,9 @@ template void qt_blend_argb24_on_rgb16(uchar *destPixels, int dbpl, const uchar *src = srcPixels + y * sbpl; const uchar *srcEnd = src + srcOffset; while (src < srcEnd) { -#if defined(QT_ARCH_ARM) || defined(QT_ARCH_POWERPC) || defined(QT_ARCH_SH) || defined(QT_ARCH_AVR32) || (defined(QT_ARCH_WINDOWSCE) && !defined(_X86_)) +#if defined(QT_ARCH_ARM) || defined(QT_ARCH_POWERPC) || defined(QT_ARCH_SH) || defined(QT_ARCH_AVR32) || (defined(QT_ARCH_WINDOWSCE) && !defined(_X86_)) || (defined(QT_ARCH_SPARC) && defined(Q_CC_GNU)) // non-16-bit aligned memory access is not possible on PowerPC, - // ARM Date: Fri, 16 Oct 2009 15:49:18 +0300 Subject: Refactored SymbianSubdirsMetaMakefileGenerator out of qmake. There was no need to have SymbianSubdirsMetaMakefileGenerator in cross-platform metamakefile.cpp, so moved the Symbian specific functionality to symmake.cpp as suggested by qmake reviewers. Task-number: QT-822 Reviewed-by: Janne Anttila --- qmake/generators/metamakefile.cpp | 268 +---------------------------------- qmake/generators/symbian/symmake.cpp | 100 ++++++------- qmake/project.cpp | 47 +++--- 3 files changed, 69 insertions(+), 346 deletions(-) diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 69dd627..5915fcf 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -419,269 +419,6 @@ SubdirsMetaMakefileGenerator::~SubdirsMetaMakefileGenerator() subs.clear(); } -class SymbianSubdirsMetaMakefileGenerator : public SubdirsMetaMakefileGenerator -{ -public: - SymbianSubdirsMetaMakefileGenerator(QMakeProject *p, const QString &n, bool op) : SubdirsMetaMakefileGenerator(p, n, op) { } - virtual ~SymbianSubdirsMetaMakefileGenerator(); - - virtual bool init(); - virtual bool write(const QString &); - -protected: - - static QMap mmpPaths; - - static QMultiMap mmpDependency; - - static QStringList getDependencyList(QString mmpFilename, int recursionDepth); - - static QStringList calculateRelativePaths(QString mmpParent, QStringList mmpChildren); - -private: - QString cleanFromSpecialCharacters(QString& str); -}; - -QMap SymbianSubdirsMetaMakefileGenerator::mmpPaths; - -QMultiMap SymbianSubdirsMetaMakefileGenerator::mmpDependency; - -QStringList SymbianSubdirsMetaMakefileGenerator::getDependencyList(QString mmpFilename, int recursionDepth) -{ - QStringList list; - - QList values = mmpDependency.values(mmpFilename); - if (recursionDepth < 0) { - // special case; just first dependency level - list = values; - return list; - } - if (values.size() == 0) { - //reached recursion END condition - if (recursionDepth == 0) { - --recursionDepth; - return list; // empty list // no dependencies / return - } else { - list.append(mmpFilename); - recursionDepth--; - return list; // leaf // return - } - } else { - recursionDepth++; - for (int i = 0; i < values.size(); ++i) { - QString current = values.at(i); - QStringList tailList = getDependencyList(current, recursionDepth); - for (int j = 0; j < tailList.size(); ++j) { - QString path = tailList.at(j); - list.append(path); - } - } - - if (recursionDepth > 0) { - //for mmp somewhere in middle - list.append(mmpFilename); - } - recursionDepth--; - return list; - } -} - -SymbianSubdirsMetaMakefileGenerator::~SymbianSubdirsMetaMakefileGenerator() { } - -bool SymbianSubdirsMetaMakefileGenerator::write(const QString &oldpwd) -{ - return SubdirsMetaMakefileGenerator::write(oldpwd); -} - -QString SymbianSubdirsMetaMakefileGenerator::cleanFromSpecialCharacters(QString& str) -{ - QString tmp = str; - - tmp.replace(QString("/"), QString("_")); - tmp.replace(QString("\\"), QString("_")); - tmp.replace(QString("-"), QString("_")); - tmp.replace(QString(":"), QString("_")); - tmp.replace(QString("."), QString("_")); - - return tmp; -} - -bool SymbianSubdirsMetaMakefileGenerator::init() -{ - if (init_flag) - return false; - - init_flag = true; - - // If we are here then we have template == subdirs - - Option::recursive = true; - - if (Option::recursive) { - QString old_output_dir = QDir::cleanPath(Option::output_dir); - if (!old_output_dir.endsWith('/')) - old_output_dir += '/'; - QString old_output = Option::output.fileName(); - QString oldpwd = QDir::cleanPath(qmake_getpwd()); - - if (!oldpwd.endsWith('/')) - oldpwd += '/'; - - // find the parent mmp filename - int end = oldpwd.size() - 1; - int start = oldpwd.lastIndexOf("/", end - 2); - QString parentMmpFilename = oldpwd.mid(start + 1, end - start - 1); - parentMmpFilename.prepend(oldpwd); - parentMmpFilename = parentMmpFilename.append(Option::mmp_ext); - - - const QStringList &subdirs = project->values("SUBDIRS"); - static int recurseDepth = -1; - ++recurseDepth; - for (int i = 0; i < subdirs.size(); ++i) { - Subdir *sub = new Subdir; - sub->indent = recurseDepth; - - QFileInfo subdir(subdirs.at(i)); - // childMmpFielname should be derived from subdirName - QString subdirName = subdirs.at(i); - if (!project->isEmpty(subdirs.at(i) + ".file")) - subdir = project->first(subdirs.at(i) + ".file"); - else if (!project->isEmpty(subdirs.at(i) + ".subdir")) - subdir = project->first(subdirs.at(i) + ".subdir"); - QString sub_name; - - QString childMmpFilename; - - if (subdir.isDir()) { - subdir = QFileInfo(subdir.filePath() + "/" + subdir.fileName() + Option::pro_ext); - childMmpFilename = subdir.fileName(); - childMmpFilename = subdir.absoluteFilePath(); - childMmpFilename.replace(Option::pro_ext, QString("")); - childMmpFilename.append(Option::mmp_ext); - } else { - childMmpFilename = subdir.absoluteFilePath(); - childMmpFilename.replace(Option::pro_ext, Option::mmp_ext); - sub_name = childMmpFilename; - sub_name.replace(Option::mmp_ext, QString("")); - sub_name.replace(0, sub_name.lastIndexOf("/") + 1, QString("")); - project->values("SHADOW_BLD_INFS").append(QString("bld.inf.") + sub_name); - } - - //handle sub project - QMakeProject *sub_proj = new QMakeProject(project->properties()); - for (int ind = 0; ind < sub->indent; ++ind) - printf(" "); - sub->input_dir = subdir.absolutePath(); - if (subdir.isRelative() && old_output_dir != oldpwd) { - sub->output_dir = old_output_dir + "/" + subdir.path(); - printf("Reading %s [%s]\n", subdir.absoluteFilePath().toLatin1().constData(), sub->output_dir.toLatin1().constData()); - } else { - sub->output_dir = sub->input_dir; - printf("Reading %s\n", subdir.absoluteFilePath().toLatin1().constData()); - } - - // find the child mmp filename - qmake_setpwd(sub->input_dir); - - QString newpwd = qmake_getpwd(); - - Option::output_dir = sub->output_dir; - if (Option::output_dir.at(Option::output_dir.length() - 1) != QLatin1Char('/')) - Option::output_dir += QLatin1Char('/'); - sub_proj->read(subdir.fileName()); - if (!sub_proj->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { - fprintf(stderr, "Project file(%s) not recursed because all requirements not met:\n\t%s\n", - subdir.fileName().toLatin1().constData(), - sub_proj->values("QMAKE_FAILED_REQUIREMENTS").join(" ").toLatin1().constData()); - delete sub; - delete sub_proj; - //continue; - } else { - // map mmpfile to its absolut filepath - mmpPaths.insert(childMmpFilename, newpwd); - - // update mmp files dependency map - mmpDependency.insert(parentMmpFilename, childMmpFilename); - - sub->makefile = MetaMakefileGenerator::createMetaGenerator(sub_proj, sub_name); - if (0 && sub->makefile->type() == SUBDIRSMETATYPE) { - subs.append(sub); - } else { - const QString output_name = Option::output.fileName(); - Option::output.setFileName(sub->output_file); - sub->makefile->write(sub->output_dir); - delete sub; - qmakeClearCaches(); - sub = 0; - Option::output.setFileName(output_name); - } - } - - Option::output_dir = old_output_dir; - qmake_setpwd(oldpwd); - - } - --recurseDepth; - Option::output.setFileName(old_output); - Option::output_dir = old_output_dir; - qmake_setpwd(oldpwd); - } - - Subdir *self = new Subdir; - self->input_dir = qmake_getpwd(); - - // To fully expand find all dependencies: - // Do as recursion, then insert result as subdirs data in project - QString newpwd = qmake_getpwd(); - if (!newpwd.endsWith('/')) - newpwd += '/'; - int end = newpwd.size() - 1; - int start = newpwd.lastIndexOf("/", end - 2); - QString mmpFilename = newpwd.mid(start + 1, end - start - 1); - mmpFilename.prepend(newpwd); - mmpFilename = mmpFilename.append(Option::mmp_ext); - - // map mmpfile to its absolute filepath - mmpPaths.insert(mmpFilename, newpwd); - - QStringList directDependencyList = getDependencyList(mmpFilename, -1); - for (int i = 0; i < directDependencyList.size(); ++i) { - project->values("MMPFILES_DIRECT_DEPENDS").append(directDependencyList.at(i)); - } - - QStringList dependencyList = getDependencyList(mmpFilename, 0); - - self->output_dir = Option::output_dir; - if (!Option::recursive || (!Option::output.fileName().endsWith(Option::dir_sep) && !QFileInfo(Option::output).isDir())) - self->output_file = Option::output.fileName(); - self->makefile = new BuildsMetaMakefileGenerator(project, name, false); - self->makefile->init(); - subs.append(self); - - return true; -} - -QStringList SymbianSubdirsMetaMakefileGenerator::calculateRelativePaths(QString mmpParent, QStringList mmpChildren) -{ - QStringList mmpRelativePaths; - QString parentDir = mmpPaths.value(mmpParent); - QDir directory(parentDir); - for (int i = 0; i < mmpChildren.size(); ++i) { - QString childDir = mmpPaths.value(mmpChildren.at(i)); - if (mmpChildren.at(i) == mmpParent) - mmpRelativePaths.append(mmpChildren.at(i)); - else { - QString relativePath = directory.relativeFilePath(childDir); - if (relativePath.startsWith("..")) - mmpRelativePaths.append(childDir); - else - directory.relativeFilePath(relativePath); - } - } - return mmpRelativePaths; -} - //Factory things QT_BEGIN_INCLUDE_NAMESPACE #include "unixmake.h" @@ -750,10 +487,7 @@ MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &na MetaMakefileGenerator *ret = 0; if ((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || Option::qmake_mode == Option::QMAKE_GENERATE_PRL)) { - if (proj->first("MAKEFILE_GENERATOR").startsWith("SYMBIAN") && proj->values("TEMPLATE").contains("subdirs")) { - // new metamakefilegenerator type to support subdirs for symbian related projects - ret = new SymbianSubdirsMetaMakefileGenerator(proj, name, op); - } else if (proj->first("TEMPLATE").endsWith("subdirs")) + if (proj->first("TEMPLATE").endsWith("subdirs")) ret = new SubdirsMetaMakefileGenerator(proj, name, op); } if (!ret) diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 3d24053..19af1da 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -1092,6 +1092,7 @@ void SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension) { // Read user defined bld inf rules + QMap userBldInfRules; for (QMap::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { if (it.key().startsWith(BLD_INF_RULES_BASE)) { @@ -1122,58 +1123,44 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy QString mmpfilename = escapeFilePath(fileFixify(project->projectFile())); mmpfilename = mmpfilename.replace(mmpfilename.lastIndexOf("."), 4, Option::mmp_ext); QString currentPath = qmake_getpwd(); + QDir directory(currentPath); - if (!currentPath.endsWith(QString("/"))) - currentPath.append("/"); - - QStringList mmpProjects = project->values("MMPFILES_DIRECT_DEPENDS"); - QStringList shadowProjects = project->values("SHADOW_BLD_INFS"); - - removeDuplicatedStrings(mmpProjects); - removeDuplicatedStrings(shadowProjects); + const QStringList &subdirs = project->values("SUBDIRS"); + foreach(QString item, subdirs) { + QString fixedItem; + if (!project->isEmpty(item + ".file")) { + fixedItem = project->first(item + ".file"); + } else if (!project->isEmpty(item + ".subdir")) { + fixedItem = project->first(item + ".subdir"); + } else { + fixedItem = item; + } - // Go in reverse order as that is the way how we build the list - QListIterator iT(mmpProjects); - iT.toBack(); - while (iT.hasPrevious()) { - QString fullMmpName = iT.previous(); - QString relativePath; + QFileInfo subdir(fileInfo(fixedItem)); + QString relativePath = directory.relativeFilePath(fixedItem); + QString subdirFileName = subdir.completeBaseName(); + QString fullProName = subdir.absoluteFilePath();; QString bldinfFilename; - QString fullProFilename = fullMmpName; - fullProFilename.replace(Option::mmp_ext, Option::pro_ext); - QString uid = generate_uid(fullProFilename); - - QString cleanMmpName = fullProFilename; - cleanMmpName.replace(Option::pro_ext, QString("")); - cleanMmpName.replace(0, cleanMmpName.lastIndexOf("/") + 1, QString("")); - - if (shadowProjects.contains(BLD_INF_FILENAME "." + cleanMmpName)) { // shadow project - QDir directory(currentPath); - relativePath = directory.relativeFilePath(fullProFilename); - bldinfFilename = BLD_INF_FILENAME "." + cleanMmpName; + if (subdir.isDir()) { + // Subdir is a regular project + bldinfFilename = relativePath + QString("/") + QString(BLD_INF_FILENAME); + fullProName += QString("/") + subdirFileName + Option::pro_ext; + } else { + // Subdir is actually a .pro file if (relativePath.contains("/")) { - // Shadow .pro not in same directory as parent .pro - if (relativePath.startsWith("..")) { - // Shadow .pro out of parent .pro - relativePath.replace(relativePath.lastIndexOf("/"), relativePath.length(), QString("")); - bldinfFilename.prepend("/").prepend(relativePath); - } else { - relativePath.replace(relativePath.lastIndexOf("/"), relativePath.length(), QString("")); - bldinfFilename.prepend("/").prepend(relativePath); - } + // .pro not in same directory as parent .pro + relativePath.remove(relativePath.lastIndexOf("/") + 1, relativePath.length()); + bldinfFilename = relativePath; } else { - // Shadow .pro and parent .pro in same directory - bldinfFilename.prepend("./"); + // .pro and parent .pro in same directory + bldinfFilename = QString("./"); } - } else { // regular project - QDir directory(currentPath); - relativePath = directory.relativeFilePath(fullProFilename); - relativePath.replace(relativePath.lastIndexOf("/"), relativePath.length(), QString("")); - bldinfFilename = relativePath.append("/").append(BLD_INF_FILENAME); + bldinfFilename += QString(BLD_INF_FILENAME ".") + subdirFileName; } - QString bldinfDefine = QString("BLD_INF_") + cleanMmpName + QString("_") + uid; + QString uid = generate_uid(fullProName); + QString bldinfDefine = QString("BLD_INF_") + subdirFileName + QString("_") + uid; bldinfDefine = bldinfDefine.toUpper(); removeSpecialCharacters(bldinfDefine); @@ -1195,6 +1182,7 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy t << endl; // Add project mmps and old style extension makefiles + QString mmpTag; if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive)) mmpTag = QLatin1String(BLD_INF_TAG_TESTMMPFILES); @@ -1204,9 +1192,7 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy t << endl << mmpTag << endl << endl; writeBldInfMkFilePart(t, addDeploymentExtension); - if (targetType == TypeSubdirs) { - mmpProjects.removeOne(mmpfilename); - } else { + if (targetType != TypeSubdirs) { QString shortProFilename = project->projectFile(); shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); shortProFilename.replace(Option::pro_ext, QString("")); @@ -1224,6 +1210,7 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy t << endl << BLD_INF_TAG_EXTENSIONS << endl << endl; // Generate extension rules + writeBldInfExtensionRulesPart(t); userItems = userBldInfRules.value(BLD_INF_TAG_EXTENSIONS); @@ -1698,8 +1685,8 @@ void SymbianMakefileGenerator::writeSisTargets(QTextStream &t) .arg(MAKE_CACHE_NAME) .arg(OK_SIS_TARGET) .arg(FAIL_SIS_NOCACHE_TARGET) - .arg(FAIL_SIS_NOPKG_TARGET); - t << siscommand << endl; + .arg(FAIL_SIS_NOPKG_TARGET); + t << siscommand << endl; t << endl; t << OK_SIS_TARGET ":" << endl; @@ -1710,15 +1697,15 @@ void SymbianMakefileGenerator::writeSisTargets(QTextStream &t) .arg("pkg"); t << pkgcommand << endl; t << endl; - - t << FAIL_SIS_NOPKG_TARGET ":" << endl; - t << "\t$(error PKG file does not exist, 'SIS' target is only supported for executables or projects with DEPLOYMENT statement)" << endl; + + t << FAIL_SIS_NOPKG_TARGET ":" << endl; + t << "\t$(error PKG file does not exist, 'SIS' target is only supported for executables or projects with DEPLOYMENT statement)" << endl; t << endl; - - t << FAIL_SIS_NOCACHE_TARGET ":" << endl; - t << "\t$(error Project has to be build before calling 'SIS' target)" << endl; + + t << FAIL_SIS_NOCACHE_TARGET ":" << endl; + t << "\t$(error Project has to be build before calling 'SIS' target)" << endl; t << endl; - + t << RESTORE_BUILD_TARGET ":" << endl; t << "-include " MAKE_CACHE_NAME << endl; @@ -1728,7 +1715,8 @@ void SymbianMakefileGenerator::writeSisTargets(QTextStream &t) void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) { t << "dodistclean:" << endl; - foreach(QString item, project->values("SUBDIRS")) { + const QStringList &subdirs = project->values("SUBDIRS"); + foreach(QString item, subdirs) { bool fromFile = false; QString fixedItem; if (!project->isEmpty(item + ".file")) { diff --git a/qmake/project.cpp b/qmake/project.cpp index 89fe5bd..e49441b 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -519,7 +519,7 @@ static isForSymbian_enum isForSymbian_value = isForSymbian_NOT_SET; // Checking for symbian build is primarily determined from the qmake spec, // but if that is not specified, detect if symbian is the default spec // by checking the MAKEFILE_GENERATOR variable value. -static void init_isForSymbian(const QMap& vars) +static void init_symbian(const QMap& vars) { if (isForSymbian_value != isForSymbian_NOT_SET) return; @@ -527,26 +527,27 @@ static void init_isForSymbian(const QMap& vars) QString spec = QFileInfo(Option::mkfile::qmakespec).fileName(); if (spec.startsWith("symbian-abld", Qt::CaseInsensitive)) { isForSymbian_value = isForSymbian_ABLD; - return; - } - if (spec.startsWith("symbian-sbsv2", Qt::CaseInsensitive)) { + } else if (spec.startsWith("symbian-sbsv2", Qt::CaseInsensitive)) { isForSymbian_value = isForSymbian_SBSV2; - return; - } - - QStringList generatorList = vars["MAKEFILE_GENERATOR"]; - - if (!generatorList.isEmpty()) { - QString generator = generatorList.first(); - if (generator.startsWith("SYMBIAN_ABLD")) - isForSymbian_value = isForSymbian_ABLD; - else if (generator.startsWith("SYMBIAN_SBSV2")) - isForSymbian_value = isForSymbian_SBSV2; - else - isForSymbian_value = isForSymbian_FALSE; } else { - isForSymbian_value = isForSymbian_FALSE; + QStringList generatorList = vars["MAKEFILE_GENERATOR"]; + + if (!generatorList.isEmpty()) { + QString generator = generatorList.first(); + if (generator.startsWith("SYMBIAN_ABLD")) + isForSymbian_value = isForSymbian_ABLD; + else if (generator.startsWith("SYMBIAN_SBSV2")) + isForSymbian_value = isForSymbian_SBSV2; + else + isForSymbian_value = isForSymbian_FALSE; + } else { + isForSymbian_value = isForSymbian_FALSE; + } } + + // Force recursive on Symbian, as non-recursive is not really a viable option there + if (isForSymbian_value != isForSymbian_FALSE) + Option::recursive = true; } bool isForSymbian() @@ -554,9 +555,9 @@ bool isForSymbian() // If isForSymbian_value has not been initialized explicitly yet, // call initializer with dummy map to check qmake spec. if (isForSymbian_value == isForSymbian_NOT_SET) - init_isForSymbian(QMap()); + init_symbian(QMap()); - return (isForSymbian_value == isForSymbian_ABLD || isForSymbian_value == isForSymbian_SBSV2); + return (isForSymbian_value != isForSymbian_FALSE); } bool isForSymbianSbsv2() @@ -564,7 +565,7 @@ bool isForSymbianSbsv2() // If isForSymbian_value has not been initialized explicitly yet, // call initializer with dummy map to check qmake spec. if (isForSymbian_value == isForSymbian_NOT_SET) - init_isForSymbian(QMap()); + init_symbian(QMap()); return (isForSymbian_value == isForSymbian_SBSV2); } @@ -1463,7 +1464,7 @@ QMakeProject::read(uchar cmd) return false; } - init_isForSymbian(base_vars); + init_symbian(base_vars); if(Option::mkfile::do_cache && !Option::mkfile::cachefile.isEmpty()) { debug_msg(1, "QMAKECACHE file: reading %s", Option::mkfile::cachefile.toLatin1().constData()); @@ -1715,7 +1716,7 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QMap Date: Tue, 13 Oct 2009 19:20:40 +0200 Subject: Doc: Gesture API documentation review and improvements. Reviewed-by: Trust Me --- doc/src/frameworks-technologies/gestures.qdoc | 245 ++++------- doc/src/getting-started/examples.qdoc | 7 +- .../snippets/gestures/imageviewer/imagewidget.cpp | 364 ---------------- .../snippets/gestures/imageviewer/imagewidget.h | 137 ------ .../gestures/imageviewer/tapandholdgesture.cpp | 159 ------- .../gestures/imageviewer/tapandholdgesture.h | 74 ---- doc/src/snippets/gestures/qgesture.cpp | 283 ------------ doc/src/snippets/gestures/qgesture.h | 101 ----- doc/src/snippets/gestures/qstandardgestures.cpp | 483 --------------------- doc/src/snippets/gestures/qstandardgestures.h | 126 ------ examples/gestures/imageviewer/imageviewer.pro | 8 +- examples/gestures/imageviewer/imagewidget.cpp | 10 +- examples/gestures/imageviewer/main.cpp | 33 +- examples/gestures/imageviewer/mainwidget.cpp | 56 +++ examples/gestures/imageviewer/mainwidget.h | 63 +++ src/gui/kernel/qgesture.cpp | 26 +- src/gui/kernel/qgesturerecognizer.cpp | 23 +- 17 files changed, 265 insertions(+), 1933 deletions(-) delete mode 100644 doc/src/snippets/gestures/imageviewer/imagewidget.cpp delete mode 100644 doc/src/snippets/gestures/imageviewer/imagewidget.h delete mode 100644 doc/src/snippets/gestures/imageviewer/tapandholdgesture.cpp delete mode 100644 doc/src/snippets/gestures/imageviewer/tapandholdgesture.h delete mode 100644 doc/src/snippets/gestures/qgesture.cpp delete mode 100644 doc/src/snippets/gestures/qgesture.h delete mode 100644 doc/src/snippets/gestures/qstandardgestures.cpp delete mode 100644 doc/src/snippets/gestures/qstandardgestures.h create mode 100644 examples/gestures/imageviewer/mainwidget.cpp create mode 100644 examples/gestures/imageviewer/mainwidget.h diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc index 158a273..e5947a2 100644 --- a/doc/src/frameworks-technologies/gestures.qdoc +++ b/doc/src/frameworks-technologies/gestures.qdoc @@ -59,176 +59,115 @@ \section1 Overview - QGesture is the central class in Qt's gesture framework, providing - the API used by classes that represent specific gestures, such as - QPanGesture, QPinchGesture, and QSwipeGesture. These standard - classes are ready to use, and each exposes functions and - properties that give gesture-specific information about the user's - input. This is described in the \l{Using Standard Gestures With Widgets} - section. - - QGesture is also designed to be subclassed and extended so that - support for new gestures can be implemented by developers. Adding - support for a new gesture involves implementing code to recognize - the gesture from incoming events. This is described in the + QGesture is the central class in Qt's gesture framework, providing a container + for information about gestures performed by the user, such as panning, pinching + and swiping. QGesture exposes properties that give general information that is + common to all gestures, and these can be extended to provide additional + gesture-specific information. + + Developers can also implement new gestures by subclassing and extending the + QGestureRecognizer class. Adding support for a new gesture involves implementing + code to recognize the gesture from input events. This is described in the \l{Creating Your Own Gesture Recognizer} section. \section1 Using Standard Gestures with Widgets - Gesture objects are applied directly to widgets and other controls that accept - user input \mdash these are the \e{target objects}. When a gesture object is - constructed, the target object is typically passed to the constructor, though - it can also be passed as the argument to the \l{QGesture::}{setGestureTarget()} - function. + Gestures can be enabled for instances of QWidget and QGraphicsObject subclasses. + An object that accepts gesture input is referred to as a \e{target object}. - \snippet examples/gestures/imageviewer/imagewidget.cpp construct swipe gesture + To enable a gesture for a target object, call its QWidget::grabGesture() or + QGraphicsObject::grabGesture() function with an argument describing the + required gesture type. The standard types are defined by the Qt::GestureType + enum and include many commonly used gestures. + + \snippet examples/gestures/imageviewer/imagewidget.cpp enable gestures In the above code, the gesture is set up in the constructor of the target object - itself, so the argument to the QSwipeGesture constructor is \e this. + itself. + + When the user performs a gesture, QGestureEvent events will be delivered to the + target object, and these can be handled by reimplementing the QWidget::event() + handler function for widgets or QGraphicsItem::sceneEvent() for graphics objects. + + For convenience, the \l{Image Gestures Example} reimplements the general + \l{QWidget::}{event()} handler function and delegates gesture events to a + specialized gestureEvent() function: - When the user performs a gesture, various signals may be emitted by the - gesture object. To monitor the user's actions, you need to connect signals - from the gesture object to slots in your code. + \snippet examples/gestures/imageviewer/imagewidget.cpp event handler - \snippet examples/gestures/imageviewer/imagewidget.cpp connect swipe gesture + The gesture events delivered to the target object can be examined individually + and dealt with appropriately: - Here, the \l{QGesture::}{triggered()} signal is used to inform the application - that a gesture was used. More precise monitoring of a gesture can be implemented - by connecting its \l{QGesture::}{started()}, \l{QGesture::}{canceled()} and - \l{QGesture::}{finished()} signals to slots. + \snippet examples/gestures/imageviewer/imagewidget.cpp gesture event handler - Responding to a signal is simply a matter of obtaining the gesture that sent - it and examining the information it contains. + Responding to a gesture is simply a matter of obtaining the QGesture object + delivered in the QGestureEvent sent to the target object and examining the + information it contains. - \snippet examples/gestures/imageviewer/imagewidget.cpp swipe slot start + \snippet examples/gestures/imageviewer/imagewidget.cpp swipe function Here, we examine the direction in which the user swiped the widget and modify its contents accordingly. - \section1 Using Standard Gestures with Graphics Items - - The approach used for applying gestures to widgets can also be used with - graphics items. However, instead of passing a target object to the - gesture object's constructor, you set a target graphics item with the - \l{QGesture::}{setGraphicsItem()} function. \section1 Creating Your Own Gesture Recognizer - QGesture is a base class for a user defined gesture recognizer class. In - order to implement the recognizer you will need to subclass the - QGesture class and implement the pure virtual function - \l{QGesture::}{filterEvent()} to filter out events that are not relevant - to your gesture. - - Once you have implemented the \l{QGesture::}{filterEvent()} function to - make your own recognizer you can process events. A sequence of events may, - according to your own rules, represent a gesture. The events can be singly - passed to the recognizer via the \l{QGesture::}{filterEvent()} function - or as a stream of events by specifying a parent source of events. The events - can be from any source and could result in any action as defined by the user. - The source and action need not be graphical, though that would be the most - likely scenario. To find how to connect a source of events to automatically - feed into the recognizer see the QGesture documentation. - - Recognizers based on QGesture can emit any of the following signals to - indicate their progress in recognizing user input: - - \list - \o \l{QGesture::}{triggered()} is emitted when a gesture is recognized. - \o \l{QGesture::}{started()} indicates that the gesture object has started - to recognize user input. - \o \l{QGesture::}{finished()} is emitted when the gesture object has - recognized the user input as a gesture, and finished handling it. - \o \l{QGesture::}{canceled()} indicates that the gesture was canceled, - either by the user or by the application. - \endlist - - These signals are emitted when the state changes with the call to - \l{QGesture::}{updateState()}, more than one signal may - be emitted when a change of state occurs. There are four GestureStates - - \table - \header \o New State \o Description \o QGesture Actions on Entering this State - \row \o Qt::NoGesture \o Initial value \o emit \l {QGesture::}{canceled()} - \row \o Qt::GestureStarted \o A continuous gesture has started \o emit \l{QGesture::}{started()} and emit \l{QGesture::}{triggered()} - \row \o Qt::GestureUpdated \o A gesture continues \o emit \l{QGesture::}{triggered()} - \row \o Qt::GestureFinished \o A gesture has finished. \o emit \l{QGesture::}{finished()} - \endtable - - \note \l{QGesture::started()}{started()} can be emitted if entering any - state greater than NoGesture if NoGesture was the previous state. This - means that your state machine does not need to explicitly use the - Qt::GestureStarted state, you can simply proceed from NoGesture to - Qt::GestureUpdated to emit a \l{QGesture::started()}{started()} signal - and a \l{QGesture::triggered()}{triggered()} signal. - - You may use some or all of these states when implementing the pure - virtual function \l{QGesture::filterEvent()}{filterEvent()}. - \l{QGesture::filterEvent()}{filterEvent()} will usually implement a - state machine using the GestureState enums, but the details of which - states are used is up to the developer. - - You may also need to reimplement the virtual function \l{QGesture::reset()}{reset()} - if internal data or objects need to be re-initialized. The function must - conclude with a call to \l{QGesture::updateState()}{updateState()} to - change the current state to Qt::NoGesture. - - \section1 The ImageViewer Example - - To illustrate how to use QGesture we will look at the ImageViewer - example. This example uses QPanGesture, a standard gesture, and an - implementation of TapAndHoldGesture. Note that TapAndHoldGesture is - platform-dependent. - - \snippet doc/src/snippets/gestures/imageviewer/tapandholdgesture.cpp tapandhold-reset - - In ImageViewer we see that the ImageWidget class uses two gestures: - \l QPanGesture and TapAndHoldGesture. The - QPanGesture is a standard gesture which is part of Qt. - TapAndHoldGesture is defined and implemented as part of the example. - The ImageWidget listens for signals from the gestures, but is not - interested in the \l{QGesture::started()}{started()} signal. - - \snippet doc/src/snippets/gestures/imageviewer/imagewidget.h imagewidget-slots - - TapAndHoldGesture uses QTouchEvent events and mouse events to detect - start, update and end events that can be mapped onto the GestureState - changes. The implementation in this case uses a timer as well. If the - timeout event occurs a given number of times after the start of the gesture - then the gesture is considered to have finished whether or not the - appropriate touch or mouse event has occurred. Also if a large jump in - the position of the event occurs, as calculated by the \l {QPoint::manhattanLength()}{manhattanLength()} - call, then the gesture is canceled by calling \l{QGesture::reset()}{reset()} - which tidies up and uses \l{QGesture::updateState()}{updateState()} to - change state to NoGesture which will result in the \l{QGesture::canceled()}{canceled()} - signal being emitted by the recognizer. - - ImageWidget handles the signals by connecting the slots to the signals, - although \c canceled() is not connected here. - - \snippet doc/src/snippets/gestures/imageviewer/imagewidget.cpp imagewidget-connect - - These functions in turn will have to be aware of which gesture - object was the source of the signal since we have more than one source - per slot. This is easily done by using the QObject::sender() function - as shown here - - \snippet doc/src/snippets/gestures/imageviewer/imagewidget.cpp imagewidget-triggered-1 - - As \l{QGesture::triggered()}{triggered()} signals are handled by - gestureTriggered() there may be position updates invoking calls to, - for example, goNextImage(), this will cause a change in the image - handling logic of ImageWidget and a call to updateImage() to display - the changed state. - - Following the logic of how the QEvent is processed we can summmarize - it as follows: - \list - \o filterEvent() becomes the event filter of the parent ImageWidget object - for a QPanGesture object and a TapAndHoldGesture object. - \o filterEvent() then calls updateState() to change states - \o updateState() emits the appropriate signal(s) for the state change. - \o The signals are caught by the defined slots in ImageWidget - \o The widget logic changes and an update() results in a paint event. - \endlist + Adding support for a new gesture involves creating and registering a new gesture + recognizer. Depending on the recognition process for the gesture, it may also + involve creating a new gesture object. + + To create a new recognizer, you need to subclass QGestureRecognizer to create a + custom recognizer class. There is one virtual function that you must reimplement + and two others that can be reimplemented as required. + + \section2 Filtering Input Events + + The \l{QGestureRecognizer::}{filterEvent()} function must be reimplemented. + This function handles and filters the incoming input events for the target objects + and determines whether or not they correspond to the gesture the recognizer is + looking for. + + Although the logic for gesture recognition is implemented in this function, + possibly using a state machine based on the Qt::GestureState enums, you can store + persistent information about the state of the recognition process in the QGesture + object supplied. + + Your \l{QGestureRecognizer::}{filterEvent()} function must return a value of + Qt::GestureState that indicates the state of recognition for a given gesture and + target object. This determines whether or not a gesture event will be delivered + to a target object. + + \section2 Custom Gestures + + If you choose to represent a gesture by a custom QGesture subclass, you will need to + reimplement the \l{QGestureRecognizer::}{createGesture()} function to construct + instances of your gesture class instead of standard QGesture instances. Alternatively, + you may want to use standard QGesture instances, but add additional dynamic properties + to them to express specific details of the gesture you want to handle. + + \section2 Resetting Gestures + + If you use custom gesture objects that need to be reset or otherwise specially + handled when a gesture is canceled, you need to reimplement the + \l{QGestureRecognizer::}{reset()} function to perform these special tasks. + + Note that QGesture objects are only created once for each combination of target object + and gesture type, and they are reused every time the user attempts to perform the + same gesture type on the target object. As a result, it can be useful to reimplement + the \l{QGestureRecognizer::}{reset()} function to clean up after each previous attempt + at recognizing a gesture. + + + \section1 Using a New Gesture Recognizer + + To use a gesture recognizer, construct an instance of your QGestureRecognizer + subclass, and register it with the application with + QApplication::registerGestureRecognizer(). A recognizer for a given type of + gesture can be removed with QApplication::unregisterGestureRecognizer(). + + + \section1 Further Reading + + The \l{Image Gestures Example} shows how to enable gestures for a widget in + a simple image viewer application. */ diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index d6ade22..05940e4 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -1072,18 +1072,17 @@ /*! \page examples-gestures.html \title Gestures Examples - + \previouspage Animation Framework Examples \contentspage Qt Examples \nextpage D-Bus Examples The API of the gesture framework is not yet finalized and still subject to change. -\omit + \list - \o \l{widgets/imageviewer}{Image Viewer} + \o \l{gestures/imagegestures}{Image Gestures} \endlist -\endomit */ /*! diff --git a/doc/src/snippets/gestures/imageviewer/imagewidget.cpp b/doc/src/snippets/gestures/imageviewer/imagewidget.cpp deleted file mode 100644 index 409db2e..0000000 --- a/doc/src/snippets/gestures/imageviewer/imagewidget.cpp +++ /dev/null @@ -1,364 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "imagewidget.h" - -#include - -ImageWidget::ImageWidget(QWidget *parent) - : QWidget(parent) -{ - setAttribute(Qt::WA_AcceptTouchEvents); - setAttribute(Qt::WA_PaintOnScreen); - setAttribute(Qt::WA_OpaquePaintEvent); - setAttribute(Qt::WA_NoSystemBackground); - - setObjectName("ImageWidget"); - - setMinimumSize(QSize(100,100)); - - position = 0; - zoomed = rotated = false; - - zoomedIn = false; - horizontalOffset = 0; - verticalOffset = 0; - -//! [imagewidget-connect] - panGesture = new QPanGesture(this); - connect(panGesture, SIGNAL(triggered()), this, SLOT(gestureTriggered())); - - tapAndHoldGesture = new TapAndHoldGesture(this); - connect(tapAndHoldGesture, SIGNAL(triggered()), this, SLOT(gestureTriggered())); - connect(tapAndHoldGesture, SIGNAL(finished()), this, SLOT(gestureFinished())); -//! [imagewidget-connect] -} - -void ImageWidget::paintEvent(QPaintEvent*) -{ - QPainter p(this); - if (currentImage.isNull()) { - p.fillRect(geometry(), Qt::white); - return; - } - int hoffset = 0; - int voffset = 0; - const int w = pixmap.width(); - const int h = pixmap.height(); - p.save(); - if (zoomedIn) { - hoffset = horizontalOffset; - voffset = verticalOffset; - if (horizontalOffset > 0) - p.fillRect(0, 0, horizontalOffset, height(), Qt::white); - if (verticalOffset > 0) - p.fillRect(0, 0, width(), verticalOffset, Qt::white); - } - p.drawPixmap(hoffset, voffset, pixmap); - if (hoffset + w < width()) - p.fillRect(hoffset + w, 0, width() - w - hoffset, height(), Qt::white); - if (voffset + h < height()) - p.fillRect(0, voffset + h, width(), height() - h - voffset, Qt::white); - - // paint touch feedback - if (touchFeedback.tapped || touchFeedback.doubleTapped) { - p.setPen(QPen(Qt::gray, 2)); - p.drawEllipse(touchFeedback.position, 5, 5); - if (touchFeedback.doubleTapped) { - p.setPen(QPen(Qt::darkGray, 2, Qt::DotLine)); - p.drawEllipse(touchFeedback.position, 15, 15); - } else if (touchFeedback.tapAndHoldState != 0) { - QPoint pts[8] = { - touchFeedback.position + QPoint( 0, -15), - touchFeedback.position + QPoint( 10, -10), - touchFeedback.position + QPoint( 15, 0), - touchFeedback.position + QPoint( 10, 10), - touchFeedback.position + QPoint( 0, 15), - touchFeedback.position + QPoint(-10, 10), - touchFeedback.position + QPoint(-15, 0) - }; - for (int i = 0; i < touchFeedback.tapAndHoldState/5; ++i) - p.drawEllipse(pts[i], 3, 3); - } - } else if (touchFeedback.sliding) { - p.setPen(QPen(Qt::red, 3)); - QPoint endPos = QPoint(touchFeedback.position.x(), touchFeedback.slidingStartPosition.y()); - p.drawLine(touchFeedback.slidingStartPosition, endPos); - int dx = 10; - if (touchFeedback.slidingStartPosition.x() < endPos.x()) - dx = -1*dx; - p.drawLine(endPos, endPos + QPoint(dx, 5)); - p.drawLine(endPos, endPos + QPoint(dx, -5)); - } - - for (int i = 0; i < TouchFeedback::MaximumNumberOfTouches; ++i) { - if (touchFeedback.touches[i].isNull()) - break; - p.drawEllipse(touchFeedback.touches[i], 10, 10); - } - p.restore(); -} - -void ImageWidget::mousePressEvent(QMouseEvent *event) -{ - touchFeedback.tapped = true; - touchFeedback.position = event->pos(); -} - -void ImageWidget::mouseDoubleClickEvent(QMouseEvent *event) -{ - touchFeedback.doubleTapped = true; - const QPoint p = event->pos(); - touchFeedback.position = p; - horizontalOffset = p.x() - currentImage.width()*1.0*p.x()/width(); - verticalOffset = p.y() - currentImage.height()*1.0*p.y()/height(); - setZoomedIn(!zoomedIn); - zoomed = rotated = false; - updateImage(); - - feedbackFadeOutTimer.start(500, this); -} - -//! [imagewidget-triggered-1] -void ImageWidget::gestureTriggered() -{ - if (sender() == panGesture) { -//! [imagewidget-triggered-1] - touchFeedback.tapped = false; - touchFeedback.doubleTapped = false; - QPanGesture *pg = qobject_cast(sender()); - if (zoomedIn) { -#ifndef QT_NO_CURSOR - switch (pg->state()) { - case Qt::GestureStarted: - case Qt::GestureUpdated: - setCursor(Qt::SizeAllCursor); - break; - default: - setCursor(Qt::ArrowCursor); - } -#endif - horizontalOffset += pg->lastOffset().width(); - verticalOffset += pg->lastOffset().height(); - } else { - // only slide gesture should be accepted - if (pg->state() == Qt::GestureFinished) { - touchFeedback.sliding = false; - zoomed = rotated = false; - if (pg->totalOffset().width() > 0) - goNextImage(); - else - goPrevImage(); - updateImage(); - } - } - update(); - feedbackFadeOutTimer.start(500, this); - } else if (sender() == tapAndHoldGesture) { - if (tapAndHoldGesture->state() == Qt::GestureFinished) { - qDebug() << "tap and hold detected"; - touchFeedback.reset(); - update(); - - QMenu menu; - menu.addAction("Action 1"); - menu.addAction("Action 2"); - menu.addAction("Action 3"); - menu.exec(mapToGlobal(tapAndHoldGesture->pos())); - } else { - ++touchFeedback.tapAndHoldState; - update(); - } - feedbackFadeOutTimer.start(500, this); - } -} - -void ImageWidget::gestureFinished() -{ - qDebug() << "gesture finished" << sender(); -} - -void ImageWidget::gestureCancelled() -{ - qDebug() << "gesture cancelled" << sender(); -} - -void ImageWidget::resizeEvent(QResizeEvent*) -{ - updateImage(); -} - -void ImageWidget::updateImage() -{ - // should use qtconcurrent here? - transformation = QTransform(); - if (zoomedIn) { - } else { - if (currentImage.isNull()) - return; - if (zoomed) { - transformation = transformation.scale(zoom, zoom); - } else { - double xscale = (double)width()/currentImage.width(); - double yscale = (double)height()/currentImage.height(); - if (xscale < yscale) - yscale = xscale; - else - xscale = yscale; - transformation = transformation.scale(xscale, yscale); - } - if (rotated) - transformation = transformation.rotate(angle); - } - pixmap = QPixmap::fromImage(currentImage).transformed(transformation); - update(); -} - -void ImageWidget::openDirectory(const QString &path) -{ - this->path = path; - QDir dir(path); - QStringList nameFilters; - nameFilters << "*.jpg" << "*.png"; - files = dir.entryList(nameFilters, QDir::Files|QDir::Readable, QDir::Name); - - position = 0; - goToImage(0); - updateImage(); -} - -QImage ImageWidget::loadImage(const QString &fileName) -{ - QImageReader reader(fileName); - if (!reader.canRead()) { - qDebug() << fileName << ": can't load image"; - return QImage(); - } - QImage image; - if (!reader.read(&image)) { - qDebug() << fileName << ": corrupted image"; - return QImage(); - } - return image; -} - -void ImageWidget::setZoomedIn(bool zoomed) -{ - zoomedIn = zoomed; -} - -void ImageWidget::goNextImage() -{ - if (files.isEmpty()) - return; - if (position < files.size()-1) { - ++position; - prevImage = currentImage; - currentImage = nextImage; - if (position+1 < files.size()) - nextImage = loadImage(path+QLatin1String("/")+files.at(position+1)); - else - nextImage = QImage(); - } - setZoomedIn(false); - updateImage(); -} - -void ImageWidget::goPrevImage() -{ - if (files.isEmpty()) - return; - if (position > 0) { - --position; - nextImage = currentImage; - currentImage = prevImage; - if (position > 0) - prevImage = loadImage(path+QLatin1String("/")+files.at(position-1)); - else - prevImage = QImage(); - } - setZoomedIn(false); - updateImage(); -} - -void ImageWidget::goToImage(int index) -{ - if (files.isEmpty()) - return; - if (index < 0 || index >= files.size()) { - qDebug() << "goToImage: invalid index: " << index; - return; - } - if (index == position+1) { - goNextImage(); - return; - } - if (position > 0 && index == position-1) { - goPrevImage(); - return; - } - position = index; - pixmap = QPixmap(); - if (index > 0) - prevImage = loadImage(path+QLatin1String("/")+files.at(position-1)); - else - prevImage = QImage(); - currentImage = loadImage(path+QLatin1String("/")+files.at(position)); - if (position+1 < files.size()) - nextImage = loadImage(path+QLatin1String("/")+files.at(position+1)); - else - nextImage = QImage(); - setZoomedIn(false); - updateImage(); -} - -void ImageWidget::timerEvent(QTimerEvent *event) -{ - if (event->timerId() == touchFeedback.tapTimer.timerId()) { - touchFeedback.tapTimer.stop(); - } else if (event->timerId() == feedbackFadeOutTimer.timerId()) { - feedbackFadeOutTimer.stop(); - touchFeedback.reset(); - } - update(); -} - -#include "moc_imagewidget.cpp" diff --git a/doc/src/snippets/gestures/imageviewer/imagewidget.h b/doc/src/snippets/gestures/imageviewer/imagewidget.h deleted file mode 100644 index 5553093..0000000 --- a/doc/src/snippets/gestures/imageviewer/imagewidget.h +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef IMAGEWIDGET_H -#define IMAGEWIDGET_H - -#include -#include -#include - -#include - -#include "tapandholdgesture.h" - -class ImageWidget : public QWidget -{ - Q_OBJECT - -public: - ImageWidget(QWidget *parent = 0); - - void openDirectory(const QString &path); - -protected: - void paintEvent(QPaintEvent*); - void resizeEvent(QResizeEvent*); - void timerEvent(QTimerEvent*); - void mousePressEvent(QMouseEvent*); - void mouseDoubleClickEvent(QMouseEvent*); - -//! [imagewidget-slots] -private slots: - void gestureTriggered(); - void gestureFinished(); - void gestureCancelled(); -//! [imagewidget-slots] - -private: - void updateImage(); - QImage loadImage(const QString &fileName); - void loadImage(); - void setZoomedIn(bool zoomed); - void goNextImage(); - void goPrevImage(); - void goToImage(int index); - - QPanGesture *panGesture; - TapAndHoldGesture *tapAndHoldGesture; - - QString path; - QStringList files; - int position; - - QImage prevImage, nextImage; - QImage currentImage; - QPixmap pixmap; - QTransform transformation; - - bool zoomedIn; - int horizontalOffset; - int verticalOffset; - - bool zoomed; - qreal zoom; - bool rotated; - qreal angle; - - struct TouchFeedback - { - bool tapped; - QPoint position; - bool sliding; - QPoint slidingStartPosition; - QBasicTimer tapTimer; - int tapState; - bool doubleTapped; - int tapAndHoldState; - - enum { MaximumNumberOfTouches = 5 }; - QPoint touches[MaximumNumberOfTouches]; - - inline TouchFeedback() { reset(); } - inline void reset() - { - tapped = false; - sliding = false; - tapTimer.stop(); - tapState = 0; - doubleTapped = false; - tapAndHoldState = 0; - for (int i = 0; i < MaximumNumberOfTouches; ++i) { - touches[i] = QPoint(); - } - } - } touchFeedback; - QBasicTimer feedbackFadeOutTimer; -}; - -#endif diff --git a/doc/src/snippets/gestures/imageviewer/tapandholdgesture.cpp b/doc/src/snippets/gestures/imageviewer/tapandholdgesture.cpp deleted file mode 100644 index 7dd2359..0000000 --- a/doc/src/snippets/gestures/imageviewer/tapandholdgesture.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "tapandholdgesture.h" - -#include - -// #define TAPANDHOLD_USING_MOUSE - -/*! - \class TapAndHoldGesture - \since 4.6 - - \brief The TapAndHoldGesture class represents a Tap-and-Hold gesture, - providing additional information. -*/ - -const int TapAndHoldGesture::iterationCount = 40; -const int TapAndHoldGesture::iterationTimeout = 50; - -/*! - Creates a new Tap and Hold gesture handler object and marks it as a child - of \a parent. - - On some platforms like Windows there is a system-wide tap and hold gesture - that cannot be overriden, hence the gesture might never trigger and default - context menu will be shown instead. -*/ -TapAndHoldGesture::TapAndHoldGesture(QWidget *parent) - : QGesture(parent), iteration(0) -{ -} - -/*! \internal */ -bool TapAndHoldGesture::filterEvent(QEvent *event) -{ - if (!event->spontaneous()) - return false; - const QTouchEvent *ev = static_cast(event); - switch (event->type()) { - case QEvent::TouchBegin: { - if (timer.isActive()) - timer.stop(); - timer.start(TapAndHoldGesture::iterationTimeout, this); - const QPoint p = ev->touchPoints().at(0).pos().toPoint(); - position = p; - break; - } - case QEvent::TouchUpdate: - if (ev->touchPoints().size() == 1) { - const QPoint startPos = ev->touchPoints().at(0).startPos().toPoint(); - const QPoint pos = ev->touchPoints().at(0).pos().toPoint(); - if ((startPos - pos).manhattanLength() > 15) - reset(); - } else { - reset(); - } - break; - case QEvent::TouchEnd: - reset(); - break; -#ifdef TAPANDHOLD_USING_MOUSE - case QEvent::MouseButtonPress: { - if (timer.isActive()) - timer.stop(); - timer.start(TapAndHoldGesture::iterationTimeout, this); - const QPoint p = static_cast(event)->pos(); - position = startPosition = p; - break; - } - case QEvent::MouseMove: { - const QPoint startPos = startPosition; - const QPoint pos = static_cast(event)->pos(); - if ((startPos - pos).manhattanLength() > 15) - reset(); - break; - } - case QEvent::MouseButtonRelease: - reset(); - break; -#endif // TAPANDHOLD_USING_MOUSE - default: - break; - } - return false; -} - -/*! \internal */ -void TapAndHoldGesture::timerEvent(QTimerEvent *event) -{ - if (event->timerId() != timer.timerId()) - return; - if (iteration == TapAndHoldGesture::iterationCount) { - timer.stop(); - updateState(Qt::GestureFinished); - } else { - updateState(Qt::GestureUpdated); - } - ++iteration; -} - -/*! \internal */ -//! [tapandhold-reset] -void TapAndHoldGesture::reset() -{ - timer.stop(); - iteration = 0; - position = startPosition = QPoint(); - updateState(Qt::NoGesture); -} -//! [tapandhold-reset] - -/*! - \property TapAndHoldGesture::pos - - \brief The position of the gesture. -*/ -QPoint TapAndHoldGesture::pos() const -{ - return position; -} diff --git a/doc/src/snippets/gestures/imageviewer/tapandholdgesture.h b/doc/src/snippets/gestures/imageviewer/tapandholdgesture.h deleted file mode 100644 index 682342e..0000000 --- a/doc/src/snippets/gestures/imageviewer/tapandholdgesture.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TAPANDHOLDGESTURE_H -#define TAPANDHOLDGESTURE_H - -#include -#include -#include - -class TapAndHoldGesture : public QGesture -{ - Q_OBJECT - Q_PROPERTY(QPoint pos READ pos) - -public: - TapAndHoldGesture(QWidget *parent); - - bool filterEvent(QEvent *event); - void reset(); - - QPoint pos() const; - -protected: - void timerEvent(QTimerEvent *event); - -private: - QBasicTimer timer; - int iteration; - QPoint position; - QPoint startPosition; - static const int iterationCount; - static const int iterationTimeout; -}; - -#endif // TAPANDHOLDGESTURE_H diff --git a/doc/src/snippets/gestures/qgesture.cpp b/doc/src/snippets/gestures/qgesture.cpp deleted file mode 100644 index 77f5cc2..0000000 --- a/doc/src/snippets/gestures/qgesture.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgesture.h" -#include -#include "qgraphicsitem.h" - -QT_BEGIN_NAMESPACE - - -class QEventFilterProxyGraphicsItem : public QGraphicsItem -{ -public: - QEventFilterProxyGraphicsItem(QGesture *g) - : gesture(g) - { - } - bool sceneEventFilter(QGraphicsItem *, QEvent *event) - { - return gesture ? gesture->filterEvent(event) : false; - } - QRectF boundingRect() const { return QRectF(); } - void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) { } - -private: - QGesture *gesture; -}; - -/* - \class QGesture - \since 4.6 - - \brief The QGesture class is the base class for implementing custom - gestures. - - This class represents both an object that recognizes a gesture out of a set - of input events (a gesture recognizer), and a gesture object itself that - can be used to get extended information about the triggered gesture. - - The class has a list of properties that can be queried by the user to get - some gesture-specific parameters (for example, an offset of a Pan gesture). - - Usually gesture recognizer implements a state machine, storing its state - internally in the recognizer object. The recognizer receives input events - through the \l{QGesture::}{filterEvent()} virtual function and decides - whether the event should change the state of the recognizer by emitting an - appropriate signal. - - Input events should be either fed to the recognizer one by one with a - filterEvent() function, or the gesture recognizer should be attached to an - object it filters events for by specifying it as a parent object. The - QGesture object installs itself as an event filter to the parent object - automatically, the unsetObject() function should be used to remove an event - filter from the parent object. To make a - gesture that operates on a QGraphicsItem, both the appropriate QGraphicsView - should be passed as a parent object and setGraphicsItem() functions should - be used to attach a gesture to a graphics item. - - This is a base class, to create a custom gesture type, you should subclass - it and implement its pure virtual functions. - - \sa QPanGesture -*/ - -/* \fn bool QGesture::filterEvent(QEvent *event) - - Parses input \a event and emits a signal when detects a gesture. - - In your reimplementation of this function, if you want to filter the \a - event out, i.e. stop it being handled further, return true; otherwise - return false; - - This is a pure virtual function that needs to be implemented in subclasses. -*/ - -/* \fn void QGesture::started() - - The signal is emitted when the gesture is started. Extended information - about the gesture is contained in the signal sender object. - - In addition to started(), a triggered() signal should also be emitted. -*/ - -/* \fn void QGesture::triggered() - - The signal is emitted when the gesture is detected. Extended information - about the gesture is contained in the signal sender object. -*/ - -/* \fn void QGesture::finished() - - The signal is emitted when the gesture is finished. Extended information - about the gesture is contained in the signal sender object. -*/ - -/* \fn void QGesture::cancelled() - - The signal is emitted when the gesture is cancelled, for example the reset() - function is called while the gesture was in the process of emitting a - triggered() signal. Extended information about the gesture is contained in - the sender object. -*/ - - -/* - Creates a new gesture handler object and marks it as a child of \a parent. - - The \a parent object is also the default event source for the gesture, - meaning that the gesture installs itself as an event filter for the \a - parent. - - \sa setGraphicsItem() -*/ -QGesture::QGesture(QObject *parent) - : QObject(*new QGesturePrivate, parent) -{ - if (parent) - parent->installEventFilter(this); -} - -/* \internal - */ -QGesture::QGesture(QGesturePrivate &dd, QObject *parent) - : QObject(dd, parent) -{ - if (parent) - parent->installEventFilter(this); -} - -/* - Destroys the gesture object. -*/ -QGesture::~QGesture() -{ -} - -/* \internal - */ -bool QGesture::eventFilter(QObject *receiver, QEvent *event) -{ - Q_D(QGesture); - if (d->graphicsItem && receiver == parent()) - return false; - return filterEvent(event); -} - -/* - \property QGesture::state - - \brief The current state of the gesture. -*/ - -/* - Returns the gesture recognition state. - */ -Qt::GestureState QGesture::state() const -{ - return d_func()->state; -} - -/* - Sets this gesture's recognition state to \a state and emits appropriate - signals. - - This functions emits the signals according to the old state and the new - \a state, and it should be called after all the internal properties have been - initialized. - - \sa started(), triggered(), finished(), cancelled() - */ -void QGesture::updateState(Qt::GestureState state) -{ - Q_D(QGesture); - if (d->state == state) { - if (state == Qt::GestureUpdated) - emit triggered(); - return; - } - const Qt::GestureState oldState = d->state; - d->state = state; - if (state != Qt::NoGesture && oldState > state) { - // comparing the state as ints: state should only be changed from - // started to (optionally) updated and to finished. - qWarning("QGesture::updateState: incorrect new state"); - return; - } - if (oldState == Qt::NoGesture) - emit started(); - if (state == Qt::GestureUpdated) - emit triggered(); - else if (state == Qt::GestureFinished) - emit finished(); - else if (state == Qt::NoGesture) - emit cancelled(); - - if (state == Qt::GestureFinished) { - // gesture is finished, so we reset the internal state. - d->state = Qt::NoGesture; - } -} - -/* - Sets the \a graphicsItem the gesture is filtering events for. - - The gesture will install an event filter to the \a graphicsItem and - redirect them to the filterEvent() function. - - \sa graphicsItem() -*/ -void QGesture::setGraphicsItem(QGraphicsItem *graphicsItem) -{ - Q_D(QGesture); - if (d->graphicsItem && d->eventFilterProxyGraphicsItem) - d->graphicsItem->removeSceneEventFilter(d->eventFilterProxyGraphicsItem); - d->graphicsItem = graphicsItem; - if (!d->eventFilterProxyGraphicsItem) - d->eventFilterProxyGraphicsItem = new QEventFilterProxyGraphicsItem(this); - if (graphicsItem) - graphicsItem->installSceneEventFilter(d->eventFilterProxyGraphicsItem); -} - -/* - Returns the graphics item the gesture is filtering events for. - - \sa setGraphicsItem() -*/ -QGraphicsItem* QGesture::graphicsItem() const -{ - return d_func()->graphicsItem; -} - -/* \fn void QGesture::reset() - - Resets the internal state of the gesture. This function might be called by - the filterEvent() implementation in a derived class, or by the user to - cancel a gesture. The base class implementation calls - updateState(Qt::NoGesture) which emits the cancelled() - signal if the state() of the gesture indicated it was active. -*/ -void QGesture::reset() -{ - updateState(Qt::NoGesture); -} - -QT_END_NAMESPACE diff --git a/doc/src/snippets/gestures/qgesture.h b/doc/src/snippets/gestures/qgesture.h deleted file mode 100644 index 3fc89a1..0000000 --- a/doc/src/snippets/gestures/qgesture.h +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGESTURE_H -#define QGESTURE_H - -#include -#include -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QGraphicsItem; -class QGesturePrivate; -class Q_GUI_EXPORT QGesture : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QGesture) - - Q_PROPERTY(Qt::GestureState state READ state) - -public: - explicit QGesture(QObject *parent = 0); - ~QGesture(); - - virtual bool filterEvent(QEvent *event) = 0; - - void setGraphicsItem(QGraphicsItem *); - QGraphicsItem *graphicsItem() const; - - Qt::GestureState state() const; - -protected: - QGesture(QGesturePrivate &dd, QObject *parent); - bool eventFilter(QObject*, QEvent*); - - virtual void reset(); - void updateState(Qt::GestureState state); - -//! [qgesture-signals] -Q_SIGNALS: - void started(); - void triggered(); - void finished(); - void cancelled(); -//! [qgesture-signals] - -private: - friend class QWidget; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QGESTURE_H diff --git a/doc/src/snippets/gestures/qstandardgestures.cpp b/doc/src/snippets/gestures/qstandardgestures.cpp deleted file mode 100644 index b22f6ae..0000000 --- a/doc/src/snippets/gestures/qstandardgestures.cpp +++ /dev/null @@ -1,483 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qstandardgestures.h" -#include "qstandardgestures_p.h" - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -#ifdef Q_WS_WIN -QWidgetPrivate *qt_widget_private(QWidget *widget); -#endif - -/*! - \class QPanGesture - \since 4.6 - - \brief The QPanGesture class represents a Pan gesture, - providing additional information related to panning. -*/ - -/*! - Creates a new Pan gesture handler object and marks it as a child of \a - parent. - - On some platform like Windows it's necessary to provide a non-null widget - as \a parent to get native gesture support. -*/ -QPanGesture::QPanGesture(QWidget *parent) - : QGesture(*new QPanGesturePrivate, parent) -{ - if (parent) { - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - qAppPriv->widgetGestures[parent].pan = this; -#ifdef Q_WS_WIN - qt_widget_private(parent)->winSetupGestures(); -#endif - } -} - -/*! \internal */ -bool QPanGesture::event(QEvent *event) -{ - switch (event->type()) { - case QEvent::ParentAboutToChange: - if (QWidget *w = qobject_cast(parent())) { - QApplicationPrivate::instance()->widgetGestures[w].pan = 0; -#ifdef Q_WS_WIN - qt_widget_private(w)->winSetupGestures(); -#endif - } - break; - case QEvent::ParentChange: - if (QWidget *w = qobject_cast(parent())) { - QApplicationPrivate::instance()->widgetGestures[w].pan = this; -#ifdef Q_WS_WIN - qt_widget_private(w)->winSetupGestures(); -#endif - } - break; - default: - break; - } - -#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA) - Q_D(QPanGesture); - if (event->type() == QEvent::Timer) { - const QTimerEvent *te = static_cast(event); - if (te->timerId() == d->panFinishedTimer) { - killTimer(d->panFinishedTimer); - d->panFinishedTimer = 0; - d->lastOffset = QSize(0, 0); - updateState(Qt::GestureFinished); - } - } -#endif - - return QObject::event(event); -} - -bool QPanGesture::eventFilter(QObject *receiver, QEvent *event) -{ -#ifdef Q_WS_WIN - Q_D(QPanGesture); - if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) { - QNativeGestureEvent *ev = static_cast(event); - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - QApplicationPrivate::WidgetStandardGesturesMap::iterator it; - it = qAppPriv->widgetGestures.find(static_cast(receiver)); - if (it == qAppPriv->widgetGestures.end()) - return false; - if (this != it.value().pan) - return false; - Qt::GestureState nextState = Qt::NoGesture; - switch(ev->gestureType) { - case QNativeGestureEvent::GestureBegin: - // next we might receive the first gesture update event, so we - // prepare for it. - d->state = Qt::NoGesture; - return false; - case QNativeGestureEvent::Pan: - nextState = Qt::GestureUpdated; - event->accept(); - break; - case QNativeGestureEvent::GestureEnd: - if (state() == Qt::NoGesture) - return false; // some other gesture has ended - nextState = Qt::GestureFinished; - break; - default: - return false; - } - if (state() == Qt::NoGesture) { - d->lastOffset = d->totalOffset = QSize(); - } else { - d->lastOffset = QSize(ev->position.x() - d->lastPosition.x(), - ev->position.y() - d->lastPosition.y()); - d->totalOffset += d->lastOffset; - } - d->lastPosition = ev->position; - updateState(nextState); - return true; - } -#endif - return QGesture::eventFilter(receiver, event); -} - -/*! \internal */ -bool QPanGesture::filterEvent(QEvent *event) -{ - Q_D(QPanGesture); - if (!event->spontaneous()) - return false; - const QTouchEvent *ev = static_cast(event); - if (event->type() == QEvent::TouchBegin) { - QTouchEvent::TouchPoint p = ev->touchPoints().at(0); - d->lastPosition = p.pos().toPoint(); - d->lastOffset = d->totalOffset = QSize(); - } else if (event->type() == QEvent::TouchEnd) { - if (state() != Qt::NoGesture) { - if (!ev->touchPoints().isEmpty()) { - QTouchEvent::TouchPoint p = ev->touchPoints().at(0); - const QPoint pos = p.pos().toPoint(); - const QPoint lastPos = p.lastPos().toPoint(); - const QPoint startPos = p.startPos().toPoint(); - d->lastOffset = QSize(pos.x() - lastPos.x(), pos.y() - lastPos.y()); - d->totalOffset = QSize(pos.x() - startPos.x(), pos.y() - startPos.y()); - } - updateState(Qt::GestureFinished); - } - reset(); - } else if (event->type() == QEvent::TouchUpdate) { - QTouchEvent::TouchPoint p = ev->touchPoints().at(0); - const QPoint pos = p.pos().toPoint(); - const QPoint lastPos = p.lastPos().toPoint(); - const QPoint startPos = p.startPos().toPoint(); - d->lastOffset = QSize(pos.x() - lastPos.x(), pos.y() - lastPos.y()); - d->totalOffset = QSize(pos.x() - startPos.x(), pos.y() - startPos.y()); - if (d->totalOffset.width() > 10 || d->totalOffset.height() > 10 || - d->totalOffset.width() < -10 || d->totalOffset.height() < -10) { - updateState(Qt::GestureUpdated); - } - } -#ifdef Q_OS_MAC - else if (event->type() == QEvent::Wheel) { - // On Mac, there is really no native panning gesture. Instead, a two - // finger pan is delivered as mouse wheel events. Otoh, on Windows, you - // either get mouse wheel events or pan events. We have decided to make this - // the Qt behaviour as well, meaning that on Mac, wheel - // events will be masked away when listening for pan events. -#ifndef QT_MAC_USE_COCOA - // In Carbon we receive neither touch-, nor pan gesture events. - // So we create pan gestures by converting wheel events. After all, this - // is how things are supposed to work on mac in the first place. - const QWheelEvent *wev = static_cast(event); - int offset = wev->delta() / -120; - d->lastOffset = wev->orientation() == Qt::Horizontal ? QSize(offset, 0) : QSize(0, offset); - - if (state() == Qt::NoGesture) { - d->totalOffset = d->lastOffset; - } else { - d->totalOffset += d->lastOffset; - } - - killTimer(d->panFinishedTimer); - d->panFinishedTimer = startTimer(200); - updateState(Qt::GestureUpdated); -#endif - return true; - } -#endif - return false; -} - -/*! \internal */ -void QPanGesture::reset() -{ - Q_D(QPanGesture); - d->lastOffset = d->totalOffset = QSize(); - d->lastPosition = QPoint(); -#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA) - if (d->panFinishedTimer) { - killTimer(d->panFinishedTimer); - d->panFinishedTimer = 0; - } -#endif - QGesture::reset(); -} - -/*! - \property QPanGesture::totalOffset - - Specifies a total pan offset since the start of the gesture. -*/ -QSize QPanGesture::totalOffset() const -{ - Q_D(const QPanGesture); - return d->totalOffset; -} - -/*! - \property QPanGesture::lastOffset - - Specifies a pan offset since the last time the gesture was - triggered. -*/ -QSize QPanGesture::lastOffset() const -{ - Q_D(const QPanGesture); - return d->lastOffset; -} - - -/*! - \class QPinchGesture - \since 4.6 - - \brief The QPinchGesture class represents a Pinch gesture, - providing additional information related to zooming and/or rotation. -*/ - -/*! - Creates a new Pinch gesture handler object and marks it as a child of \a - parent. - - On some platform like Windows it's necessary to provide a non-null widget - as \a parent to get native gesture support. -*/ -QPinchGesture::QPinchGesture(QWidget *parent) - : QGesture(*new QPinchGesturePrivate, parent) -{ - if (parent) { - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - qAppPriv->widgetGestures[parent].pinch = this; -#ifdef Q_WS_WIN - qt_widget_private(parent)->winSetupGestures(); -#endif - } -} - -/*! \internal */ -bool QPinchGesture::event(QEvent *event) -{ - switch (event->type()) { - case QEvent::ParentAboutToChange: - if (QWidget *w = qobject_cast(parent())) { - QApplicationPrivate::instance()->widgetGestures[w].pinch = 0; -#ifdef Q_WS_WIN - qt_widget_private(w)->winSetupGestures(); -#endif - } - break; - case QEvent::ParentChange: - if (QWidget *w = qobject_cast(parent())) { - QApplicationPrivate::instance()->widgetGestures[w].pinch = this; -#ifdef Q_WS_WIN - qt_widget_private(w)->winSetupGestures(); -#endif - } - break; - default: - break; - } - return QObject::event(event); -} - -bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event) -{ -#ifdef Q_WS_WIN - Q_D(QPinchGesture); - if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) { - QNativeGestureEvent *ev = static_cast(event); - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - QApplicationPrivate::WidgetStandardGesturesMap::iterator it; - it = qAppPriv->widgetGestures.find(static_cast(receiver)); - if (it == qAppPriv->widgetGestures.end()) - return false; - if (this != it.value().pinch) - return false; - Qt::GestureState nextState = Qt::NoGesture; - switch(ev->gestureType) { - case QNativeGestureEvent::GestureBegin: - // next we might receive the first gesture update event, so we - // prepare for it. - d->state = Qt::NoGesture; - d->scaleFactor = d->lastScaleFactor = 1; - d->rotationAngle = d->lastRotationAngle = 0; - d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPoint(); - d->initialDistance = 0; - return false; - case QNativeGestureEvent::Rotate: - d->lastRotationAngle = d->rotationAngle; - d->rotationAngle = -1 * GID_ROTATE_ANGLE_FROM_ARGUMENT(ev->argument); - nextState = Qt::GestureUpdated; - event->accept(); - break; - case QNativeGestureEvent::Zoom: - if (d->initialDistance != 0) { - d->lastScaleFactor = d->scaleFactor; - int distance = int(qint64(ev->argument)); - d->scaleFactor = (qreal) distance / d->initialDistance; - } else { - d->initialDistance = int(qint64(ev->argument)); - } - nextState = Qt::GestureUpdated; - event->accept(); - break; - case QNativeGestureEvent::GestureEnd: - if (state() == Qt::NoGesture) - return false; // some other gesture has ended - nextState = Qt::GestureFinished; - break; - default: - return false; - } - if (d->startCenterPoint.isNull()) - d->startCenterPoint = d->centerPoint; - d->lastCenterPoint = d->centerPoint; - d->centerPoint = static_cast(receiver)->mapFromGlobal(ev->position); - updateState(nextState); - return true; - } -#endif - return QGesture::eventFilter(receiver, event); -} - -/*! \internal */ -bool QPinchGesture::filterEvent(QEvent *event) -{ - Q_UNUSED(event); - return false; -} - -/*! \internal */ -void QPinchGesture::reset() -{ - Q_D(QPinchGesture); - d->scaleFactor = d->lastScaleFactor = 0; - d->rotationAngle = d->lastRotationAngle = 0; - d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPoint(); - QGesture::reset(); -} - -/*! - \property QPinchGesture::scaleFactor - - Specifies a scale factor of the pinch gesture. -*/ -qreal QPinchGesture::scaleFactor() const -{ - return d_func()->scaleFactor; -} - -/*! - \property QPinchGesture::lastScaleFactor - - Specifies a previous scale factor of the pinch gesture. -*/ -qreal QPinchGesture::lastScaleFactor() const -{ - return d_func()->lastScaleFactor; -} - -/*! - \property QPinchGesture::rotationAngle - - Specifies a rotation angle of the gesture. -*/ -qreal QPinchGesture::rotationAngle() const -{ - return d_func()->rotationAngle; -} - -/*! - \property QPinchGesture::lastRotationAngle - - Specifies a previous rotation angle of the gesture. -*/ -qreal QPinchGesture::lastRotationAngle() const -{ - return d_func()->lastRotationAngle; -} - -/*! - \property QPinchGesture::centerPoint - - Specifies a center point of the gesture. The point can be used as a center - point that the object is rotated around. -*/ -QPoint QPinchGesture::centerPoint() const -{ - return d_func()->centerPoint; -} - -/*! - \property QPinchGesture::lastCenterPoint - - Specifies a previous center point of the gesture. -*/ -QPoint QPinchGesture::lastCenterPoint() const -{ - return d_func()->lastCenterPoint; -} - -/*! - \property QPinchGesture::startCenterPoint - - Specifies an initial center point of the gesture. Difference between the - startCenterPoint and the centerPoint is the distance at which pinching - fingers has shifted. -*/ -QPoint QPinchGesture::startCenterPoint() const -{ - return d_func()->startCenterPoint; -} - -QT_END_NAMESPACE - -#include "moc_qstandardgestures.cpp" - diff --git a/doc/src/snippets/gestures/qstandardgestures.h b/doc/src/snippets/gestures/qstandardgestures.h deleted file mode 100644 index efd6c6e..0000000 --- a/doc/src/snippets/gestures/qstandardgestures.h +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSTANDARDGESTURES_H -#define QSTANDARDGESTURES_H - -#include -#include - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QPanGesturePrivate; -class Q_GUI_EXPORT QPanGesture : public QGesture -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QPanGesture) - - Q_PROPERTY(QSize totalOffset READ totalOffset) - Q_PROPERTY(QSize lastOffset READ lastOffset) - -public: - QPanGesture(QWidget *parent); - - bool filterEvent(QEvent *event); - - QSize totalOffset() const; - QSize lastOffset() const; - -protected: - void reset(); - -private: - bool event(QEvent *event); - bool eventFilter(QObject *receiver, QEvent *event); - - friend class QWidget; -}; - -class QPinchGesturePrivate; -class Q_GUI_EXPORT QPinchGesture : public QGesture -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QPinchGesture) - - Q_PROPERTY(qreal scaleFactor READ scaleFactor) - Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor) - - Q_PROPERTY(qreal rotationAngle READ rotationAngle) - Q_PROPERTY(qreal lastRotationAngle READ lastRotationAngle) - - Q_PROPERTY(QPoint startCenterPoint READ startCenterPoint) - Q_PROPERTY(QPoint lastCenterPoint READ lastCenterPoint) - Q_PROPERTY(QPoint centerPoint READ centerPoint) - -public: - QPinchGesture(QWidget *parent); - - bool filterEvent(QEvent *event); - void reset(); - - QPoint startCenterPoint() const; - QPoint lastCenterPoint() const; - QPoint centerPoint() const; - - qreal scaleFactor() const; - qreal lastScaleFactor() const; - - qreal rotationAngle() const; - qreal lastRotationAngle() const; - -private: - bool event(QEvent *event); - bool eventFilter(QObject *receiver, QEvent *event); - - friend class QWidget; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QSTANDARDGESTURES_H diff --git a/examples/gestures/imageviewer/imageviewer.pro b/examples/gestures/imageviewer/imageviewer.pro index 68c1f1c..7780ad9 100644 --- a/examples/gestures/imageviewer/imageviewer.pro +++ b/examples/gestures/imageviewer/imageviewer.pro @@ -1,6 +1,8 @@ -HEADERS += imagewidget.h -SOURCES += imagewidget.cpp \ - main.cpp +HEADERS = imagewidget.h \ + mainwidget.h +SOURCES = imagewidget.cpp \ + main.cpp \ + mainwidget.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer diff --git a/examples/gestures/imageviewer/imagewidget.cpp b/examples/gestures/imageviewer/imagewidget.cpp index f3fd8e4..c4a4e50 100644 --- a/examples/gestures/imageviewer/imagewidget.cpp +++ b/examples/gestures/imageviewer/imagewidget.cpp @@ -59,17 +59,21 @@ ImageWidget::ImageWidget(QWidget *parent) setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_NoSystemBackground); +//! [enable gestures] grabGesture(Qt::PanGesture); grabGesture(Qt::PinchGesture); grabGesture(Qt::SwipeGesture); +//! [enable gestures] } +//! [event handler] bool ImageWidget::event(QEvent *event) { if (event->type() == QEvent::Gesture) return gestureEvent(static_cast(event)); return QWidget::event(event); } +//! [event handler] void ImageWidget::paintEvent(QPaintEvent*) { @@ -98,6 +102,7 @@ void ImageWidget::mouseDoubleClickEvent(QMouseEvent *) update(); } +//! [gesture event handler] bool ImageWidget::gestureEvent(QGestureEvent *event) { if (QGesture *pan = event->gesture(Qt::PanGesture)) { @@ -112,6 +117,7 @@ bool ImageWidget::gestureEvent(QGestureEvent *event) } return false; } +//! [gesture event handler] void ImageWidget::panTriggered(QPanGesture *gesture) { @@ -147,7 +153,7 @@ void ImageWidget::pinchTriggered(QPinchGesture *gesture) update(); } -//! [swipe slot] +//! [swipe function] void ImageWidget::swipeTriggered(QSwipeGesture *gesture) { if (gesture->horizontalDirection() == QSwipeGesture::Left @@ -157,7 +163,7 @@ void ImageWidget::swipeTriggered(QSwipeGesture *gesture) goNextImage(); update(); } -//! [swipe slot] +//! [swipe function] void ImageWidget::resizeEvent(QResizeEvent*) { diff --git a/examples/gestures/imageviewer/main.cpp b/examples/gestures/imageviewer/main.cpp index c3d03f3..9c99f31 100644 --- a/examples/gestures/imageviewer/main.cpp +++ b/examples/gestures/imageviewer/main.cpp @@ -41,36 +41,7 @@ #include -#include "imagewidget.h" - -class MainWidget : public QMainWindow -{ - Q_OBJECT - -public: - MainWidget(QWidget *parent = 0); - -public slots: - void openDirectory(const QString &path); - -private: - bool loadImage(const QString &fileName); - - ImageWidget *imageWidget; -}; - -MainWidget::MainWidget(QWidget *parent) - : QMainWindow(parent) -{ - resize(400, 300); - imageWidget = new ImageWidget(this); - setCentralWidget(imageWidget); -} - -void MainWidget::openDirectory(const QString &path) -{ - imageWidget->openDirectory(path); -} +#include "mainwidget.h" int main(int argc, char *argv[]) { @@ -86,5 +57,3 @@ int main(int argc, char *argv[]) return app.exec(); } - -#include "main.moc" diff --git a/examples/gestures/imageviewer/mainwidget.cpp b/examples/gestures/imageviewer/mainwidget.cpp new file mode 100644 index 0000000..51e9f1e --- /dev/null +++ b/examples/gestures/imageviewer/mainwidget.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "imagewidget.h" +#include "mainwidget.h" + +MainWidget::MainWidget(QWidget *parent) + : QMainWindow(parent) +{ + resize(400, 300); + imageWidget = new ImageWidget(this); + setCentralWidget(imageWidget); +} + +void MainWidget::openDirectory(const QString &path) +{ + imageWidget->openDirectory(path); +} diff --git a/examples/gestures/imageviewer/mainwidget.h b/examples/gestures/imageviewer/mainwidget.h new file mode 100644 index 0000000..1a99155 --- /dev/null +++ b/examples/gestures/imageviewer/mainwidget.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWIDGET_H +#define MAINWIDGET_H + +#include + +class MainWidget : public QMainWindow +{ + Q_OBJECT + +public: + MainWidget(QWidget *parent = 0); + +public slots: + void openDirectory(const QString &path); + +private: + bool loadImage(const QString &fileName); + + ImageWidget *imageWidget; +}; + +#endif diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 3639a45..6231d19 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -51,11 +51,14 @@ QT_BEGIN_NAMESPACE \brief The QGesture class represents a gesture, containing properties that describe the corresponding user input. - QGesture objects are delivered to widgets and \l{QGraphicsObject}s with - \l{QGestureEvent}s. + Gesture objects are not constructed directly by developers. They are created by + the QGestureRecognizer object that is registered with the application; see + QApplication::registerGestureRecognizer(). + + \section1 Gesture Properties The class has a list of properties that can be queried by the user to get - some gesture-specific arguments. For example, the QPinchGesture gesture has a scale + some gesture-specific arguments. For example, the pinch gesture has a scale factor that is exposed as a property. Developers of custom gesture recognizers can add additional properties in @@ -63,6 +66,23 @@ QT_BEGIN_NAMESPACE by adding new dynamic properties to a QGesture object, or by subclassing the QGesture class (or one of its subclasses). + \section1 Lifecycle of a Gesture Object + + A QGesture instance is created when the application calls QWidget::grabGesture() + or QGraphicsObject::grabGesture() to configure a widget or graphics object (the + target object) for gesture input. One gesture object is created for each target + object. + + The registered gesture recognizer monitors the input events for the target + object via its \l{QGestureRecognizer::}{filterEvent()} function, updating the + properties of the gesture object as required. + + The gesture object may be delivered to the target object in a QGestureEvent if + the corresponding gesture is active or has just been canceled. Each event that + is delivered contains a list of gesture objects, since support for more than + one gesture may be enabled for the target object. Due to the way events are + handled in Qt, gesture events may be filtered by other objects. + \sa QGestureEvent, QGestureRecognizer */ diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp index 2af087f..1998cba 100644 --- a/src/gui/kernel/qgesturerecognizer.cpp +++ b/src/gui/kernel/qgesturerecognizer.cpp @@ -65,9 +65,11 @@ QT_BEGIN_NAMESPACE about the user's input. Gestures are created when the framework calls createGesture() to handle user input - for a particular target QWidget or QGraphicsObject instance. Once a QGesture has been - created for one of these objects, the gesture recognizer will receive events for it - in its filterEvent() handler function. + for a particular instance of a QWidget or QGraphicsObject subclass. A QGesture object + is created for each widget or item that is configured to use gestures. + + Once a QGesture has been created for a target object, the gesture recognizer will + receive events for it in its filterEvent() handler function. When a gesture is canceled, the reset() function is called, giving the recognizer the chance to update the appropriate properties in the corresponding QGesture object. @@ -75,15 +77,18 @@ QT_BEGIN_NAMESPACE \section1 Supporting New Gestures To add support for new gestures, you need to derive from QGestureRecognizer to create - a custom recognizer class and register it with the application by calling - QApplication::registerGestureRecognizer(). You can also derive from QGesture to create - a custom gesture class, or rely on dynamic properties to express specific details - of the gesture you want to handle. + a custom recognizer class, construct an instance of this class, and register it with + the application by calling QApplication::registerGestureRecognizer(). You can also + subclass QGesture to create a custom gesture class, or rely on dynamic properties + to express specific details of the gesture you want to handle. Your custom QGestureRecognizer subclass needs to reimplement the filterEvent() function to handle and filter the incoming input events for QWidget and QGraphicsObject subclasses. - Although the logic for gesture recognition is implemented in this function, the state of - recognition for each target object can be recorded in the QGesture object supplied. + Although the logic for gesture recognition is implemented in this function, you can + store persistent information about the state of the recognition process in the QGesture + object supplied. The filterEvent() function must return a value of Qt::GestureState that + indicates the state of recognition for a given gesture and target object. This determines + whether or not a gesture event will be delivered to a target object. If you choose to represent a gesture by a custom QGesture subclass, you will need to reimplement the createGesture() function to construct instances of your gesture class. -- cgit v0.12 From f0688de89cb82f6d3715bb03d7706fca4e6ab86f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 13 Oct 2009 19:26:35 +0200 Subject: Doc: Moving the Image Gestures example. Reviewed-by: Trust Me --- examples/gestures/gestures.pro | 2 +- examples/gestures/imagegestures/imagegestures.pro | 16 ++ examples/gestures/imagegestures/imagewidget.cpp | 268 ++++++++++++++++++++++ examples/gestures/imagegestures/imagewidget.h | 98 ++++++++ examples/gestures/imagegestures/main.cpp | 59 +++++ examples/gestures/imagegestures/mainwidget.cpp | 56 +++++ examples/gestures/imagegestures/mainwidget.h | 63 +++++ examples/gestures/imageviewer/imageviewer.pro | 16 -- examples/gestures/imageviewer/imagewidget.cpp | 268 ---------------------- examples/gestures/imageviewer/imagewidget.h | 98 -------- examples/gestures/imageviewer/main.cpp | 59 ----- examples/gestures/imageviewer/mainwidget.cpp | 56 ----- examples/gestures/imageviewer/mainwidget.h | 63 ----- 13 files changed, 561 insertions(+), 561 deletions(-) create mode 100644 examples/gestures/imagegestures/imagegestures.pro create mode 100644 examples/gestures/imagegestures/imagewidget.cpp create mode 100644 examples/gestures/imagegestures/imagewidget.h create mode 100644 examples/gestures/imagegestures/main.cpp create mode 100644 examples/gestures/imagegestures/mainwidget.cpp create mode 100644 examples/gestures/imagegestures/mainwidget.h delete mode 100644 examples/gestures/imageviewer/imageviewer.pro delete mode 100644 examples/gestures/imageviewer/imagewidget.cpp delete mode 100644 examples/gestures/imageviewer/imagewidget.h delete mode 100644 examples/gestures/imageviewer/main.cpp delete mode 100644 examples/gestures/imageviewer/mainwidget.cpp delete mode 100644 examples/gestures/imageviewer/mainwidget.h diff --git a/examples/gestures/gestures.pro b/examples/gestures/gestures.pro index 09cd56a..e3978b6 100644 --- a/examples/gestures/gestures.pro +++ b/examples/gestures/gestures.pro @@ -1,7 +1,7 @@ TEMPLATE = \ subdirs SUBDIRS = \ - imageviewer + imagegestures # install target.path = $$[QT_INSTALL_EXAMPLES]/gestures diff --git a/examples/gestures/imagegestures/imagegestures.pro b/examples/gestures/imagegestures/imagegestures.pro new file mode 100644 index 0000000..7780ad9 --- /dev/null +++ b/examples/gestures/imagegestures/imagegestures.pro @@ -0,0 +1,16 @@ +HEADERS = imagewidget.h \ + mainwidget.h +SOURCES = imagewidget.cpp \ + main.cpp \ + mainwidget.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer +sources.files = $$SOURCES \ + $$HEADERS \ + $$RESOURCES \ + $$FORMS \ + imageviewer.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer +INSTALLS += target \ + sources diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp new file mode 100644 index 0000000..c4a4e50 --- /dev/null +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -0,0 +1,268 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "imagewidget.h" + +#include + +ImageWidget::ImageWidget(QWidget *parent) + : QWidget(parent), + position(0), + horizontalOffset(0), + verticalOffset(0), + rotationAngle(0), + scaleFactor(1) + +{ + setObjectName("ImageWidget"); + setMinimumSize(QSize(100,100)); + + setAttribute(Qt::WA_PaintOnScreen); + setAttribute(Qt::WA_OpaquePaintEvent); + setAttribute(Qt::WA_NoSystemBackground); + +//! [enable gestures] + grabGesture(Qt::PanGesture); + grabGesture(Qt::PinchGesture); + grabGesture(Qt::SwipeGesture); +//! [enable gestures] +} + +//! [event handler] +bool ImageWidget::event(QEvent *event) +{ + if (event->type() == QEvent::Gesture) + return gestureEvent(static_cast(event)); + return QWidget::event(event); +} +//! [event handler] + +void ImageWidget::paintEvent(QPaintEvent*) +{ + QPainter p(this); + p.fillRect(rect(), Qt::white); + + float iw = currentImage.width(); + float ih = currentImage.height(); + float wh = height(); + float ww = width(); + + p.translate(ww/2, wh/2); + p.translate(horizontalOffset, verticalOffset); + p.rotate(rotationAngle); + p.scale(scaleFactor, scaleFactor); + p.translate(-iw/2, -ih/2); + p.drawImage(0, 0, currentImage); +} + +void ImageWidget::mouseDoubleClickEvent(QMouseEvent *) +{ + rotationAngle = 0; + scaleFactor = 1; + verticalOffset = 0; + horizontalOffset = 0; + update(); +} + +//! [gesture event handler] +bool ImageWidget::gestureEvent(QGestureEvent *event) +{ + if (QGesture *pan = event->gesture(Qt::PanGesture)) { + panTriggered(static_cast(pan)); + return true; + } else if (QGesture *pinch = event->gesture(Qt::PinchGesture)) { + pinchTriggered(static_cast(pinch)); + return true; + } else if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) { + swipeTriggered(static_cast(swipe)); + return true; + } + return false; +} +//! [gesture event handler] + +void ImageWidget::panTriggered(QPanGesture *gesture) +{ +#ifndef QT_NO_CURSOR + switch (gesture->state()) { + case Qt::GestureStarted: + case Qt::GestureUpdated: + setCursor(Qt::SizeAllCursor); + break; + default: + setCursor(Qt::ArrowCursor); + } +#endif + QSizeF lastOffset = gesture->offset(); + horizontalOffset += lastOffset.width(); + verticalOffset += lastOffset.height(); + update(); +} + +void ImageWidget::pinchTriggered(QPinchGesture *gesture) +{ + QPinchGesture::WhatChanged whatChanged = gesture->whatChanged(); + if (whatChanged & QPinchGesture::RotationAngleChanged) { + qreal value = gesture->property("rotationAngle").toReal(); + qreal lastValue = gesture->property("lastRotationAngle").toReal(); + rotationAngle += value - lastValue; + } + if (whatChanged & QPinchGesture::ScaleFactorChanged) { + qreal value = gesture->property("scaleFactor").toReal(); + qreal lastValue = gesture->property("lastScaleFactor").toReal(); + scaleFactor += value - lastValue; + } + update(); +} + +//! [swipe function] +void ImageWidget::swipeTriggered(QSwipeGesture *gesture) +{ + if (gesture->horizontalDirection() == QSwipeGesture::Left + || gesture->verticalDirection() == QSwipeGesture::Up) + goPrevImage(); + else + goNextImage(); + update(); +} +//! [swipe function] + +void ImageWidget::resizeEvent(QResizeEvent*) +{ + update(); +} + +void ImageWidget::openDirectory(const QString &path) +{ + this->path = path; + QDir dir(path); + QStringList nameFilters; + nameFilters << "*.jpg" << "*.png"; + files = dir.entryList(nameFilters, QDir::Files|QDir::Readable, QDir::Name); + + position = 0; + goToImage(0); + update(); +} + +QImage ImageWidget::loadImage(const QString &fileName) +{ + QImageReader reader(fileName); + if (!reader.canRead()) { + qDebug() << fileName << ": can't load image"; + return QImage(); + } + + QImage image; + if (!reader.read(&image)) { + qDebug() << fileName << ": corrupted image"; + return QImage(); + } + return image; +} + +void ImageWidget::goNextImage() +{ + if (files.isEmpty()) + return; + + if (position < files.size()-1) { + ++position; + prevImage = currentImage; + currentImage = nextImage; + if (position+1 < files.size()) + nextImage = loadImage(path+QLatin1String("/")+files.at(position+1)); + else + nextImage = QImage(); + } + update(); +} + +void ImageWidget::goPrevImage() +{ + if (files.isEmpty()) + return; + + if (position > 0) { + --position; + nextImage = currentImage; + currentImage = prevImage; + if (position > 0) + prevImage = loadImage(path+QLatin1String("/")+files.at(position-1)); + else + prevImage = QImage(); + } + update(); +} + +void ImageWidget::goToImage(int index) +{ + if (files.isEmpty()) + return; + + if (index < 0 || index >= files.size()) { + qDebug() << "goToImage: invalid index: " << index; + return; + } + + if (index == position+1) { + goNextImage(); + return; + } + + if (position > 0 && index == position-1) { + goPrevImage(); + return; + } + + position = index; + + if (index > 0) + prevImage = loadImage(path+QLatin1String("/")+files.at(position-1)); + else + prevImage = QImage(); + currentImage = loadImage(path+QLatin1String("/")+files.at(position)); + if (position+1 < files.size()) + nextImage = loadImage(path+QLatin1String("/")+files.at(position+1)); + else + nextImage = QImage(); + update(); +} diff --git a/examples/gestures/imagegestures/imagewidget.h b/examples/gestures/imagegestures/imagewidget.h new file mode 100644 index 0000000..7b91fbf --- /dev/null +++ b/examples/gestures/imagegestures/imagewidget.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef IMAGEWIDGET_H +#define IMAGEWIDGET_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE +class QGestureEvent; +class QPanGesture; +class QPinchGesture; +class QSwipeGesture; +QT_END_NAMESPACE + +class ImageWidget : public QWidget +{ + Q_OBJECT + +public: + ImageWidget(QWidget *parent = 0); + + void openDirectory(const QString &path); + +protected: + bool event(QEvent*); + bool gestureEvent(QGestureEvent*); + void paintEvent(QPaintEvent*); + void resizeEvent(QResizeEvent*); + void mouseDoubleClickEvent(QMouseEvent*); + +private: + void panTriggered(QPanGesture*); + void pinchTriggered(QPinchGesture*); + void swipeTriggered(QSwipeGesture*); + +private: + void updateImage(); + QImage loadImage(const QString &fileName); + void loadImage(); + void goNextImage(); + void goPrevImage(); + void goToImage(int index); + + QString path; + QStringList files; + int position; + + QImage prevImage, nextImage; + QImage currentImage; + + float horizontalOffset; + float verticalOffset; + float rotationAngle; + float scaleFactor; +}; + +#endif diff --git a/examples/gestures/imagegestures/main.cpp b/examples/gestures/imagegestures/main.cpp new file mode 100644 index 0000000..9c99f31 --- /dev/null +++ b/examples/gestures/imagegestures/main.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "mainwidget.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + MainWidget w; + w.show(); + + if (QApplication::arguments().size() > 1) + w.openDirectory(QApplication::arguments().at(1)); + else + w.openDirectory(QFileDialog::getExistingDirectory(0, "Select image folder")); + + return app.exec(); +} diff --git a/examples/gestures/imagegestures/mainwidget.cpp b/examples/gestures/imagegestures/mainwidget.cpp new file mode 100644 index 0000000..51e9f1e --- /dev/null +++ b/examples/gestures/imagegestures/mainwidget.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "imagewidget.h" +#include "mainwidget.h" + +MainWidget::MainWidget(QWidget *parent) + : QMainWindow(parent) +{ + resize(400, 300); + imageWidget = new ImageWidget(this); + setCentralWidget(imageWidget); +} + +void MainWidget::openDirectory(const QString &path) +{ + imageWidget->openDirectory(path); +} diff --git a/examples/gestures/imagegestures/mainwidget.h b/examples/gestures/imagegestures/mainwidget.h new file mode 100644 index 0000000..1a99155 --- /dev/null +++ b/examples/gestures/imagegestures/mainwidget.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWIDGET_H +#define MAINWIDGET_H + +#include + +class MainWidget : public QMainWindow +{ + Q_OBJECT + +public: + MainWidget(QWidget *parent = 0); + +public slots: + void openDirectory(const QString &path); + +private: + bool loadImage(const QString &fileName); + + ImageWidget *imageWidget; +}; + +#endif diff --git a/examples/gestures/imageviewer/imageviewer.pro b/examples/gestures/imageviewer/imageviewer.pro deleted file mode 100644 index 7780ad9..0000000 --- a/examples/gestures/imageviewer/imageviewer.pro +++ /dev/null @@ -1,16 +0,0 @@ -HEADERS = imagewidget.h \ - mainwidget.h -SOURCES = imagewidget.cpp \ - main.cpp \ - mainwidget.cpp - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer -sources.files = $$SOURCES \ - $$HEADERS \ - $$RESOURCES \ - $$FORMS \ - imageviewer.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer -INSTALLS += target \ - sources diff --git a/examples/gestures/imageviewer/imagewidget.cpp b/examples/gestures/imageviewer/imagewidget.cpp deleted file mode 100644 index c4a4e50..0000000 --- a/examples/gestures/imageviewer/imagewidget.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "imagewidget.h" - -#include - -ImageWidget::ImageWidget(QWidget *parent) - : QWidget(parent), - position(0), - horizontalOffset(0), - verticalOffset(0), - rotationAngle(0), - scaleFactor(1) - -{ - setObjectName("ImageWidget"); - setMinimumSize(QSize(100,100)); - - setAttribute(Qt::WA_PaintOnScreen); - setAttribute(Qt::WA_OpaquePaintEvent); - setAttribute(Qt::WA_NoSystemBackground); - -//! [enable gestures] - grabGesture(Qt::PanGesture); - grabGesture(Qt::PinchGesture); - grabGesture(Qt::SwipeGesture); -//! [enable gestures] -} - -//! [event handler] -bool ImageWidget::event(QEvent *event) -{ - if (event->type() == QEvent::Gesture) - return gestureEvent(static_cast(event)); - return QWidget::event(event); -} -//! [event handler] - -void ImageWidget::paintEvent(QPaintEvent*) -{ - QPainter p(this); - p.fillRect(rect(), Qt::white); - - float iw = currentImage.width(); - float ih = currentImage.height(); - float wh = height(); - float ww = width(); - - p.translate(ww/2, wh/2); - p.translate(horizontalOffset, verticalOffset); - p.rotate(rotationAngle); - p.scale(scaleFactor, scaleFactor); - p.translate(-iw/2, -ih/2); - p.drawImage(0, 0, currentImage); -} - -void ImageWidget::mouseDoubleClickEvent(QMouseEvent *) -{ - rotationAngle = 0; - scaleFactor = 1; - verticalOffset = 0; - horizontalOffset = 0; - update(); -} - -//! [gesture event handler] -bool ImageWidget::gestureEvent(QGestureEvent *event) -{ - if (QGesture *pan = event->gesture(Qt::PanGesture)) { - panTriggered(static_cast(pan)); - return true; - } else if (QGesture *pinch = event->gesture(Qt::PinchGesture)) { - pinchTriggered(static_cast(pinch)); - return true; - } else if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) { - swipeTriggered(static_cast(swipe)); - return true; - } - return false; -} -//! [gesture event handler] - -void ImageWidget::panTriggered(QPanGesture *gesture) -{ -#ifndef QT_NO_CURSOR - switch (gesture->state()) { - case Qt::GestureStarted: - case Qt::GestureUpdated: - setCursor(Qt::SizeAllCursor); - break; - default: - setCursor(Qt::ArrowCursor); - } -#endif - QSizeF lastOffset = gesture->offset(); - horizontalOffset += lastOffset.width(); - verticalOffset += lastOffset.height(); - update(); -} - -void ImageWidget::pinchTriggered(QPinchGesture *gesture) -{ - QPinchGesture::WhatChanged whatChanged = gesture->whatChanged(); - if (whatChanged & QPinchGesture::RotationAngleChanged) { - qreal value = gesture->property("rotationAngle").toReal(); - qreal lastValue = gesture->property("lastRotationAngle").toReal(); - rotationAngle += value - lastValue; - } - if (whatChanged & QPinchGesture::ScaleFactorChanged) { - qreal value = gesture->property("scaleFactor").toReal(); - qreal lastValue = gesture->property("lastScaleFactor").toReal(); - scaleFactor += value - lastValue; - } - update(); -} - -//! [swipe function] -void ImageWidget::swipeTriggered(QSwipeGesture *gesture) -{ - if (gesture->horizontalDirection() == QSwipeGesture::Left - || gesture->verticalDirection() == QSwipeGesture::Up) - goPrevImage(); - else - goNextImage(); - update(); -} -//! [swipe function] - -void ImageWidget::resizeEvent(QResizeEvent*) -{ - update(); -} - -void ImageWidget::openDirectory(const QString &path) -{ - this->path = path; - QDir dir(path); - QStringList nameFilters; - nameFilters << "*.jpg" << "*.png"; - files = dir.entryList(nameFilters, QDir::Files|QDir::Readable, QDir::Name); - - position = 0; - goToImage(0); - update(); -} - -QImage ImageWidget::loadImage(const QString &fileName) -{ - QImageReader reader(fileName); - if (!reader.canRead()) { - qDebug() << fileName << ": can't load image"; - return QImage(); - } - - QImage image; - if (!reader.read(&image)) { - qDebug() << fileName << ": corrupted image"; - return QImage(); - } - return image; -} - -void ImageWidget::goNextImage() -{ - if (files.isEmpty()) - return; - - if (position < files.size()-1) { - ++position; - prevImage = currentImage; - currentImage = nextImage; - if (position+1 < files.size()) - nextImage = loadImage(path+QLatin1String("/")+files.at(position+1)); - else - nextImage = QImage(); - } - update(); -} - -void ImageWidget::goPrevImage() -{ - if (files.isEmpty()) - return; - - if (position > 0) { - --position; - nextImage = currentImage; - currentImage = prevImage; - if (position > 0) - prevImage = loadImage(path+QLatin1String("/")+files.at(position-1)); - else - prevImage = QImage(); - } - update(); -} - -void ImageWidget::goToImage(int index) -{ - if (files.isEmpty()) - return; - - if (index < 0 || index >= files.size()) { - qDebug() << "goToImage: invalid index: " << index; - return; - } - - if (index == position+1) { - goNextImage(); - return; - } - - if (position > 0 && index == position-1) { - goPrevImage(); - return; - } - - position = index; - - if (index > 0) - prevImage = loadImage(path+QLatin1String("/")+files.at(position-1)); - else - prevImage = QImage(); - currentImage = loadImage(path+QLatin1String("/")+files.at(position)); - if (position+1 < files.size()) - nextImage = loadImage(path+QLatin1String("/")+files.at(position+1)); - else - nextImage = QImage(); - update(); -} diff --git a/examples/gestures/imageviewer/imagewidget.h b/examples/gestures/imageviewer/imagewidget.h deleted file mode 100644 index 7b91fbf..0000000 --- a/examples/gestures/imageviewer/imagewidget.h +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef IMAGEWIDGET_H -#define IMAGEWIDGET_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE -class QGestureEvent; -class QPanGesture; -class QPinchGesture; -class QSwipeGesture; -QT_END_NAMESPACE - -class ImageWidget : public QWidget -{ - Q_OBJECT - -public: - ImageWidget(QWidget *parent = 0); - - void openDirectory(const QString &path); - -protected: - bool event(QEvent*); - bool gestureEvent(QGestureEvent*); - void paintEvent(QPaintEvent*); - void resizeEvent(QResizeEvent*); - void mouseDoubleClickEvent(QMouseEvent*); - -private: - void panTriggered(QPanGesture*); - void pinchTriggered(QPinchGesture*); - void swipeTriggered(QSwipeGesture*); - -private: - void updateImage(); - QImage loadImage(const QString &fileName); - void loadImage(); - void goNextImage(); - void goPrevImage(); - void goToImage(int index); - - QString path; - QStringList files; - int position; - - QImage prevImage, nextImage; - QImage currentImage; - - float horizontalOffset; - float verticalOffset; - float rotationAngle; - float scaleFactor; -}; - -#endif diff --git a/examples/gestures/imageviewer/main.cpp b/examples/gestures/imageviewer/main.cpp deleted file mode 100644 index 9c99f31..0000000 --- a/examples/gestures/imageviewer/main.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "mainwidget.h" - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - MainWidget w; - w.show(); - - if (QApplication::arguments().size() > 1) - w.openDirectory(QApplication::arguments().at(1)); - else - w.openDirectory(QFileDialog::getExistingDirectory(0, "Select image folder")); - - return app.exec(); -} diff --git a/examples/gestures/imageviewer/mainwidget.cpp b/examples/gestures/imageviewer/mainwidget.cpp deleted file mode 100644 index 51e9f1e..0000000 --- a/examples/gestures/imageviewer/mainwidget.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "imagewidget.h" -#include "mainwidget.h" - -MainWidget::MainWidget(QWidget *parent) - : QMainWindow(parent) -{ - resize(400, 300); - imageWidget = new ImageWidget(this); - setCentralWidget(imageWidget); -} - -void MainWidget::openDirectory(const QString &path) -{ - imageWidget->openDirectory(path); -} diff --git a/examples/gestures/imageviewer/mainwidget.h b/examples/gestures/imageviewer/mainwidget.h deleted file mode 100644 index 1a99155..0000000 --- a/examples/gestures/imageviewer/mainwidget.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MAINWIDGET_H -#define MAINWIDGET_H - -#include - -class MainWidget : public QMainWindow -{ - Q_OBJECT - -public: - MainWidget(QWidget *parent = 0); - -public slots: - void openDirectory(const QString &path); - -private: - bool loadImage(const QString &fileName); - - ImageWidget *imageWidget; -}; - -#endif -- cgit v0.12 From 20fd14900702103442ee95dd025706c6f263c6f6 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 16 Oct 2009 17:07:48 +0200 Subject: Doc: Documentation for gesture features. Still a moving target. Reviewed-by: Trust Me --- doc/src/diagrams/gestures/pangesture.svg | 273 +++++++++++++++++ doc/src/diagrams/gestures/pinchgesture.svg | 341 +++++++++++++++++++++ doc/src/diagrams/gestures/swipegesture-details.svg | 168 ++++++++++ doc/src/diagrams/gestures/swipegesture.svg | 158 ++++++++++ doc/src/frameworks-technologies/gestures.qdoc | 20 +- doc/src/images/pangesture.png | Bin 0 -> 7153 bytes doc/src/images/pinchgesture.png | Bin 0 -> 10094 bytes doc/src/images/swipegesture.png | Bin 0 -> 6864 bytes examples/gestures/imagegestures/imagewidget.cpp | 7 +- examples/gestures/imagegestures/imagewidget.h | 16 +- examples/gestures/imagegestures/mainwidget.h | 2 + src/gui/kernel/qapplication.cpp | 2 +- src/gui/kernel/qevent.cpp | 42 +++ src/gui/kernel/qgesture.cpp | 242 ++++++++++++++- src/gui/kernel/qgesturerecognizer.cpp | 1 + 15 files changed, 1246 insertions(+), 26 deletions(-) create mode 100644 doc/src/diagrams/gestures/pangesture.svg create mode 100644 doc/src/diagrams/gestures/pinchgesture.svg create mode 100644 doc/src/diagrams/gestures/swipegesture-details.svg create mode 100644 doc/src/diagrams/gestures/swipegesture.svg create mode 100644 doc/src/images/pangesture.png create mode 100644 doc/src/images/pinchgesture.png create mode 100644 doc/src/images/swipegesture.png diff --git a/doc/src/diagrams/gestures/pangesture.svg b/doc/src/diagrams/gestures/pangesture.svg new file mode 100644 index 0000000..c5b95ca --- /dev/null +++ b/doc/src/diagrams/gestures/pangesture.svg @@ -0,0 +1,273 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/src/diagrams/gestures/pinchgesture.svg b/doc/src/diagrams/gestures/pinchgesture.svg new file mode 100644 index 0000000..1c520b9 --- /dev/null +++ b/doc/src/diagrams/gestures/pinchgesture.svg @@ -0,0 +1,341 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/src/diagrams/gestures/swipegesture-details.svg b/doc/src/diagrams/gestures/swipegesture-details.svg new file mode 100644 index 0000000..0f7de5b --- /dev/null +++ b/doc/src/diagrams/gestures/swipegesture-details.svg @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/doc/src/diagrams/gestures/swipegesture.svg b/doc/src/diagrams/gestures/swipegesture.svg new file mode 100644 index 0000000..fc60a4d --- /dev/null +++ b/doc/src/diagrams/gestures/swipegesture.svg @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc index e5947a2..a619fe8 100644 --- a/doc/src/frameworks-technologies/gestures.qdoc +++ b/doc/src/frameworks-technologies/gestures.qdoc @@ -41,10 +41,9 @@ /*! \page gestures-overview.html - \startpage index.html Qt Reference Documentation - \title Gestures Programming \ingroup frameworks-technologies + \startpage index.html Qt Reference Documentation \brief An overview of the Qt support for Gesture programming. @@ -60,10 +59,11 @@ \section1 Overview QGesture is the central class in Qt's gesture framework, providing a container - for information about gestures performed by the user, such as panning, pinching - and swiping. QGesture exposes properties that give general information that is - common to all gestures, and these can be extended to provide additional - gesture-specific information. + for information about gestures performed by the user. QGesture exposes + properties that give general information that is common to all gestures, and + these can be extended to provide additional gesture-specific information. + Common panning, pinching and swiping gestures are represented by specialized + classes: QPanGesture, QPinchGesture and QSwipeGesture. Developers can also implement new gestures by subclassing and extending the QGestureRecognizer class. Adding support for a new gesture involves implementing @@ -80,7 +80,7 @@ required gesture type. The standard types are defined by the Qt::GestureType enum and include many commonly used gestures. - \snippet examples/gestures/imageviewer/imagewidget.cpp enable gestures + \snippet examples/gestures/imagegestures/imagewidget.cpp enable gestures In the above code, the gesture is set up in the constructor of the target object itself. @@ -93,18 +93,18 @@ \l{QWidget::}{event()} handler function and delegates gesture events to a specialized gestureEvent() function: - \snippet examples/gestures/imageviewer/imagewidget.cpp event handler + \snippet examples/gestures/imagegestures/imagewidget.cpp event handler The gesture events delivered to the target object can be examined individually and dealt with appropriately: - \snippet examples/gestures/imageviewer/imagewidget.cpp gesture event handler + \snippet examples/gestures/imagegestures/imagewidget.cpp gesture event handler Responding to a gesture is simply a matter of obtaining the QGesture object delivered in the QGestureEvent sent to the target object and examining the information it contains. - \snippet examples/gestures/imageviewer/imagewidget.cpp swipe function + \snippet examples/gestures/imagegestures/imagewidget.cpp swipe function Here, we examine the direction in which the user swiped the widget and modify its contents accordingly. diff --git a/doc/src/images/pangesture.png b/doc/src/images/pangesture.png new file mode 100644 index 0000000..24caf91 Binary files /dev/null and b/doc/src/images/pangesture.png differ diff --git a/doc/src/images/pinchgesture.png b/doc/src/images/pinchgesture.png new file mode 100644 index 0000000..95614c4 Binary files /dev/null and b/doc/src/images/pinchgesture.png differ diff --git a/doc/src/images/swipegesture.png b/doc/src/images/swipegesture.png new file mode 100644 index 0000000..0b7d35a Binary files /dev/null and b/doc/src/images/swipegesture.png differ diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index c4a4e50..95525c5 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -43,6 +43,7 @@ #include +//! [constructor] ImageWidget::ImageWidget(QWidget *parent) : QWidget(parent), position(0), @@ -52,19 +53,15 @@ ImageWidget::ImageWidget(QWidget *parent) scaleFactor(1) { - setObjectName("ImageWidget"); setMinimumSize(QSize(100,100)); - setAttribute(Qt::WA_PaintOnScreen); - setAttribute(Qt::WA_OpaquePaintEvent); - setAttribute(Qt::WA_NoSystemBackground); - //! [enable gestures] grabGesture(Qt::PanGesture); grabGesture(Qt::PinchGesture); grabGesture(Qt::SwipeGesture); //! [enable gestures] } +//! [constructor] //! [event handler] bool ImageWidget::event(QEvent *event) diff --git a/examples/gestures/imagegestures/imagewidget.h b/examples/gestures/imagegestures/imagewidget.h index 7b91fbf..56e2316 100644 --- a/examples/gestures/imagegestures/imagewidget.h +++ b/examples/gestures/imagegestures/imagewidget.h @@ -53,28 +53,28 @@ class QPinchGesture; class QSwipeGesture; QT_END_NAMESPACE +//! [class definition begin] class ImageWidget : public QWidget { Q_OBJECT public: ImageWidget(QWidget *parent = 0); - void openDirectory(const QString &path); protected: - bool event(QEvent*); - bool gestureEvent(QGestureEvent*); - void paintEvent(QPaintEvent*); - void resizeEvent(QResizeEvent*); - void mouseDoubleClickEvent(QMouseEvent*); + bool event(QEvent *event); + void paintEvent(QPaintEvent *event); + void resizeEvent(QResizeEvent *event); + void mouseDoubleClickEvent(QMouseEvent *event); private: + bool gestureEvent(QGestureEvent *event); void panTriggered(QPanGesture*); void pinchTriggered(QPinchGesture*); void swipeTriggered(QSwipeGesture*); +//! [class definition begin] -private: void updateImage(); QImage loadImage(const QString &fileName); void loadImage(); @@ -93,6 +93,8 @@ private: float verticalOffset; float rotationAngle; float scaleFactor; +//! [class definition end] }; +//! [class definition end] #endif diff --git a/examples/gestures/imagegestures/mainwidget.h b/examples/gestures/imagegestures/mainwidget.h index 1a99155..71b09b0 100644 --- a/examples/gestures/imagegestures/mainwidget.h +++ b/examples/gestures/imagegestures/mainwidget.h @@ -44,6 +44,8 @@ #include +class ImageWidget; + class MainWidget : public QMainWindow { Q_OBJECT diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index b990fe2..6f6d706 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -5643,7 +5643,7 @@ Qt::GestureType QApplication::registerGestureRecognizer(QGestureRecognizer *reco Unregisters all gesture recognizers of the specified \a type. - \sa registerGestureRecognizer + \sa registerGestureRecognizer() */ void QApplication::unregisterGestureRecognizer(Qt::GestureType type) { diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 4826704..2ff6d65 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3563,6 +3563,7 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar) \brief The QTouchEvent class contains parameters that describe a touch event. \since 4.6 \ingroup events + \ingroup multitouch \section1 Enabling Touch Events @@ -4195,6 +4196,7 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T \class QGestureEvent \since 4.6 \ingroup events + \ingroup gestures \brief The QGestureEvent class provides the description of triggered gestures. @@ -4316,4 +4318,44 @@ bool QGestureEvent::isAccepted(QGesture *gesture) const return gesture ? gesture->d_func()->accept : false; } +#ifdef Q_NO_USING_KEYWORD +/*! + \fn void QGestureEvent::setAccepted(bool accepted) + + Sets or clears the event's internal flag that determines whether it should + be delivered to other objects. + + Calling this function with a value of true for \a accepted indicates that the + caller has accepted the event and that it should not be propagated further. + Calling this function with a value of false indicates that the caller has + ignored the event and that it should be delivered to other objects. + + For convenience, the accept flag can also be set with accept(), and cleared + with ignore(). + + \sa QEvent::accepted +*/ +/*! + \fn bool QGestureEvent::isAccepted() const + + Returns true is the event has been accepted; otherwise returns false. + + \sa QEvent::accepted +*/ +/*! + \fn void QGestureEvent::accept() + + Accepts the event, the equivalent of calling setAccepted(true). + + \sa QEvent::accept() +*/ +/*! + \fn void QGestureEvent::ignore() + + Ignores the event, the equivalent of calling setAccepted(false). + + \sa QEvent::ignore() +*/ +#endif + QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 6231d19..fc8df49 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -47,6 +47,7 @@ QT_BEGIN_NAMESPACE /*! \class QGesture \since 4.6 + \ingroup gestures \brief The QGesture class represents a gesture, containing properties that describe the corresponding user input. @@ -185,8 +186,55 @@ void QGesture::unsetHotSpot() d_func()->isHotSpotSet = false; } -// QPanGesture +/*! + \class QPanGesture + \since 4.6 + \brief The QPanGesture class describes a panning gesture made by the user. + \ingroup gestures + + \image pangesture.png + + \sa {Gestures Programming}, QPinchGesture, QSwipeGesture +*/ + +/*! + \property QPanGesture::totalOffset + \brief the total offset from the first input position to the current input + position + + The total offset measures the total change in position of the user's input + covered by the gesture on the input device. +*/ + +/*! + \property QPanGesture::lastOffset + \brief the last offset recorded for this gesture + + The last offset contains the change in position of the user's input as + reported in the \l offset property when a previous gesture event was + delivered for this gesture. + + If no previous event was delivered with information about this gesture + (i.e., this gesture object contains information about the first movement + in the gesture) then this property contains a zero size. +*/ +/*! + \property QPanGesture::offset + \brief the offset from the previous input position to the current input + position + + The offset measures the change in position of the user's input on the + input device. +*/ + +/*! + \property QPanGesture::acceleration +*/ + +/*! + \internal +*/ QPanGesture::QPanGesture(QObject *parent) : QGesture(*new QPanGesturePrivate, parent) { @@ -234,8 +282,139 @@ void QPanGesture::setAcceleration(qreal value) d_func()->acceleration = value; } -// QPinchGesture +/*! + \class QPinchGesture + \since 4.6 + \brief The QPinchGesture class describes a pinch gesture made my the user. + \ingroup multitouch + \ingroup gestures + + A pinch gesture is a form of multitouch user input in which the user typically + touches two points on the input device with a thumb and finger, before moving + them closer together or further apart to change the scale factor, zoom, or level + of detail of the user interface. + + \image pinchgesture.png + + Instead of repeatedly applying the same pinching gesture, the user may + continue to touch the input device in one place, and apply a second touch + to a new point, continuing the gesture. When this occurs, gesture events + will continue to be delivered to the target object, containing an instance + of QPinchGesture in the Qt::GestureUpdated state. + + \sa {Gestures Programming}, QPanGesture, QSwipeGesture +*/ + +/*! + \enum QPinchGesture::WhatChange + + This enum describes the changes that can occur to the properties of + the gesture object. + + \value ScaleFactorChanged The scale factor held by scaleFactor changed. + \value RotationAngleChanged The rotation angle held by rotationAngle changed. + \value CenterPointChanged The center point held by centerPoint changed. + + \sa whatChanged +*/ + +/*! + \property QPinchGesture::whatChanged + \brief the property of the gesture that has changed + + This property indicates which of the other properties has changed since + the previous gesture event included information about this gesture. You + can use this information to determine which aspect of your user interface + needs to be updated. + + \sa scaleFactor, rotationAngle, centerPoint +*/ + +/*! + \property QPinchGesture::totalScaleFactor + \brief the total scale factor + + The total scale factor measures the total change in scale factor from the + original value to the current scale factor. + + \sa scaleFactor, lastScaleFactor +*/ +/*! + \property QPinchGesture::lastScaleFactor + \brief the last scale factor recorded for this gesture + + The last scale factor contains the scale factor reported in the + \l scaleFactor property when a previous gesture event included + information about this gesture. + + If no previous event was delivered with information about this gesture + (i.e., this gesture object contains information about the first movement + in the gesture) then this property contains zero. + + \sa scaleFactor, totalScaleFactor +*/ +/*! + \property QPinchGesture::scaleFactor + \brief the current scale factor + + The scale factor measures the scale factor associated with the distance + between two of the user's inputs on a multitouch device. + + \sa totalScaleFactor, lastScaleFactor +*/ +/*! + \property QPinchGesture::totalRotationAngle + \brief the total angle covered by the gesture + + This total angle measures the complete angle covered by the gesture. Usually, this + is equal to the value held by the \l rotationAngle property, except in the case where + the user performs multiple rotations by removing and repositioning one of the touch + points, as described above. In this case, the total angle will be the sum of the + rotation angles for the multiple stages of the gesture. + + \sa rotationAngle, lastRotationAngle +*/ +/*! + \property QPinchGesture::lastRotationAngle + \brief the last reported angle covered by the gesture motion + + The last rotation angle is the angle as reported in the \l rotationAngle property + when a previous gesture event was delivered for this gesture. + + \sa rotationAngle, totalRotationAngle +*/ +/*! + \property QPinchGesture::rotationAngle + \brief the angle covered by the gesture motion + + \sa totalRotationAngle, lastRotationAngle +*/ + +/*! + \property QPinchGesture::startCenterPoint + \brief the starting position of the center point + + \sa centerPoint, lastCenterPoint +*/ +/*! + \property QPinchGesture::lastCenterPoint + \brief the last position of the center point recorded for this gesture + + \sa centerPoint, startCenterPoint +*/ +/*! + \property QPinchGesture::centerPoint + \brief the current center point + + The center point is the midpoint between the two input points in the gesture. + + \sa startCenterPoint, lastCenterPoint +*/ + +/*! + \internal +*/ QPinchGesture::QPinchGesture(QObject *parent) : QGesture(*new QPinchGesturePrivate, parent) { @@ -345,8 +524,65 @@ void QPinchGesture::setRotationAngle(qreal value) d_func()->rotationAngle = value; } -// QSwipeGesture +/*! + \class QSwipeGesture + \since 4.6 + \brief The QSwipeGesture class describes a swipe gesture made by the user. + \ingroup gestures + + \image swipegesture.png + + \sa {Gestures Programming}, QPanGesture, QPinchGesture +*/ + +/*! + \enum QSwipeGesture::SwipeDirection + + This enum describes the possible directions for the gesture's motion + along the horizontal and vertical axes. + + \value NoDirection The gesture had no motion associated with it on a particular axis. + \value Left The gesture involved a horizontal motion to the left. + \value Right The gesture involved a horizontal motion to the right. + \value Up The gesture involved an upward vertical motion. + \value Down The gesture involved a downward vertical motion. +*/ + +/*! + \property QSwipeGesture::horizontalDirection + \brief the horizontal direction of the gesture + + If the gesture has a horizontal component, the horizontal direction + is either Left or Right; otherwise, it is NoDirection. + + \sa verticalDirection, swipeAngle +*/ +/*! + \property QSwipeGesture::verticalDirection + \brief the vertical direction of the gesture + + If the gesture has a vertical component, the vertical direction + is either Up or Down; otherwise, it is NoDirection. + + \sa horizontalDirection, swipeAngle +*/ + +/*! + \property QSwipeGesture::swipeAngle + \brief the angle of the motion associated with the gesture + + If the gesture has either a horizontal or vertical component, the + swipe angle describes the angle between the direction of motion and the + x-axis as defined using the standard widget + \l{The Coordinate System}{coordinate system}. + + \sa horizontalDirection, verticalDirection +*/ + +/*! + \internal +*/ QSwipeGesture::QSwipeGesture(QObject *parent) : QGesture(*new QSwipeGesturePrivate, parent) { diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp index 1998cba..9de3bcc 100644 --- a/src/gui/kernel/qgesturerecognizer.cpp +++ b/src/gui/kernel/qgesturerecognizer.cpp @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE \class QGestureRecognizer \since 4.6 \brief The QGestureRecognizer class provides the infrastructure for gesture recognition. + \ingroup gestures Gesture recognizers are responsible for creating and managing QGesture objects and monitoring input events sent to QWidget and QGraphicsObject subclasses. -- cgit v0.12 From 6018d7a21a1ba336a59e3cda161b7cfeb144b4b5 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Fri, 16 Oct 2009 16:31:27 +0200 Subject: Kill warning, simplify code. Reviewed-by: TrustMe --- src/3rdparty/phonon/mmf/audiooutput.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/phonon/mmf/audiooutput.cpp b/src/3rdparty/phonon/mmf/audiooutput.cpp index 5a00f60..bb0e5bc 100644 --- a/src/3rdparty/phonon/mmf/audiooutput.cpp +++ b/src/3rdparty/phonon/mmf/audiooutput.cpp @@ -102,15 +102,17 @@ bool MMF::AudioOutput::activateOnMediaObject(MediaObject *mo) QHash MMF::AudioOutput::audioOutputDescription(int index) { + QHash retval; + if (index == AudioOutputDeviceID) { QHash retval; retval.insert("name", QCoreApplication::translate("Phonon::MMF", "Audio Output")); retval.insert("description", QCoreApplication::translate("Phonon::MMF", "The audio output device")); retval.insert("available", true); - - return retval; } + + return retval; } QT_END_NAMESPACE -- cgit v0.12 From 943290b3e72c9d9081ad95489a4319889e1a073a Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Fri, 16 Oct 2009 17:26:19 +0200 Subject: This reverts commit 99739f35bf700a2bff707da99f5043cd7c12aed5. Don't create native windows when setting the window title, delay the creation until the native window is needed. If a user really needs the window to be created, he/she can call winId() on the widget or set Qt::AA_ImmediateWidgetCreation. Reviewed-by: Bradley T. Hughes --- src/gui/kernel/qwidget.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 56602f7..a071ba6 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1354,6 +1354,8 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) d->setWindowIcon_sys(true); if (isWindow() && !d->topData()->iconText.isEmpty()) d->setWindowIconText_helper(d->topData()->iconText); + if (isWindow() && !d->topData()->caption.isEmpty()) + d->setWindowTitle_helper(d->topData()->caption); if (windowType() != Qt::Desktop) { d->updateSystemBackground(); @@ -5664,9 +5666,8 @@ QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widg void QWidgetPrivate::setWindowTitle_helper(const QString &title) { Q_Q(QWidget); - if (!q->testAttribute(Qt::WA_WState_Created)) - createWinId(); - setWindowTitle_sys(qt_setWindowTitle_helperHelper(title, q)); + if (q->testAttribute(Qt::WA_WState_Created)) + setWindowTitle_sys(qt_setWindowTitle_helperHelper(title, q)); } void QWidgetPrivate::setWindowIconText_helper(const QString &title) -- cgit v0.12 From 4a0e3170c779a6a37954c3dfcfd0b9f0ce144701 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Fri, 16 Oct 2009 17:53:10 +0200 Subject: Fixed crash in the Boxes demo when using -graphicssystem opengl. QGLWindowSurface::flush() assumed that updateGeometry() had been called, but in some cases it hadn't. It would therefore dereference a null pointer and crash. This has been fixed by returning from flush() if updateGeometry() has not been called. This fixes the symptom rather than the bug, so we still need to find out why it hasn't been called. Reviewed-by: Trond --- src/opengl/qwindowsurface_gl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 7f8577a..e6afed8 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -428,6 +428,12 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & return; } + //### Find out why d_ptr->geometry_updated isn't always false. + // flush() should not be called when d_ptr->geometry_updated is true. It assumes that either + // d_ptr->fbo or d_ptr->pb is allocated and has the correct size. + if (d_ptr->geometry_updated) + return; + QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); Q_ASSERT(parent); -- cgit v0.12 From c3bab81d5966c9bd3a42d9c5cbb9d8ad35a1b330 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 19 Oct 2009 14:45:47 +1000 Subject: ODBC: Retrieved in ascii, should be stored in ascii. For non-unicode databases, use ascii. Task-number: QTBUG-3736 --- src/sql/drivers/odbc/qsql_odbc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index ff9458b..e686873 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -1455,7 +1455,7 @@ bool QODBCResult::exec() else #endif { - QByteArray str = val.toString().toUtf8(); + QByteArray str = val.toString().toAscii(); if (*ind != SQL_NULL_DATA) *ind = str.length(); int strSize = str.length(); -- cgit v0.12 From e05137fe501e9536e15b1980c936af771e9518db Mon Sep 17 00:00:00 2001 From: Peter Yard Date: Mon, 19 Oct 2009 15:33:23 +1000 Subject: Additional documentation added to deployment.qdoc which lists the process and links to the original MSDN pages which describe it in full. --- doc/src/deployment/deployment.qdoc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc index f2bae23..b5b1b9c 100644 --- a/doc/src/deployment/deployment.qdoc +++ b/doc/src/deployment/deployment.qdoc @@ -345,6 +345,7 @@ are many ways to solve this: \list + \o You can install the Qt libraries in one of the system library paths (e.g. \c /usr/lib on most systems). @@ -804,6 +805,30 @@ compiler version against the same C runtime version. This prevents deploying errors caused by different versions of the C runtime libraries. + \section2 Visual Studio 2008 And Manual Installs + + As well as the above details for VS 2005 and onwards, Visual Studio 2008 + applications may have problems when deploying manually, say to a USB + stick. + + The recommended procedure is to configure Qt with the \c -plugin-manifests + option using the 'configure' tool. Then follow the \l {http://msdn.microsoft.com/en-us/library/ms235291(VS.80).aspx}{guidelines} + for manually deploying private assemblies. + + In brief the steps are + + \list 1 + + \o create a folder structure on the development computer that will match the target USB stick directory structure, for example '\\app' and for your dlls, '\\app\\lib'. + + \o on the development computer, from the appropriate 'redist' folder copy over Microsoft.VC80.CRT and Microsoft.VC80.MFC to the directories '\\app' and '\\app\\lib' on the development PC. + + \o xcopy the \\app folder to the target USB stick. + \endlist + + Your application should now run. Also be aware that even with a service + pack installed the Windows DLLs that are linked to will be the defaults. See + the information on \l {http://msdn.microsoft.com/en-us/library/cc664727.aspx}{how to select the appropriate target DLLs}. \section1 Application Dependencies -- cgit v0.12 From 6116573511d8f3ab885ceff34f6d5a2d2d12b67e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 19 Oct 2009 08:23:48 +0200 Subject: Remove debug output. --- configure | 1 - 1 file changed, 1 deletion(-) diff --git a/configure b/configure index 323224c..485c71c 100755 --- a/configure +++ b/configure @@ -2873,7 +2873,6 @@ fi # pass on $CFG_SDK to the configure tests. if [ '!' -z "$CFG_SDK" ]; then MAC_CONFIG_TEST_COMMANDLINE="-sdk $CFG_SDK" - echo "tests command line: $MAC_CONFIG_TEST_COMMANDLINE" fi # find the default framework value -- cgit v0.12 From 511adbc60fdd7fbfe95f2a1cf9cf2d31aba9b7ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Mon, 19 Oct 2009 10:23:30 +0300 Subject: Fix autotest case for QSoftkeyManager QSoftkeyManager's test case checkSoftkeyEnableStates was broken with recent fix to QSoftkeyManager where softkey action is no longer initialized to the initial state of action widget. Instead, softkey action checks the state of action widget when handling the action. Autotest case is now fixed to handle the change. Task-number: N/A Reviewed-by: Miikka Heikkinen --- tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp | 56 ++++++++++++++++++---- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp index 832605e..6efa85b 100644 --- a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp +++ b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp @@ -43,9 +43,15 @@ #include "qevent.h" #include "qdialog.h" +#include "qpushbutton.h" #include "qdialogbuttonbox.h" #include "private/qsoftkeymanager_p.h" +#ifdef Q_WS_S60 +static const int s60CommandStart = 6000; +#endif + + class tst_QSoftKeyManager : public QObject { Q_OBJECT @@ -171,22 +177,52 @@ void tst_QSoftKeyManager::handleCommand() } /* - This tests that softkey enable state follows the state of widget that owns the action - to which the softkey is related to. + This tests that the state of a widget that owns softkey action is respected when handling the softkey + command. */ void tst_QSoftKeyManager::checkSoftkeyEnableStates() { - QWidget w1, w2; - w1.setEnabled(false); - w2.setEnabled(true); + QDialog w; + QDialogButtonBox *buttons = new QDialogButtonBox( + QDialogButtonBox::RestoreDefaults | QDialogButtonBox::Help, + Qt::Horizontal, + &w); + QPushButton *pBDefaults = buttons->button(QDialogButtonBox::RestoreDefaults); + QPushButton *pBHelp = buttons->button(QDialogButtonBox::Help); + pBHelp->setEnabled(false); + w.show(); + QApplication::processEvents(); - QAction *disabledAction = QSoftKeyManager::createAction(QSoftKeyManager::OkSoftKey, &w1); - QAction *enabledAction = QSoftKeyManager::createAction(QSoftKeyManager::OkSoftKey, &w2); + QSignalSpy spy0(w.actions()[0], SIGNAL(triggered())); //restore defaults action + QSignalSpy spy1(w.actions()[1], SIGNAL(triggered())); //disabled help action - QVERIFY(disabledAction->isEnabled()==false); - QVERIFY(enabledAction->isEnabled()==true); + //Verify that enabled button gets all the action trigger signals and + //disabled button gets none. + for (int i = 0; i < 10; i++) { + //simulate "Restore Defaults" softkey press + qApp->symbianHandleCommand(s60CommandStart); + //simulate "help" softkey press + qApp->symbianHandleCommand(s60CommandStart + 1); + } + QApplication::processEvents(); + QCOMPARE(spy0.count(), 10); + QCOMPARE(spy1.count(), 0); + spy0.clear(); + spy1.clear(); + + for (int i = 0; i < 10; i++) { + //simulate "Restore Defaults" softkey press + qApp->symbianHandleCommand(s60CommandStart); + //simulate "help" softkey press + qApp->symbianHandleCommand(s60CommandStart + 1); + //switch enabled button to disabled and vice versa + pBHelp->setEnabled(!pBHelp->isEnabled()); + pBDefaults->setEnabled(!pBDefaults->isEnabled()); + } + QApplication::processEvents(); + QCOMPARE(spy0.count(), 5); + QCOMPARE(spy1.count(), 5); } - QTEST_MAIN(tst_QSoftKeyManager) #include "tst_qsoftkeymanager.moc" -- cgit v0.12 From 10a437f02966ad0963b66585cc2ff6210b995f18 Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 15 Oct 2009 16:18:19 +0200 Subject: Made Mac Carbon use the input method hints when deciding on IM. New behavior is to turn them off when inputting numbers or hidden text, which is the way it was in Qt 4.5. Task: QT-1938 Task: QT-2257 RevBy: Prasanth Ullattil --- src/gui/inputmethod/qmacinputcontext_mac.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/inputmethod/qmacinputcontext_mac.cpp b/src/gui/inputmethod/qmacinputcontext_mac.cpp index 116d233..994edb9 100644 --- a/src/gui/inputmethod/qmacinputcontext_mac.cpp +++ b/src/gui/inputmethod/qmacinputcontext_mac.cpp @@ -217,7 +217,11 @@ QMacInputContext::globalEventProcessor(EventHandlerCallRef, EventRef event, void case kEventClassTextInput: { handled_event = false; QWidget *widget = QApplicationPrivate::focus_widget; - if(!widget || (context && widget->inputContext() != context)) { + bool canCompose = widget && (!context || widget->inputContext() == context) + && !(widget->inputMethodHints() & Qt::ImhDigitsOnly + || widget->inputMethodHints() & Qt::ImhFormattedNumbersOnly + || widget->inputMethodHints() & Qt::ImhHiddenText); + if(!canCompose) { handled_event = false; } else if(ekind == kEventTextInputOffsetToPos) { if(!widget->testAttribute(Qt::WA_InputMethodEnabled)) { -- cgit v0.12 From 8472e256280f683f69fd5d9db5c2ed645dab6c92 Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 19 Oct 2009 10:27:18 +0200 Subject: Made sure the noSocketEvents value is preserved in case of exception. Task: QT-987 RevBy: mread --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 02f77a1..b32696d 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -668,6 +668,7 @@ void QEventDispatcherSymbian::closingDown() bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags flags ) { bool handledAnyEvent = false; + bool oldNoSocketEventsValue = m_noSocketEvents; QT_TRY { Q_D(QAbstractEventDispatcher); @@ -686,7 +687,6 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla block = false; } - bool oldNoSocketEventsValue = m_noSocketEvents; if (flags & QEventLoop::ExcludeSocketNotifiers) { m_noSocketEvents = true; } else { @@ -762,14 +762,14 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla }; emit awake(); - - m_noSocketEvents = oldNoSocketEventsValue; } QT_CATCH (const std::exception& ex) { #ifndef QT_NO_EXCEPTIONS CActiveScheduler::Current()->Error(qt_symbian_exception2Error(ex)); #endif } + m_noSocketEvents = oldNoSocketEventsValue; + return handledAnyEvent; } -- cgit v0.12 From 2e575432f1e1fd90e1f973791f2ee8df33b6e45e Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 19 Oct 2009 10:42:42 +0200 Subject: QSslSocket: Also handle setSocketOption Handle setSocketOption and forward it to the plainSocket that QSslSocket is using internally. Reviewed-by: Thiago --- src/network/socket/qabstractsocket.cpp | 13 +++++++++++++ src/network/ssl/qsslsocket.cpp | 16 ++++++++++++++++ src/network/ssl/qsslsocket.h | 4 ++++ 3 files changed, 33 insertions(+) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 86ccef2..9fb0b47 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1578,6 +1578,13 @@ bool QAbstractSocket::setSocketDescriptor(int socketDescriptor, SocketState sock */ void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value) { +#ifndef QT_NO_OPENSSL + if (QSslSocket *sslSocket = qobject_cast(this)) { + sslSocket->setSocketOption(option, value); + return; + } +#endif + if (!d_func()->socketEngine) return; @@ -1600,6 +1607,12 @@ void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, cons */ QVariant QAbstractSocket::socketOption(QAbstractSocket::SocketOption option) { +#ifndef QT_NO_OPENSSL + if (QSslSocket *sslSocket = qobject_cast(this)) { + return sslSocket->socketOption(option); + } +#endif + if (!d_func()->socketEngine) return QVariant(); diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index a5732fb..ad766c1 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -467,6 +467,22 @@ bool QSslSocket::setSocketDescriptor(int socketDescriptor, SocketState state, Op return retVal; } +void QSslSocket::setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value) +{ + Q_D(QSslSocket); + if (d->plainSocket) + d->plainSocket->setSocketOption(option, value); +} + +QVariant QSslSocket::socketOption(QAbstractSocket::SocketOption option) +{ + Q_D(QSslSocket); + if (d->plainSocket) + return d->plainSocket->socketOption(option); + else + return QVariant(); +} + /*! Returns the current mode for the socket; either UnencryptedMode, where QSslSocket behaves identially to QTcpSocket, or one of SslClientMode or diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h index a41e600..adb206c 100644 --- a/src/network/ssl/qsslsocket.h +++ b/src/network/ssl/qsslsocket.h @@ -90,6 +90,10 @@ public: bool setSocketDescriptor(int socketDescriptor, SocketState state = ConnectedState, OpenMode openMode = ReadWrite); + // ### Qt 5: Make virtual + void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value); + QVariant socketOption(QAbstractSocket::SocketOption option); + SslMode mode() const; bool isEncrypted() const; -- cgit v0.12 From f9e46cdb2d9a42d52f90fe50a53a76c03065b9ce Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 19 Oct 2009 13:24:21 +0200 Subject: Fix crash in QPixmapCache. QCache destruction accesses the key array that was freed in the QPixmapCache destruction, so better clear() before deleting that key. Merge-request: 1820 Reviewed-by: Alexis Menard --- src/gui/image/qpixmapcache.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index f12d397..b0b7d72 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -221,6 +221,7 @@ QPMCache::QPMCache() } QPMCache::~QPMCache() { + clear(); free(keyArray); } -- cgit v0.12 From 7a647e8c9efbbd46184bc4714159c82ae26be958 Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Mon, 19 Oct 2009 12:40:38 +0200 Subject: Regression fix. Fix the hasUncaughtException() flag in debugger's event. The QScriptEngine::hasUncaughtException() flag should be set to true if returning from a JS function was caused by an exception. According to documentation, the flag had to be accessible from the QScriptEngineAgent::functionExit event. New autotest was added. Reviewed-by: Kent Hansen --- src/script/api/qscriptengine.cpp | 12 +++++-- src/script/api/qscriptengine_p.h | 5 +++ src/script/api/qscriptengineagent.cpp | 2 ++ src/script/api/qscriptvalue.h | 3 ++ .../qscriptengineagent/tst_qscriptengineagent.cpp | 38 ++++++++++++++++++++++ 5 files changed, 57 insertions(+), 3 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index b1f36be..360036a 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -2164,7 +2164,7 @@ QScriptValue QScriptEngine::evaluate(const QString &program, const QString &file if (debugger) debugger->evaluateStart(sourceId); - exec->clearException(); + clearExceptions(); JSC::DynamicGlobalObjectScope dynamicGlobalObjectScope(exec, exec->scopeChain()->globalObject()); JSC::EvalExecutable executable(exec, source); @@ -2381,7 +2381,7 @@ bool QScriptEngine::hasUncaughtException() const { Q_D(const QScriptEngine); JSC::ExecState* exec = d->globalExec(); - return exec->hadException(); + return exec->hadException() || d->currentException().isValid(); } /*! @@ -2398,8 +2398,13 @@ bool QScriptEngine::hasUncaughtException() const QScriptValue QScriptEngine::uncaughtException() const { Q_D(const QScriptEngine); + QScriptValue result; JSC::ExecState* exec = d->globalExec(); - return const_cast(d)->scriptValueFromJSCValue(exec->exception()); + if (exec->hadException()) + result = const_cast(d)->scriptValueFromJSCValue(exec->exception()); + else + result = d->currentException(); + return result; } /*! @@ -2452,6 +2457,7 @@ void QScriptEngine::clearExceptions() Q_D(QScriptEngine); JSC::ExecState* exec = d->currentFrame; exec->clearException(); + d->clearCurrentException(); } /*! diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index f1fc135..cde116d 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -183,6 +183,10 @@ public: void agentDeleted(QScriptEngineAgent *agent); + void setCurrentException(QScriptValue exception) { m_currentException = exception; } + QScriptValue currentException() const { return m_currentException; } + void clearCurrentException() { m_currentException.d_ptr.reset(); } + #ifndef QT_NO_QOBJECT JSC::JSValue newQObject(QObject *object, QScriptEngine::ValueOwnership ownership = QScriptEngine::QtOwnership, @@ -263,6 +267,7 @@ public: QSet extensionsBeingImported; QHash loadedScripts; + QScriptValue m_currentException; #ifndef QT_NO_QOBJECT QHash m_qobjectData; diff --git a/src/script/api/qscriptengineagent.cpp b/src/script/api/qscriptengineagent.cpp index bc2eea2..0ca7ecc 100644 --- a/src/script/api/qscriptengineagent.cpp +++ b/src/script/api/qscriptengineagent.cpp @@ -156,6 +156,7 @@ void QScriptEngineAgentPrivate::exceptionThrow(const JSC::DebuggerCallFrame& fra QScriptValue value(engine->scriptValueFromJSCValue(frame.exception())); q_ptr->exceptionThrow(sourceID, value, hasHandler); engine->currentFrame = oldFrame; + engine->setCurrentException(value); }; void QScriptEngineAgentPrivate::exceptionCatch(const JSC::DebuggerCallFrame& frame, intptr_t sourceID) @@ -165,6 +166,7 @@ void QScriptEngineAgentPrivate::exceptionCatch(const JSC::DebuggerCallFrame& fra QScriptValue value(engine->scriptValueFromJSCValue(frame.exception())); q_ptr->exceptionCatch(sourceID, value); engine->currentFrame = oldFrame; + engine->clearCurrentException(); } void QScriptEngineAgentPrivate::atStatement(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno, int column) diff --git a/src/script/api/qscriptvalue.h b/src/script/api/qscriptvalue.h index 32f7a43..aba3327 100644 --- a/src/script/api/qscriptvalue.h +++ b/src/script/api/qscriptvalue.h @@ -70,6 +70,7 @@ typedef QList QScriptValueList; typedef double qsreal; class QScriptValuePrivate; +class QScriptEnginePrivate; struct QScriptValuePrivatePointerDeleter; class Q_SCRIPT_EXPORT QScriptValue { @@ -226,6 +227,8 @@ private: QExplicitlySharedDataPointer d_ptr; Q_DECLARE_PRIVATE(QScriptValue) + + friend class QScriptEnginePrivate; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QScriptValue::ResolveFlags) diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 283e489..82c8ccd 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -109,6 +109,7 @@ private slots: void extension_invoctaion(); void extension(); void isEvaluatingInExtension(); + void hasUncaughtException(); private: double m_testProperty; @@ -2182,5 +2183,42 @@ void tst_QScriptEngineAgent::isEvaluatingInExtension() QVERIFY(spy->wasEvaluating); } +class NewSpy :public QScriptEngineAgent +{ + bool m_result; +public: + NewSpy(QScriptEngine* eng) : QScriptEngineAgent(eng), m_result(false) {} + void functionExit (qint64, const QScriptValue &scriptValue) + { + if (engine()->hasUncaughtException()) m_result = true; + } + + bool isPass() { return m_result; } + void reset() { m_result = false; } +}; + +void tst_QScriptEngineAgent::hasUncaughtException() +{ + QScriptEngine eng; + NewSpy* spy = new NewSpy(&eng); + eng.setAgent(spy); + QScriptValue scriptValue; + + // Check unhandled exception. + eng.evaluate("function init () {Unknown.doSth ();}"); + scriptValue = QScriptValue(eng.globalObject().property("init")).call(); + QVERIFY(eng.hasUncaughtException()); + QVERIFY2(spy->isPass(), "At least one of a functionExit event should set hasUncaughtException flag."); + spy->reset(); + + // Check catched exception. + eng.evaluate("function innerFoo() { throw new Error('ciao') }"); + eng.evaluate("function foo() {try { innerFoo() } catch (e) {} }"); + scriptValue = QScriptValue(eng.globalObject().property("foo")).call(); + QVERIFY(!eng.hasUncaughtException()); + QVERIFY2(spy->isPass(), "At least one of a functionExit event should set hasUncaughtException flag."); +} + + QTEST_MAIN(tst_QScriptEngineAgent) #include "tst_qscriptengineagent.moc" -- cgit v0.12 From f16fc0150fce1d78cc71c27c163baf45e8953aca Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 19 Oct 2009 13:50:24 +0200 Subject: qdoc3: Added the \qmlattachedproperty command. It works just like the \qmlproperty command, except that it puts the properties in a different section for attached properties. --- tools/qdoc3/cppcodemarker.cpp | 19 +++++++++++++++++-- tools/qdoc3/cppcodeparser.cpp | 23 +++++++++++++++++------ tools/qdoc3/htmlgenerator.cpp | 6 +++--- tools/qdoc3/node.cpp | 14 ++++++++++---- tools/qdoc3/node.h | 11 +++++++++-- 5 files changed, 56 insertions(+), 17 deletions(-) diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index ed3d150..36293f8 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -1112,6 +1112,10 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, "QML Properties", "property", "properties"); + FastSection qmlattachedproperties(qmlClassNode, + "QML Attached Properties", + "property", + "properties"); FastSection qmlsignals(qmlClassNode, "QML Signals", "signal", @@ -1128,7 +1132,11 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, NodeList::ConstIterator p = qpgn->childNodes().begin(); while (p != qpgn->childNodes().end()) { if ((*p)->type() == Node::QmlProperty) { - insert(qmlproperties,*p,style,Okay); + const QmlPropertyNode* pn = static_cast(*p); + if (pn->isAttached()) + insert(qmlattachedproperties,*p,style,Okay); + else + insert(qmlproperties,*p,style,Okay); } ++p; } @@ -1142,17 +1150,23 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, ++c; } append(sections,qmlproperties); + append(sections,qmlattachedproperties); append(sections,qmlsignals); append(sections,qmlmethods); } else if (style == Detailed) { FastSection qmlproperties(qmlClassNode,"QML Property Documentation"); + FastSection qmlattachedproperties(qmlClassNode,"QML Attached Property Documentation"); FastSection qmlsignals(qmlClassNode,"QML Signal Documentation"); FastSection qmlmethods(qmlClassNode,"QML Method Documentation"); NodeList::ConstIterator c = qmlClassNode->childNodes().begin(); while (c != qmlClassNode->childNodes().end()) { if ((*c)->subType() == Node::QmlPropertyGroup) { - insert(qmlproperties,*c,style,Okay); + const QmlPropGroupNode* pgn = static_cast(*c); + if (pgn->isAttached()) + insert(qmlattachedproperties,*c,style,Okay); + else + insert(qmlproperties,*c,style,Okay); } else if ((*c)->type() == Node::QmlSignal) { insert(qmlsignals,*c,style,Okay); @@ -1163,6 +1177,7 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, ++c; } append(sections,qmlproperties); + append(sections,qmlattachedproperties); append(sections,qmlsignals); append(sections,qmlmethods); } diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index d93e24c..ad43b2b 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -88,6 +88,7 @@ QT_BEGIN_NAMESPACE #ifdef QDOC_QML #define COMMAND_QMLCLASS Doc::alias("qmlclass") #define COMMAND_QMLPROPERTY Doc::alias("qmlproperty") +#define COMMAND_QMLATTACHEDPROPERTY Doc::alias("qmlattachedproperty") #define COMMAND_QMLINHERITS Doc::alias("inherits") #define COMMAND_QMLSIGNAL Doc::alias("qmlsignal") #define COMMAND_QMLMETHOD Doc::alias("qmlmethod") @@ -482,6 +483,7 @@ QSet CppCodeParser::topicCommands() << COMMAND_VARIABLE << COMMAND_QMLCLASS << COMMAND_QMLPROPERTY + << COMMAND_QMLATTACHEDPROPERTY << COMMAND_QMLSIGNAL << COMMAND_QMLMETHOD; #else @@ -759,32 +761,40 @@ bool CppCodeParser::splitQmlArg(const Doc& doc, /*! Process the topic \a command group with arguments \a args. - Currently, this function is called only for \e{qmlproperty}. + Currently, this function is called only for \e{qmlproperty} + and \e{qmlattachedproperty}. */ Node *CppCodeParser::processTopicCommandGroup(const Doc& doc, const QString& command, const QStringList& args) { QmlPropGroupNode* qmlPropGroup = 0; - if (command == COMMAND_QMLPROPERTY) { + if ((command == COMMAND_QMLPROPERTY) || + (command == COMMAND_QMLATTACHEDPROPERTY)) { QString type; QString element; QString property; + bool attached = (command == COMMAND_QMLATTACHEDPROPERTY); QStringList::ConstIterator arg = args.begin(); if (splitQmlPropertyArg(doc,(*arg),type,element,property)) { Node* n = tre->findNode(QStringList(element),Node::Fake); if (n && n->subType() == Node::QmlClass) { QmlClassNode* qmlClass = static_cast(n); if (qmlClass) - qmlPropGroup = new QmlPropGroupNode(qmlClass,property); + qmlPropGroup = new QmlPropGroupNode(qmlClass, + property, + attached); } } if (qmlPropGroup) { - new QmlPropertyNode(qmlPropGroup,property,type); + new QmlPropertyNode(qmlPropGroup,property,type,attached); ++arg; while (arg != args.end()) { if (splitQmlPropertyArg(doc,(*arg),type,element,property)) { - new QmlPropertyNode(qmlPropGroup,property,type); + new QmlPropertyNode(qmlPropGroup, + property, + type, + attached); } ++arg; } @@ -1969,7 +1979,8 @@ bool CppCodeParser::matchDocsAndStuff() There is a topic command. Process it. */ #ifdef QDOC_QML - if (topic == COMMAND_QMLPROPERTY) { + if ((topic == COMMAND_QMLPROPERTY) || + (topic == COMMAND_QMLATTACHEDPROPERTY)) { Doc nodeDoc = doc; Node *node = processTopicCommandGroup(nodeDoc,topic,args); if (node != 0) { diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index c02dc2e..18c7916 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1240,7 +1240,7 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, generateHeader(title, inner, marker, true); generateTitle(title, subtitleText, SmallSubTitle, inner, marker); -#ifdef QDOC_QML +#ifdef QDOC_QML if (classe && !classe->qmlElement().isEmpty()) { generateInstantiatedBy(classe,marker); } @@ -3468,12 +3468,12 @@ QString HtmlGenerator::refForNode(const Node *node) } break; case Node::Property: -#ifdef QDOC_QML +#ifdef QDOC_QML case Node::QmlProperty: #endif ref = node->name() + "-prop"; break; -#ifdef QDOC_QML +#ifdef QDOC_QML case Node::QmlSignal: ref = node->name() + "-signal"; break; diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 558808f..49f2cc9 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1158,8 +1158,12 @@ QString QmlClassNode::fileBase() const Constructor for the Qml property group node. \a parent is always a QmlClassNode. */ -QmlPropGroupNode::QmlPropGroupNode(QmlClassNode* parent, const QString& name) - : FakeNode(parent, name, QmlPropertyGroup), isdefault(false) +QmlPropGroupNode::QmlPropGroupNode(QmlClassNode* parent, + const QString& name, + bool attached) + : FakeNode(parent, name, QmlPropertyGroup), + isdefault(false), + att(attached) { // nothing. } @@ -1169,11 +1173,13 @@ QmlPropGroupNode::QmlPropGroupNode(QmlClassNode* parent, const QString& name) */ QmlPropertyNode::QmlPropertyNode(QmlPropGroupNode *parent, const QString& name, - const QString& type) + const QString& type, + bool attached) : LeafNode(QmlProperty, parent, name), dt(type), sto(Trool_Default), - des(Trool_Default) + des(Trool_Default), + att(attached) { // nothing. } diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index f933270..fed4ea1 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -369,15 +369,19 @@ class QmlClassNode : public FakeNode class QmlPropGroupNode : public FakeNode { public: - QmlPropGroupNode(QmlClassNode* parent, const QString& name); + QmlPropGroupNode(QmlClassNode* parent, + const QString& name, + bool attached); virtual ~QmlPropGroupNode() { } const QString& element() const { return name(); } void setDefault() { isdefault = true; } bool isDefault() const { return isdefault; } + bool isAttached() const { return att; } private: bool isdefault; + bool att; }; class QmlPropertyNode : public LeafNode @@ -385,7 +389,8 @@ class QmlPropertyNode : public LeafNode public: QmlPropertyNode(QmlPropGroupNode* parent, const QString& name, - const QString& type); + const QString& type, + bool attached); virtual ~QmlPropertyNode() { } void setDataType(const QString& dataType) { dt = dataType; } @@ -396,6 +401,7 @@ class QmlPropertyNode : public LeafNode QString qualifiedDataType() const { return dt; } bool isStored() const { return fromTrool(sto,true); } bool isDesignable() const { return fromTrool(des,false); } + bool isAttached() const { return att; } const QString& element() const { return parent()->name(); } @@ -408,6 +414,7 @@ class QmlPropertyNode : public LeafNode QString dt; Trool sto; Trool des; + bool att; }; class QmlSignalNode : public LeafNode -- cgit v0.12 From 226d67e9077b908a128521a6bb763cf412fbe87e Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 19 Oct 2009 08:30:48 +0200 Subject: Fixed bad glyph rendering under cocoa The positioning is still wrong, but now it at least the glyphs are ok Reviewed-by: msorvig --- src/gui/painting/qtextureglyphcache.cpp | 7 ++++ src/gui/text/qfontengine_mac.mm | 62 ++++++++++++++++++++++++--------- src/gui/text/qfontengine_p.h | 3 +- 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 25b6aba..9e5707d 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -230,7 +230,14 @@ void QImageTextureGlyphCache::createTextureData(int width, int height) int QImageTextureGlyphCache::glyphMargin() const { #ifdef Q_WS_MAC + +#ifdef QT_MAC_USE_COCOA + // For cocoa the margin is built into the glyph it seems.. + return 0; +#else return 2; +#endif + #else return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0; #endif diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm index 758d8af..d11083f 100644 --- a/src/gui/text/qfontengine_mac.mm +++ b/src/gui/text/qfontengine_mac.mm @@ -119,6 +119,28 @@ OSStatus QMacFontPath::closePath(void *data) } + +void qmacfontengine_gamma_correct(QImage *image) +{ + extern uchar qt_pow_rgb_gamma[256]; + + // gamma correct the pixels back to linear color space... + int h = image->height(); + int w = image->width(); + + for (int y=0; yscanLine(y); + for (int x=0; x= MAC_OS_X_VERSION_10_5 QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(const ATSFontFamilyRef &, const ATSFontRef &atsFontRef, const QFontDef &fontDef, bool kerning) : QFontEngineMulti(0) @@ -534,7 +556,7 @@ void QCoreTextFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *position } } -QImage QCoreTextFontEngine::alphaMapForGlyph(glyph_t glyph) +QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, int margin, bool aa) { const glyph_metrics_t br = boundingBox(glyph); QImage im(qRound(br.width)+2, qRound(br.height)+2, QImage::Format_RGB32); @@ -549,9 +571,10 @@ QImage QCoreTextFontEngine::alphaMapForGlyph(glyph_t glyph) 8, im.bytesPerLine(), colorspace, cgflags); CGContextSetFontSize(ctx, fontDef.pixelSize); - CGContextSetShouldAntialias(ctx, fontDef.pointSize > qt_antialiasing_threshold - && !(fontDef.styleStrategy & QFont::NoAntialias)); - CGContextSetShouldSmoothFonts(ctx, false); + CGContextSetShouldAntialias(ctx, aa || + (fontDef.pointSize > qt_antialiasing_threshold + && !(fontDef.styleStrategy & QFont::NoAntialias))); + CGContextSetShouldSmoothFonts(ctx, aa); CGAffineTransform oldTextMatrix = CGContextGetTextMatrix(ctx); CGAffineTransform cgMatrix = CGAffineTransformMake(1, 0, 0, 1, 0, 0); @@ -586,6 +609,13 @@ QImage QCoreTextFontEngine::alphaMapForGlyph(glyph_t glyph) CGContextRelease(ctx); + return im; +} + +QImage QCoreTextFontEngine::alphaMapForGlyph(glyph_t glyph) +{ + QImage im = imageForGlyph(glyph, 0, false); + QImage indexed(im.width(), im.height(), QImage::Format_Indexed8); QVector colors(256); for (int i=0; i<256; ++i) @@ -605,6 +635,16 @@ QImage QCoreTextFontEngine::alphaMapForGlyph(glyph_t glyph) return indexed; } +QImage QCoreTextFontEngine::alphaRGBMapForGlyph(glyph_t glyph, int margin, const QTransform &x) +{ + if (x.type() >= QTransform::TxScale) + return QFontEngine::alphaRGBMapForGlyph(glyph, margin, x); + + QImage im = imageForGlyph(glyph, margin, true); + qmacfontengine_gamma_correct(&im); + return im; +} + void QCoreTextFontEngine::recalcAdvances(int numGlyphs, QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const { Q_ASSERT(false); @@ -1505,19 +1545,7 @@ QImage QFontEngineMac::alphaRGBMapForGlyph(glyph_t glyph, int margin, const QTra im = im.transformed(t); } - extern uchar qt_pow_rgb_gamma[256]; - - // gamma correct the pixels back to linear color space... - for (int y=0; y Date: Mon, 19 Oct 2009 13:57:15 +0200 Subject: QTestLib: do not assert if file is not given in logging function that assert was triggered when running a test with "-vs" to show all the signals emitted. Reviewed-by: Andy Shaw --- src/testlib/qtestlog.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index d96755a..5b78976 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -319,7 +319,6 @@ void QTestLog::info(const char *msg, const char *file, int line) { QTEST_ASSERT(QTest::testLogger); QTEST_ASSERT(msg); - QTEST_ASSERT(file); QTest::testLogger->addMessage(QAbstractTestLogger::Info, msg, file, line); } -- cgit v0.12 From 09df1c7c0ebb944f2581779d2e029c16014ddec1 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 19 Oct 2009 07:23:20 +0200 Subject: setcepaths: add support for wincewm65professional-msvc200? mkspecs Reviewed-by: mauricek --- bin/setcepaths.bat | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/setcepaths.bat b/bin/setcepaths.bat index 15d8ff8..914e594 100755 --- a/bin/setcepaths.bat +++ b/bin/setcepaths.bat @@ -79,6 +79,11 @@ checksdk.exe -sdk "Windows Mobile 6 Professional SDK (ARMV4I)" -script tmp_creat tmp_created_script_setup.bat del tmp_created_script_setup.bat echo Windows Mobile 6 Professional selected, environment is set up +) ELSE IF "%1" EQU "wincewm65professional-msvc2005" ( +checksdk.exe -sdk "Windows Mobile 6 Professional SDK (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL +tmp_created_script_setup.bat +del tmp_created_script_setup.bat +echo Windows Mobile 6 Professional selected, environment is set up ) ELSE IF "%1" EQU "wincewm60standard-msvc2005" ( checksdk.exe -sdk "Windows Mobile 6 Standard SDK (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL tmp_created_script_setup.bat @@ -124,6 +129,11 @@ checksdk.exe -sdk "Windows Mobile 6 Professional SDK (ARMV4I)" -script tmp_creat tmp_created_script_setup.bat del tmp_created_script_setup.bat echo Windows Mobile 6 Professional selected, environment is set up +) ELSE IF "%1" EQU "wincewm65professional-msvc2008" ( +checksdk.exe -sdk "Windows Mobile 6 Professional SDK (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL +tmp_created_script_setup.bat +del tmp_created_script_setup.bat +echo Windows Mobile 6 Professional selected, environment is set up ) ELSE IF "%1" EQU "wincewm60standard-msvc2008" ( checksdk.exe -sdk "Windows Mobile 6 Standard SDK (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL tmp_created_script_setup.bat -- cgit v0.12 From 5c2ed0f727aa300f70d1a50ce74ad1f0e7649dc1 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 19 Oct 2009 15:42:36 +0300 Subject: Fixed QWidget::raise in Symbian If toplevel window is raised, the whole application is now raised to foreground. Task-number: QT-2162 Reviewed-by: axis --- src/gui/kernel/qwidget_s60.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 8ce5001..abf5ba5 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -550,8 +550,13 @@ void QWidgetPrivate::raise_sys() Q_Q(QWidget); Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - if (q->internalWinId()) + if (q->internalWinId()) { q->internalWinId()->DrawableWindow()->SetOrdinalPosition(0); + + // If toplevel widget, raise app to foreground + if (q->isWindow()) + S60->wsSession().SetWindowGroupOrdinalPosition(S60->windowGroup().Identifier(), 0); + } } void QWidgetPrivate::lower_sys() -- cgit v0.12 From 2955086c8d588e58cbfb808ee45212d5ec196b58 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 19 Oct 2009 15:46:35 +0300 Subject: Fluidlauncher now comes to foreground when child application dies. Task-number: QT-2162 Reviewed-by: axis --- demos/embedded/fluidlauncher/fluidlauncher.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/demos/embedded/fluidlauncher/fluidlauncher.cpp b/demos/embedded/fluidlauncher/fluidlauncher.cpp index c065bc9..5e8cc03 100644 --- a/demos/embedded/fluidlauncher/fluidlauncher.cpp +++ b/demos/embedded/fluidlauncher/fluidlauncher.cpp @@ -265,6 +265,10 @@ void FluidLauncher::demoFinished() { setCurrentWidget(pictureFlowWidget); inputTimer->start(); + + // Bring the Fluidlauncher to the foreground to allow selecting another demo + raise(); + activateWindow(); } void FluidLauncher::changeEvent(QEvent* event) -- cgit v0.12 From dbf8da3f2e56c13a3edf0cd89a3a8596df298e29 Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 19 Oct 2009 14:50:49 +0200 Subject: Fixed the build for people who only have emulator binaries installed RevBy: mread --- mkspecs/features/symbian/stl.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/symbian/stl.prf b/mkspecs/features/symbian/stl.prf index 8892d2a..e21ee5c 100644 --- a/mkspecs/features/symbian/stl.prf +++ b/mkspecs/features/symbian/stl.prf @@ -15,7 +15,7 @@ INCLUDEPATH += $$OS_LAYER_STDCPP_SYSTEMINCLUDE INCLUDEPATH -= $$[QT_INSTALL_PREFIX]/mkspecs/common/symbian/stl-off # libstdcppv5 is preferred over libstdcpp as it has/uses the throwing version of operator new -exists($${EPOCROOT}epoc32/release/armv5/urel/libstdcppv5.dll ) { +exists($${EPOCROOT}epoc32/release/armv5/urel/libstdcppv5.dll)|exists($${EPOCROOT}epoc32/release/winscw/udeb/libstdcppv5.dll) { LIBS *= -llibstdcppv5.dll # STDCPP turns on standard C++ new behaviour (ie. throwing new) -- cgit v0.12 From e903578b7c970dd730b73a7eac711d812fefc43e Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Mon, 19 Oct 2009 15:39:39 +0200 Subject: Fix doc error. Should *not* be used as a softkey. Reviewed-by: TrustMe --- src/gui/kernel/qaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index 6a6e549..5f5650f 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -276,7 +276,7 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) This enum describes how an action should be placed in the softkey bar. Currently this enum only has an effect on the Symbian platform. - \value NoSoftKey This action should be used as a softkey + \value NoSoftKey This action should not be used as a softkey \value PositiveSoftKey This action is used to describe a softkey with a positive or non-destructive role such as Ok, Select, or Options. \value NegativeSoftKey This action is used to describe a soft ey with a negative or destructive role -- cgit v0.12 From a13cd1b97b352dc2e583b3d9b6254c7086218c3b Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Mon, 19 Oct 2009 15:29:20 +0200 Subject: Reimplementing QDate/QTime/QDateTime in Symbian native manner Some of the methods used in QDate/QTime/QDateTime have been reimplemented to use native Symbian calls. Reviewed-by: Janne Anttila --- src/corelib/tools/qdatetime.cpp | 62 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 1b559cf..54465bb 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -73,6 +73,10 @@ #include #endif +#if defined(Q_OS_SYMBIAN) +#include +#endif + QT_BEGIN_NAMESPACE enum { @@ -1128,6 +1132,12 @@ QDate QDate::currentDate() memset(&st, 0, sizeof(SYSTEMTIME)); GetLocalTime(&st); d.jd = julianDayFromDate(st.wYear, st.wMonth, st.wDay); +#elif defined(Q_OS_SYMBIAN) + TTime localTime; + localTime.HomeTime(); + TDateTime localDateTime = localTime.DateTime(); + // months and days are zero indexed + d.jd = julianDayFromDate(localDateTime.Year(), localDateTime.Month() + 1, localDateTime.Day() + 1 ); #else // posix compliant system time_t ltime; @@ -1823,6 +1833,12 @@ QTime QTime::currentTime() #if defined(Q_OS_WINCE) ct.startTick = GetTickCount() % MSECS_PER_DAY; #endif +#elif defined(Q_OS_SYMBIAN) + TTime localTime; + localTime.HomeTime(); + TDateTime localDateTime = localTime.DateTime(); + ct.mds = MSECS_PER_HOUR * localDateTime.Hour() + MSECS_PER_MIN * localDateTime.Minute() + + 1000 * localDateTime.Second() + (localDateTime.MicroSecond() / 1000); #elif defined(Q_OS_UNIX) // posix compliant system struct timeval tv; @@ -2874,6 +2890,8 @@ QDateTime QDateTime::currentDateTime() t.mds = MSECS_PER_HOUR * st.wHour + MSECS_PER_MIN * st.wMinute + 1000 * st.wSecond + st.wMilliseconds; return QDateTime(d, t); +#elif defined(Q_OS_SYMBIAN) + return QDateTime(QDate::currentDate(), QTime::currentTime()); #else #if defined(Q_OS_UNIX) // posix compliant system @@ -3700,6 +3718,27 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time) res.tm_mon = sysTime.wMonth - 1; res.tm_year = sysTime.wYear - 1900; brokenDown = &res; +#elif defined(Q_OS_SYMBIAN) + // months and days are zero index based + _LIT(KUnixEpoch, "19700000:000000.000000"); + TTimeIntervalSeconds utcOffset = User::UTCOffset(); + TTimeIntervalSeconds tTimeIntervalSecsSince1Jan1970UTC(secsSince1Jan1970UTC); + TTime epochTTime; + TInt err = epochTTime.Set(KUnixEpoch); + if(err == KErrNone) { + TTime utcTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC; + utcTTime = utcTTime + utcOffset; + TDateTime utcDateTime = utcTTime.DateTime(); + tm res; + res.tm_sec = utcDateTime.Second(); + res.tm_min = utcDateTime.Minute(); + res.tm_hour = utcDateTime.Hour(); + res.tm_mday = utcDateTime.Day() + 1; // non-zero based index for tm struct + res.tm_mon = utcDateTime.Month(); + res.tm_year = utcDateTime.Year() - 1900; + res.tm_isdst = 0; + brokenDown = &res; + } #elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) // use the reentrant version of localtime() where available tzset(); @@ -3745,7 +3784,7 @@ static void localToUtc(QDate &date, QTime &time, int isdst) localTM.tm_mon = fakeDate.month() - 1; localTM.tm_year = fakeDate.year() - 1900; localTM.tm_isdst = (int)isdst; -#if defined(Q_OS_WINCE) +#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) time_t secsSince1Jan1970UTC = toTime_tHelper(fakeDate, time); #else #if defined(Q_OS_WIN) @@ -3770,6 +3809,27 @@ static void localToUtc(QDate &date, QTime &time, int isdst) res.tm_year = sysTime.wYear - 1900; res.tm_isdst = (int)isdst; brokenDown = &res; +#elif defined(Q_OS_SYMBIAN) + // months and days are zero index based + _LIT(KUnixEpoch, "19700000:000000.000000"); + TTimeIntervalSeconds utcOffset = TTimeIntervalSeconds(0 - User::UTCOffset().Int()); + TTimeIntervalSeconds tTimeIntervalSecsSince1Jan1970UTC(secsSince1Jan1970UTC); + TTime epochTTime; + TInt err = epochTTime.Set(KUnixEpoch); + if(err == KErrNone) { + TTime utcTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC; + utcTTime = utcTTime + utcOffset; + TDateTime utcDateTime = utcTTime.DateTime(); + tm res; + res.tm_sec = utcDateTime.Second(); + res.tm_min = utcDateTime.Minute(); + res.tm_hour = utcDateTime.Hour(); + res.tm_mday = utcDateTime.Day() + 1; // non-zero based index for tm struct + res.tm_mon = utcDateTime.Month(); + res.tm_year = utcDateTime.Year() - 1900; + res.tm_isdst = (int)isdst; + brokenDown = &res; + } #elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) // use the reentrant version of gmtime() where available tm res; -- cgit v0.12 From f9d36789b4f2565f342f22d62a5106e5d5ca3389 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Mon, 19 Oct 2009 12:04:57 +0200 Subject: Does not disable full screen when end of video playlist is reached. Tested on Symbian and Windows(DS9). Task-number: QTBUG-4869 Reviewed-by: Gareth Stockwell --- demos/qmediaplayer/mediaplayer.cpp | 3 +++ src/3rdparty/phonon/mmf/mmf_videoplayer.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp index baac236..e1ceb0e 100644 --- a/demos/qmediaplayer/mediaplayer.cpp +++ b/demos/qmediaplayer/mediaplayer.cpp @@ -367,6 +367,9 @@ void MediaPlayer::stateChanged(Phonon::State newstate, Phonon::State oldstate) case Phonon::PausedState: case Phonon::StoppedState: playButton->setIcon(playIcon); + + m_videoWidget->setFullScreen(false); + if (m_MediaObject.currentSource().type() != Phonon::MediaSource::Invalid){ playButton->setEnabled(true); rewindButton->setEnabled(true); diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index a93aca0..d1d2337 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -300,8 +300,8 @@ void MMF::VideoPlayer::MvpuoPlayComplete(TInt aError) TRACE_CONTEXT(VideoPlayer::MvpuoPlayComplete, EVideoApi) TRACE_ENTRY("state %d error %d", state(), aError); - // TODO Q_UNUSED(aError); // suppress warnings in release builds + changeState(StoppedState); TRACE_EXIT_0(); } -- cgit v0.12 From ade25abbe4009c2f491cbd05e81903317d91ec82 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Mon, 19 Oct 2009 16:20:23 +0200 Subject: QTestLib: do not assert if testLogger object is already destroyed ... because when dumping signals we might get QThread::finished() etc. when closing the program, and then the testLogger instance might already be deleted. Reviewed-by: Jesper --- src/testlib/qtestlog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 5b78976..da695dc 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -317,10 +317,10 @@ void QTestLog::warn(const char *msg) void QTestLog::info(const char *msg, const char *file, int line) { - QTEST_ASSERT(QTest::testLogger); QTEST_ASSERT(msg); - QTest::testLogger->addMessage(QAbstractTestLogger::Info, msg, file, line); + if (QTest::testLogger) + QTest::testLogger->addMessage(QAbstractTestLogger::Info, msg, file, line); } void QTestLog::setLogMode(LogMode mode) -- cgit v0.12 From 758153a35e4f7066419f5a0a9f44cdc37839c419 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 19 Oct 2009 13:55:01 +0200 Subject: qwindowsmobilestyle.cpp: endif comment fixed --- src/gui/styles/qwindowsmobilestyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qwindowsmobilestyle.cpp b/src/gui/styles/qwindowsmobilestyle.cpp index d27b1ec..a617102 100644 --- a/src/gui/styles/qwindowsmobilestyle.cpp +++ b/src/gui/styles/qwindowsmobilestyle.cpp @@ -6003,7 +6003,7 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl } painter->restore(); break; -#endif // QT_NO_SLIDER +#endif // QT_NO_SCROLLBAR case CC_ToolButton: if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast(option)) { -- cgit v0.12 From 3908a76b470632f943e836342591319b454d785b Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 19 Oct 2009 12:56:43 +0200 Subject: qwidget_wince.cpp: don't invalidate the crect on maximize If we do this, QWidget::width() returns negative sizes, which makes QGraphicsView crash. Reviewed-by: thartman --- src/gui/kernel/qwidget_wince.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp index 4a0d30c..0666ab8 100644 --- a/src/gui/kernel/qwidget_wince.cpp +++ b/src/gui/kernel/qwidget_wince.cpp @@ -474,7 +474,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) int normal = SW_SHOWNOACTIVATE; if ((oldstate & Qt::WindowMinimized) && !(newstate & Qt::WindowMinimized)) - newstate |= Qt::WindowActive; + newstate |= Qt::WindowActive; if (newstate & Qt::WindowActive) normal = SW_SHOWNORMAL; if (isWindow()) { @@ -490,13 +490,13 @@ void QWidget::setWindowState(Qt::WindowStates newstate) d->topData()->normalGeometry = geometry(); } if ((oldstate & Qt::WindowMaximized) != (newstate & Qt::WindowMaximized)) { - if (!(newstate & Qt::WindowMaximized)) { + if (!(newstate & Qt::WindowMaximized)) { int style = GetWindowLong(internalWinId(), GWL_STYLE) | WS_BORDER | WS_POPUP | WS_CAPTION; SetWindowLong(internalWinId(), GWL_STYLE, style); SetWindowLong(internalWinId(), GWL_EXSTYLE, GetWindowLong (internalWinId(), GWL_EXSTYLE) & ~ WS_EX_NODRAG); } - if (isVisible() && newstate & Qt::WindowMaximized) - qt_wince_maximize(this); + if (isVisible() && newstate & Qt::WindowMaximized) + qt_wince_maximize(this); if (isVisible() && !(newstate & Qt::WindowMinimized)) { ShowWindow(internalWinId(), (newstate & Qt::WindowMaximized) ? max : normal); if (!(newstate & Qt::WindowFullScreen)) { @@ -560,16 +560,6 @@ void QWidget::setWindowState(Qt::WindowStates newstate) qt_wince_maximize(this); } } - if ((newstate & Qt::WindowMaximized) && !(newstate & Qt::WindowFullScreen)) { - QRect r = d->topData()->normalGeometry; -#ifdef Q_WS_WINCE_WM - if (!inherits("QDialog") && !inherits("QMdiArea") && !isVisible()) { - d->data.crect.setRect(0, 0, -1, -1); - } -#else - qt_wince_maximize(this); -#endif - } } data->window_state = newstate; QWindowStateChangeEvent e(oldstate); -- cgit v0.12 From 93a6da9a9b14bc2ff637c6756bbb467f58f6200b Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 19 Oct 2009 14:19:56 +0200 Subject: fix bug in tst_qwidget.cpp WinIdChangeEventWidget::event didn't return a value in all codepaths. Reviewed-by: thartman --- tests/auto/qwidget/tst_qwidget.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 758821b..1b898f4 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -4362,11 +4362,13 @@ public: } protected: - bool event(QEvent *e){ - if(e->type() == QEvent::WinIdChange) + bool event(QEvent *e) + { + if (e->type() == QEvent::WinIdChange) { ++m_winIdChangeEventCount; - else - return QWidget::event(e); + return true; + } + return QWidget::event(e); } public: int m_winIdChangeEventCount; -- cgit v0.12 From 02c15e6a8cdb0f8a0bb6ee36880877fe90334d69 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 19 Oct 2009 14:44:43 +0200 Subject: fix widget activation from minimized state on Windows mobile The following didn't work on Windows mobile: * show a widget normal (non-maximized) * minimize it * reactivate it via the file explorer * now the widget should be visible again The code path from minimized to normal state was missing. Reviewed-by: thartman --- src/gui/kernel/qwidget_wince.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp index 0666ab8..2fe69e4 100644 --- a/src/gui/kernel/qwidget_wince.cpp +++ b/src/gui/kernel/qwidget_wince.cpp @@ -558,6 +558,8 @@ void QWidget::setWindowState(Qt::WindowStates newstate) else if (newstate & Qt::WindowMaximized) { ShowWindow(internalWinId(), max); qt_wince_maximize(this); + } else { + ShowWindow(internalWinId(), normal); } } } -- cgit v0.12 From 2633931653757decd93dd3939c09f5e07203da1c Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 19 Oct 2009 11:59:20 +0200 Subject: Fix a bug affecting keyboard navigation in the table view Reviewed-by: thierry Reviewed-by: pierre --- src/gui/itemviews/qlistview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 243f542..1d9b6e0 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1105,13 +1105,13 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie ++row; if (row >= rowCount) return QModelIndex(); - return d->model->index(row, 0, d->root); + return d->model->index(row, d->column, d->root); } const QRect initialRect = rectForIndex(current); QRect rect = initialRect; if (rect.isEmpty()) { - return d->model->index(0, 0, d->root); + return d->model->index(0, d->column, d->root); } if (d->gridSize().isValid()) rect.setSize(d->gridSize()); -- cgit v0.12 From 93550050f4fe4f411bfbd80d7b30ff5bc8a20df7 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Mon, 19 Oct 2009 21:37:45 +0200 Subject: add the autotest for the QListView::setModelColumn bug sha1 of the fix: 2633931653757decd93dd3939c09f5e07203da1c --- tests/auto/qlistview/tst_qlistview.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 7599ce6a06..3ee6889 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -116,6 +116,7 @@ private slots: void keyboardSearch(); void shiftSelectionWithNonUniformItemSizes(); void clickOnViewportClearsSelection(); + void task262152_setModelColumnNavigate(); }; // Testing get/set functions @@ -1767,6 +1768,29 @@ void tst_QListView::clickOnViewportClearsSelection() } +void tst_QListView::task262152_setModelColumnNavigate() +{ + QListView view; + QStandardItemModel model(3,2); + model.setItem(0,1,new QStandardItem("[0,1]")); + model.setItem(1,1,new QStandardItem("[1,1]")); + model.setItem(2,1,new QStandardItem("[2,1]")); + + view.setModel(&model); + view.setModelColumn(1); + + view.show(); + QTest::qWait(30); + QTest::keyClick(&view, Qt::Key_Down); + QTest::qWait(10); + QCOMPARE(view.currentIndex(), model.index(1,1)); + QTest::keyClick(&view, Qt::Key_Down); + QTest::qWait(10); + QCOMPARE(view.currentIndex(), model.index(2,1)); + +} + + QTEST_MAIN(tst_QListView) #include "tst_qlistview.moc" -- cgit v0.12 From bbbb62552b1c0f68b960c1412c66b6381e7dd4d1 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 20 Oct 2009 09:00:02 +1000 Subject: Optimize QVGPixmapDropShadowFilter by removing colorize step Previously, the drop shadow was colorizing the incoming image and then blurring the colorized version. This change first blurs the image to an alpha-only VGImage and then uses that VGImage as a stencil to draw the drop shadow color. This way, there is only 1 filter step and a draw instead of 2 filter steps and a draw. The result is to make the performance of the drop shadow filter almost identical to the blur filter. Reviewed-by: trustme --- src/openvg/qpaintengine_vg.cpp | 18 ++++++++++++++ src/openvg/qpixmapfilter_vg.cpp | 54 ++++++----------------------------------- src/openvg/qpixmapfilter_vg_p.h | 5 ---- 3 files changed, 25 insertions(+), 52 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index fdd61ea..da07c1d 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -2872,6 +2872,24 @@ void qt_vg_drawVGImage(QPainter *painter, const QPointF& pos, VGImage vgImg) drawVGImage(engine->vgPrivate(), pos, vgImg); } +// Used by qpixmapfilter_vg.cpp to draw filtered VGImage's as a stencil. +void qt_vg_drawVGImageStencil + (QPainter *painter, const QPointF& pos, VGImage vgImg, const QBrush& brush) +{ + QVGPaintEngine *engine = + static_cast(painter->paintEngine()); + + QVGPaintEnginePrivate *d = engine->vgPrivate(); + + QTransform transform(d->imageTransform); + transform.translate(pos.x(), pos.y()); + d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); + + d->ensureBrush(brush); + d->setImageMode(VG_DRAW_IMAGE_STENCIL); + vgDrawImage(vgImg); +} + void QVGPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) { QPixmapData *pd = pm.pixmapData(); diff --git a/src/openvg/qpixmapfilter_vg.cpp b/src/openvg/qpixmapfilter_vg.cpp index 3305bbb..8e104db 100644 --- a/src/openvg/qpixmapfilter_vg.cpp +++ b/src/openvg/qpixmapfilter_vg.cpp @@ -58,6 +58,8 @@ QVGPixmapConvolutionFilter::~QVGPixmapConvolutionFilter() extern void qt_vg_drawVGImage (QPainter *painter, const QPointF& pos, VGImage vgImg); +extern void qt_vg_drawVGImageStencil + (QPainter *painter, const QPointF& pos, VGImage vgImg, const QBrush& brush); void QVGPixmapConvolutionFilter::draw (QPainter *painter, const QPointF &dest, @@ -213,8 +215,7 @@ void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const } QVGPixmapDropShadowFilter::QVGPixmapDropShadowFilter() - : QPixmapDropShadowFilter(), - firstTime(true) + : QPixmapDropShadowFilter() { } @@ -238,49 +239,11 @@ void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, con return; QSize size = pd->size(); - VGImage tmpImage = vgCreateImage - (VG_sARGB_8888_PRE, size.width(), size.height(), - VG_IMAGE_QUALITY_FASTER); - if (tmpImage == VG_INVALID_HANDLE) - return; - VGImage dstImage = vgCreateImage - (VG_sARGB_8888_PRE, size.width(), size.height(), + (VG_A_8, size.width(), size.height(), VG_IMAGE_QUALITY_FASTER); - if (dstImage == VG_INVALID_HANDLE) { - vgDestroyImage(tmpImage); + if (dstImage == VG_INVALID_HANDLE) return; - } - - // Recompute the color matrix if the color has changed. - QColor c = color(); - if (c != prevColor || firstTime) { - prevColor = c; - - matrix[0][0] = 0.0f; - matrix[0][1] = 0.0f; - matrix[0][2] = 0.0f; - matrix[0][3] = 0.0f; - matrix[1][0] = 0.0f; - matrix[1][1] = 0.0f; - matrix[1][2] = 0.0f; - matrix[1][3] = 0.0f; - matrix[2][0] = 0.0f; - matrix[2][1] = 0.0f; - matrix[2][2] = 0.0f; - matrix[2][3] = 0.0f; - matrix[3][0] = c.redF(); - matrix[3][1] = c.greenF(); - matrix[3][2] = c.blueF(); - matrix[3][3] = c.alphaF(); - matrix[4][0] = 0.0f; - matrix[4][1] = 0.0f; - matrix[4][2] = 0.0f; - matrix[4][3] = 0.0f; - } - - // Blacken the source image. - vgColorMatrix(tmpImage, srcImage, matrix[0]); // Clamp the radius range. We divide by 2 because the OpenVG blur // is "too blurry" compared to the default raster implementation. @@ -292,9 +255,7 @@ void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, con radiusF = maxRadius; // Blur the blackened source image. - vgGaussianBlur(dstImage, tmpImage, radiusF, radiusF, VG_TILE_PAD); - - firstTime = false; + vgGaussianBlur(dstImage, srcImage, radiusF, radiusF, VG_TILE_PAD); VGImage child = VG_INVALID_HANDLE; @@ -308,11 +269,10 @@ void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, con child = vgChildImage(dstImage, srect.x(), srect.y(), srect.width(), srect.height()); } - qt_vg_drawVGImage(painter, dest + offset(), child); + qt_vg_drawVGImageStencil(painter, dest + offset(), child, color()); if(child != dstImage) vgDestroyImage(child); - vgDestroyImage(tmpImage); vgDestroyImage(dstImage); // Now draw the actual pixmap over the top. diff --git a/src/openvg/qpixmapfilter_vg_p.h b/src/openvg/qpixmapfilter_vg_p.h index f79b6c2..efbbc7b 100644 --- a/src/openvg/qpixmapfilter_vg_p.h +++ b/src/openvg/qpixmapfilter_vg_p.h @@ -89,11 +89,6 @@ public: ~QVGPixmapDropShadowFilter(); void draw(QPainter *p, const QPointF &pos, const QPixmap &px, const QRectF &src) const; - -private: - mutable VGfloat matrix[5][4]; - mutable QColor prevColor; - mutable bool firstTime; }; class Q_OPENVG_EXPORT QVGPixmapBlurFilter : public QPixmapBlurFilter -- cgit v0.12 From dfd6221d960ec8c563a687684000c3a9c4f58079 Mon Sep 17 00:00:00 2001 From: Bill King Date: Tue, 20 Oct 2009 10:21:38 +1000 Subject: Misc mysql test fixes. --- tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 13d68ff..82b6066 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -1072,17 +1072,20 @@ void tst_QSqlDatabase::recordMySQL() int revision = tst_Databases::getMySqlVersion( db ).section( QChar('.'), 2, 2 ).toInt(); int vernum = (major << 16) + (minor << 8) + revision; -#ifdef QT3_SUPPORT /* The below is broken in mysql below 5.0.15 see http://dev.mysql.com/doc/refman/5.0/en/binary-varbinary.html specifically: Before MySQL 5.0.15, the pad value is space. Values are right-padded with space on insert, and trailing spaces are removed on select. */ if( vernum >= ((5 << 16) + 15) ) { +#ifdef QT3_SUPPORT bin10 = FieldDef("binary(10)", QVariant::ByteArray, QByteArray(Q3CString("123abc "))); varbin10 = FieldDef("varbinary(10)", QVariant::ByteArray, QByteArray(Q3CString("123abcv "))); - } +#else + bin10 = FieldDef("binary(10)", QVariant::ByteArray, QString("123abc ")); + varbin10 = FieldDef("varbinary(10)", QVariant::ByteArray, QString("123abcv ")); #endif + } static QDateTime dt(QDate::currentDate(), QTime(1, 2, 3, 0)); static const FieldDef fieldDefs[] = { @@ -2468,7 +2471,7 @@ void tst_QSqlDatabase::mysql_savepointtest() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - if ( db.driverName().startsWith( "QMYSQL" ) && tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 1 ).toInt()<4.1 ) + if ( db.driverName().startsWith( "QMYSQL" ) && tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 1 ).toDouble()<4.1 ) QSKIP( "Test requires MySQL >= 4.1", SkipSingle ); QSqlQuery q(db); -- cgit v0.12 From 420be4ee3d98c093c71cc840192138da6b5e61d2 Mon Sep 17 00:00:00 2001 From: Sarah Smith Date: Tue, 20 Oct 2009 11:53:30 +1000 Subject: Fix bug QTBUG-4848 Make the shapeText function return numGlyphs properly - its not always the same as length of string. Task-number: QTBUG-4848 Reviewed-by: Rhys Weatherley --- src/gui/text/qfontengine_mac.mm | 14 +++++++--- src/gui/text/qtextengine_mac.cpp | 9 +++---- tests/auto/qlabel/qlabel.pro | 21 +++++---------- tests/auto/qlabel/tst_qlabel.cpp | 58 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 24 deletions(-) diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm index d11083f..8ce437d 100644 --- a/src/gui/text/qfontengine_mac.mm +++ b/src/gui/text/qfontengine_mac.mm @@ -830,7 +830,6 @@ static OSStatus atsuPostLayoutCallback(ATSULayoutOperationSelector selector, ATS surrogates += (str[i].unicode() >= 0xd800 && str[i].unicode() < 0xdc00 && str[i+1].unicode() >= 0xdc00 && str[i+1].unicode() < 0xe000); } - Q_ASSERT(*nfo->numGlyphs == item->length - surrogates); #endif for (nextCharStop = item->from; nextCharStop < item->from + item->length; ++nextCharStop) if (item->charAttributes[nextCharStop].charStop) @@ -856,10 +855,13 @@ static OSStatus atsuPostLayoutCallback(ATSULayoutOperationSelector selector, ATS QFixed xAdvance = FixedToQFixed(layoutData[glyphIdx + 1].realPos - layoutData[glyphIdx].realPos); if (glyphId != 0xffff || i == 0) { - nfo->glyphs->glyphs[i] = (glyphId & 0x00ffffff) | (fontIdx << 24); + if (i < nfo->glyphs->numGlyphs) + { + nfo->glyphs->glyphs[i] = (glyphId & 0x00ffffff) | (fontIdx << 24); - nfo->glyphs->advances_y[i] = yAdvance; - nfo->glyphs->advances_x[i] = xAdvance; + nfo->glyphs->advances_y[i] = yAdvance; + nfo->glyphs->advances_x[i] = xAdvance; + } } else { // ATSUI gives us 0xffff as glyph id at the index in the glyph array for // a character position that maps to a ligtature. Such a glyph id does not @@ -1029,6 +1031,8 @@ bool QFontEngineMacMulti::stringToCMapInternal(const QChar *str, int len, QGlyph nfo.flags = flags; nfo.shaperItem = shaperItem; + int prevNumGlyphs = *nglyphs; + QVarLengthArray mappedFonts(len); for (int i = 0; i < len; ++i) mappedFonts[i] = 0; @@ -1140,6 +1144,8 @@ bool QFontEngineMacMulti::stringToCMapInternal(const QChar *str, int len, QGlyph } ATSUClearLayoutCache(textLayout, kATSUFromTextBeginning); + if (prevNumGlyphs < *nfo.numGlyphs) + return false; return true; } diff --git a/src/gui/text/qtextengine_mac.cpp b/src/gui/text/qtextengine_mac.cpp index 4f20094..e101830 100644 --- a/src/gui/text/qtextengine_mac.cpp +++ b/src/gui/text/qtextengine_mac.cpp @@ -50,7 +50,6 @@ static void heuristicSetGlyphAttributes(const QChar *uc, int length, QGlyphLayou { // ### zeroWidth and justification are missing here!!!!! - Q_ASSERT(num_glyphs <= length); Q_UNUSED(num_glyphs); // qDebug("QScriptEngine::heuristicSetGlyphAttributes, num_glyphs=%d", item->num_glyphs); @@ -596,7 +595,7 @@ void QTextEngine::shapeTextMac(int item) const } while (true) { - ensureSpace(num_glyphs); + ensureSpace(num_glyphs); num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; QGlyphLayout g = availableGlyphs(&si); @@ -611,9 +610,9 @@ void QTextEngine::shapeTextMac(int item) const log_clusters, attributes())) { - heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); - break; - } + heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); + break; + } } si.num_glyphs = num_glyphs; diff --git a/tests/auto/qlabel/qlabel.pro b/tests/auto/qlabel/qlabel.pro index 6d55c13..297f868 100644 --- a/tests/auto/qlabel/qlabel.pro +++ b/tests/auto/qlabel/qlabel.pro @@ -1,19 +1,10 @@ load(qttest_p4) -SOURCES += tst_qlabel.cpp - -wince*:{ - DEFINES += SRCDIR=\\\"\\\" -} else:!symbian { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} - -wince*|symbian { - addFiles.sources = *.png testdata +SOURCES += tst_qlabel.cpp +wince*::DEFINES += SRCDIR=\\\"\\\" +else:!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\" +wince*|symbian { + addFiles.sources = *.png \ + testdata addFiles.path = . DEPLOYMENT += addFiles } - - - - - diff --git a/tests/auto/qlabel/tst_qlabel.cpp b/tests/auto/qlabel/tst_qlabel.cpp index dd03ef3..9eae9c9 100644 --- a/tests/auto/qlabel/tst_qlabel.cpp +++ b/tests/auto/qlabel/tst_qlabel.cpp @@ -50,6 +50,7 @@ #include #include #include +#include //TESTED_CLASS= //TESTED_FILES= @@ -112,6 +113,9 @@ private slots: void task226479_movieResize(); void emptyPixmap(); + void unicodeText_data(); + void unicodeText(); + private: QLabel *testWidget; QPointer test_box; @@ -451,5 +455,59 @@ void tst_QLabel::emptyPixmap() QCOMPARE(label1.sizeHint(), label4.sizeHint()); } +/** + Test for QTBUG-4848 - unicode data corrupting QLabel display +*/ +void tst_QLabel::unicodeText_data() +{ + QTest::addColumn("text"); + QTest::addColumn("languageName"); + + /* + The "glass" phrase in Thai was the initial report for bug QTBUG-4848, was + originally found on http://www.columbia.edu/kermit/utf8.html. + + The phrase is from an internet tradition regarding a striking phrase + that is translated into many different languages. The utf8 strings + below were generated by using http://translate.google.com. + + The glass phrase in Thai contains the ้ว character which manifests bug + QTBUG-4848 + + The last long phrase is an excerpt from Churchills "on the beaches" + speech, also translated using http://translate.google.com. + */ + + QTest::newRow("english") << QString::fromUtf8("I can eat glass and it doesn't hurt me.") << QString("english"); + QTest::newRow("thai") << QString::fromUtf8("ฉันจะกินแก้วและไม่เจ็บฉัน") << QString("thai"); + QTest::newRow("chinese") << QString::fromUtf8("我可以吃玻璃,并没有伤害我。") << QString("chinese"); + QTest::newRow("arabic") << QString::fromUtf8("أستطيع أكل الزجاج ، وأنه لا يؤذيني.") << QString("arabic"); + QTest::newRow("russian") << QString::fromUtf8("Я могу есть стекло, и не больно.") << QString("russian"); + QTest::newRow("korean") << QString::fromUtf8("유리를 먹을 수있는, 그리고 그게 날 다치게하지 않습니다.") << QString("korean"); + QTest::newRow("greek") << QString::fromUtf8("Μπορώ να φάτε γυαλί και δεν μου κάνει κακό.") << QString("greek"); + QTest::newRow("german") << QString::fromUtf8("Ich kann Glas essen und es macht mich nicht heiß.") << QString("german"); + + QTest::newRow("thai_long") << QString::fromUtf8("เราจะต่อสู้ในทะเลและมหาสมุทร. เราจะต่อสู้ด้วยความมั่นใจเติบโตและความเจริญเติบโตในอากาศเราจะปกป้องเกาะของเราค่าใช้จ่ายใดๆอาจ." + "เราจะต่อสู้บนชายหาดเราจะต่อสู้ในบริเวณเชื่อมโยงไปถึงเราจะต่อสู้ในช่องและในถนนที่เราจะต่อสู้ในภูเขานั้นเราจะไม่ยอม.") + << QString("thai_long"); +} + +void tst_QLabel::unicodeText() +{ + const QString testDataPath("testdata/unicodeText"); + QFETCH(QString, text); + QFETCH(QString, languageName); + QFrame frame; + QVBoxLayout *layout = new QVBoxLayout(); + QLabel *label = new QLabel(text, &frame); + layout->addWidget(label); + layout->setMargin(8); + frame.setLayout(layout); + frame.show(); + QTest::qWaitForWindowShown(&frame); + QVERIFY(frame.isVisible()); // was successfully sized and shown + testWidget->show(); +} + QTEST_MAIN(tst_QLabel) #include "tst_qlabel.moc" -- cgit v0.12 From 31fefc7cc9dc01be244b362ada1c1b2f8aad7c47 Mon Sep 17 00:00:00 2001 From: Julian de Bhal Date: Tue, 20 Oct 2009 12:32:19 +1000 Subject: Fix dangling shader manager pointers The QGLEngineShaderManager pointers in QGLCustomShaderStagePrivate have been changed to QPointers to prevent the QGLPixmapFilters in QGL2PaintEngineEx from dereferencing the QGLEngineShaderManager after it is destroyed. Reviewed-by: Rhys Weatherley --- src/opengl/gl2paintengineex/qglcustomshaderstage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp index 24606bc..ab2026c 100644 --- a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp +++ b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp @@ -52,7 +52,7 @@ public: QGLCustomShaderStagePrivate() : m_manager(0) {} - QGLEngineShaderManager* m_manager; + QPointer m_manager; QByteArray m_source; }; -- cgit v0.12 From f38eb1b6edf8f6d758899c8ca4a4bae2d7eb4b92 Mon Sep 17 00:00:00 2001 From: Bill King Date: Tue, 20 Oct 2009 13:51:06 +1000 Subject: Fix now invalid ExpectFail. The bug causing this fail is now fixed, so remove the expectfails. --- tests/auto/qsqlquery/tst_qsqlquery.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 546c105..98030d1 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -194,7 +194,6 @@ private slots: void sqlServerReturn0_data() { generic_data(); } void sqlServerReturn0(); - private: // returns all database connections void generic_data(const QString &engine=QString()); @@ -510,9 +509,7 @@ void tst_QSqlQuery::mysqlOutValues() QVERIFY_SQL( q, exec( "create procedure " + qTableName( "qtestproc" ) + " () " "BEGIN select * from " + qTableName( "qtest" ) + " order by id; END" ) ); QVERIFY_SQL( q, exec( "call " + qTableName( "qtestproc" ) + "()" ) ); - QEXPECT_FAIL("", "There's a mysql bug that means only selects think they return data when running in prepared mode", Continue); QVERIFY_SQL( q, next() ); - QEXPECT_FAIL("", "There's a mysql bug that means only selects think they return data when running in prepared mode", Continue); QCOMPARE( q.value( 1 ).toString(), QString( "VarChar1" ) ); QVERIFY_SQL( q, exec( "drop procedure " + qTableName( "qtestproc" ) ) ); -- cgit v0.12 From 04648b44f0784223122a782320d0b09b5c1e9497 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 20 Oct 2009 16:46:46 +1000 Subject: Remove unnecessary PowerVR helper functions The cross-process memory sharing code never really worked in the way we needed it to - so remove it until something better comes along. Reviewed-by: trustme --- .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c | 60 ---------------------- .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h | 15 ------ 2 files changed, 75 deletions(-) diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c index c1b655a..17345a9 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c @@ -828,63 +828,3 @@ void pvrQwsSetSwapFunction drawable->swapFunction = func; drawable->userData = userData; } - -unsigned long pvrQwsGetMemoryId(PvrQwsDrawable *drawable) -{ - unsigned long addr; - unsigned long start; - unsigned long end; - unsigned long off; - unsigned long offset; - FILE *file; - char buffer[BUFSIZ]; - char flags[16]; - - if (!drawable->backBuffersValid) - return 0; - addr = (unsigned long) - (drawable->backBuffers[drawable->currentBackBuffer]->pBase); - - /* Search /proc/self/maps for the memory region that contains "addr". - The file offset for that memory region is the identifier we need */ - file = fopen("/proc/self/maps", "r"); - if (!file) { - perror("/proc/self/maps"); - return 0; - } - offset = 0; - while (fgets(buffer, sizeof(buffer), file)) { - if (sscanf(buffer, "%lx-%lx %s %lx", - &start, &end, flags, &off) < 4) - continue; - if (start <= addr && addr < end) { - offset = off; - break; - } - } - fclose(file); - return offset; -} - -void *pvrQwsMapMemory(unsigned long id, int size) -{ - void *addr; - int fd = open("/dev/pvrsrv", O_RDWR, 0); - if (fd < 0) { - perror("/dev/pvrsrv"); - return 0; - } - addr = mmap(0, (size_t)size, PROT_READ | PROT_WRITE, - MAP_SHARED, fd, (off_t)id); - if (addr == (void *)(-1)) { - perror("mmap pvr memory region"); - addr = 0; - } - close(fd); - return addr; -} - -void pvrQwsUnmapMemory(void *addr, int size) -{ - munmap(addr, size); -} diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h index b9e035f..55e0310 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h @@ -162,21 +162,6 @@ int pvrQwsSwapBuffers(PvrQwsDrawable *drawable, int repaintOnly); void pvrQwsSetSwapFunction (PvrQwsDrawable *drawable, PvrQwsSwapFunction func, void *userData); -/* Get a memory identifier for the indicated drawable's buffer. - The identifier can be passed to another process and then - passed to pvrQwsMapMemory() to map the drawable's buffer into - the other process's address space. Returns zero if the - memory identifier could not be determined. This should only - be used for pixmap drawables */ -unsigned long pvrQwsGetMemoryId(PvrQwsDrawable *drawable); - -/* Map the memory buffer of a foreign application's drawable, as - indicated by "id" and "size". Returns null if the map failed */ -void *pvrQwsMapMemory(unsigned long id, int size); - -/* Unmap the memory obtained from pvrQwsMapMemory() */ -void pvrQwsUnmapMemory(void *addr, int size); - #ifdef __cplusplus }; #endif -- cgit v0.12 From 5b82db6e59aee775a5acc477d6e9dac9c453876d Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Sun, 18 Oct 2009 18:02:00 +0200 Subject: Cocoa: modal window reappears on screen after reactivating app If you close a modal window, then activate different app, then activate app again, the window will pop non-modal in front. This patch makes sure that when we hide a window, we point to the next window to receive keyboard focus. Rev-By: MortenS --- src/gui/kernel/qwidget_mac.mm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index c966aa3..05c6a5b 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -305,6 +305,8 @@ bool qt_mac_insideKeyWindow(const QWidget *w) { #ifdef QT_MAC_USE_COCOA return [[reinterpret_cast(w->winId()) window] isKeyWindow]; +#else + Q_UNUSED(w); #endif return false; } @@ -3301,7 +3303,11 @@ void QWidgetPrivate::show_sys() [window miniaturize:window]; #endif } else if (!q->testAttribute(Qt::WA_ShowWithoutActivating)) { +#ifndef QT_MAC_USE_COCOA qt_event_request_activate(q); +#else + [qt_mac_window_for(q) makeKeyWindow]; +#endif } } else if(topData()->embedded || !q->parentWidget() || q->parentWidget()->isVisible()) { #ifndef QT_MAC_USE_COCOA @@ -3404,8 +3410,13 @@ void QWidgetPrivate::hide_sys() } #endif } - if(w && w->isVisible() && !w->isMinimized()) - qt_event_request_activate(w); + if(w && w->isVisible() && !w->isMinimized()) { +#ifndef QT_MAC_USE_COCOA + qt_event_request_activate(w); +#else + [qt_mac_window_for(w) makeKeyWindow]; +#endif + } } } else { invalidateBuffer(q->rect()); -- cgit v0.12 From 4ae09215de36fcfd17dc6875aca102d784d65012 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 20 Oct 2009 16:55:06 +1000 Subject: The shipped pvr2d.h/wsegl.h for PowerVR do not work with MBX Reviewed-by: trustme --- src/plugins/gfxdrivers/powervr/README | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/gfxdrivers/powervr/README b/src/plugins/gfxdrivers/powervr/README index 322a6b2..513e7f5 100644 --- a/src/plugins/gfxdrivers/powervr/README +++ b/src/plugins/gfxdrivers/powervr/README @@ -31,9 +31,10 @@ strictly Unix-style markers. * IMPORTANT: To build the QScreen plugin and the WSEGL library it depends * * on, the pvr2d.h, wsegl.h headers for your platform are required. You * * can find a copy of these headers in src/3rdparty/powervr for SGX based * -* platforms like the TI OMAP3xxx. They may also work on MBX platforms too * -* depending on how old your libEGL is. You can tell Qt where to find * -* these headers by setting QMAKE_INCDIR_POWERVR in the mkspec. * +* platforms like the TI OMAP3xxx. They probably will not work on MBX * +* because of differences in the layout of certain PVR2D structures. * +* You can tell Qt where to find the actual headers for your system by * +* setting QMAKE_INCDIR_POWERVR in the mkspec. * *************************************************************************** When you start a Qt/Embedded application, you should modify the QWS_DISPLAY -- cgit v0.12 From a210a1efb3a255235ab22e618c61d0aaccba3d9f Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 20 Oct 2009 10:39:56 +0200 Subject: QToolButton popup menu is shown at wrong position when embedded in a QGraphicsView. The main problem here is that QWidget assume that they are in the screen somewhere, which means inside the available geometry provided by QDesktopWidget. But in QGraphicsView the button can be in a position that is way bigger than the screen resolution. Lot of widgets make this assumption when positionning subpopups or submenus. Instead of applying the same code on tons of QWidgets, it's better to have an helper function in desktop widget which catch this case. It's not pretty (since it has nothing to do with QDesktopWidget) but we don't have better solution. Task-number:QTBUG-3822 Reviewed-by:brad --- src/gui/kernel/kernel.pri | 1 + src/gui/kernel/qdesktopwidget.cpp | 67 +++++++++++++++++++++++++++++++++++++++ src/gui/kernel/qdesktopwidget.h | 6 ++-- src/gui/kernel/qwidget.cpp | 22 ++----------- src/gui/kernel/qwidget_p.h | 53 +++++++++++++++++++++++++++++-- src/gui/widgets/qmenu.cpp | 31 +++++++++++++++--- src/gui/widgets/qmenu_p.h | 3 +- src/gui/widgets/qpushbutton.cpp | 4 +-- 8 files changed, 155 insertions(+), 32 deletions(-) create mode 100644 src/gui/kernel/qdesktopwidget.cpp diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 53c2611..8859358 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -84,6 +84,7 @@ SOURCES += \ kernel/qgesturerecognizer.cpp \ kernel/qgesturemanager.cpp \ kernel/qsoftkeymanager.cpp \ + kernel/qdesktopwidget.cpp \ kernel/qguiplatformplugin.cpp win32 { diff --git a/src/gui/kernel/qdesktopwidget.cpp b/src/gui/kernel/qdesktopwidget.cpp new file mode 100644 index 0000000..b1e1008 --- /dev/null +++ b/src/gui/kernel/qdesktopwidget.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qglobal.h" + +QT_BEGIN_NAMESPACE + +#include "qdesktopwidget.h" +#include "qwidget_p.h" + +const QRect QDesktopWidget::screenGeometry(const QWidget *widget) const +{ + QRect rect = QWidgetPrivate::screenGeometry(widget); + if (rect.isNull()) + return screenGeometry(screenNumber(widget)); + else return rect; +} + +const QRect QDesktopWidget::availableGeometry(const QWidget *widget) const +{ + QRect rect = QWidgetPrivate::screenGeometry(widget); + if (rect.isNull()) + return availableGeometry(screenNumber(widget)); + else + return rect; +} + +QT_END_NAMESPACE + diff --git a/src/gui/kernel/qdesktopwidget.h b/src/gui/kernel/qdesktopwidget.h index 85f479e..6e3447c 100644 --- a/src/gui/kernel/qdesktopwidget.h +++ b/src/gui/kernel/qdesktopwidget.h @@ -75,14 +75,12 @@ public: QWidget *screen(int screen = -1); const QRect screenGeometry(int screen = -1) const; - const QRect screenGeometry(const QWidget *widget) const - { return screenGeometry(screenNumber(widget)); } + const QRect screenGeometry(const QWidget *widget) const; const QRect screenGeometry(const QPoint &point) const { return screenGeometry(screenNumber(point)); } const QRect availableGeometry(int screen = -1) const; - const QRect availableGeometry(const QWidget *widget) const - { return availableGeometry(screenNumber(widget)); } + const QRect availableGeometry(const QWidget *widget) const; const QRect availableGeometry(const QPoint &point) const { return availableGeometry(screenNumber(point)); } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 7dc3ae9..e561aca 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -149,24 +149,6 @@ static inline bool hasBackingStoreSupport() #endif } -/*! - \internal - - Returns true if \a p or any of its parents enable the - Qt::BypassGraphicsProxyWidget window flag. Used in QWidget::show() and - QWidget::setParent() to determine whether it's necessary to embed the - widget into a QGraphicsProxyWidget or not. -*/ -static inline bool bypassGraphicsProxyWidget(QWidget *p) -{ - while (p) { - if (p->windowFlags() & Qt::BypassGraphicsProxyWidget) - return true; - p = p->parentWidget(); - } - return false; -} - #ifdef Q_WS_MAC # define QT_NO_PAINT_DEBUG #endif @@ -5473,6 +5455,7 @@ QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint * return pixmap; } +#ifndef QT_NO_GRAPHICSVIEW /*! \internal @@ -5481,7 +5464,7 @@ QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint * If successful, the function returns the proxy that embeds the widget, or 0 if no embedded widget was found. */ -QGraphicsProxyWidget * QWidgetPrivate::nearestGraphicsProxyWidget(QWidget *origin) +QGraphicsProxyWidget * QWidgetPrivate::nearestGraphicsProxyWidget(const QWidget *origin) { if (origin) { QWExtra *extra = origin->d_func()->extra; @@ -5491,6 +5474,7 @@ QGraphicsProxyWidget * QWidgetPrivate::nearestGraphicsProxyWidget(QWidget *origi } return 0; } +#endif /*! \property QWidget::locale diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index a549740..2132474 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -63,7 +63,9 @@ #include "QtGui/qstyle.h" #include "QtGui/qapplication.h" #include - +#include "QtGui/qgraphicsproxywidget.h" +#include "QtGui/qgraphicsscene.h" +#include "QtGui/qgraphicsview.h" #include #ifdef Q_WS_WIN @@ -180,7 +182,9 @@ struct QWExtra { // Regular pointers (keep them together to avoid gaps on 64 bits architectures). void *glContext; // if the widget is hijacked by QGLWindowSurface QTLWExtra *topextra; // only useful for TLWs +#ifndef QT_NO_GRAPHICSVIEW QGraphicsProxyWidget *proxyWidget; // if the widget is embedded +#endif #ifndef QT_NO_CURSOR QCursor *curs; #endif @@ -235,6 +239,24 @@ struct QWExtra { #endif }; +/*! + \internal + + Returns true if \a p or any of its parents enable the + Qt::BypassGraphicsProxyWidget window flag. Used in QWidget::show() and + QWidget::setParent() to determine whether it's necessary to embed the + widget into a QGraphicsProxyWidget or not. +*/ +static inline bool bypassGraphicsProxyWidget(const QWidget *p) +{ + while (p) { + if (p->windowFlags() & Qt::BypassGraphicsProxyWidget) + return true; + p = p->parentWidget(); + } + return false; +} + class Q_GUI_EXPORT QWidgetPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QWidget) @@ -344,7 +366,9 @@ public: QPainter *beginSharedPainter(); bool endSharedPainter(); - static QGraphicsProxyWidget * nearestGraphicsProxyWidget(QWidget *origin); +#ifndef QT_NO_GRAPHICSVIEW + static QGraphicsProxyWidget * nearestGraphicsProxyWidget(const QWidget *origin); +#endif QWindowSurface *createDefaultWindowSurface(); QWindowSurface *createDefaultWindowSurface_sys(); void repaint_sys(const QRegion &rgn); @@ -441,6 +465,31 @@ public: void setModal_sys(); + // This is an helper function that return the available geometry for + // a widget and takes care is this one is in QGraphicsView. + // If the widget is not embed in a scene then the geometry available is + // null, we let QDesktopWidget decide for us. + static QRect screenGeometry(const QWidget *widget) + { + QRect screen; +#ifndef QT_NO_GRAPHICSVIEW + QGraphicsProxyWidget *ancestorProxy = widget->d_func()->nearestGraphicsProxyWidget(widget); + //It's embedded if it has an ancestor + if (ancestorProxy) { + if (!bypassGraphicsProxyWidget(widget)) { + // One view, let be smart and return the viewport rect then the popup is aligned + if (ancestorProxy->scene()->views().size() == 1) { + QGraphicsView *view = ancestorProxy->scene()->views().at(0); + screen = view->mapToScene(view->viewport()->rect()).boundingRect().toRect(); + } else { + screen = ancestorProxy->scene()->sceneRect().toRect(); + } + } + } +#endif + return screen; + } + inline void setRedirected(QPaintDevice *replacement, const QPoint &offset) { Q_ASSERT(q_func()->testAttribute(Qt::WA_WState_InPaintEvent)); diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 687e1bc..324bc90 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -180,6 +180,21 @@ int QMenuPrivate::scrollerHeight() const } //Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't +QRect QMenuPrivate::popupGeometry(const QWidget *widget) const +{ +#ifdef Q_WS_WIN + return QApplication::desktop()->screenGeometry(widget); +#elif defined Q_WS_X11 + if (X11->desktopEnvironment == DE_KDE) + return QApplication::desktop()->screenGeometry(widget); + else + return QApplication::desktop()->availableGeometry(widget); +#else + return QApplication::desktop()->availableGeometry(widget); +#endif +} + +//Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't QRect QMenuPrivate::popupGeometry(int screen) const { #ifdef Q_WS_WIN @@ -234,7 +249,7 @@ void QMenuPrivate::updateActionRects() const } int max_column_width = 0, - dh = popupGeometry(QApplication::desktop()->screenNumber(q)).height(), + dh = popupGeometry(q).height(), y = 0; QStyle *style = q->style(); QStyleOption opt; @@ -744,7 +759,7 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc if (newScrollFlags & QMenuScroller::ScrollUp) newOffset -= vmargin; - QRect screen = popupGeometry(QApplication::desktop()->screenNumber(q)); + QRect screen = popupGeometry(q); const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, q); if (q->height() < screen.height()-(desktopFrame*2)-1) { QRect geom = q->geometry(); @@ -1789,7 +1804,15 @@ void QMenu::popup(const QPoint &p, QAction *atAction) d->updateActionRects(); QPoint pos = p; QSize size = sizeHint(); - QRect screen = d->popupGeometry(QApplication::desktop()->screenNumber(p)); + QRect screen; +#ifndef QT_NO_GRAPHICSVIEW + bool isEmbedded = d->nearestGraphicsProxyWidget(this); + if (isEmbedded) + screen = d->popupGeometry(this); + else +#endif + screen = d->popupGeometry(QApplication::desktop()->screenNumber(p)); + const int desktopFrame = style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, this); bool adjustToDesktop = !window()->testAttribute(Qt::WA_DontShowOnScreen); #ifdef QT_KEYPAD_NAVIGATION @@ -2927,7 +2950,7 @@ void QMenu::internalDelayedPopup() QPoint pos(rightPos); QMenu *caused = qobject_cast(d->activeMenu->d_func()->causedPopup.widget); - const QRect availGeometry(d->popupGeometry(QApplication::desktop()->screenNumber(caused))); + const QRect availGeometry(d->popupGeometry(caused)); if (isRightToLeft()) { pos = leftPos; if ((caused && caused->x() < x()) || pos.x() < availGeometry.left()) { diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index 9c4f260..6a8e4b0 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -192,7 +192,8 @@ public: mutable QVector actionRects; mutable QWidgetList widgetItems; void updateActionRects() const; - QRect popupGeometry(int screen=-1) const; + QRect popupGeometry(const QWidget *widget) const; + QRect popupGeometry(int screen = -1) const; mutable uint ncols : 4; //4 bits is probably plenty uint collapsibleSeparators : 1; diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp index 1352e1b..eb34336 100644 --- a/src/gui/widgets/qpushbutton.cpp +++ b/src/gui/widgets/qpushbutton.cpp @@ -590,7 +590,7 @@ void QPushButtonPrivate::_q_popupPressed() int x = globalPos.x(); int y = globalPos.y(); if (horizontal) { - if (globalPos.y() + rect.height() + menuSize.height() <= QApplication::desktop()->height()) { + if (globalPos.y() + rect.height() + menuSize.height() <= QApplication::desktop()->availableGeometry(q).height()) { y += rect.height(); } else { y -= menuSize.height(); @@ -598,7 +598,7 @@ void QPushButtonPrivate::_q_popupPressed() if (q->layoutDirection() == Qt::RightToLeft) x += rect.width() - menuSize.width(); } else { - if (globalPos.x() + rect.width() + menu->sizeHint().width() <= QApplication::desktop()->width()) + if (globalPos.x() + rect.width() + menu->sizeHint().width() <= QApplication::desktop()->availableGeometry(q).width()) x += rect.width(); else x -= menuSize.width(); -- cgit v0.12 From 6c1388ee5a3c4796d7ce09f0cbbc1700ab574ce4 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 20 Oct 2009 10:39:42 +0200 Subject: Fixed wrong scrolling in QListView with hidden rows in ListMode The flow positions in ScrollPerItem mode did not take the hidden rows into account when configuring the vertical scroll bar. A mapping between the scroll bar value and the flow position has been added. Auto-test included. Task-number: QTBUG-2233 Reviewed-by: Thierry --- src/gui/itemviews/qlistview.cpp | 24 +++++++++++++++++------- src/gui/itemviews/qlistview_p.h | 1 + tests/auto/qlistview/tst_qlistview.cpp | 25 +++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 1d9b6e0..88002e0 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1900,7 +1900,7 @@ void QListModeViewBase::updateVerticalScrollBar(const QSize &step) if (verticalScrollMode() == QAbstractItemView::ScrollPerItem && ((flow() == QListView::TopToBottom && !isWrapping()) || (flow() == QListView::LeftToRight && isWrapping()))) { - const int steps = (flow() == QListView::TopToBottom ? flowPositions : segmentPositions).count() - 1; + const int steps = (flow() == QListView::TopToBottom ? scrollValueMap : segmentPositions).count() - 1; if (steps > 0) { const int pageSteps = perItemScrollingPageSteps(viewport()->height(), contentsSize.height(), isWrapping()); verticalScrollBar()->setSingleStep(1); @@ -1939,7 +1939,7 @@ int QListModeViewBase::verticalScrollToValue(int index, QListView::ScrollHint hi bool above, bool below, const QRect &area, const QRect &rect) const { if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) { - int value = qBound(0, verticalScrollBar()->value(), flowPositions.count() - 1); + int value = qBound(0, scrollValueMap.at(verticalScrollBar()->value()), flowPositions.count() - 1); if (above) hint = QListView::PositionAtTop; else if (below) @@ -1986,9 +1986,9 @@ int QListModeViewBase::verticalOffset() const } } else if (flow() == QListView::TopToBottom && !flowPositions.isEmpty()) { int value = verticalScrollBar()->value(); - if (value > flowPositions.count()) + if (value > scrollValueMap.count()) return 0; - return flowPositions.at(value) - spacing(); + return flowPositions.at(scrollValueMap.at(value)) - spacing(); } } return QCommonListViewBase::verticalOffset(); @@ -2043,8 +2043,8 @@ void QListModeViewBase::scrollContentsBy(int dx, int dy, bool scrollElasticBand) if (vertical && flow() == QListView::TopToBottom && dy != 0) { int currentValue = qBound(0, verticalValue, max); int previousValue = qBound(0, currentValue + dy, max); - int currentCoordinate = flowPositions.at(currentValue); - int previousCoordinate = flowPositions.at(previousValue); + int currentCoordinate = flowPositions.at(scrollValueMap.at(currentValue)); + int previousCoordinate = flowPositions.at(scrollValueMap.at(previousValue)); dy = previousCoordinate - currentCoordinate; } else if (horizontal && flow() == QListView::LeftToRight && dx != 0) { int currentValue = qBound(0, horizontalValue, max); @@ -2113,6 +2113,7 @@ QPoint QListModeViewBase::initStaticLayout(const QListViewLayoutInfo &info) segmentPositions.clear(); segmentStartRows.clear(); segmentExtents.clear(); + scrollValueMap.clear(); x = info.bounds.left() + info.spacing; y = info.bounds.top() + info.spacing; segmentPositions.append(info.flow == QListView::LeftToRight ? y : x); @@ -2204,6 +2205,7 @@ void QListModeViewBase::doStaticLayout(const QListViewLayoutInfo &info) deltaSegPosition = 0; } // save the flow position of this item + scrollValueMap.append(flowPositions.count()); flowPositions.append(flowPosition); // prepare for the next item deltaSegPosition = qMax(deltaSegHint, deltaSegPosition); @@ -2229,6 +2231,7 @@ void QListModeViewBase::doStaticLayout(const QListViewLayoutInfo &info) // if it is the last batch, save the end of the segments if (info.last == info.max) { segmentExtents.append(flowPosition); + scrollValueMap.append(flowPositions.count()); flowPositions.append(flowPosition); segmentPositions.append(info.wrap ? segPosition + deltaSegPosition : INT_MAX); } @@ -2306,7 +2309,14 @@ QRect QListModeViewBase::mapToViewport(const QRect &rect) const int QListModeViewBase::perItemScrollingPageSteps(int length, int bounds, bool wrap) const { - const QVector positions = (wrap ? segmentPositions : flowPositions); + QVector positions; + if (wrap) + positions = segmentPositions; + else { + positions.reserve(scrollValueMap.size()); + foreach (int itemShown, scrollValueMap) + positions.append(flowPositions.at(itemShown)); + } if (positions.isEmpty() || bounds <= length) return positions.count(); if (uniformItemSizes()) { diff --git a/src/gui/itemviews/qlistview_p.h b/src/gui/itemviews/qlistview_p.h index b6785da..de4c7f3 100644 --- a/src/gui/itemviews/qlistview_p.h +++ b/src/gui/itemviews/qlistview_p.h @@ -205,6 +205,7 @@ public: QVector segmentPositions; QVector segmentStartRows; QVector segmentExtents; + QVector scrollValueMap; // used when laying out in batches int batchSavedPosition; diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 3ee6889..ed02317 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -117,6 +117,7 @@ private slots: void shiftSelectionWithNonUniformItemSizes(); void clickOnViewportClearsSelection(); void task262152_setModelColumnNavigate(); + void taskQTBUG_2233_scrollHiddenRows(); }; // Testing get/set functions @@ -1790,7 +1791,31 @@ void tst_QListView::task262152_setModelColumnNavigate() } +void tst_QListView::taskQTBUG_2233_scrollHiddenRows() +{ + const int rowCount = 200; + + QListView view; + QStringListModel model(&view); + QStringList list; + for (int i = 0; i < rowCount; ++i) + list << QString::fromAscii("Item %1").arg(i); + + model.setStringList(list); + view.setModel(&model); + view.setViewMode(QListView::ListMode); + view.setFlow(QListView::TopToBottom); + for (int i = 0; i < rowCount / 2; ++i) + view.setRowHidden(2 * i, true); + view.resize(250, 130); + for (int i = 0; i < 10; ++i) { + view.verticalScrollBar()->setValue(i); + QModelIndex index = view.indexAt(QPoint(20,0)); + QVERIFY(index.isValid()); + QCOMPARE(index.row(), 2 * i + 1); + } +} QTEST_MAIN(tst_QListView) #include "tst_qlistview.moc" -- cgit v0.12 From 3d4804a229e6cb869aa03481dd871e756ffa35ae Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 20 Oct 2009 11:08:04 +0200 Subject: Revert "Change the way we handle KeyboardUIMode on Mac" This will be handled differently (QTBUG-4751) This reverts commit b12fb5861ce09539c04cd51db12a9bfbe32a4774. --- src/corelib/global/qnamespace.qdoc | 4 +++- src/gui/kernel/qapplication.cpp | 20 ++++---------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index ba05b00..e8d6df0 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1827,7 +1827,9 @@ \value TabFocus the widget accepts focus by tabbing. \value ClickFocus the widget accepts focus by clicking. \value StrongFocus the widget accepts focus by both tabbing - and clicking. + and clicking. On Mac OS X this will also + be indicate that the widget accepts tab focus + when in 'Text/List focus mode'. \value WheelFocus like Qt::StrongFocus plus the widget accepts focus by using the mouse wheel. \value NoFocus the widget does not accept focus. diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 41d8098..f48c551 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -68,9 +68,6 @@ #include "private/qstylesheetstyle_p.h" #include "private/qstyle_p.h" #include "qmessagebox.h" -#include "qlineedit.h" -#include "qlistview.h" -#include "qtextedit.h" #include #include "qinputcontext.h" @@ -2501,6 +2498,8 @@ void QApplication::setActiveWindow(QWidget* act) */ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool next) { + uint focus_flag = qt_tab_all_widgets ? Qt::TabFocus : Qt::StrongFocus; + QWidget *f = toplevel->focusWidget(); if (!f) f = toplevel; @@ -2508,22 +2507,11 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool QWidget *w = f; QWidget *test = f->d_func()->focus_next; while (test && test != f) { - if ((test->focusPolicy() & Qt::TabFocus) + if ((test->focusPolicy() & focus_flag) == focus_flag && !(test->d_func()->extra && test->d_func()->extra->focus_proxy) && test->isVisibleTo(toplevel) && test->isEnabled() && !(w->windowType() == Qt::SubWindow && !w->isAncestorOf(test)) - && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test)) - && (qt_tab_all_widgets -#ifndef QT_NO_LINEEDIT - || qobject_cast(test) -#endif -#ifndef QT_NO_TEXTEDIT - || qobject_cast(test) -#endif -#ifndef QT_NO_ITEMVIEWS - || qobject_cast(test) -#endif - )) { + && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))) { w = test; if (next) break; -- cgit v0.12 From 63b574ee1539b34ac7df890a7941320deb1c258e Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 20 Oct 2009 11:52:38 +0200 Subject: Fix bug in embedded dialog demo with tab focus. On embedded dialog pressing tab stop changing the focus when the focus was given to QFontComboBox. It's because QFontComboBox embed a QLineEdit in order to allow editing. But this QLineEdit is a focus proxy so we need to special case that. The logic is the same in QApplication. Be careful when changing one of them. Task-number:QTBUG-4818 Reviewed-by:jan-arve Reviewed-by:ogoffart --- src/gui/graphicsview/qgraphicsproxywidget.cpp | 15 ++++++-- src/gui/kernel/qapplication.cpp | 1 + .../tst_qgraphicsproxywidget.cpp | 45 +++++++++++++++++++++- 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index b7a3962..64c51ad 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -57,6 +57,9 @@ #include #include #include +#include +#include +#include QT_BEGIN_NAMESPACE @@ -86,7 +89,9 @@ QT_BEGIN_NAMESPACE of embedded widgets through creating a child proxy for each popup. This means that when an embedded QComboBox shows its popup list, a new QGraphicsProxyWidget is created automatically, embedding the popup, and - positioning it correctly. + positioning it correctly. This only works if the popup is child of the + embedded widget (for example QToolButton::setMenu() requires the QMenu instance + to be child of the QToolButton). \section1 Embedding a Widget with QGraphicsProxyWidget @@ -184,6 +189,7 @@ QT_BEGIN_NAMESPACE */ extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); +extern bool qt_tab_all_widgets; /*! \internal @@ -369,6 +375,7 @@ QVariant QGraphicsProxyWidgetPrivate::inputMethodQueryHelper(Qt::InputMethodQuer /*! \internal + Some of the logic is shared with QApplicationPrivate::focusNextPrevChild_helper */ QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next) const { @@ -382,14 +389,16 @@ QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next) child = next ? child->d_func()->focus_next : child->d_func()->focus_prev; if ((next && child == widget) || (!next && child == widget->d_func()->focus_prev)) { return 0; - } + } } QWidget *oldChild = child; + uint focus_flag = qt_tab_all_widgets ? Qt::TabFocus : Qt::StrongFocus; do { if (child->isEnabled() && child->isVisibleTo(widget) - && (child->focusPolicy() & Qt::TabFocus)) { + && (child->focusPolicy() & focus_flag == focus_flag) + && !(child->d_func()->extra && child->d_func()->extra->focus_proxy)) { return child; } child = next ? child->d_func()->focus_next : child->d_func()->focus_prev; diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index f48c551..c4249d9 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2495,6 +2495,7 @@ void QApplication::setActiveWindow(QWidget* act) /*!internal * Helper function that returns the new focus widget, but does not set the focus reason. * Returns 0 if a new focus widget could not be found. + * Shared with QGraphicsProxyWidgetPrivate::findFocusChild() */ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool next) { diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 2426ce9..9269164 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -2007,8 +2007,10 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() edit1->setText("QLineEdit 1"); QLineEdit *edit2 = new QLineEdit; edit2->setText("QLineEdit 2"); + QFontComboBox *fontComboBox = new QFontComboBox; QVBoxLayout *vlayout = new QVBoxLayout; vlayout->addWidget(edit1); + vlayout->addWidget(fontComboBox); vlayout->addWidget(edit2); QGroupBox *box = new QGroupBox("QGroupBox"); @@ -2020,8 +2022,10 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() edit1_2->setText("QLineEdit 1_2"); QLineEdit *edit2_2 = new QLineEdit; edit2_2->setText("QLineEdit 2_2"); + QFontComboBox *fontComboBox2 = new QFontComboBox; vlayout = new QVBoxLayout; vlayout->addWidget(edit1_2); + vlayout->addWidget(fontComboBox2); vlayout->addWidget(edit2_2); QGroupBox *box_2 = new QGroupBox("QGroupBox 2"); @@ -2062,8 +2066,10 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() EventSpy eventSpy(edit1); EventSpy eventSpy2(edit2); + EventSpy eventSpy3(fontComboBox); EventSpy eventSpy1_2(edit1_2); EventSpy eventSpy2_2(edit2_2); + EventSpy eventSpy2_3(fontComboBox2); EventSpy eventSpyBox(box); // Tab into group box @@ -2084,11 +2090,24 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() QCOMPARE(eventSpy.counts[QEvent::FocusIn], 1); QCOMPARE(eventSpy.counts[QEvent::FocusOut], 0); + // Tab to the font combobox + QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); + QApplication::processEvents(); + fontComboBox->hasFocus(); + QVERIFY(!edit2->hasFocus()); + QCOMPARE(eventSpy3.counts[QEvent::FocusIn], 1); + QCOMPARE(eventSpy3.counts[QEvent::FocusOut], 0); + QCOMPARE(eventSpy.counts[QEvent::FocusIn], 1); + QCOMPARE(eventSpy.counts[QEvent::FocusOut], 1); + // Tab into line edit 2 QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); QApplication::processEvents(); edit2->hasFocus(); QVERIFY(!edit1->hasFocus()); + QCOMPARE(eventSpy2.counts[QEvent::FocusIn], 1); + QCOMPARE(eventSpy2.counts[QEvent::FocusOut], 0); + QCOMPARE(eventSpy3.counts[QEvent::FocusOut], 1); QCOMPARE(eventSpy.counts[QEvent::FocusIn], 1); QCOMPARE(eventSpy.counts[QEvent::FocusOut], 1); @@ -2106,6 +2125,16 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() QCOMPARE(eventSpy1_2.counts[QEvent::FocusIn], 1); QCOMPARE(eventSpy1_2.counts[QEvent::FocusOut], 0); + // Tab into right font combobox + QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); + QApplication::processEvents(); + QVERIFY(!edit1_2->hasFocus()); + fontComboBox2->hasFocus(); + QCOMPARE(eventSpy1_2.counts[QEvent::FocusIn], 1); + QCOMPARE(eventSpy1_2.counts[QEvent::FocusOut], 1); + QCOMPARE(eventSpy2_3.counts[QEvent::FocusIn], 1); + QCOMPARE(eventSpy2_3.counts[QEvent::FocusOut], 0); + // Tab into right bottom line edit QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); QApplication::processEvents(); @@ -2113,6 +2142,8 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() edit2_2->hasFocus(); QCOMPARE(eventSpy1_2.counts[QEvent::FocusIn], 1); QCOMPARE(eventSpy1_2.counts[QEvent::FocusOut], 1); + QCOMPARE(eventSpy2_3.counts[QEvent::FocusIn], 1); + QCOMPARE(eventSpy2_3.counts[QEvent::FocusOut], 1); QCOMPARE(eventSpy2_2.counts[QEvent::FocusIn], 1); QCOMPARE(eventSpy2_2.counts[QEvent::FocusOut], 0); @@ -2129,6 +2160,12 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() QVERIFY(!rightDial->hasFocus()); edit2_2->hasFocus(); + // Backtab into the right font combobox + QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); + QApplication::processEvents(); + QVERIFY(!edit2_2->hasFocus()); + fontComboBox2->hasFocus(); + // Backtab into line edit 1 QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); QApplication::processEvents(); @@ -2147,10 +2184,16 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() QVERIFY(!rightDial->hasFocus()); edit2->hasFocus(); - // Backtab into line edit 1 + // Backtab into the font combobox QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); QApplication::processEvents(); QVERIFY(!edit2->hasFocus()); + fontComboBox->hasFocus(); + + // Backtab into line edit 1 + QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); + QApplication::processEvents(); + QVERIFY(!fontComboBox->hasFocus()); edit1->hasFocus(); // Backtab into line box -- cgit v0.12 From 27df4f3fe6c290f22d509f677e46c7096156817b Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 20 Oct 2009 12:46:43 +0200 Subject: Make the total duration of animation be 0 if duration is 0 --- src/corelib/animation/qabstractanimation.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index c775a00..e83fad7 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -328,9 +328,9 @@ int QUnifiedTimer::closestPauseAnimationTimeToFinish() int timeToFinish; if (animation->direction() == QAbstractAnimation::Forward) - timeToFinish = animation->totalDuration() - QAbstractAnimationPrivate::get(animation)->totalCurrentTime; + timeToFinish = animation->duration() - animation->currentTime(); else - timeToFinish = QAbstractAnimationPrivate::get(animation)->totalCurrentTime; + timeToFinish = animation->currentTime(); if (timeToFinish < closestTimeToFinish) closestTimeToFinish = timeToFinish; @@ -648,13 +648,13 @@ int QAbstractAnimation::currentLoop() const */ int QAbstractAnimation::totalDuration() const { - Q_D(const QAbstractAnimation); - if (d->loopCount < 0) - return -1; int dura = duration(); - if (dura == -1) + if (dura <= 0) + return dura; + int loopcount = loopCount(); + if (loopcount < 0) return -1; - return dura * d->loopCount; + return dura * loopcount; } /*! @@ -685,7 +685,7 @@ void QAbstractAnimation::setCurrentTime(int msecs) // Calculate new time and loop. int dura = duration(); - int totalDura = (d->loopCount < 0 || dura == -1) ? -1 : dura * d->loopCount; + int totalDura = dura <= 0 ? dura : ((d->loopCount < 0) ? -1 : dura * d->loopCount); if (totalDura != -1) msecs = qMin(totalDura, msecs); d->totalCurrentTime = msecs; -- cgit v0.12 From 8b0e59706f0d7a68446b6ff5c646e2bbdef5f496 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 20 Oct 2009 12:48:24 +0200 Subject: Make the default duration of pause animations 250ms --- src/corelib/animation/qpauseanimation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp index d90f001..21e5b08 100644 --- a/src/corelib/animation/qpauseanimation.cpp +++ b/src/corelib/animation/qpauseanimation.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE class QPauseAnimationPrivate : public QAbstractAnimationPrivate { public: - QPauseAnimationPrivate() : QAbstractAnimationPrivate(), duration(0) + QPauseAnimationPrivate() : QAbstractAnimationPrivate(), duration(250) { isPause = true; } @@ -114,6 +114,7 @@ QPauseAnimation::~QPauseAnimation() \brief the duration of the pause. The duration of the pause. The duration should not be negative. + The default duration is 250 milliseconds. */ int QPauseAnimation::duration() const { -- cgit v0.12 From 462b2eae2386d22709943187820ec3f071399682 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 20 Oct 2009 12:53:04 +0200 Subject: adding autotests --- tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp index 51ef2da..7dd17e5 100644 --- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp @@ -130,6 +130,7 @@ private slots: void valueChanged(); void twoAnimations(); void deletedInUpdateCurrentTime(); + void totalDuration(); }; tst_QPropertyAnimation::tst_QPropertyAnimation() @@ -1199,5 +1200,18 @@ void tst_QPropertyAnimation::deletedInUpdateCurrentTime() QCOMPARE(o.value(), 1000); } +void tst_QPropertyAnimation::totalDuration() +{ + QPropertyAnimation anim; + QCOMPARE(anim.totalDuration(), 250); + anim.setLoopCount(2); + QCOMPARE(anim.totalDuration(), 2*250); + anim.setLoopCount(-1); + QCOMPARE(anim.totalDuration(), -1); + anim.setDuration(0); + QCOMPARE(anim.totalDuration(), 0); +} + + QTEST_MAIN(tst_QPropertyAnimation) #include "tst_qpropertyanimation.moc" -- cgit v0.12 From e0aeecfa8cc41a476bef070b349683be9aec2243 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 20 Oct 2009 13:19:33 +0200 Subject: QPauseAnimation autotests fixed --- tests/auto/qpauseanimation/tst_qpauseanimation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/qpauseanimation/tst_qpauseanimation.cpp index 62b43c4..b11efa0 100644 --- a/tests/auto/qpauseanimation/tst_qpauseanimation.cpp +++ b/tests/auto/qpauseanimation/tst_qpauseanimation.cpp @@ -169,7 +169,7 @@ void tst_QPauseAnimation::noTimerUpdates() animation.start(); QTest::qWait(animation.totalDuration() + 100); QVERIFY(animation.state() == QAbstractAnimation::Stopped); - QCOMPARE(animation.m_updateCurrentTimeCount, 2); + QCOMPARE(animation.m_updateCurrentTimeCount, 1 + loopCount); timer->setConsistentTiming(false); } @@ -399,6 +399,7 @@ void tst_QPauseAnimation::multipleSequentialGroups() void tst_QPauseAnimation::zeroDuration() { TestablePauseAnimation animation; + animation.setDuration(0); animation.start(); QTest::qWait(animation.totalDuration() + 100); QVERIFY(animation.state() == QAbstractAnimation::Stopped); -- cgit v0.12 From e64b5fa1312f42fa6377e28c11f8aa3a3413280f Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 20 Oct 2009 13:20:31 +0200 Subject: Fixed a bug in that could unregister not-registered animations --- src/corelib/animation/qabstractanimation.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index e83fad7..0d5f278 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -278,11 +278,11 @@ void QUnifiedTimer::registerAnimation(QAbstractAnimation *animation, bool isTopL void QUnifiedTimer::unregisterAnimation(QAbstractAnimation *animation) { - unregisterRunningAnimation(animation); - if (!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer) return; + unregisterRunningAnimation(animation); + int idx = animations.indexOf(animation); if (idx != -1) { animations.removeAt(idx); @@ -318,6 +318,7 @@ void QUnifiedTimer::unregisterRunningAnimation(QAbstractAnimation *animation) runningPauseAnimations.removeOne(animation); else runningLeafAnimations--; + Q_ASSERT(runningLeafAnimations >= 0); } int QUnifiedTimer::closestPauseAnimationTimeToFinish() -- cgit v0.12 From 77f055ab9474ec4d3311884c293af7ee4a2a7cb3 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 20 Oct 2009 15:52:38 +0200 Subject: Fixed QTreeView trying to animate when parent item has no child We now check that the item has children before animating. Reviewed-by: Alexis --- src/gui/itemviews/qtreeview.cpp | 6 +++--- tests/auto/qtreeview/tst_qtreeview.cpp | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 210534e..d597f5c 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2908,15 +2908,15 @@ void QTreeViewPrivate::expand(int item, bool emitSignal) layout(item); q->setState(oldState); + if (model->canFetchMore(index)) + model->fetchMore(index); if (emitSignal) { emit q->expanded(index); #ifndef QT_NO_ANIMATION - if (animationsEnabled) + if (animationsEnabled && model->hasChildren(index)) beginAnimatedOperation(); #endif //QT_NO_ANIMATION } - if (model->canFetchMore(index)) - model->fetchMore(index); } void QTreeViewPrivate::collapse(int item, bool emitSignal) diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 91b2cc5..da58725 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -172,6 +172,7 @@ private slots: void expandAndCollapse_data(); void expandAndCollapse(); void expandAndCollapseAll(); + void expandWithNoChildren(); void keyboardNavigation(); void headerSections(); void moveCursor_data(); @@ -1548,6 +1549,19 @@ void tst_QTreeView::expandAndCollapseAll() // QCOMPARE(collapsedSpy.count(), count); } +void tst_QTreeView::expandWithNoChildren() +{ + QTreeView tree; + QStandardItemModel model(1,1); + tree.setModel(&model); + tree.setAnimated(true); + tree.doItemsLayout(); + //this test should not output warnings + tree.expand(model.index(0,0)); +} + + + void tst_QTreeView::keyboardNavigation() { const int rows = 10; -- cgit v0.12 From cbca69bb0c7e3c42bf7d2d964057f38263de0553 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 20 Oct 2009 15:59:40 +0200 Subject: fix for QTreeView to not animate if there are no visible children --- src/gui/itemviews/qtreeview.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index d597f5c..f37d8c7 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2913,7 +2913,7 @@ void QTreeViewPrivate::expand(int item, bool emitSignal) if (emitSignal) { emit q->expanded(index); #ifndef QT_NO_ANIMATION - if (animationsEnabled && model->hasChildren(index)) + if (animationsEnabled) beginAnimatedOperation(); #endif //QT_NO_ANIMATION } @@ -3005,10 +3005,12 @@ void QTreeViewPrivate::beginAnimatedOperation() animatedOperation.setEndValue(animatedOperation.top() + h); } - animatedOperation.after = renderTreeToPixmapForAnimation(rect); + if (!rect.isEmpty()) { + animatedOperation.after = renderTreeToPixmapForAnimation(rect); - q->setState(QAbstractItemView::AnimatingState); - animatedOperation.start(); //let's start the animation + q->setState(QAbstractItemView::AnimatingState); + animatedOperation.start(); //let's start the animation + } } void QTreeViewPrivate::drawAnimatedOperation(QPainter *painter) const -- cgit v0.12